[PATCH] D123652: Add use condition for combine SetCCMOVMSK
Xiang Zhang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 20 18:34:38 PDT 2022
xiangzhangllvm updated this revision to Diff 424073.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123652/new/
https://reviews.llvm.org/D123652
Files:
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/vector-compare-all_of.ll
Index: llvm/test/CodeGen/X86/vector-compare-all_of.ll
===================================================================
--- llvm/test/CodeGen/X86/vector-compare-all_of.ll
+++ llvm/test/CodeGen/X86/vector-compare-all_of.ll
@@ -881,7 +881,7 @@
ret i8 %11
}
-; FIXME: Should not "MOVMSK(PCMPEQ(..)) -> PTESTZ(..)" when cmp result has muti-uses.
+; Should not "MOVMSK(PCMPEQ(..)) -> PTESTZ(..)" when cmp result has muti-uses.
define i32 @test_v32i8_muti_uses(<32 x i8> %x, <32 x i8>%y, i32 %z) {
; SSE-LABEL: test_v32i8_muti_uses:
; SSE: # %bb.0:
@@ -914,10 +914,9 @@
;
; AVX2-LABEL: test_v32i8_muti_uses:
; AVX2: # %bb.0:
-; AVX2-NEXT: vpcmpeqb %ymm1, %ymm0, %ymm2
-; AVX2-NEXT: vpmovmskb %ymm2, %ecx
-; AVX2-NEXT: vpsubb %ymm1, %ymm0, %ymm0
-; AVX2-NEXT: vptest %ymm0, %ymm0
+; AVX2-NEXT: vpcmpeqb %ymm1, %ymm0, %ymm0
+; AVX2-NEXT: vpmovmskb %ymm0, %ecx
+; AVX2-NEXT: cmpl $-1, %ecx
; AVX2-NEXT: movl $16, %eax
; AVX2-NEXT: cmovnel %ecx, %eax
; AVX2-NEXT: vzeroupper
Index: llvm/lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- llvm/lib/Target/X86/X86ISelLowering.cpp
+++ llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -45002,9 +45002,11 @@
unsigned NumElts = VecVT.getVectorNumElements();
unsigned NumEltBits = VecVT.getScalarSizeInBits();
- bool IsAnyOf = CmpOpcode == X86ISD::CMP && CmpVal.isZero();
+ bool IsAnyOf = CmpOpcode == X86ISD::CMP && CmpVal.isZero() &&
+ CmpOp.getNode()->hasOneUse();
bool IsAllOf = (CmpOpcode == X86ISD::SUB || CmpOpcode == X86ISD::CMP) &&
- NumElts <= CmpBits && CmpVal.isMask(NumElts);
+ NumElts <= CmpBits && CmpVal.isMask(NumElts) &&
+ CmpOp.getNode()->hasOneUse();
if (!IsAnyOf && !IsAllOf)
return SDValue();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123652.424073.patch
Type: text/x-patch
Size: 1844 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220421/4d6573f4/attachment.bin>
More information about the llvm-commits
mailing list