1 |
1612 |
phoenix |
;; Machine description for GNU compiler, OpenRISC 1000 family, OR32 ISA
|
2 |
|
|
;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
3 |
|
|
;; Contributed by Damjan Lampret in 1999.
|
4 |
|
|
;; Major optimizations by Matjaz Breskvar in 2005.
|
5 |
|
|
|
6 |
|
|
;; This file is part of GNU CC.
|
7 |
|
|
|
8 |
|
|
;; GNU CC is free software; you can redistribute it and/or modify
|
9 |
|
|
;; it under the terms of the GNU General Public License as published by
|
10 |
|
|
;; the Free Software Foundation; either version 1, or (at your option)
|
11 |
|
|
;; any later version.
|
12 |
|
|
|
13 |
|
|
;; GNU CC is distributed in the hope that it will be useful,
|
14 |
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
|
|
;; GNU General Public License for more details.
|
17 |
|
|
|
18 |
|
|
;; You should have received a copy of the GNU General Public License
|
19 |
|
|
;; along with GNU CC; see the file COPYING. If not, write to
|
20 |
|
|
;; the Free Software Foundation, 59 Temple Place - Suite 330,
|
21 |
|
|
;; Boston, MA 02111-1307, USA.
|
22 |
|
|
|
23 |
|
|
(define_attr "type"
|
24 |
|
|
"unknown,load,store,move,extend,logic,add,mul,shift,compare,branch,jump,fp"
|
25 |
|
|
(const_string "unknown"))
|
26 |
|
|
|
27 |
|
|
;; Number of instructions
|
28 |
|
|
(define_attr "length" "" (const_int 1))
|
29 |
|
|
|
30 |
|
|
(define_delay (eq_attr "type" "branch,jump")
|
31 |
|
|
[(and (eq_attr "type" "!branch,jump")
|
32 |
|
|
(eq_attr "length" "1")) (nil) (nil)])
|
33 |
|
|
|
34 |
|
|
;; (define_function_unit NAME MULTIPLICITY SIMULTANEITY
|
35 |
|
|
;; TEST READY-DELAY ISSUE-DELAY [CONFLICT-LIST])
|
36 |
|
|
;; MULTIPLICITY - Number of functional units of this type
|
37 |
|
|
;; SIMULTANEITY - Zero for pipelined functional unit
|
38 |
|
|
;; READY-DELAY - Number of cycles before result is available
|
39 |
|
|
;; ISSUE-DELAY - Number of cycles before unit can accept new instruction
|
40 |
|
|
;;
|
41 |
|
|
(define_function_unit "bit_unit" 1 0 (eq_attr "type" "shift") 3 1)
|
42 |
|
|
(define_function_unit "lsu" 1 0 (eq_attr "type" "load") 3 3)
|
43 |
|
|
(define_function_unit "lsu" 1 0 (eq_attr "type" "store") 2 1)
|
44 |
|
|
(define_function_unit "alu" 1 0 (eq_attr "type" "add,logic,extend,move,compare") 2 1)
|
45 |
|
|
(define_function_unit "mul_unit" 1 0 (eq_attr "type" "mul") 16 16)
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
;; Called after register allocation to add any instructions needed for the
|
49 |
|
|
;; prologue. Using a prologue insn is favored compared to putting all of the
|
50 |
|
|
;; instructions in output_function_prologue(), since it allows the scheduler
|
51 |
|
|
;; to intermix instructions with the saves of the caller saved registers. In
|
52 |
|
|
;; some cases, it might be necessary to emit a barrier instruction as the last
|
53 |
|
|
;; insn to prevent such scheduling.
|
54 |
|
|
|
55 |
|
|
(define_expand "prologue"
|
56 |
|
|
[(use (const_int 1))]
|
57 |
|
|
"TARGET_SCHED_LOGUE"
|
58 |
|
|
{
|
59 |
|
|
or32_expand_prologue ();
|
60 |
|
|
DONE;
|
61 |
|
|
})
|
62 |
|
|
|
63 |
|
|
;; Called after register allocation to add any instructions needed for the
|
64 |
|
|
;; epilogue. Using an epilogue insn is favored compared to putting all of the
|
65 |
|
|
;; instructions in output_function_epilogue(), since it allows the scheduler
|
66 |
|
|
;; to intermix instructions with the restores of the caller saved registers.
|
67 |
|
|
;; In some cases, it might be necessary to emit a barrier instruction as the
|
68 |
|
|
;; first insn to prevent such scheduling.
|
69 |
|
|
(define_expand "epilogue"
|
70 |
|
|
[(use (const_int 2))]
|
71 |
|
|
"TARGET_SCHED_LOGUE"
|
72 |
|
|
{
|
73 |
|
|
or32_expand_epilogue (false);
|
74 |
|
|
DONE;
|
75 |
|
|
})
|
76 |
|
|
|
77 |
|
|
(define_expand "sibcall_epilogue"
|
78 |
|
|
[(use (const_int 2))]
|
79 |
|
|
"TARGET_SCHED_LOGUE"
|
80 |
|
|
{
|
81 |
|
|
or32_expand_epilogue (true);
|
82 |
|
|
DONE;
|
83 |
|
|
})
|
84 |
|
|
|
85 |
|
|
(define_insn "return_internal"
|
86 |
|
|
[(return)
|
87 |
|
|
(use (match_operand 0 "pmode_register_operand" ""))]
|
88 |
|
|
"TARGET_SCHED_LOGUE"
|
89 |
|
|
"l.jr \t%0%("
|
90 |
|
|
[(set_attr "type" "jump")
|
91 |
|
|
(set_attr "length" "1")])
|
92 |
|
|
|
93 |
|
|
;;
|
94 |
|
|
;; Sibcalls
|
95 |
|
|
;;
|
96 |
|
|
|
97 |
|
|
(define_expand "sibcall"
|
98 |
|
|
[(parallel [(call (match_operand 0 "" "")
|
99 |
|
|
(match_operand 1 "" ""))
|
100 |
|
|
(use (match_operand 2 "" "")) ;; next_arg_reg
|
101 |
|
|
(use (match_operand 3 "" ""))])] ;; struct_value_size_rtx
|
102 |
|
|
"TARGET_SIBCALL"
|
103 |
|
|
"
|
104 |
|
|
{
|
105 |
|
|
or32_expand_sibcall (0, XEXP (operands[0], 0), operands[1]);
|
106 |
|
|
DONE;
|
107 |
|
|
}")
|
108 |
|
|
|
109 |
|
|
(define_expand "sibcall_value"
|
110 |
|
|
[(set (match_operand 0 "" "")
|
111 |
|
|
(call (match_operand:SI 1 "" "")
|
112 |
|
|
(match_operand 2 "" "")))]
|
113 |
|
|
"TARGET_SIBCALL"
|
114 |
|
|
"
|
115 |
|
|
{
|
116 |
|
|
or32_expand_sibcall (operands[0], XEXP (operands[1], 0), operands[2]);
|
117 |
|
|
DONE;
|
118 |
|
|
}")
|
119 |
|
|
|
120 |
|
|
(define_insn "sibcall_internal"
|
121 |
|
|
[(call (mem:SI (match_operand:SI 0 "sibcall_insn_operand" "s,r"))
|
122 |
|
|
(match_operand 1 "" ""))
|
123 |
|
|
(use (reg:SI 9))]
|
124 |
|
|
"TARGET_SIBCALL"
|
125 |
|
|
"@
|
126 |
|
|
l.j \t%S0%(\t # sibcall s
|
127 |
|
|
l.jr \t%0%(\t # sibcall r"
|
128 |
|
|
[(set_attr "type" "jump,jump")])
|
129 |
|
|
|
130 |
|
|
|
131 |
|
|
|
132 |
|
|
;;
|
133 |
|
|
;; movQI
|
134 |
|
|
;;
|
135 |
|
|
|
136 |
|
|
(define_expand "movqi"
|
137 |
|
|
[(set (match_operand:QI 0 "general_operand" "")
|
138 |
|
|
(match_operand:QI 1 "general_operand" ""))]
|
139 |
|
|
""
|
140 |
|
|
"
|
141 |
|
|
if (!no_new_pseudos)
|
142 |
|
|
{
|
143 |
|
|
if (GET_CODE (operands[1]) == CONST_INT)
|
144 |
|
|
{
|
145 |
|
|
rtx reg = gen_reg_rtx (SImode);
|
146 |
|
|
|
147 |
|
|
emit_insn (gen_movsi (reg, operands[1]));
|
148 |
|
|
operands[1] = gen_lowpart (QImode, reg);
|
149 |
|
|
}
|
150 |
|
|
if (GET_CODE (operands[1]) == MEM && optimize > 0)
|
151 |
|
|
{
|
152 |
|
|
rtx reg = gen_reg_rtx (SImode);
|
153 |
|
|
|
154 |
|
|
emit_insn (gen_rtx_SET (SImode, reg,
|
155 |
|
|
gen_rtx_ZERO_EXTEND (SImode,
|
156 |
|
|
operands[1])));
|
157 |
|
|
|
158 |
|
|
operands[1] = gen_lowpart (QImode, reg);
|
159 |
|
|
}
|
160 |
|
|
if (GET_CODE (operands[0]) != REG)
|
161 |
|
|
operands[1] = force_reg (QImode, operands[1]);
|
162 |
|
|
}
|
163 |
|
|
")
|
164 |
|
|
|
165 |
|
|
(define_insn "*movqi_internal"
|
166 |
|
|
[(set (match_operand:QI 0 "nonimmediate_operand" "=m,r,r,r,r")
|
167 |
|
|
(match_operand:QI 1 "general_operand" "r,r,I,K,m"))]
|
168 |
|
|
""
|
169 |
|
|
"@
|
170 |
|
|
l.sb \t%0,%1\t # movqi
|
171 |
|
|
l.ori \t%0,%1,0\t # movqi: move reg to reg
|
172 |
|
|
l.addi \t%0,r0,%1\t # movqi: move immediate
|
173 |
|
|
l.ori \t%0,r0,%1\t # movqi: move immediate
|
174 |
|
|
l.lbz \t%0,%1\t # movqi"
|
175 |
|
|
[(set_attr "type" "store,add,add,logic,load")])
|
176 |
|
|
|
177 |
|
|
|
178 |
|
|
;;
|
179 |
|
|
;; movHI
|
180 |
|
|
;;
|
181 |
|
|
|
182 |
|
|
(define_expand "movhi"
|
183 |
|
|
[(set (match_operand:HI 0 "general_operand" "")
|
184 |
|
|
(match_operand:HI 1 "general_operand" ""))]
|
185 |
|
|
""
|
186 |
|
|
"
|
187 |
|
|
if (!no_new_pseudos)
|
188 |
|
|
{
|
189 |
|
|
if (GET_CODE (operands[1]) == CONST_INT)
|
190 |
|
|
{
|
191 |
|
|
rtx reg = gen_reg_rtx (SImode);
|
192 |
|
|
|
193 |
|
|
emit_insn (gen_movsi (reg, operands[1]));
|
194 |
|
|
operands[1] = gen_lowpart (HImode, reg);
|
195 |
|
|
}
|
196 |
|
|
if (GET_CODE (operands[1]) == MEM && optimize > 0)
|
197 |
|
|
{
|
198 |
|
|
rtx reg = gen_reg_rtx (SImode);
|
199 |
|
|
|
200 |
|
|
emit_insn (gen_rtx_SET (SImode, reg,
|
201 |
|
|
gen_rtx_ZERO_EXTEND (SImode,
|
202 |
|
|
operands[1])));
|
203 |
|
|
operands[1] = gen_lowpart (HImode, reg);
|
204 |
|
|
}
|
205 |
|
|
if (GET_CODE (operands[0]) != REG)
|
206 |
|
|
operands[1] = force_reg (HImode, operands[1]);
|
207 |
|
|
}
|
208 |
|
|
")
|
209 |
|
|
|
210 |
|
|
(define_insn "*movhi_internal"
|
211 |
|
|
[(set (match_operand:HI 0 "nonimmediate_operand" "=m,r,r,r,r")
|
212 |
|
|
(match_operand:HI 1 "general_operand" "r,r,I,K,m"))]
|
213 |
|
|
""
|
214 |
|
|
"@
|
215 |
|
|
l.sh \t%0,%1\t # movhi
|
216 |
|
|
l.ori \t%0,%1,0\t # movhi: move reg to reg
|
217 |
|
|
l.addi \t%0,r0,%1\t # movhi: move immediate
|
218 |
|
|
l.ori \t%0,r0,%1\t # movhi: move immediate
|
219 |
|
|
l.lhz \t%0,%1\t # movhi"
|
220 |
|
|
[(set_attr "type" "store,add,add,logic,load")])
|
221 |
|
|
|
222 |
|
|
(define_expand "movsi"
|
223 |
|
|
[(set (match_operand:SI 0 "general_operand" "")
|
224 |
|
|
(match_operand:SI 1 "general_operand" ""))]
|
225 |
|
|
""
|
226 |
|
|
{
|
227 |
|
|
/* Working with CONST_INTs is easier, so convert
|
228 |
|
|
a double if needed. */
|
229 |
|
|
|
230 |
|
|
if (GET_CODE (operands[1]) == CONST_DOUBLE) {
|
231 |
|
|
operands[1] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
|
232 |
|
|
}
|
233 |
|
|
|
234 |
|
|
/* Handle sets of MEM first. */
|
235 |
|
|
if (GET_CODE (operands[0]) == MEM)
|
236 |
|
|
{
|
237 |
|
|
if (register_operand(operands[1], SImode)
|
238 |
|
|
|| (operands[1] == const0_rtx))
|
239 |
|
|
goto movsi_is_ok;
|
240 |
|
|
|
241 |
|
|
if (! reload_in_progress)
|
242 |
|
|
{
|
243 |
|
|
operands[0] = validize_mem (operands[0]);
|
244 |
|
|
operands[1] = force_reg (SImode, operands[1]);
|
245 |
|
|
}
|
246 |
|
|
}
|
247 |
|
|
|
248 |
|
|
/* This makes sure we will not get rematched due to splittage. */
|
249 |
|
|
if (! CONSTANT_P (operands[1]) || input_operand (operands[1], SImode))
|
250 |
|
|
;
|
251 |
|
|
else if (CONSTANT_P (operands[1])
|
252 |
|
|
&& GET_CODE (operands[1]) != HIGH
|
253 |
|
|
&& GET_CODE (operands[1]) != LO_SUM)
|
254 |
|
|
{
|
255 |
|
|
or32_emit_set_const32 (operands[0], operands[1]);
|
256 |
|
|
DONE;
|
257 |
|
|
}
|
258 |
|
|
movsi_is_ok:
|
259 |
|
|
;
|
260 |
|
|
})
|
261 |
|
|
|
262 |
|
|
;;
|
263 |
|
|
;; movSI
|
264 |
|
|
;;
|
265 |
|
|
|
266 |
|
|
(define_insn "*movsi_insn"
|
267 |
|
|
[(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,r,r,r,m")
|
268 |
|
|
(match_operand:SI 1 "input_operand" "I,K,M,r,m,r"))]
|
269 |
|
|
"(register_operand (operands[0], SImode)
|
270 |
|
|
|| register_operand (operands[1], SImode)
|
271 |
|
|
|| (operands[1] == const0_rtx))"
|
272 |
|
|
"@
|
273 |
|
|
l.addi \t%0,r0,%1\t # move immediate I
|
274 |
|
|
l.ori \t%0,r0,%1\t # move immediate K
|
275 |
|
|
l.movhi \t%0,hi(%1)\t # move immediate M
|
276 |
|
|
l.ori \t%0,%1,0\t # move reg to reg
|
277 |
|
|
l.lwz \t%0,%1\t # SI load
|
278 |
|
|
l.sw \t%0,%1\t # SI store"
|
279 |
|
|
[(set_attr "type" "add,load,store,add,logic,move")
|
280 |
|
|
(set_attr "length" "1,1,1,1,1,1")])
|
281 |
|
|
|
282 |
|
|
(define_insn "*movsi_lo_sum"
|
283 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
284 |
|
|
(lo_sum:SI (match_operand:SI 1 "register_operand" "r")
|
285 |
|
|
(match_operand:SI 2 "immediate_operand" "i")))]
|
286 |
|
|
""
|
287 |
|
|
"l.ori \t%0,%1,lo(%2)"
|
288 |
|
|
[(set_attr "type" "logic")
|
289 |
|
|
(set_attr "length" "1")])
|
290 |
|
|
|
291 |
|
|
(define_insn "*movsi_high"
|
292 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
293 |
|
|
(high:SI (match_operand:SI 1 "immediate_operand" "i")))]
|
294 |
|
|
""
|
295 |
|
|
"l.movhi \t%0,hi(%1)"
|
296 |
|
|
[(set_attr "type" "move")
|
297 |
|
|
(set_attr "length" "1")])
|
298 |
|
|
|
299 |
|
|
(define_insn "movsi_insn_big"
|
300 |
|
|
[(set (match_operand:SI 0 "nonimmediate_operand" "=r")
|
301 |
|
|
(match_operand:SI 1 "immediate_operand" "i"))]
|
302 |
|
|
"GET_CODE(operands[1]) != CONST_INT"
|
303 |
|
|
"l.movhi \t%0,hi(%1)\;l.ori \t%0,%0,lo(%1)"
|
304 |
|
|
[(set_attr "type" "move")
|
305 |
|
|
(set_attr "length" "2")])
|
306 |
|
|
|
307 |
|
|
|
308 |
|
|
;;
|
309 |
|
|
;; Conditional Branches & Moves
|
310 |
|
|
;;
|
311 |
|
|
|
312 |
|
|
(define_expand "addsicc"
|
313 |
|
|
[(match_operand:SI 0 "register_operand" "")
|
314 |
|
|
(match_operand 1 "comparison_operator" "")
|
315 |
|
|
(match_operand:SI 2 "register_operand" "")
|
316 |
|
|
(match_operand:SI 3 "register_operand" "")]
|
317 |
|
|
""
|
318 |
|
|
"FAIL;")
|
319 |
|
|
|
320 |
|
|
(define_expand "addhicc"
|
321 |
|
|
[(match_operand:HI 0 "register_operand" "")
|
322 |
|
|
(match_operand 1 "comparison_operator" "")
|
323 |
|
|
(match_operand:HI 2 "register_operand" "")
|
324 |
|
|
(match_operand:HI 3 "register_operand" "")]
|
325 |
|
|
""
|
326 |
|
|
"FAIL;")
|
327 |
|
|
|
328 |
|
|
(define_expand "addqicc"
|
329 |
|
|
[(match_operand:QI 0 "register_operand" "")
|
330 |
|
|
(match_operand 1 "comparison_operator" "")
|
331 |
|
|
(match_operand:QI 2 "register_operand" "")
|
332 |
|
|
(match_operand:QI 3 "register_operand" "")]
|
333 |
|
|
""
|
334 |
|
|
"FAIL;")
|
335 |
|
|
|
336 |
|
|
|
337 |
|
|
;;
|
338 |
|
|
;; conditional moves
|
339 |
|
|
;;
|
340 |
|
|
|
341 |
|
|
(define_expand "movsicc"
|
342 |
|
|
[(set (match_operand:SI 0 "register_operand" "")
|
343 |
|
|
(if_then_else:SI (match_operand 1 "comparison_operator" "")
|
344 |
|
|
(match_operand:SI 2 "register_operand" "")
|
345 |
|
|
(match_operand:SI 3 "register_operand" "")))]
|
346 |
|
|
"TARGET_CMOV"
|
347 |
|
|
"
|
348 |
|
|
{
|
349 |
|
|
if (or32_emit_cmove (operands[0], operands[1], operands[2], operands[3]))
|
350 |
|
|
DONE;
|
351 |
|
|
}")
|
352 |
|
|
|
353 |
|
|
(define_expand "movhicc"
|
354 |
|
|
[(set (match_operand:HI 0 "register_operand" "")
|
355 |
|
|
(if_then_else:SI (match_operand 1 "comparison_operator" "")
|
356 |
|
|
(match_operand:HI 2 "register_operand" "")
|
357 |
|
|
(match_operand:HI 3 "register_operand" "")))]
|
358 |
|
|
""
|
359 |
|
|
"
|
360 |
|
|
{
|
361 |
|
|
FAIL;
|
362 |
|
|
}")
|
363 |
|
|
|
364 |
|
|
(define_expand "movqicc"
|
365 |
|
|
[(set (match_operand:QI 0 "register_operand" "")
|
366 |
|
|
(if_then_else:SI (match_operand 1 "comparison_operator" "")
|
367 |
|
|
(match_operand:QI 2 "register_operand" "")
|
368 |
|
|
(match_operand:QI 3 "register_operand" "")))]
|
369 |
|
|
""
|
370 |
|
|
"
|
371 |
|
|
{
|
372 |
|
|
FAIL;
|
373 |
|
|
}")
|
374 |
|
|
|
375 |
|
|
|
376 |
|
|
;; We use the BASE_REGS for the cmov input operands because, if rA is
|
377 |
|
|
;; 0, the value of 0 is placed in rD upon truth. Similarly for rB
|
378 |
|
|
;; because we may switch the operands and rB may end up being rA.
|
379 |
|
|
|
380 |
|
|
(define_insn "cmov"
|
381 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
382 |
|
|
(if_then_else:SI
|
383 |
|
|
(match_operator 1 "comparison_operator"
|
384 |
|
|
[(match_operand 4 "cc_reg_operand" "")
|
385 |
|
|
(const_int 0)])
|
386 |
|
|
(match_operand:SI 2 "register_operand" "r")
|
387 |
|
|
(match_operand:SI 3 "register_operand" "r")))]
|
388 |
|
|
"TARGET_CMOV"
|
389 |
|
|
"*
|
390 |
|
|
{ output_cmov(operands); }")
|
391 |
|
|
|
392 |
|
|
;;
|
393 |
|
|
;; ....................
|
394 |
|
|
;;
|
395 |
|
|
;; COMPARISONS
|
396 |
|
|
;;
|
397 |
|
|
;; ....................
|
398 |
|
|
|
399 |
|
|
;; Flow here is rather complex:
|
400 |
|
|
;;
|
401 |
|
|
;; 1) The cmp{si,di,sf,df} routine is called. It deposits the
|
402 |
|
|
;; arguments into the branch_cmp array, and the type into
|
403 |
|
|
;; branch_type. No RTL is generated.
|
404 |
|
|
;;
|
405 |
|
|
;; 2) The appropriate branch define_expand is called, which then
|
406 |
|
|
;; creates the appropriate RTL for the comparison and branch.
|
407 |
|
|
;; Different CC modes are used, based on what type of branch is
|
408 |
|
|
;; done, so that we can constrain things appropriately. There
|
409 |
|
|
;; are assumptions in the rest of GCC that break if we fold the
|
410 |
|
|
;; operands into the branches for integer operations, and use cc0
|
411 |
|
|
;; for floating point, so we use the fp status register instead.
|
412 |
|
|
;; If needed, an appropriate temporary is created to hold the
|
413 |
|
|
;; of the integer compare.
|
414 |
|
|
|
415 |
|
|
;; Compare insns are next. Note that the RS/6000 has two types of compares,
|
416 |
|
|
;; signed & unsigned, and one type of branch.
|
417 |
|
|
;;
|
418 |
|
|
;; Start with the DEFINE_EXPANDs to generate the rtl for compares, scc
|
419 |
|
|
;; insns, and branches. We store the operands of compares until we see
|
420 |
|
|
;; how it is used.
|
421 |
|
|
|
422 |
|
|
(define_expand "cmpsi"
|
423 |
|
|
[(set (reg:CC 32)
|
424 |
|
|
(compare:CC (match_operand:SI 0 "register_operand" "")
|
425 |
|
|
(match_operand:SI 1 "nonmemory_operand" "")))]
|
426 |
|
|
""
|
427 |
|
|
{
|
428 |
|
|
if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
|
429 |
|
|
operands[0] = force_reg (SImode, operands[0]);
|
430 |
|
|
or32_compare_op0 = operands[0];
|
431 |
|
|
or32_compare_op1 = operands[1];
|
432 |
|
|
DONE;
|
433 |
|
|
})
|
434 |
|
|
|
435 |
|
|
|
436 |
|
|
|
437 |
|
|
;;
|
438 |
|
|
;; Conditional branches
|
439 |
|
|
;;
|
440 |
|
|
|
441 |
|
|
(define_expand "beq"
|
442 |
|
|
[(use (match_operand 0 "" ""))]
|
443 |
|
|
""
|
444 |
|
|
"or32_expand_branch (EQ, operands[0]); DONE;")
|
445 |
|
|
|
446 |
|
|
(define_expand "bne"
|
447 |
|
|
[(use (match_operand 0 "" ""))]
|
448 |
|
|
""
|
449 |
|
|
"or32_expand_branch (NE, operands[0]); DONE;")
|
450 |
|
|
|
451 |
|
|
(define_expand "bgt"
|
452 |
|
|
[(use (match_operand 0 "" ""))]
|
453 |
|
|
""
|
454 |
|
|
"or32_expand_branch (GT, operands[0]); DONE;")
|
455 |
|
|
|
456 |
|
|
(define_expand "bgtu"
|
457 |
|
|
[(use (match_operand 0 "" ""))]
|
458 |
|
|
""
|
459 |
|
|
"or32_expand_branch (GTU, operands[0]); DONE;")
|
460 |
|
|
|
461 |
|
|
(define_expand "blt"
|
462 |
|
|
[(use (match_operand 0 "" ""))]
|
463 |
|
|
""
|
464 |
|
|
"or32_expand_branch (LT, operands[0]); DONE;")
|
465 |
|
|
|
466 |
|
|
(define_expand "bltu"
|
467 |
|
|
[(use (match_operand 0 "" ""))]
|
468 |
|
|
""
|
469 |
|
|
"or32_expand_branch (LTU, operands[0]); DONE;")
|
470 |
|
|
|
471 |
|
|
(define_expand "bge"
|
472 |
|
|
[(use (match_operand 0 "" ""))]
|
473 |
|
|
""
|
474 |
|
|
"or32_expand_branch (GE, operands[0]); DONE;")
|
475 |
|
|
|
476 |
|
|
(define_expand "bgeu"
|
477 |
|
|
[(use (match_operand 0 "" ""))]
|
478 |
|
|
""
|
479 |
|
|
"or32_expand_branch (GEU, operands[0]); DONE;")
|
480 |
|
|
|
481 |
|
|
(define_expand "ble"
|
482 |
|
|
[(use (match_operand 0 "" ""))]
|
483 |
|
|
""
|
484 |
|
|
"or32_expand_branch (LE, operands[0]); DONE;")
|
485 |
|
|
|
486 |
|
|
(define_expand "bleu"
|
487 |
|
|
[(use (match_operand 0 "" ""))]
|
488 |
|
|
""
|
489 |
|
|
"or32_expand_branch (LEU, operands[0]); DONE;")
|
490 |
|
|
|
491 |
|
|
|
492 |
|
|
|
493 |
|
|
;;
|
494 |
|
|
;; Setting a CCxx registers from comparision
|
495 |
|
|
;;
|
496 |
|
|
|
497 |
|
|
|
498 |
|
|
|
499 |
|
|
;; Here are the actual compare insns.
|
500 |
|
|
(define_insn "*cmpsi_eq"
|
501 |
|
|
[(set (reg:CCEQ 32)
|
502 |
|
|
(compare:CCEQ (match_operand:SI 0 "register_operand" "r,r")
|
503 |
|
|
(match_operand:SI 1 "nonmemory_operand" "I,r")))]
|
504 |
|
|
""
|
505 |
|
|
"@
|
506 |
|
|
l.sfeqi\t%0,%1
|
507 |
|
|
l.sfeq \t%0,%1")
|
508 |
|
|
|
509 |
|
|
(define_insn "*cmpsi_ne"
|
510 |
|
|
[(set (reg:CCNE 32)
|
511 |
|
|
(compare:CCNE (match_operand:SI 0 "register_operand" "r,r")
|
512 |
|
|
(match_operand:SI 1 "nonmemory_operand" "I,r")))]
|
513 |
|
|
""
|
514 |
|
|
"@
|
515 |
|
|
l.sfnei\t%0,%1
|
516 |
|
|
l.sfne \t%0,%1")
|
517 |
|
|
|
518 |
|
|
(define_insn "*cmpsi_gt"
|
519 |
|
|
[(set (reg:CCGT 32)
|
520 |
|
|
(compare:CCGT (match_operand:SI 0 "register_operand" "r,r")
|
521 |
|
|
(match_operand:SI 1 "nonmemory_operand" "I,r")))]
|
522 |
|
|
""
|
523 |
|
|
"@
|
524 |
|
|
l.sfgtsi\t%0,%1
|
525 |
|
|
l.sfgts \t%0,%1")
|
526 |
|
|
|
527 |
|
|
(define_insn "*cmpsi_gtu"
|
528 |
|
|
[(set (reg:CCGTU 32)
|
529 |
|
|
(compare:CCGTU (match_operand:SI 0 "register_operand" "r,r")
|
530 |
|
|
(match_operand:SI 1 "nonmemory_operand" "I,r")))]
|
531 |
|
|
""
|
532 |
|
|
"@
|
533 |
|
|
l.sfgtui\t%0,%1
|
534 |
|
|
l.sfgtu \t%0,%1")
|
535 |
|
|
|
536 |
|
|
(define_insn "*cmpsi_lt"
|
537 |
|
|
[(set (reg:CCLT 32)
|
538 |
|
|
(compare:CCLT (match_operand:SI 0 "register_operand" "r,r")
|
539 |
|
|
(match_operand:SI 1 "nonmemory_operand" "I,r")))]
|
540 |
|
|
""
|
541 |
|
|
"@
|
542 |
|
|
l.sfltsi\t%0,%1
|
543 |
|
|
l.sflts \t%0,%1")
|
544 |
|
|
|
545 |
|
|
(define_insn "*cmpsi_ltu"
|
546 |
|
|
[(set (reg:CCLTU 32)
|
547 |
|
|
(compare:CCLTU (match_operand:SI 0 "register_operand" "r,r")
|
548 |
|
|
(match_operand:SI 1 "nonmemory_operand" "I,r")))]
|
549 |
|
|
""
|
550 |
|
|
"@
|
551 |
|
|
l.sfltui\t%0,%1
|
552 |
|
|
l.sfltu \t%0,%1")
|
553 |
|
|
|
554 |
|
|
(define_insn "*cmpsi_ge"
|
555 |
|
|
[(set (reg:CCGE 32)
|
556 |
|
|
(compare:CCGE (match_operand:SI 0 "register_operand" "r,r")
|
557 |
|
|
(match_operand:SI 1 "nonmemory_operand" "I,r")))]
|
558 |
|
|
""
|
559 |
|
|
"@
|
560 |
|
|
l.sfgesi\t%0,%1
|
561 |
|
|
l.sfges \t%0,%1")
|
562 |
|
|
|
563 |
|
|
|
564 |
|
|
(define_insn "*cmpsi_geu"
|
565 |
|
|
[(set (reg:CCGEU 32)
|
566 |
|
|
(compare:CCGEU (match_operand:SI 0 "register_operand" "r,r")
|
567 |
|
|
(match_operand:SI 1 "nonmemory_operand" "I,r")))]
|
568 |
|
|
""
|
569 |
|
|
"@
|
570 |
|
|
l.sfgeui\t%0,%1
|
571 |
|
|
l.sfgeu \t%0,%1")
|
572 |
|
|
|
573 |
|
|
|
574 |
|
|
(define_insn "*cmpsi_le"
|
575 |
|
|
[(set (reg:CCLE 32)
|
576 |
|
|
(compare:CCLE (match_operand:SI 0 "register_operand" "r,r")
|
577 |
|
|
(match_operand:SI 1 "nonmemory_operand" "I,r")))]
|
578 |
|
|
""
|
579 |
|
|
"@
|
580 |
|
|
l.sflesi\t%0,%1
|
581 |
|
|
l.sfles \t%0,%1")
|
582 |
|
|
|
583 |
|
|
(define_insn "*cmpsi_leu"
|
584 |
|
|
[(set (reg:CCLEU 32)
|
585 |
|
|
(compare:CCLEU (match_operand:SI 0 "register_operand" "r,r")
|
586 |
|
|
(match_operand:SI 1 "nonmemory_operand" "I,r")))]
|
587 |
|
|
""
|
588 |
|
|
"@
|
589 |
|
|
l.sfleui\t%0,%1
|
590 |
|
|
l.sfleu \t%0,%1")
|
591 |
|
|
|
592 |
|
|
(define_insn "*bf"
|
593 |
|
|
[(set (pc)
|
594 |
|
|
(if_then_else (match_operator 1 "comparison_operator"
|
595 |
|
|
[(match_operand 2
|
596 |
|
|
"cc_reg_operand" "")
|
597 |
|
|
(const_int 0)])
|
598 |
|
|
(label_ref (match_operand 0 "" ""))
|
599 |
|
|
(pc)))]
|
600 |
|
|
""
|
601 |
|
|
"*
|
602 |
|
|
{ output_bf(operands); }"
|
603 |
|
|
[(set_attr "type" "branch")
|
604 |
|
|
(set_attr "length" "1")])
|
605 |
|
|
|
606 |
|
|
;;
|
607 |
|
|
;;
|
608 |
|
|
;;
|
609 |
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
610 |
|
|
;;
|
611 |
|
|
;;
|
612 |
|
|
|
613 |
|
|
|
614 |
|
|
(define_insn "movdi"
|
615 |
|
|
[(set (match_operand:DI 0 "nonimmediate_operand" "=r, r, m, r")
|
616 |
|
|
(match_operand:DI 1 "general_operand" " r, m, r, i"))]
|
617 |
|
|
""
|
618 |
|
|
"*
|
619 |
|
|
return or32_output_move_double (operands);
|
620 |
|
|
"
|
621 |
|
|
[(set_attr "length" "2,2,2,3")])
|
622 |
|
|
|
623 |
|
|
(define_insn "movdf"
|
624 |
|
|
[(set (match_operand:DF 0 "nonimmediate_operand" "=r, r, m, r")
|
625 |
|
|
(match_operand:DF 1 "general_operand" " r, m, r, i"))]
|
626 |
|
|
""
|
627 |
|
|
"*
|
628 |
|
|
return or32_output_move_double (operands);
|
629 |
|
|
"
|
630 |
|
|
[(set_attr "length" "2,2,2,3")])
|
631 |
|
|
|
632 |
|
|
|
633 |
|
|
(define_insn "movsf"
|
634 |
|
|
[(set (match_operand:SF 0 "general_operand" "=r,r,m")
|
635 |
|
|
(match_operand:SF 1 "general_operand" "r,m,r"))]
|
636 |
|
|
""
|
637 |
|
|
"@
|
638 |
|
|
l.ori \t%0,%1,0\t # movsf
|
639 |
|
|
l.lwz \t%0,%1\t # movsf
|
640 |
|
|
l.sw \t%0,%1\t # movsf"
|
641 |
|
|
[(set_attr "type" "move,load,store")
|
642 |
|
|
(set_attr "length" "1,1,1")])
|
643 |
|
|
|
644 |
|
|
;;
|
645 |
|
|
;; extendqisi2
|
646 |
|
|
;;
|
647 |
|
|
|
648 |
|
|
(define_expand "extendqisi2"
|
649 |
|
|
[(use (match_operand:SI 0 "register_operand" ""))
|
650 |
|
|
(use (match_operand:QI 1 "nonimmediate_operand" ""))]
|
651 |
|
|
""
|
652 |
|
|
"
|
653 |
|
|
{
|
654 |
|
|
if (TARGET_SEXT)
|
655 |
|
|
emit_insn (gen_extendqisi2_sext(operands[0], operands[1]));
|
656 |
|
|
else {
|
657 |
|
|
if ( GET_CODE(operands[1]) == MEM ) {
|
658 |
|
|
emit_insn (gen_extendqisi2_no_sext_mem(operands[0], operands[1]));
|
659 |
|
|
}
|
660 |
|
|
else {
|
661 |
|
|
emit_insn (gen_extendqisi2_no_sext_reg(operands[0], operands[1]));
|
662 |
|
|
}
|
663 |
|
|
}
|
664 |
|
|
DONE;
|
665 |
|
|
}")
|
666 |
|
|
|
667 |
|
|
(define_insn "extendqisi2_sext"
|
668 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r")
|
669 |
|
|
(sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
|
670 |
|
|
"TARGET_SEXT"
|
671 |
|
|
"@
|
672 |
|
|
l.extbs \t%0,%1\t # extendqisi2_has_signed_extend
|
673 |
|
|
l.lbs \t%0,%1\t # extendqisi2_has_signed_extend"
|
674 |
|
|
[(set_attr "length" "1,1")
|
675 |
|
|
(set_attr "type" "extend,load")])
|
676 |
|
|
|
677 |
|
|
(define_insn "extendqisi2_no_sext_mem"
|
678 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
679 |
|
|
(sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
|
680 |
|
|
"!TARGET_SEXT"
|
681 |
|
|
"l.lbs \t%0,%1\t # extendqisi2_no_sext_mem"
|
682 |
|
|
[(set_attr "length" "1")
|
683 |
|
|
(set_attr "type" "load")])
|
684 |
|
|
|
685 |
|
|
(define_expand "extendqisi2_no_sext_reg"
|
686 |
|
|
[(set (match_dup 2)
|
687 |
|
|
(ashift:SI (match_operand:QI 1 "register_operand" "")
|
688 |
|
|
(const_int 24)))
|
689 |
|
|
(set (match_operand:SI 0 "register_operand" "")
|
690 |
|
|
(ashiftrt:SI (match_dup 2)
|
691 |
|
|
(const_int 24)))]
|
692 |
|
|
"!TARGET_SEXT"
|
693 |
|
|
"
|
694 |
|
|
{
|
695 |
|
|
operands[1] = gen_lowpart (SImode, operands[1]);
|
696 |
|
|
operands[2] = gen_reg_rtx (SImode); }")
|
697 |
|
|
|
698 |
|
|
;;
|
699 |
|
|
;; extendhisi2
|
700 |
|
|
;;
|
701 |
|
|
|
702 |
|
|
(define_expand "extendhisi2"
|
703 |
|
|
[(use (match_operand:SI 0 "register_operand" ""))
|
704 |
|
|
(use (match_operand:HI 1 "nonimmediate_operand" ""))]
|
705 |
|
|
""
|
706 |
|
|
"
|
707 |
|
|
{
|
708 |
|
|
if (TARGET_SEXT)
|
709 |
|
|
emit_insn (gen_extendhisi2_sext(operands[0], operands[1]));
|
710 |
|
|
else {
|
711 |
|
|
if ( GET_CODE(operands[1]) == MEM ) {
|
712 |
|
|
emit_insn (gen_extendhisi2_no_sext_mem(operands[0], operands[1]));
|
713 |
|
|
}
|
714 |
|
|
else {
|
715 |
|
|
emit_insn (gen_extendhisi2_no_sext_reg(operands[0], operands[1]));
|
716 |
|
|
}
|
717 |
|
|
}
|
718 |
|
|
DONE;
|
719 |
|
|
}")
|
720 |
|
|
|
721 |
|
|
(define_insn "extendhisi2_sext"
|
722 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r")
|
723 |
|
|
(sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
|
724 |
|
|
"TARGET_SEXT"
|
725 |
|
|
"@
|
726 |
|
|
l.exths \t%0,%1\t # extendhisi2_has_signed_extend
|
727 |
|
|
l.lhs \t%0,%1\t # extendhisi2_has_signed_extend"
|
728 |
|
|
[(set_attr "length" "1,1")
|
729 |
|
|
(set_attr "type" "extend,load")])
|
730 |
|
|
|
731 |
|
|
(define_insn "extendhisi2_no_sext_mem"
|
732 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
733 |
|
|
(sign_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
|
734 |
|
|
"!TARGET_SEXT"
|
735 |
|
|
"l.lhs \t%0,%1\t # extendhisi2_no_sext_mem"
|
736 |
|
|
[(set_attr "length" "1")
|
737 |
|
|
(set_attr "type" "load")])
|
738 |
|
|
|
739 |
|
|
(define_expand "extendhisi2_no_sext_reg"
|
740 |
|
|
[(set (match_dup 2)
|
741 |
|
|
(ashift:SI (match_operand:HI 1 "register_operand" "")
|
742 |
|
|
(const_int 16)))
|
743 |
|
|
(set (match_operand:SI 0 "register_operand" "")
|
744 |
|
|
(ashiftrt:SI (match_dup 2)
|
745 |
|
|
(const_int 16)))]
|
746 |
|
|
"!TARGET_SEXT"
|
747 |
|
|
"
|
748 |
|
|
{
|
749 |
|
|
operands[1] = gen_lowpart (SImode, operands[1]);
|
750 |
|
|
operands[2] = gen_reg_rtx (SImode); }")
|
751 |
|
|
|
752 |
|
|
|
753 |
|
|
;;
|
754 |
|
|
;; zero_extend2
|
755 |
|
|
;;
|
756 |
|
|
|
757 |
|
|
(define_insn "zero_extendqisi2"
|
758 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r")
|
759 |
|
|
(zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,m")))]
|
760 |
|
|
""
|
761 |
|
|
"@
|
762 |
|
|
l.andi \t%0,%1,0xff\t # zero_extendqisi2
|
763 |
|
|
l.lbz \t%0,%1\t # zero_extendqisi2"
|
764 |
|
|
[(set_attr "type" "logic,load")
|
765 |
|
|
(set_attr "length" "1,1")])
|
766 |
|
|
|
767 |
|
|
|
768 |
|
|
(define_insn "zero_extendhisi2"
|
769 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r")
|
770 |
|
|
(zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
|
771 |
|
|
""
|
772 |
|
|
"@
|
773 |
|
|
l.andi \t%0,%1,0xffff\t # zero_extendqisi2
|
774 |
|
|
l.lhz \t%0,%1\t # zero_extendqisi2"
|
775 |
|
|
[(set_attr "type" "logic,load")
|
776 |
|
|
(set_attr "length" "1,1")])
|
777 |
|
|
|
778 |
|
|
;;
|
779 |
|
|
;; Shift/rotate operations
|
780 |
|
|
;;
|
781 |
|
|
|
782 |
|
|
(define_insn "ashlsi3"
|
783 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r")
|
784 |
|
|
(ashift:SI (match_operand:SI 1 "register_operand" "r,r")
|
785 |
|
|
(match_operand:SI 2 "nonmemory_operand" "r,L")))]
|
786 |
|
|
""
|
787 |
|
|
"@
|
788 |
|
|
l.sll \t%0,%1,%2
|
789 |
|
|
l.slli \t%0,%1,%2"
|
790 |
|
|
[(set_attr "type" "shift,shift")
|
791 |
|
|
(set_attr "length" "1,1")])
|
792 |
|
|
|
793 |
|
|
(define_insn "ashrsi3"
|
794 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r")
|
795 |
|
|
(ashiftrt:SI (match_operand:SI 1 "register_operand" "r,r")
|
796 |
|
|
(match_operand:SI 2 "nonmemory_operand" "r,L")))]
|
797 |
|
|
""
|
798 |
|
|
"@
|
799 |
|
|
l.sra \t%0,%1,%2
|
800 |
|
|
l.srai \t%0,%1,%2"
|
801 |
|
|
[(set_attr "type" "shift,shift")
|
802 |
|
|
(set_attr "length" "1,1")])
|
803 |
|
|
|
804 |
|
|
(define_insn "lshrsi3"
|
805 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r")
|
806 |
|
|
(lshiftrt:SI (match_operand:SI 1 "register_operand" "r,r")
|
807 |
|
|
(match_operand:SI 2 "nonmemory_operand" "r,L")))]
|
808 |
|
|
""
|
809 |
|
|
"@
|
810 |
|
|
l.srl \t%0,%1,%2
|
811 |
|
|
l.srli \t%0,%1,%2"
|
812 |
|
|
[(set_attr "type" "shift,shift")
|
813 |
|
|
(set_attr "length" "1,1")])
|
814 |
|
|
|
815 |
|
|
(define_insn "rotrsi3"
|
816 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r")
|
817 |
|
|
(rotatert:SI (match_operand:SI 1 "register_operand" "r,r")
|
818 |
|
|
(match_operand:SI 2 "nonmemory_operand" "r,L")))]
|
819 |
|
|
"TARGET_ROR"
|
820 |
|
|
"@
|
821 |
|
|
l.ror \t%0,%1,%2
|
822 |
|
|
l.rori \t%0,%1,%2"
|
823 |
|
|
[(set_attr "type" "shift,shift")
|
824 |
|
|
(set_attr "length" "1,1")])
|
825 |
|
|
|
826 |
|
|
;;
|
827 |
|
|
;; Logical bitwise operations
|
828 |
|
|
;;
|
829 |
|
|
|
830 |
|
|
(define_insn "andsi3"
|
831 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r")
|
832 |
|
|
(and:SI (match_operand:SI 1 "register_operand" "%r,r")
|
833 |
|
|
(match_operand:SI 2 "nonmemory_operand" "r,K")))]
|
834 |
|
|
""
|
835 |
|
|
"@
|
836 |
|
|
l.and \t%0,%1,%2
|
837 |
|
|
l.andi \t%0,%1,%2"
|
838 |
|
|
[(set_attr "type" "logic,logic")
|
839 |
|
|
(set_attr "length" "1,1")])
|
840 |
|
|
|
841 |
|
|
(define_insn "iorsi3"
|
842 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r")
|
843 |
|
|
(ior:SI (match_operand:SI 1 "register_operand" "%r,r")
|
844 |
|
|
(match_operand:SI 2 "nonmemory_operand" "r,K")))]
|
845 |
|
|
""
|
846 |
|
|
"@
|
847 |
|
|
l.or \t%0,%1,%2
|
848 |
|
|
l.ori \t%0,%1,%2"
|
849 |
|
|
[(set_attr "type" "logic,logic")
|
850 |
|
|
(set_attr "length" "1,1")])
|
851 |
|
|
|
852 |
|
|
(define_insn "xorsi3"
|
853 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r")
|
854 |
|
|
(xor:SI (match_operand:SI 1 "register_operand" "%r,r")
|
855 |
|
|
(match_operand:SI 2 "nonmemory_operand" "r,I")))]
|
856 |
|
|
""
|
857 |
|
|
"@
|
858 |
|
|
l.xor \t%0,%1,%2
|
859 |
|
|
l.xori \t%0,%1,%2"
|
860 |
|
|
[(set_attr "type" "logic,logic")
|
861 |
|
|
(set_attr "length" "1,1")])
|
862 |
|
|
|
863 |
|
|
(define_insn "one_cmplqi2"
|
864 |
|
|
[(set (match_operand:QI 0 "register_operand" "=r")
|
865 |
|
|
(not:QI (match_operand:QI 1 "register_operand" "r")))]
|
866 |
|
|
""
|
867 |
|
|
"l.xori \t%0,%1,0x00ff"
|
868 |
|
|
[(set_attr "type" "logic")
|
869 |
|
|
(set_attr "length" "1")])
|
870 |
|
|
|
871 |
|
|
(define_insn "one_cmplsi2"
|
872 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
873 |
|
|
(not:SI (match_operand:SI 1 "register_operand" "r")))]
|
874 |
|
|
""
|
875 |
|
|
"l.xori \t%0,%1,0xffff"
|
876 |
|
|
[(set_attr "type" "logic")
|
877 |
|
|
(set_attr "length" "1")])
|
878 |
|
|
|
879 |
|
|
;;
|
880 |
|
|
;; Arithmetic operations
|
881 |
|
|
;;
|
882 |
|
|
|
883 |
|
|
(define_insn "negsi2"
|
884 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
885 |
|
|
(neg:SI (match_operand:SI 1 "register_operand" "r")))]
|
886 |
|
|
""
|
887 |
|
|
"l.sub \t%0,r0,%1"
|
888 |
|
|
[(set_attr "type" "add")
|
889 |
|
|
(set_attr "length" "1")])
|
890 |
|
|
|
891 |
|
|
(define_insn "addsi3"
|
892 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r")
|
893 |
|
|
(plus:SI (match_operand:SI 1 "register_operand" "%r,r")
|
894 |
|
|
(match_operand:SI 2 "nonmemory_operand" "r,I")))]
|
895 |
|
|
""
|
896 |
|
|
"@
|
897 |
|
|
l.add \t%0,%1,%2
|
898 |
|
|
l.addi \t%0,%1,%2"
|
899 |
|
|
[(set_attr "type" "add,add")
|
900 |
|
|
(set_attr "length" "1,1")])
|
901 |
|
|
|
902 |
|
|
(define_insn "subsi3"
|
903 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r")
|
904 |
|
|
(minus:SI (match_operand:SI 1 "register_operand" "r,r")
|
905 |
|
|
(match_operand:SI 2 "nonmemory_operand" "r,I")))]
|
906 |
|
|
""
|
907 |
|
|
"@
|
908 |
|
|
l.sub \t%0,%1,%2
|
909 |
|
|
l.addi \t%0,%1,%n2"
|
910 |
|
|
[(set_attr "type" "add,add")]
|
911 |
|
|
)
|
912 |
|
|
|
913 |
|
|
;;
|
914 |
|
|
;; mul and div
|
915 |
|
|
;;
|
916 |
|
|
|
917 |
|
|
(define_insn "mulsi3"
|
918 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
919 |
|
|
(mult:SI (match_operand:SI 1 "register_operand" "r")
|
920 |
|
|
(match_operand:SI 2 "register_operand" "r")))]
|
921 |
|
|
"TARGET_HARD_MUL"
|
922 |
|
|
"l.mul \t%0,%1,%2"
|
923 |
|
|
[(set_attr "type" "mul")
|
924 |
|
|
(set_attr "length" "1")])
|
925 |
|
|
|
926 |
|
|
(define_insn "divsi3"
|
927 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
928 |
|
|
(div:SI (match_operand:SI 1 "register_operand" "r")
|
929 |
|
|
(match_operand:SI 2 "register_operand" "r")))]
|
930 |
|
|
"TARGET_HARD_DIV"
|
931 |
|
|
"l.div \t%0,%1,%2"
|
932 |
|
|
[(set_attr "type" "mul")
|
933 |
|
|
(set_attr "length" "1")])
|
934 |
|
|
|
935 |
|
|
(define_insn "udivsi3"
|
936 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
937 |
|
|
(udiv:SI (match_operand:SI 1 "register_operand" "r")
|
938 |
|
|
(match_operand:SI 2 "register_operand" "r")))]
|
939 |
|
|
"TARGET_HARD_DIV"
|
940 |
|
|
"l.divu \t%0,%1,%2"
|
941 |
|
|
[(set_attr "type" "mul")
|
942 |
|
|
(set_attr "length" "1")])
|
943 |
|
|
|
944 |
|
|
;;
|
945 |
|
|
;; jumps
|
946 |
|
|
;;
|
947 |
|
|
|
948 |
|
|
;; jump
|
949 |
|
|
|
950 |
|
|
(define_expand "jump"
|
951 |
|
|
[(set (pc)
|
952 |
|
|
(label_ref (match_operand 0 "" "")))]
|
953 |
|
|
""
|
954 |
|
|
"
|
955 |
|
|
{
|
956 |
|
|
if (!TARGET_ALIGNED_JUMPS)
|
957 |
|
|
emit_jump_insn (gen_jump_internal (operands[0]));
|
958 |
|
|
else
|
959 |
|
|
emit_jump_insn (gen_jump_aligned (operands[0]));
|
960 |
|
|
DONE;
|
961 |
|
|
}")
|
962 |
|
|
|
963 |
|
|
(define_insn "jump_internal"
|
964 |
|
|
[(set (pc)
|
965 |
|
|
(label_ref (match_operand 0 "" "")))]
|
966 |
|
|
"!TARGET_ALIGNED_JUMPS"
|
967 |
|
|
"l.j \t%l0%("
|
968 |
|
|
[(set_attr "type" "jump")
|
969 |
|
|
(set_attr "length" "1")])
|
970 |
|
|
|
971 |
|
|
(define_insn "jump_aligned"
|
972 |
|
|
[(set (pc)
|
973 |
|
|
(label_ref (match_operand 0 "" "")))]
|
974 |
|
|
"TARGET_ALIGNED_JUMPS"
|
975 |
|
|
".balignl 0x8,0x15000015,0x4\;l.j \t%l0%("
|
976 |
|
|
[(set_attr "type" "jump")
|
977 |
|
|
(set_attr "length" "1")])
|
978 |
|
|
|
979 |
|
|
;; indirect jump
|
980 |
|
|
|
981 |
|
|
(define_expand "indirect_jump"
|
982 |
|
|
[(set (pc) (match_operand:SI 0 "register_operand" "r"))]
|
983 |
|
|
""
|
984 |
|
|
"
|
985 |
|
|
{
|
986 |
|
|
if (!TARGET_ALIGNED_JUMPS)
|
987 |
|
|
emit_jump_insn (gen_indirect_jump_internal (operands[0]));
|
988 |
|
|
else
|
989 |
|
|
emit_jump_insn (gen_indirect_jump_aligned (operands[0]));
|
990 |
|
|
DONE;
|
991 |
|
|
|
992 |
|
|
}")
|
993 |
|
|
|
994 |
|
|
(define_insn "indirect_jump_internal"
|
995 |
|
|
[(set (pc) (match_operand:SI 0 "register_operand" "r"))]
|
996 |
|
|
"!TARGET_ALIGNED_JUMPS"
|
997 |
|
|
"l.jr \t%0%("
|
998 |
|
|
[(set_attr "type" "jump")
|
999 |
|
|
(set_attr "length" "1")])
|
1000 |
|
|
|
1001 |
|
|
(define_insn "indirect_jump_aligned"
|
1002 |
|
|
[(set (pc) (match_operand:SI 0 "register_operand" "r"))]
|
1003 |
|
|
"TARGET_ALIGNED_JUMPS"
|
1004 |
|
|
".balignl 0x8,0x15000015,0x4\;l.jr \t%0%("
|
1005 |
|
|
[(set_attr "type" "jump")
|
1006 |
|
|
(set_attr "length" "1")])
|
1007 |
|
|
|
1008 |
|
|
;;
|
1009 |
|
|
;; calls
|
1010 |
|
|
;;
|
1011 |
|
|
|
1012 |
|
|
;; call
|
1013 |
|
|
|
1014 |
|
|
(define_expand "call"
|
1015 |
|
|
[(parallel [(call (match_operand:SI 0 "sym_ref_mem_operand" "")
|
1016 |
|
|
(match_operand 1 "" "i"))
|
1017 |
|
|
(clobber (reg:SI 9))])]
|
1018 |
|
|
""
|
1019 |
|
|
"
|
1020 |
|
|
{
|
1021 |
|
|
if (!TARGET_ALIGNED_JUMPS)
|
1022 |
|
|
emit_call_insn (gen_call_internal (operands[0], operands[1]));
|
1023 |
|
|
else
|
1024 |
|
|
emit_call_insn (gen_call_aligned (operands[0], operands[1]));
|
1025 |
|
|
DONE;
|
1026 |
|
|
}")
|
1027 |
|
|
|
1028 |
|
|
(define_insn "call_internal"
|
1029 |
|
|
[(parallel [(call (match_operand:SI 0 "sym_ref_mem_operand" "")
|
1030 |
|
|
(match_operand 1 "" "i"))
|
1031 |
|
|
(clobber (reg:SI 9))])]
|
1032 |
|
|
"!TARGET_ALIGNED_JUMPS"
|
1033 |
|
|
"l.jal \t%S0%("
|
1034 |
|
|
[(set_attr "type" "jump")
|
1035 |
|
|
(set_attr "length" "1")])
|
1036 |
|
|
|
1037 |
|
|
(define_insn "call_aligned"
|
1038 |
|
|
[(parallel [(call (match_operand:SI 0 "sym_ref_mem_operand" "")
|
1039 |
|
|
(match_operand 1 "" "i"))
|
1040 |
|
|
(clobber (reg:SI 9))])]
|
1041 |
|
|
"TARGET_ALIGNED_JUMPS"
|
1042 |
|
|
".balignl 0x8,0x15000015,0x4\;l.jal \t%S0%("
|
1043 |
|
|
[(set_attr "type" "jump")
|
1044 |
|
|
(set_attr "length" "1")])
|
1045 |
|
|
|
1046 |
|
|
;; call value
|
1047 |
|
|
|
1048 |
|
|
(define_expand "call_value"
|
1049 |
|
|
[(parallel [(set (match_operand 0 "register_operand" "=r")
|
1050 |
|
|
(call (match_operand:SI 1 "sym_ref_mem_operand" "")
|
1051 |
|
|
(match_operand 2 "" "i")))
|
1052 |
|
|
(clobber (reg:SI 9))])]
|
1053 |
|
|
""
|
1054 |
|
|
"
|
1055 |
|
|
{
|
1056 |
|
|
if (!TARGET_ALIGNED_JUMPS)
|
1057 |
|
|
emit_call_insn (gen_call_value_internal (operands[0], operands[1], operands[2]));
|
1058 |
|
|
else
|
1059 |
|
|
emit_call_insn (gen_call_value_aligned (operands[0], operands[1], operands[2]));
|
1060 |
|
|
DONE;
|
1061 |
|
|
}")
|
1062 |
|
|
|
1063 |
|
|
(define_insn "call_value_internal"
|
1064 |
|
|
[(parallel [(set (match_operand 0 "register_operand" "=r")
|
1065 |
|
|
(call (match_operand:SI 1 "sym_ref_mem_operand" "")
|
1066 |
|
|
(match_operand 2 "" "i")))
|
1067 |
|
|
(clobber (reg:SI 9))])]
|
1068 |
|
|
"!TARGET_ALIGNED_JUMPS"
|
1069 |
|
|
"l.jal \t%S1%("
|
1070 |
|
|
[(set_attr "type" "jump")
|
1071 |
|
|
(set_attr "length" "1")])
|
1072 |
|
|
|
1073 |
|
|
(define_insn "call_value_aligned"
|
1074 |
|
|
[(parallel [(set (match_operand 0 "register_operand" "=r")
|
1075 |
|
|
(call (match_operand:SI 1 "sym_ref_mem_operand" "")
|
1076 |
|
|
(match_operand 2 "" "i")))
|
1077 |
|
|
(clobber (reg:SI 9))])]
|
1078 |
|
|
"TARGET_ALIGNED_JUMPS"
|
1079 |
|
|
".balignl 0x8,0x15000015,0x4\;l.jal \t%S1%("
|
1080 |
|
|
[(set_attr "type" "jump")
|
1081 |
|
|
(set_attr "length" "1")])
|
1082 |
|
|
|
1083 |
|
|
;; indirect call value
|
1084 |
|
|
|
1085 |
|
|
(define_expand "call_value_indirect"
|
1086 |
|
|
[(parallel [(set (match_operand 0 "register_operand" "=r")
|
1087 |
|
|
(call (mem:SI (match_operand:SI 1 "register_operand" "r"))
|
1088 |
|
|
(match_operand 2 "" "i")))
|
1089 |
|
|
(clobber (reg:SI 9))])]
|
1090 |
|
|
""
|
1091 |
|
|
"
|
1092 |
|
|
{
|
1093 |
|
|
if (!TARGET_ALIGNED_JUMPS)
|
1094 |
|
|
emit_call_insn (gen_call_value_indirect_internal (operands[0], operands[1], operands[2]));
|
1095 |
|
|
else
|
1096 |
|
|
emit_call_insn (gen_call_value_indirect_aligned (operands[0], operands[1], operands[2]));
|
1097 |
|
|
DONE;
|
1098 |
|
|
}")
|
1099 |
|
|
|
1100 |
|
|
(define_insn "call_value_indirect_internal"
|
1101 |
|
|
[(parallel [(set (match_operand 0 "register_operand" "=r")
|
1102 |
|
|
(call (mem:SI (match_operand:SI 1 "register_operand" "r"))
|
1103 |
|
|
(match_operand 2 "" "i")))
|
1104 |
|
|
(clobber (reg:SI 9))])]
|
1105 |
|
|
"!TARGET_ALIGNED_JUMPS"
|
1106 |
|
|
"l.jalr \t%1%("
|
1107 |
|
|
[(set_attr "type" "jump")
|
1108 |
|
|
(set_attr "length" "1")])
|
1109 |
|
|
|
1110 |
|
|
(define_insn "call_value_indirect_aligned"
|
1111 |
|
|
[(parallel [(set (match_operand 0 "register_operand" "=r")
|
1112 |
|
|
(call (mem:SI (match_operand:SI 1 "register_operand" "r"))
|
1113 |
|
|
(match_operand 2 "" "i")))
|
1114 |
|
|
(clobber (reg:SI 9))])]
|
1115 |
|
|
"TARGET_ALIGNED_JUMPS"
|
1116 |
|
|
".balignl 0x8,0x15000015,0x4\;l.jalr \t%1%("
|
1117 |
|
|
[(set_attr "type" "jump")
|
1118 |
|
|
(set_attr "length" "1")])
|
1119 |
|
|
|
1120 |
|
|
;; indirect call
|
1121 |
|
|
|
1122 |
|
|
(define_expand "call_indirect"
|
1123 |
|
|
[(parallel [(call (mem:SI (match_operand:SI 0 "register_operand" "r"))
|
1124 |
|
|
(match_operand 1 "" "i"))
|
1125 |
|
|
(clobber (reg:SI 9))])]
|
1126 |
|
|
""
|
1127 |
|
|
"
|
1128 |
|
|
{
|
1129 |
|
|
if (!TARGET_ALIGNED_JUMPS)
|
1130 |
|
|
emit_call_insn (gen_call_indirect_internal (operands[0], operands[1]));
|
1131 |
|
|
else
|
1132 |
|
|
emit_call_insn (gen_call_indirect_aligned (operands[0], operands[1]));
|
1133 |
|
|
DONE;
|
1134 |
|
|
}")
|
1135 |
|
|
|
1136 |
|
|
(define_insn "call_indirect_internal"
|
1137 |
|
|
[(parallel [(call (mem:SI (match_operand:SI 0 "register_operand" "r"))
|
1138 |
|
|
(match_operand 1 "" "i"))
|
1139 |
|
|
(clobber (reg:SI 9))])]
|
1140 |
|
|
"!TARGET_ALIGNED_JUMPS"
|
1141 |
|
|
"l.jalr \t%0%("
|
1142 |
|
|
[(set_attr "type" "jump")
|
1143 |
|
|
(set_attr "length" "1")])
|
1144 |
|
|
|
1145 |
|
|
(define_insn "call_indirect_aligned"
|
1146 |
|
|
[(parallel [(call (mem:SI (match_operand:SI 0 "register_operand" "r"))
|
1147 |
|
|
(match_operand 1 "" "i"))
|
1148 |
|
|
(clobber (reg:SI 9))])]
|
1149 |
|
|
"TARGET_ALIGNED_JUMPS"
|
1150 |
|
|
".balignl 0x8,0x15000015,0x4\;l.jalr \t%0%("
|
1151 |
|
|
[(set_attr "type" "jump")
|
1152 |
|
|
(set_attr "length" "1")])
|
1153 |
|
|
|
1154 |
|
|
;; table jump
|
1155 |
|
|
|
1156 |
|
|
(define_expand "tablejump"
|
1157 |
|
|
[(set (pc) (match_operand:SI 0 "register_operand" "r"))
|
1158 |
|
|
(use (label_ref (match_operand 1 "" "")))]
|
1159 |
|
|
""
|
1160 |
|
|
"
|
1161 |
|
|
{
|
1162 |
|
|
if (!TARGET_ALIGNED_JUMPS)
|
1163 |
|
|
emit_jump_insn (gen_tablejump_internal (operands[0], operands[1]));
|
1164 |
|
|
else
|
1165 |
|
|
emit_jump_insn (gen_tablejump_aligned (operands[0], operands[1]));
|
1166 |
|
|
DONE;
|
1167 |
|
|
}")
|
1168 |
|
|
|
1169 |
|
|
(define_insn "tablejump_internal"
|
1170 |
|
|
[(set (pc) (match_operand:SI 0 "register_operand" "r"))
|
1171 |
|
|
(use (label_ref (match_operand 1 "" "")))]
|
1172 |
|
|
"!TARGET_ALIGNED_JUMPS"
|
1173 |
|
|
"l.jr \t%0%("
|
1174 |
|
|
[(set_attr "type" "jump")
|
1175 |
|
|
(set_attr "length" "1")])
|
1176 |
|
|
|
1177 |
|
|
(define_insn "tablejump_aligned"
|
1178 |
|
|
[(set (pc) (match_operand:SI 0 "register_operand" "r"))
|
1179 |
|
|
(use (label_ref (match_operand 1 "" "")))]
|
1180 |
|
|
"TARGET_ALIGNED_JUMPS"
|
1181 |
|
|
".balignl 0x8,0x15000015,0x4\;l.jr \t%0%("
|
1182 |
|
|
[(set_attr "type" "jump")
|
1183 |
|
|
(set_attr "length" "1")])
|
1184 |
|
|
|
1185 |
|
|
|
1186 |
|
|
;; no-op
|
1187 |
|
|
|
1188 |
|
|
(define_insn "nop"
|
1189 |
|
|
[(const_int 0)]
|
1190 |
|
|
""
|
1191 |
|
|
"l.nop"
|
1192 |
|
|
[(set_attr "type" "logic")
|
1193 |
|
|
(set_attr "length" "1")])
|
1194 |
|
|
|
1195 |
|
|
;;
|
1196 |
|
|
;; floating point
|
1197 |
|
|
;;
|
1198 |
|
|
|
1199 |
|
|
(define_insn "addsf3"
|
1200 |
|
|
[(set (match_operand:SF 0 "register_operand" "=r")
|
1201 |
|
|
(plus:SF (match_operand:SF 1 "register_operand" "r")
|
1202 |
|
|
(match_operand:SF 2 "register_operand" "r")))]
|
1203 |
|
|
"TARGET_HARD_FLOAT"
|
1204 |
|
|
"lf.add.s\t%0,%1,%2"
|
1205 |
|
|
[(set_attr "type" "fp")
|
1206 |
|
|
(set_attr "length" "1")])
|
1207 |
|
|
|
1208 |
|
|
(define_insn "adddf3"
|
1209 |
|
|
[(set (match_operand:DF 0 "register_operand" "=r")
|
1210 |
|
|
(plus:DF (match_operand:DF 1 "register_operand" "r")
|
1211 |
|
|
(match_operand:DF 2 "register_operand" "r")))]
|
1212 |
|
|
"TARGET_HARD_FLOAT"
|
1213 |
|
|
"lf.add.d\t%0,%1,%2"
|
1214 |
|
|
[(set_attr "type" "fp")
|
1215 |
|
|
(set_attr "length" "1")])
|
1216 |
|
|
|
1217 |
|
|
(define_insn "subsf3"
|
1218 |
|
|
[(set (match_operand:SF 0 "register_operand" "=r")
|
1219 |
|
|
(minus:SF (match_operand:SF 1 "register_operand" "r")
|
1220 |
|
|
(match_operand:SF 2 "register_operand" "r")))]
|
1221 |
|
|
"TARGET_HARD_FLOAT"
|
1222 |
|
|
"lf.sub.s\t%0,%1,%2"
|
1223 |
|
|
[(set_attr "type" "fp")
|
1224 |
|
|
(set_attr "length" "1")])
|
1225 |
|
|
|
1226 |
|
|
(define_insn "subdf3"
|
1227 |
|
|
[(set (match_operand:DF 0 "register_operand" "=r")
|
1228 |
|
|
(minus:DF (match_operand:DF 1 "register_operand" "r")
|
1229 |
|
|
(match_operand:DF 2 "register_operand" "r")))]
|
1230 |
|
|
"TARGET_HARD_FLOAT"
|
1231 |
|
|
"lf.sub.d\t%0,%1,%2"
|
1232 |
|
|
[(set_attr "type" "fp")
|
1233 |
|
|
(set_attr "length" "1")])
|
1234 |
|
|
|
1235 |
|
|
(define_insn "mulsf3"
|
1236 |
|
|
[(set (match_operand:SF 0 "register_operand" "=r")
|
1237 |
|
|
(mult:SF (match_operand:SF 1 "register_operand" "r")
|
1238 |
|
|
(match_operand:SF 2 "register_operand" "r")))]
|
1239 |
|
|
"TARGET_HARD_FLOAT"
|
1240 |
|
|
"lf.mul.s\t%0,%1,%2"
|
1241 |
|
|
[(set_attr "type" "fp")
|
1242 |
|
|
(set_attr "length" "1")])
|
1243 |
|
|
|
1244 |
|
|
(define_insn "muldf3"
|
1245 |
|
|
[(set (match_operand:DF 0 "register_operand" "=r")
|
1246 |
|
|
(mult:DF (match_operand:DF 1 "register_operand" "r")
|
1247 |
|
|
(match_operand:DF 2 "register_operand" "r")))]
|
1248 |
|
|
"TARGET_HARD_FLOAT"
|
1249 |
|
|
"lf.mul.d\t%0,%1,%2"
|
1250 |
|
|
[(set_attr "type" "fp")
|
1251 |
|
|
(set_attr "length" "1")])
|
1252 |
|
|
|
1253 |
|
|
(define_insn "divsf3"
|
1254 |
|
|
[(set (match_operand:SF 0 "register_operand" "=r")
|
1255 |
|
|
(div:SF (match_operand:SF 1 "register_operand" "r")
|
1256 |
|
|
(match_operand:SF 2 "register_operand" "r")))]
|
1257 |
|
|
"TARGET_HARD_FLOAT"
|
1258 |
|
|
"lf.div.s\t%0,%1,%2"
|
1259 |
|
|
[(set_attr "type" "fp")
|
1260 |
|
|
(set_attr "length" "1")])
|
1261 |
|
|
|
1262 |
|
|
(define_insn "divdf3"
|
1263 |
|
|
[(set (match_operand:DF 0 "register_operand" "=r")
|
1264 |
|
|
(div:DF (match_operand:DF 1 "register_operand" "r")
|
1265 |
|
|
(match_operand:DF 2 "register_operand" "r")))]
|
1266 |
|
|
"TARGET_HARD_FLOAT"
|
1267 |
|
|
"lf.div.d\t%0,%1,%2"
|
1268 |
|
|
[(set_attr "type" "fp")
|
1269 |
|
|
(set_attr "length" "1")])
|
1270 |
|
|
|
1271 |
|
|
|
1272 |
|
|
;; Local variables:
|
1273 |
|
|
;; mode:emacs-lisp
|
1274 |
|
|
;; comment-start: ";; "
|
1275 |
|
|
;; eval: (set-syntax-table (copy-sequence (syntax-table)))
|
1276 |
|
|
;; eval: (modify-syntax-entry ?[ "(]")
|
1277 |
|
|
;; eval: (modify-syntax-entry ?] ")[")
|
1278 |
|
|
;; eval: (modify-syntax-entry ?{ "(}")
|
1279 |
|
|
;; eval: (modify-syntax-entry ?} "){")
|
1280 |
|
|
;; eval: (setq indent-tabs-mode t)
|
1281 |
|
|
;; End:
|