summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/NVPTX
diff options
context:
space:
mode:
authorJustin Lebar <jlebar@google.com>2016-03-01 19:24:03 +0000
committerJustin Lebar <jlebar@google.com>2016-03-01 19:24:03 +0000
commitb5ca00a58de52d33c1935f49ce104f9d90cda67c (patch)
tree9f51d1461cb3017df95bdb34f3bb02b646896d3e /llvm/test/CodeGen/NVPTX
parent93e7a9b91c931ea65e6974ab7dfef93ce1359176 (diff)
downloadbcm5719-llvm-b5ca00a58de52d33c1935f49ce104f9d90cda67c.tar.gz
bcm5719-llvm-b5ca00a58de52d33c1935f49ce104f9d90cda67c.zip
[NVPTX] Use different, convergent MIs for convergent calls.
Summary: Calls sometimes need to be convergent. This is already handled at the LLVM IR level, but it also needs to be handled at the MI level. Ideally we'd propagate convergence from instructions, down through the selection DAG, and into MIs. But this is Hard, and would affect optimizations in the SDNs -- right now only SDNs with two operands have any flags at all. Instead, here's a much simpler hack: Add new opcodes for NVPTX for convergent calls, and generate these when lowering convergent LLVM calls. Reviewers: jholewinski Subscribers: jholewinski, chandlerc, joker.eph, jhen, tra, llvm-commits Differential Revision: http://reviews.llvm.org/D17423 llvm-svn: 262373
Diffstat (limited to 'llvm/test/CodeGen/NVPTX')
-rw-r--r--llvm/test/CodeGen/NVPTX/convergent-mir-call.ll27
1 files changed, 27 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/NVPTX/convergent-mir-call.ll b/llvm/test/CodeGen/NVPTX/convergent-mir-call.ll
new file mode 100644
index 00000000000..18142450490
--- /dev/null
+++ b/llvm/test/CodeGen/NVPTX/convergent-mir-call.ll
@@ -0,0 +1,27 @@
+; RUN: llc -mtriple nvptx64-nvidia-cuda -stop-after machine-cp -o - < %s 2>&1 | FileCheck %s
+
+; Check that convergent calls are emitted using convergent MIR instructions,
+; while non-convergent calls are not.
+
+target triple = "nvptx64-nvidia-cuda"
+
+declare void @conv() convergent
+declare void @not_conv()
+
+define void @test(void ()* %f) {
+ ; CHECK: ConvergentCallUniPrintCall
+ ; CHECK-NEXT: @conv
+ call void @conv()
+
+ ; CHECK: CallUniPrintCall
+ ; CHECK-NEXT: @not_conv
+ call void @not_conv()
+
+ ; CHECK: ConvergentCallPrintCall
+ call void %f() convergent
+
+ ; CHECK: CallPrintCall
+ call void %f()
+
+ ret void
+}
OpenPOWER on IntegriCloud