1 ;; Mips.md Machine Description for MIPS based processors
2 ;; Contributed by A. Lichnewsky, lich@inria.inria.fr
3 ;; Changes by Michael Meissner, meissner@osf.org
4 ;; Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
6 ;; This file is part of GNU CC.
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 2, or (at your option)
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.
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, 675 Mass Ave, Cambridge, MA 02139, USA.
24 ;; ....................
28 ;; ....................
30 ;; Classification of each insn.
31 ;; branch conditional branch
32 ;; jump unconditional jump
33 ;; call unconditional call
34 ;; load load instruction(s)
35 ;; store store instruction(s)
36 ;; move data movement within same register set
37 ;; xfer transfer to/from coprocessor
38 ;; hilo transfer of hi/lo registers
39 ;; arith integer arithmetic instruction
40 ;; darith double precision integer arithmetic instructions
41 ;; imul integer multiply
42 ;; idiv integer divide
43 ;; icmp integer compare
44 ;; fadd floating point add/subtract
45 ;; fmul floating point multiply
46 ;; fdiv floating point divide
47 ;; fabs floating point absolute value
48 ;; fneg floating point negation
49 ;; fcmp floating point compare
50 ;; fcvt floating point convert
51 ;; fsqrt floating point square root
52 ;; multi multiword sequence (or user asm statements)
54 ;; pic OSF/rose half pic load
57 "unknown,branch,jump,call,load,store,move,xfer,hilo,arith,darith,imul,idiv,icmp,fadd,fmul,fdiv,fabs,fneg,fcmp,fcvt,fsqrt,multi,nop,pic"
58 (const_string "unknown"))
60 ;; Main data type used by the insn
61 (define_attr "mode" "unknown,none,QI,HI,SI,DI,SF,DF" (const_string "unknown"))
63 ;; # instructions (4 bytes each)
64 (define_attr "length" "" (const_int 1))
66 ;; whether or not an instruction has a mandatory delay slot
67 (define_attr "dslot" "no,yes"
68 (if_then_else (eq_attr "type" "branch,jump,call,load,xfer,hilo,fcmp,pic")
72 ;; Attribute describing the processor
73 (define_attr "cpu" "default,r3000,r4000,r6000"
75 (cond [(eq (symbol_ref "mips_cpu") (symbol_ref "PROCESSOR_DEFAULT")) (const_string "default")
76 (eq (symbol_ref "mips_cpu") (symbol_ref "PROCESSOR_R3000")) (const_string "r3000")
77 (eq (symbol_ref "mips_cpu") (symbol_ref "PROCESSOR_R4000")) (const_string "r4000")
78 (eq (symbol_ref "mips_cpu") (symbol_ref "PROCESSOR_R6000")) (const_string "r6000")]
79 (const_string "default"))))
81 ;; Attribute defining whether or not we can use the branch-likely instructions
84 (define_attr "branch_likely" "no,yes"
86 (if_then_else (ge (symbol_ref "mips_isa") (const_int 2))
88 (const_string "no"))))
91 ;; Describe a user's asm statement.
92 (define_asm_attributes
93 [(set_attr "type" "multi")])
97 ;; .........................
99 ;; Delay slots, can't describe load/fcmp/xfer delay slots here
101 ;; .........................
103 (define_delay (eq_attr "type" "branch")
104 [(and (eq_attr "dslot" "no") (eq_attr "length" "1"))
106 (eq_attr "branch_likely" "yes")])
108 (define_delay (eq_attr "type" "call,jump")
109 [(and (eq_attr "dslot" "no") (eq_attr "length" "1"))
115 ;; .........................
119 ;; .........................
121 ; (define_function_unit NAME MULTIPLICITY SIMULTANEITY
122 ; TEST READY-DELAY BUSY-DELAY [CONFLICT-LIST])
124 ;; Make the default case (PROCESSOR_DEFAULT) handle the worst case
126 (define_function_unit "memory" 1 0
127 (and (eq_attr "type" "load,pic") (eq_attr "cpu" "!r3000"))
130 (define_function_unit "memory" 1 0
131 (and (eq_attr "type" "load,pic") (eq_attr "cpu" "r3000"))
134 (define_function_unit "memory" 1 0 (eq_attr "type" "store") 1 0)
136 (define_function_unit "transfer" 1 0 (eq_attr "type" "xfer") 2 0)
137 (define_function_unit "transfer" 1 0 (eq_attr "type" "hilo") 3 0)
139 (define_function_unit "imuldiv" 1 1
140 (and (eq_attr "type" "imul") (eq_attr "cpu" "!r3000,r4000"))
143 (define_function_unit "imuldiv" 1 1
144 (and (eq_attr "type" "imul") (eq_attr "cpu" "r3000"))
147 (define_function_unit "imuldiv" 1 1
148 (and (eq_attr "type" "imul") (eq_attr "cpu" "r4000"))
151 (define_function_unit "imuldiv" 1 1
152 (and (eq_attr "type" "idiv") (eq_attr "cpu" "!r3000,r4000"))
155 (define_function_unit "imuldiv" 1 1
156 (and (eq_attr "type" "idiv") (eq_attr "cpu" "r3000"))
159 (define_function_unit "imuldiv" 1 1
160 (and (eq_attr "type" "idiv") (eq_attr "cpu" "r4000"))
163 (define_function_unit "adder" 1 1
164 (and (eq_attr "type" "fadd") (eq_attr "cpu" "!r3000,r6000"))
167 (define_function_unit "adder" 1 1
168 (and (eq_attr "type" "fadd") (eq_attr "cpu" "r3000"))
171 (define_function_unit "adder" 1 1
172 (and (eq_attr "type" "fadd") (eq_attr "cpu" "r6000"))
175 (define_function_unit "fast" 1 1
176 (and (eq_attr "type" "fabs,fneg") (eq_attr "cpu" "!r3000"))
179 (define_function_unit "fast" 1 1
180 (and (eq_attr "type" "fabs,fneg") (eq_attr "cpu" "r3000"))
183 (define_function_unit "mult" 1 1
184 (and (eq_attr "type" "fmul") (and (eq_attr "mode" "SF") (eq_attr "cpu" "!r3000,r6000")))
187 (define_function_unit "mult" 1 1
188 (and (eq_attr "type" "fmul") (and (eq_attr "mode" "SF") (eq_attr "cpu" "r3000")))
191 (define_function_unit "mult" 1 1
192 (and (eq_attr "type" "fmul") (and (eq_attr "mode" "SF") (eq_attr "cpu" "r6000")))
195 (define_function_unit "mult" 1 1
196 (and (eq_attr "type" "fmul") (and (eq_attr "mode" "DF") (eq_attr "cpu" "!r3000,r6000")))
199 (define_function_unit "mult" 1 1
200 (and (eq_attr "type" "fmul") (and (eq_attr "mode" "DF") (eq_attr "cpu" "r3000")))
203 (define_function_unit "mult" 1 1
204 (and (eq_attr "type" "fmul") (and (eq_attr "mode" "DF") (eq_attr "cpu" "r6000")))
207 (define_function_unit "divide" 1 1
208 (and (eq_attr "type" "fdiv") (and (eq_attr "mode" "SF") (eq_attr "cpu" "!r3000,r6000")))
211 (define_function_unit "divide" 1 1
212 (and (eq_attr "type" "fdiv") (and (eq_attr "mode" "SF") (eq_attr "cpu" "r3000")))
215 (define_function_unit "divide" 1 1
216 (and (eq_attr "type" "fdiv") (and (eq_attr "mode" "SF") (eq_attr "cpu" "r6000")))
219 (define_function_unit "divide" 1 1
220 (and (eq_attr "type" "fdiv") (and (eq_attr "mode" "DF") (eq_attr "cpu" "!r3000,r6000")))
223 (define_function_unit "divide" 1 1
224 (and (eq_attr "type" "fdiv") (and (eq_attr "mode" "DF") (eq_attr "cpu" "r3000")))
227 (define_function_unit "divide" 1 1
228 (and (eq_attr "type" "fdiv") (and (eq_attr "mode" "DF") (eq_attr "cpu" "r6000")))
231 (define_function_unit "sqrt" 1 1 (and (eq_attr "type" "fsqrt") (eq_attr "mode" "SF")) 54 108)
232 (define_function_unit "sqrt" 1 1 (and (eq_attr "type" "fsqrt") (eq_attr "mode" "DF")) 112 224)
236 ;; ....................
240 ;; ....................
243 (define_insn "adddf3"
244 [(set (match_operand:DF 0 "register_operand" "=f")
245 (plus:DF (match_operand:DF 1 "register_operand" "f")
246 (match_operand:DF 2 "register_operand" "f")))]
249 [(set_attr "type" "fadd")
250 (set_attr "mode" "DF")
251 (set_attr "length" "1")])
253 (define_insn "addsf3"
254 [(set (match_operand:SF 0 "register_operand" "=f")
255 (plus:SF (match_operand:SF 1 "register_operand" "f")
256 (match_operand:SF 2 "register_operand" "f")))]
259 [(set_attr "type" "fadd")
260 (set_attr "mode" "SF")
261 (set_attr "length" "1")])
263 (define_insn "addsi3"
264 [(set (match_operand:SI 0 "register_operand" "=d")
265 (plus:SI (match_operand:SI 1 "arith_operand" "%d")
266 (match_operand:SI 2 "arith_operand" "dI")))]
270 return (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
271 ? \"subu\\t%0,%1,%n2\"
272 : \"addu\\t%0,%1,%2\";
274 [(set_attr "type" "arith")
275 (set_attr "mode" "SI")
276 (set_attr "length" "1")])
278 (define_expand "adddi3"
279 [(parallel [(set (match_operand:DI 0 "register_operand" "")
280 (plus:DI (match_operand:DI 1 "register_operand" "")
281 (match_operand:DI 2 "arith_operand" "")))
282 (clobber (match_dup 3))])]
283 "!TARGET_DEBUG_G_MODE"
284 "operands[3] = gen_reg_rtx (SImode);")
286 (define_insn "adddi3_internal_1"
287 [(set (match_operand:DI 0 "register_operand" "=d,&d")
288 (plus:DI (match_operand:DI 1 "register_operand" "0,d")
289 (match_operand:DI 2 "register_operand" "d,d")))
290 (clobber (match_operand:SI 3 "register_operand" "=d,d"))]
291 "!TARGET_DEBUG_G_MODE"
294 return (REGNO (operands[0]) == REGNO (operands[1])
295 && REGNO (operands[0]) == REGNO (operands[2]))
296 ? \"srl\\t%3,%L0,31\;sll\\t%M0,%M0,1\;sll\\t%L0,%L1,1\;addu\\t%M0,%M0,%3\"
297 : \"addu\\t%L0,%L1,%L2\;sltu\\t%3,%L0,%L2\;addu\\t%M0,%M1,%M2\;addu\\t%M0,%M0,%3\";
299 [(set_attr "type" "darith,darith")
300 (set_attr "mode" "DI,DI")
301 (set_attr "length" "4,4")])
304 [(set (match_operand:DI 0 "register_operand" "")
305 (plus:DI (match_operand:DI 1 "register_operand" "")
306 (match_operand:DI 2 "register_operand" "")))
307 (clobber (match_operand:SI 3 "register_operand" ""))]
308 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_DEBUG_G_MODE
309 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
310 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
311 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))
312 && (REGNO (operands[0]) != REGNO (operands[1])
313 || REGNO (operands[0]) != REGNO (operands[2]))"
315 [(set (subreg:SI (match_dup 0) 0)
316 (plus:SI (subreg:SI (match_dup 1) 0)
317 (subreg:SI (match_dup 2) 0)))
320 (ltu:CC (subreg:SI (match_dup 0) 0)
321 (subreg:SI (match_dup 2) 0)))
323 (set (subreg:SI (match_dup 0) 1)
324 (plus:SI (subreg:SI (match_dup 1) 1)
325 (subreg:SI (match_dup 2) 1)))
327 (set (subreg:SI (match_dup 0) 1)
328 (plus:SI (subreg:SI (match_dup 0) 1)
333 [(set (match_operand:DI 0 "register_operand" "")
334 (plus:DI (match_operand:DI 1 "register_operand" "")
335 (match_operand:DI 2 "register_operand" "")))
336 (clobber (match_operand:SI 3 "register_operand" ""))]
337 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_DEBUG_G_MODE
338 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
339 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
340 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))
341 && (REGNO (operands[0]) != REGNO (operands[1])
342 || REGNO (operands[0]) != REGNO (operands[2]))"
344 [(set (subreg:SI (match_dup 0) 1)
345 (plus:SI (subreg:SI (match_dup 1) 1)
346 (subreg:SI (match_dup 2) 1)))
349 (ltu:CC (subreg:SI (match_dup 0) 1)
350 (subreg:SI (match_dup 2) 1)))
352 (set (subreg:SI (match_dup 0) 0)
353 (plus:SI (subreg:SI (match_dup 1) 0)
354 (subreg:SI (match_dup 2) 0)))
356 (set (subreg:SI (match_dup 0) 0)
357 (plus:SI (subreg:SI (match_dup 0) 0)
361 (define_insn "adddi3_internal_2"
362 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
363 (plus:DI (match_operand:DI 1 "register_operand" "%d,%d,%d")
364 (match_operand:DI 2 "small_int" "P,J,N")))
365 (clobber (match_operand:SI 3 "register_operand" "=d,d,d"))]
366 "!TARGET_DEBUG_G_MODE && INTVAL (operands[2]) != -32768"
368 addu\\t%L0,%L1,%2\;sltu\\t%3,%L0,%2\;addu\\t%M0,%M1,%3
369 move\\t%L0,%L1\;move\\t%M0,%M1
370 subu\\t%L0,%L1,%n2\;sltu\\t%3,%L0,%2\;subu\\t%M0,%M1,1\;addu\\t%M0,%M0,%3"
371 [(set_attr "type" "darith,darith,darith")
372 (set_attr "mode" "DI,DI,DI")
373 (set_attr "length" "3,2,4")])
376 [(set (match_operand:DI 0 "register_operand" "")
377 (plus:DI (match_operand:DI 1 "register_operand" "")
378 (match_operand:DI 2 "small_int" "")))
379 (clobber (match_operand:SI 3 "register_operand" "=d"))]
380 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_DEBUG_G_MODE
381 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
382 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
383 && INTVAL (operands[2]) > 0"
385 [(set (subreg:SI (match_dup 0) 0)
386 (plus:SI (subreg:SI (match_dup 1) 0)
390 (ltu:CC (subreg:SI (match_dup 0) 0)
393 (set (subreg:SI (match_dup 0) 1)
394 (plus:SI (subreg:SI (match_dup 1) 1)
399 [(set (match_operand:DI 0 "register_operand" "")
400 (plus:DI (match_operand:DI 1 "register_operand" "")
401 (match_operand:DI 2 "small_int" "")))
402 (clobber (match_operand:SI 3 "register_operand" "=d"))]
403 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_DEBUG_G_MODE
404 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
405 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
406 && INTVAL (operands[2]) > 0"
408 [(set (subreg:SI (match_dup 0) 1)
409 (plus:SI (subreg:SI (match_dup 1) 1)
413 (ltu:CC (subreg:SI (match_dup 0) 1)
416 (set (subreg:SI (match_dup 0) 0)
417 (plus:SI (subreg:SI (match_dup 1) 0)
422 ;; ....................
426 ;; ....................
429 (define_insn "subdf3"
430 [(set (match_operand:DF 0 "register_operand" "=f")
431 (minus:DF (match_operand:DF 1 "register_operand" "f")
432 (match_operand:DF 2 "register_operand" "f")))]
435 [(set_attr "type" "fadd")
436 (set_attr "mode" "DF")
437 (set_attr "length" "1")])
439 (define_insn "subsf3"
440 [(set (match_operand:SF 0 "register_operand" "=f")
441 (minus:SF (match_operand:SF 1 "register_operand" "f")
442 (match_operand:SF 2 "register_operand" "f")))]
445 [(set_attr "type" "fadd")
446 (set_attr "mode" "SF")
447 (set_attr "length" "1")])
449 (define_insn "subsi3"
450 [(set (match_operand:SI 0 "register_operand" "=d")
451 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
452 (match_operand:SI 2 "arith_operand" "dI")))]
456 return (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
457 ? \"addu\\t%0,%z1,%n2\"
458 : \"subu\\t%0,%z1,%2\";
460 [(set_attr "type" "arith")
461 (set_attr "mode" "SI")
462 (set_attr "length" "1")])
464 (define_expand "subdi3"
465 [(parallel [(set (match_operand:DI 0 "register_operand" "=d")
466 (minus:DI (match_operand:DI 1 "register_operand" "d")
467 (match_operand:DI 2 "register_operand" "d")))
468 (clobber (match_dup 3))])]
469 "!TARGET_DEBUG_G_MODE"
470 "operands[3] = gen_reg_rtx (SImode);")
472 (define_insn "subdi3_internal"
473 [(set (match_operand:DI 0 "register_operand" "=d")
474 (minus:DI (match_operand:DI 1 "register_operand" "d")
475 (match_operand:DI 2 "register_operand" "d")))
476 (clobber (match_operand:SI 3 "register_operand" "=d"))]
477 "!TARGET_DEBUG_G_MODE"
478 "sltu\\t%3,%L1,%L2\;subu\\t%L0,%L1,%L2\;subu\\t%M0,%M1,%M2\;subu\\t%M0,%M0,%3"
479 [(set_attr "type" "darith")
480 (set_attr "mode" "DI")
481 (set_attr "length" "4")])
484 [(set (match_operand:DI 0 "register_operand" "")
485 (minus:DI (match_operand:DI 1 "register_operand" "")
486 (match_operand:DI 2 "register_operand" "")))
487 (clobber (match_operand:SI 3 "register_operand" ""))]
488 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_DEBUG_G_MODE
489 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
490 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
491 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
494 (ltu:CC (subreg:SI (match_dup 1) 0)
495 (subreg:SI (match_dup 2) 0)))
497 (set (subreg:SI (match_dup 0) 0)
498 (minus:SI (subreg:SI (match_dup 1) 0)
499 (subreg:SI (match_dup 2) 0)))
501 (set (subreg:SI (match_dup 0) 1)
502 (minus:SI (subreg:SI (match_dup 1) 1)
503 (subreg:SI (match_dup 2) 1)))
505 (set (subreg:SI (match_dup 0) 1)
506 (minus:SI (subreg:SI (match_dup 0) 1)
511 [(set (match_operand:DI 0 "register_operand" "")
512 (minus:DI (match_operand:DI 1 "register_operand" "")
513 (match_operand:DI 2 "register_operand" "")))
514 (clobber (match_operand:SI 3 "register_operand" ""))]
515 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_DEBUG_G_MODE
516 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
517 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
518 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
521 (ltu:CC (subreg:SI (match_dup 1) 1)
522 (subreg:SI (match_dup 2) 1)))
524 (set (subreg:SI (match_dup 0) 1)
525 (minus:SI (subreg:SI (match_dup 1) 1)
526 (subreg:SI (match_dup 2) 1)))
528 (set (subreg:SI (match_dup 0) 0)
529 (minus:SI (subreg:SI (match_dup 1) 0)
530 (subreg:SI (match_dup 2) 0)))
532 (set (subreg:SI (match_dup 0) 0)
533 (minus:SI (subreg:SI (match_dup 0) 0)
537 (define_insn "subdi3_internal_2"
538 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
539 (minus:DI (match_operand:DI 1 "register_operand" "d,d,d")
540 (match_operand:DI 2 "small_int" "P,J,N")))
541 (clobber (match_operand:SI 3 "register_operand" "=d,d,d"))]
542 "!TARGET_DEBUG_G_MODE && INTVAL (operands[2]) != -32768"
544 sltu\\t%3,%L1,%2\;subu\\t%L0,%L1,%2\;subu\\t%M0,%M1,%3
545 move\\t%L0,%L1\;move\\t%M0,%M1
546 sltu\\t%3,%L1,%2\;subu\\t%L0,%L1,%2\;subu\\t%M0,%M1,1\;subu\\t%M0,%M0,%3"
547 [(set_attr "type" "darith,darith,darith")
548 (set_attr "mode" "DI,DI,DI")
549 (set_attr "length" "3,2,4")])
552 [(set (match_operand:DI 0 "register_operand" "")
553 (minus:DI (match_operand:DI 1 "register_operand" "")
554 (match_operand:DI 2 "small_int" "")))
555 (clobber (match_operand:SI 3 "register_operand" ""))]
556 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_DEBUG_G_MODE
557 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
558 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
559 && INTVAL (operands[2]) > 0"
562 (ltu:CC (subreg:SI (match_dup 1) 0)
565 (set (subreg:SI (match_dup 0) 0)
566 (minus:SI (subreg:SI (match_dup 1) 0)
569 (set (subreg:SI (match_dup 0) 1)
570 (minus:SI (subreg:SI (match_dup 1) 1)
575 [(set (match_operand:DI 0 "register_operand" "")
576 (minus:DI (match_operand:DI 1 "register_operand" "")
577 (match_operand:DI 2 "small_int" "")))
578 (clobber (match_operand:SI 3 "register_operand" ""))]
579 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_DEBUG_G_MODE
580 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
581 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
582 && INTVAL (operands[2]) > 0"
585 (ltu:CC (subreg:SI (match_dup 1) 1)
588 (set (subreg:SI (match_dup 0) 1)
589 (minus:SI (subreg:SI (match_dup 1) 1)
592 (set (subreg:SI (match_dup 0) 0)
593 (minus:SI (subreg:SI (match_dup 1) 0)
599 ;; ....................
603 ;; ....................
606 (define_insn "muldf3"
607 [(set (match_operand:DF 0 "register_operand" "=f")
608 (mult:DF (match_operand:DF 1 "register_operand" "f")
609 (match_operand:DF 2 "register_operand" "f")))]
612 [(set_attr "type" "fmul")
613 (set_attr "mode" "DF")
614 (set_attr "length" "1")])
616 (define_insn "mulsf3"
617 [(set (match_operand:SF 0 "register_operand" "=f")
618 (mult:SF (match_operand:SF 1 "register_operand" "f")
619 (match_operand:SF 2 "register_operand" "f")))]
622 [(set_attr "type" "fmul")
623 (set_attr "mode" "SF")
624 (set_attr "length" "1")])
626 (define_insn "mulsi3"
627 [(set (match_operand:SI 0 "register_operand" "=d")
628 (mult:SI (match_operand:SI 1 "register_operand" "d")
629 (match_operand:SI 2 "register_operand" "d")))
630 (clobber (reg:SI 64))
631 (clobber (reg:SI 65))]
637 xoperands[0] = operands[0];
638 xoperands[1] = gen_rtx (REG, SImode, LO_REGNUM);
640 output_asm_insn (\"mult\\t%1,%2\", operands);
641 output_asm_insn (mips_move_1word (xoperands, insn), xoperands);
644 [(set_attr "type" "imul")
645 (set_attr "mode" "SI")
646 (set_attr "length" "3")]) ;; mult + mflo + delay
649 [(set (match_operand:SI 0 "register_operand" "")
650 (mult:SI (match_operand:SI 1 "register_operand" "")
651 (match_operand:SI 2 "register_operand" "")))
652 (clobber (reg:SI 64))
653 (clobber (reg:SI 65))]
655 [(parallel [(set (reg:SI 65) ;; low register
656 (mult:SI (match_dup 1)
658 (clobber (reg:SI 64))])
663 (define_insn "mulsi3_internal"
664 [(set (reg:SI 65) ;; low register
665 (mult:SI (match_operand:SI 0 "register_operand" "d")
666 (match_operand:SI 1 "register_operand" "d")))
667 (clobber (reg:SI 64))]
670 [(set_attr "type" "imul")
671 (set_attr "mode" "SI")
672 (set_attr "length" "1")])
674 (define_insn "mulsidi3"
675 [(set (match_operand:DI 0 "register_operand" "=d")
676 (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))
677 (sign_extend:DI (match_operand:SI 2 "register_operand" "d"))))
678 (clobber (reg:DI 64))]
684 xoperands[0] = operands[0];
685 xoperands[1] = gen_rtx (REG, DImode, MD_REG_FIRST);
687 output_asm_insn (\"mult\\t%1,%2\", operands);
688 output_asm_insn (mips_move_2words (xoperands, insn), xoperands);
691 [(set_attr "type" "imul")
692 (set_attr "mode" "SI")
693 (set_attr "length" "4")]) ;; mult + mflo + mfhi + delay
695 (define_insn "umulsidi3"
696 [(set (match_operand:DI 0 "register_operand" "=d")
697 (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "d"))
698 (zero_extend:DI (match_operand:SI 2 "register_operand" "d"))))
699 (clobber (reg:DI 64))]
705 xoperands[0] = operands[0];
706 xoperands[1] = gen_rtx (REG, DImode, MD_REG_FIRST);
708 output_asm_insn (\"multu\\t%1,%2\", operands);
709 output_asm_insn (mips_move_2words (xoperands, insn), xoperands);
712 [(set_attr "type" "imul")
713 (set_attr "mode" "SI")
714 (set_attr "length" "4")]) ;; mult + mflo + mfhi + delay
718 ;; ....................
720 ;; DIVISION and REMAINDER
722 ;; ....................
725 (define_insn "divdf3"
726 [(set (match_operand:DF 0 "register_operand" "=f")
727 (div:DF (match_operand:DF 1 "register_operand" "f")
728 (match_operand:DF 2 "register_operand" "f")))]
731 [(set_attr "type" "fdiv")
732 (set_attr "mode" "DF")
733 (set_attr "length" "1")])
735 (define_insn "divsf3"
736 [(set (match_operand:SF 0 "register_operand" "=f")
737 (div:SF (match_operand:SF 1 "register_operand" "f")
738 (match_operand:SF 2 "register_operand" "f")))]
741 [(set_attr "type" "fdiv")
742 (set_attr "mode" "SF")
743 (set_attr "length" "1")])
745 ;; If optimizing, prefer the divmod functions over separate div and
746 ;; mod functions, since this will allow using one instruction for both
747 ;; the quotient and remainder. At present, the divmod is not moved out
748 ;; of loops if it is constant within the loop, so allow -mdebugc to
749 ;; use the old method of doing things.
751 ;; 64 is the multiply/divide hi register
752 ;; 65 is the multiply/divide lo register
754 (define_insn "divmodsi4"
755 [(parallel [(set (match_operand:SI 0 "register_operand" "=d")
756 (div:SI (match_operand:SI 1 "register_operand" "d")
757 (match_operand:SI 2 "register_operand" "d")))
758 (set (match_operand:SI 3 "register_operand" "=d")
759 (mod:SI (match_dup 1)
761 (clobber (reg:SI 64))
762 (clobber (reg:SI 65))])]
763 "optimize && !TARGET_DEBUG_C_MODE"
766 if (find_reg_note (insn, REG_UNUSED, operands[3]))
767 return \"div\\t%0,%1,%2\";
769 if (find_reg_note (insn, REG_UNUSED, operands[0]))
770 return \"rem\\t%3,%1,%2\";
772 return \"div\\t%0,%1,%2\;mfhi\\t%3\";
774 [(set_attr "type" "idiv")
775 (set_attr "mode" "SI")
776 (set_attr "length" "13")]) ;; various tests for dividing by 0 and such
778 (define_insn "udivmodsi4"
779 [(parallel [(set (match_operand:SI 0 "register_operand" "=d")
780 (udiv:SI (match_operand:SI 1 "register_operand" "d")
781 (match_operand:SI 2 "register_operand" "d")))
782 (set (match_operand:SI 3 "register_operand" "=d")
783 (umod:SI (match_dup 1)
785 (clobber (reg:SI 64))
786 (clobber (reg:SI 65))])]
787 "optimize && !TARGET_DEBUG_C_MODE"
790 if (find_reg_note (insn, REG_UNUSED, operands[3]))
791 return \"divu\\t%0,%1,%2\";
793 if (find_reg_note (insn, REG_UNUSED, operands[0]))
794 return \"remu\\t%3,%1,%2\";
796 return \"divu\\t%0,%1,%2\;mfhi\\t%3\";
798 [(set_attr "type" "idiv")
799 (set_attr "mode" "SI")
800 (set_attr "length" "13")]) ;; various tests for dividing by 0 and such
802 (define_insn "divsi3"
803 [(set (match_operand:SI 0 "register_operand" "=d")
804 (div:SI (match_operand:SI 1 "register_operand" "d")
805 (match_operand:SI 2 "register_operand" "d")))
806 (clobber (reg:SI 64))
807 (clobber (reg:SI 65))]
808 "!optimize || TARGET_DEBUG_C_MODE"
810 [(set_attr "type" "idiv")
811 (set_attr "mode" "SI")
812 (set_attr "length" "13")]) ;; various tests for dividing by 0 and such
814 (define_insn "modsi3"
815 [(set (match_operand:SI 0 "register_operand" "=d")
816 (mod:SI (match_operand:SI 1 "register_operand" "d")
817 (match_operand:SI 2 "register_operand" "d")))
818 (clobber (reg:SI 64))
819 (clobber (reg:SI 65))]
820 "!optimize || TARGET_DEBUG_C_MODE"
822 [(set_attr "type" "idiv")
823 (set_attr "mode" "SI")
824 (set_attr "length" "14")]) ;; various tests for dividing by 0 and such
826 (define_insn "udivsi3"
827 [(set (match_operand:SI 0 "register_operand" "=d")
828 (udiv:SI (match_operand:SI 1 "register_operand" "d")
829 (match_operand:SI 2 "register_operand" "d")))
830 (clobber (reg:SI 64))
831 (clobber (reg:SI 65))]
832 "!optimize || TARGET_DEBUG_C_MODE"
834 [(set_attr "type" "idiv")
835 (set_attr "mode" "SI")
836 (set_attr "length" "14")]) ;; various tests for dividing by 0 and such
838 (define_insn "umodsi3"
839 [(set (match_operand:SI 0 "register_operand" "=d")
840 (umod:SI (match_operand:SI 1 "register_operand" "d")
841 (match_operand:SI 2 "register_operand" "d")))
842 (clobber (reg:SI 64))
843 (clobber (reg:SI 65))]
844 "!optimize || TARGET_DEBUG_C_MODE"
846 [(set_attr "type" "idiv")
847 (set_attr "mode" "SI")
848 (set_attr "length" "14")]) ;; various tests for dividing by 0 and such
852 ;; ....................
856 ;; ....................
858 (define_insn "sqrtdf2"
859 [(set (match_operand:DF 0 "register_operand" "=f")
860 (sqrt:DF (match_operand:DF 1 "register_operand" "f")))]
861 "TARGET_HARD_FLOAT && HAVE_SQRT_P()"
863 [(set_attr "type" "fabs")
864 (set_attr "mode" "DF")
865 (set_attr "length" "1")])
867 (define_insn "sqrtsf2"
868 [(set (match_operand:SF 0 "register_operand" "=f")
869 (sqrt:SF (match_operand:SF 1 "register_operand" "f")))]
870 "TARGET_HARD_FLOAT && HAVE_SQRT_P()"
872 [(set_attr "type" "fabs")
873 (set_attr "mode" "SF")
874 (set_attr "length" "1")])
878 ;; ....................
882 ;; ....................
884 ;; Do not use the integer abs macro instruction, since that signals an
885 ;; exception on -2147483648 (sigh).
887 (define_insn "abssi2"
888 [(set (match_operand:SI 0 "register_operand" "=d")
889 (abs:SI (match_operand:SI 1 "register_operand" "d")))]
894 dslots_jump_filled++;
895 operands[2] = const0_rtx;
897 return (REGNO (operands[0]) == REGNO (operands[1]))
898 ? \"bgez\\t%1,1f%#\\n\\tsubu\\t%0,%z2,%0\\n1:\"
899 : \"%(bgez\\t%1,1f\\n\\tmove\\t%0,%1\\n\\tsubu\\t%0,%z2,%0\\n1:%)\";
901 [(set_attr "type" "multi")
902 (set_attr "mode" "SI")
903 (set_attr "length" "3")])
905 (define_insn "absdf2"
906 [(set (match_operand:DF 0 "register_operand" "=f")
907 (abs:DF (match_operand:DF 1 "register_operand" "f")))]
910 [(set_attr "type" "fabs")
911 (set_attr "mode" "DF")
912 (set_attr "length" "1")])
914 (define_insn "abssf2"
915 [(set (match_operand:SF 0 "register_operand" "=f")
916 (abs:SF (match_operand:SF 1 "register_operand" "f")))]
919 [(set_attr "type" "fabs")
920 (set_attr "mode" "SF")
921 (set_attr "length" "1")])
925 ;; ....................
927 ;; FIND FIRST BIT INSTRUCTION
929 ;; ....................
932 (define_insn "ffssi2"
933 [(set (match_operand:SI 0 "register_operand" "=&d")
934 (ffs:SI (match_operand:SI 1 "register_operand" "d")))
935 (clobber (match_scratch:SI 2 "d"))
936 (clobber (match_scratch:SI 3 "d"))]
940 dslots_jump_total += 2;
941 dslots_jump_filled += 2;
942 operands[4] = const0_rtx;
944 if (optimize && find_reg_note (insn, REG_DEAD, operands[1]))
947 \\tbeq\\t%1,%z4,2f\\n\\
948 1:\\tand\\t%2,%1,0x0001\\n\\
949 \\taddu\\t%0,%0,1\\n\\
950 \\tbeq\\t%2,%z4,1b\\n\\
951 \\tsrl\\t%1,%1,1\\n\\
957 \\tbeq\\t%3,%z4,2f\\n\\
958 1:\\tand\\t%2,%3,0x0001\\n\\
959 \\taddu\\t%0,%0,1\\n\\
960 \\tbeq\\t%2,%z4,1b\\n\\
961 \\tsrl\\t%3,%3,1\\n\\
964 [(set_attr "type" "multi")
965 (set_attr "mode" "SI")
966 (set_attr "length" "6")])
970 ;; ....................
972 ;; NEGATION and ONE'S COMPLEMENT
974 ;; ....................
976 (define_insn "negsi2"
977 [(set (match_operand:SI 0 "register_operand" "=d")
978 (neg:SI (match_operand:SI 1 "register_operand" "d")))]
982 operands[2] = const0_rtx;
983 return \"subu\\t%0,%z2,%1\";
985 [(set_attr "type" "arith")
986 (set_attr "mode" "SI")
987 (set_attr "length" "1")])
989 (define_expand "negdi3"
990 [(parallel [(set (match_operand:DI 0 "register_operand" "=d")
991 (neg:DI (match_operand:DI 1 "register_operand" "d")))
992 (clobber (match_dup 2))])]
993 "!TARGET_DEBUG_G_MODE"
994 "operands[2] = gen_reg_rtx (SImode);")
996 (define_insn "negdi3_internal"
997 [(set (match_operand:DI 0 "register_operand" "=d")
998 (neg:DI (match_operand:DI 1 "register_operand" "d")))
999 (clobber (match_operand:SI 2 "register_operand" "=d"))]
1000 "!TARGET_DEBUG_G_MODE"
1003 operands[3] = const0_rtx;
1004 return \"subu\\t%L0,%z3,%L1\;subu\\t%M0,%z3,%M1\;sltu\\t%2,%z3,%L0\;subu\\t%M0,%M0,%2\";
1006 [(set_attr "type" "darith")
1007 (set_attr "mode" "DI")
1008 (set_attr "length" "4")])
1010 (define_insn "negdf2"
1011 [(set (match_operand:DF 0 "register_operand" "=f")
1012 (neg:DF (match_operand:DF 1 "register_operand" "f")))]
1015 [(set_attr "type" "fneg")
1016 (set_attr "mode" "DF")
1017 (set_attr "length" "1")])
1019 (define_insn "negsf2"
1020 [(set (match_operand:SF 0 "register_operand" "=f")
1021 (neg:SF (match_operand:SF 1 "register_operand" "f")))]
1024 [(set_attr "type" "fneg")
1025 (set_attr "mode" "SF")
1026 (set_attr "length" "1")])
1028 (define_insn "one_cmplsi2"
1029 [(set (match_operand:SI 0 "register_operand" "=d")
1030 (not:SI (match_operand:SI 1 "register_operand" "d")))]
1034 operands[2] = const0_rtx;
1035 return \"nor\\t%0,%z2,%1\";
1037 [(set_attr "type" "arith")
1038 (set_attr "mode" "SI")
1039 (set_attr "length" "1")])
1041 (define_insn "one_cmpldi2"
1042 [(set (match_operand:DI 0 "register_operand" "=d")
1043 (not:SI (match_operand:DI 1 "register_operand" "d")))]
1047 operands[2] = const0_rtx;
1048 return \"nor\\t%M0,%z2,%M1\;nor\\t%L0,%z2,%L1\";
1050 [(set_attr "type" "darith")
1051 (set_attr "mode" "DI")
1052 (set_attr "length" "2")])
1055 [(set (match_operand:DI 0 "register_operand" "")
1056 (not:DI (match_operand:DI 1 "register_operand" "")))]
1057 "reload_completed && !TARGET_DEBUG_G_MODE
1058 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
1059 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))"
1061 [(set (subreg:SI (match_dup 0) 0) (not:SI (subreg:SI (match_dup 1) 0)))
1062 (set (subreg:SI (match_dup 0) 1) (not:SI (subreg:SI (match_dup 1) 1)))]
1065 ;; Simple hack to recognize the "nor" instruction on the MIPS
1066 ;; This must appear before the normal or patterns, so that the
1067 ;; combiner will correctly fold things.
1069 (define_insn "norsi3"
1070 [(set (match_operand:SI 0 "register_operand" "=d")
1071 (not:SI (ior:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
1072 (match_operand:SI 2 "reg_or_0_operand" "dJ"))))]
1075 [(set_attr "type" "arith")
1076 (set_attr "mode" "SI")
1077 (set_attr "length" "1")])
1079 (define_insn "nordi3"
1080 [(set (match_operand:DI 0 "register_operand" "=d")
1081 (not:DI (ior:DI (match_operand:DI 1 "register_operand" "d")
1082 (match_operand:DI 2 "register_operand" "d"))))]
1084 "nor\\t%M0,%M1,%M2\;nor\\t%L0,%L1,%L2"
1085 [(set_attr "type" "darith")
1086 (set_attr "mode" "DI")
1087 (set_attr "length" "2")])
1090 [(set (match_operand:DI 0 "register_operand" "")
1091 (not:DI (ior:DI (match_operand:DI 1 "register_operand" "")
1092 (match_operand:DI 2 "register_operand" ""))))]
1093 "reload_completed && !TARGET_DEBUG_G_MODE
1094 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
1095 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
1096 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
1098 [(set (subreg:SI (match_dup 0) 0) (not:SI (ior:SI (subreg:SI (match_dup 1) 0) (subreg:SI (match_dup 2) 0))))
1099 (set (subreg:SI (match_dup 0) 1) (not:SI (ior:SI (subreg:SI (match_dup 1) 1) (subreg:SI (match_dup 2) 1))))]
1104 ;; ....................
1108 ;; ....................
1111 ;; Be more liberal in allowing logical operations than the machine actually
1112 ;; supports. This causes better code to be generated for bitfields, since
1113 ;; the optimizer can fold things together, at the expense of not moving the
1114 ;; constant out of loops.
1116 (define_insn "andsi3"
1117 [(set (match_operand:SI 0 "register_operand" "=d,d,?d,?d")
1118 (and:SI (match_operand:SI 1 "arith32_operand" "%d,d,d,d")
1119 (match_operand:SI 2 "arith32_operand" "d,K,I,M")))]
1124 %[li\\t%@,%X2\;and\\t%0,%1,%@%]
1125 %[li\\t%@,%X2\;and\\t%0,%1,%@%]"
1126 [(set_attr "type" "arith,arith,multi,multi")
1127 (set_attr "mode" "SI,SI,SI,SI")
1128 (set_attr "length" "1,1,2,3")])
1130 (define_insn "anddi3"
1131 [(set (match_operand:DI 0 "register_operand" "=d")
1132 (and:DI (match_operand:DI 1 "register_operand" "d")
1133 (match_operand:DI 2 "register_operand" "d")))]
1134 "!TARGET_DEBUG_G_MODE"
1135 "and\\t%M0,%M1,%M2\;and\\t%L0,%L1,%L2"
1136 [(set_attr "type" "darith")
1137 (set_attr "mode" "DI")
1138 (set_attr "length" "2")])
1141 [(set (match_operand:DI 0 "register_operand" "")
1142 (and:DI (match_operand:DI 1 "register_operand" "")
1143 (match_operand:DI 2 "register_operand" "")))]
1144 "reload_completed && !TARGET_DEBUG_G_MODE
1145 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
1146 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
1147 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
1149 [(set (subreg:SI (match_dup 0) 0) (and:SI (subreg:SI (match_dup 1) 0) (subreg:SI (match_dup 2) 0)))
1150 (set (subreg:SI (match_dup 0) 1) (and:SI (subreg:SI (match_dup 1) 1) (subreg:SI (match_dup 2) 1)))]
1153 (define_insn "iorsi3"
1154 [(set (match_operand:SI 0 "register_operand" "=d,d,?d,?d")
1155 (ior:SI (match_operand:SI 1 "arith32_operand" "%d,d,d,d")
1156 (match_operand:SI 2 "arith32_operand" "d,K,I,M")))]
1161 %[li\\t%@,%X2\;or\\t%0,%1,%@%]
1162 %[li\\t%@,%X2\;or\\t%0,%1,%@%]"
1163 [(set_attr "type" "arith,arith,multi,multi")
1164 (set_attr "mode" "SI,SI,SI,SI")
1165 (set_attr "length" "1,1,2,3")])
1167 (define_insn "iordi3"
1168 [(set (match_operand:DI 0 "register_operand" "=d")
1169 (ior:DI (match_operand:DI 1 "register_operand" "d")
1170 (match_operand:DI 2 "register_operand" "d")))]
1171 "!TARGET_DEBUG_G_MODE"
1172 "or\\t%M0,%M1,%M2\;or\\t%L0,%L1,%L2"
1173 [(set_attr "type" "darith")
1174 (set_attr "mode" "DI")
1175 (set_attr "length" "2")])
1178 [(set (match_operand:DI 0 "register_operand" "")
1179 (ior:DI (match_operand:DI 1 "register_operand" "")
1180 (match_operand:DI 2 "register_operand" "")))]
1181 "reload_completed && !TARGET_DEBUG_G_MODE
1182 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
1183 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
1184 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
1186 [(set (subreg:SI (match_dup 0) 0) (ior:SI (subreg:SI (match_dup 1) 0) (subreg:SI (match_dup 2) 0)))
1187 (set (subreg:SI (match_dup 0) 1) (ior:SI (subreg:SI (match_dup 1) 1) (subreg:SI (match_dup 2) 1)))]
1190 (define_insn "xorsi3"
1191 [(set (match_operand:SI 0 "register_operand" "=d,d,?d,?d")
1192 (xor:SI (match_operand:SI 1 "arith32_operand" "%d,d,d,d")
1193 (match_operand:SI 2 "arith32_operand" "d,K,I,M")))]
1198 %[li\\t%@,%X2\;xor\\t%0,%1,%@%]
1199 %[li\\t%@,%X2\;xor\\t%0,%1,%@%]"
1200 [(set_attr "type" "arith,arith,multi,multi")
1201 (set_attr "mode" "SI,SI,SI,SI")
1202 (set_attr "length" "1,1,2,3")])
1204 (define_insn "xordi3"
1205 [(set (match_operand:DI 0 "register_operand" "=d")
1206 (xor:DI (match_operand:DI 1 "register_operand" "d")
1207 (match_operand:DI 2 "register_operand" "d")))]
1208 "!TARGET_DEBUG_G_MODE"
1209 "xor\\t%M0,%M1,%M2\;xor\\t%L0,%L1,%L2"
1210 [(set_attr "type" "darith")
1211 (set_attr "mode" "DI")
1212 (set_attr "length" "2")])
1215 [(set (match_operand:DI 0 "register_operand" "")
1216 (xor:DI (match_operand:DI 1 "register_operand" "")
1217 (match_operand:DI 2 "register_operand" "")))]
1218 "reload_completed && !TARGET_DEBUG_G_MODE
1219 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
1220 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
1221 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
1223 [(set (subreg:SI (match_dup 0) 0) (xor:SI (subreg:SI (match_dup 1) 0) (subreg:SI (match_dup 2) 0)))
1224 (set (subreg:SI (match_dup 0) 1) (xor:SI (subreg:SI (match_dup 1) 1) (subreg:SI (match_dup 2) 1)))]
1229 ;; ....................
1233 ;; ....................
1235 (define_insn "truncdfsf2"
1236 [(set (match_operand:SF 0 "register_operand" "=f")
1237 (float_truncate:SF (match_operand:DF 1 "register_operand" "f")))]
1240 [(set_attr "type" "fcvt")
1241 (set_attr "mode" "SF")
1242 (set_attr "length" "1")])
1246 ;; ....................
1250 ;; ....................
1253 ;; Those for integer source operand
1254 ;; are ordered widest source type first.
1256 (define_insn "zero_extendhisi2"
1257 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
1258 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "d,R,m")))]
1262 if (which_alternative == 0)
1263 return \"andi\\t%0,%1,0xffff\";
1265 return mips_move_1word (operands, insn, TRUE);
1267 [(set_attr "type" "arith,load,load")
1268 (set_attr "mode" "SI,SI,SI")
1269 (set_attr "length" "1,1,2")])
1271 (define_insn "zero_extendqihi2"
1272 [(set (match_operand:HI 0 "register_operand" "=d,d,d")
1273 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "d,R,m")))]
1277 if (which_alternative == 0)
1278 return \"andi\\t%0,%1,0x00ff\";
1280 return mips_move_1word (operands, insn, TRUE);
1282 [(set_attr "type" "arith,load,load")
1283 (set_attr "mode" "HI,HI,HI")
1284 (set_attr "length" "1,1,2")])
1286 (define_insn "zero_extendqisi2"
1287 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
1288 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "d,R,m")))]
1292 if (which_alternative == 0)
1293 return \"andi\\t%0,%1,0x00ff\";
1295 return mips_move_1word (operands, insn, TRUE);
1297 [(set_attr "type" "arith,load,load")
1298 (set_attr "mode" "SI,SI,SI")
1299 (set_attr "length" "1,1,2")])
1303 ;; ....................
1307 ;; ....................
1310 ;; Those for integer source operand
1311 ;; are ordered widest source type first.
1313 ;; These patterns originally accepted general_operands, however, slightly
1314 ;; better code is generated by only accepting register_operands, and then
1315 ;; letting combine generate the lh and lb insns.
1317 (define_expand "extendhisi2"
1318 [(set (match_operand:SI 0 "register_operand" "")
1319 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
1323 if (optimize && GET_CODE (operands[1]) == MEM)
1324 operands[1] = force_not_mem (operands[1]);
1326 if (GET_CODE (operands[1]) != MEM)
1328 rtx op1 = gen_lowpart (SImode, operands[1]);
1329 rtx temp = gen_reg_rtx (SImode);
1330 rtx shift = gen_rtx (CONST_INT, VOIDmode, 16);
1332 emit_insn (gen_ashlsi3 (temp, op1, shift));
1333 emit_insn (gen_ashrsi3 (operands[0], temp, shift));
1338 (define_insn "extendhisi2_internal"
1339 [(set (match_operand:SI 0 "register_operand" "=d,d")
1340 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,m")))]
1342 "* return mips_move_1word (operands, insn, FALSE);"
1343 [(set_attr "type" "load,load")
1344 (set_attr "mode" "SI,SI")
1345 (set_attr "length" "1,2")])
1347 (define_expand "extendqihi2"
1348 [(set (match_operand:HI 0 "register_operand" "")
1349 (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))]
1353 if (optimize && GET_CODE (operands[1]) == MEM)
1354 operands[1] = force_not_mem (operands[1]);
1356 if (GET_CODE (operands[1]) != MEM)
1358 rtx op0 = gen_lowpart (SImode, operands[0]);
1359 rtx op1 = gen_lowpart (SImode, operands[1]);
1360 rtx temp = gen_reg_rtx (SImode);
1361 rtx shift = gen_rtx (CONST_INT, VOIDmode, 24);
1363 emit_insn (gen_ashlsi3 (temp, op1, shift));
1364 emit_insn (gen_ashrsi3 (op0, temp, shift));
1369 (define_insn "extendqihi2_internal"
1370 [(set (match_operand:HI 0 "register_operand" "=d,d")
1371 (sign_extend:HI (match_operand:QI 1 "memory_operand" "R,m")))]
1373 "* return mips_move_1word (operands, insn, FALSE);"
1374 [(set_attr "type" "load,load")
1375 (set_attr "mode" "SI,SI")
1376 (set_attr "length" "1,2")])
1379 (define_expand "extendqisi2"
1380 [(set (match_operand:SI 0 "register_operand" "")
1381 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
1385 if (optimize && GET_CODE (operands[1]) == MEM)
1386 operands[1] = force_not_mem (operands[1]);
1388 if (GET_CODE (operands[1]) != MEM)
1390 rtx op1 = gen_lowpart (SImode, operands[1]);
1391 rtx temp = gen_reg_rtx (SImode);
1392 rtx shift = gen_rtx (CONST_INT, VOIDmode, 24);
1394 emit_insn (gen_ashlsi3 (temp, op1, shift));
1395 emit_insn (gen_ashrsi3 (operands[0], temp, shift));
1400 (define_insn "extendqisi2_insn"
1401 [(set (match_operand:SI 0 "register_operand" "=d,d")
1402 (sign_extend:SI (match_operand:QI 1 "memory_operand" "R,m")))]
1404 "* return mips_move_1word (operands, insn, FALSE);"
1405 [(set_attr "type" "load,load")
1406 (set_attr "mode" "SI,SI")
1407 (set_attr "length" "1,2")])
1410 (define_insn "extendsfdf2"
1411 [(set (match_operand:DF 0 "register_operand" "=f")
1412 (float_extend:DF (match_operand:SF 1 "register_operand" "f")))]
1415 [(set_attr "type" "fcvt")
1416 (set_attr "mode" "DF")
1417 (set_attr "length" "1")])
1422 ;; ....................
1426 ;; ....................
1428 (define_insn "fix_truncdfsi2_internal"
1429 [(set (match_operand:SI 0 "general_operand" "=d,*f,R,o")
1430 (fix:SI (match_operand:DF 1 "register_operand" "f,*f,f,f")))
1431 (clobber (match_operand:SI 2 "register_operand" "d,*d,d,d"))
1432 (clobber (match_operand:DF 3 "register_operand" "f,*f,f,f"))]
1438 if (which_alternative == 1)
1439 return \"trunc.w.d %0,%1,%2\";
1441 output_asm_insn (\"trunc.w.d %3,%1,%2\", operands);
1443 xoperands[0] = operands[0];
1444 xoperands[1] = operands[3];
1445 output_asm_insn (mips_move_1word (xoperands, insn, FALSE), xoperands);
1448 [(set_attr "type" "fcvt,fcvt,fcvt,fcvt")
1449 (set_attr "mode" "DF,DF,DF,DF")
1450 (set_attr "length" "14,12,13,14")])
1453 (define_expand "fix_truncdfsi2"
1454 [(parallel [(set (match_operand:SI 0 "register_operand" "=d")
1455 (fix:SI (match_operand:DF 1 "register_operand" "f")))
1456 (clobber (match_dup 2))
1457 (clobber (match_dup 3))])]
1461 operands[2] = gen_reg_rtx (SImode); /* gp reg that saves FP status bits */
1462 operands[3] = gen_reg_rtx (DFmode); /* fp reg that gets the conversion */
1464 /* Fall through and generate default code */
1467 (define_insn "fix_truncsfsi2_internal"
1468 [(set (match_operand:SI 0 "general_operand" "=d,*f,R,o")
1469 (fix:SI (match_operand:SF 1 "register_operand" "f,*f,f,f")))
1470 (clobber (match_operand:SI 2 "register_operand" "d,*d,d,d"))
1471 (clobber (match_operand:SF 3 "register_operand" "f,*f,f,f"))]
1477 if (which_alternative == 1)
1478 return \"trunc.w.s %0,%1,%2\";
1480 output_asm_insn (\"trunc.w.s %3,%1,%2\", operands);
1482 xoperands[0] = operands[0];
1483 xoperands[1] = operands[3];
1484 output_asm_insn (mips_move_1word (xoperands, insn, FALSE), xoperands);
1487 [(set_attr "type" "fcvt,fcvt,fcvt,fcvt")
1488 (set_attr "mode" "SF,SF,SF,SF")
1489 (set_attr "length" "14,12,13,14")])
1492 (define_expand "fix_truncsfsi2"
1493 [(parallel [(set (match_operand:SI 0 "register_operand" "=f")
1494 (fix:SI (match_operand:SF 1 "register_operand" "f")))
1495 (clobber (match_dup 2))
1496 (clobber (match_dup 3))])]
1500 operands[2] = gen_reg_rtx (SImode); /* gp reg that saves FP status bits */
1501 operands[3] = gen_reg_rtx (SFmode); /* fp reg that gets the conversion */
1503 /* Fall through and generate default code */
1507 (define_insn "floatsidf2"
1508 [(set (match_operand:DF 0 "register_operand" "=f")
1509 (float:DF (match_operand:SI 1 "register_operand" "d")))]
1511 "mtc1\\t%1,%0\;cvt.d.w\\t%0,%0"
1512 [(set_attr "type" "fcvt")
1513 (set_attr "mode" "DF")
1514 (set_attr "length" "13")])
1516 (define_insn "floatsisf2"
1517 [(set (match_operand:SF 0 "register_operand" "=f")
1518 (float:SF (match_operand:SI 1 "register_operand" "d")))]
1520 "mtc1\\t%1,%0\;cvt.s.w\\t%0,%0"
1521 [(set_attr "type" "fcvt")
1522 (set_attr "mode" "SF")
1523 (set_attr "length" "13")])
1525 (define_expand "fixuns_truncdfsi2"
1526 [(set (match_operand:SI 0 "register_operand" "")
1527 (unsigned_fix:SI (match_operand:DF 1 "register_operand" "")))]
1531 rtx reg1 = gen_reg_rtx (DFmode);
1532 rtx reg2 = gen_reg_rtx (DFmode);
1533 rtx reg3 = gen_reg_rtx (SImode);
1534 rtx label1 = gen_label_rtx ();
1535 rtx label2 = gen_label_rtx ();
1536 REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (1.0, 31);
1538 if (reg1) /* turn off complaints about unreached code */
1540 extern rtx gen_cmpdf ();
1541 emit_move_insn (reg1, immed_real_const_1 (offset, DFmode));
1542 do_pending_stack_adjust ();
1544 emit_insn (gen_cmpdf (operands[1], reg1));
1545 emit_jump_insn (gen_bge (label1));
1547 emit_insn (gen_fix_truncdfsi2 (operands[0], operands[1]));
1548 emit_jump_insn (gen_rtx (SET, VOIDmode, pc_rtx,
1549 gen_rtx (LABEL_REF, VOIDmode, label2)));
1552 emit_label (label1);
1553 emit_move_insn (reg2, gen_rtx (MINUS, DFmode, operands[1], reg1));
1554 emit_move_insn (reg3, gen_rtx (CONST_INT, VOIDmode, 0x80000000));
1556 emit_insn (gen_fix_truncdfsi2 (operands[0], reg2));
1557 emit_insn (gen_iorsi3 (operands[0], operands[0], reg3));
1559 emit_label (label2);
1561 /* allow REG_NOTES to be set on last insn (labels don't have enough
1562 fields, and can't be used for REG_NOTES anyway). */
1563 emit_insn (gen_rtx (USE, VOIDmode, stack_pointer_rtx));
1568 (define_expand "fixuns_truncsfsi2"
1569 [(set (match_operand:SI 0 "register_operand" "")
1570 (unsigned_fix:SI (match_operand:SF 1 "register_operand" "")))]
1574 rtx reg1 = gen_reg_rtx (SFmode);
1575 rtx reg2 = gen_reg_rtx (SFmode);
1576 rtx reg3 = gen_reg_rtx (SImode);
1577 rtx label1 = gen_label_rtx ();
1578 rtx label2 = gen_label_rtx ();
1579 REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (1.0, 31);
1581 if (reg1) /* turn off complaints about unreached code */
1583 extern rtx gen_cmpsf ();
1584 emit_move_insn (reg1, immed_real_const_1 (offset, SFmode));
1585 do_pending_stack_adjust ();
1587 emit_insn (gen_cmpsf (operands[1], reg1));
1588 emit_jump_insn (gen_bge (label1));
1590 emit_insn (gen_fix_truncsfsi2 (operands[0], operands[1]));
1591 emit_jump_insn (gen_rtx (SET, VOIDmode, pc_rtx,
1592 gen_rtx (LABEL_REF, VOIDmode, label2)));
1595 emit_label (label1);
1596 emit_move_insn (reg2, gen_rtx (MINUS, SFmode, operands[1], reg1));
1597 emit_move_insn (reg3, gen_rtx (CONST_INT, VOIDmode, 0x80000000));
1599 emit_insn (gen_fix_truncsfsi2 (operands[0], reg2));
1600 emit_insn (gen_iorsi3 (operands[0], operands[0], reg3));
1602 emit_label (label2);
1604 /* allow REG_NOTES to be set on last insn (labels don't have enough
1605 fields, and can't be used for REG_NOTES anyway). */
1606 emit_insn (gen_rtx (USE, VOIDmode, stack_pointer_rtx));
1613 ;; ....................
1617 ;; ....................
1619 ;; unaligned word moves generated by the block moves.
1621 (define_expand "movsi_unaligned"
1622 [(set (match_operand:SI 0 "general_operand" "")
1623 (unspec [(match_operand:SI 1 "general_operand" "")] 0))]
1627 extern rtx force_reg ();
1628 extern rtx gen_movsi_ulw ();
1629 extern rtx gen_movsi ();
1632 if (GET_CODE (operands[0]) == MEM)
1634 rtx reg = gen_reg_rtx (SImode);
1635 rtx insn = emit_insn (gen_movsi_ulw (reg, operands[1]));
1636 rtx addr = XEXP (operands[0], 0);
1637 if (CONSTANT_P (addr))
1638 REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_EQUIV, addr, REG_NOTES (insn));
1640 if (reg_or_0_operand (operands[1], SImode))
1646 /* Generate appropriate load, store. If not a load or store,
1647 do a normal movsi. */
1648 if (GET_CODE (operands[0]) != MEM && GET_CODE (operands[1]) != MEM)
1650 emit_insn (gen_movsi (operands[0], operands[1]));
1654 /* Fall through and generate normal code. */
1657 (define_insn "movsi_ulw"
1658 [(set (match_operand:SI 0 "register_operand" "=&d,&d,d,d")
1659 (unspec [(match_operand:SI 1 "general_operand" "R,o,dIKL,M")] 0))]
1663 extern rtx eliminate_constant_term ();
1670 if (which_alternative != 0)
1671 return mips_move_1word (operands, insn, FALSE);
1674 mips_count_memory_refs (operands[1], 2);
1676 /* The stack/frame pointers are always aligned, so we can convert
1677 to the faster lw if we are referencing an aligned stack location. */
1679 offset = const0_rtx;
1680 addr = XEXP (operands[1], 0);
1681 mem_addr = eliminate_constant_term (addr, &offset);
1683 if ((INTVAL (offset) & (UNITS_PER_WORD-1)) == 0
1684 && (mem_addr == stack_pointer_rtx || mem_addr == frame_pointer_rtx))
1685 ret = \"lw\\t%0,%1\";
1689 ret = \"ulw\\t%0,%1\";
1692 enum rtx_code code = GET_CODE (addr);
1694 if (code == CONST || code == SYMBOL_REF || code == LABEL_REF)
1696 operands[2] = gen_rtx (REG, SImode, GP_REG_FIRST + 1);
1697 ret = \"%[la\\t%2,%1\;ulw\\t%0,0(%2)%]\";
1702 return mips_fill_delay_slot (ret, DELAY_LOAD, operands, insn);
1704 [(set_attr "type" "load,load,move,arith")
1705 (set_attr "mode" "SI,SI,SI,SI")
1706 (set_attr "length" "2,4,1,2")])
1708 (define_insn "movsi_usw"
1709 [(set (match_operand:SI 0 "memory_operand" "=R,o")
1710 (unspec [(match_operand:SI 1 "reg_or_0_operand" "dJ,dJ")] 0))]
1714 extern rtx eliminate_constant_term ();
1715 rtx offset = const0_rtx;
1716 rtx addr = XEXP (operands[0], 0);
1717 rtx mem_addr = eliminate_constant_term (addr, &offset);
1720 mips_count_memory_refs (operands[0], 2);
1722 /* The stack/frame pointers are always aligned, so we can convert
1723 to the faster sw if we are referencing an aligned stack location. */
1725 if ((INTVAL (offset) & (UNITS_PER_WORD-1)) == 0
1726 && (mem_addr == stack_pointer_rtx || mem_addr == frame_pointer_rtx))
1727 return \"sw\\t%1,%0\";
1732 enum rtx_code code = GET_CODE (XEXP (operands[0], 0));
1734 if (code == CONST || code == SYMBOL_REF || code == LABEL_REF)
1736 operands[2] = gen_rtx (REG, SImode, GP_REG_FIRST + 1);
1737 return \"%[la\\t%2,%0\;usw\\t%z1,0(%2)%]\";
1741 return \"usw\\t%z1,%0\";
1743 [(set_attr "type" "store,store")
1744 (set_attr "mode" "SI,SI")
1745 (set_attr "length" "2,4")])
1747 ;; 64-bit integer moves
1749 ;; Unlike most other insns, the move insns can't be split with
1750 ;; different predicates, because register spilling and other parts of
1751 ;; the compiler, have memoized the insn number already.
1753 (define_insn "movdi"
1754 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,R,o,*d,*x")
1755 (match_operand:DI 1 "general_operand" "d,iF,R,o,d,d,*x,*d"))]
1757 "* return mips_move_2words (operands, insn); "
1758 [(set_attr "type" "move,arith,load,load,store,store,hilo,hilo")
1759 (set_attr "mode" "DI,DI,DI,DI,DI,DI,DI,DI")
1760 (set_attr "length" "2,4,2,4,2,4,2,2")])
1763 [(set (match_operand:DI 0 "register_operand" "")
1764 (match_operand:DI 1 "register_operand" ""))]
1765 "reload_completed && !TARGET_DEBUG_G_MODE
1766 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
1767 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))"
1769 [(set (subreg:SI (match_dup 0) 0) (subreg:SI (match_dup 1) 0))
1770 (set (subreg:SI (match_dup 0) 1) (subreg:SI (match_dup 1) 1))]
1774 ;; 32-bit Integer moves
1777 [(set (match_operand:SI 0 "register_operand" "")
1778 (match_operand:SI 1 "large_int" ""))]
1783 (ior:SI (match_dup 0)
1787 operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) & 0xffff0000);
1788 operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) & 0x0000ffff);
1791 ;; Unlike most other insns, the move insns can't be split with
1792 ;; different predicates, because register spilling and other parts of
1793 ;; the compiler, have memoized the insn number already.
1795 (define_expand "movsi"
1796 [(set (match_operand:SI 0 "nonimmediate_operand" "")
1797 (match_operand:SI 1 "general_operand" ""))]
1801 /* If this is a half-pic address being moved to a register, convert the
1802 address into a load, so that scheduling and stuff works properly. */
1805 && GET_CODE (operands[0]) == REG
1806 && GET_CODE (operands[1]) == SYMBOL_REF
1807 && HALF_PIC_ADDRESS_P (operands[1]))
1809 rtx ptr = HALF_PIC_PTR (operands[1]);
1810 if (XSTR (ptr, 0) != XSTR (operands[1], 0))
1812 emit_move_insn (operands[0], gen_rtx (MEM, Pmode, ptr));
1818 (define_insn "movsi_internal"
1819 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d,d,R,m,*d,*fs,*f,*f,*f,*R,*m,*x,*d")
1820 (match_operand:SI 1 "general_operand" "d,S,IKL,Mnis,R,m,dJ,dJ,*fs,*d,*f,*R,*m,*f,*f,*d,*x"))]
1822 "* return mips_move_1word (operands, insn, TRUE);"
1823 [(set_attr "type" "move,pic,arith,arith,load,load,store,store,xfer,xfer,move,load,load,store,store,hilo,hilo")
1824 (set_attr "mode" "SI,SI,SI,SI,SI,SI,SI,SI,SI,SI,SI,SI,SI,SI,SI,SI,SI")
1825 (set_attr "length" "1,4,1,2,1,2,1,2,1,1,1,1,2,1,2,1,1")])
1827 ;; 16-bit Integer moves
1829 ;; Unlike most other insns, the move insns can't be split with
1830 ;; different predicates, because register spilling and other parts of
1831 ;; the compiler, have memoized the insn number already.
1832 ;; Unsigned loads are used because BYTE_LOADS_ZERO_EXTEND is defined
1834 (define_insn "movhi"
1835 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,R,m,*d,*f,*f,*x,*d")
1836 (match_operand:HI 1 "general_operand" "d,IK,R,m,dJ,dJ,*fs,*d,*f,*d,*x"))]
1838 "* return mips_move_1word (operands, insn, TRUE);"
1839 [(set_attr "type" "move,arith,load,load,store,store,xfer,xfer,move,hilo,hilo")
1840 (set_attr "mode" "HI,HI,HI,HI,HI,HI,HI,HI,HI,HI,HI")
1841 (set_attr "length" "1,1,1,2,1,2,1,1,1,1,1")])
1843 ;; 8-bit Integer moves
1845 ;; Unlike most other insns, the move insns can't be split with
1846 ;; different predicates, because register spilling and other parts of
1847 ;; the compiler, have memoized the insn number already.
1848 ;; Unsigned loads are used because BYTE_LOADS_ZERO_EXTEND is defined
1850 (define_insn "movqi"
1851 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,m,*d,*f,*f,*x,*d")
1852 (match_operand:QI 1 "general_operand" "d,IK,R,m,dJ,dJ,*fs,*d,*f,*d,*x"))]
1854 "* return mips_move_1word (operands, insn, TRUE);"
1855 [(set_attr "type" "move,arith,load,load,store,store,xfer,xfer,move,hilo,hilo")
1856 (set_attr "mode" "QI,QI,QI,QI,QI,QI,QI,QI,QI,QI,QI")
1857 (set_attr "length" "1,1,1,2,1,2,1,1,1,1,1")])
1860 ;; 32-bit floating point moves
1862 (define_insn "movsf"
1863 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,f,f,R,m,*f,*d,*d,*d,*d,*R,*m")
1864 (match_operand:SF 1 "general_operand" "f,G,R,Em,fG,fG,*d,*f,*Gd,*R,*Em,*d,*d"))]
1866 "* return mips_move_1word (operands, insn, FALSE);"
1867 [(set_attr "type" "move,xfer,load,load,store,store,xfer,xfer,move,load,load,store,store")
1868 (set_attr "mode" "SF,SF,SF,SF,SF,SF,SF,SF,SF,SF,SF,SF,SF")
1869 (set_attr "length" "1,1,1,2,1,2,1,1,1,1,2,1,2")])
1871 ;; 64-bit floating point moves
1873 (define_insn "movdf"
1874 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,o,f,*f,*d,*d,*d,*d,*R,*o")
1875 (match_operand:DF 1 "general_operand" "f,R,o,fG,fG,E,*d,*f,*dG,*R,*oE,*d,*d"))]
1877 "* return mips_move_2words (operands, insn); "
1878 [(set_attr "type" "move,load,load,store,store,load,xfer,xfer,move,load,load,store,store")
1879 (set_attr "mode" "DF,DF,DF,DF,DF,DF,DF,DF,DF,DF,DF,DF,DF")
1880 (set_attr "length" "1,2,4,2,4,4,2,2,2,2,4,2,4")])
1883 [(set (match_operand:DF 0 "register_operand" "")
1884 (match_operand:DF 1 "register_operand" ""))]
1885 "reload_completed && !TARGET_DEBUG_G_MODE
1886 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
1887 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))"
1889 [(set (subreg:SI (match_dup 0) 0) (subreg:SI (match_dup 1) 0))
1890 (set (subreg:SI (match_dup 0) 1) (subreg:SI (match_dup 1) 1))]
1893 ;; Block moves, see mips.c for more details.
1894 ;; Argument 0 is the destination
1895 ;; Argument 1 is the source
1896 ;; Argument 2 is the length
1897 ;; Argument 3 is the alignment
1899 (define_expand "movstrsi"
1900 [(parallel [(set (mem:BLK (match_operand:BLK 0 "general_operand" ""))
1901 (mem:BLK (match_operand:BLK 1 "general_operand" "")))
1902 (use (match_operand:SI 2 "arith32_operand" ""))
1903 (use (match_operand:SI 3 "immediate_operand" ""))])]
1907 if (operands[0]) /* avoid unused code messages */
1909 expand_block_move (operands);
1914 ;; Insn generated by block moves
1916 (define_insn "movstrsi_internal"
1917 [(set (match_operand:BLK 0 "memory_operand" "=Ro")
1918 (match_operand:BLK 1 "memory_operand" "Ro"))
1919 (clobber (match_scratch:SI 4 "=&d"))
1920 (clobber (match_scratch:SI 5 "=&d"))
1921 (clobber (match_scratch:SI 6 "=&d"))
1922 (clobber (match_scratch:SI 7 "=&d"))
1923 (use (match_operand:SI 2 "small_int" "I"))
1924 (use (match_operand:SI 3 "small_int" "I"))]
1926 "* return output_block_move (insn, operands, 4);"
1927 [(set_attr "type" "multi")
1928 (set_attr "mode" "none")
1929 (set_attr "length" "20")])
1933 ;; ....................
1937 ;; ....................
1939 (define_insn "ashlsi3"
1940 [(set (match_operand:SI 0 "register_operand" "=d")
1941 (ashift:SI (match_operand:SI 1 "register_operand" "d")
1942 (match_operand:SI 2 "arith_operand" "dI")))]
1946 if (GET_CODE (operands[2]) == CONST_INT)
1947 operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);
1949 return \"sll\\t%0,%1,%2\";
1951 [(set_attr "type" "arith")
1952 (set_attr "mode" "SI")
1953 (set_attr "length" "1")])
1956 (define_expand "ashldi3"
1957 [(parallel [(set (match_operand:DI 0 "register_operand" "")
1958 (ashift:DI (match_operand:DI 1 "register_operand" "")
1959 (match_operand:SI 2 "arith_operand" "")))
1960 (clobber (match_dup 3))])]
1961 "!TARGET_DEBUG_G_MODE"
1962 "operands[3] = gen_reg_rtx (SImode);")
1965 (define_insn "ashldi3_internal"
1966 [(set (match_operand:DI 0 "register_operand" "=d")
1967 (ashift:DI (match_operand:DI 1 "register_operand" "d")
1968 (match_operand:SI 2 "register_operand" "d")))
1969 (clobber (match_operand:SI 3 "register_operand" "=d"))]
1970 "!TARGET_DEBUG_G_MODE"
1973 operands[4] = const0_rtx;
1974 dslots_jump_total += 3;
1975 dslots_jump_filled += 2;
1977 return \"sll\\t%3,%2,26\\n\\
1978 \\tbgez\\t%3,1f\\n\\
1979 \\tsll\\t%M0,%L1,%2\\n\\
1981 \\tmove\\t%L0,%z4%)\\n\\
1984 \\t%(beq\\t%3,%z4,2f\\n\\
1985 \\tsll\\t%M0,%M1,%2%)\\n\\
1987 \\tsubu\\t%3,%z4,%2\\n\\
1988 \\tsrl\\t%3,%L1,%3\\n\\
1989 \\tor\\t%M0,%M0,%3\\n\\
1991 \\tsll\\t%L0,%L1,%2\\n\\
1994 [(set_attr "type" "darith")
1995 (set_attr "mode" "SI")
1996 (set_attr "length" "12")])
1999 (define_insn "ashldi3_internal2"
2000 [(set (match_operand:DI 0 "register_operand" "=d")
2001 (ashift:DI (match_operand:DI 1 "register_operand" "d")
2002 (match_operand:SI 2 "small_int" "IJK")))
2003 (clobber (match_operand:SI 3 "register_operand" "=d"))]
2004 "!TARGET_DEBUG_G_MODE && (INTVAL (operands[2]) & 32) != 0"
2007 operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);
2008 operands[4] = const0_rtx;
2009 return \"sll\\t%M0,%L1,%2\;move\\t%L0,%z4\";
2011 [(set_attr "type" "darith")
2012 (set_attr "mode" "DI")
2013 (set_attr "length" "2")])
2017 [(set (match_operand:DI 0 "register_operand" "")
2018 (ashift:DI (match_operand:DI 1 "register_operand" "")
2019 (match_operand:SI 2 "small_int" "")))
2020 (clobber (match_operand:SI 3 "register_operand" ""))]
2021 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_DEBUG_G_MODE
2022 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
2023 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
2024 && (INTVAL (operands[2]) & 32) != 0"
2026 [(set (subreg:SI (match_dup 0) 1) (ashift:SI (subreg:SI (match_dup 1) 0) (match_dup 2)))
2027 (set (subreg:SI (match_dup 0) 0) (const_int 0))]
2029 "operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);")
2033 [(set (match_operand:DI 0 "register_operand" "")
2034 (ashift:DI (match_operand:DI 1 "register_operand" "")
2035 (match_operand:SI 2 "small_int" "")))
2036 (clobber (match_operand:SI 3 "register_operand" ""))]
2037 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_DEBUG_G_MODE
2038 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
2039 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
2040 && (INTVAL (operands[2]) & 32) != 0"
2042 [(set (subreg:SI (match_dup 0) 0) (ashift:SI (subreg:SI (match_dup 1) 1) (match_dup 2)))
2043 (set (subreg:SI (match_dup 0) 1) (const_int 0))]
2045 "operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);")
2048 (define_insn "ashldi3_internal3"
2049 [(set (match_operand:DI 0 "register_operand" "=d")
2050 (ashift:DI (match_operand:DI 1 "register_operand" "d")
2051 (match_operand:SI 2 "small_int" "IJK")))
2052 (clobber (match_operand:SI 3 "register_operand" "=d"))]
2053 "!TARGET_DEBUG_G_MODE
2054 && (INTVAL (operands[2]) & 63) < 32
2055 && (INTVAL (operands[2]) & 63) != 0"
2058 int amount = INTVAL (operands[2]);
2060 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
2061 operands[4] = const0_rtx;
2062 operands[5] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
2064 return \"sll\\t%M0,%M1,%2\;srl\\t%3,%L1,%5\;or\\t%M0,%M0,%3\;sll\\t%L0,%L1,%2\";
2066 [(set_attr "type" "darith")
2067 (set_attr "mode" "DI")
2068 (set_attr "length" "4")])
2072 [(set (match_operand:DI 0 "register_operand" "")
2073 (ashift:DI (match_operand:DI 1 "register_operand" "")
2074 (match_operand:SI 2 "small_int" "")))
2075 (clobber (match_operand:SI 3 "register_operand" ""))]
2076 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_DEBUG_G_MODE
2077 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
2078 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
2079 && (INTVAL (operands[2]) & 63) < 32
2080 && (INTVAL (operands[2]) & 63) != 0"
2082 [(set (subreg:SI (match_dup 0) 1)
2083 (ashift:SI (subreg:SI (match_dup 1) 1)
2087 (lshiftrt:SI (subreg:SI (match_dup 1) 0)
2090 (set (subreg:SI (match_dup 0) 1)
2091 (ior:SI (subreg:SI (match_dup 0) 1)
2094 (set (subreg:SI (match_dup 0) 0)
2095 (ashift:SI (subreg:SI (match_dup 1) 0)
2099 int amount = INTVAL (operands[2]);
2100 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
2101 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
2106 [(set (match_operand:DI 0 "register_operand" "")
2107 (ashift:DI (match_operand:DI 1 "register_operand" "")
2108 (match_operand:SI 2 "small_int" "")))
2109 (clobber (match_operand:SI 3 "register_operand" ""))]
2110 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_DEBUG_G_MODE
2111 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
2112 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
2113 && (INTVAL (operands[2]) & 63) < 32
2114 && (INTVAL (operands[2]) & 63) != 0"
2116 [(set (subreg:SI (match_dup 0) 0)
2117 (ashift:SI (subreg:SI (match_dup 1) 0)
2121 (lshiftrt:SI (subreg:SI (match_dup 1) 1)
2124 (set (subreg:SI (match_dup 0) 0)
2125 (ior:SI (subreg:SI (match_dup 0) 0)
2128 (set (subreg:SI (match_dup 0) 1)
2129 (ashift:SI (subreg:SI (match_dup 1) 1)
2133 int amount = INTVAL (operands[2]);
2134 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
2135 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
2139 (define_insn "ashrsi3"
2140 [(set (match_operand:SI 0 "register_operand" "=d")
2141 (ashiftrt:SI (match_operand:SI 1 "register_operand" "d")
2142 (match_operand:SI 2 "arith_operand" "dI")))]
2146 if (GET_CODE (operands[2]) == CONST_INT)
2147 operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);
2149 return \"sra\\t%0,%1,%2\";
2151 [(set_attr "type" "arith")
2152 (set_attr "mode" "SI")
2153 (set_attr "length" "1")])
2156 (define_expand "ashrdi3"
2157 [(parallel [(set (match_operand:DI 0 "register_operand" "")
2158 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
2159 (match_operand:SI 2 "arith_operand" "")))
2160 (clobber (match_dup 3))])]
2161 "!TARGET_DEBUG_G_MODE"
2162 "operands[3] = gen_reg_rtx (SImode);")
2165 (define_insn "ashrdi3_internal"
2166 [(set (match_operand:DI 0 "register_operand" "=d")
2167 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
2168 (match_operand:SI 2 "register_operand" "d")))
2169 (clobber (match_operand:SI 3 "register_operand" "=d"))]
2170 "!TARGET_DEBUG_G_MODE"
2173 operands[4] = const0_rtx;
2174 dslots_jump_total += 3;
2175 dslots_jump_filled += 2;
2177 return \"sll\\t%3,%2,26\\n\\
2178 \\tbgez\\t%3,1f\\n\\
2179 \\tsra\\t%L0,%M1,%2\\n\\
2181 \\tsra\\t%M0,%M1,31%)\\n\\
2184 \\t%(beq\\t%3,%z4,2f\\n\\
2185 \\tsrl\\t%L0,%L1,%2%)\\n\\
2187 \\tsubu\\t%3,%z4,%2\\n\\
2188 \\tsll\\t%3,%M1,%3\\n\\
2189 \\tor\\t%L0,%L0,%3\\n\\
2191 \\tsra\\t%M0,%M1,%2\\n\\
2194 [(set_attr "type" "darith")
2195 (set_attr "mode" "DI")
2196 (set_attr "length" "12")])
2199 (define_insn "ashrdi3_internal2"
2200 [(set (match_operand:DI 0 "register_operand" "=d")
2201 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
2202 (match_operand:SI 2 "small_int" "IJK")))
2203 (clobber (match_operand:SI 3 "register_operand" "=d"))]
2204 "!TARGET_DEBUG_G_MODE && (INTVAL (operands[2]) & 32) != 0"
2207 operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);
2208 return \"sra\\t%L0,%M1,%2\;sra\\t%M0,%M1,31\";
2210 [(set_attr "type" "darith")
2211 (set_attr "mode" "DI")
2212 (set_attr "length" "2")])
2216 [(set (match_operand:DI 0 "register_operand" "")
2217 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
2218 (match_operand:SI 2 "small_int" "")))
2219 (clobber (match_operand:SI 3 "register_operand" ""))]
2220 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_DEBUG_G_MODE
2221 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
2222 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
2223 && (INTVAL (operands[2]) & 32) != 0"
2225 [(set (subreg:SI (match_dup 0) 0) (ashiftrt:SI (subreg:SI (match_dup 1) 1) (match_dup 2)))
2226 (set (subreg:SI (match_dup 0) 1) (ashiftrt:SI (subreg:SI (match_dup 1) 1) (const_int 31)))]
2228 "operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);")
2232 [(set (match_operand:DI 0 "register_operand" "")
2233 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
2234 (match_operand:SI 2 "small_int" "")))
2235 (clobber (match_operand:SI 3 "register_operand" ""))]
2236 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_DEBUG_G_MODE
2237 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
2238 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
2239 && (INTVAL (operands[2]) & 32) != 0"
2241 [(set (subreg:SI (match_dup 0) 1) (ashiftrt:SI (subreg:SI (match_dup 1) 0) (match_dup 2)))
2242 (set (subreg:SI (match_dup 0) 0) (ashiftrt:SI (subreg:SI (match_dup 1) 0) (const_int 31)))]
2244 "operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);")
2247 (define_insn "ashrdi3_internal3"
2248 [(set (match_operand:DI 0 "register_operand" "=d")
2249 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
2250 (match_operand:SI 2 "small_int" "IJK")))
2251 (clobber (match_operand:SI 3 "register_operand" "=d"))]
2252 "!TARGET_DEBUG_G_MODE
2253 && (INTVAL (operands[2]) & 63) < 32
2254 && (INTVAL (operands[2]) & 63) != 0"
2257 int amount = INTVAL (operands[2]);
2259 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
2260 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
2262 return \"srl\\t%L0,%L1,%2\;sll\\t%3,%M1,%4\;or\\t%L0,%L0,%3\;sra\\t%M0,%M1,%2\";
2264 [(set_attr "type" "darith")
2265 (set_attr "mode" "DI")
2266 (set_attr "length" "4")])
2270 [(set (match_operand:DI 0 "register_operand" "")
2271 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
2272 (match_operand:SI 2 "small_int" "")))
2273 (clobber (match_operand:SI 3 "register_operand" ""))]
2274 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_DEBUG_G_MODE
2275 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
2276 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
2277 && (INTVAL (operands[2]) & 63) < 32
2278 && (INTVAL (operands[2]) & 63) != 0"
2280 [(set (subreg:SI (match_dup 0) 0)
2281 (lshiftrt:SI (subreg:SI (match_dup 1) 0)
2285 (ashift:SI (subreg:SI (match_dup 1) 1)
2288 (set (subreg:SI (match_dup 0) 0)
2289 (ior:SI (subreg:SI (match_dup 0) 0)
2292 (set (subreg:SI (match_dup 0) 1)
2293 (ashiftrt:SI (subreg:SI (match_dup 1) 1)
2297 int amount = INTVAL (operands[2]);
2298 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
2299 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
2304 [(set (match_operand:DI 0 "register_operand" "")
2305 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
2306 (match_operand:SI 2 "small_int" "")))
2307 (clobber (match_operand:SI 3 "register_operand" ""))]
2308 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_DEBUG_G_MODE
2309 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
2310 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
2311 && (INTVAL (operands[2]) & 63) < 32
2312 && (INTVAL (operands[2]) & 63) != 0"
2314 [(set (subreg:SI (match_dup 0) 1)
2315 (lshiftrt:SI (subreg:SI (match_dup 1) 1)
2319 (ashift:SI (subreg:SI (match_dup 1) 0)
2322 (set (subreg:SI (match_dup 0) 1)
2323 (ior:SI (subreg:SI (match_dup 0) 1)
2326 (set (subreg:SI (match_dup 0) 0)
2327 (ashiftrt:SI (subreg:SI (match_dup 1) 0)
2331 int amount = INTVAL (operands[2]);
2332 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
2333 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
2337 (define_insn "lshrsi3"
2338 [(set (match_operand:SI 0 "register_operand" "=d")
2339 (lshiftrt:SI (match_operand:SI 1 "register_operand" "d")
2340 (match_operand:SI 2 "arith_operand" "dI")))]
2344 if (GET_CODE (operands[2]) == CONST_INT)
2345 operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);
2347 return \"srl\\t%0,%1,%2\";
2349 [(set_attr "type" "arith")
2350 (set_attr "mode" "SI")
2351 (set_attr "length" "1")])
2354 (define_expand "lshrdi3"
2355 [(parallel [(set (match_operand:DI 0 "register_operand" "")
2356 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
2357 (match_operand:SI 2 "arith_operand" "")))
2358 (clobber (match_dup 3))])]
2359 "!TARGET_DEBUG_G_MODE"
2360 "operands[3] = gen_reg_rtx (SImode);")
2363 (define_insn "lshrdi3_internal"
2364 [(set (match_operand:DI 0 "register_operand" "=&d")
2365 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
2366 (match_operand:SI 2 "register_operand" "d")))
2367 (clobber (match_operand:SI 3 "register_operand" "=d"))]
2368 "!TARGET_DEBUG_G_MODE"
2371 operands[4] = const0_rtx;
2372 dslots_jump_total += 3;
2373 dslots_jump_filled += 2;
2375 return \"sll\\t%3,%2,26\\n\\
2376 \\tbgez\\t%3,1f\\n\\
2377 \\tsrl\\t%L0,%M1,%2\\n\\
2379 \\tmove\\t%M0,%z4%)\\n\\
2382 \\t%(beq\\t%3,%z4,2f\\n\\
2383 \\tsrl\\t%L0,%L1,%2%)\\n\\
2385 \\tsubu\\t%3,%z4,%2\\n\\
2386 \\tsll\\t%3,%M1,%3\\n\\
2387 \\tor\\t%L0,%L0,%3\\n\\
2389 \\tsrl\\t%M0,%M1,%2\\n\\
2392 [(set_attr "type" "darith")
2393 (set_attr "mode" "DI")
2394 (set_attr "length" "12")])
2397 (define_insn "lshrdi3_internal2"
2398 [(set (match_operand:DI 0 "register_operand" "=d")
2399 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
2400 (match_operand:SI 2 "small_int" "IJK")))
2401 (clobber (match_operand:SI 3 "register_operand" "=d"))]
2402 "!TARGET_DEBUG_G_MODE && (INTVAL (operands[2]) & 32) != 0"
2405 operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);
2406 operands[4] = const0_rtx;
2407 return \"srl\\t%L0,%M1,%2\;move\\t%M0,%z4\";
2409 [(set_attr "type" "darith")
2410 (set_attr "mode" "DI")
2411 (set_attr "length" "2")])
2415 [(set (match_operand:DI 0 "register_operand" "")
2416 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
2417 (match_operand:SI 2 "small_int" "")))
2418 (clobber (match_operand:SI 3 "register_operand" ""))]
2419 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_DEBUG_G_MODE
2420 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
2421 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
2422 && (INTVAL (operands[2]) & 32) != 0"
2424 [(set (subreg:SI (match_dup 0) 0) (lshiftrt:SI (subreg:SI (match_dup 1) 1) (match_dup 2)))
2425 (set (subreg:SI (match_dup 0) 1) (const_int 0))]
2427 "operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);")
2431 [(set (match_operand:DI 0 "register_operand" "")
2432 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
2433 (match_operand:SI 2 "small_int" "")))
2434 (clobber (match_operand:SI 3 "register_operand" ""))]
2435 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_DEBUG_G_MODE
2436 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
2437 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
2438 && (INTVAL (operands[2]) & 32) != 0"
2440 [(set (subreg:SI (match_dup 0) 1) (lshiftrt:SI (subreg:SI (match_dup 1) 0) (match_dup 2)))
2441 (set (subreg:SI (match_dup 0) 0) (const_int 0))]
2443 "operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);")
2446 (define_insn "lshrdi3_internal3"
2447 [(set (match_operand:DI 0 "register_operand" "=d")
2448 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
2449 (match_operand:SI 2 "small_int" "IJK")))
2450 (clobber (match_operand:SI 3 "register_operand" "=d"))]
2451 "!TARGET_DEBUG_G_MODE
2452 && (INTVAL (operands[2]) & 63) < 32
2453 && (INTVAL (operands[2]) & 63) != 0"
2456 int amount = INTVAL (operands[2]);
2458 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
2459 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
2461 return \"srl\\t%L0,%L1,%2\;sll\\t%3,%M1,%4\;or\\t%L0,%L0,%3\;srl\\t%M0,%M1,%2\";
2463 [(set_attr "type" "darith")
2464 (set_attr "mode" "DI")
2465 (set_attr "length" "4")])
2469 [(set (match_operand:DI 0 "register_operand" "")
2470 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
2471 (match_operand:SI 2 "small_int" "")))
2472 (clobber (match_operand:SI 3 "register_operand" ""))]
2473 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_DEBUG_G_MODE
2474 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
2475 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
2476 && (INTVAL (operands[2]) & 63) < 32
2477 && (INTVAL (operands[2]) & 63) != 0"
2479 [(set (subreg:SI (match_dup 0) 0)
2480 (lshiftrt:SI (subreg:SI (match_dup 1) 0)
2484 (ashift:SI (subreg:SI (match_dup 1) 1)
2487 (set (subreg:SI (match_dup 0) 0)
2488 (ior:SI (subreg:SI (match_dup 0) 0)
2491 (set (subreg:SI (match_dup 0) 1)
2492 (lshiftrt:SI (subreg:SI (match_dup 1) 1)
2496 int amount = INTVAL (operands[2]);
2497 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
2498 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
2503 [(set (match_operand:DI 0 "register_operand" "")
2504 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
2505 (match_operand:SI 2 "small_int" "")))
2506 (clobber (match_operand:SI 3 "register_operand" ""))]
2507 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_DEBUG_G_MODE
2508 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
2509 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
2510 && (INTVAL (operands[2]) & 63) < 32
2511 && (INTVAL (operands[2]) & 63) != 0"
2513 [(set (subreg:SI (match_dup 0) 1)
2514 (lshiftrt:SI (subreg:SI (match_dup 1) 1)
2518 (ashift:SI (subreg:SI (match_dup 1) 0)
2521 (set (subreg:SI (match_dup 0) 1)
2522 (ior:SI (subreg:SI (match_dup 0) 1)
2525 (set (subreg:SI (match_dup 0) 0)
2526 (lshiftrt:SI (subreg:SI (match_dup 1) 0)
2530 int amount = INTVAL (operands[2]);
2531 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
2532 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
2537 ;; ....................
2541 ;; ....................
2543 ;; Flow here is rather complex:
2545 ;; 1) The cmp{si,sf,df} routine is called. It deposits the
2546 ;; arguments into the branch_cmp array, and the type into
2547 ;; branch_type. No RTL is generated.
2549 ;; 2) The appropriate branch define_expand is called, which then
2550 ;; creates the appropriate RTL for the comparison and branch.
2551 ;; Different CC modes are used, based on what type of branch is
2552 ;; done, so that we can constrain things appropriately. There
2553 ;; are assumptions in the rest of GCC that break if we fold the
2554 ;; operands into the branchs for integer operations, and use cc0
2555 ;; for floating point.
2557 ;; 3) The compare define_insns then once again set branch_cmp and
2558 ;; branch_type, and the branch define_insns use them.
2560 ;; 4) If a set condition code is done instead of a branch, then the
2561 ;; operands are folded into the RTL, and a separate set of cc0 is
2562 ;; not done. This allows slt's to be put into delay slots.
2564 (define_expand "cmpsi"
2566 (compare:CC (match_operand:SI 0 "register_operand" "")
2567 (match_operand:SI 1 "arith_operand" "")))]
2571 if (operands[0]) /* avoid unused code message */
2573 branch_cmp[0] = operands[0];
2574 branch_cmp[1] = operands[1];
2575 branch_type = CMP_SI;
2580 (define_expand "tstsi"
2582 (match_operand:SI 0 "register_operand" ""))]
2586 if (operands[0]) /* avoid unused code message */
2588 branch_cmp[0] = operands[0];
2589 branch_cmp[1] = const0_rtx;
2590 branch_type = CMP_SI;
2595 (define_insn "cmpsi_eqne"
2597 (compare:CC_EQ (match_operand:SI 0 "register_operand" "dJ")
2598 (match_operand:SI 1 "reg_or_0_operand" "dJ")))]
2602 branch_cmp[0] = operands[0];
2603 branch_cmp[1] = operands[1];
2604 branch_type = CMP_SI;
2607 [(set_attr "type" "icmp")
2608 (set_attr "mode" "none")
2609 (set_attr "length" "0")])
2611 (define_insn "cmpsi_zero"
2613 (match_operand:SI 0 "reg_or_0_operand" "dJ"))]
2617 branch_cmp[0] = operands[0];
2618 branch_cmp[1] = const0_rtx;
2619 branch_type = CMP_SI;
2622 [(set_attr "type" "icmp")
2623 (set_attr "mode" "none")
2624 (set_attr "length" "0")])
2626 (define_insn "cmpsi_relational"
2628 (compare:CC (match_operand:SI 0 "register_operand" "dJ")
2629 (match_operand:SI 1 "arith_operand" "dI")))]
2633 branch_cmp[0] = operands[0];
2634 branch_cmp[1] = operands[1];
2635 branch_type = CMP_SI;
2638 [(set_attr "type" "icmp")
2639 (set_attr "mode" "none")
2640 (set_attr "length" "0")])
2642 (define_expand "cmpdf"
2644 (compare:CC_FP (match_operand:DF 0 "register_operand" "")
2645 (match_operand:DF 1 "register_operand" "")))]
2649 if (operands[0]) /* avoid unused code message */
2651 branch_cmp[0] = operands[0];
2652 branch_cmp[1] = operands[1];
2653 branch_type = CMP_DF;
2658 (define_insn "cmpdf_internal"
2660 (compare:CC_FP (match_operand:DF 0 "register_operand" "f")
2661 (match_operand:DF 1 "register_operand" "f")))]
2665 branch_cmp[0] = operands[0];
2666 branch_cmp[1] = operands[1];
2667 branch_type = CMP_DF;
2670 [(set_attr "type" "fcmp")
2671 (set_attr "mode" "none")
2672 (set_attr "length" "0")])
2675 (define_expand "cmpsf"
2677 (compare:CC_FP (match_operand:SF 0 "register_operand" "")
2678 (match_operand:SF 1 "register_operand" "")))]
2682 if (operands[0]) /* avoid unused code message */
2684 branch_cmp[0] = operands[0];
2685 branch_cmp[1] = operands[1];
2686 branch_type = CMP_SF;
2691 (define_insn "cmpsf_internal"
2693 (compare:CC_FP (match_operand:SF 0 "register_operand" "f")
2694 (match_operand:SF 1 "register_operand" "f")))]
2698 branch_cmp[0] = operands[0];
2699 branch_cmp[1] = operands[1];
2700 branch_type = CMP_SF;
2703 [(set_attr "type" "fcmp")
2704 (set_attr "mode" "none")
2705 (set_attr "length" "0")])
2709 ;; ....................
2711 ;; CONDITIONAL BRANCHES
2713 ;; ....................
2715 ;; We really can't note that integer branches clobber $at, and FP
2716 ;; branches clobber $fcr31 because if we use a parallel operation, a
2717 ;; normal insn is used to hold the value instead of jump_insn. See
2718 ;; above for cmpxx saving the operands in branch_cmp and branch_type.
2720 (define_insn "branch_fp_true"
2722 (if_then_else (match_operator:CC_FP 0 "fcmp_op" [(cc0) (const_int 0)])
2723 (label_ref (match_operand 1 "" ""))
2728 operands[2] = branch_cmp[0];
2729 operands[3] = branch_cmp[1];
2731 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
2732 if (branch_type == CMP_DF)
2734 switch (GET_CODE (operands[0]))
2736 case EQ: return \"c.eq.d\\t%2,%3%#\;%*bc1t%?\\t%l1\";
2737 case NE: return \"c.eq.d\\t%2,%3%#\;%*bc1f%?\\t%l1\";
2738 case LT: return \"c.lt.d\\t%2,%3%#\;%*bc1t%?\\t%l1\";
2739 case LE: return \"c.le.d\\t%2,%3%#\;%*bc1t%?\\t%l1\";
2740 case GT: return \"c.lt.d\\t%3,%2%#\;%*bc1t%?\\t%l1\";
2741 case GE: return \"c.le.d\\t%3,%2%#\;%*bc1t%?\\t%l1\";
2745 else if (branch_type == CMP_SF)
2747 switch (GET_CODE (operands[0]))
2749 case EQ: return \"c.eq.s\\t%2,%3%#\;%*bc1t%?\\t%l1\";
2750 case NE: return \"c.eq.s\\t%2,%3%#\;%*bc1f%?\\t%l1\";
2751 case LT: return \"c.lt.s\\t%2,%3%#\;%*bc1t%?\\t%l1\";
2752 case LE: return \"c.le.s\\t%2,%3%#\;%*bc1t%?\\t%l1\";
2753 case GT: return \"c.lt.s\\t%3,%2%#\;%*bc1t%?\\t%l1\";
2754 case GE: return \"c.le.s\\t%3,%2%#\;%*bc1t%?\\t%l1\";
2758 abort_with_insn (insn, \"Bad floating compare/branch\");
2761 [(set_attr "type" "branch")
2762 (set_attr "mode" "none")
2763 (set_attr "length" "3")])
2765 (define_insn "branch_fp_false"
2767 (if_then_else (match_operator:CC_FP 0 "fcmp_op" [(cc0) (const_int 0)])
2769 (label_ref (match_operand 1 "" ""))))]
2773 operands[2] = branch_cmp[0];
2774 operands[3] = branch_cmp[1];
2776 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
2777 if (branch_type == CMP_DF)
2779 switch (GET_CODE (operands[0]))
2781 case EQ: return \"c.eq.d\\t%2,%3%#\;%*bc1f%?\\t%l1\";
2782 case NE: return \"c.eq.d\\t%2,%3%#\;%*bc1t%?\\t%l1\";
2783 case LT: return \"c.lt.d\\t%2,%3%#\;%*bc1f%?\\t%l1\";
2784 case LE: return \"c.le.d\\t%2,%3%#\;%*bc1f%?\\t%l1\";
2785 case GT: return \"c.lt.d\\t%3,%2%#\;%*bc1f%?\\t%l1\";
2786 case GE: return \"c.le.d\\t%3,%2%#\;%*bc1f%?\\t%l1\";
2790 else if (branch_type == CMP_SF)
2792 switch (GET_CODE (operands[0]))
2794 case EQ: return \"c.eq.s\\t%2,%3%#\;%*bc1f%?\\t%l1\";
2795 case NE: return \"c.eq.s\\t%2,%3%#\;%*bc1t%?\\t%l1\";
2796 case LT: return \"c.lt.s\\t%2,%3%#\;%*bc1f%?\\t%l1\";
2797 case LE: return \"c.le.s\\t%2,%3%#\;%*bc1f%?\\t%l1\";
2798 case GT: return \"c.lt.s\\t%3,%2%#\;%*bc1f%?\\t%l1\";
2799 case GE: return \"c.le.s\\t%3,%2%#\;%*bc1f%?\\t%l1\";
2803 abort_with_insn (insn, \"Bad floating compare/branch\");
2806 [(set_attr "type" "branch")
2807 (set_attr "mode" "none")
2808 (set_attr "length" "3")])
2811 (define_insn "branch_eqne_true"
2813 (if_then_else (match_operator:CC_EQ 0 "equality_op" [(cc0) (const_int 0)])
2814 (label_ref (match_operand 1 "" ""))
2819 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
2820 operands[2] = branch_cmp[0];
2821 operands[3] = branch_cmp[1];
2822 return \"%*b%C0%?\\t%z2,%z3,%1\";
2824 [(set_attr "type" "branch")
2825 (set_attr "mode" "none")
2826 (set_attr "length" "1")])
2828 (define_insn "branch_eqne_false"
2830 (if_then_else (match_operator:CC_EQ 0 "equality_op" [(cc0) (const_int 0)])
2832 (label_ref (match_operand 1 "" ""))))]
2836 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
2837 operands[2] = branch_cmp[0];
2838 operands[3] = branch_cmp[1];
2839 return \"%*b%N0%?\\t%z2,%z3,%1\";
2841 [(set_attr "type" "branch")
2842 (set_attr "mode" "none")
2843 (set_attr "length" "1")])
2845 (define_insn "branch_zero_true"
2847 (if_then_else (match_operator:CC_0 0 "cmp_op" [(cc0) (const_int 0)])
2848 (label_ref (match_operand 1 "" ""))
2853 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
2854 operands[2] = branch_cmp[0];
2856 switch (GET_CODE (operands[0]))
2858 case EQ: return \"%*beq%?\\t%z2,%.,%1\";
2859 case NE: return \"%*bne%?\\t%z2,%.,%1\";
2860 case GTU: return \"%*bne%?\\t%z2,%.,%1\";
2861 case LEU: return \"%*beq%?\\t%z2,%.,%1\";
2862 case GEU: return \"%*j\\t%1\";
2863 case LTU: return \"#%*bltuz\\t%z2,%1\";
2866 return \"%*b%C0z%?\\t%z2,%1\";
2868 [(set_attr "type" "branch")
2869 (set_attr "mode" "none")
2870 (set_attr "length" "1")])
2872 (define_insn "branch_zero_false"
2874 (if_then_else (match_operator:CC_0 0 "cmp_op" [(cc0) (const_int 0)])
2876 (label_ref (match_operand 1 "" ""))))]
2880 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
2881 operands[2] = branch_cmp[0];
2882 switch (GET_CODE (operands[0]))
2884 case EQ: return \"%*bne%?\\t%z2,%.,%1\";
2885 case NE: return \"%*beq%?\\t%z2,%.,%1\";
2886 case GTU: return \"%*beq%?\\t%z2,%.,%1\";
2887 case LEU: return \"%*bne\\t%z2,%.,%1\";
2888 case GEU: return \"#%*bgeuz\\t%z2,%1\";
2889 case LTU: return \"%*j\\t%1\";
2892 return \"%*b%N0z%?\\t%z2,%1\";
2894 [(set_attr "type" "branch")
2895 (set_attr "mode" "none")
2896 (set_attr "length" "1")])
2898 (define_insn "branch_relop_true"
2900 (if_then_else (match_operator:CC 0 "cmp2_op" [(cc0) (const_int 0)])
2901 (label_ref (match_operand 1 "" ""))
2906 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
2907 operands[2] = branch_cmp[0];
2908 operands[3] = branch_cmp[1];
2910 return \"%&b%C0%?\\t%z2,%z3,%1%!\";
2912 [(set_attr "type" "branch")
2913 (set_attr "mode" "none")
2914 (set_attr "length" "2")])
2916 (define_insn "branch_relop_false"
2918 (if_then_else (match_operator:CC 0 "cmp2_op" [(cc0) (const_int 0)])
2920 (label_ref (match_operand 1 "" ""))))]
2924 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
2925 operands[2] = branch_cmp[0];
2926 operands[3] = branch_cmp[1];
2928 return \"%&b%N0%?\\t%z2,%z3,%1%!\";
2930 [(set_attr "type" "branch")
2931 (set_attr "mode" "none")
2932 (set_attr "length" "2")])
2934 (define_expand "beq"
2936 (if_then_else (eq:CC_EQ (cc0)
2938 (label_ref (match_operand 0 "" ""))
2943 if (operands[0]) /* avoid unused code warning */
2945 gen_conditional_branch (operands, EQ);
2950 (define_expand "bne"
2952 (if_then_else (ne:CC_EQ (cc0)
2954 (label_ref (match_operand 0 "" ""))
2959 if (operands[0]) /* avoid unused code warning */
2961 gen_conditional_branch (operands, NE);
2966 (define_expand "bgt"
2968 (if_then_else (gt:CC (cc0)
2970 (label_ref (match_operand 0 "" ""))
2975 if (operands[0]) /* avoid unused code warning */
2977 gen_conditional_branch (operands, GT);
2982 (define_expand "bge"
2984 (if_then_else (ge:CC (cc0)
2986 (label_ref (match_operand 0 "" ""))
2991 if (operands[0]) /* avoid unused code warning */
2993 gen_conditional_branch (operands, GE);
2998 (define_expand "blt"
3000 (if_then_else (lt:CC (cc0)
3002 (label_ref (match_operand 0 "" ""))
3007 if (operands[0]) /* avoid unused code warning */
3009 gen_conditional_branch (operands, LT);
3014 (define_expand "ble"
3016 (if_then_else (le:CC (cc0)
3018 (label_ref (match_operand 0 "" ""))
3023 if (operands[0]) /* avoid unused code warning */
3025 gen_conditional_branch (operands, LE);
3030 (define_expand "bgtu"
3032 (if_then_else (gtu:CC (cc0)
3034 (label_ref (match_operand 0 "" ""))
3039 if (operands[0]) /* avoid unused code warning */
3041 gen_conditional_branch (operands, GTU);
3046 (define_expand "bgeu"
3048 (if_then_else (geu:CC (cc0)
3050 (label_ref (match_operand 0 "" ""))
3055 if (operands[0]) /* avoid unused code warning */
3057 gen_conditional_branch (operands, GEU);
3063 (define_expand "bltu"
3065 (if_then_else (ltu:CC (cc0)
3067 (label_ref (match_operand 0 "" ""))
3072 if (operands[0]) /* avoid unused code warning */
3074 gen_conditional_branch (operands, LTU);
3079 (define_expand "bleu"
3081 (if_then_else (leu:CC (cc0)
3083 (label_ref (match_operand 0 "" ""))
3088 if (operands[0]) /* avoid unused code warning */
3090 gen_conditional_branch (operands, LEU);
3097 ;; ....................
3099 ;; SETTING A REGISTER FROM A COMPARISON
3101 ;; ....................
3103 (define_expand "seq"
3104 [(set (match_operand:SI 0 "register_operand" "=d")
3105 (eq:CC_EQ (match_dup 1)
3110 extern rtx force_reg ();
3112 if (branch_type != CMP_SI)
3115 /* set up operands from compare. */
3116 operands[1] = branch_cmp[0];
3117 operands[2] = branch_cmp[1];
3119 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
3120 operands[2] = force_reg (SImode, operands[2]);
3122 /* fall through and generate default code */
3125 (define_insn "seq_si"
3126 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
3127 (eq:CC_EQ (match_operand:SI 1 "register_operand" "%d,d,d")
3128 (match_operand:SI 2 "uns_arith_operand" "J,d,K")))]
3132 xor\\t%0,%1,%2\;sltu\\t%0,%0,1
3133 xori\\t%0,%1,%x2\;sltu\\t%0,%0,1"
3134 [(set_attr "type" "arith,arith,arith")
3135 (set_attr "mode" "SI,SI,SI")
3136 (set_attr "length" "1,2,2")])
3139 [(set (match_operand:SI 0 "register_operand" "")
3140 (eq:CC_EQ (match_operand:SI 1 "register_operand" "")
3141 (match_operand:SI 2 "uns_arith_operand" "")))]
3142 "GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0"
3144 (xor:SI (match_dup 1)
3147 (ltu:CC (match_dup 0)
3151 (define_expand "sne"
3152 [(set (match_operand:SI 0 "register_operand" "=d")
3153 (ne:CC_EQ (match_dup 1)
3158 extern rtx force_reg ();
3160 if (branch_type != CMP_SI)
3163 /* set up operands from compare. */
3164 operands[1] = branch_cmp[0];
3165 operands[2] = branch_cmp[1];
3167 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
3168 operands[2] = force_reg (SImode, operands[2]);
3170 /* fall through and generate default code */
3173 (define_insn "sne_si"
3174 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
3175 (ne:CC_EQ (match_operand:SI 1 "register_operand" "%d,d,d")
3176 (match_operand:SI 2 "uns_arith_operand" "J,d,K")))]
3180 if (GET_CODE (operands[2]) != CONST_INT)
3181 return \"xor\\t%0,%1,%2\;sltu\\t%0,%.,%0\";
3183 if (INTVAL (operands[2]) == 0)
3184 return \"sltu\\t%0,%.,%1\";
3186 return \"xori\\t%0,%1,%x2\;sltu\\t%0,%.,%0\";
3188 [(set_attr "type" "arith,arith,arith")
3189 (set_attr "mode" "SI,SI,SI")
3190 (set_attr "length" "1,2,2")])
3193 [(set (match_operand:SI 0 "register_operand" "")
3194 (ne:CC_EQ (match_operand:SI 1 "register_operand" "")
3195 (match_operand:SI 2 "uns_arith_operand" "")))]
3196 "GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0"
3198 (xor:SI (match_dup 1)
3201 (gtu:CC (match_dup 0)
3205 (define_expand "sgt"
3206 [(set (match_operand:SI 0 "register_operand" "=d")
3207 (gt:CC (match_dup 1)
3212 extern rtx force_reg ();
3214 if (branch_type != CMP_SI)
3217 /* set up operands from compare. */
3218 operands[1] = branch_cmp[0];
3219 operands[2] = branch_cmp[1];
3221 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) != 0)
3222 operands[2] = force_reg (SImode, operands[2]);
3224 /* fall through and generate default code */
3227 (define_insn "sgt_si"
3228 [(set (match_operand:SI 0 "register_operand" "=d")
3229 (gt:CC (match_operand:SI 1 "register_operand" "d")
3230 (match_operand:SI 2 "reg_or_0_operand" "dJ")))]
3233 [(set_attr "type" "arith")
3234 (set_attr "mode" "SI")
3235 (set_attr "length" "1")])
3237 (define_expand "sge"
3238 [(set (match_operand:SI 0 "register_operand" "=d")
3239 (ge:CC (match_dup 1)
3244 if (branch_type != CMP_SI)
3247 /* set up operands from compare. */
3248 operands[1] = branch_cmp[0];
3249 operands[2] = branch_cmp[1];
3251 /* fall through and generate default code */
3254 (define_insn "sge_si"
3255 [(set (match_operand:SI 0 "register_operand" "=d")
3256 (ge:CC (match_operand:SI 1 "register_operand" "d")
3257 (match_operand:SI 2 "arith_operand" "dI")))]
3259 "slt\\t%0,%1,%2\;xori\\t%0,%0,0x0001"
3260 [(set_attr "type" "arith")
3261 (set_attr "mode" "SI")
3262 (set_attr "length" "2")])
3265 [(set (match_operand:SI 0 "register_operand" "")
3266 (ge:CC (match_operand:SI 1 "register_operand" "")
3267 (match_operand:SI 2 "arith_operand" "")))]
3270 (lt:CC (match_dup 1)
3273 (xor:SI (match_dup 0)
3277 (define_expand "slt"
3278 [(set (match_operand:SI 0 "register_operand" "=d")
3279 (lt:CC (match_dup 1)
3284 if (branch_type != CMP_SI)
3287 /* set up operands from compare. */
3288 operands[1] = branch_cmp[0];
3289 operands[2] = branch_cmp[1];
3291 /* fall through and generate default code */
3294 (define_insn "slt_si"
3295 [(set (match_operand:SI 0 "register_operand" "=d")
3296 (lt:CC (match_operand:SI 1 "register_operand" "d")
3297 (match_operand:SI 2 "arith_operand" "dI")))]
3300 [(set_attr "type" "arith")
3301 (set_attr "mode" "SI")
3302 (set_attr "length" "1")])
3304 (define_expand "sle"
3305 [(set (match_operand:SI 0 "register_operand" "=d")
3306 (le:CC (match_dup 1)
3311 extern rtx force_reg ();
3313 if (branch_type != CMP_SI)
3316 /* set up operands from compare. */
3317 operands[1] = branch_cmp[0];
3318 operands[2] = branch_cmp[1];
3320 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 32767)
3321 operands[2] = force_reg (SImode, operands[2]);
3323 /* fall through and generate default code */
3326 (define_insn "sle_si"
3327 [(set (match_operand:SI 0 "register_operand" "=d,d")
3328 (le:CC (match_operand:SI 1 "register_operand" "d,d")
3329 (match_operand:SI 2 "arith_operand" "d,I")))]
3330 "GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 32767"
3332 slt\\t%0,%z2,%1\;xori\\t%0,%0,0x0001
3334 [(set_attr "type" "arith,arith")
3335 (set_attr "mode" "SI,SI")
3336 (set_attr "length" "2,1")])
3339 [(set (match_operand:SI 0 "register_operand" "")
3340 (le:CC (match_operand:SI 1 "register_operand" "")
3341 (match_operand:SI 2 "register_operand" "")))]
3344 (lt:CC (match_dup 2)
3347 (xor:SI (match_dup 0)
3351 (define_expand "sgtu"
3352 [(set (match_operand:SI 0 "register_operand" "=d")
3353 (gtu:CC (match_dup 1)
3358 extern rtx force_reg ();
3360 if (branch_type != CMP_SI)
3363 /* set up operands from compare. */
3364 operands[1] = branch_cmp[0];
3365 operands[2] = branch_cmp[1];
3367 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) != 0)
3368 operands[2] = force_reg (SImode, operands[2]);
3370 /* fall through and generate default code */
3373 (define_insn "sgtu_si"
3374 [(set (match_operand:SI 0 "register_operand" "=d")
3375 (gtu:CC (match_operand:SI 1 "register_operand" "d")
3376 (match_operand:SI 2 "reg_or_0_operand" "dJ")))]
3379 [(set_attr "type" "arith")
3380 (set_attr "mode" "SI")
3381 (set_attr "length" "1")])
3383 (define_expand "sgeu"
3384 [(set (match_operand:SI 0 "register_operand" "=d")
3385 (geu:CC (match_dup 1)
3390 if (branch_type != CMP_SI)
3393 /* set up operands from compare. */
3394 operands[1] = branch_cmp[0];
3395 operands[2] = branch_cmp[1];
3397 /* fall through and generate default code */
3400 (define_insn "sgeu_si"
3401 [(set (match_operand:SI 0 "register_operand" "=d")
3402 (geu:CC (match_operand:SI 1 "register_operand" "d")
3403 (match_operand:SI 2 "arith_operand" "dI")))]
3405 "sltu\\t%0,%1,%2\;xori\\t%0,%0,0x0001"
3406 [(set_attr "type" "arith")
3407 (set_attr "mode" "SI")
3408 (set_attr "length" "2")])
3411 [(set (match_operand:SI 0 "register_operand" "")
3412 (geu:CC (match_operand:SI 1 "register_operand" "")
3413 (match_operand:SI 2 "arith_operand" "")))]
3416 (ltu:CC (match_dup 1)
3419 (xor:SI (match_dup 0)
3423 (define_expand "sltu"
3424 [(set (match_operand:SI 0 "register_operand" "=d")
3425 (ltu:CC (match_dup 1)
3430 if (branch_type != CMP_SI)
3433 /* set up operands from compare. */
3434 operands[1] = branch_cmp[0];
3435 operands[2] = branch_cmp[1];
3437 /* fall through and generate default code */
3440 (define_insn "sltu_si"
3441 [(set (match_operand:SI 0 "register_operand" "=d")
3442 (ltu:CC (match_operand:SI 1 "register_operand" "d")
3443 (match_operand:SI 2 "arith_operand" "dI")))]
3446 [(set_attr "type" "arith")
3447 (set_attr "mode" "SI")
3448 (set_attr "length" "1")])
3450 (define_expand "sleu"
3451 [(set (match_operand:SI 0 "register_operand" "=d")
3452 (leu:CC (match_dup 1)
3457 extern rtx force_reg ();
3459 if (branch_type != CMP_SI)
3462 /* set up operands from compare. */
3463 operands[1] = branch_cmp[0];
3464 operands[2] = branch_cmp[1];
3466 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 32767)
3467 operands[2] = force_reg (SImode, operands[2]);
3469 /* fall through and generate default code */
3472 (define_insn "sleu_si"
3473 [(set (match_operand:SI 0 "register_operand" "=d,d")
3474 (leu:CC (match_operand:SI 1 "register_operand" "d,d")
3475 (match_operand:SI 2 "arith_operand" "d,I")))]
3476 "GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) < 32767"
3478 sltu\\t%0,%z2,%1\;xori\\t%0,%0,0x0001
3479 sltu\\t%0,%1,(%2+1)"
3480 [(set_attr "type" "arith,arith")
3481 (set_attr "mode" "SI,SI")
3482 (set_attr "length" "2,1")])
3485 [(set (match_operand:SI 0 "register_operand" "")
3486 (leu:CC (match_operand:SI 1 "register_operand" "")
3487 (match_operand:SI 2 "register_operand" "")))]
3490 (ltu:CC (match_dup 2)
3493 (xor:SI (match_dup 0)
3499 ;; ....................
3501 ;; UNCONDITIONAL BRANCHES
3503 ;; ....................
3505 ;; Unconditional branches.
3509 (label_ref (match_operand 0 "" "")))]
3513 if (GET_CODE (operands[0]) == REG)
3514 return \"%*j\\t%0\";
3516 return \"%*j\\t%l0\";
3518 [(set_attr "type" "jump")
3519 (set_attr "mode" "none")
3520 (set_attr "length" "1")])
3522 (define_insn "indirect_jump"
3523 [(set (pc) (match_operand:SI 0 "register_operand" "d"))]
3526 [(set_attr "type" "jump")
3527 (set_attr "mode" "none")
3528 (set_attr "length" "1")])
3530 (define_insn "tablejump"
3532 (match_operand:SI 0 "register_operand" "d"))
3533 (use (label_ref (match_operand 1 "" "")))]
3536 [(set_attr "type" "jump")
3537 (set_attr "mode" "none")
3538 (set_attr "length" "1")])
3540 ;; Function return, only allow after optimization, so that we can
3541 ;; eliminate jumps to jumps if no stack space is used.
3543 (define_insn "return"
3548 operands[0] = gen_rtx (REG, SImode, GP_REG_FIRST + 31);
3549 return \"%*j\\t%0\";
3551 [(set_attr "type" "jump")
3552 (set_attr "mode" "none")
3553 (set_attr "length" "1")])
3557 ;; ....................
3561 ;; ....................
3563 ;; calls.c now passes a third argument, make saber happy
3565 (define_expand "call"
3566 [(parallel [(call (match_operand 0 "memory_operand" "m")
3567 (match_operand 1 "" "i"))
3568 (clobber (match_operand 2 "" ""))])] ;; overwrite op2 with $31
3574 operands[2] = gen_rtx (REG, SImode, GP_REG_FIRST + 31);
3576 addr = XEXP (operands[0], 0);
3577 if (GET_CODE (addr) != REG && !CONSTANT_ADDRESS_P (addr))
3578 XEXP (operands[0], 0) = force_reg (FUNCTION_MODE, addr);
3581 (define_insn "call_internal"
3582 [(call (match_operand 0 "memory_operand" "m")
3583 (match_operand 1 "" "i"))
3584 (clobber (match_operand:SI 2 "register_operand" "=d"))]
3588 register rtx target = XEXP (operands[0], 0);
3590 if (GET_CODE (target) == SYMBOL_REF)
3591 return \"%*jal\\t%0\";
3595 operands[0] = target;
3596 operands[1] = gen_rtx (REG, SImode, GP_REG_FIRST + 31);
3597 return \"%*jal\\t%1,%0\";
3600 [(set_attr "type" "call")
3601 (set_attr "mode" "none")
3602 (set_attr "length" "1")])
3604 ;; calls.c now passes a fourth argument, make saber happy
3606 (define_expand "call_value"
3607 [(parallel [(set (match_operand 0 "register_operand" "=df")
3608 (call (match_operand 1 "memory_operand" "m")
3609 (match_operand 2 "" "i")))
3610 (clobber (match_operand 3 "" ""))])] ;; overwrite op3 with $31
3616 operands[3] = gen_rtx (REG, SImode, GP_REG_FIRST + 31);
3618 addr = XEXP (operands[1], 0);
3619 if (GET_CODE (addr) != REG && !CONSTANT_ADDRESS_P (addr))
3620 XEXP (operands[1], 0) = force_reg (FUNCTION_MODE, addr);
3623 (define_insn "call_value_internal"
3624 [(set (match_operand 0 "register_operand" "=df")
3625 (call (match_operand 1 "memory_operand" "m")
3626 (match_operand 2 "" "i")))
3627 (clobber (match_operand:SI 3 "register_operand" "=d"))]
3631 register rtx target = XEXP (operands[1], 0);
3633 if (GET_CODE (target) == SYMBOL_REF)
3634 return \"%*jal\\t%1\";
3638 operands[1] = target;
3639 operands[2] = gen_rtx (REG, SImode, GP_REG_FIRST + 31);
3640 return \"%*jal\\t%2,%1\";
3643 [(set_attr "type" "call")
3644 (set_attr "mode" "none")
3645 (set_attr "length" "1")])
3649 ;; ....................
3653 ;; ....................
3660 [(set_attr "type" "nop")
3661 (set_attr "mode" "none")
3662 (set_attr "length" "1")])
3664 (define_expand "probe"
3670 operands[0] = gen_reg_rtx (SImode);
3671 operands[1] = gen_rtx (MEM, SImode, stack_pointer_rtx);
3672 MEM_VOLATILE_P (operands[1]) = TRUE;
3674 /* fall through and generate default code */
3681 ;; comment-start: ";; "
3682 ;; eval: (set-syntax-table (copy-sequence (syntax-table)))
3683 ;; eval: (modify-syntax-entry ?[ "(]")
3684 ;; eval: (modify-syntax-entry ?] ")[")
3685 ;; eval: (modify-syntax-entry ?{ "(}")
3686 ;; eval: (modify-syntax-entry ?} "){")