[llvm] [X86] Transform `(xor x, SIGN_BIT)` -> `(add x, SIGN_BIT)` 32 bit and smaller scalars (PR #83659)

via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 2 10:34:44 PST 2024


================
@@ -205,15 +205,15 @@ define i8 @sub_xor_sminval_i8(i8 %x, i8 %y) {
 ; X86-LABEL: sub_xor_sminval_i8:
 ; X86:       # %bb.0:
 ; X86-NEXT:    movzbl {{[0-9]+}}(%esp), %eax
-; X86-NEXT:    addb $-128, %al
 ; X86-NEXT:    subb {{[0-9]+}}(%esp), %al
+; X86-NEXT:    addb $-128, %al
 ; X86-NEXT:    retl
 ;
 ; X64-LABEL: sub_xor_sminval_i8:
 ; X64:       # %bb.0:
 ; X64-NEXT:    # kill: def $edi killed $edi def $rdi
+; X64-NEXT:    subb %sil, %dil
----------------
goldsteinn wrote:

Im not sure. The prior impl has the same issue, but the new code gen does not have the same high bits as before:
https://alive2.llvm.org/ce/z/FTCyUY

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


More information about the llvm-commits mailing list