Skip to content

Commit 5a40acc

Browse files
authored
[LLVM][XTHeadVector] Implement intrinsics for vsmul. (llvm#75)
* [NFC][XTHeadVector] Update README. * [LLVM][XTHeadVector] Add test cases. * [LLVM][XTHeadVector] Define pseudos and pats. * [LLVM][XTHeadVector] Implement intrinsics for vsmul.
1 parent 0e306f8 commit 5a40acc

File tree

4 files changed

+2475
-1
lines changed

4 files changed

+2475
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Any feature not listed below but present in the specification should be consider
5252
- (Done) `12.12. Vector Single-Width Integer Multiply-Add Instructions`
5353
- (Done) `12.13. Vector Widening Integer Multiply-Add Instructions`
5454
- (Done) `12.14. Vector Integer Merge and Move Instructions`
55+
- (Done) `13.3. Vector Single-Width Fractional Multiply with Rounding and Saturation`
5556
- (WIP) Clang intrinsics related to the `XTHeadVector` extension:
5657
- (WIP) `6. Configuration-Setting and Utility`
5758
- (Done) `6.1. Set vl and vtype`

llvm/include/llvm/IR/IntrinsicsRISCVXTHeadV.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,4 +793,8 @@ let TargetPrefix = "riscv" in {
793793
let ScalarOperand = 1;
794794
let VLOperand = 2;
795795
}
796+
797+
// 13.3. Vector Single-Width Fractional Multiply with Rounding and Saturation Instructions
798+
defm th_vsmul : XVBinaryABX;
799+
796800
} // TargetPrefix = "riscv"

llvm/lib/Target/RISCV/RISCVInstrInfoXTHeadVPseudos.td

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2089,6 +2089,21 @@ multiclass XVPseudoVWMAC_VX {
20892089
}
20902090
}
20912091

2092+
multiclass XVPseudoVSMUL_VV_VX {
2093+
foreach m = MxListXTHeadV in {
2094+
defvar mx = m.MX;
2095+
defvar WriteVSIMulV_MX = !cast<SchedWrite>("WriteVSMulV_" # mx);
2096+
defvar WriteVSIMulX_MX = !cast<SchedWrite>("WriteVSMulX_" # mx);
2097+
defvar ReadVSIMulV_MX = !cast<SchedRead>("ReadVSMulV_" # mx);
2098+
defvar ReadVSIMulX_MX = !cast<SchedRead>("ReadVSMulX_" # mx);
2099+
2100+
defm "" : XVPseudoBinaryV_VV<m>,
2101+
Sched<[WriteVSIMulV_MX, ReadVSIMulV_MX, ReadVSIMulV_MX, ReadVMask]>;
2102+
defm "" : XVPseudoBinaryV_VX<m>,
2103+
Sched<[WriteVSIMulX_MX, ReadVSIMulV_MX, ReadVSIMulX_MX, ReadVMask]>;
2104+
}
2105+
}
2106+
20922107
//===----------------------------------------------------------------------===//
20932108
// Helpers to define the intrinsic patterns for the XTHeadVector extension.
20942109
//===----------------------------------------------------------------------===//
@@ -3020,4 +3035,18 @@ let Predicates = [HasVendorXTHeadV] in {
30203035
}
30213036
} // Predicates = [HasVendorXTHeadV]
30223037

3023-
include "RISCVInstrInfoXTHeadVVLPatterns.td"
3038+
//===----------------------------------------------------------------------===//
3039+
// 13.3. Vector Single-Width Fractional Multiply with Rounding and
3040+
// Saturation Instructions
3041+
//===----------------------------------------------------------------------===//
3042+
3043+
let Predicates = [HasVendorXTHeadV] in {
3044+
defm PseudoTH_VSMUL : XVPseudoVSMUL_VV_VX;
3045+
} // Predicates = [HasVendorXTHeadV]
3046+
3047+
let Predicates = [HasVendorXTHeadV] in {
3048+
defm : XVPatBinaryV_VV_VX<"int_riscv_th_vsmul", "PseudoTH_VSMUL", AllIntegerXVectors>;
3049+
// defm : XVPatBinaryV_VV_VX<"int_riscv_th_vsmul", "PseudoTH_VSMUL", AllIntegerXVectors, isSEWAware=1>;
3050+
} // Predicates = [HasVendorXTHeadV]
3051+
3052+
include "RISCVInstrInfoXTHeadVVLPatterns.td"

0 commit comments

Comments
 (0)