[llvm] [X86] LowerABD - simplify i32/i64 to use sub+sub+cmov instead of repeating nodes via abs (PR #102174)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 19 05:30:10 PDT 2024


================
@@ -139,28 +139,25 @@ define i16 @abd_ext_i16(i16 %a, i16 %b) nounwind {
 define i16 @abd_ext_i16_i32(i16 %a, i32 %b) nounwind {
 ; X86-LABEL: abd_ext_i16_i32:
 ; X86:       # %bb.0:
-; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
-; X86-NEXT:    movswl {{[0-9]+}}(%esp), %eax
-; X86-NEXT:    movl %eax, %edx
-; X86-NEXT:    subl %ecx, %edx
-; X86-NEXT:    negl %edx
+; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X86-NEXT:    movswl {{[0-9]+}}(%esp), %ecx
+; X86-NEXT:    movl %ecx, %edx
+; X86-NEXT:    subl %eax, %edx
 ; X86-NEXT:    subl %ecx, %eax
-; X86-NEXT:    cmovlel %edx, %eax
+; X86-NEXT:    cmovll %edx, %eax
 ; X86-NEXT:    negl %eax
----------------
RKSimon wrote:

Yes, although I'm not sure if we want to do this through a generic NEG(ABD(X,Y)) fold or NEG(CMOV(F,T,C)) fold. I'll do some tests in alive and see what I can come up with.

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


More information about the llvm-commits mailing list