1 // NOTE
: Assertions have been autogenerated by utils
/update_cc_test_checks.py
2 // REQUIRES
: amdgpu-registered-target
3 // RUN
: %clang_cc1 -triple amdgcn-unknown-unknown -cl-std
=CL2.0 -target-cpu verde -emit-llvm -o - %s | FileCheck %s
5 // CHECK-LABEL
: @test_amdgcn_make_buffer_rsrc_p0
(
7 // CHECK-NEXT
: [[TMP0
:%.
*]] = tail call ptr addrspace
(8) @llvm.amdgcn.make.buffer.rsrc.p0
(ptr [[P
:%.
*]], i16
[[STRIDE
:%.
*]], i32
[[NUM
:%.
*]], i32
[[FLAGS
:%.
*]])
8 // CHECK-NEXT
: ret ptr addrspace
(8) [[TMP0]]
10 __amdgpu_buffer_rsrc_t test_amdgcn_make_buffer_rsrc_p0(void *p, short stride, int num, int flags) {
11 return __builtin_amdgcn_make_buffer_rsrc(p, stride, num, flags);
14 // CHECK-LABEL: @test_amdgcn_make_buffer_rsrc_p0_stride_constant(
16 // CHECK-NEXT: [[TMP0:%.*]] = tail call ptr addrspace(8) @llvm.amdgcn.make.buffer.rsrc.p0(ptr [[P:%.*]], i16 4, i32 [[NUM:%.*]], i32 [[FLAGS:%.*]])
17 // CHECK-NEXT: ret ptr addrspace(8) [[TMP0]]
19 __amdgpu_buffer_rsrc_t test_amdgcn_make_buffer_rsrc_p0_stride_constant
(void *p
, int num
, int flags
) {
20 return __builtin_amdgcn_make_buffer_rsrc
(p, /*stride
=*/4, num
, flags
);
23 // CHECK-LABEL
: @test_amdgcn_make_buffer_rsrc_p0_num_constant
(
25 // CHECK-NEXT
: [[TMP0
:%.
*]] = tail call ptr addrspace
(8) @llvm.amdgcn.make.buffer.rsrc.p0
(ptr [[P
:%.
*]], i16
[[STRIDE
:%.
*]], i32
1234, i32
[[FLAGS
:%.
*]])
26 // CHECK-NEXT
: ret ptr addrspace
(8) [[TMP0]]
28 __amdgpu_buffer_rsrc_t test_amdgcn_make_buffer_rsrc_p0_num_constant(void *p, short stride, int flags) {
29 return __builtin_amdgcn_make_buffer_rsrc(p, stride, /*num=*/1234, flags);
32 // CHECK-LABEL: @test_amdgcn_make_buffer_rsrc_p0_flags_constant(
34 // CHECK-NEXT: [[TMP0:%.*]] = tail call ptr addrspace(8) @llvm.amdgcn.make.buffer.rsrc.p0(ptr [[P:%.*]], i16 [[STRIDE:%.*]], i32 [[NUM:%.*]], i32 5678)
35 // CHECK-NEXT: ret ptr addrspace(8) [[TMP0]]
37 __amdgpu_buffer_rsrc_t test_amdgcn_make_buffer_rsrc_p0_flags_constant
(void *p
, short stride
, int num
) {
38 return __builtin_amdgcn_make_buffer_rsrc
(p, stride
, num
, /*flags
=*/5678);
41 // CHECK-LABEL
: @test_amdgcn_make_buffer_rsrc_p1
(
43 // CHECK-NEXT
: [[TMP0
:%.
*]] = tail call ptr addrspace
(8) @llvm.amdgcn.make.buffer.rsrc.p1
(ptr addrspace
(1) [[P
:%.
*]], i16
[[STRIDE
:%.
*]], i32
[[NUM
:%.
*]], i32
[[FLAGS
:%.
*]])
44 // CHECK-NEXT
: ret ptr addrspace
(8) [[TMP0]]
46 __amdgpu_buffer_rsrc_t test_amdgcn_make_buffer_rsrc_p1(global void *p, short stride, int num, int flags) {
47 return __builtin_amdgcn_make_buffer_rsrc(p, stride, num, flags);
50 // CHECK-LABEL: @test_amdgcn_make_buffer_rsrc_p1_stride_constant(
52 // CHECK-NEXT: [[TMP0:%.*]] = tail call ptr addrspace(8) @llvm.amdgcn.make.buffer.rsrc.p1(ptr addrspace(1) [[P:%.*]], i16 4, i32 [[NUM:%.*]], i32 [[FLAGS:%.*]])
53 // CHECK-NEXT: ret ptr addrspace(8) [[TMP0]]
55 __amdgpu_buffer_rsrc_t test_amdgcn_make_buffer_rsrc_p1_stride_constant
(global void
*p
, int num
, int flags
) {
56 return __builtin_amdgcn_make_buffer_rsrc
(p, /*stride
=*/4, num
, flags
);
59 // CHECK-LABEL
: @test_amdgcn_make_buffer_rsrc_p1_num_constant
(
61 // CHECK-NEXT
: [[TMP0
:%.
*]] = tail call ptr addrspace
(8) @llvm.amdgcn.make.buffer.rsrc.p1
(ptr addrspace
(1) [[P
:%.
*]], i16
[[STRIDE
:%.
*]], i32
1234, i32
[[FLAGS
:%.
*]])
62 // CHECK-NEXT
: ret ptr addrspace
(8) [[TMP0]]
64 __amdgpu_buffer_rsrc_t test_amdgcn_make_buffer_rsrc_p1_num_constant(global void *p, short stride, int flags) {
65 return __builtin_amdgcn_make_buffer_rsrc(p, stride, /*num=*/1234, flags);
68 // CHECK-LABEL: @test_amdgcn_make_buffer_rsrc_p1_flags_constant(
70 // CHECK-NEXT: [[TMP0:%.*]] = tail call ptr addrspace(8) @llvm.amdgcn.make.buffer.rsrc.p1(ptr addrspace(1) [[P:%.*]], i16 [[STRIDE:%.*]], i32 [[NUM:%.*]], i32 5678)
71 // CHECK-NEXT: ret ptr addrspace(8) [[TMP0]]
73 __amdgpu_buffer_rsrc_t test_amdgcn_make_buffer_rsrc_p1_flags_constant
(global void
*p
, short stride
, int num
) {
74 return __builtin_amdgcn_make_buffer_rsrc
(p, stride
, num
, /*flags
=*/5678);
77 // CHECK-LABEL
: @test_amdgcn_make_buffer_p0_nullptr
(
79 // CHECK-NEXT
: [[TMP0
:%.
*]] = tail call ptr addrspace
(8) @llvm.amdgcn.make.buffer.rsrc.p0
(ptr null
, i16
[[STRIDE
:%.
*]], i32
[[NUM
:%.
*]], i32
[[FLAGS
:%.
*]])
80 // CHECK-NEXT
: ret ptr addrspace
(8) [[TMP0]]
82 __amdgpu_buffer_rsrc_t test_amdgcn_make_buffer_p0_nullptr(short stride, int num, int flags) {
83 return __builtin_amdgcn_make_buffer_rsrc((void *)0LL, stride, num, flags);
86 // CHECK-LABEL: @test_amdgcn_make_buffer_p1_nullptr(
88 // CHECK-NEXT: [[TMP0:%.*]] = tail call ptr addrspace(8) @llvm.amdgcn.make.buffer.rsrc.p1(ptr addrspace(1) null, i16 [[STRIDE:%.*]], i32 [[NUM:%.*]], i32 [[FLAGS:%.*]])
89 // CHECK-NEXT: ret ptr addrspace(8) [[TMP0]]
91 __amdgpu_buffer_rsrc_t test_amdgcn_make_buffer_p1_nullptr
(short stride
, int num
, int flags
) {
92 return __builtin_amdgcn_make_buffer_rsrc
((global void
*)0LL, stride
, num
, flags
);