[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 06:12:25 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:
Not intended, but its what we currently end up with for split loads in a lot of code (and 32-bit sees this a lot more due to passing args on the stack) - I'd prefer it cmov'd the pointer/stack offset and remained branchless but haven't drilled down any further yet.
https://github.com/llvm/llvm-project/pull/182021
More information about the llvm-commits
mailing list