1 // NOTE
: Assertions have been autogenerated by utils
/update_cc_test_checks.py
2 // RUN
: %clang_cc1 -cl-std
=CL2.0 -O0 -triple amdgcn-unknown-unknown -target-cpu gfx940 -emit-llvm -o - %s | FileCheck %s
3 // REQUIRES
: amdgpu-registered-target
5 typedef unsigned int u32
;
6 typedef unsigned short u16
;
7 typedef unsigned char u8
;
9 // CHECK-LABEL
: @test_global_load_lds_u32
(
11 // CHECK-NEXT
: [[SRC_ADDR
:%.
*]] = alloca ptr addrspace
(1), align
8, addrspace
(5)
12 // CHECK-NEXT
: [[DST_ADDR
:%.
*]] = alloca ptr addrspace
(3), align
4, addrspace
(5)
13 // CHECK-NEXT
: [[SRC_ADDR_ASCAST
:%.
*]] = addrspacecast ptr addrspace
(5) [[SRC_ADDR]] to ptr
14 // CHECK-NEXT: [[DST_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[DST_ADDR]] to ptr
15 // CHECK-NEXT: store ptr addrspace(1) [[SRC:%.*]], ptr [[SRC_ADDR_ASCAST]], align 8
16 // CHECK-NEXT: store ptr addrspace(3) [[DST:%.*]], ptr [[DST_ADDR_ASCAST]], align 4
17 // CHECK-NEXT: [[TMP0:%.*]] = load ptr addrspace(1), ptr [[SRC_ADDR_ASCAST]], align 8
18 // CHECK-NEXT: [[TMP1:%.*]] = load ptr addrspace(3), ptr [[DST_ADDR_ASCAST]], align 4
19 // CHECK-NEXT: call void @llvm.amdgcn.global.load.lds(ptr addrspace(1) [[TMP0]], ptr addrspace(3) [[TMP1]], i32 4, i32 0, i32 0)
20 // CHECK-NEXT: ret void
22 void test_global_load_lds_u32(global u32* src, local u32 *dst) {
23 __builtin_amdgcn_global_load_lds(src, dst, /*size=*/4, /*offset=*/0, /*aux=*/0);
26 // CHECK-LABEL: @test_global_load_lds_u16(
28 // CHECK-NEXT: [[SRC_ADDR:%.*]] = alloca ptr addrspace(1), align 8, addrspace(5)
29 // CHECK-NEXT: [[DST_ADDR:%.*]] = alloca ptr addrspace(3), align 4, addrspace(5)
30 // CHECK-NEXT: [[SRC_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[SRC_ADDR]] to ptr
31 // CHECK-NEXT
: [[DST_ADDR_ASCAST
:%.
*]] = addrspacecast ptr addrspace
(5) [[DST_ADDR]] to ptr
32 // CHECK-NEXT: store ptr addrspace(1) [[SRC:%.*]], ptr [[SRC_ADDR_ASCAST]], align 8
33 // CHECK-NEXT: store ptr addrspace(3) [[DST:%.*]], ptr [[DST_ADDR_ASCAST]], align 4
34 // CHECK-NEXT: [[TMP0:%.*]] = load ptr addrspace(1), ptr [[SRC_ADDR_ASCAST]], align 8
35 // CHECK-NEXT: [[TMP1:%.*]] = load ptr addrspace(3), ptr [[DST_ADDR_ASCAST]], align 4
36 // CHECK-NEXT: call void @llvm.amdgcn.global.load.lds(ptr addrspace(1) [[TMP0]], ptr addrspace(3) [[TMP1]], i32 2, i32 0, i32 0)
37 // CHECK-NEXT: ret void
39 void test_global_load_lds_u16(global u16* src, local u16 *dst) {
40 __builtin_amdgcn_global_load_lds(src, dst, /*size=*/2, /*offset=*/0, /*aux=*/0);
43 // CHECK-LABEL: @test_global_load_lds_u8(
45 // CHECK-NEXT: [[SRC_ADDR:%.*]] = alloca ptr addrspace(1), align 8, addrspace(5)
46 // CHECK-NEXT: [[DST_ADDR:%.*]] = alloca ptr addrspace(3), align 4, addrspace(5)
47 // CHECK-NEXT: [[SRC_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[SRC_ADDR]] to ptr
48 // CHECK-NEXT: [[DST_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[DST_ADDR]] to ptr
49 // CHECK-NEXT
: store ptr addrspace
(1) [[SRC
:%.
*]], ptr
[[SRC_ADDR_ASCAST]], align 8
50 // CHECK-NEXT: store ptr addrspace(3) [[DST:%.*]], ptr [[DST_ADDR_ASCAST]], align 4
51 // CHECK-NEXT: [[TMP0:%.*]] = load ptr addrspace(1), ptr [[SRC_ADDR_ASCAST]], align
8
52 // CHECK-NEXT
: [[TMP1
:%.
*]] = load ptr addrspace
(3), ptr
[[DST_ADDR_ASCAST]], align 4
53 // CHECK-NEXT: call void @llvm.amdgcn.global.load.lds(ptr addrspace(1) [[TMP0]], ptr addrspace(3) [[TMP1]], i32 1, i32 0, i32 0)
54 // CHECK-NEXT: ret void
56 void test_global_load_lds_u8(global u8* src, local u8 *dst) {
57 __builtin_amdgcn_global_load_lds(src, dst, /*size=*/1, /*offset=*/0, /*aux=*/0);