[llvm] 43ff781 - [RISCV] Pre-commit test for Teach VSETVLInsert to eliminate redundant vsetvli for vmv.s.x and vfmv.s.f.
via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 30 01:04:13 PST 2021
Author: jacquesguan
Date: 2021-12-30T17:02:19+08:00
New Revision: 43ff781c783d32b5abf62509593d388c540b7ad8
URL: https://github.com/llvm/llvm-project/commit/43ff781c783d32b5abf62509593d388c540b7ad8
DIFF: https://github.com/llvm/llvm-project/commit/43ff781c783d32b5abf62509593d388c540b7ad8.diff
LOG: [RISCV] Pre-commit test for Teach VSETVLInsert to eliminate redundant vsetvli for vmv.s.x and vfmv.s.f.
Differential Revision: https://reviews.llvm.org/D116306
Added:
Modified:
llvm/test/CodeGen/RISCV/rvv/vsetvli-insert.ll
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/RISCV/rvv/vsetvli-insert.ll b/llvm/test/CodeGen/RISCV/rvv/vsetvli-insert.ll
index 44c50a7ff607d..beab37712fd5a 100644
--- a/llvm/test/CodeGen/RISCV/rvv/vsetvli-insert.ll
+++ b/llvm/test/CodeGen/RISCV/rvv/vsetvli-insert.ll
@@ -3,6 +3,7 @@
; RUN: -verify-machineinstrs -O2 < %s | FileCheck %s
declare i64 @llvm.riscv.vsetvli(i64, i64, i64)
+declare i64 @llvm.riscv.vsetvlimax(i64, i64)
declare <vscale x 1 x double> @llvm.riscv.vfadd.nxv1f64.nxv1f64(
<vscale x 1 x double>,
<vscale x 1 x double>,
@@ -143,6 +144,67 @@ for.body: ; preds = %entry, %for.body
br i1 %cmp.not, label %for.cond.cleanup, label %for.body
}
+define <vscale x 1 x i64> @test7(<vscale x 1 x i64> %a, i64 %b, <vscale x 1 x i1> %mask) nounwind {
+; CHECK-LABEL: test7:
+; CHECK: # %bb.0: # %entry
+; CHECK-NEXT: vsetvli a1, zero, e64, m1, ta, mu
+; CHECK-NEXT: vsetivli zero, 1, e64, m1, tu, mu
+; CHECK-NEXT: vmv.s.x v8, a0
+; CHECK-NEXT: ret
+entry:
+ %x = tail call i64 @llvm.riscv.vsetvlimax(i64 3, i64 0)
+ %y = call <vscale x 1 x i64> @llvm.riscv.vmv.s.x.nxv1i64(
+ <vscale x 1 x i64> %a,
+ i64 %b, i64 1)
+
+ ret <vscale x 1 x i64> %y
+}
+
+define <vscale x 1 x i64> @test8(<vscale x 1 x i64> %a, i64 %b, <vscale x 1 x i1> %mask) nounwind {
+; CHECK-LABEL: test8:
+; CHECK: # %bb.0: # %entry
+; CHECK-NEXT: vsetivli a1, 6, e64, m1, ta, mu
+; CHECK-NEXT: vsetivli zero, 2, e64, m1, tu, mu
+; CHECK-NEXT: vmv.s.x v8, a0
+; CHECK-NEXT: ret
+entry:
+ %x = tail call i64 @llvm.riscv.vsetvli(i64 6, i64 3, i64 0)
+ %y = call <vscale x 1 x i64> @llvm.riscv.vmv.s.x.nxv1i64(<vscale x 1 x i64> %a, i64 %b, i64 2)
+ ret <vscale x 1 x i64> %y
+}
+
+define <vscale x 1 x i64> @test9(<vscale x 1 x i64> %a, i64 %b, <vscale x 1 x i1> %mask) nounwind {
+; CHECK-LABEL: test9:
+; CHECK: # %bb.0: # %entry
+; CHECK-NEXT: vsetivli zero, 9, e64, m1, tu, mu
+; CHECK-NEXT: vadd.vv v8, v8, v8, v0.t
+; CHECK-NEXT: vsetivli zero, 2, e64, m1, tu, mu
+; CHECK-NEXT: vmv.s.x v8, a0
+; CHECK-NEXT: ret
+entry:
+ %x = call <vscale x 1 x i64> @llvm.riscv.vadd.mask.nxv1i64.nxv1i64(
+ <vscale x 1 x i64> %a,
+ <vscale x 1 x i64> %a,
+ <vscale x 1 x i64> %a,
+ <vscale x 1 x i1> %mask,
+ i64 9,
+ i64 0)
+ %y = call <vscale x 1 x i64> @llvm.riscv.vmv.s.x.nxv1i64(<vscale x 1 x i64> %x, i64 %b, i64 2)
+ ret <vscale x 1 x i64> %y
+}
+
+declare <vscale x 1 x i64> @llvm.riscv.vadd.mask.nxv1i64.nxv1i64(
+ <vscale x 1 x i64>,
+ <vscale x 1 x i64>,
+ <vscale x 1 x i64>,
+ <vscale x 1 x i1>,
+ i64,
+ i64);
+
+declare <vscale x 1 x i64> @llvm.riscv.vmv.s.x.nxv1i64(
+ <vscale x 1 x i64>,
+ i64,
+ i64);
declare i64 @llvm.riscv.vsetvli.i64(i64, i64 immarg, i64 immarg)
declare <vscale x 2 x i32> @llvm.riscv.vle.nxv2i32.i64(<vscale x 2 x i32>* nocapture, i64)
declare <vscale x 2 x i1> @llvm.riscv.vmslt.nxv2i32.i32.i64(<vscale x 2 x i32>, i32, i64)
More information about the llvm-commits
mailing list