Skip to content

Commit 131be5d

Browse files
committed
[RISCV] Add more disjoint or tests for vwadd[u].{w,v}v. NFC
1 parent 316634f commit 131be5d

File tree

1 file changed

+58
-2
lines changed

1 file changed

+58
-2
lines changed

llvm/test/CodeGen/RISCV/rvv/vwadd-sdnode.ll

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,8 +1396,8 @@ define <vscale x 1 x i64> @i1_zext(<vscale x 1 x i1> %va, <vscale x 1 x i64> %vb
13961396
; %x.i32 and %y.i32 are disjoint, so DAGCombiner will combine it into an or.
13971397
; FIXME: We should be able to recover the or into vwaddu.vv if the disjoint
13981398
; flag is set.
1399-
define <vscale x 2 x i32> @disjoint_or(<vscale x 2 x i8> %x.i8, <vscale x 2 x i8> %y.i8) {
1400-
; CHECK-LABEL: disjoint_or:
1399+
define <vscale x 2 x i32> @vwaddu_vv_disjoint_or_add(<vscale x 2 x i8> %x.i8, <vscale x 2 x i8> %y.i8) {
1400+
; CHECK-LABEL: vwaddu_vv_disjoint_or_add:
14011401
; CHECK: # %bb.0:
14021402
; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
14031403
; CHECK-NEXT: vzext.vf2 v10, v8
@@ -1414,3 +1414,59 @@ define <vscale x 2 x i32> @disjoint_or(<vscale x 2 x i8> %x.i8, <vscale x 2 x i8
14141414
%add = add <vscale x 2 x i32> %x.i32, %y.i32
14151415
ret <vscale x 2 x i32> %add
14161416
}
1417+
1418+
; TODO: We could select vwaddu.vv, but when both arms of the or are the same
1419+
; DAGCombiner::hoistLogicOpWithSameOpcodeHands moves the zext above the or.
1420+
define <vscale x 2 x i32> @vwaddu_vv_disjoint_or(<vscale x 2 x i16> %x.i16, <vscale x 2 x i16> %y.i16) {
1421+
; CHECK-LABEL: vwaddu_vv_disjoint_or:
1422+
; CHECK: # %bb.0:
1423+
; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
1424+
; CHECK-NEXT: vor.vv v9, v8, v9
1425+
; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, ma
1426+
; CHECK-NEXT: vzext.vf2 v8, v9
1427+
; CHECK-NEXT: ret
1428+
%x.i32 = zext <vscale x 2 x i16> %x.i16 to <vscale x 2 x i32>
1429+
%y.i32 = zext <vscale x 2 x i16> %y.i16 to <vscale x 2 x i32>
1430+
%or = or disjoint <vscale x 2 x i32> %x.i32, %y.i32
1431+
ret <vscale x 2 x i32> %or
1432+
}
1433+
1434+
; TODO: We could select vwadd.vv, but when both arms of the or are the same
1435+
; DAGCombiner::hoistLogicOpWithSameOpcodeHands moves the zext above the or.
1436+
define <vscale x 2 x i32> @vwadd_vv_disjoint_or(<vscale x 2 x i16> %x.i16, <vscale x 2 x i16> %y.i16) {
1437+
; CHECK-LABEL: vwadd_vv_disjoint_or:
1438+
; CHECK: # %bb.0:
1439+
; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
1440+
; CHECK-NEXT: vor.vv v9, v8, v9
1441+
; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, ma
1442+
; CHECK-NEXT: vsext.vf2 v8, v9
1443+
; CHECK-NEXT: ret
1444+
%x.i32 = sext <vscale x 2 x i16> %x.i16 to <vscale x 2 x i32>
1445+
%y.i32 = sext <vscale x 2 x i16> %y.i16 to <vscale x 2 x i32>
1446+
%or = or disjoint <vscale x 2 x i32> %x.i32, %y.i32
1447+
ret <vscale x 2 x i32> %or
1448+
}
1449+
1450+
define <vscale x 2 x i32> @vwaddu_wv_disjoint_or(<vscale x 2 x i32> %x.i32, <vscale x 2 x i16> %y.i16) {
1451+
; CHECK-LABEL: vwaddu_wv_disjoint_or:
1452+
; CHECK: # %bb.0:
1453+
; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
1454+
; CHECK-NEXT: vzext.vf2 v10, v9
1455+
; CHECK-NEXT: vor.vv v8, v8, v10
1456+
; CHECK-NEXT: ret
1457+
%y.i32 = zext <vscale x 2 x i16> %y.i16 to <vscale x 2 x i32>
1458+
%or = or disjoint <vscale x 2 x i32> %x.i32, %y.i32
1459+
ret <vscale x 2 x i32> %or
1460+
}
1461+
1462+
define <vscale x 2 x i32> @vwadd_wv_disjoint_or(<vscale x 2 x i32> %x.i32, <vscale x 2 x i16> %y.i16) {
1463+
; CHECK-LABEL: vwadd_wv_disjoint_or:
1464+
; CHECK: # %bb.0:
1465+
; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
1466+
; CHECK-NEXT: vsext.vf2 v10, v9
1467+
; CHECK-NEXT: vor.vv v8, v8, v10
1468+
; CHECK-NEXT: ret
1469+
%y.i32 = sext <vscale x 2 x i16> %y.i16 to <vscale x 2 x i32>
1470+
%or = or disjoint <vscale x 2 x i32> %x.i32, %y.i32
1471+
ret <vscale x 2 x i32> %or
1472+
}

0 commit comments

Comments
 (0)