1 ; RUN: llc -march=amdgcn -mcpu=SI -verify-machineinstrs< %s | FileCheck -check-prefix=SI %s
3 ; SI-LABEL: {{^}}unaligned_load_store_i32:
8 define void @unaligned_load_store_i32(i32 addrspace(3)* %p, i32 addrspace(3)* %r) nounwind {
9 %v = load i32 addrspace(3)* %p, align 1
10 store i32 %v, i32 addrspace(3)* %r, align 1
14 ; SI-LABEL: {{^}}unaligned_load_store_v4i32:
40 define void @unaligned_load_store_v4i32(<4 x i32> addrspace(3)* %p, <4 x i32> addrspace(3)* %r) nounwind {
41 %v = load <4 x i32> addrspace(3)* %p, align 1
42 store <4 x i32> %v, <4 x i32> addrspace(3)* %r, align 1
46 ; SI-LABEL: {{^}}load_lds_i64_align_4:
49 define void @load_lds_i64_align_4(i64 addrspace(1)* nocapture %out, i64 addrspace(3)* %in) #0 {
50 %val = load i64 addrspace(3)* %in, align 4
51 store i64 %val, i64 addrspace(1)* %out, align 8
55 ; SI-LABEL: {{^}}load_lds_i64_align_4_with_offset
56 ; SI: ds_read2_b32 v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]}} offset0:8 offset1:9
58 define void @load_lds_i64_align_4_with_offset(i64 addrspace(1)* nocapture %out, i64 addrspace(3)* %in) #0 {
59 %ptr = getelementptr i64 addrspace(3)* %in, i32 4
60 %val = load i64 addrspace(3)* %ptr, align 4
61 store i64 %val, i64 addrspace(1)* %out, align 8
65 ; SI-LABEL: {{^}}load_lds_i64_align_4_with_split_offset:
66 ; The tests for the case where the lo offset is 8-bits, but the hi offset is 9-bits
67 ; SI: ds_read2_b32 v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]}} offset0:0 offset1:1
69 define void @load_lds_i64_align_4_with_split_offset(i64 addrspace(1)* nocapture %out, i64 addrspace(3)* %in) #0 {
70 %ptr = bitcast i64 addrspace(3)* %in to i32 addrspace(3)*
71 %ptr255 = getelementptr i32 addrspace(3)* %ptr, i32 255
72 %ptri64 = bitcast i32 addrspace(3)* %ptr255 to i64 addrspace(3)*
73 %val = load i64 addrspace(3)* %ptri64, align 4
74 store i64 %val, i64 addrspace(1)* %out, align 8
78 ; FIXME: Need to fix this case.
79 ; define void @load_lds_i64_align_1(i64 addrspace(1)* nocapture %out, i64 addrspace(3)* %in) #0 {
80 ; %val = load i64 addrspace(3)* %in, align 1
81 ; store i64 %val, i64 addrspace(1)* %out, align 8
85 ; SI-LABEL: {{^}}store_lds_i64_align_4:
88 define void @store_lds_i64_align_4(i64 addrspace(3)* %out, i64 %val) #0 {
89 store i64 %val, i64 addrspace(3)* %out, align 4
93 ; SI-LABEL: {{^}}store_lds_i64_align_4_with_offset
94 ; SI: ds_write2_b32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset0:8 offset1:9
96 define void @store_lds_i64_align_4_with_offset(i64 addrspace(3)* %out) #0 {
97 %ptr = getelementptr i64 addrspace(3)* %out, i32 4
98 store i64 0, i64 addrspace(3)* %ptr, align 4
102 ; SI-LABEL: {{^}}store_lds_i64_align_4_with_split_offset:
103 ; The tests for the case where the lo offset is 8-bits, but the hi offset is 9-bits
104 ; SI: ds_write2_b32 v{{[0-9]+}}, v{{[0-9]+}}, v{{[0-9]+}} offset0:0 offset1:1
106 define void @store_lds_i64_align_4_with_split_offset(i64 addrspace(3)* %out) #0 {
107 %ptr = bitcast i64 addrspace(3)* %out to i32 addrspace(3)*
108 %ptr255 = getelementptr i32 addrspace(3)* %ptr, i32 255
109 %ptri64 = bitcast i32 addrspace(3)* %ptr255 to i64 addrspace(3)*
110 store i64 0, i64 addrspace(3)* %out, align 4