[llvm] f10685f - [X86] lowerAtomicArith - use DAG::getNegative() helper. NFC.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 30 02:43:35 PDT 2024


Author: Simon Pilgrim
Date: 2024-04-30T10:43:14+01:00
New Revision: f10685f3e606e9e50906d9bf4e302a4281664152

URL: https://github.com/llvm/llvm-project/commit/f10685f3e606e9e50906d9bf4e302a4281664152
DIFF: https://github.com/llvm/llvm-project/commit/f10685f3e606e9e50906d9bf4e302a4281664152.diff

LOG: [X86] lowerAtomicArith - use DAG::getNegative() helper. NFC.

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86ISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index a811ce43422ec8..0a58ee4a651a96 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -31534,11 +31534,10 @@ static SDValue lowerAtomicArith(SDValue N, SelectionDAG &DAG,
     // Handle (atomic_load_xor p, SignBit) as (atomic_load_add p, SignBit) so we
     // can use LXADD as opposed to cmpxchg.
     if (Opc == ISD::ATOMIC_LOAD_SUB ||
-        (Opc == ISD::ATOMIC_LOAD_XOR && isMinSignedConstant(RHS))) {
-      RHS = DAG.getNode(ISD::SUB, DL, VT, DAG.getConstant(0, DL, VT), RHS);
-      return DAG.getAtomic(ISD::ATOMIC_LOAD_ADD, DL, VT, Chain, LHS, RHS,
-                           AN->getMemOperand());
-    }
+        (Opc == ISD::ATOMIC_LOAD_XOR && isMinSignedConstant(RHS)))
+      return DAG.getAtomic(ISD::ATOMIC_LOAD_ADD, DL, VT, Chain, LHS,
+                           DAG.getNegative(RHS, DL, VT), AN->getMemOperand());
+
     assert(Opc == ISD::ATOMIC_LOAD_ADD &&
            "Used AtomicRMW ops other than Add should have been expanded!");
     return N;


        


More information about the llvm-commits mailing list