aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/Target/RISCV/RISCVMacroFusion.rccdesc
blob: 2c432a2ef270ee253ccd0b2b439912c794b5a940 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# SPDX-License-Identifier: GPL-3.0-or-later

macro_fusion_rules:
  -
    id: TuneLUIADDIFusion
    feature: fusion-lui-addi
    first_opcodes: [LUI]
    second_opcodes: [ADDI, ADDIW]
    link: { first_definition: 0, second_use: 1, second_definition: 0, one_non_debug_use: true, second_destination_tied: true }
  -
    id: TuneAUIPCADDIFusion
    feature: fusion-auipc-addi
    first_opcodes: [AUIPC]
    second_opcodes: [ADDI]
    link: { first_definition: 0, second_use: 1, second_definition: 0, one_non_debug_use: true, second_destination_tied: true }
  -
    id: TuneZExtHFusion
    feature: fusion-zexth
    first_opcodes: [SLLI]
    second_opcodes: [SRLI]
    immediates:
      - { instruction: first, operand: 2, min: 48, max: 48 }
      - { instruction: second, operand: 2, min: 48, max: 48 }
    link: { first_definition: 0, second_use: 1, second_definition: 0, one_non_debug_use: true, second_destination_tied: true }
  -
    id: TuneZExtWFusion
    feature: fusion-zextw
    first_opcodes: [SLLI]
    second_opcodes: [SRLI]
    immediates:
      - { instruction: first, operand: 2, min: 32, max: 32 }
      - { instruction: second, operand: 2, min: 32, max: 32 }
    link: { first_definition: 0, second_use: 1, second_definition: 0, one_non_debug_use: true, second_destination_tied: true }
  -
    id: TuneShiftedZExtWFusion
    feature: fusion-shifted-zextw
    first_opcodes: [SLLI]
    second_opcodes: [SRLI]
    immediates:
      - { instruction: first, operand: 2, min: 32, max: 32 }
      - { instruction: second, operand: 2, min: 0, max: 31 }
    link: { first_definition: 0, second_use: 1, second_definition: 0, one_non_debug_use: true, second_destination_tied: true }
  -
    id: TuneLDADDFusion
    feature: fusion-ld-add
    first_opcodes: [ADD]
    second_opcodes: [LD]
    immediates:
      - { instruction: second, operand: 2, min: 0, max: 0 }
    link: { first_definition: 0, second_use: 1, second_definition: 0, one_non_debug_use: true, second_destination_tied: true }
  -
    id: TuneADDLoadFusion
    feature: fusion-add-load
    first_opcodes: [ADD, ADD_UW]
    second_opcodes: [LB, LH, LW, LD, LBU, LHU, LWU]
    link: { first_definition: 0, second_use: 1, second_definition: 0, one_non_debug_use: true, second_destination_tied: true }
  -
    id: TuneAUIPCLoadFusion
    feature: fusion-auipc-load
    first_opcodes: [AUIPC]
    second_opcodes: [LB, LH, LW, LD, LBU, LHU, LWU]
    link: { first_definition: 0, second_use: 1, second_definition: 0, one_non_debug_use: true, second_destination_tied: true }
  -
    id: TuneLUILoadFusion
    feature: fusion-lui-load
    first_opcodes: [LUI]
    second_opcodes: [LB, LH, LW, LD, LBU, LHU, LWU]
    link: { first_definition: 0, second_use: 1, second_definition: 0, one_non_debug_use: true, second_destination_tied: true }
  -
    id: TuneBFExtFusion
    feature: fusion-bfext
    first_opcodes: [SLLI]
    second_opcodes: [SRLI]
    link: { first_definition: 0, second_use: 1, second_definition: 0, one_non_debug_use: true, second_destination_tied: true }
  -
    id: TuneADDILoadFusion
    feature: fusion-addi-load
    first_opcodes: [ADDI]
    second_opcodes: [LB, LH, LW, LD, LBU, LHU, LWU]
    link: { first_definition: 0, second_use: 1, second_definition: 0, one_non_debug_use: true, second_destination_tied: true }
  -
    id: TuneSHXADDLoadFusion
    feature: fusion-shxadd-load
    first_opcodes: [SH1ADD, SH2ADD, SH3ADD, SH1ADD_UW, SH2ADD_UW, SH3ADD_UW]
    second_opcodes: [LB, LH, LW, LD, LBU, LHU, LWU]
    link: { first_definition: 0, second_use: 1, second_definition: 0, one_non_debug_use: true, second_destination_tied: true }
  -
    id: TuneFusionLogicRegReg
    feature: fusion-logic-reg-reg
    first_opcodes: [AND, OR, XOR]
    second_opcodes: [AND, OR, XOR]
    link: { first_definition: 0, second_use: 1, second_definition: 0, commutable_second_use: 2, one_non_debug_use: true, second_destination_tied: true }
  -
    id: TuneFusionLogicRegImm
    feature: fusion-logic-reg-imm
    first_opcodes: [AND, OR, XOR]
    second_opcodes: [ANDI, ORI, XORI]
    link: { first_definition: 0, second_use: 1, second_definition: 0, one_non_debug_use: true, second_destination_tied: true }
  -
    id: TuneFusionLogicImmReg
    feature: fusion-logic-imm-reg
    first_opcodes: [ANDI, ORI, XORI]
    second_opcodes: [AND, OR, XOR]
    link: { first_definition: 0, second_use: 1, second_definition: 0, commutable_second_use: 2, one_non_debug_use: true, second_destination_tied: true }
  -
    id: TuneFusionMulAdd
    feature: fusion-mul-add
    first_opcodes: [MUL, MULW]
    second_opcodes: [ADD, ADDW]
    opcode_pairs:
      - { first: MUL, second: ADD }
      - { first: MULW, second: ADDW }
    register_not_equal:
      - { instruction: second, left: 0, right: 2 }
    link: { first_definition: 0, second_use: 1, second_definition: 0, one_non_debug_use: true, second_destination_tied: true }
  -
    id: TuneFusionAddMem
    feature: fusion-add-mem
    first_opcodes: [ADD]
    second_opcodes: [LB, LBU, LH, LHU, LW, LWU, LD, FLW, FLD, SB, SH, SW, SD, FSW, FSD]
    immediates:
      - { instruction: second, operand: 2, min: 0, max: 0 }
    register_not_equal:
      - { instruction: first, left: 0, right: 1 }
      - { instruction: first, left: 0, right: 2 }
    link: { first_definition: 0, second_use: 1, second_definition: 0, one_non_debug_use: false, second_destination_tied: false }
  -
    id: TuneFusionShiftBitExtract
    feature: fusion-shift-bit-extract
    first_opcodes: [SLLI, SLLIW]
    second_opcodes: [SRLI, SRLIW, SRAI, SRAIW]
    opcode_pairs:
      - { first: SLLI, second: SRLI }
      - { first: SLLI, second: SRAI }
      - { first: SLLIW, second: SRLIW }
      - { first: SLLIW, second: SRAIW }
    immediate_relations:
      - { kind: less_equal, first_operand: 2, second_operand: 2 }
    link: { first_definition: 0, second_use: 1, second_definition: 0, one_non_debug_use: true, second_destination_tied: true }