aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/Target/RISCV/RISCVGISelShift.rccdesc
blob: bf9bf71b292d5a2892a6909e66acbed2fe7d97a0 (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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# SPDX-License-Identifier: GPL-3.0-or-later

selection_rules:
  -
    id: select_g_lshr_s64_word_immediate
    priority: 500
    match:
      opcode: G_LSHR
      result_type: { kind: scalar, bits: 64 }
      operand_types:
        - { index: 1, kind: scalar, bits: 64 }
        - { index: 2, kind: scalar, bits: 64 }
      operand_banks:
        - { index: 0, bank: GPR }
        - { index: 1, bank: GPR }
        - { index: 2, bank: GPR }
      operand_def_constants:
        - index: 2
          ranges: [{ min: 0, max: 31 }]
      def_use:
        - operand: 1
          opcode: G_AND
          captures:
            - { id: source, operand: 1 }
          operand_def_constants:
            - index: 2
              ranges: [{ min: 4294967295, max: 4294967295 }]
    apply:
      instructions:
        - opcode: SRLIW
          root: true
          operands:
            - { operand: 0 }
            - { captured_operand: source }
            - { captured_immediate: 2 }
      erase_operand_definitions: [1, 2]
  -
    id: select_g_ashr_s64_word_immediate
    priority: 500
    match:
      opcode: G_ASHR
      result_type: { kind: scalar, bits: 64 }
      operand_types:
        - { index: 1, kind: scalar, bits: 64 }
        - { index: 2, kind: scalar, bits: 64 }
      operand_banks:
        - { index: 0, bank: GPR }
        - { index: 1, bank: GPR }
        - { index: 2, bank: GPR }
      operand_def_constants:
        - index: 2
          ranges: [{ min: 0, max: 31 }]
      def_use:
        - operand: 1
          opcode: G_SEXT_INREG
          captures:
            - { id: source, operand: 1 }
          operand_def_constants:
            - index: 2
              ranges: [{ min: 32, max: 32 }]
    apply:
      instructions:
        - opcode: SRAIW
          root: true
          operands:
            - { operand: 0 }
            - { captured_operand: source }
            - { captured_immediate: 2 }
      erase_operand_definitions: [1, 2]
  -
    id: select_g_shl_s64_immediate
    priority: 400
    match:
      opcode: G_SHL
      result_type: { kind: scalar, bits: 64 }
      operand_types:
        - { index: 1, kind: scalar, bits: 64 }
        - { index: 2, kind: scalar, bits: 64 }
      operand_banks:
        - { index: 0, bank: GPR }
        - { index: 1, bank: GPR }
        - { index: 2, bank: GPR }
      operand_def_constants:
        - index: 2
          ranges: [{ min: 0, max: 63 }]
    apply:
      instructions:
        - opcode: SLLI
          root: true
          operands: [{ operand: 0 }, { operand: 1 }, { captured_immediate: 2 }]
      erase_operand_definitions: [2]
  -
    id: select_g_lshr_s64_immediate
    priority: 400
    match:
      opcode: G_LSHR
      result_type: { kind: scalar, bits: 64 }
      operand_types:
        - { index: 1, kind: scalar, bits: 64 }
        - { index: 2, kind: scalar, bits: 64 }
      operand_banks:
        - { index: 0, bank: GPR }
        - { index: 1, bank: GPR }
        - { index: 2, bank: GPR }
      operand_def_constants:
        - index: 2
          ranges: [{ min: 0, max: 63 }]
    apply:
      instructions:
        - opcode: SRLI
          root: true
          operands: [{ operand: 0 }, { operand: 1 }, { captured_immediate: 2 }]
      erase_operand_definitions: [2]
  -
    id: select_g_ashr_s64_immediate
    priority: 400
    match:
      opcode: G_ASHR
      result_type: { kind: scalar, bits: 64 }
      operand_types:
        - { index: 1, kind: scalar, bits: 64 }
        - { index: 2, kind: scalar, bits: 64 }
      operand_banks:
        - { index: 0, bank: GPR }
        - { index: 1, bank: GPR }
        - { index: 2, bank: GPR }
      operand_def_constants:
        - index: 2
          ranges: [{ min: 0, max: 63 }]
    apply:
      instructions:
        - opcode: SRAI
          root: true
          operands: [{ operand: 0 }, { operand: 1 }, { captured_immediate: 2 }]
      erase_operand_definitions: [2]
  -
    id: select_g_shl_s64_register
    priority: 100
    match:
      opcode: G_SHL
      result_type: { kind: scalar, bits: 64 }
      operand_types:
        - { index: 1, kind: scalar, bits: 64 }
        - { index: 2, kind: scalar, bits: 64 }
      operand_banks:
        - { index: 0, bank: GPR }
        - { index: 1, bank: GPR }
        - { index: 2, bank: GPR }
    apply:
      instructions:
        - opcode: SLL
          root: true
          operands:
            - { operand: 0 }
            - { operand: 1 }
            - { complex: shift_mask_xlen, operand: 2 }
  -
    id: select_g_lshr_s64_register
    priority: 100
    match:
      opcode: G_LSHR
      result_type: { kind: scalar, bits: 64 }
      operand_types:
        - { index: 1, kind: scalar, bits: 64 }
        - { index: 2, kind: scalar, bits: 64 }
      operand_banks:
        - { index: 0, bank: GPR }
        - { index: 1, bank: GPR }
        - { index: 2, bank: GPR }
    apply:
      instructions:
        - opcode: SRL
          root: true
          operands:
            - { operand: 0 }
            - { operand: 1 }
            - { complex: shift_mask_xlen, operand: 2 }
  -
    id: select_g_ashr_s64_register
    priority: 100
    match:
      opcode: G_ASHR
      result_type: { kind: scalar, bits: 64 }
      operand_types:
        - { index: 1, kind: scalar, bits: 64 }
        - { index: 2, kind: scalar, bits: 64 }
      operand_banks:
        - { index: 0, bank: GPR }
        - { index: 1, bank: GPR }
        - { index: 2, bank: GPR }
    apply:
      instructions:
        - opcode: SRA
          root: true
          operands:
            - { operand: 0 }
            - { operand: 1 }
            - { complex: shift_mask_xlen, operand: 2 }