Utilise a similar lowering strategy to D47882.
All cmpxchg are lowered as 'strong' currently and failure ordering is ignored. I believe this is conservative but correct.
Paths
| Differential D48131
[RISCV] Implement codegen for cmpxchg on RV32IA ClosedPublic Authored by asb on Jun 13 2018, 8:21 AM.
Details Summary Utilise a similar lowering strategy to D47882. All cmpxchg are lowered as 'strong' currently and failure ordering is ignored. I believe this is conservative but correct.
Diff Detail
Event TimelineHerald added subscribers: rogfer01, mgrang, edward-jones and 9 others. · View Herald TranscriptJun 13 2018, 8:21 AM Comment Actions You can introduce a target-specific SelectionDAG node without adding a corresponding IR intrinsic. See ISD::FIRST_TARGET_MEMORY_OPCODE. Comment Actions I obviously haven't been following RISC-V enough to give final reviews, but this mostly looked sensible to me. Just one question:
asb removed a parent revision: D48129: [AtomicExpandPass] Widen partword atomicrmw or/xor/and before tryExpandAtomicRMW.Aug 16 2018, 2:17 AM asb marked 3 inline comments as done. Comment ActionsUpdated so common code for generating masks etc is reused through AtomicExpandPass. Herald added subscribers: jocewei, PkmX, rkruppe and 3 others. · View Herald TranscriptSep 18 2018, 7:23 AM Comment Actions
(Sorry, just noticed I had an unsubmitted comment here). I think in this case I do need an intrinsic, as I want mask calculation and so on to be produced as early as possible (i.e. in IR with the help of AtomicExpandPass), and then want to pass this through to my target pseudo-instruction. The only way of doing so is via an intrinsic. If the mask generation were taking place when creating or transforming the SelectionDAG it seems ISD::FIRST_TARGET_MEMORY_OPCODE would be the best approach.
asb marked an inline comment as done. Comment ActionsUpdate to consistently use loophead/looptail labels in comments.
asb retitled this revision from [RISCV] Implement codegen for cmpxchg on RV32I to [RISCV] Implement codegen for cmpxchg on RV32IA. Comment ActionsRebased patch. No changes, but I had to re-generate the new atomic-cmpxchg.ll lines as regalloc is slightly different after the recent enableMultipleCopyHints change. Comment Actions I've re-checked this patch still applies cleanly against current HEAD. Ping? I'd really like to get this landed to complete this atomics lowering work. lewis-revill added inline comments.
Comment Actions This patch still applies with minimal fuzz and all tests still pass. I'd really appreciate a review. Ping? This revision is now accepted and ready to land.Nov 29 2018, 11:53 AM Closed by commit rL347914: [RISCV] Implement codegen for cmpxchg on RV32IA (authored by asb). · Explain WhyNov 29 2018, 12:46 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 175936 llvm/trunk/include/llvm/IR/IntrinsicsRISCV.td
llvm/trunk/lib/CodeGen/AtomicExpandPass.cpp
llvm/trunk/lib/Target/RISCV/RISCVExpandPseudoInsts.cpp
llvm/trunk/lib/Target/RISCV/RISCVISelLowering.h
llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/trunk/lib/Target/RISCV/RISCVInstrInfoA.td
llvm/trunk/test/CodeGen/RISCV/atomic-cmpxchg.ll
|