Skip to content

Commit f15b7de

Browse files
committed
[RISCV] Add test case to show missing vmerge fold on tied pseudos. NFC
Note we can't use vwaddu.wv because it will get combined away with #78403
1 parent df75183 commit f15b7de

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

llvm/test/CodeGen/RISCV/rvv/rvv-peephole-vmerge-vops.ll

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,3 +1187,19 @@ define <vscale x 2 x i32> @vmerge_larger_vl_false_becomes_tail(<vscale x 2 x i32
11871187
%b = call <vscale x 2 x i32> @llvm.riscv.vmerge.nxv2i32.nxv2i32(<vscale x 2 x i32> poison, <vscale x 2 x i32> %false, <vscale x 2 x i32> %a, <vscale x 2 x i1> %m, i64 3)
11881188
ret <vscale x 2 x i32> %b
11891189
}
1190+
1191+
; Test widening pseudos with their TIED variant (passthru same as first op).
1192+
define <vscale x 2 x i64> @vpmerge_vwsub.w_tied(<vscale x 2 x i64> %passthru, <vscale x 2 x i64> %x, <vscale x 2 x i32> %y, <vscale x 2 x i1> %mask, i32 zeroext %vl) {
1193+
; CHECK-LABEL: vpmerge_vwsub.w_tied:
1194+
; CHECK: # %bb.0:
1195+
; CHECK-NEXT: vsetvli zero, a0, e32, m1, tu, ma
1196+
; CHECK-NEXT: vmv2r.v v10, v8
1197+
; CHECK-NEXT: vwsub.wv v10, v10, v12
1198+
; CHECK-NEXT: vsetvli zero, zero, e64, m2, tu, ma
1199+
; CHECK-NEXT: vmerge.vvm v8, v8, v10, v0
1200+
; CHECK-NEXT: ret
1201+
%vl.zext = zext i32 %vl to i64
1202+
%a = call <vscale x 2 x i64> @llvm.riscv.vwsub.w.nxv2i64.nxv2i32(<vscale x 2 x i64> %passthru, <vscale x 2 x i64> %passthru, <vscale x 2 x i32> %y, i64 %vl.zext)
1203+
%b = call <vscale x 2 x i64> @llvm.vp.merge.nxv2i64(<vscale x 2 x i1> %mask, <vscale x 2 x i64> %a, <vscale x 2 x i64> %passthru, i32 %vl)
1204+
ret <vscale x 2 x i64> %b
1205+
}

0 commit comments

Comments
 (0)