Skip to content

Commit 0a18ea0

Browse files
committed
[RISCV][Clang] Add RVV vnsra, vnsrl and vwmul intrinsic functions.
Reviewed By: craig.topper Authored-by: Roger Ferrer Ibanez <[email protected]> Co-Authored-by: Zakk Chen <[email protected]> Differential Revision: https://reviews.llvm.org/D99525
1 parent 66c0560 commit 0a18ea0

File tree

7 files changed

+8474
-2
lines changed

7 files changed

+8474
-2
lines changed

clang/include/clang/Basic/riscv_vector.td

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,13 @@ multiclass RVVBuiltinSet<string intrinsic_name, string type_range,
215215
}
216216
}
217217

218+
// IntrinsicTypes is output, op0, op1 [-1, 0, 1]
219+
multiclass RVVOutOp0Op1BuiltinSet<string intrinsic_name, string type_range,
220+
list<list<string>> suffixes_prototypes> {
221+
defm NAME : RVVBuiltinSet<intrinsic_name, type_range, suffixes_prototypes,
222+
[-1, 0, 1]>;
223+
}
224+
218225
// IntrinsicTypes is output, op1 [-1, 1]
219226
multiclass RVVOutOp1BuiltinSet<string intrinsic_name, string type_range,
220227
list<list<string>> suffixes_prototypes> {
@@ -455,7 +462,14 @@ defm vsra : RVVOutOp1BuiltinSet<"vsra", "csil",
455462
["vx", "v", "vvz"]]>;
456463

457464
// 12.7. Vector Narrowing Integer Right Shift Instructions
458-
// TODO
465+
let Log2LMUL = [-3, -2, -1, 0, 1, 2] in {
466+
defm vnsrl : RVVOutOp0Op1BuiltinSet<"vnsrl", "csi",
467+
[["wv", "Uv", "UvUwUv"],
468+
["wx", "Uv", "UvUwz"]]>;
469+
defm vnsra : RVVOutOp0Op1BuiltinSet<"vnsra", "csi",
470+
[["wv", "v", "vwUv"],
471+
["wx", "v", "vwz"]]>;
472+
}
459473

460474
// 12.8. Vector Integer Comparison Instructions
461475
// TODO
@@ -481,7 +495,17 @@ defm vremu : RVVUnsignedBinBuiltinSet;
481495
defm vrem : RVVSignedBinBuiltinSet;
482496

483497
// 12.12. Vector Widening Integer Multiply Instructions
484-
// TODO
498+
let Log2LMUL = [-3, -2, -1, 0, 1, 2] in {
499+
defm vwmul : RVVOutOp0Op1BuiltinSet<"vwmul", "csi",
500+
[["vv", "w", "wvv"],
501+
["vx", "w", "wve"]]>;
502+
defm vwmulu : RVVOutOp0Op1BuiltinSet<"vwmulu", "csi",
503+
[["vv", "Uw", "UwUvUv"],
504+
["vx", "Uw", "UwUvUe"]]>;
505+
defm vwmulsu : RVVOutOp0Op1BuiltinSet<"vwmulsu", "csi",
506+
[["vv", "w", "wvUv"],
507+
["vx", "w", "wvUe"]]>;
508+
}
485509

486510
// 12.13. Vector Single-Width Integer Multiply-Add Instructions
487511
let HasMaskedOffOperand = false in {

clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vnsra.c

Lines changed: 848 additions & 0 deletions
Large diffs are not rendered by default.

clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vnsrl.c

Lines changed: 848 additions & 0 deletions
Large diffs are not rendered by default.

clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vwmul.c

Lines changed: 2528 additions & 0 deletions
Large diffs are not rendered by default.

clang/test/CodeGen/RISCV/rvv-intrinsics/vnsra.c

Lines changed: 848 additions & 0 deletions
Large diffs are not rendered by default.

clang/test/CodeGen/RISCV/rvv-intrinsics/vnsrl.c

Lines changed: 848 additions & 0 deletions
Large diffs are not rendered by default.

clang/test/CodeGen/RISCV/rvv-intrinsics/vwmul.c

Lines changed: 2528 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)