Skip to content

Commit

Permalink
No neg in atomics
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasSte committed Dec 12, 2024
1 parent f082558 commit cab0eaa
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions llvm/lib/Target/SBF/SBFInstrInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -883,9 +883,19 @@ let Constraints = "$dst = $val" in {
// atomic_load_sub can be represented as a neg followed
// by an atomic_load_add.
def : Pat<(atomic_load_sub_32 ADDRri:$addr, GPR32:$val),
(XFADDW32 ADDRri:$addr, (NEG_32 GPR32:$val))>;
(XFADDW32 ADDRri:$addr, (NEG_32 GPR32:$val))>,
Requires<[SBFHasNeg]>;
def : Pat<(atomic_load_sub_64 ADDRri:$addr, GPR:$val),
(XFADDD ADDRri:$addr, (NEG_64 GPR:$val))>;
(XFADDD ADDRri:$addr, (NEG_64 GPR:$val))>,
Requires<[SBFHasNeg]>;

// In SBFv2, we don't have neg
def : Pat<(atomic_load_sub_32 ADDRri:$addr, GPR32:$val),
(XFADDW32 ADDRri:$addr, (SUB_ri_32 GPR32:$val, (i32 0)))>,
Requires<[SBFNoNeg]>;
def : Pat<(atomic_load_sub_64 ADDRri:$addr, GPR:$val),
(XFADDD ADDRri:$addr, (SUB_ri GPR:$val, (i64 0)))>,
Requires<[SBFNoNeg]>;

let usesCustomInserter = 1, isCodeGenOnly = 1 in {
def ATOMIC_FENCE : Pseudo<
Expand Down

0 comments on commit cab0eaa

Please sign in to comment.