9ea9a5a2617b87f9f33ff49b49e3e33dbf076a56
[oota-llvm.git] / test / CodeGen / AMDGPU / ds_read2_offset_order.ll
1 ; RUN: llc -march=amdgcn -mcpu=bonaire -verify-machineinstrs -mattr=+load-store-opt -enable-misched < %s | FileCheck -strict-whitespace -check-prefix=SI %s
2 ; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs -mattr=+load-store-opt -enable-misched < %s | FileCheck -strict-whitespace -check-prefix=SI %s
3
4 ; XFAIL: *
5
6 @lds = addrspace(3) global [512 x float] undef, align 4
7
8 ; SI-LABEL: {{^}}offset_order:
9
10 ; SI: ds_read_b32 v{{[0-9]+}}, v{{[0-9]+}} offset:56
11 ; SI: ds_read2st64_b32 v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}} offset0:0 offset1:4
12 ; SI: ds_read2_b32 v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}} offset0:2 offset1:3
13 ; SI: ds_read2_b32 v[{{[0-9]+}}:{{[0-9]+}}], v{{[0-9]+}} offset0:11 offset1:1
14
15 define void @offset_order(float addrspace(1)* %out) {
16 entry:
17   %ptr0 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 0
18   %val0 = load float, float addrspace(3)* %ptr0
19
20   %ptr1 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 256
21   %val1 = load float, float addrspace(3)* %ptr1
22   %add1 = fadd float %val0, %val1
23
24   %ptr2 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 3
25   %val2 = load float, float addrspace(3)* %ptr2
26   %add2 = fadd float %add1, %val2
27
28   %ptr3 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 2
29   %val3 = load float, float addrspace(3)* %ptr3
30   %add3 = fadd float %add2, %val3
31
32   %ptr4 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 12
33   %val4 = load float, float addrspace(3)* %ptr4
34   %add4 = fadd float %add3, %val4
35
36   %ptr5 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 14
37   %val5 = load float, float addrspace(3)* %ptr5
38   %add5 = fadd float %add4, %val5
39
40   %ptr6 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 11
41   %val6 = load float, float addrspace(3)* %ptr6
42   %add6 = fadd float %add5, %val6
43   store float %add6, float addrspace(1)* %out
44   ret void
45 }