diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-09-08 12:44:22 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-09-08 12:44:22 +0000 |
commit | 178cd2cd3a69046c88ade1b31796f3f90b7e86a0 (patch) | |
tree | f25ccf75fb95b3389347e0d05136d911190e5c46 | |
parent | 9d570020708d633e9979030a5787034887426a7c (diff) | |
download | bcm5719-llvm-178cd2cd3a69046c88ade1b31796f3f90b7e86a0.tar.gz bcm5719-llvm-178cd2cd3a69046c88ade1b31796f3f90b7e86a0.zip |
[X86][SSE] Fix out of range shift introduced in D67070/rL371328
Use APInt to create the comparison mask instead.
llvm-svn: 371330
-rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 3 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/vector-reduce-and-bool.ll | 8 |
2 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index f5c9971a3c5..5e5ec5c6c8b 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -35944,7 +35944,8 @@ static SDValue combineHorizontalPredicateResult(SDNode *Extract, CondCode = ISD::CondCode::SETNE; } else { // all_of -> MOVMSK == ((1 << NumElts) - 1) - CmpC = DAG.getConstant((1ULL << NumElts) - 1, DL, CmpVT); + CmpC = DAG.getConstant(APInt::getLowBitsSet(CmpVT.getSizeInBits(), NumElts), + DL, CmpVT); CondCode = ISD::CondCode::SETEQ; } diff --git a/llvm/test/CodeGen/X86/vector-reduce-and-bool.ll b/llvm/test/CodeGen/X86/vector-reduce-and-bool.ll index b9cdb2f0225..49add302bf4 100644 --- a/llvm/test/CodeGen/X86/vector-reduce-and-bool.ll +++ b/llvm/test/CodeGen/X86/vector-reduce-and-bool.ll @@ -866,7 +866,7 @@ define i1 @trunc_v64i8_v64i1(<64 x i8>) { ; AVX512BW-NEXT: vpsllw $7, %zmm0, %zmm0 ; AVX512BW-NEXT: vpmovb2m %zmm0, %k0 ; AVX512BW-NEXT: kortestq %k0, %k0 -; AVX512BW-NEXT: sete %al +; AVX512BW-NEXT: setb %al ; AVX512BW-NEXT: vzeroupper ; AVX512BW-NEXT: retq ; @@ -875,7 +875,7 @@ define i1 @trunc_v64i8_v64i1(<64 x i8>) { ; AVX512VL-NEXT: vpsllw $7, %zmm0, %zmm0 ; AVX512VL-NEXT: vpmovb2m %zmm0, %k0 ; AVX512VL-NEXT: kortestq %k0, %k0 -; AVX512VL-NEXT: sete %al +; AVX512VL-NEXT: setb %al ; AVX512VL-NEXT: vzeroupper ; AVX512VL-NEXT: retq %a = trunc <64 x i8> %0 to <64 x i1> @@ -1744,7 +1744,7 @@ define i1 @icmp_v64i8_v64i1(<64 x i8>) { ; AVX512BW: # %bb.0: ; AVX512BW-NEXT: vptestnmb %zmm0, %zmm0, %k0 ; AVX512BW-NEXT: kortestq %k0, %k0 -; AVX512BW-NEXT: sete %al +; AVX512BW-NEXT: setb %al ; AVX512BW-NEXT: vzeroupper ; AVX512BW-NEXT: retq ; @@ -1752,7 +1752,7 @@ define i1 @icmp_v64i8_v64i1(<64 x i8>) { ; AVX512VL: # %bb.0: ; AVX512VL-NEXT: vptestnmb %zmm0, %zmm0, %k0 ; AVX512VL-NEXT: kortestq %k0, %k0 -; AVX512VL-NEXT: sete %al +; AVX512VL-NEXT: setb %al ; AVX512VL-NEXT: vzeroupper ; AVX512VL-NEXT: retq %a = icmp eq <64 x i8> %0, zeroinitializer |