r334385 - [X86] Remove masking from dbpsadbw builtins, use select builtin instead.
Craig Topper via cfe-commits
cfe-commits at lists.llvm.org
Sun Jun 10 23:18:29 PDT 2018
Author: ctopper
Date: Sun Jun 10 23:18:29 2018
New Revision: 334385
URL: http://llvm.org/viewvc/llvm-project?rev=334385&view=rev
Log:
[X86] Remove masking from dbpsadbw builtins, use select builtin instead.
Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/avx512bwintrin.h
cfe/trunk/lib/Headers/avx512vlbwintrin.h
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/test/CodeGen/avx512bw-builtins.c
cfe/trunk/test/CodeGen/avx512vlbw-builtins.c
Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=334385&r1=334384&r2=334385&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Sun Jun 10 23:18:29 2018
@@ -1745,9 +1745,9 @@ TARGET_BUILTIN(__builtin_ia32_kunpckhi,
TARGET_BUILTIN(__builtin_ia32_kxnorhi, "UsUsUs", "nc", "avx512f")
TARGET_BUILTIN(__builtin_ia32_kxorhi, "UsUsUs", "nc", "avx512f")
TARGET_BUILTIN(__builtin_ia32_palignr512, "V64cV64cV64cIi", "nc", "avx512bw")
-TARGET_BUILTIN(__builtin_ia32_dbpsadbw128_mask, "V8sV16cV16cIiV8sUc", "nc", "avx512bw,avx512vl")
-TARGET_BUILTIN(__builtin_ia32_dbpsadbw256_mask, "V16sV32cV32cIiV16sUs", "nc", "avx512bw,avx512vl")
-TARGET_BUILTIN(__builtin_ia32_dbpsadbw512_mask, "V32sV64cV64cIiV32sUi", "nc", "avx512bw")
+TARGET_BUILTIN(__builtin_ia32_dbpsadbw128, "V8sV16cV16cIi", "nc", "avx512bw,avx512vl")
+TARGET_BUILTIN(__builtin_ia32_dbpsadbw256, "V16sV32cV32cIi", "nc", "avx512bw,avx512vl")
+TARGET_BUILTIN(__builtin_ia32_dbpsadbw512, "V32sV64cV64cIi", "nc", "avx512bw")
TARGET_BUILTIN(__builtin_ia32_psadbw512, "V8LLiV64cV64c", "nc", "avx512bw")
TARGET_BUILTIN(__builtin_ia32_compressdf512_mask, "V8dV8dV8dUc", "nc", "avx512f")
TARGET_BUILTIN(__builtin_ia32_compressdi512_mask, "V8LLiV8LLiV8LLiUc", "nc", "avx512f")
Modified: cfe/trunk/lib/Headers/avx512bwintrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512bwintrin.h?rev=334385&r1=334384&r2=334385&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/avx512bwintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512bwintrin.h Sun Jun 10 23:18:29 2018
@@ -1819,22 +1819,18 @@ _mm512_mask_permutexvar_epi16 (__m512i _
(__v64qi)(__m512i)_mm512_setzero_si512())
#define _mm512_dbsad_epu8(A, B, imm) \
- (__m512i)__builtin_ia32_dbpsadbw512_mask((__v64qi)(__m512i)(A), \
- (__v64qi)(__m512i)(B), (int)(imm), \
- (__v32hi)_mm512_undefined_epi32(), \
- (__mmask32)-1)
+ (__m512i)__builtin_ia32_dbpsadbw512((__v64qi)(__m512i)(A), \
+ (__v64qi)(__m512i)(B), (int)(imm))
#define _mm512_mask_dbsad_epu8(W, U, A, B, imm) \
- (__m512i)__builtin_ia32_dbpsadbw512_mask((__v64qi)(__m512i)(A), \
- (__v64qi)(__m512i)(B), (int)(imm), \
- (__v32hi)(__m512i)(W), \
- (__mmask32)(U))
+ (__m512i)__builtin_ia32_selectw_512((__mmask32)(U), \
+ (__v32hi)_mm512_dbsad_epu8((A), (B), (imm)), \
+ (__v32hi)(__m512i)(W))
#define _mm512_maskz_dbsad_epu8(U, A, B, imm) \
- (__m512i)__builtin_ia32_dbpsadbw512_mask((__v64qi)(__m512i)(A), \
- (__v64qi)(__m512i)(B), (int)(imm), \
- (__v32hi)_mm512_setzero_si512(), \
- (__mmask32)(U))
+ (__m512i)__builtin_ia32_selectw_512((__mmask32)(U), \
+ (__v32hi)_mm512_dbsad_epu8((A), (B), (imm)), \
+ (__v32hi)_mm512_setzero_si512())
static __inline__ __m512i __DEFAULT_FN_ATTRS
_mm512_sad_epu8 (__m512i __A, __m512i __B)
Modified: cfe/trunk/lib/Headers/avx512vlbwintrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512vlbwintrin.h?rev=334385&r1=334384&r2=334385&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/avx512vlbwintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512vlbwintrin.h Sun Jun 10 23:18:29 2018
@@ -2714,40 +2714,32 @@ _mm256_mask_permutexvar_epi16 (__m256i _
(__v32qi)_mm256_setzero_si256())
#define _mm_dbsad_epu8(A, B, imm) \
- (__m128i)__builtin_ia32_dbpsadbw128_mask((__v16qi)(__m128i)(A), \
- (__v16qi)(__m128i)(B), (int)(imm), \
- (__v8hi)_mm_setzero_si128(), \
- (__mmask8)-1)
+ (__m128i)__builtin_ia32_dbpsadbw128((__v16qi)(__m128i)(A), \
+ (__v16qi)(__m128i)(B), (int)(imm))
#define _mm_mask_dbsad_epu8(W, U, A, B, imm) \
- (__m128i)__builtin_ia32_dbpsadbw128_mask((__v16qi)(__m128i)(A), \
- (__v16qi)(__m128i)(B), (int)(imm), \
- (__v8hi)(__m128i)(W), \
- (__mmask8)(U))
+ (__m128i)__builtin_ia32_selectw_128((__mmask8)(U), \
+ (__v8hi)_mm_dbsad_epu8((A), (B), (imm)), \
+ (__v8hi)(__m128i)(W))
#define _mm_maskz_dbsad_epu8(U, A, B, imm) \
- (__m128i)__builtin_ia32_dbpsadbw128_mask((__v16qi)(__m128i)(A), \
- (__v16qi)(__m128i)(B), (int)(imm), \
- (__v8hi)_mm_setzero_si128(), \
- (__mmask8)(U))
+ (__m128i)__builtin_ia32_selectw_128((__mmask8)(U), \
+ (__v8hi)_mm_dbsad_epu8((A), (B), (imm)), \
+ (__v8hi)_mm_setzero_si128())
#define _mm256_dbsad_epu8(A, B, imm) \
- (__m256i)__builtin_ia32_dbpsadbw256_mask((__v32qi)(__m256i)(A), \
- (__v32qi)(__m256i)(B), (int)(imm), \
- (__v16hi)_mm256_setzero_si256(), \
- (__mmask16)-1)
+ (__m256i)__builtin_ia32_dbpsadbw256((__v32qi)(__m256i)(A), \
+ (__v32qi)(__m256i)(B), (int)(imm))
#define _mm256_mask_dbsad_epu8(W, U, A, B, imm) \
- (__m256i)__builtin_ia32_dbpsadbw256_mask((__v32qi)(__m256i)(A), \
- (__v32qi)(__m256i)(B), (int)(imm), \
- (__v16hi)(__m256i)(W), \
- (__mmask16)(U))
+ (__m256i)__builtin_ia32_selectw_256((__mmask16)(U), \
+ (__v16hi)_mm256_dbsad_epu8((A), (B), (imm)), \
+ (__v16hi)(__m256i)(W))
#define _mm256_maskz_dbsad_epu8(U, A, B, imm) \
- (__m256i)__builtin_ia32_dbpsadbw256_mask((__v32qi)(__m256i)(A), \
- (__v32qi)(__m256i)(B), (int)(imm), \
- (__v16hi)_mm256_setzero_si256(), \
- (__mmask16)(U))
+ (__m256i)__builtin_ia32_selectw_256((__mmask16)(U), \
+ (__v16hi)_mm256_dbsad_epu8((A), (B), (imm)), \
+ (__v16hi)_mm256_setzero_si256())
#undef __DEFAULT_FN_ATTRS
Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=334385&r1=334384&r2=334385&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Sun Jun 10 23:18:29 2018
@@ -2838,9 +2838,9 @@ bool Sema::CheckX86BuiltinFunctionCall(u
case X86::BI__builtin_ia32_shufps:
case X86::BI__builtin_ia32_shufps256:
case X86::BI__builtin_ia32_shufps512:
- case X86::BI__builtin_ia32_dbpsadbw128_mask:
- case X86::BI__builtin_ia32_dbpsadbw256_mask:
- case X86::BI__builtin_ia32_dbpsadbw512_mask:
+ case X86::BI__builtin_ia32_dbpsadbw128:
+ case X86::BI__builtin_ia32_dbpsadbw256:
+ case X86::BI__builtin_ia32_dbpsadbw512:
case X86::BI__builtin_ia32_vpshldd128_mask:
case X86::BI__builtin_ia32_vpshldd256_mask:
case X86::BI__builtin_ia32_vpshldd512_mask:
Modified: cfe/trunk/test/CodeGen/avx512bw-builtins.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512bw-builtins.c?rev=334385&r1=334384&r2=334385&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/avx512bw-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512bw-builtins.c Sun Jun 10 23:18:29 2018
@@ -1934,19 +1934,21 @@ __m512i test_mm512_maskz_alignr_epi8(__m
__m512i test_mm512_mm_dbsad_epu8(__m512i __A, __m512i __B) {
// CHECK-LABEL: @test_mm512_mm_dbsad_epu8
- // CHECK: @llvm.x86.avx512.mask.dbpsadbw.512
+ // CHECK: @llvm.x86.avx512.dbpsadbw.512
return _mm512_dbsad_epu8(__A, __B, 170);
}
__m512i test_mm512_mm_mask_dbsad_epu8(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) {
// CHECK-LABEL: @test_mm512_mm_mask_dbsad_epu8
- // CHECK: @llvm.x86.avx512.mask.dbpsadbw.512
+ // CHECK: @llvm.x86.avx512.dbpsadbw.512
+ //CHECK: select <32 x i1> %{{.*}}, <32 x i16> %{{.*}}, <32 x i16> %{{.*}}
return _mm512_mask_dbsad_epu8(__W, __U, __A, __B, 170);
}
__m512i test_mm512_mm_maskz_dbsad_epu8(__mmask32 __U, __m512i __A, __m512i __B) {
// CHECK-LABEL: @test_mm512_mm_maskz_dbsad_epu8
- // CHECK: @llvm.x86.avx512.mask.dbpsadbw.512
+ // CHECK: @llvm.x86.avx512.dbpsadbw.512
+ //CHECK: select <32 x i1> %{{.*}}, <32 x i16> %{{.*}}, <32 x i16> %{{.*}}
return _mm512_maskz_dbsad_epu8(__U, __A, __B, 170);
}
Modified: cfe/trunk/test/CodeGen/avx512vlbw-builtins.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512vlbw-builtins.c?rev=334385&r1=334384&r2=334385&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/avx512vlbw-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512vlbw-builtins.c Sun Jun 10 23:18:29 2018
@@ -2964,37 +2964,41 @@ __m256i test_mm256_maskz_alignr_epi8(__m
__m128i test_mm_dbsad_epu8(__m128i __A, __m128i __B) {
// CHECK-LABEL: @test_mm_dbsad_epu8
- // CHECK: @llvm.x86.avx512.mask.dbpsadbw.128
+ // CHECK: @llvm.x86.avx512.dbpsadbw.128
return _mm_dbsad_epu8(__A, __B, 170);
}
__m128i test_mm_mask_dbsad_epu8(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
// CHECK-LABEL: @test_mm_mask_dbsad_epu8
- // CHECK: @llvm.x86.avx512.mask.dbpsadbw.128
+ // CHECK: @llvm.x86.avx512.dbpsadbw.128
+ // CHECK: select <8 x i1> %{{.*}}, <8 x i16> %{{.*}}, <8 x i16> %{{.*}}
return _mm_mask_dbsad_epu8(__W, __U, __A, __B, 170);
}
__m128i test_mm_maskz_dbsad_epu8(__mmask8 __U, __m128i __A, __m128i __B) {
// CHECK-LABEL: @test_mm_maskz_dbsad_epu8
- // CHECK: @llvm.x86.avx512.mask.dbpsadbw.128
+ // CHECK: @llvm.x86.avx512.dbpsadbw.128
+ // CHECK: select <8 x i1> %{{.*}}, <8 x i16> %{{.*}}, <8 x i16> %{{.*}}
return _mm_maskz_dbsad_epu8(__U, __A, __B, 170);
}
__m256i test_mm256_dbsad_epu8(__m256i __A, __m256i __B) {
// CHECK-LABEL: @test_mm256_dbsad_epu8
- // CHECK: @llvm.x86.avx512.mask.dbpsadbw.256
+ // CHECK: @llvm.x86.avx512.dbpsadbw.256
return _mm256_dbsad_epu8(__A, __B, 170);
}
__m256i test_mm256_mask_dbsad_epu8(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B) {
// CHECK-LABEL: @test_mm256_mask_dbsad_epu8
- // CHECK: @llvm.x86.avx512.mask.dbpsadbw.256
+ // CHECK: @llvm.x86.avx512.dbpsadbw.256
+ // CHECK: select <16 x i1> %{{.*}}, <16 x i16> %{{.*}}, <16 x i16> %{{.*}}
return _mm256_mask_dbsad_epu8(__W, __U, __A, __B, 170);
}
__m256i test_mm256_maskz_dbsad_epu8(__mmask16 __U, __m256i __A, __m256i __B) {
// CHECK-LABEL: @test_mm256_maskz_dbsad_epu8
- // CHECK: @llvm.x86.avx512.mask.dbpsadbw.256
+ // CHECK: @llvm.x86.avx512.dbpsadbw.256
+ // CHECK: select <16 x i1> %{{.*}}, <16 x i16> %{{.*}}, <16 x i16> %{{.*}}
return _mm256_maskz_dbsad_epu8(__U, __A, __B, 170);
}
__mmask8 test_mm_movepi16_mask(__m128i __A) {
More information about the cfe-commits
mailing list