summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen
diff options
context:
space:
mode:
authorJustin Lebar <jlebar@google.com>2016-04-01 01:09:07 +0000
committerJustin Lebar <jlebar@google.com>2016-04-01 01:09:07 +0000
commitefcc81cbb4852faec3c0deb20e35225244c67fcb (patch)
tree523f824d063561e4417d931369b2bc7454304300 /llvm/test/CodeGen
parent645c3014a12cc24b75556d93db2ecfa4b99f8635 (diff)
downloadbcm5719-llvm-efcc81cbb4852faec3c0deb20e35225244c67fcb.tar.gz
bcm5719-llvm-efcc81cbb4852faec3c0deb20e35225244c67fcb.zip
[NVPTX] Read __CUDA_FTZ from module flags in NVVMReflect.
Summary: Previously the NVVMReflect pass would read its configuration from command-line flags or a static configuration given to the pass at instantiation time. This doesn't quite work for clang's use-case. It needs to pass a value for __CUDA_FTZ down on a per-module basis. We use a module flag for this, so the NVVMReflect pass needs to be updated to read said flag. Reviewers: tra, rnk Subscribers: cfe-commits, jholewinski Differential Revision: http://reviews.llvm.org/D18672 llvm-svn: 265090
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r--llvm/test/CodeGen/NVPTX/nvvm-reflect-module-flag.ll13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/NVPTX/nvvm-reflect-module-flag.ll b/llvm/test/CodeGen/NVPTX/nvvm-reflect-module-flag.ll
new file mode 100644
index 00000000000..4fdab5c087d
--- /dev/null
+++ b/llvm/test/CodeGen/NVPTX/nvvm-reflect-module-flag.ll
@@ -0,0 +1,13 @@
+; RUN: opt < %s -S -nvvm-reflect | FileCheck %s
+
+declare i32 @__nvvm_reflect(i8*)
+@str = private unnamed_addr addrspace(1) constant [11 x i8] c"__CUDA_FTZ\00"
+
+define i32 @foo() {
+ %call = call i32 @__nvvm_reflect(i8* addrspacecast (i8 addrspace(1)* getelementptr inbounds ([11 x i8], [11 x i8] addrspace(1)* @str, i32 0, i32 0) to i8*))
+ ; CHECK: ret i32 42
+ ret i32 %call
+}
+
+!llvm.module.flags = !{!0}
+!0 = !{i32 4, !"nvvm-reflect-ftz", i32 42}
OpenPOWER on IntegriCloud