9393 ret void
9494}
9595
96+ define ptr @alloca_load_store_ptr64_full_ivec (ptr %arg ) {
97+ ; CHECK-LABEL: define ptr @alloca_load_store_ptr64_full_ivec
98+ ; CHECK-SAME: (ptr [[ARG:%.*]]) {
99+ ; CHECK-NEXT: entry:
100+ ; CHECK-NEXT: [[TMP0:%.*]] = ptrtoint ptr [[ARG]] to i64
101+ ; CHECK-NEXT: [[TMP1:%.*]] = bitcast i64 [[TMP0]] to <8 x i8>
102+ ; CHECK-NEXT: ret ptr [[ARG]]
103+ ;
104+ entry:
105+ %alloca = alloca [8 x i8 ], align 8 , addrspace (5 )
106+ store ptr %arg , ptr addrspace (5 ) %alloca , align 8
107+ %tmp = load ptr , ptr addrspace (5 ) %alloca , align 8
108+ ret ptr %tmp
109+ }
110+
96111define ptr addrspace (3 ) @alloca_load_store_ptr32_full_ivec (ptr addrspace (3 ) %arg ) {
97112; CHECK-LABEL: define ptr addrspace(3) @alloca_load_store_ptr32_full_ivec
98113; CHECK-SAME: (ptr addrspace(3) [[ARG:%.*]]) {
@@ -108,6 +123,22 @@ entry:
108123 ret ptr addrspace (3 ) %tmp
109124}
110125
126+ define <4 x ptr addrspace (3 )> @alloca_load_store_ptr_mixed_full_ptrvec (<2 x ptr > %arg ) {
127+ ; CHECK-LABEL: define <4 x ptr addrspace(3)> @alloca_load_store_ptr_mixed_full_ptrvec
128+ ; CHECK-SAME: (<2 x ptr> [[ARG:%.*]]) {
129+ ; CHECK-NEXT: entry:
130+ ; CHECK-NEXT: [[TMP0:%.*]] = ptrtoint <2 x ptr> [[ARG]] to <2 x i64>
131+ ; CHECK-NEXT: [[TMP1:%.*]] = bitcast <2 x i64> [[TMP0]] to <4 x i32>
132+ ; CHECK-NEXT: [[TMP2:%.*]] = inttoptr <4 x i32> [[TMP1]] to <4 x ptr addrspace(3)>
133+ ; CHECK-NEXT: ret <4 x ptr addrspace(3)> [[TMP2]]
134+ ;
135+ entry:
136+ %alloca = alloca [4 x i32 ], align 8 , addrspace (5 )
137+ store <2 x ptr > %arg , ptr addrspace (5 ) %alloca , align 8
138+ %tmp = load <4 x ptr addrspace (3 )>, ptr addrspace (5 ) %alloca , align 8
139+ ret <4 x ptr addrspace (3 )> %tmp
140+ }
141+
111142define <8 x i16 > @ptralloca_load_store_ints_full (<2 x i64 > %arg ) {
112143; CHECK-LABEL: define <8 x i16> @ptralloca_load_store_ints_full
113144; CHECK-SAME: (<2 x i64> [[ARG:%.*]]) {
@@ -168,38 +199,32 @@ entry:
168199 ret ptr addrspace (3 ) %tmp
169200}
170201
171- ; Will not vectorize because we are doing a load/store of a pointer across
172- ; address spaces of varying pointer sizes.
173- define ptr @alloca_load_store_ptr64_full_ivec (ptr %arg ) {
174- ; CHECK-LABEL: define ptr @alloca_load_store_ptr64_full_ivec
175- ; CHECK-SAME: (ptr [[ARG:%.*]]) {
202+ ; Will not vectorize because we're saving a 64-bit pointer from addrspace 0
203+ ; in to two 32 bits pointers of addrspace 5.
204+ ; CHECK-LABEL: define void @alloca_load_store_ptr_mixed_addrspace_ptrvec
176205; CHECK-NEXT: entry:
177- ; CHECK-NEXT: [[ALLOCA:%.*]] = alloca [8 x i8], align 8, addrspace(5)
178- ; CHECK-NEXT: store ptr [[ARG]], ptr addrspace(5) [[ALLOCA]], align 8
179- ; CHECK-NEXT: [[TMP:%.*]] = load ptr, ptr addrspace(5) [[ALLOCA]], align 8
180- ; CHECK-NEXT: ret ptr [[TMP]]
206+ ; CHECK-NEXT: [[ALLOCA:%.*]] = alloca <2 x ptr addrspace(5)>, align 8, addrspace(5)
207+ ; CHECK-NEXT: store ptr undef, ptr addrspace(5) [[ALLOCA]], align 8
208+ ; CHECK-NEXT: ret void
181209;
210+ define void @alloca_load_store_ptr_mixed_addrspace_ptrvec () {
182211entry:
183- %alloca = alloca [8 x i8 ], align 8 , addrspace (5 )
184- store ptr %arg , ptr addrspace (5 ) %alloca , align 8
185- %tmp = load ptr , ptr addrspace (5 ) %alloca , align 8
186- ret ptr %tmp
212+ %A2 = alloca <2 x ptr addrspace (5 )>, align 8 , addrspace (5 )
213+ store ptr undef , ptr addrspace (5 ) %A2 , align 8
214+ ret void
187215}
188216
189- ; Will not vectorize because we are doing a load/store of a pointer across
190- ; address spaces of varying pointer sizes.
191- define <4 x ptr addrspace (3 )> @alloca_load_store_ptr_mixed_full_ptrvec (<2 x ptr > %arg ) {
192- ; CHECK-LABEL: define <4 x ptr addrspace(3)> @alloca_load_store_ptr_mixed_full_ptrvec
193- ; CHECK-SAME: (<2 x ptr> [[ARG:%.*]]) {
217+ ; Will not vectorize because we're saving a 32-bit pointers from addrspace 5
218+ ; in to two 64 bits pointers of addrspace 0, even though the size in memory
219+ ; is same.
220+ ; CHECK-LABEL: define void @alloca_load_store_ptr_mixed_addrspace_ptrvec2
194221; CHECK-NEXT: entry:
195- ; CHECK-NEXT: [[ALLOCA:%.*]] = alloca [4 x i32], align 8, addrspace(5)
196- ; CHECK-NEXT: store <2 x ptr> [[ARG]], ptr addrspace(5) [[ALLOCA]], align 8
197- ; CHECK-NEXT: [[TMP:%.*]] = load <4 x ptr addrspace(3)>, ptr addrspace(5) [[ALLOCA]], align 8
198- ; CHECK-NEXT: ret <4 x ptr addrspace(3)> [[TMP]]
199- ;
222+ ; CHECK-NEXT: [[ALLOCA:%.*]] = alloca <2 x ptr>, align 8
223+ ; CHECK-NEXT: store <4 x ptr addrspace(5)> undef, ptr [[ALLOCA]], align 8
224+ ; CHECK-NEXT: ret void
225+ define void @alloca_load_store_ptr_mixed_addrspace_ptrvec2 () {
200226entry:
201- %alloca = alloca [4 x i32 ], align 8 , addrspace (5 )
202- store <2 x ptr > %arg , ptr addrspace (5 ) %alloca , align 8
203- %tmp = load <4 x ptr addrspace (3 )>, ptr addrspace (5 ) %alloca , align 8
204- ret <4 x ptr addrspace (3 )> %tmp
227+ %A2 = alloca <2 x ptr >, align 8
228+ store <4 x ptr addrspace (5 )> undef , ptr %A2 , align 8
229+ ret void
205230}
0 commit comments