[clang] dcb8fbd - [llvm][RISCV] Support alternative LMUL intrinsics for Xsfmm tile move instructions (#246221)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 29 22:04:15 PST 2026
Author: Brandon Wu
Date: 2026-11-30T14:04:08+08:00
New Revision: dcb8fbd39a41528f064b0e39bf82b34a862b2b2d
URL: https://github.com/llvm/llvm-project/commit/dcb8fbd39a41528f064b0e39bf82b34a862b2b2d
DIFF: https://github.com/llvm/llvm-project/commit/dcb8fbd39a41528f064b0e39bf82b34a862b2b2d.diff
LOG: [llvm][RISCV] Support alternative LMUL intrinsics for Xsfmm tile move instructions (#246221)
Tile move instrucitons move 1 row or column at a time which occupies for
example at most 2 vector registers for TEW=8 when TE==VLEN/4, we can
release the rule of using LMUL=8.
Added:
Modified:
clang/include/clang/Basic/riscv_sifive_vector.td
clang/test/CodeGen/RISCV/rvv-intrinsics-sifive/non-policy/non-overloaded/sf_vtmv_t_v.c
clang/test/CodeGen/RISCV/rvv-intrinsics-sifive/non-policy/non-overloaded/sf_vtmv_v_t.c
clang/test/CodeGen/RISCV/rvv-intrinsics-sifive/non-policy/overloaded/sf_vtmv_t_v.c
llvm/lib/Target/RISCV/RISCVInstrInfoXSfmm.td
llvm/test/CodeGen/RISCV/rvv/sifive-xsfmm-vset-insert.mir
llvm/test/CodeGen/RISCV/rvv/sifive_sf_vtmv_t_v.ll
llvm/test/CodeGen/RISCV/rvv/sifive_sf_vtmv_v_t.ll
Removed:
################################################################################
diff --git a/clang/include/clang/Basic/riscv_sifive_vector.td b/clang/include/clang/Basic/riscv_sifive_vector.td
index 1273ecd27ae877..6b0be75dc9e517 100644
--- a/clang/include/clang/Basic/riscv_sifive_vector.td
+++ b/clang/include/clang/Basic/riscv_sifive_vector.td
@@ -266,7 +266,10 @@ multiclass RVVSFTileMoveBuiltinSet<list<list<string>> suffixes_prototypes,
Name = NAME,
IRName = NAME,
HasVL = true,
- Log2LMUL = [3],
+ Log2LMUL = !cond(
+ !or(!eq(type, "c"), !eq(type, "a"), !eq(type, "b")): [1, 3],
+ !or(!eq(type, "s"), !eq(type, "x"), !eq(type, "y")): [2, 3],
+ true: [3]),
IntrinsicTypes = intrinsic_types in
def : RVVBuiltin<sp[0], sp[1], type>;
}
diff --git a/clang/test/CodeGen/RISCV/rvv-intrinsics-sifive/non-policy/non-overloaded/sf_vtmv_t_v.c b/clang/test/CodeGen/RISCV/rvv-intrinsics-sifive/non-policy/non-overloaded/sf_vtmv_t_v.c
index 98edcfb44f2317..1387371565a028 100644
--- a/clang/test/CodeGen/RISCV/rvv-intrinsics-sifive/non-policy/non-overloaded/sf_vtmv_t_v.c
+++ b/clang/test/CodeGen/RISCV/rvv-intrinsics-sifive/non-policy/non-overloaded/sf_vtmv_t_v.c
@@ -8,6 +8,86 @@
#include <sifive_vector.h>
+// CHECK-RV64-LABEL: define dso_local void @test_sf_vtmv_t_v_i8m2(
+// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], <vscale x 16 x i8> [[SRC:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] {
+// CHECK-RV64-NEXT: entry:
+// CHECK-RV64-NEXT: call void @llvm.riscv.sf.vtmv.t.v.nxv16i8.i64(i64 [[TSS]], <vscale x 16 x i8> [[SRC]], i64 [[VL]])
+// CHECK-RV64-NEXT: ret void
+//
+void test_sf_vtmv_t_v_i8m2(size_t tss, vint8m2_t src, size_t vl) {
+ return __riscv_sf_vtmv_t_v_i8m2(tss, src, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local void @test_sf_vtmv_t_v_u8m2(
+// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], <vscale x 16 x i8> [[SRC:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT: entry:
+// CHECK-RV64-NEXT: call void @llvm.riscv.sf.vtmv.t.v.nxv16i8.i64(i64 [[TSS]], <vscale x 16 x i8> [[SRC]], i64 [[VL]])
+// CHECK-RV64-NEXT: ret void
+//
+void test_sf_vtmv_t_v_u8m2(size_t tss, vuint8m2_t src, size_t vl) {
+ return __riscv_sf_vtmv_t_v_u8m2(tss, src, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local void @test_sf_vtmv_t_v_f8e4m3m2(
+// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], <vscale x 16 x i8> [[SRC:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT: entry:
+// CHECK-RV64-NEXT: call void @llvm.riscv.sf.vtmv.t.v.nxv16i8.i64(i64 [[TSS]], <vscale x 16 x i8> [[SRC]], i64 [[VL]])
+// CHECK-RV64-NEXT: ret void
+//
+void test_sf_vtmv_t_v_f8e4m3m2(size_t tss, vfloat8e4m3m2_t src, size_t vl) {
+ return __riscv_sf_vtmv_t_v_f8e4m3m2(tss, src, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local void @test_sf_vtmv_t_v_f8e5m2m2(
+// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], <vscale x 16 x i8> [[SRC:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT: entry:
+// CHECK-RV64-NEXT: call void @llvm.riscv.sf.vtmv.t.v.nxv16i8.i64(i64 [[TSS]], <vscale x 16 x i8> [[SRC]], i64 [[VL]])
+// CHECK-RV64-NEXT: ret void
+//
+void test_sf_vtmv_t_v_f8e5m2m2(size_t tss, vfloat8e5m2m2_t src, size_t vl) {
+ return __riscv_sf_vtmv_t_v_f8e5m2m2(tss, src, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local void @test_sf_vtmv_t_v_i16m4(
+// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], <vscale x 16 x i16> [[SRC:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT: entry:
+// CHECK-RV64-NEXT: call void @llvm.riscv.sf.vtmv.t.v.nxv16i16.i64(i64 [[TSS]], <vscale x 16 x i16> [[SRC]], i64 [[VL]])
+// CHECK-RV64-NEXT: ret void
+//
+void test_sf_vtmv_t_v_i16m4(size_t tss, vint16m4_t src, size_t vl) {
+ return __riscv_sf_vtmv_t_v_i16m4(tss, src, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local void @test_sf_vtmv_t_v_u16m4(
+// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], <vscale x 16 x i16> [[SRC:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT: entry:
+// CHECK-RV64-NEXT: call void @llvm.riscv.sf.vtmv.t.v.nxv16i16.i64(i64 [[TSS]], <vscale x 16 x i16> [[SRC]], i64 [[VL]])
+// CHECK-RV64-NEXT: ret void
+//
+void test_sf_vtmv_t_v_u16m4(size_t tss, vuint16m4_t src, size_t vl) {
+ return __riscv_sf_vtmv_t_v_u16m4(tss, src, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local void @test_sf_vtmv_t_v_f16m4(
+// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], <vscale x 16 x half> [[SRC:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT: entry:
+// CHECK-RV64-NEXT: call void @llvm.riscv.sf.vtmv.t.v.nxv16f16.i64(i64 [[TSS]], <vscale x 16 x half> [[SRC]], i64 [[VL]])
+// CHECK-RV64-NEXT: ret void
+//
+void test_sf_vtmv_t_v_f16m4(size_t tss, vfloat16m4_t src, size_t vl) {
+ return __riscv_sf_vtmv_t_v_f16m4(tss, src, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local void @test_sf_vtmv_t_v_bf16m4(
+// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], <vscale x 16 x bfloat> [[SRC:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT: entry:
+// CHECK-RV64-NEXT: call void @llvm.riscv.sf.vtmv.t.v.nxv16bf16.i64(i64 [[TSS]], <vscale x 16 x bfloat> [[SRC]], i64 [[VL]])
+// CHECK-RV64-NEXT: ret void
+//
+void test_sf_vtmv_t_v_bf16m4(size_t tss, vbfloat16m4_t src, size_t vl) {
+ return __riscv_sf_vtmv_t_v_bf16m4(tss, src, vl);
+}
+
// CHECK-RV64-LABEL: define dso_local void @test_sf_vtmv_t_v_bf16m8(
// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], <vscale x 32 x bfloat> [[SRC:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] {
// CHECK-RV64-NEXT: entry:
diff --git a/clang/test/CodeGen/RISCV/rvv-intrinsics-sifive/non-policy/non-overloaded/sf_vtmv_v_t.c b/clang/test/CodeGen/RISCV/rvv-intrinsics-sifive/non-policy/non-overloaded/sf_vtmv_v_t.c
index 49ca160a3a0c1f..78caec94b88431 100644
--- a/clang/test/CodeGen/RISCV/rvv-intrinsics-sifive/non-policy/non-overloaded/sf_vtmv_v_t.c
+++ b/clang/test/CodeGen/RISCV/rvv-intrinsics-sifive/non-policy/non-overloaded/sf_vtmv_v_t.c
@@ -8,6 +8,86 @@
#include <sifive_vector.h>
+// CHECK-RV64-LABEL: define dso_local <vscale x 16 x i8> @test_sf_vtmv_v_t_i8m2(
+// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] {
+// CHECK-RV64-NEXT: entry:
+// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 16 x i8> @llvm.riscv.sf.vtmv.v.t.nxv16i8.i64(i64 [[TSS]], i64 [[VL]])
+// CHECK-RV64-NEXT: ret <vscale x 16 x i8> [[TMP0]]
+//
+vint8m2_t test_sf_vtmv_v_t_i8m2(size_t tss, size_t vl) {
+ return __riscv_sf_vtmv_v_t_i8m2(tss, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local <vscale x 16 x i8> @test_sf_vtmv_v_t_u8m2(
+// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT: entry:
+// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 16 x i8> @llvm.riscv.sf.vtmv.v.t.nxv16i8.i64(i64 [[TSS]], i64 [[VL]])
+// CHECK-RV64-NEXT: ret <vscale x 16 x i8> [[TMP0]]
+//
+vuint8m2_t test_sf_vtmv_v_t_u8m2(size_t tss, size_t vl) {
+ return __riscv_sf_vtmv_v_t_u8m2(tss, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local <vscale x 16 x i8> @test_sf_vtmv_v_t_f8e4m3m2(
+// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT: entry:
+// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 16 x i8> @llvm.riscv.sf.vtmv.v.t.nxv16i8.i64(i64 [[TSS]], i64 [[VL]])
+// CHECK-RV64-NEXT: ret <vscale x 16 x i8> [[TMP0]]
+//
+vfloat8e4m3m2_t test_sf_vtmv_v_t_f8e4m3m2(size_t tss, size_t vl) {
+ return __riscv_sf_vtmv_v_t_f8e4m3m2(tss, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local <vscale x 16 x i8> @test_sf_vtmv_v_t_f8e5m2m2(
+// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT: entry:
+// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 16 x i8> @llvm.riscv.sf.vtmv.v.t.nxv16i8.i64(i64 [[TSS]], i64 [[VL]])
+// CHECK-RV64-NEXT: ret <vscale x 16 x i8> [[TMP0]]
+//
+vfloat8e5m2m2_t test_sf_vtmv_v_t_f8e5m2m2(size_t tss, size_t vl) {
+ return __riscv_sf_vtmv_v_t_f8e5m2m2(tss, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local <vscale x 16 x i16> @test_sf_vtmv_v_t_i16m4(
+// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT: entry:
+// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 16 x i16> @llvm.riscv.sf.vtmv.v.t.nxv16i16.i64(i64 [[TSS]], i64 [[VL]])
+// CHECK-RV64-NEXT: ret <vscale x 16 x i16> [[TMP0]]
+//
+vint16m4_t test_sf_vtmv_v_t_i16m4(size_t tss, size_t vl) {
+ return __riscv_sf_vtmv_v_t_i16m4(tss, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local <vscale x 16 x i16> @test_sf_vtmv_v_t_u16m4(
+// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT: entry:
+// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 16 x i16> @llvm.riscv.sf.vtmv.v.t.nxv16i16.i64(i64 [[TSS]], i64 [[VL]])
+// CHECK-RV64-NEXT: ret <vscale x 16 x i16> [[TMP0]]
+//
+vuint16m4_t test_sf_vtmv_v_t_u16m4(size_t tss, size_t vl) {
+ return __riscv_sf_vtmv_v_t_u16m4(tss, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local <vscale x 16 x half> @test_sf_vtmv_v_t_f16m4(
+// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT: entry:
+// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 16 x half> @llvm.riscv.sf.vtmv.v.t.nxv16f16.i64(i64 [[TSS]], i64 [[VL]])
+// CHECK-RV64-NEXT: ret <vscale x 16 x half> [[TMP0]]
+//
+vfloat16m4_t test_sf_vtmv_v_t_f16m4(size_t tss, size_t vl) {
+ return __riscv_sf_vtmv_v_t_f16m4(tss, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local <vscale x 16 x bfloat> @test_sf_vtmv_v_t_bf16m4(
+// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT: entry:
+// CHECK-RV64-NEXT: [[TMP0:%.*]] = call <vscale x 16 x bfloat> @llvm.riscv.sf.vtmv.v.t.nxv16bf16.i64(i64 [[TSS]], i64 [[VL]])
+// CHECK-RV64-NEXT: ret <vscale x 16 x bfloat> [[TMP0]]
+//
+vbfloat16m4_t test_sf_vtmv_v_t_bf16m4(size_t tss, size_t vl) {
+ return __riscv_sf_vtmv_v_t_bf16m4(tss, vl);
+}
+
// CHECK-RV64-LABEL: define dso_local <vscale x 32 x bfloat> @test_sf_vtmv_v_t_bf16m8(
// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] {
// CHECK-RV64-NEXT: entry:
diff --git a/clang/test/CodeGen/RISCV/rvv-intrinsics-sifive/non-policy/overloaded/sf_vtmv_t_v.c b/clang/test/CodeGen/RISCV/rvv-intrinsics-sifive/non-policy/overloaded/sf_vtmv_t_v.c
index 7a6bb061e634b2..17df54f1b437ac 100644
--- a/clang/test/CodeGen/RISCV/rvv-intrinsics-sifive/non-policy/overloaded/sf_vtmv_t_v.c
+++ b/clang/test/CodeGen/RISCV/rvv-intrinsics-sifive/non-policy/overloaded/sf_vtmv_t_v.c
@@ -8,6 +8,86 @@
#include <sifive_vector.h>
+// CHECK-RV64-LABEL: define dso_local void @test_sf_vtmv_t_v_i8m2(
+// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], <vscale x 16 x i8> [[SRC:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] {
+// CHECK-RV64-NEXT: entry:
+// CHECK-RV64-NEXT: call void @llvm.riscv.sf.vtmv.t.v.nxv16i8.i64(i64 [[TSS]], <vscale x 16 x i8> [[SRC]], i64 [[VL]])
+// CHECK-RV64-NEXT: ret void
+//
+void test_sf_vtmv_t_v_i8m2(size_t tss, vint8m2_t src, size_t vl) {
+ return __riscv_sf_vtmv_t_v(tss, src, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local void @test_sf_vtmv_t_v_u8m2(
+// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], <vscale x 16 x i8> [[SRC:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT: entry:
+// CHECK-RV64-NEXT: call void @llvm.riscv.sf.vtmv.t.v.nxv16i8.i64(i64 [[TSS]], <vscale x 16 x i8> [[SRC]], i64 [[VL]])
+// CHECK-RV64-NEXT: ret void
+//
+void test_sf_vtmv_t_v_u8m2(size_t tss, vuint8m2_t src, size_t vl) {
+ return __riscv_sf_vtmv_t_v(tss, src, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local void @test_sf_vtmv_t_v_f8e4m3m2(
+// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], <vscale x 16 x i8> [[SRC:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT: entry:
+// CHECK-RV64-NEXT: call void @llvm.riscv.sf.vtmv.t.v.nxv16i8.i64(i64 [[TSS]], <vscale x 16 x i8> [[SRC]], i64 [[VL]])
+// CHECK-RV64-NEXT: ret void
+//
+void test_sf_vtmv_t_v_f8e4m3m2(size_t tss, vfloat8e4m3m2_t src, size_t vl) {
+ return __riscv_sf_vtmv_t_v(tss, src, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local void @test_sf_vtmv_t_v_f8e5m2m2(
+// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], <vscale x 16 x i8> [[SRC:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT: entry:
+// CHECK-RV64-NEXT: call void @llvm.riscv.sf.vtmv.t.v.nxv16i8.i64(i64 [[TSS]], <vscale x 16 x i8> [[SRC]], i64 [[VL]])
+// CHECK-RV64-NEXT: ret void
+//
+void test_sf_vtmv_t_v_f8e5m2m2(size_t tss, vfloat8e5m2m2_t src, size_t vl) {
+ return __riscv_sf_vtmv_t_v(tss, src, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local void @test_sf_vtmv_t_v_i16m4(
+// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], <vscale x 16 x i16> [[SRC:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT: entry:
+// CHECK-RV64-NEXT: call void @llvm.riscv.sf.vtmv.t.v.nxv16i16.i64(i64 [[TSS]], <vscale x 16 x i16> [[SRC]], i64 [[VL]])
+// CHECK-RV64-NEXT: ret void
+//
+void test_sf_vtmv_t_v_i16m4(size_t tss, vint16m4_t src, size_t vl) {
+ return __riscv_sf_vtmv_t_v(tss, src, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local void @test_sf_vtmv_t_v_u16m4(
+// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], <vscale x 16 x i16> [[SRC:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT: entry:
+// CHECK-RV64-NEXT: call void @llvm.riscv.sf.vtmv.t.v.nxv16i16.i64(i64 [[TSS]], <vscale x 16 x i16> [[SRC]], i64 [[VL]])
+// CHECK-RV64-NEXT: ret void
+//
+void test_sf_vtmv_t_v_u16m4(size_t tss, vuint16m4_t src, size_t vl) {
+ return __riscv_sf_vtmv_t_v(tss, src, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local void @test_sf_vtmv_t_v_f16m4(
+// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], <vscale x 16 x half> [[SRC:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT: entry:
+// CHECK-RV64-NEXT: call void @llvm.riscv.sf.vtmv.t.v.nxv16f16.i64(i64 [[TSS]], <vscale x 16 x half> [[SRC]], i64 [[VL]])
+// CHECK-RV64-NEXT: ret void
+//
+void test_sf_vtmv_t_v_f16m4(size_t tss, vfloat16m4_t src, size_t vl) {
+ return __riscv_sf_vtmv_t_v(tss, src, vl);
+}
+
+// CHECK-RV64-LABEL: define dso_local void @test_sf_vtmv_t_v_bf16m4(
+// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], <vscale x 16 x bfloat> [[SRC:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0]] {
+// CHECK-RV64-NEXT: entry:
+// CHECK-RV64-NEXT: call void @llvm.riscv.sf.vtmv.t.v.nxv16bf16.i64(i64 [[TSS]], <vscale x 16 x bfloat> [[SRC]], i64 [[VL]])
+// CHECK-RV64-NEXT: ret void
+//
+void test_sf_vtmv_t_v_bf16m4(size_t tss, vbfloat16m4_t src, size_t vl) {
+ return __riscv_sf_vtmv_t_v(tss, src, vl);
+}
+
// CHECK-RV64-LABEL: define dso_local void @test_sf_vtmv_t_v_bf16m8(
// CHECK-RV64-SAME: i64 noundef [[TSS:%.*]], <vscale x 32 x bfloat> [[SRC:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] {
// CHECK-RV64-NEXT: entry:
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoXSfmm.td b/llvm/lib/Target/RISCV/RISCVInstrInfoXSfmm.td
index 8efccf9852cb44..f287082a7aa12e 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoXSfmm.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoXSfmm.td
@@ -301,9 +301,9 @@ class VPseudoSF_VTileStore
let hasSideEffects = 1;
}
-class VPseudoSF_VTileMove_V_T
- : RISCVVPseudo<(outs VRM8:$vd), (ins GPR:$rs1, GPRNoX0:$atn, sew:$sew,
- twiden:$twiden)> {
+class VPseudoSF_VTileMove_V_T<RegisterClass vreg_class>
+ : RISCVVPseudo<(outs vreg_class:$vd), (ins GPR:$rs1, GPRNoX0:$atn, sew:$sew,
+ twiden:$twiden)> {
let mayLoad = 0;
let mayStore = 0;
let HasVLOp = 1; // Tn
@@ -312,8 +312,8 @@ class VPseudoSF_VTileMove_V_T
let hasSideEffects = 1;
}
-class VPseudoSF_VTileMove_T_V
- : RISCVVPseudo<(outs), (ins GPR:$rs1, VRM8:$vs2, GPRNoX0:$atn, sew:$sew,
+class VPseudoSF_VTileMove_T_V<RegisterClass vreg_class>
+ : RISCVVPseudo<(outs), (ins GPR:$rs1, vreg_class:$vs2, GPRNoX0:$atn, sew:$sew,
twiden:$twiden)> {
let mayLoad = 0;
let mayStore = 0;
@@ -394,8 +394,10 @@ foreach eew = [8, 16, 32, 64] in {
def PseudoSF_VSTE # eew : VPseudoSF_VTileStore;
}
-def PseudoSF_VTMV_T_V : VPseudoSF_VTileMove_T_V;
-def PseudoSF_VTMV_V_T : VPseudoSF_VTileMove_V_T;
+foreach lmul = [V_M2, V_M4, V_M8] in {
+ def PseudoSF_VTMV_T_V_ # lmul.MX : VPseudoSF_VTileMove_T_V<lmul.vrclass>;
+ def PseudoSF_VTMV_V_T_ # lmul.MX : VPseudoSF_VTileMove_V_T<lmul.vrclass>;
+}
foreach a = I8Encodes in
foreach b = I8Encodes in
@@ -436,14 +438,15 @@ class VPatXSfmmTileStore<string intrinsic_name,
class VPatXSfmmTileMove_T_V<string intrinsic_name,
string inst_name,
ValueType reg_type,
+ RegisterClass vreg_class,
int log2sew> :
Pat<(!cast<Intrinsic>(intrinsic_name)
(XLenVT GPR:$rs1),
- (reg_type VRM8:$vs2),
+ (reg_type vreg_class:$vs2),
(XLenVT GPRNoX0:$atn)),
(!cast<Instruction>(inst_name)
(XLenVT GPR:$rs1),
- (reg_type VRM8:$vs2),
+ (reg_type vreg_class:$vs2),
GPR:$atn, log2sew, 1)>;
class VPatXSfmmTileMove_V_T<string intrinsic_name,
@@ -465,9 +468,14 @@ class VPatXSfmmVTDiscard<string intrinsic_name,
foreach eew = [8, 16, 32, 64] in
def : VPatXSfmmTileStore<"int_riscv_sf_vste" # eew, "PseudoSF_VSTE" # eew, !logtwo(eew)>;
-foreach vti = [VI8M8, VI16M8, VI32M8, VI64M8, VF16M8, VF32M8, VF64M8, VBF16M8] in {
- def : VPatXSfmmTileMove_T_V<"int_riscv_sf_vtmv_t_v", "PseudoSF_VTMV_T_V", vti.Vector, vti.Log2SEW>;
- def : VPatXSfmmTileMove_V_T<"int_riscv_sf_vtmv_v_t", "PseudoSF_VTMV_V_T", vti.Vector, vti.Log2SEW>;
+foreach vti = [VI8M2, VI16M4, VF16M4, VBF16M4, VI8M8, VI16M8, VI32M8, VI64M8,
+ VF16M8, VF32M8, VF64M8, VBF16M8] in {
+ def : VPatXSfmmTileMove_T_V<"int_riscv_sf_vtmv_t_v",
+ "PseudoSF_VTMV_T_V_" # vti.LMul.MX, vti.Vector,
+ vti.LMul.vrclass, vti.Log2SEW>;
+ def : VPatXSfmmTileMove_V_T<"int_riscv_sf_vtmv_v_t",
+ "PseudoSF_VTMV_V_T_" # vti.LMul.MX, vti.Vector,
+ vti.Log2SEW>;
}
def : VPatXSfmmVTDiscard<"int_riscv_sf_vtdiscard", "PseudoSF_VTDISCARD">;
diff --git a/llvm/test/CodeGen/RISCV/rvv/sifive-xsfmm-vset-insert.mir b/llvm/test/CodeGen/RISCV/rvv/sifive-xsfmm-vset-insert.mir
index e244aeb9549637..d3fd92c5d45723 100644
--- a/llvm/test/CodeGen/RISCV/rvv/sifive-xsfmm-vset-insert.mir
+++ b/llvm/test/CodeGen/RISCV/rvv/sifive-xsfmm-vset-insert.mir
@@ -239,9 +239,9 @@ body: |
; CHECK-NEXT: [[COPY2:%[0-9]+]]:vrm8 = COPY $v8m8
; CHECK-NEXT: [[ADDI:%[0-9]+]]:gpr = ADDI $x0, 1
; CHECK-NEXT: dead $x0 = PseudoSF_VSETTNT [[COPY1]], 512 /* e8, w1 */, implicit-def $vl, implicit-def $vtype
- ; CHECK-NEXT: [[PseudoSF_VTMV_V_T:%[0-9]+]]:vrm8 = PseudoSF_VTMV_V_T [[ADDI]], $noreg, 3 /* e8 */, 1 /* w1 */, implicit $vl, implicit $vtype
+ ; CHECK-NEXT: [[PseudoSF_VTMV_V_T_M8_:%[0-9]+]]:vrm8 = PseudoSF_VTMV_V_T_M8 [[ADDI]], $noreg, 3 /* e8 */, 1 /* w1 */, implicit $vl, implicit $vtype
; CHECK-NEXT: dead $x0 = PseudoVSETVLI [[COPY1]], 195 /* e8, m8, ta, ma */, implicit-def $vl, implicit-def $vtype
- ; CHECK-NEXT: [[PseudoVADD_VV_M8_:%[0-9]+]]:vrm8 = PseudoVADD_VV_M8 $noreg, [[COPY2]], [[PseudoSF_VTMV_V_T]], $noreg /* vl */, 3 /* e8 */, 0 /* tu, mu */, implicit $vl, implicit $vtype
+ ; CHECK-NEXT: [[PseudoVADD_VV_M8_:%[0-9]+]]:vrm8 = PseudoVADD_VV_M8 $noreg, [[COPY2]], [[PseudoSF_VTMV_V_T_M8_]], $noreg /* vl */, 3 /* e8 */, 0 /* tu, mu */, implicit $vl, implicit $vtype
; CHECK-NEXT: dead $x0 = PseudoSF_VSETTNT [[COPY1]], 520 /* e16, w1 */, implicit-def $vl, implicit-def $vtype
; CHECK-NEXT: PseudoSF_VSTE16 [[ADDI]], [[COPY]], $noreg, 4 /* e16 */, 1 /* w1 */, implicit $vl, implicit $vtype
; CHECK-NEXT: $v8m8 = COPY [[PseudoVADD_VV_M8_]], implicit $vtype
@@ -250,7 +250,7 @@ body: |
%1:gprnox0 = COPY $x10
%0:vrm8 = COPY $v8m8
%3:gpr = ADDI $x0, 1
- %4:vrm8 = PseudoSF_VTMV_V_T %3:gpr, %1:gprnox0, 3, 1
+ %4:vrm8 = PseudoSF_VTMV_V_T_M8 %3:gpr, %1:gprnox0, 3, 1
%5:vrm8 = PseudoVADD_VV_M8 $noreg, %0:vrm8, %4:vrm8, %1:gprnox0, 3, 0
PseudoSF_VSTE16 %3:gpr, %2:gpr, %1:gprnox0, 4, 1
$v8m8 = COPY %5:vrm8
@@ -279,7 +279,7 @@ body: |
; CHECK-NEXT: dead $x0 = PseudoVSETVLI [[COPY1]], 195 /* e8, m8, ta, ma */, implicit-def $vl, implicit-def $vtype
; CHECK-NEXT: [[PseudoVADD_VV_M8_:%[0-9]+]]:vrm8 = PseudoVADD_VV_M8 $noreg, [[COPY2]], [[COPY2]], $noreg /* vl */, 3 /* e8 */, 0 /* tu, mu */, implicit $vl, implicit $vtype
; CHECK-NEXT: dead $x0 = PseudoSF_VSETTNT [[COPY1]], 512 /* e8, w1 */, implicit-def $vl, implicit-def $vtype
- ; CHECK-NEXT: dead [[PseudoSF_VTMV_V_T:%[0-9]+]]:vrm8 = PseudoSF_VTMV_V_T [[ADDI]], $noreg, 3 /* e8 */, 1 /* w1 */, implicit $vl, implicit $vtype
+ ; CHECK-NEXT: dead [[PseudoSF_VTMV_V_T_M8_:%[0-9]+]]:vrm8 = PseudoSF_VTMV_V_T_M8 [[ADDI]], $noreg, 3 /* e8 */, 1 /* w1 */, implicit $vl, implicit $vtype
; CHECK-NEXT: dead $x0 = PseudoVSETVLI [[COPY1]], 195 /* e8, m8, ta, ma */, implicit-def $vl, implicit-def $vtype
; CHECK-NEXT: [[PseudoVADD_VV_M8_1:%[0-9]+]]:vrm8 = PseudoVADD_VV_M8 $noreg, [[PseudoVADD_VV_M8_]], [[PseudoVADD_VV_M8_]], $noreg /* vl */, 3 /* e8 */, 0 /* tu, mu */, implicit $vl, implicit $vtype
; CHECK-NEXT: dead $x0 = PseudoSF_VSETTNT [[COPY1]], 520 /* e16, w1 */, implicit-def $vl, implicit-def $vtype
@@ -291,7 +291,7 @@ body: |
%0:vrm8 = COPY $v8m8
%3:gpr = ADDI $x0, 1
%4:vrm8 = PseudoVADD_VV_M8 $noreg, %0:vrm8, %0:vrm8, %1:gprnox0, 3, 0
- %5:vrm8 = PseudoSF_VTMV_V_T %3:gpr, %1:gprnox0, 3, 1
+ %5:vrm8 = PseudoSF_VTMV_V_T_M8 %3:gpr, %1:gprnox0, 3, 1
%6:vrm8 = PseudoVADD_VV_M8 $noreg, %4:vrm8, %4:vrm8, %1:gprnox0, 3, 0
PseudoSF_VSTE16 %3:gpr, %2:gpr, %1:gprnox0, 4, 1
$v8m8 = COPY %6:vrm8
diff --git a/llvm/test/CodeGen/RISCV/rvv/sifive_sf_vtmv_t_v.ll b/llvm/test/CodeGen/RISCV/rvv/sifive_sf_vtmv_t_v.ll
index 616941c8fa0772..9987dca23a44ab 100644
--- a/llvm/test/CodeGen/RISCV/rvv/sifive_sf_vtmv_t_v.ll
+++ b/llvm/test/CodeGen/RISCV/rvv/sifive_sf_vtmv_t_v.ll
@@ -6,6 +6,46 @@
; RUN: -mattr=+zvfhmin -mattr=+zvfbfmin -mattr=+xsfmmbase \
; RUN: -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK
+define void @test_sf_vtmv_t_v_i8m2(iXLen %tss, <vscale x 16 x i8> %src, iXLen %vl) {
+; CHECK-LABEL: test_sf_vtmv_t_v_i8m2:
+; CHECK: sf.vsettnt zero, a1, e8, w1
+; CHECK-NEXT: sf.vtmv.t.v a0, v8
+; CHECK-NEXT: ret
+ entry:
+ call void @llvm.riscv.sf.vtmv.t.v.nxv16i8.iXLen(iXLen %tss, <vscale x 16 x i8> %src, iXLen %vl)
+ ret void
+}
+
+define void @test_sf_vtmv_t_v_i16m4(iXLen %tss, <vscale x 16 x i16> %src, iXLen %vl) {
+; CHECK-LABEL: test_sf_vtmv_t_v_i16m4:
+; CHECK: sf.vsettnt zero, a1, e16, w1
+; CHECK-NEXT: sf.vtmv.t.v a0, v8
+; CHECK-NEXT: ret
+ entry:
+ call void @llvm.riscv.sf.vtmv.t.v.nxv16i16.iXLen(iXLen %tss, <vscale x 16 x i16> %src, iXLen %vl)
+ ret void
+}
+
+define void @test_sf_vtmv_t_v_f16m4(iXLen %tss, <vscale x 16 x half> %src, iXLen %vl) {
+; CHECK-LABEL: test_sf_vtmv_t_v_f16m4:
+; CHECK: sf.vsettnt zero, a1, e16, w1
+; CHECK-NEXT: sf.vtmv.t.v a0, v8
+; CHECK-NEXT: ret
+ entry:
+ call void @llvm.riscv.sf.vtmv.t.v.nxv16f16.iXLen(iXLen %tss, <vscale x 16 x half> %src, iXLen %vl)
+ ret void
+}
+
+define void @test_sf_vtmv_t_v_bf16m4(iXLen %tss, <vscale x 16 x bfloat> %src, iXLen %vl) {
+; CHECK-LABEL: test_sf_vtmv_t_v_bf16m4:
+; CHECK: sf.vsettnt zero, a1, e16, w1
+; CHECK-NEXT: sf.vtmv.t.v a0, v8
+; CHECK-NEXT: ret
+ entry:
+ call void @llvm.riscv.sf.vtmv.t.v.nxv16bf16.iXLen(iXLen %tss, <vscale x 16 x bfloat> %src, iXLen %vl)
+ ret void
+}
+
define void @test_sf_vtmv_t_v_bf16m8(iXLen %tss, <vscale x 32 x bfloat> %src, iXLen %vl) {
; CHECK-LABEL: test_sf_vtmv_t_v_bf16m8:
; CHECK: # %bb.0: # %entry
diff --git a/llvm/test/CodeGen/RISCV/rvv/sifive_sf_vtmv_v_t.ll b/llvm/test/CodeGen/RISCV/rvv/sifive_sf_vtmv_v_t.ll
index a0d2dcf3112b42..e335268d8d1b17 100644
--- a/llvm/test/CodeGen/RISCV/rvv/sifive_sf_vtmv_v_t.ll
+++ b/llvm/test/CodeGen/RISCV/rvv/sifive_sf_vtmv_v_t.ll
@@ -6,6 +6,46 @@
; RUN: -mattr=+zvfhmin -mattr=+zvfbfmin -mattr=+xsfmmbase \
; RUN: -verify-machineinstrs | FileCheck %s --check-prefixes=CHECK
+define <vscale x 16 x i8> @test_sf_vtmv_v_t_i8m2(iXLen %tss, iXLen %vl) {
+; CHECK-LABEL: test_sf_vtmv_v_t_i8m2:
+; CHECK: sf.vsettnt zero, a1, e8, w1
+; CHECK-NEXT: sf.vtmv.v.t v8, a0
+; CHECK-NEXT: ret
+ entry:
+ %0 = call <vscale x 16 x i8> @llvm.riscv.sf.vtmv.v.t.nxv16i8.iXLen(iXLen %tss, iXLen %vl)
+ ret <vscale x 16 x i8> %0
+}
+
+define <vscale x 16 x i16> @test_sf_vtmv_v_t_i16m4(iXLen %tss, iXLen %vl) {
+; CHECK-LABEL: test_sf_vtmv_v_t_i16m4:
+; CHECK: sf.vsettnt zero, a1, e16, w1
+; CHECK-NEXT: sf.vtmv.v.t v8, a0
+; CHECK-NEXT: ret
+ entry:
+ %0 = call <vscale x 16 x i16> @llvm.riscv.sf.vtmv.v.t.nxv16i16.iXLen(iXLen %tss, iXLen %vl)
+ ret <vscale x 16 x i16> %0
+}
+
+define <vscale x 16 x half> @test_sf_vtmv_v_t_f16m4(iXLen %tss, iXLen %vl) {
+; CHECK-LABEL: test_sf_vtmv_v_t_f16m4:
+; CHECK: sf.vsettnt zero, a1, e16, w1
+; CHECK-NEXT: sf.vtmv.v.t v8, a0
+; CHECK-NEXT: ret
+ entry:
+ %0 = call <vscale x 16 x half> @llvm.riscv.sf.vtmv.v.t.nxv16f16.iXLen(iXLen %tss, iXLen %vl)
+ ret <vscale x 16 x half> %0
+}
+
+define <vscale x 16 x bfloat> @test_sf_vtmv_v_t_bf16m4(iXLen %tss, iXLen %vl) {
+; CHECK-LABEL: test_sf_vtmv_v_t_bf16m4:
+; CHECK: sf.vsettnt zero, a1, e16, w1
+; CHECK-NEXT: sf.vtmv.v.t v8, a0
+; CHECK-NEXT: ret
+ entry:
+ %0 = call <vscale x 16 x bfloat> @llvm.riscv.sf.vtmv.v.t.nxv16bf16.iXLen(iXLen %tss, iXLen %vl)
+ ret <vscale x 16 x bfloat> %0
+}
+
define <vscale x 32 x bfloat> @test_sf_vtmv_v_t_bf16m8(iXLen %tss, iXLen %vl) {
; CHECK-LABEL: test_sf_vtmv_v_t_bf16m8:
; CHECK: # %bb.0: # %entry
More information about the cfe-commits
mailing list