blob: af22b0da8bcc610a7823f2ebe09a77e7096c8d7d [file] [log] [blame]
Tom Stellard044e4182014-02-06 18:36:34 +00001; RUN: llc < %s -march=r600 -mcpu=SI -show-mc-encoding -verify-machineinstrs | FileCheck %s
2
3; SMRD load with an immediate offset.
4; CHECK-LABEL: @smrd0
Matt Arsenault4d7d3832014-04-15 22:32:49 +00005; CHECK: S_LOAD_DWORD s{{[0-9]}}, s[{{[0-9]:[0-9]}}], 0x1 ; encoding: [0x01
Tom Stellard044e4182014-02-06 18:36:34 +00006define void @smrd0(i32 addrspace(1)* %out, i32 addrspace(2)* %ptr) {
7entry:
8 %0 = getelementptr i32 addrspace(2)* %ptr, i64 1
9 %1 = load i32 addrspace(2)* %0
10 store i32 %1, i32 addrspace(1)* %out
11 ret void
12}
13
14; SMRD load with the largest possible immediate offset.
15; CHECK-LABEL: @smrd1
Matt Arsenault4d7d3832014-04-15 22:32:49 +000016; CHECK: S_LOAD_DWORD s{{[0-9]}}, s[{{[0-9]:[0-9]}}], 0xff ; encoding: [0xff
Tom Stellard044e4182014-02-06 18:36:34 +000017define void @smrd1(i32 addrspace(1)* %out, i32 addrspace(2)* %ptr) {
18entry:
19 %0 = getelementptr i32 addrspace(2)* %ptr, i64 255
20 %1 = load i32 addrspace(2)* %0
21 store i32 %1, i32 addrspace(1)* %out
22 ret void
23}
24
25; SMRD load with an offset greater than the largest possible immediate.
26; CHECK-LABEL: @smrd2
Matt Arsenault4d7d3832014-04-15 22:32:49 +000027; CHECK: S_MOV_B32 s[[OFFSET:[0-9]]], 0x400
Tom Stellard044e4182014-02-06 18:36:34 +000028; CHECK: S_LOAD_DWORD s{{[0-9]}}, s[{{[0-9]:[0-9]}}], s[[OFFSET]] ; encoding: [0x0[[OFFSET]]
29define void @smrd2(i32 addrspace(1)* %out, i32 addrspace(2)* %ptr) {
30entry:
31 %0 = getelementptr i32 addrspace(2)* %ptr, i64 256
32 %1 = load i32 addrspace(2)* %0
33 store i32 %1, i32 addrspace(1)* %out
34 ret void
35}
36
37; SMRD load using the load.const intrinsic with an immediate offset
38; CHECK-LABEL: @smrd_load_const0
Matt Arsenault4d7d3832014-04-15 22:32:49 +000039; CHECK: S_BUFFER_LOAD_DWORD s{{[0-9]}}, s[{{[0-9]:[0-9]}}], 0x4 ; encoding: [0x04
Tom Stellard044e4182014-02-06 18:36:34 +000040define void @smrd_load_const0(<16 x i8> addrspace(2)* inreg, <16 x i8> addrspace(2)* inreg, <32 x i8> addrspace(2)* inreg, i32 inreg, <2 x i32>, <2 x i32>, <2 x i32>, <3 x i32>, <2 x i32>, <2 x i32>, <2 x i32>, float, float, float, float, float, float, float, float, float) #0 {
41main_body:
42 %20 = getelementptr <16 x i8> addrspace(2)* %0, i32 0
43 %21 = load <16 x i8> addrspace(2)* %20
44 %22 = call float @llvm.SI.load.const(<16 x i8> %21, i32 16)
45 call void @llvm.SI.export(i32 15, i32 1, i32 1, i32 0, i32 0, float %22, float %22, float %22, float %22)
46 ret void
47}
48
49; SMRD load using the load.const intrinsic with an offset greater largest possible
50; immediate offset.
51; CHECK-LABEL: @smrd_load_const1
Matt Arsenault4d7d3832014-04-15 22:32:49 +000052; CHECK: S_BUFFER_LOAD_DWORD s{{[0-9]}}, s[{{[0-9]:[0-9]}}], 0xff ; encoding: [0xff
Tom Stellard044e4182014-02-06 18:36:34 +000053define void @smrd_load_const1(<16 x i8> addrspace(2)* inreg, <16 x i8> addrspace(2)* inreg, <32 x i8> addrspace(2)* inreg, i32 inreg, <2 x i32>, <2 x i32>, <2 x i32>, <3 x i32>, <2 x i32>, <2 x i32>, <2 x i32>, float, float, float, float, float, float, float, float, float) #0 {
54main_body:
55 %20 = getelementptr <16 x i8> addrspace(2)* %0, i32 0
56 %21 = load <16 x i8> addrspace(2)* %20
57 %22 = call float @llvm.SI.load.const(<16 x i8> %21, i32 1020)
58 call void @llvm.SI.export(i32 15, i32 1, i32 1, i32 0, i32 0, float %22, float %22, float %22, float %22)
59 ret void
60}
61; SMRD load using the load.const intrinsic with the largetst possible
62; immediate offset.
63; CHECK-LABEL: @smrd_load_const2
64; CHECK: S_BUFFER_LOAD_DWORD s{{[0-9]}}, s[{{[0-9]:[0-9]}}], s[[OFFSET]] ; encoding: [0x0[[OFFSET]]
65define void @smrd_load_const2(<16 x i8> addrspace(2)* inreg, <16 x i8> addrspace(2)* inreg, <32 x i8> addrspace(2)* inreg, i32 inreg, <2 x i32>, <2 x i32>, <2 x i32>, <3 x i32>, <2 x i32>, <2 x i32>, <2 x i32>, float, float, float, float, float, float, float, float, float) #0 {
66main_body:
67 %20 = getelementptr <16 x i8> addrspace(2)* %0, i32 0
68 %21 = load <16 x i8> addrspace(2)* %20
69 %22 = call float @llvm.SI.load.const(<16 x i8> %21, i32 1024)
70 call void @llvm.SI.export(i32 15, i32 1, i32 1, i32 0, i32 0, float %22, float %22, float %22, float %22)
71 ret void
72}
73
74; Function Attrs: nounwind readnone
75declare float @llvm.SI.load.const(<16 x i8>, i32) #1
76
77declare void @llvm.SI.export(i32, i32, i32, i32, i32, float, float, float, float)
78
79attributes #0 = { "ShaderType"="0" }
80attributes #1 = { nounwind readnone }