[llvm] [X86] combineSETCC - drop unnecessary shift amount bounds check for larger-than-legal ICMP_ZERO(AND(X,SHL(1,IDX))) folds (PR #182021)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 18 09:18:49 PST 2026
================
@@ -341,43 +341,20 @@ define i1 @scalar_i64_signbit_eq(i64 %x, i64 %y) nounwind {
}
define i1 @scalar_i64_lowestbit_eq(i64 %x, i64 %y) nounwind {
-; X86-BMI1-LABEL: scalar_i64_lowestbit_eq:
-; X86-BMI1: # %bb.0:
-; X86-BMI1-NEXT: pushl %esi
-; X86-BMI1-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
-; X86-BMI1-NEXT: movl $1, %eax
-; X86-BMI1-NEXT: xorl %esi, %esi
-; X86-BMI1-NEXT: xorl %edx, %edx
-; X86-BMI1-NEXT: shldl %cl, %eax, %edx
-; X86-BMI1-NEXT: shll %cl, %eax
-; X86-BMI1-NEXT: testb $32, %cl
-; X86-BMI1-NEXT: cmovnel %eax, %edx
-; X86-BMI1-NEXT: cmovnel %esi, %eax
-; X86-BMI1-NEXT: andl {{[0-9]+}}(%esp), %edx
-; X86-BMI1-NEXT: andl {{[0-9]+}}(%esp), %eax
-; X86-BMI1-NEXT: orl %edx, %eax
-; X86-BMI1-NEXT: sete %al
-; X86-BMI1-NEXT: popl %esi
-; X86-BMI1-NEXT: retl
-;
-; X86-BMI2-LABEL: scalar_i64_lowestbit_eq:
-; X86-BMI2: # %bb.0:
-; X86-BMI2-NEXT: pushl %esi
-; X86-BMI2-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
-; X86-BMI2-NEXT: movl $1, %edx
-; X86-BMI2-NEXT: xorl %esi, %esi
-; X86-BMI2-NEXT: xorl %eax, %eax
-; X86-BMI2-NEXT: shldl %cl, %edx, %eax
-; X86-BMI2-NEXT: shlxl %ecx, %edx, %edx
-; X86-BMI2-NEXT: testb $32, %cl
-; X86-BMI2-NEXT: cmovnel %edx, %eax
-; X86-BMI2-NEXT: cmovnel %esi, %edx
-; X86-BMI2-NEXT: andl {{[0-9]+}}(%esp), %eax
-; X86-BMI2-NEXT: andl {{[0-9]+}}(%esp), %edx
-; X86-BMI2-NEXT: orl %eax, %edx
-; X86-BMI2-NEXT: sete %al
-; X86-BMI2-NEXT: popl %esi
-; X86-BMI2-NEXT: retl
+; X86-LABEL: scalar_i64_lowestbit_eq:
+; X86: # %bb.0:
+; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT: testb $32, %al
+; X86-NEXT: je .LBB10_1
----------------
RKSimon wrote:
I've got a WIP patch for `CMOV(LOAD(PTR0),LOAD(PTR1)) -> LOAD(CMOV(PTR0,PTR1))` but I'd prefer to work on it independently of this PR - are you happy for this PR to go ahead with the branchy code?
https://github.com/llvm/llvm-project/pull/182021
More information about the llvm-commits
mailing list