blob: d558aa24304b681c63b567915948a0b02df09351 [file] [log] [blame]
Mikael Holmenece84cd2017-02-14 06:37:42 +00001; RUN: llc < %s | FileCheck %s
2
Mikael Holmenece84cd2017-02-14 06:37:42 +00003target triple = "amdgcn--"
4
5; We need to compile this for a target where we have different address spaces,
6; and where pointers in those address spaces have different size.
7; E.g. for amdgcn-- pointers in address space 0 are 32 bits and pointers in
8; address space 1 are 64 bits.
9
10; We shouldn't crash. Check that we get a loop with the two stores.
11;CHECK-LABEL: foo:
12;CHECK: [[LOOP_LABEL:BB[0-9]+_[0-9]+]]:
13;CHECK: buffer_store_dword
14;CHECK: buffer_store_dword
15;CHECK: s_branch [[LOOP_LABEL]]
16
Matt Arsenault3dbeefa2017-03-21 21:39:51 +000017define amdgpu_kernel void @foo() {
Mikael Holmenece84cd2017-02-14 06:37:42 +000018entry:
19 br label %loop
20
21loop:
22 %idx0 = phi i32 [ %next_idx0, %loop ], [ 0, %entry ]
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000023 %0 = getelementptr inbounds i32, i32 addrspace(5)* null, i32 %idx0
Mikael Holmenece84cd2017-02-14 06:37:42 +000024 %1 = getelementptr inbounds i32, i32 addrspace(1)* null, i32 %idx0
Yaxun Liu2a22c5d2018-02-02 16:07:16 +000025 store i32 1, i32 addrspace(5)* %0
Mikael Holmenece84cd2017-02-14 06:37:42 +000026 store i32 7, i32 addrspace(1)* %1
27 %next_idx0 = add nuw nsw i32 %idx0, 1
28 br label %loop
29}
30