1 # RUN: llc -mtriple=amdgcn -mcpu=gfx90a -run-pass=si-load-store-opt -verify-machineinstrs -o - %s | FileCheck %s
2 # RUN: llc -mtriple=amdgcn -mcpu=gfx90a -passes=si-load-store-opt -verify-machineinstrs -o - %s | FileCheck %s
4 # The purpose of this test is to make sure we are combining relevant memory
5 # operations correctly with/without SCC bit.
8 define amdgpu_kernel void @test1(ptr addrspace(1) %out) {
9 %out.gep.1 = getelementptr i32, ptr addrspace(1) %out, i32 1
10 store i32 123, ptr addrspace(1) %out.gep.1
11 store i32 456, ptr addrspace(1) %out
15 define amdgpu_kernel void @test2(ptr addrspace(1) %out) {
16 %out.gep.1 = getelementptr i32, ptr addrspace(1) %out, i32 1
17 store i32 123, ptr addrspace(1) %out.gep.1
18 store i32 456, ptr addrspace(1) %out
22 define amdgpu_kernel void @test3(ptr addrspace(1) %out) {
23 %out.gep.1 = getelementptr i32, ptr addrspace(1) %out, i32 1
24 store i32 123, ptr addrspace(1) %out.gep.1
25 store i32 456, ptr addrspace(1) %out
28 define amdgpu_kernel void @test4(ptr addrspace(1) %out) {
29 %out.gep.1 = getelementptr i32, ptr addrspace(1) %out, i32 1
30 store i32 123, ptr addrspace(1) %out.gep.1
31 store i32 456, ptr addrspace(1) %out
36 # CHECK: BUFFER_STORE_DWORDX2_OFFSET killed %{{[0-9]+}}, %{{[0-9]+}}, 0, 4, 0, 0, implicit $exec :: (store (s64) into %ir.out.gep.1, align 4, addrspace 1)
40 - { reg: '$sgpr0_sgpr1', virtual-reg: '' }
45 $vgpr0 = V_MOV_B32_e32 123, implicit $exec
46 $vgpr1 = V_MOV_B32_e32 456, implicit $exec
49 $sgpr3 = S_MOV_B32 61440
51 %0:sgpr_64 = COPY $sgpr0_sgpr1
52 %1:sgpr_64 = S_LOAD_DWORDX2_IMM %1, 36, 0 :: (dereferenceable invariant load (s64) from `ptr addrspace(4) undef`, addrspace 4)
53 %2:sgpr_32 = COPY $sgpr2
54 %3:sgpr_32 = COPY $sgpr3
55 %4:sgpr_128 = REG_SEQUENCE %1, %subreg.sub0, %2, %subreg.sub1, %3, %subreg.sub2
57 %5:vgpr_32 = COPY $vgpr0
58 %6:vgpr_32 = COPY $vgpr1
60 BUFFER_STORE_DWORD_OFFSET %5, %4, 0, 4, 0, 0, implicit $exec :: (store (s32) into %ir.out.gep.1, addrspace 1)
61 BUFFER_STORE_DWORD_OFFSET %6, %4, 0, 8, 0, 0, implicit $exec :: (store (s32) into %ir.out.gep.1, addrspace 1)
66 # CHECK: BUFFER_STORE_DWORD_OFFSET %{{[0-9]+}}, %{{[0-9]+}}, 0, 4, 16, 0, implicit $exec :: (store (s32) into %ir.out.gep.1, addrspace 1)
67 # CHECK: BUFFER_STORE_DWORD_OFFSET %{{[0-9]+}}, %{{[0-9]+}}, 0, 8, 0, 0, implicit $exec :: (store (s32) into %ir.out.gep.1, addrspace 1)
71 - { reg: '$sgpr0_sgpr1', virtual-reg: '' }
76 $vgpr0 = V_MOV_B32_e32 123, implicit $exec
77 $vgpr1 = V_MOV_B32_e32 456, implicit $exec
80 $sgpr3 = S_MOV_B32 61440
82 %0:sgpr_64 = COPY $sgpr0_sgpr1
83 %1:sgpr_64 = S_LOAD_DWORDX2_IMM %1, 36, 0 :: (dereferenceable invariant load (s64) from `ptr addrspace(4) undef`, addrspace 4)
84 %2:sgpr_32 = COPY $sgpr2
85 %3:sgpr_32 = COPY $sgpr3
86 %4:sgpr_128 = REG_SEQUENCE %1, %subreg.sub0, %2, %subreg.sub1, %3, %subreg.sub2
88 %5:vgpr_32 = COPY $vgpr0
89 %6:vgpr_32 = COPY $vgpr1
91 BUFFER_STORE_DWORD_OFFSET %5, %4, 0, 4, 16, 0, implicit $exec :: (store (s32) into %ir.out.gep.1, addrspace 1)
92 BUFFER_STORE_DWORD_OFFSET %6, %4, 0, 8, 0, 0, implicit $exec :: (store (s32) into %ir.out.gep.1, addrspace 1)
97 # CHECK: BUFFER_STORE_DWORD_OFFSET %{{[0-9]+}}, %{{[0-9]+}}, 0, 4, 0, 0, implicit $exec :: (store (s32) into %ir.out.gep.1, addrspace 1)
98 # CHECK: BUFFER_STORE_DWORD_OFFSET %{{[0-9]+}}, %{{[0-9]+}}, 0, 8, 16, 0, implicit $exec :: (store (s32) into %ir.out.gep.1, addrspace 1)
102 - { reg: '$sgpr0_sgpr1', virtual-reg: '' }
105 liveins: $sgpr0_sgpr1
107 $vgpr0 = V_MOV_B32_e32 123, implicit $exec
108 $vgpr1 = V_MOV_B32_e32 456, implicit $exec
110 $sgpr2 = S_MOV_B32 -1
111 $sgpr3 = S_MOV_B32 61440
113 %0:sgpr_64 = COPY $sgpr0_sgpr1
114 %1:sgpr_64 = S_LOAD_DWORDX2_IMM %1, 36, 0 :: (dereferenceable invariant load (s64) from `ptr addrspace(4) undef`, addrspace 4)
115 %2:sgpr_32 = COPY $sgpr2
116 %3:sgpr_32 = COPY $sgpr3
117 %4:sgpr_128 = REG_SEQUENCE %1, %subreg.sub0, %2, %subreg.sub1, %3, %subreg.sub2
119 %5:vgpr_32 = COPY $vgpr0
120 %6:vgpr_32 = COPY $vgpr1
122 BUFFER_STORE_DWORD_OFFSET %5, %4, 0, 4, 0, 0, implicit $exec :: (store (s32) into %ir.out.gep.1, addrspace 1)
123 BUFFER_STORE_DWORD_OFFSET %6, %4, 0, 8, 16, 0, implicit $exec :: (store (s32) into %ir.out.gep.1, addrspace 1)
128 # CHECK: BUFFER_STORE_DWORDX2_OFFSET killed %{{[0-9]+}}, %{{[0-9]+}}, 0, 4, 16, 0, implicit $exec :: (store (s64) into %ir.out.gep.1, align 4, addrspace 1)
132 - { reg: '$sgpr0_sgpr1', virtual-reg: '' }
135 liveins: $sgpr0_sgpr1
137 $vgpr0 = V_MOV_B32_e32 123, implicit $exec
138 $vgpr1 = V_MOV_B32_e32 456, implicit $exec
140 $sgpr2 = S_MOV_B32 -1
141 $sgpr3 = S_MOV_B32 61440
143 %0:sgpr_64 = COPY $sgpr0_sgpr1
144 %1:sgpr_64 = S_LOAD_DWORDX2_IMM %1, 36, 0 :: (dereferenceable invariant load (s64) from `ptr addrspace(4) undef`, addrspace 4)
145 %2:sgpr_32 = COPY $sgpr2
146 %3:sgpr_32 = COPY $sgpr3
147 %4:sgpr_128 = REG_SEQUENCE %1, %subreg.sub0, %2, %subreg.sub1, %3, %subreg.sub2
149 %5:vgpr_32 = COPY $vgpr0
150 %6:vgpr_32 = COPY $vgpr1
152 BUFFER_STORE_DWORD_OFFSET %5, %4, 0, 4, 16, 0, implicit $exec :: (store (s32) into %ir.out.gep.1, addrspace 1)
153 BUFFER_STORE_DWORD_OFFSET %6, %4, 0, 8, 16, 0, implicit $exec :: (store (s32) into %ir.out.gep.1, addrspace 1)