https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/239103
Move the fusion tuning features to RISCVFeatures.td with the other tuning features, and attach the predicates with SimpleFusionFor and FusionFor. The features no longer depend on the instruction definitions. Co-authored-by: Claude Opus 5.5 <[email protected]> --- <sub>Stack created with <a href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub> >From 175ea63386e28e70ded7ffeb85ef1de031e32ee8 Mon Sep 17 00:00:00 2001 From: Matt Arsenault <[email protected]> Date: Tue, 13 Oct 2026 12:33:06 -0700 Subject: [PATCH] RISCV: Define macro fusion features separately from predicates Move the fusion tuning features to RISCVFeatures.td with the other tuning features, and attach the predicates with SimpleFusionFor and FusionFor. The features no longer depend on the instruction definitions. Co-authored-by: Claude Opus 5.5 <[email protected]> --- llvm/lib/Target/RISCV/RISCVFeatures.td | 104 +++++++ llvm/lib/Target/RISCV/RISCVMacroFusion.td | 286 ++++++++---------- llvm/lib/Target/RISCV/RISCVMacroFusionXQCI.td | 132 ++++---- 3 files changed, 289 insertions(+), 233 deletions(-) diff --git a/llvm/lib/Target/RISCV/RISCVFeatures.td b/llvm/lib/Target/RISCV/RISCVFeatures.td index 6c94edcee2c715..83a4be1cd7bc69 100644 --- a/llvm/lib/Target/RISCV/RISCVFeatures.td +++ b/llvm/lib/Target/RISCV/RISCVFeatures.td @@ -2291,6 +2291,110 @@ def TuneAvoidVXRM : SubtargetFeature<"avoid-vxrm", "AvoidVXRM", "true", "Instructions that use VXRM should be avoided">; +class RISCVFusionFeature<string name, string field_name, string description> + : SubtargetFeature<"fusion-"#name, field_name, "true", description, [], + InlineIgnore>; + +def TuneLUIADDIFusion + : RISCVFusionFeature<"lui-addi", "HasLUIADDIFusion", + "Enable LUI+ADDI macro fusion">; + +def TuneAUIPCADDIFusion + : RISCVFusionFeature<"auipc-addi", "HasAUIPCADDIFusion", + "Enable AUIPC+ADDI macrofusion">; + +def TuneZExtHFusion + : RISCVFusionFeature<"zexth", "HasZExtHFusion", + "Enable SLLI+SRLI to be fused to zero extension of halfword">; + +def TuneZExtWFusion + : RISCVFusionFeature<"zextw", "HasZExtWFusion", + "Enable SLLI+SRLI to be fused to zero extension of word">; + +def TuneShiftedZExtWFusion + : RISCVFusionFeature<"shifted-zextw", "HasShiftedZExtWFusion", + "Enable SLLI+SRLI to be fused when computing (shifted) word zero extension">; + +def TuneLDADDFusion + : RISCVFusionFeature<"ld-add", "HasLDADDFusion", + "Enable LD+ADD macrofusion">; + +def TuneADDLoadFusion + : RISCVFusionFeature<"add-load", "HasADDLoadFusion", + "Enable ADD(.UW) + load macrofusion">; + +def TuneAUIPCLoadFusion + : RISCVFusionFeature<"auipc-load", "HasAUIPCLoadFusion", + "Enable AUIPC + load macrofusion">; + +def TuneLUILoadFusion + : RISCVFusionFeature<"lui-load", "HasLUILoadFusion", + "Enable LUI + load macrofusion">; + +def TuneQCELILoadStoreFusion + : RISCVFusionFeature<"qc-e-li-load-store", "HasQCELILoadStoreFusion", + "Enable QC.E.LI + Load/Store macrofusion">; + +def TuneBFExtFusion + : RISCVFusionFeature<"bfext", "HasBFExtFusion", + "Enable SLLI+SRLI (bitfield extract) macrofusion">; + +def TuneADDILoadFusion + : RISCVFusionFeature<"addi-load", "HasADDILoadFusion", + "Enable ADDI + load macrofusion">; + +def TuneSHXADDLoadFusion + : RISCVFusionFeature<"shxadd-load", "HasSHXADDLoadFusion", + "Enable SH(1|2|3)ADD(.UW) + load macrofusion">; + +def TuneFusionLogicRegReg + : RISCVFusionFeature<"logic-reg-reg", "HasFusionLogicRegReg", + "Enable AND/OR/XOR+AND/OR/XOR macrofusion">; + +def TuneFusionLogicRegImm + : RISCVFusionFeature<"logic-reg-imm", "HasFusionLogicRegImm", + "Enable AND/OR/XOR+ANDI/ORI/XORI macrofusion">; + +def TuneFusionLogicImmReg + : RISCVFusionFeature<"logic-imm-reg", "HasFusionLogicImmReg", + "Enable ANDI/ORI/XORI+AND/OR/XOR macrofusion">; + +def TuneFusionMulAdd + : RISCVFusionFeature<"mul-add", "HasFusionMulAdd", + "Enable MUL+ADD macrofusion">; + +def TuneFusionAddMem + : RISCVFusionFeature<"add-mem", "HasFusionAddMem", + "Enable ADD+LOAD/STORE macrofusion">; + +def TuneFusionShiftBitExtract + : RISCVFusionFeature<"shift-bit-extract", "HasFusionShiftBitExtract", + "Enable SLLI+SRLI/SRAI macrofusion">; + +def TuneMOVIMMALUXqciFusion + : RISCVFusionFeature<"xqci-movimm-alu", "HasMOVIMMALUXqciFusion", + "Enable MOVIMM + ALU operations macrofusion">; + +def TuneMOVIMMMULXqciFusion + : RISCVFusionFeature<"xqci-movimm-mul", "HasMOVIMMMULXqciFusion", + "Enable MOVIMM + multiply macrofusion">; + +def TuneMOVIMMLoadStoreXqciFusion + : RISCVFusionFeature<"xqci-movimm-ldst", "HasMOVIMMLoadStoreXqciFusion", + "Enable MOVIMM + long Load/Store macrofusion">; + +def TuneMOVIMMJumpXqciFusion + : RISCVFusionFeature<"xqci-movimm-jump", "HasMOVIMMJumpXqciFusion", + "Enable MOVIMM + Jump macrofusion">; + +def TuneMOVIMMLongAccumXciFusion + : RISCVFusionFeature<"xqci-movimm-longlogical", "HasMOVIMMLongAccumXqciFusion", + "Enable MOVIMM + long accumulate macrofusion">; + +def TuneMovALUXqciFusion + : RISCVFusionFeature<"xqci-mov-longlogical", "HasMovALUXqciFusion", + "Enable MOV + long accumulate macrofusion">; + //===----------------------------------------------------------------------===// // CPU Families (alphabetized by vendor). //===----------------------------------------------------------------------===// diff --git a/llvm/lib/Target/RISCV/RISCVMacroFusion.td b/llvm/lib/Target/RISCV/RISCVMacroFusion.td index 875cbebc67f0bd..08e49f93a48732 100644 --- a/llvm/lib/Target/RISCV/RISCVMacroFusion.td +++ b/llvm/lib/Target/RISCV/RISCVMacroFusion.td @@ -13,77 +13,66 @@ // rd = imm[31:0] which decomposes to // lui rd, imm[31:12] // addi(w) rd, rd, imm[11:0] -def TuneLUIADDIFusion - : SimpleFusion<"lui-addi", "HasLUIADDIFusion", - "Enable LUI+ADDI macro fusion", - CheckOpcode<[LUI]>, - CheckOpcode<[ADDI, ADDIW]>>; +def : SimpleFusionFor<TuneLUIADDIFusion, + CheckOpcode<[LUI]>, + CheckOpcode<[ADDI, ADDIW]>>; // Fuse AUIPC followed by ADDI: // auipc rd, imm20 // addi rd, rd, imm12 -def TuneAUIPCADDIFusion - : SimpleFusion<"auipc-addi", "HasAUIPCADDIFusion", - "Enable AUIPC+ADDI macrofusion", - CheckOpcode<[AUIPC]>, - CheckOpcode<[ADDI]>>; +def : SimpleFusionFor<TuneAUIPCADDIFusion, + CheckOpcode<[AUIPC]>, + CheckOpcode<[ADDI]>>; // Fuse zero extension of halfword: // slli rd, rs1, 48 // srli rd, rd, 48 -def TuneZExtHFusion - : SimpleFusion<"zexth", "HasZExtHFusion", - "Enable SLLI+SRLI to be fused to zero extension of halfword", - CheckAll<[ - CheckOpcode<[SLLI]>, - CheckImmOperand<2, 48> - ]>, - CheckAll<[ - CheckOpcode<[SRLI]>, - CheckImmOperand<2, 48> - ]>>; +def : SimpleFusionFor<TuneZExtHFusion, + CheckAll<[ + CheckOpcode<[SLLI]>, + CheckImmOperand<2, 48> + ]>, + CheckAll<[ + CheckOpcode<[SRLI]>, + CheckImmOperand<2, 48> + ]>>; // Fuse zero extension of word: // slli rd, rs1, 32 // srli rd, rd, 32 -def TuneZExtWFusion - : SimpleFusion<"zextw", "HasZExtWFusion", - "Enable SLLI+SRLI to be fused to zero extension of word", - CheckAll<[ - CheckOpcode<[SLLI]>, - CheckImmOperand<2, 32> - ]>, - CheckAll<[ - CheckOpcode<[SRLI]>, - CheckImmOperand<2, 32> - ]>>; +def : SimpleFusionFor<TuneZExtWFusion, + CheckAll<[ + CheckOpcode<[SLLI]>, + CheckImmOperand<2, 32> + ]>, + CheckAll<[ + CheckOpcode<[SRLI]>, + CheckImmOperand<2, 32> + ]>>; // Fuse shifted zero extension of word: // slli rd, rs1, 32 // srli rd, rd, x // where 0 <= x < 32 -def TuneShiftedZExtWFusion - : SimpleFusion<"shifted-zextw", "HasShiftedZExtWFusion", - "Enable SLLI+SRLI to be fused when computing (shifted) word zero extension", - CheckAll<[ - CheckOpcode<[SLLI]>, - CheckImmOperand<2, 32> - ]>, - CheckAll<[ - CheckOpcode<[SRLI]>, - CheckImmOperandRange<2, 0, 31> - ]>>; +def : SimpleFusionFor<TuneShiftedZExtWFusion, + CheckAll<[ + CheckOpcode<[SLLI]>, + CheckImmOperand<2, 32> + ]>, + CheckAll<[ + CheckOpcode<[SRLI]>, + CheckImmOperandRange<2, 0, 31> + ]>>; // Fuse load with add: // add rd, rs1, rs2 // ld rd, 0(rd) -def TuneLDADDFusion - : SimpleFusion<"ld-add", "HasLDADDFusion", "Enable LD+ADD macrofusion", - CheckOpcode<[ADD]>, - CheckAll<[ - CheckOpcode<[LD]>, - CheckImmOperand<2, 0> - ]>>; +def : SimpleFusionFor<TuneLDADDFusion, + CheckOpcode<[ADD]>, + CheckAll<[ + CheckOpcode<[LD]>, + CheckImmOperand<2, 0> + ]>>; defvar Load = [LB, LH, LW, LD, LBU, LHU, LWU]; defvar LoadStore = [LB, LBU, LH, LHU, LW, LWU, LD, @@ -98,167 +87,142 @@ defvar ShiftRight = [SRLI, SRLIW, SRAI, SRAIW]; // Fuse add(.uw) followed by a load (lb, lh, lw, ld, lbu, lhu, lwu): // add(.uw) rd, rs1, rs2 // load rd, imm12(rd) -def TuneADDLoadFusion - : SimpleFusion<"add-load", "HasADDLoadFusion", "Enable ADD(.UW) + load macrofusion", - CheckOpcode<[ADD, ADD_UW]>, - CheckOpcode<Load>>; +def : SimpleFusionFor<TuneADDLoadFusion, + CheckOpcode<[ADD, ADD_UW]>, + CheckOpcode<Load>>; // Fuse AUIPC followed by by a load (lb, lh, lw, ld, lbu, lhu, lwu) // auipc rd, imm20 // load rd, imm12(rd) -def TuneAUIPCLoadFusion - : SimpleFusion<"auipc-load", "HasAUIPCLoadFusion", - "Enable AUIPC + load macrofusion", - CheckOpcode<[AUIPC]>, - CheckOpcode<Load>>; +def : SimpleFusionFor<TuneAUIPCLoadFusion, + CheckOpcode<[AUIPC]>, + CheckOpcode<Load>>; // Fuse LUI followed by a load (lb, lh, lw, ld, lbu, lhu, lwu) // lui rd, imm[31:12] // load rd, imm12(rd) -def TuneLUILoadFusion - : SimpleFusion<"lui-load", "HasLUILoadFusion", - "Enable LUI + load macrofusion", - CheckOpcode<[LUI]>, - CheckOpcode<Load>>; +def : SimpleFusionFor<TuneLUILoadFusion, + CheckOpcode<[LUI]>, + CheckOpcode<Load>>; defvar RV32GPRLoadStore = [LB, LBU, LH, LHU, LW, SB, SH, SW]; -def TuneQCELILoadStoreFusion - : Fusion<"qc-e-li-load-store", "HasQCELILoadStoreFusion", - "Enable QC.E.LI + Load/Store macrofusion", - [ - SecondFusionPredicateWithMCInstPredicate<CheckOpcode<RV32GPRLoadStore>>, - WildcardTrue, - FirstFusionPredicateWithMCInstPredicate<CheckOpcode<[QC_E_LI]>>, - OneUse, - TieReg<0, 1>, - ]>; +def : FusionFor<TuneQCELILoadStoreFusion, + [ + SecondFusionPredicateWithMCInstPredicate<CheckOpcode<RV32GPRLoadStore>>, + WildcardTrue, + FirstFusionPredicateWithMCInstPredicate<CheckOpcode<[QC_E_LI]>>, + OneUse, + TieReg<0, 1>, + ]>; // Bitfield extract fusion: similar to TuneShiftedZExtWFusion // but without the immediate restriction // slli rd, rs1, imm12 // srli rd, rd, imm12 -def TuneBFExtFusion - : SimpleFusion<"bfext", "HasBFExtFusion", - "Enable SLLI+SRLI (bitfield extract) macrofusion", - CheckOpcode<[SLLI]>, - CheckOpcode<[SRLI]>>; +def : SimpleFusionFor<TuneBFExtFusion, + CheckOpcode<[SLLI]>, + CheckOpcode<[SRLI]>>; // Fuse ADDI followed by a load (lb, lh, lw, ld, lbu, lhu, lwu) // addi rd, rs1, imm12 // load rd, imm12(rd) -def TuneADDILoadFusion - : SimpleFusion<"addi-load", "HasADDILoadFusion", - "Enable ADDI + load macrofusion", - CheckOpcode<[ADDI]>, - CheckOpcode<Load>>; +def : SimpleFusionFor<TuneADDILoadFusion, + CheckOpcode<[ADDI]>, + CheckOpcode<Load>>; // Fuse shXadd(.uw) followed by a load (lb, lh, lw, ld, lbu, lhu, lwu) // shXadd(.uw) rd, rs1, rs2 // load rd, imm12(rd) -def TuneSHXADDLoadFusion - : SimpleFusion<"shxadd-load", "HasSHXADDLoadFusion", - "Enable SH(1|2|3)ADD(.UW) + load macrofusion", - CheckOpcode<[SH1ADD, SH2ADD, SH3ADD, SH1ADD_UW, SH2ADD_UW, SH3ADD_UW]>, - CheckOpcode<Load>>; +def : SimpleFusionFor<TuneSHXADDLoadFusion, + CheckOpcode<[SH1ADD, SH2ADD, SH3ADD, SH1ADD_UW, SH2ADD_UW, SH3ADD_UW]>, + CheckOpcode<Load>>; // Fuse logic operation followed by another logic operation: // and/or/xor rd, rs1, rs2 // and/or/xor rd, rd, rs3 let IsCommutable = 1 in -def TuneFusionLogicRegReg - : SimpleFusion<"logic-reg-reg", "HasFusionLogicRegReg", - "Enable AND/OR/XOR+AND/OR/XOR macrofusion", - CheckOpcode<LogicOp>, - CheckOpcode<LogicOp>>; +def : SimpleFusionFor<TuneFusionLogicRegReg, + CheckOpcode<LogicOp>, + CheckOpcode<LogicOp>>; // Fuse logic operation followed by logic immediate operation: // and/or/xor rd, rs1, rs2 // andi/ori/xori rd, rd, imm -def TuneFusionLogicRegImm - : SimpleFusion<"logic-reg-imm", "HasFusionLogicRegImm", - "Enable AND/OR/XOR+ANDI/ORI/XORI macrofusion", - CheckOpcode<LogicOp>, - CheckOpcode<LogicImmOp>>; +def : SimpleFusionFor<TuneFusionLogicRegImm, + CheckOpcode<LogicOp>, + CheckOpcode<LogicImmOp>>; // Fuse logic immediate operation followed by logic operation: // andi/ori/xori rd, rs1, imm // and/or/xor rd, rd, rs2 let IsCommutable = 1 in -def TuneFusionLogicImmReg - : SimpleFusion<"logic-imm-reg", "HasFusionLogicImmReg", - "Enable ANDI/ORI/XORI+AND/OR/XOR macrofusion", - CheckOpcode<LogicImmOp>, - CheckOpcode<LogicOp>>; +def : SimpleFusionFor<TuneFusionLogicImmReg, + CheckOpcode<LogicImmOp>, + CheckOpcode<LogicOp>>; // Fuse multiply followed by add: // mul(w) rd, rs1, rs2 // add(w) rd, rd, rs3 -def TuneFusionMulAdd - : SimpleFusion<"mul-add", "HasFusionMulAdd", - "Enable MUL+ADD macrofusion", - CheckOpcode<[MUL, MULW]>, - CheckOpcode<[ADD, ADDW]>, - epilog = [ - // Check that both instructions have the same width - FusionPredicateWithCode<[{ - if ((FirstMI->getDesc().TSFlags & RISCVII::IsSignExtendingOpWMask) != - (SecondMI.getDesc().TSFlags & RISCVII::IsSignExtendingOpWMask)) - return false; - }]>, - SecondFusionPredicateWithMCInstPredicate< - CheckNot<CheckSameRegOperand<0, 2>> - > - ]>; +def : SimpleFusionFor<TuneFusionMulAdd, + CheckOpcode<[MUL, MULW]>, + CheckOpcode<[ADD, ADDW]>, + epilog = [ + // Check that both instructions have the same width + FusionPredicateWithCode<[{ + if ((FirstMI->getDesc().TSFlags & RISCVII::IsSignExtendingOpWMask) != + (SecondMI.getDesc().TSFlags & RISCVII::IsSignExtendingOpWMask)) + return false; + }]>, + SecondFusionPredicateWithMCInstPredicate< + CheckNot<CheckSameRegOperand<0, 2>> + > + ]>; // Fuse add with load or store with zero offset: // add rd, rs1, rs2 // load/store rt, 0(rd) -def TuneFusionAddMem - : Fusion<"add-mem", "HasFusionAddMem", - "Enable ADD+LOAD/STORE macrofusion", - [ - SecondFusionPredicateWithMCInstPredicate< - CheckAll<[ - CheckOpcode<LoadStore>, - CheckImmOperand<2, 0> - ]> - >, - WildcardTrue, - FirstFusionPredicateWithMCInstPredicate< - CheckAll<[ - CheckOpcode<[ADD]>, - CheckNot<CheckSameRegOperand<0, 1>>, - CheckNot<CheckSameRegOperand<0, 2>> - ]> - >, - TieReg<0, 1> - ]>; +def : FusionFor<TuneFusionAddMem, + [ + SecondFusionPredicateWithMCInstPredicate< + CheckAll<[ + CheckOpcode<LoadStore>, + CheckImmOperand<2, 0> + ]> + >, + WildcardTrue, + FirstFusionPredicateWithMCInstPredicate< + CheckAll<[ + CheckOpcode<[ADD]>, + CheckNot<CheckSameRegOperand<0, 1>>, + CheckNot<CheckSameRegOperand<0, 2>> + ]> + >, + TieReg<0, 1> + ]>; // Fuse shift left followed by shift right for bit extraction: // slli(w) rd, rs1, imm1 // srli(w)/srai(w) rd, rd, imm2 // where imm1 <= imm2 -def TuneFusionShiftBitExtract - : SimpleFusion<"shift-bit-extract", "HasFusionShiftBitExtract", - "Enable SLLI+SRLI/SRAI macrofusion", - CheckOpcode<ShiftLeft>, - CheckOpcode<ShiftRight>, - epilog = [ - // Check that both instructions have the same width - FusionPredicateWithCode<[{ - if ((FirstMI->getDesc().TSFlags & RISCVII::IsSignExtendingOpWMask) != - (SecondMI.getDesc().TSFlags & RISCVII::IsSignExtendingOpWMask)) - return false; - }]>, - // Check that FirstMI's immediate <= SecondMI's immediate - FusionPredicateWithCode<[{ - if (!(FirstMI->getOperand(2).isImm() && - SecondMI.getOperand(2).isImm() && - FirstMI->getOperand(2).getImm() <= - SecondMI.getOperand(2).getImm())) - return false; - }]>, - ]>; +def : SimpleFusionFor<TuneFusionShiftBitExtract, + CheckOpcode<ShiftLeft>, + CheckOpcode<ShiftRight>, + epilog = [ + // Check that both instructions have the same width + FusionPredicateWithCode<[{ + if ((FirstMI->getDesc().TSFlags & RISCVII::IsSignExtendingOpWMask) != + (SecondMI.getDesc().TSFlags & RISCVII::IsSignExtendingOpWMask)) + return false; + }]>, + // Check that FirstMI's immediate <= SecondMI's immediate + FusionPredicateWithCode<[{ + if (!(FirstMI->getOperand(2).isImm() && + SecondMI.getOperand(2).isImm() && + FirstMI->getOperand(2).getImm() <= + SecondMI.getOperand(2).getImm())) + return false; + }]>, + ]>; // Xqci macro fusions. diff --git a/llvm/lib/Target/RISCV/RISCVMacroFusionXQCI.td b/llvm/lib/Target/RISCV/RISCVMacroFusionXQCI.td index d1fc6ca0db9831..9d4d1b8f51acc6 100644 --- a/llvm/lib/Target/RISCV/RISCVMacroFusionXQCI.td +++ b/llvm/lib/Target/RISCV/RISCVMacroFusionXQCI.td @@ -18,88 +18,76 @@ defvar LongLoadStoreXqciOp = [QC_E_LB, QC_E_LBU, QC_E_LH, QC_E_LHU, QC_E_LW, defvar LongAccumXqciOp = [QC_E_XORAI, QC_E_ORAI, QC_E_ANDAI, QC_E_ADDAI]; // Fuse load-immediate/move-immediate followed by arithmetic/logic. -def TuneMOVIMMALUXqciFusion - : SimpleFusion<"xqci-movimm-alu", "HasMOVIMMALUXqciFusion", - "Enable MOVIMM + ALU operations macrofusion", - CheckAny<[ - CheckAll<[ - CheckOpcode<[ADDI]>, - CheckRegOperand<1, X0> - ]>, - CheckOpcode<LoadImmOp>, - CheckOpcode<[AUIPC]>, - ]>, - CheckOpcode<[ - ADD, ADDI, SUB, MUL, - AND, ANDI, ANDN, OR, ORI, ORN, XOR, XORI, XNOR, - QC_E_ANDI, QC_E_ORI, QC_E_XORI, - SLLI, SRLI, SRAI, QC_LI, QC_E_LI, - MAX, MAXU, MIN, MINU - ]>>; +def : SimpleFusionFor<TuneMOVIMMALUXqciFusion, + CheckAny<[ + CheckAll<[ + CheckOpcode<[ADDI]>, + CheckRegOperand<1, X0> + ]>, + CheckOpcode<LoadImmOp>, + CheckOpcode<[AUIPC]>, + ]>, + CheckOpcode<[ + ADD, ADDI, SUB, MUL, + AND, ANDI, ANDN, OR, ORI, ORN, XOR, XORI, XNOR, + QC_E_ANDI, QC_E_ORI, QC_E_XORI, + SLLI, SRLI, SRAI, QC_LI, QC_E_LI, + MAX, MAXU, MIN, MINU + ]>>; // Fuse load-immediate/move-immediate followed by multiply. -def TuneMOVIMMMULXqciFusion - : SimpleFusion<"xqci-movimm-mul", "HasMOVIMMMULXqciFusion", - "Enable MOVIMM + multiply macrofusion", - CheckAny<[ - CheckAll<[ - CheckOpcode<[ADDI]>, - CheckRegOperand<1, X0> - ]>, - CheckOpcode<LoadImmOp>, - ]>, - CheckOpcode<[MUL]>>; +def : SimpleFusionFor<TuneMOVIMMMULXqciFusion, + CheckAny<[ + CheckAll<[ + CheckOpcode<[ADDI]>, + CheckRegOperand<1, X0> + ]>, + CheckOpcode<LoadImmOp>, + ]>, + CheckOpcode<[MUL]>>; // Fuse load-immediate/move-immediate followed by long load/store. -def TuneMOVIMMLoadStoreXqciFusion - : SimpleFusion<"xqci-movimm-ldst", "HasMOVIMMLoadStoreXqciFusion", - "Enable MOVIMM + long Load/Store macrofusion", - CheckAny<[ - CheckAll<[ - CheckOpcode<[ADDI]>, - CheckRegOperand<1, X0> - ]>, - CheckOpcode<LoadImmOp>, - ]>, - CheckOpcode<LongLoadStoreXqciOp>>; +def : SimpleFusionFor<TuneMOVIMMLoadStoreXqciFusion, + CheckAny<[ + CheckAll<[ + CheckOpcode<[ADDI]>, + CheckRegOperand<1, X0> + ]>, + CheckOpcode<LoadImmOp>, + ]>, + CheckOpcode<LongLoadStoreXqciOp>>; // Fuse load-immediate/move-immediate followed by a jump. -def TuneMOVIMMJumpXqciFusion - : SimpleFusion<"xqci-movimm-jump", "HasMOVIMMJumpXqciFusion", - "Enable MOVIMM + Jump macrofusion", - CheckAny<[ - CheckAll<[ - CheckOpcode<[ADDI]>, - CheckRegOperand<1, X0> - ]>, - CheckOpcode<LoadImmOp>, - ]>, - CheckOpcode<[JALR]>>; +def : SimpleFusionFor<TuneMOVIMMJumpXqciFusion, + CheckAny<[ + CheckAll<[ + CheckOpcode<[ADDI]>, + CheckRegOperand<1, X0> + ]>, + CheckOpcode<LoadImmOp>, + ]>, + CheckOpcode<[JALR]>>; // The destination register of the first operation is the same as the // destination register of the second operation. // Fuse load-immediate/move-immediate followed by long accumulate operation. -def TuneMOVIMMLongAccumXciFusion - : SimpleFusion<"xqci-movimm-longlogical", "HasMOVIMMLongAccumXqciFusion", - "Enable MOVIMM + long accumulate macrofusion", - CheckAny<[ - CheckAll<[ - CheckOpcode<[ADDI]>, - CheckRegOperand<1, X0> - ]>, - CheckOpcode<LoadImmOp>, - ]>, - CheckOpcode<LongAccumXqciOp>, - epilog=[TieReg<0, 0>]>; +def : SimpleFusionFor<TuneMOVIMMLongAccumXciFusion, + CheckAny<[ + CheckAll<[ + CheckOpcode<[ADDI]>, + CheckRegOperand<1, X0> + ]>, + CheckOpcode<LoadImmOp>, + ]>, + CheckOpcode<LongAccumXqciOp>, + epilog=[TieReg<0, 0>]>; // Fuse move followed by long accumulate operation. -def TuneMovALUXqciFusion - : SimpleFusion<"xqci-mov-longlogical", "HasMovALUXqciFusion", - "Enable MOV + long accumulate macrofusion", - CheckAll<[ - CheckOpcode<[ADDI]>, - CheckImmOperand<2, 0>, - ]>, - CheckOpcode<LongAccumXqciOp>, - epilog=[TieReg<0, 0>]>; +def : SimpleFusionFor<TuneMovALUXqciFusion, + CheckAll<[ + CheckOpcode<[ADDI]>, + CheckImmOperand<2, 0>, + ]>, + CheckOpcode<LongAccumXqciOp>, + epilog=[TieReg<0, 0>]>; _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
