Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/CodeGen_RISCV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ struct RISCVIntrinsic {
const RISCVIntrinsic signed_intrinsic_defs[] = {
{"vaadd", Type::Int, "halving_add", {Type::Int, Type::Int}, AddVLArg | RoundDown | Commutes},
{"vaadd", Type::Int, "rounding_halving_add", {Type::Int, Type::Int}, AddVLArg | RoundUp | Commutes},
{"vsadd", Type::Int, "saturating_add", {Type::Int, Type::Int}, AddVLArg | Commutes},
{"vssub", Type::Int, "saturating_sub", {Type::Int, Type::Int}, AddVLArg},
{"vwadd", {Type::Int, 2}, "widening_add", {Type::Int, Type::Int}, AddVLArg | MangleReturnType | Commutes},
{"vwsub", {Type::Int, 2}, "widening_sub", {Type::Int, Type::Int}, AddVLArg | MangleReturnType},
{"vwmul", {Type::Int, 2}, "widening_mul", {Type::Int, Type::Int}, AddVLArg | MangleReturnType | Commutes},
Expand All @@ -70,6 +72,8 @@ const RISCVIntrinsic signed_intrinsic_defs[] = {
const RISCVIntrinsic unsigned_intrinsic_defs[] = {
{"vaaddu", {Type::UInt}, "halving_add", {Type::UInt, Type::UInt}, AddVLArg | RoundDown | Commutes},
{"vaaddu", {Type::UInt}, "rounding_halving_add", {Type::UInt, Type::UInt}, AddVLArg | RoundUp | Commutes},
{"vsaddu", {Type::UInt}, "saturating_add", {Type::UInt, Type::UInt}, AddVLArg | Commutes},
{"vssubu", {Type::UInt}, "saturating_sub", {Type::UInt, Type::UInt}, AddVLArg},
{"vwaddu", {Type::UInt, 2}, "widening_add", {Type::UInt, Type::UInt}, AddVLArg | MangleReturnType | Commutes},
{"vwsubu", {Type::UInt, 2}, "widening_sub", {Type::UInt, Type::UInt}, AddVLArg | MangleReturnType},
{"vwmulu", {Type::UInt, 2}, "widening_mul", {Type::UInt, Type::UInt}, AddVLArg | MangleReturnType | Commutes},
Expand Down
4 changes: 4 additions & 0 deletions test/correctness/simd_op_check_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ class SimdOpCheckRISCV : public SimdOpCheckTest {
check("vaaddu.vv", lanes, halving_add(u_1, u_2));
check("vaadd.vv", lanes, rounding_halving_add(i_1, i_2));
check("vaaddu.vv", lanes, rounding_halving_add(u_1, u_2));
check("vsadd.vv", lanes, saturating_add(i_1, i_2));
check("vsaddu.vv", lanes, saturating_add(u_1, u_2));
check("vssub.vv", lanes, saturating_sub(i_1, i_2));
check("vssubu.vv", lanes, saturating_sub(u_1, u_2));

// Widening intrinsics
if (base_bit_width < 64) {
Expand Down