[llvm] d9630c3 - [PowerPC][GISel] Select sync instructions required by atomic operations
Kai Luo via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 11 00:25:53 PST 2023
Author: Kai Luo
Date: 2023-01-11T16:25:46+08:00
New Revision: d9630c34f44d9ab88fcbe5726a153eef03f82476
URL: https://github.com/llvm/llvm-project/commit/d9630c34f44d9ab88fcbe5726a153eef03f82476
DIFF: https://github.com/llvm/llvm-project/commit/d9630c34f44d9ab88fcbe5726a153eef03f82476.diff
LOG: [PowerPC][GISel] Select sync instructions required by atomic operations
This is part of selecting `G_ATOMIC*` instructions. Select `isync`, `sync` and `lwsync` in GISel.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D141360
Added:
llvm/test/CodeGen/PowerPC/GlobalISel/ppc-isel-sync.ll
Modified:
llvm/lib/Target/PowerPC/GISel/PPCRegisterBankInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/PowerPC/GISel/PPCRegisterBankInfo.cpp b/llvm/lib/Target/PowerPC/GISel/PPCRegisterBankInfo.cpp
index 69d9a04109a56..ff8bb16ba9c8a 100644
--- a/llvm/lib/Target/PowerPC/GISel/PPCRegisterBankInfo.cpp
+++ b/llvm/lib/Target/PowerPC/GISel/PPCRegisterBankInfo.cpp
@@ -175,6 +175,13 @@ PPCRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
getValueMapping(PMI_GPR64)});
break;
}
+ case TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS: {
+ // FIXME: We have to check every operand in this MI and compute value
+ // mapping accordingly.
+ SmallVector<const ValueMapping *, 8> OpdsMapping(NumOperands);
+ OperandsMapping = getOperandsMapping(OpdsMapping);
+ break;
+ }
default:
return getInvalidInstructionMapping();
}
diff --git a/llvm/test/CodeGen/PowerPC/GlobalISel/ppc-isel-sync.ll b/llvm/test/CodeGen/PowerPC/GlobalISel/ppc-isel-sync.ll
new file mode 100644
index 0000000000000..39869287c3e1e
--- /dev/null
+++ b/llvm/test/CodeGen/PowerPC/GlobalISel/ppc-isel-sync.ll
@@ -0,0 +1,21 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64le -global-isel \
+; RUN: -ppc-asm-full-reg-names < %s | FileCheck %s
+
+declare void @llvm.ppc.isync()
+declare void @llvm.ppc.sync()
+declare void @llvm.ppc.lwsync()
+
+define void @test_sync() {
+; CHECK-LABEL: test_sync:
+; CHECK: # %bb.0: # %entry
+; CHECK-NEXT: isync
+; CHECK-NEXT: sync
+; CHECK-NEXT: lwsync
+; CHECK-NEXT: blr
+entry:
+ call void @llvm.ppc.isync()
+ call void @llvm.ppc.sync()
+ call void @llvm.ppc.lwsync()
+ ret void
+}
More information about the llvm-commits
mailing list