Skip to content

Commit d9630c3

Browse files
author
Kai Luo
committed
[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
1 parent ad551c1 commit d9630c3

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

llvm/lib/Target/PowerPC/GISel/PPCRegisterBankInfo.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,13 @@ PPCRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
175175
getValueMapping(PMI_GPR64)});
176176
break;
177177
}
178+
case TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS: {
179+
// FIXME: We have to check every operand in this MI and compute value
180+
// mapping accordingly.
181+
SmallVector<const ValueMapping *, 8> OpdsMapping(NumOperands);
182+
OperandsMapping = getOperandsMapping(OpdsMapping);
183+
break;
184+
}
178185
default:
179186
return getInvalidInstructionMapping();
180187
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2+
; RUN: llc -verify-machineinstrs -mtriple=powerpc64le -global-isel \
3+
; RUN: -ppc-asm-full-reg-names < %s | FileCheck %s
4+
5+
declare void @llvm.ppc.isync()
6+
declare void @llvm.ppc.sync()
7+
declare void @llvm.ppc.lwsync()
8+
9+
define void @test_sync() {
10+
; CHECK-LABEL: test_sync:
11+
; CHECK: # %bb.0: # %entry
12+
; CHECK-NEXT: isync
13+
; CHECK-NEXT: sync
14+
; CHECK-NEXT: lwsync
15+
; CHECK-NEXT: blr
16+
entry:
17+
call void @llvm.ppc.isync()
18+
call void @llvm.ppc.sync()
19+
call void @llvm.ppc.lwsync()
20+
ret void
21+
}

0 commit comments

Comments
 (0)