@@ -1223,3 +1223,66 @@ void foo20() {
1223
1223
// OGCG: %[[TMP_A:.*]] = load <4 x i32>, ptr %[[VEC_A]], align 16
1224
1224
// OGCG: %[[TMP_B:.*]] = load <4 x i32>, ptr %[[VEC_B]], align 16
1225
1225
// OGCG: %[[SHUF:.*]] = shufflevector <4 x i32> %[[TMP_A]], <4 x i32> %[[TMP_B]], <4 x i32> <i32 poison, i32 1, i32 poison, i32 1>
1226
+
1227
+ void foo21 () {
1228
+ vi4 a = {1 , 2 , 3 , 4 };
1229
+ vi4 shl = a << 3 ;
1230
+
1231
+ uvi4 b = {1u , 2u , 3u , 4u };
1232
+ uvi4 shr = b >> 3u ;
1233
+ }
1234
+
1235
+ // CIR: %[[VEC_A:.*]] = cir.alloca !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>>, ["a", init]
1236
+ // CIR: %[[SHL_RES:.*]] = cir.alloca !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>>, ["shl", init]
1237
+ // CIR: %[[VEC_B:.*]] = cir.alloca !cir.vector<4 x !u32i>, !cir.ptr<!cir.vector<4 x !u32i>>, ["b", init]
1238
+ // CIR: %[[SHR_RES:.*]] = cir.alloca !cir.vector<4 x !u32i>, !cir.ptr<!cir.vector<4 x !u32i>>, ["shr", init]
1239
+ // CIR: %[[CONST_1:.*]] = cir.const #cir.int<1> : !s32i
1240
+ // CIR: %[[CONST_2:.*]] = cir.const #cir.int<2> : !s32i
1241
+ // CIR: %[[CONST_3:.*]] = cir.const #cir.int<3> : !s32i
1242
+ // CIR: %[[CONST_4:.*]] = cir.const #cir.int<4> : !s32i
1243
+ // CIR: %[[VEC_A_VAL:.*]] = cir.vec.create(%[[CONST_1]], %[[CONST_2]], %[[CONST_3]], %[[CONST_4]] :
1244
+ // CIR-SAME: !s32i, !s32i, !s32i, !s32i) : !cir.vector<4 x !s32i>
1245
+ // CIR: cir.store{{.*}} %[[VEC_A_VAL]], %[[VEC_A]] : !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>>
1246
+ // CIR: %[[TMP_A:.*]] = cir.load{{.*}} %[[VEC_A]] : !cir.ptr<!cir.vector<4 x !s32i>>, !cir.vector<4 x !s32i>
1247
+ // CIR: %[[SPLAT_VEC:.*]] = cir.const #cir.const_vector<[#cir.int<3> : !s32i, #cir.int<3> :
1248
+ // CIR-SAME: !s32i, #cir.int<3> : !s32i, #cir.int<3> : !s32i]> : !cir.vector<4 x !s32i>
1249
+ // CIR: %[[SHL:.*]] = cir.shift(left, %[[TMP_A]] : !cir.vector<4 x !s32i>, %[[SPLAT_VEC]] : !cir.vector<4 x !s32i>) -> !cir.vector<4 x !s32i>
1250
+ // CIR: cir.store{{.*}} %[[SHL]], %[[SHL_RES]] : !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>>
1251
+ // CIR: %[[CONST_1:.*]] = cir.const #cir.int<1> : !u32i
1252
+ // CIR: %[[CONST_2:.*]] = cir.const #cir.int<2> : !u32i
1253
+ // CIR: %[[CONST_3:.*]] = cir.const #cir.int<3> : !u32i
1254
+ // CIR: %[[CONST_4:.*]] = cir.const #cir.int<4> : !u32i
1255
+ // CIR: %[[VEC_B_VAL:.*]] = cir.vec.create(%[[CONST_1]], %[[CONST_2]], %[[CONST_3]], %[[CONST_4]] :
1256
+ // CIR-SAME: !u32i, !u32i, !u32i, !u32i) : !cir.vector<4 x !u32i>
1257
+ // CIR: cir.store{{.*}} %[[VEC_B_VAL]], %[[VEC_B]] : !cir.vector<4 x !u32i>, !cir.ptr<!cir.vector<4 x !u32i>>
1258
+ // CIR: %[[TMP_B:.*]] = cir.load{{.*}} %[[VEC_B]] : !cir.ptr<!cir.vector<4 x !u32i>>, !cir.vector<4 x !u32i>
1259
+ // CIR: %[[SPLAT_VEC:.*]] = cir.const #cir.const_vector<[#cir.int<3> : !u32i, #cir.int<3> : !u32i,
1260
+ // CIR-SAME: #cir.int<3> : !u32i, #cir.int<3> : !u32i]> : !cir.vector<4 x !u32i>
1261
+ // CIR: %[[SHR:.*]] = cir.shift(right, %[[TMP_B]] : !cir.vector<4 x !u32i>, %[[SPLAT_VEC]] : !cir.vector<4 x !u32i>) -> !cir.vector<4 x !u32i>
1262
+ // CIR: cir.store{{.*}} %[[SHR]], %[[SHR_RES]] : !cir.vector<4 x !u32i>, !cir.ptr<!cir.vector<4 x !u32i>>
1263
+
1264
+ // LLVM: %[[VEC_A:.*]] = alloca <4 x i32>, i64 1, align 16
1265
+ // LLVM: %[[SHL_RES:.*]] = alloca <4 x i32>, i64 1, align 16
1266
+ // LLVM: %[[VEC_B:.*]] = alloca <4 x i32>, i64 1, align 16
1267
+ // LLVM: %[[SHR_RES:.*]] = alloca <4 x i32>, i64 1, align 16
1268
+ // LLVM: store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, ptr %[[VEC_A]], align 16
1269
+ // LLVM: %[[TMP_A:.*]] = load <4 x i32>, ptr %[[VEC_A]], align 16
1270
+ // LLVM: %[[SHL:.*]] = shl <4 x i32> %[[TMP_A]], splat (i32 3)
1271
+ // LLVM: store <4 x i32> %[[SHL]], ptr %[[SHL_RES]], align 16
1272
+ // LLVM: store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, ptr %[[VEC_B]], align 16
1273
+ // LLVM: %[[TMP_B:.*]] = load <4 x i32>, ptr %[[VEC_B]], align 16
1274
+ // LLVM: %[[SHR:.*]] = lshr <4 x i32> %[[TMP_B]], splat (i32 3)
1275
+ // LLVM: store <4 x i32> %[[SHR]], ptr %[[SHR_RES]], align 16
1276
+
1277
+ // OGCG: %[[VEC_A:.*]] = alloca <4 x i32>, align 16
1278
+ // OGCG: %[[SHL_RES:.*]] = alloca <4 x i32>, align 16
1279
+ // OGCG: %[[VEC_B:.*]] = alloca <4 x i32>, align 16
1280
+ // OGCG: %[[SHR_RES:.*]] = alloca <4 x i32>, align 16
1281
+ // OGCG: store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, ptr %[[VEC_A]], align 16
1282
+ // OGCG: %[[TMP_A:.*]] = load <4 x i32>, ptr %[[VEC_A]], align 16
1283
+ // OGCG: %[[SHL:.*]] = shl <4 x i32> %[[TMP_A]], splat (i32 3)
1284
+ // OGCG: store <4 x i32> %[[SHL]], ptr %[[SHL_RES]], align 16
1285
+ // OGCG: store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, ptr %[[VEC_B]], align 16
1286
+ // OGCG: %[[TMP_B:.*]] = load <4 x i32>, ptr %[[VEC_B]], align 16
1287
+ // OGCG: %[[SHR:.*]] = lshr <4 x i32> %[[TMP_B]], splat (i32 3)
1288
+ // OGCG: store <4 x i32> %[[SHR]], ptr %[[SHR_RES]], align 16
0 commit comments