Skip to content

Commit cdecd48

Browse files
authored
[LLVM][XTHeadVector] Implement intrinsics for vwfmul. (llvm#96)
* [LLVM][XTHeadVector] Define intrinsic functions. * [LLVM][XTHeadVector] Define pseudos and pats. * [LLVM][XTHeadVector] Add test cases. * [NFC][XTHeadVector] Update Readme.
1 parent 6518c41 commit cdecd48

File tree

4 files changed

+1084
-0
lines changed

4 files changed

+1084
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Any feature not listed below but present in the specification should be consider
6161
- (Done) `14.2. Vector Single-Width Floating-Point Add/Subtract Instructions`
6262
- (Done) `14.3. Vector Widening Floating-Point Add/Subtract Instructions`
6363
- (Done) `14.4. Vector Single-Width Floating-Point Multiply/Divide Instructions`
64+
- (Done) `14.5. Vector Widening Floating-Point Multiply`
6465
- (WIP) Clang intrinsics related to the `XTHeadVector` extension:
6566
- (WIP) `6. Configuration-Setting and Utility`
6667
- (Done) `6.1. Set vl and vtype`

llvm/include/llvm/IR/IntrinsicsRISCVXTHeadV.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,9 @@ let TargetPrefix = "riscv" in {
898898
defm th_vfdiv : XVBinaryAAXRoundingMode;
899899
defm th_vfrdiv : XVBinaryAAXRoundingMode;
900900

901+
// 14.5. Vector Widening Floating-Point Multiply
902+
defm th_vfwmul : XVBinaryABXRoundingMode;
903+
901904
// 16.1. Vector Mask-Register Logical Operations
902905
def int_riscv_th_vmand: RISCVBinaryAAAUnMasked;
903906
def int_riscv_th_vmnand: RISCVBinaryAAAUnMasked;

llvm/lib/Target/RISCV/RISCVInstrInfoXTHeadVPseudos.td

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2517,6 +2517,29 @@ multiclass XVPseudoVFRDIV_VF_RM {
25172517
}
25182518
}
25192519

2520+
multiclass XVPseudoVWMUL_VV_VF_RM {
2521+
foreach m = MxListWXTHeadV in {
2522+
defvar mx = m.MX;
2523+
defvar WriteVFWMulV_MX = !cast<SchedWrite>("WriteVFWMulV_" # mx);
2524+
defvar ReadVFWMulV_MX = !cast<SchedRead>("ReadVFWMulV_" # mx);
2525+
2526+
defm "" : XVPseudoBinaryW_VV_RM<m>,
2527+
Sched<[WriteVFWMulV_MX, ReadVFWMulV_MX, ReadVFWMulV_MX, ReadVMask]>;
2528+
}
2529+
2530+
foreach f = FPListXTHeadV in {
2531+
foreach m = f.MxListFW in {
2532+
defvar mx = m.MX;
2533+
defvar WriteVFWMulF_MX = !cast<SchedWrite>("WriteVFWMulF_" # mx);
2534+
defvar ReadVFWMulV_MX = !cast<SchedRead>("ReadVFWMulV_" # mx);
2535+
defvar ReadVFWMulF_MX = !cast<SchedRead>("ReadVFWMulF_" # mx);
2536+
2537+
defm "" : XVPseudoBinaryW_VF_RM<m, f>,
2538+
Sched<[WriteVFWMulF_MX, ReadVFWMulV_MX, ReadVFWMulF_MX, ReadVMask]>;
2539+
}
2540+
}
2541+
}
2542+
25202543
multiclass XVPseudoVALU_MM {
25212544
foreach m = MxListXTHeadV in {
25222545
defvar mx = m.MX;
@@ -3980,6 +4003,18 @@ let Predicates = [HasVendorXTHeadV] in {
39804003
AllFloatXVectors, isSEWAware=1>;
39814004
} // Predicates = [HasVendorXTHeadV]
39824005

4006+
//===----------------------------------------------------------------------===//
4007+
// 14.5. Vector Single-Width Floating-Point Add/Subtract Instructions
4008+
//===----------------------------------------------------------------------===//
4009+
let Predicates = [HasVendorXTHeadV], mayRaiseFPException = true, hasSideEffects = 0 in {
4010+
defm PseudoTH_VFWMUL : XVPseudoVWMUL_VV_VF_RM;
4011+
}
4012+
4013+
let Predicates = [HasVendorXTHeadV] in {
4014+
defm : XVPatBinaryW_VV_VX_RM<"int_riscv_th_vfwmul", "PseudoTH_VFWMUL",
4015+
AllWidenableFloatXVectors>;
4016+
}
4017+
39834018
//===----------------------------------------------------------------------===//
39844019
// 16.1. Vector Mask-Register Logical Operations
39854020
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)