blob: bc5f031cd4a2931c29eb4e5eebd1b30890cae29a [file] [log] [blame]
Tom Stellard29dd05e2015-12-15 22:39:36 +00001; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=NOHSA %s
2; RUN: llc -mtriple=amdgcn--amdhsa -mcpu=kaveri -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=HSA %s
Tom Stellardc93fc112015-12-10 02:13:01 +00003
4@readonly = private unnamed_addr addrspace(2) constant [4 x float] [float 0.0, float 1.0, float 2.0, float 3.0]
5@readonly2 = private unnamed_addr addrspace(2) constant [4 x float] [float 4.0, float 5.0, float 6.0, float 7.0]
6
7; GCN-LABEL: {{^}}main:
8; GCN: s_getpc_b64 s{{\[}}[[PC0_LO:[0-9]+]]:[[PC0_HI:[0-9]+]]{{\]}}
9; GCN-NEXT: s_add_u32 s{{[0-9]+}}, s[[PC0_LO]], readonly
10; GCN: s_addc_u32 s{{[0-9]+}}, s[[PC0_HI]], 0
11; GCN: s_getpc_b64 s{{\[}}[[PC1_LO:[0-9]+]]:[[PC1_HI:[0-9]+]]{{\]}}
12; GCN-NEXT: s_add_u32 s{{[0-9]+}}, s[[PC1_LO]], readonly
13; GCN: s_addc_u32 s{{[0-9]+}}, s[[PC1_HI]], 0
Tom Stellard29dd05e2015-12-15 22:39:36 +000014; NOHSA: .text
15; HSA: .hsatext
Tom Stellardc93fc112015-12-10 02:13:01 +000016; GCN: readonly:
17; GCN: readonly2:
18define void @main(i32 %index, float addrspace(1)* %out) {
19 %ptr = getelementptr [4 x float], [4 x float] addrspace(2) * @readonly, i32 0, i32 %index
20 %val = load float, float addrspace(2)* %ptr
21 store float %val, float addrspace(1)* %out
22 %ptr2 = getelementptr [4 x float], [4 x float] addrspace(2) * @readonly2, i32 0, i32 %index
23 %val2 = load float, float addrspace(2)* %ptr2
24 store float %val2, float addrspace(1)* %out
25 ret void
26}
27