diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index 487af807ab93..fdfc729c9c62 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -1302,11 +1302,11 @@ bool TargetLowering::isConstTrueVal(const SDNode *N) const { if (!BV) return false; - BitVector UndefElements; - CN = BV->getConstantSplatNode(&UndefElements); - // Only interested in constant splats, and we don't try to handle undef - // elements in identifying boolean constants. - if (!CN || UndefElements.none()) + // Only interested in constant splats, we don't care about undef + // elements in identifying boolean constants and getConstantSplatNode + // returns NULL if all ops are undef; + CN = BV->getConstantSplatNode(); + if (!CN) return false; } @@ -1342,11 +1342,11 @@ bool TargetLowering::isConstFalseVal(const SDNode *N) const { if (!BV) return false; - BitVector UndefElements; - CN = BV->getConstantSplatNode(&UndefElements); - // Only interested in constant splats, and we don't try to handle undef - // elements in identifying boolean constants. - if (!CN || UndefElements.none()) + // Only interested in constant splats, we don't care about undef + // elements in identifying boolean constants and getConstantSplatNode + // returns NULL if all ops are undef; + CN = BV->getConstantSplatNode(); + if (!CN) return false; } diff --git a/llvm/test/CodeGen/X86/avx512-ext.ll b/llvm/test/CodeGen/X86/avx512-ext.ll index 4d8f95a00f52..d1e256c2673a 100644 --- a/llvm/test/CodeGen/X86/avx512-ext.ll +++ b/llvm/test/CodeGen/X86/avx512-ext.ll @@ -1400,19 +1400,14 @@ define i8 @trunc_8i16_to_8i1(<8 x i16> %a) { define <8 x i32> @sext_8i1_8i32(<8 x i32> %a1, <8 x i32> %a2) nounwind { ; KNL-LABEL: sext_8i1_8i32: ; KNL: ## BB#0: -; KNL-NEXT: ## kill: %YMM1 %YMM1 %ZMM1 -; KNL-NEXT: ## kill: %YMM0 %YMM0 %ZMM0 -; KNL-NEXT: vpcmpgtd %zmm0, %zmm1, %k0 -; KNL-NEXT: knotw %k0, %k1 -; KNL-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 -; KNL-NEXT: vmovdqa64 %zmm0, %zmm0 {%k1} {z} -; KNL-NEXT: vpmovqd %zmm0, %ymm0 +; KNL-NEXT: vpcmpgtd %ymm0, %ymm1, %ymm0 +; KNL-NEXT: vpcmpeqd %ymm1, %ymm1, %ymm1 +; KNL-NEXT: vpxor %ymm1, %ymm0, %ymm0 ; KNL-NEXT: retq ; ; SKX-LABEL: sext_8i1_8i32: ; SKX: ## BB#0: -; SKX-NEXT: vpcmpgtd %ymm0, %ymm1, %k0 -; SKX-NEXT: knotb %k0, %k0 +; SKX-NEXT: vpcmpled %ymm0, %ymm1, %k0 ; SKX-NEXT: vpmovm2d %k0, %ymm0 ; SKX-NEXT: retq %x = icmp slt <8 x i32> %a1, %a2 diff --git a/llvm/test/CodeGen/X86/avx512-vec-cmp.ll b/llvm/test/CodeGen/X86/avx512-vec-cmp.ll index 063383d8f0cb..b9cdb3ccec93 100644 --- a/llvm/test/CodeGen/X86/avx512-vec-cmp.ll +++ b/llvm/test/CodeGen/X86/avx512-vec-cmp.ll @@ -659,7 +659,8 @@ define <16 x i32> @test14(<16 x i32>%a, <16 x i32>%b) { ; CHECK-LABEL: test14: ; CHECK: ## BB#0: ; CHECK-NEXT: vpsubd %zmm1, %zmm0, %zmm1 -; CHECK-NEXT: vpcmpgtd %zmm0, %zmm1, %k1 +; CHECK-NEXT: vpcmpled %zmm0, %zmm1, %k0 +; CHECK-NEXT: knotw %k0, %k1 ; CHECK-NEXT: vmovdqa32 %zmm1, %zmm0 {%k1} {z} ; CHECK-NEXT: retq %sub_r = sub <16 x i32> %a, %b @@ -674,7 +675,8 @@ define <8 x i64> @test15(<8 x i64>%a, <8 x i64>%b) { ; CHECK-LABEL: test15: ; CHECK: ## BB#0: ; CHECK-NEXT: vpsubq %zmm1, %zmm0, %zmm1 -; CHECK-NEXT: vpcmpgtq %zmm0, %zmm1, %k1 +; CHECK-NEXT: vpcmpleq %zmm0, %zmm1, %k0 +; CHECK-NEXT: knotw %k0, %k1 ; CHECK-NEXT: vmovdqa64 %zmm1, %zmm0 {%k1} {z} ; CHECK-NEXT: retq %sub_r = sub <8 x i64> %a, %b diff --git a/llvm/test/CodeGen/X86/v8i1-masks.ll b/llvm/test/CodeGen/X86/v8i1-masks.ll index d5c31506e981..e378cf33dea4 100644 --- a/llvm/test/CodeGen/X86/v8i1-masks.ll +++ b/llvm/test/CodeGen/X86/v8i1-masks.ll @@ -48,10 +48,8 @@ define void @neg_masks(<8 x float>* %a, <8 x float>* %b, <8 x float>* %c) nounwi ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx ; X32-NEXT: vmovups (%ecx), %ymm0 -; X32-NEXT: vcmpltps (%eax), %ymm0, %ymm0 -; X32-NEXT: vmovaps {{.*#+}} ymm1 = [1,1,1,1,1,1,1,1] -; X32-NEXT: vxorps %ymm1, %ymm0, %ymm0 -; X32-NEXT: vandps %ymm1, %ymm0, %ymm0 +; X32-NEXT: vcmpnltps (%eax), %ymm0, %ymm0 +; X32-NEXT: vandps LCPI1_0, %ymm0, %ymm0 ; X32-NEXT: vmovaps %ymm0, (%eax) ; X32-NEXT: vzeroupper ; X32-NEXT: retl @@ -59,10 +57,8 @@ define void @neg_masks(<8 x float>* %a, <8 x float>* %b, <8 x float>* %c) nounwi ; X64-LABEL: neg_masks: ; X64: ## BB#0: ; X64-NEXT: vmovups (%rsi), %ymm0 -; X64-NEXT: vcmpltps (%rdi), %ymm0, %ymm0 -; X64-NEXT: vmovaps {{.*#+}} ymm1 = [1,1,1,1,1,1,1,1] -; X64-NEXT: vxorps %ymm1, %ymm0, %ymm0 -; X64-NEXT: vandps %ymm1, %ymm0, %ymm0 +; X64-NEXT: vcmpnltps (%rdi), %ymm0, %ymm0 +; X64-NEXT: vandps {{.*}}(%rip), %ymm0, %ymm0 ; X64-NEXT: vmovaps %ymm0, (%rax) ; X64-NEXT: vzeroupper ; X64-NEXT: retq