From 27a7d8d5f711dad8bddc67eceb0387a00c7e11e8 Mon Sep 17 00:00:00 2001 From: Kiva Date: Mon, 25 Mar 2024 08:02:46 +0800 Subject: [PATCH] [Clang][XTHeadVector] implement 12.13 vwmaccu/vwmacc/vwmaccsu/vwmaccus (#87) * [Clang][XTHeadVector] implement 12.13 `vwmaccu/vwmacc/vwmaccsu/vwmaccus` * [Clang][XTHeadVector] test 12.13 `vwmaccu/vwmacc/vwmaccsu/vwmaccus` --- .../clang/Basic/riscv_vector_xtheadv.td | 20 + .../vector-widening-mul-add/thead/vwmacc.c | 367 ++++++++++++++++++ .../vector-widening-mul-add/thead/vwmaccsu.c | 367 ++++++++++++++++++ .../vector-widening-mul-add/thead/vwmaccu.c | 367 ++++++++++++++++++ .../vector-widening-mul-add/thead/vwmaccus.c | 187 +++++++++ 5 files changed, 1308 insertions(+) create mode 100644 clang/test/CodeGen/RISCV/rvv0p71-intrinsics-handcrafted/vector-widening-mul-add/thead/vwmacc.c create mode 100644 clang/test/CodeGen/RISCV/rvv0p71-intrinsics-handcrafted/vector-widening-mul-add/thead/vwmaccsu.c create mode 100644 clang/test/CodeGen/RISCV/rvv0p71-intrinsics-handcrafted/vector-widening-mul-add/thead/vwmaccu.c create mode 100644 clang/test/CodeGen/RISCV/rvv0p71-intrinsics-handcrafted/vector-widening-mul-add/thead/vwmaccus.c diff --git a/clang/include/clang/Basic/riscv_vector_xtheadv.td b/clang/include/clang/Basic/riscv_vector_xtheadv.td index f89b31ee28da1b..a85f6da4475202 100644 --- a/clang/include/clang/Basic/riscv_vector_xtheadv.td +++ b/clang/include/clang/Basic/riscv_vector_xtheadv.td @@ -61,6 +61,10 @@ multiclass RVVOp0Op1BuiltinSet> suffixes_prototypes> : RVVBuiltinSet; +multiclass RVVOutOp1Op2BuiltinSet> suffixes_prototypes> + : RVVBuiltinSet; + multiclass RVVSignedBinBuiltinSet : RVVOutOp1BuiltinSet; + defm th_vwmacc : RVVOutOp1Op2BuiltinSet<"th_vwmacc", "csi", + [["vv", "w", "wwvv"], + ["vx", "w", "wwev"]]>; + defm th_vwmaccsu : RVVOutOp1Op2BuiltinSet<"th_vwmaccsu", "csi", + [["vv", "w", "wwvUv"], + ["vx", "w", "wweUv"]]>; + defm th_vwmaccus : RVVOutOp1Op2BuiltinSet<"th_vwmaccus", "csi", + [["vx", "w", "wwUev"]]>; +} // 12.14. Vector Integer Merge Operations diff --git a/clang/test/CodeGen/RISCV/rvv0p71-intrinsics-handcrafted/vector-widening-mul-add/thead/vwmacc.c b/clang/test/CodeGen/RISCV/rvv0p71-intrinsics-handcrafted/vector-widening-mul-add/thead/vwmacc.c new file mode 100644 index 00000000000000..18dc89ede393cb --- /dev/null +++ b/clang/test/CodeGen/RISCV/rvv0p71-intrinsics-handcrafted/vector-widening-mul-add/thead/vwmacc.c @@ -0,0 +1,367 @@ +// RUN: %clang_cc1 -triple riscv64 -target-feature +xtheadvector \ +// RUN: -disable-O0-optnone -emit-llvm %s -o - | \ +// RUN: opt -S -passes=mem2reg | \ +// RUN: FileCheck --check-prefix=CHECK-RV64 %s + +#include + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vv_i16m2 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.nxv8i16.nxv8i8.nxv8i8.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m2_t test_vwmacc_vv_i16m2(vint16m2_t vd, vint8m1_t vs1, vint8m1_t vs2, size_t vl) { + return __riscv_th_vwmacc_vv_i16m2(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vx_i16m2 +// CHECK-RV64-SAME: ( [[VD:%.*]], i8 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.nxv8i16.i8.nxv8i8.i64( [[VD]], i8 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m2_t test_vwmacc_vx_i16m2(vint16m2_t vd, int8_t rs1, vint8m1_t vs2, size_t vl) { + return __riscv_th_vwmacc_vx_i16m2(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vv_i16m4 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.nxv16i16.nxv16i8.nxv16i8.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m4_t test_vwmacc_vv_i16m4(vint16m4_t vd, vint8m2_t vs1, vint8m2_t vs2, size_t vl) { + return __riscv_th_vwmacc_vv_i16m4(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vx_i16m4 +// CHECK-RV64-SAME: ( [[VD:%.*]], i8 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.nxv16i16.i8.nxv16i8.i64( [[VD]], i8 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m4_t test_vwmacc_vx_i16m4(vint16m4_t vd, int8_t rs1, vint8m2_t vs2, size_t vl) { + return __riscv_th_vwmacc_vx_i16m4(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vv_i16m8 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.nxv32i16.nxv32i8.nxv32i8.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m8_t test_vwmacc_vv_i16m8(vint16m8_t vd, vint8m4_t vs1, vint8m4_t vs2, size_t vl) { + return __riscv_th_vwmacc_vv_i16m8(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vx_i16m8 +// CHECK-RV64-SAME: ( [[VD:%.*]], i8 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.nxv32i16.i8.nxv32i8.i64( [[VD]], i8 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m8_t test_vwmacc_vx_i16m8(vint16m8_t vd, int8_t rs1, vint8m4_t vs2, size_t vl) { + return __riscv_th_vwmacc_vx_i16m8(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vv_i32m2 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.nxv4i32.nxv4i16.nxv4i16.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m2_t test_vwmacc_vv_i32m2(vint32m2_t vd, vint16m1_t vs1, vint16m1_t vs2, size_t vl) { + return __riscv_th_vwmacc_vv_i32m2(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vx_i32m2 +// CHECK-RV64-SAME: ( [[VD:%.*]], i16 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.nxv4i32.i16.nxv4i16.i64( [[VD]], i16 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m2_t test_vwmacc_vx_i32m2(vint32m2_t vd, int16_t rs1, vint16m1_t vs2, size_t vl) { + return __riscv_th_vwmacc_vx_i32m2(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vv_i32m4 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.nxv8i32.nxv8i16.nxv8i16.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m4_t test_vwmacc_vv_i32m4(vint32m4_t vd, vint16m2_t vs1, vint16m2_t vs2, size_t vl) { + return __riscv_th_vwmacc_vv_i32m4(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vx_i32m4 +// CHECK-RV64-SAME: ( [[VD:%.*]], i16 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.nxv8i32.i16.nxv8i16.i64( [[VD]], i16 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m4_t test_vwmacc_vx_i32m4(vint32m4_t vd, int16_t rs1, vint16m2_t vs2, size_t vl) { + return __riscv_th_vwmacc_vx_i32m4(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vv_i32m8 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.nxv16i32.nxv16i16.nxv16i16.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m8_t test_vwmacc_vv_i32m8(vint32m8_t vd, vint16m4_t vs1, vint16m4_t vs2, size_t vl) { + return __riscv_th_vwmacc_vv_i32m8(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vx_i32m8 +// CHECK-RV64-SAME: ( [[VD:%.*]], i16 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.nxv16i32.i16.nxv16i16.i64( [[VD]], i16 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m8_t test_vwmacc_vx_i32m8(vint32m8_t vd, int16_t rs1, vint16m4_t vs2, size_t vl) { + return __riscv_th_vwmacc_vx_i32m8(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vv_i64m2 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.nxv2i64.nxv2i32.nxv2i32.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m2_t test_vwmacc_vv_i64m2(vint64m2_t vd, vint32m1_t vs1, vint32m1_t vs2, size_t vl) { + return __riscv_th_vwmacc_vv_i64m2(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vx_i64m2 +// CHECK-RV64-SAME: ( [[VD:%.*]], i32 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.nxv2i64.i32.nxv2i32.i64( [[VD]], i32 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m2_t test_vwmacc_vx_i64m2(vint64m2_t vd, int32_t rs1, vint32m1_t vs2, size_t vl) { + return __riscv_th_vwmacc_vx_i64m2(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vv_i64m4 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.nxv4i64.nxv4i32.nxv4i32.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m4_t test_vwmacc_vv_i64m4(vint64m4_t vd, vint32m2_t vs1, vint32m2_t vs2, size_t vl) { + return __riscv_th_vwmacc_vv_i64m4(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vx_i64m4 +// CHECK-RV64-SAME: ( [[VD:%.*]], i32 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.nxv4i64.i32.nxv4i32.i64( [[VD]], i32 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m4_t test_vwmacc_vx_i64m4(vint64m4_t vd, int32_t rs1, vint32m2_t vs2, size_t vl) { + return __riscv_th_vwmacc_vx_i64m4(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vv_i64m8 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.nxv8i64.nxv8i32.nxv8i32.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m8_t test_vwmacc_vv_i64m8(vint64m8_t vd, vint32m4_t vs1, vint32m4_t vs2, size_t vl) { + return __riscv_th_vwmacc_vv_i64m8(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vx_i64m8 +// CHECK-RV64-SAME: ( [[VD:%.*]], i32 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.nxv8i64.i32.nxv8i32.i64( [[VD]], i32 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m8_t test_vwmacc_vx_i64m8(vint64m8_t vd, int32_t rs1, vint32m4_t vs2, size_t vl) { + return __riscv_th_vwmacc_vx_i64m8(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vv_i16m2_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.mask.nxv8i16.nxv8i8.nxv8i8.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m2_t test_vwmacc_vv_i16m2_m(vbool8_t mask, vint16m2_t vd, vint8m1_t vs1, vint8m1_t vs2, size_t vl) { + return __riscv_th_vwmacc_vv_i16m2_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vx_i16m2_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i8 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.mask.nxv8i16.i8.nxv8i8.i64( [[VD]], i8 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m2_t test_vwmacc_vx_i16m2_m(vbool8_t mask, vint16m2_t vd, int8_t rs1, vint8m1_t vs2, size_t vl) { + return __riscv_th_vwmacc_vx_i16m2_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vv_i16m4_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.mask.nxv16i16.nxv16i8.nxv16i8.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m4_t test_vwmacc_vv_i16m4_m(vbool4_t mask, vint16m4_t vd, vint8m2_t vs1, vint8m2_t vs2, size_t vl) { + return __riscv_th_vwmacc_vv_i16m4_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vx_i16m4_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i8 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.mask.nxv16i16.i8.nxv16i8.i64( [[VD]], i8 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m4_t test_vwmacc_vx_i16m4_m(vbool4_t mask, vint16m4_t vd, int8_t rs1, vint8m2_t vs2, size_t vl) { + return __riscv_th_vwmacc_vx_i16m4_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vv_i16m8_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.mask.nxv32i16.nxv32i8.nxv32i8.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m8_t test_vwmacc_vv_i16m8_m(vbool2_t mask, vint16m8_t vd, vint8m4_t vs1, vint8m4_t vs2, size_t vl) { + return __riscv_th_vwmacc_vv_i16m8_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vx_i16m8_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i8 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.mask.nxv32i16.i8.nxv32i8.i64( [[VD]], i8 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m8_t test_vwmacc_vx_i16m8_m(vbool2_t mask, vint16m8_t vd, int8_t rs1, vint8m4_t vs2, size_t vl) { + return __riscv_th_vwmacc_vx_i16m8_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vv_i32m2_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.mask.nxv4i32.nxv4i16.nxv4i16.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m2_t test_vwmacc_vv_i32m2_m(vbool16_t mask, vint32m2_t vd, vint16m1_t vs1, vint16m1_t vs2, size_t vl) { + return __riscv_th_vwmacc_vv_i32m2_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vx_i32m2_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i16 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.mask.nxv4i32.i16.nxv4i16.i64( [[VD]], i16 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m2_t test_vwmacc_vx_i32m2_m(vbool16_t mask, vint32m2_t vd, int16_t rs1, vint16m1_t vs2, size_t vl) { + return __riscv_th_vwmacc_vx_i32m2_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vv_i32m4_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.mask.nxv8i32.nxv8i16.nxv8i16.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m4_t test_vwmacc_vv_i32m4_m(vbool8_t mask, vint32m4_t vd, vint16m2_t vs1, vint16m2_t vs2, size_t vl) { + return __riscv_th_vwmacc_vv_i32m4_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vx_i32m4_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i16 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.mask.nxv8i32.i16.nxv8i16.i64( [[VD]], i16 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m4_t test_vwmacc_vx_i32m4_m(vbool8_t mask, vint32m4_t vd, int16_t rs1, vint16m2_t vs2, size_t vl) { + return __riscv_th_vwmacc_vx_i32m4_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vv_i32m8_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.mask.nxv16i32.nxv16i16.nxv16i16.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m8_t test_vwmacc_vv_i32m8_m(vbool4_t mask, vint32m8_t vd, vint16m4_t vs1, vint16m4_t vs2, size_t vl) { + return __riscv_th_vwmacc_vv_i32m8_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vx_i32m8_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i16 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.mask.nxv16i32.i16.nxv16i16.i64( [[VD]], i16 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m8_t test_vwmacc_vx_i32m8_m(vbool4_t mask, vint32m8_t vd, int16_t rs1, vint16m4_t vs2, size_t vl) { + return __riscv_th_vwmacc_vx_i32m8_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vv_i64m2_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.mask.nxv2i64.nxv2i32.nxv2i32.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m2_t test_vwmacc_vv_i64m2_m(vbool32_t mask, vint64m2_t vd, vint32m1_t vs1, vint32m1_t vs2, size_t vl) { + return __riscv_th_vwmacc_vv_i64m2_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vx_i64m2_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i32 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.mask.nxv2i64.i32.nxv2i32.i64( [[VD]], i32 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m2_t test_vwmacc_vx_i64m2_m(vbool32_t mask, vint64m2_t vd, int32_t rs1, vint32m1_t vs2, size_t vl) { + return __riscv_th_vwmacc_vx_i64m2_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vv_i64m4_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.mask.nxv4i64.nxv4i32.nxv4i32.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m4_t test_vwmacc_vv_i64m4_m(vbool16_t mask, vint64m4_t vd, vint32m2_t vs1, vint32m2_t vs2, size_t vl) { + return __riscv_th_vwmacc_vv_i64m4_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vx_i64m4_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i32 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.mask.nxv4i64.i32.nxv4i32.i64( [[VD]], i32 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m4_t test_vwmacc_vx_i64m4_m(vbool16_t mask, vint64m4_t vd, int32_t rs1, vint32m2_t vs2, size_t vl) { + return __riscv_th_vwmacc_vx_i64m4_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vv_i64m8_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.mask.nxv8i64.nxv8i32.nxv8i32.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m8_t test_vwmacc_vv_i64m8_m(vbool8_t mask, vint64m8_t vd, vint32m4_t vs1, vint32m4_t vs2, size_t vl) { + return __riscv_th_vwmacc_vv_i64m8_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmacc_vx_i64m8_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i32 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmacc.mask.nxv8i64.i32.nxv8i32.i64( [[VD]], i32 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m8_t test_vwmacc_vx_i64m8_m(vbool8_t mask, vint64m8_t vd, int32_t rs1, vint32m4_t vs2, size_t vl) { + return __riscv_th_vwmacc_vx_i64m8_m(mask, vd, rs1, vs2, vl); +} + diff --git a/clang/test/CodeGen/RISCV/rvv0p71-intrinsics-handcrafted/vector-widening-mul-add/thead/vwmaccsu.c b/clang/test/CodeGen/RISCV/rvv0p71-intrinsics-handcrafted/vector-widening-mul-add/thead/vwmaccsu.c new file mode 100644 index 00000000000000..3a36e546ed4608 --- /dev/null +++ b/clang/test/CodeGen/RISCV/rvv0p71-intrinsics-handcrafted/vector-widening-mul-add/thead/vwmaccsu.c @@ -0,0 +1,367 @@ +// RUN: %clang_cc1 -triple riscv64 -target-feature +xtheadvector \ +// RUN: -disable-O0-optnone -emit-llvm %s -o - | \ +// RUN: opt -S -passes=mem2reg | \ +// RUN: FileCheck --check-prefix=CHECK-RV64 %s + +#include + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vv_i16m2 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.nxv8i16.nxv8i8.nxv8i8.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m2_t test_vwmaccsu_vv_i16m2(vint16m2_t vd, vint8m1_t vs1, vuint8m1_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vv_i16m2(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vx_i16m2 +// CHECK-RV64-SAME: ( [[VD:%.*]], i8 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.nxv8i16.i8.nxv8i8.i64( [[VD]], i8 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m2_t test_vwmaccsu_vx_i16m2(vint16m2_t vd, int8_t rs1, vuint8m1_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vx_i16m2(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vv_i16m4 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.nxv16i16.nxv16i8.nxv16i8.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m4_t test_vwmaccsu_vv_i16m4(vint16m4_t vd, vint8m2_t vs1, vuint8m2_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vv_i16m4(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vx_i16m4 +// CHECK-RV64-SAME: ( [[VD:%.*]], i8 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.nxv16i16.i8.nxv16i8.i64( [[VD]], i8 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m4_t test_vwmaccsu_vx_i16m4(vint16m4_t vd, int8_t rs1, vuint8m2_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vx_i16m4(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vv_i16m8 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.nxv32i16.nxv32i8.nxv32i8.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m8_t test_vwmaccsu_vv_i16m8(vint16m8_t vd, vint8m4_t vs1, vuint8m4_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vv_i16m8(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vx_i16m8 +// CHECK-RV64-SAME: ( [[VD:%.*]], i8 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.nxv32i16.i8.nxv32i8.i64( [[VD]], i8 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m8_t test_vwmaccsu_vx_i16m8(vint16m8_t vd, int8_t rs1, vuint8m4_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vx_i16m8(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vv_i32m2 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.nxv4i32.nxv4i16.nxv4i16.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m2_t test_vwmaccsu_vv_i32m2(vint32m2_t vd, vint16m1_t vs1, vuint16m1_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vv_i32m2(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vx_i32m2 +// CHECK-RV64-SAME: ( [[VD:%.*]], i16 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.nxv4i32.i16.nxv4i16.i64( [[VD]], i16 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m2_t test_vwmaccsu_vx_i32m2(vint32m2_t vd, int16_t rs1, vuint16m1_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vx_i32m2(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vv_i32m4 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.nxv8i32.nxv8i16.nxv8i16.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m4_t test_vwmaccsu_vv_i32m4(vint32m4_t vd, vint16m2_t vs1, vuint16m2_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vv_i32m4(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vx_i32m4 +// CHECK-RV64-SAME: ( [[VD:%.*]], i16 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.nxv8i32.i16.nxv8i16.i64( [[VD]], i16 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m4_t test_vwmaccsu_vx_i32m4(vint32m4_t vd, int16_t rs1, vuint16m2_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vx_i32m4(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vv_i32m8 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.nxv16i32.nxv16i16.nxv16i16.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m8_t test_vwmaccsu_vv_i32m8(vint32m8_t vd, vint16m4_t vs1, vuint16m4_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vv_i32m8(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vx_i32m8 +// CHECK-RV64-SAME: ( [[VD:%.*]], i16 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.nxv16i32.i16.nxv16i16.i64( [[VD]], i16 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m8_t test_vwmaccsu_vx_i32m8(vint32m8_t vd, int16_t rs1, vuint16m4_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vx_i32m8(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vv_i64m2 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.nxv2i64.nxv2i32.nxv2i32.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m2_t test_vwmaccsu_vv_i64m2(vint64m2_t vd, vint32m1_t vs1, vuint32m1_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vv_i64m2(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vx_i64m2 +// CHECK-RV64-SAME: ( [[VD:%.*]], i32 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.nxv2i64.i32.nxv2i32.i64( [[VD]], i32 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m2_t test_vwmaccsu_vx_i64m2(vint64m2_t vd, int32_t rs1, vuint32m1_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vx_i64m2(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vv_i64m4 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.nxv4i64.nxv4i32.nxv4i32.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m4_t test_vwmaccsu_vv_i64m4(vint64m4_t vd, vint32m2_t vs1, vuint32m2_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vv_i64m4(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vx_i64m4 +// CHECK-RV64-SAME: ( [[VD:%.*]], i32 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.nxv4i64.i32.nxv4i32.i64( [[VD]], i32 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m4_t test_vwmaccsu_vx_i64m4(vint64m4_t vd, int32_t rs1, vuint32m2_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vx_i64m4(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vv_i64m8 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.nxv8i64.nxv8i32.nxv8i32.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m8_t test_vwmaccsu_vv_i64m8(vint64m8_t vd, vint32m4_t vs1, vuint32m4_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vv_i64m8(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vx_i64m8 +// CHECK-RV64-SAME: ( [[VD:%.*]], i32 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.nxv8i64.i32.nxv8i32.i64( [[VD]], i32 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m8_t test_vwmaccsu_vx_i64m8(vint64m8_t vd, int32_t rs1, vuint32m4_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vx_i64m8(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vv_i16m2_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.mask.nxv8i16.nxv8i8.nxv8i8.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m2_t test_vwmaccsu_vv_i16m2_m(vbool8_t mask, vint16m2_t vd, vint8m1_t vs1, vuint8m1_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vv_i16m2_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vx_i16m2_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i8 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.mask.nxv8i16.i8.nxv8i8.i64( [[VD]], i8 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m2_t test_vwmaccsu_vx_i16m2_m(vbool8_t mask, vint16m2_t vd, int8_t rs1, vuint8m1_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vx_i16m2_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vv_i16m4_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.mask.nxv16i16.nxv16i8.nxv16i8.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m4_t test_vwmaccsu_vv_i16m4_m(vbool4_t mask, vint16m4_t vd, vint8m2_t vs1, vuint8m2_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vv_i16m4_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vx_i16m4_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i8 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.mask.nxv16i16.i8.nxv16i8.i64( [[VD]], i8 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m4_t test_vwmaccsu_vx_i16m4_m(vbool4_t mask, vint16m4_t vd, int8_t rs1, vuint8m2_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vx_i16m4_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vv_i16m8_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.mask.nxv32i16.nxv32i8.nxv32i8.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m8_t test_vwmaccsu_vv_i16m8_m(vbool2_t mask, vint16m8_t vd, vint8m4_t vs1, vuint8m4_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vv_i16m8_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vx_i16m8_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i8 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.mask.nxv32i16.i8.nxv32i8.i64( [[VD]], i8 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m8_t test_vwmaccsu_vx_i16m8_m(vbool2_t mask, vint16m8_t vd, int8_t rs1, vuint8m4_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vx_i16m8_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vv_i32m2_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.mask.nxv4i32.nxv4i16.nxv4i16.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m2_t test_vwmaccsu_vv_i32m2_m(vbool16_t mask, vint32m2_t vd, vint16m1_t vs1, vuint16m1_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vv_i32m2_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vx_i32m2_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i16 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.mask.nxv4i32.i16.nxv4i16.i64( [[VD]], i16 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m2_t test_vwmaccsu_vx_i32m2_m(vbool16_t mask, vint32m2_t vd, int16_t rs1, vuint16m1_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vx_i32m2_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vv_i32m4_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.mask.nxv8i32.nxv8i16.nxv8i16.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m4_t test_vwmaccsu_vv_i32m4_m(vbool8_t mask, vint32m4_t vd, vint16m2_t vs1, vuint16m2_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vv_i32m4_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vx_i32m4_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i16 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.mask.nxv8i32.i16.nxv8i16.i64( [[VD]], i16 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m4_t test_vwmaccsu_vx_i32m4_m(vbool8_t mask, vint32m4_t vd, int16_t rs1, vuint16m2_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vx_i32m4_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vv_i32m8_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.mask.nxv16i32.nxv16i16.nxv16i16.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m8_t test_vwmaccsu_vv_i32m8_m(vbool4_t mask, vint32m8_t vd, vint16m4_t vs1, vuint16m4_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vv_i32m8_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vx_i32m8_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i16 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.mask.nxv16i32.i16.nxv16i16.i64( [[VD]], i16 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m8_t test_vwmaccsu_vx_i32m8_m(vbool4_t mask, vint32m8_t vd, int16_t rs1, vuint16m4_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vx_i32m8_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vv_i64m2_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.mask.nxv2i64.nxv2i32.nxv2i32.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m2_t test_vwmaccsu_vv_i64m2_m(vbool32_t mask, vint64m2_t vd, vint32m1_t vs1, vuint32m1_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vv_i64m2_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vx_i64m2_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i32 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.mask.nxv2i64.i32.nxv2i32.i64( [[VD]], i32 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m2_t test_vwmaccsu_vx_i64m2_m(vbool32_t mask, vint64m2_t vd, int32_t rs1, vuint32m1_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vx_i64m2_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vv_i64m4_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.mask.nxv4i64.nxv4i32.nxv4i32.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m4_t test_vwmaccsu_vv_i64m4_m(vbool16_t mask, vint64m4_t vd, vint32m2_t vs1, vuint32m2_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vv_i64m4_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vx_i64m4_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i32 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.mask.nxv4i64.i32.nxv4i32.i64( [[VD]], i32 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m4_t test_vwmaccsu_vx_i64m4_m(vbool16_t mask, vint64m4_t vd, int32_t rs1, vuint32m2_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vx_i64m4_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vv_i64m8_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.mask.nxv8i64.nxv8i32.nxv8i32.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m8_t test_vwmaccsu_vv_i64m8_m(vbool8_t mask, vint64m8_t vd, vint32m4_t vs1, vuint32m4_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vv_i64m8_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccsu_vx_i64m8_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i32 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccsu.mask.nxv8i64.i32.nxv8i32.i64( [[VD]], i32 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m8_t test_vwmaccsu_vx_i64m8_m(vbool8_t mask, vint64m8_t vd, int32_t rs1, vuint32m4_t vs2, size_t vl) { + return __riscv_th_vwmaccsu_vx_i64m8_m(mask, vd, rs1, vs2, vl); +} + diff --git a/clang/test/CodeGen/RISCV/rvv0p71-intrinsics-handcrafted/vector-widening-mul-add/thead/vwmaccu.c b/clang/test/CodeGen/RISCV/rvv0p71-intrinsics-handcrafted/vector-widening-mul-add/thead/vwmaccu.c new file mode 100644 index 00000000000000..e568981e877e5b --- /dev/null +++ b/clang/test/CodeGen/RISCV/rvv0p71-intrinsics-handcrafted/vector-widening-mul-add/thead/vwmaccu.c @@ -0,0 +1,367 @@ +// RUN: %clang_cc1 -triple riscv64 -target-feature +xtheadvector \ +// RUN: -disable-O0-optnone -emit-llvm %s -o - | \ +// RUN: opt -S -passes=mem2reg | \ +// RUN: FileCheck --check-prefix=CHECK-RV64 %s + +#include + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vv_u16m2 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.nxv8i16.nxv8i8.nxv8i8.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint16m2_t test_vwmaccu_vv_u16m2(vuint16m2_t vd, vuint8m1_t vs1, vuint8m1_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vv_u16m2(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vx_u16m2 +// CHECK-RV64-SAME: ( [[VD:%.*]], i8 noundef zeroext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.nxv8i16.i8.nxv8i8.i64( [[VD]], i8 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint16m2_t test_vwmaccu_vx_u16m2(vuint16m2_t vd, uint8_t rs1, vuint8m1_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vx_u16m2(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vv_u16m4 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.nxv16i16.nxv16i8.nxv16i8.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint16m4_t test_vwmaccu_vv_u16m4(vuint16m4_t vd, vuint8m2_t vs1, vuint8m2_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vv_u16m4(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vx_u16m4 +// CHECK-RV64-SAME: ( [[VD:%.*]], i8 noundef zeroext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.nxv16i16.i8.nxv16i8.i64( [[VD]], i8 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint16m4_t test_vwmaccu_vx_u16m4(vuint16m4_t vd, uint8_t rs1, vuint8m2_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vx_u16m4(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vv_u16m8 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.nxv32i16.nxv32i8.nxv32i8.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint16m8_t test_vwmaccu_vv_u16m8(vuint16m8_t vd, vuint8m4_t vs1, vuint8m4_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vv_u16m8(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vx_u16m8 +// CHECK-RV64-SAME: ( [[VD:%.*]], i8 noundef zeroext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.nxv32i16.i8.nxv32i8.i64( [[VD]], i8 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint16m8_t test_vwmaccu_vx_u16m8(vuint16m8_t vd, uint8_t rs1, vuint8m4_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vx_u16m8(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vv_u32m2 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.nxv4i32.nxv4i16.nxv4i16.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint32m2_t test_vwmaccu_vv_u32m2(vuint32m2_t vd, vuint16m1_t vs1, vuint16m1_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vv_u32m2(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vx_u32m2 +// CHECK-RV64-SAME: ( [[VD:%.*]], i16 noundef zeroext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.nxv4i32.i16.nxv4i16.i64( [[VD]], i16 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint32m2_t test_vwmaccu_vx_u32m2(vuint32m2_t vd, uint16_t rs1, vuint16m1_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vx_u32m2(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vv_u32m4 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.nxv8i32.nxv8i16.nxv8i16.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint32m4_t test_vwmaccu_vv_u32m4(vuint32m4_t vd, vuint16m2_t vs1, vuint16m2_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vv_u32m4(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vx_u32m4 +// CHECK-RV64-SAME: ( [[VD:%.*]], i16 noundef zeroext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.nxv8i32.i16.nxv8i16.i64( [[VD]], i16 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint32m4_t test_vwmaccu_vx_u32m4(vuint32m4_t vd, uint16_t rs1, vuint16m2_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vx_u32m4(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vv_u32m8 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.nxv16i32.nxv16i16.nxv16i16.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint32m8_t test_vwmaccu_vv_u32m8(vuint32m8_t vd, vuint16m4_t vs1, vuint16m4_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vv_u32m8(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vx_u32m8 +// CHECK-RV64-SAME: ( [[VD:%.*]], i16 noundef zeroext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.nxv16i32.i16.nxv16i16.i64( [[VD]], i16 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint32m8_t test_vwmaccu_vx_u32m8(vuint32m8_t vd, uint16_t rs1, vuint16m4_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vx_u32m8(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vv_u64m2 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.nxv2i64.nxv2i32.nxv2i32.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint64m2_t test_vwmaccu_vv_u64m2(vuint64m2_t vd, vuint32m1_t vs1, vuint32m1_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vv_u64m2(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vx_u64m2 +// CHECK-RV64-SAME: ( [[VD:%.*]], i32 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.nxv2i64.i32.nxv2i32.i64( [[VD]], i32 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint64m2_t test_vwmaccu_vx_u64m2(vuint64m2_t vd, uint32_t rs1, vuint32m1_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vx_u64m2(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vv_u64m4 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.nxv4i64.nxv4i32.nxv4i32.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint64m4_t test_vwmaccu_vv_u64m4(vuint64m4_t vd, vuint32m2_t vs1, vuint32m2_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vv_u64m4(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vx_u64m4 +// CHECK-RV64-SAME: ( [[VD:%.*]], i32 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.nxv4i64.i32.nxv4i32.i64( [[VD]], i32 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint64m4_t test_vwmaccu_vx_u64m4(vuint64m4_t vd, uint32_t rs1, vuint32m2_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vx_u64m4(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vv_u64m8 +// CHECK-RV64-SAME: ( [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.nxv8i64.nxv8i32.nxv8i32.i64( [[VD]], [[VS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint64m8_t test_vwmaccu_vv_u64m8(vuint64m8_t vd, vuint32m4_t vs1, vuint32m4_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vv_u64m8(vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vx_u64m8 +// CHECK-RV64-SAME: ( [[VD:%.*]], i32 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.nxv8i64.i32.nxv8i32.i64( [[VD]], i32 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint64m8_t test_vwmaccu_vx_u64m8(vuint64m8_t vd, uint32_t rs1, vuint32m4_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vx_u64m8(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vv_u16m2_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.mask.nxv8i16.nxv8i8.nxv8i8.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint16m2_t test_vwmaccu_vv_u16m2_m(vbool8_t mask, vuint16m2_t vd, vuint8m1_t vs1, vuint8m1_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vv_u16m2_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vx_u16m2_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i8 noundef zeroext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.mask.nxv8i16.i8.nxv8i8.i64( [[VD]], i8 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint16m2_t test_vwmaccu_vx_u16m2_m(vbool8_t mask, vuint16m2_t vd, uint8_t rs1, vuint8m1_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vx_u16m2_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vv_u16m4_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.mask.nxv16i16.nxv16i8.nxv16i8.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint16m4_t test_vwmaccu_vv_u16m4_m(vbool4_t mask, vuint16m4_t vd, vuint8m2_t vs1, vuint8m2_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vv_u16m4_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vx_u16m4_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i8 noundef zeroext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.mask.nxv16i16.i8.nxv16i8.i64( [[VD]], i8 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint16m4_t test_vwmaccu_vx_u16m4_m(vbool4_t mask, vuint16m4_t vd, uint8_t rs1, vuint8m2_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vx_u16m4_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vv_u16m8_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.mask.nxv32i16.nxv32i8.nxv32i8.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint16m8_t test_vwmaccu_vv_u16m8_m(vbool2_t mask, vuint16m8_t vd, vuint8m4_t vs1, vuint8m4_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vv_u16m8_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vx_u16m8_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i8 noundef zeroext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.mask.nxv32i16.i8.nxv32i8.i64( [[VD]], i8 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint16m8_t test_vwmaccu_vx_u16m8_m(vbool2_t mask, vuint16m8_t vd, uint8_t rs1, vuint8m4_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vx_u16m8_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vv_u32m2_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.mask.nxv4i32.nxv4i16.nxv4i16.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint32m2_t test_vwmaccu_vv_u32m2_m(vbool16_t mask, vuint32m2_t vd, vuint16m1_t vs1, vuint16m1_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vv_u32m2_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vx_u32m2_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i16 noundef zeroext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.mask.nxv4i32.i16.nxv4i16.i64( [[VD]], i16 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint32m2_t test_vwmaccu_vx_u32m2_m(vbool16_t mask, vuint32m2_t vd, uint16_t rs1, vuint16m1_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vx_u32m2_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vv_u32m4_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.mask.nxv8i32.nxv8i16.nxv8i16.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint32m4_t test_vwmaccu_vv_u32m4_m(vbool8_t mask, vuint32m4_t vd, vuint16m2_t vs1, vuint16m2_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vv_u32m4_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vx_u32m4_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i16 noundef zeroext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.mask.nxv8i32.i16.nxv8i16.i64( [[VD]], i16 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint32m4_t test_vwmaccu_vx_u32m4_m(vbool8_t mask, vuint32m4_t vd, uint16_t rs1, vuint16m2_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vx_u32m4_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vv_u32m8_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.mask.nxv16i32.nxv16i16.nxv16i16.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint32m8_t test_vwmaccu_vv_u32m8_m(vbool4_t mask, vuint32m8_t vd, vuint16m4_t vs1, vuint16m4_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vv_u32m8_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vx_u32m8_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i16 noundef zeroext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.mask.nxv16i32.i16.nxv16i16.i64( [[VD]], i16 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint32m8_t test_vwmaccu_vx_u32m8_m(vbool4_t mask, vuint32m8_t vd, uint16_t rs1, vuint16m4_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vx_u32m8_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vv_u64m2_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.mask.nxv2i64.nxv2i32.nxv2i32.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint64m2_t test_vwmaccu_vv_u64m2_m(vbool32_t mask, vuint64m2_t vd, vuint32m1_t vs1, vuint32m1_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vv_u64m2_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vx_u64m2_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i32 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.mask.nxv2i64.i32.nxv2i32.i64( [[VD]], i32 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint64m2_t test_vwmaccu_vx_u64m2_m(vbool32_t mask, vuint64m2_t vd, uint32_t rs1, vuint32m1_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vx_u64m2_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vv_u64m4_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.mask.nxv4i64.nxv4i32.nxv4i32.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint64m4_t test_vwmaccu_vv_u64m4_m(vbool16_t mask, vuint64m4_t vd, vuint32m2_t vs1, vuint32m2_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vv_u64m4_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vx_u64m4_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i32 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.mask.nxv4i64.i32.nxv4i32.i64( [[VD]], i32 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint64m4_t test_vwmaccu_vx_u64m4_m(vbool16_t mask, vuint64m4_t vd, uint32_t rs1, vuint32m2_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vx_u64m4_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vv_u64m8_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], [[VS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.mask.nxv8i64.nxv8i32.nxv8i32.i64( [[VD]], [[VS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint64m8_t test_vwmaccu_vv_u64m8_m(vbool8_t mask, vuint64m8_t vd, vuint32m4_t vs1, vuint32m4_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vv_u64m8_m(mask, vd, vs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccu_vx_u64m8_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i32 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccu.mask.nxv8i64.i32.nxv8i32.i64( [[VD]], i32 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vuint64m8_t test_vwmaccu_vx_u64m8_m(vbool8_t mask, vuint64m8_t vd, uint32_t rs1, vuint32m4_t vs2, size_t vl) { + return __riscv_th_vwmaccu_vx_u64m8_m(mask, vd, rs1, vs2, vl); +} + diff --git a/clang/test/CodeGen/RISCV/rvv0p71-intrinsics-handcrafted/vector-widening-mul-add/thead/vwmaccus.c b/clang/test/CodeGen/RISCV/rvv0p71-intrinsics-handcrafted/vector-widening-mul-add/thead/vwmaccus.c new file mode 100644 index 00000000000000..4d53e7d09201cb --- /dev/null +++ b/clang/test/CodeGen/RISCV/rvv0p71-intrinsics-handcrafted/vector-widening-mul-add/thead/vwmaccus.c @@ -0,0 +1,187 @@ +// RUN: %clang_cc1 -triple riscv64 -target-feature +xtheadvector \ +// RUN: -disable-O0-optnone -emit-llvm %s -o - | \ +// RUN: opt -S -passes=mem2reg | \ +// RUN: FileCheck --check-prefix=CHECK-RV64 %s + +#include + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccus_vx_i16m2 +// CHECK-RV64-SAME: ( [[VD:%.*]], i8 noundef zeroext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccus.nxv8i16.i8.nxv8i8.i64( [[VD]], i8 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m2_t test_vwmaccus_vx_i16m2(vint16m2_t vd, uint8_t rs1, vint8m1_t vs2, size_t vl) { + return __riscv_th_vwmaccus_vx_i16m2(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccus_vx_i16m4 +// CHECK-RV64-SAME: ( [[VD:%.*]], i8 noundef zeroext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccus.nxv16i16.i8.nxv16i8.i64( [[VD]], i8 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m4_t test_vwmaccus_vx_i16m4(vint16m4_t vd, uint8_t rs1, vint8m2_t vs2, size_t vl) { + return __riscv_th_vwmaccus_vx_i16m4(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccus_vx_i16m8 +// CHECK-RV64-SAME: ( [[VD:%.*]], i8 noundef zeroext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccus.nxv32i16.i8.nxv32i8.i64( [[VD]], i8 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m8_t test_vwmaccus_vx_i16m8(vint16m8_t vd, uint8_t rs1, vint8m4_t vs2, size_t vl) { + return __riscv_th_vwmaccus_vx_i16m8(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccus_vx_i32m2 +// CHECK-RV64-SAME: ( [[VD:%.*]], i16 noundef zeroext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccus.nxv4i32.i16.nxv4i16.i64( [[VD]], i16 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m2_t test_vwmaccus_vx_i32m2(vint32m2_t vd, uint16_t rs1, vint16m1_t vs2, size_t vl) { + return __riscv_th_vwmaccus_vx_i32m2(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccus_vx_i32m4 +// CHECK-RV64-SAME: ( [[VD:%.*]], i16 noundef zeroext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccus.nxv8i32.i16.nxv8i16.i64( [[VD]], i16 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m4_t test_vwmaccus_vx_i32m4(vint32m4_t vd, uint16_t rs1, vint16m2_t vs2, size_t vl) { + return __riscv_th_vwmaccus_vx_i32m4(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccus_vx_i32m8 +// CHECK-RV64-SAME: ( [[VD:%.*]], i16 noundef zeroext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccus.nxv16i32.i16.nxv16i16.i64( [[VD]], i16 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m8_t test_vwmaccus_vx_i32m8(vint32m8_t vd, uint16_t rs1, vint16m4_t vs2, size_t vl) { + return __riscv_th_vwmaccus_vx_i32m8(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccus_vx_i64m2 +// CHECK-RV64-SAME: ( [[VD:%.*]], i32 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccus.nxv2i64.i32.nxv2i32.i64( [[VD]], i32 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m2_t test_vwmaccus_vx_i64m2(vint64m2_t vd, uint32_t rs1, vint32m1_t vs2, size_t vl) { + return __riscv_th_vwmaccus_vx_i64m2(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccus_vx_i64m4 +// CHECK-RV64-SAME: ( [[VD:%.*]], i32 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccus.nxv4i64.i32.nxv4i32.i64( [[VD]], i32 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m4_t test_vwmaccus_vx_i64m4(vint64m4_t vd, uint32_t rs1, vint32m2_t vs2, size_t vl) { + return __riscv_th_vwmaccus_vx_i64m4(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccus_vx_i64m8 +// CHECK-RV64-SAME: ( [[VD:%.*]], i32 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccus.nxv8i64.i32.nxv8i32.i64( [[VD]], i32 [[RS1]], [[VS2]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m8_t test_vwmaccus_vx_i64m8(vint64m8_t vd, uint32_t rs1, vint32m4_t vs2, size_t vl) { + return __riscv_th_vwmaccus_vx_i64m8(vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccus_vx_i16m2_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i8 noundef zeroext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccus.mask.nxv8i16.i8.nxv8i8.i64( [[VD]], i8 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m2_t test_vwmaccus_vx_i16m2_m(vbool8_t mask, vint16m2_t vd, uint8_t rs1, vint8m1_t vs2, size_t vl) { + return __riscv_th_vwmaccus_vx_i16m2_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccus_vx_i16m4_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i8 noundef zeroext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccus.mask.nxv16i16.i8.nxv16i8.i64( [[VD]], i8 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m4_t test_vwmaccus_vx_i16m4_m(vbool4_t mask, vint16m4_t vd, uint8_t rs1, vint8m2_t vs2, size_t vl) { + return __riscv_th_vwmaccus_vx_i16m4_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccus_vx_i16m8_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i8 noundef zeroext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccus.mask.nxv32i16.i8.nxv32i8.i64( [[VD]], i8 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint16m8_t test_vwmaccus_vx_i16m8_m(vbool2_t mask, vint16m8_t vd, uint8_t rs1, vint8m4_t vs2, size_t vl) { + return __riscv_th_vwmaccus_vx_i16m8_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccus_vx_i32m2_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i16 noundef zeroext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccus.mask.nxv4i32.i16.nxv4i16.i64( [[VD]], i16 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m2_t test_vwmaccus_vx_i32m2_m(vbool16_t mask, vint32m2_t vd, uint16_t rs1, vint16m1_t vs2, size_t vl) { + return __riscv_th_vwmaccus_vx_i32m2_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccus_vx_i32m4_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i16 noundef zeroext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccus.mask.nxv8i32.i16.nxv8i16.i64( [[VD]], i16 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m4_t test_vwmaccus_vx_i32m4_m(vbool8_t mask, vint32m4_t vd, uint16_t rs1, vint16m2_t vs2, size_t vl) { + return __riscv_th_vwmaccus_vx_i32m4_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccus_vx_i32m8_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i16 noundef zeroext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccus.mask.nxv16i32.i16.nxv16i16.i64( [[VD]], i16 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint32m8_t test_vwmaccus_vx_i32m8_m(vbool4_t mask, vint32m8_t vd, uint16_t rs1, vint16m4_t vs2, size_t vl) { + return __riscv_th_vwmaccus_vx_i32m8_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccus_vx_i64m2_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i32 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccus.mask.nxv2i64.i32.nxv2i32.i64( [[VD]], i32 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m2_t test_vwmaccus_vx_i64m2_m(vbool32_t mask, vint64m2_t vd, uint32_t rs1, vint32m1_t vs2, size_t vl) { + return __riscv_th_vwmaccus_vx_i64m2_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccus_vx_i64m4_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i32 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccus.mask.nxv4i64.i32.nxv4i32.i64( [[VD]], i32 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m4_t test_vwmaccus_vx_i64m4_m(vbool16_t mask, vint64m4_t vd, uint32_t rs1, vint32m2_t vs2, size_t vl) { + return __riscv_th_vwmaccus_vx_i64m4_m(mask, vd, rs1, vs2, vl); +} + +// CHECK-RV64-LABEL: define dso_local @test_vwmaccus_vx_i64m8_m +// CHECK-RV64-SAME: ( [[MASK:%.*]], [[VD:%.*]], i32 noundef signext [[RS1:%.*]], [[VS2:%.*]], i64 noundef [[VL:%.*]]) #[[ATTR0:[0-9]+]] { +// CHECK-RV64-NEXT: entry: +// CHECK-RV64-NEXT: [[TMP0:%.*]] = call @llvm.riscv.th.vwmaccus.mask.nxv8i64.i32.nxv8i32.i64( [[VD]], i32 [[RS1]], [[VS2]], [[MASK]], i64 [[VL]]) +// CHECK-RV64-NEXT: ret [[TMP0]] +// +vint64m8_t test_vwmaccus_vx_i64m8_m(vbool8_t mask, vint64m8_t vd, uint32_t rs1, vint32m4_t vs2, size_t vl) { + return __riscv_th_vwmaccus_vx_i64m8_m(mask, vd, rs1, vs2, vl); +} +