[llvm] [X86] LowerSelect - generalize "select icmp(x,0), lhs, rhs" folding patterns. (PR #107272)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 6 04:01:28 PDT 2024


================
@@ -77,12 +77,11 @@ define i32 @or_signbit_select_shl(i32 %x, i1 %cond, ptr %dst) {
 ; X86-LABEL: or_signbit_select_shl:
 ; X86:       # %bb.0:
 ; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
-; X86-NEXT:    testb $1, {{[0-9]+}}(%esp)
-; X86-NEXT:    je .LBB2_2
-; X86-NEXT:  # %bb.1:
-; X86-NEXT:    orl $16711680, %eax # imm = 0xFF0000
-; X86-NEXT:  .LBB2_2:
+; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
----------------
RKSimon wrote:

Yes, I'm intending to start looking at this soon (after extending the LowerSELECTWithCmpZero xor/or support to handle add/sub as well) - its definitely worth it if we're loading the comparison value for instance. Some benchmarks appear to benefit (e.g. coremark's crc tests). So this will be more useful than just a pre-CMOV 32-bit optimization :)

This first step is just getting this refactor out of the way to make it easier to extend.

https://github.com/llvm/llvm-project/pull/107272


More information about the llvm-commits mailing list