diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoC.td b/llvm/lib/Target/RISCV/RISCVInstrInfoC.td --- a/llvm/lib/Target/RISCV/RISCVInstrInfoC.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoC.td @@ -401,8 +401,7 @@ let rd = 0, imm = 0, hasSideEffects = 0, mayLoad = 0, mayStore = 0 in def C_NOP : RVInst16CI<0b000, 0b01, (outs), (ins), "c.nop", "">, - Sched<[WriteNop]> -{ + Sched<[WriteNop]> { let Inst{6-2} = 0; } @@ -622,8 +621,7 @@ //===----------------------------------------------------------------------===// let Predicates = [HasStdExtCOrZca, HasRVCHints], hasSideEffects = 0, mayLoad = 0, - mayStore = 0 in -{ + mayStore = 0 in { let rd = 0 in def C_NOP_HINT : RVInst16CI<0b000, 0b01, (outs), (ins simm6nonzero:$imm), @@ -659,8 +657,7 @@ } def C_MV_HINT : RVInst16CR<0b1000, 0b10, (outs GPRX0:$rs1), (ins GPRNoX0:$rs2), - "c.mv", "$rs1, $rs2">, Sched<[WriteIALU, ReadIALU]> -{ + "c.mv", "$rs1, $rs2">, Sched<[WriteIALU, ReadIALU]> { let Inst{11-7} = 0; let DecoderMethod = "decodeRVCInstrRdRs2"; } diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td --- a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td @@ -258,8 +258,7 @@ //===----------------------------------------------------------------------===// class VTypeInfo -{ + ValueType Scal = XLenVT, RegisterClass ScalarReg = GPR> { ValueType Vector = Vec; ValueType Mask = Mas; int SEW = Sew; @@ -281,8 +280,7 @@ class GroupVTypeInfo - : VTypeInfo -{ + : VTypeInfo { ValueType VectorM1 = VecM1; } @@ -360,8 +358,7 @@ // This functor is used to obtain the int vector type that has the same SEW and // multiplier as the input parameter type -class GetIntVTypeInfo -{ +class GetIntVTypeInfo { // Equivalent integer vector type. Eg. // VI8M1 → VI8M1 (identity) // VF64M4 → VI64M4 @@ -394,14 +391,12 @@ def : MTypeInfo; } -class VTypeInfoToWide -{ +class VTypeInfoToWide { VTypeInfo Vti = vti; VTypeInfo Wti = wti; } -class VTypeInfoToFraction -{ +class VTypeInfoToFraction { VTypeInfo Vti = vti; VTypeInfo Fti = fti; } @@ -499,11 +494,7 @@ // This class holds the record of the RISCVVPseudoTable below. // This represents the information we need in codegen for each pseudo. // The definition should be consistent with `struct PseudoInfo` in -// RISCVBaseInfo.h. -class CONST8b val> { - bits<8> V = val; -} -def InvalidIndex : CONST8b<0x80>; +// RISCVInstrInfo.h. class RISCVVPseudo { Pseudo Pseudo = !cast(NAME); // Used as a key. Instruction BaseInstr = !cast(PseudoToVInst.VInst); @@ -1862,8 +1853,7 @@ } multiclass VPseudoVPOP_M { - foreach mti = AllMasks in - { + foreach mti = AllMasks in { defvar mx = mti.LMul.MX; defvar WriteVMPopV_MX = !cast("WriteVMPopV_" # mx); defvar ReadVMPopV_MX = !cast("ReadVMPopV_" # mx); @@ -1877,8 +1867,7 @@ } multiclass VPseudoV1ST_M { - foreach mti = AllMasks in - { + foreach mti = AllMasks in { defvar mx = mti.LMul.MX; defvar WriteVMFFSV_MX = !cast("WriteVMFFSV_" # mx); defvar ReadVMFFSV_MX = !cast("ReadVMFFSV_" # mx); @@ -1893,8 +1882,7 @@ multiclass VPseudoVSFS_M { defvar constraint = "@earlyclobber $rd"; - foreach mti = AllMasks in - { + foreach mti = AllMasks in { defvar mx = mti.LMul.MX; defvar WriteVMSFSV_MX = !cast("WriteVMSFSV_" # mx); defvar ReadVMSFSV_MX = !cast("ReadVMSFSV_" # mx); @@ -2400,8 +2388,7 @@ multiclass PseudoVEXT_VF2 { defvar constraints = "@earlyclobber $rd"; - foreach m = MxListVF2 in - { + foreach m = MxListVF2 in { defvar mx = m.MX; defvar WriteVExtV_MX = !cast("WriteVExtV_" # mx); defvar ReadVExtV_MX = !cast("ReadVExtV_" # mx); @@ -2419,8 +2406,7 @@ multiclass PseudoVEXT_VF4 { defvar constraints = "@earlyclobber $rd"; - foreach m = MxListVF4 in - { + foreach m = MxListVF4 in { defvar mx = m.MX; defvar WriteVExtV_MX = !cast("WriteVExtV_" # mx); defvar ReadVExtV_MX = !cast("ReadVExtV_" # mx); @@ -2438,8 +2424,7 @@ multiclass PseudoVEXT_VF8 { defvar constraints = "@earlyclobber $rd"; - foreach m = MxListVF8 in - { + foreach m = MxListVF8 in { defvar mx = m.MX; defvar WriteVExtV_MX = !cast("WriteVExtV_" # mx); defvar ReadVExtV_MX = !cast("ReadVExtV_" # mx); @@ -4394,8 +4379,7 @@ GPR:$vl, log2sew, TAIL_AGNOSTIC)>; multiclass VPatUnaryS_M -{ + string inst> { foreach mti = AllMasks in { def : Pat<(XLenVT (!cast(intrinsic_name) (mti.Mask VR:$rs1), VLOpFrag)), @@ -4419,16 +4403,14 @@ } multiclass VPatUnaryM_M -{ + string inst> { foreach mti = AllMasks in { def : VPatMaskUnaryNoMask; def : VPatMaskUnaryMask; } } -multiclass VPatUnaryV_M -{ +multiclass VPatUnaryV_M { foreach vti = AllIntegerVectors in { let Predicates = GetVTypePredicates.Predicates in { def : VPatUnaryNoMask fractionList> -{ - foreach vtiTofti = fractionList in - { + list fractionList> { + foreach vtiTofti = fractionList in { defvar vti = vtiTofti.Vti; defvar fti = vtiTofti.Fti; let Predicates = !listconcat(GetVTypePredicates.Predicates, @@ -4472,8 +4452,7 @@ } } -multiclass VPatNullaryV -{ +multiclass VPatNullaryV { foreach vti = AllIntegerVectors in { let Predicates = GetVTypePredicates.Predicates in { def : Pat<(vti.Vector (!cast(intrinsic) @@ -4508,8 +4487,7 @@ int sew, VReg result_reg_class, VReg op1_reg_class, - DAGOperand op2_kind> -{ + DAGOperand op2_kind> { def : VPatBinaryM; def : VPatBinaryMask -{ + DAGOperand op2_kind> { def : VPatBinaryNoMask; def : VPatBinaryNoMaskTU -{ + DAGOperand op2_kind> { def : VPatBinaryNoMaskRoundingMode; def : VPatBinaryNoMaskTURoundingMode -{ + DAGOperand op2_kind> { def : VPatBinaryNoMaskSwapped; def : VPatBinaryMaskSwapped -{ + DAGOperand op2_kind> { def : Pat<(result_type (!cast(intrinsic) (result_type undef), (op1_type op1_reg_class:$rs1), @@ -4621,8 +4595,7 @@ int sew, LMULInfo vlmul, VReg op1_reg_class, - DAGOperand op2_kind> -{ + DAGOperand op2_kind> { def : Pat<(result_type (!cast(intrinsic) (op1_type op1_reg_class:$rs1), (op2_type op2_kind:$rs2), @@ -4643,8 +4616,7 @@ int sew, LMULInfo vlmul, VReg op1_reg_class, - DAGOperand op2_kind> -{ + DAGOperand op2_kind> { def : Pat<(result_type (!cast(intrinsic) (op1_type op1_reg_class:$rs1), (op2_type op2_kind:$rs2), @@ -4664,8 +4636,7 @@ int sew, LMULInfo vlmul, VReg result_reg_class, - VReg op1_reg_class> -{ + VReg op1_reg_class> { def : VPatUnaryNoMask; def : VPatUnaryMask; multiclass VPatReductionV_VS { - foreach vti = !if(IsFloat, NoGroupFloatVectors, NoGroupIntegerVectors) in - { + foreach vti = !if(IsFloat, NoGroupFloatVectors, NoGroupIntegerVectors) in { defvar vectorM1 = !cast(!if(IsFloat, "VF", "VI") # vti.SEW # "M1"); let Predicates = GetVTypePredicates.Predicates in defm : VPatTernaryTA; } - foreach gvti = !if(IsFloat, GroupFloatVectors, GroupIntegerVectors) in - { + foreach gvti = !if(IsFloat, GroupFloatVectors, GroupIntegerVectors) in { let Predicates = GetVTypePredicates.Predicates in defm : VPatTernaryTA { - foreach vti = !if(IsFloat, AllFloatVectors, AllIntegerVectors) in - { + foreach vti = !if(IsFloat, AllFloatVectors, AllIntegerVectors) in { defvar wtiSEW = !mul(vti.SEW, 2); if !le(wtiSEW, 64) then { defvar wtiM1 = !cast(!if(IsFloat, "VF", "VI") # wtiSEW # "M1"); @@ -5405,10 +5373,8 @@ } multiclass VPatConversionVI_VF -{ - foreach fvti = AllFloatVectors in - { + string instruction> { + foreach fvti = AllFloatVectors in { defvar ivti = GetIntVTypeInfo.Vti; let Predicates = !listconcat(GetVTypePredicates.Predicates, GetVTypePredicates.Predicates) in @@ -5419,10 +5385,8 @@ } multiclass VPatConversionVF_VI -{ - foreach fvti = AllFloatVectors in - { + string instruction> { + foreach fvti = AllFloatVectors in { defvar ivti = GetIntVTypeInfo.Vti; let Predicates = !listconcat(GetVTypePredicates.Predicates, GetVTypePredicates.Predicates) in @@ -5433,8 +5397,7 @@ } multiclass VPatConversionWI_VF { - foreach fvtiToFWti = AllWidenableFloatVectors in - { + foreach fvtiToFWti = AllWidenableFloatVectors in { defvar fvti = fvtiToFWti.Vti; defvar iwti = GetIntVTypeInfo.Vti; let Predicates = !listconcat(GetVTypePredicates.Predicates, @@ -5446,8 +5409,7 @@ } multiclass VPatConversionWF_VI { - foreach vtiToWti = AllWidenableIntToFloatVectors in - { + foreach vtiToWti = AllWidenableIntToFloatVectors in { defvar vti = vtiToWti.Vti; defvar fwti = vtiToWti.Wti; let Predicates = !listconcat(GetVTypePredicates.Predicates, @@ -5459,8 +5421,7 @@ } multiclass VPatConversionWF_VF { - foreach fvtiToFWti = AllWidenableFloatVectors in - { + foreach fvtiToFWti = AllWidenableFloatVectors in { defvar fvti = fvtiToFWti.Vti; defvar fwti = fvtiToFWti.Wti; let Predicates = !listconcat(GetVTypePredicates.Predicates, @@ -5472,8 +5433,7 @@ } multiclass VPatConversionVI_WF { - foreach vtiToWti = AllWidenableIntToFloatVectors in - { + foreach vtiToWti = AllWidenableIntToFloatVectors in { defvar vti = vtiToWti.Vti; defvar fwti = vtiToWti.Wti; let Predicates = !listconcat(GetVTypePredicates.Predicates, @@ -5485,8 +5445,7 @@ } multiclass VPatConversionVF_WI { - foreach fvtiToFWti = AllWidenableFloatVectors in - { + foreach fvtiToFWti = AllWidenableFloatVectors in { defvar fvti = fvtiToFWti.Vti; defvar iwti = GetIntVTypeInfo.Vti; let Predicates = !listconcat(GetVTypePredicates.Predicates, @@ -5498,8 +5457,7 @@ } multiclass VPatConversionVF_WF { - foreach fvtiToFWti = AllWidenableFloatVectors in - { + foreach fvtiToFWti = AllWidenableFloatVectors in { defvar fvti = fvtiToFWti.Vti; defvar fwti = fvtiToFWti.Wti; let Predicates = !listconcat(GetVTypePredicates.Predicates, diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td b/llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td --- a/llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td @@ -29,8 +29,7 @@ LMULInfo vlmul, OutPatFrag avl, VReg reg_class, - int sew = !shl(1, log2sew)> -{ + int sew = !shl(1, log2sew)> { defvar load_instr = !cast("PseudoVLE"#sew#"_V_"#vlmul.MX); defvar store_instr = !cast("PseudoVSE"#sew#"_V_"#vlmul.MX); // Load @@ -45,8 +44,7 @@ int log2sew, LMULInfo vlmul, VReg reg_class, - int sew = !shl(1, log2sew)> -{ + int sew = !shl(1, log2sew)> { defvar load_instr = !cast("VL"#!substr(vlmul.MX, 1)#"RE"#sew#"_V"); defvar store_instr = @@ -60,8 +58,7 @@ (store_instr reg_class:$rs2, GPR:$rs1)>; } -multiclass VPatUSLoadStoreMaskSDNode -{ +multiclass VPatUSLoadStoreMaskSDNode { defvar load_instr = !cast("PseudoVLM_V_"#m.BX); defvar store_instr = !cast("PseudoVSM_V_"#m.BX); // Load