summaryrefslogtreecommitdiff
path: root/llvm/test/CodeGen/X86/known-never-zero.ll
diff options
context:
space:
mode:
authorBjorn Pettersson <bjorn.a.pettersson@ericsson.com>2025-11-12 23:03:13 +0100
committerBjorn Pettersson <bjorn.a.pettersson@ericsson.com>2025-11-12 23:03:13 +0100
commit9f0273a6d84bb05cd93e78ef5d1af0384c5fd6ad (patch)
treed1680223885aec350a8e2185a99d116ec80a3db0 /llvm/test/CodeGen/X86/known-never-zero.ll
parentcf9cb542f22e18cc9c567bc952e91b52e310070f (diff)
[SelectionDAG] Fix bug related to demanded bits/elts for BITCASTusers/bjope/demandedbits_bitcast_1
When we have a BITCAST and the source type is a vector with smaller elements compared to the destination type, then we need to demand all the source elements that make up the demanded elts for the result when doing recursive calls to SimplifyDemandedBits, SimplifyDemandedVectorElts and SimplifyMultipleUseDemandedBits. Problem is that those simplifications are allowed to turn non-demanded elements of a vector into POISON, so unless we demand all source elements that make up the result there is a risk that the result would be more poisonous (even for demanded elts) after the simplification. The patch fixes some bugs in SimplifyMultipleUseDemandedBits and SimplifyDemandedBits for situations when we did not consider the problem described above. Now we make sure that we also demand vector elements that "must not be turned into poison" even if those elements correspond to bits that does not need to be defined according to the DemandedBits mask. Fixes #138513
Diffstat (limited to 'llvm/test/CodeGen/X86/known-never-zero.ll')
-rw-r--r--llvm/test/CodeGen/X86/known-never-zero.ll3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/test/CodeGen/X86/known-never-zero.ll b/llvm/test/CodeGen/X86/known-never-zero.ll
index 63336ffa7c6c..f6b8839afb2d 100644
--- a/llvm/test/CodeGen/X86/known-never-zero.ll
+++ b/llvm/test/CodeGen/X86/known-never-zero.ll
@@ -1243,7 +1243,8 @@ define i32 @mul_maybe_zero(i32 %x, i32 %y) {
define i32 @bitcast_known_nonzero(<2 x i16> %xx) {
; X86-LABEL: bitcast_known_nonzero:
; X86: # %bb.0:
-; X86-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3]
+; X86-NEXT: pxor %xmm1, %xmm1
+; X86-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
; X86-NEXT: pslld $23, %xmm0
; X86-NEXT: paddd {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
; X86-NEXT: cvttps2dq %xmm0, %xmm0