Skip to content

Commit

Permalink
[X86] lowerAtomicArith - use DAG::getNegative() helper. NFC.
Browse files Browse the repository at this point in the history
  • Loading branch information
RKSimon committed Apr 30, 2024
1 parent fb2d305 commit f10685f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions llvm/lib/Target/X86/X86ISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f10685f

Please sign in to comment.