1; RUN: llc -march=r600 -mcpu=juniper < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
2
3; FUNC-LABEL: {{^}}test_0:
4; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
5; EG: MOV [[VAL]], literal.x
6; EG-NEXT: LSHR
7; EG-NEXT: 0(
8define amdgpu_kernel void @test_0(i32 %in0, i32 addrspace(1)* %out) {
9entry:
10  %0 = call i32 @llvm.OpenCL.sampler.get.resource.id(i32 %in0) #0
11  store i32 %0, i32 addrspace(1)* %out
12  ret void
13}
14
15; FUNC-LABEL: {{^}}test_1:
16; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
17; EG: MOV [[VAL]], literal.x
18; EG-NEXT: LSHR
19; EG-NEXT: 1(
20define amdgpu_kernel void @test_1(i32 %in0, i32 %in1, i32 addrspace(1)* %out) {
21entry:
22  %0 = call i32 @llvm.OpenCL.sampler.get.resource.id(i32 %in1) #0
23  store i32 %0, i32 addrspace(1)* %out
24  ret void
25}
26
27; FUNC-LABEL: {{^}}test_2:
28; EG: MEM_RAT_CACHELESS STORE_RAW [[VAL:T[0-9]+\.X]]
29; EG: MOV [[VAL]], literal.x
30; EG-NEXT: LSHR
31; EG-NEXT: 2(
32define amdgpu_kernel void @test_2(i32 %in0, i32 %in1, i32 %in2, i32 addrspace(1)* %out) {
33entry:
34  %0 = call i32 @llvm.OpenCL.sampler.get.resource.id(i32 %in2) #0
35  store i32 %0, i32 addrspace(1)* %out
36  ret void
37}
38
39
40declare i32 @llvm.OpenCL.sampler.get.resource.id(i32) #0
41
42attributes #0 = { readnone }
43
44!opencl.kernels = !{!0, !1, !2}
45
46!0 = !{void (i32, i32 addrspace(1)*)* @test_0, !10, !20, !30, !40, !50}
47!10 = !{!"kernel_arg_addr_space", i32 0, i32 1}
48!20 = !{!"kernel_arg_access_qual", !"none", !"none"}
49!30 = !{!"kernel_arg_type", !"sampler_t", !"int*"}
50!40 = !{!"kernel_arg_base_type", !"sampler_t", !"int*"}
51!50 = !{!"kernel_arg_type_qual", !"", !""}
52
53!1 = !{void (i32, i32, i32 addrspace(1)*)* @test_1, !11, !21, !31, !41, !51}
54!11 = !{!"kernel_arg_addr_space", i32 0, i32 0, i32 1}
55!21 = !{!"kernel_arg_access_qual", !"none", !"none", !"none"}
56!31 = !{!"kernel_arg_type", !"sampler_t", !"sampler_t", !"int*"}
57!41 = !{!"kernel_arg_base_type", !"sampler_t", !"sampler_t", !"int*"}
58!51 = !{!"kernel_arg_type_qual", !"", !"", !""}
59
60!2 = !{void (i32, i32, i32, i32 addrspace(1)*)* @test_2, !12, !22, !32, !42, !52}
61!12 = !{!"kernel_arg_addr_space", i32 0, i32 0, i32 0, i32 1}
62!22 = !{!"kernel_arg_access_qual", !"none", !"none", !"none", !"none"}
63!32 = !{!"kernel_arg_type", !"sampler_t", !"sampler_t", !"sampler_t", !"int*"}
64!42 = !{!"kernel_arg_base_type", !"sampler_t", !"sampler_t", !"sampler_t", !"int*"}
65!52 = !{!"kernel_arg_type_qual", !"", !"", !"", !""}
66