1 ! RUN: bbc -emit-fir %s -o - | FileCheck --check-prefixes="FIR" %s
2 ! RUN: %flang_fc1 -emit-fir %s -o - | fir-opt --fir-to-llvm-ir | FileCheck --check-prefixes="MLIR" %s
3 ! RUN: %flang_fc1 -emit-llvm %s -o - | FileCheck --check-prefixes="CHECK" %s
4 ! REQUIRES: target=powerpc{{.*}}
10 ! CHECK-LABEL: vec_splat_testi8i8
11 subroutine vec_splat_testi8i8(x
)
12 vector(integer(1)) :: x
, y
14 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<16:i8>>
15 ! FIR: %[[idx:.*]] = arith.constant 0 : i8
16 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<16:i8>) -> vector<16xi8>
17 ! FIR: %[[c:.*]] = arith.constant 16 : i8
18 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i8
19 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i8] : vector<16xi8>
20 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<16xi8>
21 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<16xi8>) -> !fir.vector<16:i8>
22 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<16:i8>>
24 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<16xi8>>
25 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i8) : i8
26 ! MLIR: %[[c:.*]] = llvm.mlir.constant(16 : i8) : i8
27 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i8
28 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i8] : vector<16xi8>
29 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<16xi8>
30 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
31 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<16xi8>
32 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] : vector<16xi8>
33 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<16xi8>>
35 ! LLVMIR: %[[x:.*]] = load <16 x i8>, ptr %{{[0-9]}}, align 16
36 ! LLVMIR: %[[ele:.*]] = extractelement <16 x i8> %[[x]], i8 0
37 ! LLVMIR: %[[ins:.*]] = insertelement <16 x i8> undef, i8 %[[ele]], i32 0
38 ! LLVMIR: %[[y:.*]] = shufflevector <16 x i8> %[[ins]], <16 x i8> undef, <16 x i32> zeroinitializer
39 ! LLVMIR: store <16 x i8> %[[y]], ptr %{{[0-9]}}, align 16
40 end subroutine vec_splat_testi8i8
42 ! CHECK-LABEL: vec_splat_testi8i16
43 subroutine vec_splat_testi8i16(x
)
44 vector(integer(1)) :: x
, y
46 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<16:i8>>
47 ! FIR: %[[idx:.*]] = arith.constant 0 : i16
48 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<16:i8>) -> vector<16xi8>
49 ! FIR: %[[c:.*]] = arith.constant 16 : i16
50 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i16
51 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i16] : vector<16xi8>
52 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<16xi8>
53 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<16xi8>) -> !fir.vector<16:i8>
54 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<16:i8>>
56 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<16xi8>>
57 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i16) : i16
58 ! MLIR: %[[c:.*]] = llvm.mlir.constant(16 : i16) : i16
59 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i16
60 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i16] : vector<16xi8>
61 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<16xi8>
62 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
63 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<16xi8>
64 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] : vector<16xi8>
65 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<16xi8>>
67 ! LLVMIR: %[[x:.*]] = load <16 x i8>, ptr %{{[0-9]}}, align 16
68 ! LLVMIR: %[[ele:.*]] = extractelement <16 x i8> %[[x]], i16 0
69 ! LLVMIR: %[[ins:.*]] = insertelement <16 x i8> undef, i8 %[[ele]], i32 0
70 ! LLVMIR: %[[y:.*]] = shufflevector <16 x i8> %[[ins]], <16 x i8> undef, <16 x i32> zeroinitializer
71 ! LLVMIR: store <16 x i8> %[[y]], ptr %{{[0-9]}}, align 16
72 end subroutine vec_splat_testi8i16
74 ! CHECK-LABEL: vec_splat_testi8i32
75 subroutine vec_splat_testi8i32(x
)
76 vector(integer(1)) :: x
, y
78 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<16:i8>>
79 ! FIR: %[[idx:.*]] = arith.constant 0 : i32
80 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<16:i8>) -> vector<16xi8>
81 ! FIR: %[[c:.*]] = arith.constant 16 : i32
82 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i32
83 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i32] : vector<16xi8>
84 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<16xi8>
85 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<16xi8>) -> !fir.vector<16:i8>
86 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<16:i8>>
88 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<16xi8>>
89 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i32) : i32
90 ! MLIR: %[[c:.*]] = llvm.mlir.constant(16 : i32) : i32
91 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i32
92 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i32] : vector<16xi8>
93 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<16xi8>
94 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
95 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<16xi8>
96 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] : vector<16xi8>
97 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<16xi8>>
99 ! LLVMIR: %[[x:.*]] = load <16 x i8>, ptr %{{[0-9]}}, align 16
100 ! LLVMIR: %[[ele:.*]] = extractelement <16 x i8> %[[x]], i32 0
101 ! LLVMIR: %[[ins:.*]] = insertelement <16 x i8> undef, i8 %[[ele]], i32 0
102 ! LLVMIR: %[[y:.*]] = shufflevector <16 x i8> %[[ins]], <16 x i8> undef, <16 x i32> zeroinitializer
103 ! LLVMIR: store <16 x i8> %[[y]], ptr %{{[0-9]}}, align 16
104 end subroutine vec_splat_testi8i32
106 ! CHECK-LABEL: vec_splat_testi8i64
107 subroutine vec_splat_testi8i64(x
)
108 vector(integer(1)) :: x
, y
109 y
= vec_splat(x
, 0_8)
110 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<16:i8>>
111 ! FIR: %[[idx:.*]] = arith.constant 0 : i64
112 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<16:i8>) -> vector<16xi8>
113 ! FIR: %[[c:.*]] = arith.constant 16 : i64
114 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i64
115 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i64] : vector<16xi8>
116 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<16xi8>
117 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<16xi8>) -> !fir.vector<16:i8>
118 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<16:i8>>
120 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<16xi8>>
121 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i64) : i64
122 ! MLIR: %[[c:.*]] = llvm.mlir.constant(16 : i64) : i64
123 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i64
124 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i64] : vector<16xi8>
125 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<16xi8>
126 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
127 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<16xi8>
128 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] : vector<16xi8>
129 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<16xi8>>
131 ! LLVMIR: %[[x:.*]] = load <16 x i8>, ptr %{{[0-9]}}, align 16
132 ! LLVMIR: %[[ele:.*]] = extractelement <16 x i8> %[[x]], i64 0
133 ! LLVMIR: %[[ins:.*]] = insertelement <16 x i8> undef, i8 %[[ele]], i32 0
134 ! LLVMIR: %[[y:.*]] = shufflevector <16 x i8> %[[ins]], <16 x i8> undef, <16 x i32> zeroinitializer
135 ! LLVMIR: store <16 x i8> %[[y]], ptr %{{[0-9]}}, align 16
136 end subroutine vec_splat_testi8i64
138 ! CHECK-LABEL: vec_splat_testi16i8
139 subroutine vec_splat_testi16i8(x
)
140 vector(integer(2)) :: x
, y
141 y
= vec_splat(x
, 0_1)
142 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<8:i16>>
143 ! FIR: %[[idx:.*]] = arith.constant 0 : i8
144 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<8:i16>) -> vector<8xi16>
145 ! FIR: %[[c:.*]] = arith.constant 8 : i8
146 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i8
147 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i8] : vector<8xi16>
148 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<8xi16>
149 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<8xi16>) -> !fir.vector<8:i16>
150 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<8:i16>>
152 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<8xi16>>
153 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i8) : i8
154 ! MLIR: %[[c:.*]] = llvm.mlir.constant(8 : i8) : i8
155 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i8
156 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i8] : vector<8xi16>
157 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<8xi16>
158 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
159 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<8xi16>
160 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0, 0, 0, 0, 0] : vector<8xi16>
161 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<8xi16>>
163 ! LLVMIR: %[[x:.*]] = load <8 x i16>, ptr %{{[0-9]}}, align 16
164 ! LLVMIR: %[[ele:.*]] = extractelement <8 x i16> %[[x]], i8 0
165 ! LLVMIR: %[[ins:.*]] = insertelement <8 x i16> undef, i16 %[[ele]], i32 0
166 ! LLVMIR: %[[y:.*]] = shufflevector <8 x i16> %[[ins]], <8 x i16> undef, <8 x i32> zeroinitializer
167 ! LLVMIR: store <8 x i16> %[[y]], ptr %{{[0-9]}}, align 16
168 end subroutine vec_splat_testi16i8
170 ! CHECK-LABEL: vec_splat_testi16i16
171 subroutine vec_splat_testi16i16(x
)
172 vector(integer(2)) :: x
, y
173 y
= vec_splat(x
, 0_2)
174 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<8:i16>>
175 ! FIR: %[[idx:.*]] = arith.constant 0 : i16
176 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<8:i16>) -> vector<8xi16>
177 ! FIR: %[[c:.*]] = arith.constant 8 : i16
178 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i16
179 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i16] : vector<8xi16>
180 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<8xi16>
181 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<8xi16>) -> !fir.vector<8:i16>
182 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<8:i16>>
184 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<8xi16>>
185 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i16) : i16
186 ! MLIR: %[[c:.*]] = llvm.mlir.constant(8 : i16) : i16
187 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i16
188 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i16] : vector<8xi16>
189 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<8xi16>
190 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
191 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<8xi16>
192 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0, 0, 0, 0, 0] : vector<8xi16>
193 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<8xi16>>
195 ! LLVMIR: %[[x:.*]] = load <8 x i16>, ptr %{{[0-9]}}, align 16
196 ! LLVMIR: %[[ele:.*]] = extractelement <8 x i16> %[[x]], i16 0
197 ! LLVMIR: %[[ins:.*]] = insertelement <8 x i16> undef, i16 %[[ele]], i32 0
198 ! LLVMIR: %[[y:.*]] = shufflevector <8 x i16> %[[ins]], <8 x i16> undef, <8 x i32> zeroinitializer
199 ! LLVMIR: store <8 x i16> %[[y]], ptr %{{[0-9]}}, align 16
200 end subroutine vec_splat_testi16i16
202 ! CHECK-LABEL: vec_splat_testi16i32
203 subroutine vec_splat_testi16i32(x
)
204 vector(integer(2)) :: x
, y
205 y
= vec_splat(x
, 0_4)
206 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<8:i16>>
207 ! FIR: %[[idx:.*]] = arith.constant 0 : i32
208 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<8:i16>) -> vector<8xi16>
209 ! FIR: %[[c:.*]] = arith.constant 8 : i32
210 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i32
211 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i32] : vector<8xi16>
212 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<8xi16>
213 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<8xi16>) -> !fir.vector<8:i16>
214 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<8:i16>>
216 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<8xi16>>
217 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i32) : i32
218 ! MLIR: %[[c:.*]] = llvm.mlir.constant(8 : i32) : i32
219 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i32
220 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i32] : vector<8xi16>
221 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<8xi16>
222 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
223 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<8xi16>
224 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0, 0, 0, 0, 0] : vector<8xi16>
225 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<8xi16>>
227 ! LLVMIR: %[[x:.*]] = load <8 x i16>, ptr %{{[0-9]}}, align 16
228 ! LLVMIR: %[[ele:.*]] = extractelement <8 x i16> %[[x]], i32 0
229 ! LLVMIR: %[[ins:.*]] = insertelement <8 x i16> undef, i16 %[[ele]], i32 0
230 ! LLVMIR: %[[y:.*]] = shufflevector <8 x i16> %[[ins]], <8 x i16> undef, <8 x i32> zeroinitializer
231 ! LLVMIR: store <8 x i16> %[[y]], ptr %{{[0-9]}}, align 16
232 end subroutine vec_splat_testi16i32
234 ! CHECK-LABEL: vec_splat_testi16i64
235 subroutine vec_splat_testi16i64(x
)
236 vector(integer(2)) :: x
, y
237 y
= vec_splat(x
, 0_8)
238 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<8:i16>>
239 ! FIR: %[[idx:.*]] = arith.constant 0 : i64
240 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<8:i16>) -> vector<8xi16>
241 ! FIR: %[[c:.*]] = arith.constant 8 : i64
242 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i64
243 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i64] : vector<8xi16>
244 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<8xi16>
245 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<8xi16>) -> !fir.vector<8:i16>
246 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<8:i16>>
248 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<8xi16>>
249 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i64) : i64
250 ! MLIR: %[[c:.*]] = llvm.mlir.constant(8 : i64) : i64
251 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i64
252 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i64] : vector<8xi16>
253 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<8xi16>
254 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
255 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<8xi16>
256 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0, 0, 0, 0, 0] : vector<8xi16>
257 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<8xi16>>
259 ! LLVMIR: %[[x:.*]] = load <8 x i16>, ptr %{{[0-9]}}, align 16
260 ! LLVMIR: %[[ele:.*]] = extractelement <8 x i16> %[[x]], i64 0
261 ! LLVMIR: %[[ins:.*]] = insertelement <8 x i16> undef, i16 %[[ele]], i32 0
262 ! LLVMIR: %[[y:.*]] = shufflevector <8 x i16> %[[ins]], <8 x i16> undef, <8 x i32> zeroinitializer
263 ! LLVMIR: store <8 x i16> %[[y]], ptr %{{[0-9]}}, align 16
264 end subroutine vec_splat_testi16i64
266 ! CHECK-LABEL: vec_splat_testi32i8
267 subroutine vec_splat_testi32i8(x
)
268 vector(integer(4)) :: x
, y
269 y
= vec_splat(x
, 0_1)
270 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<4:i32>>
271 ! FIR: %[[idx:.*]] = arith.constant 0 : i8
272 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<4:i32>) -> vector<4xi32>
273 ! FIR: %[[c:.*]] = arith.constant 4 : i8
274 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i8
275 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i8] : vector<4xi32>
276 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<4xi32>
277 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<4xi32>) -> !fir.vector<4:i32>
278 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<4:i32>>
280 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<4xi32>>
281 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i8) : i8
282 ! MLIR: %[[c:.*]] = llvm.mlir.constant(4 : i8) : i8
283 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i8
284 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i8] : vector<4xi32>
285 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<4xi32>
286 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
287 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<4xi32>
288 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0] : vector<4xi32>
289 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<4xi32>>
291 ! LLVMIR: %[[x:.*]] = load <4 x i32>, ptr %{{[0-9]}}, align 16
292 ! LLVMIR: %[[ele:.*]] = extractelement <4 x i32> %[[x]], i8 0
293 ! LLVMIR: %[[ins:.*]] = insertelement <4 x i32> undef, i32 %[[ele]], i32 0
294 ! LLVMIR: %[[y:.*]] = shufflevector <4 x i32> %[[ins]], <4 x i32> undef, <4 x i32> zeroinitializer
295 ! LLVMIR: store <4 x i32> %[[y]], ptr %{{[0-9]}}, align 16
296 end subroutine vec_splat_testi32i8
298 ! CHECK-LABEL: vec_splat_testi32i16
299 subroutine vec_splat_testi32i16(x
)
300 vector(integer(4)) :: x
, y
301 y
= vec_splat(x
, 0_2)
302 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<4:i32>>
303 ! FIR: %[[idx:.*]] = arith.constant 0 : i16
304 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<4:i32>) -> vector<4xi32>
305 ! FIR: %[[c:.*]] = arith.constant 4 : i16
306 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i16
307 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i16] : vector<4xi32>
308 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<4xi32>
309 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<4xi32>) -> !fir.vector<4:i32>
310 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<4:i32>>
312 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<4xi32>>
313 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i16) : i16
314 ! MLIR: %[[c:.*]] = llvm.mlir.constant(4 : i16) : i16
315 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i16
316 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i16] : vector<4xi32>
317 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<4xi32>
318 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
319 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<4xi32>
320 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0] : vector<4xi32>
321 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<4xi32>>
323 ! LLVMIR: %[[x:.*]] = load <4 x i32>, ptr %{{[0-9]}}, align 16
324 ! LLVMIR: %[[ele:.*]] = extractelement <4 x i32> %[[x]], i16 0
325 ! LLVMIR: %[[ins:.*]] = insertelement <4 x i32> undef, i32 %[[ele]], i32 0
326 ! LLVMIR: %[[y:.*]] = shufflevector <4 x i32> %[[ins]], <4 x i32> undef, <4 x i32> zeroinitializer
327 ! LLVMIR: store <4 x i32> %[[y]], ptr %{{[0-9]}}, align 16
328 end subroutine vec_splat_testi32i16
330 ! CHECK-LABEL: vec_splat_testi32i32
331 subroutine vec_splat_testi32i32(x
)
332 vector(integer(4)) :: x
, y
333 y
= vec_splat(x
, 0_4)
334 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<4:i32>>
335 ! FIR: %[[idx:.*]] = arith.constant 0 : i32
336 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<4:i32>) -> vector<4xi32>
337 ! FIR: %[[c:.*]] = arith.constant 4 : i32
338 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i32
339 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i32] : vector<4xi32>
340 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<4xi32>
341 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<4xi32>) -> !fir.vector<4:i32>
342 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<4:i32>>
344 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<4xi32>>
345 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i32) : i32
346 ! MLIR: %[[c:.*]] = llvm.mlir.constant(4 : i32) : i32
347 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i32
348 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i32] : vector<4xi32>
349 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<4xi32>
350 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
351 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<4xi32>
352 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0] : vector<4xi32>
353 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<4xi32>>
355 ! LLVMIR: %[[x:.*]] = load <4 x i32>, ptr %{{[0-9]}}, align 16
356 ! LLVMIR: %[[ele:.*]] = extractelement <4 x i32> %[[x]], i32 0
357 ! LLVMIR: %[[ins:.*]] = insertelement <4 x i32> undef, i32 %[[ele]], i32 0
358 ! LLVMIR: %[[y:.*]] = shufflevector <4 x i32> %[[ins]], <4 x i32> undef, <4 x i32> zeroinitializer
359 ! LLVMIR: store <4 x i32> %[[y]], ptr %{{[0-9]}}, align 16
360 end subroutine vec_splat_testi32i32
362 ! CHECK-LABEL: vec_splat_testi32i64
363 subroutine vec_splat_testi32i64(x
)
364 vector(integer(4)) :: x
, y
365 y
= vec_splat(x
, 0_8)
366 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<4:i32>>
367 ! FIR: %[[idx:.*]] = arith.constant 0 : i64
368 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<4:i32>) -> vector<4xi32>
369 ! FIR: %[[c:.*]] = arith.constant 4 : i64
370 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i64
371 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i64] : vector<4xi32>
372 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<4xi32>
373 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<4xi32>) -> !fir.vector<4:i32>
374 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<4:i32>>
376 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<4xi32>>
377 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i64) : i64
378 ! MLIR: %[[c:.*]] = llvm.mlir.constant(4 : i64) : i64
379 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i64
380 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i64] : vector<4xi32>
381 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<4xi32>
382 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
383 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<4xi32>
384 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0] : vector<4xi32>
385 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<4xi32>>
387 ! LLVMIR: %[[x:.*]] = load <4 x i32>, ptr %{{[0-9]}}, align 16
388 ! LLVMIR: %[[ele:.*]] = extractelement <4 x i32> %[[x]], i64 0
389 ! LLVMIR: %[[ins:.*]] = insertelement <4 x i32> undef, i32 %[[ele]], i32 0
390 ! LLVMIR: %[[y:.*]] = shufflevector <4 x i32> %[[ins]], <4 x i32> undef, <4 x i32> zeroinitializer
391 ! LLVMIR: store <4 x i32> %[[y]], ptr %{{[0-9]}}, align 16
392 end subroutine vec_splat_testi32i64
394 ! CHECK-LABEL: vec_splat_testi64i8
395 subroutine vec_splat_testi64i8(x
)
396 vector(integer(8)) :: x
, y
397 y
= vec_splat(x
, 0_1)
398 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<2:i64>>
399 ! FIR: %[[idx:.*]] = arith.constant 0 : i8
400 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<2:i64>) -> vector<2xi64>
401 ! FIR: %[[c:.*]] = arith.constant 2 : i8
402 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i8
403 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i8] : vector<2xi64>
404 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<2xi64>
405 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<2xi64>) -> !fir.vector<2:i64>
406 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<2:i64>>
408 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<2xi64>>
409 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i8) : i8
410 ! MLIR: %[[c:.*]] = llvm.mlir.constant(2 : i8) : i8
411 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i8
412 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i8] : vector<2xi64>
413 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<2xi64>
414 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
415 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<2xi64>
416 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0] : vector<2xi64>
417 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<2xi64>>
419 ! LLVMIR: %[[x:.*]] = load <2 x i64>, ptr %{{[0-9]}}, align 16
420 ! LLVMIR: %[[ele:.*]] = extractelement <2 x i64> %[[x]], i8 0
421 ! LLVMIR: %[[ins:.*]] = insertelement <2 x i64> undef, i64 %[[ele]], i32 0
422 ! LLVMIR: %[[y:.*]] = shufflevector <2 x i64> %[[ins]], <2 x i64> undef, <2 x i32> zeroinitializer
423 ! LLVMIR: store <2 x i64> %[[y]], ptr %{{[0-9]}}, align 16
424 end subroutine vec_splat_testi64i8
426 ! CHECK-LABEL: vec_splat_testi64i16
427 subroutine vec_splat_testi64i16(x
)
428 vector(integer(8)) :: x
, y
429 y
= vec_splat(x
, 0_2)
430 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<2:i64>>
431 ! FIR: %[[idx:.*]] = arith.constant 0 : i16
432 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<2:i64>) -> vector<2xi64>
433 ! FIR: %[[c:.*]] = arith.constant 2 : i16
434 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i16
435 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i16] : vector<2xi64>
436 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<2xi64>
437 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<2xi64>) -> !fir.vector<2:i64>
438 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<2:i64>>
440 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<2xi64>>
441 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i16) : i16
442 ! MLIR: %[[c:.*]] = llvm.mlir.constant(2 : i16) : i16
443 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i16
444 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i16] : vector<2xi64>
445 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<2xi64>
446 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
447 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<2xi64>
448 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0] : vector<2xi64>
449 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<2xi64>>
451 ! LLVMIR: %[[x:.*]] = load <2 x i64>, ptr %{{[0-9]}}, align 16
452 ! LLVMIR: %[[ele:.*]] = extractelement <2 x i64> %[[x]], i16 0
453 ! LLVMIR: %[[ins:.*]] = insertelement <2 x i64> undef, i64 %[[ele]], i32 0
454 ! LLVMIR: %[[y:.*]] = shufflevector <2 x i64> %[[ins]], <2 x i64> undef, <2 x i32> zeroinitializer
455 ! LLVMIR: store <2 x i64> %[[y]], ptr %{{[0-9]}}, align 16
456 end subroutine vec_splat_testi64i16
458 ! CHECK-LABEL: vec_splat_testi64i32
459 subroutine vec_splat_testi64i32(x
)
460 vector(integer(8)) :: x
, y
461 y
= vec_splat(x
, 0_4)
462 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<2:i64>>
463 ! FIR: %[[idx:.*]] = arith.constant 0 : i32
464 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<2:i64>) -> vector<2xi64>
465 ! FIR: %[[c:.*]] = arith.constant 2 : i32
466 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i32
467 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i32] : vector<2xi64>
468 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<2xi64>
469 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<2xi64>) -> !fir.vector<2:i64>
470 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<2:i64>>
472 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<2xi64>>
473 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i32) : i32
474 ! MLIR: %[[c:.*]] = llvm.mlir.constant(2 : i32) : i32
475 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i32
476 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i32] : vector<2xi64>
477 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<2xi64>
478 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
479 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<2xi64>
480 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0] : vector<2xi64>
481 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<2xi64>>
483 ! LLVMIR: %[[x:.*]] = load <2 x i64>, ptr %{{[0-9]}}, align 16
484 ! LLVMIR: %[[ele:.*]] = extractelement <2 x i64> %[[x]], i32 0
485 ! LLVMIR: %[[ins:.*]] = insertelement <2 x i64> undef, i64 %[[ele]], i32 0
486 ! LLVMIR: %[[y:.*]] = shufflevector <2 x i64> %[[ins]], <2 x i64> undef, <2 x i32> zeroinitializer
487 ! LLVMIR: store <2 x i64> %[[y]], ptr %{{[0-9]}}, align 16
488 end subroutine vec_splat_testi64i32
490 ! CHECK-LABEL: vec_splat_testi64i64
491 subroutine vec_splat_testi64i64(x
)
492 vector(integer(8)) :: x
, y
493 y
= vec_splat(x
, 0_8)
494 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<2:i64>>
495 ! FIR: %[[idx:.*]] = arith.constant 0 : i64
496 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<2:i64>) -> vector<2xi64>
497 ! FIR: %[[c:.*]] = arith.constant 2 : i64
498 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i64
499 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i64] : vector<2xi64>
500 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<2xi64>
501 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<2xi64>) -> !fir.vector<2:i64>
502 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<2:i64>>
504 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<2xi64>>
505 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i64) : i64
506 ! MLIR: %[[c:.*]] = llvm.mlir.constant(2 : i64) : i64
507 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i64
508 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i64] : vector<2xi64>
509 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<2xi64>
510 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
511 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<2xi64>
512 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0] : vector<2xi64>
513 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<2xi64>>
515 ! LLVMIR: %[[x:.*]] = load <2 x i64>, ptr %{{[0-9]}}, align 16
516 ! LLVMIR: %[[ele:.*]] = extractelement <2 x i64> %[[x]], i64 0
517 ! LLVMIR: %[[ins:.*]] = insertelement <2 x i64> undef, i64 %[[ele]], i32 0
518 ! LLVMIR: %[[y:.*]] = shufflevector <2 x i64> %[[ins]], <2 x i64> undef, <2 x i32> zeroinitializer
519 ! LLVMIR: store <2 x i64> %[[y]], ptr %{{[0-9]}}, align 16
520 end subroutine vec_splat_testi64i64
522 ! CHECK-LABEL: vec_splat_testf32i8
523 subroutine vec_splat_testf32i8(x
)
524 vector(real(4)) :: x
, y
525 y
= vec_splat(x
, 0_1)
526 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<4:f32>>
527 ! FIR: %[[idx:.*]] = arith.constant 0 : i8
528 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<4:f32>) -> vector<4xf32>
529 ! FIR: %[[c:.*]] = arith.constant 4 : i8
530 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i8
531 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i8] : vector<4xf32>
532 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<4xf32>
533 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<4xf32>) -> !fir.vector<4:f32>
534 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<4:f32>>
536 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<4xf32>>
537 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i8) : i8
538 ! MLIR: %[[c:.*]] = llvm.mlir.constant(4 : i8) : i8
539 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i8
540 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i8] : vector<4xf32>
541 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<4xf32>
542 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
543 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<4xf32>
544 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0] : vector<4xf32>
545 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<4xf32>>
547 ! LLVMIR: %[[x:.*]] = load <4 x float>, ptr %{{[0-9]}}, align 16
548 ! LLVMIR: %[[ele:.*]] = extractelement <4 x float> %[[x]], i8 0
549 ! LLVMIR: %[[ins:.*]] = insertelement <4 x float> undef, float %[[ele]], i32 0
550 ! LLVMIR: %[[y:.*]] = shufflevector <4 x float> %[[ins]], <4 x float> undef, <4 x i32> zeroinitializer
551 ! LLVMIR: store <4 x float> %[[y]], ptr %{{[0-9]}}, align 16
552 end subroutine vec_splat_testf32i8
554 ! CHECK-LABEL: vec_splat_testf32i16
555 subroutine vec_splat_testf32i16(x
)
556 vector(real(4)) :: x
, y
557 y
= vec_splat(x
, 0_2)
558 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<4:f32>>
559 ! FIR: %[[idx:.*]] = arith.constant 0 : i16
560 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<4:f32>) -> vector<4xf32>
561 ! FIR: %[[c:.*]] = arith.constant 4 : i16
562 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i16
563 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i16] : vector<4xf32>
564 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<4xf32>
565 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<4xf32>) -> !fir.vector<4:f32>
566 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<4:f32>>
568 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<4xf32>>
569 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i16) : i16
570 ! MLIR: %[[c:.*]] = llvm.mlir.constant(4 : i16) : i16
571 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i16
572 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i16] : vector<4xf32>
573 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<4xf32>
574 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
575 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<4xf32>
576 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0] : vector<4xf32>
577 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<4xf32>>
579 ! LLVMIR: %[[x:.*]] = load <4 x float>, ptr %{{[0-9]}}, align 16
580 ! LLVMIR: %[[ele:.*]] = extractelement <4 x float> %[[x]], i16 0
581 ! LLVMIR: %[[ins:.*]] = insertelement <4 x float> undef, float %[[ele]], i32 0
582 ! LLVMIR: %[[y:.*]] = shufflevector <4 x float> %[[ins]], <4 x float> undef, <4 x i32> zeroinitializer
583 ! LLVMIR: store <4 x float> %[[y]], ptr %{{[0-9]}}, align 16
584 end subroutine vec_splat_testf32i16
586 ! CHECK-LABEL: vec_splat_testf32i32
587 subroutine vec_splat_testf32i32(x
)
588 vector(real(4)) :: x
, y
589 y
= vec_splat(x
, 0_4)
590 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<4:f32>>
591 ! FIR: %[[idx:.*]] = arith.constant 0 : i32
592 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<4:f32>) -> vector<4xf32>
593 ! FIR: %[[c:.*]] = arith.constant 4 : i32
594 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i32
595 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i32] : vector<4xf32>
596 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<4xf32>
597 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<4xf32>) -> !fir.vector<4:f32>
598 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<4:f32>>
600 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<4xf32>>
601 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i32) : i32
602 ! MLIR: %[[c:.*]] = llvm.mlir.constant(4 : i32) : i32
603 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i32
604 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i32] : vector<4xf32>
605 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<4xf32>
606 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
607 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<4xf32>
608 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0] : vector<4xf32>
609 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<4xf32>>
611 ! LLVMIR: %[[x:.*]] = load <4 x float>, ptr %{{[0-9]}}, align 16
612 ! LLVMIR: %[[ele:.*]] = extractelement <4 x float> %[[x]], i32 0
613 ! LLVMIR: %[[ins:.*]] = insertelement <4 x float> undef, float %[[ele]], i32 0
614 ! LLVMIR: %[[y:.*]] = shufflevector <4 x float> %[[ins]], <4 x float> undef, <4 x i32> zeroinitializer
615 ! LLVMIR: store <4 x float> %[[y]], ptr %{{[0-9]}}, align 16
616 end subroutine vec_splat_testf32i32
618 ! CHECK-LABEL: vec_splat_testf32i64
619 subroutine vec_splat_testf32i64(x
)
620 vector(real(4)) :: x
, y
621 y
= vec_splat(x
, 0_8)
622 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<4:f32>>
623 ! FIR: %[[idx:.*]] = arith.constant 0 : i64
624 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<4:f32>) -> vector<4xf32>
625 ! FIR: %[[c:.*]] = arith.constant 4 : i64
626 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i64
627 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i64] : vector<4xf32>
628 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<4xf32>
629 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<4xf32>) -> !fir.vector<4:f32>
630 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<4:f32>>
632 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<4xf32>>
633 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i64) : i64
634 ! MLIR: %[[c:.*]] = llvm.mlir.constant(4 : i64) : i64
635 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i64
636 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i64] : vector<4xf32>
637 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<4xf32>
638 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
639 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<4xf32>
640 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0] : vector<4xf32>
641 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<4xf32>>
643 ! LLVMIR: %[[x:.*]] = load <4 x float>, ptr %{{[0-9]}}, align 16
644 ! LLVMIR: %[[ele:.*]] = extractelement <4 x float> %[[x]], i64 0
645 ! LLVMIR: %[[ins:.*]] = insertelement <4 x float> undef, float %[[ele]], i32 0
646 ! LLVMIR: %[[y:.*]] = shufflevector <4 x float> %[[ins]], <4 x float> undef, <4 x i32> zeroinitializer
647 ! LLVMIR: store <4 x float> %[[y]], ptr %{{[0-9]}}, align 16
648 end subroutine vec_splat_testf32i64
650 ! CHECK-LABEL: vec_splat_testf64i8
651 subroutine vec_splat_testf64i8(x
)
652 vector(real(8)) :: x
, y
653 y
= vec_splat(x
, 0_1)
654 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<2:f64>>
655 ! FIR: %[[idx:.*]] = arith.constant 0 : i8
656 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<2:f64>) -> vector<2xf64>
657 ! FIR: %[[c:.*]] = arith.constant 2 : i8
658 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i8
659 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i8] : vector<2xf64>
660 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<2xf64>
661 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<2xf64>) -> !fir.vector<2:f64>
662 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<2:f64>>
664 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<2xf64>>
665 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i8) : i8
666 ! MLIR: %[[c:.*]] = llvm.mlir.constant(2 : i8) : i8
667 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i8
668 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i8] : vector<2xf64>
669 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<2xf64>
670 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
671 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<2xf64>
672 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0] : vector<2xf64>
673 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<2xf64>>
675 ! LLVMIR: %[[x:.*]] = load <2 x double>, ptr %{{[0-9]}}, align 16
676 ! LLVMIR: %[[ele:.*]] = extractelement <2 x double> %[[x]], i8 0
677 ! LLVMIR: %[[ins:.*]] = insertelement <2 x double> undef, double %[[ele]], i32 0
678 ! LLVMIR: %[[y:.*]] = shufflevector <2 x double> %[[ins]], <2 x double> undef, <2 x i32> zeroinitializer
679 ! LLVMIR: store <2 x double> %[[y]], ptr %{{[0-9]}}, align 16
680 end subroutine vec_splat_testf64i8
682 ! CHECK-LABEL: vec_splat_testf64i16
683 subroutine vec_splat_testf64i16(x
)
684 vector(real(8)) :: x
, y
685 y
= vec_splat(x
, 0_2)
686 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<2:f64>>
687 ! FIR: %[[idx:.*]] = arith.constant 0 : i16
688 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<2:f64>) -> vector<2xf64>
689 ! FIR: %[[c:.*]] = arith.constant 2 : i16
690 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i16
691 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i16] : vector<2xf64>
692 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<2xf64>
693 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<2xf64>) -> !fir.vector<2:f64>
694 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<2:f64>>
696 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<2xf64>>
697 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i16) : i16
698 ! MLIR: %[[c:.*]] = llvm.mlir.constant(2 : i16) : i16
699 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i16
700 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i16] : vector<2xf64>
701 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<2xf64>
702 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
703 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<2xf64>
704 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0] : vector<2xf64>
705 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<2xf64>>
707 ! LLVMIR: %[[x:.*]] = load <2 x double>, ptr %{{[0-9]}}, align 16
708 ! LLVMIR: %[[ele:.*]] = extractelement <2 x double> %[[x]], i16 0
709 ! LLVMIR: %[[ins:.*]] = insertelement <2 x double> undef, double %[[ele]], i32 0
710 ! LLVMIR: %[[y:.*]] = shufflevector <2 x double> %[[ins]], <2 x double> undef, <2 x i32> zeroinitializer
711 ! LLVMIR: store <2 x double> %[[y]], ptr %{{[0-9]}}, align 16
712 end subroutine vec_splat_testf64i16
714 ! CHECK-LABEL: vec_splat_testf64i32
715 subroutine vec_splat_testf64i32(x
)
716 vector(real(8)) :: x
, y
717 y
= vec_splat(x
, 0_4)
718 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<2:f64>>
719 ! FIR: %[[idx:.*]] = arith.constant 0 : i32
720 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<2:f64>) -> vector<2xf64>
721 ! FIR: %[[c:.*]] = arith.constant 2 : i32
722 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i32
723 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i32] : vector<2xf64>
724 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<2xf64>
725 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<2xf64>) -> !fir.vector<2:f64>
726 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<2:f64>>
728 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<2xf64>>
729 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i32) : i32
730 ! MLIR: %[[c:.*]] = llvm.mlir.constant(2 : i32) : i32
731 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i32
732 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i32] : vector<2xf64>
733 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<2xf64>
734 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
735 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<2xf64>
736 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0] : vector<2xf64>
737 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<2xf64>>
739 ! LLVMIR: %[[x:.*]] = load <2 x double>, ptr %{{[0-9]}}, align 16
740 ! LLVMIR: %[[ele:.*]] = extractelement <2 x double> %[[x]], i32 0
741 ! LLVMIR: %[[ins:.*]] = insertelement <2 x double> undef, double %[[ele]], i32 0
742 ! LLVMIR: %[[y:.*]] = shufflevector <2 x double> %[[ins]], <2 x double> undef, <2 x i32> zeroinitializer
743 ! LLVMIR: store <2 x double> %[[y]], ptr %{{[0-9]}}, align 16
744 end subroutine vec_splat_testf64i32
746 ! CHECK-LABEL: vec_splat_testf64i64
747 subroutine vec_splat_testf64i64(x
)
748 vector(real(8)) :: x
, y
749 y
= vec_splat(x
, 0_8)
750 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<2:f64>>
751 ! FIR: %[[idx:.*]] = arith.constant 0 : i64
752 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<2:f64>) -> vector<2xf64>
753 ! FIR: %[[c:.*]] = arith.constant 2 : i64
754 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i64
755 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i64] : vector<2xf64>
756 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<2xf64>
757 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<2xf64>) -> !fir.vector<2:f64>
758 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<2:f64>>
760 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<2xf64>>
761 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i64) : i64
762 ! MLIR: %[[c:.*]] = llvm.mlir.constant(2 : i64) : i64
763 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i64
764 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i64] : vector<2xf64>
765 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<2xf64>
766 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
767 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<2xf64>
768 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0] : vector<2xf64>
769 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<2xf64>>
771 ! LLVMIR: %[[x:.*]] = load <2 x double>, ptr %{{[0-9]}}, align 16
772 ! LLVMIR: %[[ele:.*]] = extractelement <2 x double> %[[x]], i64 0
773 ! LLVMIR: %[[ins:.*]] = insertelement <2 x double> undef, double %[[ele]], i32 0
774 ! LLVMIR: %[[y:.*]] = shufflevector <2 x double> %[[ins]], <2 x double> undef, <2 x i32> zeroinitializer
775 ! LLVMIR: store <2 x double> %[[y]], ptr %{{[0-9]}}, align 16
776 end subroutine vec_splat_testf64i64
778 ! CHECK-LABEL: vec_splat_testu8i8
779 subroutine vec_splat_testu8i8(x
)
780 vector(unsigned(1)) :: x
, y
781 y
= vec_splat(x
, 0_1)
782 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<16:ui8>>
783 ! FIR: %[[idx:.*]] = arith.constant 0 : i8
784 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<16:ui8>) -> vector<16xi8>
785 ! FIR: %[[c:.*]] = arith.constant 16 : i8
786 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i8
787 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i8] : vector<16xi8>
788 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<16xi8>
789 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<16xi8>) -> !fir.vector<16:ui8>
790 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<16:ui8>>
792 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<16xi8>>
793 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i8) : i8
794 ! MLIR: %[[c:.*]] = llvm.mlir.constant(16 : i8) : i8
795 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i8
796 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i8] : vector<16xi8>
797 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<16xi8>
798 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
799 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<16xi8>
800 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] : vector<16xi8>
801 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<16xi8>>
803 ! LLVMIR: %[[x:.*]] = load <16 x i8>, ptr %{{[0-9]}}, align 16
804 ! LLVMIR: %[[ele:.*]] = extractelement <16 x i8> %[[x]], i8 0
805 ! LLVMIR: %[[ins:.*]] = insertelement <16 x i8> undef, i8 %[[ele]], i32 0
806 ! LLVMIR: %[[y:.*]] = shufflevector <16 x i8> %[[ins]], <16 x i8> undef, <16 x i32> zeroinitializer
807 ! LLVMIR: store <16 x i8> %[[y]], ptr %{{[0-9]}}, align 16
808 end subroutine vec_splat_testu8i8
810 ! CHECK-LABEL: vec_splat_testu8i16
811 subroutine vec_splat_testu8i16(x
)
812 vector(unsigned(1)) :: x
, y
813 y
= vec_splat(x
, 0_2)
814 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<16:ui8>>
815 ! FIR: %[[idx:.*]] = arith.constant 0 : i16
816 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<16:ui8>) -> vector<16xi8>
817 ! FIR: %[[c:.*]] = arith.constant 16 : i16
818 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i16
819 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i16] : vector<16xi8>
820 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<16xi8>
821 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<16xi8>) -> !fir.vector<16:ui8>
822 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<16:ui8>>
824 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<16xi8>>
825 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i16) : i16
826 ! MLIR: %[[c:.*]] = llvm.mlir.constant(16 : i16) : i16
827 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i16
828 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i16] : vector<16xi8>
829 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<16xi8>
830 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
831 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<16xi8>
832 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] : vector<16xi8>
833 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<16xi8>>
835 ! LLVMIR: %[[x:.*]] = load <16 x i8>, ptr %{{[0-9]}}, align 16
836 ! LLVMIR: %[[ele:.*]] = extractelement <16 x i8> %[[x]], i16 0
837 ! LLVMIR: %[[ins:.*]] = insertelement <16 x i8> undef, i8 %[[ele]], i32 0
838 ! LLVMIR: %[[y:.*]] = shufflevector <16 x i8> %[[ins]], <16 x i8> undef, <16 x i32> zeroinitializer
839 ! LLVMIR: store <16 x i8> %[[y]], ptr %{{[0-9]}}, align 16
840 end subroutine vec_splat_testu8i16
842 ! CHECK-LABEL: vec_splat_testu8i32
843 subroutine vec_splat_testu8i32(x
)
844 vector(unsigned(1)) :: x
, y
845 y
= vec_splat(x
, 0_4)
846 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<16:ui8>>
847 ! FIR: %[[idx:.*]] = arith.constant 0 : i32
848 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<16:ui8>) -> vector<16xi8>
849 ! FIR: %[[c:.*]] = arith.constant 16 : i32
850 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i32
851 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i32] : vector<16xi8>
852 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<16xi8>
853 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<16xi8>) -> !fir.vector<16:ui8>
854 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<16:ui8>>
856 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<16xi8>>
857 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i32) : i32
858 ! MLIR: %[[c:.*]] = llvm.mlir.constant(16 : i32) : i32
859 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i32
860 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i32] : vector<16xi8>
861 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<16xi8>
862 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
863 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<16xi8>
864 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] : vector<16xi8>
865 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<16xi8>>
867 ! LLVMIR: %[[x:.*]] = load <16 x i8>, ptr %{{[0-9]}}, align 16
868 ! LLVMIR: %[[ele:.*]] = extractelement <16 x i8> %[[x]], i32 0
869 ! LLVMIR: %[[ins:.*]] = insertelement <16 x i8> undef, i8 %[[ele]], i32 0
870 ! LLVMIR: %[[y:.*]] = shufflevector <16 x i8> %[[ins]], <16 x i8> undef, <16 x i32> zeroinitializer
871 ! LLVMIR: store <16 x i8> %[[y]], ptr %{{[0-9]}}, align 16
872 end subroutine vec_splat_testu8i32
874 ! CHECK-LABEL: vec_splat_testu8i64
875 subroutine vec_splat_testu8i64(x
)
876 vector(unsigned(1)) :: x
, y
877 y
= vec_splat(x
, 0_8)
878 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<16:ui8>>
879 ! FIR: %[[idx:.*]] = arith.constant 0 : i64
880 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<16:ui8>) -> vector<16xi8>
881 ! FIR: %[[c:.*]] = arith.constant 16 : i64
882 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i64
883 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i64] : vector<16xi8>
884 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<16xi8>
885 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<16xi8>) -> !fir.vector<16:ui8>
886 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<16:ui8>>
888 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<16xi8>>
889 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i64) : i64
890 ! MLIR: %[[c:.*]] = llvm.mlir.constant(16 : i64) : i64
891 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i64
892 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i64] : vector<16xi8>
893 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<16xi8>
894 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
895 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<16xi8>
896 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] : vector<16xi8>
897 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<16xi8>>
899 ! LLVMIR: %[[x:.*]] = load <16 x i8>, ptr %{{[0-9]}}, align 16
900 ! LLVMIR: %[[ele:.*]] = extractelement <16 x i8> %[[x]], i64 0
901 ! LLVMIR: %[[ins:.*]] = insertelement <16 x i8> undef, i8 %[[ele]], i32 0
902 ! LLVMIR: %[[y:.*]] = shufflevector <16 x i8> %[[ins]], <16 x i8> undef, <16 x i32> zeroinitializer
903 ! LLVMIR: store <16 x i8> %[[y]], ptr %{{[0-9]}}, align 16
904 end subroutine vec_splat_testu8i64
906 ! CHECK-LABEL: vec_splat_testu16i8
907 subroutine vec_splat_testu16i8(x
)
908 vector(unsigned(2)) :: x
, y
909 y
= vec_splat(x
, 0_1)
910 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<8:ui16>>
911 ! FIR: %[[idx:.*]] = arith.constant 0 : i8
912 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<8:ui16>) -> vector<8xi16>
913 ! FIR: %[[c:.*]] = arith.constant 8 : i8
914 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i8
915 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i8] : vector<8xi16>
916 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<8xi16>
917 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<8xi16>) -> !fir.vector<8:ui16>
918 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<8:ui16>>
920 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<8xi16>>
921 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i8) : i8
922 ! MLIR: %[[c:.*]] = llvm.mlir.constant(8 : i8) : i8
923 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i8
924 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i8] : vector<8xi16>
925 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<8xi16>
926 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
927 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<8xi16>
928 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0, 0, 0, 0, 0] : vector<8xi16>
929 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<8xi16>>
931 ! LLVMIR: %[[x:.*]] = load <8 x i16>, ptr %{{[0-9]}}, align 16
932 ! LLVMIR: %[[ele:.*]] = extractelement <8 x i16> %[[x]], i8 0
933 ! LLVMIR: %[[ins:.*]] = insertelement <8 x i16> undef, i16 %[[ele]], i32 0
934 ! LLVMIR: %[[y:.*]] = shufflevector <8 x i16> %[[ins]], <8 x i16> undef, <8 x i32> zeroinitializer
935 ! LLVMIR: store <8 x i16> %[[y]], ptr %{{[0-9]}}, align 16
936 end subroutine vec_splat_testu16i8
938 ! CHECK-LABEL: vec_splat_testu16i16
939 subroutine vec_splat_testu16i16(x
)
940 vector(unsigned(2)) :: x
, y
941 y
= vec_splat(x
, 0_2)
942 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<8:ui16>>
943 ! FIR: %[[idx:.*]] = arith.constant 0 : i16
944 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<8:ui16>) -> vector<8xi16>
945 ! FIR: %[[c:.*]] = arith.constant 8 : i16
946 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i16
947 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i16] : vector<8xi16>
948 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<8xi16>
949 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<8xi16>) -> !fir.vector<8:ui16>
950 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<8:ui16>>
952 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<8xi16>>
953 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i16) : i16
954 ! MLIR: %[[c:.*]] = llvm.mlir.constant(8 : i16) : i16
955 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i16
956 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i16] : vector<8xi16>
957 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<8xi16>
958 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
959 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<8xi16>
960 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0, 0, 0, 0, 0] : vector<8xi16>
961 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<8xi16>>
963 ! LLVMIR: %[[x:.*]] = load <8 x i16>, ptr %{{[0-9]}}, align 16
964 ! LLVMIR: %[[ele:.*]] = extractelement <8 x i16> %[[x]], i16 0
965 ! LLVMIR: %[[ins:.*]] = insertelement <8 x i16> undef, i16 %[[ele]], i32 0
966 ! LLVMIR: %[[y:.*]] = shufflevector <8 x i16> %[[ins]], <8 x i16> undef, <8 x i32> zeroinitializer
967 ! LLVMIR: store <8 x i16> %[[y]], ptr %{{[0-9]}}, align 16
968 end subroutine vec_splat_testu16i16
970 ! CHECK-LABEL: vec_splat_testu16i32
971 subroutine vec_splat_testu16i32(x
)
972 vector(unsigned(2)) :: x
, y
973 y
= vec_splat(x
, 0_4)
974 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<8:ui16>>
975 ! FIR: %[[idx:.*]] = arith.constant 0 : i32
976 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<8:ui16>) -> vector<8xi16>
977 ! FIR: %[[c:.*]] = arith.constant 8 : i32
978 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i32
979 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i32] : vector<8xi16>
980 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<8xi16>
981 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<8xi16>) -> !fir.vector<8:ui16>
982 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<8:ui16>>
984 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<8xi16>>
985 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i32) : i32
986 ! MLIR: %[[c:.*]] = llvm.mlir.constant(8 : i32) : i32
987 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i32
988 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i32] : vector<8xi16>
989 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<8xi16>
990 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
991 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<8xi16>
992 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0, 0, 0, 0, 0] : vector<8xi16>
993 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<8xi16>>
995 ! LLVMIR: %[[x:.*]] = load <8 x i16>, ptr %{{[0-9]}}, align 16
996 ! LLVMIR: %[[ele:.*]] = extractelement <8 x i16> %[[x]], i32 0
997 ! LLVMIR: %[[ins:.*]] = insertelement <8 x i16> undef, i16 %[[ele]], i32 0
998 ! LLVMIR: %[[y:.*]] = shufflevector <8 x i16> %[[ins]], <8 x i16> undef, <8 x i32> zeroinitializer
999 ! LLVMIR: store <8 x i16> %[[y]], ptr %{{[0-9]}}, align 16
1000 end subroutine vec_splat_testu16i32
1002 ! CHECK-LABEL: vec_splat_testu16i64
1003 subroutine vec_splat_testu16i64(x
)
1004 vector(unsigned(2)) :: x
, y
1005 y
= vec_splat(x
, 0_8)
1006 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<8:ui16>>
1007 ! FIR: %[[idx:.*]] = arith.constant 0 : i64
1008 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<8:ui16>) -> vector<8xi16>
1009 ! FIR: %[[c:.*]] = arith.constant 8 : i64
1010 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i64
1011 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i64] : vector<8xi16>
1012 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<8xi16>
1013 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<8xi16>) -> !fir.vector<8:ui16>
1014 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<8:ui16>>
1016 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<8xi16>>
1017 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i64) : i64
1018 ! MLIR: %[[c:.*]] = llvm.mlir.constant(8 : i64) : i64
1019 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i64
1020 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i64] : vector<8xi16>
1021 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<8xi16>
1022 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
1023 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<8xi16>
1024 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0, 0, 0, 0, 0] : vector<8xi16>
1025 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<8xi16>>
1027 ! LLVMIR: %[[x:.*]] = load <8 x i16>, ptr %{{[0-9]}}, align 16
1028 ! LLVMIR: %[[ele:.*]] = extractelement <8 x i16> %[[x]], i64 0
1029 ! LLVMIR: %[[ins:.*]] = insertelement <8 x i16> undef, i16 %[[ele]], i32 0
1030 ! LLVMIR: %[[y:.*]] = shufflevector <8 x i16> %[[ins]], <8 x i16> undef, <8 x i32> zeroinitializer
1031 ! LLVMIR: store <8 x i16> %[[y]], ptr %{{[0-9]}}, align 16
1032 end subroutine vec_splat_testu16i64
1034 ! CHECK-LABEL: vec_splat_testu32i8
1035 subroutine vec_splat_testu32i8(x
)
1036 vector(unsigned(4)) :: x
, y
1037 y
= vec_splat(x
, 0_1)
1038 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<4:ui32>>
1039 ! FIR: %[[idx:.*]] = arith.constant 0 : i8
1040 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<4:ui32>) -> vector<4xi32>
1041 ! FIR: %[[c:.*]] = arith.constant 4 : i8
1042 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i8
1043 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i8] : vector<4xi32>
1044 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<4xi32>
1045 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<4xi32>) -> !fir.vector<4:ui32>
1046 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<4:ui32>>
1048 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<4xi32>>
1049 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i8) : i8
1050 ! MLIR: %[[c:.*]] = llvm.mlir.constant(4 : i8) : i8
1051 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i8
1052 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i8] : vector<4xi32>
1053 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<4xi32>
1054 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
1055 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<4xi32>
1056 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0] : vector<4xi32>
1057 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<4xi32>>
1059 ! LLVMIR: %[[x:.*]] = load <4 x i32>, ptr %{{[0-9]}}, align 16
1060 ! LLVMIR: %[[ele:.*]] = extractelement <4 x i32> %[[x]], i8 0
1061 ! LLVMIR: %[[ins:.*]] = insertelement <4 x i32> undef, i32 %[[ele]], i32 0
1062 ! LLVMIR: %[[y:.*]] = shufflevector <4 x i32> %[[ins]], <4 x i32> undef, <4 x i32> zeroinitializer
1063 ! LLVMIR: store <4 x i32> %[[y]], ptr %{{[0-9]}}, align 16
1064 end subroutine vec_splat_testu32i8
1066 ! CHECK-LABEL: vec_splat_testu32i16
1067 subroutine vec_splat_testu32i16(x
)
1068 vector(unsigned(4)) :: x
, y
1069 y
= vec_splat(x
, 0_2)
1070 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<4:ui32>>
1071 ! FIR: %[[idx:.*]] = arith.constant 0 : i16
1072 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<4:ui32>) -> vector<4xi32>
1073 ! FIR: %[[c:.*]] = arith.constant 4 : i16
1074 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i16
1075 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i16] : vector<4xi32>
1076 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<4xi32>
1077 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<4xi32>) -> !fir.vector<4:ui32>
1078 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<4:ui32>>
1080 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<4xi32>>
1081 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i16) : i16
1082 ! MLIR: %[[c:.*]] = llvm.mlir.constant(4 : i16) : i16
1083 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i16
1084 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i16] : vector<4xi32>
1085 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<4xi32>
1086 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
1087 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<4xi32>
1088 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0] : vector<4xi32>
1089 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<4xi32>>
1091 ! LLVMIR: %[[x:.*]] = load <4 x i32>, ptr %{{[0-9]}}, align 16
1092 ! LLVMIR: %[[ele:.*]] = extractelement <4 x i32> %[[x]], i16 0
1093 ! LLVMIR: %[[ins:.*]] = insertelement <4 x i32> undef, i32 %[[ele]], i32 0
1094 ! LLVMIR: %[[y:.*]] = shufflevector <4 x i32> %[[ins]], <4 x i32> undef, <4 x i32> zeroinitializer
1095 ! LLVMIR: store <4 x i32> %[[y]], ptr %{{[0-9]}}, align 16
1096 end subroutine vec_splat_testu32i16
1098 ! CHECK-LABEL: vec_splat_testu32i32
1099 subroutine vec_splat_testu32i32(x
)
1100 vector(unsigned(4)) :: x
, y
1101 y
= vec_splat(x
, 0_4)
1102 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<4:ui32>>
1103 ! FIR: %[[idx:.*]] = arith.constant 0 : i32
1104 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<4:ui32>) -> vector<4xi32>
1105 ! FIR: %[[c:.*]] = arith.constant 4 : i32
1106 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i32
1107 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i32] : vector<4xi32>
1108 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<4xi32>
1109 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<4xi32>) -> !fir.vector<4:ui32>
1110 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<4:ui32>>
1112 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<4xi32>>
1113 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i32) : i32
1114 ! MLIR: %[[c:.*]] = llvm.mlir.constant(4 : i32) : i32
1115 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i32
1116 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i32] : vector<4xi32>
1117 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<4xi32>
1118 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
1119 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<4xi32>
1120 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0] : vector<4xi32>
1121 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<4xi32>>
1123 ! LLVMIR: %[[x:.*]] = load <4 x i32>, ptr %{{[0-9]}}, align 16
1124 ! LLVMIR: %[[ele:.*]] = extractelement <4 x i32> %[[x]], i32 0
1125 ! LLVMIR: %[[ins:.*]] = insertelement <4 x i32> undef, i32 %[[ele]], i32 0
1126 ! LLVMIR: %[[y:.*]] = shufflevector <4 x i32> %[[ins]], <4 x i32> undef, <4 x i32> zeroinitializer
1127 ! LLVMIR: store <4 x i32> %[[y]], ptr %{{[0-9]}}, align 16
1128 end subroutine vec_splat_testu32i32
1130 ! CHECK-LABEL: vec_splat_testu32i64
1131 subroutine vec_splat_testu32i64(x
)
1132 vector(unsigned(4)) :: x
, y
1133 y
= vec_splat(x
, 0_8)
1134 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<4:ui32>>
1135 ! FIR: %[[idx:.*]] = arith.constant 0 : i64
1136 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<4:ui32>) -> vector<4xi32>
1137 ! FIR: %[[c:.*]] = arith.constant 4 : i64
1138 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i64
1139 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i64] : vector<4xi32>
1140 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<4xi32>
1141 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<4xi32>) -> !fir.vector<4:ui32>
1142 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<4:ui32>>
1144 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<4xi32>>
1145 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i64) : i64
1146 ! MLIR: %[[c:.*]] = llvm.mlir.constant(4 : i64) : i64
1147 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i64
1148 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i64] : vector<4xi32>
1149 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<4xi32>
1150 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
1151 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<4xi32>
1152 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0] : vector<4xi32>
1153 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<4xi32>>
1155 ! LLVMIR: %[[x:.*]] = load <4 x i32>, ptr %{{[0-9]}}, align 16
1156 ! LLVMIR: %[[ele:.*]] = extractelement <4 x i32> %[[x]], i64 0
1157 ! LLVMIR: %[[ins:.*]] = insertelement <4 x i32> undef, i32 %[[ele]], i32 0
1158 ! LLVMIR: %[[y:.*]] = shufflevector <4 x i32> %[[ins]], <4 x i32> undef, <4 x i32> zeroinitializer
1159 ! LLVMIR: store <4 x i32> %[[y]], ptr %{{[0-9]}}, align 16
1160 end subroutine vec_splat_testu32i64
1162 ! CHECK-LABEL: vec_splat_testu64i8
1163 subroutine vec_splat_testu64i8(x
)
1164 vector(unsigned(8)) :: x
, y
1165 y
= vec_splat(x
, 0_1)
1166 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<2:ui64>>
1167 ! FIR: %[[idx:.*]] = arith.constant 0 : i8
1168 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<2:ui64>) -> vector<2xi64>
1169 ! FIR: %[[c:.*]] = arith.constant 2 : i8
1170 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i8
1171 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i8] : vector<2xi64>
1172 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<2xi64>
1173 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<2xi64>) -> !fir.vector<2:ui64>
1174 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<2:ui64>>
1176 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<2xi64>>
1177 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i8) : i8
1178 ! MLIR: %[[c:.*]] = llvm.mlir.constant(2 : i8) : i8
1179 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i8
1180 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i8] : vector<2xi64>
1181 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<2xi64>
1182 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
1183 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<2xi64>
1184 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0] : vector<2xi64>
1185 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<2xi64>>
1187 ! LLVMIR: %[[x:.*]] = load <2 x i64>, ptr %{{[0-9]}}, align 16
1188 ! LLVMIR: %[[ele:.*]] = extractelement <2 x i64> %[[x]], i8 0
1189 ! LLVMIR: %[[ins:.*]] = insertelement <2 x i64> undef, i64 %[[ele]], i32 0
1190 ! LLVMIR: %[[y:.*]] = shufflevector <2 x i64> %[[ins]], <2 x i64> undef, <2 x i32> zeroinitializer
1191 ! LLVMIR: store <2 x i64> %[[y]], ptr %{{[0-9]}}, align 16
1192 end subroutine vec_splat_testu64i8
1194 ! CHECK-LABEL: vec_splat_testu64i16
1195 subroutine vec_splat_testu64i16(x
)
1196 vector(unsigned(8)) :: x
, y
1197 y
= vec_splat(x
, 0_2)
1198 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<2:ui64>>
1199 ! FIR: %[[idx:.*]] = arith.constant 0 : i16
1200 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<2:ui64>) -> vector<2xi64>
1201 ! FIR: %[[c:.*]] = arith.constant 2 : i16
1202 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i16
1203 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i16] : vector<2xi64>
1204 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<2xi64>
1205 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<2xi64>) -> !fir.vector<2:ui64>
1206 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<2:ui64>>
1208 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<2xi64>>
1209 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i16) : i16
1210 ! MLIR: %[[c:.*]] = llvm.mlir.constant(2 : i16) : i16
1211 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i16
1212 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i16] : vector<2xi64>
1213 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<2xi64>
1214 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
1215 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<2xi64>
1216 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0] : vector<2xi64>
1217 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<2xi64>>
1219 ! LLVMIR: %[[x:.*]] = load <2 x i64>, ptr %{{[0-9]}}, align 16
1220 ! LLVMIR: %[[ele:.*]] = extractelement <2 x i64> %[[x]], i16 0
1221 ! LLVMIR: %[[ins:.*]] = insertelement <2 x i64> undef, i64 %[[ele]], i32 0
1222 ! LLVMIR: %[[y:.*]] = shufflevector <2 x i64> %[[ins]], <2 x i64> undef, <2 x i32> zeroinitializer
1223 ! LLVMIR: store <2 x i64> %[[y]], ptr %{{[0-9]}}, align 16
1224 end subroutine vec_splat_testu64i16
1226 ! CHECK-LABEL: vec_splat_testu64i32
1227 subroutine vec_splat_testu64i32(x
)
1228 vector(unsigned(8)) :: x
, y
1229 y
= vec_splat(x
, 0_4)
1230 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<2:ui64>>
1231 ! FIR: %[[idx:.*]] = arith.constant 0 : i32
1232 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<2:ui64>) -> vector<2xi64>
1233 ! FIR: %[[c:.*]] = arith.constant 2 : i32
1234 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i32
1235 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i32] : vector<2xi64>
1236 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<2xi64>
1237 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<2xi64>) -> !fir.vector<2:ui64>
1238 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<2:ui64>>
1240 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<2xi64>>
1241 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i32) : i32
1242 ! MLIR: %[[c:.*]] = llvm.mlir.constant(2 : i32) : i32
1243 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i32
1244 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i32] : vector<2xi64>
1245 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<2xi64>
1246 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
1247 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<2xi64>
1248 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0] : vector<2xi64>
1249 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<2xi64>>
1251 ! LLVMIR: %[[x:.*]] = load <2 x i64>, ptr %{{[0-9]}}, align 16
1252 ! LLVMIR: %[[ele:.*]] = extractelement <2 x i64> %[[x]], i32 0
1253 ! LLVMIR: %[[ins:.*]] = insertelement <2 x i64> undef, i64 %[[ele]], i32 0
1254 ! LLVMIR: %[[y:.*]] = shufflevector <2 x i64> %[[ins]], <2 x i64> undef, <2 x i32> zeroinitializer
1255 ! LLVMIR: store <2 x i64> %[[y]], ptr %{{[0-9]}}, align 16
1256 end subroutine vec_splat_testu64i32
1258 ! CHECK-LABEL: vec_splat_testu64i64
1259 subroutine vec_splat_testu64i64(x
)
1260 vector(unsigned(8)) :: x
, y
1261 y
= vec_splat(x
, 0_8)
1262 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<!fir.vector<2:ui64>>
1263 ! FIR: %[[idx:.*]] = arith.constant 0 : i64
1264 ! FIR: %[[vx:.*]] = fir.convert %[[x]] : (!fir.vector<2:ui64>) -> vector<2xi64>
1265 ! FIR: %[[c:.*]] = arith.constant 2 : i64
1266 ! FIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i64
1267 ! FIR: %[[ele:.*]] = vector.extractelement %[[vx]][%[[u]] : i64] : vector<2xi64>
1268 ! FIR: %[[vy:.*]] = vector.splat %[[ele]] : vector<2xi64>
1269 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<2xi64>) -> !fir.vector<2:ui64>
1270 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<2:ui64>>
1272 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<vector<2xi64>>
1273 ! MLIR: %[[idx:.*]] = llvm.mlir.constant(0 : i64) : i64
1274 ! MLIR: %[[c:.*]] = llvm.mlir.constant(2 : i64) : i64
1275 ! MLIR: %[[u:.*]] = llvm.urem %[[idx]], %[[c]] : i64
1276 ! MLIR: %[[ele:.*]] = llvm.extractelement %[[x]][%[[u]] : i64] : vector<2xi64>
1277 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<2xi64>
1278 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
1279 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[ele]], %[[undef]][%[[zero]] : i32] : vector<2xi64>
1280 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0] : vector<2xi64>
1281 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<2xi64>>
1283 ! LLVMIR: %[[x:.*]] = load <2 x i64>, ptr %{{[0-9]}}, align 16
1284 ! LLVMIR: %[[ele:.*]] = extractelement <2 x i64> %[[x]], i64 0
1285 ! LLVMIR: %[[ins:.*]] = insertelement <2 x i64> undef, i64 %[[ele]], i32 0
1286 ! LLVMIR: %[[y:.*]] = shufflevector <2 x i64> %[[ins]], <2 x i64> undef, <2 x i32> zeroinitializer
1287 ! LLVMIR: store <2 x i64> %[[y]], ptr %{{[0-9]}}, align 16
1288 end subroutine vec_splat_testu64i64
1294 ! CHECK-LABEL: vec_splats_testi8
1295 subroutine vec_splats_testi8(x
)
1297 vector(integer(1)) :: y
1299 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<i8>
1300 ! FIR: %[[vy:.*]] = vector.splat %[[x]] : vector<16xi8>
1301 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<16xi8>) -> !fir.vector<16:i8>
1302 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<16:i8>>
1304 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<i8>
1305 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<16xi8>
1306 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
1307 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[x]], %[[undef]][%[[zero]] : i32] : vector<16xi8>
1308 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] : vector<16xi8>
1309 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<16xi8>>
1311 ! LLVMIR: %[[x:.*]] = load i8, ptr %{{[0-9]}}, align 1
1312 ! LLVMIR: %[[ins:.*]] = insertelement <16 x i8> undef, i8 %[[x]], i32 0
1313 ! LLVMIR: %[[y:.*]] = shufflevector <16 x i8> %[[ins]], <16 x i8> undef, <16 x i32> zeroinitializer
1314 ! LLVMIR: store <16 x i8> %[[y]], ptr %{{[0-9]}}, align 16
1315 end subroutine vec_splats_testi8
1317 ! CHECK-LABEL: vec_splats_testi16
1318 subroutine vec_splats_testi16(x
)
1320 vector(integer(2)) :: y
1322 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<i16>
1323 ! FIR: %[[vy:.*]] = vector.splat %[[x]] : vector<8xi16>
1324 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<8xi16>) -> !fir.vector<8:i16>
1325 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<8:i16>>
1327 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<i16>
1328 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<8xi16>
1329 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
1330 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[x]], %[[undef]][%[[zero]] : i32] : vector<8xi16>
1331 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0, 0, 0, 0, 0] : vector<8xi16>
1332 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<8xi16>>
1334 ! LLVMIR: %[[x:.*]] = load i16, ptr %{{[0-9]}}, align 2
1335 ! LLVMIR: %[[ins:.*]] = insertelement <8 x i16> undef, i16 %[[x]], i32 0
1336 ! LLVMIR: %[[y:.*]] = shufflevector <8 x i16> %[[ins]], <8 x i16> undef, <8 x i32> zeroinitializer
1337 ! LLVMIR: store <8 x i16> %[[y]], ptr %{{[0-9]}}, align 16
1338 end subroutine vec_splats_testi16
1340 ! CHECK-LABEL: vec_splats_testi32
1341 subroutine vec_splats_testi32(x
)
1343 vector(integer(4)) :: y
1345 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<i32>
1346 ! FIR: %[[vy:.*]] = vector.splat %[[x]] : vector<4xi32>
1347 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<4xi32>) -> !fir.vector<4:i32>
1348 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<4:i32>>
1350 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<i32>
1351 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<4xi32>
1352 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
1353 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[x]], %[[undef]][%[[zero]] : i32] : vector<4xi32>
1354 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0] : vector<4xi32>
1355 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<4xi32>>
1357 ! LLVMIR: %[[x:.*]] = load i32, ptr %{{[0-9]}}, align 4
1358 ! LLVMIR: %[[ins:.*]] = insertelement <4 x i32> undef, i32 %[[x]], i32 0
1359 ! LLVMIR: %[[y:.*]] = shufflevector <4 x i32> %[[ins]], <4 x i32> undef, <4 x i32> zeroinitializer
1360 ! LLVMIR: store <4 x i32> %[[y]], ptr %{{[0-9]}}, align 16
1361 end subroutine vec_splats_testi32
1363 ! CHECK-LABEL: vec_splats_testi64
1364 subroutine vec_splats_testi64(x
)
1366 vector(integer(8)) :: y
1368 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<i64>
1369 ! FIR: %[[vy:.*]] = vector.splat %[[x]] : vector<2xi64>
1370 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<2xi64>) -> !fir.vector<2:i64>
1371 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<2:i64>>
1373 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<i64>
1374 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<2xi64>
1375 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
1376 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[x]], %[[undef]][%[[zero]] : i32] : vector<2xi64>
1377 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0] : vector<2xi64>
1378 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<2xi64>>
1380 ! LLVMIR: %[[x:.*]] = load i64, ptr %{{[0-9]}}, align 8
1381 ! LLVMIR: %[[ins:.*]] = insertelement <2 x i64> undef, i64 %[[x]], i32 0
1382 ! LLVMIR: %[[y:.*]] = shufflevector <2 x i64> %[[ins]], <2 x i64> undef, <2 x i32> zeroinitializer
1383 ! LLVMIR: store <2 x i64> %[[y]], ptr %{{[0-9]}}, align 16
1384 end subroutine vec_splats_testi64
1386 ! CHECK-LABEL: vec_splats_testf32
1387 subroutine vec_splats_testf32(x
)
1389 vector(real(4)) :: y
1391 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<f32>
1392 ! FIR: %[[vy:.*]] = vector.splat %[[x]] : vector<4xf32>
1393 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<4xf32>) -> !fir.vector<4:f32>
1394 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<4:f32>>
1396 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<f32>
1397 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<4xf32>
1398 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
1399 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[x]], %[[undef]][%[[zero]] : i32] : vector<4xf32>
1400 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0, 0, 0] : vector<4xf32>
1401 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<4xf32>>
1403 ! LLVMIR: %[[x:.*]] = load float, ptr %{{[0-9]}}, align 4
1404 ! LLVMIR: %[[ins:.*]] = insertelement <4 x float> undef, float %[[x]], i32 0
1405 ! LLVMIR: %[[y:.*]] = shufflevector <4 x float> %[[ins]], <4 x float> undef, <4 x i32> zeroinitializer
1406 ! LLVMIR: store <4 x float> %[[y]], ptr %{{[0-9]}}, align 16
1407 end subroutine vec_splats_testf32
1409 ! CHECK-LABEL: vec_splats_testf64
1410 subroutine vec_splats_testf64(x
)
1412 vector(real(8)) :: y
1414 ! FIR: %[[x:.*]] = fir.load %arg0 : !fir.ref<f64>
1415 ! FIR: %[[vy:.*]] = vector.splat %[[x]] : vector<2xf64>
1416 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<2xf64>) -> !fir.vector<2:f64>
1417 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<2:f64>>
1419 ! MLIR: %[[x:.*]] = llvm.load %arg0 : !llvm.ptr<f64>
1420 ! MLIR: %[[undef:.*]] = llvm.mlir.undef : vector<2xf64>
1421 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
1422 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[x]], %[[undef]][%[[zero]] : i32] : vector<2xf64>
1423 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[undef]] [0, 0] : vector<2xf64>
1424 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<2xf64>>
1426 ! LLVMIR: %[[x:.*]] = load double, ptr %{{[0-9]}}, align 8
1427 ! LLVMIR: %[[ins:.*]] = insertelement <2 x double> undef, double %[[x]], i32 0
1428 ! LLVMIR: %[[y:.*]] = shufflevector <2 x double> %[[ins]], <2 x double> undef, <2 x i32> zeroinitializer
1429 ! LLVMIR: store <2 x double> %[[y]], ptr %{{[0-9]}}, align 16
1430 end subroutine vec_splats_testf64
1432 ! CHECK-LABEL: vec_splat_s32testi8
1433 subroutine vec_splat_s32testi8()
1434 vector(integer(4)) :: y
1435 y
= vec_splat_s32(7_1)
1436 ! FIR: %[[val:.*]] = arith.constant 7 : i8
1437 ! FIR: %[[cval:.*]] = fir.convert %[[val]] : (i8) -> i32
1438 ! FIR: %[[vy:.*]] = vector.splat %[[cval]] : vector<4xi32>
1439 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<4xi32>) -> !fir.vector<4:i32>
1440 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<4:i32>>
1442 ! MLIR: %[[val:.*]] = llvm.mlir.constant(7 : i8) : i8
1443 ! MLIR: %[[cval:.*]] = llvm.sext %[[val]] : i8 to i32
1444 ! MLIR: %[[und:.*]] = llvm.mlir.undef : vector<4xi32>
1445 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
1446 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[cval]], %[[und]][%[[zero]] : i32] : vector<4xi32>
1447 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[und]] [0, 0, 0, 0] : vector<4xi32>
1448 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<4xi32>>
1450 ! LLVMIR: store <4 x i32> <i32 7, i32 7, i32 7, i32 7>, ptr %{{[0-9]}}, align 16
1451 end subroutine vec_splat_s32testi8
1453 ! CHECK-LABEL: vec_splat_s32testi16
1454 subroutine vec_splat_s32testi16()
1455 vector(integer(4)) :: y
1456 y
= vec_splat_s32(7_2)
1457 ! FIR: %[[val:.*]] = arith.constant 7 : i16
1458 ! FIR: %[[cval:.*]] = fir.convert %[[val]] : (i16) -> i32
1459 ! FIR: %[[vy:.*]] = vector.splat %[[cval]] : vector<4xi32>
1460 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<4xi32>) -> !fir.vector<4:i32>
1461 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<4:i32>>
1463 ! MLIR: %[[val:.*]] = llvm.mlir.constant(7 : i16) : i16
1464 ! MLIR: %[[cval:.*]] = llvm.sext %[[val]] : i16 to i32
1465 ! MLIR: %[[und:.*]] = llvm.mlir.undef : vector<4xi32>
1466 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
1467 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[cval]], %[[und]][%[[zero]] : i32] : vector<4xi32>
1468 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[und]] [0, 0, 0, 0] : vector<4xi32>
1469 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<4xi32>>
1471 ! LLVMIR: store <4 x i32> <i32 7, i32 7, i32 7, i32 7>, ptr %{{[0-9]}}, align 16
1472 end subroutine vec_splat_s32testi16
1474 ! CHECK-LABEL: vec_splat_s32testi32
1475 subroutine vec_splat_s32testi32()
1476 vector(integer(4)) :: y
1477 y
= vec_splat_s32(7_4)
1478 ! FIR: %[[val:.*]] = arith.constant 7 : i32
1479 ! FIR: %[[vy:.*]] = vector.splat %[[val]] : vector<4xi32>
1480 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<4xi32>) -> !fir.vector<4:i32>
1481 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<4:i32>>
1483 ! MLIR: %[[val:.*]] = llvm.mlir.constant(7 : i32) : i32
1484 ! MLIR: %[[y:.*]] = llvm.mlir.constant(dense<7> : vector<4xi32>) : vector<4xi32>
1485 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<4xi32>>
1487 ! LLVMIR: store <4 x i32> <i32 7, i32 7, i32 7, i32 7>, ptr %{{[0-9]}}, align 16
1488 end subroutine vec_splat_s32testi32
1490 ! CHECK-LABEL: vec_splat_s32testi64
1491 subroutine vec_splat_s32testi64()
1492 vector(integer(4)) :: y
1493 y
= vec_splat_s32(7_8)
1494 ! FIR: %[[val:.*]] = arith.constant 7 : i64
1495 ! FIR: %[[cval:.*]] = fir.convert %[[val]] : (i64) -> i32
1496 ! FIR: %[[vy:.*]] = vector.splat %[[cval]] : vector<4xi32>
1497 ! FIR: %[[y:.*]] = fir.convert %[[vy]] : (vector<4xi32>) -> !fir.vector<4:i32>
1498 ! FIR: fir.store %[[y]] to %{{[0-9]}} : !fir.ref<!fir.vector<4:i32>>
1500 ! MLIR: %[[val:.*]] = llvm.mlir.constant(7 : i64) : i64
1501 ! MLIR: %[[cval:.*]] = llvm.trunc %[[val]] : i64 to i32
1502 ! MLIR: %[[und:.*]] = llvm.mlir.undef : vector<4xi32>
1503 ! MLIR: %[[zero:.*]] = llvm.mlir.constant(0 : i32) : i32
1504 ! MLIR: %[[ins:.*]] = llvm.insertelement %[[cval]], %[[und]][%[[zero]] : i32] : vector<4xi32>
1505 ! MLIR: %[[y:.*]] = llvm.shufflevector %[[ins]], %[[und]] [0, 0, 0, 0] : vector<4xi32>
1506 ! MLIR: llvm.store %[[y]], %{{[0-9]}} : !llvm.ptr<vector<4xi32>>
1508 ! LLVMIR: store <4 x i32> <i32 7, i32 7, i32 7, i32 7>, ptr %{{[0-9]}}, align 16
1509 end subroutine vec_splat_s32testi64