1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+v -verify-machineinstrs < %s | FileCheck %s
3 ; RUN: llc -mtriple=riscv64 -mattr=+v -verify-machineinstrs < %s | FileCheck %s
5 declare <2 x i1> @llvm.vp.trunc.v2i1.v2i16(<2 x i16>, <2 x i1>, i32)
7 define <2 x i1> @vtrunc_v2i1_v2i16(<2 x i16> %a, <2 x i1> %m, i32 zeroext %vl) {
8 ; CHECK-LABEL: vtrunc_v2i1_v2i16:
10 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
11 ; CHECK-NEXT: vand.vi v8, v8, 1, v0.t
12 ; CHECK-NEXT: vmsne.vi v0, v8, 0, v0.t
14 %v = call <2 x i1> @llvm.vp.trunc.v2i1.v2i16(<2 x i16> %a, <2 x i1> %m, i32 %vl)
18 define <2 x i1> @vtrunc_v2i1_v2i16_unmasked(<2 x i16> %a, i32 zeroext %vl) {
19 ; CHECK-LABEL: vtrunc_v2i1_v2i16_unmasked:
21 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
22 ; CHECK-NEXT: vand.vi v8, v8, 1
23 ; CHECK-NEXT: vmsne.vi v0, v8, 0
25 %v = call <2 x i1> @llvm.vp.trunc.v2i1.v2i16(<2 x i16> %a, <2 x i1> <i1 true, i1 true>, i32 %vl)
29 declare <2 x i1> @llvm.vp.trunc.v2i1.v2i32(<2 x i32>, <2 x i1>, i32)
31 define <2 x i1> @vtrunc_v2i1_v2i32(<2 x i32> %a, <2 x i1> %m, i32 zeroext %vl) {
32 ; CHECK-LABEL: vtrunc_v2i1_v2i32:
34 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
35 ; CHECK-NEXT: vand.vi v8, v8, 1, v0.t
36 ; CHECK-NEXT: vmsne.vi v0, v8, 0, v0.t
38 %v = call <2 x i1> @llvm.vp.trunc.v2i1.v2i32(<2 x i32> %a, <2 x i1> %m, i32 %vl)
42 define <2 x i1> @vtrunc_v2i1_v2i32_unmasked(<2 x i32> %a, i32 zeroext %vl) {
43 ; CHECK-LABEL: vtrunc_v2i1_v2i32_unmasked:
45 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
46 ; CHECK-NEXT: vand.vi v8, v8, 1
47 ; CHECK-NEXT: vmsne.vi v0, v8, 0
49 %v = call <2 x i1> @llvm.vp.trunc.v2i1.v2i32(<2 x i32> %a, <2 x i1> <i1 true, i1 true>, i32 %vl)
53 declare <2 x i1> @llvm.vp.trunc.v2i1.v2i64(<2 x i64>, <2 x i1>, i32)
55 define <2 x i1> @vtrunc_v2i1_v2i64(<2 x i64> %a, <2 x i1> %m, i32 zeroext %vl) {
56 ; CHECK-LABEL: vtrunc_v2i1_v2i64:
58 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
59 ; CHECK-NEXT: vand.vi v8, v8, 1, v0.t
60 ; CHECK-NEXT: vmsne.vi v0, v8, 0, v0.t
62 %v = call <2 x i1> @llvm.vp.trunc.v2i1.v2i64(<2 x i64> %a, <2 x i1> %m, i32 %vl)
66 define <2 x i1> @vtrunc_v2i1_v2i64_unmasked(<2 x i64> %a, i32 zeroext %vl) {
67 ; CHECK-LABEL: vtrunc_v2i1_v2i64_unmasked:
69 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
70 ; CHECK-NEXT: vand.vi v8, v8, 1
71 ; CHECK-NEXT: vmsne.vi v0, v8, 0
73 %v = call <2 x i1> @llvm.vp.trunc.v2i1.v2i64(<2 x i64> %a, <2 x i1> <i1 true, i1 true>, i32 %vl)