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)
56 "unknown,branch,jump,call,load,store,move,xfer,hilo,arith,darith,imul,idiv,icmp,fadd,fmul,fdiv,fabs,fneg,fcmp,fcvt,fsqrt,multi,nop"
57 (const_string "unknown"))
59 ;; Main data type used by the insn
60 (define_attr "mode" "unknown,none,QI,HI,SI,DI,SF,DF,FPSW" (const_string "unknown"))
62 ;; # instructions (4 bytes each)
63 (define_attr "length" "" (const_int 1))
65 ;; whether or not an instruction has a mandatory delay slot
66 (define_attr "dslot" "no,yes"
67 (if_then_else (eq_attr "type" "branch,jump,call,load,xfer,hilo,fcmp")
71 ;; Attribute describing the processor. This attribute must match exactly
72 ;; with the processor_type enumeration in mips.h.
74 ;; Attribute describing the processor
75 ;; (define_attr "cpu" "default,r3000,r6000,r4000"
77 ;; (cond [(eq (symbol_ref "mips_cpu") (symbol_ref "PROCESSOR_R3000")) (const_string "r3000")
78 ;; (eq (symbol_ref "mips_cpu") (symbol_ref "PROCESSOR_R4000")) (const_string "r4000")
79 ;; (eq (symbol_ref "mips_cpu") (symbol_ref "PROCESSOR_R6000")) (const_string "r6000")]
80 ;; (const_string "default"))))
82 (define_attr "cpu" "default,r3000,r6000,r4000"
83 (const (symbol_ref "mips_cpu_attr")))
85 ;; Attribute defining whether or not we can use the branch-likely instructions
88 (define_attr "branch_likely" "no,yes"
90 (if_then_else (ge (symbol_ref "mips_isa") (const_int 2))
92 (const_string "no"))))
95 ;; Describe a user's asm statement.
96 (define_asm_attributes
97 [(set_attr "type" "multi")])
101 ;; .........................
103 ;; Delay slots, can't describe load/fcmp/xfer delay slots here
105 ;; .........................
107 (define_delay (eq_attr "type" "branch")
108 [(and (eq_attr "dslot" "no") (eq_attr "length" "1"))
110 (and (eq_attr "branch_likely" "yes") (and (eq_attr "dslot" "no") (eq_attr "length" "1")))])
112 (define_delay (eq_attr "type" "call,jump")
113 [(and (eq_attr "dslot" "no") (eq_attr "length" "1"))
119 ;; .........................
123 ;; .........................
125 ; (define_function_unit NAME MULTIPLICITY SIMULTANEITY
126 ; TEST READY-DELAY ISSUE-DELAY [CONFLICT-LIST])
128 ;; Make the default case (PROCESSOR_DEFAULT) handle the worst case
130 (define_function_unit "memory" 1 0
131 (and (eq_attr "type" "load") (eq_attr "cpu" "!r3000"))
134 (define_function_unit "memory" 1 0
135 (and (eq_attr "type" "load") (eq_attr "cpu" "r3000"))
138 (define_function_unit "memory" 1 0 (eq_attr "type" "store") 1 0)
140 (define_function_unit "addr" 1 0 (eq_attr "type" "fcmp") 2 0)
142 (define_function_unit "memory" 1 0 (eq_attr "type" "xfer") 2 0)
143 (define_function_unit "memory" 1 0 (eq_attr "type" "hilo") 3 0)
145 (define_function_unit "imuldiv" 1 1
146 (and (eq_attr "type" "imul") (eq_attr "cpu" "!r3000,r4000"))
149 (define_function_unit "imuldiv" 1 1
150 (and (eq_attr "type" "imul") (eq_attr "cpu" "r3000"))
153 (define_function_unit "imuldiv" 1 1
154 (and (eq_attr "type" "imul") (eq_attr "cpu" "r4000"))
157 (define_function_unit "imuldiv" 1 1
158 (and (eq_attr "type" "idiv") (eq_attr "cpu" "!r3000,r4000"))
161 (define_function_unit "imuldiv" 1 1
162 (and (eq_attr "type" "idiv") (eq_attr "cpu" "r3000"))
165 (define_function_unit "imuldiv" 1 1
166 (and (eq_attr "type" "idiv") (eq_attr "cpu" "r4000"))
169 (define_function_unit "adder" 1 1
170 (and (eq_attr "type" "fadd") (eq_attr "cpu" "!r3000,r6000"))
173 (define_function_unit "adder" 1 1
174 (and (eq_attr "type" "fadd") (eq_attr "cpu" "r3000"))
177 (define_function_unit "adder" 1 1
178 (and (eq_attr "type" "fadd") (eq_attr "cpu" "r6000"))
181 (define_function_unit "adder" 1 1
182 (and (eq_attr "type" "fabs,fneg") (eq_attr "cpu" "!r3000"))
185 (define_function_unit "adder" 1 1
186 (and (eq_attr "type" "fabs,fneg") (eq_attr "cpu" "r3000"))
189 (define_function_unit "mult" 1 1
190 (and (eq_attr "type" "fmul") (and (eq_attr "mode" "SF") (eq_attr "cpu" "!r3000,r6000")))
193 (define_function_unit "mult" 1 1
194 (and (eq_attr "type" "fmul") (and (eq_attr "mode" "SF") (eq_attr "cpu" "r3000")))
197 (define_function_unit "mult" 1 1
198 (and (eq_attr "type" "fmul") (and (eq_attr "mode" "SF") (eq_attr "cpu" "r6000")))
201 (define_function_unit "mult" 1 1
202 (and (eq_attr "type" "fmul") (and (eq_attr "mode" "DF") (eq_attr "cpu" "!r3000,r6000")))
205 (define_function_unit "mult" 1 1
206 (and (eq_attr "type" "fmul") (and (eq_attr "mode" "DF") (eq_attr "cpu" "r3000")))
209 (define_function_unit "mult" 1 1
210 (and (eq_attr "type" "fmul") (and (eq_attr "mode" "DF") (eq_attr "cpu" "r6000")))
213 (define_function_unit "divide" 1 1
214 (and (eq_attr "type" "fdiv") (and (eq_attr "mode" "SF") (eq_attr "cpu" "!r3000,r6000")))
217 (define_function_unit "divide" 1 1
218 (and (eq_attr "type" "fdiv") (and (eq_attr "mode" "SF") (eq_attr "cpu" "r3000")))
221 (define_function_unit "divide" 1 1
222 (and (eq_attr "type" "fdiv") (and (eq_attr "mode" "SF") (eq_attr "cpu" "r6000")))
225 (define_function_unit "divide" 1 1
226 (and (eq_attr "type" "fdiv") (and (eq_attr "mode" "DF") (eq_attr "cpu" "!r3000,r6000")))
229 (define_function_unit "divide" 1 1
230 (and (eq_attr "type" "fdiv") (and (eq_attr "mode" "DF") (eq_attr "cpu" "r3000")))
233 (define_function_unit "divide" 1 1
234 (and (eq_attr "type" "fdiv") (and (eq_attr "mode" "DF") (eq_attr "cpu" "r6000")))
237 (define_function_unit "divide" 1 1 (and (eq_attr "type" "fsqrt") (eq_attr "mode" "SF")) 54 0)
238 (define_function_unit "divide" 1 1 (and (eq_attr "type" "fsqrt") (eq_attr "mode" "DF")) 112 0)
241 ;; The following functional units do not use the cpu type, and use
242 ;; much less memory in genattrtab.c.
244 ;; (define_function_unit "memory" 1 0 (eq_attr "type" "load") 3 0)
245 ;; (define_function_unit "memory" 1 0 (eq_attr "type" "store") 1 0)
247 ;; (define_function_unit "fp_comp" 1 0 (eq_attr "type" "fcmp") 2 0)
249 ;; (define_function_unit "transfer" 1 0 (eq_attr "type" "xfer") 2 0)
250 ;; (define_function_unit "transfer" 1 0 (eq_attr "type" "hilo") 3 0)
252 ;; (define_function_unit "imuldiv" 1 1 (eq_attr "type" "imul") 17 0)
253 ;; (define_function_unit "imuldiv" 1 1 (eq_attr "type" "idiv") 38 0)
255 ;; (define_function_unit "adder" 1 1 (eq_attr "type" "fadd") 4 0)
256 ;; (define_function_unit "adder" 1 1 (eq_attr "type" "fabs,fneg") 2 0)
258 ;; (define_function_unit "mult" 1 1 (and (eq_attr "type" "fmul") (eq_attr "mode" "SF")) 7 0)
259 ;; (define_function_unit "mult" 1 1 (and (eq_attr "type" "fmul") (eq_attr "mode" "DF")) 8 0)
261 ;; (define_function_unit "divide" 1 1 (and (eq_attr "type" "fdiv") (eq_attr "mode" "SF")) 23 0)
262 ;; (define_function_unit "divide" 1 1 (and (eq_attr "type" "fdiv") (eq_attr "mode" "DF")) 36 0)
264 ;; (define_function_unit "sqrt" 1 1 (and (eq_attr "type" "fsqrt") (eq_attr "mode" "SF")) 54 0)
265 ;; (define_function_unit "sqrt" 1 1 (and (eq_attr "type" "fsqrt") (eq_attr "mode" "DF")) 112 0)
269 ;; ....................
273 ;; ....................
276 (define_insn "adddf3"
277 [(set (match_operand:DF 0 "register_operand" "=f")
278 (plus:DF (match_operand:DF 1 "register_operand" "f")
279 (match_operand:DF 2 "register_operand" "f")))]
282 [(set_attr "type" "fadd")
283 (set_attr "mode" "DF")
284 (set_attr "length" "1")])
286 (define_insn "addsf3"
287 [(set (match_operand:SF 0 "register_operand" "=f")
288 (plus:SF (match_operand:SF 1 "register_operand" "f")
289 (match_operand:SF 2 "register_operand" "f")))]
292 [(set_attr "type" "fadd")
293 (set_attr "mode" "SF")
294 (set_attr "length" "1")])
296 (define_expand "addsi3"
297 [(set (match_operand:SI 0 "register_operand" "=d")
298 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
299 (match_operand:SI 2 "arith_operand" "dI")))]
303 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == -32768)
304 operands[2] = force_reg (SImode, operands[2]);
307 (define_insn "addsi3_internal"
308 [(set (match_operand:SI 0 "register_operand" "=d")
309 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
310 (match_operand:SI 2 "arith_operand" "dI")))]
311 "GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768"
314 return (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
315 ? \"subu\\t%0,%z1,%n2\"
316 : \"addu\\t%0,%z1,%2\";
318 [(set_attr "type" "arith")
319 (set_attr "mode" "SI")
320 (set_attr "length" "1")])
322 (define_expand "adddi3"
323 [(parallel [(set (match_operand:DI 0 "register_operand" "")
324 (plus:DI (match_operand:DI 1 "register_operand" "")
325 (match_operand:DI 2 "arith_operand" "")))
326 (clobber (match_dup 3))])]
327 "!TARGET_DEBUG_G_MODE"
330 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == -32768)
331 operands[2] = force_reg (SImode, operands[2]);
333 operands[3] = gen_reg_rtx (SImode);
336 (define_insn "adddi3_internal_1"
337 [(set (match_operand:DI 0 "register_operand" "=d,&d")
338 (plus:DI (match_operand:DI 1 "register_operand" "0,d")
339 (match_operand:DI 2 "register_operand" "d,d")))
340 (clobber (match_operand:SI 3 "register_operand" "=d,d"))]
341 "!TARGET_DEBUG_G_MODE"
344 return (REGNO (operands[0]) == REGNO (operands[1])
345 && REGNO (operands[0]) == REGNO (operands[2]))
346 ? \"srl\\t%3,%L0,31\;sll\\t%M0,%M0,1\;sll\\t%L0,%L1,1\;addu\\t%M0,%M0,%3\"
347 : \"addu\\t%L0,%L1,%L2\;sltu\\t%3,%L0,%L2\;addu\\t%M0,%M1,%M2\;addu\\t%M0,%M0,%3\";
349 [(set_attr "type" "darith")
350 (set_attr "mode" "DI")
351 (set_attr "length" "4")])
354 [(set (match_operand:DI 0 "register_operand" "")
355 (plus:DI (match_operand:DI 1 "register_operand" "")
356 (match_operand:DI 2 "register_operand" "")))
357 (clobber (match_operand:SI 3 "register_operand" ""))]
358 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
359 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
360 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
361 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))
362 && (REGNO (operands[0]) != REGNO (operands[1])
363 || REGNO (operands[0]) != REGNO (operands[2]))"
365 [(set (subreg:SI (match_dup 0) 0)
366 (plus:SI (subreg:SI (match_dup 1) 0)
367 (subreg:SI (match_dup 2) 0)))
370 (ltu:SI (subreg:SI (match_dup 0) 0)
371 (subreg:SI (match_dup 2) 0)))
373 (set (subreg:SI (match_dup 0) 1)
374 (plus:SI (subreg:SI (match_dup 1) 1)
375 (subreg:SI (match_dup 2) 1)))
377 (set (subreg:SI (match_dup 0) 1)
378 (plus:SI (subreg:SI (match_dup 0) 1)
383 [(set (match_operand:DI 0 "register_operand" "")
384 (plus:DI (match_operand:DI 1 "register_operand" "")
385 (match_operand:DI 2 "register_operand" "")))
386 (clobber (match_operand:SI 3 "register_operand" ""))]
387 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
388 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
389 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
390 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))
391 && (REGNO (operands[0]) != REGNO (operands[1])
392 || REGNO (operands[0]) != REGNO (operands[2]))"
394 [(set (subreg:SI (match_dup 0) 1)
395 (plus:SI (subreg:SI (match_dup 1) 1)
396 (subreg:SI (match_dup 2) 1)))
399 (ltu:SI (subreg:SI (match_dup 0) 1)
400 (subreg:SI (match_dup 2) 1)))
402 (set (subreg:SI (match_dup 0) 0)
403 (plus:SI (subreg:SI (match_dup 1) 0)
404 (subreg:SI (match_dup 2) 0)))
406 (set (subreg:SI (match_dup 0) 0)
407 (plus:SI (subreg:SI (match_dup 0) 0)
411 (define_insn "adddi3_internal_2"
412 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
413 (plus:DI (match_operand:DI 1 "register_operand" "%d,%d,%d")
414 (match_operand:DI 2 "small_int" "P,J,N")))
415 (clobber (match_operand:SI 3 "register_operand" "=d,d,d"))]
416 "!TARGET_DEBUG_G_MODE && INTVAL (operands[2]) != -32768"
418 addu\\t%L0,%L1,%2\;sltu\\t%3,%L0,%2\;addu\\t%M0,%M1,%3
419 move\\t%L0,%L1\;move\\t%M0,%M1
420 subu\\t%L0,%L1,%n2\;sltu\\t%3,%L0,%2\;subu\\t%M0,%M1,1\;addu\\t%M0,%M0,%3"
421 [(set_attr "type" "darith")
422 (set_attr "mode" "DI")
423 (set_attr "length" "3,2,4")])
426 [(set (match_operand:DI 0 "register_operand" "")
427 (plus:DI (match_operand:DI 1 "register_operand" "")
428 (match_operand:DI 2 "small_int" "")))
429 (clobber (match_operand:SI 3 "register_operand" "=d"))]
430 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
431 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
432 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
433 && INTVAL (operands[2]) > 0"
435 [(set (subreg:SI (match_dup 0) 0)
436 (plus:SI (subreg:SI (match_dup 1) 0)
440 (ltu:SI (subreg:SI (match_dup 0) 0)
443 (set (subreg:SI (match_dup 0) 1)
444 (plus:SI (subreg:SI (match_dup 1) 1)
449 [(set (match_operand:DI 0 "register_operand" "")
450 (plus:DI (match_operand:DI 1 "register_operand" "")
451 (match_operand:DI 2 "small_int" "")))
452 (clobber (match_operand:SI 3 "register_operand" "=d"))]
453 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
454 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
455 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
456 && INTVAL (operands[2]) > 0"
458 [(set (subreg:SI (match_dup 0) 1)
459 (plus:SI (subreg:SI (match_dup 1) 1)
463 (ltu:SI (subreg:SI (match_dup 0) 1)
466 (set (subreg:SI (match_dup 0) 0)
467 (plus:SI (subreg:SI (match_dup 1) 0)
472 ;; ....................
476 ;; ....................
479 (define_insn "subdf3"
480 [(set (match_operand:DF 0 "register_operand" "=f")
481 (minus:DF (match_operand:DF 1 "register_operand" "f")
482 (match_operand:DF 2 "register_operand" "f")))]
485 [(set_attr "type" "fadd")
486 (set_attr "mode" "DF")
487 (set_attr "length" "1")])
489 (define_insn "subsf3"
490 [(set (match_operand:SF 0 "register_operand" "=f")
491 (minus:SF (match_operand:SF 1 "register_operand" "f")
492 (match_operand:SF 2 "register_operand" "f")))]
495 [(set_attr "type" "fadd")
496 (set_attr "mode" "SF")
497 (set_attr "length" "1")])
499 (define_expand "subsi3"
500 [(set (match_operand:SI 0 "register_operand" "=d")
501 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
502 (match_operand:SI 2 "arith_operand" "dI")))]
506 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == -32768)
507 operands[2] = force_reg (SImode, operands[2]);
510 (define_insn "subsi3_internal"
511 [(set (match_operand:SI 0 "register_operand" "=d")
512 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
513 (match_operand:SI 2 "arith_operand" "dI")))]
514 "GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768"
517 return (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
518 ? \"addu\\t%0,%z1,%n2\"
519 : \"subu\\t%0,%z1,%2\";
521 [(set_attr "type" "arith")
522 (set_attr "mode" "SI")
523 (set_attr "length" "1")])
525 (define_expand "subdi3"
526 [(parallel [(set (match_operand:DI 0 "register_operand" "=d")
527 (minus:DI (match_operand:DI 1 "register_operand" "d")
528 (match_operand:DI 2 "register_operand" "d")))
529 (clobber (match_dup 3))])]
530 "!TARGET_DEBUG_G_MODE"
531 "operands[3] = gen_reg_rtx (SImode);")
533 (define_insn "subdi3_internal"
534 [(set (match_operand:DI 0 "register_operand" "=d")
535 (minus:DI (match_operand:DI 1 "register_operand" "d")
536 (match_operand:DI 2 "register_operand" "d")))
537 (clobber (match_operand:SI 3 "register_operand" "=d"))]
538 "!TARGET_DEBUG_G_MODE"
539 "sltu\\t%3,%L1,%L2\;subu\\t%L0,%L1,%L2\;subu\\t%M0,%M1,%M2\;subu\\t%M0,%M0,%3"
540 [(set_attr "type" "darith")
541 (set_attr "mode" "DI")
542 (set_attr "length" "4")])
545 [(set (match_operand:DI 0 "register_operand" "")
546 (minus:DI (match_operand:DI 1 "register_operand" "")
547 (match_operand:DI 2 "register_operand" "")))
548 (clobber (match_operand:SI 3 "register_operand" ""))]
549 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
550 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
551 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
552 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
555 (ltu:SI (subreg:SI (match_dup 1) 0)
556 (subreg:SI (match_dup 2) 0)))
558 (set (subreg:SI (match_dup 0) 0)
559 (minus:SI (subreg:SI (match_dup 1) 0)
560 (subreg:SI (match_dup 2) 0)))
562 (set (subreg:SI (match_dup 0) 1)
563 (minus:SI (subreg:SI (match_dup 1) 1)
564 (subreg:SI (match_dup 2) 1)))
566 (set (subreg:SI (match_dup 0) 1)
567 (minus:SI (subreg:SI (match_dup 0) 1)
572 [(set (match_operand:DI 0 "register_operand" "")
573 (minus:DI (match_operand:DI 1 "register_operand" "")
574 (match_operand:DI 2 "register_operand" "")))
575 (clobber (match_operand:SI 3 "register_operand" ""))]
576 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
577 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
578 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
579 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
582 (ltu:SI (subreg:SI (match_dup 1) 1)
583 (subreg:SI (match_dup 2) 1)))
585 (set (subreg:SI (match_dup 0) 1)
586 (minus:SI (subreg:SI (match_dup 1) 1)
587 (subreg:SI (match_dup 2) 1)))
589 (set (subreg:SI (match_dup 0) 0)
590 (minus:SI (subreg:SI (match_dup 1) 0)
591 (subreg:SI (match_dup 2) 0)))
593 (set (subreg:SI (match_dup 0) 0)
594 (minus:SI (subreg:SI (match_dup 0) 0)
598 (define_insn "subdi3_internal_2"
599 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
600 (minus:DI (match_operand:DI 1 "register_operand" "d,d,d")
601 (match_operand:DI 2 "small_int" "P,J,N")))
602 (clobber (match_operand:SI 3 "register_operand" "=d,d,d"))]
603 "!TARGET_DEBUG_G_MODE && INTVAL (operands[2]) != -32768"
605 sltu\\t%3,%L1,%2\;subu\\t%L0,%L1,%2\;subu\\t%M0,%M1,%3
606 move\\t%L0,%L1\;move\\t%M0,%M1
607 sltu\\t%3,%L1,%2\;subu\\t%L0,%L1,%2\;subu\\t%M0,%M1,1\;subu\\t%M0,%M0,%3"
608 [(set_attr "type" "darith")
609 (set_attr "mode" "DI")
610 (set_attr "length" "3,2,4")])
613 [(set (match_operand:DI 0 "register_operand" "")
614 (minus:DI (match_operand:DI 1 "register_operand" "")
615 (match_operand:DI 2 "small_int" "")))
616 (clobber (match_operand:SI 3 "register_operand" ""))]
617 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
618 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
619 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
620 && INTVAL (operands[2]) > 0"
623 (ltu:SI (subreg:SI (match_dup 1) 0)
626 (set (subreg:SI (match_dup 0) 0)
627 (minus:SI (subreg:SI (match_dup 1) 0)
630 (set (subreg:SI (match_dup 0) 1)
631 (minus:SI (subreg:SI (match_dup 1) 1)
636 [(set (match_operand:DI 0 "register_operand" "")
637 (minus:DI (match_operand:DI 1 "register_operand" "")
638 (match_operand:DI 2 "small_int" "")))
639 (clobber (match_operand:SI 3 "register_operand" ""))]
640 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
641 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
642 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
643 && INTVAL (operands[2]) > 0"
646 (ltu:SI (subreg:SI (match_dup 1) 1)
649 (set (subreg:SI (match_dup 0) 1)
650 (minus:SI (subreg:SI (match_dup 1) 1)
653 (set (subreg:SI (match_dup 0) 0)
654 (minus:SI (subreg:SI (match_dup 1) 0)
660 ;; ....................
664 ;; ....................
667 (define_insn "muldf3"
668 [(set (match_operand:DF 0 "register_operand" "=f")
669 (mult:DF (match_operand:DF 1 "register_operand" "f")
670 (match_operand:DF 2 "register_operand" "f")))]
673 [(set_attr "type" "fmul")
674 (set_attr "mode" "DF")
675 (set_attr "length" "1")])
677 (define_insn "mulsf3"
678 [(set (match_operand:SF 0 "register_operand" "=f")
679 (mult:SF (match_operand:SF 1 "register_operand" "f")
680 (match_operand:SF 2 "register_operand" "f")))]
683 [(set_attr "type" "fmul")
684 (set_attr "mode" "SF")
685 (set_attr "length" "1")])
687 (define_insn "mulsi3"
688 [(set (match_operand:SI 0 "register_operand" "=d")
689 (mult:SI (match_operand:SI 1 "register_operand" "d")
690 (match_operand:SI 2 "register_operand" "d")))
691 (clobber (reg:SI 64))
692 (clobber (reg:SI 65))]
698 xoperands[0] = operands[0];
699 xoperands[1] = gen_rtx (REG, SImode, LO_REGNUM);
701 output_asm_insn (\"mult\\t%1,%2\", operands);
702 output_asm_insn (mips_move_1word (xoperands, insn), xoperands);
705 [(set_attr "type" "imul")
706 (set_attr "mode" "SI")
707 (set_attr "length" "3")]) ;; mult + mflo + delay
710 [(set (match_operand:SI 0 "register_operand" "")
711 (mult:SI (match_operand:SI 1 "register_operand" "")
712 (match_operand:SI 2 "register_operand" "")))
713 (clobber (reg:SI 64))
714 (clobber (reg:SI 65))]
715 "!TARGET_DEBUG_D_MODE"
716 [(parallel [(set (reg:SI 65) ;; low register
717 (mult:SI (match_dup 1)
719 (clobber (reg:SI 64))])
724 (define_insn "mulsi3_internal"
725 [(set (reg:SI 65) ;; low register
726 (mult:SI (match_operand:SI 0 "register_operand" "d")
727 (match_operand:SI 1 "register_operand" "d")))
728 (clobber (reg:SI 64))]
731 [(set_attr "type" "imul")
732 (set_attr "mode" "SI")
733 (set_attr "length" "1")])
735 (define_insn "mulsidi3"
736 [(set (match_operand:DI 0 "register_operand" "=d")
737 (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))
738 (sign_extend:DI (match_operand:SI 2 "register_operand" "d"))))
739 (clobber (reg:DI 64))]
745 xoperands[0] = operands[0];
746 xoperands[1] = gen_rtx (REG, DImode, MD_REG_FIRST);
748 output_asm_insn (\"mult\\t%1,%2\", operands);
749 output_asm_insn (mips_move_2words (xoperands, insn), xoperands);
752 [(set_attr "type" "imul")
753 (set_attr "mode" "SI")
754 (set_attr "length" "4")]) ;; mult + mflo + mfhi + delay
756 (define_insn "umulsidi3"
757 [(set (match_operand:DI 0 "register_operand" "=d")
758 (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "d"))
759 (zero_extend:DI (match_operand:SI 2 "register_operand" "d"))))
760 (clobber (reg:DI 64))]
766 xoperands[0] = operands[0];
767 xoperands[1] = gen_rtx (REG, DImode, MD_REG_FIRST);
769 output_asm_insn (\"multu\\t%1,%2\", operands);
770 output_asm_insn (mips_move_2words (xoperands, insn), xoperands);
773 [(set_attr "type" "imul")
774 (set_attr "mode" "SI")
775 (set_attr "length" "4")]) ;; mult + mflo + mfhi + delay
779 ;; ....................
781 ;; DIVISION and REMAINDER
783 ;; ....................
786 (define_insn "divdf3"
787 [(set (match_operand:DF 0 "register_operand" "=f")
788 (div:DF (match_operand:DF 1 "register_operand" "f")
789 (match_operand:DF 2 "register_operand" "f")))]
792 [(set_attr "type" "fdiv")
793 (set_attr "mode" "DF")
794 (set_attr "length" "1")])
796 (define_insn "divsf3"
797 [(set (match_operand:SF 0 "register_operand" "=f")
798 (div:SF (match_operand:SF 1 "register_operand" "f")
799 (match_operand:SF 2 "register_operand" "f")))]
802 [(set_attr "type" "fdiv")
803 (set_attr "mode" "SF")
804 (set_attr "length" "1")])
806 ;; If optimizing, prefer the divmod functions over separate div and
807 ;; mod functions, since this will allow using one instruction for both
808 ;; the quotient and remainder. At present, the divmod is not moved out
809 ;; of loops if it is constant within the loop, so allow -mdebugc to
810 ;; use the old method of doing things.
812 ;; 64 is the multiply/divide hi register
813 ;; 65 is the multiply/divide lo register
815 (define_insn "divmodsi4"
816 [(set (match_operand:SI 0 "register_operand" "=d")
817 (div:SI (match_operand:SI 1 "register_operand" "d")
818 (match_operand:SI 2 "register_operand" "d")))
819 (set (match_operand:SI 3 "register_operand" "=d")
820 (mod:SI (match_dup 1)
822 (clobber (reg:SI 64))
823 (clobber (reg:SI 65))]
827 if (find_reg_note (insn, REG_UNUSED, operands[3]))
828 return \"div\\t%0,%1,%2\";
830 if (find_reg_note (insn, REG_UNUSED, operands[0]))
831 return \"rem\\t%3,%1,%2\";
833 return \"div\\t%0,%1,%2\;mfhi\\t%3\";
835 [(set_attr "type" "idiv")
836 (set_attr "mode" "SI")
837 (set_attr "length" "13")]) ;; various tests for dividing by 0 and such
839 (define_insn "udivmodsi4"
840 [(set (match_operand:SI 0 "register_operand" "=d")
841 (udiv:SI (match_operand:SI 1 "register_operand" "d")
842 (match_operand:SI 2 "register_operand" "d")))
843 (set (match_operand:SI 3 "register_operand" "=d")
844 (umod:SI (match_dup 1)
846 (clobber (reg:SI 64))
847 (clobber (reg:SI 65))]
851 if (find_reg_note (insn, REG_UNUSED, operands[3]))
852 return \"divu\\t%0,%1,%2\";
854 if (find_reg_note (insn, REG_UNUSED, operands[0]))
855 return \"remu\\t%3,%1,%2\";
857 return \"divu\\t%0,%1,%2\;mfhi\\t%3\";
859 [(set_attr "type" "idiv")
860 (set_attr "mode" "SI")
861 (set_attr "length" "13")]) ;; various tests for dividing by 0 and such
863 (define_insn "divsi3"
864 [(set (match_operand:SI 0 "register_operand" "=d")
865 (div:SI (match_operand:SI 1 "register_operand" "d")
866 (match_operand:SI 2 "register_operand" "d")))
867 (clobber (reg:SI 64))
868 (clobber (reg:SI 65))]
871 [(set_attr "type" "idiv")
872 (set_attr "mode" "SI")
873 (set_attr "length" "13")]) ;; various tests for dividing by 0 and such
875 (define_insn "modsi3"
876 [(set (match_operand:SI 0 "register_operand" "=d")
877 (mod:SI (match_operand:SI 1 "register_operand" "d")
878 (match_operand:SI 2 "register_operand" "d")))
879 (clobber (reg:SI 64))
880 (clobber (reg:SI 65))]
883 [(set_attr "type" "idiv")
884 (set_attr "mode" "SI")
885 (set_attr "length" "14")]) ;; various tests for dividing by 0 and such
887 (define_insn "udivsi3"
888 [(set (match_operand:SI 0 "register_operand" "=d")
889 (udiv:SI (match_operand:SI 1 "register_operand" "d")
890 (match_operand:SI 2 "register_operand" "d")))
891 (clobber (reg:SI 64))
892 (clobber (reg:SI 65))]
895 [(set_attr "type" "idiv")
896 (set_attr "mode" "SI")
897 (set_attr "length" "14")]) ;; various tests for dividing by 0 and such
899 (define_insn "umodsi3"
900 [(set (match_operand:SI 0 "register_operand" "=d")
901 (umod:SI (match_operand:SI 1 "register_operand" "d")
902 (match_operand:SI 2 "register_operand" "d")))
903 (clobber (reg:SI 64))
904 (clobber (reg:SI 65))]
907 [(set_attr "type" "idiv")
908 (set_attr "mode" "SI")
909 (set_attr "length" "14")]) ;; various tests for dividing by 0 and such
913 ;; ....................
917 ;; ....................
919 (define_insn "sqrtdf2"
920 [(set (match_operand:DF 0 "register_operand" "=f")
921 (sqrt:DF (match_operand:DF 1 "register_operand" "f")))]
922 "TARGET_HARD_FLOAT && HAVE_SQRT_P()"
924 [(set_attr "type" "fabs")
925 (set_attr "mode" "DF")
926 (set_attr "length" "1")])
928 (define_insn "sqrtsf2"
929 [(set (match_operand:SF 0 "register_operand" "=f")
930 (sqrt:SF (match_operand:SF 1 "register_operand" "f")))]
931 "TARGET_HARD_FLOAT && HAVE_SQRT_P()"
933 [(set_attr "type" "fabs")
934 (set_attr "mode" "SF")
935 (set_attr "length" "1")])
939 ;; ....................
943 ;; ....................
945 ;; Do not use the integer abs macro instruction, since that signals an
946 ;; exception on -2147483648 (sigh).
948 (define_insn "abssi2"
949 [(set (match_operand:SI 0 "register_operand" "=d")
950 (abs:SI (match_operand:SI 1 "register_operand" "d")))]
955 dslots_jump_filled++;
956 operands[2] = const0_rtx;
958 return (REGNO (operands[0]) == REGNO (operands[1]))
959 ? \"bgez\\t%1,1f%#\\n\\tsubu\\t%0,%z2,%0\\n1:\"
960 : \"%(bgez\\t%1,1f\\n\\tmove\\t%0,%1\\n\\tsubu\\t%0,%z2,%0\\n1:%)\";
962 [(set_attr "type" "multi")
963 (set_attr "mode" "SI")
964 (set_attr "length" "3")])
966 (define_insn "absdf2"
967 [(set (match_operand:DF 0 "register_operand" "=f")
968 (abs:DF (match_operand:DF 1 "register_operand" "f")))]
971 [(set_attr "type" "fabs")
972 (set_attr "mode" "DF")
973 (set_attr "length" "1")])
975 (define_insn "abssf2"
976 [(set (match_operand:SF 0 "register_operand" "=f")
977 (abs:SF (match_operand:SF 1 "register_operand" "f")))]
980 [(set_attr "type" "fabs")
981 (set_attr "mode" "SF")
982 (set_attr "length" "1")])
986 ;; ....................
988 ;; FIND FIRST BIT INSTRUCTION
990 ;; ....................
993 (define_insn "ffssi2"
994 [(set (match_operand:SI 0 "register_operand" "=&d")
995 (ffs:SI (match_operand:SI 1 "register_operand" "d")))
996 (clobber (match_scratch:SI 2 "=&d"))
997 (clobber (match_scratch:SI 3 "=&d"))]
1001 dslots_jump_total += 2;
1002 dslots_jump_filled += 2;
1003 operands[4] = const0_rtx;
1005 if (optimize && find_reg_note (insn, REG_DEAD, operands[1]))
1008 \\tbeq\\t%1,%z4,2f\\n\\
1009 1:\\tand\\t%2,%1,0x0001\\n\\
1010 \\taddu\\t%0,%0,1\\n\\
1011 \\tbeq\\t%2,%z4,1b\\n\\
1012 \\tsrl\\t%1,%1,1\\n\\
1017 \\tmove\\t%3,%1\\n\\
1018 \\tbeq\\t%3,%z4,2f\\n\\
1019 1:\\tand\\t%2,%3,0x0001\\n\\
1020 \\taddu\\t%0,%0,1\\n\\
1021 \\tbeq\\t%2,%z4,1b\\n\\
1022 \\tsrl\\t%3,%3,1\\n\\
1025 [(set_attr "type" "multi")
1026 (set_attr "mode" "SI")
1027 (set_attr "length" "6")])
1031 ;; ....................
1033 ;; NEGATION and ONE'S COMPLEMENT
1035 ;; ....................
1037 (define_insn "negsi2"
1038 [(set (match_operand:SI 0 "register_operand" "=d")
1039 (neg:SI (match_operand:SI 1 "register_operand" "d")))]
1043 operands[2] = const0_rtx;
1044 return \"subu\\t%0,%z2,%1\";
1046 [(set_attr "type" "arith")
1047 (set_attr "mode" "SI")
1048 (set_attr "length" "1")])
1050 (define_expand "negdi2"
1051 [(parallel [(set (match_operand:DI 0 "register_operand" "=d")
1052 (neg:DI (match_operand:DI 1 "register_operand" "d")))
1053 (clobber (match_dup 2))])]
1054 "!TARGET_DEBUG_G_MODE"
1055 "operands[2] = gen_reg_rtx (SImode);")
1057 (define_insn "negdi2_internal"
1058 [(set (match_operand:DI 0 "register_operand" "=d")
1059 (neg:DI (match_operand:DI 1 "register_operand" "d")))
1060 (clobber (match_operand:SI 2 "register_operand" "=d"))]
1061 "!TARGET_DEBUG_G_MODE"
1064 operands[3] = const0_rtx;
1065 return \"subu\\t%L0,%z3,%L1\;subu\\t%M0,%z3,%M1\;sltu\\t%2,%z3,%L0\;subu\\t%M0,%M0,%2\";
1067 [(set_attr "type" "darith")
1068 (set_attr "mode" "DI")
1069 (set_attr "length" "4")])
1071 (define_insn "negdf2"
1072 [(set (match_operand:DF 0 "register_operand" "=f")
1073 (neg:DF (match_operand:DF 1 "register_operand" "f")))]
1076 [(set_attr "type" "fneg")
1077 (set_attr "mode" "DF")
1078 (set_attr "length" "1")])
1080 (define_insn "negsf2"
1081 [(set (match_operand:SF 0 "register_operand" "=f")
1082 (neg:SF (match_operand:SF 1 "register_operand" "f")))]
1085 [(set_attr "type" "fneg")
1086 (set_attr "mode" "SF")
1087 (set_attr "length" "1")])
1089 (define_insn "one_cmplsi2"
1090 [(set (match_operand:SI 0 "register_operand" "=d")
1091 (not:SI (match_operand:SI 1 "register_operand" "d")))]
1095 operands[2] = const0_rtx;
1096 return \"nor\\t%0,%z2,%1\";
1098 [(set_attr "type" "arith")
1099 (set_attr "mode" "SI")
1100 (set_attr "length" "1")])
1102 (define_insn "one_cmpldi2"
1103 [(set (match_operand:DI 0 "register_operand" "=d")
1104 (not:SI (match_operand:DI 1 "register_operand" "d")))]
1108 operands[2] = const0_rtx;
1109 return \"nor\\t%M0,%z2,%M1\;nor\\t%L0,%z2,%L1\";
1111 [(set_attr "type" "darith")
1112 (set_attr "mode" "DI")
1113 (set_attr "length" "2")])
1116 [(set (match_operand:DI 0 "register_operand" "")
1117 (not:DI (match_operand:DI 1 "register_operand" "")))]
1118 "reload_completed && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
1119 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
1120 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))"
1122 [(set (subreg:SI (match_dup 0) 0) (not:SI (subreg:SI (match_dup 1) 0)))
1123 (set (subreg:SI (match_dup 0) 1) (not:SI (subreg:SI (match_dup 1) 1)))]
1126 ;; Simple hack to recognize the "nor" instruction on the MIPS
1127 ;; This must appear before the normal or patterns, so that the
1128 ;; combiner will correctly fold things.
1130 (define_insn "norsi3"
1131 [(set (match_operand:SI 0 "register_operand" "=d")
1132 (not:SI (ior:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
1133 (match_operand:SI 2 "reg_or_0_operand" "dJ"))))]
1136 [(set_attr "type" "arith")
1137 (set_attr "mode" "SI")
1138 (set_attr "length" "1")])
1140 (define_insn "nordi3"
1141 [(set (match_operand:DI 0 "register_operand" "=d")
1142 (not:DI (ior:DI (match_operand:DI 1 "register_operand" "d")
1143 (match_operand:DI 2 "register_operand" "d"))))]
1145 "nor\\t%M0,%M1,%M2\;nor\\t%L0,%L1,%L2"
1146 [(set_attr "type" "darith")
1147 (set_attr "mode" "DI")
1148 (set_attr "length" "2")])
1151 [(set (match_operand:DI 0 "register_operand" "")
1152 (not:DI (ior:DI (match_operand:DI 1 "register_operand" "")
1153 (match_operand:DI 2 "register_operand" ""))))]
1154 "reload_completed && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
1155 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
1156 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
1157 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
1159 [(set (subreg:SI (match_dup 0) 0) (not:SI (ior:SI (subreg:SI (match_dup 1) 0) (subreg:SI (match_dup 2) 0))))
1160 (set (subreg:SI (match_dup 0) 1) (not:SI (ior:SI (subreg:SI (match_dup 1) 1) (subreg:SI (match_dup 2) 1))))]
1165 ;; ....................
1169 ;; ....................
1172 (define_insn "andsi3"
1173 [(set (match_operand:SI 0 "register_operand" "=d,d")
1174 (and:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
1175 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
1180 [(set_attr "type" "arith")
1181 (set_attr "mode" "SI")
1182 (set_attr "length" "1")])
1184 (define_insn "anddi3"
1185 [(set (match_operand:DI 0 "register_operand" "=d")
1186 (and:DI (match_operand:DI 1 "register_operand" "d")
1187 (match_operand:DI 2 "register_operand" "d")))]
1188 "!TARGET_DEBUG_G_MODE"
1189 "and\\t%M0,%M1,%M2\;and\\t%L0,%L1,%L2"
1190 [(set_attr "type" "darith")
1191 (set_attr "mode" "DI")
1192 (set_attr "length" "2")])
1195 [(set (match_operand:DI 0 "register_operand" "")
1196 (and:DI (match_operand:DI 1 "register_operand" "")
1197 (match_operand:DI 2 "register_operand" "")))]
1198 "reload_completed && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
1199 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
1200 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
1201 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
1203 [(set (subreg:SI (match_dup 0) 0) (and:SI (subreg:SI (match_dup 1) 0) (subreg:SI (match_dup 2) 0)))
1204 (set (subreg:SI (match_dup 0) 1) (and:SI (subreg:SI (match_dup 1) 1) (subreg:SI (match_dup 2) 1)))]
1207 (define_insn "iorsi3"
1208 [(set (match_operand:SI 0 "register_operand" "=d,d")
1209 (ior:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
1210 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
1215 [(set_attr "type" "arith")
1216 (set_attr "mode" "SI")
1217 (set_attr "length" "1")])
1219 (define_insn "iordi3"
1220 [(set (match_operand:DI 0 "register_operand" "=d")
1221 (ior:DI (match_operand:DI 1 "register_operand" "d")
1222 (match_operand:DI 2 "register_operand" "d")))]
1223 "!TARGET_DEBUG_G_MODE"
1224 "or\\t%M0,%M1,%M2\;or\\t%L0,%L1,%L2"
1225 [(set_attr "type" "darith")
1226 (set_attr "mode" "DI")
1227 (set_attr "length" "2")])
1230 [(set (match_operand:DI 0 "register_operand" "")
1231 (ior:DI (match_operand:DI 1 "register_operand" "")
1232 (match_operand:DI 2 "register_operand" "")))]
1233 "reload_completed && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
1234 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
1235 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
1236 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
1238 [(set (subreg:SI (match_dup 0) 0) (ior:SI (subreg:SI (match_dup 1) 0) (subreg:SI (match_dup 2) 0)))
1239 (set (subreg:SI (match_dup 0) 1) (ior:SI (subreg:SI (match_dup 1) 1) (subreg:SI (match_dup 2) 1)))]
1242 (define_insn "xorsi3"
1243 [(set (match_operand:SI 0 "register_operand" "=d,d")
1244 (xor:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
1245 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
1250 [(set_attr "type" "arith")
1251 (set_attr "mode" "SI")
1252 (set_attr "length" "1")])
1254 (define_insn "xordi3"
1255 [(set (match_operand:DI 0 "register_operand" "=d")
1256 (xor:DI (match_operand:DI 1 "register_operand" "d")
1257 (match_operand:DI 2 "register_operand" "d")))]
1258 "!TARGET_DEBUG_G_MODE"
1259 "xor\\t%M0,%M1,%M2\;xor\\t%L0,%L1,%L2"
1260 [(set_attr "type" "darith")
1261 (set_attr "mode" "DI")
1262 (set_attr "length" "2")])
1265 [(set (match_operand:DI 0 "register_operand" "")
1266 (xor:DI (match_operand:DI 1 "register_operand" "")
1267 (match_operand:DI 2 "register_operand" "")))]
1268 "reload_completed && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
1269 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
1270 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
1271 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
1273 [(set (subreg:SI (match_dup 0) 0) (xor:SI (subreg:SI (match_dup 1) 0) (subreg:SI (match_dup 2) 0)))
1274 (set (subreg:SI (match_dup 0) 1) (xor:SI (subreg:SI (match_dup 1) 1) (subreg:SI (match_dup 2) 1)))]
1279 ;; ....................
1283 ;; ....................
1285 (define_insn "truncdfsf2"
1286 [(set (match_operand:SF 0 "register_operand" "=f")
1287 (float_truncate:SF (match_operand:DF 1 "register_operand" "f")))]
1290 [(set_attr "type" "fcvt")
1291 (set_attr "mode" "SF")
1292 (set_attr "length" "1")])
1296 ;; ....................
1300 ;; ....................
1303 ;; Those for integer source operand
1304 ;; are ordered widest source type first.
1306 (define_insn "zero_extendhisi2"
1307 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
1308 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "d,R,m")))]
1312 if (which_alternative == 0)
1313 return \"andi\\t%0,%1,0xffff\";
1315 return mips_move_1word (operands, insn, TRUE);
1317 [(set_attr "type" "arith,load,load")
1318 (set_attr "mode" "SI")
1319 (set_attr "length" "1,1,2")])
1321 (define_insn "zero_extendqihi2"
1322 [(set (match_operand:HI 0 "register_operand" "=d,d,d")
1323 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "d,R,m")))]
1327 if (which_alternative == 0)
1328 return \"andi\\t%0,%1,0x00ff\";
1330 return mips_move_1word (operands, insn, TRUE);
1332 [(set_attr "type" "arith,load,load")
1333 (set_attr "mode" "HI")
1334 (set_attr "length" "1,1,2")])
1336 (define_insn "zero_extendqisi2"
1337 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
1338 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "d,R,m")))]
1342 if (which_alternative == 0)
1343 return \"andi\\t%0,%1,0x00ff\";
1345 return mips_move_1word (operands, insn, TRUE);
1347 [(set_attr "type" "arith,load,load")
1348 (set_attr "mode" "SI")
1349 (set_attr "length" "1,1,2")])
1353 ;; ....................
1357 ;; ....................
1360 ;; Those for integer source operand
1361 ;; are ordered widest source type first.
1363 ;; These patterns originally accepted general_operands, however, slightly
1364 ;; better code is generated by only accepting register_operands, and then
1365 ;; letting combine generate the lh and lb insns.
1367 (define_expand "extendhisi2"
1368 [(set (match_operand:SI 0 "register_operand" "")
1369 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
1373 if (optimize && GET_CODE (operands[1]) == MEM)
1374 operands[1] = force_not_mem (operands[1]);
1376 if (GET_CODE (operands[1]) != MEM)
1378 rtx op1 = gen_lowpart (SImode, operands[1]);
1379 rtx temp = gen_reg_rtx (SImode);
1380 rtx shift = gen_rtx (CONST_INT, VOIDmode, 16);
1382 emit_insn (gen_ashlsi3 (temp, op1, shift));
1383 emit_insn (gen_ashrsi3 (operands[0], temp, shift));
1388 (define_insn "extendhisi2_internal"
1389 [(set (match_operand:SI 0 "register_operand" "=d,d")
1390 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,m")))]
1392 "* return mips_move_1word (operands, insn, FALSE);"
1393 [(set_attr "type" "load")
1394 (set_attr "mode" "SI")
1395 (set_attr "length" "1,2")])
1397 (define_expand "extendqihi2"
1398 [(set (match_operand:HI 0 "register_operand" "")
1399 (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))]
1403 if (optimize && GET_CODE (operands[1]) == MEM)
1404 operands[1] = force_not_mem (operands[1]);
1406 if (GET_CODE (operands[1]) != MEM)
1408 rtx op0 = gen_lowpart (SImode, operands[0]);
1409 rtx op1 = gen_lowpart (SImode, operands[1]);
1410 rtx temp = gen_reg_rtx (SImode);
1411 rtx shift = gen_rtx (CONST_INT, VOIDmode, 24);
1413 emit_insn (gen_ashlsi3 (temp, op1, shift));
1414 emit_insn (gen_ashrsi3 (op0, temp, shift));
1419 (define_insn "extendqihi2_internal"
1420 [(set (match_operand:HI 0 "register_operand" "=d,d")
1421 (sign_extend:HI (match_operand:QI 1 "memory_operand" "R,m")))]
1423 "* return mips_move_1word (operands, insn, FALSE);"
1424 [(set_attr "type" "load")
1425 (set_attr "mode" "SI")
1426 (set_attr "length" "1,2")])
1429 (define_expand "extendqisi2"
1430 [(set (match_operand:SI 0 "register_operand" "")
1431 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
1435 if (optimize && GET_CODE (operands[1]) == MEM)
1436 operands[1] = force_not_mem (operands[1]);
1438 if (GET_CODE (operands[1]) != MEM)
1440 rtx op1 = gen_lowpart (SImode, operands[1]);
1441 rtx temp = gen_reg_rtx (SImode);
1442 rtx shift = gen_rtx (CONST_INT, VOIDmode, 24);
1444 emit_insn (gen_ashlsi3 (temp, op1, shift));
1445 emit_insn (gen_ashrsi3 (operands[0], temp, shift));
1450 (define_insn "extendqisi2_insn"
1451 [(set (match_operand:SI 0 "register_operand" "=d,d")
1452 (sign_extend:SI (match_operand:QI 1 "memory_operand" "R,m")))]
1454 "* return mips_move_1word (operands, insn, FALSE);"
1455 [(set_attr "type" "load")
1456 (set_attr "mode" "SI")
1457 (set_attr "length" "1,2")])
1460 (define_insn "extendsfdf2"
1461 [(set (match_operand:DF 0 "register_operand" "=f")
1462 (float_extend:DF (match_operand:SF 1 "register_operand" "f")))]
1465 [(set_attr "type" "fcvt")
1466 (set_attr "mode" "DF")
1467 (set_attr "length" "1")])
1472 ;; ....................
1476 ;; ....................
1478 (define_insn "fix_truncdfsi2"
1479 [(set (match_operand:SI 0 "general_operand" "=d,*f,R,o")
1480 (fix:SI (match_operand:DF 1 "register_operand" "f,*f,f,f")))
1481 (clobber (match_scratch:SI 2 "=d,*d,d,d"))
1482 (clobber (match_scratch:DF 3 "=f,*X,f,f"))]
1488 if (which_alternative == 1)
1489 return \"trunc.w.d %0,%1,%2\";
1491 output_asm_insn (\"trunc.w.d %3,%1,%2\", operands);
1493 xoperands[0] = operands[0];
1494 xoperands[1] = operands[3];
1495 output_asm_insn (mips_move_1word (xoperands, insn, FALSE), xoperands);
1498 [(set_attr "type" "fcvt")
1499 (set_attr "mode" "DF")
1500 (set_attr "length" "11,9,10,11")])
1503 (define_insn "fix_truncsfsi2"
1504 [(set (match_operand:SI 0 "general_operand" "=d,*f,R,o")
1505 (fix:SI (match_operand:SF 1 "register_operand" "f,*f,f,f")))
1506 (clobber (match_scratch:SI 2 "=d,*d,d,d"))
1507 (clobber (match_scratch:SF 3 "=f,*X,f,f"))]
1513 if (which_alternative == 1)
1514 return \"trunc.w.s %0,%1,%2\";
1516 output_asm_insn (\"trunc.w.s %3,%1,%2\", operands);
1518 xoperands[0] = operands[0];
1519 xoperands[1] = operands[3];
1520 output_asm_insn (mips_move_1word (xoperands, insn, FALSE), xoperands);
1523 [(set_attr "type" "fcvt")
1524 (set_attr "mode" "SF")
1525 (set_attr "length" "11,9,10,11")])
1528 (define_insn "floatsidf2"
1529 [(set (match_operand:DF 0 "register_operand" "=f,f,f")
1530 (float:DF (match_operand:SI 1 "nonimmediate_operand" "d,R,m")))]
1534 dslots_load_total++;
1535 if (GET_CODE (operands[1]) == MEM)
1536 return \"l.s\\t%0,%1%#\;cvt.d.w\\t%0,%0\";
1538 return \"mtc1\\t%1,%0%#\;cvt.d.w\\t%0,%0\";
1540 [(set_attr "type" "fcvt")
1541 (set_attr "mode" "DF")
1542 (set_attr "length" "3,4,3")])
1545 (define_insn "floatsisf2"
1546 [(set (match_operand:SF 0 "register_operand" "=f,f,f")
1547 (float:SF (match_operand:SI 1 "nonimmediate_operand" "d,R,m")))]
1551 dslots_load_total++;
1552 if (GET_CODE (operands[1]) == MEM)
1553 return \"l.s\\t%0,%1%#\;cvt.s.w\\t%0,%0\";
1555 return \"mtc1\\t%1,%0%#\;cvt.s.w\\t%0,%0\";
1557 [(set_attr "type" "fcvt")
1558 (set_attr "mode" "SF")
1559 (set_attr "length" "3,4,3")])
1562 (define_expand "fixuns_truncdfsi2"
1563 [(set (match_operand:SI 0 "register_operand" "")
1564 (unsigned_fix:SI (match_operand:DF 1 "register_operand" "")))]
1568 rtx reg1 = gen_reg_rtx (DFmode);
1569 rtx reg2 = gen_reg_rtx (DFmode);
1570 rtx reg3 = gen_reg_rtx (SImode);
1571 rtx label1 = gen_label_rtx ();
1572 rtx label2 = gen_label_rtx ();
1573 REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (1.0, 31);
1575 if (reg1) /* turn off complaints about unreached code */
1577 emit_move_insn (reg1, immed_real_const_1 (offset, DFmode));
1578 do_pending_stack_adjust ();
1580 emit_insn (gen_cmpdf (operands[1], reg1));
1581 emit_jump_insn (gen_bge (label1));
1583 emit_insn (gen_fix_truncdfsi2 (operands[0], operands[1]));
1584 emit_jump_insn (gen_rtx (SET, VOIDmode, pc_rtx,
1585 gen_rtx (LABEL_REF, VOIDmode, label2)));
1588 emit_label (label1);
1589 emit_move_insn (reg2, gen_rtx (MINUS, DFmode, operands[1], reg1));
1590 emit_move_insn (reg3, gen_rtx (CONST_INT, VOIDmode, 0x80000000));
1592 emit_insn (gen_fix_truncdfsi2 (operands[0], reg2));
1593 emit_insn (gen_iorsi3 (operands[0], operands[0], reg3));
1595 emit_label (label2);
1597 /* allow REG_NOTES to be set on last insn (labels don't have enough
1598 fields, and can't be used for REG_NOTES anyway). */
1599 emit_insn (gen_rtx (USE, VOIDmode, stack_pointer_rtx));
1605 (define_expand "fixuns_truncsfsi2"
1606 [(set (match_operand:SI 0 "register_operand" "")
1607 (unsigned_fix:SI (match_operand:SF 1 "register_operand" "")))]
1611 rtx reg1 = gen_reg_rtx (SFmode);
1612 rtx reg2 = gen_reg_rtx (SFmode);
1613 rtx reg3 = gen_reg_rtx (SImode);
1614 rtx label1 = gen_label_rtx ();
1615 rtx label2 = gen_label_rtx ();
1616 REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (1.0, 31);
1618 if (reg1) /* turn off complaints about unreached code */
1620 emit_move_insn (reg1, immed_real_const_1 (offset, SFmode));
1621 do_pending_stack_adjust ();
1623 emit_insn (gen_cmpsf (operands[1], reg1));
1624 emit_jump_insn (gen_bge (label1));
1626 emit_insn (gen_fix_truncsfsi2 (operands[0], operands[1]));
1627 emit_jump_insn (gen_rtx (SET, VOIDmode, pc_rtx,
1628 gen_rtx (LABEL_REF, VOIDmode, label2)));
1631 emit_label (label1);
1632 emit_move_insn (reg2, gen_rtx (MINUS, SFmode, operands[1], reg1));
1633 emit_move_insn (reg3, gen_rtx (CONST_INT, VOIDmode, 0x80000000));
1635 emit_insn (gen_fix_truncsfsi2 (operands[0], reg2));
1636 emit_insn (gen_iorsi3 (operands[0], operands[0], reg3));
1638 emit_label (label2);
1640 /* allow REG_NOTES to be set on last insn (labels don't have enough
1641 fields, and can't be used for REG_NOTES anyway). */
1642 emit_insn (gen_rtx (USE, VOIDmode, stack_pointer_rtx));
1649 ;; ....................
1653 ;; ....................
1655 ;; unaligned word moves generated by the block moves.
1657 (define_expand "movsi_unaligned"
1658 [(set (match_operand:SI 0 "general_operand" "")
1659 (unspec [(match_operand:SI 1 "general_operand" "")] 0))]
1664 if (GET_CODE (operands[0]) == MEM)
1666 rtx reg = gen_reg_rtx (SImode);
1667 rtx insn = emit_insn (gen_movsi_ulw (reg, operands[1]));
1668 rtx addr = XEXP (operands[0], 0);
1669 if (CONSTANT_P (addr))
1670 REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_EQUIV, addr, REG_NOTES (insn));
1672 if (reg_or_0_operand (operands[1], SImode))
1678 /* Generate appropriate load, store. If not a load or store,
1679 do a normal movsi. */
1680 if (GET_CODE (operands[0]) != MEM && GET_CODE (operands[1]) != MEM)
1682 emit_insn (gen_movsi (operands[0], operands[1]));
1686 /* Fall through and generate normal code. */
1689 (define_insn "movsi_ulw"
1690 [(set (match_operand:SI 0 "register_operand" "=&d,&d,d,d")
1691 (unspec [(match_operand:SI 1 "general_operand" "R,o,dIKL,M")] 0))]
1701 if (which_alternative != 0)
1702 return mips_move_1word (operands, insn, FALSE);
1705 mips_count_memory_refs (operands[1], 2);
1707 /* The stack/frame pointers are always aligned, so we can convert
1708 to the faster lw if we are referencing an aligned stack location. */
1710 offset = const0_rtx;
1711 addr = XEXP (operands[1], 0);
1712 mem_addr = eliminate_constant_term (addr, &offset);
1714 if ((INTVAL (offset) & (UNITS_PER_WORD-1)) == 0
1715 && (mem_addr == stack_pointer_rtx || mem_addr == frame_pointer_rtx))
1716 ret = \"lw\\t%0,%1\";
1720 ret = \"ulw\\t%0,%1\";
1723 enum rtx_code code = GET_CODE (addr);
1725 if (code == CONST || code == SYMBOL_REF || code == LABEL_REF)
1727 operands[2] = gen_rtx (REG, SImode, GP_REG_FIRST + 1);
1728 ret = \"%[la\\t%2,%1\;ulw\\t%0,0(%2)%]\";
1733 return mips_fill_delay_slot (ret, DELAY_LOAD, operands, insn);
1735 [(set_attr "type" "load,load,move,arith")
1736 (set_attr "mode" "SI")
1737 (set_attr "length" "2,4,1,2")])
1739 (define_insn "movsi_usw"
1740 [(set (match_operand:SI 0 "memory_operand" "=R,o")
1741 (unspec [(match_operand:SI 1 "reg_or_0_operand" "dJ,dJ")] 0))]
1745 rtx offset = const0_rtx;
1746 rtx addr = XEXP (operands[0], 0);
1747 rtx mem_addr = eliminate_constant_term (addr, &offset);
1750 mips_count_memory_refs (operands[0], 2);
1752 /* The stack/frame pointers are always aligned, so we can convert
1753 to the faster sw if we are referencing an aligned stack location. */
1755 if ((INTVAL (offset) & (UNITS_PER_WORD-1)) == 0
1756 && (mem_addr == stack_pointer_rtx || mem_addr == frame_pointer_rtx))
1757 return \"sw\\t%1,%0\";
1762 enum rtx_code code = GET_CODE (XEXP (operands[0], 0));
1764 if (code == CONST || code == SYMBOL_REF || code == LABEL_REF)
1766 operands[2] = gen_rtx (REG, SImode, GP_REG_FIRST + 1);
1767 return \"%[la\\t%2,%0\;usw\\t%z1,0(%2)%]\";
1771 return \"usw\\t%z1,%0\";
1773 [(set_attr "type" "store")
1774 (set_attr "mode" "SI")
1775 (set_attr "length" "2,4")])
1778 ;; 64-bit integer moves
1780 ;; Unlike most other insns, the move insns can't be split with
1781 ;; different predicates, because register spilling and other parts of
1782 ;; the compiler, have memoized the insn number already.
1784 (define_expand "movdi"
1785 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1786 (match_operand:DI 1 "general_operand" ""))]
1790 if ((reload_in_progress | reload_completed) == 0
1791 && !register_operand (operands[0], DImode)
1792 && !register_operand (operands[1], DImode)
1793 && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 0)
1794 && operands[1] != CONST0_RTX (DImode))
1796 rtx temp = force_reg (DImode, operands[1]);
1797 emit_move_insn (operands[0], temp);
1802 (define_insn "movdi_internal"
1803 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,R,o,*d,*x")
1804 (match_operand:DI 1 "general_operand" "d,iF,R,o,d,d,*x,*d"))]
1805 "register_operand (operands[0], DImode)
1806 || register_operand (operands[1], DImode)
1807 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0)
1808 || operands[1] == CONST0_RTX (DImode)"
1809 "* return mips_move_2words (operands, insn); "
1810 [(set_attr "type" "move,arith,load,load,store,store,hilo,hilo")
1811 (set_attr "mode" "DI")
1812 (set_attr "length" "2,4,2,4,2,4,2,2")])
1815 [(set (match_operand:DI 0 "register_operand" "")
1816 (match_operand:DI 1 "register_operand" ""))]
1817 "reload_completed && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
1818 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
1819 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))"
1821 [(set (subreg:SI (match_dup 0) 0) (subreg:SI (match_dup 1) 0))
1822 (set (subreg:SI (match_dup 0) 1) (subreg:SI (match_dup 1) 1))]
1826 ;; 32-bit Integer moves
1829 [(set (match_operand:SI 0 "register_operand" "")
1830 (match_operand:SI 1 "large_int" ""))]
1831 "!TARGET_DEBUG_D_MODE"
1835 (ior:SI (match_dup 0)
1839 operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) & 0xffff0000);
1840 operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) & 0x0000ffff);
1843 ;; Unlike most other insns, the move insns can't be split with
1844 ;; different predicates, because register spilling and other parts of
1845 ;; the compiler, have memoized the insn number already.
1847 (define_expand "movsi"
1848 [(set (match_operand:SI 0 "nonimmediate_operand" "")
1849 (match_operand:SI 1 "general_operand" ""))]
1853 if ((reload_in_progress | reload_completed) == 0
1854 && !register_operand (operands[0], SImode)
1855 && !register_operand (operands[1], SImode)
1856 && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 0))
1858 rtx temp = force_reg (SImode, operands[1]);
1859 emit_move_insn (operands[0], temp);
1864 ;; The difference between these two is whether or not ints are allowed
1865 ;; in FP registers (off by default, use -mdebugh to enable).
1867 (define_insn "movsi_internal1"
1868 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d,d,R,m,*d,*f*z,*f,*f,*f,*R,*m,*x,*d")
1869 (match_operand:SI 1 "general_operand" "d,S,IKL,Mnis,R,m,dJ,dJ,*f*z,*d,*f,*R,*m,*f,*f,*d,*x"))]
1870 "TARGET_DEBUG_H_MODE
1871 && (register_operand (operands[0], SImode)
1872 || register_operand (operands[1], SImode)
1873 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
1874 "* return mips_move_1word (operands, insn, TRUE);"
1875 [(set_attr "type" "move,load,arith,arith,load,load,store,store,xfer,xfer,move,load,load,store,store,hilo,hilo")
1876 (set_attr "mode" "SI")
1877 (set_attr "length" "1,2,1,2,1,2,1,2,1,1,1,1,2,1,2,1,1")])
1879 (define_insn "movsi_internal2"
1880 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d,d,R,m,*d,*z,*d,*x")
1881 (match_operand:SI 1 "general_operand" "d,S,IKL,Mnis,R,m,dJ,dJ,*z,*d,*x,*d"))]
1882 "!TARGET_DEBUG_H_MODE
1883 && (register_operand (operands[0], SImode)
1884 || register_operand (operands[1], SImode)
1885 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
1886 "* return mips_move_1word (operands, insn, TRUE);"
1887 [(set_attr "type" "move,load,arith,arith,load,load,store,store,xfer,xfer,hilo,hilo")
1888 (set_attr "mode" "SI")
1889 (set_attr "length" "1,2,1,2,1,2,1,2,1,1,1,1")])
1892 ;; 16-bit Integer moves
1894 ;; Unlike most other insns, the move insns can't be split with
1895 ;; different predicates, because register spilling and other parts of
1896 ;; the compiler, have memoized the insn number already.
1897 ;; Unsigned loads are used because BYTE_LOADS_ZERO_EXTEND is defined
1899 (define_expand "movhi"
1900 [(set (match_operand:HI 0 "nonimmediate_operand" "")
1901 (match_operand:HI 1 "general_operand" ""))]
1905 if ((reload_in_progress | reload_completed) == 0
1906 && !register_operand (operands[0], HImode)
1907 && !register_operand (operands[1], HImode)
1908 && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 0))
1910 rtx temp = force_reg (HImode, operands[1]);
1911 emit_move_insn (operands[0], temp);
1916 ;; The difference between these two is whether or not ints are allowed
1917 ;; in FP registers (off by default, use -mdebugh to enable).
1919 (define_insn "movhi_internal1"
1920 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,R,m,*d,*f,*f*z,*x,*d")
1921 (match_operand:HI 1 "general_operand" "d,IK,R,m,dJ,dJ,*f*z,*d,*f,*d,*x"))]
1922 "TARGET_DEBUG_H_MODE
1923 && (register_operand (operands[0], HImode)
1924 || register_operand (operands[1], HImode)
1925 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
1926 "* return mips_move_1word (operands, insn, TRUE);"
1927 [(set_attr "type" "move,arith,load,load,store,store,xfer,xfer,move,hilo,hilo")
1928 (set_attr "mode" "HI")
1929 (set_attr "length" "1,1,1,2,1,2,1,1,1,1,1")])
1931 (define_insn "movhi_internal2"
1932 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,R,m,*d,*z,*x,*d")
1933 (match_operand:HI 1 "general_operand" "d,IK,R,m,dJ,dJ,*z,*d,*d,*x"))]
1934 "!TARGET_DEBUG_H_MODE
1935 && (register_operand (operands[0], HImode)
1936 || register_operand (operands[1], HImode)
1937 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
1938 "* return mips_move_1word (operands, insn, TRUE);"
1939 [(set_attr "type" "move,arith,load,load,store,store,xfer,xfer,hilo,hilo")
1940 (set_attr "mode" "HI")
1941 (set_attr "length" "1,1,1,2,1,2,1,1,1,1")])
1944 ;; 8-bit Integer moves
1946 ;; Unlike most other insns, the move insns can't be split with
1947 ;; different predicates, because register spilling and other parts of
1948 ;; the compiler, have memoized the insn number already.
1949 ;; Unsigned loads are used because BYTE_LOADS_ZERO_EXTEND is defined
1951 (define_expand "movqi"
1952 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1953 (match_operand:QI 1 "general_operand" ""))]
1957 if ((reload_in_progress | reload_completed) == 0
1958 && !register_operand (operands[0], QImode)
1959 && !register_operand (operands[1], QImode)
1960 && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 0))
1962 rtx temp = force_reg (QImode, operands[1]);
1963 emit_move_insn (operands[0], temp);
1968 ;; The difference between these two is whether or not ints are allowed
1969 ;; in FP registers (off by default, use -mdebugh to enable).
1971 (define_insn "movqi_internal1"
1972 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,m,*d,*f*z,*f,*x,*d")
1973 (match_operand:QI 1 "general_operand" "d,IK,R,m,dJ,dJ,*f*z,*d,*f,*d,*x"))]
1974 "TARGET_DEBUG_H_MODE
1975 && (register_operand (operands[0], QImode)
1976 || register_operand (operands[1], QImode)
1977 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
1978 "* return mips_move_1word (operands, insn, TRUE);"
1979 [(set_attr "type" "move,arith,load,load,store,store,xfer,xfer,move,hilo,hilo")
1980 (set_attr "mode" "QI")
1981 (set_attr "length" "1,1,1,2,1,2,1,1,1,1,1")])
1983 (define_insn "movqi_internal2"
1984 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,m,*d,*z,*x,*d")
1985 (match_operand:QI 1 "general_operand" "d,IK,R,m,dJ,dJ,*z,*d,*d,*x"))]
1986 "!TARGET_DEBUG_H_MODE
1987 && (register_operand (operands[0], QImode)
1988 || register_operand (operands[1], QImode)
1989 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
1990 "* return mips_move_1word (operands, insn, TRUE);"
1991 [(set_attr "type" "move,arith,load,load,store,store,xfer,xfer,hilo,hilo")
1992 (set_attr "mode" "QI")
1993 (set_attr "length" "1,1,1,2,1,2,1,1,1,1")])
1996 ;; 32-bit floating point moves
1998 (define_expand "movsf"
1999 [(set (match_operand:SF 0 "nonimmediate_operand" "")
2000 (match_operand:SF 1 "general_operand" ""))]
2004 if ((reload_in_progress | reload_completed) == 0
2005 && !register_operand (operands[0], SFmode)
2006 && !register_operand (operands[1], SFmode)
2007 && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 0)
2008 && operands[1] != CONST0_RTX (SFmode))
2010 rtx temp = force_reg (SFmode, operands[1]);
2011 emit_move_insn (operands[0], temp);
2016 (define_insn "movsf_internal1"
2017 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,f,f,R,m,*f,*d,*d,*d,*d,*R,*m")
2018 (match_operand:SF 1 "general_operand" "f,G,R,Em,fG,fG,*d,*f,*G*d,*R,*E*m,*d,*d"))]
2020 && (register_operand (operands[0], SFmode)
2021 || register_operand (operands[1], SFmode)
2022 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0)
2023 || operands[1] == CONST0_RTX (SFmode))"
2024 "* return mips_move_1word (operands, insn, FALSE);"
2025 [(set_attr "type" "move,xfer,load,load,store,store,xfer,xfer,move,load,load,store,store")
2026 (set_attr "mode" "SF")
2027 (set_attr "length" "1,1,1,2,1,2,1,1,1,1,2,1,2")])
2030 (define_insn "movsf_internal2"
2031 [(set (match_operand:SF 0 "nonimmediate_operand" "=d,d,d,R,m")
2032 (match_operand:SF 1 "general_operand" " Gd,R,Em,d,d"))]
2034 && (register_operand (operands[0], SFmode)
2035 || register_operand (operands[1], SFmode)
2036 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0)
2037 || operands[1] == CONST0_RTX (SFmode))"
2038 "* return mips_move_1word (operands, insn, FALSE);"
2039 [(set_attr "type" "move,load,load,store,store")
2040 (set_attr "mode" "SF")
2041 (set_attr "length" "1,1,2,1,2")])
2044 ;; 64-bit floating point moves
2046 (define_expand "movdf"
2047 [(set (match_operand:DF 0 "nonimmediate_operand" "")
2048 (match_operand:DF 1 "general_operand" ""))]
2052 if ((reload_in_progress | reload_completed) == 0
2053 && !register_operand (operands[0], DFmode)
2054 && !register_operand (operands[1], DFmode)
2055 && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 0)
2056 && operands[1] != CONST0_RTX (DFmode))
2058 rtx temp = force_reg (DFmode, operands[1]);
2059 emit_move_insn (operands[0], temp);
2064 (define_insn "movdf_internal1"
2065 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,o,f,*f,*d,*d,*d,*d,*R,*o")
2066 (match_operand:DF 1 "general_operand" "f,R,o,fG,fG,E,*d,*f,*d*G,*R,*o*E,*d,*d"))]
2068 && (register_operand (operands[0], DFmode)
2069 || register_operand (operands[1], DFmode)
2070 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0)
2071 || operands[1] == CONST0_RTX (DFmode))"
2072 "* return mips_move_2words (operands, insn); "
2073 [(set_attr "type" "move,load,load,store,store,load,xfer,xfer,move,load,load,store,store")
2074 (set_attr "mode" "DF")
2075 (set_attr "length" "1,2,4,2,4,4,2,2,2,2,4,2,4")])
2077 (define_insn "movdf_internal2"
2078 [(set (match_operand:DF 0 "nonimmediate_operand" "=d,d,d,R,o")
2079 (match_operand:DF 1 "general_operand" "dG,R,oE,d,d"))]
2081 && (register_operand (operands[0], DFmode)
2082 || register_operand (operands[1], DFmode)
2083 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0)
2084 || operands[1] == CONST0_RTX (DFmode))"
2085 "* return mips_move_2words (operands, insn); "
2086 [(set_attr "type" "move,load,load,store,store")
2087 (set_attr "mode" "DF")
2088 (set_attr "length" "2,2,4,2,4")])
2091 [(set (match_operand:DF 0 "register_operand" "")
2092 (match_operand:DF 1 "register_operand" ""))]
2093 "reload_completed && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
2094 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
2095 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))"
2097 [(set (subreg:SI (match_dup 0) 0) (subreg:SI (match_dup 1) 0))
2098 (set (subreg:SI (match_dup 0) 1) (subreg:SI (match_dup 1) 1))]
2102 ;; Block moves, see mips.c for more details.
2103 ;; Argument 0 is the destination
2104 ;; Argument 1 is the source
2105 ;; Argument 2 is the length
2106 ;; Argument 3 is the alignment
2108 (define_expand "movstrsi"
2109 [(parallel [(set (mem:BLK (match_operand:BLK 0 "general_operand" ""))
2110 (mem:BLK (match_operand:BLK 1 "general_operand" "")))
2111 (use (match_operand:SI 2 "arith32_operand" ""))
2112 (use (match_operand:SI 3 "immediate_operand" ""))])]
2116 if (operands[0]) /* avoid unused code messages */
2118 expand_block_move (operands);
2123 ;; Insn generated by block moves
2125 (define_insn "movstrsi_internal"
2126 [(set (match_operand:BLK 0 "memory_operand" "=Ro") ;; destination
2127 (match_operand:BLK 1 "memory_operand" "Ro")) ;; source
2128 (clobber (match_scratch:SI 4 "=&d")) ;; temp 1
2129 (clobber (match_scratch:SI 5 "=&d")) ;; temp 2
2130 (clobber (match_scratch:SI 6 "=&d")) ;; temp 3
2131 (clobber (match_scratch:SI 7 "=&d")) ;; temp 4
2132 (use (match_operand:SI 2 "small_int" "I")) ;; # bytes to move
2133 (use (match_operand:SI 3 "small_int" "I")) ;; alignment
2134 (use (const_int 0))] ;; normal block move
2136 "* return output_block_move (insn, operands, 4, BLOCK_MOVE_NORMAL);"
2137 [(set_attr "type" "multi")
2138 (set_attr "mode" "none")
2139 (set_attr "length" "20")])
2141 ;; Split a block move into 2 parts, the first part is everything
2142 ;; except for the last move, and the second part is just the last
2143 ;; store, which is exactly 1 instruction (ie, not a usw), so it can
2144 ;; fill a delay slot. This also prevents a bug in delayed branches
2145 ;; from showing up, which reuses one of the registers in our clobbers.
2148 [(set (mem:BLK (match_operand:SI 0 "register_operand" ""))
2149 (mem:BLK (match_operand:SI 1 "register_operand" "")))
2150 (clobber (match_operand:SI 4 "register_operand" ""))
2151 (clobber (match_operand:SI 5 "register_operand" ""))
2152 (clobber (match_operand:SI 6 "register_operand" ""))
2153 (clobber (match_operand:SI 7 "register_operand" ""))
2154 (use (match_operand:SI 2 "small_int" ""))
2155 (use (match_operand:SI 3 "small_int" ""))
2156 (use (const_int 0))]
2158 "reload_completed && !TARGET_DEBUG_D_MODE && INTVAL (operands[2]) > 0"
2160 ;; All but the last move
2161 [(parallel [(set (mem:BLK (match_dup 0))
2162 (mem:BLK (match_dup 1)))
2163 (clobber (match_dup 4))
2164 (clobber (match_dup 5))
2165 (clobber (match_dup 6))
2166 (clobber (match_dup 7))
2169 (use (const_int 1))])
2171 ;; The last store, so it can fill a delay slot
2172 (parallel [(set (mem:BLK (match_dup 0))
2173 (mem:BLK (match_dup 1)))
2174 (clobber (match_dup 4))
2175 (clobber (match_dup 5))
2176 (clobber (match_dup 6))
2177 (clobber (match_dup 7))
2180 (use (const_int 2))])]
2184 (define_insn "movstrsi_internal2"
2185 [(set (match_operand:BLK 0 "memory_operand" "=Ro") ;; destination
2186 (match_operand:BLK 1 "memory_operand" "Ro")) ;; source
2187 (clobber (match_scratch:SI 4 "=&d")) ;; temp 1
2188 (clobber (match_scratch:SI 5 "=&d")) ;; temp 2
2189 (clobber (match_scratch:SI 6 "=&d")) ;; temp 3
2190 (clobber (match_scratch:SI 7 "=&d")) ;; temp 4
2191 (use (match_operand:SI 2 "small_int" "I")) ;; # bytes to move
2192 (use (match_operand:SI 3 "small_int" "I")) ;; alignment
2193 (use (const_int 1))] ;; all but last store
2195 "* return output_block_move (insn, operands, 4, BLOCK_MOVE_NOT_LAST);"
2196 [(set_attr "type" "multi")
2197 (set_attr "mode" "none")
2198 (set_attr "length" "20")])
2200 (define_insn "movstrsi_internal3"
2201 [(set (match_operand:BLK 0 "memory_operand" "=Ro") ;; destination
2202 (match_operand:BLK 1 "memory_operand" "Ro")) ;; source
2203 (clobber (match_scratch:SI 4 "=&d")) ;; temp 1
2204 (clobber (match_scratch:SI 5 "=&d")) ;; temp 2
2205 (clobber (match_scratch:SI 6 "=&d")) ;; temp 3
2206 (clobber (match_scratch:SI 7 "=&d")) ;; temp 4
2207 (use (match_operand:SI 2 "small_int" "I")) ;; # bytes to move
2208 (use (match_operand:SI 3 "small_int" "I")) ;; alignment
2209 (use (const_int 2))] ;; just last store of block mvoe
2211 "* return output_block_move (insn, operands, 4, BLOCK_MOVE_LAST);"
2212 [(set_attr "type" "store")
2213 (set_attr "mode" "none")
2214 (set_attr "length" "1")])
2218 ;; ....................
2222 ;; ....................
2224 (define_insn "ashlsi3"
2225 [(set (match_operand:SI 0 "register_operand" "=d")
2226 (ashift:SI (match_operand:SI 1 "register_operand" "d")
2227 (match_operand:SI 2 "arith_operand" "dI")))]
2231 if (GET_CODE (operands[2]) == CONST_INT)
2232 operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);
2234 return \"sll\\t%0,%1,%2\";
2236 [(set_attr "type" "arith")
2237 (set_attr "mode" "SI")
2238 (set_attr "length" "1")])
2241 (define_expand "ashldi3"
2242 [(parallel [(set (match_operand:DI 0 "register_operand" "")
2243 (ashift:DI (match_operand:DI 1 "register_operand" "")
2244 (match_operand:SI 2 "arith_operand" "")))
2245 (clobber (match_dup 3))])]
2246 "!TARGET_DEBUG_G_MODE"
2247 "operands[3] = gen_reg_rtx (SImode);")
2250 (define_insn "ashldi3_internal"
2251 [(set (match_operand:DI 0 "register_operand" "=&d")
2252 (ashift:DI (match_operand:DI 1 "register_operand" "d")
2253 (match_operand:SI 2 "register_operand" "d")))
2254 (clobber (match_operand:SI 3 "register_operand" "=d"))]
2255 "!TARGET_DEBUG_G_MODE"
2258 operands[4] = const0_rtx;
2259 dslots_jump_total += 3;
2260 dslots_jump_filled += 2;
2262 return \"sll\\t%3,%2,26\\n\\
2263 \\tbgez\\t%3,1f\\n\\
2264 \\tsll\\t%M0,%L1,%2\\n\\
2266 \\tmove\\t%L0,%z4%)\\n\\
2269 \\t%(beq\\t%3,%z4,2f\\n\\
2270 \\tsll\\t%M0,%M1,%2%)\\n\\
2272 \\tsubu\\t%3,%z4,%2\\n\\
2273 \\tsrl\\t%3,%L1,%3\\n\\
2274 \\tor\\t%M0,%M0,%3\\n\\
2276 \\tsll\\t%L0,%L1,%2\\n\\
2279 [(set_attr "type" "darith")
2280 (set_attr "mode" "SI")
2281 (set_attr "length" "12")])
2284 (define_insn "ashldi3_internal2"
2285 [(set (match_operand:DI 0 "register_operand" "=d")
2286 (ashift:DI (match_operand:DI 1 "register_operand" "d")
2287 (match_operand:SI 2 "small_int" "IJK")))
2288 (clobber (match_operand:SI 3 "register_operand" "=d"))]
2289 "!TARGET_DEBUG_G_MODE && (INTVAL (operands[2]) & 32) != 0"
2292 operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);
2293 operands[4] = const0_rtx;
2294 return \"sll\\t%M0,%L1,%2\;move\\t%L0,%z4\";
2296 [(set_attr "type" "darith")
2297 (set_attr "mode" "DI")
2298 (set_attr "length" "2")])
2302 [(set (match_operand:DI 0 "register_operand" "")
2303 (ashift:DI (match_operand:DI 1 "register_operand" "")
2304 (match_operand:SI 2 "small_int" "")))
2305 (clobber (match_operand:SI 3 "register_operand" ""))]
2306 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
2307 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
2308 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
2309 && (INTVAL (operands[2]) & 32) != 0"
2311 [(set (subreg:SI (match_dup 0) 1) (ashift:SI (subreg:SI (match_dup 1) 0) (match_dup 2)))
2312 (set (subreg:SI (match_dup 0) 0) (const_int 0))]
2314 "operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);")
2318 [(set (match_operand:DI 0 "register_operand" "")
2319 (ashift:DI (match_operand:DI 1 "register_operand" "")
2320 (match_operand:SI 2 "small_int" "")))
2321 (clobber (match_operand:SI 3 "register_operand" ""))]
2322 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
2323 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
2324 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
2325 && (INTVAL (operands[2]) & 32) != 0"
2327 [(set (subreg:SI (match_dup 0) 0) (ashift:SI (subreg:SI (match_dup 1) 1) (match_dup 2)))
2328 (set (subreg:SI (match_dup 0) 1) (const_int 0))]
2330 "operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);")
2333 (define_insn "ashldi3_internal3"
2334 [(set (match_operand:DI 0 "register_operand" "=d")
2335 (ashift:DI (match_operand:DI 1 "register_operand" "d")
2336 (match_operand:SI 2 "small_int" "IJK")))
2337 (clobber (match_operand:SI 3 "register_operand" "=d"))]
2338 "!TARGET_DEBUG_G_MODE
2339 && (INTVAL (operands[2]) & 63) < 32
2340 && (INTVAL (operands[2]) & 63) != 0"
2343 int amount = INTVAL (operands[2]);
2345 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
2346 operands[4] = const0_rtx;
2347 operands[5] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
2349 return \"sll\\t%M0,%M1,%2\;srl\\t%3,%L1,%5\;or\\t%M0,%M0,%3\;sll\\t%L0,%L1,%2\";
2351 [(set_attr "type" "darith")
2352 (set_attr "mode" "DI")
2353 (set_attr "length" "4")])
2357 [(set (match_operand:DI 0 "register_operand" "")
2358 (ashift:DI (match_operand:DI 1 "register_operand" "")
2359 (match_operand:SI 2 "small_int" "")))
2360 (clobber (match_operand:SI 3 "register_operand" ""))]
2361 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
2362 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
2363 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
2364 && (INTVAL (operands[2]) & 63) < 32
2365 && (INTVAL (operands[2]) & 63) != 0"
2367 [(set (subreg:SI (match_dup 0) 1)
2368 (ashift:SI (subreg:SI (match_dup 1) 1)
2372 (lshiftrt:SI (subreg:SI (match_dup 1) 0)
2375 (set (subreg:SI (match_dup 0) 1)
2376 (ior:SI (subreg:SI (match_dup 0) 1)
2379 (set (subreg:SI (match_dup 0) 0)
2380 (ashift:SI (subreg:SI (match_dup 1) 0)
2384 int amount = INTVAL (operands[2]);
2385 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
2386 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
2391 [(set (match_operand:DI 0 "register_operand" "")
2392 (ashift:DI (match_operand:DI 1 "register_operand" "")
2393 (match_operand:SI 2 "small_int" "")))
2394 (clobber (match_operand:SI 3 "register_operand" ""))]
2395 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
2396 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
2397 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
2398 && (INTVAL (operands[2]) & 63) < 32
2399 && (INTVAL (operands[2]) & 63) != 0"
2401 [(set (subreg:SI (match_dup 0) 0)
2402 (ashift:SI (subreg:SI (match_dup 1) 0)
2406 (lshiftrt:SI (subreg:SI (match_dup 1) 1)
2409 (set (subreg:SI (match_dup 0) 0)
2410 (ior:SI (subreg:SI (match_dup 0) 0)
2413 (set (subreg:SI (match_dup 0) 1)
2414 (ashift:SI (subreg:SI (match_dup 1) 1)
2418 int amount = INTVAL (operands[2]);
2419 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
2420 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
2424 (define_insn "ashrsi3"
2425 [(set (match_operand:SI 0 "register_operand" "=d")
2426 (ashiftrt:SI (match_operand:SI 1 "register_operand" "d")
2427 (match_operand:SI 2 "arith_operand" "dI")))]
2431 if (GET_CODE (operands[2]) == CONST_INT)
2432 operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);
2434 return \"sra\\t%0,%1,%2\";
2436 [(set_attr "type" "arith")
2437 (set_attr "mode" "SI")
2438 (set_attr "length" "1")])
2441 (define_expand "ashrdi3"
2442 [(parallel [(set (match_operand:DI 0 "register_operand" "")
2443 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
2444 (match_operand:SI 2 "arith_operand" "")))
2445 (clobber (match_dup 3))])]
2446 "!TARGET_DEBUG_G_MODE"
2447 "operands[3] = gen_reg_rtx (SImode);")
2450 (define_insn "ashrdi3_internal"
2451 [(set (match_operand:DI 0 "register_operand" "=&d")
2452 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
2453 (match_operand:SI 2 "register_operand" "d")))
2454 (clobber (match_operand:SI 3 "register_operand" "=d"))]
2455 "!TARGET_DEBUG_G_MODE"
2458 operands[4] = const0_rtx;
2459 dslots_jump_total += 3;
2460 dslots_jump_filled += 2;
2462 return \"sll\\t%3,%2,26\\n\\
2463 \\tbgez\\t%3,1f\\n\\
2464 \\tsra\\t%L0,%M1,%2\\n\\
2466 \\tsra\\t%M0,%M1,31%)\\n\\
2469 \\t%(beq\\t%3,%z4,2f\\n\\
2470 \\tsrl\\t%L0,%L1,%2%)\\n\\
2472 \\tsubu\\t%3,%z4,%2\\n\\
2473 \\tsll\\t%3,%M1,%3\\n\\
2474 \\tor\\t%L0,%L0,%3\\n\\
2476 \\tsra\\t%M0,%M1,%2\\n\\
2479 [(set_attr "type" "darith")
2480 (set_attr "mode" "DI")
2481 (set_attr "length" "12")])
2484 (define_insn "ashrdi3_internal2"
2485 [(set (match_operand:DI 0 "register_operand" "=d")
2486 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
2487 (match_operand:SI 2 "small_int" "IJK")))
2488 (clobber (match_operand:SI 3 "register_operand" "=d"))]
2489 "!TARGET_DEBUG_G_MODE && (INTVAL (operands[2]) & 32) != 0"
2492 operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);
2493 return \"sra\\t%L0,%M1,%2\;sra\\t%M0,%M1,31\";
2495 [(set_attr "type" "darith")
2496 (set_attr "mode" "DI")
2497 (set_attr "length" "2")])
2501 [(set (match_operand:DI 0 "register_operand" "")
2502 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
2503 (match_operand:SI 2 "small_int" "")))
2504 (clobber (match_operand:SI 3 "register_operand" ""))]
2505 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
2506 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
2507 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
2508 && (INTVAL (operands[2]) & 32) != 0"
2510 [(set (subreg:SI (match_dup 0) 0) (ashiftrt:SI (subreg:SI (match_dup 1) 1) (match_dup 2)))
2511 (set (subreg:SI (match_dup 0) 1) (ashiftrt:SI (subreg:SI (match_dup 1) 1) (const_int 31)))]
2513 "operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);")
2517 [(set (match_operand:DI 0 "register_operand" "")
2518 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
2519 (match_operand:SI 2 "small_int" "")))
2520 (clobber (match_operand:SI 3 "register_operand" ""))]
2521 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
2522 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
2523 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
2524 && (INTVAL (operands[2]) & 32) != 0"
2526 [(set (subreg:SI (match_dup 0) 1) (ashiftrt:SI (subreg:SI (match_dup 1) 0) (match_dup 2)))
2527 (set (subreg:SI (match_dup 0) 0) (ashiftrt:SI (subreg:SI (match_dup 1) 0) (const_int 31)))]
2529 "operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);")
2532 (define_insn "ashrdi3_internal3"
2533 [(set (match_operand:DI 0 "register_operand" "=d")
2534 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
2535 (match_operand:SI 2 "small_int" "IJK")))
2536 (clobber (match_operand:SI 3 "register_operand" "=d"))]
2537 "!TARGET_DEBUG_G_MODE
2538 && (INTVAL (operands[2]) & 63) < 32
2539 && (INTVAL (operands[2]) & 63) != 0"
2542 int amount = INTVAL (operands[2]);
2544 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
2545 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
2547 return \"srl\\t%L0,%L1,%2\;sll\\t%3,%M1,%4\;or\\t%L0,%L0,%3\;sra\\t%M0,%M1,%2\";
2549 [(set_attr "type" "darith")
2550 (set_attr "mode" "DI")
2551 (set_attr "length" "4")])
2555 [(set (match_operand:DI 0 "register_operand" "")
2556 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
2557 (match_operand:SI 2 "small_int" "")))
2558 (clobber (match_operand:SI 3 "register_operand" ""))]
2559 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
2560 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
2561 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
2562 && (INTVAL (operands[2]) & 63) < 32
2563 && (INTVAL (operands[2]) & 63) != 0"
2565 [(set (subreg:SI (match_dup 0) 0)
2566 (lshiftrt:SI (subreg:SI (match_dup 1) 0)
2570 (ashift:SI (subreg:SI (match_dup 1) 1)
2573 (set (subreg:SI (match_dup 0) 0)
2574 (ior:SI (subreg:SI (match_dup 0) 0)
2577 (set (subreg:SI (match_dup 0) 1)
2578 (ashiftrt:SI (subreg:SI (match_dup 1) 1)
2582 int amount = INTVAL (operands[2]);
2583 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
2584 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
2589 [(set (match_operand:DI 0 "register_operand" "")
2590 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
2591 (match_operand:SI 2 "small_int" "")))
2592 (clobber (match_operand:SI 3 "register_operand" ""))]
2593 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
2594 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
2595 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
2596 && (INTVAL (operands[2]) & 63) < 32
2597 && (INTVAL (operands[2]) & 63) != 0"
2599 [(set (subreg:SI (match_dup 0) 1)
2600 (lshiftrt:SI (subreg:SI (match_dup 1) 1)
2604 (ashift:SI (subreg:SI (match_dup 1) 0)
2607 (set (subreg:SI (match_dup 0) 1)
2608 (ior:SI (subreg:SI (match_dup 0) 1)
2611 (set (subreg:SI (match_dup 0) 0)
2612 (ashiftrt:SI (subreg:SI (match_dup 1) 0)
2616 int amount = INTVAL (operands[2]);
2617 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
2618 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
2622 (define_insn "lshrsi3"
2623 [(set (match_operand:SI 0 "register_operand" "=d")
2624 (lshiftrt:SI (match_operand:SI 1 "register_operand" "d")
2625 (match_operand:SI 2 "arith_operand" "dI")))]
2629 if (GET_CODE (operands[2]) == CONST_INT)
2630 operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);
2632 return \"srl\\t%0,%1,%2\";
2634 [(set_attr "type" "arith")
2635 (set_attr "mode" "SI")
2636 (set_attr "length" "1")])
2639 (define_expand "lshrdi3"
2640 [(parallel [(set (match_operand:DI 0 "register_operand" "")
2641 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
2642 (match_operand:SI 2 "arith_operand" "")))
2643 (clobber (match_dup 3))])]
2644 "!TARGET_DEBUG_G_MODE"
2645 "operands[3] = gen_reg_rtx (SImode);")
2648 (define_insn "lshrdi3_internal"
2649 [(set (match_operand:DI 0 "register_operand" "=&d")
2650 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
2651 (match_operand:SI 2 "register_operand" "d")))
2652 (clobber (match_operand:SI 3 "register_operand" "=d"))]
2653 "!TARGET_DEBUG_G_MODE"
2656 operands[4] = const0_rtx;
2657 dslots_jump_total += 3;
2658 dslots_jump_filled += 2;
2660 return \"sll\\t%3,%2,26\\n\\
2661 \\tbgez\\t%3,1f\\n\\
2662 \\tsrl\\t%L0,%M1,%2\\n\\
2664 \\tmove\\t%M0,%z4%)\\n\\
2667 \\t%(beq\\t%3,%z4,2f\\n\\
2668 \\tsrl\\t%L0,%L1,%2%)\\n\\
2670 \\tsubu\\t%3,%z4,%2\\n\\
2671 \\tsll\\t%3,%M1,%3\\n\\
2672 \\tor\\t%L0,%L0,%3\\n\\
2674 \\tsrl\\t%M0,%M1,%2\\n\\
2677 [(set_attr "type" "darith")
2678 (set_attr "mode" "DI")
2679 (set_attr "length" "12")])
2682 (define_insn "lshrdi3_internal2"
2683 [(set (match_operand:DI 0 "register_operand" "=d")
2684 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
2685 (match_operand:SI 2 "small_int" "IJK")))
2686 (clobber (match_operand:SI 3 "register_operand" "=d"))]
2687 "!TARGET_DEBUG_G_MODE && (INTVAL (operands[2]) & 32) != 0"
2690 operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);
2691 operands[4] = const0_rtx;
2692 return \"srl\\t%L0,%M1,%2\;move\\t%M0,%z4\";
2694 [(set_attr "type" "darith")
2695 (set_attr "mode" "DI")
2696 (set_attr "length" "2")])
2700 [(set (match_operand:DI 0 "register_operand" "")
2701 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
2702 (match_operand:SI 2 "small_int" "")))
2703 (clobber (match_operand:SI 3 "register_operand" ""))]
2704 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
2705 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
2706 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
2707 && (INTVAL (operands[2]) & 32) != 0"
2709 [(set (subreg:SI (match_dup 0) 0) (lshiftrt:SI (subreg:SI (match_dup 1) 1) (match_dup 2)))
2710 (set (subreg:SI (match_dup 0) 1) (const_int 0))]
2712 "operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);")
2716 [(set (match_operand:DI 0 "register_operand" "")
2717 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
2718 (match_operand:SI 2 "small_int" "")))
2719 (clobber (match_operand:SI 3 "register_operand" ""))]
2720 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
2721 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
2722 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
2723 && (INTVAL (operands[2]) & 32) != 0"
2725 [(set (subreg:SI (match_dup 0) 1) (lshiftrt:SI (subreg:SI (match_dup 1) 0) (match_dup 2)))
2726 (set (subreg:SI (match_dup 0) 0) (const_int 0))]
2728 "operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);")
2731 (define_insn "lshrdi3_internal3"
2732 [(set (match_operand:DI 0 "register_operand" "=d")
2733 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
2734 (match_operand:SI 2 "small_int" "IJK")))
2735 (clobber (match_operand:SI 3 "register_operand" "=d"))]
2736 "!TARGET_DEBUG_G_MODE
2737 && (INTVAL (operands[2]) & 63) < 32
2738 && (INTVAL (operands[2]) & 63) != 0"
2741 int amount = INTVAL (operands[2]);
2743 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
2744 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
2746 return \"srl\\t%L0,%L1,%2\;sll\\t%3,%M1,%4\;or\\t%L0,%L0,%3\;srl\\t%M0,%M1,%2\";
2748 [(set_attr "type" "darith")
2749 (set_attr "mode" "DI")
2750 (set_attr "length" "4")])
2754 [(set (match_operand:DI 0 "register_operand" "")
2755 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
2756 (match_operand:SI 2 "small_int" "")))
2757 (clobber (match_operand:SI 3 "register_operand" ""))]
2758 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
2759 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
2760 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
2761 && (INTVAL (operands[2]) & 63) < 32
2762 && (INTVAL (operands[2]) & 63) != 0"
2764 [(set (subreg:SI (match_dup 0) 0)
2765 (lshiftrt:SI (subreg:SI (match_dup 1) 0)
2769 (ashift:SI (subreg:SI (match_dup 1) 1)
2772 (set (subreg:SI (match_dup 0) 0)
2773 (ior:SI (subreg:SI (match_dup 0) 0)
2776 (set (subreg:SI (match_dup 0) 1)
2777 (lshiftrt:SI (subreg:SI (match_dup 1) 1)
2781 int amount = INTVAL (operands[2]);
2782 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
2783 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
2788 [(set (match_operand:DI 0 "register_operand" "")
2789 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
2790 (match_operand:SI 2 "small_int" "")))
2791 (clobber (match_operand:SI 3 "register_operand" ""))]
2792 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
2793 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
2794 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
2795 && (INTVAL (operands[2]) & 63) < 32
2796 && (INTVAL (operands[2]) & 63) != 0"
2798 [(set (subreg:SI (match_dup 0) 1)
2799 (lshiftrt:SI (subreg:SI (match_dup 1) 1)
2803 (ashift:SI (subreg:SI (match_dup 1) 0)
2806 (set (subreg:SI (match_dup 0) 1)
2807 (ior:SI (subreg:SI (match_dup 0) 1)
2810 (set (subreg:SI (match_dup 0) 0)
2811 (lshiftrt:SI (subreg:SI (match_dup 1) 0)
2815 int amount = INTVAL (operands[2]);
2816 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
2817 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
2822 ;; ....................
2826 ;; ....................
2828 ;; Flow here is rather complex:
2830 ;; 1) The cmp{si,sf,df} routine is called. It deposits the
2831 ;; arguments into the branch_cmp array, and the type into
2832 ;; branch_type. No RTL is generated.
2834 ;; 2) The appropriate branch define_expand is called, which then
2835 ;; creates the appropriate RTL for the comparison and branch.
2836 ;; Different CC modes are used, based on what type of branch is
2837 ;; done, so that we can constrain things appropriately. There
2838 ;; are assumptions in the rest of GCC that break if we fold the
2839 ;; operands into the branchs for integer operations, and use cc0
2840 ;; for floating point, so we use the fp status register instead.
2841 ;; If needed, an appropriate temporary is created to hold the
2842 ;; of the integer compare.
2844 (define_expand "cmpsi"
2846 (compare:CC (match_operand:SI 0 "register_operand" "")
2847 (match_operand:SI 1 "arith_operand" "")))]
2851 if (operands[0]) /* avoid unused code message */
2853 branch_cmp[0] = operands[0];
2854 branch_cmp[1] = operands[1];
2855 branch_type = CMP_SI;
2860 (define_expand "tstsi"
2862 (match_operand:SI 0 "register_operand" ""))]
2866 if (operands[0]) /* avoid unused code message */
2868 branch_cmp[0] = operands[0];
2869 branch_cmp[1] = const0_rtx;
2870 branch_type = CMP_SI;
2875 (define_expand "cmpdf"
2877 (compare:CC_FP (match_operand:DF 0 "register_operand" "")
2878 (match_operand:DF 1 "register_operand" "")))]
2882 if (operands[0]) /* avoid unused code message */
2884 branch_cmp[0] = operands[0];
2885 branch_cmp[1] = operands[1];
2886 branch_type = CMP_DF;
2891 (define_expand "cmpsf"
2893 (compare:CC_FP (match_operand:SF 0 "register_operand" "")
2894 (match_operand:SF 1 "register_operand" "")))]
2898 if (operands[0]) /* avoid unused code message */
2900 branch_cmp[0] = operands[0];
2901 branch_cmp[1] = operands[1];
2902 branch_type = CMP_SF;
2909 ;; ....................
2911 ;; CONDITIONAL BRANCHES
2913 ;; ....................
2915 (define_insn "branch_fp_ne"
2917 (if_then_else (ne:CC_FP (reg:CC_FP 66)
2919 (match_operand 0 "pc_or_label_operand" "")
2920 (match_operand 1 "pc_or_label_operand" "")))]
2924 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
2925 return (operands[0] != pc_rtx) ? \"%*bc1t%?\\t%0\" : \"%*bc1f%?\\t%1\";
2927 [(set_attr "type" "branch")
2928 (set_attr "mode" "none")
2929 (set_attr "length" "1")])
2931 (define_insn "branch_fp_ne_rev"
2933 (if_then_else (ne:CC_REV_FP (reg:CC_REV_FP 66)
2935 (match_operand 0 "pc_or_label_operand" "")
2936 (match_operand 1 "pc_or_label_operand" "")))]
2940 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
2941 return (operands[0] != pc_rtx) ? \"%*bc1f%?\\t%0\" : \"%*bc1t%?\\t%1\";
2943 [(set_attr "type" "branch")
2944 (set_attr "mode" "none")
2945 (set_attr "length" "1")])
2947 (define_insn "branch_fp_eq"
2949 (if_then_else (eq:CC_FP (reg:CC_FP 66)
2951 (match_operand 0 "pc_or_label_operand" "")
2952 (match_operand 1 "pc_or_label_operand" "")))]
2956 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
2957 return (operands[0] != pc_rtx) ? \"%*bc1f%?\\t%0\" : \"%*bc1t%?\\t%1\";
2959 [(set_attr "type" "branch")
2960 (set_attr "mode" "none")
2961 (set_attr "length" "1")])
2963 (define_insn "branch_fp_eq_rev"
2965 (if_then_else (eq:CC_REV_FP (reg:CC_REV_FP 66)
2967 (match_operand 0 "pc_or_label_operand" "")
2968 (match_operand 1 "pc_or_label_operand" "")))]
2972 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
2973 return (operands[0] != pc_rtx) ? \"%*bc1t%?\\t%0\" : \"%*bc1f%?\\t%1\";
2975 [(set_attr "type" "branch")
2976 (set_attr "mode" "none")
2977 (set_attr "length" "1")])
2980 (define_insn "branch_zero"
2982 (if_then_else (match_operator:SI 0 "cmp_op"
2983 [(match_operand:SI 1 "register_operand" "d")
2985 (match_operand 2 "pc_or_label_operand" "")
2986 (match_operand 3 "pc_or_label_operand" "")))]
2990 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
2991 if (operands[2] != pc_rtx)
2993 switch (GET_CODE (operands[0]))
2995 case EQ: return \"%*beq%?\\t%z1,%.,%2\";
2996 case NE: return \"%*bne%?\\t%z1,%.,%2\";
2997 case GTU: return \"%*bne%?\\t%z1,%.,%2\";
2998 case LEU: return \"%*beq%?\\t%z1,%.,%2\";
2999 case GEU: return \"%*j\\t%2\";
3000 case LTU: return \"%*bne%?\\t%.,%.,%2\";
3003 return \"%*b%C0z%?\\t%z1,%2\";
3006 { /* inverted jump */
3007 switch (GET_CODE (operands[0]))
3009 case EQ: return \"%*bne%?\\t%z1,%.,%3\";
3010 case NE: return \"%*beq%?\\t%z1,%.,%3\";
3011 case GTU: return \"%*beq%?\\t%z1,%.,%3\";
3012 case LEU: return \"%*bne%?\\t%z1,%.,%3\";
3013 case GEU: return \"%*beq%?\\t%.,%.,%3\";
3014 case LTU: return \"%*j\\t%3\";
3017 return \"%*b%N0z%?\\t%z1,%3\";
3020 [(set_attr "type" "branch")
3021 (set_attr "mode" "none")
3022 (set_attr "length" "1")])
3025 (define_insn "branch_equality"
3027 (if_then_else (match_operator:SI 0 "equality_op"
3028 [(match_operand:SI 1 "register_operand" "d")
3029 (match_operand:SI 2 "register_operand" "d")])
3030 (match_operand 3 "pc_or_label_operand" "")
3031 (match_operand 4 "pc_or_label_operand" "")))]
3035 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
3036 return (operands[3] != pc_rtx)
3037 ? \"%*b%C0%?\\t%z1,%z2,%3\"
3038 : \"%*b%N0%?\\t%z1,%z2,%4\";
3040 [(set_attr "type" "branch")
3041 (set_attr "mode" "none")
3042 (set_attr "length" "1")])
3045 (define_expand "beq"
3047 (if_then_else (eq:CC_EQ (cc0)
3049 (label_ref (match_operand 0 "" ""))
3054 if (operands[0]) /* avoid unused code warning */
3056 gen_conditional_branch (operands, EQ);
3061 (define_expand "bne"
3063 (if_then_else (ne:CC_EQ (cc0)
3065 (label_ref (match_operand 0 "" ""))
3070 if (operands[0]) /* avoid unused code warning */
3072 gen_conditional_branch (operands, NE);
3077 (define_expand "bgt"
3079 (if_then_else (gt:CC (cc0)
3081 (label_ref (match_operand 0 "" ""))
3086 if (operands[0]) /* avoid unused code warning */
3088 gen_conditional_branch (operands, GT);
3093 (define_expand "bge"
3095 (if_then_else (ge:CC (cc0)
3097 (label_ref (match_operand 0 "" ""))
3102 if (operands[0]) /* avoid unused code warning */
3104 gen_conditional_branch (operands, GE);
3109 (define_expand "blt"
3111 (if_then_else (lt:CC (cc0)
3113 (label_ref (match_operand 0 "" ""))
3118 if (operands[0]) /* avoid unused code warning */
3120 gen_conditional_branch (operands, LT);
3125 (define_expand "ble"
3127 (if_then_else (le:CC (cc0)
3129 (label_ref (match_operand 0 "" ""))
3134 if (operands[0]) /* avoid unused code warning */
3136 gen_conditional_branch (operands, LE);
3141 (define_expand "bgtu"
3143 (if_then_else (gtu:CC (cc0)
3145 (label_ref (match_operand 0 "" ""))
3150 if (operands[0]) /* avoid unused code warning */
3152 gen_conditional_branch (operands, GTU);
3157 (define_expand "bgeu"
3159 (if_then_else (geu:CC (cc0)
3161 (label_ref (match_operand 0 "" ""))
3166 if (operands[0]) /* avoid unused code warning */
3168 gen_conditional_branch (operands, GEU);
3174 (define_expand "bltu"
3176 (if_then_else (ltu:CC (cc0)
3178 (label_ref (match_operand 0 "" ""))
3183 if (operands[0]) /* avoid unused code warning */
3185 gen_conditional_branch (operands, LTU);
3190 (define_expand "bleu"
3192 (if_then_else (leu:CC (cc0)
3194 (label_ref (match_operand 0 "" ""))
3199 if (operands[0]) /* avoid unused code warning */
3201 gen_conditional_branch (operands, LEU);
3208 ;; ....................
3210 ;; SETTING A REGISTER FROM A COMPARISON
3212 ;; ....................
3214 (define_expand "seq"
3215 [(set (match_operand:SI 0 "register_operand" "=d")
3216 (eq:SI (match_dup 1)
3221 if (branch_type != CMP_SI)
3224 /* set up operands from compare. */
3225 operands[1] = branch_cmp[0];
3226 operands[2] = branch_cmp[1];
3228 if (!TARGET_DEBUG_C_MODE)
3230 gen_int_relational (EQ, operands[0], operands[1], operands[2], (int *)0);
3234 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
3235 operands[2] = force_reg (SImode, operands[2]);
3237 /* fall through and generate default code */
3241 (define_insn "seq_si_zero"
3242 [(set (match_operand:SI 0 "register_operand" "=d")
3243 (eq:SI (match_operand:SI 1 "register_operand" "d")
3247 [(set_attr "type" "arith")
3248 (set_attr "mode" "SI")
3249 (set_attr "length" "1")])
3251 (define_insn "seq_si"
3252 [(set (match_operand:SI 0 "register_operand" "=d,d")
3253 (eq:SI (match_operand:SI 1 "register_operand" "%d,d")
3254 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
3255 "TARGET_DEBUG_C_MODE"
3257 xor\\t%0,%1,%2\;sltu\\t%0,%0,1
3258 xori\\t%0,%1,%2\;sltu\\t%0,%0,1"
3259 [(set_attr "type" "arith")
3260 (set_attr "mode" "SI")
3261 (set_attr "length" "2")])
3264 [(set (match_operand:SI 0 "register_operand" "")
3265 (eq:SI (match_operand:SI 1 "register_operand" "")
3266 (match_operand:SI 2 "uns_arith_operand" "")))]
3267 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE
3268 && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)"
3270 (xor:SI (match_dup 1)
3273 (ltu:SI (match_dup 0)
3277 (define_expand "sne"
3278 [(set (match_operand:SI 0 "register_operand" "=d")
3279 (ne:SI (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 if (!TARGET_DEBUG_C_MODE)
3293 gen_int_relational (NE, operands[0], operands[1], operands[2], (int *)0);
3297 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
3298 operands[2] = force_reg (SImode, operands[2]);
3300 /* fall through and generate default code */
3303 (define_insn "sne_si_zero"
3304 [(set (match_operand:SI 0 "register_operand" "=d")
3305 (ne:SI (match_operand:SI 1 "register_operand" "d")
3309 [(set_attr "type" "arith")
3310 (set_attr "mode" "SI")
3311 (set_attr "length" "1")])
3313 (define_insn "sne_si"
3314 [(set (match_operand:SI 0 "register_operand" "=d,d")
3315 (ne:SI (match_operand:SI 1 "register_operand" "%d,d")
3316 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
3317 "TARGET_DEBUG_C_MODE"
3319 xor\\t%0,%1,%2\;sltu\\t%0,%.,%0
3320 xori\\t%0,%1,%x2\;sltu\\t%0,%.,%0"
3321 [(set_attr "type" "arith")
3322 (set_attr "mode" "SI")
3323 (set_attr "length" "2")])
3326 [(set (match_operand:SI 0 "register_operand" "")
3327 (ne:SI (match_operand:SI 1 "register_operand" "")
3328 (match_operand:SI 2 "uns_arith_operand" "")))]
3329 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE
3330 && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)"
3332 (xor:SI (match_dup 1)
3335 (gtu:SI (match_dup 0)
3339 (define_expand "sgt"
3340 [(set (match_operand:SI 0 "register_operand" "=d")
3341 (gt:SI (match_dup 1)
3346 if (branch_type != CMP_SI)
3349 /* set up operands from compare. */
3350 operands[1] = branch_cmp[0];
3351 operands[2] = branch_cmp[1];
3353 if (!TARGET_DEBUG_C_MODE)
3355 gen_int_relational (GT, operands[0], operands[1], operands[2], (int *)0);
3359 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) != 0)
3360 operands[2] = force_reg (SImode, operands[2]);
3362 /* fall through and generate default code */
3365 (define_insn "sgt_si"
3366 [(set (match_operand:SI 0 "register_operand" "=d")
3367 (gt:SI (match_operand:SI 1 "register_operand" "d")
3368 (match_operand:SI 2 "reg_or_0_operand" "dJ")))]
3371 [(set_attr "type" "arith")
3372 (set_attr "mode" "SI")
3373 (set_attr "length" "1")])
3375 (define_expand "sge"
3376 [(set (match_operand:SI 0 "register_operand" "=d")
3377 (ge:SI (match_dup 1)
3382 if (branch_type != CMP_SI)
3385 /* set up operands from compare. */
3386 operands[1] = branch_cmp[0];
3387 operands[2] = branch_cmp[1];
3389 if (!TARGET_DEBUG_C_MODE)
3391 gen_int_relational (GE, operands[0], operands[1], operands[2], (int *)0);
3395 /* fall through and generate default code */
3398 (define_insn "sge_si"
3399 [(set (match_operand:SI 0 "register_operand" "=d")
3400 (ge:SI (match_operand:SI 1 "register_operand" "d")
3401 (match_operand:SI 2 "arith_operand" "dI")))]
3402 "TARGET_DEBUG_C_MODE"
3403 "slt\\t%0,%1,%2\;xori\\t%0,%0,0x0001"
3404 [(set_attr "type" "arith")
3405 (set_attr "mode" "SI")
3406 (set_attr "length" "2")])
3409 [(set (match_operand:SI 0 "register_operand" "")
3410 (ge:SI (match_operand:SI 1 "register_operand" "")
3411 (match_operand:SI 2 "arith_operand" "")))]
3412 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
3414 (lt:SI (match_dup 1)
3417 (xor:SI (match_dup 0)
3421 (define_expand "slt"
3422 [(set (match_operand:SI 0 "register_operand" "=d")
3423 (lt:SI (match_dup 1)
3428 if (branch_type != CMP_SI)
3431 /* set up operands from compare. */
3432 operands[1] = branch_cmp[0];
3433 operands[2] = branch_cmp[1];
3435 if (!TARGET_DEBUG_C_MODE)
3437 gen_int_relational (LT, operands[0], operands[1], operands[2], (int *)0);
3441 /* fall through and generate default code */
3444 (define_insn "slt_si"
3445 [(set (match_operand:SI 0 "register_operand" "=d")
3446 (lt:SI (match_operand:SI 1 "register_operand" "d")
3447 (match_operand:SI 2 "arith_operand" "dI")))]
3450 [(set_attr "type" "arith")
3451 (set_attr "mode" "SI")
3452 (set_attr "length" "1")])
3454 (define_expand "sle"
3455 [(set (match_operand:SI 0 "register_operand" "=d")
3456 (le:SI (match_dup 1)
3461 if (branch_type != CMP_SI)
3464 /* set up operands from compare. */
3465 operands[1] = branch_cmp[0];
3466 operands[2] = branch_cmp[1];
3468 if (!TARGET_DEBUG_C_MODE)
3470 gen_int_relational (LE, operands[0], operands[1], operands[2], (int *)0);
3474 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 32767)
3475 operands[2] = force_reg (SImode, operands[2]);
3477 /* fall through and generate default code */
3480 (define_insn "sle_si_const"
3481 [(set (match_operand:SI 0 "register_operand" "=d")
3482 (le:SI (match_operand:SI 1 "register_operand" "d")
3483 (match_operand:SI 2 "small_int" "I")))]
3484 "INTVAL (operands[2]) < 32767"
3487 operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2])+1);
3488 return \"slt\\t%0,%1,%2\";
3490 [(set_attr "type" "arith")
3491 (set_attr "mode" "SI")
3492 (set_attr "length" "1")])
3494 (define_insn "sle_si_reg"
3495 [(set (match_operand:SI 0 "register_operand" "=d")
3496 (le:SI (match_operand:SI 1 "register_operand" "d")
3497 (match_operand:SI 2 "register_operand" "d")))]
3498 "TARGET_DEBUG_C_MODE"
3499 "slt\\t%0,%z2,%1\;xori\\t%0,%0,0x0001"
3500 [(set_attr "type" "arith")
3501 (set_attr "mode" "SI")
3502 (set_attr "length" "2")])
3505 [(set (match_operand:SI 0 "register_operand" "")
3506 (le:SI (match_operand:SI 1 "register_operand" "")
3507 (match_operand:SI 2 "register_operand" "")))]
3508 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
3510 (lt:SI (match_dup 2)
3513 (xor:SI (match_dup 0)
3517 (define_expand "sgtu"
3518 [(set (match_operand:SI 0 "register_operand" "=d")
3519 (gtu:SI (match_dup 1)
3524 if (branch_type != CMP_SI)
3527 /* set up operands from compare. */
3528 operands[1] = branch_cmp[0];
3529 operands[2] = branch_cmp[1];
3531 if (!TARGET_DEBUG_C_MODE)
3533 gen_int_relational (GTU, operands[0], operands[1], operands[2], (int *)0);
3537 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) != 0)
3538 operands[2] = force_reg (SImode, operands[2]);
3540 /* fall through and generate default code */
3543 (define_insn "sgtu_si"
3544 [(set (match_operand:SI 0 "register_operand" "=d")
3545 (gtu:SI (match_operand:SI 1 "register_operand" "d")
3546 (match_operand:SI 2 "reg_or_0_operand" "dJ")))]
3549 [(set_attr "type" "arith")
3550 (set_attr "mode" "SI")
3551 (set_attr "length" "1")])
3553 (define_expand "sgeu"
3554 [(set (match_operand:SI 0 "register_operand" "=d")
3555 (geu:SI (match_dup 1)
3560 if (branch_type != CMP_SI)
3563 /* set up operands from compare. */
3564 operands[1] = branch_cmp[0];
3565 operands[2] = branch_cmp[1];
3567 if (!TARGET_DEBUG_C_MODE)
3569 gen_int_relational (GEU, operands[0], operands[1], operands[2], (int *)0);
3573 /* fall through and generate default code */
3576 (define_insn "sgeu_si"
3577 [(set (match_operand:SI 0 "register_operand" "=d")
3578 (geu:SI (match_operand:SI 1 "register_operand" "d")
3579 (match_operand:SI 2 "arith_operand" "dI")))]
3580 "TARGET_DEBUG_C_MODE"
3581 "sltu\\t%0,%1,%2\;xori\\t%0,%0,0x0001"
3582 [(set_attr "type" "arith")
3583 (set_attr "mode" "SI")
3584 (set_attr "length" "2")])
3587 [(set (match_operand:SI 0 "register_operand" "")
3588 (geu:SI (match_operand:SI 1 "register_operand" "")
3589 (match_operand:SI 2 "arith_operand" "")))]
3590 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
3592 (ltu:SI (match_dup 1)
3595 (xor:SI (match_dup 0)
3599 (define_expand "sltu"
3600 [(set (match_operand:SI 0 "register_operand" "=d")
3601 (ltu:SI (match_dup 1)
3606 if (branch_type != CMP_SI)
3609 /* set up operands from compare. */
3610 operands[1] = branch_cmp[0];
3611 operands[2] = branch_cmp[1];
3613 if (!TARGET_DEBUG_C_MODE)
3615 gen_int_relational (LTU, operands[0], operands[1], operands[2], (int *)0);
3619 /* fall through and generate default code */
3622 (define_insn "sltu_si"
3623 [(set (match_operand:SI 0 "register_operand" "=d")
3624 (ltu:SI (match_operand:SI 1 "register_operand" "d")
3625 (match_operand:SI 2 "arith_operand" "dI")))]
3628 [(set_attr "type" "arith")
3629 (set_attr "mode" "SI")
3630 (set_attr "length" "1")])
3632 (define_expand "sleu"
3633 [(set (match_operand:SI 0 "register_operand" "=d")
3634 (leu:SI (match_dup 1)
3639 if (branch_type != CMP_SI)
3642 /* set up operands from compare. */
3643 operands[1] = branch_cmp[0];
3644 operands[2] = branch_cmp[1];
3646 if (!TARGET_DEBUG_C_MODE)
3648 gen_int_relational (LEU, operands[0], operands[1], operands[2], (int *)0);
3652 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 32767)
3653 operands[2] = force_reg (SImode, operands[2]);
3655 /* fall through and generate default code */
3658 (define_insn "sleu_si_const"
3659 [(set (match_operand:SI 0 "register_operand" "=d")
3660 (leu:SI (match_operand:SI 1 "register_operand" "d")
3661 (match_operand:SI 2 "small_int" "I")))]
3662 "INTVAL (operands[2]) < 32767"
3665 operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2])+1);
3666 return \"sltu\\t%0,%1,%2\";
3668 [(set_attr "type" "arith")
3669 (set_attr "mode" "SI")
3670 (set_attr "length" "1")])
3672 (define_insn "sleu_si_reg"
3673 [(set (match_operand:SI 0 "register_operand" "=d")
3674 (leu:SI (match_operand:SI 1 "register_operand" "d")
3675 (match_operand:SI 2 "register_operand" "d")))]
3676 "TARGET_DEBUG_C_MODE"
3677 "sltu\\t%0,%z2,%1\;xori\\t%0,%0,0x0001"
3678 [(set_attr "type" "arith")
3679 (set_attr "mode" "SI")
3680 (set_attr "length" "2")])
3683 [(set (match_operand:SI 0 "register_operand" "")
3684 (leu:SI (match_operand:SI 1 "register_operand" "")
3685 (match_operand:SI 2 "register_operand" "")))]
3686 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
3688 (ltu:SI (match_dup 2)
3691 (xor:SI (match_dup 0)
3697 ;; ....................
3699 ;; FLOATING POINT COMPARISONS
3701 ;; ....................
3703 (define_insn "seq_df"
3704 [(set (reg:CC_FP 66)
3705 (eq:CC_FP (match_operand:DF 0 "register_operand" "f")
3706 (match_operand:DF 1 "register_operand" "f")))]
3711 xoperands[0] = gen_rtx (REG, CC_FPmode, FPSW_REGNUM);
3712 xoperands[1] = operands[0];
3713 xoperands[2] = operands[1];
3715 return mips_fill_delay_slot (\"c.eq.d\\t%0,%1\", DELAY_FCMP, xoperands, insn);
3717 [(set_attr "type" "fcmp")
3718 (set_attr "mode" "FPSW")
3719 (set_attr "length" "1")])
3721 (define_insn "sne_df"
3722 [(set (reg:CC_REV_FP 66)
3723 (ne:CC_REV_FP (match_operand:DF 0 "register_operand" "f")
3724 (match_operand:DF 1 "register_operand" "f")))]
3729 xoperands[0] = gen_rtx (REG, CC_FPmode, FPSW_REGNUM);
3730 xoperands[1] = operands[0];
3731 xoperands[2] = operands[1];
3733 return mips_fill_delay_slot (\"c.eq.d\\t%0,%1\", DELAY_FCMP, xoperands, insn);
3735 [(set_attr "type" "fcmp")
3736 (set_attr "mode" "FPSW")
3737 (set_attr "length" "1")])
3739 (define_insn "slt_df"
3740 [(set (reg:CC_FP 66)
3741 (lt:CC_FP (match_operand:DF 0 "register_operand" "f")
3742 (match_operand:DF 1 "register_operand" "f")))]
3747 xoperands[0] = gen_rtx (REG, CC_FPmode, FPSW_REGNUM);
3748 xoperands[1] = operands[0];
3749 xoperands[2] = operands[1];
3751 return mips_fill_delay_slot (\"c.lt.d\\t%0,%1\", DELAY_FCMP, xoperands, insn);
3753 [(set_attr "type" "fcmp")
3754 (set_attr "mode" "FPSW")
3755 (set_attr "length" "1")])
3757 (define_insn "sle_df"
3758 [(set (reg:CC_FP 66)
3759 (le:CC_FP (match_operand:DF 0 "register_operand" "f")
3760 (match_operand:DF 1 "register_operand" "f")))]
3765 xoperands[0] = gen_rtx (REG, CC_FPmode, FPSW_REGNUM);
3766 xoperands[1] = operands[0];
3767 xoperands[2] = operands[1];
3769 return mips_fill_delay_slot (\"c.le.d\\t%0,%1\", DELAY_FCMP, xoperands, insn);
3771 [(set_attr "type" "fcmp")
3772 (set_attr "mode" "FPSW")
3773 (set_attr "length" "1")])
3775 (define_insn "sgt_df"
3776 [(set (reg:CC_FP 66)
3777 (gt:CC_FP (match_operand:DF 0 "register_operand" "f")
3778 (match_operand:DF 1 "register_operand" "f")))]
3783 xoperands[0] = gen_rtx (REG, CC_FPmode, FPSW_REGNUM);
3784 xoperands[1] = operands[0];
3785 xoperands[2] = operands[1];
3787 return mips_fill_delay_slot (\"c.lt.d\\t%1,%0\", DELAY_FCMP, xoperands, insn);
3789 [(set_attr "type" "fcmp")
3790 (set_attr "mode" "FPSW")
3791 (set_attr "length" "1")])
3793 (define_insn "sge_df"
3794 [(set (reg:CC_FP 66)
3795 (ge:CC_FP (match_operand:DF 0 "register_operand" "f")
3796 (match_operand:DF 1 "register_operand" "f")))]
3801 xoperands[0] = gen_rtx (REG, CC_FPmode, FPSW_REGNUM);
3802 xoperands[1] = operands[0];
3803 xoperands[2] = operands[1];
3805 return mips_fill_delay_slot (\"c.le.d\\t%1,%0\", DELAY_FCMP, xoperands, insn);
3807 [(set_attr "type" "fcmp")
3808 (set_attr "mode" "FPSW")
3809 (set_attr "length" "1")])
3811 (define_insn "seq_sf"
3812 [(set (reg:CC_FP 66)
3813 (eq:CC_FP (match_operand:SF 0 "register_operand" "f")
3814 (match_operand:SF 1 "register_operand" "f")))]
3819 xoperands[0] = gen_rtx (REG, CC_FPmode, FPSW_REGNUM);
3820 xoperands[1] = operands[0];
3821 xoperands[2] = operands[1];
3823 return mips_fill_delay_slot (\"c.eq.s\\t%0,%1\", DELAY_FCMP, xoperands, insn);
3825 [(set_attr "type" "fcmp")
3826 (set_attr "mode" "FPSW")
3827 (set_attr "length" "1")])
3829 (define_insn "sne_sf"
3830 [(set (reg:CC_REV_FP 66)
3831 (ne:CC_REV_FP (match_operand:SF 0 "register_operand" "f")
3832 (match_operand:SF 1 "register_operand" "f")))]
3837 xoperands[0] = gen_rtx (REG, CC_FPmode, FPSW_REGNUM);
3838 xoperands[1] = operands[0];
3839 xoperands[2] = operands[1];
3841 return mips_fill_delay_slot (\"c.eq.s\\t%0,%1\", DELAY_FCMP, xoperands, insn);
3843 [(set_attr "type" "fcmp")
3844 (set_attr "mode" "FPSW")
3845 (set_attr "length" "1")])
3847 (define_insn "slt_sf"
3848 [(set (reg:CC_FP 66)
3849 (lt:CC_FP (match_operand:SF 0 "register_operand" "f")
3850 (match_operand:SF 1 "register_operand" "f")))]
3855 xoperands[0] = gen_rtx (REG, CC_FPmode, FPSW_REGNUM);
3856 xoperands[1] = operands[0];
3857 xoperands[2] = operands[1];
3859 return mips_fill_delay_slot (\"c.lt.s\\t%0,%1\", DELAY_FCMP, xoperands, insn);
3861 [(set_attr "type" "fcmp")
3862 (set_attr "mode" "FPSW")
3863 (set_attr "length" "1")])
3865 (define_insn "sle_sf"
3866 [(set (reg:CC_FP 66)
3867 (le:CC_FP (match_operand:SF 0 "register_operand" "f")
3868 (match_operand:SF 1 "register_operand" "f")))]
3873 xoperands[0] = gen_rtx (REG, CC_FPmode, FPSW_REGNUM);
3874 xoperands[1] = operands[0];
3875 xoperands[2] = operands[1];
3877 return mips_fill_delay_slot (\"c.le.s\\t%0,%1\", DELAY_FCMP, xoperands, insn);
3879 [(set_attr "type" "fcmp")
3880 (set_attr "mode" "FPSW")
3881 (set_attr "length" "1")])
3883 (define_insn "sgt_sf"
3884 [(set (reg:CC_FP 66)
3885 (gt:CC_FP (match_operand:SF 0 "register_operand" "f")
3886 (match_operand:SF 1 "register_operand" "f")))]
3891 xoperands[0] = gen_rtx (REG, CC_FPmode, FPSW_REGNUM);
3892 xoperands[1] = operands[0];
3893 xoperands[2] = operands[1];
3895 return mips_fill_delay_slot (\"c.lt.s\\t%1,%0\", DELAY_FCMP, xoperands, insn);
3897 [(set_attr "type" "fcmp")
3898 (set_attr "mode" "FPSW")
3899 (set_attr "length" "1")])
3901 (define_insn "sge_sf"
3902 [(set (reg:CC_FP 66)
3903 (ge:CC_FP (match_operand:SF 0 "register_operand" "f")
3904 (match_operand:SF 1 "register_operand" "f")))]
3909 xoperands[0] = gen_rtx (REG, CC_FPmode, FPSW_REGNUM);
3910 xoperands[1] = operands[0];
3911 xoperands[2] = operands[1];
3913 return mips_fill_delay_slot (\"c.le.s\\t%1,%0\", DELAY_FCMP, xoperands, insn);
3915 [(set_attr "type" "fcmp")
3916 (set_attr "mode" "FPSW")
3917 (set_attr "length" "1")])
3921 ;; ....................
3923 ;; UNCONDITIONAL BRANCHES
3925 ;; ....................
3927 ;; Unconditional branches.
3931 (label_ref (match_operand 0 "" "")))]
3935 if (GET_CODE (operands[0]) == REG)
3936 return \"%*j\\t%0\";
3938 return \"%*j\\t%l0\";
3940 [(set_attr "type" "jump")
3941 (set_attr "mode" "none")
3942 (set_attr "length" "1")])
3944 (define_insn "indirect_jump"
3945 [(set (pc) (match_operand:SI 0 "register_operand" "d"))]
3948 [(set_attr "type" "jump")
3949 (set_attr "mode" "none")
3950 (set_attr "length" "1")])
3952 (define_insn "tablejump"
3954 (match_operand:SI 0 "register_operand" "d"))
3955 (use (label_ref (match_operand 1 "" "")))]
3958 [(set_attr "type" "jump")
3959 (set_attr "mode" "none")
3960 (set_attr "length" "1")])
3962 ;; Function return, only allow after optimization, so that we can
3963 ;; eliminate jumps to jumps if no stack space is used.
3965 ;; (define_expand "return"
3966 ;; [(set (pc) (reg:SI 31))]
3967 ;; "simple_epilogue_p ()"
3970 (define_expand "return"
3971 [(parallel [(return)
3972 (use (reg:SI 31))])]
3973 "simple_epilogue_p ()"
3976 (define_insn "return_internal"
3977 [(parallel [(return)
3978 (use (match_operand:SI 0 "register_operand" "d"))])]
3981 [(set_attr "type" "jump")
3982 (set_attr "mode" "none")
3983 (set_attr "length" "1")])
3987 ;; ....................
3989 ;; Function prologue/epilogue
3991 ;; ....................
3994 (define_expand "prologue"
3999 if (mips_isa >= 0) /* avoid unused code warnings */
4001 mips_expand_prologue ();
4006 ;; Block any insns from being moved before this point, since the
4007 ;; profiling call to mcount can use various registers that aren't
4008 ;; saved or used to pass arguments.
4010 (define_insn "blockage"
4011 [(unspec_volatile [(const_int 0)] 0)]
4014 [(set_attr "type" "unknown")
4015 (set_attr "mode" "none")
4016 (set_attr "length" "0")])
4018 ;; At present, don't expand the epilogue, reorg.c will clobber the
4019 ;; return register in compiling gen_lowpart (emit-rtl.c).
4021 ;; (define_expand "epilogue"
4026 ;; if (mips_isa >= 0) /* avoid unused code warnings */
4028 ;; mips_expand_epilogue ();
4035 ;; ....................
4039 ;; ....................
4041 ;; calls.c now passes a third argument, make saber happy
4043 (define_expand "call"
4044 [(parallel [(call (match_operand 0 "memory_operand" "m")
4045 (match_operand 1 "" "i"))
4046 (clobber (reg:SI 31))
4047 (use (match_operand 2 "" "")) ;; next_arg_reg
4048 (use (match_operand 3 "" ""))])] ;; struct_value_size_rtx
4054 if (operands[0]) /* eliminate unused code warnings */
4056 addr = XEXP (operands[0], 0);
4057 if ((GET_CODE (addr) != REG && (!CONSTANT_ADDRESS_P (addr) || TARGET_LONG_CALLS))
4058 || ! call_insn_operand (operands[0], VOIDmode))
4059 XEXP (operands[0], 0) = copy_to_mode_reg (Pmode, addr);
4061 /* In order to pass small structures by value in registers
4062 compatibly with the MIPS compiler, we need to shift the value
4063 into the high part of the register. Function_arg has encoded
4064 a PARALLEL rtx, holding a vector of adjustments to be made
4065 as the next_arg_reg variable, so we split up the insns,
4066 and emit them separately. */
4068 if (operands[2] != (rtx)0 && GET_CODE (operands[2]) == PARALLEL)
4070 rtvec adjust = XVEC (operands[2], 0);
4071 int num = GET_NUM_ELEM (adjust);
4074 for (i = 0; i < num; i++)
4075 emit_insn (RTVEC_ELT (adjust, i));
4078 emit_call_insn (gen_call_internal1 (operands[0], operands[1],
4079 gen_rtx (REG, Pmode, GP_REG_FIRST + 31)));
4084 (define_insn "call_internal1"
4085 [(call (match_operand 0 "call_insn_operand" "m")
4086 (match_operand 1 "" "i"))
4087 (clobber (match_operand:SI 2 "register_operand" "=d"))]
4088 "!TARGET_LONG_CALLS"
4091 register rtx target = XEXP (operands[0], 0);
4093 if (GET_CODE (target) == SYMBOL_REF)
4094 return \"%*jal\\t%0\";
4096 else if (GET_CODE (target) == CONST_INT)
4098 operands[0] = target;
4099 return \"%*%[li\\t%@,%0\\n\\tjal\\t%2,%@%]\";
4104 operands[0] = target;
4105 return \"%*jal\\t%2,%0\";
4108 [(set_attr "type" "call")
4109 (set_attr "mode" "none")
4110 (set_attr "length" "1")])
4112 (define_insn "call_internal2"
4113 [(call (mem:SI (match_operand:SI 0 "register_operand" "r"))
4114 (match_operand 1 "" "i"))
4115 (clobber (match_operand:SI 2 "register_operand" "=d"))]
4118 [(set_attr "type" "call")
4119 (set_attr "mode" "none")
4120 (set_attr "length" "1")])
4123 ;; calls.c now passes a fourth argument, make saber happy
4125 (define_expand "call_value"
4126 [(parallel [(set (match_operand 0 "register_operand" "=df")
4127 (call (match_operand 1 "memory_operand" "m")
4128 (match_operand 2 "" "i")))
4129 (clobber (reg:SI 31))
4130 (use (match_operand 3 "" ""))])] ;; next_arg_reg
4136 if (operands[0]) /* eliminate unused code warning */
4138 addr = XEXP (operands[1], 0);
4139 if ((GET_CODE (addr) != REG && (!CONSTANT_ADDRESS_P (addr) || TARGET_LONG_CALLS))
4140 || ! call_insn_operand (operands[1], VOIDmode))
4141 XEXP (operands[1], 0) = copy_to_mode_reg (Pmode, addr);
4143 /* In order to pass small structures by value in registers
4144 compatibly with the MIPS compiler, we need to shift the value
4145 into the high part of the register. Function_arg has encoded
4146 a PARALLEL rtx, holding a vector of adjustments to be made
4147 as the next_arg_reg variable, so we split up the insns,
4148 and emit them separately. */
4150 if (operands[3] != (rtx)0 && GET_CODE (operands[3]) == PARALLEL)
4152 rtvec adjust = XVEC (operands[3], 0);
4153 int num = GET_NUM_ELEM (adjust);
4156 for (i = 0; i < num; i++)
4157 emit_insn (RTVEC_ELT (adjust, i));
4160 emit_call_insn (gen_call_value_internal1 (operands[0], operands[1], operands[2],
4161 gen_rtx (REG, Pmode, GP_REG_FIRST + 31)));
4168 (define_insn "call_value_internal1"
4169 [(set (match_operand 0 "register_operand" "=df")
4170 (call (match_operand 1 "call_insn_operand" "m")
4171 (match_operand 2 "" "i")))
4172 (clobber (match_operand:SI 3 "register_operand" "=d"))]
4173 "!TARGET_LONG_CALLS"
4176 register rtx target = XEXP (operands[1], 0);
4178 if (GET_CODE (target) == SYMBOL_REF)
4179 return \"%*jal\\t%1\";
4181 else if (GET_CODE (target) == CONST_INT)
4183 operands[1] = target;
4184 return \"%*%[li\\t%@,%1\\n\\tjal\\t%3,%@%]\";
4189 operands[1] = target;
4190 return \"%*jal\\t%3,%1\";
4193 [(set_attr "type" "call")
4194 (set_attr "mode" "none")
4195 (set_attr "length" "1")])
4197 (define_insn "call_value_internal2"
4198 [(set (match_operand 0 "register_operand" "=df")
4199 (call (mem:SI (match_operand:SI 1 "register_operand" "r"))
4200 (match_operand 2 "" "i")))
4201 (clobber (match_operand:SI 3 "register_operand" "=d"))]
4204 [(set_attr "type" "call")
4205 (set_attr "mode" "none")
4206 (set_attr "length" "1")])
4208 ;; Call subroutine returning any type.
4210 (define_expand "untyped_call"
4211 [(parallel [(call (match_operand 0 "" "")
4213 (match_operand 1 "" "")
4214 (match_operand 2 "" "")])]
4218 if (operands[0]) /* silence statement not reached warnings */
4222 emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
4224 for (i = 0; i < XVECLEN (operands[2], 0); i++)
4226 rtx set = XVECEXP (operands[2], 0, i);
4227 emit_move_insn (SET_DEST (set), SET_SRC (set));
4230 emit_insn (gen_blockage ());
4236 ;; ....................
4240 ;; ....................
4247 [(set_attr "type" "nop")
4248 (set_attr "mode" "none")
4249 (set_attr "length" "1")])
4251 (define_expand "probe"
4257 operands[0] = gen_reg_rtx (SImode);
4258 operands[1] = gen_rtx (MEM, SImode, stack_pointer_rtx);
4259 MEM_VOLATILE_P (operands[1]) = TRUE;
4261 /* fall through and generate default code */