summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/Target/AMDGPU/R600AsmPrinter.cpp4
-rw-r--r--llvm/test/CodeGen/AMDGPU/r600.func-alignment.ll13
2 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/Target/AMDGPU/R600AsmPrinter.cpp b/llvm/lib/Target/AMDGPU/R600AsmPrinter.cpp
index 37ecbf7a869..ea247a07329 100644
--- a/llvm/lib/Target/AMDGPU/R600AsmPrinter.cpp
+++ b/llvm/lib/Target/AMDGPU/R600AsmPrinter.cpp
@@ -103,6 +103,10 @@ void R600AsmPrinter::EmitProgramInfoR600(const MachineFunction &MF) {
bool R600AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
+
+ // Functions needs to be cacheline (256B) aligned.
+ MF.ensureAlignment(8);
+
SetupMachineFunction(MF);
MCContext &Context = getObjFileLowering().getContext();
diff --git a/llvm/test/CodeGen/AMDGPU/r600.func-alignment.ll b/llvm/test/CodeGen/AMDGPU/r600.func-alignment.ll
new file mode 100644
index 00000000000..d8db3061d37
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/r600.func-alignment.ll
@@ -0,0 +1,13 @@
+; RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck %s
+; RUN: llc < %s -march=r600 -mcpu=rs880 | FileCheck %s
+
+; CHECK: .globl test
+; Functions need to be cacheline (256B) aligned to prevent GPU hangs
+; CHECK: .p2align 8
+; CHECK: {{^}}test:
+; CHECK: CF_END
+
+define amdgpu_ps void @test(<4 x float> inreg %reg0) {
+entry:
+ ret void
+}
OpenPOWER on IntegriCloud