forked from OSchip/llvm-project
[RISCV] Add intrinsics for vmacc/vnmsac/vmadd/vnmsub instructions
This defines vmadd, vmacc, vnmsub, and vnmsac intrinsics and lower to V instructions. Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com> Co-Authored-by: ShihPo Hung <shihpo.hung@sifive.com> Differential Revision: https://reviews.llvm.org/D93632
This commit is contained in:
parent
6e2af4d604
commit
b15ba2cf6f
|
@ -304,6 +304,20 @@ let TargetPrefix = "riscv" in {
|
|||
[LLVMMatchType<0>, LLVMMatchType<0>, llvm_anyint_ty,
|
||||
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>, LLVMMatchType<1>],
|
||||
[IntrNoMem]>, RISCVVIntrinsic;
|
||||
class RISCVTernaryAAXANoMask
|
||||
: Intrinsic<[llvm_anyvector_ty],
|
||||
[LLVMMatchType<0>, llvm_any_ty, LLVMMatchType<0>,
|
||||
llvm_anyint_ty],
|
||||
[IntrNoMem]>, RISCVVIntrinsic {
|
||||
let ExtendOperand = 2;
|
||||
}
|
||||
class RISCVTernaryAAXAMask
|
||||
: Intrinsic<[llvm_anyvector_ty],
|
||||
[LLVMMatchType<0>, llvm_any_ty, LLVMMatchType<0>,
|
||||
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>, llvm_anyint_ty],
|
||||
[IntrNoMem]>, RISCVVIntrinsic {
|
||||
let ExtendOperand = 2;
|
||||
}
|
||||
|
||||
multiclass RISCVUSLoad {
|
||||
def "int_riscv_" # NAME : RISCVUSLoad;
|
||||
|
@ -358,6 +372,10 @@ let TargetPrefix = "riscv" in {
|
|||
def "int_riscv_" # NAME : RISCVTernaryAAAXNoMask;
|
||||
def "int_riscv_" # NAME # "_mask" : RISCVTernaryAAAXMask;
|
||||
}
|
||||
multiclass RISCVTernaryAAXA {
|
||||
def "int_riscv_" # NAME : RISCVTernaryAAXANoMask;
|
||||
def "int_riscv_" # NAME # "_mask" : RISCVTernaryAAXAMask;
|
||||
}
|
||||
|
||||
defm vle : RISCVUSLoad;
|
||||
defm vse : RISCVUSStore;
|
||||
|
@ -418,6 +436,11 @@ let TargetPrefix = "riscv" in {
|
|||
defm vwmulu : RISCVBinaryABX;
|
||||
defm vwmulsu : RISCVBinaryABX;
|
||||
|
||||
defm vmacc : RISCVTernaryAAXA;
|
||||
defm vnmsac : RISCVTernaryAAXA;
|
||||
defm vmadd : RISCVTernaryAAXA;
|
||||
defm vnmsub : RISCVTernaryAAXA;
|
||||
|
||||
defm vfadd : RISCVBinaryAAX;
|
||||
defm vfsub : RISCVBinaryAAX;
|
||||
defm vfrsub : RISCVBinaryAAX;
|
||||
|
|
|
@ -854,16 +854,31 @@ multiclass VPseudoTernary<VReg RetClass,
|
|||
}
|
||||
}
|
||||
|
||||
multiclass VPseudoTernaryV_VV<string Constraint = ""> {
|
||||
foreach m = MxList.m in
|
||||
defm _VV : VPseudoTernary<m.vrclass, m.vrclass, m.vrclass, m, Constraint>;
|
||||
}
|
||||
|
||||
multiclass VPseudoTernaryV_VX<string Constraint = ""> {
|
||||
foreach m = MxList.m in
|
||||
defm _VX : VPseudoTernary<m.vrclass, m.vrclass, GPR, m, Constraint>;
|
||||
}
|
||||
|
||||
multiclass VPseudoTernaryV_VX_AAXA<string Constraint = ""> {
|
||||
foreach m = MxList.m in
|
||||
defm _VX : VPseudoTernary<m.vrclass, GPR, m.vrclass, m, Constraint>;
|
||||
}
|
||||
|
||||
multiclass VPseudoTernaryV_VI<Operand ImmType = simm5, string Constraint = ""> {
|
||||
foreach m = MxList.m in
|
||||
defm _VI : VPseudoTernary<m.vrclass, m.vrclass, ImmType, m, Constraint>;
|
||||
}
|
||||
|
||||
multiclass VPseudoTernaryV_VV_VX_AAXA<string Constraint = ""> {
|
||||
defm "" : VPseudoTernaryV_VV<Constraint>;
|
||||
defm "" : VPseudoTernaryV_VX_AAXA<Constraint>;
|
||||
}
|
||||
|
||||
multiclass VPseudoTernaryV_VX_VI<Operand ImmType = simm5, string Constraint = ""> {
|
||||
defm "" : VPseudoTernaryV_VX<Constraint>;
|
||||
defm "" : VPseudoTernaryV_VI<ImmType, Constraint>;
|
||||
|
@ -1475,6 +1490,15 @@ multiclass VPatTernary<string intrinsic,
|
|||
op2_kind>;
|
||||
}
|
||||
|
||||
multiclass VPatTernaryV_VV<string intrinsic, string instruction,
|
||||
list<VTypeInfo> vtilist> {
|
||||
foreach vti = vtilist in
|
||||
defm : VPatTernary<intrinsic, instruction, "VV",
|
||||
vti.Vector, vti.Vector, vti.Vector, vti.Mask,
|
||||
vti.SEW, vti.LMul, vti.RegClass,
|
||||
vti.RegClass, vti.RegClass>;
|
||||
}
|
||||
|
||||
multiclass VPatTernaryV_VX<string intrinsic, string instruction,
|
||||
list<VTypeInfo> vtilist> {
|
||||
foreach vti = vtilist in
|
||||
|
@ -1484,6 +1508,15 @@ multiclass VPatTernaryV_VX<string intrinsic, string instruction,
|
|||
vti.RegClass, GPR>;
|
||||
}
|
||||
|
||||
multiclass VPatTernaryV_VX_AAXA<string intrinsic, string instruction,
|
||||
list<VTypeInfo> vtilist> {
|
||||
foreach vti = vtilist in
|
||||
defm : VPatTernary<intrinsic, instruction, "VX",
|
||||
vti.Vector, vti.Scalar, vti.Vector, vti.Mask,
|
||||
vti.SEW, vti.LMul, vti.RegClass,
|
||||
vti.ScalarRegClass, vti.RegClass>;
|
||||
}
|
||||
|
||||
multiclass VPatTernaryV_VI<string intrinsic, string instruction,
|
||||
list<VTypeInfo> vtilist, Operand Imm_type> {
|
||||
foreach vti = vtilist in
|
||||
|
@ -1493,6 +1526,12 @@ multiclass VPatTernaryV_VI<string intrinsic, string instruction,
|
|||
vti.RegClass, Imm_type>;
|
||||
}
|
||||
|
||||
multiclass VPatTernaryV_VV_VX_AAXA<string intrinsic, string instruction,
|
||||
list<VTypeInfo> vtilist> {
|
||||
defm "" : VPatTernaryV_VV<intrinsic, instruction, vtilist>;
|
||||
defm "" : VPatTernaryV_VX_AAXA<intrinsic, instruction, vtilist>;
|
||||
}
|
||||
|
||||
multiclass VPatTernaryV_VX_VI<string intrinsic, string instruction,
|
||||
list<VTypeInfo> vtilist, Operand Imm_type = simm5> {
|
||||
defm "" : VPatTernaryV_VX<intrinsic, instruction, vtilist>;
|
||||
|
@ -1649,6 +1688,14 @@ defm PseudoVWMUL : VPseudoBinaryW_VV_VX;
|
|||
defm PseudoVWMULU : VPseudoBinaryW_VV_VX;
|
||||
defm PseudoVWMULSU : VPseudoBinaryW_VV_VX;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// 12.13. Vector Single-Width Integer Multiply-Add Instructions
|
||||
//===----------------------------------------------------------------------===//
|
||||
defm PseudoVMACC : VPseudoTernaryV_VV_VX_AAXA;
|
||||
defm PseudoVNMSAC : VPseudoTernaryV_VV_VX_AAXA;
|
||||
defm PseudoVMADD : VPseudoTernaryV_VV_VX_AAXA;
|
||||
defm PseudoVNMSUB : VPseudoTernaryV_VV_VX_AAXA;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// 12.17. Vector Integer Move Instructions
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -1975,6 +2022,14 @@ defm "" : VPatBinaryW_VV_VX<"int_riscv_vwmul", "PseudoVWMUL", AllWidenableIntVec
|
|||
defm "" : VPatBinaryW_VV_VX<"int_riscv_vwmulu", "PseudoVWMULU", AllWidenableIntVectors>;
|
||||
defm "" : VPatBinaryW_VV_VX<"int_riscv_vwmulsu", "PseudoVWMULSU", AllWidenableIntVectors>;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// 12.13. Vector Single-Width Integer Multiply-Add Instructions
|
||||
//===----------------------------------------------------------------------===//
|
||||
defm "" : VPatTernaryV_VV_VX_AAXA<"int_riscv_vmadd", "PseudoVMADD", AllIntegerVectors>;
|
||||
defm "" : VPatTernaryV_VV_VX_AAXA<"int_riscv_vnmsub", "PseudoVNMSUB", AllIntegerVectors>;
|
||||
defm "" : VPatTernaryV_VV_VX_AAXA<"int_riscv_vmacc", "PseudoVMACC", AllIntegerVectors>;
|
||||
defm "" : VPatTernaryV_VV_VX_AAXA<"int_riscv_vnmsac", "PseudoVNMSAC", AllIntegerVectors>;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// 12.17. Vector Integer Move Instructions
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue