1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
2 ; RUN: llc -mtriple=riscv32 -mattr=+v -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK
3 ; RUN: llc -mtriple=riscv64 -mattr=+v -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK
5 define <8 x i64> @vwsub_wv_mask_v8i32(<8 x i32> %x, <8 x i64> %y) {
6 ; CHECK-LABEL: vwsub_wv_mask_v8i32:
8 ; CHECK-NEXT: li a0, 42
9 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
10 ; CHECK-NEXT: vmslt.vx v0, v8, a0
11 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, tu, mu
12 ; CHECK-NEXT: vwsub.wv v12, v12, v8, v0.t
13 ; CHECK-NEXT: vmv4r.v v8, v12
15 %mask = icmp slt <8 x i32> %x, <i32 42, i32 42, i32 42, i32 42, i32 42, i32 42, i32 42, i32 42>
16 %a = select <8 x i1> %mask, <8 x i32> %x, <8 x i32> zeroinitializer
17 %sa = sext <8 x i32> %a to <8 x i64>
18 %ret = sub <8 x i64> %y, %sa
22 define <8 x i64> @vwsubu_wv_mask_v8i32(<8 x i32> %x, <8 x i64> %y) {
23 ; CHECK-LABEL: vwsubu_wv_mask_v8i32:
25 ; CHECK-NEXT: li a0, 42
26 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
27 ; CHECK-NEXT: vmslt.vx v0, v8, a0
28 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, tu, mu
29 ; CHECK-NEXT: vwsubu.wv v12, v12, v8, v0.t
30 ; CHECK-NEXT: vmv4r.v v8, v12
32 %mask = icmp slt <8 x i32> %x, <i32 42, i32 42, i32 42, i32 42, i32 42, i32 42, i32 42, i32 42>
33 %a = select <8 x i1> %mask, <8 x i32> %x, <8 x i32> zeroinitializer
34 %sa = zext <8 x i32> %a to <8 x i64>
35 %ret = sub <8 x i64> %y, %sa
39 define <8 x i64> @vwsubu_vv_mask_v8i32(<8 x i32> %x, <8 x i32> %y) {
40 ; CHECK-LABEL: vwsubu_vv_mask_v8i32:
42 ; CHECK-NEXT: li a0, 42
43 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
44 ; CHECK-NEXT: vmslt.vx v0, v8, a0
45 ; CHECK-NEXT: vmv.v.i v12, 0
46 ; CHECK-NEXT: vmerge.vvm v8, v12, v8, v0
47 ; CHECK-NEXT: vwsubu.vv v12, v10, v8
48 ; CHECK-NEXT: vmv4r.v v8, v12
50 %mask = icmp slt <8 x i32> %x, <i32 42, i32 42, i32 42, i32 42, i32 42, i32 42, i32 42, i32 42>
51 %a = select <8 x i1> %mask, <8 x i32> %x, <8 x i32> zeroinitializer
52 %sa = zext <8 x i32> %a to <8 x i64>
53 %sy = zext <8 x i32> %y to <8 x i64>
54 %ret = sub <8 x i64> %sy, %sa
58 define <8 x i64> @vwsub_wv_mask_v8i32_nonzero(<8 x i32> %x, <8 x i64> %y) {
59 ; CHECK-LABEL: vwsub_wv_mask_v8i32_nonzero:
61 ; CHECK-NEXT: li a0, 42
62 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
63 ; CHECK-NEXT: vmslt.vx v0, v8, a0
64 ; CHECK-NEXT: vmv.v.i v10, 1
65 ; CHECK-NEXT: vmerge.vvm v16, v10, v8, v0
66 ; CHECK-NEXT: vwsub.wv v8, v12, v16
68 %mask = icmp slt <8 x i32> %x, <i32 42, i32 42, i32 42, i32 42, i32 42, i32 42, i32 42, i32 42>
69 %a = select <8 x i1> %mask, <8 x i32> %x, <8 x i32> <i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
70 %sa = sext <8 x i32> %a to <8 x i64>
71 %ret = sub <8 x i64> %y, %sa