@@ -337,6 +337,63 @@ void foo7() {
337
337
// OGCG: %[[NEW_VEC:.*]] = insertelement <4 x i32> %[[TMP2]], i32 %[[RES]], i32 2
338
338
// OGCG: store <4 x i32> %[[NEW_VEC]], ptr %[[VEC]], align 16
339
339
340
+
341
+ void foo8 () {
342
+ vi4 a = { 1 , 2 , 3 , 4 };
343
+ vi4 plus_res = +a;
344
+ vi4 minus_res = -a;
345
+ vi4 not_res = ~a;
346
+ }
347
+
348
+ // CIR: %[[VEC:.*]] = cir.alloca !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>>, ["a", init]
349
+ // CIR: %[[PLUS_RES:.*]] = cir.alloca !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>>, ["plus_res", init]
350
+ // CIR: %[[MINUS_RES:.*]] = cir.alloca !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>>, ["minus_res", init]
351
+ // CIR: %[[NOT_RES:.*]] = cir.alloca !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>>, ["not_res", init]
352
+ // CIR: %[[CONST_1:.*]] = cir.const #cir.int<1> : !s32i
353
+ // CIR: %[[CONST_2:.*]] = cir.const #cir.int<2> : !s32i
354
+ // CIR: %[[CONST_3:.*]] = cir.const #cir.int<3> : !s32i
355
+ // CIR: %[[CONST_4:.*]] = cir.const #cir.int<4> : !s32i
356
+ // CIR: %[[VEC_VAL:.*]] = cir.vec.create(%[[CONST_1]], %[[CONST_2]], %[[CONST_3]], %[[CONST_4]] :
357
+ // CIR-SAME: !s32i, !s32i, !s32i, !s32i) : !cir.vector<4 x !s32i>
358
+ // CIR: cir.store %[[VEC_VAL]], %[[VEC]] : !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>>
359
+ // CIR: %[[TMP1:.*]] = cir.load %[[VEC]] : !cir.ptr<!cir.vector<4 x !s32i>>, !cir.vector<4 x !s32i>
360
+ // CIR: %[[PLUS:.*]] = cir.unary(plus, %[[TMP1]]) : !cir.vector<4 x !s32i>, !cir.vector<4 x !s32i>
361
+ // CIR: cir.store %[[PLUS]], %[[PLUS_RES]] : !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>>
362
+ // CIR: %[[TMP2:.*]] = cir.load %[[VEC]] : !cir.ptr<!cir.vector<4 x !s32i>>, !cir.vector<4 x !s32i>
363
+ // CIR: %[[MINUS:.*]] = cir.unary(minus, %[[TMP2]]) : !cir.vector<4 x !s32i>, !cir.vector<4 x !s32i>
364
+ // CIR: cir.store %[[MINUS]], %[[MINUS_RES]] : !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>>
365
+ // CIR: %[[TMP3:.*]] = cir.load %[[VEC]] : !cir.ptr<!cir.vector<4 x !s32i>>, !cir.vector<4 x !s32i>
366
+ // CIR: %[[NOT:.*]] = cir.unary(not, %[[TMP3]]) : !cir.vector<4 x !s32i>, !cir.vector<4 x !s32i>
367
+ // CIR: cir.store %[[NOT]], %[[NOT_RES]] : !cir.vector<4 x !s32i>, !cir.ptr<!cir.vector<4 x !s32i>>
368
+
369
+ // LLVM: %[[VEC:.*]] = alloca <4 x i32>, i64 1, align 16
370
+ // LLVM: %[[PLUS_RES:.*]] = alloca <4 x i32>, i64 1, align 16
371
+ // LLVM: %[[MINUS_RES:.*]] = alloca <4 x i32>, i64 1, align 16
372
+ // LLVM: %[[NOT_RES:.*]] = alloca <4 x i32>, i64 1, align 16
373
+ // LLVM: store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, ptr %[[VEC]], align 16
374
+ // LLVM: %[[TMP1:.*]] = load <4 x i32>, ptr %[[VEC]], align 16
375
+ // LLVM: store <4 x i32> %[[TMP1]], ptr %[[PLUS_RES]], align 16
376
+ // LLVM: %[[TMP2:.*]] = load <4 x i32>, ptr %[[VEC]], align 16
377
+ // LLVM: %[[SUB:.*]] = sub <4 x i32> zeroinitializer, %[[TMP2]]
378
+ // LLVM: store <4 x i32> %[[SUB]], ptr %[[MINUS_RES]], align 16
379
+ // LLVM: %[[TMP3:.*]] = load <4 x i32>, ptr %[[VEC]], align 16
380
+ // LLVM: %[[NOT:.*]] = xor <4 x i32> %[[TMP3]], splat (i32 -1)
381
+ // LLVM: store <4 x i32> %[[NOT]], ptr %[[NOT_RES]], align 16
382
+
383
+ // OGCG: %[[VEC:.*]] = alloca <4 x i32>, align 16
384
+ // OGCG: %[[PLUS_RES:.*]] = alloca <4 x i32>, align 16
385
+ // OGCG: %[[MINUS_RES:.*]] = alloca <4 x i32>, align 16
386
+ // OGCG: %[[NOT_RES:.*]] = alloca <4 x i32>, align 16
387
+ // OGCG: store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, ptr %[[VEC]], align 16
388
+ // OGCG: %[[TMP1:.*]] = load <4 x i32>, ptr %[[VEC]], align 16
389
+ // OGCG: store <4 x i32> %[[TMP1]], ptr %[[PLUS_RES]], align 16
390
+ // OGCG: %[[TMP2:.*]] = load <4 x i32>, ptr %[[VEC]], align 16
391
+ // OGCG: %[[SUB:.*]] = sub <4 x i32> zeroinitializer, %[[TMP2]]
392
+ // OGCG: store <4 x i32> %[[SUB]], ptr %[[MINUS_RES]], align 16
393
+ // OGCG: %[[TMP3:.*]] = load <4 x i32>, ptr %[[VEC]], align 16
394
+ // OGCG: %[[NOT:.*]] = xor <4 x i32> %[[TMP3]], splat (i32 -1)
395
+ // OGCG: store <4 x i32> %[[NOT]], ptr %[[NOT_RES]], align 16
396
+
340
397
void foo9 () {
341
398
vi4 a = {1 , 2 , 3 , 4 };
342
399
vi4 b = {5 , 6 , 7 , 8 };
0 commit comments