const MachineBasicBlock::iterator &MI);
/// \returns Atomic cmpxchg/rmw info if \p MI is an atomic cmpxchg or
/// rmw operation, "None" otherwise.
- static Optional<SIMemOpInfo> getAtomicCmpxchgInfo(
+ static Optional<SIMemOpInfo> getAtomicCmpxchgOrRmwInfo(
const MachineBasicBlock::iterator &MI);
/// \brief Reports unknown synchronization scope used in \p MI to LLVM
unsigned Vmcnt0Immediate = 0;
/// \brief Opcode for cache invalidation instruction (L1).
- unsigned Wbinvl1Opcode = 0;
+ unsigned VmemSIMDCacheInvalidateOpc = 0;
/// \brief List of atomic pseudo instructions.
std::list<MachineBasicBlock::iterator> AtomicPseudoMIs;
/// \brief Inserts "buffer_wbinvl1_vol" instruction \p Before or after \p MI.
/// Always returns true.
- bool insertBufferWbinvl1Vol(MachineBasicBlock::iterator &MI,
- bool Before = true) const;
+ bool insertVmemSIMDCacheInvalidate(MachineBasicBlock::iterator &MI,
+ bool Before = true) const;
/// \brief Inserts "s_waitcnt vmcnt(0)" instruction \p Before or after \p MI.
/// Always returns true.
bool insertWaitcntVmcnt0(MachineBasicBlock::iterator &MI,
MachineBasicBlock::iterator &MI);
/// \brief Expands atomic cmpxchg or rmw operation \p MI. Returns true if
/// instructions are added/deleted or \p MI is modified, false otherwise.
- bool expandAtomicCmpxchg(const SIMemOpInfo &MOI,
- MachineBasicBlock::iterator &MI);
+ bool expandAtomicCmpxchgOrRmw(const SIMemOpInfo &MOI,
+ MachineBasicBlock::iterator &MI);
public:
static char ID;
}
/* static */
-Optional<SIMemOpInfo> SIMemOpInfo::getAtomicCmpxchgInfo(
+Optional<SIMemOpInfo> SIMemOpInfo::getAtomicCmpxchgOrRmwInfo(
const MachineBasicBlock::iterator &MI) {
assert(MI->getDesc().TSFlags & SIInstrFlags::maybeAtomic);
CTX->diagnose(Diag);
}
-bool SIMemoryLegalizer::insertBufferWbinvl1Vol(MachineBasicBlock::iterator &MI,
- bool Before) const {
+bool SIMemoryLegalizer::insertVmemSIMDCacheInvalidate(
+ MachineBasicBlock::iterator &MI, bool Before) const {
MachineBasicBlock &MBB = *MI->getParent();
DebugLoc DL = MI->getDebugLoc();
if (!Before)
++MI;
- BuildMI(MBB, MI, DL, TII->get(Wbinvl1Opcode));
+ BuildMI(MBB, MI, DL, TII->get(VmemSIMDCacheInvalidateOpc));
if (!Before)
--MI;
if (MOI.getOrdering() == AtomicOrdering::Acquire ||
MOI.getOrdering() == AtomicOrdering::SequentiallyConsistent) {
Changed |= insertWaitcntVmcnt0(MI, false);
- Changed |= insertBufferWbinvl1Vol(MI, false);
+ Changed |= insertVmemSIMDCacheInvalidate(MI, false);
}
return Changed;
if (MOI.getOrdering() == AtomicOrdering::Acquire ||
MOI.getOrdering() == AtomicOrdering::AcquireRelease ||
MOI.getOrdering() == AtomicOrdering::SequentiallyConsistent)
- Changed |= insertBufferWbinvl1Vol(MI);
+ Changed |= insertVmemSIMDCacheInvalidate(MI);
AtomicPseudoMIs.push_back(MI);
return Changed;
return Changed;
}
-bool SIMemoryLegalizer::expandAtomicCmpxchg(const SIMemOpInfo &MOI,
- MachineBasicBlock::iterator &MI) {
+bool SIMemoryLegalizer::expandAtomicCmpxchgOrRmw(const SIMemOpInfo &MOI,
+ MachineBasicBlock::iterator &MI) {
assert(MI->mayLoad() && MI->mayStore());
bool Changed = false;
MOI.getFailureOrdering() == AtomicOrdering::Acquire ||
MOI.getFailureOrdering() == AtomicOrdering::SequentiallyConsistent) {
Changed |= insertWaitcntVmcnt0(MI, false);
- Changed |= insertBufferWbinvl1Vol(MI, false);
+ Changed |= insertVmemSIMDCacheInvalidate(MI, false);
}
return Changed;
Vmcnt0Immediate =
AMDGPU::encodeWaitcnt(IV, 0, getExpcntBitMask(IV), getLgkmcntBitMask(IV));
- Wbinvl1Opcode = ST.getGeneration() <= AMDGPUSubtarget::SOUTHERN_ISLANDS ?
- AMDGPU::BUFFER_WBINVL1 : AMDGPU::BUFFER_WBINVL1_VOL;
+ VmemSIMDCacheInvalidateOpc =
+ ST.getGeneration() <= AMDGPUSubtarget::SOUTHERN_ISLANDS ?
+ AMDGPU::BUFFER_WBINVL1 : AMDGPU::BUFFER_WBINVL1_VOL;
for (auto &MBB : MF) {
for (auto MI = MBB.begin(); MI != MBB.end(); ++MI) {
Changed |= expandStore(MOI.getValue(), MI);
else if (const auto &MOI = SIMemOpInfo::getAtomicFenceInfo(MI))
Changed |= expandAtomicFence(MOI.getValue(), MI);
- else if (const auto &MOI = SIMemOpInfo::getAtomicCmpxchgInfo(MI))
- Changed |= expandAtomicCmpxchg(MOI.getValue(), MI);
+ else if (const auto &MOI = SIMemOpInfo::getAtomicCmpxchgOrRmwInfo(MI))
+ Changed |= expandAtomicCmpxchgOrRmw(MOI.getValue(), MI);
}
}