Skip to content

Commit f720c22

Browse files
committed
[RISCV][Clang] Add RVV Widening Integer Extension intrinsic functions.
Reviewed By: HsiangKai Authored-by: Roger Ferrer Ibanez <[email protected]> Co-Authored-by: Zakk Chen <[email protected]> Differential Revision: https://reviews.llvm.org/D99527
1 parent 0a18ea0 commit f720c22

File tree

5 files changed

+3300
-1
lines changed

5 files changed

+3300
-1
lines changed

clang/include/clang/Basic/riscv_vector.td

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,14 @@ multiclass RVVFloatingBinBuiltinSet {
259259
["vf", "v", "vve"]]>;
260260
}
261261

262+
multiclass RVVIntExt<string intrinsic_name, string suffix, string prototype,
263+
string type_range> {
264+
let IRName = intrinsic_name, IRNameMask = intrinsic_name # "_mask",
265+
MangledName = NAME, IntrinsicTypes = [-1, 0] in {
266+
def "" : RVVBuiltin<suffix, prototype, type_range>;
267+
}
268+
}
269+
262270
defvar TypeList = ["c","s","i","l","f","d"];
263271
defvar EEWList = [["8", "(Log2EEW:3)"],
264272
["16", "(Log2EEW:4)"],
@@ -438,7 +446,18 @@ defm vrsub : RVVOutOp1BuiltinSet<"vrsub", "csil",
438446
// TODO
439447

440448
// 12.3. Vector Integer Extension
441-
// TODO
449+
let Log2LMUL = [-3, -2, -1, 0, 1, 2] in {
450+
defm vsext_vf2 : RVVIntExt<"vsext", "w", "wv", "csi">;
451+
defm vzext_vf2 : RVVIntExt<"vzext", "Uw", "UwUv", "csi">;
452+
}
453+
let Log2LMUL = [-3, -2, -1, 0, 1] in {
454+
defm vsext_vf4 : RVVIntExt<"vsext", "q", "qv", "cs">;
455+
defm vzext_vf4 : RVVIntExt<"vzext", "Uq", "UqUv", "cs">;
456+
}
457+
let Log2LMUL = [-3, -2, -1, 0] in {
458+
defm vsext_vf8 : RVVIntExt<"vsext", "o", "ov", "c">;
459+
defm vzext_vf8 : RVVIntExt<"vzext", "Uo", "UoUv", "c">;
460+
}
442461

443462
// 12.4. Vector Integer Add-with-Carry / Subtract-with-Borrow Instructions
444463
// TODO

0 commit comments

Comments
 (0)