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, 90-96, 1997 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, 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
25 ;; ??? Currently does not have define_function_unit support for the R8000.
26 ;; Must include new entries for fmadd in addition to existing entries.
30 ;; ....................
34 ;; ....................
36 ;; Classification of each insn.
37 ;; branch conditional branch
38 ;; jump unconditional jump
39 ;; call unconditional call
40 ;; load load instruction(s)
41 ;; store store instruction(s)
42 ;; move data movement within same register set
43 ;; xfer transfer to/from coprocessor
44 ;; hilo transfer of hi/lo registers
45 ;; arith integer arithmetic instruction
46 ;; darith double precision integer arithmetic instructions
47 ;; imul integer multiply
48 ;; idiv integer divide
49 ;; icmp integer compare
50 ;; fadd floating point add/subtract
51 ;; fmul floating point multiply
52 ;; fmadd floating point multiply-add
53 ;; fdiv floating point divide
54 ;; fabs floating point absolute value
55 ;; fneg floating point negation
56 ;; fcmp floating point compare
57 ;; fcvt floating point convert
58 ;; fsqrt floating point square root
59 ;; multi multiword sequence (or user asm statements)
63 "unknown,branch,jump,call,load,store,move,xfer,hilo,arith,darith,imul,idiv,icmp,fadd,fmul,fmadd,fdiv,fabs,fneg,fcmp,fcvt,fsqrt,multi,nop"
64 (const_string "unknown"))
66 ;; Main data type used by the insn
67 (define_attr "mode" "unknown,none,QI,HI,SI,DI,SF,DF,FPSW" (const_string "unknown"))
69 ;; # instructions (4 bytes each)
70 (define_attr "length" "" (const_int 1))
72 ;; whether or not an instruction has a mandatory delay slot
73 (define_attr "dslot" "no,yes"
74 (if_then_else (eq_attr "type" "branch,jump,call,load,xfer,hilo,fcmp")
78 ;; Attribute describing the processor. This attribute must match exactly
79 ;; with the processor_type enumeration in mips.h.
81 ;; Attribute describing the processor
82 ;; (define_attr "cpu" "default,r3000,r6000,r4000"
84 ;; (cond [(eq (symbol_ref "mips_cpu") (symbol_ref "PROCESSOR_R3000")) (const_string "r3000")
85 ;; (eq (symbol_ref "mips_cpu") (symbol_ref "PROCESSOR_R4000")) (const_string "r4000")
86 ;; (eq (symbol_ref "mips_cpu") (symbol_ref "PROCESSOR_R6000")) (const_string "r6000")]
87 ;; (const_string "default"))))
89 ;; ??? Fix everything that tests this attribute.
91 "default,r3000,r6000,r4000,r4100,r4300,r4600,r4650,r5000,r8000"
92 (const (symbol_ref "mips_cpu_attr")))
94 ;; Attribute defining whether or not we can use the branch-likely instructions
97 (define_attr "branch_likely" "no,yes"
99 (if_then_else (ge (symbol_ref "mips_isa") (const_int 2))
101 (const_string "no"))))
104 ;; Describe a user's asm statement.
105 (define_asm_attributes
106 [(set_attr "type" "multi")])
108 ;; whether or not generating calls to position independent functions
109 (define_attr "abicalls" "no,yes"
110 (const (symbol_ref "mips_abicalls_attr")))
114 ;; .........................
116 ;; Delay slots, can't describe load/fcmp/xfer delay slots here
118 ;; .........................
120 (define_delay (eq_attr "type" "branch")
121 [(and (eq_attr "dslot" "no") (eq_attr "length" "1"))
123 (and (eq_attr "branch_likely" "yes") (and (eq_attr "dslot" "no") (eq_attr "length" "1")))])
125 (define_delay (eq_attr "type" "jump")
126 [(and (eq_attr "dslot" "no") (eq_attr "length" "1"))
130 (define_delay (and (eq_attr "type" "call") (eq_attr "abicalls" "no"))
131 [(and (eq_attr "dslot" "no") (eq_attr "length" "1"))
137 ;; .........................
141 ;; .........................
143 ; (define_function_unit NAME MULTIPLICITY SIMULTANEITY
144 ; TEST READY-DELAY ISSUE-DELAY [CONFLICT-LIST])
146 ;; Make the default case (PROCESSOR_DEFAULT) handle the worst case
148 (define_function_unit "memory" 1 0
149 (and (eq_attr "type" "load")
150 (eq_attr "cpu" "!r3000,r4600,r4650,r4100,r4300,r5000"))
153 (define_function_unit "memory" 1 0
154 (and (eq_attr "type" "load")
155 (eq_attr "cpu" "r3000,r4600,r4650,r4100,r4300,r5000"))
158 (define_function_unit "memory" 1 0 (eq_attr "type" "store") 1 0)
160 (define_function_unit "memory" 1 0 (eq_attr "type" "xfer") 2 0)
162 (define_function_unit "imuldiv" 1 0
163 (eq_attr "type" "hilo")
166 (define_function_unit "imuldiv" 1 0
167 (and (eq_attr "type" "imul")
168 (eq_attr "cpu" "!r3000,r4000,r4600,r4650,r4100,r4300,r5000"))
171 (define_function_unit "imuldiv" 1 0
172 (and (eq_attr "type" "imul") (eq_attr "cpu" "r3000"))
175 (define_function_unit "imuldiv" 1 0
176 (and (eq_attr "type" "imul") (eq_attr "cpu" "r4000,r4600"))
179 (define_function_unit "imuldiv" 1 0
180 (and (eq_attr "type" "imul") (eq_attr "cpu" "r4650"))
183 (define_function_unit "imuldiv" 1 0
184 (and (eq_attr "type" "imul")
185 (and (eq_attr "mode" "SI") (eq_attr "cpu" "r4100")))
188 (define_function_unit "imuldiv" 1 0
189 (and (eq_attr "type" "imul")
190 (and (eq_attr "mode" "DI") (eq_attr "cpu" "r4100")))
193 (define_function_unit "imuldiv" 1 0
194 (and (eq_attr "type" "imul")
195 (and (eq_attr "mode" "SI") (eq_attr "cpu" "r4300,r5000")))
198 (define_function_unit "imuldiv" 1 0
199 (and (eq_attr "type" "imul")
200 (and (eq_attr "mode" "DI") (eq_attr "cpu" "r4300")))
203 (define_function_unit "imuldiv" 1 0
204 (and (eq_attr "type" "imul")
205 (and (eq_attr "mode" "DI") (eq_attr "cpu" "r5000")))
208 (define_function_unit "imuldiv" 1 0
209 (and (eq_attr "type" "idiv")
210 (eq_attr "cpu" "!r3000,r4000,r4600,r4650,r4100,r4300,r5000"))
213 (define_function_unit "imuldiv" 1 0
214 (and (eq_attr "type" "idiv") (eq_attr "cpu" "r3000"))
217 (define_function_unit "imuldiv" 1 0
218 (and (eq_attr "type" "idiv") (eq_attr "cpu" "r4600"))
221 (define_function_unit "imuldiv" 1 0
222 (and (eq_attr "type" "idiv") (eq_attr "cpu" "r4650"))
225 (define_function_unit "imuldiv" 1 0
226 (and (eq_attr "type" "idiv") (eq_attr "cpu" "r4000"))
229 (define_function_unit "imuldiv" 1 0
230 (and (eq_attr "type" "idiv")
231 (and (eq_attr "mode" "SI") (eq_attr "cpu" "r4100")))
234 (define_function_unit "imuldiv" 1 0
235 (and (eq_attr "type" "idiv")
236 (and (eq_attr "mode" "DI") (eq_attr "cpu" "r4100")))
239 (define_function_unit "imuldiv" 1 0
240 (and (eq_attr "type" "idiv")
241 (and (eq_attr "mode" "SI") (eq_attr "cpu" "r4300")))
244 (define_function_unit "imuldiv" 1 0
245 (and (eq_attr "type" "idiv")
246 (and (eq_attr "mode" "DI") (eq_attr "cpu" "r4300")))
249 (define_function_unit "imuldiv" 1 0
250 (and (eq_attr "type" "idiv")
251 (and (eq_attr "mode" "SI") (eq_attr "cpu" "r5000")))
254 (define_function_unit "imuldiv" 1 0
255 (and (eq_attr "type" "idiv")
256 (and (eq_attr "mode" "DI") (eq_attr "cpu" "r5000")))
259 ;; The R4300 does *NOT* have a seperate Floating Point Unit, instead
260 ;; the FP hardware is part of the normal ALU circuitry. This means FP
261 ;; instructions affect the pipe-line, and no functional unit
262 ;; parallelism can occur on R4300 processors. To force GCC into coding
263 ;; for only a single functional unit, we force the R4300 FP
264 ;; instructions to be processed in the "imuldiv" unit.
266 (define_function_unit "adder" 1 1
267 (and (eq_attr "type" "fcmp") (eq_attr "cpu" "!r3000,r6000,r4300,r5000"))
270 (define_function_unit "adder" 1 1
271 (and (eq_attr "type" "fcmp") (eq_attr "cpu" "r3000,r6000"))
274 (define_function_unit "adder" 1 1
275 (and (eq_attr "type" "fcmp") (eq_attr "cpu" "r5000"))
278 (define_function_unit "adder" 1 1
279 (and (eq_attr "type" "fadd") (eq_attr "cpu" "!r3000,r6000,r4300"))
282 (define_function_unit "adder" 1 1
283 (and (eq_attr "type" "fadd") (eq_attr "cpu" "r3000"))
286 (define_function_unit "adder" 1 1
287 (and (eq_attr "type" "fadd") (eq_attr "cpu" "r6000"))
290 (define_function_unit "adder" 1 1
291 (and (eq_attr "type" "fabs,fneg")
292 (eq_attr "cpu" "!r3000,r4600,r4650,r4300,r5000"))
295 (define_function_unit "adder" 1 1
296 (and (eq_attr "type" "fabs,fneg") (eq_attr "cpu" "r3000,r4600,r4650,r5000"))
299 (define_function_unit "mult" 1 1
300 (and (eq_attr "type" "fmul")
301 (and (eq_attr "mode" "SF")
302 (eq_attr "cpu" "!r3000,r6000,r4600,r4650,r4300,r5000")))
305 (define_function_unit "mult" 1 1
306 (and (eq_attr "type" "fmul")
307 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r3000,r5000")))
310 (define_function_unit "mult" 1 1
311 (and (eq_attr "type" "fmul")
312 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r6000")))
315 (define_function_unit "mult" 1 1
316 (and (eq_attr "type" "fmul")
317 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r4600,r4650")))
320 (define_function_unit "mult" 1 1
321 (and (eq_attr "type" "fmul")
322 (and (eq_attr "mode" "DF") (eq_attr "cpu" "!r3000,r6000,r4300,r5000")))
325 (define_function_unit "mult" 1 1
326 (and (eq_attr "type" "fmul")
327 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r3000,r5000")))
330 (define_function_unit "mult" 1 1
331 (and (eq_attr "type" "fmul")
332 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r6000")))
335 (define_function_unit "divide" 1 1
336 (and (eq_attr "type" "fdiv")
337 (and (eq_attr "mode" "SF")
338 (eq_attr "cpu" "!r3000,r6000,r4600,r4650,r4300,r5000")))
341 (define_function_unit "divide" 1 1
342 (and (eq_attr "type" "fdiv")
343 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r3000")))
346 (define_function_unit "divide" 1 1
347 (and (eq_attr "type" "fdiv")
348 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r6000")))
351 (define_function_unit "divide" 1 1
352 (and (eq_attr "type" "fdiv")
353 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r4600,r4650")))
356 (define_function_unit "divide" 1 1
357 (and (eq_attr "type" "fdiv")
358 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r5000")))
361 (define_function_unit "divide" 1 1
362 (and (eq_attr "type" "fdiv")
363 (and (eq_attr "mode" "DF")
364 (eq_attr "cpu" "!r3000,r6000,r4600,r4650,r4300")))
367 (define_function_unit "divide" 1 1
368 (and (eq_attr "type" "fdiv")
369 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r3000")))
372 (define_function_unit "divide" 1 1
373 (and (eq_attr "type" "fdiv")
374 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r6000")))
377 (define_function_unit "divide" 1 1
378 (and (eq_attr "type" "fdiv")
379 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r4600,r4650")))
382 ;;; ??? Is this number right?
383 (define_function_unit "divide" 1 1
384 (and (eq_attr "type" "fsqrt")
385 (and (eq_attr "mode" "SF") (eq_attr "cpu" "!r4600,r4650,r4300,r5000")))
388 (define_function_unit "divide" 1 1
389 (and (eq_attr "type" "fsqrt")
390 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r4600,r4650")))
393 (define_function_unit "divide" 1 1
394 (and (eq_attr "type" "fsqrt")
395 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r5000")))
398 ;;; ??? Is this number right?
399 (define_function_unit "divide" 1 1
400 (and (eq_attr "type" "fsqrt")
401 (and (eq_attr "mode" "DF") (eq_attr "cpu" "!r4600,r4650,r4300,r5000")))
404 (define_function_unit "divide" 1 1
405 (and (eq_attr "type" "fsqrt")
406 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r4600,r4650")))
409 (define_function_unit "divide" 1 1
410 (and (eq_attr "type" "fsqrt")
411 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r5000")))
414 ;; R4300 FP instruction classes treated as part of the "imuldiv"
417 (define_function_unit "imuldiv" 1 0
418 (and (eq_attr "type" "fadd") (eq_attr "cpu" "r4300"))
421 (define_function_unit "imuldiv" 1 0
422 (and (eq_attr "type" "fcmp,fabs,fneg") (eq_attr "cpu" "r4300"))
425 (define_function_unit "imuldiv" 1 0
426 (and (eq_attr "type" "fmul") (and (eq_attr "mode" "SF") (eq_attr "cpu" "r4300")))
428 (define_function_unit "imuldiv" 1 0
429 (and (eq_attr "type" "fmul") (and (eq_attr "mode" "DF") (eq_attr "cpu" "r4300")))
432 (define_function_unit "imuldiv" 1 0
433 (and (and (eq_attr "type" "fdiv") (eq_attr "type" "fsqrt"))
434 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r4300")))
436 (define_function_unit "imuldiv" 1 0
437 (and (and (eq_attr "type" "fdiv") (eq_attr "type" "fsqrt"))
438 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r4300")))
441 ;; The following functional units do not use the cpu type, and use
442 ;; much less memory in genattrtab.c.
444 ;; (define_function_unit "memory" 1 0 (eq_attr "type" "load") 3 0)
445 ;; (define_function_unit "memory" 1 0 (eq_attr "type" "store") 1 0)
447 ;; (define_function_unit "fp_comp" 1 0 (eq_attr "type" "fcmp") 2 0)
449 ;; (define_function_unit "transfer" 1 0 (eq_attr "type" "xfer") 2 0)
450 ;; (define_function_unit "transfer" 1 0 (eq_attr "type" "hilo") 3 0)
452 ;; (define_function_unit "imuldiv" 1 1 (eq_attr "type" "imul") 17 0)
453 ;; (define_function_unit "imuldiv" 1 1 (eq_attr "type" "idiv") 38 0)
455 ;; (define_function_unit "adder" 1 1 (eq_attr "type" "fadd") 4 0)
456 ;; (define_function_unit "adder" 1 1 (eq_attr "type" "fabs,fneg") 2 0)
458 ;; (define_function_unit "mult" 1 1 (and (eq_attr "type" "fmul") (eq_attr "mode" "SF")) 7 0)
459 ;; (define_function_unit "mult" 1 1 (and (eq_attr "type" "fmul") (eq_attr "mode" "DF")) 8 0)
461 ;; (define_function_unit "divide" 1 1 (and (eq_attr "type" "fdiv") (eq_attr "mode" "SF")) 23 0)
462 ;; (define_function_unit "divide" 1 1 (and (eq_attr "type" "fdiv") (eq_attr "mode" "DF")) 36 0)
464 ;; (define_function_unit "sqrt" 1 1 (and (eq_attr "type" "fsqrt") (eq_attr "mode" "SF")) 54 0)
465 ;; (define_function_unit "sqrt" 1 1 (and (eq_attr "type" "fsqrt") (eq_attr "mode" "DF")) 112 0)
469 ;; ....................
473 ;; ....................
476 (define_insn "adddf3"
477 [(set (match_operand:DF 0 "register_operand" "=f")
478 (plus:DF (match_operand:DF 1 "register_operand" "f")
479 (match_operand:DF 2 "register_operand" "f")))]
480 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
482 [(set_attr "type" "fadd")
483 (set_attr "mode" "DF")
484 (set_attr "length" "1")])
486 (define_insn "addsf3"
487 [(set (match_operand:SF 0 "register_operand" "=f")
488 (plus:SF (match_operand:SF 1 "register_operand" "f")
489 (match_operand:SF 2 "register_operand" "f")))]
492 [(set_attr "type" "fadd")
493 (set_attr "mode" "SF")
494 (set_attr "length" "1")])
496 (define_expand "addsi3"
497 [(set (match_operand:SI 0 "register_operand" "=d")
498 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
499 (match_operand:SI 2 "arith_operand" "dI")))]
503 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == -32768)
504 operands[2] = force_reg (SImode, operands[2]);
507 (define_insn "addsi3_internal"
508 [(set (match_operand:SI 0 "register_operand" "=d")
509 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
510 (match_operand:SI 2 "arith_operand" "dI")))]
511 "GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768"
513 [(set_attr "type" "arith")
514 (set_attr "mode" "SI")
515 (set_attr "length" "1")])
517 (define_expand "adddi3"
518 [(parallel [(set (match_operand:DI 0 "register_operand" "")
519 (plus:DI (match_operand:DI 1 "se_register_operand" "")
520 (match_operand:DI 2 "se_arith_operand" "")))
521 (clobber (match_dup 3))])]
522 "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
525 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == -32768)
526 operands[2] = force_reg (DImode, operands[2]);
530 emit_insn (gen_adddi3_internal_3 (operands[0], operands[1],
535 operands[3] = gen_reg_rtx (SImode);
538 (define_insn "adddi3_internal_1"
539 [(set (match_operand:DI 0 "register_operand" "=d,&d")
540 (plus:DI (match_operand:DI 1 "register_operand" "0,d")
541 (match_operand:DI 2 "register_operand" "d,d")))
542 (clobber (match_operand:SI 3 "register_operand" "=d,d"))]
543 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE"
546 return (REGNO (operands[0]) == REGNO (operands[1])
547 && REGNO (operands[0]) == REGNO (operands[2]))
548 ? \"srl\\t%3,%L0,31\;sll\\t%M0,%M0,1\;sll\\t%L0,%L1,1\;addu\\t%M0,%M0,%3\"
549 : \"addu\\t%L0,%L1,%L2\;sltu\\t%3,%L0,%L2\;addu\\t%M0,%M1,%M2\;addu\\t%M0,%M0,%3\";
551 [(set_attr "type" "darith")
552 (set_attr "mode" "DI")
553 (set_attr "length" "4")])
556 [(set (match_operand:DI 0 "register_operand" "")
557 (plus:DI (match_operand:DI 1 "register_operand" "")
558 (match_operand:DI 2 "register_operand" "")))
559 (clobber (match_operand:SI 3 "register_operand" ""))]
560 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
561 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
562 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
563 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))
564 && (REGNO (operands[0]) != REGNO (operands[1])
565 || REGNO (operands[0]) != REGNO (operands[2]))"
567 [(set (subreg:SI (match_dup 0) 0)
568 (plus:SI (subreg:SI (match_dup 1) 0)
569 (subreg:SI (match_dup 2) 0)))
572 (ltu:SI (subreg:SI (match_dup 0) 0)
573 (subreg:SI (match_dup 2) 0)))
575 (set (subreg:SI (match_dup 0) 1)
576 (plus:SI (subreg:SI (match_dup 1) 1)
577 (subreg:SI (match_dup 2) 1)))
579 (set (subreg:SI (match_dup 0) 1)
580 (plus:SI (subreg:SI (match_dup 0) 1)
585 [(set (match_operand:DI 0 "register_operand" "")
586 (plus:DI (match_operand:DI 1 "register_operand" "")
587 (match_operand:DI 2 "register_operand" "")))
588 (clobber (match_operand:SI 3 "register_operand" ""))]
589 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
590 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
591 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
592 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))
593 && (REGNO (operands[0]) != REGNO (operands[1])
594 || REGNO (operands[0]) != REGNO (operands[2]))"
596 [(set (subreg:SI (match_dup 0) 1)
597 (plus:SI (subreg:SI (match_dup 1) 1)
598 (subreg:SI (match_dup 2) 1)))
601 (ltu:SI (subreg:SI (match_dup 0) 1)
602 (subreg:SI (match_dup 2) 1)))
604 (set (subreg:SI (match_dup 0) 0)
605 (plus:SI (subreg:SI (match_dup 1) 0)
606 (subreg:SI (match_dup 2) 0)))
608 (set (subreg:SI (match_dup 0) 0)
609 (plus:SI (subreg:SI (match_dup 0) 0)
613 (define_insn "adddi3_internal_2"
614 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
615 (plus:DI (match_operand:DI 1 "register_operand" "%d,%d,%d")
616 (match_operand:DI 2 "small_int" "P,J,N")))
617 (clobber (match_operand:SI 3 "register_operand" "=d,d,d"))]
618 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && INTVAL (operands[2]) != -32768"
620 addu\\t%L0,%L1,%2\;sltu\\t%3,%L0,%2\;addu\\t%M0,%M1,%3
621 move\\t%L0,%L1\;move\\t%M0,%M1
622 subu\\t%L0,%L1,%n2\;sltu\\t%3,%L0,%2\;subu\\t%M0,%M1,1\;addu\\t%M0,%M0,%3"
623 [(set_attr "type" "darith")
624 (set_attr "mode" "DI")
625 (set_attr "length" "3,2,4")])
628 [(set (match_operand:DI 0 "register_operand" "")
629 (plus:DI (match_operand:DI 1 "register_operand" "")
630 (match_operand:DI 2 "small_int" "")))
631 (clobber (match_operand:SI 3 "register_operand" "=d"))]
632 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
633 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
634 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
635 && INTVAL (operands[2]) > 0"
637 [(set (subreg:SI (match_dup 0) 0)
638 (plus:SI (subreg:SI (match_dup 1) 0)
642 (ltu:SI (subreg:SI (match_dup 0) 0)
645 (set (subreg:SI (match_dup 0) 1)
646 (plus:SI (subreg:SI (match_dup 1) 1)
651 [(set (match_operand:DI 0 "register_operand" "")
652 (plus:DI (match_operand:DI 1 "register_operand" "")
653 (match_operand:DI 2 "small_int" "")))
654 (clobber (match_operand:SI 3 "register_operand" "=d"))]
655 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
656 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
657 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
658 && INTVAL (operands[2]) > 0"
660 [(set (subreg:SI (match_dup 0) 1)
661 (plus:SI (subreg:SI (match_dup 1) 1)
665 (ltu:SI (subreg:SI (match_dup 0) 1)
668 (set (subreg:SI (match_dup 0) 0)
669 (plus:SI (subreg:SI (match_dup 1) 0)
673 (define_insn "adddi3_internal_3"
674 [(set (match_operand:DI 0 "register_operand" "=d")
675 (plus:DI (match_operand:DI 1 "se_reg_or_0_operand" "dJ")
676 (match_operand:DI 2 "se_arith_operand" "dI")))]
677 "TARGET_64BIT && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768)"
680 return (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
681 ? \"dsubu\\t%0,%z1,%n2\"
682 : \"daddu\\t%0,%z1,%2\";
684 [(set_attr "type" "darith")
685 (set_attr "mode" "DI")
686 (set_attr "length" "1")])
689 (define_insn "addsi3_internal_2"
690 [(set (match_operand:DI 0 "register_operand" "=d")
691 (sign_extend:DI (plus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
692 (match_operand:SI 2 "arith_operand" "dI"))))]
693 "TARGET_64BIT && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768)"
696 return (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
697 ? \"subu\\t%0,%z1,%n2\"
698 : \"addu\\t%0,%z1,%2\";
700 [(set_attr "type" "arith")
701 (set_attr "mode" "SI")
702 (set_attr "length" "1")])
706 ;; ....................
710 ;; ....................
713 (define_insn "subdf3"
714 [(set (match_operand:DF 0 "register_operand" "=f")
715 (minus:DF (match_operand:DF 1 "register_operand" "f")
716 (match_operand:DF 2 "register_operand" "f")))]
717 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
719 [(set_attr "type" "fadd")
720 (set_attr "mode" "DF")
721 (set_attr "length" "1")])
723 (define_insn "subsf3"
724 [(set (match_operand:SF 0 "register_operand" "=f")
725 (minus:SF (match_operand:SF 1 "register_operand" "f")
726 (match_operand:SF 2 "register_operand" "f")))]
729 [(set_attr "type" "fadd")
730 (set_attr "mode" "SF")
731 (set_attr "length" "1")])
733 (define_expand "subsi3"
734 [(set (match_operand:SI 0 "register_operand" "=d")
735 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
736 (match_operand:SI 2 "arith_operand" "dI")))]
740 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == -32768)
741 operands[2] = force_reg (SImode, operands[2]);
744 (define_insn "subsi3_internal"
745 [(set (match_operand:SI 0 "register_operand" "=d")
746 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
747 (match_operand:SI 2 "arith_operand" "dI")))]
748 "GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768"
750 [(set_attr "type" "arith")
751 (set_attr "mode" "SI")
752 (set_attr "length" "1")])
754 (define_expand "subdi3"
755 [(parallel [(set (match_operand:DI 0 "register_operand" "=d")
756 (minus:DI (match_operand:DI 1 "se_register_operand" "d")
757 (match_operand:DI 2 "se_register_operand" "d")))
758 (clobber (match_dup 3))])]
759 "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
764 emit_insn (gen_subdi3_internal_3 (operands[0], operands[1],
769 operands[3] = gen_reg_rtx (SImode);
772 (define_insn "subdi3_internal"
773 [(set (match_operand:DI 0 "register_operand" "=d")
774 (minus:DI (match_operand:DI 1 "register_operand" "d")
775 (match_operand:DI 2 "register_operand" "d")))
776 (clobber (match_operand:SI 3 "register_operand" "=d"))]
777 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE"
778 "sltu\\t%3,%L1,%L2\;subu\\t%L0,%L1,%L2\;subu\\t%M0,%M1,%M2\;subu\\t%M0,%M0,%3"
779 [(set_attr "type" "darith")
780 (set_attr "mode" "DI")
781 (set_attr "length" "4")])
784 [(set (match_operand:DI 0 "register_operand" "")
785 (minus:DI (match_operand:DI 1 "register_operand" "")
786 (match_operand:DI 2 "register_operand" "")))
787 (clobber (match_operand:SI 3 "register_operand" ""))]
788 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
789 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
790 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
791 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
794 (ltu:SI (subreg:SI (match_dup 1) 0)
795 (subreg:SI (match_dup 2) 0)))
797 (set (subreg:SI (match_dup 0) 0)
798 (minus:SI (subreg:SI (match_dup 1) 0)
799 (subreg:SI (match_dup 2) 0)))
801 (set (subreg:SI (match_dup 0) 1)
802 (minus:SI (subreg:SI (match_dup 1) 1)
803 (subreg:SI (match_dup 2) 1)))
805 (set (subreg:SI (match_dup 0) 1)
806 (minus:SI (subreg:SI (match_dup 0) 1)
811 [(set (match_operand:DI 0 "register_operand" "")
812 (minus:DI (match_operand:DI 1 "register_operand" "")
813 (match_operand:DI 2 "register_operand" "")))
814 (clobber (match_operand:SI 3 "register_operand" ""))]
815 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
816 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
817 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
818 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
821 (ltu:SI (subreg:SI (match_dup 1) 1)
822 (subreg:SI (match_dup 2) 1)))
824 (set (subreg:SI (match_dup 0) 1)
825 (minus:SI (subreg:SI (match_dup 1) 1)
826 (subreg:SI (match_dup 2) 1)))
828 (set (subreg:SI (match_dup 0) 0)
829 (minus:SI (subreg:SI (match_dup 1) 0)
830 (subreg:SI (match_dup 2) 0)))
832 (set (subreg:SI (match_dup 0) 0)
833 (minus:SI (subreg:SI (match_dup 0) 0)
837 (define_insn "subdi3_internal_2"
838 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
839 (minus:DI (match_operand:DI 1 "register_operand" "d,d,d")
840 (match_operand:DI 2 "small_int" "P,J,N")))
841 (clobber (match_operand:SI 3 "register_operand" "=d,d,d"))]
842 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && INTVAL (operands[2]) != -32768"
844 sltu\\t%3,%L1,%2\;subu\\t%L0,%L1,%2\;subu\\t%M0,%M1,%3
845 move\\t%L0,%L1\;move\\t%M0,%M1
846 sltu\\t%3,%L1,%2\;subu\\t%L0,%L1,%2\;subu\\t%M0,%M1,1\;subu\\t%M0,%M0,%3"
847 [(set_attr "type" "darith")
848 (set_attr "mode" "DI")
849 (set_attr "length" "3,2,4")])
852 [(set (match_operand:DI 0 "register_operand" "")
853 (minus:DI (match_operand:DI 1 "register_operand" "")
854 (match_operand:DI 2 "small_int" "")))
855 (clobber (match_operand:SI 3 "register_operand" ""))]
856 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
857 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
858 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
859 && INTVAL (operands[2]) > 0"
862 (ltu:SI (subreg:SI (match_dup 1) 0)
865 (set (subreg:SI (match_dup 0) 0)
866 (minus:SI (subreg:SI (match_dup 1) 0)
869 (set (subreg:SI (match_dup 0) 1)
870 (minus:SI (subreg:SI (match_dup 1) 1)
875 [(set (match_operand:DI 0 "register_operand" "")
876 (minus:DI (match_operand:DI 1 "register_operand" "")
877 (match_operand:DI 2 "small_int" "")))
878 (clobber (match_operand:SI 3 "register_operand" ""))]
879 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
880 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
881 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
882 && INTVAL (operands[2]) > 0"
885 (ltu:SI (subreg:SI (match_dup 1) 1)
888 (set (subreg:SI (match_dup 0) 1)
889 (minus:SI (subreg:SI (match_dup 1) 1)
892 (set (subreg:SI (match_dup 0) 0)
893 (minus:SI (subreg:SI (match_dup 1) 0)
897 (define_insn "subdi3_internal_3"
898 [(set (match_operand:DI 0 "register_operand" "=d")
899 (minus:DI (match_operand:DI 1 "se_reg_or_0_operand" "dJ")
900 (match_operand:DI 2 "se_arith_operand" "dI")))]
901 "TARGET_64BIT && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768)"
904 return (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
905 ? \"daddu\\t%0,%z1,%n2\"
906 : \"dsubu\\t%0,%z1,%2\";
908 [(set_attr "type" "darith")
909 (set_attr "mode" "DI")
910 (set_attr "length" "1")])
913 (define_insn "subsi3_internal_2"
914 [(set (match_operand:DI 0 "register_operand" "=d")
915 (sign_extend:DI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
916 (match_operand:SI 2 "arith_operand" "dI"))))]
917 "TARGET_64BIT && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768)"
920 return (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
921 ? \"addu\\t%0,%z1,%n2\"
922 : \"subu\\t%0,%z1,%2\";
924 [(set_attr "type" "arith")
925 (set_attr "mode" "DI")
926 (set_attr "length" "1")])
930 ;; ....................
934 ;; ....................
937 ;; Early Vr4300 silicon has a CPU bug where multiplies with certain
938 ;; operands may corrupt immediately following multiplies. This is a
939 ;; simple fix to insert NOPs.
941 (define_expand "muldf3"
942 [(set (match_operand:DF 0 "register_operand" "=f")
943 (mult:DF (match_operand:DF 1 "register_operand" "f")
944 (match_operand:DF 2 "register_operand" "f")))]
945 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
948 if (mips_cpu != PROCESSOR_R4300)
949 emit_insn (gen_muldf3_internal (operands[0], operands[1], operands[2]));
951 emit_insn (gen_muldf3_r4300 (operands[0], operands[1], operands[2]));
955 (define_insn "muldf3_internal"
956 [(set (match_operand:DF 0 "register_operand" "=f")
957 (mult:DF (match_operand:DF 1 "register_operand" "f")
958 (match_operand:DF 2 "register_operand" "f")))]
959 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && mips_cpu != PROCESSOR_R4300"
961 [(set_attr "type" "fmul")
962 (set_attr "mode" "DF")
963 (set_attr "length" "1")])
965 (define_insn "muldf3_r4300"
966 [(set (match_operand:DF 0 "register_operand" "=f")
967 (mult:DF (match_operand:DF 1 "register_operand" "f")
968 (match_operand:DF 2 "register_operand" "f")))]
969 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && mips_cpu == PROCESSOR_R4300"
972 output_asm_insn (\"mul.d\\t%0,%1,%2\", operands);
973 if (TARGET_4300_MUL_FIX)
974 output_asm_insn (\"nop\", operands);
977 [(set_attr "type" "fmul")
978 (set_attr "mode" "DF")
979 (set_attr "length" "2")]) ;; mul.d + nop
981 (define_expand "mulsf3"
982 [(set (match_operand:SF 0 "register_operand" "=f")
983 (mult:SF (match_operand:SF 1 "register_operand" "f")
984 (match_operand:SF 2 "register_operand" "f")))]
988 if (mips_cpu != PROCESSOR_R4300)
989 emit_insn( gen_mulsf3_internal (operands[0], operands[1], operands[2]));
991 emit_insn( gen_mulsf3_r4300 (operands[0], operands[1], operands[2]));
995 (define_insn "mulsf3_internal"
996 [(set (match_operand:SF 0 "register_operand" "=f")
997 (mult:SF (match_operand:SF 1 "register_operand" "f")
998 (match_operand:SF 2 "register_operand" "f")))]
999 "TARGET_HARD_FLOAT && mips_cpu != PROCESSOR_R4300"
1001 [(set_attr "type" "fmul")
1002 (set_attr "mode" "SF")
1003 (set_attr "length" "1")])
1005 (define_insn "mulsf3_r4300"
1006 [(set (match_operand:SF 0 "register_operand" "=f")
1007 (mult:SF (match_operand:SF 1 "register_operand" "f")
1008 (match_operand:SF 2 "register_operand" "f")))]
1009 "TARGET_HARD_FLOAT && mips_cpu == PROCESSOR_R4300"
1012 output_asm_insn (\"mul.s\\t%0,%1,%2\", operands);
1013 if (TARGET_4300_MUL_FIX)
1014 output_asm_insn (\"nop\", operands);
1017 [(set_attr "type" "fmul")
1018 (set_attr "mode" "SF")
1019 (set_attr "length" "2")]) ;; mul.s + nop
1021 ;; ??? The R4000 (only) has a cpu bug. If a double-word shift executes while
1022 ;; a multiply is in progress, it may give an incorrect result. Avoid
1023 ;; this by keeping the mflo with the mult on the R4000.
1025 (define_expand "mulsi3"
1026 [(set (match_operand:SI 0 "register_operand" "=l")
1027 (mult:SI (match_operand:SI 1 "register_operand" "d")
1028 (match_operand:SI 2 "register_operand" "d")))
1029 (clobber (match_scratch:SI 3 "=h"))
1030 (clobber (match_scratch:SI 4 "=a"))]
1035 emit_insn (gen_mulsi3_r4650 (operands[0], operands[1], operands[2]));
1036 else if (mips_cpu != PROCESSOR_R4000)
1037 emit_insn (gen_mulsi3_internal (operands[0], operands[1], operands[2]));
1039 emit_insn (gen_mulsi3_r4000 (operands[0], operands[1], operands[2]));
1043 (define_insn "mulsi3_internal"
1044 [(set (match_operand:SI 0 "register_operand" "=l")
1045 (mult:SI (match_operand:SI 1 "register_operand" "d")
1046 (match_operand:SI 2 "register_operand" "d")))
1047 (clobber (match_scratch:SI 3 "=h"))
1048 (clobber (match_scratch:SI 4 "=a"))]
1049 "mips_cpu != PROCESSOR_R4000"
1051 [(set_attr "type" "imul")
1052 (set_attr "mode" "SI")
1053 (set_attr "length" "1")])
1055 (define_insn "mulsi3_r4000"
1056 [(set (match_operand:SI 0 "register_operand" "=d")
1057 (mult:SI (match_operand:SI 1 "register_operand" "d")
1058 (match_operand:SI 2 "register_operand" "d")))
1059 (clobber (match_scratch:SI 3 "=h"))
1060 (clobber (match_scratch:SI 4 "=l"))
1061 (clobber (match_scratch:SI 5 "=a"))]
1062 "mips_cpu == PROCESSOR_R4000"
1067 xoperands[0] = operands[0];
1068 xoperands[1] = gen_rtx (REG, SImode, LO_REGNUM);
1070 output_asm_insn (\"mult\\t%1,%2\", operands);
1071 output_asm_insn (mips_move_1word (xoperands, insn, FALSE), xoperands);
1074 [(set_attr "type" "imul")
1075 (set_attr "mode" "SI")
1076 (set_attr "length" "3")]) ;; mult + mflo + delay
1078 (define_insn "mulsi3_r4650"
1079 [(set (match_operand:SI 0 "register_operand" "=d")
1080 (mult:SI (match_operand:SI 1 "register_operand" "d")
1081 (match_operand:SI 2 "register_operand" "d")))
1082 (clobber (match_scratch:SI 3 "=h"))
1083 (clobber (match_scratch:SI 4 "=l"))
1084 (clobber (match_scratch:SI 5 "=a"))]
1087 [(set_attr "type" "imul")
1088 (set_attr "mode" "SI")
1089 (set_attr "length" "1")])
1091 (define_expand "muldi3"
1092 [(set (match_operand:DI 0 "register_operand" "=l")
1093 (mult:DI (match_operand:DI 1 "se_register_operand" "d")
1094 (match_operand:DI 2 "register_operand" "d")))
1095 (clobber (match_scratch:DI 3 "=h"))
1096 (clobber (match_scratch:DI 4 "=a"))]
1100 if (mips_cpu != PROCESSOR_R4000)
1101 emit_insn (gen_muldi3_internal (operands[0], operands[1], operands[2]));
1103 emit_insn (gen_muldi3_r4000 (operands[0], operands[1], operands[2]));
1107 ;; Don't accept both operands using se_register_operand, because if
1108 ;; both operands are sign extended we would prefer to use mult in the
1109 ;; mulsidi3 pattern. Commutativity should permit either operand to be
1112 (define_insn "muldi3_internal"
1113 [(set (match_operand:DI 0 "register_operand" "=l")
1114 (mult:DI (match_operand:DI 1 "se_register_operand" "d")
1115 (match_operand:DI 2 "register_operand" "d")))
1116 (clobber (match_scratch:DI 3 "=h"))
1117 (clobber (match_scratch:DI 4 "=a"))]
1118 "TARGET_64BIT && mips_cpu != PROCESSOR_R4000"
1120 [(set_attr "type" "imul")
1121 (set_attr "mode" "DI")
1122 (set_attr "length" "1")])
1124 (define_insn "muldi3_r4000"
1125 [(set (match_operand:DI 0 "register_operand" "=d")
1126 (mult:DI (match_operand:DI 1 "se_register_operand" "d")
1127 (match_operand:DI 2 "register_operand" "d")))
1128 (clobber (match_scratch:DI 3 "=h"))
1129 (clobber (match_scratch:DI 4 "=l"))
1130 (clobber (match_scratch:DI 5 "=a"))]
1131 "TARGET_64BIT && mips_cpu == PROCESSOR_R4000"
1136 xoperands[0] = operands[0];
1137 xoperands[1] = gen_rtx (REG, DImode, LO_REGNUM);
1139 output_asm_insn (\"dmult\\t%1,%2\", operands);
1140 output_asm_insn (mips_move_1word (xoperands, insn, FALSE), xoperands);
1143 [(set_attr "type" "imul")
1144 (set_attr "mode" "DI")
1145 (set_attr "length" "3")]) ;; mult + mflo + delay
1147 ;; ??? We could define a mulditi3 pattern when TARGET_64BIT.
1149 (define_expand "mulsidi3"
1150 [(set (match_operand:DI 0 "register_operand" "=x")
1151 (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))
1152 (sign_extend:DI (match_operand:SI 2 "register_operand" "d"))))]
1157 emit_insn (gen_mulsidi3_64bit (operands[0], operands[1], operands[2]));
1159 emit_insn (gen_mulsidi3_internal (operands[0], operands[1], operands[2]));
1163 (define_insn "mulsidi3_internal"
1164 [(set (match_operand:DI 0 "register_operand" "=x")
1165 (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))
1166 (sign_extend:DI (match_operand:SI 2 "register_operand" "d"))))
1167 (clobber (match_scratch:SI 3 "=a"))]
1170 [(set_attr "type" "imul")
1171 (set_attr "mode" "SI")
1172 (set_attr "length" "1")])
1174 (define_insn "mulsidi3_64bit"
1175 [(set (match_operand:DI 0 "register_operand" "=a")
1176 (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))
1177 (sign_extend:DI (match_operand:SI 2 "register_operand" "d"))))
1178 (clobber (match_scratch:DI 3 "=l"))
1179 (clobber (match_scratch:DI 4 "=h"))]
1182 [(set_attr "type" "imul")
1183 (set_attr "mode" "SI")
1184 (set_attr "length" "1")])
1186 (define_insn "smulsi3_highpart"
1187 [(set (match_operand:SI 0 "register_operand" "=h")
1189 (lshiftrt:DI (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))
1190 (sign_extend:DI (match_operand:SI 2 "register_operand" "d")))
1192 (clobber (match_scratch:SI 3 "=l"))
1193 (clobber (match_scratch:SI 4 "=a"))]
1196 [(set_attr "type" "imul")
1197 (set_attr "mode" "SI")
1198 (set_attr "length" "1")])
1200 (define_expand "umulsidi3"
1201 [(set (match_operand:DI 0 "register_operand" "=x")
1202 (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "d"))
1203 (zero_extend:DI (match_operand:SI 2 "register_operand" "d"))))]
1208 emit_insn (gen_umulsidi3_64bit (operands[0], operands[1], operands[2]));
1210 emit_insn (gen_umulsidi3_internal (operands[0], operands[1], operands[2]));
1214 (define_insn "umulsidi3_internal"
1215 [(set (match_operand:DI 0 "register_operand" "=x")
1216 (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "d"))
1217 (zero_extend:DI (match_operand:SI 2 "register_operand" "d"))))
1218 (clobber (match_scratch:SI 3 "=a"))]
1221 [(set_attr "type" "imul")
1222 (set_attr "mode" "SI")
1223 (set_attr "length" "1")])
1225 (define_insn "umulsidi3_64bit"
1226 [(set (match_operand:DI 0 "register_operand" "=a")
1227 (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "d"))
1228 (zero_extend:DI (match_operand:SI 2 "register_operand" "d"))))
1229 (clobber (match_scratch:DI 3 "=l"))
1230 (clobber (match_scratch:DI 4 "=h"))]
1233 [(set_attr "type" "imul")
1234 (set_attr "mode" "SI")
1235 (set_attr "length" "1")])
1237 (define_insn "umulsi3_highpart"
1238 [(set (match_operand:SI 0 "register_operand" "=h")
1240 (lshiftrt:DI (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "d"))
1241 (zero_extend:DI (match_operand:SI 2 "register_operand" "d")))
1243 (clobber (match_scratch:SI 3 "=l"))
1244 (clobber (match_scratch:SI 4 "=a"))]
1247 [(set_attr "type" "imul")
1248 (set_attr "mode" "SI")
1249 (set_attr "length" "1")])
1251 (define_insn "smuldi3_highpart"
1252 [(set (match_operand:DI 0 "register_operand" "=h")
1254 (lshiftrt:TI (mult:TI (sign_extend:TI (match_operand:DI 1 "se_register_operand" "d"))
1255 (sign_extend:TI (match_operand:DI 2 "se_register_operand" "d")))
1257 (clobber (match_scratch:DI 3 "=l"))
1258 (clobber (match_scratch:DI 4 "=a"))]
1261 [(set_attr "type" "imul")
1262 (set_attr "mode" "DI")
1263 (set_attr "length" "1")])
1265 (define_insn "umuldi3_highpart"
1266 [(set (match_operand:DI 0 "register_operand" "=h")
1268 (lshiftrt:TI (mult:TI (zero_extend:TI (match_operand:DI 1 "se_register_operand" "d"))
1269 (zero_extend:TI (match_operand:DI 2 "se_register_operand" "d")))
1271 (clobber (match_scratch:DI 3 "=l"))
1272 (clobber (match_scratch:DI 4 "=a"))]
1275 [(set_attr "type" "imul")
1276 (set_attr "mode" "DI")
1277 (set_attr "length" "1")])
1279 ;; The R4650 supports a 32 bit multiply/ 64 bit accumulate
1280 ;; instruction. The HI/LO registers are used as a 64 bit accumulator.
1282 (define_insn "madsi"
1283 [(set (match_operand:SI 0 "register_operand" "+l")
1284 (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "d")
1285 (match_operand:SI 2 "register_operand" "d"))
1287 (clobber (match_scratch:SI 3 "=h"))
1288 (clobber (match_scratch:SI 4 "=a"))]
1291 [(set_attr "type" "imul")
1292 (set_attr "mode" "SI")
1293 (set_attr "length" "1")])
1295 (define_insn "maddi"
1296 [(set (match_operand:DI 0 "register_operand" "+x")
1297 (plus:DI (mult:DI (sign_extend:DI
1298 (match_operand:SI 1 "register_operand" "d"))
1300 (match_operand:SI 2 "register_operand" "d")))
1302 (clobber (match_scratch:SI 3 "=a"))]
1303 "TARGET_MAD && ! TARGET_64BIT"
1305 [(set_attr "type" "imul")
1306 (set_attr "mode" "SI")
1307 (set_attr "length" "1")])
1309 (define_insn "maddi_64bit"
1310 [(set (match_operand:DI 0 "register_operand" "+a")
1311 (plus:DI (mult:DI (sign_extend:DI
1312 (match_operand:SI 1 "register_operand" "d"))
1314 (match_operand:SI 2 "register_operand" "d")))
1316 (clobber (match_scratch:DI 3 "=l"))
1317 (clobber (match_scratch:DI 4 "=h"))]
1318 "TARGET_MAD && TARGET_64BIT"
1320 [(set_attr "type" "imul")
1321 (set_attr "mode" "SI")
1322 (set_attr "length" "1")])
1324 (define_insn "umaddi"
1325 [(set (match_operand:DI 0 "register_operand" "+x")
1326 (plus:DI (mult:DI (zero_extend:DI
1327 (match_operand:SI 1 "register_operand" "d"))
1329 (match_operand:SI 2 "register_operand" "d")))
1331 (clobber (match_scratch:SI 3 "=a"))]
1332 "TARGET_MAD && ! TARGET_64BIT"
1334 [(set_attr "type" "imul")
1335 (set_attr "mode" "SI")
1336 (set_attr "length" "1")])
1338 (define_insn "umaddi_64bit"
1339 [(set (match_operand:DI 0 "register_operand" "+a")
1340 (plus:DI (mult:DI (zero_extend:DI
1341 (match_operand:SI 1 "register_operand" "d"))
1343 (match_operand:SI 2 "register_operand" "d")))
1345 (clobber (match_scratch:DI 3 "=l"))
1346 (clobber (match_scratch:DI 4 "=h"))]
1347 "TARGET_MAD && TARGET_64BIT"
1349 [(set_attr "type" "imul")
1350 (set_attr "mode" "SI")
1351 (set_attr "length" "1")])
1353 ;; Floating point multiply accumulate instructions.
1356 [(set (match_operand:DF 0 "register_operand" "=f")
1357 (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
1358 (match_operand:DF 2 "register_operand" "f"))
1359 (match_operand:DF 3 "register_operand" "f")))]
1360 "mips_isa >= 4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
1361 "madd.d\\t%0,%3,%1,%2"
1362 [(set_attr "type" "fmadd")
1363 (set_attr "mode" "DF")
1364 (set_attr "length" "1")])
1367 [(set (match_operand:SF 0 "register_operand" "=f")
1368 (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
1369 (match_operand:SF 2 "register_operand" "f"))
1370 (match_operand:SF 3 "register_operand" "f")))]
1371 "mips_isa >= 4 && TARGET_HARD_FLOAT"
1372 "madd.s\\t%0,%3,%1,%2"
1373 [(set_attr "type" "fmadd")
1374 (set_attr "mode" "SF")
1375 (set_attr "length" "1")])
1378 [(set (match_operand:DF 0 "register_operand" "=f")
1379 (minus:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
1380 (match_operand:DF 2 "register_operand" "f"))
1381 (match_operand:DF 3 "register_operand" "f")))]
1382 "mips_isa >= 4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
1383 "msub.d\\t%0,%3,%1,%2"
1384 [(set_attr "type" "fmadd")
1385 (set_attr "mode" "DF")
1386 (set_attr "length" "1")])
1389 [(set (match_operand:SF 0 "register_operand" "=f")
1390 (minus:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
1391 (match_operand:SF 2 "register_operand" "f"))
1392 (match_operand:SF 3 "register_operand" "f")))]
1394 "mips_isa >= 4 && TARGET_HARD_FLOAT"
1395 "msub.s\\t%0,%3,%1,%2"
1396 [(set_attr "type" "fmadd")
1397 (set_attr "mode" "SF")
1398 (set_attr "length" "1")])
1401 [(set (match_operand:DF 0 "register_operand" "=f")
1402 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
1403 (match_operand:DF 2 "register_operand" "f"))
1404 (match_operand:DF 3 "register_operand" "f"))))]
1405 "mips_isa >= 4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
1406 "nmadd.d\\t%0,%3,%1,%2"
1407 [(set_attr "type" "fmadd")
1408 (set_attr "mode" "DF")
1409 (set_attr "length" "1")])
1412 [(set (match_operand:SF 0 "register_operand" "=f")
1413 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
1414 (match_operand:SF 2 "register_operand" "f"))
1415 (match_operand:SF 3 "register_operand" "f"))))]
1416 "mips_isa >= 4 && TARGET_HARD_FLOAT"
1417 "nmadd.s\\t%0,%3,%1,%2"
1418 [(set_attr "type" "fmadd")
1419 (set_attr "mode" "SF")
1420 (set_attr "length" "1")])
1423 [(set (match_operand:DF 0 "register_operand" "=f")
1424 (minus:DF (match_operand:DF 1 "register_operand" "f")
1425 (mult:DF (match_operand:DF 2 "register_operand" "f")
1426 (match_operand:DF 3 "register_operand" "f"))))]
1427 "mips_isa >= 4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
1428 "nmsub.d\\t%0,%1,%2,%3"
1429 [(set_attr "type" "fmadd")
1430 (set_attr "mode" "DF")
1431 (set_attr "length" "1")])
1434 [(set (match_operand:SF 0 "register_operand" "=f")
1435 (minus:SF (match_operand:SF 1 "register_operand" "f")
1436 (mult:SF (match_operand:SF 2 "register_operand" "f")
1437 (match_operand:SF 3 "register_operand" "f"))))]
1438 "mips_isa >= 4 && TARGET_HARD_FLOAT"
1439 "nmsub.s\\t%0,%1,%2,%3"
1440 [(set_attr "type" "fmadd")
1441 (set_attr "mode" "SF")
1442 (set_attr "length" "1")])
1445 ;; ....................
1447 ;; DIVISION and REMAINDER
1449 ;; ....................
1452 (define_insn "divdf3"
1453 [(set (match_operand:DF 0 "register_operand" "=f")
1454 (div:DF (match_operand:DF 1 "register_operand" "f")
1455 (match_operand:DF 2 "register_operand" "f")))]
1456 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
1458 [(set_attr "type" "fdiv")
1459 (set_attr "mode" "DF")
1460 (set_attr "length" "1")])
1462 (define_insn "divsf3"
1463 [(set (match_operand:SF 0 "register_operand" "=f")
1464 (div:SF (match_operand:SF 1 "register_operand" "f")
1465 (match_operand:SF 2 "register_operand" "f")))]
1468 [(set_attr "type" "fdiv")
1469 (set_attr "mode" "SF")
1470 (set_attr "length" "1")])
1473 [(set (match_operand:DF 0 "register_operand" "=f")
1474 (div:DF (match_operand:DF 1 "const_float_1_operand" "")
1475 (match_operand:DF 2 "register_operand" "f")))]
1476 "mips_isa >= 4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && flag_fast_math"
1478 [(set_attr "type" "fdiv")
1479 (set_attr "mode" "DF")
1480 (set_attr "length" "1")])
1483 [(set (match_operand:SF 0 "register_operand" "=f")
1484 (div:SF (match_operand:SF 1 "const_float_1_operand" "")
1485 (match_operand:SF 2 "register_operand" "f")))]
1486 "mips_isa >= 4 && TARGET_HARD_FLOAT && flag_fast_math"
1488 [(set_attr "type" "fdiv")
1489 (set_attr "mode" "SF")
1490 (set_attr "length" "1")])
1492 ;; If optimizing, prefer the divmod functions over separate div and
1493 ;; mod functions, since this will allow using one instruction for both
1494 ;; the quotient and remainder. At present, the divmod is not moved out
1495 ;; of loops if it is constant within the loop, so allow -mdebugc to
1496 ;; use the old method of doing things.
1498 ;; 64 is the multiply/divide hi register
1499 ;; 65 is the multiply/divide lo register
1501 ;; ??? We can't accept constants here, because the MIPS assembler will replace
1502 ;; a divide by power of 2 with a shift, and then the remainder is no longer
1505 (define_insn "divmodsi4"
1506 [(set (match_operand:SI 0 "register_operand" "=d")
1507 (div:SI (match_operand:SI 1 "register_operand" "d")
1508 (match_operand:SI 2 "register_operand" "d")))
1509 (set (match_operand:SI 3 "register_operand" "=d")
1510 (mod:SI (match_dup 1)
1512 (clobber (match_scratch:SI 4 "=l"))
1513 (clobber (match_scratch:SI 5 "=h"))
1514 (clobber (match_scratch:SI 6 "=a"))]
1518 if (find_reg_note (insn, REG_UNUSED, operands[3]))
1519 return \"div\\t%0,%1,%2\";
1521 if (find_reg_note (insn, REG_UNUSED, operands[0]))
1522 return \"rem\\t%3,%1,%2\";
1524 return \"div\\t%0,%1,%2\;mfhi\\t%3\";
1526 [(set_attr "type" "idiv")
1527 (set_attr "mode" "SI")
1528 (set_attr "length" "14")]) ;; various tests for dividing by 0 and such
1530 (define_insn "divmoddi4"
1531 [(set (match_operand:DI 0 "register_operand" "=d")
1532 (div:DI (match_operand:DI 1 "se_register_operand" "d")
1533 (match_operand:DI 2 "se_register_operand" "d")))
1534 (set (match_operand:DI 3 "register_operand" "=d")
1535 (mod:DI (match_dup 1)
1537 (clobber (match_scratch:DI 4 "=l"))
1538 (clobber (match_scratch:DI 5 "=h"))
1539 (clobber (match_scratch:DI 6 "=a"))]
1540 "TARGET_64BIT && optimize"
1543 if (find_reg_note (insn, REG_UNUSED, operands[3]))
1544 return \"ddiv\\t%0,%1,%2\";
1546 if (find_reg_note (insn, REG_UNUSED, operands[0]))
1547 return \"drem\\t%3,%1,%2\";
1549 return \"ddiv\\t%0,%1,%2\;mfhi\\t%3\";
1551 [(set_attr "type" "idiv")
1552 (set_attr "mode" "DI")
1553 (set_attr "length" "15")]) ;; various tests for dividing by 0 and such
1555 (define_insn "udivmodsi4"
1556 [(set (match_operand:SI 0 "register_operand" "=d")
1557 (udiv:SI (match_operand:SI 1 "register_operand" "d")
1558 (match_operand:SI 2 "register_operand" "d")))
1559 (set (match_operand:SI 3 "register_operand" "=d")
1560 (umod:SI (match_dup 1)
1562 (clobber (match_scratch:SI 4 "=l"))
1563 (clobber (match_scratch:SI 5 "=h"))
1564 (clobber (match_scratch:SI 6 "=a"))]
1568 if (find_reg_note (insn, REG_UNUSED, operands[3]))
1569 return \"divu\\t%0,%1,%2\";
1571 if (find_reg_note (insn, REG_UNUSED, operands[0]))
1572 return \"remu\\t%3,%1,%2\";
1574 return \"divu\\t%0,%1,%2\;mfhi\\t%3\";
1576 [(set_attr "type" "idiv")
1577 (set_attr "mode" "SI")
1578 (set_attr "length" "8")]) ;; various tests for dividing by 0 and such
1580 (define_insn "udivmoddi4"
1581 [(set (match_operand:DI 0 "register_operand" "=d")
1582 (udiv:DI (match_operand:DI 1 "se_register_operand" "d")
1583 (match_operand:DI 2 "se_register_operand" "d")))
1584 (set (match_operand:DI 3 "register_operand" "=d")
1585 (umod:DI (match_dup 1)
1587 (clobber (match_scratch:DI 4 "=l"))
1588 (clobber (match_scratch:DI 5 "=h"))
1589 (clobber (match_scratch:DI 6 "=a"))]
1590 "TARGET_64BIT && optimize"
1593 if (find_reg_note (insn, REG_UNUSED, operands[3]))
1594 return \"ddivu\\t%0,%1,%2\";
1596 if (find_reg_note (insn, REG_UNUSED, operands[0]))
1597 return \"dremu\\t%3,%1,%2\";
1599 return \"ddivu\\t%0,%1,%2\;mfhi\\t%3\";
1601 [(set_attr "type" "idiv")
1602 (set_attr "mode" "DI")
1603 (set_attr "length" "8")]) ;; various tests for dividing by 0 and such
1605 (define_insn "divsi3"
1606 [(set (match_operand:SI 0 "register_operand" "=d")
1607 (div:SI (match_operand:SI 1 "register_operand" "d")
1608 (match_operand:SI 2 "nonmemory_operand" "di")))
1609 (clobber (match_scratch:SI 3 "=l"))
1610 (clobber (match_scratch:SI 4 "=h"))
1611 (clobber (match_scratch:SI 6 "=a"))]
1614 [(set_attr "type" "idiv")
1615 (set_attr "mode" "SI")
1616 (set_attr "length" "13")]) ;; various tests for dividing by 0 and such
1618 (define_insn "divdi3"
1619 [(set (match_operand:DI 0 "register_operand" "=d")
1620 (div:DI (match_operand:DI 1 "se_register_operand" "d")
1621 (match_operand:DI 2 "se_nonmemory_operand" "di")))
1622 (clobber (match_scratch:DI 3 "=l"))
1623 (clobber (match_scratch:DI 4 "=h"))
1624 (clobber (match_scratch:DI 6 "=a"))]
1625 "TARGET_64BIT && !optimize"
1627 [(set_attr "type" "idiv")
1628 (set_attr "mode" "DI")
1629 (set_attr "length" "14")]) ;; various tests for dividing by 0 and such
1631 (define_insn "modsi3"
1632 [(set (match_operand:SI 0 "register_operand" "=d")
1633 (mod:SI (match_operand:SI 1 "register_operand" "d")
1634 (match_operand:SI 2 "nonmemory_operand" "di")))
1635 (clobber (match_scratch:SI 3 "=l"))
1636 (clobber (match_scratch:SI 4 "=h"))
1637 (clobber (match_scratch:SI 6 "=a"))]
1640 [(set_attr "type" "idiv")
1641 (set_attr "mode" "SI")
1642 (set_attr "length" "13")]) ;; various tests for dividing by 0 and such
1644 (define_insn "moddi3"
1645 [(set (match_operand:DI 0 "register_operand" "=d")
1646 (mod:DI (match_operand:DI 1 "se_register_operand" "d")
1647 (match_operand:DI 2 "se_nonmemory_operand" "di")))
1648 (clobber (match_scratch:DI 3 "=l"))
1649 (clobber (match_scratch:DI 4 "=h"))
1650 (clobber (match_scratch:DI 6 "=a"))]
1651 "TARGET_64BIT && !optimize"
1653 [(set_attr "type" "idiv")
1654 (set_attr "mode" "DI")
1655 (set_attr "length" "14")]) ;; various tests for dividing by 0 and such
1657 (define_insn "udivsi3"
1658 [(set (match_operand:SI 0 "register_operand" "=d")
1659 (udiv:SI (match_operand:SI 1 "register_operand" "d")
1660 (match_operand:SI 2 "nonmemory_operand" "di")))
1661 (clobber (match_scratch:SI 3 "=l"))
1662 (clobber (match_scratch:SI 4 "=h"))
1663 (clobber (match_scratch:SI 6 "=a"))]
1666 [(set_attr "type" "idiv")
1667 (set_attr "mode" "SI")
1668 (set_attr "length" "7")]) ;; various tests for dividing by 0 and such
1670 (define_insn "udivdi3"
1671 [(set (match_operand:DI 0 "register_operand" "=d")
1672 (udiv:DI (match_operand:DI 1 "se_register_operand" "d")
1673 (match_operand:DI 2 "se_nonmemory_operand" "di")))
1674 (clobber (match_scratch:DI 3 "=l"))
1675 (clobber (match_scratch:DI 4 "=h"))
1676 (clobber (match_scratch:DI 6 "=a"))]
1677 "TARGET_64BIT && !optimize"
1679 [(set_attr "type" "idiv")
1680 (set_attr "mode" "DI")
1681 (set_attr "length" "7")]) ;; various tests for dividing by 0 and such
1683 (define_insn "umodsi3"
1684 [(set (match_operand:SI 0 "register_operand" "=d")
1685 (umod:SI (match_operand:SI 1 "register_operand" "d")
1686 (match_operand:SI 2 "nonmemory_operand" "di")))
1687 (clobber (match_scratch:SI 3 "=l"))
1688 (clobber (match_scratch:SI 4 "=h"))
1689 (clobber (match_scratch:SI 6 "=a"))]
1692 [(set_attr "type" "idiv")
1693 (set_attr "mode" "SI")
1694 (set_attr "length" "7")]) ;; various tests for dividing by 0 and such
1696 (define_insn "umoddi3"
1697 [(set (match_operand:DI 0 "register_operand" "=d")
1698 (umod:DI (match_operand:DI 1 "se_register_operand" "d")
1699 (match_operand:DI 2 "se_nonmemory_operand" "di")))
1700 (clobber (match_scratch:DI 3 "=l"))
1701 (clobber (match_scratch:DI 4 "=h"))
1702 (clobber (match_scratch:DI 6 "=a"))]
1703 "TARGET_64BIT && !optimize"
1705 [(set_attr "type" "idiv")
1706 (set_attr "mode" "DI")
1707 (set_attr "length" "7")]) ;; various tests for dividing by 0 and such
1711 ;; ....................
1715 ;; ....................
1717 (define_insn "sqrtdf2"
1718 [(set (match_operand:DF 0 "register_operand" "=f")
1719 (sqrt:DF (match_operand:DF 1 "register_operand" "f")))]
1720 "TARGET_HARD_FLOAT && HAVE_SQRT_P() && TARGET_DOUBLE_FLOAT"
1722 [(set_attr "type" "fsqrt")
1723 (set_attr "mode" "DF")
1724 (set_attr "length" "1")])
1726 (define_insn "sqrtsf2"
1727 [(set (match_operand:SF 0 "register_operand" "=f")
1728 (sqrt:SF (match_operand:SF 1 "register_operand" "f")))]
1729 "TARGET_HARD_FLOAT && HAVE_SQRT_P()"
1731 [(set_attr "type" "fsqrt")
1732 (set_attr "mode" "SF")
1733 (set_attr "length" "1")])
1736 [(set (match_operand:DF 0 "register_operand" "=f")
1737 (div:DF (match_operand:DF 1 "const_float_1_operand" "")
1738 (sqrt:DF (match_operand:DF 2 "register_operand" "f"))))]
1739 "mips_isa >= 4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && flag_fast_math"
1741 [(set_attr "type" "fsqrt")
1742 (set_attr "mode" "DF")
1743 (set_attr "length" "1")])
1746 [(set (match_operand:SF 0 "register_operand" "=f")
1747 (div:SF (match_operand:SF 1 "const_float_1_operand" "")
1748 (sqrt:SF (match_operand:SF 2 "register_operand" "f"))))]
1749 "mips_isa >= 4 && TARGET_HARD_FLOAT && flag_fast_math"
1751 [(set_attr "type" "fsqrt")
1752 (set_attr "mode" "SF")
1753 (set_attr "length" "1")])
1757 ;; ....................
1761 ;; ....................
1763 ;; Do not use the integer abs macro instruction, since that signals an
1764 ;; exception on -2147483648 (sigh).
1766 (define_insn "abssi2"
1767 [(set (match_operand:SI 0 "register_operand" "=d")
1768 (abs:SI (match_operand:SI 1 "register_operand" "d")))]
1772 dslots_jump_total++;
1773 dslots_jump_filled++;
1774 operands[2] = const0_rtx;
1776 if (REGNO (operands[0]) == REGNO (operands[1]))
1779 return \"%(bltzl\\t%1,1f\\n\\tsubu\\t%0,%z2,%0\\n1:%)\";
1781 return \"bgez\\t%1,1f%#\\n\\tsubu\\t%0,%z2,%0\\n1:\";
1784 return \"%(bgez\\t%1,1f\\n\\tmove\\t%0,%1\\n\\tsubu\\t%0,%z2,%0\\n1:%)\";
1786 [(set_attr "type" "multi")
1787 (set_attr "mode" "SI")
1788 (set_attr "length" "3")])
1790 (define_insn "absdi2"
1791 [(set (match_operand:DI 0 "register_operand" "=d")
1792 (abs:DI (match_operand:DI 1 "se_register_operand" "d")))]
1796 dslots_jump_total++;
1797 dslots_jump_filled++;
1798 operands[2] = const0_rtx;
1800 if (REGNO (operands[0]) == REGNO (operands[1]))
1801 return \"%(bltzl\\t%1,1f\\n\\tdsubu\\t%0,%z2,%0\\n1:%)\";
1803 return \"%(bgez\\t%1,1f\\n\\tmove\\t%0,%1\\n\\tdsubu\\t%0,%z2,%0\\n1:%)\";
1805 [(set_attr "type" "multi")
1806 (set_attr "mode" "DI")
1807 (set_attr "length" "3")])
1809 (define_insn "absdf2"
1810 [(set (match_operand:DF 0 "register_operand" "=f")
1811 (abs:DF (match_operand:DF 1 "register_operand" "f")))]
1812 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
1814 [(set_attr "type" "fabs")
1815 (set_attr "mode" "DF")
1816 (set_attr "length" "1")])
1818 (define_insn "abssf2"
1819 [(set (match_operand:SF 0 "register_operand" "=f")
1820 (abs:SF (match_operand:SF 1 "register_operand" "f")))]
1823 [(set_attr "type" "fabs")
1824 (set_attr "mode" "SF")
1825 (set_attr "length" "1")])
1829 ;; ....................
1831 ;; FIND FIRST BIT INSTRUCTION
1833 ;; ....................
1836 (define_insn "ffssi2"
1837 [(set (match_operand:SI 0 "register_operand" "=&d")
1838 (ffs:SI (match_operand:SI 1 "register_operand" "d")))
1839 (clobber (match_scratch:SI 2 "=&d"))
1840 (clobber (match_scratch:SI 3 "=&d"))]
1844 dslots_jump_total += 2;
1845 dslots_jump_filled += 2;
1846 operands[4] = const0_rtx;
1848 if (optimize && find_reg_note (insn, REG_DEAD, operands[1]))
1851 \\tbeq\\t%1,%z4,2f\\n\\
1852 1:\\tand\\t%2,%1,0x0001\\n\\
1853 \\taddu\\t%0,%0,1\\n\\
1854 \\tbeq\\t%2,%z4,1b\\n\\
1855 \\tsrl\\t%1,%1,1\\n\\
1860 \\tmove\\t%3,%1\\n\\
1861 \\tbeq\\t%3,%z4,2f\\n\\
1862 1:\\tand\\t%2,%3,0x0001\\n\\
1863 \\taddu\\t%0,%0,1\\n\\
1864 \\tbeq\\t%2,%z4,1b\\n\\
1865 \\tsrl\\t%3,%3,1\\n\\
1868 [(set_attr "type" "multi")
1869 (set_attr "mode" "SI")
1870 (set_attr "length" "6")])
1872 (define_insn "ffsdi2"
1873 [(set (match_operand:DI 0 "register_operand" "=&d")
1874 (ffs:DI (match_operand:DI 1 "se_register_operand" "d")))
1875 (clobber (match_scratch:DI 2 "=&d"))
1876 (clobber (match_scratch:DI 3 "=&d"))]
1880 dslots_jump_total += 2;
1881 dslots_jump_filled += 2;
1882 operands[4] = const0_rtx;
1884 if (optimize && find_reg_note (insn, REG_DEAD, operands[1]))
1887 \\tbeq\\t%1,%z4,2f\\n\\
1888 1:\\tand\\t%2,%1,0x0001\\n\\
1889 \\tdaddu\\t%0,%0,1\\n\\
1890 \\tbeq\\t%2,%z4,1b\\n\\
1891 \\tdsrl\\t%1,%1,1\\n\\
1896 \\tmove\\t%3,%1\\n\\
1897 \\tbeq\\t%3,%z4,2f\\n\\
1898 1:\\tand\\t%2,%3,0x0001\\n\\
1899 \\tdaddu\\t%0,%0,1\\n\\
1900 \\tbeq\\t%2,%z4,1b\\n\\
1901 \\tdsrl\\t%3,%3,1\\n\\
1904 [(set_attr "type" "multi")
1905 (set_attr "mode" "DI")
1906 (set_attr "length" "6")])
1910 ;; ....................
1912 ;; NEGATION and ONE'S COMPLEMENT
1914 ;; ....................
1916 (define_insn "negsi2"
1917 [(set (match_operand:SI 0 "register_operand" "=d")
1918 (neg:SI (match_operand:SI 1 "register_operand" "d")))]
1922 operands[2] = const0_rtx;
1923 return \"subu\\t%0,%z2,%1\";
1925 [(set_attr "type" "arith")
1926 (set_attr "mode" "SI")
1927 (set_attr "length" "1")])
1929 (define_expand "negdi2"
1930 [(parallel [(set (match_operand:DI 0 "register_operand" "=d")
1931 (neg:DI (match_operand:DI 1 "se_register_operand" "d")))
1932 (clobber (match_dup 2))])]
1933 "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
1938 emit_insn (gen_negdi2_internal_2 (operands[0], operands[1]));
1942 operands[2] = gen_reg_rtx (SImode);
1945 (define_insn "negdi2_internal"
1946 [(set (match_operand:DI 0 "register_operand" "=d")
1947 (neg:DI (match_operand:DI 1 "register_operand" "d")))
1948 (clobber (match_operand:SI 2 "register_operand" "=d"))]
1949 "! TARGET_64BIT && !TARGET_DEBUG_G_MODE"
1952 operands[3] = const0_rtx;
1953 return \"subu\\t%L0,%z3,%L1\;subu\\t%M0,%z3,%M1\;sltu\\t%2,%z3,%L0\;subu\\t%M0,%M0,%2\";
1955 [(set_attr "type" "darith")
1956 (set_attr "mode" "DI")
1957 (set_attr "length" "4")])
1959 (define_insn "negdi2_internal_2"
1960 [(set (match_operand:DI 0 "register_operand" "=d")
1961 (neg:DI (match_operand:DI 1 "se_register_operand" "d")))]
1965 operands[2] = const0_rtx;
1966 return \"dsubu\\t%0,%z2,%1\";
1968 [(set_attr "type" "arith")
1969 (set_attr "mode" "DI")
1970 (set_attr "length" "1")])
1972 (define_insn "negdf2"
1973 [(set (match_operand:DF 0 "register_operand" "=f")
1974 (neg:DF (match_operand:DF 1 "register_operand" "f")))]
1975 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
1977 [(set_attr "type" "fneg")
1978 (set_attr "mode" "DF")
1979 (set_attr "length" "1")])
1981 (define_insn "negsf2"
1982 [(set (match_operand:SF 0 "register_operand" "=f")
1983 (neg:SF (match_operand:SF 1 "register_operand" "f")))]
1986 [(set_attr "type" "fneg")
1987 (set_attr "mode" "SF")
1988 (set_attr "length" "1")])
1990 (define_insn "one_cmplsi2"
1991 [(set (match_operand:SI 0 "register_operand" "=d")
1992 (not:SI (match_operand:SI 1 "register_operand" "d")))]
1996 operands[2] = const0_rtx;
1997 return \"nor\\t%0,%z2,%1\";
1999 [(set_attr "type" "arith")
2000 (set_attr "mode" "SI")
2001 (set_attr "length" "1")])
2003 (define_insn "one_cmpldi2"
2004 [(set (match_operand:DI 0 "register_operand" "=d")
2005 (not:DI (match_operand:DI 1 "se_register_operand" "d")))]
2009 operands[2] = const0_rtx;
2011 return \"nor\\t%0,%z2,%1\";
2012 return \"nor\\t%M0,%z2,%M1\;nor\\t%L0,%z2,%L1\";
2014 [(set_attr "type" "darith")
2015 (set_attr "mode" "DI")
2016 (set (attr "length")
2017 (if_then_else (ge (symbol_ref "mips_isa") (const_int 3))
2022 [(set (match_operand:DI 0 "register_operand" "")
2023 (not:DI (match_operand:DI 1 "register_operand" "")))]
2024 "reload_completed && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
2025 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
2026 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))"
2028 [(set (subreg:SI (match_dup 0) 0) (not:SI (subreg:SI (match_dup 1) 0)))
2029 (set (subreg:SI (match_dup 0) 1) (not:SI (subreg:SI (match_dup 1) 1)))]
2034 ;; ....................
2038 ;; ....................
2041 (define_insn "andsi3"
2042 [(set (match_operand:SI 0 "register_operand" "=d,d")
2043 (and:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
2044 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
2049 [(set_attr "type" "arith")
2050 (set_attr "mode" "SI")
2051 (set_attr "length" "1")])
2053 (define_insn "anddi3"
2054 [(set (match_operand:DI 0 "register_operand" "=d")
2055 (and:DI (match_operand:DI 1 "se_register_operand" "d")
2056 (match_operand:DI 2 "se_register_operand" "d")))]
2057 "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
2061 return \"and\\t%0,%1,%2\";
2062 return \"and\\t%M0,%M1,%M2\;and\\t%L0,%L1,%L2\";
2064 [(set_attr "type" "darith")
2065 (set_attr "mode" "DI")
2066 (set (attr "length")
2067 (if_then_else (ne (symbol_ref "TARGET_64BIT") (const_int 0))
2072 [(set (match_operand:DI 0 "register_operand" "")
2073 (and:DI (match_operand:DI 1 "register_operand" "")
2074 (match_operand:DI 2 "register_operand" "")))]
2075 "reload_completed && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
2076 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
2077 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
2078 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
2080 [(set (subreg:SI (match_dup 0) 0) (and:SI (subreg:SI (match_dup 1) 0) (subreg:SI (match_dup 2) 0)))
2081 (set (subreg:SI (match_dup 0) 1) (and:SI (subreg:SI (match_dup 1) 1) (subreg:SI (match_dup 2) 1)))]
2084 (define_insn "anddi3_internal1"
2085 [(set (match_operand:DI 0 "register_operand" "=d,d")
2086 (and:DI (match_operand:DI 1 "se_register_operand" "%d,d")
2087 (match_operand:DI 2 "se_uns_arith_operand" "d,K")))]
2092 [(set_attr "type" "arith")
2093 (set_attr "mode" "DI")
2094 (set_attr "length" "1")])
2096 (define_insn "iorsi3"
2097 [(set (match_operand:SI 0 "register_operand" "=d,d")
2098 (ior:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
2099 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
2104 [(set_attr "type" "arith")
2105 (set_attr "mode" "SI")
2106 (set_attr "length" "1")])
2108 ;;; ??? There is no iordi3 pattern which accepts 'K' constants when
2111 (define_insn "iordi3"
2112 [(set (match_operand:DI 0 "register_operand" "=d")
2113 (ior:DI (match_operand:DI 1 "se_register_operand" "d")
2114 (match_operand:DI 2 "se_register_operand" "d")))]
2115 "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
2119 return \"or\\t%0,%1,%2\";
2120 return \"or\\t%M0,%M1,%M2\;or\\t%L0,%L1,%L2\";
2122 [(set_attr "type" "darith")
2123 (set_attr "mode" "DI")
2124 (set (attr "length")
2125 (if_then_else (ne (symbol_ref "TARGET_64BIT") (const_int 0))
2130 [(set (match_operand:DI 0 "register_operand" "")
2131 (ior:DI (match_operand:DI 1 "register_operand" "")
2132 (match_operand:DI 2 "register_operand" "")))]
2133 "reload_completed && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
2134 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
2135 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
2136 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
2138 [(set (subreg:SI (match_dup 0) 0) (ior:SI (subreg:SI (match_dup 1) 0) (subreg:SI (match_dup 2) 0)))
2139 (set (subreg:SI (match_dup 0) 1) (ior:SI (subreg:SI (match_dup 1) 1) (subreg:SI (match_dup 2) 1)))]
2142 (define_insn "xorsi3"
2143 [(set (match_operand:SI 0 "register_operand" "=d,d")
2144 (xor:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
2145 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
2150 [(set_attr "type" "arith")
2151 (set_attr "mode" "SI")
2152 (set_attr "length" "1")])
2154 ;; ??? If delete the 32-bit long long patterns, then could merge this with
2155 ;; the following xordi3_internal pattern.
2156 (define_insn "xordi3"
2157 [(set (match_operand:DI 0 "register_operand" "=d")
2158 (xor:DI (match_operand:DI 1 "se_register_operand" "d")
2159 (match_operand:DI 2 "se_register_operand" "d")))]
2160 "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
2164 return \"xor\\t%0,%1,%2\";
2165 return \"xor\\t%M0,%M1,%M2\;xor\\t%L0,%L1,%L2\";
2167 [(set_attr "type" "darith")
2168 (set_attr "mode" "DI")
2169 (set (attr "length")
2170 (if_then_else (ne (symbol_ref "TARGET_64BIT") (const_int 0))
2175 [(set (match_operand:DI 0 "register_operand" "")
2176 (xor:DI (match_operand:DI 1 "register_operand" "")
2177 (match_operand:DI 2 "register_operand" "")))]
2178 "reload_completed && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
2179 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
2180 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
2181 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
2183 [(set (subreg:SI (match_dup 0) 0) (xor:SI (subreg:SI (match_dup 1) 0) (subreg:SI (match_dup 2) 0)))
2184 (set (subreg:SI (match_dup 0) 1) (xor:SI (subreg:SI (match_dup 1) 1) (subreg:SI (match_dup 2) 1)))]
2187 (define_insn "xordi3_immed"
2188 [(set (match_operand:DI 0 "register_operand" "d")
2189 (xor:DI (match_operand:DI 1 "se_register_operand" "d")
2190 (match_operand:DI 2 "se_uns_arith_operand" "K")))]
2193 [(set_attr "type" "arith")
2194 (set_attr "mode" "DI")
2195 (set_attr "length" "1")])
2197 (define_insn "*norsi3"
2198 [(set (match_operand:SI 0 "register_operand" "=d")
2199 (and:SI (not:SI (match_operand:SI 1 "register_operand" "d"))
2200 (not:SI (match_operand:SI 2 "register_operand" "d"))))]
2203 [(set_attr "type" "arith")
2204 (set_attr "mode" "SI")
2205 (set_attr "length" "1")])
2207 (define_insn "*nordi3"
2208 [(set (match_operand:DI 0 "register_operand" "=d")
2209 (and:DI (not:DI (match_operand:DI 1 "se_register_operand" "d"))
2210 (not:DI (match_operand:DI 2 "se_register_operand" "d"))))]
2215 return \"nor\\t%0,%z1,%z2\";
2216 return \"nor\\t%M0,%M1,%M2\;nor\\t%L0,%L1,%L2\";
2218 [(set_attr "type" "darith")
2219 (set_attr "mode" "DI")
2220 (set (attr "length")
2221 (if_then_else (ne (symbol_ref "TARGET_64BIT") (const_int 0))
2226 [(set (match_operand:DI 0 "register_operand" "")
2227 (and:DI (not:DI (match_operand:DI 1 "register_operand" ""))
2228 (not:DI (match_operand:DI 2 "register_operand" ""))))]
2229 "reload_completed && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
2230 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
2231 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
2232 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
2234 [(set (subreg:SI (match_dup 0) 0) (and:SI (not:SI (subreg:SI (match_dup 1) 0)) (not:SI (subreg:SI (match_dup 2) 0))))
2235 (set (subreg:SI (match_dup 0) 1) (and:SI (not:SI (subreg:SI (match_dup 1) 1)) (not:SI (subreg:SI (match_dup 2) 1))))]
2239 ;; ....................
2243 ;; ....................
2245 (define_insn "truncdfsf2"
2246 [(set (match_operand:SF 0 "register_operand" "=f")
2247 (float_truncate:SF (match_operand:DF 1 "register_operand" "f")))]
2248 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
2250 [(set_attr "type" "fcvt")
2251 (set_attr "mode" "SF")
2252 (set_attr "length" "1")])
2254 (define_insn "truncdisi2"
2255 [(set (match_operand:SI 0 "register_operand" "=d")
2256 (truncate:SI (match_operand:DI 1 "se_register_operand" "d")))]
2258 "dsll\\t%0,%1,32\;dsra\\t%0,%0,32"
2259 [(set_attr "type" "darith")
2260 (set_attr "mode" "SI")
2261 (set_attr "length" "2")])
2263 (define_insn "truncdihi2"
2264 [(set (match_operand:HI 0 "register_operand" "=d")
2265 (truncate:HI (match_operand:DI 1 "se_register_operand" "d")))]
2267 "andi\\t%0,%1,0xffff"
2268 [(set_attr "type" "darith")
2269 (set_attr "mode" "HI")
2270 (set_attr "length" "1")])
2272 (define_insn "truncdiqi2"
2273 [(set (match_operand:QI 0 "register_operand" "=d")
2274 (truncate:QI (match_operand:DI 1 "se_register_operand" "d")))]
2276 "andi\\t%0,%1,0x00ff"
2277 [(set_attr "type" "darith")
2278 (set_attr "mode" "QI")
2279 (set_attr "length" "1")])
2281 ;; Combiner patterns to optimize shift/truncate combinations.
2283 [(set (match_operand:SI 0 "register_operand" "=d")
2284 (truncate:SI (ashiftrt:DI (match_operand:DI 1 "se_register_operand" "d")
2285 (match_operand:DI 2 "small_int" "I"))))]
2289 int shift_amt = INTVAL (operands[2]) & 0x3f;
2293 operands[2] = GEN_INT (32 - shift_amt);
2294 return \"dsll\\t%0,%1,%2\;dsra\\t%0,%0,32\";
2298 operands[2] = GEN_INT (shift_amt);
2299 return \"dsra\\t%0,%1,%2\";
2302 [(set_attr "type" "darith")
2303 (set_attr "mode" "SI")
2304 (set_attr "length" "2")])
2307 [(set (match_operand:SI 0 "register_operand" "=d")
2308 (truncate:SI (lshiftrt:DI (match_operand:DI 1 "se_register_operand" "d")
2309 (match_operand:DI 2 "small_int" "I"))))]
2313 int shift_amt = INTVAL (operands[2]) & 0x3f;
2317 operands[2] = GEN_INT (32 - shift_amt);
2318 return \"dsll\\t%0,%1,%2\;dsra\\t%0,%0,32\";
2320 else if (shift_amt == 32)
2321 return \"dsra\\t%0,%1,32\";
2324 operands[2] = GEN_INT (shift_amt);
2325 return \"dsrl\\t%0,%1,%2\";
2328 [(set_attr "type" "darith")
2329 (set_attr "mode" "SI")
2330 (set_attr "length" "2")])
2333 [(set (match_operand:SI 0 "register_operand" "=d")
2334 (truncate:SI (ashift:DI (match_operand:DI 1 "se_register_operand" "d")
2335 (match_operand:DI 2 "small_int" "I"))))]
2339 int shift_amt = INTVAL (operands[2]) & 0x3f;
2343 operands[2] = GEN_INT (32 + shift_amt);
2344 return \"dsll\\t%0,%1,%2\;dsra\\t%0,%0,32\";
2347 return \"move\\t%0,%.\";
2349 [(set_attr "type" "darith")
2350 (set_attr "mode" "SI")
2351 (set_attr "length" "2")])
2353 ;; Combiner patterns to optimize truncate/zero_extend combinations.
2356 [(set (match_operand:SI 0 "register_operand" "=d")
2357 (zero_extend:SI (truncate:HI
2358 (match_operand:DI 1 "se_register_operand" "d"))))]
2360 "andi\\t%0,%1,0xffff"
2361 [(set_attr "type" "darith")
2362 (set_attr "mode" "SI")
2363 (set_attr "length" "1")])
2366 [(set (match_operand:SI 0 "register_operand" "=d")
2367 (zero_extend:SI (truncate:QI
2368 (match_operand:DI 1 "se_register_operand" "d"))))]
2371 [(set_attr "type" "darith")
2372 (set_attr "mode" "SI")
2373 (set_attr "length" "1")])
2376 [(set (match_operand:HI 0 "register_operand" "=d")
2377 (zero_extend:HI (truncate:QI
2378 (match_operand:DI 1 "se_register_operand" "d"))))]
2381 [(set_attr "type" "darith")
2382 (set_attr "mode" "HI")
2383 (set_attr "length" "1")])
2386 ;; ....................
2390 ;; ....................
2393 ;; Those for integer source operand are ordered widest source type first.
2395 (define_expand "zero_extendsidi2"
2396 [(set (match_operand:DI 0 "register_operand" "")
2397 (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" "")))]
2401 if (optimize && GET_CODE (operands[1]) == MEM)
2402 operands[1] = force_not_mem (operands[1]);
2404 if (GET_CODE (operands[1]) != MEM)
2406 rtx op1 = gen_lowpart (DImode, operands[1]);
2407 rtx temp = gen_reg_rtx (DImode);
2408 rtx shift = gen_rtx (CONST_INT, VOIDmode, 32);
2410 emit_insn (gen_ashldi3 (temp, op1, shift));
2411 emit_insn (gen_lshrdi3 (operands[0], temp, shift));
2416 (define_insn "zero_extendsidi2_internal"
2417 [(set (match_operand:DI 0 "register_operand" "=d,d")
2418 (zero_extend:DI (match_operand:SI 1 "memory_operand" "R,m")))]
2420 "* return mips_move_1word (operands, insn, TRUE);"
2421 [(set_attr "type" "load")
2422 (set_attr "mode" "DI")
2423 (set_attr "length" "1,2")])
2425 (define_insn "zero_extendhisi2"
2426 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
2427 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "d,R,m")))]
2431 if (which_alternative == 0)
2432 return \"andi\\t%0,%1,0xffff\";
2434 return mips_move_1word (operands, insn, TRUE);
2436 [(set_attr "type" "arith,load,load")
2437 (set_attr "mode" "SI")
2438 (set_attr "length" "1,1,2")])
2440 (define_insn "zero_extendhidi2"
2441 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
2442 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "d,R,m")))]
2446 if (which_alternative == 0)
2447 return \"andi\\t%0,%1,0xffff\";
2449 return mips_move_1word (operands, insn, TRUE);
2451 [(set_attr "type" "arith,load,load")
2452 (set_attr "mode" "DI")
2453 (set_attr "length" "1,1,2")])
2455 (define_insn "zero_extendqihi2"
2456 [(set (match_operand:HI 0 "register_operand" "=d,d,d")
2457 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "d,R,m")))]
2461 if (which_alternative == 0)
2462 return \"andi\\t%0,%1,0x00ff\";
2464 return mips_move_1word (operands, insn, TRUE);
2466 [(set_attr "type" "arith,load,load")
2467 (set_attr "mode" "HI")
2468 (set_attr "length" "1,1,2")])
2470 (define_insn "zero_extendqisi2"
2471 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
2472 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "d,R,m")))]
2476 if (which_alternative == 0)
2477 return \"andi\\t%0,%1,0x00ff\";
2479 return mips_move_1word (operands, insn, TRUE);
2481 [(set_attr "type" "arith,load,load")
2482 (set_attr "mode" "SI")
2483 (set_attr "length" "1,1,2")])
2485 (define_insn "zero_extendqidi2"
2486 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
2487 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "d,R,m")))]
2491 if (which_alternative == 0)
2492 return \"andi\\t%0,%1,0x00ff\";
2494 return mips_move_1word (operands, insn, TRUE);
2496 [(set_attr "type" "arith,load,load")
2497 (set_attr "mode" "DI")
2498 (set_attr "length" "1,1,2")])
2500 ;; These can be created when a paradoxical subreg operand with an implicit
2501 ;; sign_extend operator is reloaded. Because of the subreg, this is really
2503 ;; ??? It might be possible to eliminate the need for these patterns by adding
2504 ;; more support to reload for implicit sign_extend operators.
2505 (define_insn "*paradoxical_extendhidi2"
2506 [(set (match_operand:DI 0 "register_operand" "=d,d")
2508 (subreg:SI (match_operand:HI 1 "memory_operand" "R,m") 0)))]
2512 return mips_move_1word (operands, insn, TRUE);
2514 [(set_attr "type" "load,load")
2515 (set_attr "mode" "DI")
2516 (set_attr "length" "1,2")])
2518 (define_insn "*paradoxical_extendqidi2"
2519 [(set (match_operand:DI 0 "register_operand" "=d,d")
2521 (subreg:SI (match_operand:QI 1 "memory_operand" "R,m") 0)))]
2525 return mips_move_1word (operands, insn, TRUE);
2527 [(set_attr "type" "load,load")
2528 (set_attr "mode" "DI")
2529 (set_attr "length" "1,2")])
2532 ;; ....................
2536 ;; ....................
2539 ;; Those for integer source operand are ordered widest source type first.
2541 ;; In 64 bit mode, 32 bit values in general registers are always
2542 ;; correctly sign extended. That means that if the target is a
2543 ;; general register, we can sign extend from SImode to DImode just by
2546 (define_insn "extendsidi2"
2547 [(set (match_operand:DI 0 "register_operand" "=d,*d,d,d")
2548 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,*x,R,m")))]
2550 "* return mips_move_1word (operands, insn, FALSE);"
2551 [(set_attr "type" "move,hilo,load,load")
2552 (set_attr "mode" "DI")
2553 (set_attr "length" "1,1,1,2")])
2555 ;; These patterns originally accepted general_operands, however, slightly
2556 ;; better code is generated by only accepting register_operands, and then
2557 ;; letting combine generate the lh and lb insns.
2559 (define_expand "extendhidi2"
2560 [(set (match_operand:DI 0 "register_operand" "")
2561 (sign_extend:DI (match_operand:HI 1 "nonimmediate_operand" "")))]
2565 if (optimize && GET_CODE (operands[1]) == MEM)
2566 operands[1] = force_not_mem (operands[1]);
2568 if (GET_CODE (operands[1]) != MEM)
2570 rtx op1 = gen_lowpart (DImode, operands[1]);
2571 rtx temp = gen_reg_rtx (DImode);
2572 rtx shift = gen_rtx (CONST_INT, VOIDmode, 48);
2574 emit_insn (gen_ashldi3 (temp, op1, shift));
2575 emit_insn (gen_ashrdi3 (operands[0], temp, shift));
2580 (define_insn "extendhidi2_internal"
2581 [(set (match_operand:DI 0 "register_operand" "=d,d")
2582 (sign_extend:DI (match_operand:HI 1 "memory_operand" "R,m")))]
2584 "* return mips_move_1word (operands, insn, FALSE);"
2585 [(set_attr "type" "load")
2586 (set_attr "mode" "DI")
2587 (set_attr "length" "1,2")])
2589 (define_expand "extendhisi2"
2590 [(set (match_operand:SI 0 "register_operand" "")
2591 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
2595 if (optimize && GET_CODE (operands[1]) == MEM)
2596 operands[1] = force_not_mem (operands[1]);
2598 if (GET_CODE (operands[1]) != MEM)
2600 rtx op1 = gen_lowpart (SImode, operands[1]);
2601 rtx temp = gen_reg_rtx (SImode);
2602 rtx shift = gen_rtx (CONST_INT, VOIDmode, 16);
2604 emit_insn (gen_ashlsi3 (temp, op1, shift));
2605 emit_insn (gen_ashrsi3 (operands[0], temp, shift));
2610 (define_insn "extendhisi2_internal"
2611 [(set (match_operand:SI 0 "register_operand" "=d,d")
2612 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,m")))]
2614 "* return mips_move_1word (operands, insn, FALSE);"
2615 [(set_attr "type" "load")
2616 (set_attr "mode" "SI")
2617 (set_attr "length" "1,2")])
2619 (define_expand "extendqihi2"
2620 [(set (match_operand:HI 0 "register_operand" "")
2621 (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))]
2625 if (optimize && GET_CODE (operands[1]) == MEM)
2626 operands[1] = force_not_mem (operands[1]);
2628 if (GET_CODE (operands[1]) != MEM)
2630 rtx op0 = gen_lowpart (SImode, operands[0]);
2631 rtx op1 = gen_lowpart (SImode, operands[1]);
2632 rtx temp = gen_reg_rtx (SImode);
2633 rtx shift = gen_rtx (CONST_INT, VOIDmode, 24);
2635 emit_insn (gen_ashlsi3 (temp, op1, shift));
2636 emit_insn (gen_ashrsi3 (op0, temp, shift));
2641 (define_insn "extendqihi2_internal"
2642 [(set (match_operand:HI 0 "register_operand" "=d,d")
2643 (sign_extend:HI (match_operand:QI 1 "memory_operand" "R,m")))]
2645 "* return mips_move_1word (operands, insn, FALSE);"
2646 [(set_attr "type" "load")
2647 (set_attr "mode" "SI")
2648 (set_attr "length" "1,2")])
2651 (define_expand "extendqisi2"
2652 [(set (match_operand:SI 0 "register_operand" "")
2653 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
2657 if (optimize && GET_CODE (operands[1]) == MEM)
2658 operands[1] = force_not_mem (operands[1]);
2660 if (GET_CODE (operands[1]) != MEM)
2662 rtx op1 = gen_lowpart (SImode, operands[1]);
2663 rtx temp = gen_reg_rtx (SImode);
2664 rtx shift = gen_rtx (CONST_INT, VOIDmode, 24);
2666 emit_insn (gen_ashlsi3 (temp, op1, shift));
2667 emit_insn (gen_ashrsi3 (operands[0], temp, shift));
2672 (define_insn "extendqisi2_insn"
2673 [(set (match_operand:SI 0 "register_operand" "=d,d")
2674 (sign_extend:SI (match_operand:QI 1 "memory_operand" "R,m")))]
2676 "* return mips_move_1word (operands, insn, FALSE);"
2677 [(set_attr "type" "load")
2678 (set_attr "mode" "SI")
2679 (set_attr "length" "1,2")])
2681 (define_expand "extendqidi2"
2682 [(set (match_operand:DI 0 "register_operand" "")
2683 (sign_extend:DI (match_operand:QI 1 "nonimmediate_operand" "")))]
2687 if (optimize && GET_CODE (operands[1]) == MEM)
2688 operands[1] = force_not_mem (operands[1]);
2690 if (GET_CODE (operands[1]) != MEM)
2692 rtx op1 = gen_lowpart (DImode, operands[1]);
2693 rtx temp = gen_reg_rtx (DImode);
2694 rtx shift = gen_rtx (CONST_INT, VOIDmode, 56);
2696 emit_insn (gen_ashldi3 (temp, op1, shift));
2697 emit_insn (gen_ashrdi3 (operands[0], temp, shift));
2702 (define_insn "extendqidi2_insn"
2703 [(set (match_operand:DI 0 "register_operand" "=d,d")
2704 (sign_extend:DI (match_operand:QI 1 "memory_operand" "R,m")))]
2706 "* return mips_move_1word (operands, insn, FALSE);"
2707 [(set_attr "type" "load")
2708 (set_attr "mode" "DI")
2709 (set_attr "length" "1,2")])
2712 (define_insn "extendsfdf2"
2713 [(set (match_operand:DF 0 "register_operand" "=f")
2714 (float_extend:DF (match_operand:SF 1 "register_operand" "f")))]
2715 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
2717 [(set_attr "type" "fcvt")
2718 (set_attr "mode" "DF")
2719 (set_attr "length" "1")])
2724 ;; ....................
2728 ;; ....................
2730 ;; The SImode scratch register can not be shared with address regs used for
2731 ;; operand zero, because then the address in the move instruction will be
2732 ;; clobbered. We mark the scratch register as early clobbered to prevent this.
2734 (define_insn "fix_truncdfsi2"
2735 [(set (match_operand:SI 0 "general_operand" "=d,*f,R,o")
2736 (fix:SI (match_operand:DF 1 "register_operand" "f,*f,f,f")))
2737 (clobber (match_scratch:SI 2 "=d,*d,&d,&d"))
2738 (clobber (match_scratch:DF 3 "=f,*X,f,f"))]
2739 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
2744 if (which_alternative == 1)
2745 return \"trunc.w.d %0,%1,%2\";
2747 output_asm_insn (\"trunc.w.d %3,%1,%2\", operands);
2749 xoperands[0] = operands[0];
2750 xoperands[1] = operands[3];
2751 output_asm_insn (mips_move_1word (xoperands, insn, FALSE), xoperands);
2754 [(set_attr "type" "fcvt")
2755 (set_attr "mode" "DF")
2756 (set_attr "length" "11,9,10,11")])
2759 (define_insn "fix_truncsfsi2"
2760 [(set (match_operand:SI 0 "general_operand" "=d,*f,R,o")
2761 (fix:SI (match_operand:SF 1 "register_operand" "f,*f,f,f")))
2762 (clobber (match_scratch:SI 2 "=d,*d,&d,&d"))
2763 (clobber (match_scratch:SF 3 "=f,*X,f,f"))]
2769 if (which_alternative == 1)
2770 return \"trunc.w.s %0,%1,%2\";
2772 output_asm_insn (\"trunc.w.s %3,%1,%2\", operands);
2774 xoperands[0] = operands[0];
2775 xoperands[1] = operands[3];
2776 output_asm_insn (mips_move_1word (xoperands, insn, FALSE), xoperands);
2779 [(set_attr "type" "fcvt")
2780 (set_attr "mode" "SF")
2781 (set_attr "length" "11,9,10,11")])
2784 ;;; ??? trunc.l.d is mentioned in the appendix of the 1993 r4000/r4600 manuals
2785 ;;; but not in the chapter that describes the FPU. It is not mentioned at all
2786 ;;; in the 1991 manuals. The r4000 at Cygnus does not have this instruction.
2788 ;;; Deleting this means that we now need two libgcc2.a libraries. One for
2789 ;;; the 32 bit calling convention and one for the 64 bit calling convention.
2791 ;;; If this is disabled, then fixuns_truncdfdi2 must be disabled also.
2793 (define_insn "fix_truncdfdi2"
2794 [(set (match_operand:DI 0 "general_operand" "=d,*f,R,o")
2795 (fix:DI (match_operand:DF 1 "register_operand" "f,*f,f,f")))
2796 (clobber (match_scratch:DF 2 "=f,*X,f,f"))]
2797 "TARGET_HARD_FLOAT && TARGET_64BIT && TARGET_DOUBLE_FLOAT"
2802 if (which_alternative == 1)
2803 return \"trunc.l.d %0,%1\";
2805 output_asm_insn (\"trunc.l.d %2,%1\", operands);
2807 xoperands[0] = operands[0];
2808 xoperands[1] = operands[2];
2809 output_asm_insn (mips_move_2words (xoperands, insn, FALSE), xoperands);
2812 [(set_attr "type" "fcvt")
2813 (set_attr "mode" "DF")
2814 (set_attr "length" "2,1,2,3")])
2817 ;;; ??? trunc.l.s is mentioned in the appendix of the 1993 r4000/r4600 manuals
2818 ;;; but not in the chapter that describes the FPU. It is not mentioned at all
2819 ;;; in the 1991 manuals. The r4000 at Cygnus does not have this instruction.
2820 (define_insn "fix_truncsfdi2"
2821 [(set (match_operand:DI 0 "general_operand" "=d,*f,R,o")
2822 (fix:DI (match_operand:SF 1 "register_operand" "f,*f,f,f")))
2823 (clobber (match_scratch:DF 2 "=f,*X,f,f"))]
2824 "TARGET_HARD_FLOAT && TARGET_64BIT && TARGET_DOUBLE_FLOAT"
2829 if (which_alternative == 1)
2830 return \"trunc.l.s %0,%1\";
2832 output_asm_insn (\"trunc.l.s %2,%1\", operands);
2834 xoperands[0] = operands[0];
2835 xoperands[1] = operands[2];
2836 output_asm_insn (mips_move_2words (xoperands, insn, FALSE), xoperands);
2839 [(set_attr "type" "fcvt")
2840 (set_attr "mode" "SF")
2841 (set_attr "length" "2,1,2,3")])
2844 (define_insn "floatsidf2"
2845 [(set (match_operand:DF 0 "register_operand" "=f,f,f")
2846 (float:DF (match_operand:SI 1 "nonimmediate_operand" "d,R,m")))]
2847 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
2850 dslots_load_total++;
2851 if (GET_CODE (operands[1]) == MEM)
2852 return \"l.s\\t%0,%1%#\;cvt.d.w\\t%0,%0\";
2854 return \"mtc1\\t%1,%0%#\;cvt.d.w\\t%0,%0\";
2856 [(set_attr "type" "fcvt")
2857 (set_attr "mode" "DF")
2858 (set_attr "length" "3,4,3")])
2861 (define_insn "floatdidf2"
2862 [(set (match_operand:DF 0 "register_operand" "=f,f,f")
2863 (float:DF (match_operand:DI 1 "se_nonimmediate_operand" "d,R,m")))]
2864 "TARGET_HARD_FLOAT && TARGET_64BIT && TARGET_DOUBLE_FLOAT"
2867 dslots_load_total++;
2868 if (GET_CODE (operands[1]) == MEM)
2869 return \"l.d\\t%0,%1%#\;cvt.d.l\\t%0,%0\";
2871 return \"dmtc1\\t%1,%0%#\;cvt.d.l\\t%0,%0\";
2873 [(set_attr "type" "fcvt")
2874 (set_attr "mode" "DF")
2875 (set_attr "length" "3,4,3")])
2878 (define_insn "floatsisf2"
2879 [(set (match_operand:SF 0 "register_operand" "=f,f,f")
2880 (float:SF (match_operand:SI 1 "nonimmediate_operand" "d,R,m")))]
2884 dslots_load_total++;
2885 if (GET_CODE (operands[1]) == MEM)
2886 return \"l.s\\t%0,%1%#\;cvt.s.w\\t%0,%0\";
2888 return \"mtc1\\t%1,%0%#\;cvt.s.w\\t%0,%0\";
2890 [(set_attr "type" "fcvt")
2891 (set_attr "mode" "SF")
2892 (set_attr "length" "3,4,3")])
2895 (define_insn "floatdisf2"
2896 [(set (match_operand:SF 0 "register_operand" "=f,f,f")
2897 (float:SF (match_operand:DI 1 "se_nonimmediate_operand" "d,R,m")))]
2898 "TARGET_HARD_FLOAT && TARGET_64BIT && TARGET_DOUBLE_FLOAT"
2901 dslots_load_total++;
2902 if (GET_CODE (operands[1]) == MEM)
2903 return \"l.d\\t%0,%1%#\;cvt.s.l\\t%0,%0\";
2905 return \"dmtc1\\t%1,%0%#\;cvt.s.l\\t%0,%0\";
2907 [(set_attr "type" "fcvt")
2908 (set_attr "mode" "SF")
2909 (set_attr "length" "3,4,3")])
2912 (define_expand "fixuns_truncdfsi2"
2913 [(set (match_operand:SI 0 "register_operand" "")
2914 (unsigned_fix:SI (match_operand:DF 1 "register_operand" "")))]
2915 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
2918 rtx reg1 = gen_reg_rtx (DFmode);
2919 rtx reg2 = gen_reg_rtx (DFmode);
2920 rtx reg3 = gen_reg_rtx (SImode);
2921 rtx label1 = gen_label_rtx ();
2922 rtx label2 = gen_label_rtx ();
2923 REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (1.0, 31);
2925 if (reg1) /* turn off complaints about unreached code */
2927 emit_move_insn (reg1, immed_real_const_1 (offset, DFmode));
2928 do_pending_stack_adjust ();
2930 emit_insn (gen_cmpdf (operands[1], reg1));
2931 emit_jump_insn (gen_bge (label1));
2933 emit_insn (gen_fix_truncdfsi2 (operands[0], operands[1]));
2934 emit_jump_insn (gen_rtx (SET, VOIDmode, pc_rtx,
2935 gen_rtx (LABEL_REF, VOIDmode, label2)));
2938 emit_label (label1);
2939 emit_move_insn (reg2, gen_rtx (MINUS, DFmode, operands[1], reg1));
2940 emit_move_insn (reg3, gen_rtx (CONST_INT, VOIDmode, 0x80000000));
2942 emit_insn (gen_fix_truncdfsi2 (operands[0], reg2));
2943 emit_insn (gen_iorsi3 (operands[0], operands[0], reg3));
2945 emit_label (label2);
2947 /* allow REG_NOTES to be set on last insn (labels don't have enough
2948 fields, and can't be used for REG_NOTES anyway). */
2949 emit_insn (gen_rtx (USE, VOIDmode, stack_pointer_rtx));
2955 (define_expand "fixuns_truncdfdi2"
2956 [(set (match_operand:DI 0 "register_operand" "")
2957 (unsigned_fix:DI (match_operand:DF 1 "register_operand" "")))]
2958 "TARGET_HARD_FLOAT && TARGET_64BIT && TARGET_DOUBLE_FLOAT"
2961 rtx reg1 = gen_reg_rtx (DFmode);
2962 rtx reg2 = gen_reg_rtx (DFmode);
2963 rtx reg3 = gen_reg_rtx (DImode);
2964 rtx label1 = gen_label_rtx ();
2965 rtx label2 = gen_label_rtx ();
2966 REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (1.0, 63);
2968 if (reg1) /* turn off complaints about unreached code */
2970 emit_move_insn (reg1, immed_real_const_1 (offset, DFmode));
2971 do_pending_stack_adjust ();
2973 emit_insn (gen_cmpdf (operands[1], reg1));
2974 emit_jump_insn (gen_bge (label1));
2976 emit_insn (gen_fix_truncdfdi2 (operands[0], operands[1]));
2977 emit_jump_insn (gen_rtx (SET, VOIDmode, pc_rtx,
2978 gen_rtx (LABEL_REF, VOIDmode, label2)));
2981 emit_label (label1);
2982 emit_move_insn (reg2, gen_rtx (MINUS, DFmode, operands[1], reg1));
2983 emit_move_insn (reg3, gen_rtx (CONST_INT, VOIDmode, 0x80000000));
2984 emit_insn (gen_ashldi3 (reg3, reg3, GEN_INT (32)));
2986 emit_insn (gen_fix_truncdfdi2 (operands[0], reg2));
2987 emit_insn (gen_iordi3 (operands[0], operands[0], reg3));
2989 emit_label (label2);
2991 /* allow REG_NOTES to be set on last insn (labels don't have enough
2992 fields, and can't be used for REG_NOTES anyway). */
2993 emit_insn (gen_rtx (USE, VOIDmode, stack_pointer_rtx));
2999 (define_expand "fixuns_truncsfsi2"
3000 [(set (match_operand:SI 0 "register_operand" "")
3001 (unsigned_fix:SI (match_operand:SF 1 "register_operand" "")))]
3005 rtx reg1 = gen_reg_rtx (SFmode);
3006 rtx reg2 = gen_reg_rtx (SFmode);
3007 rtx reg3 = gen_reg_rtx (SImode);
3008 rtx label1 = gen_label_rtx ();
3009 rtx label2 = gen_label_rtx ();
3010 REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (1.0, 31);
3012 if (reg1) /* turn off complaints about unreached code */
3014 emit_move_insn (reg1, immed_real_const_1 (offset, SFmode));
3015 do_pending_stack_adjust ();
3017 emit_insn (gen_cmpsf (operands[1], reg1));
3018 emit_jump_insn (gen_bge (label1));
3020 emit_insn (gen_fix_truncsfsi2 (operands[0], operands[1]));
3021 emit_jump_insn (gen_rtx (SET, VOIDmode, pc_rtx,
3022 gen_rtx (LABEL_REF, VOIDmode, label2)));
3025 emit_label (label1);
3026 emit_move_insn (reg2, gen_rtx (MINUS, SFmode, operands[1], reg1));
3027 emit_move_insn (reg3, gen_rtx (CONST_INT, VOIDmode, 0x80000000));
3029 emit_insn (gen_fix_truncsfsi2 (operands[0], reg2));
3030 emit_insn (gen_iorsi3 (operands[0], operands[0], reg3));
3032 emit_label (label2);
3034 /* allow REG_NOTES to be set on last insn (labels don't have enough
3035 fields, and can't be used for REG_NOTES anyway). */
3036 emit_insn (gen_rtx (USE, VOIDmode, stack_pointer_rtx));
3042 (define_expand "fixuns_truncsfdi2"
3043 [(set (match_operand:DI 0 "register_operand" "")
3044 (unsigned_fix:DI (match_operand:SF 1 "register_operand" "")))]
3045 "TARGET_HARD_FLOAT && TARGET_64BIT && TARGET_DOUBLE_FLOAT"
3048 rtx reg1 = gen_reg_rtx (SFmode);
3049 rtx reg2 = gen_reg_rtx (SFmode);
3050 rtx reg3 = gen_reg_rtx (DImode);
3051 rtx label1 = gen_label_rtx ();
3052 rtx label2 = gen_label_rtx ();
3053 REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (1.0, 63);
3055 if (reg1) /* turn off complaints about unreached code */
3057 emit_move_insn (reg1, immed_real_const_1 (offset, SFmode));
3058 do_pending_stack_adjust ();
3060 emit_insn (gen_cmpsf (operands[1], reg1));
3061 emit_jump_insn (gen_bge (label1));
3063 emit_insn (gen_fix_truncsfdi2 (operands[0], operands[1]));
3064 emit_jump_insn (gen_rtx (SET, VOIDmode, pc_rtx,
3065 gen_rtx (LABEL_REF, VOIDmode, label2)));
3068 emit_label (label1);
3069 emit_move_insn (reg2, gen_rtx (MINUS, SFmode, operands[1], reg1));
3070 emit_move_insn (reg3, gen_rtx (CONST_INT, VOIDmode, 0x80000000));
3071 emit_insn (gen_ashldi3 (reg3, reg3, GEN_INT (32)));
3073 emit_insn (gen_fix_truncsfdi2 (operands[0], reg2));
3074 emit_insn (gen_iordi3 (operands[0], operands[0], reg3));
3076 emit_label (label2);
3078 /* allow REG_NOTES to be set on last insn (labels don't have enough
3079 fields, and can't be used for REG_NOTES anyway). */
3080 emit_insn (gen_rtx (USE, VOIDmode, stack_pointer_rtx));
3087 ;; ....................
3091 ;; ....................
3093 ;; Bit field extract patterns which use lwl/lwr.
3095 ;; ??? There should be DImode variants for 64 bit code, but the current
3096 ;; bitfield scheme can't handle that. We would need to add new optabs
3097 ;; in order to make that work.
3099 ;; ??? There could be HImode variants for the ulh/ulhu/ush macros.
3100 ;; It isn't clear whether this will give better code.
3102 (define_expand "extv"
3103 [(set (match_operand:SI 0 "register_operand" "")
3104 (sign_extract:SI (match_operand:QI 1 "memory_operand" "")
3105 (match_operand:SI 2 "immediate_operand" "")
3106 (match_operand:SI 3 "immediate_operand" "")))]
3110 /* If this isn't a 32 bit field, and it doesn't start on a byte boundary
3112 if (INTVAL (operands[2]) != 32 || (INTVAL (operands[3]) % 8) != 0)
3115 /* This can happen for a 64 bit target, when extracting a value from
3116 a 64 bit union member. extract_bit_field doesn't verify that our
3117 source matches the predicate, so we force it to be a MEM here. */
3118 if (GET_CODE (operands[1]) != MEM)
3121 /* Otherwise, emit a lwl/lwr pair to load the value. */
3122 emit_insn (gen_movsi_ulw (operands[0], operands[1]));
3126 (define_expand "extzv"
3127 [(set (match_operand:SI 0 "register_operand" "")
3128 (zero_extract:SI (match_operand:QI 1 "memory_operand" "")
3129 (match_operand:SI 2 "immediate_operand" "")
3130 (match_operand:SI 3 "immediate_operand" "")))]
3134 /* If this isn't a 32 bit field, and it doesn't start on a byte boundary
3136 if (INTVAL (operands[2]) != 32 || (INTVAL (operands[3]) % 8) != 0)
3139 /* This can happen for a 64 bit target, when extracting a value from
3140 a 64 bit union member. extract_bit_field doesn't verify that our
3141 source matches the predicate, so we force it to be a MEM here. */
3142 if (GET_CODE (operands[1]) != MEM)
3145 /* Otherwise, emit a lwl/lwr pair to load the value. */
3146 emit_insn (gen_movsi_ulw (operands[0], operands[1]));
3150 (define_expand "insv"
3151 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "")
3152 (match_operand:SI 1 "immediate_operand" "")
3153 (match_operand:SI 2 "immediate_operand" ""))
3154 (match_operand:SI 3 "register_operand" ""))]
3158 /* If this isn't a 32 bit field, and it doesn't start on a byte boundary
3160 if (INTVAL (operands[1]) != 32 || (INTVAL (operands[2]) % 8) != 0)
3163 /* This can happen for a 64 bit target, when storing into a 32 bit union
3164 member. store_bit_field doesn't verify that our target matches the
3165 predicate, so we force it to be a MEM here. */
3166 if (GET_CODE (operands[0]) != MEM)
3169 /* Otherwise, emit a swl/swr pair to load the value. */
3170 emit_insn (gen_movsi_usw (operands[0], operands[3]));
3174 ;; unaligned word moves generated by the bit field patterns
3176 (define_insn "movsi_ulw"
3177 [(set (match_operand:SI 0 "register_operand" "=&d,&d")
3178 (unspec [(match_operand:QI 1 "general_operand" "R,o")] 0))]
3182 rtx offset = const0_rtx;
3183 rtx addr = XEXP (operands[1], 0);
3184 rtx mem_addr = eliminate_constant_term (addr, &offset);
3188 mips_count_memory_refs (operands[1], 2);
3190 /* The stack/frame pointers are always aligned, so we can convert
3191 to the faster lw if we are referencing an aligned stack location. */
3193 if ((INTVAL (offset) & 3) == 0
3194 && (mem_addr == stack_pointer_rtx || mem_addr == frame_pointer_rtx))
3195 ret = \"lw\\t%0,%1\";
3197 ret = \"ulw\\t%0,%1\";
3199 return mips_fill_delay_slot (ret, DELAY_LOAD, operands, insn);
3201 [(set_attr "type" "load,load")
3202 (set_attr "mode" "SI")
3203 (set_attr "length" "2,4")])
3205 (define_insn "movsi_usw"
3206 [(set (match_operand:QI 0 "memory_operand" "=R,o")
3207 (unspec [(match_operand:SI 1 "reg_or_0_operand" "dJ,dJ")] 1))]
3211 rtx offset = const0_rtx;
3212 rtx addr = XEXP (operands[0], 0);
3213 rtx mem_addr = eliminate_constant_term (addr, &offset);
3216 mips_count_memory_refs (operands[0], 2);
3218 /* The stack/frame pointers are always aligned, so we can convert
3219 to the faster sw if we are referencing an aligned stack location. */
3221 if ((INTVAL (offset) & 3) == 0
3222 && (mem_addr == stack_pointer_rtx || mem_addr == frame_pointer_rtx))
3223 return \"sw\\t%1,%0\";
3225 return \"usw\\t%z1,%0\";
3227 [(set_attr "type" "store")
3228 (set_attr "mode" "SI")
3229 (set_attr "length" "2,4")])
3231 ;; These two patterns support loading addresses with two instructions instead
3232 ;; of using the macro instruction la.
3234 ;; ??? mips_move_1word has support for HIGH, so this pattern may be
3238 [(set (match_operand:SI 0 "register_operand" "=r")
3239 (high:SI (match_operand:SI 1 "immediate_operand" "")))]
3240 "mips_split_addresses"
3241 "lui\\t%0,%%hi(%1) # high"
3242 [(set_attr "type" "move")
3243 (set_attr "length" "1")])
3246 [(set (match_operand:SI 0 "register_operand" "=r")
3247 (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
3248 (match_operand:SI 2 "immediate_operand" "")))]
3249 "mips_split_addresses"
3250 "addiu\\t%0,%1,%%lo(%2) # low"
3251 [(set_attr "type" "arith")
3252 (set_attr "mode" "SI")
3253 (set_attr "length" "1")])
3255 ;; 64-bit integer moves
3257 ;; Unlike most other insns, the move insns can't be split with
3258 ;; different predicates, because register spilling and other parts of
3259 ;; the compiler, have memoized the insn number already.
3261 (define_expand "movdi"
3262 [(set (match_operand:DI 0 "nonimmediate_operand" "")
3263 (match_operand:DI 1 "general_operand" ""))]
3267 if (mips_split_addresses && mips_check_split (operands[1], DImode))
3269 enum machine_mode mode = GET_MODE (operands[0]);
3270 rtx tem = ((reload_in_progress | reload_completed)
3271 ? operands[0] : gen_reg_rtx (mode));
3273 emit_insn (gen_rtx (SET, VOIDmode, tem,
3274 gen_rtx (HIGH, mode, operands[1])));
3276 operands[1] = gen_rtx (LO_SUM, mode, tem, operands[1]);
3279 /* If we are generating embedded PIC code, and we are referring to a
3280 symbol in the .text section, we must use an offset from the start
3282 if (TARGET_EMBEDDED_PIC
3283 && (GET_CODE (operands[1]) == LABEL_REF
3284 || (GET_CODE (operands[1]) == SYMBOL_REF
3285 && ! SYMBOL_REF_FLAG (operands[1]))))
3289 temp = embedded_pic_offset (operands[1]);
3290 temp = gen_rtx (PLUS, Pmode, embedded_pic_fnaddr_rtx,
3291 force_reg (DImode, temp));
3292 emit_move_insn (operands[0], force_reg (DImode, temp));
3296 /* If operands[1] is a constant address illegal for pic, then we need to
3297 handle it just like LEGITIMIZE_ADDRESS does. */
3298 if (flag_pic && pic_address_needs_scratch (operands[1]))
3300 rtx temp = force_reg (DImode, XEXP (XEXP (operands[1], 0), 0));
3301 rtx temp2 = XEXP (XEXP (operands[1], 0), 1);
3303 if (! SMALL_INT (temp2))
3304 temp2 = force_reg (DImode, temp2);
3306 emit_move_insn (operands[0], gen_rtx (PLUS, DImode, temp, temp2));
3310 if ((reload_in_progress | reload_completed) == 0
3311 && !register_operand (operands[0], DImode)
3312 && !register_operand (operands[1], DImode)
3313 && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 0)
3314 && operands[1] != CONST0_RTX (DImode))
3316 rtx temp = force_reg (DImode, operands[1]);
3317 emit_move_insn (operands[0], temp);
3322 (define_insn "movdi_internal"
3323 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,R,o,*x,*d,*x")
3324 (match_operand:DI 1 "general_operand" "d,iF,R,o,d,d,J,*x,*d"))]
3326 && (register_operand (operands[0], DImode)
3327 || register_operand (operands[1], DImode)
3328 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0)
3329 || operands[1] == CONST0_RTX (DImode))"
3330 "* return mips_move_2words (operands, insn); "
3331 [(set_attr "type" "move,arith,load,load,store,store,hilo,hilo,hilo")
3332 (set_attr "mode" "DI")
3333 (set_attr "length" "2,4,2,4,2,4,2,2,2")])
3336 [(set (match_operand:DI 0 "register_operand" "")
3337 (match_operand:DI 1 "register_operand" ""))]
3338 "reload_completed && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
3339 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
3340 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))"
3342 [(set (subreg:SI (match_dup 0) 0) (subreg:SI (match_dup 1) 0))
3343 (set (subreg:SI (match_dup 0) 1) (subreg:SI (match_dup 1) 1))]
3346 (define_insn "movdi_internal2"
3347 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,d,d,R,m,*x,*d,*x,*a")
3348 (match_operand:DI 1 "movdi_operand" "d,S,IKL,Mnis,R,m,dJ,dJ,J,*x,*d,*J"))]
3350 && (register_operand (operands[0], DImode)
3351 || se_register_operand (operands[1], DImode)
3352 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0)
3353 || operands[1] == CONST0_RTX (DImode))"
3354 "* return mips_move_2words (operands, insn); "
3355 [(set_attr "type" "move,load,arith,arith,load,load,store,store,hilo,hilo,hilo,hilo")
3356 (set_attr "mode" "DI")
3357 (set_attr "length" "1,2,1,2,1,2,1,2,1,1,1,2")])
3359 ;; Handle input reloads in DImode.
3360 ;; This is mainly to handle reloading HILO_REGNUM. Note that we may
3361 ;; see it as the source or the destination, depending upon which way
3362 ;; reload handles the instruction.
3363 ;; Making the second operand TImode is a trick. The compiler may
3364 ;; reuse the same register for operand 0 and operand 2. Using TImode
3365 ;; gives us two registers, so we can always use the one which is not
3368 (define_expand "reload_indi"
3369 [(set (match_operand:DI 0 "register_operand" "=b")
3370 (match_operand:DI 1 "movdi_operand" "b"))
3371 (clobber (match_operand:TI 2 "register_operand" "=&d"))]
3375 rtx scratch = gen_rtx (REG, DImode,
3376 (REGNO (operands[0]) == REGNO (operands[2])
3377 ? REGNO (operands[2]) + 1
3378 : REGNO (operands[2])));
3380 if (GET_CODE (operands[0]) == REG && REGNO (operands[0]) == HILO_REGNUM)
3382 if (GET_CODE (operands[1]) == MEM)
3384 rtx memword, offword, hiword, loword;
3386 scratch = gen_rtx (REG, SImode, REGNO (scratch));
3387 memword = change_address (operands[1], SImode, NULL_RTX);
3388 offword = change_address (adj_offsettable_operand (operands[1], 4),
3390 if (BYTES_BIG_ENDIAN)
3400 emit_move_insn (scratch, hiword);
3401 emit_move_insn (gen_rtx (REG, SImode, 64), scratch);
3402 emit_move_insn (scratch, loword);
3403 emit_move_insn (gen_rtx (REG, SImode, 65), scratch);
3407 emit_insn (gen_ashrdi3 (scratch, operands[1], GEN_INT (32)));
3408 emit_insn (gen_movdi (gen_rtx (REG, DImode, 64), scratch));
3409 emit_insn (gen_ashldi3 (scratch, operands[1], GEN_INT (32)));
3410 emit_insn (gen_ashrdi3 (scratch, scratch, GEN_INT (32)));
3411 emit_insn (gen_movdi (gen_rtx (REG, DImode, 65), scratch));
3415 if (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == HILO_REGNUM)
3417 emit_insn (gen_movdi (scratch, gen_rtx (REG, DImode, 65)));
3418 emit_insn (gen_ashldi3 (scratch, scratch, GEN_INT (32)));
3419 emit_insn (gen_lshrdi3 (scratch, scratch, GEN_INT (32)));
3420 emit_insn (gen_movdi (operands[0], gen_rtx (REG, DImode, 64)));
3421 emit_insn (gen_ashldi3 (operands[0], operands[0], GEN_INT (32)));
3422 emit_insn (gen_iordi3 (operands[0], operands[0], scratch));
3425 /* This handles moves between a float register and HI/LO. */
3426 emit_move_insn (scratch, operands[1]);
3427 emit_move_insn (operands[0], scratch);
3431 ;; Handle output reloads in DImode.
3433 (define_expand "reload_outdi"
3434 [(set (match_operand:DI 0 "general_operand" "=b")
3435 (match_operand:DI 1 "se_register_operand" "b"))
3436 (clobber (match_operand:DI 2 "register_operand" "=&d"))]
3440 if (GET_CODE (operands[0]) == REG && REGNO (operands[0]) == HILO_REGNUM)
3442 emit_insn (gen_ashrdi3 (operands[2], operands[1], GEN_INT (32)));
3443 emit_insn (gen_movdi (gen_rtx (REG, DImode, 64), operands[2]));
3444 emit_insn (gen_ashldi3 (operands[2], operands[1], GEN_INT (32)));
3445 emit_insn (gen_ashrdi3 (operands[2], operands[2], GEN_INT (32)));
3446 emit_insn (gen_movdi (gen_rtx (REG, DImode, 65), operands[2]));
3449 if (GET_CODE (operands[1]) == REG && REGNO (operands[1]) == HILO_REGNUM)
3451 if (GET_CODE (operands[0]) == MEM)
3453 rtx scratch, memword, offword, hiword, loword;
3455 scratch = gen_rtx (REG, SImode, REGNO (operands[2]));
3456 memword = change_address (operands[0], SImode, NULL_RTX);
3457 offword = change_address (adj_offsettable_operand (operands[0], 4),
3459 if (BYTES_BIG_ENDIAN)
3469 emit_move_insn (scratch, gen_rtx (REG, SImode, 64));
3470 emit_move_insn (hiword, scratch);
3471 emit_move_insn (scratch, gen_rtx (REG, SImode, 65));
3472 emit_move_insn (loword, scratch);
3476 emit_insn (gen_movdi (operands[2], gen_rtx (REG, DImode, 65)));
3477 emit_insn (gen_ashldi3 (operands[2], operands[2], GEN_INT (32)));
3478 emit_insn (gen_lshrdi3 (operands[2], operands[2], GEN_INT (32)));
3479 emit_insn (gen_movdi (operands[0], gen_rtx (REG, DImode, 64)));
3480 emit_insn (gen_ashldi3 (operands[0], operands[0], GEN_INT (32)));
3481 emit_insn (gen_iordi3 (operands[0], operands[0], operands[2]));
3485 /* This handles moves between a float register and HI/LO. */
3486 emit_move_insn (operands[2], operands[1]);
3487 emit_move_insn (operands[0], operands[2]);
3491 ;; 32-bit Integer moves
3494 [(set (match_operand:SI 0 "register_operand" "")
3495 (match_operand:SI 1 "large_int" ""))]
3496 "!TARGET_DEBUG_D_MODE"
3500 (ior:SI (match_dup 0)
3504 operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) & 0xffff0000);
3505 operands[3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[1]) & 0x0000ffff);
3508 ;; Unlike most other insns, the move insns can't be split with
3509 ;; different predicates, because register spilling and other parts of
3510 ;; the compiler, have memoized the insn number already.
3512 (define_expand "movsi"
3513 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3514 (match_operand:SI 1 "general_operand" ""))]
3518 if (mips_split_addresses && mips_check_split (operands[1], SImode))
3520 enum machine_mode mode = GET_MODE (operands[0]);
3521 rtx tem = ((reload_in_progress | reload_completed)
3522 ? operands[0] : gen_reg_rtx (mode));
3524 emit_insn (gen_rtx (SET, VOIDmode, tem,
3525 gen_rtx (HIGH, mode, operands[1])));
3527 operands[1] = gen_rtx (LO_SUM, mode, tem, operands[1]);
3530 /* If we are generating embedded PIC code, and we are referring to a
3531 symbol in the .text section, we must use an offset from the start
3533 if (TARGET_EMBEDDED_PIC
3534 && (GET_CODE (operands[1]) == LABEL_REF
3535 || (GET_CODE (operands[1]) == SYMBOL_REF
3536 && ! SYMBOL_REF_FLAG (operands[1]))))
3540 temp = embedded_pic_offset (operands[1]);
3541 temp = gen_rtx (PLUS, Pmode, embedded_pic_fnaddr_rtx,
3542 force_reg (SImode, temp));
3543 emit_move_insn (operands[0], force_reg (SImode, temp));
3547 /* If operands[1] is a constant address invalid for pic, then we need to
3548 handle it just like LEGITIMIZE_ADDRESS does. */
3549 if (flag_pic && pic_address_needs_scratch (operands[1]))
3551 rtx temp = force_reg (SImode, XEXP (XEXP (operands[1], 0), 0));
3552 rtx temp2 = XEXP (XEXP (operands[1], 0), 1);
3554 if (! SMALL_INT (temp2))
3555 temp2 = force_reg (SImode, temp2);
3557 emit_move_insn (operands[0], gen_rtx (PLUS, SImode, temp, temp2));
3561 if ((reload_in_progress | reload_completed) == 0
3562 && !register_operand (operands[0], SImode)
3563 && !register_operand (operands[1], SImode)
3564 && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 0))
3566 rtx temp = force_reg (SImode, operands[1]);
3567 emit_move_insn (operands[0], temp);
3572 ;; The difference between these two is whether or not ints are allowed
3573 ;; in FP registers (off by default, use -mdebugh to enable).
3575 (define_insn "movsi_internal1"
3576 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d,d,R,m,*d,*f*z,*f,*f,*f,*R,*m,*x,*x,*d,*d")
3577 (match_operand:SI 1 "move_operand" "d,S,IKL,Mnis,R,m,dJ,dJ,*f*z,*d,*f,*R,*m,*f,*f,J,*d,*x,*a"))]
3578 "TARGET_DEBUG_H_MODE
3579 && (register_operand (operands[0], SImode)
3580 || register_operand (operands[1], SImode)
3581 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
3582 "* return mips_move_1word (operands, insn, FALSE);"
3583 [(set_attr "type" "move,load,arith,arith,load,load,store,store,xfer,xfer,move,load,load,store,store,hilo,hilo,hilo,hilo")
3584 (set_attr "mode" "SI")
3585 (set_attr "length" "1,2,1,2,1,2,1,2,1,1,1,1,2,1,2,1,1,1,1")])
3587 (define_insn "movsi_internal2"
3588 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d,d,R,m,*d,*z,*x,*d,*x,*d")
3589 (match_operand:SI 1 "move_operand" "d,S,IKL,Mnis,R,m,dJ,dJ,*z,*d,J,*x,*d,*a"))]
3590 "!TARGET_DEBUG_H_MODE
3591 && (register_operand (operands[0], SImode)
3592 || register_operand (operands[1], SImode)
3593 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
3594 "* return mips_move_1word (operands, insn, FALSE);"
3595 [(set_attr "type" "move,load,arith,arith,load,load,store,store,xfer,xfer,hilo,hilo,hilo,hilo")
3596 (set_attr "mode" "SI")
3597 (set_attr "length" "1,2,1,2,1,2,1,2,1,1,1,1,1,1")])
3599 ;; Reload HILO_REGNUM in SI mode. This needs a scratch register in
3600 ;; order to set the sign bit correctly in the HI register.
3602 (define_expand "reload_outsi"
3603 [(set (match_operand:SI 0 "general_operand" "=b")
3604 (match_operand:SI 1 "register_operand" "d"))
3605 (clobber (match_operand:SI 2 "register_operand" "=&d"))]
3609 if (GET_CODE (operands[0]) == REG && REGNO (operands[0]) == HILO_REGNUM)
3611 emit_insn (gen_movsi (gen_rtx (REG, SImode, 65), operands[1]));
3612 emit_insn (gen_ashrsi3 (operands[2], operands[1], GEN_INT (31)));
3613 emit_insn (gen_movsi (gen_rtx (REG, SImode, 64), operands[2]));
3616 /* This handles moves between a float register and HI/LO. */
3617 emit_move_insn (operands[2], operands[1]);
3618 emit_move_insn (operands[0], operands[2]);
3622 ;; This insn handles moving CCmode values. It's really just a
3623 ;; slightly simplified copy of movsi_internal2, with additional cases
3624 ;; to move a condition register to a general register and to move
3625 ;; between the general registers and the floating point registers.
3627 (define_insn "movcc"
3628 [(set (match_operand:CC 0 "nonimmediate_operand" "=d,*d,*d,*d,*R,*m,*d,*f,*f,*f,*f,*R,*m")
3629 (match_operand:CC 1 "general_operand" "z,*d,*R,*m,*d,*d,*f,*d,*f,*R,*m,*f,*f"))]
3630 "mips_isa >= 4 && TARGET_HARD_FLOAT"
3631 "* return mips_move_1word (operands, insn, FALSE);"
3632 [(set_attr "type" "move,move,load,load,store,store,xfer,xfer,move,load,load,store,store")
3633 (set_attr "mode" "SI")
3634 (set_attr "length" "2,1,1,2,1,2,1,1,1,1,2,1,2")])
3636 ;; Reload condition code registers. These need scratch registers.
3638 (define_expand "reload_incc"
3639 [(set (match_operand:CC 0 "register_operand" "=z")
3640 (match_operand:CC 1 "general_operand" "z"))
3641 (clobber (match_operand:TF 2 "register_operand" "=&f"))]
3642 "mips_isa >= 4 && TARGET_HARD_FLOAT"
3648 /* This is called when are copying some value into a condition code
3649 register. Operand 0 is the condition code register. Operand 1
3650 is the source. Operand 2 is a scratch register; we use TFmode
3651 because we actually need two floating point registers. */
3652 if (! ST_REG_P (true_regnum (operands[0]))
3653 || ! FP_REG_P (true_regnum (operands[2])))
3656 /* We need to get the source in SFmode so that the insn is
3658 if (GET_CODE (operands[1]) == MEM)
3659 source = change_address (operands[1], SFmode, NULL_RTX);
3660 else if (GET_CODE (operands[1]) == REG || GET_CODE (operands[1]) == SUBREG)
3661 source = gen_rtx (REG, SFmode, true_regnum (operands[1]));
3663 source = operands[1];
3665 fp1 = gen_rtx (REG, SFmode, REGNO (operands[2]));
3666 fp2 = gen_rtx (REG, SFmode, REGNO (operands[2]) + 1);
3668 emit_insn (gen_move_insn (fp1, source));
3669 emit_insn (gen_move_insn (fp2, gen_rtx (REG, SFmode, 0)));
3670 emit_insn (gen_rtx (SET, VOIDmode, operands[0],
3671 gen_rtx (LT, CCmode, fp2, fp1)));
3676 (define_expand "reload_outcc"
3677 [(set (match_operand:CC 0 "general_operand" "=z")
3678 (match_operand:CC 1 "register_operand" "z"))
3679 (clobber (match_operand:CC 2 "register_operand" "=&d"))]
3680 "mips_isa >= 4 && TARGET_HARD_FLOAT"
3683 /* This is called when we are copying a condition code register out
3684 to save it somewhere. Operand 0 should be the location we are
3685 going to save it to. Operand 1 should be the condition code
3686 register. Operand 2 should be a scratch general purpose register
3687 created for us by reload. The mips_secondary_reload_class
3688 function should have told reload that we don't need a scratch
3689 register if the destination is a general purpose register anyhow. */
3690 if (ST_REG_P (true_regnum (operands[0]))
3691 || GP_REG_P (true_regnum (operands[0]))
3692 || ! ST_REG_P (true_regnum (operands[1]))
3693 || ! GP_REG_P (true_regnum (operands[2])))
3696 /* All we have to do is copy the value from the condition code to
3697 the data register, which movcc can handle, and then store the
3698 value into the real final destination. */
3699 emit_insn (gen_move_insn (operands[2], operands[1]));
3700 emit_insn (gen_move_insn (operands[0], operands[2]));
3705 ;; MIPS4 supports loading and storing a floating point register from
3706 ;; the sum of two general registers. We use two versions for each of
3707 ;; these four instructions: one where the two general registers are
3708 ;; SImode, and one where they are DImode. This is because general
3709 ;; registers will be in SImode when they hold 32 bit values, but,
3710 ;; since the 32 bit values are always sign extended, the [ls][wd]xc1
3711 ;; instructions will still work correctly.
3713 ;; ??? Perhaps it would be better to support these instructions by
3714 ;; modifying GO_IF_LEGITIMATE_ADDRESS and friends. However, since
3715 ;; these instructions can only be used to load and store floating
3716 ;; point registers, that would probably cause trouble in reload.
3719 [(set (match_operand:SF 0 "register_operand" "=f")
3720 (mem:SF (plus:SI (match_operand:SI 1 "register_operand" "d")
3721 (match_operand:SI 2 "register_operand" "d"))))]
3722 "mips_isa >= 4 && TARGET_HARD_FLOAT"
3724 [(set_attr "type" "load")
3725 (set_attr "mode" "SF")
3726 (set_attr "length" "1")])
3729 [(set (match_operand:SF 0 "register_operand" "=f")
3730 (mem:SF (plus:DI (match_operand:DI 1 "se_register_operand" "d")
3731 (match_operand:DI 2 "se_register_operand" "d"))))]
3732 "mips_isa >= 4 && TARGET_HARD_FLOAT"
3734 [(set_attr "type" "load")
3735 (set_attr "mode" "SF")
3736 (set_attr "length" "1")])
3739 [(set (match_operand:DF 0 "register_operand" "=f")
3740 (mem:DF (plus:SI (match_operand:SI 1 "register_operand" "d")
3741 (match_operand:SI 2 "register_operand" "d"))))]
3742 "mips_isa >= 4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
3744 [(set_attr "type" "load")
3745 (set_attr "mode" "DF")
3746 (set_attr "length" "1")])
3749 [(set (match_operand:DF 0 "register_operand" "=f")
3750 (mem:DF (plus:DI (match_operand:DI 1 "se_register_operand" "d")
3751 (match_operand:DI 2 "se_register_operand" "d"))))]
3752 "mips_isa >= 4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
3754 [(set_attr "type" "load")
3755 (set_attr "mode" "DF")
3756 (set_attr "length" "1")])
3759 [(set (mem:SF (plus:SI (match_operand:SI 1 "register_operand" "d")
3760 (match_operand:SI 2 "register_operand" "d")))
3761 (match_operand:SF 0 "register_operand" "=f"))]
3762 "mips_isa >= 4 && TARGET_HARD_FLOAT"
3764 [(set_attr "type" "store")
3765 (set_attr "mode" "SF")
3766 (set_attr "length" "1")])
3769 [(set (mem:SF (plus:DI (match_operand:DI 1 "se_register_operand" "d")
3770 (match_operand:DI 2 "se_register_operand" "d")))
3771 (match_operand:SF 0 "register_operand" "=f"))]
3772 "mips_isa >= 4 && TARGET_HARD_FLOAT"
3774 [(set_attr "type" "store")
3775 (set_attr "mode" "SF")
3776 (set_attr "length" "1")])
3779 [(set (mem:DF (plus:SI (match_operand:SI 1 "register_operand" "d")
3780 (match_operand:SI 2 "register_operand" "d")))
3781 (match_operand:DF 0 "register_operand" "=f"))]
3782 "mips_isa >= 4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
3784 [(set_attr "type" "store")
3785 (set_attr "mode" "DF")
3786 (set_attr "length" "1")])
3789 [(set (mem:DF (plus:DI (match_operand:DI 1 "se_register_operand" "d")
3790 (match_operand:DI 2 "se_register_operand" "d")))
3791 (match_operand:DF 0 "register_operand" "=f"))]
3792 "mips_isa >= 4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
3794 [(set_attr "type" "store")
3795 (set_attr "mode" "DF")
3796 (set_attr "length" "1")])
3798 ;; 16-bit Integer moves
3800 ;; Unlike most other insns, the move insns can't be split with
3801 ;; different predicates, because register spilling and other parts of
3802 ;; the compiler, have memoized the insn number already.
3803 ;; Unsigned loads are used because BYTE_LOADS_ZERO_EXTEND is defined
3805 (define_expand "movhi"
3806 [(set (match_operand:HI 0 "nonimmediate_operand" "")
3807 (match_operand:HI 1 "general_operand" ""))]
3811 if ((reload_in_progress | reload_completed) == 0
3812 && !register_operand (operands[0], HImode)
3813 && !register_operand (operands[1], HImode)
3814 && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 0))
3816 rtx temp = force_reg (HImode, operands[1]);
3817 emit_move_insn (operands[0], temp);
3822 ;; The difference between these two is whether or not ints are allowed
3823 ;; in FP registers (off by default, use -mdebugh to enable).
3825 (define_insn "movhi_internal1"
3826 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,R,m,*d,*f,*f*z,*x,*d")
3827 (match_operand:HI 1 "general_operand" "d,IK,R,m,dJ,dJ,*f*z,*d,*f,*d,*x"))]
3828 "TARGET_DEBUG_H_MODE
3829 && (register_operand (operands[0], HImode)
3830 || register_operand (operands[1], HImode)
3831 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
3832 "* return mips_move_1word (operands, insn, TRUE);"
3833 [(set_attr "type" "move,arith,load,load,store,store,xfer,xfer,move,hilo,hilo")
3834 (set_attr "mode" "HI")
3835 (set_attr "length" "1,1,1,2,1,2,1,1,1,1,1")])
3837 (define_insn "movhi_internal2"
3838 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,R,m,*d,*z,*x,*d")
3839 (match_operand:HI 1 "general_operand" "d,IK,R,m,dJ,dJ,*z,*d,*d,*x"))]
3840 "!TARGET_DEBUG_H_MODE
3841 && (register_operand (operands[0], HImode)
3842 || register_operand (operands[1], HImode)
3843 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
3844 "* return mips_move_1word (operands, insn, TRUE);"
3845 [(set_attr "type" "move,arith,load,load,store,store,xfer,xfer,hilo,hilo")
3846 (set_attr "mode" "HI")
3847 (set_attr "length" "1,1,1,2,1,2,1,1,1,1")])
3850 ;; 8-bit Integer moves
3852 ;; Unlike most other insns, the move insns can't be split with
3853 ;; different predicates, because register spilling and other parts of
3854 ;; the compiler, have memoized the insn number already.
3855 ;; Unsigned loads are used because BYTE_LOADS_ZERO_EXTEND is defined
3857 (define_expand "movqi"
3858 [(set (match_operand:QI 0 "nonimmediate_operand" "")
3859 (match_operand:QI 1 "general_operand" ""))]
3863 if ((reload_in_progress | reload_completed) == 0
3864 && !register_operand (operands[0], QImode)
3865 && !register_operand (operands[1], QImode)
3866 && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 0))
3868 rtx temp = force_reg (QImode, operands[1]);
3869 emit_move_insn (operands[0], temp);
3874 ;; The difference between these two is whether or not ints are allowed
3875 ;; in FP registers (off by default, use -mdebugh to enable).
3877 (define_insn "movqi_internal1"
3878 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,m,*d,*f*z,*f,*x,*d")
3879 (match_operand:QI 1 "general_operand" "d,IK,R,m,dJ,dJ,*f*z,*d,*f,*d,*x"))]
3880 "TARGET_DEBUG_H_MODE
3881 && (register_operand (operands[0], QImode)
3882 || register_operand (operands[1], QImode)
3883 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
3884 "* return mips_move_1word (operands, insn, TRUE);"
3885 [(set_attr "type" "move,arith,load,load,store,store,xfer,xfer,move,hilo,hilo")
3886 (set_attr "mode" "QI")
3887 (set_attr "length" "1,1,1,2,1,2,1,1,1,1,1")])
3889 (define_insn "movqi_internal2"
3890 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,m,*d,*z,*x,*d")
3891 (match_operand:QI 1 "general_operand" "d,IK,R,m,dJ,dJ,*z,*d,*d,*x"))]
3892 "!TARGET_DEBUG_H_MODE
3893 && (register_operand (operands[0], QImode)
3894 || register_operand (operands[1], QImode)
3895 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
3896 "* return mips_move_1word (operands, insn, TRUE);"
3897 [(set_attr "type" "move,arith,load,load,store,store,xfer,xfer,hilo,hilo")
3898 (set_attr "mode" "QI")
3899 (set_attr "length" "1,1,1,2,1,2,1,1,1,1")])
3902 ;; 32-bit floating point moves
3904 (define_expand "movsf"
3905 [(set (match_operand:SF 0 "nonimmediate_operand" "")
3906 (match_operand:SF 1 "general_operand" ""))]
3910 if ((reload_in_progress | reload_completed) == 0
3911 && !register_operand (operands[0], SFmode)
3912 && !register_operand (operands[1], SFmode)
3913 && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 0)
3914 && operands[1] != CONST0_RTX (SFmode))
3916 rtx temp = force_reg (SFmode, operands[1]);
3917 emit_move_insn (operands[0], temp);
3922 (define_insn "movsf_internal1"
3923 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,f,f,R,m,*f,*d,*d,*d,*d,*R,*m")
3924 (match_operand:SF 1 "general_operand" "f,G,R,Fm,fG,fG,*d,*f,*G*d,*R,*F*m,*d,*d"))]
3926 && (register_operand (operands[0], SFmode)
3927 || register_operand (operands[1], SFmode)
3928 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0)
3929 || operands[1] == CONST0_RTX (SFmode))"
3930 "* return mips_move_1word (operands, insn, FALSE);"
3931 [(set_attr "type" "move,xfer,load,load,store,store,xfer,xfer,move,load,load,store,store")
3932 (set_attr "mode" "SF")
3933 (set_attr "length" "1,1,1,2,1,2,1,1,1,1,2,1,2")])
3936 (define_insn "movsf_internal2"
3937 [(set (match_operand:SF 0 "nonimmediate_operand" "=d,d,d,R,m")
3938 (match_operand:SF 1 "general_operand" " Gd,R,Fm,d,d"))]
3940 && (register_operand (operands[0], SFmode)
3941 || register_operand (operands[1], SFmode)
3942 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0)
3943 || operands[1] == CONST0_RTX (SFmode))"
3944 "* return mips_move_1word (operands, insn, FALSE);"
3945 [(set_attr "type" "move,load,load,store,store")
3946 (set_attr "mode" "SF")
3947 (set_attr "length" "1,1,2,1,2")])
3950 ;; 64-bit floating point moves
3952 (define_expand "movdf"
3953 [(set (match_operand:DF 0 "nonimmediate_operand" "")
3954 (match_operand:DF 1 "general_operand" ""))]
3958 if ((reload_in_progress | reload_completed) == 0
3959 && !register_operand (operands[0], DFmode)
3960 && !register_operand (operands[1], DFmode)
3961 && (GET_CODE (operands[1]) != CONST_INT || INTVAL (operands[1]) != 0)
3962 && operands[1] != CONST0_RTX (DFmode))
3964 rtx temp = force_reg (DFmode, operands[1]);
3965 emit_move_insn (operands[0], temp);
3970 (define_insn "movdf_internal1"
3971 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,R,o,f,*f,*d,*d,*d,*d,*R,*o")
3972 (match_operand:DF 1 "general_operand" "f,R,o,fG,fG,F,*d,*f,*d*G,*R,*o*F,*d,*d"))]
3973 "TARGET_HARD_FLOAT && !(TARGET_FLOAT64 && !TARGET_64BIT)
3974 && TARGET_DOUBLE_FLOAT
3975 && (register_operand (operands[0], DFmode)
3976 || register_operand (operands[1], DFmode)
3977 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0)
3978 || operands[1] == CONST0_RTX (DFmode))"
3979 "* return mips_move_2words (operands, insn); "
3980 [(set_attr "type" "move,load,load,store,store,load,xfer,xfer,move,load,load,store,store")
3981 (set_attr "mode" "DF")
3982 (set_attr "length" "1,2,4,2,4,4,2,2,2,2,4,2,4")])
3984 (define_insn "movdf_internal1a"
3985 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,R,R,o,o,f,*d,*d,*d,*o,*R")
3986 (match_operand:DF 1 "general_operand" " f,o,f,G,f,G,F,*F,*o,*R,*d,*d"))]
3987 "TARGET_HARD_FLOAT && (TARGET_FLOAT64 && !TARGET_64BIT)
3988 && TARGET_DOUBLE_FLOAT
3989 && (register_operand (operands[0], DFmode)
3990 || register_operand (operands[1], DFmode))
3991 || (GET_CODE (operands [0]) == MEM
3992 && ((GET_CODE (operands[1]) == CONST_INT
3993 && INTVAL (operands[1]) == 0)
3994 || operands[1] == CONST0_RTX (DFmode)))"
3995 "* return mips_move_2words (operands, insn); "
3996 [(set_attr "type" "move,load,store,store,store,store,load,load,load,load,store,store")
3997 (set_attr "mode" "DF")
3998 (set_attr "length" "1,2,1,1,2,2,2,2,2,1,2,1")])
4000 (define_insn "movdf_internal2"
4001 [(set (match_operand:DF 0 "nonimmediate_operand" "=d,d,d,R,o")
4002 (match_operand:DF 1 "general_operand" "dG,R,oF,d,d"))]
4003 "(TARGET_SOFT_FLOAT || TARGET_SINGLE_FLOAT)
4004 && (register_operand (operands[0], DFmode)
4005 || register_operand (operands[1], DFmode)
4006 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0)
4007 || operands[1] == CONST0_RTX (DFmode))"
4008 "* return mips_move_2words (operands, insn); "
4009 [(set_attr "type" "move,load,load,store,store")
4010 (set_attr "mode" "DF")
4011 (set_attr "length" "2,2,4,2,4")])
4014 [(set (match_operand:DF 0 "register_operand" "")
4015 (match_operand:DF 1 "register_operand" ""))]
4016 "reload_completed && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
4017 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
4018 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))"
4019 [(set (subreg:SI (match_dup 0) 0) (subreg:SI (match_dup 1) 0))
4020 (set (subreg:SI (match_dup 0) 1) (subreg:SI (match_dup 1) 1))]
4023 ;; Instructions to load the global pointer register.
4024 ;; This is volatile to make sure that the scheduler won't move any symbol_ref
4025 ;; uses in front of it. All symbol_refs implicitly use the gp reg.
4027 (define_insn "loadgp"
4029 (unspec_volatile [(match_operand:DI 0 "address_operand" "")] 2))
4030 (clobber (reg:DI 1))]
4032 "%[lui\\t$1,%%hi(%%neg(%%gp_rel(%a0)))\\n\\taddiu\\t$1,$1,%%lo(%%neg(%%gp_rel(%a0)))\\n\\tdaddu\\t$gp,$1,$25%]"
4033 [(set_attr "type" "move")
4034 (set_attr "mode" "DI")
4035 (set_attr "length" "3")])
4037 ;; Block moves, see mips.c for more details.
4038 ;; Argument 0 is the destination
4039 ;; Argument 1 is the source
4040 ;; Argument 2 is the length
4041 ;; Argument 3 is the alignment
4043 (define_expand "movstrsi"
4044 [(parallel [(set (mem:BLK (match_operand:BLK 0 "general_operand" ""))
4045 (mem:BLK (match_operand:BLK 1 "general_operand" "")))
4046 (use (match_operand:SI 2 "arith32_operand" ""))
4047 (use (match_operand:SI 3 "immediate_operand" ""))])]
4051 if (operands[0]) /* avoid unused code messages */
4053 expand_block_move (operands);
4058 ;; Insn generated by block moves
4060 (define_insn "movstrsi_internal"
4061 [(set (match_operand:BLK 0 "memory_operand" "=o") ;; destination
4062 (match_operand:BLK 1 "memory_operand" "o")) ;; source
4063 (clobber (match_scratch:SI 4 "=&d")) ;; temp 1
4064 (clobber (match_scratch:SI 5 "=&d")) ;; temp 2
4065 (clobber (match_scratch:SI 6 "=&d")) ;; temp 3
4066 (clobber (match_scratch:SI 7 "=&d")) ;; temp 4
4067 (use (match_operand:SI 2 "small_int" "I")) ;; # bytes to move
4068 (use (match_operand:SI 3 "small_int" "I")) ;; alignment
4069 (use (const_int 0))] ;; normal block move
4071 "* return output_block_move (insn, operands, 4, BLOCK_MOVE_NORMAL);"
4072 [(set_attr "type" "multi")
4073 (set_attr "mode" "none")
4074 (set_attr "length" "20")])
4076 ;; Split a block move into 2 parts, the first part is everything
4077 ;; except for the last move, and the second part is just the last
4078 ;; store, which is exactly 1 instruction (ie, not a usw), so it can
4079 ;; fill a delay slot. This also prevents a bug in delayed branches
4080 ;; from showing up, which reuses one of the registers in our clobbers.
4083 [(set (mem:BLK (match_operand:SI 0 "register_operand" ""))
4084 (mem:BLK (match_operand:SI 1 "register_operand" "")))
4085 (clobber (match_operand:SI 4 "register_operand" ""))
4086 (clobber (match_operand:SI 5 "register_operand" ""))
4087 (clobber (match_operand:SI 6 "register_operand" ""))
4088 (clobber (match_operand:SI 7 "register_operand" ""))
4089 (use (match_operand:SI 2 "small_int" ""))
4090 (use (match_operand:SI 3 "small_int" ""))
4091 (use (const_int 0))]
4093 "reload_completed && !TARGET_DEBUG_D_MODE && INTVAL (operands[2]) > 0"
4095 ;; All but the last move
4096 [(parallel [(set (mem:BLK (match_dup 0))
4097 (mem:BLK (match_dup 1)))
4098 (clobber (match_dup 4))
4099 (clobber (match_dup 5))
4100 (clobber (match_dup 6))
4101 (clobber (match_dup 7))
4104 (use (const_int 1))])
4106 ;; The last store, so it can fill a delay slot
4107 (parallel [(set (mem:BLK (match_dup 0))
4108 (mem:BLK (match_dup 1)))
4109 (clobber (match_dup 4))
4110 (clobber (match_dup 5))
4111 (clobber (match_dup 6))
4112 (clobber (match_dup 7))
4115 (use (const_int 2))])]
4119 (define_insn "movstrsi_internal2"
4120 [(set (match_operand:BLK 0 "memory_operand" "=o") ;; destination
4121 (match_operand:BLK 1 "memory_operand" "o")) ;; source
4122 (clobber (match_scratch:SI 4 "=&d")) ;; temp 1
4123 (clobber (match_scratch:SI 5 "=&d")) ;; temp 2
4124 (clobber (match_scratch:SI 6 "=&d")) ;; temp 3
4125 (clobber (match_scratch:SI 7 "=&d")) ;; temp 4
4126 (use (match_operand:SI 2 "small_int" "I")) ;; # bytes to move
4127 (use (match_operand:SI 3 "small_int" "I")) ;; alignment
4128 (use (const_int 1))] ;; all but last store
4130 "* return output_block_move (insn, operands, 4, BLOCK_MOVE_NOT_LAST);"
4131 [(set_attr "type" "multi")
4132 (set_attr "mode" "none")
4133 (set_attr "length" "20")])
4135 (define_insn "movstrsi_internal3"
4136 [(set (match_operand:BLK 0 "memory_operand" "=Ro") ;; destination
4137 (match_operand:BLK 1 "memory_operand" "Ro")) ;; source
4138 (clobber (match_scratch:SI 4 "=&d")) ;; temp 1
4139 (clobber (match_scratch:SI 5 "=&d")) ;; temp 2
4140 (clobber (match_scratch:SI 6 "=&d")) ;; temp 3
4141 (clobber (match_scratch:SI 7 "=&d")) ;; temp 4
4142 (use (match_operand:SI 2 "small_int" "I")) ;; # bytes to move
4143 (use (match_operand:SI 3 "small_int" "I")) ;; alignment
4144 (use (const_int 2))] ;; just last store of block move
4146 "* return output_block_move (insn, operands, 4, BLOCK_MOVE_LAST);"
4147 [(set_attr "type" "store")
4148 (set_attr "mode" "none")
4149 (set_attr "length" "1")])
4153 ;; ....................
4157 ;; ....................
4159 (define_insn "ashlsi3"
4160 [(set (match_operand:SI 0 "register_operand" "=d")
4161 (ashift:SI (match_operand:SI 1 "register_operand" "d")
4162 (match_operand:SI 2 "arith_operand" "dI")))]
4166 if (GET_CODE (operands[2]) == CONST_INT)
4167 operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0x1f);
4169 return \"sll\\t%0,%1,%2\";
4171 [(set_attr "type" "arith")
4172 (set_attr "mode" "SI")
4173 (set_attr "length" "1")])
4176 (define_expand "ashldi3"
4177 [(parallel [(set (match_operand:DI 0 "register_operand" "")
4178 (ashift:DI (match_operand:DI 1 "se_register_operand" "")
4179 (match_operand:SI 2 "arith_operand" "")))
4180 (clobber (match_dup 3))])]
4181 "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
4186 emit_insn (gen_ashldi3_internal4 (operands[0], operands[1],
4191 operands[3] = gen_reg_rtx (SImode);
4195 (define_insn "ashldi3_internal"
4196 [(set (match_operand:DI 0 "register_operand" "=&d")
4197 (ashift:DI (match_operand:DI 1 "register_operand" "d")
4198 (match_operand:SI 2 "register_operand" "d")))
4199 (clobber (match_operand:SI 3 "register_operand" "=d"))]
4200 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE"
4203 operands[4] = const0_rtx;
4204 dslots_jump_total += 3;
4205 dslots_jump_filled += 2;
4207 return \"sll\\t%3,%2,26\\n\\
4208 \\tbgez\\t%3,1f\\n\\
4209 \\tsll\\t%M0,%L1,%2\\n\\
4211 \\tmove\\t%L0,%z4%)\\n\\
4214 \\t%(beq\\t%3,%z4,2f\\n\\
4215 \\tsll\\t%M0,%M1,%2%)\\n\\
4217 \\tsubu\\t%3,%z4,%2\\n\\
4218 \\tsrl\\t%3,%L1,%3\\n\\
4219 \\tor\\t%M0,%M0,%3\\n\\
4221 \\tsll\\t%L0,%L1,%2\\n\\
4224 [(set_attr "type" "darith")
4225 (set_attr "mode" "SI")
4226 (set_attr "length" "12")])
4229 (define_insn "ashldi3_internal2"
4230 [(set (match_operand:DI 0 "register_operand" "=d")
4231 (ashift:DI (match_operand:DI 1 "register_operand" "d")
4232 (match_operand:SI 2 "small_int" "IJK")))
4233 (clobber (match_operand:SI 3 "register_operand" "=d"))]
4234 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && (INTVAL (operands[2]) & 32) != 0"
4237 operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0x1f);
4238 operands[4] = const0_rtx;
4239 return \"sll\\t%M0,%L1,%2\;move\\t%L0,%z4\";
4241 [(set_attr "type" "darith")
4242 (set_attr "mode" "DI")
4243 (set_attr "length" "2")])
4247 [(set (match_operand:DI 0 "register_operand" "")
4248 (ashift:DI (match_operand:DI 1 "register_operand" "")
4249 (match_operand:SI 2 "small_int" "")))
4250 (clobber (match_operand:SI 3 "register_operand" ""))]
4251 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
4252 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
4253 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
4254 && (INTVAL (operands[2]) & 32) != 0"
4256 [(set (subreg:SI (match_dup 0) 1) (ashift:SI (subreg:SI (match_dup 1) 0) (match_dup 2)))
4257 (set (subreg:SI (match_dup 0) 0) (const_int 0))]
4259 "operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0x1f);")
4263 [(set (match_operand:DI 0 "register_operand" "")
4264 (ashift:DI (match_operand:DI 1 "register_operand" "")
4265 (match_operand:SI 2 "small_int" "")))
4266 (clobber (match_operand:SI 3 "register_operand" ""))]
4267 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
4268 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
4269 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
4270 && (INTVAL (operands[2]) & 32) != 0"
4272 [(set (subreg:SI (match_dup 0) 0) (ashift:SI (subreg:SI (match_dup 1) 1) (match_dup 2)))
4273 (set (subreg:SI (match_dup 0) 1) (const_int 0))]
4275 "operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0x1f);")
4278 (define_insn "ashldi3_internal3"
4279 [(set (match_operand:DI 0 "register_operand" "=d")
4280 (ashift:DI (match_operand:DI 1 "register_operand" "d")
4281 (match_operand:SI 2 "small_int" "IJK")))
4282 (clobber (match_operand:SI 3 "register_operand" "=d"))]
4283 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE
4284 && (INTVAL (operands[2]) & 63) < 32
4285 && (INTVAL (operands[2]) & 63) != 0"
4288 int amount = INTVAL (operands[2]);
4290 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
4291 operands[4] = const0_rtx;
4292 operands[5] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
4294 return \"sll\\t%M0,%M1,%2\;srl\\t%3,%L1,%5\;or\\t%M0,%M0,%3\;sll\\t%L0,%L1,%2\";
4296 [(set_attr "type" "darith")
4297 (set_attr "mode" "DI")
4298 (set_attr "length" "4")])
4302 [(set (match_operand:DI 0 "register_operand" "")
4303 (ashift:DI (match_operand:DI 1 "register_operand" "")
4304 (match_operand:SI 2 "small_int" "")))
4305 (clobber (match_operand:SI 3 "register_operand" ""))]
4306 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
4307 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
4308 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
4309 && (INTVAL (operands[2]) & 63) < 32
4310 && (INTVAL (operands[2]) & 63) != 0"
4312 [(set (subreg:SI (match_dup 0) 1)
4313 (ashift:SI (subreg:SI (match_dup 1) 1)
4317 (lshiftrt:SI (subreg:SI (match_dup 1) 0)
4320 (set (subreg:SI (match_dup 0) 1)
4321 (ior:SI (subreg:SI (match_dup 0) 1)
4324 (set (subreg:SI (match_dup 0) 0)
4325 (ashift:SI (subreg:SI (match_dup 1) 0)
4329 int amount = INTVAL (operands[2]);
4330 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
4331 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
4336 [(set (match_operand:DI 0 "register_operand" "")
4337 (ashift:DI (match_operand:DI 1 "register_operand" "")
4338 (match_operand:SI 2 "small_int" "")))
4339 (clobber (match_operand:SI 3 "register_operand" ""))]
4340 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
4341 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
4342 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
4343 && (INTVAL (operands[2]) & 63) < 32
4344 && (INTVAL (operands[2]) & 63) != 0"
4346 [(set (subreg:SI (match_dup 0) 0)
4347 (ashift:SI (subreg:SI (match_dup 1) 0)
4351 (lshiftrt:SI (subreg:SI (match_dup 1) 1)
4354 (set (subreg:SI (match_dup 0) 0)
4355 (ior:SI (subreg:SI (match_dup 0) 0)
4358 (set (subreg:SI (match_dup 0) 1)
4359 (ashift:SI (subreg:SI (match_dup 1) 1)
4363 int amount = INTVAL (operands[2]);
4364 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
4365 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
4369 (define_insn "ashldi3_internal4"
4370 [(set (match_operand:DI 0 "register_operand" "=d")
4371 (ashift:DI (match_operand:DI 1 "se_register_operand" "d")
4372 (match_operand:SI 2 "arith_operand" "dI")))]
4376 if (GET_CODE (operands[2]) == CONST_INT)
4377 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f);
4379 return \"dsll\\t%0,%1,%2\";
4381 [(set_attr "type" "arith")
4382 (set_attr "mode" "DI")
4383 (set_attr "length" "1")])
4386 (define_insn "ashrsi3"
4387 [(set (match_operand:SI 0 "register_operand" "=d")
4388 (ashiftrt:SI (match_operand:SI 1 "register_operand" "d")
4389 (match_operand:SI 2 "arith_operand" "dI")))]
4393 if (GET_CODE (operands[2]) == CONST_INT)
4394 operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0x1f);
4396 return \"sra\\t%0,%1,%2\";
4398 [(set_attr "type" "arith")
4399 (set_attr "mode" "SI")
4400 (set_attr "length" "1")])
4403 (define_expand "ashrdi3"
4404 [(parallel [(set (match_operand:DI 0 "register_operand" "")
4405 (ashiftrt:DI (match_operand:DI 1 "se_register_operand" "")
4406 (match_operand:SI 2 "arith_operand" "")))
4407 (clobber (match_dup 3))])]
4408 "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
4413 emit_insn (gen_ashrdi3_internal4 (operands[0], operands[1],
4418 operands[3] = gen_reg_rtx (SImode);
4422 (define_insn "ashrdi3_internal"
4423 [(set (match_operand:DI 0 "register_operand" "=&d")
4424 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
4425 (match_operand:SI 2 "register_operand" "d")))
4426 (clobber (match_operand:SI 3 "register_operand" "=d"))]
4427 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE"
4430 operands[4] = const0_rtx;
4431 dslots_jump_total += 3;
4432 dslots_jump_filled += 2;
4434 return \"sll\\t%3,%2,26\\n\\
4435 \\tbgez\\t%3,1f\\n\\
4436 \\tsra\\t%L0,%M1,%2\\n\\
4438 \\tsra\\t%M0,%M1,31%)\\n\\
4441 \\t%(beq\\t%3,%z4,2f\\n\\
4442 \\tsrl\\t%L0,%L1,%2%)\\n\\
4444 \\tsubu\\t%3,%z4,%2\\n\\
4445 \\tsll\\t%3,%M1,%3\\n\\
4446 \\tor\\t%L0,%L0,%3\\n\\
4448 \\tsra\\t%M0,%M1,%2\\n\\
4451 [(set_attr "type" "darith")
4452 (set_attr "mode" "DI")
4453 (set_attr "length" "12")])
4456 (define_insn "ashrdi3_internal2"
4457 [(set (match_operand:DI 0 "register_operand" "=d")
4458 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
4459 (match_operand:SI 2 "small_int" "IJK")))
4460 (clobber (match_operand:SI 3 "register_operand" "=d"))]
4461 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && (INTVAL (operands[2]) & 32) != 0"
4464 operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0x1f);
4465 return \"sra\\t%L0,%M1,%2\;sra\\t%M0,%M1,31\";
4467 [(set_attr "type" "darith")
4468 (set_attr "mode" "DI")
4469 (set_attr "length" "2")])
4473 [(set (match_operand:DI 0 "register_operand" "")
4474 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4475 (match_operand:SI 2 "small_int" "")))
4476 (clobber (match_operand:SI 3 "register_operand" ""))]
4477 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
4478 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
4479 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
4480 && (INTVAL (operands[2]) & 32) != 0"
4482 [(set (subreg:SI (match_dup 0) 0) (ashiftrt:SI (subreg:SI (match_dup 1) 1) (match_dup 2)))
4483 (set (subreg:SI (match_dup 0) 1) (ashiftrt:SI (subreg:SI (match_dup 1) 1) (const_int 31)))]
4485 "operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0x1f);")
4489 [(set (match_operand:DI 0 "register_operand" "")
4490 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4491 (match_operand:SI 2 "small_int" "")))
4492 (clobber (match_operand:SI 3 "register_operand" ""))]
4493 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
4494 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
4495 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
4496 && (INTVAL (operands[2]) & 32) != 0"
4498 [(set (subreg:SI (match_dup 0) 1) (ashiftrt:SI (subreg:SI (match_dup 1) 0) (match_dup 2)))
4499 (set (subreg:SI (match_dup 0) 0) (ashiftrt:SI (subreg:SI (match_dup 1) 0) (const_int 31)))]
4501 "operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0x1f);")
4504 (define_insn "ashrdi3_internal3"
4505 [(set (match_operand:DI 0 "register_operand" "=d")
4506 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
4507 (match_operand:SI 2 "small_int" "IJK")))
4508 (clobber (match_operand:SI 3 "register_operand" "=d"))]
4509 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE
4510 && (INTVAL (operands[2]) & 63) < 32
4511 && (INTVAL (operands[2]) & 63) != 0"
4514 int amount = INTVAL (operands[2]);
4516 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
4517 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
4519 return \"srl\\t%L0,%L1,%2\;sll\\t%3,%M1,%4\;or\\t%L0,%L0,%3\;sra\\t%M0,%M1,%2\";
4521 [(set_attr "type" "darith")
4522 (set_attr "mode" "DI")
4523 (set_attr "length" "4")])
4527 [(set (match_operand:DI 0 "register_operand" "")
4528 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4529 (match_operand:SI 2 "small_int" "")))
4530 (clobber (match_operand:SI 3 "register_operand" ""))]
4531 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
4532 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
4533 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
4534 && (INTVAL (operands[2]) & 63) < 32
4535 && (INTVAL (operands[2]) & 63) != 0"
4537 [(set (subreg:SI (match_dup 0) 0)
4538 (lshiftrt:SI (subreg:SI (match_dup 1) 0)
4542 (ashift:SI (subreg:SI (match_dup 1) 1)
4545 (set (subreg:SI (match_dup 0) 0)
4546 (ior:SI (subreg:SI (match_dup 0) 0)
4549 (set (subreg:SI (match_dup 0) 1)
4550 (ashiftrt:SI (subreg:SI (match_dup 1) 1)
4554 int amount = INTVAL (operands[2]);
4555 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
4556 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
4561 [(set (match_operand:DI 0 "register_operand" "")
4562 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4563 (match_operand:SI 2 "small_int" "")))
4564 (clobber (match_operand:SI 3 "register_operand" ""))]
4565 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
4566 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
4567 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
4568 && (INTVAL (operands[2]) & 63) < 32
4569 && (INTVAL (operands[2]) & 63) != 0"
4571 [(set (subreg:SI (match_dup 0) 1)
4572 (lshiftrt:SI (subreg:SI (match_dup 1) 1)
4576 (ashift:SI (subreg:SI (match_dup 1) 0)
4579 (set (subreg:SI (match_dup 0) 1)
4580 (ior:SI (subreg:SI (match_dup 0) 1)
4583 (set (subreg:SI (match_dup 0) 0)
4584 (ashiftrt:SI (subreg:SI (match_dup 1) 0)
4588 int amount = INTVAL (operands[2]);
4589 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
4590 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
4594 (define_insn "ashrdi3_internal4"
4595 [(set (match_operand:DI 0 "register_operand" "=d")
4596 (ashiftrt:DI (match_operand:DI 1 "se_register_operand" "d")
4597 (match_operand:SI 2 "arith_operand" "dI")))]
4601 if (GET_CODE (operands[2]) == CONST_INT)
4602 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f);
4604 return \"dsra\\t%0,%1,%2\";
4606 [(set_attr "type" "arith")
4607 (set_attr "mode" "DI")
4608 (set_attr "length" "1")])
4611 (define_insn "lshrsi3"
4612 [(set (match_operand:SI 0 "register_operand" "=d")
4613 (lshiftrt:SI (match_operand:SI 1 "register_operand" "d")
4614 (match_operand:SI 2 "arith_operand" "dI")))]
4618 if (GET_CODE (operands[2]) == CONST_INT)
4619 operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0x1f);
4621 return \"srl\\t%0,%1,%2\";
4623 [(set_attr "type" "arith")
4624 (set_attr "mode" "SI")
4625 (set_attr "length" "1")])
4628 (define_expand "lshrdi3"
4629 [(parallel [(set (match_operand:DI 0 "register_operand" "")
4630 (lshiftrt:DI (match_operand:DI 1 "se_register_operand" "")
4631 (match_operand:SI 2 "arith_operand" "")))
4632 (clobber (match_dup 3))])]
4633 "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
4638 emit_insn (gen_lshrdi3_internal4 (operands[0], operands[1],
4643 operands[3] = gen_reg_rtx (SImode);
4647 (define_insn "lshrdi3_internal"
4648 [(set (match_operand:DI 0 "register_operand" "=&d")
4649 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
4650 (match_operand:SI 2 "register_operand" "d")))
4651 (clobber (match_operand:SI 3 "register_operand" "=d"))]
4652 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE"
4655 operands[4] = const0_rtx;
4656 dslots_jump_total += 3;
4657 dslots_jump_filled += 2;
4659 return \"sll\\t%3,%2,26\\n\\
4660 \\tbgez\\t%3,1f\\n\\
4661 \\tsrl\\t%L0,%M1,%2\\n\\
4663 \\tmove\\t%M0,%z4%)\\n\\
4666 \\t%(beq\\t%3,%z4,2f\\n\\
4667 \\tsrl\\t%L0,%L1,%2%)\\n\\
4669 \\tsubu\\t%3,%z4,%2\\n\\
4670 \\tsll\\t%3,%M1,%3\\n\\
4671 \\tor\\t%L0,%L0,%3\\n\\
4673 \\tsrl\\t%M0,%M1,%2\\n\\
4676 [(set_attr "type" "darith")
4677 (set_attr "mode" "DI")
4678 (set_attr "length" "12")])
4681 (define_insn "lshrdi3_internal2"
4682 [(set (match_operand:DI 0 "register_operand" "=d")
4683 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
4684 (match_operand:SI 2 "small_int" "IJK")))
4685 (clobber (match_operand:SI 3 "register_operand" "=d"))]
4686 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && (INTVAL (operands[2]) & 32) != 0"
4689 operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0x1f);
4690 operands[4] = const0_rtx;
4691 return \"srl\\t%L0,%M1,%2\;move\\t%M0,%z4\";
4693 [(set_attr "type" "darith")
4694 (set_attr "mode" "DI")
4695 (set_attr "length" "2")])
4699 [(set (match_operand:DI 0 "register_operand" "")
4700 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
4701 (match_operand:SI 2 "small_int" "")))
4702 (clobber (match_operand:SI 3 "register_operand" ""))]
4703 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
4704 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
4705 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
4706 && (INTVAL (operands[2]) & 32) != 0"
4708 [(set (subreg:SI (match_dup 0) 0) (lshiftrt:SI (subreg:SI (match_dup 1) 1) (match_dup 2)))
4709 (set (subreg:SI (match_dup 0) 1) (const_int 0))]
4711 "operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0x1f);")
4715 [(set (match_operand:DI 0 "register_operand" "")
4716 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
4717 (match_operand:SI 2 "small_int" "")))
4718 (clobber (match_operand:SI 3 "register_operand" ""))]
4719 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
4720 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
4721 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
4722 && (INTVAL (operands[2]) & 32) != 0"
4724 [(set (subreg:SI (match_dup 0) 1) (lshiftrt:SI (subreg:SI (match_dup 1) 0) (match_dup 2)))
4725 (set (subreg:SI (match_dup 0) 0) (const_int 0))]
4727 "operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2]) & 0x1f);")
4730 (define_insn "lshrdi3_internal3"
4731 [(set (match_operand:DI 0 "register_operand" "=d")
4732 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
4733 (match_operand:SI 2 "small_int" "IJK")))
4734 (clobber (match_operand:SI 3 "register_operand" "=d"))]
4735 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE
4736 && (INTVAL (operands[2]) & 63) < 32
4737 && (INTVAL (operands[2]) & 63) != 0"
4740 int amount = INTVAL (operands[2]);
4742 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
4743 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
4745 return \"srl\\t%L0,%L1,%2\;sll\\t%3,%M1,%4\;or\\t%L0,%L0,%3\;srl\\t%M0,%M1,%2\";
4747 [(set_attr "type" "darith")
4748 (set_attr "mode" "DI")
4749 (set_attr "length" "4")])
4753 [(set (match_operand:DI 0 "register_operand" "")
4754 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
4755 (match_operand:SI 2 "small_int" "")))
4756 (clobber (match_operand:SI 3 "register_operand" ""))]
4757 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
4758 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
4759 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
4760 && (INTVAL (operands[2]) & 63) < 32
4761 && (INTVAL (operands[2]) & 63) != 0"
4763 [(set (subreg:SI (match_dup 0) 0)
4764 (lshiftrt:SI (subreg:SI (match_dup 1) 0)
4768 (ashift:SI (subreg:SI (match_dup 1) 1)
4771 (set (subreg:SI (match_dup 0) 0)
4772 (ior:SI (subreg:SI (match_dup 0) 0)
4775 (set (subreg:SI (match_dup 0) 1)
4776 (lshiftrt:SI (subreg:SI (match_dup 1) 1)
4780 int amount = INTVAL (operands[2]);
4781 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
4782 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
4787 [(set (match_operand:DI 0 "register_operand" "")
4788 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
4789 (match_operand:SI 2 "small_int" "")))
4790 (clobber (match_operand:SI 3 "register_operand" ""))]
4791 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
4792 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
4793 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
4794 && (INTVAL (operands[2]) & 63) < 32
4795 && (INTVAL (operands[2]) & 63) != 0"
4797 [(set (subreg:SI (match_dup 0) 1)
4798 (lshiftrt:SI (subreg:SI (match_dup 1) 1)
4802 (ashift:SI (subreg:SI (match_dup 1) 0)
4805 (set (subreg:SI (match_dup 0) 1)
4806 (ior:SI (subreg:SI (match_dup 0) 1)
4809 (set (subreg:SI (match_dup 0) 0)
4810 (lshiftrt:SI (subreg:SI (match_dup 1) 0)
4814 int amount = INTVAL (operands[2]);
4815 operands[2] = gen_rtx (CONST_INT, VOIDmode, (amount & 31));
4816 operands[4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) & 31));
4820 (define_insn "lshrdi3_internal4"
4821 [(set (match_operand:DI 0 "register_operand" "=d")
4822 (lshiftrt:DI (match_operand:DI 1 "se_register_operand" "d")
4823 (match_operand:SI 2 "arith_operand" "dI")))]
4827 if (GET_CODE (operands[2]) == CONST_INT)
4828 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f);
4830 return \"dsrl\\t%0,%1,%2\";
4832 [(set_attr "type" "arith")
4833 (set_attr "mode" "DI")
4834 (set_attr "length" "1")])
4838 ;; ....................
4842 ;; ....................
4844 ;; Flow here is rather complex:
4846 ;; 1) The cmp{si,di,sf,df} routine is called. It deposits the
4847 ;; arguments into the branch_cmp array, and the type into
4848 ;; branch_type. No RTL is generated.
4850 ;; 2) The appropriate branch define_expand is called, which then
4851 ;; creates the appropriate RTL for the comparison and branch.
4852 ;; Different CC modes are used, based on what type of branch is
4853 ;; done, so that we can constrain things appropriately. There
4854 ;; are assumptions in the rest of GCC that break if we fold the
4855 ;; operands into the branchs for integer operations, and use cc0
4856 ;; for floating point, so we use the fp status register instead.
4857 ;; If needed, an appropriate temporary is created to hold the
4858 ;; of the integer compare.
4860 (define_expand "cmpsi"
4862 (compare:CC (match_operand:SI 0 "register_operand" "")
4863 (match_operand:SI 1 "arith_operand" "")))]
4867 if (operands[0]) /* avoid unused code message */
4869 branch_cmp[0] = operands[0];
4870 branch_cmp[1] = operands[1];
4871 branch_type = CMP_SI;
4876 (define_expand "tstsi"
4878 (match_operand:SI 0 "register_operand" ""))]
4882 if (operands[0]) /* avoid unused code message */
4884 branch_cmp[0] = operands[0];
4885 branch_cmp[1] = const0_rtx;
4886 branch_type = CMP_SI;
4891 (define_expand "cmpdi"
4893 (compare:CC (match_operand:DI 0 "se_register_operand" "")
4894 (match_operand:DI 1 "se_arith_operand" "")))]
4898 if (operands[0]) /* avoid unused code message */
4900 branch_cmp[0] = operands[0];
4901 branch_cmp[1] = operands[1];
4902 branch_type = CMP_DI;
4907 (define_expand "tstdi"
4909 (match_operand:DI 0 "se_register_operand" ""))]
4913 if (operands[0]) /* avoid unused code message */
4915 branch_cmp[0] = operands[0];
4916 branch_cmp[1] = const0_rtx;
4917 branch_type = CMP_DI;
4922 (define_expand "cmpdf"
4924 (compare:CC (match_operand:DF 0 "register_operand" "")
4925 (match_operand:DF 1 "register_operand" "")))]
4926 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
4929 if (operands[0]) /* avoid unused code message */
4931 branch_cmp[0] = operands[0];
4932 branch_cmp[1] = operands[1];
4933 branch_type = CMP_DF;
4938 (define_expand "cmpsf"
4940 (compare:CC (match_operand:SF 0 "register_operand" "")
4941 (match_operand:SF 1 "register_operand" "")))]
4945 if (operands[0]) /* avoid unused code message */
4947 branch_cmp[0] = operands[0];
4948 branch_cmp[1] = operands[1];
4949 branch_type = CMP_SF;
4956 ;; ....................
4958 ;; CONDITIONAL BRANCHES
4960 ;; ....................
4962 (define_insn "branch_fp_ne"
4964 (if_then_else (ne:CC (match_operand:CC 0 "register_operand" "z")
4966 (match_operand 1 "pc_or_label_operand" "")
4967 (match_operand 2 "pc_or_label_operand" "")))]
4971 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
4972 return (operands[1] != pc_rtx) ? \"%*bc1t%?\\t%Z0%1\" : \"%*bc1f%?\\t%Z0%2\";
4974 [(set_attr "type" "branch")
4975 (set_attr "mode" "none")
4976 (set_attr "length" "1")])
4978 (define_insn "branch_fp_eq"
4980 (if_then_else (eq:CC (match_operand:CC 0 "register_operand" "z")
4982 (match_operand 1 "pc_or_label_operand" "")
4983 (match_operand 2 "pc_or_label_operand" "")))]
4987 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
4988 return (operands[1] != pc_rtx) ? \"%*bc1f%?\\t%Z0%1\" : \"%*bc1t%?\\t%Z0%2\";
4990 [(set_attr "type" "branch")
4991 (set_attr "mode" "none")
4992 (set_attr "length" "1")])
4994 (define_insn "branch_zero"
4996 (if_then_else (match_operator:SI 0 "cmp_op"
4997 [(match_operand:SI 1 "register_operand" "d")
4999 (match_operand 2 "pc_or_label_operand" "")
5000 (match_operand 3 "pc_or_label_operand" "")))]
5004 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
5005 if (operands[2] != pc_rtx)
5007 switch (GET_CODE (operands[0]))
5009 case EQ: return \"%*beq%?\\t%z1,%.,%2\";
5010 case NE: return \"%*bne%?\\t%z1,%.,%2\";
5011 case GTU: return \"%*bne%?\\t%z1,%.,%2\";
5012 case LEU: return \"%*beq%?\\t%z1,%.,%2\";
5013 case GEU: return \"%*j\\t%2\";
5014 case LTU: return \"%*bne%?\\t%.,%.,%2\";
5017 return \"%*b%C0z%?\\t%z1,%2\";
5020 { /* inverted jump */
5021 switch (GET_CODE (operands[0]))
5023 case EQ: return \"%*bne%?\\t%z1,%.,%3\";
5024 case NE: return \"%*beq%?\\t%z1,%.,%3\";
5025 case GTU: return \"%*beq%?\\t%z1,%.,%3\";
5026 case LEU: return \"%*bne%?\\t%z1,%.,%3\";
5027 case GEU: return \"%*beq%?\\t%.,%.,%3\";
5028 case LTU: return \"%*j\\t%3\";
5031 return \"%*b%N0z%?\\t%z1,%3\";
5034 [(set_attr "type" "branch")
5035 (set_attr "mode" "none")
5036 (set_attr "length" "1")])
5039 (define_insn "branch_zero_di"
5041 (if_then_else (match_operator:DI 0 "cmp_op"
5042 [(match_operand:DI 1 "se_register_operand" "d")
5044 (match_operand 2 "pc_or_label_operand" "")
5045 (match_operand 3 "pc_or_label_operand" "")))]
5049 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
5050 if (operands[2] != pc_rtx)
5052 switch (GET_CODE (operands[0]))
5054 case EQ: return \"%*beq%?\\t%z1,%.,%2\";
5055 case NE: return \"%*bne%?\\t%z1,%.,%2\";
5056 case GTU: return \"%*bne%?\\t%z1,%.,%2\";
5057 case LEU: return \"%*beq%?\\t%z1,%.,%2\";
5058 case GEU: return \"%*j\\t%2\";
5059 case LTU: return \"%*bne%?\\t%.,%.,%2\";
5062 return \"%*b%C0z%?\\t%z1,%2\";
5065 { /* inverted jump */
5066 switch (GET_CODE (operands[0]))
5068 case EQ: return \"%*bne%?\\t%z1,%.,%3\";
5069 case NE: return \"%*beq%?\\t%z1,%.,%3\";
5070 case GTU: return \"%*beq%?\\t%z1,%.,%3\";
5071 case LEU: return \"%*bne%?\\t%z1,%.,%3\";
5072 case GEU: return \"%*beq%?\\t%.,%.,%3\";
5073 case LTU: return \"%*j\\t%3\";
5076 return \"%*b%N0z%?\\t%z1,%3\";
5079 [(set_attr "type" "branch")
5080 (set_attr "mode" "none")
5081 (set_attr "length" "1")])
5084 (define_insn "branch_equality"
5086 (if_then_else (match_operator:SI 0 "equality_op"
5087 [(match_operand:SI 1 "register_operand" "d")
5088 (match_operand:SI 2 "register_operand" "d")])
5089 (match_operand 3 "pc_or_label_operand" "")
5090 (match_operand 4 "pc_or_label_operand" "")))]
5094 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
5095 return (operands[3] != pc_rtx)
5096 ? \"%*b%C0%?\\t%z1,%z2,%3\"
5097 : \"%*b%N0%?\\t%z1,%z2,%4\";
5099 [(set_attr "type" "branch")
5100 (set_attr "mode" "none")
5101 (set_attr "length" "1")])
5104 (define_insn "branch_equality_di"
5106 (if_then_else (match_operator:DI 0 "equality_op"
5107 [(match_operand:DI 1 "se_register_operand" "d")
5108 (match_operand:DI 2 "se_register_operand" "d")])
5109 (match_operand 3 "pc_or_label_operand" "")
5110 (match_operand 4 "pc_or_label_operand" "")))]
5114 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
5115 return (operands[3] != pc_rtx)
5116 ? \"%*b%C0%?\\t%z1,%z2,%3\"
5117 : \"%*b%N0%?\\t%z1,%z2,%4\";
5119 [(set_attr "type" "branch")
5120 (set_attr "mode" "none")
5121 (set_attr "length" "1")])
5124 (define_expand "beq"
5126 (if_then_else (eq:CC (cc0)
5128 (label_ref (match_operand 0 "" ""))
5133 if (operands[0]) /* avoid unused code warning */
5135 gen_conditional_branch (operands, EQ);
5140 (define_expand "bne"
5142 (if_then_else (ne:CC (cc0)
5144 (label_ref (match_operand 0 "" ""))
5149 if (operands[0]) /* avoid unused code warning */
5151 gen_conditional_branch (operands, NE);
5156 (define_expand "bgt"
5158 (if_then_else (gt:CC (cc0)
5160 (label_ref (match_operand 0 "" ""))
5165 if (operands[0]) /* avoid unused code warning */
5167 gen_conditional_branch (operands, GT);
5172 (define_expand "bge"
5174 (if_then_else (ge:CC (cc0)
5176 (label_ref (match_operand 0 "" ""))
5181 if (operands[0]) /* avoid unused code warning */
5183 gen_conditional_branch (operands, GE);
5188 (define_expand "blt"
5190 (if_then_else (lt:CC (cc0)
5192 (label_ref (match_operand 0 "" ""))
5197 if (operands[0]) /* avoid unused code warning */
5199 gen_conditional_branch (operands, LT);
5204 (define_expand "ble"
5206 (if_then_else (le:CC (cc0)
5208 (label_ref (match_operand 0 "" ""))
5213 if (operands[0]) /* avoid unused code warning */
5215 gen_conditional_branch (operands, LE);
5220 (define_expand "bgtu"
5222 (if_then_else (gtu:CC (cc0)
5224 (label_ref (match_operand 0 "" ""))
5229 if (operands[0]) /* avoid unused code warning */
5231 gen_conditional_branch (operands, GTU);
5236 (define_expand "bgeu"
5238 (if_then_else (geu:CC (cc0)
5240 (label_ref (match_operand 0 "" ""))
5245 if (operands[0]) /* avoid unused code warning */
5247 gen_conditional_branch (operands, GEU);
5253 (define_expand "bltu"
5255 (if_then_else (ltu:CC (cc0)
5257 (label_ref (match_operand 0 "" ""))
5262 if (operands[0]) /* avoid unused code warning */
5264 gen_conditional_branch (operands, LTU);
5269 (define_expand "bleu"
5271 (if_then_else (leu:CC (cc0)
5273 (label_ref (match_operand 0 "" ""))
5278 if (operands[0]) /* avoid unused code warning */
5280 gen_conditional_branch (operands, LEU);
5287 ;; ....................
5289 ;; SETTING A REGISTER FROM A COMPARISON
5291 ;; ....................
5293 (define_expand "seq"
5294 [(set (match_operand:SI 0 "register_operand" "=d")
5295 (eq:SI (match_dup 1)
5300 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
5303 /* set up operands from compare. */
5304 operands[1] = branch_cmp[0];
5305 operands[2] = branch_cmp[1];
5307 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
5309 gen_int_relational (EQ, operands[0], operands[1], operands[2], (int *)0);
5313 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
5314 operands[2] = force_reg (SImode, operands[2]);
5316 /* fall through and generate default code */
5320 (define_insn "seq_si_zero"
5321 [(set (match_operand:SI 0 "register_operand" "=d")
5322 (eq:SI (match_operand:SI 1 "register_operand" "d")
5326 [(set_attr "type" "arith")
5327 (set_attr "mode" "SI")
5328 (set_attr "length" "1")])
5330 (define_insn "seq_di_zero"
5331 [(set (match_operand:DI 0 "register_operand" "=d")
5332 (eq:DI (match_operand:DI 1 "se_register_operand" "d")
5336 [(set_attr "type" "arith")
5337 (set_attr "mode" "DI")
5338 (set_attr "length" "1")])
5340 (define_insn "seq_si"
5341 [(set (match_operand:SI 0 "register_operand" "=d,d")
5342 (eq:SI (match_operand:SI 1 "register_operand" "%d,d")
5343 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
5344 "TARGET_DEBUG_C_MODE"
5346 xor\\t%0,%1,%2\;sltu\\t%0,%0,1
5347 xori\\t%0,%1,%2\;sltu\\t%0,%0,1"
5348 [(set_attr "type" "arith")
5349 (set_attr "mode" "SI")
5350 (set_attr "length" "2")])
5353 [(set (match_operand:SI 0 "register_operand" "")
5354 (eq:SI (match_operand:SI 1 "register_operand" "")
5355 (match_operand:SI 2 "uns_arith_operand" "")))]
5356 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE
5357 && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)"
5359 (xor:SI (match_dup 1)
5362 (ltu:SI (match_dup 0)
5366 (define_insn "seq_di"
5367 [(set (match_operand:DI 0 "register_operand" "=d,d")
5368 (eq:DI (match_operand:DI 1 "se_register_operand" "%d,d")
5369 (match_operand:DI 2 "se_uns_arith_operand" "d,K")))]
5370 "TARGET_64BIT && TARGET_DEBUG_C_MODE"
5372 xor\\t%0,%1,%2\;sltu\\t%0,%0,1
5373 xori\\t%0,%1,%2\;sltu\\t%0,%0,1"
5374 [(set_attr "type" "arith")
5375 (set_attr "mode" "DI")
5376 (set_attr "length" "2")])
5379 [(set (match_operand:DI 0 "register_operand" "")
5380 (eq:DI (match_operand:DI 1 "se_register_operand" "")
5381 (match_operand:DI 2 "se_uns_arith_operand" "")))]
5382 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE
5383 && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)"
5385 (xor:DI (match_dup 1)
5388 (ltu:DI (match_dup 0)
5392 (define_expand "sne"
5393 [(set (match_operand:SI 0 "register_operand" "=d")
5394 (ne:SI (match_dup 1)
5399 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
5402 /* set up operands from compare. */
5403 operands[1] = branch_cmp[0];
5404 operands[2] = branch_cmp[1];
5406 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
5408 gen_int_relational (NE, operands[0], operands[1], operands[2], (int *)0);
5412 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
5413 operands[2] = force_reg (SImode, operands[2]);
5415 /* fall through and generate default code */
5418 (define_insn "sne_si_zero"
5419 [(set (match_operand:SI 0 "register_operand" "=d")
5420 (ne:SI (match_operand:SI 1 "register_operand" "d")
5424 [(set_attr "type" "arith")
5425 (set_attr "mode" "SI")
5426 (set_attr "length" "1")])
5428 (define_insn "sne_di_zero"
5429 [(set (match_operand:DI 0 "register_operand" "=d")
5430 (ne:DI (match_operand:DI 1 "se_register_operand" "d")
5434 [(set_attr "type" "arith")
5435 (set_attr "mode" "DI")
5436 (set_attr "length" "1")])
5438 (define_insn "sne_si"
5439 [(set (match_operand:SI 0 "register_operand" "=d,d")
5440 (ne:SI (match_operand:SI 1 "register_operand" "%d,d")
5441 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
5442 "TARGET_DEBUG_C_MODE"
5444 xor\\t%0,%1,%2\;sltu\\t%0,%.,%0
5445 xori\\t%0,%1,%x2\;sltu\\t%0,%.,%0"
5446 [(set_attr "type" "arith")
5447 (set_attr "mode" "SI")
5448 (set_attr "length" "2")])
5451 [(set (match_operand:SI 0 "register_operand" "")
5452 (ne:SI (match_operand:SI 1 "register_operand" "")
5453 (match_operand:SI 2 "uns_arith_operand" "")))]
5454 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE
5455 && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)"
5457 (xor:SI (match_dup 1)
5460 (gtu:SI (match_dup 0)
5464 (define_insn "sne_di"
5465 [(set (match_operand:DI 0 "register_operand" "=d,d")
5466 (ne:DI (match_operand:DI 1 "se_register_operand" "%d,d")
5467 (match_operand:DI 2 "se_uns_arith_operand" "d,K")))]
5468 "TARGET_64BIT && TARGET_DEBUG_C_MODE"
5470 xor\\t%0,%1,%2\;sltu\\t%0,%.,%0
5471 xori\\t%0,%1,%x2\;sltu\\t%0,%.,%0"
5472 [(set_attr "type" "arith")
5473 (set_attr "mode" "DI")
5474 (set_attr "length" "2")])
5477 [(set (match_operand:DI 0 "register_operand" "")
5478 (ne:DI (match_operand:DI 1 "se_register_operand" "")
5479 (match_operand:DI 2 "se_uns_arith_operand" "")))]
5480 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE
5481 && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)"
5483 (xor:DI (match_dup 1)
5486 (gtu:DI (match_dup 0)
5490 (define_expand "sgt"
5491 [(set (match_operand:SI 0 "register_operand" "=d")
5492 (gt:SI (match_dup 1)
5497 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
5500 /* set up operands from compare. */
5501 operands[1] = branch_cmp[0];
5502 operands[2] = branch_cmp[1];
5504 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
5506 gen_int_relational (GT, operands[0], operands[1], operands[2], (int *)0);
5510 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) != 0)
5511 operands[2] = force_reg (SImode, operands[2]);
5513 /* fall through and generate default code */
5516 (define_insn "sgt_si"
5517 [(set (match_operand:SI 0 "register_operand" "=d")
5518 (gt:SI (match_operand:SI 1 "register_operand" "d")
5519 (match_operand:SI 2 "reg_or_0_operand" "dJ")))]
5522 [(set_attr "type" "arith")
5523 (set_attr "mode" "SI")
5524 (set_attr "length" "1")])
5526 (define_insn "sgt_di"
5527 [(set (match_operand:DI 0 "register_operand" "=d")
5528 (gt:DI (match_operand:DI 1 "se_register_operand" "d")
5529 (match_operand:DI 2 "se_reg_or_0_operand" "dJ")))]
5532 [(set_attr "type" "arith")
5533 (set_attr "mode" "DI")
5534 (set_attr "length" "1")])
5536 (define_expand "sge"
5537 [(set (match_operand:SI 0 "register_operand" "=d")
5538 (ge:SI (match_dup 1)
5543 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
5546 /* set up operands from compare. */
5547 operands[1] = branch_cmp[0];
5548 operands[2] = branch_cmp[1];
5550 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
5552 gen_int_relational (GE, operands[0], operands[1], operands[2], (int *)0);
5556 /* fall through and generate default code */
5559 (define_insn "sge_si"
5560 [(set (match_operand:SI 0 "register_operand" "=d")
5561 (ge:SI (match_operand:SI 1 "register_operand" "d")
5562 (match_operand:SI 2 "arith_operand" "dI")))]
5563 "TARGET_DEBUG_C_MODE"
5564 "slt\\t%0,%1,%2\;xori\\t%0,%0,0x0001"
5565 [(set_attr "type" "arith")
5566 (set_attr "mode" "SI")
5567 (set_attr "length" "2")])
5570 [(set (match_operand:SI 0 "register_operand" "")
5571 (ge:SI (match_operand:SI 1 "register_operand" "")
5572 (match_operand:SI 2 "arith_operand" "")))]
5573 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
5575 (lt:SI (match_dup 1)
5578 (xor:SI (match_dup 0)
5582 (define_insn "sge_di"
5583 [(set (match_operand:DI 0 "register_operand" "=d")
5584 (ge:DI (match_operand:DI 1 "se_register_operand" "d")
5585 (match_operand:DI 2 "se_arith_operand" "dI")))]
5586 "TARGET_64BIT && TARGET_DEBUG_C_MODE"
5587 "slt\\t%0,%1,%2\;xori\\t%0,%0,0x0001"
5588 [(set_attr "type" "arith")
5589 (set_attr "mode" "DI")
5590 (set_attr "length" "2")])
5593 [(set (match_operand:DI 0 "register_operand" "")
5594 (ge:DI (match_operand:DI 1 "se_register_operand" "")
5595 (match_operand:DI 2 "se_arith_operand" "")))]
5596 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
5598 (lt:DI (match_dup 1)
5601 (xor:DI (match_dup 0)
5605 (define_expand "slt"
5606 [(set (match_operand:SI 0 "register_operand" "=d")
5607 (lt:SI (match_dup 1)
5612 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
5615 /* set up operands from compare. */
5616 operands[1] = branch_cmp[0];
5617 operands[2] = branch_cmp[1];
5619 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
5621 gen_int_relational (LT, operands[0], operands[1], operands[2], (int *)0);
5625 /* fall through and generate default code */
5628 (define_insn "slt_si"
5629 [(set (match_operand:SI 0 "register_operand" "=d")
5630 (lt:SI (match_operand:SI 1 "register_operand" "d")
5631 (match_operand:SI 2 "arith_operand" "dI")))]
5634 [(set_attr "type" "arith")
5635 (set_attr "mode" "SI")
5636 (set_attr "length" "1")])
5638 (define_insn "slt_di"
5639 [(set (match_operand:DI 0 "register_operand" "=d")
5640 (lt:DI (match_operand:DI 1 "se_register_operand" "d")
5641 (match_operand:DI 2 "se_arith_operand" "dI")))]
5644 [(set_attr "type" "arith")
5645 (set_attr "mode" "DI")
5646 (set_attr "length" "1")])
5648 (define_expand "sle"
5649 [(set (match_operand:SI 0 "register_operand" "=d")
5650 (le:SI (match_dup 1)
5655 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
5658 /* set up operands from compare. */
5659 operands[1] = branch_cmp[0];
5660 operands[2] = branch_cmp[1];
5662 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
5664 gen_int_relational (LE, operands[0], operands[1], operands[2], (int *)0);
5668 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 32767)
5669 operands[2] = force_reg (SImode, operands[2]);
5671 /* fall through and generate default code */
5674 (define_insn "sle_si_const"
5675 [(set (match_operand:SI 0 "register_operand" "=d")
5676 (le:SI (match_operand:SI 1 "register_operand" "d")
5677 (match_operand:SI 2 "small_int" "I")))]
5678 "INTVAL (operands[2]) < 32767"
5681 operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2])+1);
5682 return \"slt\\t%0,%1,%2\";
5684 [(set_attr "type" "arith")
5685 (set_attr "mode" "SI")
5686 (set_attr "length" "1")])
5688 (define_insn "sle_di_const"
5689 [(set (match_operand:DI 0 "register_operand" "=d")
5690 (le:DI (match_operand:DI 1 "se_register_operand" "d")
5691 (match_operand:DI 2 "small_int" "I")))]
5692 "TARGET_64BIT && INTVAL (operands[2]) < 32767"
5695 operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2])+1);
5696 return \"slt\\t%0,%1,%2\";
5698 [(set_attr "type" "arith")
5699 (set_attr "mode" "DI")
5700 (set_attr "length" "1")])
5702 (define_insn "sle_si_reg"
5703 [(set (match_operand:SI 0 "register_operand" "=d")
5704 (le:SI (match_operand:SI 1 "register_operand" "d")
5705 (match_operand:SI 2 "register_operand" "d")))]
5706 "TARGET_DEBUG_C_MODE"
5707 "slt\\t%0,%z2,%1\;xori\\t%0,%0,0x0001"
5708 [(set_attr "type" "arith")
5709 (set_attr "mode" "SI")
5710 (set_attr "length" "2")])
5713 [(set (match_operand:SI 0 "register_operand" "")
5714 (le:SI (match_operand:SI 1 "register_operand" "")
5715 (match_operand:SI 2 "register_operand" "")))]
5716 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
5718 (lt:SI (match_dup 2)
5721 (xor:SI (match_dup 0)
5725 (define_insn "sle_di_reg"
5726 [(set (match_operand:DI 0 "register_operand" "=d")
5727 (le:DI (match_operand:DI 1 "se_register_operand" "d")
5728 (match_operand:DI 2 "se_register_operand" "d")))]
5729 "TARGET_64BIT && TARGET_DEBUG_C_MODE"
5730 "slt\\t%0,%z2,%1\;xori\\t%0,%0,0x0001"
5731 [(set_attr "type" "arith")
5732 (set_attr "mode" "DI")
5733 (set_attr "length" "2")])
5736 [(set (match_operand:DI 0 "register_operand" "")
5737 (le:DI (match_operand:DI 1 "se_register_operand" "")
5738 (match_operand:DI 2 "se_register_operand" "")))]
5739 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
5741 (lt:DI (match_dup 2)
5744 (xor:DI (match_dup 0)
5748 (define_expand "sgtu"
5749 [(set (match_operand:SI 0 "register_operand" "=d")
5750 (gtu:SI (match_dup 1)
5755 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
5758 /* set up operands from compare. */
5759 operands[1] = branch_cmp[0];
5760 operands[2] = branch_cmp[1];
5762 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
5764 gen_int_relational (GTU, operands[0], operands[1], operands[2], (int *)0);
5768 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) != 0)
5769 operands[2] = force_reg (SImode, operands[2]);
5771 /* fall through and generate default code */
5774 (define_insn "sgtu_si"
5775 [(set (match_operand:SI 0 "register_operand" "=d")
5776 (gtu:SI (match_operand:SI 1 "register_operand" "d")
5777 (match_operand:SI 2 "reg_or_0_operand" "dJ")))]
5780 [(set_attr "type" "arith")
5781 (set_attr "mode" "SI")
5782 (set_attr "length" "1")])
5784 (define_insn "sgtu_di"
5785 [(set (match_operand:DI 0 "register_operand" "=d")
5786 (gtu:DI (match_operand:DI 1 "se_register_operand" "d")
5787 (match_operand:DI 2 "se_reg_or_0_operand" "dJ")))]
5790 [(set_attr "type" "arith")
5791 (set_attr "mode" "DI")
5792 (set_attr "length" "1")])
5794 (define_expand "sgeu"
5795 [(set (match_operand:SI 0 "register_operand" "=d")
5796 (geu:SI (match_dup 1)
5801 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
5804 /* set up operands from compare. */
5805 operands[1] = branch_cmp[0];
5806 operands[2] = branch_cmp[1];
5808 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
5810 gen_int_relational (GEU, operands[0], operands[1], operands[2], (int *)0);
5814 /* fall through and generate default code */
5817 (define_insn "sgeu_si"
5818 [(set (match_operand:SI 0 "register_operand" "=d")
5819 (geu:SI (match_operand:SI 1 "register_operand" "d")
5820 (match_operand:SI 2 "arith_operand" "dI")))]
5821 "TARGET_DEBUG_C_MODE"
5822 "sltu\\t%0,%1,%2\;xori\\t%0,%0,0x0001"
5823 [(set_attr "type" "arith")
5824 (set_attr "mode" "SI")
5825 (set_attr "length" "2")])
5828 [(set (match_operand:SI 0 "register_operand" "")
5829 (geu:SI (match_operand:SI 1 "register_operand" "")
5830 (match_operand:SI 2 "arith_operand" "")))]
5831 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
5833 (ltu:SI (match_dup 1)
5836 (xor:SI (match_dup 0)
5840 (define_insn "sgeu_di"
5841 [(set (match_operand:DI 0 "register_operand" "=d")
5842 (geu:DI (match_operand:DI 1 "se_register_operand" "d")
5843 (match_operand:DI 2 "se_arith_operand" "dI")))]
5844 "TARGET_64BIT && TARGET_DEBUG_C_MODE"
5845 "sltu\\t%0,%1,%2\;xori\\t%0,%0,0x0001"
5846 [(set_attr "type" "arith")
5847 (set_attr "mode" "DI")
5848 (set_attr "length" "2")])
5851 [(set (match_operand:DI 0 "register_operand" "")
5852 (geu:DI (match_operand:DI 1 "se_register_operand" "")
5853 (match_operand:DI 2 "se_arith_operand" "")))]
5854 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
5856 (ltu:DI (match_dup 1)
5859 (xor:DI (match_dup 0)
5863 (define_expand "sltu"
5864 [(set (match_operand:SI 0 "register_operand" "=d")
5865 (ltu:SI (match_dup 1)
5870 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
5873 /* set up operands from compare. */
5874 operands[1] = branch_cmp[0];
5875 operands[2] = branch_cmp[1];
5877 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
5879 gen_int_relational (LTU, operands[0], operands[1], operands[2], (int *)0);
5883 /* fall through and generate default code */
5886 (define_insn "sltu_si"
5887 [(set (match_operand:SI 0 "register_operand" "=d")
5888 (ltu:SI (match_operand:SI 1 "register_operand" "d")
5889 (match_operand:SI 2 "arith_operand" "dI")))]
5892 [(set_attr "type" "arith")
5893 (set_attr "mode" "SI")
5894 (set_attr "length" "1")])
5896 (define_insn "sltu_di"
5897 [(set (match_operand:DI 0 "register_operand" "=d")
5898 (ltu:DI (match_operand:DI 1 "se_register_operand" "d")
5899 (match_operand:DI 2 "se_arith_operand" "dI")))]
5902 [(set_attr "type" "arith")
5903 (set_attr "mode" "DI")
5904 (set_attr "length" "1")])
5906 (define_expand "sleu"
5907 [(set (match_operand:SI 0 "register_operand" "=d")
5908 (leu:SI (match_dup 1)
5913 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
5916 /* set up operands from compare. */
5917 operands[1] = branch_cmp[0];
5918 operands[2] = branch_cmp[1];
5920 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
5922 gen_int_relational (LEU, operands[0], operands[1], operands[2], (int *)0);
5926 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 32767)
5927 operands[2] = force_reg (SImode, operands[2]);
5929 /* fall through and generate default code */
5932 (define_insn "sleu_si_const"
5933 [(set (match_operand:SI 0 "register_operand" "=d")
5934 (leu:SI (match_operand:SI 1 "register_operand" "d")
5935 (match_operand:SI 2 "small_int" "I")))]
5936 "INTVAL (operands[2]) < 32767"
5939 operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2])+1);
5940 return \"sltu\\t%0,%1,%2\";
5942 [(set_attr "type" "arith")
5943 (set_attr "mode" "SI")
5944 (set_attr "length" "1")])
5946 (define_insn "sleu_di_const"
5947 [(set (match_operand:DI 0 "register_operand" "=d")
5948 (leu:DI (match_operand:DI 1 "se_register_operand" "d")
5949 (match_operand:DI 2 "small_int" "I")))]
5950 "TARGET_64BIT && INTVAL (operands[2]) < 32767"
5953 operands[2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[2])+1);
5954 return \"sltu\\t%0,%1,%2\";
5956 [(set_attr "type" "arith")
5957 (set_attr "mode" "DI")
5958 (set_attr "length" "1")])
5960 (define_insn "sleu_si_reg"
5961 [(set (match_operand:SI 0 "register_operand" "=d")
5962 (leu:SI (match_operand:SI 1 "register_operand" "d")
5963 (match_operand:SI 2 "register_operand" "d")))]
5964 "TARGET_DEBUG_C_MODE"
5965 "sltu\\t%0,%z2,%1\;xori\\t%0,%0,0x0001"
5966 [(set_attr "type" "arith")
5967 (set_attr "mode" "SI")
5968 (set_attr "length" "2")])
5971 [(set (match_operand:SI 0 "register_operand" "")
5972 (leu:SI (match_operand:SI 1 "register_operand" "")
5973 (match_operand:SI 2 "register_operand" "")))]
5974 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
5976 (ltu:SI (match_dup 2)
5979 (xor:SI (match_dup 0)
5983 (define_insn "sleu_di_reg"
5984 [(set (match_operand:DI 0 "register_operand" "=d")
5985 (leu:DI (match_operand:DI 1 "se_register_operand" "d")
5986 (match_operand:DI 2 "se_register_operand" "d")))]
5987 "TARGET_64BIT && TARGET_DEBUG_C_MODE"
5988 "sltu\\t%0,%z2,%1\;xori\\t%0,%0,0x0001"
5989 [(set_attr "type" "arith")
5990 (set_attr "mode" "DI")
5991 (set_attr "length" "2")])
5994 [(set (match_operand:DI 0 "register_operand" "")
5995 (leu:DI (match_operand:DI 1 "se_register_operand" "")
5996 (match_operand:DI 2 "se_register_operand" "")))]
5997 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE"
5999 (ltu:DI (match_dup 2)
6002 (xor:DI (match_dup 0)
6008 ;; ....................
6010 ;; FLOATING POINT COMPARISONS
6012 ;; ....................
6014 (define_insn "seq_df"
6015 [(set (match_operand:CC 0 "register_operand" "=z")
6016 (eq:CC (match_operand:DF 1 "register_operand" "f")
6017 (match_operand:DF 2 "register_operand" "f")))]
6018 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
6021 return mips_fill_delay_slot (\"c.eq.d\\t%Z0%1,%2\", DELAY_FCMP, operands, insn);
6023 [(set_attr "type" "fcmp")
6024 (set_attr "mode" "FPSW")
6025 (set_attr "length" "1")])
6027 (define_insn "slt_df"
6028 [(set (match_operand:CC 0 "register_operand" "=z")
6029 (lt:CC (match_operand:DF 1 "register_operand" "f")
6030 (match_operand:DF 2 "register_operand" "f")))]
6031 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
6034 return mips_fill_delay_slot (\"c.lt.d\\t%Z0%1,%2\", DELAY_FCMP, operands, insn);
6036 [(set_attr "type" "fcmp")
6037 (set_attr "mode" "FPSW")
6038 (set_attr "length" "1")])
6040 (define_insn "sle_df"
6041 [(set (match_operand:CC 0 "register_operand" "=z")
6042 (le:CC (match_operand:DF 1 "register_operand" "f")
6043 (match_operand:DF 2 "register_operand" "f")))]
6044 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
6047 return mips_fill_delay_slot (\"c.le.d\\t%Z0%1,%2\", DELAY_FCMP, operands, insn);
6049 [(set_attr "type" "fcmp")
6050 (set_attr "mode" "FPSW")
6051 (set_attr "length" "1")])
6053 (define_insn "sgt_df"
6054 [(set (match_operand:CC 0 "register_operand" "=z")
6055 (gt:CC (match_operand:DF 1 "register_operand" "f")
6056 (match_operand:DF 2 "register_operand" "f")))]
6057 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
6060 return mips_fill_delay_slot (\"c.lt.d\\t%Z0%2,%1\", DELAY_FCMP, operands, insn);
6062 [(set_attr "type" "fcmp")
6063 (set_attr "mode" "FPSW")
6064 (set_attr "length" "1")])
6066 (define_insn "sge_df"
6067 [(set (match_operand:CC 0 "register_operand" "=z")
6068 (ge:CC (match_operand:DF 1 "register_operand" "f")
6069 (match_operand:DF 2 "register_operand" "f")))]
6070 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
6073 return mips_fill_delay_slot (\"c.le.d\\t%Z0%2,%1\", DELAY_FCMP, operands, insn);
6075 [(set_attr "type" "fcmp")
6076 (set_attr "mode" "FPSW")
6077 (set_attr "length" "1")])
6079 (define_insn "seq_sf"
6080 [(set (match_operand:CC 0 "register_operand" "=z")
6081 (eq:CC (match_operand:SF 1 "register_operand" "f")
6082 (match_operand:SF 2 "register_operand" "f")))]
6086 return mips_fill_delay_slot (\"c.eq.s\\t%Z0%1,%2\", DELAY_FCMP, operands, insn);
6088 [(set_attr "type" "fcmp")
6089 (set_attr "mode" "FPSW")
6090 (set_attr "length" "1")])
6092 (define_insn "slt_sf"
6093 [(set (match_operand:CC 0 "register_operand" "=z")
6094 (lt:CC (match_operand:SF 1 "register_operand" "f")
6095 (match_operand:SF 2 "register_operand" "f")))]
6099 return mips_fill_delay_slot (\"c.lt.s\\t%Z0%1,%2\", DELAY_FCMP, operands, insn);
6101 [(set_attr "type" "fcmp")
6102 (set_attr "mode" "FPSW")
6103 (set_attr "length" "1")])
6105 (define_insn "sle_sf"
6106 [(set (match_operand:CC 0 "register_operand" "=z")
6107 (le:CC (match_operand:SF 1 "register_operand" "f")
6108 (match_operand:SF 2 "register_operand" "f")))]
6112 return mips_fill_delay_slot (\"c.le.s\\t%Z0%1,%2\", DELAY_FCMP, operands, insn);
6114 [(set_attr "type" "fcmp")
6115 (set_attr "mode" "FPSW")
6116 (set_attr "length" "1")])
6118 (define_insn "sgt_sf"
6119 [(set (match_operand:CC 0 "register_operand" "=z")
6120 (gt:CC (match_operand:SF 1 "register_operand" "f")
6121 (match_operand:SF 2 "register_operand" "f")))]
6125 return mips_fill_delay_slot (\"c.lt.s\\t%Z0%2,%1\", DELAY_FCMP, operands, insn);
6127 [(set_attr "type" "fcmp")
6128 (set_attr "mode" "FPSW")
6129 (set_attr "length" "1")])
6131 (define_insn "sge_sf"
6132 [(set (match_operand:CC 0 "register_operand" "=z")
6133 (ge:CC (match_operand:SF 1 "register_operand" "f")
6134 (match_operand:SF 2 "register_operand" "f")))]
6138 return mips_fill_delay_slot (\"c.le.s\\t%Z0%2,%1\", DELAY_FCMP, operands, insn);
6140 [(set_attr "type" "fcmp")
6141 (set_attr "mode" "FPSW")
6142 (set_attr "length" "1")])
6146 ;; ....................
6148 ;; UNCONDITIONAL BRANCHES
6150 ;; ....................
6152 ;; Unconditional branches.
6156 (label_ref (match_operand 0 "" "")))]
6160 if (GET_CODE (operands[0]) == REG)
6161 return \"%*j\\t%0\";
6162 /* ??? I don't know why this is necessary. This works around an
6163 assembler problem that appears when a label is defined, then referenced
6164 in a switch table, then used in a `j' instruction. */
6165 else if (mips_abi != ABI_32)
6166 return \"%*b\\t%l0\";
6168 return \"%*j\\t%l0\";
6170 [(set_attr "type" "jump")
6171 (set_attr "mode" "none")
6172 (set_attr "length" "1")])
6174 (define_expand "indirect_jump"
6175 [(set (pc) (match_operand 0 "register_operand" "d"))]
6181 if (operands[0]) /* eliminate unused code warnings */
6184 if (GET_CODE (dest) != REG || GET_MODE (dest) != Pmode)
6185 operands[0] = copy_to_mode_reg (Pmode, dest);
6188 emit_jump_insn (gen_indirect_jump_internal1 (operands[0]));
6190 emit_jump_insn (gen_indirect_jump_internal2 (operands[0]));
6196 (define_insn "indirect_jump_internal1"
6197 [(set (pc) (match_operand:SI 0 "register_operand" "d"))]
6200 [(set_attr "type" "jump")
6201 (set_attr "mode" "none")
6202 (set_attr "length" "1")])
6204 (define_insn "indirect_jump_internal2"
6205 [(set (pc) (match_operand:DI 0 "se_register_operand" "d"))]
6208 [(set_attr "type" "jump")
6209 (set_attr "mode" "none")
6210 (set_attr "length" "1")])
6212 (define_expand "tablejump"
6214 (match_operand 0 "register_operand" "d"))
6215 (use (label_ref (match_operand 1 "" "")))]
6221 if (operands[0]) /* eliminate unused code warnings */
6223 if (GET_MODE (operands[0]) != Pmode)
6229 emit_jump_insn (gen_tablejump_internal1 (operands[0], operands[1]));
6231 emit_jump_insn (gen_tablejump_internal2 (operands[0], operands[1]));
6236 emit_jump_insn (gen_tablejump_internal3 (operands[0], operands[1]));
6238 emit_jump_insn (gen_tablejump_internal4 (operands[0], operands[1]));
6245 (define_insn "tablejump_internal1"
6247 (match_operand:SI 0 "register_operand" "d"))
6248 (use (label_ref (match_operand 1 "" "")))]
6251 [(set_attr "type" "jump")
6252 (set_attr "mode" "none")
6253 (set_attr "length" "1")])
6255 (define_insn "tablejump_internal2"
6257 (match_operand:DI 0 "se_register_operand" "d"))
6258 (use (label_ref (match_operand 1 "" "")))]
6261 [(set_attr "type" "jump")
6262 (set_attr "mode" "none")
6263 (set_attr "length" "1")])
6265 (define_expand "tablejump_internal3"
6267 (plus:SI (match_operand:SI 0 "register_operand" "d")
6268 (label_ref:SI (match_operand:SI 1 "" ""))))]
6272 ;;; Make sure that this only matches the insn before ADDR_DIFF_VEC. Otherwise
6273 ;;; it is not valid.
6275 ;;; ??? The length depends on the ABI. It is two for o32, and one for n32.
6276 ;;; We just use the conservative number here.
6280 (plus:SI (match_operand:SI 0 "register_operand" "d")
6281 (label_ref:SI (match_operand:SI 1 "" ""))))]
6282 "!TARGET_LONG64 && next_active_insn (insn) != 0
6283 && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
6284 && PREV_INSN (next_active_insn (insn)) == operands[1]"
6287 /* .cpadd expands to add REG,REG,$gp when pic, and nothing when not pic. */
6288 if (mips_abi == ABI_32)
6289 output_asm_insn (\".cpadd\\t%0\", operands);
6290 return \"%*j\\t%0\";
6292 [(set_attr "type" "jump")
6293 (set_attr "mode" "none")
6294 (set_attr "length" "2")])
6296 (define_expand "tablejump_internal4"
6298 (plus:DI (match_operand:DI 0 "se_register_operand" "d")
6299 (label_ref:DI (match_operand:SI 1 "" ""))))]
6303 ;;; Make sure that this only matches the insn before ADDR_DIFF_VEC. Otherwise
6304 ;;; it is not valid.
6308 (plus:DI (match_operand:DI 0 "se_register_operand" "d")
6309 (label_ref:DI (match_operand:SI 1 "" ""))))]
6310 "TARGET_LONG64 && next_active_insn (insn) != 0
6311 && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
6312 && PREV_INSN (next_active_insn (insn)) == operands[1]"
6314 [(set_attr "type" "jump")
6315 (set_attr "mode" "none")
6316 (set_attr "length" "1")])
6318 ;; Implement a switch statement when generating embedded PIC code.
6319 ;; Switches are implemented by `tablejump' when not using -membedded-pic.
6321 (define_expand "casesi"
6323 (minus:SI (match_operand:SI 0 "register_operand" "d")
6324 (match_operand:SI 1 "arith_operand" "dI")))
6326 (compare:CC (match_dup 5)
6327 (match_operand:SI 2 "arith_operand" "")))
6329 (if_then_else (gtu (cc0)
6331 (label_ref (match_operand 4 "" ""))
6335 (mem:SI (plus:SI (mult:SI (match_dup 5)
6337 (label_ref (match_operand 3 "" "")))))
6338 (clobber (match_scratch:SI 6 ""))
6339 (clobber (reg:SI 31))])]
6340 "TARGET_EMBEDDED_PIC"
6343 /* We need slightly different code for eight byte table entries. */
6349 rtx reg = gen_reg_rtx (SImode);
6351 /* If the index is too large, go to the default label. */
6352 emit_insn (gen_subsi3 (reg, operands[0], operands[1]));
6353 emit_insn (gen_cmpsi (reg, operands[2]));
6354 emit_insn (gen_bgtu (operands[4]));
6356 /* Do the PIC jump. */
6357 emit_insn (gen_casesi_internal (reg, operands[3], gen_reg_rtx (SImode)));
6363 ;; An embedded PIC switch statement looks like this:
6365 ;; sll $reg,$index,2
6367 ;; addu $reg,$reg,$31
6368 ;; lw $reg,$L1-$LS1($reg)
6369 ;; addu $reg,$reg,$31
6376 (define_insn "casesi_internal"
6378 (mem:SI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "d")
6380 (label_ref (match_operand 1 "" "")))))
6381 (clobber (match_operand:SI 2 "register_operand" "d"))
6382 (clobber (reg:SI 31))]
6383 "TARGET_EMBEDDED_PIC"
6386 output_asm_insn (\"%(bal\\t%S1\;sll\\t%0,2\\n%S1:\", operands);
6387 output_asm_insn (\"addu\\t%0,%0,$31%)\", operands);
6388 output_asm_insn (\"lw\\t%0,%1-%S1(%0)\;addu\\t%0,%0,$31\", operands);
6391 [(set_attr "type" "jump")
6392 (set_attr "mode" "none")
6393 (set_attr "length" "6")])
6397 ;; ....................
6399 ;; Function prologue/epilogue
6401 ;; ....................
6404 (define_expand "prologue"
6409 if (mips_isa >= 0) /* avoid unused code warnings */
6411 mips_expand_prologue ();
6416 ;; Block any insns from being moved before this point, since the
6417 ;; profiling call to mcount can use various registers that aren't
6418 ;; saved or used to pass arguments.
6420 (define_insn "blockage"
6421 [(unspec_volatile [(const_int 0)] 0)]
6424 [(set_attr "type" "unknown")
6425 (set_attr "mode" "none")
6426 (set_attr "length" "0")])
6428 (define_expand "epilogue"
6433 if (mips_isa >= 0) /* avoid unused code warnings */
6435 mips_expand_epilogue ();
6440 ;; Trivial return. Make it look like a normal return insn as that
6441 ;; allows jump optimizations to work better .
6442 (define_insn "return"
6444 "mips_can_use_return_insn ()"
6446 [(set_attr "type" "jump")
6447 (set_attr "mode" "none")
6448 (set_attr "length" "1")])
6451 (define_insn "return_internal"
6456 [(set_attr "type" "jump")
6457 (set_attr "mode" "none")
6458 (set_attr "length" "1")])
6460 ;; When generating embedded PIC code we need to get the address of the
6461 ;; current function. This specialized instruction does just that.
6463 (define_insn "get_fnaddr"
6464 [(set (match_operand 0 "register_operand" "=d")
6465 (unspec [(match_operand 1 "" "")] 1))
6466 (clobber (reg:SI 31))]
6467 "TARGET_EMBEDDED_PIC
6468 && GET_CODE (operands[1]) == SYMBOL_REF"
6469 "%($LF%= = . + 8\;bal\\t$LF%=\;la\\t%0,%1-$LF%=%)\;addu\\t%0,%0,$31"
6470 [(set_attr "type" "call")
6471 (set_attr "mode" "none")
6472 (set_attr "length" "4")])
6476 ;; ....................
6480 ;; ....................
6482 ;; calls.c now passes a third argument, make saber happy
6484 (define_expand "call"
6485 [(parallel [(call (match_operand 0 "memory_operand" "m")
6486 (match_operand 1 "" "i"))
6487 (clobber (reg:SI 31))
6488 (use (match_operand 2 "" "")) ;; next_arg_reg
6489 (use (match_operand 3 "" ""))])] ;; struct_value_size_rtx
6495 if (operands[0]) /* eliminate unused code warnings */
6497 addr = XEXP (operands[0], 0);
6498 if ((GET_CODE (addr) != REG && (!CONSTANT_ADDRESS_P (addr) || TARGET_LONG_CALLS))
6499 || ! call_insn_operand (addr, VOIDmode))
6500 XEXP (operands[0], 0) = copy_to_mode_reg (Pmode, addr);
6502 /* In order to pass small structures by value in registers
6503 compatibly with the MIPS compiler, we need to shift the value
6504 into the high part of the register. Function_arg has encoded
6505 a PARALLEL rtx, holding a vector of adjustments to be made
6506 as the next_arg_reg variable, so we split up the insns,
6507 and emit them separately. */
6509 if (operands[2] != (rtx)0 && GET_CODE (operands[2]) == PARALLEL)
6511 rtvec adjust = XVEC (operands[2], 0);
6512 int num = GET_NUM_ELEM (adjust);
6515 for (i = 0; i < num; i++)
6516 emit_insn (RTVEC_ELT (adjust, i));
6519 emit_call_insn (gen_call_internal0 (operands[0], operands[1],
6520 gen_rtx (REG, SImode, GP_REG_FIRST + 31)));
6525 (define_expand "call_internal0"
6526 [(parallel [(call (match_operand 0 "" "")
6527 (match_operand 1 "" ""))
6528 (clobber (match_operand:SI 2 "" ""))])]
6532 (define_insn "call_internal1"
6533 [(call (mem (match_operand 0 "call_insn_operand" "ri"))
6534 (match_operand 1 "" "i"))
6535 (clobber (match_operand:SI 2 "register_operand" "=d"))]
6536 "!TARGET_ABICALLS && !TARGET_LONG_CALLS"
6539 register rtx target = operands[0];
6541 if (GET_CODE (target) == SYMBOL_REF)
6542 return \"%*jal\\t%0\";
6543 else if (GET_CODE (target) == CONST_INT)
6544 return \"%[li\\t%@,%0\\n\\t%*jal\\t%2,%@%]\";
6546 return \"%*jal\\t%2,%0\";
6548 [(set_attr "type" "call")
6549 (set_attr "mode" "none")
6550 (set_attr "length" "1")])
6552 (define_insn "call_internal2"
6553 [(call (mem (match_operand 0 "call_insn_operand" "ri"))
6554 (match_operand 1 "" "i"))
6555 (clobber (match_operand:SI 2 "register_operand" "=d"))]
6556 "TARGET_ABICALLS && !TARGET_LONG_CALLS"
6559 register rtx target = operands[0];
6561 if (GET_CODE (target) == SYMBOL_REF)
6563 if (GET_MODE (target) == SImode)
6564 return \"la\\t%^,%0\\n\\tjal\\t%2,%^\";
6566 return \"dla\\t%^,%0\\n\\tjal\\t%2,%^\";
6568 else if (GET_CODE (target) == CONST_INT)
6569 return \"li\\t%^,%0\\n\\tjal\\t%2,%^\";
6570 else if (REGNO (target) != PIC_FUNCTION_ADDR_REGNUM)
6571 return \"move\\t%^,%0\\n\\tjal\\t%2,%^\";
6573 return \"jal\\t%2,%0\";
6575 [(set_attr "type" "call")
6576 (set_attr "mode" "none")
6577 (set_attr "length" "2")])
6579 (define_insn "call_internal3a"
6580 [(call (mem:SI (match_operand:SI 0 "register_operand" "r"))
6581 (match_operand 1 "" "i"))
6582 (clobber (match_operand:SI 2 "register_operand" "=d"))]
6583 "!TARGET_LONG64 && !TARGET_ABICALLS && TARGET_LONG_CALLS"
6585 [(set_attr "type" "call")
6586 (set_attr "mode" "none")
6587 (set_attr "length" "1")])
6589 (define_insn "call_internal3b"
6590 [(call (mem:DI (match_operand:DI 0 "se_register_operand" "r"))
6591 (match_operand 1 "" "i"))
6592 (clobber (match_operand:SI 2 "register_operand" "=d"))]
6593 "TARGET_LONG64 && !TARGET_ABICALLS && TARGET_LONG_CALLS"
6595 [(set_attr "type" "call")
6596 (set_attr "mode" "none")
6597 (set_attr "length" "1")])
6599 (define_insn "call_internal4a"
6600 [(call (mem:SI (match_operand:SI 0 "register_operand" "r"))
6601 (match_operand 1 "" "i"))
6602 (clobber (match_operand:SI 2 "register_operand" "=d"))]
6603 "!TARGET_LONG64 && TARGET_ABICALLS && TARGET_LONG_CALLS"
6606 if (REGNO (operands[0]) != PIC_FUNCTION_ADDR_REGNUM)
6607 return \"move\\t%^,%0\\n\\tjal\\t%2,%^\";
6609 return \"jal\\t%2,%0\";
6611 [(set_attr "type" "call")
6612 (set_attr "mode" "none")
6613 (set_attr "length" "2")])
6615 (define_insn "call_internal4b"
6616 [(call (mem:DI (match_operand:DI 0 "se_register_operand" "r"))
6617 (match_operand 1 "" "i"))
6618 (clobber (match_operand:SI 2 "register_operand" "=d"))]
6619 "TARGET_LONG64 && TARGET_ABICALLS && TARGET_LONG_CALLS"
6622 if (REGNO (operands[0]) != PIC_FUNCTION_ADDR_REGNUM)
6623 return \"move\\t%^,%0\\n\\tjal\\t%2,%^\";
6625 return \"jal\\t%2,%0\";
6627 [(set_attr "type" "call")
6628 (set_attr "mode" "none")
6629 (set_attr "length" "2")])
6631 ;; calls.c now passes a fourth argument, make saber happy
6633 (define_expand "call_value"
6634 [(parallel [(set (match_operand 0 "register_operand" "=df")
6635 (call (match_operand 1 "memory_operand" "m")
6636 (match_operand 2 "" "i")))
6637 (clobber (reg:SI 31))
6638 (use (match_operand 3 "" ""))])] ;; next_arg_reg
6644 if (operands[0]) /* eliminate unused code warning */
6646 addr = XEXP (operands[1], 0);
6647 if ((GET_CODE (addr) != REG && (!CONSTANT_ADDRESS_P (addr) || TARGET_LONG_CALLS))
6648 || ! call_insn_operand (addr, VOIDmode))
6649 XEXP (operands[1], 0) = copy_to_mode_reg (Pmode, addr);
6651 /* In order to pass small structures by value in registers
6652 compatibly with the MIPS compiler, we need to shift the value
6653 into the high part of the register. Function_arg has encoded
6654 a PARALLEL rtx, holding a vector of adjustments to be made
6655 as the next_arg_reg variable, so we split up the insns,
6656 and emit them separately. */
6658 if (operands[3] != (rtx)0 && GET_CODE (operands[3]) == PARALLEL)
6660 rtvec adjust = XVEC (operands[3], 0);
6661 int num = GET_NUM_ELEM (adjust);
6664 for (i = 0; i < num; i++)
6665 emit_insn (RTVEC_ELT (adjust, i));
6668 /* Handle Irix6 function calls that have multiple non-contiguous
6670 if (GET_CODE (operands[0]) == PARALLEL && XVECLEN (operands[0], 0) > 1)
6672 emit_call_insn (gen_call_value_multiple_internal0
6673 (XEXP (XVECEXP (operands[0], 0, 0), 0),
6674 operands[1], operands[2],
6675 XEXP (XVECEXP (operands[0], 0, 1), 0),
6676 gen_rtx (REG, SImode, GP_REG_FIRST + 31)));
6680 /* We have a call returning a DImode structure in an FP reg.
6681 Strip off the now unnecessary PARALLEL. */
6682 if (GET_CODE (operands[0]) == PARALLEL)
6683 operands[0] = XEXP (XVECEXP (operands[0], 0, 0), 0);
6685 emit_call_insn (gen_call_value_internal0 (operands[0], operands[1], operands[2],
6686 gen_rtx (REG, SImode, GP_REG_FIRST + 31)));
6692 (define_expand "call_value_internal0"
6693 [(parallel [(set (match_operand 0 "" "")
6694 (call (match_operand 1 "" "")
6695 (match_operand 2 "" "")))
6696 (clobber (match_operand:SI 3 "" ""))])]
6700 (define_insn "call_value_internal1"
6701 [(set (match_operand 0 "register_operand" "=df")
6702 (call (mem (match_operand 1 "call_insn_operand" "ri"))
6703 (match_operand 2 "" "i")))
6704 (clobber (match_operand:SI 3 "register_operand" "=d"))]
6705 "!TARGET_ABICALLS && !TARGET_LONG_CALLS"
6708 register rtx target = operands[1];
6710 if (GET_CODE (target) == SYMBOL_REF)
6711 return \"%*jal\\t%1\";
6712 else if (GET_CODE (target) == CONST_INT)
6713 return \"%[li\\t%@,%1\\n\\t%*jal\\t%3,%@%]\";
6715 return \"%*jal\\t%3,%1\";
6717 [(set_attr "type" "call")
6718 (set_attr "mode" "none")
6719 (set_attr "length" "1")])
6721 (define_insn "call_value_internal2"
6722 [(set (match_operand 0 "register_operand" "=df")
6723 (call (mem (match_operand 1 "call_insn_operand" "ri"))
6724 (match_operand 2 "" "i")))
6725 (clobber (match_operand:SI 3 "register_operand" "=d"))]
6726 "TARGET_ABICALLS && !TARGET_LONG_CALLS"
6729 register rtx target = operands[1];
6731 if (GET_CODE (target) == SYMBOL_REF)
6733 if (GET_MODE (target) == SImode)
6734 return \"la\\t%^,%1\\n\\tjal\\t%3,%^\";
6736 return \"dla\\t%^,%1\\n\\tjal\\t%3,%^\";
6738 else if (GET_CODE (target) == CONST_INT)
6739 return \"li\\t%^,%1\\n\\tjal\\t%3,%^\";
6740 else if (REGNO (target) != PIC_FUNCTION_ADDR_REGNUM)
6741 return \"move\\t%^,%1\\n\\tjal\\t%3,%^\";
6743 return \"jal\\t%3,%1\";
6745 [(set_attr "type" "call")
6746 (set_attr "mode" "none")
6747 (set_attr "length" "2")])
6749 (define_insn "call_value_internal3a"
6750 [(set (match_operand 0 "register_operand" "=df")
6751 (call (mem:SI (match_operand:SI 1 "register_operand" "r"))
6752 (match_operand 2 "" "i")))
6753 (clobber (match_operand:SI 3 "register_operand" "=d"))]
6754 "!TARGET_LONG64 && !TARGET_ABICALLS && TARGET_LONG_CALLS"
6756 [(set_attr "type" "call")
6757 (set_attr "mode" "none")
6758 (set_attr "length" "1")])
6760 (define_insn "call_value_internal3b"
6761 [(set (match_operand 0 "register_operand" "=df")
6762 (call (mem:DI (match_operand:DI 1 "se_register_operand" "r"))
6763 (match_operand 2 "" "i")))
6764 (clobber (match_operand:SI 3 "register_operand" "=d"))]
6765 "TARGET_LONG64 && !TARGET_ABICALLS && TARGET_LONG_CALLS"
6767 [(set_attr "type" "call")
6768 (set_attr "mode" "none")
6769 (set_attr "length" "1")])
6771 (define_insn "call_value_internal4a"
6772 [(set (match_operand 0 "register_operand" "=df")
6773 (call (mem:SI (match_operand:SI 1 "register_operand" "r"))
6774 (match_operand 2 "" "i")))
6775 (clobber (match_operand:SI 3 "register_operand" "=d"))]
6776 "!TARGET_LONG64 && TARGET_ABICALLS && TARGET_LONG_CALLS"
6779 if (REGNO (operands[1]) != PIC_FUNCTION_ADDR_REGNUM)
6780 return \"move\\t%^,%1\\n\\tjal\\t%3,%^\";
6782 return \"jal\\t%3,%1\";
6784 [(set_attr "type" "call")
6785 (set_attr "mode" "none")
6786 (set_attr "length" "2")])
6788 (define_insn "call_value_internal4b"
6789 [(set (match_operand 0 "register_operand" "=df")
6790 (call (mem:DI (match_operand:DI 1 "se_register_operand" "r"))
6791 (match_operand 2 "" "i")))
6792 (clobber (match_operand:SI 3 "register_operand" "=d"))]
6793 "TARGET_LONG64 && TARGET_ABICALLS && TARGET_LONG_CALLS"
6796 if (REGNO (operands[1]) != PIC_FUNCTION_ADDR_REGNUM)
6797 return \"move\\t%^,%1\\n\\tjal\\t%3,%^\";
6799 return \"jal\\t%3,%1\";
6801 [(set_attr "type" "call")
6802 (set_attr "mode" "none")
6803 (set_attr "length" "2")])
6805 (define_expand "call_value_multiple_internal0"
6806 [(parallel [(set (match_operand 0 "" "")
6807 (call (match_operand 1 "" "")
6808 (match_operand 2 "" "")))
6809 (set (match_operand 3 "" "")
6812 (clobber (match_operand:SI 4 "" ""))])]
6816 ;; ??? May eventually need all 6 versions of the call patterns with multiple
6819 (define_insn "call_value_multiple_internal2"
6820 [(set (match_operand 0 "register_operand" "=df")
6821 (call (mem (match_operand 1 "call_insn_operand" "ri"))
6822 (match_operand 2 "" "i")))
6823 (set (match_operand 3 "register_operand" "=df")
6824 (call (mem (match_dup 1))
6826 (clobber (match_operand:SI 4 "register_operand" "=d"))]
6827 "TARGET_ABICALLS && !TARGET_LONG_CALLS"
6830 register rtx target = operands[1];
6832 if (GET_CODE (target) == SYMBOL_REF)
6834 if (GET_MODE (target) == SImode)
6835 return \"la\\t%^,%1\\n\\tjal\\t%4,%^\";
6837 return \"la\\t%^,%1\\n\\tjal\\t%4,%^\";
6839 else if (GET_CODE (target) == CONST_INT)
6840 return \"li\\t%^,%1\\n\\tjal\\t%4,%^\";
6841 else if (REGNO (target) != PIC_FUNCTION_ADDR_REGNUM)
6842 return \"move\\t%^,%1\\n\\tjal\\t%4,%^\";
6844 return \"jal\\t%4,%1\";
6846 [(set_attr "type" "call")
6847 (set_attr "mode" "none")
6848 (set_attr "length" "2")])
6851 ;; Call subroutine returning any type.
6853 (define_expand "untyped_call"
6854 [(parallel [(call (match_operand 0 "" "")
6856 (match_operand 1 "" "")
6857 (match_operand 2 "" "")])]
6861 if (operands[0]) /* silence statement not reached warnings */
6865 emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
6867 for (i = 0; i < XVECLEN (operands[2], 0); i++)
6869 rtx set = XVECEXP (operands[2], 0, i);
6870 emit_move_insn (SET_DEST (set), SET_SRC (set));
6873 emit_insn (gen_blockage ());
6879 ;; ....................
6883 ;; ....................
6890 [(set_attr "type" "nop")
6891 (set_attr "mode" "none")
6892 (set_attr "length" "1")])
6894 ;; The MIPS chip does not seem to require stack probes.
6896 ;; (define_expand "probe"
6897 ;; [(set (match_dup 0)
6902 ;; operands[0] = gen_reg_rtx (SImode);
6903 ;; operands[1] = gen_rtx (MEM, SImode, stack_pointer_rtx);
6904 ;; MEM_VOLATILE_P (operands[1]) = TRUE;
6906 ;; /* fall through and generate default code */
6911 ;; MIPS4 Conditional move instructions.
6914 [(set (match_operand:SI 0 "register_operand" "=d,d")
6916 (match_operator 4 "equality_op"
6917 [(match_operand:SI 1 "register_operand" "d,d")
6919 (match_operand:SI 2 "reg_or_0_operand" "dJ,0")
6920 (match_operand:SI 3 "reg_or_0_operand" "0,dJ")))]
6925 [(set_attr "type" "move")
6926 (set_attr "mode" "SI")])
6929 [(set (match_operand:SI 0 "register_operand" "=d,d")
6931 (match_operator 4 "equality_op"
6932 [(match_operand:DI 1 "se_register_operand" "d,d")
6934 (match_operand:SI 2 "reg_or_0_operand" "dJ,0")
6935 (match_operand:SI 3 "reg_or_0_operand" "0,dJ")))]
6940 [(set_attr "type" "move")
6941 (set_attr "mode" "SI")])
6944 [(set (match_operand:SI 0 "register_operand" "=d,d")
6946 (match_operator 3 "equality_op" [(match_operand:CC 4
6950 (match_operand:SI 1 "reg_or_0_operand" "dJ,0")
6951 (match_operand:SI 2 "reg_or_0_operand" "0,dJ")))]
6952 "mips_isa >= 4 && TARGET_HARD_FLOAT"
6956 [(set_attr "type" "move")
6957 (set_attr "mode" "SI")])
6960 [(set (match_operand:DI 0 "register_operand" "=d,d")
6962 (match_operator 4 "equality_op"
6963 [(match_operand:SI 1 "register_operand" "d,d")
6965 (match_operand:DI 2 "se_reg_or_0_operand" "dJ,0")
6966 (match_operand:DI 3 "se_reg_or_0_operand" "0,dJ")))]
6971 [(set_attr "type" "move")
6972 (set_attr "mode" "DI")])
6975 [(set (match_operand:DI 0 "register_operand" "=d,d")
6977 (match_operator 4 "equality_op"
6978 [(match_operand:DI 1 "se_register_operand" "d,d")
6980 (match_operand:DI 2 "se_reg_or_0_operand" "dJ,0")
6981 (match_operand:DI 3 "se_reg_or_0_operand" "0,dJ")))]
6986 [(set_attr "type" "move")
6987 (set_attr "mode" "DI")])
6990 [(set (match_operand:DI 0 "register_operand" "=d,d")
6992 (match_operator 3 "equality_op" [(match_operand:CC 4
6996 (match_operand:DI 1 "se_reg_or_0_operand" "dJ,0")
6997 (match_operand:DI 2 "se_reg_or_0_operand" "0,dJ")))]
6998 "mips_isa >= 4 && TARGET_HARD_FLOAT"
7002 [(set_attr "type" "move")
7003 (set_attr "mode" "DI")])
7006 [(set (match_operand:SF 0 "register_operand" "=f,f")
7008 (match_operator 4 "equality_op"
7009 [(match_operand:SI 1 "register_operand" "d,d")
7011 (match_operand:SF 2 "register_operand" "f,0")
7012 (match_operand:SF 3 "register_operand" "0,f")))]
7013 "mips_isa >= 4 && TARGET_HARD_FLOAT"
7016 mov%b4.s\\t%0,%3,%1"
7017 [(set_attr "type" "move")
7018 (set_attr "mode" "SF")])
7021 [(set (match_operand:SF 0 "register_operand" "=f,f")
7023 (match_operator 3 "equality_op" [(match_operand:CC 4
7027 (match_operand:SF 1 "register_operand" "f,0")
7028 (match_operand:SF 2 "register_operand" "0,f")))]
7029 "mips_isa >= 4 && TARGET_HARD_FLOAT"
7032 mov%t3.s\\t%0,%2,%4"
7033 [(set_attr "type" "move")
7034 (set_attr "mode" "SF")])
7037 [(set (match_operand:DF 0 "register_operand" "=f,f")
7039 (match_operator 4 "equality_op"
7040 [(match_operand:SI 1 "register_operand" "d,d")
7042 (match_operand:DF 2 "register_operand" "f,0")
7043 (match_operand:DF 3 "register_operand" "0,f")))]
7044 "mips_isa >= 4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
7047 mov%b4.d\\t%0,%3,%1"
7048 [(set_attr "type" "move")
7049 (set_attr "mode" "DF")])
7052 [(set (match_operand:DF 0 "register_operand" "=f,f")
7054 (match_operator 3 "equality_op" [(match_operand:CC 4
7058 (match_operand:DF 1 "register_operand" "f,0")
7059 (match_operand:DF 2 "register_operand" "0,f")))]
7060 "mips_isa >= 4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
7063 mov%t3.d\\t%0,%2,%4"
7064 [(set_attr "type" "move")
7065 (set_attr "mode" "DF")])
7067 ;; These are the main define_expand's used to make conditional moves.
7069 (define_expand "movsicc"
7070 [(set (match_dup 4) (match_operand 1 "comparison_operator" ""))
7071 (set (match_operand:SI 0 "register_operand" "")
7072 (if_then_else:SI (match_dup 5)
7073 (match_operand:SI 2 "reg_or_0_operand" "")
7074 (match_operand:SI 3 "reg_or_0_operand" "")))]
7078 gen_conditional_move (operands);
7082 (define_expand "movdicc"
7083 [(set (match_dup 4) (match_operand 1 "comparison_operator" ""))
7084 (set (match_operand:DI 0 "register_operand" "")
7085 (if_then_else:DI (match_dup 5)
7086 (match_operand:DI 2 "se_reg_or_0_operand" "")
7087 (match_operand:DI 3 "se_reg_or_0_operand" "")))]
7091 gen_conditional_move (operands);
7095 (define_expand "movsfcc"
7096 [(set (match_dup 4) (match_operand 1 "comparison_operator" ""))
7097 (set (match_operand:SF 0 "register_operand" "")
7098 (if_then_else:SF (match_dup 5)
7099 (match_operand:SF 2 "register_operand" "")
7100 (match_operand:SF 3 "register_operand" "")))]
7101 "mips_isa >= 4 && TARGET_HARD_FLOAT"
7104 gen_conditional_move (operands);
7108 (define_expand "movdfcc"
7109 [(set (match_dup 4) (match_operand 1 "comparison_operator" ""))
7110 (set (match_operand:DF 0 "register_operand" "")
7111 (if_then_else:DF (match_dup 5)
7112 (match_operand:DF 2 "register_operand" "")
7113 (match_operand:DF 3 "register_operand" "")))]
7114 "mips_isa >= 4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
7117 gen_conditional_move (operands);