From 8de5abc4c880bdbafdd16ee9d2ba3ea35b03fe7c Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Fri, 25 Jan 2019 07:08:22 +0000 Subject: [PATCH] [X86] Remove mask and passthru arguments from vpconflict builtins. Use select in IR instead. llvm-svn: 352173 --- clang/include/clang/Basic/BuiltinsX86.def | 12 ++--- clang/lib/Headers/avx512cdintrin.h | 32 +++++------ clang/lib/Headers/avx512vlcdintrin.h | 66 ++++++++++------------- clang/test/CodeGen/avx512cdintrin.c | 16 +++--- clang/test/CodeGen/avx512vlcd-builtins.c | 32 ++++++----- 5 files changed, 78 insertions(+), 80 deletions(-) diff --git a/clang/include/clang/Basic/BuiltinsX86.def b/clang/include/clang/Basic/BuiltinsX86.def index 7c72d4fd5c09..373ff247735f 100644 --- a/clang/include/clang/Basic/BuiltinsX86.def +++ b/clang/include/clang/Basic/BuiltinsX86.def @@ -1067,12 +1067,12 @@ TARGET_BUILTIN(__builtin_ia32_psubsw512, "V32sV32sV32s", "ncV:512:", "avx512bw") TARGET_BUILTIN(__builtin_ia32_psubusb512, "V64cV64cV64c", "ncV:512:", "avx512bw") TARGET_BUILTIN(__builtin_ia32_psubusw512, "V32sV32sV32s", "ncV:512:", "avx512bw") -TARGET_BUILTIN(__builtin_ia32_vpconflictdi_128_mask, "V2LLiV2LLiV2LLiUc", "ncV:128:", "avx512cd,avx512vl") -TARGET_BUILTIN(__builtin_ia32_vpconflictdi_256_mask, "V4LLiV4LLiV4LLiUc", "ncV:256:", "avx512cd,avx512vl") -TARGET_BUILTIN(__builtin_ia32_vpconflictsi_128_mask, "V4iV4iV4iUc", "ncV:128:", "avx512cd,avx512vl") -TARGET_BUILTIN(__builtin_ia32_vpconflictsi_256_mask, "V8iV8iV8iUc", "ncV:256:", "avx512cd,avx512vl") -TARGET_BUILTIN(__builtin_ia32_vpconflictdi_512_mask, "V8LLiV8LLiV8LLiUc", "ncV:512:", "avx512cd") -TARGET_BUILTIN(__builtin_ia32_vpconflictsi_512_mask, "V16iV16iV16iUs", "ncV:512:", "avx512cd") +TARGET_BUILTIN(__builtin_ia32_vpconflictdi_128, "V2LLiV2LLi", "ncV:128:", "avx512cd,avx512vl") +TARGET_BUILTIN(__builtin_ia32_vpconflictdi_256, "V4LLiV4LLi", "ncV:256:", "avx512cd,avx512vl") +TARGET_BUILTIN(__builtin_ia32_vpconflictsi_128, "V4iV4i", "ncV:128:", "avx512cd,avx512vl") +TARGET_BUILTIN(__builtin_ia32_vpconflictsi_256, "V8iV8i", "ncV:256:", "avx512cd,avx512vl") +TARGET_BUILTIN(__builtin_ia32_vpconflictdi_512, "V8LLiV8LLi", "ncV:512:", "avx512cd") +TARGET_BUILTIN(__builtin_ia32_vpconflictsi_512, "V16iV16i", "ncV:512:", "avx512cd") TARGET_BUILTIN(__builtin_ia32_vplzcntd_512, "V16iV16i", "ncV:512:", "avx512cd") TARGET_BUILTIN(__builtin_ia32_vplzcntq_512, "V8LLiV8LLi", "ncV:512:", "avx512cd") diff --git a/clang/lib/Headers/avx512cdintrin.h b/clang/lib/Headers/avx512cdintrin.h index e63902743c06..c4c76bc6ca88 100644 --- a/clang/lib/Headers/avx512cdintrin.h +++ b/clang/lib/Headers/avx512cdintrin.h @@ -34,49 +34,45 @@ static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_conflict_epi64 (__m512i __A) { - return (__m512i) __builtin_ia32_vpconflictdi_512_mask ((__v8di) __A, - (__v8di) _mm512_setzero_si512 (), - (__mmask8) -1); + return (__m512i) __builtin_ia32_vpconflictdi_512 ((__v8di) __A); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_conflict_epi64 (__m512i __W, __mmask8 __U, __m512i __A) { - return (__m512i) __builtin_ia32_vpconflictdi_512_mask ((__v8di) __A, - (__v8di) __W, - (__mmask8) __U); + return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U, + (__v8di)_mm512_conflict_epi64(__A), + (__v8di)__W); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_conflict_epi64 (__mmask8 __U, __m512i __A) { - return (__m512i) __builtin_ia32_vpconflictdi_512_mask ((__v8di) __A, - (__v8di) _mm512_setzero_si512 (), - (__mmask8) __U); + return (__m512i)__builtin_ia32_selectq_512((__mmask8)__U, + (__v8di)_mm512_conflict_epi64(__A), + (__v8di)_mm512_setzero_si512 ()); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_conflict_epi32 (__m512i __A) { - return (__m512i) __builtin_ia32_vpconflictsi_512_mask ((__v16si) __A, - (__v16si) _mm512_setzero_si512 (), - (__mmask16) -1); + return (__m512i) __builtin_ia32_vpconflictsi_512 ((__v16si) __A); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_mask_conflict_epi32 (__m512i __W, __mmask16 __U, __m512i __A) { - return (__m512i) __builtin_ia32_vpconflictsi_512_mask ((__v16si) __A, - (__v16si) __W, - (__mmask16) __U); + return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U, + (__v16si)_mm512_conflict_epi32(__A), + (__v16si)__W); } static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_maskz_conflict_epi32 (__mmask16 __U, __m512i __A) { - return (__m512i) __builtin_ia32_vpconflictsi_512_mask ((__v16si) __A, - (__v16si) _mm512_setzero_si512 (), - (__mmask16) __U); + return (__m512i)__builtin_ia32_selectd_512((__mmask16)__U, + (__v16si)_mm512_conflict_epi32(__A), + (__v16si)_mm512_setzero_si512()); } static __inline__ __m512i __DEFAULT_FN_ATTRS diff --git a/clang/lib/Headers/avx512vlcdintrin.h b/clang/lib/Headers/avx512vlcdintrin.h index 903a7c25493f..df420005a41d 100644 --- a/clang/lib/Headers/avx512vlcdintrin.h +++ b/clang/lib/Headers/avx512vlcdintrin.h @@ -60,99 +60,89 @@ _mm256_broadcastmw_epi32 (__mmask16 __A) static __inline__ __m128i __DEFAULT_FN_ATTRS128 _mm_conflict_epi64 (__m128i __A) { - return (__m128i) __builtin_ia32_vpconflictdi_128_mask ((__v2di) __A, - (__v2di) _mm_undefined_si128 (), - (__mmask8) -1); + return (__m128i) __builtin_ia32_vpconflictdi_128 ((__v2di) __A); } static __inline__ __m128i __DEFAULT_FN_ATTRS128 _mm_mask_conflict_epi64 (__m128i __W, __mmask8 __U, __m128i __A) { - return (__m128i) __builtin_ia32_vpconflictdi_128_mask ((__v2di) __A, - (__v2di) __W, - (__mmask8) __U); + return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U, + (__v2di)_mm_conflict_epi64(__A), + (__v2di)__W); } static __inline__ __m128i __DEFAULT_FN_ATTRS128 _mm_maskz_conflict_epi64 (__mmask8 __U, __m128i __A) { - return (__m128i) __builtin_ia32_vpconflictdi_128_mask ((__v2di) __A, - (__v2di) - _mm_setzero_si128 (), - (__mmask8) __U); + return (__m128i)__builtin_ia32_selectq_128((__mmask8)__U, + (__v2di)_mm_conflict_epi64(__A), + (__v2di)_mm_setzero_si128()); } static __inline__ __m256i __DEFAULT_FN_ATTRS256 _mm256_conflict_epi64 (__m256i __A) { - return (__m256i) __builtin_ia32_vpconflictdi_256_mask ((__v4di) __A, - (__v4di) _mm256_undefined_si256 (), - (__mmask8) -1); + return (__m256i) __builtin_ia32_vpconflictdi_256 ((__v4di) __A); } static __inline__ __m256i __DEFAULT_FN_ATTRS256 _mm256_mask_conflict_epi64 (__m256i __W, __mmask8 __U, __m256i __A) { - return (__m256i) __builtin_ia32_vpconflictdi_256_mask ((__v4di) __A, - (__v4di) __W, - (__mmask8) __U); + return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U, + (__v4di)_mm256_conflict_epi64(__A), + (__v4di)__W); } static __inline__ __m256i __DEFAULT_FN_ATTRS256 _mm256_maskz_conflict_epi64 (__mmask8 __U, __m256i __A) { - return (__m256i) __builtin_ia32_vpconflictdi_256_mask ((__v4di) __A, - (__v4di) _mm256_setzero_si256 (), - (__mmask8) __U); + return (__m256i)__builtin_ia32_selectq_256((__mmask8)__U, + (__v4di)_mm256_conflict_epi64(__A), + (__v4di)_mm256_setzero_si256()); } static __inline__ __m128i __DEFAULT_FN_ATTRS128 _mm_conflict_epi32 (__m128i __A) { - return (__m128i) __builtin_ia32_vpconflictsi_128_mask ((__v4si) __A, - (__v4si) _mm_undefined_si128 (), - (__mmask8) -1); + return (__m128i) __builtin_ia32_vpconflictsi_128 ((__v4si) __A); } static __inline__ __m128i __DEFAULT_FN_ATTRS128 _mm_mask_conflict_epi32 (__m128i __W, __mmask8 __U, __m128i __A) { - return (__m128i) __builtin_ia32_vpconflictsi_128_mask ((__v4si) __A, - (__v4si) __W, - (__mmask8) __U); + return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U, + (__v4si)_mm_conflict_epi32(__A), + (__v4si)__W); } static __inline__ __m128i __DEFAULT_FN_ATTRS128 _mm_maskz_conflict_epi32 (__mmask8 __U, __m128i __A) { - return (__m128i) __builtin_ia32_vpconflictsi_128_mask ((__v4si) __A, - (__v4si) _mm_setzero_si128 (), - (__mmask8) __U); + return (__m128i)__builtin_ia32_selectd_128((__mmask8)__U, + (__v4si)_mm_conflict_epi32(__A), + (__v4si)_mm_setzero_si128()); } static __inline__ __m256i __DEFAULT_FN_ATTRS256 _mm256_conflict_epi32 (__m256i __A) { - return (__m256i) __builtin_ia32_vpconflictsi_256_mask ((__v8si) __A, - (__v8si) _mm256_undefined_si256 (), - (__mmask8) -1); + return (__m256i) __builtin_ia32_vpconflictsi_256 ((__v8si) __A); } static __inline__ __m256i __DEFAULT_FN_ATTRS256 _mm256_mask_conflict_epi32 (__m256i __W, __mmask8 __U, __m256i __A) { - return (__m256i) __builtin_ia32_vpconflictsi_256_mask ((__v8si) __A, - (__v8si) __W, - (__mmask8) __U); + return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U, + (__v8si)_mm256_conflict_epi32(__A), + (__v8si)__W); } static __inline__ __m256i __DEFAULT_FN_ATTRS256 _mm256_maskz_conflict_epi32 (__mmask8 __U, __m256i __A) { - return (__m256i) __builtin_ia32_vpconflictsi_256_mask ((__v8si) __A, - (__v8si) - _mm256_setzero_si256 (), - (__mmask8) __U); + return (__m256i)__builtin_ia32_selectd_256((__mmask8)__U, + (__v8si)_mm256_conflict_epi32(__A), + (__v8si)_mm256_setzero_si256()); } static __inline__ __m128i __DEFAULT_FN_ATTRS128 diff --git a/clang/test/CodeGen/avx512cdintrin.c b/clang/test/CodeGen/avx512cdintrin.c index e01d277be9ff..6483d7e8dda5 100644 --- a/clang/test/CodeGen/avx512cdintrin.c +++ b/clang/test/CodeGen/avx512cdintrin.c @@ -5,32 +5,36 @@ __m512i test_mm512_conflict_epi64(__m512i __A) { // CHECK-LABEL: @test_mm512_conflict_epi64 - // CHECK: @llvm.x86.avx512.mask.conflict.q.512 + // CHECK: @llvm.x86.avx512.conflict.q.512 return _mm512_conflict_epi64(__A); } __m512i test_mm512_mask_conflict_epi64(__m512i __W, __mmask8 __U, __m512i __A) { // CHECK-LABEL: @test_mm512_mask_conflict_epi64 - // CHECK: @llvm.x86.avx512.mask.conflict.q.512 + // CHECK: @llvm.x86.avx512.conflict.q.512 + // CHECK: select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}} return _mm512_mask_conflict_epi64(__W,__U,__A); } __m512i test_mm512_maskz_conflict_epi64(__mmask8 __U, __m512i __A) { // CHECK-LABEL: @test_mm512_maskz_conflict_epi64 - // CHECK: @llvm.x86.avx512.mask.conflict.q.512 + // CHECK: @llvm.x86.avx512.conflict.q.512 + // CHECK: select <8 x i1> %{{.*}}, <8 x i64> %{{.*}}, <8 x i64> %{{.*}} return _mm512_maskz_conflict_epi64(__U,__A); } __m512i test_mm512_conflict_epi32(__m512i __A) { // CHECK-LABEL: @test_mm512_conflict_epi32 - // CHECK: @llvm.x86.avx512.mask.conflict.d.512 + // CHECK: @llvm.x86.avx512.conflict.d.512 return _mm512_conflict_epi32(__A); } __m512i test_mm512_mask_conflict_epi32(__m512i __W, __mmask16 __U, __m512i __A) { // CHECK-LABEL: @test_mm512_mask_conflict_epi32 - // CHECK: @llvm.x86.avx512.mask.conflict.d.512 + // CHECK: @llvm.x86.avx512.conflict.d.512 + // CHECK: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}} return _mm512_mask_conflict_epi32(__W,__U,__A); } __m512i test_mm512_maskz_conflict_epi32(__mmask16 __U, __m512i __A) { // CHECK-LABEL: @test_mm512_maskz_conflict_epi32 - // CHECK: @llvm.x86.avx512.mask.conflict.d.512 + // CHECK: @llvm.x86.avx512.conflict.d.512 + // CHECK: select <16 x i1> %{{.*}}, <16 x i32> %{{.*}}, <16 x i32> %{{.*}} return _mm512_maskz_conflict_epi32(__U,__A); } __m512i test_mm512_lzcnt_epi32(__m512i __A) { diff --git a/clang/test/CodeGen/avx512vlcd-builtins.c b/clang/test/CodeGen/avx512vlcd-builtins.c index 376a342f76ee..e9330a52da31 100644 --- a/clang/test/CodeGen/avx512vlcd-builtins.c +++ b/clang/test/CodeGen/avx512vlcd-builtins.c @@ -57,73 +57,81 @@ __m256i test_mm256_broadcastmw_epi32(__m512i a, __m512i b) { __m128i test_mm_conflict_epi64(__m128i __A) { // CHECK-LABEL: @test_mm_conflict_epi64 - // CHECK: @llvm.x86.avx512.mask.conflict.q.128 + // CHECK: @llvm.x86.avx512.conflict.q.128 return _mm_conflict_epi64(__A); } __m128i test_mm_mask_conflict_epi64(__m128i __W, __mmask8 __U, __m128i __A) { // CHECK-LABEL: @test_mm_mask_conflict_epi64 - // CHECK: @llvm.x86.avx512.mask.conflict.q.128 + // CHECK: @llvm.x86.avx512.conflict.q.128 + // CHECK: select <2 x i1> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}} return _mm_mask_conflict_epi64(__W, __U, __A); } __m128i test_mm_maskz_conflict_epi64(__mmask8 __U, __m128i __A) { // CHECK-LABEL: @test_mm_maskz_conflict_epi64 - // CHECK: @llvm.x86.avx512.mask.conflict.q.128 + // CHECK: @llvm.x86.avx512.conflict.q.128 + // CHECK: select <2 x i1> %{{.*}}, <2 x i64> %{{.*}}, <2 x i64> %{{.*}} return _mm_maskz_conflict_epi64(__U, __A); } __m256i test_mm256_conflict_epi64(__m256i __A) { // CHECK-LABEL: @test_mm256_conflict_epi64 - // CHECK: @llvm.x86.avx512.mask.conflict.q.256 + // CHECK: @llvm.x86.avx512.conflict.q.256 return _mm256_conflict_epi64(__A); } __m256i test_mm256_mask_conflict_epi64(__m256i __W, __mmask8 __U, __m256i __A) { // CHECK-LABEL: @test_mm256_mask_conflict_epi64 - // CHECK: @llvm.x86.avx512.mask.conflict.q.256 + // CHECK: @llvm.x86.avx512.conflict.q.256 + // CHECK: select <4 x i1> %{{.*}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}} return _mm256_mask_conflict_epi64(__W, __U, __A); } __m256i test_mm256_maskz_conflict_epi64(__mmask8 __U, __m256i __A) { // CHECK-LABEL: @test_mm256_maskz_conflict_epi64 - // CHECK: @llvm.x86.avx512.mask.conflict.q.256 + // CHECK: @llvm.x86.avx512.conflict.q.256 + // CHECK: select <4 x i1> %{{.*}}, <4 x i64> %{{.*}}, <4 x i64> %{{.*}} return _mm256_maskz_conflict_epi64(__U, __A); } __m128i test_mm_conflict_epi32(__m128i __A) { // CHECK-LABEL: @test_mm_conflict_epi32 - // CHECK: @llvm.x86.avx512.mask.conflict.d.128 + // CHECK: @llvm.x86.avx512.conflict.d.128 return _mm_conflict_epi32(__A); } __m128i test_mm_mask_conflict_epi32(__m128i __W, __mmask8 __U, __m128i __A) { // CHECK-LABEL: @test_mm_mask_conflict_epi32 - // CHECK: @llvm.x86.avx512.mask.conflict.d.128 + // CHECK: @llvm.x86.avx512.conflict.d.128 + // CHECK: select <4 x i1> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> %{{.*}} return _mm_mask_conflict_epi32(__W, __U, __A); } __m128i test_mm_maskz_conflict_epi32(__mmask8 __U, __m128i __A) { // CHECK-LABEL: @test_mm_maskz_conflict_epi32 - // CHECK: @llvm.x86.avx512.mask.conflict.d.128 + // CHECK: @llvm.x86.avx512.conflict.d.128 + // CHECK: select <4 x i1> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> %{{.*}} return _mm_maskz_conflict_epi32(__U, __A); } __m256i test_mm256_conflict_epi32(__m256i __A) { // CHECK-LABEL: @test_mm256_conflict_epi32 - // CHECK: @llvm.x86.avx512.mask.conflict.d.256 + // CHECK: @llvm.x86.avx512.conflict.d.256 return _mm256_conflict_epi32(__A); } __m256i test_mm256_mask_conflict_epi32(__m256i __W, __mmask8 __U, __m256i __A) { // CHECK-LABEL: @test_mm256_mask_conflict_epi32 - // CHECK: @llvm.x86.avx512.mask.conflict.d.256 + // CHECK: @llvm.x86.avx512.conflict.d.256 + // CHECK: select <8 x i1> %{{.*}}, <8 x i32> %{{.*}}, <8 x i32> %{{.*}} return _mm256_mask_conflict_epi32(__W, __U, __A); } __m256i test_mm256_maskz_conflict_epi32(__mmask8 __U, __m256i __A) { // CHECK-LABEL: @test_mm256_maskz_conflict_epi32 - // CHECK: @llvm.x86.avx512.mask.conflict.d.256 + // CHECK: @llvm.x86.avx512.conflict.d.256 + // CHECK: select <8 x i1> %{{.*}}, <8 x i32> %{{.*}}, <8 x i32> %{{.*}} return _mm256_maskz_conflict_epi32(__U, __A); }