Skip to content

Commit eff4593

Browse files
committed
[RISCV] Add test case for missed vwaddu.vv due to add->or combine. NFC
We should be able to recover this with combineBinOp_VLToVWBinOp_VL if we check that the or has the disjoint flag set.
1 parent 88b10f3 commit eff4593

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,3 +1392,25 @@ define <vscale x 1 x i64> @i1_zext(<vscale x 1 x i1> %va, <vscale x 1 x i64> %vb
13921392
store i9 42, ptr %p
13931393
ret <vscale x 1 x i64> %vd
13941394
}
1395+
1396+
; %x.i32 and %y.i32 are disjoint, so DAGCombiner will combine it into an or.
1397+
; FIXME: We should be able to recover the or into vwaddu.vv if the disjoint
1398+
; 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:
1401+
; CHECK: # %bb.0:
1402+
; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
1403+
; CHECK-NEXT: vzext.vf2 v10, v8
1404+
; CHECK-NEXT: vsll.vi v8, v10, 8
1405+
; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, ma
1406+
; CHECK-NEXT: vzext.vf2 v10, v8
1407+
; CHECK-NEXT: vzext.vf4 v8, v9
1408+
; CHECK-NEXT: vor.vv v8, v10, v8
1409+
; CHECK-NEXT: ret
1410+
%x.i16 = zext <vscale x 2 x i8> %x.i8 to <vscale x 2 x i16>
1411+
%x.shl = shl <vscale x 2 x i16> %x.i16, shufflevector(<vscale x 2 x i16> insertelement(<vscale x 2 x i16> poison, i16 8, i32 0), <vscale x 2 x i16> poison, <vscale x 2 x i32> zeroinitializer)
1412+
%x.i32 = zext <vscale x 2 x i16> %x.shl to <vscale x 2 x i32>
1413+
%y.i32 = zext <vscale x 2 x i8> %y.i8 to <vscale x 2 x i32>
1414+
%add = add <vscale x 2 x i32> %x.i32, %y.i32
1415+
ret <vscale x 2 x i32> %add
1416+
}

0 commit comments

Comments
 (0)