summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/AMDGPU/global-constant.ll
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2015-12-10 02:13:01 +0000
committerTom Stellard <thomas.stellard@amd.com>2015-12-10 02:13:01 +0000
commitc93fc11f36c5d9c85c471bb36367d30885a56087 (patch)
tree1e26a1d42b1cf42d9c8bfee59798a316eac4ed34 /llvm/test/CodeGen/AMDGPU/global-constant.ll
parentb3c3bda512712feb662ae03758dfb6fc0c05fe20 (diff)
downloadbcm5719-llvm-c93fc11f36c5d9c85c471bb36367d30885a56087.tar.gz
bcm5719-llvm-c93fc11f36c5d9c85c471bb36367d30885a56087.zip
AMDGPU/SI: Emit constant arrays in the .text section
Summary: This allows us to remove the END_OF_TEXT_LABEL hack we had been using and simplifies the fixups used to compute the address of constant arrays. Reviewers: arsenm Subscribers: arsenm, llvm-commits Differential Revision: http://reviews.llvm.org/D15257 llvm-svn: 255204
Diffstat (limited to 'llvm/test/CodeGen/AMDGPU/global-constant.ll')
-rw-r--r--llvm/test/CodeGen/AMDGPU/global-constant.ll25
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/AMDGPU/global-constant.ll b/llvm/test/CodeGen/AMDGPU/global-constant.ll
new file mode 100644
index 00000000000..b52a0a10313
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/global-constant.ll
@@ -0,0 +1,25 @@
+; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
+
+@readonly = private unnamed_addr addrspace(2) constant [4 x float] [float 0.0, float 1.0, float 2.0, float 3.0]
+@readonly2 = private unnamed_addr addrspace(2) constant [4 x float] [float 4.0, float 5.0, float 6.0, float 7.0]
+
+; GCN-LABEL: {{^}}main:
+; GCN: s_getpc_b64 s{{\[}}[[PC0_LO:[0-9]+]]:[[PC0_HI:[0-9]+]]{{\]}}
+; GCN-NEXT: s_add_u32 s{{[0-9]+}}, s[[PC0_LO]], readonly
+; GCN: s_addc_u32 s{{[0-9]+}}, s[[PC0_HI]], 0
+; GCN: s_getpc_b64 s{{\[}}[[PC1_LO:[0-9]+]]:[[PC1_HI:[0-9]+]]{{\]}}
+; GCN-NEXT: s_add_u32 s{{[0-9]+}}, s[[PC1_LO]], readonly
+; GCN: s_addc_u32 s{{[0-9]+}}, s[[PC1_HI]], 0
+; GCN: .text
+; GCN: readonly:
+; GCN: readonly2:
+define void @main(i32 %index, float addrspace(1)* %out) {
+ %ptr = getelementptr [4 x float], [4 x float] addrspace(2) * @readonly, i32 0, i32 %index
+ %val = load float, float addrspace(2)* %ptr
+ store float %val, float addrspace(1)* %out
+ %ptr2 = getelementptr [4 x float], [4 x float] addrspace(2) * @readonly2, i32 0, i32 %index
+ %val2 = load float, float addrspace(2)* %ptr2
+ store float %val2, float addrspace(1)* %out
+ ret void
+}
+
OpenPOWER on IntegriCloud