blob: 482debb965bae77dfaed8ed600a05659b087e9c2 [file] [log] [blame]
Tom Stellard49f8bfd2015-01-06 18:00:21 +00001; RUN: llc -march=amdgcn -mcpu=bonaire -verify-machineinstrs -mattr=+load-store-opt -enable-misched < %s | FileCheck -check-prefix=SI %s
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +00002
Matt Arsenaultcc8d3b82014-11-13 19:56:13 +00003@lds = addrspace(3) global [512 x float] undef, align 4
4@lds.f64 = addrspace(3) global [512 x double] undef, align 8
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +00005
6
7; SI-LABEL: @simple_read2st64_f32_0_1
Tom Stellard326d6ec2014-11-05 14:50:53 +00008; SI: ds_read2st64_b32 v{{\[}}[[LO_VREG:[0-9]+]]:[[HI_VREG:[0-9]+]]{{\]}}, v{{[0-9]+}} offset0:0 offset1:1
9; SI: s_waitcnt lgkmcnt(0)
10; SI: v_add_f32_e32 [[RESULT:v[0-9]+]], v[[HI_VREG]], v[[LO_VREG]]
11; SI: buffer_store_dword [[RESULT]]
12; SI: s_endpgm
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +000013define void @simple_read2st64_f32_0_1(float addrspace(1)* %out) #0 {
14 %x.i = tail call i32 @llvm.r600.read.tidig.x() #1
David Blaikie79e6c742015-02-27 19:29:02 +000015 %arrayidx0 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %x.i
David Blaikiea79ac142015-02-27 21:17:42 +000016 %val0 = load float, float addrspace(3)* %arrayidx0, align 4
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +000017 %add.x = add nsw i32 %x.i, 64
David Blaikie79e6c742015-02-27 19:29:02 +000018 %arrayidx1 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %add.x
David Blaikiea79ac142015-02-27 21:17:42 +000019 %val1 = load float, float addrspace(3)* %arrayidx1, align 4
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +000020 %sum = fadd float %val0, %val1
David Blaikie79e6c742015-02-27 19:29:02 +000021 %out.gep = getelementptr inbounds float, float addrspace(1)* %out, i32 %x.i
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +000022 store float %sum, float addrspace(1)* %out.gep, align 4
23 ret void
24}
25
26; SI-LABEL: @simple_read2st64_f32_1_2
Tom Stellard326d6ec2014-11-05 14:50:53 +000027; SI: ds_read2st64_b32 v{{\[}}[[LO_VREG:[0-9]+]]:[[HI_VREG:[0-9]+]]{{\]}}, v{{[0-9]+}} offset0:1 offset1:2
28; SI: s_waitcnt lgkmcnt(0)
29; SI: v_add_f32_e32 [[RESULT:v[0-9]+]], v[[HI_VREG]], v[[LO_VREG]]
30; SI: buffer_store_dword [[RESULT]]
31; SI: s_endpgm
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +000032define void @simple_read2st64_f32_1_2(float addrspace(1)* %out, float addrspace(3)* %lds) #0 {
33 %x.i = tail call i32 @llvm.r600.read.tidig.x() #1
34 %add.x.0 = add nsw i32 %x.i, 64
David Blaikie79e6c742015-02-27 19:29:02 +000035 %arrayidx0 = getelementptr inbounds float, float addrspace(3)* %lds, i32 %add.x.0
David Blaikiea79ac142015-02-27 21:17:42 +000036 %val0 = load float, float addrspace(3)* %arrayidx0, align 4
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +000037 %add.x.1 = add nsw i32 %x.i, 128
David Blaikie79e6c742015-02-27 19:29:02 +000038 %arrayidx1 = getelementptr inbounds float, float addrspace(3)* %lds, i32 %add.x.1
David Blaikiea79ac142015-02-27 21:17:42 +000039 %val1 = load float, float addrspace(3)* %arrayidx1, align 4
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +000040 %sum = fadd float %val0, %val1
David Blaikie79e6c742015-02-27 19:29:02 +000041 %out.gep = getelementptr inbounds float, float addrspace(1)* %out, i32 %x.i
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +000042 store float %sum, float addrspace(1)* %out.gep, align 4
43 ret void
44}
45
46; SI-LABEL: @simple_read2st64_f32_max_offset
Tom Stellard326d6ec2014-11-05 14:50:53 +000047; SI: ds_read2st64_b32 v{{\[}}[[LO_VREG:[0-9]+]]:[[HI_VREG:[0-9]+]]{{\]}}, v{{[0-9]+}} offset0:1 offset1:255
48; SI: s_waitcnt lgkmcnt(0)
49; SI: v_add_f32_e32 [[RESULT:v[0-9]+]], v[[HI_VREG]], v[[LO_VREG]]
50; SI: buffer_store_dword [[RESULT]]
51; SI: s_endpgm
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +000052define void @simple_read2st64_f32_max_offset(float addrspace(1)* %out, float addrspace(3)* %lds) #0 {
53 %x.i = tail call i32 @llvm.r600.read.tidig.x() #1
54 %add.x.0 = add nsw i32 %x.i, 64
David Blaikie79e6c742015-02-27 19:29:02 +000055 %arrayidx0 = getelementptr inbounds float, float addrspace(3)* %lds, i32 %add.x.0
David Blaikiea79ac142015-02-27 21:17:42 +000056 %val0 = load float, float addrspace(3)* %arrayidx0, align 4
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +000057 %add.x.1 = add nsw i32 %x.i, 16320
David Blaikie79e6c742015-02-27 19:29:02 +000058 %arrayidx1 = getelementptr inbounds float, float addrspace(3)* %lds, i32 %add.x.1
David Blaikiea79ac142015-02-27 21:17:42 +000059 %val1 = load float, float addrspace(3)* %arrayidx1, align 4
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +000060 %sum = fadd float %val0, %val1
David Blaikie79e6c742015-02-27 19:29:02 +000061 %out.gep = getelementptr inbounds float, float addrspace(1)* %out, i32 %x.i
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +000062 store float %sum, float addrspace(1)* %out.gep, align 4
63 ret void
64}
65
66; SI-LABEL: @simple_read2st64_f32_over_max_offset
Tom Stellard326d6ec2014-11-05 14:50:53 +000067; SI-NOT: ds_read2st64_b32
Tom Stellard326d6ec2014-11-05 14:50:53 +000068; SI: v_add_i32_e32 [[BIGADD:v[0-9]+]], 0x10000, {{v[0-9]+}}
Tom Stellard83f0bce2015-01-29 16:55:25 +000069; SI: ds_read_b32 {{v[0-9]+}}, {{v[0-9]+}} offset:256
Tom Stellard326d6ec2014-11-05 14:50:53 +000070; SI: ds_read_b32 {{v[0-9]+}}, [[BIGADD]]
71; SI: s_endpgm
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +000072define void @simple_read2st64_f32_over_max_offset(float addrspace(1)* %out, float addrspace(3)* %lds) #0 {
73 %x.i = tail call i32 @llvm.r600.read.tidig.x() #1
74 %add.x.0 = add nsw i32 %x.i, 64
David Blaikie79e6c742015-02-27 19:29:02 +000075 %arrayidx0 = getelementptr inbounds float, float addrspace(3)* %lds, i32 %add.x.0
David Blaikiea79ac142015-02-27 21:17:42 +000076 %val0 = load float, float addrspace(3)* %arrayidx0, align 4
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +000077 %add.x.1 = add nsw i32 %x.i, 16384
David Blaikie79e6c742015-02-27 19:29:02 +000078 %arrayidx1 = getelementptr inbounds float, float addrspace(3)* %lds, i32 %add.x.1
David Blaikiea79ac142015-02-27 21:17:42 +000079 %val1 = load float, float addrspace(3)* %arrayidx1, align 4
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +000080 %sum = fadd float %val0, %val1
David Blaikie79e6c742015-02-27 19:29:02 +000081 %out.gep = getelementptr inbounds float, float addrspace(1)* %out, i32 %x.i
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +000082 store float %sum, float addrspace(1)* %out.gep, align 4
83 ret void
84}
85
86; SI-LABEL: @odd_invalid_read2st64_f32_0
Tom Stellard326d6ec2014-11-05 14:50:53 +000087; SI-NOT: ds_read2st64_b32
88; SI: s_endpgm
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +000089define void @odd_invalid_read2st64_f32_0(float addrspace(1)* %out) #0 {
90 %x.i = tail call i32 @llvm.r600.read.tidig.x() #1
David Blaikie79e6c742015-02-27 19:29:02 +000091 %arrayidx0 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %x.i
David Blaikiea79ac142015-02-27 21:17:42 +000092 %val0 = load float, float addrspace(3)* %arrayidx0, align 4
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +000093 %add.x = add nsw i32 %x.i, 63
David Blaikie79e6c742015-02-27 19:29:02 +000094 %arrayidx1 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %add.x
David Blaikiea79ac142015-02-27 21:17:42 +000095 %val1 = load float, float addrspace(3)* %arrayidx1, align 4
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +000096 %sum = fadd float %val0, %val1
David Blaikie79e6c742015-02-27 19:29:02 +000097 %out.gep = getelementptr inbounds float, float addrspace(1)* %out, i32 %x.i
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +000098 store float %sum, float addrspace(1)* %out.gep, align 4
99 ret void
100}
101
102; SI-LABEL: @odd_invalid_read2st64_f32_1
Tom Stellard326d6ec2014-11-05 14:50:53 +0000103; SI-NOT: ds_read2st64_b32
104; SI: s_endpgm
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000105define void @odd_invalid_read2st64_f32_1(float addrspace(1)* %out) #0 {
106 %x.i = tail call i32 @llvm.r600.read.tidig.x() #1
107 %add.x.0 = add nsw i32 %x.i, 64
David Blaikie79e6c742015-02-27 19:29:02 +0000108 %arrayidx0 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %add.x.0
David Blaikiea79ac142015-02-27 21:17:42 +0000109 %val0 = load float, float addrspace(3)* %arrayidx0, align 4
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000110 %add.x.1 = add nsw i32 %x.i, 127
David Blaikie79e6c742015-02-27 19:29:02 +0000111 %arrayidx1 = getelementptr inbounds [512 x float], [512 x float] addrspace(3)* @lds, i32 0, i32 %add.x.1
David Blaikiea79ac142015-02-27 21:17:42 +0000112 %val1 = load float, float addrspace(3)* %arrayidx1, align 4
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000113 %sum = fadd float %val0, %val1
David Blaikie79e6c742015-02-27 19:29:02 +0000114 %out.gep = getelementptr inbounds float, float addrspace(1)* %out, i32 %x.i
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000115 store float %sum, float addrspace(1)* %out.gep, align 4
116 ret void
117}
118
119; SI-LABEL: @simple_read2st64_f64_0_1
Tom Stellard326d6ec2014-11-05 14:50:53 +0000120; SI: ds_read2st64_b64 v{{\[}}[[LO_VREG:[0-9]+]]:[[HI_VREG:[0-9]+]]{{\]}}, v{{[0-9]+}} offset0:0 offset1:1
121; SI: s_waitcnt lgkmcnt(0)
122; SI: v_add_f64 [[RESULT:v\[[0-9]+:[0-9]+\]]], v{{\[}}[[LO_VREG]]:{{[0-9]+\]}}, v{{\[[0-9]+}}:[[HI_VREG]]{{\]}}
123; SI: buffer_store_dwordx2 [[RESULT]]
124; SI: s_endpgm
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000125define void @simple_read2st64_f64_0_1(double addrspace(1)* %out) #0 {
126 %x.i = tail call i32 @llvm.r600.read.tidig.x() #1
David Blaikie79e6c742015-02-27 19:29:02 +0000127 %arrayidx0 = getelementptr inbounds [512 x double], [512 x double] addrspace(3)* @lds.f64, i32 0, i32 %x.i
David Blaikiea79ac142015-02-27 21:17:42 +0000128 %val0 = load double, double addrspace(3)* %arrayidx0, align 8
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000129 %add.x = add nsw i32 %x.i, 64
David Blaikie79e6c742015-02-27 19:29:02 +0000130 %arrayidx1 = getelementptr inbounds [512 x double], [512 x double] addrspace(3)* @lds.f64, i32 0, i32 %add.x
David Blaikiea79ac142015-02-27 21:17:42 +0000131 %val1 = load double, double addrspace(3)* %arrayidx1, align 8
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000132 %sum = fadd double %val0, %val1
David Blaikie79e6c742015-02-27 19:29:02 +0000133 %out.gep = getelementptr inbounds double, double addrspace(1)* %out, i32 %x.i
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000134 store double %sum, double addrspace(1)* %out.gep, align 8
135 ret void
136}
137
138; SI-LABEL: @simple_read2st64_f64_1_2
Tom Stellard326d6ec2014-11-05 14:50:53 +0000139; SI: ds_read2st64_b64 v{{\[}}[[LO_VREG:[0-9]+]]:[[HI_VREG:[0-9]+]]{{\]}}, v{{[0-9]+}} offset0:1 offset1:2
140; SI: s_waitcnt lgkmcnt(0)
141; SI: v_add_f64 [[RESULT:v\[[0-9]+:[0-9]+\]]], v{{\[}}[[LO_VREG]]:{{[0-9]+\]}}, v{{\[[0-9]+}}:[[HI_VREG]]{{\]}}
142; SI: buffer_store_dwordx2 [[RESULT]]
143; SI: s_endpgm
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000144define void @simple_read2st64_f64_1_2(double addrspace(1)* %out, double addrspace(3)* %lds) #0 {
145 %x.i = tail call i32 @llvm.r600.read.tidig.x() #1
146 %add.x.0 = add nsw i32 %x.i, 64
David Blaikie79e6c742015-02-27 19:29:02 +0000147 %arrayidx0 = getelementptr inbounds double, double addrspace(3)* %lds, i32 %add.x.0
David Blaikiea79ac142015-02-27 21:17:42 +0000148 %val0 = load double, double addrspace(3)* %arrayidx0, align 8
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000149 %add.x.1 = add nsw i32 %x.i, 128
David Blaikie79e6c742015-02-27 19:29:02 +0000150 %arrayidx1 = getelementptr inbounds double, double addrspace(3)* %lds, i32 %add.x.1
David Blaikiea79ac142015-02-27 21:17:42 +0000151 %val1 = load double, double addrspace(3)* %arrayidx1, align 8
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000152 %sum = fadd double %val0, %val1
David Blaikie79e6c742015-02-27 19:29:02 +0000153 %out.gep = getelementptr inbounds double, double addrspace(1)* %out, i32 %x.i
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000154 store double %sum, double addrspace(1)* %out.gep, align 8
155 ret void
156}
157
158; Alignment only
159
160; SI-LABEL: @misaligned_read2st64_f64
Tom Stellard326d6ec2014-11-05 14:50:53 +0000161; SI: ds_read2_b32 v{{\[[0-9]+:[0-9]+\]}}, {{v[0-9]+}} offset0:0 offset1:1
162; SI: ds_read2_b32 v{{\[[0-9]+:[0-9]+\]}}, {{v[0-9]+}} offset0:128 offset1:129
163; SI: s_endpgm
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000164define void @misaligned_read2st64_f64(double addrspace(1)* %out, double addrspace(3)* %lds) #0 {
165 %x.i = tail call i32 @llvm.r600.read.tidig.x() #1
David Blaikie79e6c742015-02-27 19:29:02 +0000166 %arrayidx0 = getelementptr inbounds double, double addrspace(3)* %lds, i32 %x.i
David Blaikiea79ac142015-02-27 21:17:42 +0000167 %val0 = load double, double addrspace(3)* %arrayidx0, align 4
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000168 %add.x = add nsw i32 %x.i, 64
David Blaikie79e6c742015-02-27 19:29:02 +0000169 %arrayidx1 = getelementptr inbounds double, double addrspace(3)* %lds, i32 %add.x
David Blaikiea79ac142015-02-27 21:17:42 +0000170 %val1 = load double, double addrspace(3)* %arrayidx1, align 4
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000171 %sum = fadd double %val0, %val1
David Blaikie79e6c742015-02-27 19:29:02 +0000172 %out.gep = getelementptr inbounds double, double addrspace(1)* %out, i32 %x.i
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000173 store double %sum, double addrspace(1)* %out.gep, align 4
174 ret void
175}
176
177; The maximum is not the usual 0xff because 0xff * 8 * 64 > 0xffff
178; SI-LABEL: @simple_read2st64_f64_max_offset
Tom Stellard326d6ec2014-11-05 14:50:53 +0000179; SI: ds_read2st64_b64 v{{\[}}[[LO_VREG:[0-9]+]]:[[HI_VREG:[0-9]+]]{{\]}}, v{{[0-9]+}} offset0:4 offset1:127
180; SI: s_waitcnt lgkmcnt(0)
181; SI: v_add_f64 [[RESULT:v\[[0-9]+:[0-9]+\]]], v{{\[}}[[LO_VREG]]:{{[0-9]+\]}}, v{{\[[0-9]+}}:[[HI_VREG]]{{\]}}
182; SI: buffer_store_dwordx2 [[RESULT]]
183; SI: s_endpgm
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000184define void @simple_read2st64_f64_max_offset(double addrspace(1)* %out, double addrspace(3)* %lds) #0 {
185 %x.i = tail call i32 @llvm.r600.read.tidig.x() #1
186 %add.x.0 = add nsw i32 %x.i, 256
David Blaikie79e6c742015-02-27 19:29:02 +0000187 %arrayidx0 = getelementptr inbounds double, double addrspace(3)* %lds, i32 %add.x.0
David Blaikiea79ac142015-02-27 21:17:42 +0000188 %val0 = load double, double addrspace(3)* %arrayidx0, align 8
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000189 %add.x.1 = add nsw i32 %x.i, 8128
David Blaikie79e6c742015-02-27 19:29:02 +0000190 %arrayidx1 = getelementptr inbounds double, double addrspace(3)* %lds, i32 %add.x.1
David Blaikiea79ac142015-02-27 21:17:42 +0000191 %val1 = load double, double addrspace(3)* %arrayidx1, align 8
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000192 %sum = fadd double %val0, %val1
David Blaikie79e6c742015-02-27 19:29:02 +0000193 %out.gep = getelementptr inbounds double, double addrspace(1)* %out, i32 %x.i
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000194 store double %sum, double addrspace(1)* %out.gep, align 8
195 ret void
196}
197
198; SI-LABEL: @simple_read2st64_f64_over_max_offset
Tom Stellard326d6ec2014-11-05 14:50:53 +0000199; SI-NOT: ds_read2st64_b64
Tom Stellard326d6ec2014-11-05 14:50:53 +0000200; SI: v_add_i32_e32 [[BIGADD:v[0-9]+]], 0x10000, {{v[0-9]+}}
Tom Stellard83f0bce2015-01-29 16:55:25 +0000201; SI: ds_read_b64 {{v\[[0-9]+:[0-9]+\]}}, {{v[0-9]+}} offset:512
Tom Stellard326d6ec2014-11-05 14:50:53 +0000202; SI: ds_read_b64 {{v\[[0-9]+:[0-9]+\]}}, [[BIGADD]]
203; SI: s_endpgm
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000204define void @simple_read2st64_f64_over_max_offset(double addrspace(1)* %out, double addrspace(3)* %lds) #0 {
205 %x.i = tail call i32 @llvm.r600.read.tidig.x() #1
206 %add.x.0 = add nsw i32 %x.i, 64
David Blaikie79e6c742015-02-27 19:29:02 +0000207 %arrayidx0 = getelementptr inbounds double, double addrspace(3)* %lds, i32 %add.x.0
David Blaikiea79ac142015-02-27 21:17:42 +0000208 %val0 = load double, double addrspace(3)* %arrayidx0, align 8
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000209 %add.x.1 = add nsw i32 %x.i, 8192
David Blaikie79e6c742015-02-27 19:29:02 +0000210 %arrayidx1 = getelementptr inbounds double, double addrspace(3)* %lds, i32 %add.x.1
David Blaikiea79ac142015-02-27 21:17:42 +0000211 %val1 = load double, double addrspace(3)* %arrayidx1, align 8
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000212 %sum = fadd double %val0, %val1
David Blaikie79e6c742015-02-27 19:29:02 +0000213 %out.gep = getelementptr inbounds double, double addrspace(1)* %out, i32 %x.i
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000214 store double %sum, double addrspace(1)* %out.gep, align 8
215 ret void
216}
217
218; SI-LABEL: @invalid_read2st64_f64_odd_offset
Tom Stellard326d6ec2014-11-05 14:50:53 +0000219; SI-NOT: ds_read2st64_b64
220; SI: s_endpgm
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000221define void @invalid_read2st64_f64_odd_offset(double addrspace(1)* %out, double addrspace(3)* %lds) #0 {
222 %x.i = tail call i32 @llvm.r600.read.tidig.x() #1
223 %add.x.0 = add nsw i32 %x.i, 64
David Blaikie79e6c742015-02-27 19:29:02 +0000224 %arrayidx0 = getelementptr inbounds double, double addrspace(3)* %lds, i32 %add.x.0
David Blaikiea79ac142015-02-27 21:17:42 +0000225 %val0 = load double, double addrspace(3)* %arrayidx0, align 8
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000226 %add.x.1 = add nsw i32 %x.i, 8129
David Blaikie79e6c742015-02-27 19:29:02 +0000227 %arrayidx1 = getelementptr inbounds double, double addrspace(3)* %lds, i32 %add.x.1
David Blaikiea79ac142015-02-27 21:17:42 +0000228 %val1 = load double, double addrspace(3)* %arrayidx1, align 8
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000229 %sum = fadd double %val0, %val1
David Blaikie79e6c742015-02-27 19:29:02 +0000230 %out.gep = getelementptr inbounds double, double addrspace(1)* %out, i32 %x.i
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000231 store double %sum, double addrspace(1)* %out.gep, align 8
232 ret void
233}
234
235; The stride of 8 elements is 8 * 8 bytes. We need to make sure the
236; stride in elements, not bytes, is a multiple of 64.
237
238; SI-LABEL: @byte_size_only_divisible_64_read2_f64
Tom Stellard326d6ec2014-11-05 14:50:53 +0000239; SI-NOT: ds_read2st_b64
240; SI: ds_read2_b64 v{{\[[0-9]+:[0-9]+\]}}, v{{[0-9]+}} offset0:0 offset1:8
241; SI: s_endpgm
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000242define void @byte_size_only_divisible_64_read2_f64(double addrspace(1)* %out, double addrspace(3)* %lds) #0 {
243 %x.i = tail call i32 @llvm.r600.read.tidig.x() #1
David Blaikie79e6c742015-02-27 19:29:02 +0000244 %arrayidx0 = getelementptr inbounds double, double addrspace(3)* %lds, i32 %x.i
David Blaikiea79ac142015-02-27 21:17:42 +0000245 %val0 = load double, double addrspace(3)* %arrayidx0, align 8
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000246 %add.x = add nsw i32 %x.i, 8
David Blaikie79e6c742015-02-27 19:29:02 +0000247 %arrayidx1 = getelementptr inbounds double, double addrspace(3)* %lds, i32 %add.x
David Blaikiea79ac142015-02-27 21:17:42 +0000248 %val1 = load double, double addrspace(3)* %arrayidx1, align 8
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000249 %sum = fadd double %val0, %val1
David Blaikie79e6c742015-02-27 19:29:02 +0000250 %out.gep = getelementptr inbounds double, double addrspace(1)* %out, i32 %x.i
Matt Arsenaultfe0a2e62014-10-10 22:12:32 +0000251 store double %sum, double addrspace(1)* %out.gep, align 4
252 ret void
253}
254
255; Function Attrs: nounwind readnone
256declare i32 @llvm.r600.read.tgid.x() #1
257
258; Function Attrs: nounwind readnone
259declare i32 @llvm.r600.read.tgid.y() #1
260
261; Function Attrs: nounwind readnone
262declare i32 @llvm.r600.read.tidig.x() #1
263
264; Function Attrs: nounwind readnone
265declare i32 @llvm.r600.read.tidig.y() #1
266
267; Function Attrs: noduplicate nounwind
268declare void @llvm.AMDGPU.barrier.local() #2
269
270attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
271attributes #1 = { nounwind readnone }
272attributes #2 = { noduplicate nounwind }