forked from OSchip/llvm-project
[RISCV] Define the remaining vector fixed-point arithmetic intrinsics.
This patch base on D93366, and define vector fixed-point intrinsics. 1. vaaddu/vaadd/vasubu/vasub 2. vsmul 3. vssrl/vssra 4. vnclipu/vnclip We work with @rogfer01 from BSC to come out this patch. Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com> Co-Authored-by: ShihPo Hung <shihpo.hung@sifive.com> Differential Revision: https://reviews.llvm.org/D93508
This commit is contained in:
parent
e0963ae274
commit
3183add534
|
@ -274,6 +274,25 @@ let TargetPrefix = "riscv" in {
|
|||
[IntrNoMem, IntrHasSideEffects]>, RISCVVIntrinsic {
|
||||
let ExtendOperand = 3;
|
||||
}
|
||||
// For Saturating binary operations.
|
||||
// The destination vector type is NOT the same as first source vector.
|
||||
// Input: (vector_in, vector_in/scalar_in, vl)
|
||||
class RISCVSaturatingBinaryABXNoMask
|
||||
: Intrinsic<[llvm_anyvector_ty],
|
||||
[llvm_anyvector_ty, llvm_any_ty, llvm_anyint_ty],
|
||||
[IntrNoMem, IntrHasSideEffects]>, RISCVVIntrinsic {
|
||||
let ExtendOperand = 2;
|
||||
}
|
||||
// For Saturating binary operations with mask.
|
||||
// The destination vector type is NOT the same as first source vector (with mask).
|
||||
// Input: (maskedoff, vector_in, vector_in/scalar_in, mask, vl)
|
||||
class RISCVSaturatingBinaryABXMask
|
||||
: Intrinsic<[llvm_anyvector_ty],
|
||||
[LLVMMatchType<0>, llvm_anyvector_ty, llvm_any_ty,
|
||||
LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>, llvm_anyint_ty],
|
||||
[IntrNoMem, IntrHasSideEffects]>, RISCVVIntrinsic {
|
||||
let ExtendOperand = 3;
|
||||
}
|
||||
|
||||
// For vmv.v.v, vmv.v.x, vmv.v.i
|
||||
// Input: (vector_in/scalar_in, vl)
|
||||
|
@ -339,6 +358,10 @@ let TargetPrefix = "riscv" in {
|
|||
def "int_riscv_" # NAME : RISCVSaturatingBinaryAAXNoMask;
|
||||
def "int_riscv_" # NAME # "_mask" : RISCVSaturatingBinaryAAXMask;
|
||||
}
|
||||
multiclass RISCVSaturatingBinaryABX {
|
||||
def "int_riscv_" # NAME : RISCVSaturatingBinaryABXNoMask;
|
||||
def "int_riscv_" # NAME # "_mask" : RISCVSaturatingBinaryABXMask;
|
||||
}
|
||||
multiclass RISCVTernaryAAAX {
|
||||
def "int_riscv_" # NAME : RISCVTernaryAAAXNoMask;
|
||||
def "int_riscv_" # NAME # "_mask" : RISCVTernaryAAAXMask;
|
||||
|
@ -446,4 +469,17 @@ let TargetPrefix = "riscv" in {
|
|||
|
||||
defm vslideup : RISCVTernaryAAAX;
|
||||
defm vslidedown : RISCVTernaryAAAX;
|
||||
|
||||
defm vaaddu : RISCVSaturatingBinaryAAX;
|
||||
defm vaadd : RISCVSaturatingBinaryAAX;
|
||||
defm vasubu : RISCVSaturatingBinaryAAX;
|
||||
defm vasub : RISCVSaturatingBinaryAAX;
|
||||
|
||||
defm vsmul : RISCVSaturatingBinaryAAX;
|
||||
|
||||
defm vssrl : RISCVSaturatingBinaryAAX;
|
||||
defm vssra : RISCVSaturatingBinaryAAX;
|
||||
|
||||
defm vnclipu : RISCVSaturatingBinaryABX;
|
||||
defm vnclip : RISCVSaturatingBinaryABX;
|
||||
} // TargetPrefix = "riscv"
|
||||
|
|
|
@ -1658,6 +1658,39 @@ let Defs = [VXSAT], hasSideEffects = 1 in {
|
|||
defm PseudoVSSUB : VPseudoBinaryV_VV_VX;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// 13.2. Vector Single-Width Averaging Add and Subtract
|
||||
//===----------------------------------------------------------------------===//
|
||||
let Uses = [VL, VTYPE, VXRM], hasSideEffects = 1 in {
|
||||
defm PseudoVAADDU : VPseudoBinaryV_VV_VX;
|
||||
defm PseudoVAADD : VPseudoBinaryV_VV_VX;
|
||||
defm PseudoVASUBU : VPseudoBinaryV_VV_VX;
|
||||
defm PseudoVASUB : VPseudoBinaryV_VV_VX;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// 13.3. Vector Single-Width Fractional Multiply with Rounding and Saturation
|
||||
//===----------------------------------------------------------------------===//
|
||||
let Uses = [VL, VTYPE, VXRM], Defs = [VXSAT], hasSideEffects = 1 in {
|
||||
defm PseudoVSMUL : VPseudoBinaryV_VV_VX;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// 13.4. Vector Single-Width Scaling Shift Instructions
|
||||
//===----------------------------------------------------------------------===//
|
||||
let Uses = [VL, VTYPE, VXRM], hasSideEffects = 1 in {
|
||||
defm PseudoVSSRL : VPseudoBinaryV_VV_VX_VI<uimm5>;
|
||||
defm PseudoVSSRA : VPseudoBinaryV_VV_VX_VI<uimm5>;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// 13.5. Vector Narrowing Fixed-Point Clip Instructions
|
||||
//===----------------------------------------------------------------------===//
|
||||
let Uses = [VL, VTYPE, VXRM], Defs = [VXSAT], hasSideEffects = 1 in {
|
||||
defm PseudoVNCLIP : VPseudoBinaryV_WV_WX_WI;
|
||||
defm PseudoVNCLIPU : VPseudoBinaryV_WV_WX_WI;
|
||||
}
|
||||
|
||||
} // Predicates = [HasStdExtV]
|
||||
|
||||
let Predicates = [HasStdExtV, HasStdExtF] in {
|
||||
|
@ -1955,6 +1988,33 @@ defm "" : VPatBinaryV_VV_VX_VI<"int_riscv_vsadd", "PseudoVSADD", AllIntegerVecto
|
|||
defm "" : VPatBinaryV_VV_VX<"int_riscv_vssubu", "PseudoVSSUBU", AllIntegerVectors>;
|
||||
defm "" : VPatBinaryV_VV_VX<"int_riscv_vssub", "PseudoVSSUB", AllIntegerVectors>;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// 13.2. Vector Single-Width Averaging Add and Subtract
|
||||
//===----------------------------------------------------------------------===//
|
||||
defm "" : VPatBinaryV_VV_VX<"int_riscv_vaaddu", "PseudoVAADDU", AllIntegerVectors>;
|
||||
defm "" : VPatBinaryV_VV_VX<"int_riscv_vaadd", "PseudoVAADD", AllIntegerVectors>;
|
||||
defm "" : VPatBinaryV_VV_VX<"int_riscv_vasubu", "PseudoVASUBU", AllIntegerVectors>;
|
||||
defm "" : VPatBinaryV_VV_VX<"int_riscv_vasub", "PseudoVASUB", AllIntegerVectors>;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// 13.3. Vector Single-Width Fractional Multiply with Rounding and Saturation
|
||||
//===----------------------------------------------------------------------===//
|
||||
defm "" : VPatBinaryV_VV_VX<"int_riscv_vsmul", "PseudoVSMUL", AllIntegerVectors>;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// 13.4. Vector Single-Width Scaling Shift Instructions
|
||||
//===----------------------------------------------------------------------===//
|
||||
defm "" : VPatBinaryV_VV_VX_VI<"int_riscv_vssrl", "PseudoVSSRL", AllIntegerVectors,
|
||||
uimm5>;
|
||||
defm "" : VPatBinaryV_VV_VX_VI<"int_riscv_vssra", "PseudoVSSRA", AllIntegerVectors,
|
||||
uimm5>;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// 13.5. Vector Narrowing Fixed-Point Clip Instructions
|
||||
//===----------------------------------------------------------------------===//
|
||||
defm "" : VPatBinaryV_WV_WX_WI<"int_riscv_vnclipu", "PseudoVNCLIPU", AllWidenableIntVectors>;
|
||||
defm "" : VPatBinaryV_WV_WX_WI<"int_riscv_vnclip", "PseudoVNCLIP", AllWidenableIntVectors>;
|
||||
|
||||
} // Predicates = [HasStdExtV]
|
||||
|
||||
let Predicates = [HasStdExtV, HasStdExtF] in {
|
||||
|
|
|
@ -99,6 +99,7 @@ BitVector RISCVRegisterInfo::getReservedRegs(const MachineFunction &MF) const {
|
|||
markSuperRegs(Reserved, RISCV::VL);
|
||||
markSuperRegs(Reserved, RISCV::VTYPE);
|
||||
markSuperRegs(Reserved, RISCV::VXSAT);
|
||||
markSuperRegs(Reserved, RISCV::VXRM);
|
||||
|
||||
assert(checkAllSuperRegsMarked(Reserved));
|
||||
return Reserved;
|
||||
|
|
|
@ -380,6 +380,7 @@ let RegAltNameIndices = [ABIRegAltName] in {
|
|||
def VTYPE : RISCVReg<0, "vtype", ["vtype"]>;
|
||||
def VL : RISCVReg<0, "vl", ["vl"]>;
|
||||
def VXSAT : RISCVReg<0, "vxsat", ["vxsat"]>;
|
||||
def VXRM : RISCVReg<0, "vxrm", ["vxrm"]>;
|
||||
}
|
||||
|
||||
class RegisterTypes<list<ValueType> reg_types> {
|
||||
|
|
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
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
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