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 ;; 64 bit r4000 support by Ian Lance Taylor, ian@cygnus.com, and
5 ;; Brendan Eich, brendan@microunity.com.
6 ;; Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
8 ;; This file is part of GNU CC.
10 ;; GNU CC is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU CC is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU CC; see the file COPYING. If not, write to
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
26 ;; ....................
30 ;; ....................
32 ;; Classification of each insn.
33 ;; branch conditional branch
34 ;; jump unconditional jump
35 ;; call unconditional call
36 ;; load load instruction(s)
37 ;; store store instruction(s)
38 ;; move data movement within same register set
39 ;; xfer transfer to/from coprocessor
40 ;; hilo transfer of hi/lo registers
41 ;; arith integer arithmetic instruction
42 ;; darith double precision integer arithmetic instructions
43 ;; imul integer multiply
44 ;; idiv integer divide
45 ;; icmp integer compare
46 ;; fadd floating point add/subtract
47 ;; fmul floating point multiply
48 ;; fdiv floating point divide
49 ;; fabs floating point absolute value
50 ;; fneg floating point negation
51 ;; fcmp floating point compare
52 ;; fcvt floating point convert
53 ;; fsqrt floating point square root
54 ;; multi multiword sequence (or user asm statements)
58 "unknown,branch,jump,call,load,store,move,xfer,hilo,arith,darith,imul,idiv,icmp,fadd,fmul,fdiv,fabs,fneg,fcmp,fcvt,fsqrt,multi,nop"
59 (const_string "unknown"))
61 ;; Main data type used by the insn
62 (define_attr "mode" "unknown,none,QI,HI,SI,DI,SF,DF,FPSW" (const_string "unknown"))
64 ;; # instructions (4 bytes each)
65 (define_attr "length" "" (const_int 1))
67 ;; whether or not an instruction has a mandatory delay slot
68 (define_attr "dslot" "no,yes"
69 (if_then_else (eq_attr "type" "branch,jump,call,load,xfer,hilo,fcmp")
73 ;; Attribute describing the processor. This attribute must match exactly
74 ;; with the processor_type enumeration in mips.h.
76 ;; Attribute describing the processor
77 ;; (define_attr "cpu" "default,r3000,r6000,r4000"
79 ;; (cond [(eq (symbol_ref "mips_cpu") (symbol_ref "PROCESSOR_R3000")) (const_string "r3000")
80 ;; (eq (symbol_ref "mips_cpu") (symbol_ref "PROCESSOR_R4000")) (const_string "r4000")
81 ;; (eq (symbol_ref "mips_cpu") (symbol_ref "PROCESSOR_R6000")) (const_string "r6000")]
82 ;; (const_string "default"))))
84 (define_attr "cpu" "default,r3000,r6000,r4000,r4600"
85 (const (symbol_ref "mips_cpu_attr")))
87 ;; Attribute defining whether or not we can use the branch-likely instructions
90 (define_attr "branch_likely" "no,yes"
92 (if_then_else (ge (symbol_ref "mips_isa") (const_int 2))
94 (const_string "no"))))
97 ;; Describe a user's asm statement.
98 (define_asm_attributes
99 [(set_attr "type" "multi")])
101 ;; whether or not generating calls to position independent functions
102 (define_attr "abicalls" "no,yes"
103 (const (symbol_ref "mips_abicalls_attr")))
107 ;; .........................
109 ;; Delay slots, can't describe load/fcmp/xfer delay slots here
111 ;; .........................
113 (define_delay (eq_attr "type" "branch")
114 [(and (eq_attr "dslot" "no") (eq_attr "length" "1"))
116 (and (eq_attr "branch_likely" "yes") (and (eq_attr "dslot" "no") (eq_attr "length" "1")))])
118 (define_delay (eq_attr "type" "jump")
119 [(and (eq_attr "dslot" "no") (eq_attr "length" "1"))
123 (define_delay (and (eq_attr "type" "call") (eq_attr "abicalls" "no"))
124 [(and (eq_attr "dslot" "no") (eq_attr "length" "1"))
130 ;; .........................
134 ;; .........................
136 ; (define_function_unit NAME MULTIPLICITY SIMULTANEITY
137 ; TEST READY-DELAY ISSUE-DELAY [CONFLICT-LIST])
139 ;; Make the default case (PROCESSOR_DEFAULT) handle the worst case
141 (define_function_unit "memory" 1 0
142 (and (eq_attr "type" "load") (eq_attr "cpu" "!r3000"))
145 (define_function_unit "memory" 1 0
146 (and (eq_attr "type" "load") (eq_attr "cpu" "r3000,r4600"))
149 (define_function_unit "memory" 1 0 (eq_attr "type" "store") 1 0)
151 (define_function_unit "memory" 1 0 (eq_attr "type" "xfer") 2 0)
153 (define_function_unit "imuldiv" 1 0
154 (eq_attr "type" "hilo")
157 (define_function_unit "imuldiv" 1 0
158 (and (eq_attr "type" "imul") (eq_attr "cpu" "!r3000,r4000,r4600"))
161 (define_function_unit "imuldiv" 1 0
162 (and (eq_attr "type" "imul") (eq_attr "cpu" "r3000"))
165 (define_function_unit "imuldiv" 1 0
166 (and (eq_attr "type" "imul") (eq_attr "cpu" "r4000,r4600"))
169 (define_function_unit "imuldiv" 1 0
170 (and (eq_attr "type" "idiv") (eq_attr "cpu" "!r3000,r4000,r4600"))
173 (define_function_unit "imuldiv" 1 0
174 (and (eq_attr "type" "idiv") (eq_attr "cpu" "r3000"))
177 (define_function_unit "imuldiv" 1 0
178 (and (eq_attr "type" "idiv") (eq_attr "cpu" "r4600"))
181 (define_function_unit "imuldiv" 1 0
182 (and (eq_attr "type" "idiv") (eq_attr "cpu" "r4000"))
185 (define_function_unit "adder" 1 1
186 (and (eq_attr "type" "fcmp") (eq_attr "cpu" "!r3000,r6000"))
189 (define_function_unit "adder" 1 1
190 (and (eq_attr "type" "fcmp") (eq_attr "cpu" "r3000,r6000"))
193 (define_function_unit "adder" 1 1
194 (and (eq_attr "type" "fadd") (eq_attr "cpu" "!r3000,r6000"))
197 (define_function_unit "adder" 1 1
198 (and (eq_attr "type" "fadd") (eq_attr "cpu" "r3000"))
201 (define_function_unit "adder" 1 1
202 (and (eq_attr "type" "fadd") (eq_attr "cpu" "r6000"))
205 (define_function_unit "adder" 1 1
206 (and (eq_attr "type" "fabs,fneg") (eq_attr "cpu" "!r3000,r4600"))
209 (define_function_unit "adder" 1 1
210 (and (eq_attr "type" "fabs,fneg") (eq_attr "cpu" "r3000,r4600"))
213 (define_function_unit "mult" 1 1
214 (and (eq_attr "type" "fmul") (and (eq_attr "mode" "SF") (eq_attr "cpu" "!r3000,r6000,r4600")))
217 (define_function_unit "mult" 1 1
218 (and (eq_attr "type" "fmul") (and (eq_attr "mode" "SF") (eq_attr "cpu" "r3000")))
221 (define_function_unit "mult" 1 1
222 (and (eq_attr "type" "fmul") (and (eq_attr "mode" "SF") (eq_attr "cpu" "r6000")))
225 (define_function_unit "mult" 1 1
226 (and (eq_attr "type" "fmul") (and (eq_attr "mode" "SF") (eq_attr "cpu" "r4600")))
229 (define_function_unit "mult" 1 1
230 (and (eq_attr "type" "fmul") (and (eq_attr "mode" "DF") (eq_attr "cpu" "!r3000,r6000")))
233 (define_function_unit "mult" 1 1
234 (and (eq_attr "type" "fmul") (and (eq_attr "mode" "DF") (eq_attr "cpu" "r3000")))
237 (define_function_unit "mult" 1 1
238 (and (eq_attr "type" "fmul") (and (eq_attr "mode" "DF") (eq_attr "cpu" "r6000")))
241 (define_function_unit "divide" 1 1
242 (and (eq_attr "type" "fdiv") (and (eq_attr "mode" "SF") (eq_attr "cpu" "!r3000,r6000,r4600")))
245 (define_function_unit "divide" 1 1
246 (and (eq_attr "type" "fdiv") (and (eq_attr "mode" "SF") (eq_attr "cpu" "r3000")))
249 (define_function_unit "divide" 1 1
250 (and (eq_attr "type" "fdiv") (and (eq_attr "mode" "SF") (eq_attr "cpu" "r6000")))
253 (define_function_unit "divide" 1 1
254 (and (eq_attr "type" "fdiv") (and (eq_attr "mode" "SF") (eq_attr "cpu" "r4600")))
257 (define_function_unit "divide" 1 1
258 (and (eq_attr "type" "fdiv") (and (eq_attr "mode" "DF") (eq_attr "cpu" "!r3000,r6000,r4600")))
261 (define_function_unit "divide" 1 1
262 (and (eq_attr "type" "fdiv") (and (eq_attr "mode" "DF") (eq_attr "cpu" "r3000")))
265 (define_function_unit "divide" 1 1
266 (and (eq_attr "type" "fdiv") (and (eq_attr "mode" "DF") (eq_attr "cpu" "r6000")))
269 (define_function_unit "divide" 1 1
270 (and (eq_attr "type" "fdiv") (and (eq_attr "mode" "DF") (eq_attr "cpu" "r4600")))
273 ;;; ??? Is this number right?
274 (define_function_unit "divide" 1 1
275 (and (eq_attr "type" "fsqrt") (and (eq_attr "mode" "SF") (eq_attr "cpu" "!r4600")))
277 (define_function_unit "divide" 1 1
278 (and (eq_attr "type" "fsqrt") (and (eq_attr "mode" "SF") (eq_attr "cpu" "r4600")))
281 ;;; ??? Is this number right?
282 (define_function_unit "divide" 1 1
283 (and (eq_attr "type" "fsqrt") (and (eq_attr "mode" "DF") (eq_attr "cpu" "!r4600")))
285 (define_function_unit "divide" 1 1
286 (and (eq_attr "type" "fsqrt") (and (eq_attr "mode" "DF") (eq_attr "cpu" "r4600")))
290 ;; The following functional units do not use the cpu type, and use
291 ;; much less memory in genattrtab.c.
293 ;; (define_function_unit "memory" 1 0 (eq_attr "type" "load") 3 0)
294 ;; (define_function_unit "memory" 1 0 (eq_attr "type" "store") 1 0)
296 ;; (define_function_unit "fp_comp" 1 0 (eq_attr "type" "fcmp") 2 0)
298 ;; (define_function_unit "transfer" 1 0 (eq_attr "type" "xfer") 2 0)
299 ;; (define_function_unit "transfer" 1 0 (eq_attr "type" "hilo") 3 0)
301 ;; (define_function_unit "imuldiv" 1 1 (eq_attr "type" "imul") 17 0)
302 ;; (define_function_unit "imuldiv" 1 1 (eq_attr "type" "idiv") 38 0)
304 ;; (define_function_unit "adder" 1 1 (eq_attr "type" "fadd") 4 0)
305 ;; (define_function_unit "adder" 1 1 (eq_attr "type" "fabs,fneg") 2 0)
307 ;; (define_function_unit "mult" 1 1 (and (eq_attr "type" "fmul") (eq_attr "mode" "SF")) 7 0)
308 ;; (define_function_unit "mult" 1 1 (and (eq_attr "type" "fmul") (eq_attr "mode" "DF")) 8 0)
310 ;; (define_function_unit "divide" 1 1 (and (eq_attr "type" "fdiv") (eq_attr "mode" "SF")) 23 0)
311 ;; (define_function_unit "divide" 1 1 (and (eq_attr "type" "fdiv") (eq_attr "mode" "DF")) 36 0)
313 ;; (define_function_unit "sqrt" 1 1 (and (eq_attr "type" "fsqrt") (eq_attr "mode" "SF")) 54 0)
314 ;; (define_function_unit "sqrt" 1 1 (and (eq_attr "type" "fsqrt") (eq_attr "mode" "DF")) 112 0)
318 ;; ....................
322 ;; ....................
325 (define_insn "adddf3"
326 [(set (match_operand:DF 0 "register_operand" "=f")
327 (plus:DF (match_operand:DF 1 "register_operand" "f")
328 (match_operand:DF 2 "register_operand" "f")))]
331 [(set_attr "type" "fadd")
332 (set_attr "mode" "DF")
333 (set_attr "length" "1")])
335 (define_insn "addsf3"
336 [(set (match_operand:SF 0 "register_operand" "=f")
337 (plus:SF (match_operand:SF 1 "register_operand" "f")
338 (match_operand:SF 2 "register_operand" "f")))]
341 [(set_attr "type" "fadd")
342 (set_attr "mode" "SF")
343 (set_attr "length" "1")])
345 (define_expand "addsi3"
346 [(set (match_operand:SI 0 "register_operand" "=d")
347 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
348 (match_operand:SI 2 "arith_operand" "dI")))]
352 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == -32768)
353 operands[2] = force_reg (SImode, operands[2]);
356 (define_insn "addsi3_internal"
357 [(set (match_operand:SI 0 "register_operand" "=d")
358 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
359 (match_operand:SI 2 "arith_operand" "dI")))]
360 "GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768"
363 return (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
364 ? \"subu\\t%0,%z1,%n2\"
365 : \"addu\\t%0,%z1,%2\";
367 [(set_attr "type" "arith")
368 (set_attr "mode" "SI")
369 (set_attr "length" "1")])
371 (define_expand "adddi3"
372 [(parallel [(set (match_operand:DI 0 "register_operand" "")
373 (plus:DI (match_operand:DI 1 "register_operand" "")
374 (match_operand:DI 2 "arith_operand" "")))
375 (clobber (match_dup 3))])]
376 "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
379 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == -32768)
380 operands[2] = force_reg (DImode, operands[2]);
384 emit_insn (gen_adddi3_internal_3 (operands[0], operands[1],
389 operands[3] = gen_reg_rtx (SImode);
392 (define_insn "adddi3_internal_1"
393 [(set (match_operand:DI 0 "register_operand" "=d,&d")
394 (plus:DI (match_operand:DI 1 "register_operand" "0,d")
395 (match_operand:DI 2 "register_operand" "d,d")))
396 (clobber (match_operand:SI 3 "register_operand" "=d,d"))]
397 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE"
400 return (REGNO (operands[0]) == REGNO (operands[1])
401 && REGNO (operands[0]) == REGNO (operands[2]))
402 ? \"srl\\t%3,%L0,31\;sll\\t%M0,%M0,1\;sll\\t%L0,%L1,1\;addu\\t%M0,%M0,%3\"
403 : \"addu\\t%L0,%L1,%L2\;sltu\\t%3,%L0,%L2\;addu\\t%M0,%M1,%M2\;addu\\t%M0,%M0,%3\";
405 [(set_attr "type" "darith")
406 (set_attr "mode" "DI")
407 (set_attr "length" "4")])
410 [(set (match_operand:DI 0 "register_operand" "")
411 (plus:DI (match_operand:DI 1 "register_operand" "")
412 (match_operand:DI 2 "register_operand" "")))
413 (clobber (match_operand:SI 3 "register_operand" ""))]
414 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
415 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
416 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
417 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))
418 && (REGNO (operands[0]) != REGNO (operands[1])
419 || REGNO (operands[0]) != REGNO (operands[2]))"
421 [(set (subreg:SI (match_dup 0) 0)
422 (plus:SI (subreg:SI (match_dup 1) 0)
423 (subreg:SI (match_dup 2) 0)))
426 (ltu:SI (subreg:SI (match_dup 0) 0)
427 (subreg:SI (match_dup 2) 0)))
429 (set (subreg:SI (match_dup 0) 1)
430 (plus:SI (subreg:SI (match_dup 1) 1)
431 (subreg:SI (match_dup 2) 1)))
433 (set (subreg:SI (match_dup 0) 1)
434 (plus:SI (subreg:SI (match_dup 0) 1)
439 [(set (match_operand:DI 0 "register_operand" "")
440 (plus:DI (match_operand:DI 1 "register_operand" "")
441 (match_operand:DI 2 "register_operand" "")))
442 (clobber (match_operand:SI 3 "register_operand" ""))]
443 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
444 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
445 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
446 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))
447 && (REGNO (operands[0]) != REGNO (operands[1])
448 || REGNO (operands[0]) != REGNO (operands[2]))"
450 [(set (subreg:SI (match_dup 0) 1)
451 (plus:SI (subreg:SI (match_dup 1) 1)
452 (subreg:SI (match_dup 2) 1)))
455 (ltu:SI (subreg:SI (match_dup 0) 1)
456 (subreg:SI (match_dup 2) 1)))
458 (set (subreg:SI (match_dup 0) 0)
459 (plus:SI (subreg:SI (match_dup 1) 0)
460 (subreg:SI (match_dup 2) 0)))
462 (set (subreg:SI (match_dup 0) 0)
463 (plus:SI (subreg:SI (match_dup 0) 0)
467 (define_insn "adddi3_internal_2"
468 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
469 (plus:DI (match_operand:DI 1 "register_operand" "%d,%d,%d")
470 (match_operand:DI 2 "small_int" "P,J,N")))
471 (clobber (match_operand:SI 3 "register_operand" "=d,d,d"))]
472 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && INTVAL (operands[2]) != -32768"
474 addu\\t%L0,%L1,%2\;sltu\\t%3,%L0,%2\;addu\\t%M0,%M1,%3
475 move\\t%L0,%L1\;move\\t%M0,%M1
476 subu\\t%L0,%L1,%n2\;sltu\\t%3,%L0,%2\;subu\\t%M0,%M1,1\;addu\\t%M0,%M0,%3"
477 [(set_attr "type" "darith")
478 (set_attr "mode" "DI")
479 (set_attr "length" "3,2,4")])
482 [(set (match_operand:DI 0 "register_operand" "")
483 (plus:DI (match_operand:DI 1 "register_operand" "")
484 (match_operand:DI 2 "small_int" "")))
485 (clobber (match_operand:SI 3 "register_operand" "=d"))]
486 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
487 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
488 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
489 && INTVAL (operands[2]) > 0"
491 [(set (subreg:SI (match_dup 0) 0)
492 (plus:SI (subreg:SI (match_dup 1) 0)
496 (ltu:SI (subreg:SI (match_dup 0) 0)
499 (set (subreg:SI (match_dup 0) 1)
500 (plus:SI (subreg:SI (match_dup 1) 1)
505 [(set (match_operand:DI 0 "register_operand" "")
506 (plus:DI (match_operand:DI 1 "register_operand" "")
507 (match_operand:DI 2 "small_int" "")))
508 (clobber (match_operand:SI 3 "register_operand" "=d"))]
509 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
510 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
511 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
512 && INTVAL (operands[2]) > 0"
514 [(set (subreg:SI (match_dup 0) 1)
515 (plus:SI (subreg:SI (match_dup 1) 1)
519 (ltu:SI (subreg:SI (match_dup 0) 1)
522 (set (subreg:SI (match_dup 0) 0)
523 (plus:SI (subreg:SI (match_dup 1) 0)
527 (define_insn "adddi3_internal_3"
528 [(set (match_operand:DI 0 "register_operand" "=d")
529 (plus:DI (match_operand:DI 1 "reg_or_0_operand" "dJ")
530 (match_operand:DI 2 "arith_operand" "dI")))]
531 "TARGET_64BIT && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768)"
534 return (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
535 ? \"dsubu\\t%0,%z1,%n2\"
536 : \"daddu\\t%0,%z1,%2\";
538 [(set_attr "type" "darith")
539 (set_attr "mode" "DI")
540 (set_attr "length" "1")])
543 (define_insn "addsi3_internal_2"
544 [(set (match_operand:DI 0 "register_operand" "=d")
545 (sign_extend:DI (plus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
546 (match_operand:SI 2 "arith_operand" "dI"))))]
547 "TARGET_64BIT && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768)"
550 return (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
551 ? \"subu\\t%0,%z1,%n2\"
552 : \"addu\\t%0,%z1,%2\";
554 [(set_attr "type" "arith")
555 (set_attr "mode" "SI")
556 (set_attr "length" "1")])
560 ;; ....................
564 ;; ....................
567 (define_insn "subdf3"
568 [(set (match_operand:DF 0 "register_operand" "=f")
569 (minus:DF (match_operand:DF 1 "register_operand" "f")
570 (match_operand:DF 2 "register_operand" "f")))]
573 [(set_attr "type" "fadd")
574 (set_attr "mode" "DF")
575 (set_attr "length" "1")])
577 (define_insn "subsf3"
578 [(set (match_operand:SF 0 "register_operand" "=f")
579 (minus:SF (match_operand:SF 1 "register_operand" "f")
580 (match_operand:SF 2 "register_operand" "f")))]
583 [(set_attr "type" "fadd")
584 (set_attr "mode" "SF")
585 (set_attr "length" "1")])
587 (define_expand "subsi3"
588 [(set (match_operand:SI 0 "register_operand" "=d")
589 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
590 (match_operand:SI 2 "arith_operand" "dI")))]
594 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == -32768)
595 operands[2] = force_reg (SImode, operands[2]);
598 (define_insn "subsi3_internal"
599 [(set (match_operand:SI 0 "register_operand" "=d")
600 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
601 (match_operand:SI 2 "arith_operand" "dI")))]
602 "GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768"
605 return (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
606 ? \"addu\\t%0,%z1,%n2\"
607 : \"subu\\t%0,%z1,%2\";
609 [(set_attr "type" "arith")
610 (set_attr "mode" "SI")
611 (set_attr "length" "1")])
613 (define_expand "subdi3"
614 [(parallel [(set (match_operand:DI 0 "register_operand" "=d")
615 (minus:DI (match_operand:DI 1 "register_operand" "d")
616 (match_operand:DI 2 "register_operand" "d")))
617 (clobber (match_dup 3))])]
618 "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
623 emit_insn (gen_subdi3_internal_3 (operands[0], operands[1],
628 operands[3] = gen_reg_rtx (SImode);
631 (define_insn "subdi3_internal"
632 [(set (match_operand:DI 0 "register_operand" "=d")
633 (minus:DI (match_operand:DI 1 "register_operand" "d")
634 (match_operand:DI 2 "register_operand" "d")))
635 (clobber (match_operand:SI 3 "register_operand" "=d"))]
636 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE"
637 "sltu\\t%3,%L1,%L2\;subu\\t%L0,%L1,%L2\;subu\\t%M0,%M1,%M2\;subu\\t%M0,%M0,%3"
638 [(set_attr "type" "darith")
639 (set_attr "mode" "DI")
640 (set_attr "length" "4")])
643 [(set (match_operand:DI 0 "register_operand" "")
644 (minus:DI (match_operand:DI 1 "register_operand" "")
645 (match_operand:DI 2 "register_operand" "")))
646 (clobber (match_operand:SI 3 "register_operand" ""))]
647 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
648 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
649 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
650 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
653 (ltu:SI (subreg:SI (match_dup 1) 0)
654 (subreg:SI (match_dup 2) 0)))
656 (set (subreg:SI (match_dup 0) 0)
657 (minus:SI (subreg:SI (match_dup 1) 0)
658 (subreg:SI (match_dup 2) 0)))
660 (set (subreg:SI (match_dup 0) 1)
661 (minus:SI (subreg:SI (match_dup 1) 1)
662 (subreg:SI (match_dup 2) 1)))
664 (set (subreg:SI (match_dup 0) 1)
665 (minus:SI (subreg:SI (match_dup 0) 1)
670 [(set (match_operand:DI 0 "register_operand" "")
671 (minus:DI (match_operand:DI 1 "register_operand" "")
672 (match_operand:DI 2 "register_operand" "")))
673 (clobber (match_operand:SI 3 "register_operand" ""))]
674 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
675 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
676 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
677 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
680 (ltu:SI (subreg:SI (match_dup 1) 1)
681 (subreg:SI (match_dup 2) 1)))
683 (set (subreg:SI (match_dup 0) 1)
684 (minus:SI (subreg:SI (match_dup 1) 1)
685 (subreg:SI (match_dup 2) 1)))
687 (set (subreg:SI (match_dup 0) 0)
688 (minus:SI (subreg:SI (match_dup 1) 0)
689 (subreg:SI (match_dup 2) 0)))
691 (set (subreg:SI (match_dup 0) 0)
692 (minus:SI (subreg:SI (match_dup 0) 0)
696 (define_insn "subdi3_internal_2"
697 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
698 (minus:DI (match_operand:DI 1 "register_operand" "d,d,d")
699 (match_operand:DI 2 "small_int" "P,J,N")))
700 (clobber (match_operand:SI 3 "register_operand" "=d,d,d"))]
701 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && INTVAL (operands[2]) != -32768"
703 sltu\\t%3,%L1,%2\;subu\\t%L0,%L1,%2\;subu\\t%M0,%M1,%3
704 move\\t%L0,%L1\;move\\t%M0,%M1
705 sltu\\t%3,%L1,%2\;subu\\t%L0,%L1,%2\;subu\\t%M0,%M1,1\;subu\\t%M0,%M0,%3"
706 [(set_attr "type" "darith")
707 (set_attr "mode" "DI")
708 (set_attr "length" "3,2,4")])
711 [(set (match_operand:DI 0 "register_operand" "")
712 (minus:DI (match_operand:DI 1 "register_operand" "")
713 (match_operand:DI 2 "small_int" "")))
714 (clobber (match_operand:SI 3 "register_operand" ""))]
715 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
716 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
717 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
718 && INTVAL (operands[2]) > 0"
721 (ltu:SI (subreg:SI (match_dup 1) 0)
724 (set (subreg:SI (match_dup 0) 0)
725 (minus:SI (subreg:SI (match_dup 1) 0)
728 (set (subreg:SI (match_dup 0) 1)
729 (minus:SI (subreg:SI (match_dup 1) 1)
734 [(set (match_operand:DI 0 "register_operand" "")
735 (minus:DI (match_operand:DI 1 "register_operand" "")
736 (match_operand:DI 2 "small_int" "")))
737 (clobber (match_operand:SI 3 "register_operand" ""))]
738 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
739 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
740 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
741 && INTVAL (operands[2]) > 0"
744 (ltu:SI (subreg:SI (match_dup 1) 1)
747 (set (subreg:SI (match_dup 0) 1)
748 (minus:SI (subreg:SI (match_dup 1) 1)
751 (set (subreg:SI (match_dup 0) 0)
752 (minus:SI (subreg:SI (match_dup 1) 0)
756 (define_insn "subdi3_internal_3"
757 [(set (match_operand:DI 0 "register_operand" "=d")
758 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "dJ")
759 (match_operand:DI 2 "arith_operand" "dI")))]
760 "TARGET_64BIT && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768)"
763 return (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
764 ? \"daddu\\t%0,%z1,%n2\"
765 : \"dsubu\\t%0,%z1,%2\";
767 [(set_attr "type" "darith")
768 (set_attr "mode" "DI")
769 (set_attr "length" "1")])
772 (define_insn "subsi3_internal_2"
773 [(set (match_operand:DI 0 "register_operand" "=d")
774 (sign_extend:DI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
775 (match_operand:SI 2 "arith_operand" "dI"))))]
776 "TARGET_64BIT && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768)"
779 return (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
780 ? \"addu\\t%0,%z1,%n2\"
781 : \"subu\\t%0,%z1,%2\";
783 [(set_attr "type" "arith")
784 (set_attr "mode" "DI")
785 (set_attr "length" "1")])
789 ;; ....................
793 ;; ....................
796 (define_insn "muldf3"
797 [(set (match_operand:DF 0 "register_operand" "=f")
798 (mult:DF (match_operand:DF 1 "register_operand" "f")
799 (match_operand:DF 2 "register_operand" "f")))]
802 [(set_attr "type" "fmul")
803 (set_attr "mode" "DF")
804 (set_attr "length" "1")])
806 (define_insn "mulsf3"
807 [(set (match_operand:SF 0 "register_operand" "=f")
808 (mult:SF (match_operand:SF 1 "register_operand" "f")
809 (match_operand:SF 2 "register_operand" "f")))]
812 [(set_attr "type" "fmul")
813 (set_attr "mode" "SF")
814 (set_attr "length" "1")])
816 (define_insn "mulsi3"
817 [(set (match_operand:SI 0 "register_operand" "=d")
818 (mult:SI (match_operand:SI 1 "register_operand" "d")
819 (match_operand:SI 2 "register_operand" "d")))
820 (clobber (reg:SI 64))
821 (clobber (reg:SI 65))]
827 xoperands[0] = operands[0];
828 xoperands[1] = gen_rtx (REG, SImode, LO_REGNUM);
830 output_asm_insn (\"mult\\t%1,%2\", operands);
831 output_asm_insn (mips_move_1word (xoperands, insn, FALSE), xoperands);
834 [(set_attr "type" "imul")
835 (set_attr "mode" "SI")
836 (set_attr "length" "3")]) ;; mult + mflo + delay
838 ;; ??? The R4000 (only) has a cpu bug. If a double-word shift executes while
839 ;; a multiply is in progress, it may give an incorrect result. We solve
840 ;; this by not splitting on the r4000.
843 [(set (match_operand:SI 0 "register_operand" "")
844 (mult:SI (match_operand:SI 1 "register_operand" "")
845 (match_operand:SI 2 "register_operand" "")))
846 (clobber (reg:SI 64))
847 (clobber (reg:SI 65))]
848 "!TARGET_DEBUG_D_MODE && mips_cpu != PROCESSOR_R4000"
849 [(parallel [(set (reg:SI 65) ;; low register
850 (mult:SI (match_dup 1)
852 (clobber (reg:SI 64))])
857 (define_insn "mulsi3_internal"
858 [(set (reg:SI 65) ;; low register
859 (mult:SI (match_operand:SI 0 "register_operand" "d")
860 (match_operand:SI 1 "register_operand" "d")))
861 (clobber (reg:SI 64))]
864 [(set_attr "type" "imul")
865 (set_attr "mode" "SI")
866 (set_attr "length" "1")])
868 (define_insn "muldi3"
869 [(set (match_operand:DI 0 "register_operand" "=d")
870 (mult:DI (match_operand:DI 1 "register_operand" "d")
871 (match_operand:DI 2 "register_operand" "d")))
872 (clobber (reg:DI 64))
873 (clobber (reg:DI 65))]
879 xoperands[0] = operands[0];
880 xoperands[1] = gen_rtx (REG, DImode, LO_REGNUM);
882 output_asm_insn (\"dmult\\t%1,%2\", operands);
883 output_asm_insn (mips_move_1word (xoperands, insn, FALSE), xoperands);
886 [(set_attr "type" "imul")
887 (set_attr "mode" "DI")
888 (set_attr "length" "3")]) ;; mult + mflo + delay
890 ;; ??? The R4000 (only) has a cpu bug. If a double-word shift executes while
891 ;; a multiply is in progress, it may give an incorrect result. We solve
892 ;; this by not splitting on the r4000.
895 [(set (match_operand:DI 0 "register_operand" "")
896 (mult:DI (match_operand:DI 1 "register_operand" "")
897 (match_operand:DI 2 "register_operand" "")))
898 (clobber (reg:DI 64))
899 (clobber (reg:DI 65))]
900 "TARGET_64BIT && !TARGET_DEBUG_D_MODE && mips_cpu != PROCESSOR_R4000"
901 [(parallel [(set (reg:DI 65) ;; low register
902 (mult:DI (match_dup 1)
904 (clobber (reg:DI 64))])
909 (define_insn "muldi3_internal"
910 [(set (reg:DI 65) ;; low register
911 (mult:DI (match_operand:DI 0 "register_operand" "d")
912 (match_operand:DI 1 "register_operand" "d")))
913 (clobber (reg:DI 64))]
916 [(set_attr "type" "imul")
917 (set_attr "mode" "DI")
918 (set_attr "length" "1")])
920 ;; In 64 bit mode the mult instruction still writes 32 bits each to HI
921 ;; and LO, so to do mulsidi3 and umultsidi3 we need to pull the values
922 ;; out and combine them by hand into the single output register. Not
923 ;; supported for now.
925 ;; ??? We could define a mulditi3 pattern when TARGET_64BIT.
927 (define_insn "mulsidi3"
928 [(set (match_operand:DI 0 "register_operand" "=d")
929 (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))
930 (sign_extend:DI (match_operand:SI 2 "register_operand" "d"))))
931 (clobber (reg:SI 64))
932 (clobber (reg:SI 65))]
938 xoperands[0] = operands[0];
939 xoperands[1] = gen_rtx (REG, DImode, MD_REG_FIRST);
941 output_asm_insn (\"mult\\t%1,%2\", operands);
942 output_asm_insn (mips_move_2words (xoperands, insn), xoperands);
945 [(set_attr "type" "imul")
946 (set_attr "mode" "SI")
947 (set_attr "length" "4")]) ;; mult + mflo + mfhi + delay
949 (define_insn "umulsidi3"
950 [(set (match_operand:DI 0 "register_operand" "=d")
951 (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "d"))
952 (zero_extend:DI (match_operand:SI 2 "register_operand" "d"))))
953 (clobber (reg:SI 64))
954 (clobber (reg:SI 65))]
960 xoperands[0] = operands[0];
961 xoperands[1] = gen_rtx (REG, DImode, MD_REG_FIRST);
963 output_asm_insn (\"multu\\t%1,%2\", operands);
964 output_asm_insn (mips_move_2words (xoperands, insn), xoperands);
967 [(set_attr "type" "imul")
968 (set_attr "mode" "SI")
969 (set_attr "length" "4")]) ;; mult + mflo + mfhi + delay
973 ;; ....................
975 ;; DIVISION and REMAINDER
977 ;; ....................
980 (define_insn "divdf3"
981 [(set (match_operand:DF 0 "register_operand" "=f")
982 (div:DF (match_operand:DF 1 "register_operand" "f")
983 (match_operand:DF 2 "register_operand" "f")))]
986 [(set_attr "type" "fdiv")
987 (set_attr "mode" "DF")
988 (set_attr "length" "1")])
990 (define_insn "divsf3"
991 [(set (match_operand:SF 0 "register_operand" "=f")
992 (div:SF (match_operand:SF 1 "register_operand" "f")
993 (match_operand:SF 2 "register_operand" "f")))]
996 [(set_attr "type" "fdiv")
997 (set_attr "mode" "SF")
998 (set_attr "length" "1")])
1000 ;; If optimizing, prefer the divmod functions over separate div and
1001 ;; mod functions, since this will allow using one instruction for both
1002 ;; the quotient and remainder. At present, the divmod is not moved out
1003 ;; of loops if it is constant within the loop, so allow -mdebugc to
1004 ;; use the old method of doing things.
1006 ;; 64 is the multiply/divide hi register
1007 ;; 65 is the multiply/divide lo register
1009 ;; ??? We can't accept constants here, because the MIPS assembler will replace
1010 ;; a divide by power of 2 with a shift, and then the remainder is no longer
1013 (define_insn "divmodsi4"
1014 [(set (match_operand:SI 0 "register_operand" "=d")
1015 (div:SI (match_operand:SI 1 "register_operand" "d")
1016 (match_operand:SI 2 "register_operand" "d")))
1017 (set (match_operand:SI 3 "register_operand" "=d")
1018 (mod:SI (match_dup 1)
1020 (clobber (reg:SI 64))
1021 (clobber (reg:SI 65))]
1025 if (find_reg_note (insn, REG_UNUSED, operands[3]))
1026 return \"div\\t%0,%1,%2\";
1028 if (find_reg_note (insn, REG_UNUSED, operands[0]))
1029 return \"rem\\t%3,%1,%2\";
1031 return \"div\\t%0,%1,%2\;mfhi\\t%3\";
1033 [(set_attr "type" "idiv")
1034 (set_attr "mode" "SI")
1035 (set_attr "length" "14")]) ;; various tests for dividing by 0 and such
1037 (define_insn "divmoddi4"
1038 [(set (match_operand:DI 0 "register_operand" "=d")
1039 (div:DI (match_operand:DI 1 "register_operand" "d")
1040 (match_operand:DI 2 "register_operand" "d")))
1041 (set (match_operand:DI 3 "register_operand" "=d")
1042 (mod:DI (match_dup 1)
1044 (clobber (reg:DI 64))
1045 (clobber (reg:DI 65))]
1046 "TARGET_64BIT && optimize"
1049 if (find_reg_note (insn, REG_UNUSED, operands[3]))
1050 return \"ddiv\\t%0,%1,%2\";
1052 if (find_reg_note (insn, REG_UNUSED, operands[0]))
1053 return \"drem\\t%3,%1,%2\";
1055 return \"ddiv\\t%0,%1,%2\;mfhi\\t%3\";
1057 [(set_attr "type" "idiv")
1058 (set_attr "mode" "DI")
1059 (set_attr "length" "15")]) ;; various tests for dividing by 0 and such
1061 (define_insn "udivmodsi4"
1062 [(set (match_operand:SI 0 "register_operand" "=d")
1063 (udiv:SI (match_operand:SI 1 "register_operand" "d")
1064 (match_operand:SI 2 "register_operand" "d")))
1065 (set (match_operand:SI 3 "register_operand" "=d")
1066 (umod:SI (match_dup 1)
1068 (clobber (reg:SI 64))
1069 (clobber (reg:SI 65))]
1073 if (find_reg_note (insn, REG_UNUSED, operands[3]))
1074 return \"divu\\t%0,%1,%2\";
1076 if (find_reg_note (insn, REG_UNUSED, operands[0]))
1077 return \"remu\\t%3,%1,%2\";
1079 return \"divu\\t%0,%1,%2\;mfhi\\t%3\";
1081 [(set_attr "type" "idiv")
1082 (set_attr "mode" "SI")
1083 (set_attr "length" "8")]) ;; various tests for dividing by 0 and such
1085 (define_insn "udivmoddi4"
1086 [(set (match_operand:DI 0 "register_operand" "=d")
1087 (udiv:DI (match_operand:DI 1 "register_operand" "d")
1088 (match_operand:DI 2 "register_operand" "d")))
1089 (set (match_operand:DI 3 "register_operand" "=d")
1090 (umod:DI (match_dup 1)
1092 (clobber (reg:DI 64))
1093 (clobber (reg:DI 65))]
1094 "TARGET_64BIT && optimize"
1097 if (find_reg_note (insn, REG_UNUSED, operands[3]))
1098 return \"ddivu\\t%0,%1,%2\";
1100 if (find_reg_note (insn, REG_UNUSED, operands[0]))
1101 return \"dremu\\t%3,%1,%2\";
1103 return \"ddivu\\t%0,%1,%2\;mfhi\\t%3\";
1105 [(set_attr "type" "idiv")
1106 (set_attr "mode" "DI")
1107 (set_attr "length" "8")]) ;; various tests for dividing by 0 and such
1109 (define_insn "divsi3"
1110 [(set (match_operand:SI 0 "register_operand" "=d")
1111 (div:SI (match_operand:SI 1 "register_operand" "d")
1112 (match_operand:SI 2 "nonmemory_operand" "di")))
1113 (clobber (reg:SI 64))
1114 (clobber (reg:SI 65))]
1117 [(set_attr "type" "idiv")
1118 (set_attr "mode" "SI")
1119 (set_attr "length" "13")]) ;; various tests for dividing by 0 and such
1121 (define_insn "divdi3"
1122 [(set (match_operand:DI 0 "register_operand" "=d")
1123 (div:DI (match_operand:DI 1 "register_operand" "d")
1124 (match_operand:DI 2 "nonmemory_operand" "di")))
1125 (clobber (reg:DI 64))
1126 (clobber (reg:DI 65))]
1127 "TARGET_64BIT && !optimize"
1129 [(set_attr "type" "idiv")
1130 (set_attr "mode" "DI")
1131 (set_attr "length" "14")]) ;; various tests for dividing by 0 and such
1133 (define_insn "modsi3"
1134 [(set (match_operand:SI 0 "register_operand" "=d")
1135 (mod:SI (match_operand:SI 1 "register_operand" "d")
1136 (match_operand:SI 2 "nonmemory_operand" "di")))
1137 (clobber (reg:SI 64))
1138 (clobber (reg:SI 65))]
1141 [(set_attr "type" "idiv")
1142 (set_attr "mode" "SI")
1143 (set_attr "length" "13")]) ;; various tests for dividing by 0 and such
1145 (define_insn "moddi3"
1146 [(set (match_operand:DI 0 "register_operand" "=d")
1147 (mod:DI (match_operand:DI 1 "register_operand" "d")
1148 (match_operand:DI 2 "nonmemory_operand" "di")))
1149 (clobber (reg:DI 64))
1150 (clobber (reg:DI 65))]
1151 "TARGET_64BIT && !optimize"
1153 [(set_attr "type" "idiv")
1154 (set_attr "mode" "DI")
1155 (set_attr "length" "14")]) ;; various tests for dividing by 0 and such
1157 (define_insn "udivsi3"
1158 [(set (match_operand:SI 0 "register_operand" "=d")
1159 (udiv:SI (match_operand:SI 1 "register_operand" "d")
1160 (match_operand:SI 2 "nonmemory_operand" "di")))
1161 (clobber (reg:SI 64))
1162 (clobber (reg:SI 65))]
1165 [(set_attr "type" "idiv")
1166 (set_attr "mode" "SI")
1167 (set_attr "length" "7")]) ;; various tests for dividing by 0 and such
1169 (define_insn "udivdi3"
1170 [(set (match_operand:DI 0 "register_operand" "=d")
1171 (udiv:DI (match_operand:DI 1 "register_operand" "d")
1172 (match_operand:DI 2 "nonmemory_operand" "di")))
1173 (clobber (reg:DI 64))
1174 (clobber (reg:DI 65))]
1175 "TARGET_64BIT && !optimize"
1177 [(set_attr "type" "idiv")
1178 (set_attr "mode" "DI")
1179 (set_attr "length" "7")]) ;; various tests for dividing by 0 and such
1181 (define_insn "umodsi3"
1182 [(set (match_operand:SI 0 "register_operand" "=d")
1183 (umod:SI (match_operand:SI 1 "register_operand" "d")
1184 (match_operand:SI 2 "nonmemory_operand" "di")))
1185 (clobber (reg:SI 64))
1186 (clobber (reg:SI 65))]
1189 [(set_attr "type" "idiv")
1190 (set_attr "mode" "SI")
1191 (set_attr "length" "7")]) ;; various tests for dividing by 0 and such
1193 (define_insn "umoddi3"
1194 [(set (match_operand:DI 0 "register_operand" "=d")
1195 (umod:DI (match_operand:DI 1 "register_operand" "d")
1196 (match_operand:DI 2 "nonmemory_operand" "di")))
1197 (clobber (reg:DI 64))
1198 (clobber (reg:DI 65))]
1199 "TARGET_64BIT && !optimize"
1201 [(set_attr "type" "idiv")
1202 (set_attr "mode" "DI")
1203 (set_attr "length" "7")]) ;; various tests for dividing by 0 and such
1207 ;; ....................
1211 ;; ....................
1213 (define_insn "sqrtdf2"
1214 [(set (match_operand:DF 0 "register_operand" "=f")
1215 (sqrt:DF (match_operand:DF 1 "register_operand" "f")))]
1216 "TARGET_HARD_FLOAT && HAVE_SQRT_P()"
1218 [(set_attr "type" "fsqrt")
1219 (set_attr "mode" "DF")
1220 (set_attr "length" "1")])
1222 (define_insn "sqrtsf2"
1223 [(set (match_operand:SF 0 "register_operand" "=f")
1224 (sqrt:SF (match_operand:SF 1 "register_operand" "f")))]
1225 "TARGET_HARD_FLOAT && HAVE_SQRT_P()"
1227 [(set_attr "type" "fsqrt")
1228 (set_attr "mode" "SF")
1229 (set_attr "length" "1")])
1233 ;; ....................
1237 ;; ....................
1239 ;; Do not use the integer abs macro instruction, since that signals an
1240 ;; exception on -2147483648 (sigh).
1242 (define_insn "abssi2"
1243 [(set (match_operand:SI 0 "register_operand" "=d")
1244 (abs:SI (match_operand:SI 1 "register_operand" "d")))]
1248 dslots_jump_total++;
1249 dslots_jump_filled++;
1250 operands[2] = const0_rtx;
1252 if (REGNO (operands[0]) == REGNO (operands[1]))
1255 return \"%(bltzl\\t%1,1f\\n\\tsubu\\t%0,%z2,%0\\n1:%)\";
1257 return \"bgez\\t%1,1f%#\\n\\tsubu\\t%0,%z2,%0\\n1:\";
1260 return \"%(bgez\\t%1,1f\\n\\tmove\\t%0,%1\\n\\tsubu\\t%0,%z2,%0\\n1:%)\";
1262 [(set_attr "type" "multi")
1263 (set_attr "mode" "SI")
1264 (set_attr "length" "3")])
1266 (define_insn "absdi2"
1267 [(set (match_operand:DI 0 "register_operand" "=d")
1268 (abs:DI (match_operand:DI 1 "register_operand" "d")))]
1272 dslots_jump_total++;
1273 dslots_jump_filled++;
1274 operands[2] = const0_rtx;
1276 if (REGNO (operands[0]) == REGNO (operands[1]))
1277 return \"%(bltzl\\t%1,1f\\n\\tdsubu\\t%0,%z2,%0\\n1:%)\";
1279 return \"%(bgez\\t%1,1f\\n\\tmove\\t%0,%1\\n\\tdsubu\\t%0,%z2,%0\\n1:%)\";
1281 [(set_attr "type" "multi")
1282 (set_attr "mode" "DI")
1283 (set_attr "length" "3")])
1285 (define_insn "absdf2"
1286 [(set (match_operand:DF 0 "register_operand" "=f")
1287 (abs:DF (match_operand:DF 1 "register_operand" "f")))]
1290 [(set_attr "type" "fabs")
1291 (set_attr "mode" "DF")
1292 (set_attr "length" "1")])
1294 (define_insn "abssf2"
1295 [(set (match_operand:SF 0 "register_operand" "=f")
1296 (abs:SF (match_operand:SF 1 "register_operand" "f")))]
1299 [(set_attr "type" "fabs")
1300 (set_attr "mode" "SF")
1301 (set_attr "length" "1")])
1305 ;; ....................
1307 ;; FIND FIRST BIT INSTRUCTION
1309 ;; ....................
1312 (define_insn "ffssi2"
1313 [(set (match_operand:SI 0 "register_operand" "=&d")
1314 (ffs:SI (match_operand:SI 1 "register_operand" "d")))
1315 (clobber (match_scratch:SI 2 "=&d"))
1316 (clobber (match_scratch:SI 3 "=&d"))]
1320 dslots_jump_total += 2;
1321 dslots_jump_filled += 2;
1322 operands[4] = const0_rtx;
1324 if (optimize && find_reg_note (insn, REG_DEAD, operands[1]))
1327 \\tbeq\\t%1,%z4,2f\\n\\
1328 1:\\tand\\t%2,%1,0x0001\\n\\
1329 \\taddu\\t%0,%0,1\\n\\
1330 \\tbeq\\t%2,%z4,1b\\n\\
1331 \\tsrl\\t%1,%1,1\\n\\
1336 \\tmove\\t%3,%1\\n\\
1337 \\tbeq\\t%3,%z4,2f\\n\\
1338 1:\\tand\\t%2,%3,0x0001\\n\\
1339 \\taddu\\t%0,%0,1\\n\\
1340 \\tbeq\\t%2,%z4,1b\\n\\
1341 \\tsrl\\t%3,%3,1\\n\\
1344 [(set_attr "type" "multi")
1345 (set_attr "mode" "SI")
1346 (set_attr "length" "6")])
1348 (define_insn "ffsdi2"
1349 [(set (match_operand:DI 0 "register_operand" "=&d")
1350 (ffs:DI (match_operand:DI 1 "register_operand" "d")))
1351 (clobber (match_scratch:DI 2 "=&d"))
1352 (clobber (match_scratch:DI 3 "=&d"))]
1356 dslots_jump_total += 2;
1357 dslots_jump_filled += 2;
1358 operands[4] = const0_rtx;
1360 if (optimize && find_reg_note (insn, REG_DEAD, operands[1]))
1363 \\tbeq\\t%1,%z4,2f\\n\\
1364 1:\\tand\\t%2,%1,0x0001\\n\\
1365 \\tdaddu\\t%0,%0,1\\n\\
1366 \\tbeq\\t%2,%z4,1b\\n\\
1367 \\tdsrl\\t%1,%1,1\\n\\
1372 \\tmove\\t%3,%1\\n\\
1373 \\tbeq\\t%3,%z4,2f\\n\\
1374 1:\\tand\\t%2,%3,0x0001\\n\\
1375 \\tdaddu\\t%0,%0,1\\n\\
1376 \\tbeq\\t%2,%z4,1b\\n\\
1377 \\tdsrl\\t%3,%3,1\\n\\
1380 [(set_attr "type" "multi")
1381 (set_attr "mode" "DI")
1382 (set_attr "length" "6")])
1386 ;; ....................
1388 ;; NEGATION and ONE'S COMPLEMENT
1390 ;; ....................
1392 (define_insn "negsi2"
1393 [(set (match_operand:SI 0 "register_operand" "=d")
1394 (neg:SI (match_operand:SI 1 "register_operand" "d")))]
1398 operands[2] = const0_rtx;
1399 return \"subu\\t%0,%z2,%1\";
1401 [(set_attr "type" "arith")
1402 (set_attr "mode" "SI")
1403 (set_attr "length" "1")])
1405 (define_expand "negdi2"
1406 [(parallel [(set (match_operand:DI 0 "register_operand" "=d")
1407 (neg:DI (match_operand:DI 1 "register_operand" "d")))
1408 (clobber (match_dup 2))])]
1409 "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
1414 emit_insn (gen_negdi2_internal_2 (operands[0], operands[1]));
1418 operands[2] = gen_reg_rtx (SImode);
1421 (define_insn "negdi2_internal"
1422 [(set (match_operand:DI 0 "register_operand" "=d")
1423 (neg:DI (match_operand:DI 1 "register_operand" "d")))
1424 (clobber (match_operand:SI 2 "register_operand" "=d"))]
1425 "! TARGET_64BIT && !TARGET_DEBUG_G_MODE"
1428 operands[3] = const0_rtx;
1429 return \"subu\\t%L0,%z3,%L1\;subu\\t%M0,%z3,%M1\;sltu\\t%2,%z3,%L0\;subu\\t%M0,%M0,%2\";
1431 [(set_attr "type" "darith")
1432 (set_attr "mode" "DI")
1433 (set_attr "length" "4")])
1435 (define_insn "negdi2_internal_2"
1436 [(set (match_operand:DI 0 "register_operand" "=d")
1437 (neg:DI (match_operand:DI 1 "register_operand" "d")))]
1441 operands[2] = const0_rtx;
1442 return \"dsubu\\t%0,%z2,%1\";
1444 [(set_attr "type" "arith")
1445 (set_attr "mode" "DI")
1446 (set_attr "length" "1")])
1448 (define_insn "negdf2"
1449 [(set (match_operand:DF 0 "register_operand" "=f")
1450 (neg:DF (match_operand:DF 1 "register_operand" "f")))]
1453 [(set_attr "type" "fneg")
1454 (set_attr "mode" "DF")
1455 (set_attr "length" "1")])
1457 (define_insn "negsf2"
1458 [(set (match_operand:SF 0 "register_operand" "=f")
1459 (neg:SF (match_operand:SF 1 "register_operand" "f")))]
1462 [(set_attr "type" "fneg")
1463 (set_attr "mode" "SF")
1464 (set_attr "length" "1")])
1466 (define_insn "one_cmplsi2"
1467 [(set (match_operand:SI 0 "register_operand" "=d")
1468 (not:SI (match_operand:SI 1 "register_operand" "d")))]
1472 operands[2] = const0_rtx;
1473 return \"nor\\t%0,%z2,%1\";
1475 [(set_attr "type" "arith")
1476 (set_attr "mode" "SI")
1477 (set_attr "length" "1")])
1479 (define_insn "one_cmpldi2"
1480 [(set (match_operand:DI 0 "register_operand" "=d")
1481 (not:DI (match_operand:DI 1 "register_operand" "d")))]
1485 operands[2] = const0_rtx;
1487 return \"nor\\t%0,%z2,%1\";
1488 return \"nor\\t%M0,%z2,%M1\;nor\\t%L0,%z2,%L1\";
1490 [(set_attr "type" "darith")
1491 (set_attr "mode" "DI")
1492 (set (attr "length")
1493 (if_then_else (ge (symbol_ref "mips_isa") (const_int 3))
1498 [(set (match_operand:DI 0 "register_operand" "")
1499 (not:DI (match_operand:DI 1 "register_operand" "")))]
1500 "reload_completed && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
1501 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
1502 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))"
1504 [(set (subreg:SI (match_dup 0) 0) (not:SI (subreg:SI (match_dup 1) 0)))
1505 (set (subreg:SI (match_dup 0) 1) (not:SI (subreg:SI (match_dup 1) 1)))]
1508 ;; Simple hack to recognize the "nor" instruction on the MIPS
1509 ;; This must appear before the normal or patterns, so that the
1510 ;; combiner will correctly fold things.
1512 (define_insn "norsi3"
1513 [(set (match_operand:SI 0 "register_operand" "=d")
1514 (not:SI (ior:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
1515 (match_operand:SI 2 "reg_or_0_operand" "dJ"))))]
1518 [(set_attr "type" "arith")
1519 (set_attr "mode" "SI")
1520 (set_attr "length" "1")])
1522 (define_insn "nordi3"
1523 [(set (match_operand:DI 0 "register_operand" "=d")
1524 (not:DI (ior:DI (match_operand:DI 1 "register_operand" "d")
1525 (match_operand:DI 2 "register_operand" "d"))))]
1530 return \"nor\\t%0,%z1,%z2\";
1531 return \"nor\\t%M0,%M1,%M2\;nor\\t%L0,%L1,%L2\";
1533 [(set_attr "type" "darith")
1534 (set_attr "mode" "DI")
1535 (set (attr "length")
1536 (if_then_else (ge (symbol_ref "mips_isa") (const_int 3))
1541 [(set (match_operand:DI 0 "register_operand" "")
1542 (not:DI (ior:DI (match_operand:DI 1 "register_operand" "")
1543 (match_operand:DI 2 "register_operand" ""))))]
1544 "reload_completed && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
1545 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
1546 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
1547 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
1549 [(set (subreg:SI (match_dup 0) 0) (not:SI (ior:SI (subreg:SI (match_dup 1) 0) (subreg:SI (match_dup 2) 0))))
1550 (set (subreg:SI (match_dup 0) 1) (not:SI (ior:SI (subreg:SI (match_dup 1) 1) (subreg:SI (match_dup 2) 1))))]
1555 ;; ....................
1559 ;; ....................
1562 (define_insn "andsi3"
1563 [(set (match_operand:SI 0 "register_operand" "=d,d")
1564 (and:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
1565 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
1570 [(set_attr "type" "arith")
1571 (set_attr "mode" "SI")
1572 (set_attr "length" "1")])
1574 (define_insn "anddi3"
1575 [(set (match_operand:DI 0 "register_operand" "=d")
1576 (and:DI (match_operand:DI 1 "register_operand" "d")
1577 (match_operand:DI 2 "register_operand" "d")))]
1578 "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
1582 return \"and\\t%0,%1,%2\";
1583 return \"and\\t%M0,%M1,%M2\;and\\t%L0,%L1,%L2\";
1585 [(set_attr "type" "darith")
1586 (set_attr "mode" "DI")
1587 (set (attr "length")
1588 (if_then_else (ge (symbol_ref "mips_isa") (const_int 3))
1593 [(set (match_operand:DI 0 "register_operand" "")
1594 (and:DI (match_operand:DI 1 "register_operand" "")
1595 (match_operand:DI 2 "register_operand" "")))]
1596 "reload_completed && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
1597 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
1598 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
1599 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
1601 [(set (subreg:SI (match_dup 0) 0) (and:SI (subreg:SI (match_dup 1) 0) (subreg:SI (match_dup 2) 0)))
1602 (set (subreg:SI (match_dup 0) 1) (and:SI (subreg:SI (match_dup 1) 1) (subreg:SI (match_dup 2) 1)))]
1605 (define_insn "anddi3_internal1"
1606 [(set (match_operand:DI 0 "register_operand" "=d,d")
1607 (and:DI (match_operand:DI 1 "register_operand" "%d,d")
1608 (match_operand:DI 2 "uns_arith_operand" "d,K")))]
1613 [(set_attr "type" "arith")
1614 (set_attr "mode" "DI")
1615 (set_attr "length" "1")])
1617 (define_insn "iorsi3"
1618 [(set (match_operand:SI 0 "register_operand" "=d,d")
1619 (ior:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
1620 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
1625 [(set_attr "type" "arith")
1626 (set_attr "mode" "SI")
1627 (set_attr "length" "1")])
1629 ;;; ??? There is no iordi3 pattern which accepts 'K' constants when
1632 (define_insn "iordi3"
1633 [(set (match_operand:DI 0 "register_operand" "=d")
1634 (ior:DI (match_operand:DI 1 "register_operand" "d")
1635 (match_operand:DI 2 "register_operand" "d")))]
1636 "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
1640 return \"or\\t%0,%1,%2\";
1641 return \"or\\t%M0,%M1,%M2\;or\\t%L0,%L1,%L2\";
1643 [(set_attr "type" "darith")
1644 (set_attr "mode" "DI")
1645 (set (attr "length")
1646 (if_then_else (ge (symbol_ref "mips_isa") (const_int 3))
1651 [(set (match_operand:DI 0 "register_operand" "")
1652 (ior:DI (match_operand:DI 1 "register_operand" "")
1653 (match_operand:DI 2 "register_operand" "")))]
1654 "reload_completed && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
1655 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
1656 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
1657 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
1659 [(set (subreg:SI (match_dup 0) 0) (ior:SI (subreg:SI (match_dup 1) 0) (subreg:SI (match_dup 2) 0)))
1660 (set (subreg:SI (match_dup 0) 1) (ior:SI (subreg:SI (match_dup 1) 1) (subreg:SI (match_dup 2) 1)))]
1663 (define_insn "xorsi3"
1664 [(set (match_operand:SI 0 "register_operand" "=d,d")
1665 (xor:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
1666 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
1671 [(set_attr "type" "arith")
1672 (set_attr "mode" "SI")
1673 (set_attr "length" "1")])
1675 ;; ??? If delete the 32-bit long long patterns, then could merge this with
1676 ;; the following xordi3_internal pattern.
1677 (define_insn "xordi3"
1678 [(set (match_operand:DI 0 "register_operand" "=d")
1679 (xor:DI (match_operand:DI 1 "register_operand" "d")
1680 (match_operand:DI 2 "register_operand" "d")))]
1681 "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
1685 return \"xor\\t%0,%1,%2\";
1686 return \"xor\\t%M0,%M1,%M2\;xor\\t%L0,%L1,%L2\";
1688 [(set_attr "type" "darith")
1689 (set_attr "mode" "DI")
1690 (set (attr "length")
1691 (if_then_else (ge (symbol_ref "mips_isa") (const_int 3))
1696 [(set (match_operand:DI 0 "register_operand" "")
1697 (xor:DI (match_operand:DI 1 "register_operand" "")
1698 (match_operand:DI 2 "register_operand" "")))]
1699 "reload_completed && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
1700 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
1701 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
1702 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
1704 [(set (subreg:SI (match_dup 0) 0) (xor:SI (subreg:SI (match_dup 1) 0) (subreg:SI (match_dup 2) 0)))
1705 (set (subreg:SI (match_dup 0) 1) (xor:SI (subreg:SI (match_dup 1) 1) (subreg:SI (match_dup 2) 1)))]
1708 (define_insn "xordi3_immed"
1709 [(set (match_operand:DI 0 "register_operand" "d")
1710 (xor:DI (match_operand:DI 1 "register_operand" "d")
1711 (match_operand:DI 2 "uns_arith_operand" "K")))]
1714 [(set_attr "type" "arith")
1715 (set_attr "mode" "DI")
1716 (set_attr "length" "1")])
1720 ;; ....................
1724 ;; ....................
1726 (define_insn "truncdfsf2"
1727 [(set (match_operand:SF 0 "register_operand" "=f")
1728 (float_truncate:SF (match_operand:DF 1 "register_operand" "f")))]
1731 [(set_attr "type" "fcvt")
1732 (set_attr "mode" "SF")
1733 (set_attr "length" "1")])
1735 ;; ??? This should be a define expand.
1736 ;; See the zero_extendsidi2 pattern.
1737 (define_insn "truncdisi2"
1738 [(set (match_operand:SI 0 "register_operand" "=d")
1739 (truncate:SI (match_operand:DI 1 "register_operand" "d")))]
1741 "dsll\\t%0,%1,32\;dsra\\t%0,%0,32"
1742 [(set_attr "type" "darith")
1743 (set_attr "mode" "SI")
1744 (set_attr "length" "2")])
1746 (define_insn "truncdihi2"
1747 [(set (match_operand:HI 0 "register_operand" "=d")
1748 (truncate:HI (match_operand:DI 1 "register_operand" "d")))]
1750 "andi\\t%0,%1,0xffff"
1751 [(set_attr "type" "darith")
1752 (set_attr "mode" "HI")
1753 (set_attr "length" "1")])
1755 (define_insn "truncdiqi2"
1756 [(set (match_operand:QI 0 "register_operand" "=d")
1757 (truncate:QI (match_operand:DI 1 "register_operand" "d")))]
1759 "andi\\t%0,%1,0x00ff"
1760 [(set_attr "type" "darith")
1761 (set_attr "mode" "QI")
1762 (set_attr "length" "1")])
1765 ;; ....................
1769 ;; ....................
1772 ;; Those for integer source operand
1773 ;; are ordered widest source type first.
1775 (define_expand "zero_extendsidi2"
1776 [(set (match_operand:DI 0 "register_operand" "")
1777 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
1781 if (optimize && GET_CODE (operands[1]) == MEM)
1782 operands[1] = force_not_mem (operands[1]);
1784 if (GET_CODE (operands[1]) != MEM)
1786 rtx op1 = gen_lowpart (DImode, operands[1]);
1787 rtx temp = gen_reg_rtx (DImode);
1788 rtx shift = gen_rtx (CONST_INT, VOIDmode, 32);
1790 emit_insn (gen_ashldi3 (temp, op1, shift));
1791 emit_insn (gen_lshrdi3 (operands[0], temp, shift));
1796 (define_insn "zero_extendsidi2_internal"
1797 [(set (match_operand:DI 0 "register_operand" "=d,d")
1798 (zero_extend:DI (match_operand:SI 1 "memory_operand" "R,m")))]
1800 "* return mips_move_1word (operands, insn, TRUE);"
1801 [(set_attr "type" "load")
1802 (set_attr "mode" "DI")
1803 (set_attr "length" "1,2")])
1806 (define_insn "zero_extendhisi2"
1807 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
1808 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "d,R,m")))]
1812 if (which_alternative == 0)
1813 return \"andi\\t%0,%1,0xffff\";
1815 return mips_move_1word (operands, insn, TRUE);
1817 [(set_attr "type" "arith,load,load")
1818 (set_attr "mode" "SI")
1819 (set_attr "length" "1,1,2")])
1821 (define_insn "zero_extendhidi2"
1822 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
1823 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "d,R,m")))]
1827 if (which_alternative == 0)
1828 return \"andi\\t%0,%1,0xffff\";
1830 return mips_move_1word (operands, insn, TRUE);
1832 [(set_attr "type" "arith,load,load")
1833 (set_attr "mode" "DI")
1834 (set_attr "length" "1,1,2")])
1836 (define_insn "zero_extendqihi2"
1837 [(set (match_operand:HI 0 "register_operand" "=d,d,d")
1838 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "d,R,m")))]
1842 if (which_alternative == 0)
1843 return \"andi\\t%0,%1,0x00ff\";
1845 return mips_move_1word (operands, insn, TRUE);
1847 [(set_attr "type" "arith,load,load")
1848 (set_attr "mode" "HI")
1849 (set_attr "length" "1,1,2")])
1851 (define_insn "zero_extendqisi2"
1852 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
1853 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "d,R,m")))]
1857 if (which_alternative == 0)
1858 return \"andi\\t%0,%1,0x00ff\";
1860 return mips_move_1word (operands, insn, TRUE);
1862 [(set_attr "type" "arith,load,load")
1863 (set_attr "mode" "SI")
1864 (set_attr "length" "1,1,2")])
1866 (define_insn "zero_extendqidi2"
1867 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
1868 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "d,R,m")))]
1872 if (which_alternative == 0)
1873 return \"andi\\t%0,%1,0x00ff\";
1875 return mips_move_1word (operands, insn, TRUE);
1877 [(set_attr "type" "arith,load,load")
1878 (set_attr "mode" "DI")
1879 (set_attr "length" "1,1,2")])
1883 ;; ....................
1887 ;; ....................
1890 ;; Those for integer source operand
1891 ;; are ordered widest source type first.
1893 ;; ??? This should be a define_expand.
1895 (define_insn "extendsidi2"
1896 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
1897 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,R,m")))]
1901 if (which_alternative == 0)
1902 return \"dsll\\t%0,%1,32\;dsra\\t%0,%0,32\";
1903 return mips_move_1word (operands, insn, FALSE);
1905 [(set_attr "type" "arith,load,load")
1906 (set_attr "mode" "DI")
1907 (set_attr "length" "2,1,2")])
1909 ;; These patterns originally accepted general_operands, however, slightly
1910 ;; better code is generated by only accepting register_operands, and then
1911 ;; letting combine generate the lh and lb insns.
1913 (define_expand "extendhidi2"
1914 [(set (match_operand:DI 0 "register_operand" "")
1915 (sign_extend:DI (match_operand:HI 1 "nonimmediate_operand" "")))]
1919 if (optimize && GET_CODE (operands[1]) == MEM)
1920 operands[1] = force_not_mem (operands[1]);
1922 if (GET_CODE (operands[1]) != MEM)
1924 rtx op1 = gen_lowpart (DImode, operands[1]);
1925 rtx temp = gen_reg_rtx (DImode);
1926 rtx shift = gen_rtx (CONST_INT, VOIDmode, 48);
1928 emit_insn (gen_ashldi3 (temp, op1, shift));
1929 emit_insn (gen_ashrdi3 (operands[0], temp, shift));
1934 (define_insn "extendhidi2_internal"
1935 [(set (match_operand:DI 0 "register_operand" "=d,d")
1936 (sign_extend:DI (match_operand:HI 1 "memory_operand" "R,m")))]
1938 "* return mips_move_1word (operands, insn, FALSE);"
1939 [(set_attr "type" "load")
1940 (set_attr "mode" "DI")
1941 (set_attr "length" "1,2")])
1943 (define_expand "extendhisi2"
1944 [(set (match_operand:SI 0 "register_operand" "")
1945 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
1949 if (optimize && GET_CODE (operands[1]) == MEM)
1950 operands[1] = force_not_mem (operands[1]);
1952 if (GET_CODE (operands[1]) != MEM)
1954 rtx op1 = gen_lowpart (SImode, operands[1]);
1955 rtx temp = gen_reg_rtx (SImode);
1956 rtx shift = gen_rtx (CONST_INT, VOIDmode, 16);
1958 emit_insn (gen_ashlsi3 (temp, op1, shift));
1959 emit_insn (gen_ashrsi3 (operands[0], temp, shift));
1964 (define_insn "extendhisi2_internal"
1965 [(set (match_operand:SI 0 "register_operand" "=d,d")
1966 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,m")))]
1968 "* return mips_move_1word (operands, insn, FALSE);"
1969 [(set_attr "type" "load")
1970 (set_attr "mode" "SI")
1971 (set_attr "length" "1,2")])
1973 (define_expand "extendqihi2"
1974 [(set (match_operand:HI 0 "register_operand" "")
1975 (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))]
1979 if (optimize && GET_CODE (operands[1]) == MEM)
1980 operands[1] = force_not_mem (operands[1]);
1982 if (GET_CODE (operands[1]) != MEM)
1984 rtx op0 = gen_lowpart (SImode, operands[0]);
1985 rtx op1 = gen_lowpart (SImode, operands[1]);
1986 rtx temp = gen_reg_rtx (SImode);
1987 rtx shift = gen_rtx (CONST_INT, VOIDmode, 24);
1989 emit_insn (gen_ashlsi3 (temp, op1, shift));
1990 emit_insn (gen_ashrsi3 (op0, temp, shift));
1995 (define_insn "extendqihi2_internal"
1996 [(set (match_operand:HI 0 "register_operand" "=d,d")
1997 (sign_extend:HI (match_operand:QI 1 "memory_operand" "R,m")))]
1999 "* return mips_move_1word (operands, insn, FALSE);"
2000 [(set_attr "type" "load")
2001 (set_attr "mode" "SI")
2002 (set_attr "length" "1,2")])
2005 (define_expand "extendqisi2"
2006 [(set (match_operand:SI 0 "register_operand" "")
2007 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
2011 if (optimize && GET_CODE (operands[1]) == MEM)
2012 operands[1] = force_not_mem (operands[1]);
2014 if (GET_CODE (operands[1]) != MEM)
2016 rtx op1 = gen_lowpart (SImode, operands[1]);
2017 rtx temp = gen_reg_rtx (SImode);
2018 rtx shift = gen_rtx (CONST_INT, VOIDmode, 24);
2020 emit_insn (gen_ashlsi3 (temp, op1, shift));
2021 emit_insn (gen_ashrsi3 (operands[0], temp, shift));
2026 (define_insn "extendqisi2_insn"
2027 [(set (match_operand:SI 0 "register_operand" "=d,d")
2028 (sign_extend:SI (match_operand:QI 1 "memory_operand" "R,m")))]
2030 "* return mips_move_1word (operands, insn, FALSE);"
2031 [(set_attr "type" "load")
2032 (set_attr "mode" "SI")
2033 (set_attr "length" "1,2")])
2035 (define_expand "extendqidi2"
2036 [(set (match_operand:DI 0 "register_operand" "")
2037 (sign_extend:DI (match_operand:QI 1 "nonimmediate_operand" "")))]
2041 if (optimize && GET_CODE (operands[1]) == MEM)
2042 operands[1] = force_not_mem (operands[1]);
2044 if (GET_CODE (operands[1]) != MEM)
2046 rtx op1 = gen_lowpart (DImode, operands[1]);
2047 rtx temp = gen_reg_rtx (DImode);
2048 rtx shift = gen_rtx (CONST_INT, VOIDmode, 56);
2050 emit_insn (gen_ashldi3 (temp, op1, shift));
2051 emit_insn (gen_ashrdi3 (operands[0], temp, shift));
2056 (define_insn "extendqidi2_insn"
2057 [(set (match_operand:DI 0 "register_operand" "=d,d")
2058 (sign_extend:DI (match_operand:QI 1 "memory_operand" "R,m")))]
2060 "* return mips_move_1word (operands, insn, FALSE);"
2061 [(set_attr "type" "load")
2062 (set_attr "mode" "DI")
2063 (set_attr "length" "1,2")])
2066 (define_insn "extendsfdf2"
2067 [(set (match_operand:DF 0 "register_operand" "=f")
2068 (float_extend:DF (match_operand:SF 1 "register_operand" "f")))]
2071 [(set_attr "type" "fcvt")
2072 (set_attr "mode" "DF")
2073 (set_attr "length" "1")])
2078 ;; ....................
2082 ;; ....................
2084 ;; The SImode scratch register can not be shared with address regs used for
2085 ;; operand zero, because then the address in the move instruction will be
2086 ;; clobbered. We mark the scratch register as early clobbered to prevent this.
2088 (define_insn "fix_truncdfsi2"
2089 [(set (match_operand:SI 0 "general_operand" "=d,*f,R,o")
2090 (fix:SI (match_operand:DF 1 "register_operand" "f,*f,f,f")))
2091 (clobber (match_scratch:SI 2 "=d,*d,&d,&d"))
2092 (clobber (match_scratch:DF 3 "=f,*X,f,f"))]
2098 if (which_alternative == 1)
2099 return \"trunc.w.d %0,%1,%2\";
2101 output_asm_insn (\"trunc.w.d %3,%1,%2\", operands);
2103 xoperands[0] = operands[0];
2104 xoperands[1] = operands[3];
2105 output_asm_insn (mips_move_1word (xoperands, insn, FALSE), xoperands);
2108 [(set_attr "type" "fcvt")
2109 (set_attr "mode" "DF")
2110 (set_attr "length" "11,9,10,11")])
2113 (define_insn "fix_truncsfsi2"
2114 [(set (match_operand:SI 0 "general_operand" "=d,*f,R,o")
2115 (fix:SI (match_operand:SF 1 "register_operand" "f,*f,f,f")))
2116 (clobber (match_scratch:SI 2 "=d,*d,&d,&d"))
2117 (clobber (match_scratch:SF 3 "=f,*X,f,f"))]
2123 if (which_alternative == 1)
2124 return \"trunc.w.s %0,%1,%2\";
2126 output_asm_insn (\"trunc.w.s %3,%1,%2\", operands);
2128 xoperands[0] = operands[0];
2129 xoperands[1] = operands[3];
2130 output_asm_insn (mips_move_1word (xoperands, insn, FALSE), xoperands);
2133 [(set_attr "type" "fcvt")
2134 (set_attr "mode" "SF")
2135 (set_attr "length" "11,9,10,11")])
2138 ;;; ??? trunc.l.d is mentioned in the appendix of the 1993 r4000/r4600 manuals
2139 ;;; but not in the chapter that describes the FPU. It is not mentioned at all
2140 ;;; in the 1991 manuals. The r4000 at Cygnus does not have this instruction.
2142 ;;; Deleting this means that we now need two libgcc2.a libraries. One for
2143 ;;; the 32 bit calling convention and one for the 64 bit calling convention.
2145 ;;; If this is disabled, then fixuns_truncdfdi2 must be disabled also.
2147 (define_insn "fix_truncdfdi2"
2148 [(set (match_operand:DI 0 "general_operand" "=d,*f,R,o")
2149 (fix:DI (match_operand:DF 1 "register_operand" "f,*f,f,f")))
2150 (clobber (match_scratch:DF 2 "=f,*X,f,f"))]
2151 "TARGET_HARD_FLOAT && TARGET_64BIT"
2156 if (which_alternative == 1)
2157 return \"trunc.l.d %0,%1\";
2159 output_asm_insn (\"trunc.l.d %2,%1\", operands);
2161 xoperands[0] = operands[0];
2162 xoperands[1] = operands[2];
2163 output_asm_insn (mips_move_2words (xoperands, insn, FALSE), xoperands);
2166 [(set_attr "type" "fcvt")
2167 (set_attr "mode" "DF")
2168 (set_attr "length" "2,1,2,3")])
2171 ;;; ??? trunc.l.s is mentioned in the appendix of the 1993 r4000/r4600 manuals
2172 ;;; but not in the chapter that describes the FPU. It is not mentioned at all
2173 ;;; in the 1991 manuals. The r4000 at Cygnus does not have this instruction.
2174 (define_insn "fix_truncsfdi2"
2175 [(set (match_operand:DI 0 "general_operand" "=d,*f,R,o")
2176 (fix:DI (match_operand:SF 1 "register_operand" "f,*f,f,f")))
2177 (clobber (match_scratch:DF 2 "=f,*X,f,f"))]
2178 "TARGET_HARD_FLOAT && TARGET_64BIT"
2183 if (which_alternative == 1)
2184 return \"trunc.l.s %0,%1\";
2186 output_asm_insn (\"trunc.l.s %2,%1\", operands);
2188 xoperands[0] = operands[0];
2189 xoperands[1] = operands[2];
2190 output_asm_insn (mips_move_2words (xoperands, insn, FALSE), xoperands);
2193 [(set_attr "type" "fcvt")
2194 (set_attr "mode" "SF")
2195 (set_attr "length" "2,1,2,3")])
2198 (define_insn "floatsidf2"
2199 [(set (match_operand:DF 0 "register_operand" "=f,f,f")
2200 (float:DF (match_operand:SI 1 "nonimmediate_operand" "d,R,m")))]
2204 dslots_load_total++;
2205 if (GET_CODE (operands[1]) == MEM)
2206 return \"l.s\\t%0,%1%#\;cvt.d.w\\t%0,%0\";
2208 return \"mtc1\\t%1,%0%#\;cvt.d.w\\t%0,%0\";
2210 [(set_attr "type" "fcvt")
2211 (set_attr "mode" "DF")
2212 (set_attr "length" "3,4,3")])
2215 (define_insn "floatdidf2"
2216 [(set (match_operand:DF 0 "register_operand" "=f,f,f")
2217 (float:DF (match_operand:DI 1 "nonimmediate_operand" "d,R,m")))]
2218 "TARGET_HARD_FLOAT && TARGET_64BIT"
2221 dslots_load_total++;
2222 if (GET_CODE (operands[1]) == MEM)
2223 return \"l.d\\t%0,%1%#\;cvt.d.l\\t%0,%0\";
2225 return \"dmtc1\\t%1,%0%#\;cvt.d.l\\t%0,%0\";
2227 [(set_attr "type" "fcvt")
2228 (set_attr "mode" "DF")
2229 (set_attr "length" "3,4,3")])
2232 (define_insn "floatsisf2"
2233 [(set (match_operand:SF 0 "register_operand" "=f,f,f")
2234 (float:SF (match_operand:SI 1 "nonimmediate_operand" "d,R,m")))]
2238 dslots_load_total++;
2239 if (GET_CODE (operands[1]) == MEM)
2240 return \"l.s\\t%0,%1%#\;cvt.s.w\\t%0,%0\";
2242 return \"mtc1\\t%1,%0%#\;cvt.s.w\\t%0,%0\";
2244 [(set_attr "type" "fcvt")
2245 (set_attr "mode" "SF")
2246 (set_attr "length" "3,4,3")])
2249 (define_insn "floatdisf2"
2250 [(set (match_operand:SF 0 "register_operand" "=f,f,f")
2251 (float:SF (match_operand:DI 1 "nonimmediate_operand" "d,R,m")))]
2252 "TARGET_HARD_FLOAT && TARGET_64BIT"
2255 dslots_load_total++;
2256 if (GET_CODE (operands[1]) == MEM)
2257 return \"l.d\\t%0,%1%#\;cvt.s.l\\t%0,%0\";
2259 return \"dmtc1\\t%1,%0%#\;cvt.s.l\\t%0,%0\";
2261 [(set_attr "type" "fcvt")
2262 (set_attr "mode" "SF")
2263 (set_attr "length" "3,4,3")])
2266 (define_expand "fixuns_truncdfsi2"
2267 [(set (match_operand:SI 0 "register_operand" "")
2268 (unsigned_fix:SI (match_operand:DF 1 "register_operand" "")))]
2272 rtx reg1 = gen_reg_rtx (DFmode);
2273 rtx reg2 = gen_reg_rtx (DFmode);
2274 rtx reg3 = gen_reg_rtx (SImode);
2275 rtx label1 = gen_label_rtx ();
2276 rtx label2 = gen_label_rtx ();
2277 REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (1.0, 31);
2279 if (reg1) /* turn off complaints about unreached code */
2281 emit_move_insn (reg1, immed_real_const_1 (offset, DFmode));
2282 do_pending_stack_adjust ();
2284 emit_insn (gen_cmpdf (operands[1], reg1));
2285 emit_jump_insn (gen_bge (label1));
2287 emit_insn (gen_fix_truncdfsi2 (operands[0], operands[1]));
2288 emit_jump_insn (gen_rtx (SET, VOIDmode, pc_rtx,
2289 gen_rtx (LABEL_REF, VOIDmode, label2)));
2292 emit_label (label1);
2293 emit_move_insn (reg2, gen_rtx (MINUS, DFmode, operands[1], reg1));
2294 emit_move_insn (reg3, gen_rtx (CONST_INT, VOIDmode, 0x80000000));
2296 emit_insn (gen_fix_truncdfsi2 (operands[0], reg2));
2297 emit_insn (gen_iorsi3 (operands[0], operands[0], reg3));
2299 emit_label (label2);
2301 /* allow REG_NOTES to be set on last insn (labels don't have enough
2302 fields, and can't be used for REG_NOTES anyway). */
2303 emit_insn (gen_rtx (USE, VOIDmode, stack_pointer_rtx));
2309 (define_expand "fixuns_truncdfdi2"
2310 [(set (match_operand:DI 0 "register_operand" "")
2311 (unsigned_fix:DI (match_operand:DF 1 "register_operand" "")))]
2312 "TARGET_HARD_FLOAT && TARGET_64BIT"
2315 rtx reg1 = gen_reg_rtx (DFmode);
2316 rtx reg2 = gen_reg_rtx (DFmode);
2317 rtx reg3 = gen_reg_rtx (DImode);
2318 rtx label1 = gen_label_rtx ();
2319 rtx label2 = gen_label_rtx ();
2320 REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (1.0, 63);
2322 if (reg1) /* turn off complaints about unreached code */
2324 emit_move_insn (reg1, immed_real_const_1 (offset, DFmode));
2325 do_pending_stack_adjust ();
2327 emit_insn (gen_cmpdf (operands[1], reg1));
2328 emit_jump_insn (gen_bge (label1));
2330 emit_insn (gen_fix_truncdfdi2 (operands[0], operands[1]));
2331 emit_jump_insn (gen_rtx (SET, VOIDmode, pc_rtx,
2332 gen_rtx (LABEL_REF, VOIDmode, label2)));
2335 emit_label (label1);
2336 emit_move_insn (reg2, gen_rtx (MINUS, DFmode, operands[1], reg1));
2337 emit_move_insn (reg3, gen_rtx (CONST_INT, VOIDmode, 0x80000000));
2338 emit_insn (gen_ashldi3 (reg3, reg3, GEN_INT (32)));
2340 emit_insn (gen_fix_truncdfdi2 (operands[0], reg2));
2341 emit_insn (gen_iordi3 (operands[0], operands[0], reg3));
2343 emit_label (label2);
2345 /* allow REG_NOTES to be set on last insn (labels don't have enough
2346 fields, and can't be used for REG_NOTES anyway). */
2347 emit_insn (gen_rtx (USE, VOIDmode, stack_pointer_rtx));
2353 (define_expand "fixuns_truncsfsi2"
2354 [(set (match_operand:SI 0 "register_operand" "")
2355 (unsigned_fix:SI (match_operand:SF 1 "register_operand" "")))]
2359 rtx reg1 = gen_reg_rtx (SFmode);
2360 rtx reg2 = gen_reg_rtx (SFmode);
2361 rtx reg3 = gen_reg_rtx (SImode);
2362 rtx label1 = gen_label_rtx ();
2363 rtx label2 = gen_label_rtx ();
2364 REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (1.0, 31);
2366 if (reg1) /* turn off complaints about unreached code */
2368 emit_move_insn (reg1, immed_real_const_1 (offset, SFmode));
2369 do_pending_stack_adjust ();
2371 emit_insn (gen_cmpsf (operands[1], reg1));
2372 emit_jump_insn (gen_bge (label1));
2374 emit_insn (gen_fix_truncsfsi2 (operands[0], operands[1]));
2375 emit_jump_insn (gen_rtx (SET, VOIDmode, pc_rtx,
2376 gen_rtx (LABEL_REF, VOIDmode, label2)));
2379 emit_label (label1);
2380 emit_move_insn (reg2, gen_rtx (MINUS, SFmode, operands[1], reg1));
2381 emit_move_insn (reg3, gen_rtx (CONST_INT, VOIDmode, 0x80000000));
2383 emit_insn (gen_fix_truncsfsi2 (operands[0], reg2));
2384 emit_insn (gen_iorsi3 (operands[0], operands[0], reg3));
2386 emit_label (label2);
2388 /* allow REG_NOTES to be set on last insn (labels don't have enough
2389 fields, and can't be used for REG_NOTES anyway). */
2390 emit_insn (gen_rtx (USE, VOIDmode, stack_pointer_rtx));
2396 (define_expand "fixuns_truncsfdi2"
2397 [(set (match_operand:DI 0 "register_operand" "")
2398 (unsigned_fix:DI (match_operand:SF 1 "register_operand" "")))]
2399 "TARGET_HARD_FLOAT && TARGET_64BIT"
2402 rtx reg1 = gen_reg_rtx (SFmode);
2403 rtx reg2 = gen_reg_rtx (SFmode);
2404 rtx reg3 = gen_reg_rtx (DImode);
2405 rtx label1 = gen_label_rtx ();
2406 rtx label2 = gen_label_rtx ();
2407 REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (1.0, 63);
2409 if (reg1) /* turn off complaints about unreached code */
2411 emit_move_insn (reg1, immed_real_const_1 (offset, SFmode));
2412 do_pending_stack_adjust ();
2414 emit_insn (gen_cmpsf (operands[1], reg1));
2415 emit_jump_insn (gen_bge (label1));
2417 emit_insn (gen_fix_truncsfdi2 (operands[0], operands[1]));
2418 emit_jump_insn (gen_rtx (SET, VOIDmode, pc_rtx,
2419 gen_rtx (LABEL_REF, VOIDmode, label2)));
2422 emit_label (label1);
2423 emit_move_insn (reg2, gen_rtx (MINUS, SFmode, operands[1], reg1));
2424 emit_move_insn (reg3, gen_rtx (CONST_INT, VOIDmode, 0x80000000));
2425 emit_insn (gen_ashldi3 (reg3, reg3, GEN_INT (32)));
2427 emit_insn (gen_fix_truncsfdi2 (operands[0], reg2));
2428 emit_insn (gen_iordi3 (operands[0], operands[0], reg3));
2430 emit_label (label2);
2432 /* allow REG_NOTES to be set on last insn (labels don't have enough
2433 fields, and can't be used for REG_NOTES anyway). */
2434 emit_insn (gen_rtx (USE, VOIDmode, stack_pointer_rtx));
2441 ;; ....................
2445 ;; ....................
2447 ;; unaligned word moves generated by the block moves.
2449 ;; I don't think these are used anymore. Ian Taylor 30 Sep 93
2451 ;;(define_expand "movsi_unaligned"
2452 ;; [(set (match_operand:SI 0 "general_operand" "")
2453 ;; (unspec [(match_operand:SI 1 "general_operand" "")] 0))]
2457 ;; /* Handle stores. */
2458 ;; if (GET_CODE (operands[0]) == MEM)
2460 ;; rtx reg = gen_reg_rtx (SImode);
2461 ;; rtx insn = emit_insn (gen_movsi_ulw (reg, operands[1]));
2462 ;; rtx addr = XEXP (operands[0], 0);
2463 ;; if (CONSTANT_P (addr))
2464 ;; REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_EQUIV, addr, REG_NOTES (insn));
2466 ;; if (reg_or_0_operand (operands[1], SImode))
2469 ;; operands[1] = reg;
2472 ;; /* Generate appropriate load, store. If not a load or store,
2473 ;; do a normal movsi. */
2474 ;; if (GET_CODE (operands[0]) != MEM && GET_CODE (operands[1]) != MEM)
2476 ;; emit_insn (gen_movsi (operands[0], operands[1]));
2480 ;; /* Fall through and generate normal code. */
2483 ;;(define_insn "movsi_ulw"
2484 ;; [(set (match_operand:SI 0 "register_operand" "=&d,&d,d,d")
2485 ;; (unspec [(match_operand:SI 1 "general_operand" "R,o,dIKL,M")] 0))]
2489 ;; enum rtx_code code;
2495 ;; if (which_alternative != 0)
2496 ;; return mips_move_1word (operands, insn, FALSE);
2498 ;; if (TARGET_STATS)
2499 ;; mips_count_memory_refs (operands[1], 2);
2501 ;; /* The stack/frame pointers are always aligned, so we can convert
2502 ;; to the faster lw if we are referencing an aligned stack location. */
2504 ;; offset = const0_rtx;
2505 ;; addr = XEXP (operands[1], 0);
2506 ;; mem_addr = eliminate_constant_term (addr, &offset);
2508 ;; if ((INTVAL (offset) & (UNITS_PER_WORD-1)) == 0
2509 ;; && (mem_addr == stack_pointer_rtx || mem_addr == frame_pointer_rtx))
2510 ;; ret = \"lw\\t%0,%1\";
2514 ;; ret = \"ulw\\t%0,%1\";
2517 ;; enum rtx_code code = GET_CODE (addr);
2519 ;; if (code == CONST || code == SYMBOL_REF || code == LABEL_REF)
2521 ;; operands[2] = gen_rtx (REG, SImode, GP_REG_FIRST + 1);
2522 ;; ret = \"%[la\\t%2,%1\;ulw\\t%0,0(%2)%]\";
2527 ;; return mips_fill_delay_slot (ret, DELAY_LOAD, operands, insn);
2529 ;; [(set_attr "type" "load,load,move,arith")
2530 ;; (set_attr "mode" "SI")
2531 ;; (set_attr "length" "2,4,1,2")])
2533 ;;(define_insn "movsi_usw"
2534 ;; [(set (match_operand:SI 0 "memory_operand" "=R,o")
2535 ;; (unspec [(match_operand:SI 1 "reg_or_0_operand" "dJ,dJ")] 0))]
2539 ;; rtx offset = const0_rtx;
2540 ;; rtx addr = XEXP (operands[0], 0);
2541 ;; rtx mem_addr = eliminate_constant_term (addr, &offset);
2543 ;; if (TARGET_STATS)
2544 ;; mips_count_memory_refs (operands[0], 2);
2546 ;; /* The stack/frame pointers are always aligned, so we can convert
2547 ;; to the faster sw if we are referencing an aligned stack location. */
2549 ;; if ((INTVAL (offset) & (UNITS_PER_WORD-1)) == 0
2550 ;; && (mem_addr == stack_pointer_rtx || mem_addr == frame_pointer_rtx))
2551 ;; return \"sw\\t%1,%0\";
2556 ;; enum rtx_code code = GET_CODE (XEXP (operands[0], 0));
2558 ;; if (code == CONST || code == SYMBOL_REF || code == LABEL_REF)
2560 ;; operands[2] = gen_rtx (REG, SImode, GP_REG_FIRST + 1);
2561 ;; return \"%[la\\t%2,%0\;usw\\t%z1,0(%2)%]\";
2565 ;; return \"usw\\t%z1,%0\";
2567 ;; [(set_attr "type" "store")
2568 ;; (set_attr "mode" "SI")
2569 ;; (set_attr "length" "2,4")])
2572 ;; 64-bit integer moves
2574 ;; Unlike most other insns, the move insns can't be split with
2575 ;; different predicates, because register spilling and other parts of
2576 ;; the compiler, have memoized the insn number already.
2578 (define_expand "movdi"
2579 [(set (match_operand:DI 0 "nonimmediate_operand" "")
2580 (match_operand:DI 1 "general_operand" ""))]
2584 if ((reload_in_progress | reload_completed) == 0
2585 && !register_operand (operands[0], DImode)
2586 && !register_operand (operands[1], DImode)
2587 && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 0)
2588 && operands[1] != CONST0_RTX (DImode))
2590 rtx temp = force_reg (DImode, operands[1]);
2591 emit_move_insn (operands[0], temp);
2596 (define_insn "movdi_internal"
2597 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,R,o,*d,*x")
2598 (match_operand:DI 1 "general_operand" "d,iF,R,o,d,d,*x,*d"))]
2600 && (register_operand (operands[0], DImode)
2601 || register_operand (operands[1], DImode)
2602 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0)
2603 || operands[1] == CONST0_RTX (DImode))"
2604 "* return mips_move_2words (operands, insn); "
2605 [(set_attr "type" "move,arith,load,load,store,store,hilo,hilo")
2606 (set_attr "mode" "DI")
2607 (set_attr "length" "2,4,2,4,2,4,2,2")])
2610 [(set (match_operand:DI 0 "register_operand" "")
2611 (match_operand:DI 1 "register_operand" ""))]
2612 "reload_completed && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
2613 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
2614 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))"
2616 [(set (subreg:SI (match_dup 0) 0) (subreg:SI (match_dup 1) 0))
2617 (set (subreg:SI (match_dup 0) 1) (subreg:SI (match_dup 1) 1))]
2620 (define_insn "movdi_internal2"
2621 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,d,d,R,m,*d,*x")
2622 (match_operand:DI 1 "general_operand" " d,S,IKL,Mnis,R,m,dJ,dJ,*x,*d"))]
2624 && (register_operand (operands[0], DImode)
2625 || register_operand (operands[1], DImode)
2626 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0)
2627 || operands[1] == CONST0_RTX (DImode))"
2628 "* return mips_move_2words (operands, insn); "
2629 [(set_attr "type" "move,load,arith,arith,load,load,store,store,hilo,hilo")
2630 (set_attr "mode" "DI")
2631 (set_attr "length" "1,2,1,2,1,2,1,2,1,1")])
2634 ;; 32-bit Integer moves
2637 [(set (match_operand:SI 0 "register_operand" "")
2638 (match_operand:SI 1 "large_int" ""))]
2639 "!TARGET_DEBUG_D_MODE"
2643 (ior:SI (match_dup 0)
2647 operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) & 0xffff0000);
2648 operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) & 0x0000ffff);
2651 ;; Unlike most other insns, the move insns can't be split with
2652 ;; different predicates, because register spilling and other parts of
2653 ;; the compiler, have memoized the insn number already.
2655 (define_expand "movsi"
2656 [(set (match_operand:SI 0 "nonimmediate_operand" "")
2657 (match_operand:SI 1 "general_operand" ""))]
2661 if ((reload_in_progress | reload_completed) == 0
2662 && !register_operand (operands[0], SImode)
2663 && !register_operand (operands[1], SImode)
2664 && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 0))
2666 rtx temp = force_reg (SImode, operands[1]);
2667 emit_move_insn (operands[0], temp);
2672 ;; The difference between these two is whether or not ints are allowed
2673 ;; in FP registers (off by default, use -mdebugh to enable).
2675 (define_insn "movsi_internal1"
2676 [(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")
2677 (match_operand:SI 1 "general_operand" "d,S,IKL,Mnis,R,m,dJ,dJ,*f*z,*d,*f,*R,*m,*f,*f,*d,*x"))]
2678 "TARGET_DEBUG_H_MODE
2679 && (register_operand (operands[0], SImode)
2680 || register_operand (operands[1], SImode)
2681 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
2682 "* return mips_move_1word (operands, insn, FALSE);"
2683 [(set_attr "type" "move,load,arith,arith,load,load,store,store,xfer,xfer,move,load,load,store,store,hilo,hilo")
2684 (set_attr "mode" "SI")
2685 (set_attr "length" "1,2,1,2,1,2,1,2,1,1,1,1,2,1,2,1,1")])
2687 (define_insn "movsi_internal2"
2688 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d,d,R,m,*d,*z,*d,*x")
2689 (match_operand:SI 1 "general_operand" "d,S,IKL,Mnis,R,m,dJ,dJ,*z,*d,*x,*d"))]
2690 "!TARGET_DEBUG_H_MODE
2691 && (register_operand (operands[0], SImode)
2692 || register_operand (operands[1], SImode)
2693 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
2694 "* return mips_move_1word (operands, insn, FALSE);"
2695 [(set_attr "type" "move,load,arith,arith,load,load,store,store,xfer,xfer,hilo,hilo")
2696 (set_attr "mode" "SI")
2697 (set_attr "length" "1,2,1,2,1,2,1,2,1,1,1,1")])
2700 ;; 16-bit Integer moves
2702 ;; Unlike most other insns, the move insns can't be split with
2703 ;; different predicates, because register spilling and other parts of
2704 ;; the compiler, have memoized the insn number already.
2705 ;; Unsigned loads are used because BYTE_LOADS_ZERO_EXTEND is defined
2707 (define_expand "movhi"
2708 [(set (match_operand:HI 0 "nonimmediate_operand" "")
2709 (match_operand:HI 1 "general_operand" ""))]
2713 if ((reload_in_progress | reload_completed) == 0
2714 && !register_operand (operands[0], HImode)
2715 && !register_operand (operands[1], HImode)
2716 && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 0))
2718 rtx temp = force_reg (HImode, operands[1]);
2719 emit_move_insn (operands[0], temp);
2724 ;; The difference between these two is whether or not ints are allowed
2725 ;; in FP registers (off by default, use -mdebugh to enable).
2727 (define_insn "movhi_internal1"
2728 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,R,m,*d,*f,*f*z,*x,*d")
2729 (match_operand:HI 1 "general_operand" "d,IK,R,m,dJ,dJ,*f*z,*d,*f,*d,*x"))]
2730 "TARGET_DEBUG_H_MODE
2731 && (register_operand (operands[0], HImode)
2732 || register_operand (operands[1], HImode)
2733 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
2734 "* return mips_move_1word (operands, insn, TRUE);"
2735 [(set_attr "type" "move,arith,load,load,store,store,xfer,xfer,move,hilo,hilo")
2736 (set_attr "mode" "HI")
2737 (set_attr "length" "1,1,1,2,1,2,1,1,1,1,1")])
2739 (define_insn "movhi_internal2"
2740 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,R,m,*d,*z,*x,*d")
2741 (match_operand:HI 1 "general_operand" "d,IK,R,m,dJ,dJ,*z,*d,*d,*x"))]
2742 "!TARGET_DEBUG_H_MODE
2743 && (register_operand (operands[0], HImode)
2744 || register_operand (operands[1], HImode)
2745 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
2746 "* return mips_move_1word (operands, insn, TRUE);"
2747 [(set_attr "type" "move,arith,load,load,store,store,xfer,xfer,hilo,hilo")
2748 (set_attr "mode" "HI")
2749 (set_attr "length" "1,1,1,2,1,2,1,1,1,1")])
2752 ;; 8-bit Integer moves
2754 ;; Unlike most other insns, the move insns can't be split with
2755 ;; different predicates, because register spilling and other parts of
2756 ;; the compiler, have memoized the insn number already.
2757 ;; Unsigned loads are used because BYTE_LOADS_ZERO_EXTEND is defined
2759 (define_expand "movqi"
2760 [(set (match_operand:QI 0 "nonimmediate_operand" "")
2761 (match_operand:QI 1 "general_operand" ""))]
2765 if ((reload_in_progress | reload_completed) == 0
2766 && !register_operand (operands[0], QImode)
2767 && !register_operand (operands[1], QImode)
2768 && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 0))
2770 rtx temp = force_reg (QImode, operands[1]);
2771 emit_move_insn (operands[0], temp);
2776 ;; The difference between these two is whether or not ints are allowed
2777 ;; in FP registers (off by default, use -mdebugh to enable).
2779 (define_insn "movqi_internal1"
2780 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,m,*d,*f*z,*f,*x,*d")
2781 (match_operand:QI 1 "general_operand" "d,IK,R,m,dJ,dJ,*f*z,*d,*f,*d,*x"))]
2782 "TARGET_DEBUG_H_MODE
2783 && (register_operand (operands[0], QImode)
2784 || register_operand (operands[1], QImode)
2785 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
2786 "* return mips_move_1word (operands, insn, TRUE);"
2787 [(set_attr "type" "move,arith,load,load,store,store,xfer,xfer,move,hilo,hilo")
2788 (set_attr "mode" "QI")
2789 (set_attr "length" "1,1,1,2,1,2,1,1,1,1,1")])
2791 (define_insn "movqi_internal2"
2792 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,m,*d,*z,*x,*d")
2793 (match_operand:QI 1 "general_operand" "d,IK,R,m,dJ,dJ,*z,*d,*d,*x"))]
2794 "!TARGET_DEBUG_H_MODE
2795 && (register_operand (operands[0], QImode)
2796 || register_operand (operands[1], QImode)
2797 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
2798 "* return mips_move_1word (operands, insn, TRUE);"
2799 [(set_attr "type" "move,arith,load,load,store,store,xfer,xfer,hilo,hilo")
2800 (set_attr "mode" "QI")
2801 (set_attr "length" "1,1,1,2,1,2,1,1,1,1")])
2804 ;; 32-bit floating point moves
2806 (define_expand "movsf"
2807 [(set (match_operand:SF 0 "nonimmediate_operand" "")
2808 (match_operand:SF 1 "general_operand" ""))]
2812 if ((reload_in_progress | reload_completed) == 0
2813 && !register_operand (operands[0], SFmode)
2814 && !register_operand (operands[1], SFmode)
2815 && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 0)
2816 && operands[1] != CONST0_RTX (SFmode))
2818 rtx temp = force_reg (SFmode, operands[1]);
2819 emit_move_insn (operands[0], temp);
2824 (define_insn "movsf_internal1"
2825 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,f,f,R,m,*f,*d,*d,*d,*d,*R,*m")
2826 (match_operand:SF 1 "general_operand" "f,G,R,Fm,fG,fG,*d,*f,*G*d,*R,*F*m,*d,*d"))]
2828 && (register_operand (operands[0], SFmode)
2829 || register_operand (operands[1], SFmode)
2830 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0)
2831 || operands[1] == CONST0_RTX (SFmode))"
2832 "* return mips_move_1word (operands, insn, FALSE);"
2833 [(set_attr "type" "move,xfer,load,load,store,store,xfer,xfer,move,load,load,store,store")
2834 (set_attr "mode" "SF")
2835 (set_attr "length" "1,1,1,2,1,2,1,1,1,1,2,1,2")])
2838 (define_insn "movsf_internal2"
2839 [(set (match_operand:SF 0 "nonimmediate_operand" "=d,d,d,R,m")
2840 (match_operand:SF 1 "general_operand" " Gd,R,Fm,d,d"))]
2842 && (register_operand (operands[0], SFmode)
2843 || register_operand (operands[1], SFmode)
2844 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0)
2845 || operands[1] == CONST0_RTX (SFmode))"
2846 "* return mips_move_1word (operands, insn, FALSE);"
2847 [(set_attr "type" "move,load,load,store,store")
2848 (set_attr "mode" "SF")
2849 (set_attr "length" "1,1,2,1,2")])
2852 ;; 64-bit floating point moves
2854 (define_expand "movdf"
2855 [(set (match_operand:DF 0 "nonimmediate_operand" "")
2856 (match_operand:DF 1 "general_operand" ""))]
2860 if ((reload_in_progress | reload_completed) == 0
2861 && !register_operand (operands[0], DFmode)
2862 && !register_operand (operands[1], DFmode)
2863 && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 0)
2864 && operands[1] != CONST0_RTX (DFmode))
2866 rtx temp = force_reg (DFmode, operands[1]);
2867 emit_move_insn (operands[0], temp);
2872 (define_insn "movdf_internal1"
2873 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,o,f,*f,*d,*d,*d,*d,*R,*o")
2874 (match_operand:DF 1 "general_operand" "f,R,o,fG,fG,F,*d,*f,*d*G,*R,*o*F,*d,*d"))]
2876 && (register_operand (operands[0], DFmode)
2877 || register_operand (operands[1], DFmode)
2878 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0)
2879 || operands[1] == CONST0_RTX (DFmode))"
2880 "* return mips_move_2words (operands, insn); "
2881 [(set_attr "type" "move,load,load,store,store,load,xfer,xfer,move,load,load,store,store")
2882 (set_attr "mode" "DF")
2883 (set_attr "length" "1,2,4,2,4,4,2,2,2,2,4,2,4")])
2885 (define_insn "movdf_internal2"
2886 [(set (match_operand:DF 0 "nonimmediate_operand" "=d,d,d,R,o")
2887 (match_operand:DF 1 "general_operand" "dG,R,oF,d,d"))]
2889 && (register_operand (operands[0], DFmode)
2890 || register_operand (operands[1], DFmode)
2891 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0)
2892 || operands[1] == CONST0_RTX (DFmode))"
2893 "* return mips_move_2words (operands, insn); "
2894 [(set_attr "type" "move,load,load,store,store")
2895 (set_attr "mode" "DF")
2896 (set_attr "length" "2,2,4,2,4")])
2899 [(set (match_operand:DF 0 "register_operand" "")
2900 (match_operand:DF 1 "register_operand" ""))]
2901 "reload_completed && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
2902 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
2903 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))"
2905 [(set (subreg:SI (match_dup 0) 0) (subreg:SI (match_dup 1) 0))
2906 (set (subreg:SI (match_dup 0) 1) (subreg:SI (match_dup 1) 1))]
2910 ;; Block moves, see mips.c for more details.
2911 ;; Argument 0 is the destination
2912 ;; Argument 1 is the source
2913 ;; Argument 2 is the length
2914 ;; Argument 3 is the alignment
2916 (define_expand "movstrsi"
2917 [(parallel [(set (mem:BLK (match_operand:BLK 0 "general_operand" ""))
2918 (mem:BLK (match_operand:BLK 1 "general_operand" "")))
2919 (use (match_operand:SI 2 "arith32_operand" ""))
2920 (use (match_operand:SI 3 "immediate_operand" ""))])]
2924 if (operands[0]) /* avoid unused code messages */
2926 expand_block_move (operands);
2931 ;; Insn generated by block moves
2933 (define_insn "movstrsi_internal"
2934 [(set (match_operand:BLK 0 "memory_operand" "=Ro") ;; destination
2935 (match_operand:BLK 1 "memory_operand" "Ro")) ;; source
2936 (clobber (match_scratch:SI 4 "=&d")) ;; temp 1
2937 (clobber (match_scratch:SI 5 "=&d")) ;; temp 2
2938 (clobber (match_scratch:SI 6 "=&d")) ;; temp 3
2939 (clobber (match_scratch:SI 7 "=&d")) ;; temp 4
2940 (use (match_operand:SI 2 "small_int" "I")) ;; # bytes to move
2941 (use (match_operand:SI 3 "small_int" "I")) ;; alignment
2942 (use (const_int 0))] ;; normal block move
2944 "* return output_block_move (insn, operands, 4, BLOCK_MOVE_NORMAL);"
2945 [(set_attr "type" "multi")
2946 (set_attr "mode" "none")
2947 (set_attr "length" "20")])
2949 ;; Split a block move into 2 parts, the first part is everything
2950 ;; except for the last move, and the second part is just the last
2951 ;; store, which is exactly 1 instruction (ie, not a usw), so it can
2952 ;; fill a delay slot. This also prevents a bug in delayed branches
2953 ;; from showing up, which reuses one of the registers in our clobbers.
2956 [(set (mem:BLK (match_operand:SI 0 "register_operand" ""))
2957 (mem:BLK (match_operand:SI 1 "register_operand" "")))
2958 (clobber (match_operand:SI 4 "register_operand" ""))
2959 (clobber (match_operand:SI 5 "register_operand" ""))
2960 (clobber (match_operand:SI 6 "register_operand" ""))
2961 (clobber (match_operand:SI 7 "register_operand" ""))
2962 (use (match_operand:SI 2 "small_int" ""))
2963 (use (match_operand:SI 3 "small_int" ""))
2964 (use (const_int 0))]
2966 "reload_completed && !TARGET_DEBUG_D_MODE && INTVAL (operands[2]) > 0"
2968 ;; All but the last move
2969 [(parallel [(set (mem:BLK (match_dup 0))
2970 (mem:BLK (match_dup 1)))
2971 (clobber (match_dup 4))
2972 (clobber (match_dup 5))
2973 (clobber (match_dup 6))
2974 (clobber (match_dup 7))
2977 (use (const_int 1))])
2979 ;; The last store, so it can fill a delay slot
2980 (parallel [(set (mem:BLK (match_dup 0))
2981 (mem:BLK (match_dup 1)))
2982 (clobber (match_dup 4))
2983 (clobber (match_dup 5))
2984 (clobber (match_dup 6))
2985 (clobber (match_dup 7))
2988 (use (const_int 2))])]
2992 (define_insn "movstrsi_internal2"
2993 [(set (match_operand:BLK 0 "memory_operand" "=Ro") ;; destination
2994 (match_operand:BLK 1 "memory_operand" "Ro")) ;; source
2995 (clobber (match_scratch:SI 4 "=&d")) ;; temp 1
2996 (clobber (match_scratch:SI 5 "=&d")) ;; temp 2
2997 (clobber (match_scratch:SI 6 "=&d")) ;; temp 3
2998 (clobber (match_scratch:SI 7 "=&d")) ;; temp 4
2999 (use (match_operand:SI 2 "small_int" "I")) ;; # bytes to move
3000 (use (match_operand:SI 3 "small_int" "I")) ;; alignment
3001 (use (const_int 1))] ;; all but last store
3003 "* return output_block_move (insn, operands, 4, BLOCK_MOVE_NOT_LAST);"
3004 [(set_attr "type" "multi")
3005 (set_attr "mode" "none")
3006 (set_attr "length" "20")])
3008 (define_insn "movstrsi_internal3"
3009 [(set (match_operand:BLK 0 "memory_operand" "=Ro") ;; destination
3010 (match_operand:BLK 1 "memory_operand" "Ro")) ;; source
3011 (clobber (match_scratch:SI 4 "=&d")) ;; temp 1
3012 (clobber (match_scratch:SI 5 "=&d")) ;; temp 2
3013 (clobber (match_scratch:SI 6 "=&d")) ;; temp 3
3014 (clobber (match_scratch:SI 7 "=&d")) ;; temp 4
3015 (use (match_operand:SI 2 "small_int" "I")) ;; # bytes to move
3016 (use (match_operand:SI 3 "small_int" "I")) ;; alignment
3017 (use (const_int 2))] ;; just last store of block move
3019 "* return output_block_move (insn, operands, 4, BLOCK_MOVE_LAST);"
3020 [(set_attr "type" "store")
3021 (set_attr "mode" "none")
3022 (set_attr "length" "1")])
3026 ;; ....................
3030 ;; ....................
3032 (define_insn "ashlsi3"
3033 [(set (match_operand:SI 0 "register_operand" "=d")
3034 (ashift:SI (match_operand:SI 1 "register_operand" "d")
3035 (match_operand:SI 2 "arith_operand" "dI")))]
3039 if (GET_CODE (operands[2]) == CONST_INT)
3040 operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);
3042 return \"sll\\t%0,%1,%2\";
3044 [(set_attr "type" "arith")
3045 (set_attr "mode" "SI")
3046 (set_attr "length" "1")])
3049 (define_expand "ashldi3"
3050 [(parallel [(set (match_operand:DI 0 "register_operand" "")
3051 (ashift:DI (match_operand:DI 1 "register_operand" "")
3052 (match_operand:SI 2 "arith_operand" "")))
3053 (clobber (match_dup 3))])]
3054 "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
3059 emit_insn (gen_ashldi3_internal4 (operands[0], operands[1],
3064 operands[3] = gen_reg_rtx (SImode);
3068 (define_insn "ashldi3_internal"
3069 [(set (match_operand:DI 0 "register_operand" "=&d")
3070 (ashift:DI (match_operand:DI 1 "register_operand" "d")
3071 (match_operand:SI 2 "register_operand" "d")))
3072 (clobber (match_operand:SI 3 "register_operand" "=d"))]
3073 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE"
3076 operands[4] = const0_rtx;
3077 dslots_jump_total += 3;
3078 dslots_jump_filled += 2;
3080 return \"sll\\t%3,%2,26\\n\\
3081 \\tbgez\\t%3,1f\\n\\
3082 \\tsll\\t%M0,%L1,%2\\n\\
3084 \\tmove\\t%L0,%z4%)\\n\\
3087 \\t%(beq\\t%3,%z4,2f\\n\\
3088 \\tsll\\t%M0,%M1,%2%)\\n\\
3090 \\tsubu\\t%3,%z4,%2\\n\\
3091 \\tsrl\\t%3,%L1,%3\\n\\
3092 \\tor\\t%M0,%M0,%3\\n\\
3094 \\tsll\\t%L0,%L1,%2\\n\\
3097 [(set_attr "type" "darith")
3098 (set_attr "mode" "SI")
3099 (set_attr "length" "12")])
3102 (define_insn "ashldi3_internal2"
3103 [(set (match_operand:DI 0 "register_operand" "=d")
3104 (ashift:DI (match_operand:DI 1 "register_operand" "d")
3105 (match_operand:SI 2 "small_int" "IJK")))
3106 (clobber (match_operand:SI 3 "register_operand" "=d"))]
3107 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && (INTVAL (operands[2]) & 32) != 0"
3110 operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);
3111 operands[4] = const0_rtx;
3112 return \"sll\\t%M0,%L1,%2\;move\\t%L0,%z4\";
3114 [(set_attr "type" "darith")
3115 (set_attr "mode" "DI")
3116 (set_attr "length" "2")])
3120 [(set (match_operand:DI 0 "register_operand" "")
3121 (ashift:DI (match_operand:DI 1 "register_operand" "")
3122 (match_operand:SI 2 "small_int" "")))
3123 (clobber (match_operand:SI 3 "register_operand" ""))]
3124 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
3125 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
3126 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
3127 && (INTVAL (operands[2]) & 32) != 0"
3129 [(set (subreg:SI (match_dup 0) 1) (ashift:SI (subreg:SI (match_dup 1) 0) (match_dup 2)))
3130 (set (subreg:SI (match_dup 0) 0) (const_int 0))]
3132 "operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);")
3136 [(set (match_operand:DI 0 "register_operand" "")
3137 (ashift:DI (match_operand:DI 1 "register_operand" "")
3138 (match_operand:SI 2 "small_int" "")))
3139 (clobber (match_operand:SI 3 "register_operand" ""))]
3140 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
3141 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
3142 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
3143 && (INTVAL (operands[2]) & 32) != 0"
3145 [(set (subreg:SI (match_dup 0) 0) (ashift:SI (subreg:SI (match_dup 1) 1) (match_dup 2)))
3146 (set (subreg:SI (match_dup 0) 1) (const_int 0))]
3148 "operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);")
3151 (define_insn "ashldi3_internal3"
3152 [(set (match_operand:DI 0 "register_operand" "=d")
3153 (ashift:DI (match_operand:DI 1 "register_operand" "d")
3154 (match_operand:SI 2 "small_int" "IJK")))
3155 (clobber (match_operand:SI 3 "register_operand" "=d"))]
3156 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE
3157 && (INTVAL (operands[2]) & 63) < 32
3158 && (INTVAL (operands[2]) & 63) != 0"
3161 int amount = INTVAL (operands[2]);
3163 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
3164 operands[4] = const0_rtx;
3165 operands[5] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
3167 return \"sll\\t%M0,%M1,%2\;srl\\t%3,%L1,%5\;or\\t%M0,%M0,%3\;sll\\t%L0,%L1,%2\";
3169 [(set_attr "type" "darith")
3170 (set_attr "mode" "DI")
3171 (set_attr "length" "4")])
3175 [(set (match_operand:DI 0 "register_operand" "")
3176 (ashift:DI (match_operand:DI 1 "register_operand" "")
3177 (match_operand:SI 2 "small_int" "")))
3178 (clobber (match_operand:SI 3 "register_operand" ""))]
3179 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
3180 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
3181 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
3182 && (INTVAL (operands[2]) & 63) < 32
3183 && (INTVAL (operands[2]) & 63) != 0"
3185 [(set (subreg:SI (match_dup 0) 1)
3186 (ashift:SI (subreg:SI (match_dup 1) 1)
3190 (lshiftrt:SI (subreg:SI (match_dup 1) 0)
3193 (set (subreg:SI (match_dup 0) 1)
3194 (ior:SI (subreg:SI (match_dup 0) 1)
3197 (set (subreg:SI (match_dup 0) 0)
3198 (ashift:SI (subreg:SI (match_dup 1) 0)
3202 int amount = INTVAL (operands[2]);
3203 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
3204 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
3209 [(set (match_operand:DI 0 "register_operand" "")
3210 (ashift:DI (match_operand:DI 1 "register_operand" "")
3211 (match_operand:SI 2 "small_int" "")))
3212 (clobber (match_operand:SI 3 "register_operand" ""))]
3213 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
3214 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
3215 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
3216 && (INTVAL (operands[2]) & 63) < 32
3217 && (INTVAL (operands[2]) & 63) != 0"
3219 [(set (subreg:SI (match_dup 0) 0)
3220 (ashift:SI (subreg:SI (match_dup 1) 0)
3224 (lshiftrt:SI (subreg:SI (match_dup 1) 1)
3227 (set (subreg:SI (match_dup 0) 0)
3228 (ior:SI (subreg:SI (match_dup 0) 0)
3231 (set (subreg:SI (match_dup 0) 1)
3232 (ashift:SI (subreg:SI (match_dup 1) 1)
3236 int amount = INTVAL (operands[2]);
3237 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
3238 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
3242 (define_insn "ashldi3_internal4"
3243 [(set (match_operand:DI 0 "register_operand" "=d")
3244 (ashift:DI (match_operand:DI 1 "register_operand" "d")
3245 (match_operand:SI 2 "arith_operand" "dI")))]
3249 if (GET_CODE (operands[2]) == CONST_INT)
3250 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f);
3252 return \"dsll\\t%0,%1,%2\";
3254 [(set_attr "type" "arith")
3255 (set_attr "mode" "DI")
3256 (set_attr "length" "1")])
3259 (define_insn "ashrsi3"
3260 [(set (match_operand:SI 0 "register_operand" "=d")
3261 (ashiftrt:SI (match_operand:SI 1 "register_operand" "d")
3262 (match_operand:SI 2 "arith_operand" "dI")))]
3266 if (GET_CODE (operands[2]) == CONST_INT)
3267 operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);
3269 return \"sra\\t%0,%1,%2\";
3271 [(set_attr "type" "arith")
3272 (set_attr "mode" "SI")
3273 (set_attr "length" "1")])
3276 (define_expand "ashrdi3"
3277 [(parallel [(set (match_operand:DI 0 "register_operand" "")
3278 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
3279 (match_operand:SI 2 "arith_operand" "")))
3280 (clobber (match_dup 3))])]
3281 "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
3286 emit_insn (gen_ashrdi3_internal4 (operands[0], operands[1],
3291 operands[3] = gen_reg_rtx (SImode);
3295 (define_insn "ashrdi3_internal"
3296 [(set (match_operand:DI 0 "register_operand" "=&d")
3297 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
3298 (match_operand:SI 2 "register_operand" "d")))
3299 (clobber (match_operand:SI 3 "register_operand" "=d"))]
3300 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE"
3303 operands[4] = const0_rtx;
3304 dslots_jump_total += 3;
3305 dslots_jump_filled += 2;
3307 return \"sll\\t%3,%2,26\\n\\
3308 \\tbgez\\t%3,1f\\n\\
3309 \\tsra\\t%L0,%M1,%2\\n\\
3311 \\tsra\\t%M0,%M1,31%)\\n\\
3314 \\t%(beq\\t%3,%z4,2f\\n\\
3315 \\tsrl\\t%L0,%L1,%2%)\\n\\
3317 \\tsubu\\t%3,%z4,%2\\n\\
3318 \\tsll\\t%3,%M1,%3\\n\\
3319 \\tor\\t%L0,%L0,%3\\n\\
3321 \\tsra\\t%M0,%M1,%2\\n\\
3324 [(set_attr "type" "darith")
3325 (set_attr "mode" "DI")
3326 (set_attr "length" "12")])
3329 (define_insn "ashrdi3_internal2"
3330 [(set (match_operand:DI 0 "register_operand" "=d")
3331 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
3332 (match_operand:SI 2 "small_int" "IJK")))
3333 (clobber (match_operand:SI 3 "register_operand" "=d"))]
3334 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && (INTVAL (operands[2]) & 32) != 0"
3337 operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);
3338 return \"sra\\t%L0,%M1,%2\;sra\\t%M0,%M1,31\";
3340 [(set_attr "type" "darith")
3341 (set_attr "mode" "DI")
3342 (set_attr "length" "2")])
3346 [(set (match_operand:DI 0 "register_operand" "")
3347 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
3348 (match_operand:SI 2 "small_int" "")))
3349 (clobber (match_operand:SI 3 "register_operand" ""))]
3350 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
3351 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
3352 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
3353 && (INTVAL (operands[2]) & 32) != 0"
3355 [(set (subreg:SI (match_dup 0) 0) (ashiftrt:SI (subreg:SI (match_dup 1) 1) (match_dup 2)))
3356 (set (subreg:SI (match_dup 0) 1) (ashiftrt:SI (subreg:SI (match_dup 1) 1) (const_int 31)))]
3358 "operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);")
3362 [(set (match_operand:DI 0 "register_operand" "")
3363 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
3364 (match_operand:SI 2 "small_int" "")))
3365 (clobber (match_operand:SI 3 "register_operand" ""))]
3366 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
3367 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
3368 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
3369 && (INTVAL (operands[2]) & 32) != 0"
3371 [(set (subreg:SI (match_dup 0) 1) (ashiftrt:SI (subreg:SI (match_dup 1) 0) (match_dup 2)))
3372 (set (subreg:SI (match_dup 0) 0) (ashiftrt:SI (subreg:SI (match_dup 1) 0) (const_int 31)))]
3374 "operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);")
3377 (define_insn "ashrdi3_internal3"
3378 [(set (match_operand:DI 0 "register_operand" "=d")
3379 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
3380 (match_operand:SI 2 "small_int" "IJK")))
3381 (clobber (match_operand:SI 3 "register_operand" "=d"))]
3382 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE
3383 && (INTVAL (operands[2]) & 63) < 32
3384 && (INTVAL (operands[2]) & 63) != 0"
3387 int amount = INTVAL (operands[2]);
3389 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
3390 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
3392 return \"srl\\t%L0,%L1,%2\;sll\\t%3,%M1,%4\;or\\t%L0,%L0,%3\;sra\\t%M0,%M1,%2\";
3394 [(set_attr "type" "darith")
3395 (set_attr "mode" "DI")
3396 (set_attr "length" "4")])
3400 [(set (match_operand:DI 0 "register_operand" "")
3401 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
3402 (match_operand:SI 2 "small_int" "")))
3403 (clobber (match_operand:SI 3 "register_operand" ""))]
3404 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
3405 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
3406 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
3407 && (INTVAL (operands[2]) & 63) < 32
3408 && (INTVAL (operands[2]) & 63) != 0"
3410 [(set (subreg:SI (match_dup 0) 0)
3411 (lshiftrt:SI (subreg:SI (match_dup 1) 0)
3415 (ashift:SI (subreg:SI (match_dup 1) 1)
3418 (set (subreg:SI (match_dup 0) 0)
3419 (ior:SI (subreg:SI (match_dup 0) 0)
3422 (set (subreg:SI (match_dup 0) 1)
3423 (ashiftrt:SI (subreg:SI (match_dup 1) 1)
3427 int amount = INTVAL (operands[2]);
3428 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
3429 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
3434 [(set (match_operand:DI 0 "register_operand" "")
3435 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
3436 (match_operand:SI 2 "small_int" "")))
3437 (clobber (match_operand:SI 3 "register_operand" ""))]
3438 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
3439 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
3440 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
3441 && (INTVAL (operands[2]) & 63) < 32
3442 && (INTVAL (operands[2]) & 63) != 0"
3444 [(set (subreg:SI (match_dup 0) 1)
3445 (lshiftrt:SI (subreg:SI (match_dup 1) 1)
3449 (ashift:SI (subreg:SI (match_dup 1) 0)
3452 (set (subreg:SI (match_dup 0) 1)
3453 (ior:SI (subreg:SI (match_dup 0) 1)
3456 (set (subreg:SI (match_dup 0) 0)
3457 (ashiftrt:SI (subreg:SI (match_dup 1) 0)
3461 int amount = INTVAL (operands[2]);
3462 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
3463 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
3467 (define_insn "ashrdi3_internal4"
3468 [(set (match_operand:DI 0 "register_operand" "=d")
3469 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
3470 (match_operand:SI 2 "arith_operand" "dI")))]
3474 if (GET_CODE (operands[2]) == CONST_INT)
3475 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f);
3477 return \"dsra\\t%0,%1,%2\";
3479 [(set_attr "type" "arith")
3480 (set_attr "mode" "DI")
3481 (set_attr "length" "1")])
3484 (define_insn "lshrsi3"
3485 [(set (match_operand:SI 0 "register_operand" "=d")
3486 (lshiftrt:SI (match_operand:SI 1 "register_operand" "d")
3487 (match_operand:SI 2 "arith_operand" "dI")))]
3491 if (GET_CODE (operands[2]) == CONST_INT)
3492 operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);
3494 return \"srl\\t%0,%1,%2\";
3496 [(set_attr "type" "arith")
3497 (set_attr "mode" "SI")
3498 (set_attr "length" "1")])
3501 (define_expand "lshrdi3"
3502 [(parallel [(set (match_operand:DI 0 "register_operand" "")
3503 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
3504 (match_operand:SI 2 "arith_operand" "")))
3505 (clobber (match_dup 3))])]
3506 "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
3511 emit_insn (gen_lshrdi3_internal4 (operands[0], operands[1],
3516 operands[3] = gen_reg_rtx (SImode);
3520 (define_insn "lshrdi3_internal"
3521 [(set (match_operand:DI 0 "register_operand" "=&d")
3522 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
3523 (match_operand:SI 2 "register_operand" "d")))
3524 (clobber (match_operand:SI 3 "register_operand" "=d"))]
3525 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE"
3528 operands[4] = const0_rtx;
3529 dslots_jump_total += 3;
3530 dslots_jump_filled += 2;
3532 return \"sll\\t%3,%2,26\\n\\
3533 \\tbgez\\t%3,1f\\n\\
3534 \\tsrl\\t%L0,%M1,%2\\n\\
3536 \\tmove\\t%M0,%z4%)\\n\\
3539 \\t%(beq\\t%3,%z4,2f\\n\\
3540 \\tsrl\\t%L0,%L1,%2%)\\n\\
3542 \\tsubu\\t%3,%z4,%2\\n\\
3543 \\tsll\\t%3,%M1,%3\\n\\
3544 \\tor\\t%L0,%L0,%3\\n\\
3546 \\tsrl\\t%M0,%M1,%2\\n\\
3549 [(set_attr "type" "darith")
3550 (set_attr "mode" "DI")
3551 (set_attr "length" "12")])
3554 (define_insn "lshrdi3_internal2"
3555 [(set (match_operand:DI 0 "register_operand" "=d")
3556 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
3557 (match_operand:SI 2 "small_int" "IJK")))
3558 (clobber (match_operand:SI 3 "register_operand" "=d"))]
3559 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && (INTVAL (operands[2]) & 32) != 0"
3562 operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);
3563 operands[4] = const0_rtx;
3564 return \"srl\\t%L0,%M1,%2\;move\\t%M0,%z4\";
3566 [(set_attr "type" "darith")
3567 (set_attr "mode" "DI")
3568 (set_attr "length" "2")])
3572 [(set (match_operand:DI 0 "register_operand" "")
3573 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
3574 (match_operand:SI 2 "small_int" "")))
3575 (clobber (match_operand:SI 3 "register_operand" ""))]
3576 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
3577 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
3578 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
3579 && (INTVAL (operands[2]) & 32) != 0"
3581 [(set (subreg:SI (match_dup 0) 0) (lshiftrt:SI (subreg:SI (match_dup 1) 1) (match_dup 2)))
3582 (set (subreg:SI (match_dup 0) 1) (const_int 0))]
3584 "operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);")
3588 [(set (match_operand:DI 0 "register_operand" "")
3589 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
3590 (match_operand:SI 2 "small_int" "")))
3591 (clobber (match_operand:SI 3 "register_operand" ""))]
3592 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
3593 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
3594 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
3595 && (INTVAL (operands[2]) & 32) != 0"
3597 [(set (subreg:SI (match_dup 0) 1) (lshiftrt:SI (subreg:SI (match_dup 1) 0) (match_dup 2)))
3598 (set (subreg:SI (match_dup 0) 0) (const_int 0))]
3600 "operands[2] = gen_rtx (CONST_INT, VOIDmode, (XINT (operands[2], 0))& 0x1f);")
3603 (define_insn "lshrdi3_internal3"
3604 [(set (match_operand:DI 0 "register_operand" "=d")
3605 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
3606 (match_operand:SI 2 "small_int" "IJK")))
3607 (clobber (match_operand:SI 3 "register_operand" "=d"))]
3608 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE
3609 && (INTVAL (operands[2]) & 63) < 32
3610 && (INTVAL (operands[2]) & 63) != 0"
3613 int amount = INTVAL (operands[2]);
3615 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
3616 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
3618 return \"srl\\t%L0,%L1,%2\;sll\\t%3,%M1,%4\;or\\t%L0,%L0,%3\;srl\\t%M0,%M1,%2\";
3620 [(set_attr "type" "darith")
3621 (set_attr "mode" "DI")
3622 (set_attr "length" "4")])
3626 [(set (match_operand:DI 0 "register_operand" "")
3627 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
3628 (match_operand:SI 2 "small_int" "")))
3629 (clobber (match_operand:SI 3 "register_operand" ""))]
3630 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
3631 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
3632 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
3633 && (INTVAL (operands[2]) & 63) < 32
3634 && (INTVAL (operands[2]) & 63) != 0"
3636 [(set (subreg:SI (match_dup 0) 0)
3637 (lshiftrt:SI (subreg:SI (match_dup 1) 0)
3641 (ashift:SI (subreg:SI (match_dup 1) 1)
3644 (set (subreg:SI (match_dup 0) 0)
3645 (ior:SI (subreg:SI (match_dup 0) 0)
3648 (set (subreg:SI (match_dup 0) 1)
3649 (lshiftrt:SI (subreg:SI (match_dup 1) 1)
3653 int amount = INTVAL (operands[2]);
3654 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
3655 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
3660 [(set (match_operand:DI 0 "register_operand" "")
3661 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
3662 (match_operand:SI 2 "small_int" "")))
3663 (clobber (match_operand:SI 3 "register_operand" ""))]
3664 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
3665 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
3666 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
3667 && (INTVAL (operands[2]) & 63) < 32
3668 && (INTVAL (operands[2]) & 63) != 0"
3670 [(set (subreg:SI (match_dup 0) 1)
3671 (lshiftrt:SI (subreg:SI (match_dup 1) 1)
3675 (ashift:SI (subreg:SI (match_dup 1) 0)
3678 (set (subreg:SI (match_dup 0) 1)
3679 (ior:SI (subreg:SI (match_dup 0) 1)
3682 (set (subreg:SI (match_dup 0) 0)
3683 (lshiftrt:SI (subreg:SI (match_dup 1) 0)
3687 int amount = INTVAL (operands[2]);
3688 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
3689 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
3693 (define_insn "lshrdi3_internal4"
3694 [(set (match_operand:DI 0 "register_operand" "=d")
3695 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
3696 (match_operand:SI 2 "arith_operand" "dI")))]
3700 if (GET_CODE (operands[2]) == CONST_INT)
3701 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f);
3703 return \"dsrl\\t%0,%1,%2\";
3705 [(set_attr "type" "arith")
3706 (set_attr "mode" "DI")
3707 (set_attr "length" "1")])
3711 ;; ....................
3715 ;; ....................
3717 ;; Flow here is rather complex:
3719 ;; 1) The cmp{si,di,sf,df} routine is called. It deposits the
3720 ;; arguments into the branch_cmp array, and the type into
3721 ;; branch_type. No RTL is generated.
3723 ;; 2) The appropriate branch define_expand is called, which then
3724 ;; creates the appropriate RTL for the comparison and branch.
3725 ;; Different CC modes are used, based on what type of branch is
3726 ;; done, so that we can constrain things appropriately. There
3727 ;; are assumptions in the rest of GCC that break if we fold the
3728 ;; operands into the branchs for integer operations, and use cc0
3729 ;; for floating point, so we use the fp status register instead.
3730 ;; If needed, an appropriate temporary is created to hold the
3731 ;; of the integer compare.
3733 (define_expand "cmpsi"
3735 (compare:CC (match_operand:SI 0 "register_operand" "")
3736 (match_operand:SI 1 "arith_operand" "")))]
3740 if (operands[0]) /* avoid unused code message */
3742 branch_cmp[0] = operands[0];
3743 branch_cmp[1] = operands[1];
3744 branch_type = CMP_SI;
3749 (define_expand "tstsi"
3751 (match_operand:SI 0 "register_operand" ""))]
3755 if (operands[0]) /* avoid unused code message */
3757 branch_cmp[0] = operands[0];
3758 branch_cmp[1] = const0_rtx;
3759 branch_type = CMP_SI;
3764 (define_expand "cmpdi"
3766 (compare:CC (match_operand:DI 0 "register_operand" "")
3767 (match_operand:DI 1 "arith_operand" "")))]
3771 if (operands[0]) /* avoid unused code message */
3773 branch_cmp[0] = operands[0];
3774 branch_cmp[1] = operands[1];
3775 branch_type = CMP_DI;
3780 (define_expand "tstdi"
3782 (match_operand:DI 0 "register_operand" ""))]
3786 if (operands[0]) /* avoid unused code message */
3788 branch_cmp[0] = operands[0];
3789 branch_cmp[1] = const0_rtx;
3790 branch_type = CMP_DI;
3795 (define_expand "cmpdf"
3797 (compare:CC_FP (match_operand:DF 0 "register_operand" "")
3798 (match_operand:DF 1 "register_operand" "")))]
3802 if (operands[0]) /* avoid unused code message */
3804 branch_cmp[0] = operands[0];
3805 branch_cmp[1] = operands[1];
3806 branch_type = CMP_DF;
3811 (define_expand "cmpsf"
3813 (compare:CC_FP (match_operand:SF 0 "register_operand" "")
3814 (match_operand:SF 1 "register_operand" "")))]
3818 if (operands[0]) /* avoid unused code message */
3820 branch_cmp[0] = operands[0];
3821 branch_cmp[1] = operands[1];
3822 branch_type = CMP_SF;
3829 ;; ....................
3831 ;; CONDITIONAL BRANCHES
3833 ;; ....................
3835 (define_insn "branch_fp_ne"
3837 (if_then_else (ne:CC_FP (reg:CC_FP 66)
3839 (match_operand 0 "pc_or_label_operand" "")
3840 (match_operand 1 "pc_or_label_operand" "")))]
3844 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
3845 return (operands[0] != pc_rtx) ? \"%*bc1t%?\\t%0\" : \"%*bc1f%?\\t%1\";
3847 [(set_attr "type" "branch")
3848 (set_attr "mode" "none")
3849 (set_attr "length" "1")])
3851 (define_insn "branch_fp_ne_rev"
3853 (if_then_else (ne:CC_REV_FP (reg:CC_REV_FP 66)
3855 (match_operand 0 "pc_or_label_operand" "")
3856 (match_operand 1 "pc_or_label_operand" "")))]
3860 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
3861 return (operands[0] != pc_rtx) ? \"%*bc1f%?\\t%0\" : \"%*bc1t%?\\t%1\";
3863 [(set_attr "type" "branch")
3864 (set_attr "mode" "none")
3865 (set_attr "length" "1")])
3867 (define_insn "branch_fp_eq"
3869 (if_then_else (eq:CC_FP (reg:CC_FP 66)
3871 (match_operand 0 "pc_or_label_operand" "")
3872 (match_operand 1 "pc_or_label_operand" "")))]
3876 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
3877 return (operands[0] != pc_rtx) ? \"%*bc1f%?\\t%0\" : \"%*bc1t%?\\t%1\";
3879 [(set_attr "type" "branch")
3880 (set_attr "mode" "none")
3881 (set_attr "length" "1")])
3883 (define_insn "branch_fp_eq_rev"
3885 (if_then_else (eq:CC_REV_FP (reg:CC_REV_FP 66)
3887 (match_operand 0 "pc_or_label_operand" "")
3888 (match_operand 1 "pc_or_label_operand" "")))]
3892 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
3893 return (operands[0] != pc_rtx) ? \"%*bc1t%?\\t%0\" : \"%*bc1f%?\\t%1\";
3895 [(set_attr "type" "branch")
3896 (set_attr "mode" "none")
3897 (set_attr "length" "1")])
3900 (define_insn "branch_zero"
3902 (if_then_else (match_operator:SI 0 "cmp_op"
3903 [(match_operand:SI 1 "register_operand" "d")
3905 (match_operand 2 "pc_or_label_operand" "")
3906 (match_operand 3 "pc_or_label_operand" "")))]
3910 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
3911 if (operands[2] != pc_rtx)
3913 switch (GET_CODE (operands[0]))
3915 case EQ: return \"%*beq%?\\t%z1,%.,%2\";
3916 case NE: return \"%*bne%?\\t%z1,%.,%2\";
3917 case GTU: return \"%*bne%?\\t%z1,%.,%2\";
3918 case LEU: return \"%*beq%?\\t%z1,%.,%2\";
3919 case GEU: return \"%*j\\t%2\";
3920 case LTU: return \"%*bne%?\\t%.,%.,%2\";
3923 return \"%*b%C0z%?\\t%z1,%2\";
3926 { /* inverted jump */
3927 switch (GET_CODE (operands[0]))
3929 case EQ: return \"%*bne%?\\t%z1,%.,%3\";
3930 case NE: return \"%*beq%?\\t%z1,%.,%3\";
3931 case GTU: return \"%*beq%?\\t%z1,%.,%3\";
3932 case LEU: return \"%*bne%?\\t%z1,%.,%3\";
3933 case GEU: return \"%*beq%?\\t%.,%.,%3\";
3934 case LTU: return \"%*j\\t%3\";
3937 return \"%*b%N0z%?\\t%z1,%3\";
3940 [(set_attr "type" "branch")
3941 (set_attr "mode" "none")
3942 (set_attr "length" "1")])
3945 (define_insn "branch_zero_di"
3947 (if_then_else (match_operator:DI 0 "cmp_op"
3948 [(match_operand:DI 1 "register_operand" "d")
3950 (match_operand 2 "pc_or_label_operand" "")
3951 (match_operand 3 "pc_or_label_operand" "")))]
3955 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
3956 if (operands[2] != pc_rtx)
3958 switch (GET_CODE (operands[0]))
3960 case EQ: return \"%*beq%?\\t%z1,%.,%2\";
3961 case NE: return \"%*bne%?\\t%z1,%.,%2\";
3962 case GTU: return \"%*bne%?\\t%z1,%.,%2\";
3963 case LEU: return \"%*beq%?\\t%z1,%.,%2\";
3964 case GEU: return \"%*j\\t%2\";
3965 case LTU: return \"%*bne%?\\t%.,%.,%2\";
3968 return \"%*b%C0z%?\\t%z1,%2\";
3971 { /* inverted jump */
3972 switch (GET_CODE (operands[0]))
3974 case EQ: return \"%*bne%?\\t%z1,%.,%3\";
3975 case NE: return \"%*beq%?\\t%z1,%.,%3\";
3976 case GTU: return \"%*beq%?\\t%z1,%.,%3\";
3977 case LEU: return \"%*bne%?\\t%z1,%.,%3\";
3978 case GEU: return \"%*beq%?\\t%.,%.,%3\";
3979 case LTU: return \"%*j\\t%3\";
3982 return \"%*b%N0z%?\\t%z1,%3\";
3985 [(set_attr "type" "branch")
3986 (set_attr "mode" "none")
3987 (set_attr "length" "1")])
3990 (define_insn "branch_equality"
3992 (if_then_else (match_operator:SI 0 "equality_op"
3993 [(match_operand:SI 1 "register_operand" "d")
3994 (match_operand:SI 2 "register_operand" "d")])
3995 (match_operand 3 "pc_or_label_operand" "")
3996 (match_operand 4 "pc_or_label_operand" "")))]
4000 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
4001 return (operands[3] != pc_rtx)
4002 ? \"%*b%C0%?\\t%z1,%z2,%3\"
4003 : \"%*b%N0%?\\t%z1,%z2,%4\";
4005 [(set_attr "type" "branch")
4006 (set_attr "mode" "none")
4007 (set_attr "length" "1")])
4010 (define_insn "branch_equality_di"
4012 (if_then_else (match_operator:DI 0 "equality_op"
4013 [(match_operand:DI 1 "register_operand" "d")
4014 (match_operand:DI 2 "register_operand" "d")])
4015 (match_operand 3 "pc_or_label_operand" "")
4016 (match_operand 4 "pc_or_label_operand" "")))]
4020 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
4021 return (operands[3] != pc_rtx)
4022 ? \"%*b%C0%?\\t%z1,%z2,%3\"
4023 : \"%*b%N0%?\\t%z1,%z2,%4\";
4025 [(set_attr "type" "branch")
4026 (set_attr "mode" "none")
4027 (set_attr "length" "1")])
4030 (define_expand "beq"
4032 (if_then_else (eq:CC_EQ (cc0)
4034 (label_ref (match_operand 0 "" ""))
4039 if (operands[0]) /* avoid unused code warning */
4041 gen_conditional_branch (operands, EQ);
4046 (define_expand "bne"
4048 (if_then_else (ne:CC_EQ (cc0)
4050 (label_ref (match_operand 0 "" ""))
4055 if (operands[0]) /* avoid unused code warning */
4057 gen_conditional_branch (operands, NE);
4062 (define_expand "bgt"
4064 (if_then_else (gt:CC (cc0)
4066 (label_ref (match_operand 0 "" ""))
4071 if (operands[0]) /* avoid unused code warning */
4073 gen_conditional_branch (operands, GT);
4078 (define_expand "bge"
4080 (if_then_else (ge:CC (cc0)
4082 (label_ref (match_operand 0 "" ""))
4087 if (operands[0]) /* avoid unused code warning */
4089 gen_conditional_branch (operands, GE);
4094 (define_expand "blt"
4096 (if_then_else (lt:CC (cc0)
4098 (label_ref (match_operand 0 "" ""))
4103 if (operands[0]) /* avoid unused code warning */
4105 gen_conditional_branch (operands, LT);
4110 (define_expand "ble"
4112 (if_then_else (le:CC (cc0)
4114 (label_ref (match_operand 0 "" ""))
4119 if (operands[0]) /* avoid unused code warning */
4121 gen_conditional_branch (operands, LE);
4126 (define_expand "bgtu"
4128 (if_then_else (gtu:CC (cc0)
4130 (label_ref (match_operand 0 "" ""))
4135 if (operands[0]) /* avoid unused code warning */
4137 gen_conditional_branch (operands, GTU);
4142 (define_expand "bgeu"
4144 (if_then_else (geu:CC (cc0)
4146 (label_ref (match_operand 0 "" ""))
4151 if (operands[0]) /* avoid unused code warning */
4153 gen_conditional_branch (operands, GEU);
4159 (define_expand "bltu"
4161 (if_then_else (ltu:CC (cc0)
4163 (label_ref (match_operand 0 "" ""))
4168 if (operands[0]) /* avoid unused code warning */
4170 gen_conditional_branch (operands, LTU);
4175 (define_expand "bleu"
4177 (if_then_else (leu:CC (cc0)
4179 (label_ref (match_operand 0 "" ""))
4184 if (operands[0]) /* avoid unused code warning */
4186 gen_conditional_branch (operands, LEU);
4193 ;; ....................
4195 ;; SETTING A REGISTER FROM A COMPARISON
4197 ;; ....................
4199 (define_expand "seq"
4200 [(set (match_operand:SI 0 "register_operand" "=d")
4201 (eq:SI (match_dup 1)
4206 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
4209 /* set up operands from compare. */
4210 operands[1] = branch_cmp[0];
4211 operands[2] = branch_cmp[1];
4213 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
4215 gen_int_relational (EQ, operands[0], operands[1], operands[2], (int *)0);
4219 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
4220 operands[2] = force_reg (SImode, operands[2]);
4222 /* fall through and generate default code */
4226 (define_insn "seq_si_zero"
4227 [(set (match_operand:SI 0 "register_operand" "=d")
4228 (eq:SI (match_operand:SI 1 "register_operand" "d")
4232 [(set_attr "type" "arith")
4233 (set_attr "mode" "SI")
4234 (set_attr "length" "1")])
4236 (define_insn "seq_di_zero"
4237 [(set (match_operand:DI 0 "register_operand" "=d")
4238 (eq:DI (match_operand:DI 1 "register_operand" "d")
4242 [(set_attr "type" "arith")
4243 (set_attr "mode" "DI")
4244 (set_attr "length" "1")])
4246 (define_insn "seq_si"
4247 [(set (match_operand:SI 0 "register_operand" "=d,d")
4248 (eq:SI (match_operand:SI 1 "register_operand" "%d,d")
4249 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
4250 "TARGET_DEBUG_C_MODE"
4252 xor\\t%0,%1,%2\;sltu\\t%0,%0,1
4253 xori\\t%0,%1,%2\;sltu\\t%0,%0,1"
4254 [(set_attr "type" "arith")
4255 (set_attr "mode" "SI")
4256 (set_attr "length" "2")])
4259 [(set (match_operand:SI 0 "register_operand" "")
4260 (eq:SI (match_operand:SI 1 "register_operand" "")
4261 (match_operand:SI 2 "uns_arith_operand" "")))]
4262 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE
4263 && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)"
4265 (xor:SI (match_dup 1)
4268 (ltu:SI (match_dup 0)
4272 (define_insn "seq_di"
4273 [(set (match_operand:DI 0 "register_operand" "=d,d")
4274 (eq:DI (match_operand:DI 1 "register_operand" "%d,d")
4275 (match_operand:DI 2 "uns_arith_operand" "d,K")))]
4276 "TARGET_64BIT && TARGET_DEBUG_C_MODE"
4278 xor\\t%0,%1,%2\;sltu\\t%0,%0,1
4279 xori\\t%0,%1,%2\;sltu\\t%0,%0,1"
4280 [(set_attr "type" "arith")
4281 (set_attr "mode" "DI")
4282 (set_attr "length" "2")])
4285 [(set (match_operand:DI 0 "register_operand" "")
4286 (eq:DI (match_operand:DI 1 "register_operand" "")
4287 (match_operand:DI 2 "uns_arith_operand" "")))]
4288 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE
4289 && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)"
4291 (xor:DI (match_dup 1)
4294 (ltu:DI (match_dup 0)
4298 (define_expand "sne"
4299 [(set (match_operand:SI 0 "register_operand" "=d")
4300 (ne:SI (match_dup 1)
4305 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
4308 /* set up operands from compare. */
4309 operands[1] = branch_cmp[0];
4310 operands[2] = branch_cmp[1];
4312 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
4314 gen_int_relational (NE, operands[0], operands[1], operands[2], (int *)0);
4318 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
4319 operands[2] = force_reg (SImode, operands[2]);
4321 /* fall through and generate default code */
4324 (define_insn "sne_si_zero"
4325 [(set (match_operand:SI 0 "register_operand" "=d")
4326 (ne:SI (match_operand:SI 1 "register_operand" "d")
4330 [(set_attr "type" "arith")
4331 (set_attr "mode" "SI")
4332 (set_attr "length" "1")])
4334 (define_insn "sne_di_zero"
4335 [(set (match_operand:DI 0 "register_operand" "=d")
4336 (ne:DI (match_operand:DI 1 "register_operand" "d")
4340 [(set_attr "type" "arith")
4341 (set_attr "mode" "DI")
4342 (set_attr "length" "1")])
4344 (define_insn "sne_si"
4345 [(set (match_operand:SI 0 "register_operand" "=d,d")
4346 (ne:SI (match_operand:SI 1 "register_operand" "%d,d")
4347 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
4348 "TARGET_DEBUG_C_MODE"
4350 xor\\t%0,%1,%2\;sltu\\t%0,%.,%0
4351 xori\\t%0,%1,%x2\;sltu\\t%0,%.,%0"
4352 [(set_attr "type" "arith")
4353 (set_attr "mode" "SI")
4354 (set_attr "length" "2")])
4357 [(set (match_operand:SI 0 "register_operand" "")
4358 (ne:SI (match_operand:SI 1 "register_operand" "")
4359 (match_operand:SI 2 "uns_arith_operand" "")))]
4360 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE
4361 && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)"
4363 (xor:SI (match_dup 1)
4366 (gtu:SI (match_dup 0)
4370 (define_insn "sne_di"
4371 [(set (match_operand:DI 0 "register_operand" "=d,d")
4372 (ne:DI (match_operand:DI 1 "register_operand" "%d,d")
4373 (match_operand:DI 2 "uns_arith_operand" "d,K")))]
4374 "TARGET_64BIT && TARGET_DEBUG_C_MODE"
4376 xor\\t%0,%1,%2\;sltu\\t%0,%.,%0
4377 xori\\t%0,%1,%x2\;sltu\\t%0,%.,%0"
4378 [(set_attr "type" "arith")
4379 (set_attr "mode" "DI")
4380 (set_attr "length" "2")])
4383 [(set (match_operand:DI 0 "register_operand" "")
4384 (ne:DI (match_operand:DI 1 "register_operand" "")
4385 (match_operand:DI 2 "uns_arith_operand" "")))]
4386 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE
4387 && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)"
4389 (xor:DI (match_dup 1)
4392 (gtu:DI (match_dup 0)
4396 (define_expand "sgt"
4397 [(set (match_operand:SI 0 "register_operand" "=d")
4398 (gt:SI (match_dup 1)
4403 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
4406 /* set up operands from compare. */
4407 operands[1] = branch_cmp[0];
4408 operands[2] = branch_cmp[1];
4410 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
4412 gen_int_relational (GT, operands[0], operands[1], operands[2], (int *)0);
4416 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) != 0)
4417 operands[2] = force_reg (SImode, operands[2]);
4419 /* fall through and generate default code */
4422 (define_insn "sgt_si"
4423 [(set (match_operand:SI 0 "register_operand" "=d")
4424 (gt:SI (match_operand:SI 1 "register_operand" "d")
4425 (match_operand:SI 2 "reg_or_0_operand" "dJ")))]
4428 [(set_attr "type" "arith")
4429 (set_attr "mode" "SI")
4430 (set_attr "length" "1")])
4432 (define_insn "sgt_di"
4433 [(set (match_operand:DI 0 "register_operand" "=d")
4434 (gt:DI (match_operand:DI 1 "register_operand" "d")
4435 (match_operand:DI 2 "reg_or_0_operand" "dJ")))]
4438 [(set_attr "type" "arith")
4439 (set_attr "mode" "DI")
4440 (set_attr "length" "1")])
4442 (define_expand "sge"
4443 [(set (match_operand:SI 0 "register_operand" "=d")
4444 (ge:SI (match_dup 1)
4449 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
4452 /* set up operands from compare. */
4453 operands[1] = branch_cmp[0];
4454 operands[2] = branch_cmp[1];
4456 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
4458 gen_int_relational (GE, operands[0], operands[1], operands[2], (int *)0);
4462 /* fall through and generate default code */
4465 (define_insn "sge_si"
4466 [(set (match_operand:SI 0 "register_operand" "=d")
4467 (ge:SI (match_operand:SI 1 "register_operand" "d")
4468 (match_operand:SI 2 "arith_operand" "dI")))]
4469 "TARGET_DEBUG_C_MODE"
4470 "slt\\t%0,%1,%2\;xori\\t%0,%0,0x0001"
4471 [(set_attr "type" "arith")
4472 (set_attr "mode" "SI")
4473 (set_attr "length" "2")])
4476 [(set (match_operand:SI 0 "register_operand" "")
4477 (ge:SI (match_operand:SI 1 "register_operand" "")
4478 (match_operand:SI 2 "arith_operand" "")))]
4479 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
4481 (lt:SI (match_dup 1)
4484 (xor:SI (match_dup 0)
4488 (define_insn "sge_di"
4489 [(set (match_operand:DI 0 "register_operand" "=d")
4490 (ge:DI (match_operand:DI 1 "register_operand" "d")
4491 (match_operand:DI 2 "arith_operand" "dI")))]
4492 "TARGET_64BIT && TARGET_DEBUG_C_MODE"
4493 "slt\\t%0,%1,%2\;xori\\t%0,%0,0x0001"
4494 [(set_attr "type" "arith")
4495 (set_attr "mode" "DI")
4496 (set_attr "length" "2")])
4499 [(set (match_operand:DI 0 "register_operand" "")
4500 (ge:DI (match_operand:DI 1 "register_operand" "")
4501 (match_operand:DI 2 "arith_operand" "")))]
4502 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
4504 (lt:DI (match_dup 1)
4507 (xor:DI (match_dup 0)
4511 (define_expand "slt"
4512 [(set (match_operand:SI 0 "register_operand" "=d")
4513 (lt:SI (match_dup 1)
4518 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
4521 /* set up operands from compare. */
4522 operands[1] = branch_cmp[0];
4523 operands[2] = branch_cmp[1];
4525 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
4527 gen_int_relational (LT, operands[0], operands[1], operands[2], (int *)0);
4531 /* fall through and generate default code */
4534 (define_insn "slt_si"
4535 [(set (match_operand:SI 0 "register_operand" "=d")
4536 (lt:SI (match_operand:SI 1 "register_operand" "d")
4537 (match_operand:SI 2 "arith_operand" "dI")))]
4540 [(set_attr "type" "arith")
4541 (set_attr "mode" "SI")
4542 (set_attr "length" "1")])
4544 (define_insn "slt_di"
4545 [(set (match_operand:DI 0 "register_operand" "=d")
4546 (lt:DI (match_operand:DI 1 "register_operand" "d")
4547 (match_operand:DI 2 "arith_operand" "dI")))]
4550 [(set_attr "type" "arith")
4551 (set_attr "mode" "DI")
4552 (set_attr "length" "1")])
4554 (define_expand "sle"
4555 [(set (match_operand:SI 0 "register_operand" "=d")
4556 (le:SI (match_dup 1)
4561 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
4564 /* set up operands from compare. */
4565 operands[1] = branch_cmp[0];
4566 operands[2] = branch_cmp[1];
4568 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
4570 gen_int_relational (LE, operands[0], operands[1], operands[2], (int *)0);
4574 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 32767)
4575 operands[2] = force_reg (SImode, operands[2]);
4577 /* fall through and generate default code */
4580 (define_insn "sle_si_const"
4581 [(set (match_operand:SI 0 "register_operand" "=d")
4582 (le:SI (match_operand:SI 1 "register_operand" "d")
4583 (match_operand:SI 2 "small_int" "I")))]
4584 "INTVAL (operands[2]) < 32767"
4587 operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2])+1);
4588 return \"slt\\t%0,%1,%2\";
4590 [(set_attr "type" "arith")
4591 (set_attr "mode" "SI")
4592 (set_attr "length" "1")])
4594 (define_insn "sle_di_const"
4595 [(set (match_operand:DI 0 "register_operand" "=d")
4596 (le:DI (match_operand:DI 1 "register_operand" "d")
4597 (match_operand:DI 2 "small_int" "I")))]
4598 "TARGET_64BIT && INTVAL (operands[2]) < 32767"
4601 operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2])+1);
4602 return \"slt\\t%0,%1,%2\";
4604 [(set_attr "type" "arith")
4605 (set_attr "mode" "DI")
4606 (set_attr "length" "1")])
4608 (define_insn "sle_si_reg"
4609 [(set (match_operand:SI 0 "register_operand" "=d")
4610 (le:SI (match_operand:SI 1 "register_operand" "d")
4611 (match_operand:SI 2 "register_operand" "d")))]
4612 "TARGET_DEBUG_C_MODE"
4613 "slt\\t%0,%z2,%1\;xori\\t%0,%0,0x0001"
4614 [(set_attr "type" "arith")
4615 (set_attr "mode" "SI")
4616 (set_attr "length" "2")])
4619 [(set (match_operand:SI 0 "register_operand" "")
4620 (le:SI (match_operand:SI 1 "register_operand" "")
4621 (match_operand:SI 2 "register_operand" "")))]
4622 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
4624 (lt:SI (match_dup 2)
4627 (xor:SI (match_dup 0)
4631 (define_insn "sle_di_reg"
4632 [(set (match_operand:DI 0 "register_operand" "=d")
4633 (le:DI (match_operand:DI 1 "register_operand" "d")
4634 (match_operand:DI 2 "register_operand" "d")))]
4635 "TARGET_64BIT && TARGET_DEBUG_C_MODE"
4636 "slt\\t%0,%z2,%1\;xori\\t%0,%0,0x0001"
4637 [(set_attr "type" "arith")
4638 (set_attr "mode" "DI")
4639 (set_attr "length" "2")])
4642 [(set (match_operand:DI 0 "register_operand" "")
4643 (le:DI (match_operand:DI 1 "register_operand" "")
4644 (match_operand:DI 2 "register_operand" "")))]
4645 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
4647 (lt:DI (match_dup 2)
4650 (xor:DI (match_dup 0)
4654 (define_expand "sgtu"
4655 [(set (match_operand:SI 0 "register_operand" "=d")
4656 (gtu:SI (match_dup 1)
4661 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
4664 /* set up operands from compare. */
4665 operands[1] = branch_cmp[0];
4666 operands[2] = branch_cmp[1];
4668 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
4670 gen_int_relational (GTU, operands[0], operands[1], operands[2], (int *)0);
4674 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) != 0)
4675 operands[2] = force_reg (SImode, operands[2]);
4677 /* fall through and generate default code */
4680 (define_insn "sgtu_si"
4681 [(set (match_operand:SI 0 "register_operand" "=d")
4682 (gtu:SI (match_operand:SI 1 "register_operand" "d")
4683 (match_operand:SI 2 "reg_or_0_operand" "dJ")))]
4686 [(set_attr "type" "arith")
4687 (set_attr "mode" "SI")
4688 (set_attr "length" "1")])
4690 (define_insn "sgtu_di"
4691 [(set (match_operand:DI 0 "register_operand" "=d")
4692 (gtu:DI (match_operand:DI 1 "register_operand" "d")
4693 (match_operand:DI 2 "reg_or_0_operand" "dJ")))]
4696 [(set_attr "type" "arith")
4697 (set_attr "mode" "DI")
4698 (set_attr "length" "1")])
4700 (define_expand "sgeu"
4701 [(set (match_operand:SI 0 "register_operand" "=d")
4702 (geu:SI (match_dup 1)
4707 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
4710 /* set up operands from compare. */
4711 operands[1] = branch_cmp[0];
4712 operands[2] = branch_cmp[1];
4714 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
4716 gen_int_relational (GEU, operands[0], operands[1], operands[2], (int *)0);
4720 /* fall through and generate default code */
4723 (define_insn "sgeu_si"
4724 [(set (match_operand:SI 0 "register_operand" "=d")
4725 (geu:SI (match_operand:SI 1 "register_operand" "d")
4726 (match_operand:SI 2 "arith_operand" "dI")))]
4727 "TARGET_DEBUG_C_MODE"
4728 "sltu\\t%0,%1,%2\;xori\\t%0,%0,0x0001"
4729 [(set_attr "type" "arith")
4730 (set_attr "mode" "SI")
4731 (set_attr "length" "2")])
4734 [(set (match_operand:SI 0 "register_operand" "")
4735 (geu:SI (match_operand:SI 1 "register_operand" "")
4736 (match_operand:SI 2 "arith_operand" "")))]
4737 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
4739 (ltu:SI (match_dup 1)
4742 (xor:SI (match_dup 0)
4746 (define_insn "sgeu_di"
4747 [(set (match_operand:DI 0 "register_operand" "=d")
4748 (geu:DI (match_operand:DI 1 "register_operand" "d")
4749 (match_operand:DI 2 "arith_operand" "dI")))]
4750 "TARGET_64BIT && TARGET_DEBUG_C_MODE"
4751 "sltu\\t%0,%1,%2\;xori\\t%0,%0,0x0001"
4752 [(set_attr "type" "arith")
4753 (set_attr "mode" "DI")
4754 (set_attr "length" "2")])
4757 [(set (match_operand:DI 0 "register_operand" "")
4758 (geu:DI (match_operand:DI 1 "register_operand" "")
4759 (match_operand:DI 2 "arith_operand" "")))]
4760 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
4762 (ltu:DI (match_dup 1)
4765 (xor:DI (match_dup 0)
4769 (define_expand "sltu"
4770 [(set (match_operand:SI 0 "register_operand" "=d")
4771 (ltu:SI (match_dup 1)
4776 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
4779 /* set up operands from compare. */
4780 operands[1] = branch_cmp[0];
4781 operands[2] = branch_cmp[1];
4783 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
4785 gen_int_relational (LTU, operands[0], operands[1], operands[2], (int *)0);
4789 /* fall through and generate default code */
4792 (define_insn "sltu_si"
4793 [(set (match_operand:SI 0 "register_operand" "=d")
4794 (ltu:SI (match_operand:SI 1 "register_operand" "d")
4795 (match_operand:SI 2 "arith_operand" "dI")))]
4798 [(set_attr "type" "arith")
4799 (set_attr "mode" "SI")
4800 (set_attr "length" "1")])
4802 (define_insn "sltu_di"
4803 [(set (match_operand:DI 0 "register_operand" "=d")
4804 (ltu:DI (match_operand:DI 1 "register_operand" "d")
4805 (match_operand:DI 2 "arith_operand" "dI")))]
4808 [(set_attr "type" "arith")
4809 (set_attr "mode" "DI")
4810 (set_attr "length" "1")])
4812 (define_expand "sleu"
4813 [(set (match_operand:SI 0 "register_operand" "=d")
4814 (leu:SI (match_dup 1)
4819 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
4822 /* set up operands from compare. */
4823 operands[1] = branch_cmp[0];
4824 operands[2] = branch_cmp[1];
4826 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
4828 gen_int_relational (LEU, operands[0], operands[1], operands[2], (int *)0);
4832 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 32767)
4833 operands[2] = force_reg (SImode, operands[2]);
4835 /* fall through and generate default code */
4838 (define_insn "sleu_si_const"
4839 [(set (match_operand:SI 0 "register_operand" "=d")
4840 (leu:SI (match_operand:SI 1 "register_operand" "d")
4841 (match_operand:SI 2 "small_int" "I")))]
4842 "INTVAL (operands[2]) < 32767"
4845 operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2])+1);
4846 return \"sltu\\t%0,%1,%2\";
4848 [(set_attr "type" "arith")
4849 (set_attr "mode" "SI")
4850 (set_attr "length" "1")])
4852 (define_insn "sleu_di_const"
4853 [(set (match_operand:DI 0 "register_operand" "=d")
4854 (leu:DI (match_operand:DI 1 "register_operand" "d")
4855 (match_operand:DI 2 "small_int" "I")))]
4856 "TARGET_64BIT && INTVAL (operands[2]) < 32767"
4859 operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2])+1);
4860 return \"sltu\\t%0,%1,%2\";
4862 [(set_attr "type" "arith")
4863 (set_attr "mode" "DI")
4864 (set_attr "length" "1")])
4866 (define_insn "sleu_si_reg"
4867 [(set (match_operand:SI 0 "register_operand" "=d")
4868 (leu:SI (match_operand:SI 1 "register_operand" "d")
4869 (match_operand:SI 2 "register_operand" "d")))]
4870 "TARGET_DEBUG_C_MODE"
4871 "sltu\\t%0,%z2,%1\;xori\\t%0,%0,0x0001"
4872 [(set_attr "type" "arith")
4873 (set_attr "mode" "SI")
4874 (set_attr "length" "2")])
4877 [(set (match_operand:SI 0 "register_operand" "")
4878 (leu:SI (match_operand:SI 1 "register_operand" "")
4879 (match_operand:SI 2 "register_operand" "")))]
4880 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
4882 (ltu:SI (match_dup 2)
4885 (xor:SI (match_dup 0)
4889 (define_insn "sleu_di_reg"
4890 [(set (match_operand:DI 0 "register_operand" "=d")
4891 (leu:DI (match_operand:DI 1 "register_operand" "d")
4892 (match_operand:DI 2 "register_operand" "d")))]
4893 "TARGET_64BIT && TARGET_DEBUG_C_MODE"
4894 "sltu\\t%0,%z2,%1\;xori\\t%0,%0,0x0001"
4895 [(set_attr "type" "arith")
4896 (set_attr "mode" "DI")
4897 (set_attr "length" "2")])
4900 [(set (match_operand:DI 0 "register_operand" "")
4901 (leu:DI (match_operand:DI 1 "register_operand" "")
4902 (match_operand:DI 2 "register_operand" "")))]
4903 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
4905 (ltu:DI (match_dup 2)
4908 (xor:DI (match_dup 0)
4914 ;; ....................
4916 ;; FLOATING POINT COMPARISONS
4918 ;; ....................
4920 (define_insn "seq_df"
4921 [(set (reg:CC_FP 66)
4922 (eq:CC_FP (match_operand:DF 0 "register_operand" "f")
4923 (match_operand:DF 1 "register_operand" "f")))]
4928 xoperands[0] = gen_rtx (REG, CC_FPmode, FPSW_REGNUM);
4929 xoperands[1] = operands[0];
4930 xoperands[2] = operands[1];
4932 return mips_fill_delay_slot (\"c.eq.d\\t%0,%1\", DELAY_FCMP, xoperands, insn);
4934 [(set_attr "type" "fcmp")
4935 (set_attr "mode" "FPSW")
4936 (set_attr "length" "1")])
4938 (define_insn "sne_df"
4939 [(set (reg:CC_REV_FP 66)
4940 (ne:CC_REV_FP (match_operand:DF 0 "register_operand" "f")
4941 (match_operand:DF 1 "register_operand" "f")))]
4946 xoperands[0] = gen_rtx (REG, CC_FPmode, FPSW_REGNUM);
4947 xoperands[1] = operands[0];
4948 xoperands[2] = operands[1];
4950 return mips_fill_delay_slot (\"c.eq.d\\t%0,%1\", DELAY_FCMP, xoperands, insn);
4952 [(set_attr "type" "fcmp")
4953 (set_attr "mode" "FPSW")
4954 (set_attr "length" "1")])
4956 (define_insn "slt_df"
4957 [(set (reg:CC_FP 66)
4958 (lt:CC_FP (match_operand:DF 0 "register_operand" "f")
4959 (match_operand:DF 1 "register_operand" "f")))]
4964 xoperands[0] = gen_rtx (REG, CC_FPmode, FPSW_REGNUM);
4965 xoperands[1] = operands[0];
4966 xoperands[2] = operands[1];
4968 return mips_fill_delay_slot (\"c.lt.d\\t%0,%1\", DELAY_FCMP, xoperands, insn);
4970 [(set_attr "type" "fcmp")
4971 (set_attr "mode" "FPSW")
4972 (set_attr "length" "1")])
4974 (define_insn "sle_df"
4975 [(set (reg:CC_FP 66)
4976 (le:CC_FP (match_operand:DF 0 "register_operand" "f")
4977 (match_operand:DF 1 "register_operand" "f")))]
4982 xoperands[0] = gen_rtx (REG, CC_FPmode, FPSW_REGNUM);
4983 xoperands[1] = operands[0];
4984 xoperands[2] = operands[1];
4986 return mips_fill_delay_slot (\"c.le.d\\t%0,%1\", DELAY_FCMP, xoperands, insn);
4988 [(set_attr "type" "fcmp")
4989 (set_attr "mode" "FPSW")
4990 (set_attr "length" "1")])
4992 (define_insn "sgt_df"
4993 [(set (reg:CC_FP 66)
4994 (gt:CC_FP (match_operand:DF 0 "register_operand" "f")
4995 (match_operand:DF 1 "register_operand" "f")))]
5000 xoperands[0] = gen_rtx (REG, CC_FPmode, FPSW_REGNUM);
5001 xoperands[1] = operands[0];
5002 xoperands[2] = operands[1];
5004 return mips_fill_delay_slot (\"c.lt.d\\t%1,%0\", DELAY_FCMP, xoperands, insn);
5006 [(set_attr "type" "fcmp")
5007 (set_attr "mode" "FPSW")
5008 (set_attr "length" "1")])
5010 (define_insn "sge_df"
5011 [(set (reg:CC_FP 66)
5012 (ge:CC_FP (match_operand:DF 0 "register_operand" "f")
5013 (match_operand:DF 1 "register_operand" "f")))]
5018 xoperands[0] = gen_rtx (REG, CC_FPmode, FPSW_REGNUM);
5019 xoperands[1] = operands[0];
5020 xoperands[2] = operands[1];
5022 return mips_fill_delay_slot (\"c.le.d\\t%1,%0\", DELAY_FCMP, xoperands, insn);
5024 [(set_attr "type" "fcmp")
5025 (set_attr "mode" "FPSW")
5026 (set_attr "length" "1")])
5028 (define_insn "seq_sf"
5029 [(set (reg:CC_FP 66)
5030 (eq:CC_FP (match_operand:SF 0 "register_operand" "f")
5031 (match_operand:SF 1 "register_operand" "f")))]
5036 xoperands[0] = gen_rtx (REG, CC_FPmode, FPSW_REGNUM);
5037 xoperands[1] = operands[0];
5038 xoperands[2] = operands[1];
5040 return mips_fill_delay_slot (\"c.eq.s\\t%0,%1\", DELAY_FCMP, xoperands, insn);
5042 [(set_attr "type" "fcmp")
5043 (set_attr "mode" "FPSW")
5044 (set_attr "length" "1")])
5046 (define_insn "sne_sf"
5047 [(set (reg:CC_REV_FP 66)
5048 (ne:CC_REV_FP (match_operand:SF 0 "register_operand" "f")
5049 (match_operand:SF 1 "register_operand" "f")))]
5054 xoperands[0] = gen_rtx (REG, CC_FPmode, FPSW_REGNUM);
5055 xoperands[1] = operands[0];
5056 xoperands[2] = operands[1];
5058 return mips_fill_delay_slot (\"c.eq.s\\t%0,%1\", DELAY_FCMP, xoperands, insn);
5060 [(set_attr "type" "fcmp")
5061 (set_attr "mode" "FPSW")
5062 (set_attr "length" "1")])
5064 (define_insn "slt_sf"
5065 [(set (reg:CC_FP 66)
5066 (lt:CC_FP (match_operand:SF 0 "register_operand" "f")
5067 (match_operand:SF 1 "register_operand" "f")))]
5072 xoperands[0] = gen_rtx (REG, CC_FPmode, FPSW_REGNUM);
5073 xoperands[1] = operands[0];
5074 xoperands[2] = operands[1];
5076 return mips_fill_delay_slot (\"c.lt.s\\t%0,%1\", DELAY_FCMP, xoperands, insn);
5078 [(set_attr "type" "fcmp")
5079 (set_attr "mode" "FPSW")
5080 (set_attr "length" "1")])
5082 (define_insn "sle_sf"
5083 [(set (reg:CC_FP 66)
5084 (le:CC_FP (match_operand:SF 0 "register_operand" "f")
5085 (match_operand:SF 1 "register_operand" "f")))]
5090 xoperands[0] = gen_rtx (REG, CC_FPmode, FPSW_REGNUM);
5091 xoperands[1] = operands[0];
5092 xoperands[2] = operands[1];
5094 return mips_fill_delay_slot (\"c.le.s\\t%0,%1\", DELAY_FCMP, xoperands, insn);
5096 [(set_attr "type" "fcmp")
5097 (set_attr "mode" "FPSW")
5098 (set_attr "length" "1")])
5100 (define_insn "sgt_sf"
5101 [(set (reg:CC_FP 66)
5102 (gt:CC_FP (match_operand:SF 0 "register_operand" "f")
5103 (match_operand:SF 1 "register_operand" "f")))]
5108 xoperands[0] = gen_rtx (REG, CC_FPmode, FPSW_REGNUM);
5109 xoperands[1] = operands[0];
5110 xoperands[2] = operands[1];
5112 return mips_fill_delay_slot (\"c.lt.s\\t%1,%0\", DELAY_FCMP, xoperands, insn);
5114 [(set_attr "type" "fcmp")
5115 (set_attr "mode" "FPSW")
5116 (set_attr "length" "1")])
5118 (define_insn "sge_sf"
5119 [(set (reg:CC_FP 66)
5120 (ge:CC_FP (match_operand:SF 0 "register_operand" "f")
5121 (match_operand:SF 1 "register_operand" "f")))]
5126 xoperands[0] = gen_rtx (REG, CC_FPmode, FPSW_REGNUM);
5127 xoperands[1] = operands[0];
5128 xoperands[2] = operands[1];
5130 return mips_fill_delay_slot (\"c.le.s\\t%1,%0\", DELAY_FCMP, xoperands, insn);
5132 [(set_attr "type" "fcmp")
5133 (set_attr "mode" "FPSW")
5134 (set_attr "length" "1")])
5138 ;; ....................
5140 ;; UNCONDITIONAL BRANCHES
5142 ;; ....................
5144 ;; Unconditional branches.
5148 (label_ref (match_operand 0 "" "")))]
5152 if (GET_CODE (operands[0]) == REG)
5153 return \"%*j\\t%0\";
5155 return \"%*j\\t%l0\";
5157 [(set_attr "type" "jump")
5158 (set_attr "mode" "none")
5159 (set_attr "length" "1")])
5161 (define_expand "indirect_jump"
5162 [(set (pc) (match_operand 0 "register_operand" "d"))]
5168 if (operands[0]) /* eliminate unused code warnings */
5171 if (GET_CODE (dest) != REG || GET_MODE (dest) != Pmode)
5172 operands[0] = copy_to_mode_reg (Pmode, dest);
5175 emit_jump_insn (gen_indirect_jump_internal1 (operands[0]));
5177 emit_jump_insn (gen_indirect_jump_internal2 (operands[0]));
5183 (define_insn "indirect_jump_internal1"
5184 [(set (pc) (match_operand:SI 0 "register_operand" "d"))]
5187 [(set_attr "type" "jump")
5188 (set_attr "mode" "none")
5189 (set_attr "length" "1")])
5191 (define_insn "indirect_jump_internal2"
5192 [(set (pc) (match_operand:DI 0 "register_operand" "d"))]
5195 [(set_attr "type" "jump")
5196 (set_attr "mode" "none")
5197 (set_attr "length" "1")])
5199 (define_expand "tablejump"
5201 (match_operand 0 "register_operand" "d"))
5202 (use (label_ref (match_operand 1 "" "")))]
5208 if (operands[0]) /* eliminate unused code warnings */
5210 if (GET_MODE (operands[0]) != Pmode)
5214 emit_jump_insn (gen_tablejump_internal1 (operands[0], operands[1]));
5216 emit_jump_insn (gen_tablejump_internal2 (operands[0], operands[1]));
5222 (define_insn "tablejump_internal1"
5224 (match_operand:SI 0 "register_operand" "d"))
5225 (use (label_ref (match_operand 1 "" "")))]
5228 [(set_attr "type" "jump")
5229 (set_attr "mode" "none")
5230 (set_attr "length" "1")])
5232 (define_insn "tablejump_internal2"
5234 (match_operand:DI 0 "register_operand" "d"))
5235 (use (label_ref (match_operand 1 "" "")))]
5238 [(set_attr "type" "jump")
5239 (set_attr "mode" "none")
5240 (set_attr "length" "1")])
5242 ;; Function return, only allow after optimization, so that we can
5243 ;; eliminate jumps to jumps if no stack space is used.
5245 ;; (define_expand "return"
5246 ;; [(set (pc) (reg:SI 31))]
5247 ;; "simple_epilogue_p ()"
5250 (define_expand "return"
5251 [(parallel [(return)
5252 (use (reg:SI 31))])]
5253 "simple_epilogue_p ()"
5256 (define_insn "return_internal"
5257 [(parallel [(return)
5258 (use (match_operand:SI 0 "register_operand" "d"))])]
5261 [(set_attr "type" "jump")
5262 (set_attr "mode" "none")
5263 (set_attr "length" "1")])
5267 ;; ....................
5269 ;; Function prologue/epilogue
5271 ;; ....................
5274 (define_expand "prologue"
5279 if (mips_isa >= 0) /* avoid unused code warnings */
5281 mips_expand_prologue ();
5286 ;; Block any insns from being moved before this point, since the
5287 ;; profiling call to mcount can use various registers that aren't
5288 ;; saved or used to pass arguments.
5290 (define_insn "blockage"
5291 [(unspec_volatile [(const_int 0)] 0)]
5294 [(set_attr "type" "unknown")
5295 (set_attr "mode" "none")
5296 (set_attr "length" "0")])
5298 ;; At present, don't expand the epilogue, reorg.c will clobber the
5299 ;; return register in compiling gen_lowpart (emit-rtl.c).
5301 ;; (define_expand "epilogue"
5306 ;; if (mips_isa >= 0) /* avoid unused code warnings */
5308 ;; mips_expand_epilogue ();
5315 ;; ....................
5319 ;; ....................
5321 ;; calls.c now passes a third argument, make saber happy
5323 (define_expand "call"
5324 [(parallel [(call (match_operand 0 "memory_operand" "m")
5325 (match_operand 1 "" "i"))
5326 (clobber (reg:SI 31))
5327 (use (match_operand 2 "" "")) ;; next_arg_reg
5328 (use (match_operand 3 "" ""))])] ;; struct_value_size_rtx
5334 if (operands[0]) /* eliminate unused code warnings */
5336 addr = XEXP (operands[0], 0);
5337 if ((GET_CODE (addr) != REG && (!CONSTANT_ADDRESS_P (addr) || TARGET_LONG_CALLS))
5338 || ! call_insn_operand (operands[0], VOIDmode))
5339 XEXP (operands[0], 0) = copy_to_mode_reg (Pmode, addr);
5341 /* In order to pass small structures by value in registers
5342 compatibly with the MIPS compiler, we need to shift the value
5343 into the high part of the register. Function_arg has encoded
5344 a PARALLEL rtx, holding a vector of adjustments to be made
5345 as the next_arg_reg variable, so we split up the insns,
5346 and emit them separately. */
5348 if (operands[2] != (rtx)0 && GET_CODE (operands[2]) == PARALLEL)
5350 rtvec adjust = XVEC (operands[2], 0);
5351 int num = GET_NUM_ELEM (adjust);
5354 for (i = 0; i < num; i++)
5355 emit_insn (RTVEC_ELT (adjust, i));
5358 emit_call_insn (gen_call_internal1 (operands[0], operands[1],
5359 gen_rtx (REG, SImode, GP_REG_FIRST + 31)));
5364 (define_insn "call_internal1"
5365 [(call (match_operand 0 "call_insn_operand" "m")
5366 (match_operand 1 "" "i"))
5367 (clobber (match_operand:SI 2 "register_operand" "=d"))]
5368 "!TARGET_ABICALLS && !TARGET_LONG_CALLS"
5371 register rtx target = XEXP (operands[0], 0);
5373 if (GET_CODE (target) == SYMBOL_REF)
5374 return \"%*jal\\t%0\";
5376 else if (GET_CODE (target) == CONST_INT)
5378 operands[0] = target;
5379 return \"%*%[li\\t%@,%0\\n\\tjal\\t%2,%@%]\";
5384 operands[0] = target;
5385 return \"%*jal\\t%2,%0\";
5388 [(set_attr "type" "call")
5389 (set_attr "mode" "none")
5390 (set_attr "length" "1")])
5392 (define_insn "call_internal2"
5393 [(call (match_operand 0 "call_insn_operand" "m")
5394 (match_operand 1 "" "i"))
5395 (clobber (match_operand:SI 2 "register_operand" "=d"))]
5396 "TARGET_ABICALLS && !TARGET_LONG_CALLS"
5399 register rtx target = XEXP (operands[0], 0);
5401 if (GET_CODE (target) == SYMBOL_REF)
5402 return \"jal\\t%0\";
5404 else if (GET_CODE (target) == CONST_INT)
5406 operands[0] = target;
5407 return \"li\\t%^,%0\\n\\tjal\\t%2,%^\";
5412 operands[0] = target;
5413 if (REGNO (target) != PIC_FUNCTION_ADDR_REGNUM)
5414 return \"move\\t%^,%0\\n\\tjal\\t%2,%^\";
5416 return \"jal\\t%2,%0\";
5419 [(set_attr "type" "call")
5420 (set_attr "mode" "none")
5421 (set_attr "length" "2")])
5423 (define_insn "call_internal3a"
5424 [(call (mem:SI (match_operand:SI 0 "register_operand" "r"))
5425 (match_operand 1 "" "i"))
5426 (clobber (match_operand:SI 2 "register_operand" "=d"))]
5427 "!TARGET_LONG64 && !TARGET_ABICALLS && TARGET_LONG_CALLS"
5429 [(set_attr "type" "call")
5430 (set_attr "mode" "none")
5431 (set_attr "length" "1")])
5433 (define_insn "call_internal3b"
5434 [(call (mem:DI (match_operand:DI 0 "register_operand" "r"))
5435 (match_operand 1 "" "i"))
5436 (clobber (match_operand:SI 2 "register_operand" "=d"))]
5437 "TARGET_LONG64 && !TARGET_ABICALLS && TARGET_LONG_CALLS"
5439 [(set_attr "type" "call")
5440 (set_attr "mode" "none")
5441 (set_attr "length" "1")])
5443 (define_insn "call_internal4a"
5444 [(call (mem:SI (match_operand:SI 0 "register_operand" "r"))
5445 (match_operand 1 "" "i"))
5446 (clobber (match_operand:SI 2 "register_operand" "=d"))]
5447 "!TARGET_LONG64 && TARGET_ABICALLS && TARGET_LONG_CALLS"
5450 if (REGNO (operands[0]) != PIC_FUNCTION_ADDR_REGNUM)
5451 return \"move\\t%^,%0\\n\\tjal\\t%2,%^\";
5453 return \"jal\\t%2,%0\";
5455 [(set_attr "type" "call")
5456 (set_attr "mode" "none")
5457 (set_attr "length" "2")])
5459 (define_insn "call_internal4b"
5460 [(call (mem:DI (match_operand:DI 0 "register_operand" "r"))
5461 (match_operand 1 "" "i"))
5462 (clobber (match_operand:SI 2 "register_operand" "=d"))]
5463 "TARGET_LONG64 && TARGET_ABICALLS && TARGET_LONG_CALLS"
5466 if (REGNO (operands[0]) != PIC_FUNCTION_ADDR_REGNUM)
5467 return \"move\\t%^,%0\\n\\tjal\\t%2,%^\";
5469 return \"jal\\t%2,%0\";
5471 [(set_attr "type" "call")
5472 (set_attr "mode" "none")
5473 (set_attr "length" "2")])
5475 ;; calls.c now passes a fourth argument, make saber happy
5477 (define_expand "call_value"
5478 [(parallel [(set (match_operand 0 "register_operand" "=df")
5479 (call (match_operand 1 "memory_operand" "m")
5480 (match_operand 2 "" "i")))
5481 (clobber (reg:SI 31))
5482 (use (match_operand 3 "" ""))])] ;; next_arg_reg
5488 if (operands[0]) /* eliminate unused code warning */
5490 addr = XEXP (operands[1], 0);
5491 if ((GET_CODE (addr) != REG && (!CONSTANT_ADDRESS_P (addr) || TARGET_LONG_CALLS))
5492 || ! call_insn_operand (operands[1], VOIDmode))
5493 XEXP (operands[1], 0) = copy_to_mode_reg (Pmode, addr);
5495 /* In order to pass small structures by value in registers
5496 compatibly with the MIPS compiler, we need to shift the value
5497 into the high part of the register. Function_arg has encoded
5498 a PARALLEL rtx, holding a vector of adjustments to be made
5499 as the next_arg_reg variable, so we split up the insns,
5500 and emit them separately. */
5502 if (operands[3] != (rtx)0 && GET_CODE (operands[3]) == PARALLEL)
5504 rtvec adjust = XVEC (operands[3], 0);
5505 int num = GET_NUM_ELEM (adjust);
5508 for (i = 0; i < num; i++)
5509 emit_insn (RTVEC_ELT (adjust, i));
5512 emit_call_insn (gen_call_value_internal1 (operands[0], operands[1], operands[2],
5513 gen_rtx (REG, SImode, GP_REG_FIRST + 31)));
5520 (define_insn "call_value_internal1"
5521 [(set (match_operand 0 "register_operand" "=df")
5522 (call (match_operand 1 "call_insn_operand" "m")
5523 (match_operand 2 "" "i")))
5524 (clobber (match_operand:SI 3 "register_operand" "=d"))]
5525 "!TARGET_ABICALLS && !TARGET_LONG_CALLS"
5528 register rtx target = XEXP (operands[1], 0);
5530 if (GET_CODE (target) == SYMBOL_REF)
5531 return \"%*jal\\t%1\";
5533 else if (GET_CODE (target) == CONST_INT)
5535 operands[1] = target;
5536 return \"%*%[li\\t%@,%1\\n\\tjal\\t%3,%@%]\";
5541 operands[1] = target;
5542 return \"%*jal\\t%3,%1\";
5545 [(set_attr "type" "call")
5546 (set_attr "mode" "none")
5547 (set_attr "length" "1")])
5549 (define_insn "call_value_internal2"
5550 [(set (match_operand 0 "register_operand" "=df")
5551 (call (match_operand 1 "call_insn_operand" "m")
5552 (match_operand 2 "" "i")))
5553 (clobber (match_operand:SI 3 "register_operand" "=d"))]
5554 "TARGET_ABICALLS && !TARGET_LONG_CALLS"
5557 register rtx target = XEXP (operands[1], 0);
5559 if (GET_CODE (target) == SYMBOL_REF)
5560 return \"jal\\t%1\";
5562 else if (GET_CODE (target) == CONST_INT)
5564 operands[1] = target;
5565 return \"li\\t%^,%1\\n\\tjal\\t%3,%^\";
5570 operands[1] = target;
5571 if (REGNO (target) != PIC_FUNCTION_ADDR_REGNUM)
5572 return \"move\\t%^,%1\\n\\tjal\\t%3,%^\";
5574 return \"jal\\t%3,%1\";
5577 [(set_attr "type" "call")
5578 (set_attr "mode" "none")
5579 (set_attr "length" "2")])
5581 (define_insn "call_value_internal3a"
5582 [(set (match_operand 0 "register_operand" "=df")
5583 (call (mem:SI (match_operand:SI 1 "register_operand" "r"))
5584 (match_operand 2 "" "i")))
5585 (clobber (match_operand:SI 3 "register_operand" "=d"))]
5586 "!TARGET_LONG64 && !TARGET_ABICALLS && TARGET_LONG_CALLS"
5588 [(set_attr "type" "call")
5589 (set_attr "mode" "none")
5590 (set_attr "length" "1")])
5592 (define_insn "call_value_internal3b"
5593 [(set (match_operand 0 "register_operand" "=df")
5594 (call (mem:DI (match_operand:DI 1 "register_operand" "r"))
5595 (match_operand 2 "" "i")))
5596 (clobber (match_operand:SI 3 "register_operand" "=d"))]
5597 "TARGET_LONG64 && !TARGET_ABICALLS && TARGET_LONG_CALLS"
5599 [(set_attr "type" "call")
5600 (set_attr "mode" "none")
5601 (set_attr "length" "1")])
5603 (define_insn "call_value_internal4a"
5604 [(set (match_operand 0 "register_operand" "=df")
5605 (call (mem:SI (match_operand:SI 1 "register_operand" "r"))
5606 (match_operand 2 "" "i")))
5607 (clobber (match_operand:SI 3 "register_operand" "=d"))]
5608 "!TARGET_LONG64 && TARGET_ABICALLS && TARGET_LONG_CALLS"
5611 if (REGNO (operands[1]) != PIC_FUNCTION_ADDR_REGNUM)
5612 return \"move\\t%^,%1\\n\\tjal\\t%3,%^\";
5614 return \"jal\\t%3,%1\";
5616 [(set_attr "type" "call")
5617 (set_attr "mode" "none")
5618 (set_attr "length" "2")])
5620 (define_insn "call_value_internal4b"
5621 [(set (match_operand 0 "register_operand" "=df")
5622 (call (mem:DI (match_operand:DI 1 "register_operand" "r"))
5623 (match_operand 2 "" "i")))
5624 (clobber (match_operand:SI 3 "register_operand" "=d"))]
5625 "TARGET_LONG64 && TARGET_ABICALLS && TARGET_LONG_CALLS"
5628 if (REGNO (operands[1]) != PIC_FUNCTION_ADDR_REGNUM)
5629 return \"move\\t%^,%1\\n\\tjal\\t%3,%^\";
5631 return \"jal\\t%3,%1\";
5633 [(set_attr "type" "call")
5634 (set_attr "mode" "none")
5635 (set_attr "length" "2")])
5637 ;; Call subroutine returning any type.
5639 (define_expand "untyped_call"
5640 [(parallel [(call (match_operand 0 "" "")
5642 (match_operand 1 "" "")
5643 (match_operand 2 "" "")])]
5647 if (operands[0]) /* silence statement not reached warnings */
5651 emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
5653 for (i = 0; i < XVECLEN (operands[2], 0); i++)
5655 rtx set = XVECEXP (operands[2], 0, i);
5656 emit_move_insn (SET_DEST (set), SET_SRC (set));
5659 emit_insn (gen_blockage ());
5665 ;; ....................
5669 ;; ....................
5676 [(set_attr "type" "nop")
5677 (set_attr "mode" "none")
5678 (set_attr "length" "1")])
5680 (define_expand "probe"
5686 operands[0] = gen_reg_rtx (SImode);
5687 operands[1] = gen_rtx (MEM, SImode, stack_pointer_rtx);
5688 MEM_VOLATILE_P (operands[1]) = TRUE;
5690 /* fall through and generate default code */