1 ; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs< %s | FileCheck -check-prefix=SI %s
3 ; FIXME: This is probably wrong. This probably needs to expand to 8-bit reads and writes.
4 ; SI-LABEL: @unaligned_load_store_i32:
9 define void @unaligned_load_store_i32(i32 addrspace(3)* %p, i32 addrspace(3)* %r) nounwind {
10 %v = load i32 addrspace(3)* %p, align 1
11 store i32 %v, i32 addrspace(3)* %r, align 1
15 ; SI-LABEL: @unaligned_load_store_v4i32:
29 define void @unaligned_load_store_v4i32(<4 x i32> addrspace(3)* %p, <4 x i32> addrspace(3)* %r) nounwind {
30 %v = load <4 x i32> addrspace(3)* %p, align 1
31 store <4 x i32> %v, <4 x i32> addrspace(3)* %r, align 1
35 ; SI-LABEL: @load_lds_i64_align_4
38 define void @load_lds_i64_align_4(i64 addrspace(1)* nocapture %out, i64 addrspace(3)* %in) #0 {
39 %val = load i64 addrspace(3)* %in, align 4
40 store i64 %val, i64 addrspace(1)* %out, align 8
44 ; SI-LABEL: @load_lds_i64_align_4_with_offset
45 ; SI: DS_READ2_B32 v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]}}, 0x8, 0x9
47 define void @load_lds_i64_align_4_with_offset(i64 addrspace(1)* nocapture %out, i64 addrspace(3)* %in) #0 {
48 %ptr = getelementptr i64 addrspace(3)* %in, i32 4
49 %val = load i64 addrspace(3)* %ptr, align 4
50 store i64 %val, i64 addrspace(1)* %out, align 8
54 ; SI-LABEL: @load_lds_i64_align_4_with_split_offset
55 ; The tests for the case where the lo offset is 8-bits, but the hi offset is 9-bits
56 ; SI: DS_READ2_B32 v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]}}, 0x0, 0x1
58 define void @load_lds_i64_align_4_with_split_offset(i64 addrspace(1)* nocapture %out, i64 addrspace(3)* %in) #0 {
59 %ptr = bitcast i64 addrspace(3)* %in to i32 addrspace(3)*
60 %ptr255 = getelementptr i32 addrspace(3)* %ptr, i32 255
61 %ptri64 = bitcast i32 addrspace(3)* %ptr255 to i64 addrspace(3)*
62 %val = load i64 addrspace(3)* %ptri64, align 4
63 store i64 %val, i64 addrspace(1)* %out, align 8
67 ; FIXME: Need to fix this case.
68 ; define void @load_lds_i64_align_1(i64 addrspace(1)* nocapture %out, i64 addrspace(3)* %in) #0 {
69 ; %val = load i64 addrspace(3)* %in, align 1
70 ; store i64 %val, i64 addrspace(1)* %out, align 8
74 ; SI-LABEL: @store_lds_i64_align_4
77 define void @store_lds_i64_align_4(i64 addrspace(3)* %out, i64 %val) #0 {
78 store i64 %val, i64 addrspace(3)* %out, align 4
82 ; SI-LABEL: @store_lds_i64_align_4_with_offset
83 ; DS_WRITE_B32 v[{{[0-9]+}}], v[{{[0-9]+}}], v{{[0-9]}}, 0x9, 0x9
85 define void @store_lds_i64_align_4_with_offset(i64 addrspace(3)* %out) #0 {
86 %ptr = getelementptr i64 addrspace(3)* %out, i32 4
87 store i64 0, i64 addrspace(3)* %ptr, align 4
91 ; SI-LABEL: @store_lds_i64_align_4_with_split_offset
92 ; The tests for the case where the lo offset is 8-bits, but the hi offset is 9-bits
93 ; DS_WRITE_B32 v[{{[0-9]+}}], v[{{[0-9]+}}], v{{[0-9]}}, 0x0, 0x1
95 define void @store_lds_i64_align_4_with_split_offset(i64 addrspace(3)* %out) #0 {
96 %ptr = bitcast i64 addrspace(3)* %out to i32 addrspace(3)*
97 %ptr255 = getelementptr i32 addrspace(3)* %ptr, i32 255
98 %ptri64 = bitcast i32 addrspace(3)* %ptr255 to i64 addrspace(3)*
99 store i64 0, i64 addrspace(3)* %out, align 4