Skip to content

Commit 1359f72

Browse files
authored
[X86] canCreateUndefOrPoisonForTargetNode - add X86ISD::MOVMSK (llvm#154321)
MOVMSK nodes don't create undef/poison when extracting the signbits from the source operand
1 parent 42350f4 commit 1359f72

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45152,6 +45152,9 @@ bool X86TargetLowering::canCreateUndefOrPoisonForTargetNode(
4515245152
case X86ISD::PCMPEQ:
4515345153
case X86ISD::PCMPGT:
4515445154
return false;
45155+
// SSE signbit extraction.
45156+
case X86ISD::MOVMSK:
45157+
return false;
4515545158
case ISD::INTRINSIC_WO_CHAIN:
4515645159
switch (Op->getConstantOperandVal(0)) {
4515745160
case Intrinsic::x86_sse2_pmadd_wd:

llvm/test/CodeGen/X86/combine-movmsk.ll

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -489,24 +489,21 @@ define i32 @or_pmovmskb_pmovmskb(<16 x i8> %a0, <8 x i16> %a1) {
489489
ret i32 %7
490490
}
491491

492-
; TODO: FREEZE(MOVMSK(X)) -> MOVMSK(FREEZE(X))
492+
; FREEZE(MOVMSK(X)) -> MOVMSK(FREEZE(X))
493493
define i32 @movmskps_freeze(<4 x i32> %a0) {
494494
; SSE-LABEL: movmskps_freeze:
495495
; SSE: # %bb.0:
496496
; SSE-NEXT: movmskps %xmm0, %eax
497-
; SSE-NEXT: andl $15, %eax
498497
; SSE-NEXT: retq
499498
;
500499
; AVX-LABEL: movmskps_freeze:
501500
; AVX: # %bb.0:
502501
; AVX-NEXT: vmovmskps %xmm0, %eax
503-
; AVX-NEXT: andl $15, %eax
504502
; AVX-NEXT: retq
505503
;
506504
; ADL-LABEL: movmskps_freeze:
507505
; ADL: # %bb.0:
508506
; ADL-NEXT: vmovmskps %xmm0, %eax
509-
; ADL-NEXT: andl $15, %eax
510507
; ADL-NEXT: retq
511508
%1 = icmp slt <4 x i32> %a0, zeroinitializer
512509
%2 = sext <4 x i1> %1 to <4 x i32>

0 commit comments

Comments
 (0)