1 //==----- RISCVMacroFusion.td - Macro Fusion Definitions -----*- tablegen -*-=//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // ===---------------------------------------------------------------------===//
10 // The following definitions describe the macro fusion predicators.
12 // Fuse LUI followed by ADDI or ADDIW:
13 // rd = imm[31:0] which decomposes to
15 // addi(w) rd, rd, imm[11:0]
17 : SimpleFusion<"lui-addi-fusion", "HasLUIADDIFusion",
18 "Enable LUI+ADDI macro fusion",
20 CheckOpcode<[ADDI, ADDIW]>>;
22 // Fuse AUIPC followed by ADDI:
25 def TuneAUIPCADDIFusion
26 : SimpleFusion<"auipc-addi-fusion", "HasAUIPCADDIFusion",
27 "Enable AUIPC+ADDI macrofusion",
31 // Fuse zero extension of halfword:
35 : SimpleFusion<"zexth-fusion", "HasZExtHFusion",
36 "Enable SLLI+SRLI to be fused to zero extension of halfword",
40 CheckImmOperand<2, 48>
45 CheckImmOperand<2, 48>
48 // Fuse zero extension of word:
52 : SimpleFusion<"zextw-fusion", "HasZExtWFusion",
53 "Enable SLLI+SRLI to be fused to zero extension of word",
57 CheckImmOperand<2, 32>
62 CheckImmOperand<2, 32>
65 // Fuse shifted zero extension of word:
69 def TuneShiftedZExtWFusion
70 : SimpleFusion<"shifted-zextw-fusion", "HasShiftedZExtWFusion",
71 "Enable SLLI+SRLI to be fused when computing (shifted) word zero extension",
75 CheckImmOperand<2, 32>
80 CheckImmOperandRange<2, 0, 31>
83 // Fuse load with add:
87 : SimpleFusion<"ld-add-fusion", "HasLDADDFusion", "Enable LD+ADD macrofusion",