This revision was automatically updated to reflect the committed changes. Closed by commit rL246083: [X86][SSE] Add _mm_undefined_* intrinsics (authored by RKSimon).
Changed prior to commit: http://reviews.llvm.org/D12052?vs=32514&id=33249#toc Repository: rL LLVM http://reviews.llvm.org/D12052 Files: cfe/trunk/include/clang/Basic/BuiltinsX86.def cfe/trunk/lib/CodeGen/CGBuiltin.cpp cfe/trunk/lib/Headers/avx512fintrin.h cfe/trunk/lib/Headers/avxintrin.h cfe/trunk/lib/Headers/emmintrin.h cfe/trunk/lib/Headers/xmmintrin.h cfe/trunk/test/CodeGen/avx-builtins.c cfe/trunk/test/CodeGen/avx512f-builtins.c cfe/trunk/test/CodeGen/sse-builtins.c
Index: cfe/trunk/test/CodeGen/avx-builtins.c =================================================================== --- cfe/trunk/test/CodeGen/avx-builtins.c +++ cfe/trunk/test/CodeGen/avx-builtins.c @@ -147,3 +147,21 @@ // CHECK: insertelement <4 x i64> {{.*}}, i64 {{.*}}, i32 {{.*}} return _mm256_insert_epi64(__a, 42, 3); } + +__m256 test_mm256_undefined_ps() { + // CHECK-LABEL: @test_mm256_undefined_ps + // CHECK: ret <8 x float> undef + return _mm256_undefined_ps(); +} + +__m256d test_mm256_undefined_pd() { + // CHECK-LABEL: @test_mm256_undefined_pd + // CHECK: ret <4 x double> undef + return _mm256_undefined_pd(); +} + +__m256i test_mm256_undefined_si256() { + // CHECK-LABEL: @test_mm256_undefined_si256 + // CHECK: ret <4 x i64> undef + return _mm256_undefined_si256(); +} Index: cfe/trunk/test/CodeGen/sse-builtins.c =================================================================== --- cfe/trunk/test/CodeGen/sse-builtins.c +++ cfe/trunk/test/CodeGen/sse-builtins.c @@ -649,3 +649,21 @@ // CHECK: call <2 x i64> @llvm.x86.sse41.pmovzxdq(<4 x i32> {{.*}}) return _mm_cvtepu32_epi64(a); } + +__m128 test_mm_undefined_ps() { + // CHECK-LABEL: @test_mm_undefined_ps + // CHECK: ret <4 x float> undef + return _mm_undefined_ps(); +} + +__m128d test_mm_undefined_pd() { + // CHECK-LABEL: @test_mm_undefined_pd + // CHECK: ret <2 x double> undef + return _mm_undefined_pd(); +} + +__m128i test_mm_undefined_si128() { + // CHECK-LABEL: @test_mm_undefined_si128 + // CHECK: ret <2 x i64> undef + return _mm_undefined_si128(); +} Index: cfe/trunk/test/CodeGen/avx512f-builtins.c =================================================================== --- cfe/trunk/test/CodeGen/avx512f-builtins.c +++ cfe/trunk/test/CodeGen/avx512f-builtins.c @@ -1875,3 +1875,27 @@ // CHECK: @llvm.x86.avx512.mask.min.sd.round return _mm_maskz_min_sd(__U,__A,__B); } + +__m512 test_mm512_undefined() { + // CHECK-LABEL: @test_mm512_undefined + // CHECK: ret <16 x float> undef + return _mm512_undefined(); +} + +__m512 test_mm512_undefined_ps() { + // CHECK-LABEL: @test_mm512_undefined_ps + // CHECK: ret <16 x float> undef + return _mm512_undefined_ps(); +} + +__m512d test_mm512_undefined_pd() { + // CHECK-LABEL: @test_mm512_undefined_pd + // CHECK: ret <8 x double> undef + return _mm512_undefined_pd(); +} + +__m512i test_mm512_undefined_epi32() { + // CHECK-LABEL: @test_mm512_undefined_epi32 + // CHECK: ret <8 x i64> undef + return _mm512_undefined_epi32(); +} Index: cfe/trunk/lib/CodeGen/CGBuiltin.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp @@ -6047,6 +6047,10 @@ Value *F = CGM.getIntrinsic(Intrinsic::prefetch); return Builder.CreateCall(F, {Address, RW, Locality, Data}); } + case X86::BI__builtin_ia32_undef128: + case X86::BI__builtin_ia32_undef256: + case X86::BI__builtin_ia32_undef512: + return UndefValue::get(ConvertType(E->getType())); case X86::BI__builtin_ia32_vec_init_v8qi: case X86::BI__builtin_ia32_vec_init_v4hi: case X86::BI__builtin_ia32_vec_init_v2si: Index: cfe/trunk/lib/Headers/avx512fintrin.h =================================================================== --- cfe/trunk/lib/Headers/avx512fintrin.h +++ cfe/trunk/lib/Headers/avx512fintrin.h @@ -57,6 +57,30 @@ return (__m512i)(__v8di){ 0, 0, 0, 0, 0, 0, 0, 0 }; } +static __inline__ __m512d __DEFAULT_FN_ATTRS +_mm512_undefined_pd() +{ + return (__m512d)__builtin_ia32_undef512(); +} + +static __inline__ __m512 __DEFAULT_FN_ATTRS +_mm512_undefined() +{ + return (__m512)__builtin_ia32_undef512(); +} + +static __inline__ __m512 __DEFAULT_FN_ATTRS +_mm512_undefined_ps() +{ + return (__m512)__builtin_ia32_undef512(); +} + +static __inline__ __m512i __DEFAULT_FN_ATTRS +_mm512_undefined_epi32() +{ + return (__m512i)__builtin_ia32_undef512(); +} + static __inline __m512i __DEFAULT_FN_ATTRS _mm512_maskz_set1_epi32(__mmask16 __M, int __A) { Index: cfe/trunk/lib/Headers/emmintrin.h =================================================================== --- cfe/trunk/lib/Headers/emmintrin.h +++ cfe/trunk/lib/Headers/emmintrin.h @@ -523,6 +523,12 @@ } static __inline__ __m128d __DEFAULT_FN_ATTRS +_mm_undefined_pd() +{ + return (__m128d)__builtin_ia32_undef128(); +} + +static __inline__ __m128d __DEFAULT_FN_ATTRS _mm_set_sd(double __w) { return (__m128d){ __w, 0 }; @@ -1116,6 +1122,12 @@ } static __inline__ __m128i __DEFAULT_FN_ATTRS +_mm_undefined_si128() +{ + return (__m128i)__builtin_ia32_undef128(); +} + +static __inline__ __m128i __DEFAULT_FN_ATTRS _mm_set_epi64x(long long q1, long long q0) { return (__m128i){ q0, q1 }; Index: cfe/trunk/lib/Headers/xmmintrin.h =================================================================== --- cfe/trunk/lib/Headers/xmmintrin.h +++ cfe/trunk/lib/Headers/xmmintrin.h @@ -577,6 +577,12 @@ } static __inline__ __m128 __DEFAULT_FN_ATTRS +_mm_undefined_ps() +{ + return (__m128)__builtin_ia32_undef128(); +} + +static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_set_ss(float __w) { return (__m128){ __w, 0, 0, 0 }; Index: cfe/trunk/lib/Headers/avxintrin.h =================================================================== --- cfe/trunk/lib/Headers/avxintrin.h +++ cfe/trunk/lib/Headers/avxintrin.h @@ -900,6 +900,24 @@ } /* Create vectors */ +static __inline__ __m256d __DEFAULT_FN_ATTRS +_mm256_undefined_pd() +{ + return (__m256d)__builtin_ia32_undef256(); +} + +static __inline__ __m256 __DEFAULT_FN_ATTRS +_mm256_undefined_ps() +{ + return (__m256)__builtin_ia32_undef256(); +} + +static __inline__ __m256i __DEFAULT_FN_ATTRS +_mm256_undefined_si256() +{ + return (__m256i)__builtin_ia32_undef256(); +} + static __inline __m256d __DEFAULT_FN_ATTRS _mm256_set_pd(double __a, double __b, double __c, double __d) { Index: cfe/trunk/include/clang/Basic/BuiltinsX86.def =================================================================== --- cfe/trunk/include/clang/Basic/BuiltinsX86.def +++ cfe/trunk/include/clang/Basic/BuiltinsX86.def @@ -30,6 +30,12 @@ // can use it? BUILTIN(__builtin_cpu_supports, "bcC*", "nc") +// Undefined Values +// +TARGET_BUILTIN(__builtin_ia32_undef128, "V2d", "nc", "") +TARGET_BUILTIN(__builtin_ia32_undef256, "V4d", "nc", "") +TARGET_BUILTIN(__builtin_ia32_undef512, "V8d", "nc", "") + // 3DNow! // TARGET_BUILTIN(__builtin_ia32_femms, "v", "", "3dnow")
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits