1 ;; Mips.md Machine Description for MIPS based processors
2 ;; Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 ;; 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
4 ;; Contributed by A. Lichnewsky, lich@inria.inria.fr
5 ;; Changes by Michael Meissner, meissner@osf.org
6 ;; 64 bit r4000 support by Ian Lance Taylor, ian@cygnus.com, and
7 ;; Brendan Eich, brendan@microunity.com.
9 ;; This file is part of GNU CC.
11 ;; GNU CC is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; GNU CC is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU CC; see the file COPYING. If not, write to
23 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
26 ;; ??? Currently does not have define_function_unit support for the R8000.
27 ;; Must include new entries for fmadd in addition to existing entries.
30 [(UNSPEC_LOAD_DF_LOW 0)
31 (UNSPEC_LOAD_DF_HIGH 1)
32 (UNSPEC_STORE_DF_HIGH 2)
36 (UNSPEC_EH_RECEIVER 10)
38 (UNSPEC_CONSTTABLE_QI 12)
39 (UNSPEC_CONSTTABLE_HI 13)
40 (UNSPEC_CONSTTABLE_SI 14)
41 (UNSPEC_CONSTTABLE_DI 15)
42 (UNSPEC_CONSTTABLE_SF 16)
43 (UNSPEC_CONSTTABLE_DF 17)
57 ;; Constants used in relocation unspecs. RELOC_GOT_PAGE and RELOC_GOT_DISP
58 ;; are really only available for n32 and n64. However, it is convenient
59 ;; to reuse them for SVR4 PIC, where they represent the local and global
60 ;; forms of R_MIPS_GOT16.
70 (RELOC_LOADGP_LO 109)])
73 ;; ....................
77 ;; ....................
79 ;; For jal instructions, this attribute is DIRECT when the target address
80 ;; is symbolic and INDIRECT when it is a register.
81 (define_attr "jal" "unset,direct,indirect"
82 (const_string "unset"))
84 ;; True for multi-instruction jal macros. jal is always a macro
85 ;; in SVR4 PIC since it includes an instruction to restore $gp.
86 ;; Direct jals are also macros in NewABI PIC since they load the
87 ;; target address into $25.
88 (define_attr "jal_macro" "no,yes"
89 (cond [(eq_attr "jal" "direct")
90 (symbol_ref "TARGET_ABICALLS != 0")
91 (eq_attr "jal" "indirect")
92 (symbol_ref "(TARGET_ABICALLS && !TARGET_NEWABI) != 0")]
95 ;; Classification of each insn.
96 ;; branch conditional branch
97 ;; jump unconditional jump
98 ;; call unconditional call
99 ;; load load instruction(s)
100 ;; store store instruction(s)
101 ;; prefetch memory prefetch
102 ;; move data movement within same register set
103 ;; xfer transfer to/from coprocessor
104 ;; hilo transfer of hi/lo registers
105 ;; arith integer arithmetic instruction
106 ;; darith double precision integer arithmetic instructions
107 ;; const load constant
108 ;; imul integer multiply
109 ;; imadd integer multiply-add
110 ;; idiv integer divide
111 ;; icmp integer compare
112 ;; fadd floating point add/subtract
113 ;; fmul floating point multiply
114 ;; fmadd floating point multiply-add
115 ;; fdiv floating point divide
116 ;; fabs floating point absolute value
117 ;; fneg floating point negation
118 ;; fcmp floating point compare
119 ;; fcvt floating point convert
120 ;; fsqrt floating point square root
121 ;; frsqrt floating point reciprocal square root
122 ;; multi multiword sequence (or user asm statements)
125 "unknown,branch,jump,call,load,store,prefetch,move,xfer,hilo,const,arith,darith,imul,imadd,idiv,icmp,fadd,fmul,fmadd,fdiv,fabs,fneg,fcmp,fcvt,fsqrt,frsqrt,multi,nop"
126 (cond [(eq_attr "jal" "!unset")
127 (const_string "call")]
128 (const_string "unknown")))
130 ;; Main data type used by the insn
131 (define_attr "mode" "unknown,none,QI,HI,SI,DI,SF,DF,FPSW" (const_string "unknown"))
133 ;; Is this an extended instruction in mips16 mode?
134 (define_attr "extended_mips16" "no,yes"
137 ;; Length (in # of bytes). A conditional branch is allowed only to a
138 ;; location within a signed 18-bit offset of the delay slot. If that
139 ;; provides too smal a range, we use the `j' instruction. This
140 ;; instruction takes a 28-bit value, but that value is not an offset.
141 ;; Instead, it's bitwise-ored with the high-order four bits of the
142 ;; instruction in the delay slot, which means it cannot be used to
143 ;; cross a 256MB boundary. We could fall back back on the jr,
144 ;; instruction which allows full access to the entire address space,
145 ;; but we do not do so at present.
147 (define_attr "length" ""
148 (cond [(eq_attr "type" "branch")
149 (cond [(lt (abs (minus (match_dup 1) (plus (pc) (const_int 4))))
152 (ne (symbol_ref "flag_pic && ! TARGET_EMBEDDED_PIC")
156 (eq_attr "type" "const")
157 (symbol_ref "mips_const_insns (operands[1]) * 4")
158 (eq_attr "type" "load")
159 (symbol_ref "mips_fetch_insns (operands[1]) * 4")
160 (eq_attr "type" "store")
161 (symbol_ref "mips_fetch_insns (operands[0]) * 4")
162 ;; In the worst case, a call macro will take 8 instructions:
164 ;; lui $25,%call_hi(FOO)
166 ;; lw $25,%call_lo(FOO)($25)
172 (eq_attr "jal_macro" "yes")
174 (and (eq_attr "extended_mips16" "yes")
175 (ne (symbol_ref "TARGET_MIPS16") (const_int 0)))
177 (and (eq_attr "type" "idiv")
178 (ne (symbol_ref "TARGET_CHECK_ZERO_DIV") (const_int 0)))
179 (cond [(ne (symbol_ref "TARGET_MIPS16") (const_int 0))
184 ;; Attribute describing the processor. This attribute must match exactly
185 ;; with the processor_type enumeration in mips.h.
187 ;; Attribute describing the processor
188 ;; (define_attr "cpu" "default,r3000,r6000,r4000"
190 ;; (cond [(eq (symbol_ref "mips_cpu") (symbol_ref "PROCESSOR_R3000")) (const_string "r3000")
191 ;; (eq (symbol_ref "mips_cpu") (symbol_ref "PROCESSOR_R4000")) (const_string "r4000")
192 ;; (eq (symbol_ref "mips_cpu") (symbol_ref "PROCESSOR_R6000")) (const_string "r6000")]
193 ;; (const_string "default"))))
195 ;; ??? Fix everything that tests this attribute.
197 "default,4kc,5kc,20kc,m4k,r3000,r3900,r6000,r4000,r4100,r4111,r4120,r4300,r4600,r4650,r5000,r5400,r5500,r8000,sb1,sr71000"
198 (const (symbol_ref "mips_cpu_attr")))
200 ;; The type of hardware hazard associated with this instruction.
201 ;; DELAY means that the next instruction cannot read the result
202 ;; of this one. HILO means that the next two instructions cannot
203 ;; write to HI or LO.
204 (define_attr "hazard" "none,delay,hilo"
205 (cond [(and (eq_attr "type" "load")
206 (ne (symbol_ref "ISA_HAS_LOAD_DELAY") (const_int 0)))
207 (const_string "delay")
209 (and (eq_attr "type" "xfer")
210 (ne (symbol_ref "ISA_HAS_XFER_DELAY") (const_int 0)))
211 (const_string "delay")
213 (and (eq_attr "type" "fcmp")
214 (ne (symbol_ref "ISA_HAS_FCMP_DELAY") (const_int 0)))
215 (const_string "delay")
217 ;; The r4000 multiplication patterns include an mflo instruction.
218 (and (eq_attr "type" "imul")
219 (ne (symbol_ref "TARGET_MIPS4000") (const_int 0)))
220 (const_string "hilo")
222 (and (eq_attr "type" "hilo")
223 (and (eq (symbol_ref "ISA_HAS_HILO_INTERLOCKS") (const_int 0))
224 (match_operand 1 "hilo_operand" "")))
225 (const_string "hilo")]
226 (const_string "none")))
228 ;; Is it a single instruction?
229 (define_attr "single_insn" "no,yes"
230 (symbol_ref "get_attr_length (insn) == (TARGET_MIPS16 ? 2 : 4)"))
232 ;; Can the instruction be put into a delay slot?
233 (define_attr "can_delay" "no,yes"
234 (if_then_else (and (eq_attr "type" "!branch,call,jump")
235 (and (eq_attr "hazard" "none")
236 (eq_attr "single_insn" "yes")))
238 (const_string "no")))
240 ;; Attribute defining whether or not we can use the branch-likely instructions
242 (define_attr "branch_likely" "no,yes"
244 (if_then_else (ne (symbol_ref "GENERATE_BRANCHLIKELY") (const_int 0))
246 (const_string "no"))))
249 ;; Describe a user's asm statement.
250 (define_asm_attributes
251 [(set_attr "type" "multi")])
255 ;; .........................
257 ;; Delay slots, can't describe load/fcmp/xfer delay slots here
259 ;; .........................
261 (define_delay (and (eq_attr "type" "branch")
262 (eq (symbol_ref "mips16") (const_int 0)))
263 [(eq_attr "can_delay" "yes")
265 (and (eq_attr "branch_likely" "yes")
266 (eq_attr "can_delay" "yes"))])
268 (define_delay (eq_attr "type" "jump")
269 [(eq_attr "can_delay" "yes")
273 (define_delay (and (eq_attr "type" "call")
274 (eq_attr "jal_macro" "no"))
275 [(eq_attr "can_delay" "yes")
281 ;; .........................
285 ;; .........................
287 ; (define_function_unit NAME MULTIPLICITY SIMULTANEITY
288 ; TEST READY-DELAY ISSUE-DELAY [CONFLICT-LIST])
290 ;; Make the default case (PROCESSOR_DEFAULT) handle the worst case
292 (define_function_unit "memory" 1 0
293 (and (eq_attr "type" "load")
294 (eq_attr "cpu" "!r3000,r3900,r4600,r4650,r4100,r4120,r4300,r5000"))
297 (define_function_unit "memory" 1 0
298 (and (eq_attr "type" "load")
299 (eq_attr "cpu" "r3000,r3900,r4600,r4650,r4100,r4120,r4300,r5000"))
302 (define_function_unit "memory" 1 0 (eq_attr "type" "store") 1 0)
304 (define_function_unit "memory" 1 0 (eq_attr "type" "xfer") 2 0)
306 (define_function_unit "imuldiv" 1 0
307 (eq_attr "type" "hilo")
310 (define_function_unit "imuldiv" 1 0
311 (and (eq_attr "type" "imul,imadd")
312 (eq_attr "cpu" "!r3000,r3900,r4000,r4600,r4650,r4100,r4120,r4300,r5000"))
315 ;; On them mips16, we want to stronly discourage a mult from appearing
316 ;; after an mflo, since that requires explicit nop instructions. We
317 ;; do this by pretending that mflo ties up the function unit for long
318 ;; enough that the scheduler will ignore load stalls and the like when
319 ;; selecting instructions to between the two instructions.
321 (define_function_unit "imuldiv" 1 0
322 (and (eq_attr "type" "hilo") (ne (symbol_ref "mips16") (const_int 0)))
325 (define_function_unit "imuldiv" 1 0
326 (and (eq_attr "type" "imul,imadd") (eq_attr "cpu" "r3000,r3900"))
329 (define_function_unit "imuldiv" 1 0
330 (and (eq_attr "type" "imul,imadd") (eq_attr "cpu" "r4000,r4600"))
333 (define_function_unit "imuldiv" 1 0
334 (and (eq_attr "type" "imul,imadd") (eq_attr "cpu" "r4650"))
337 (define_function_unit "imuldiv" 1 0
338 (and (eq_attr "type" "imul,imadd")
339 (and (eq_attr "mode" "SI") (eq_attr "cpu" "r4100,r4120")))
342 (define_function_unit "imuldiv" 1 0
343 (and (eq_attr "type" "imul,imadd")
344 (and (eq_attr "mode" "DI") (eq_attr "cpu" "r4100,r4120")))
347 (define_function_unit "imuldiv" 1 0
348 (and (eq_attr "type" "imul,imadd")
349 (and (eq_attr "mode" "SI") (eq_attr "cpu" "r4300,r5000")))
352 (define_function_unit "imuldiv" 1 0
353 (and (eq_attr "type" "imul,imadd")
354 (and (eq_attr "mode" "DI") (eq_attr "cpu" "r4300")))
357 (define_function_unit "imuldiv" 1 0
358 (and (eq_attr "type" "imul,imadd")
359 (and (eq_attr "mode" "DI") (eq_attr "cpu" "r5000")))
362 (define_function_unit "imuldiv" 1 0
363 (and (eq_attr "type" "idiv")
364 (eq_attr "cpu" "!r3000,r3900,r4000,r4600,r4650,r4100,r4120,r4300,r5000"))
367 (define_function_unit "imuldiv" 1 0
368 (and (eq_attr "type" "idiv") (eq_attr "cpu" "r3000,r3900"))
371 (define_function_unit "imuldiv" 1 0
372 (and (eq_attr "type" "idiv") (eq_attr "cpu" "r4600"))
375 (define_function_unit "imuldiv" 1 0
376 (and (eq_attr "type" "idiv") (eq_attr "cpu" "r4650"))
379 (define_function_unit "imuldiv" 1 0
380 (and (eq_attr "type" "idiv") (eq_attr "cpu" "r4000"))
383 (define_function_unit "imuldiv" 1 0
384 (and (eq_attr "type" "idiv")
385 (and (eq_attr "mode" "SI") (eq_attr "cpu" "r4100,r4120")))
388 (define_function_unit "imuldiv" 1 0
389 (and (eq_attr "type" "idiv")
390 (and (eq_attr "mode" "DI") (eq_attr "cpu" "r4100,r4120")))
393 (define_function_unit "imuldiv" 1 0
394 (and (eq_attr "type" "idiv")
395 (and (eq_attr "mode" "SI") (eq_attr "cpu" "r4300")))
398 (define_function_unit "imuldiv" 1 0
399 (and (eq_attr "type" "idiv")
400 (and (eq_attr "mode" "DI") (eq_attr "cpu" "r4300")))
403 (define_function_unit "imuldiv" 1 0
404 (and (eq_attr "type" "idiv")
405 (and (eq_attr "mode" "SI") (eq_attr "cpu" "r5000")))
408 (define_function_unit "imuldiv" 1 0
409 (and (eq_attr "type" "idiv")
410 (and (eq_attr "mode" "DI") (eq_attr "cpu" "r5000")))
413 ;; The R4300 does *NOT* have a separate Floating Point Unit, instead
414 ;; the FP hardware is part of the normal ALU circuitry. This means FP
415 ;; instructions affect the pipe-line, and no functional unit
416 ;; parallelism can occur on R4300 processors. To force GCC into coding
417 ;; for only a single functional unit, we force the R4300 FP
418 ;; instructions to be processed in the "imuldiv" unit.
420 (define_function_unit "adder" 1 1
421 (and (eq_attr "type" "fcmp") (eq_attr "cpu" "!r3000,r3900,r6000,r4300,r5000"))
424 (define_function_unit "adder" 1 1
425 (and (eq_attr "type" "fcmp") (eq_attr "cpu" "r3000,r3900,r6000"))
428 (define_function_unit "adder" 1 1
429 (and (eq_attr "type" "fcmp") (eq_attr "cpu" "r5000"))
432 (define_function_unit "adder" 1 1
433 (and (eq_attr "type" "fadd") (eq_attr "cpu" "!r3000,r3900,r6000,r4300"))
436 (define_function_unit "adder" 1 1
437 (and (eq_attr "type" "fadd") (eq_attr "cpu" "r3000,r3900"))
440 (define_function_unit "adder" 1 1
441 (and (eq_attr "type" "fadd") (eq_attr "cpu" "r6000"))
444 (define_function_unit "adder" 1 1
445 (and (eq_attr "type" "fabs,fneg")
446 (eq_attr "cpu" "!r3000,r3900,r4600,r4650,r4300,r5000"))
449 (define_function_unit "adder" 1 1
450 (and (eq_attr "type" "fabs,fneg") (eq_attr "cpu" "r3000,r3900,r4600,r4650,r5000"))
453 (define_function_unit "mult" 1 1
454 (and (eq_attr "type" "fmul")
455 (and (eq_attr "mode" "SF")
456 (eq_attr "cpu" "!r3000,r3900,r6000,r4600,r4650,r4300,r5000")))
459 (define_function_unit "mult" 1 1
460 (and (eq_attr "type" "fmul")
461 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r3000,r3900,r5000")))
464 (define_function_unit "mult" 1 1
465 (and (eq_attr "type" "fmul")
466 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r6000")))
469 (define_function_unit "mult" 1 1
470 (and (eq_attr "type" "fmul")
471 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r4600,r4650")))
474 (define_function_unit "mult" 1 1
475 (and (eq_attr "type" "fmul")
476 (and (eq_attr "mode" "DF") (eq_attr "cpu" "!r3000,r3900,r6000,r4300,r5000")))
479 (define_function_unit "mult" 1 1
480 (and (eq_attr "type" "fmul")
481 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r3000,r3900,r5000")))
484 (define_function_unit "mult" 1 1
485 (and (eq_attr "type" "fmul")
486 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r6000")))
489 (define_function_unit "divide" 1 1
490 (and (eq_attr "type" "fdiv")
491 (and (eq_attr "mode" "SF")
492 (eq_attr "cpu" "!r3000,r3900,r6000,r4600,r4650,r4300,r5000")))
495 (define_function_unit "divide" 1 1
496 (and (eq_attr "type" "fdiv")
497 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r3000,r3900")))
500 (define_function_unit "divide" 1 1
501 (and (eq_attr "type" "fdiv")
502 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r6000")))
505 (define_function_unit "divide" 1 1
506 (and (eq_attr "type" "fdiv")
507 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r4600,r4650")))
510 (define_function_unit "divide" 1 1
511 (and (eq_attr "type" "fdiv")
512 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r5000")))
515 (define_function_unit "divide" 1 1
516 (and (eq_attr "type" "fdiv")
517 (and (eq_attr "mode" "DF")
518 (eq_attr "cpu" "!r3000,r3900,r6000,r4600,r4650,r4300")))
521 (define_function_unit "divide" 1 1
522 (and (eq_attr "type" "fdiv")
523 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r3000,r3900")))
526 (define_function_unit "divide" 1 1
527 (and (eq_attr "type" "fdiv")
528 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r6000")))
531 (define_function_unit "divide" 1 1
532 (and (eq_attr "type" "fdiv")
533 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r4600,r4650")))
536 ;;; ??? Is this number right?
537 (define_function_unit "divide" 1 1
538 (and (eq_attr "type" "fsqrt,frsqrt")
539 (and (eq_attr "mode" "SF") (eq_attr "cpu" "!r4600,r4650,r4300,r5000")))
542 (define_function_unit "divide" 1 1
543 (and (eq_attr "type" "fsqrt,frsqrt")
544 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r4600,r4650")))
547 (define_function_unit "divide" 1 1
548 (and (eq_attr "type" "fsqrt,frsqrt")
549 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r5000")))
552 ;;; ??? Is this number right?
553 (define_function_unit "divide" 1 1
554 (and (eq_attr "type" "fsqrt,frsqrt")
555 (and (eq_attr "mode" "DF") (eq_attr "cpu" "!r4600,r4650,r4300,r5000")))
558 (define_function_unit "divide" 1 1
559 (and (eq_attr "type" "fsqrt,frsqrt")
560 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r4600,r4650")))
563 (define_function_unit "divide" 1 1
564 (and (eq_attr "type" "fsqrt,frsqrt")
565 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r5000")))
568 ;; R4300 FP instruction classes treated as part of the "imuldiv"
571 (define_function_unit "imuldiv" 1 0
572 (and (eq_attr "type" "fadd") (eq_attr "cpu" "r4300"))
575 (define_function_unit "imuldiv" 1 0
576 (and (eq_attr "type" "fcmp,fabs,fneg") (eq_attr "cpu" "r4300"))
579 (define_function_unit "imuldiv" 1 0
580 (and (eq_attr "type" "fmul") (and (eq_attr "mode" "SF") (eq_attr "cpu" "r4300")))
582 (define_function_unit "imuldiv" 1 0
583 (and (eq_attr "type" "fmul") (and (eq_attr "mode" "DF") (eq_attr "cpu" "r4300")))
586 (define_function_unit "imuldiv" 1 0
587 (and (and (eq_attr "type" "fdiv") (eq_attr "type" "fsqrt,frsqrt"))
588 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r4300")))
590 (define_function_unit "imuldiv" 1 0
591 (and (and (eq_attr "type" "fdiv") (eq_attr "type" "fsqrt,frsqrt"))
592 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r4300")))
595 ;; The following functional units do not use the cpu type, and use
596 ;; much less memory in genattrtab.c.
598 ;; (define_function_unit "memory" 1 0 (eq_attr "type" "load") 3 0)
599 ;; (define_function_unit "memory" 1 0 (eq_attr "type" "store") 1 0)
601 ;; (define_function_unit "fp_comp" 1 0 (eq_attr "type" "fcmp") 2 0)
603 ;; (define_function_unit "transfer" 1 0 (eq_attr "type" "xfer") 2 0)
604 ;; (define_function_unit "transfer" 1 0 (eq_attr "type" "hilo") 3 0)
606 ;; (define_function_unit "imuldiv" 1 1 (eq_attr "type" "imul") 17 0)
607 ;; (define_function_unit "imuldiv" 1 1 (eq_attr "type" "idiv") 38 0)
609 ;; (define_function_unit "adder" 1 1 (eq_attr "type" "fadd") 4 0)
610 ;; (define_function_unit "adder" 1 1 (eq_attr "type" "fabs,fneg") 2 0)
612 ;; (define_function_unit "mult" 1 1 (and (eq_attr "type" "fmul") (eq_attr "mode" "SF")) 7 0)
613 ;; (define_function_unit "mult" 1 1 (and (eq_attr "type" "fmul") (eq_attr "mode" "DF")) 8 0)
615 ;; (define_function_unit "divide" 1 1 (and (eq_attr "type" "fdiv") (eq_attr "mode" "SF")) 23 0)
616 ;; (define_function_unit "divide" 1 1 (and (eq_attr "type" "fdiv") (eq_attr "mode" "DF")) 36 0)
618 ;; (define_function_unit "sqrt" 1 1 (and (eq_attr "type" "fsqrt") (eq_attr "mode" "SF")) 54 0)
619 ;; (define_function_unit "sqrt" 1 1 (and (eq_attr "type" "fsqrt") (eq_attr "mode" "DF")) 112 0)
621 ;; Include scheduling descriptions.
629 ;; ....................
633 ;; ....................
637 [(trap_if (const_int 1) (const_int 0))]
641 if (ISA_HAS_COND_TRAP)
642 return \"teq\\t$0,$0\";
643 /* The IRIX 6 O32 assembler requires the first break operand. */
644 else if (TARGET_MIPS16 || ! TARGET_GAS)
650 (define_expand "conditional_trap"
651 [(trap_if (match_operator 0 "cmp_op"
652 [(match_dup 2) (match_dup 3)])
653 (match_operand 1 "const_int_operand" ""))]
657 mips_gen_conditional_trap (operands);
661 ;; Match a TRAP_IF with 2nd arg of 0. The div_trap_* insns match a
662 ;; 2nd arg of any CONST_INT, so this insn must appear first.
663 ;; gen_div_trap always generates TRAP_IF with 2nd arg of 6 or 7.
666 [(trap_if (match_operator 0 "trap_cmp_op"
667 [(match_operand:SI 1 "reg_or_0_operand" "d")
668 (match_operand:SI 2 "nonmemory_operand" "dI")])
674 ;; ....................
678 ;; ....................
681 (define_insn "adddf3"
682 [(set (match_operand:DF 0 "register_operand" "=f")
683 (plus:DF (match_operand:DF 1 "register_operand" "f")
684 (match_operand:DF 2 "register_operand" "f")))]
685 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
687 [(set_attr "type" "fadd")
688 (set_attr "mode" "DF")])
690 (define_insn "addsf3"
691 [(set (match_operand:SF 0 "register_operand" "=f")
692 (plus:SF (match_operand:SF 1 "register_operand" "f")
693 (match_operand:SF 2 "register_operand" "f")))]
696 [(set_attr "type" "fadd")
697 (set_attr "mode" "SF")])
699 (define_expand "addsi3"
700 [(set (match_operand:SI 0 "register_operand" "")
701 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "")
702 (match_operand:SI 2 "arith_operand" "")))]
706 /* The mips16 assembler handles -32768 correctly, and so does gas,
707 but some other MIPS assemblers think that -32768 needs to be
708 loaded into a register before it can be added in. */
711 && GET_CODE (operands[2]) == CONST_INT
712 && INTVAL (operands[2]) == -32768)
713 operands[2] = force_reg (SImode, operands[2]);
715 /* If a large stack adjustment was forced into a register, we may be
716 asked to generate rtx such as:
718 (set (reg:SI sp) (plus:SI (reg:SI sp) (reg:SI pseudo)))
720 but no such instruction is available in mips16. Handle it by
721 using a temporary. */
723 && REGNO (operands[0]) == STACK_POINTER_REGNUM
724 && ((GET_CODE (operands[1]) == REG
725 && REGNO (operands[1]) != STACK_POINTER_REGNUM)
726 || GET_CODE (operands[2]) != CONST_INT))
728 rtx tmp = gen_reg_rtx (SImode);
730 emit_move_insn (tmp, operands[1]);
731 emit_insn (gen_addsi3 (tmp, tmp, operands[2]));
732 emit_move_insn (operands[0], tmp);
737 (define_insn "addsi3_internal"
738 [(set (match_operand:SI 0 "register_operand" "=d,d")
739 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ,dJ")
740 (match_operand:SI 2 "arith_operand" "d,Q")))]
743 || GET_CODE (operands[2]) != CONST_INT
744 || INTVAL (operands[2]) != -32768)"
748 [(set_attr "type" "arith")
749 (set_attr "mode" "SI")])
751 ;; For the mips16, we need to recognize stack pointer additions
752 ;; explicitly, since we don't have a constraint for $sp. These insns
753 ;; will be generated by the save_restore_insns functions.
758 (match_operand:SI 0 "small_int" "I")))]
761 [(set_attr "type" "arith")
762 (set_attr "mode" "SI")
763 (set (attr "length") (if_then_else (match_operand:VOID 0 "m16_simm8_8" "")
768 [(set (match_operand:SI 0 "register_operand" "=d")
770 (match_operand:SI 1 "small_int" "I")))]
773 [(set_attr "type" "arith")
774 (set_attr "mode" "SI")
775 (set (attr "length") (if_then_else (match_operand:VOID 1 "m16_uimm8_4" "")
780 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
781 (plus:SI (match_operand:SI 1 "register_operand" "0,d,d")
782 (match_operand:SI 2 "arith_operand" "Q,O,d")))]
784 && (GET_CODE (operands[1]) != REG
785 || REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER
786 || M16_REG_P (REGNO (operands[1]))
787 || REGNO (operands[1]) == ARG_POINTER_REGNUM
788 || REGNO (operands[1]) == FRAME_POINTER_REGNUM
789 || REGNO (operands[1]) == STACK_POINTER_REGNUM)
790 && (GET_CODE (operands[2]) != REG
791 || REGNO (operands[2]) >= FIRST_PSEUDO_REGISTER
792 || M16_REG_P (REGNO (operands[2]))
793 || REGNO (operands[2]) == ARG_POINTER_REGNUM
794 || REGNO (operands[2]) == FRAME_POINTER_REGNUM
795 || REGNO (operands[2]) == STACK_POINTER_REGNUM)"
798 if (REGNO (operands[0]) == REGNO (operands[1]))
799 return \"addu\\t%0,%2\";
800 return \"addu\\t%0,%1,%2\";
802 [(set_attr "type" "arith")
803 (set_attr "mode" "SI")
804 (set_attr_alternative "length"
805 [(if_then_else (match_operand:VOID 2 "m16_simm8_1" "")
808 (if_then_else (match_operand:VOID 2 "m16_simm4_1" "")
814 ;; On the mips16, we can sometimes split an add of a constant which is
815 ;; a 4 byte instruction into two adds which are both 2 byte
816 ;; instructions. There are two cases: one where we are adding a
817 ;; constant plus a register to another register, and one where we are
818 ;; simply adding a constant to a register.
821 [(set (match_operand:SI 0 "register_operand" "")
822 (plus:SI (match_dup 0)
823 (match_operand:SI 1 "const_int_operand" "")))]
824 "TARGET_MIPS16 && reload_completed && !TARGET_DEBUG_D_MODE
825 && GET_CODE (operands[0]) == REG
826 && M16_REG_P (REGNO (operands[0]))
827 && GET_CODE (operands[1]) == CONST_INT
828 && ((INTVAL (operands[1]) > 0x7f
829 && INTVAL (operands[1]) <= 0x7f + 0x7f)
830 || (INTVAL (operands[1]) < - 0x80
831 && INTVAL (operands[1]) >= - 0x80 - 0x80))"
832 [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
833 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))]
836 HOST_WIDE_INT val = INTVAL (operands[1]);
840 operands[1] = GEN_INT (0x7f);
841 operands[2] = GEN_INT (val - 0x7f);
845 operands[1] = GEN_INT (- 0x80);
846 operands[2] = GEN_INT (val + 0x80);
851 [(set (match_operand:SI 0 "register_operand" "")
852 (plus:SI (match_operand:SI 1 "register_operand" "")
853 (match_operand:SI 2 "const_int_operand" "")))]
854 "TARGET_MIPS16 && reload_completed && !TARGET_DEBUG_D_MODE
855 && GET_CODE (operands[0]) == REG
856 && M16_REG_P (REGNO (operands[0]))
857 && GET_CODE (operands[1]) == REG
858 && M16_REG_P (REGNO (operands[1]))
859 && REGNO (operands[0]) != REGNO (operands[1])
860 && GET_CODE (operands[2]) == CONST_INT
861 && ((INTVAL (operands[2]) > 0x7
862 && INTVAL (operands[2]) <= 0x7 + 0x7f)
863 || (INTVAL (operands[2]) < - 0x8
864 && INTVAL (operands[2]) >= - 0x8 - 0x80))"
865 [(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))
866 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 3)))]
869 HOST_WIDE_INT val = INTVAL (operands[2]);
873 operands[2] = GEN_INT (0x7);
874 operands[3] = GEN_INT (val - 0x7);
878 operands[2] = GEN_INT (- 0x8);
879 operands[3] = GEN_INT (val + 0x8);
883 (define_expand "adddi3"
884 [(parallel [(set (match_operand:DI 0 "register_operand" "")
885 (plus:DI (match_operand:DI 1 "register_operand" "")
886 (match_operand:DI 2 "arith_operand" "")))
887 (clobber (match_dup 3))])]
888 "TARGET_64BIT || (!TARGET_DEBUG_G_MODE && !TARGET_MIPS16)"
891 /* The mips16 assembler handles -32768 correctly, and so does gas,
892 but some other MIPS assemblers think that -32768 needs to be
893 loaded into a register before it can be added in. */
896 && GET_CODE (operands[2]) == CONST_INT
897 && INTVAL (operands[2]) == -32768)
898 operands[2] = force_reg (DImode, operands[2]);
900 /* If a large stack adjustment was forced into a register, we may be
901 asked to generate rtx such as:
903 (set (reg:DI sp) (plus:DI (reg:DI sp) (reg:DI pseudo)))
905 but no such instruction is available in mips16. Handle it by
906 using a temporary. */
908 && REGNO (operands[0]) == STACK_POINTER_REGNUM
909 && ((GET_CODE (operands[1]) == REG
910 && REGNO (operands[1]) != STACK_POINTER_REGNUM)
911 || GET_CODE (operands[2]) != CONST_INT))
913 rtx tmp = gen_reg_rtx (DImode);
915 emit_move_insn (tmp, operands[1]);
916 emit_insn (gen_addsi3 (tmp, tmp, operands[2]));
917 emit_move_insn (operands[0], tmp);
923 emit_insn (gen_adddi3_internal_3 (operands[0], operands[1],
928 operands[3] = gen_reg_rtx (SImode);
931 (define_insn "adddi3_internal_1"
932 [(set (match_operand:DI 0 "register_operand" "=d,&d")
933 (plus:DI (match_operand:DI 1 "register_operand" "0,d")
934 (match_operand:DI 2 "register_operand" "d,d")))
935 (clobber (match_operand:SI 3 "register_operand" "=d,d"))]
936 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16"
939 return (REGNO (operands[0]) == REGNO (operands[1])
940 && REGNO (operands[0]) == REGNO (operands[2]))
941 ? \"srl\\t%3,%L0,31\;sll\\t%M0,%M0,1\;sll\\t%L0,%L1,1\;addu\\t%M0,%M0,%3\"
942 : \"addu\\t%L0,%L1,%L2\;sltu\\t%3,%L0,%L2\;addu\\t%M0,%M1,%M2\;addu\\t%M0,%M0,%3\";
944 [(set_attr "type" "darith")
945 (set_attr "mode" "DI")
946 (set_attr "length" "16")])
949 [(set (match_operand:DI 0 "register_operand" "")
950 (plus:DI (match_operand:DI 1 "register_operand" "")
951 (match_operand:DI 2 "register_operand" "")))
952 (clobber (match_operand:SI 3 "register_operand" ""))]
953 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT
954 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
955 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
956 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
957 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))
958 && (REGNO (operands[0]) != REGNO (operands[1])
959 || REGNO (operands[0]) != REGNO (operands[2]))"
961 [(set (subreg:SI (match_dup 0) 0)
962 (plus:SI (subreg:SI (match_dup 1) 0)
963 (subreg:SI (match_dup 2) 0)))
966 (ltu:SI (subreg:SI (match_dup 0) 0)
967 (subreg:SI (match_dup 2) 0)))
969 (set (subreg:SI (match_dup 0) 4)
970 (plus:SI (subreg:SI (match_dup 1) 4)
971 (subreg:SI (match_dup 2) 4)))
973 (set (subreg:SI (match_dup 0) 4)
974 (plus:SI (subreg:SI (match_dup 0) 4)
979 [(set (match_operand:DI 0 "register_operand" "")
980 (plus:DI (match_operand:DI 1 "register_operand" "")
981 (match_operand:DI 2 "register_operand" "")))
982 (clobber (match_operand:SI 3 "register_operand" ""))]
983 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT
984 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
985 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
986 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
987 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))
988 && (REGNO (operands[0]) != REGNO (operands[1])
989 || REGNO (operands[0]) != REGNO (operands[2]))"
991 [(set (subreg:SI (match_dup 0) 4)
992 (plus:SI (subreg:SI (match_dup 1) 4)
993 (subreg:SI (match_dup 2) 4)))
996 (ltu:SI (subreg:SI (match_dup 0) 4)
997 (subreg:SI (match_dup 2) 4)))
999 (set (subreg:SI (match_dup 0) 0)
1000 (plus:SI (subreg:SI (match_dup 1) 0)
1001 (subreg:SI (match_dup 2) 0)))
1003 (set (subreg:SI (match_dup 0) 0)
1004 (plus:SI (subreg:SI (match_dup 0) 0)
1008 (define_insn "adddi3_internal_2"
1009 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
1010 (plus:DI (match_operand:DI 1 "register_operand" "%d,%d,%d")
1011 (match_operand:DI 2 "small_int" "P,J,N")))
1012 (clobber (match_operand:SI 3 "register_operand" "=d,d,d"))]
1013 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
1015 || GET_CODE (operands[2]) != CONST_INT
1016 || INTVAL (operands[2]) != -32768)"
1018 addu\\t%L0,%L1,%2\;sltu\\t%3,%L0,%2\;addu\\t%M0,%M1,%3
1019 move\\t%L0,%L1\;move\\t%M0,%M1
1020 subu\\t%L0,%L1,%n2\;sltu\\t%3,%L0,%2\;subu\\t%M0,%M1,1\;addu\\t%M0,%M0,%3"
1021 [(set_attr "type" "darith")
1022 (set_attr "mode" "DI")
1023 (set_attr "length" "12,8,16")])
1026 [(set (match_operand:DI 0 "register_operand" "")
1027 (plus:DI (match_operand:DI 1 "register_operand" "")
1028 (match_operand:DI 2 "small_int" "")))
1029 (clobber (match_operand:SI 3 "register_operand" ""))]
1030 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT
1031 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
1032 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
1033 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
1034 && INTVAL (operands[2]) > 0"
1036 [(set (subreg:SI (match_dup 0) 0)
1037 (plus:SI (subreg:SI (match_dup 1) 0)
1041 (ltu:SI (subreg:SI (match_dup 0) 0)
1044 (set (subreg:SI (match_dup 0) 4)
1045 (plus:SI (subreg:SI (match_dup 1) 4)
1050 [(set (match_operand:DI 0 "register_operand" "")
1051 (plus:DI (match_operand:DI 1 "register_operand" "")
1052 (match_operand:DI 2 "small_int" "")))
1053 (clobber (match_operand:SI 3 "register_operand" ""))]
1054 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT
1055 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
1056 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
1057 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
1058 && INTVAL (operands[2]) > 0"
1060 [(set (subreg:SI (match_dup 0) 4)
1061 (plus:SI (subreg:SI (match_dup 1) 4)
1065 (ltu:SI (subreg:SI (match_dup 0) 4)
1068 (set (subreg:SI (match_dup 0) 0)
1069 (plus:SI (subreg:SI (match_dup 1) 0)
1073 (define_insn "adddi3_internal_3"
1074 [(set (match_operand:DI 0 "register_operand" "=d,d")
1075 (plus:DI (match_operand:DI 1 "reg_or_0_operand" "dJ,dJ")
1076 (match_operand:DI 2 "arith_operand" "d,Q")))]
1080 || GET_CODE (operands[2]) != CONST_INT
1081 || INTVAL (operands[2]) != -32768)"
1085 [(set_attr "type" "darith")
1086 (set_attr "mode" "DI")])
1088 ;; For the mips16, we need to recognize stack pointer additions
1089 ;; explicitly, since we don't have a constraint for $sp. These insns
1090 ;; will be generated by the save_restore_insns functions.
1094 (plus:DI (reg:DI 29)
1095 (match_operand:DI 0 "small_int" "I")))]
1096 "TARGET_MIPS16 && TARGET_64BIT"
1098 [(set_attr "type" "arith")
1099 (set_attr "mode" "DI")
1100 (set (attr "length") (if_then_else (match_operand:VOID 0 "m16_simm8_8" "")
1105 [(set (match_operand:DI 0 "register_operand" "=d")
1106 (plus:DI (reg:DI 29)
1107 (match_operand:DI 1 "small_int" "I")))]
1108 "TARGET_MIPS16 && TARGET_64BIT"
1110 [(set_attr "type" "arith")
1111 (set_attr "mode" "DI")
1112 (set (attr "length") (if_then_else (match_operand:VOID 0 "m16_uimm5_4" "")
1117 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
1118 (plus:DI (match_operand:DI 1 "register_operand" "0,d,d")
1119 (match_operand:DI 2 "arith_operand" "Q,O,d")))]
1120 "TARGET_MIPS16 && TARGET_64BIT
1121 && (GET_CODE (operands[1]) != REG
1122 || REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER
1123 || M16_REG_P (REGNO (operands[1]))
1124 || REGNO (operands[1]) == ARG_POINTER_REGNUM
1125 || REGNO (operands[1]) == FRAME_POINTER_REGNUM
1126 || REGNO (operands[1]) == STACK_POINTER_REGNUM)
1127 && (GET_CODE (operands[2]) != REG
1128 || REGNO (operands[2]) >= FIRST_PSEUDO_REGISTER
1129 || M16_REG_P (REGNO (operands[2]))
1130 || REGNO (operands[2]) == ARG_POINTER_REGNUM
1131 || REGNO (operands[2]) == FRAME_POINTER_REGNUM
1132 || REGNO (operands[2]) == STACK_POINTER_REGNUM)"
1135 if (REGNO (operands[0]) == REGNO (operands[1]))
1136 return \"daddu\\t%0,%2\";
1137 return \"daddu\\t%0,%1,%2\";
1139 [(set_attr "type" "arith")
1140 (set_attr "mode" "DI")
1141 (set_attr_alternative "length"
1142 [(if_then_else (match_operand:VOID 2 "m16_simm5_1" "")
1145 (if_then_else (match_operand:VOID 2 "m16_simm4_1" "")
1151 ;; On the mips16, we can sometimes split an add of a constant which is
1152 ;; a 4 byte instruction into two adds which are both 2 byte
1153 ;; instructions. There are two cases: one where we are adding a
1154 ;; constant plus a register to another register, and one where we are
1155 ;; simply adding a constant to a register.
1158 [(set (match_operand:DI 0 "register_operand" "")
1159 (plus:DI (match_dup 0)
1160 (match_operand:DI 1 "const_int_operand" "")))]
1161 "TARGET_MIPS16 && TARGET_64BIT && reload_completed && !TARGET_DEBUG_D_MODE
1162 && GET_CODE (operands[0]) == REG
1163 && M16_REG_P (REGNO (operands[0]))
1164 && GET_CODE (operands[1]) == CONST_INT
1165 && ((INTVAL (operands[1]) > 0xf
1166 && INTVAL (operands[1]) <= 0xf + 0xf)
1167 || (INTVAL (operands[1]) < - 0x10
1168 && INTVAL (operands[1]) >= - 0x10 - 0x10))"
1169 [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 1)))
1170 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2)))]
1173 HOST_WIDE_INT val = INTVAL (operands[1]);
1177 operands[1] = GEN_INT (0xf);
1178 operands[2] = GEN_INT (val - 0xf);
1182 operands[1] = GEN_INT (- 0x10);
1183 operands[2] = GEN_INT (val + 0x10);
1188 [(set (match_operand:DI 0 "register_operand" "")
1189 (plus:DI (match_operand:DI 1 "register_operand" "")
1190 (match_operand:DI 2 "const_int_operand" "")))]
1191 "TARGET_MIPS16 && TARGET_64BIT && reload_completed && !TARGET_DEBUG_D_MODE
1192 && GET_CODE (operands[0]) == REG
1193 && M16_REG_P (REGNO (operands[0]))
1194 && GET_CODE (operands[1]) == REG
1195 && M16_REG_P (REGNO (operands[1]))
1196 && REGNO (operands[0]) != REGNO (operands[1])
1197 && GET_CODE (operands[2]) == CONST_INT
1198 && ((INTVAL (operands[2]) > 0x7
1199 && INTVAL (operands[2]) <= 0x7 + 0xf)
1200 || (INTVAL (operands[2]) < - 0x8
1201 && INTVAL (operands[2]) >= - 0x8 - 0x10))"
1202 [(set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))
1203 (set (match_dup 0) (plus:DI (match_dup 0) (match_dup 3)))]
1206 HOST_WIDE_INT val = INTVAL (operands[2]);
1210 operands[2] = GEN_INT (0x7);
1211 operands[3] = GEN_INT (val - 0x7);
1215 operands[2] = GEN_INT (- 0x8);
1216 operands[3] = GEN_INT (val + 0x8);
1220 (define_insn "addsi3_internal_2"
1221 [(set (match_operand:DI 0 "register_operand" "=d,d")
1222 (sign_extend:DI (plus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ,dJ")
1223 (match_operand:SI 2 "arith_operand" "d,Q"))))]
1227 || GET_CODE (operands[2]) != CONST_INT
1228 || INTVAL (operands[2]) != -32768)"
1232 [(set_attr "type" "arith")
1233 (set_attr "mode" "SI")])
1236 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
1237 (sign_extend:DI (plus:SI (match_operand:SI 1 "register_operand" "0,d,d")
1238 (match_operand:SI 2 "arith_operand" "Q,O,d"))))]
1239 "TARGET_MIPS16 && TARGET_64BIT"
1242 if (REGNO (operands[0]) == REGNO (operands[1]))
1243 return \"addu\\t%0,%2\";
1244 return \"addu\\t%0,%1,%2\";
1246 [(set_attr "type" "arith")
1247 (set_attr "mode" "SI")
1248 (set_attr_alternative "length"
1249 [(if_then_else (match_operand:VOID 2 "m16_simm8_1" "")
1252 (if_then_else (match_operand:VOID 2 "m16_simm4_1" "")
1259 ;; ....................
1263 ;; ....................
1266 (define_insn "subdf3"
1267 [(set (match_operand:DF 0 "register_operand" "=f")
1268 (minus:DF (match_operand:DF 1 "register_operand" "f")
1269 (match_operand:DF 2 "register_operand" "f")))]
1270 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
1272 [(set_attr "type" "fadd")
1273 (set_attr "mode" "DF")])
1275 (define_insn "subsf3"
1276 [(set (match_operand:SF 0 "register_operand" "=f")
1277 (minus:SF (match_operand:SF 1 "register_operand" "f")
1278 (match_operand:SF 2 "register_operand" "f")))]
1281 [(set_attr "type" "fadd")
1282 (set_attr "mode" "SF")])
1284 (define_expand "subsi3"
1285 [(set (match_operand:SI 0 "register_operand" "=d")
1286 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
1287 (match_operand:SI 2 "arith_operand" "dI")))]
1291 if (GET_CODE (operands[2]) == CONST_INT
1292 && (INTVAL (operands[2]) == -32768
1294 && INTVAL (operands[2]) == -0x4000)))
1295 operands[2] = force_reg (SImode, operands[2]);
1298 (define_insn "subsi3_internal"
1299 [(set (match_operand:SI 0 "register_operand" "=d")
1300 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
1301 (match_operand:SI 2 "arith_operand" "dI")))]
1303 && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768)"
1305 [(set_attr "type" "arith")
1306 (set_attr "mode" "SI")])
1308 ;; For the mips16, we need to recognize stack pointer subtractions
1309 ;; explicitly, since we don't have a constraint for $sp. These insns
1310 ;; will be generated by the save_restore_insns functions.
1314 (minus:SI (reg:SI 29)
1315 (match_operand:SI 0 "small_int" "I")))]
1317 && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768)"
1319 [(set_attr "type" "arith")
1320 (set_attr "mode" "SI")
1321 (set (attr "length") (if_then_else (match_operand:VOID 0 "m16_nsimm8_8" "")
1326 [(set (match_operand:SI 0 "register_operand" "=d")
1327 (minus:SI (reg:SI 29)
1328 (match_operand:SI 1 "small_int" "I")))]
1330 && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768)"
1332 [(set_attr "type" "arith")
1333 (set_attr "mode" "SI")
1334 (set (attr "length") (if_then_else (match_operand:VOID 1 "m16_nuimm8_4" "")
1340 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
1341 (minus:SI (match_operand:SI 1 "register_operand" "0,d,d")
1342 (match_operand:SI 2 "arith_operand" "I,O,d")))]
1344 && (GET_CODE (operands[2]) != CONST_INT
1345 || (INTVAL (operands[2]) != -32768 && INTVAL (operands[2]) != -0x4000))"
1348 if (REGNO (operands[0]) == REGNO (operands[1]))
1349 return \"subu\\t%0,%2\";
1350 return \"subu\\t%0,%1,%2\";
1352 [(set_attr "type" "arith")
1353 (set_attr "mode" "SI")
1354 (set_attr_alternative "length"
1355 [(if_then_else (match_operand:VOID 2 "m16_nsimm8_1" "")
1358 (if_then_else (match_operand:VOID 2 "m16_nsimm4_1" "")
1363 ;; On the mips16, we can sometimes split a subtract of a constant
1364 ;; which is a 4 byte instruction into two adds which are both 2 byte
1365 ;; instructions. There are two cases: one where we are setting a
1366 ;; register to a register minus a constant, and one where we are
1367 ;; simply subtracting a constant from a register.
1370 [(set (match_operand:SI 0 "register_operand" "")
1371 (minus:SI (match_dup 0)
1372 (match_operand:SI 1 "const_int_operand" "")))]
1373 "TARGET_MIPS16 && reload_completed && !TARGET_DEBUG_D_MODE
1374 && GET_CODE (operands[0]) == REG
1375 && M16_REG_P (REGNO (operands[0]))
1376 && GET_CODE (operands[1]) == CONST_INT
1377 && ((INTVAL (operands[1]) > 0x80
1378 && INTVAL (operands[1]) <= 0x80 + 0x80)
1379 || (INTVAL (operands[1]) < - 0x7f
1380 && INTVAL (operands[1]) >= - 0x7f - 0x7f))"
1381 [(set (match_dup 0) (minus:SI (match_dup 0) (match_dup 1)))
1382 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 2)))]
1385 HOST_WIDE_INT val = INTVAL (operands[1]);
1389 operands[1] = GEN_INT (0x80);
1390 operands[2] = GEN_INT (val - 0x80);
1394 operands[1] = GEN_INT (- 0x7f);
1395 operands[2] = GEN_INT (val + 0x7f);
1400 [(set (match_operand:SI 0 "register_operand" "")
1401 (minus:SI (match_operand:SI 1 "register_operand" "")
1402 (match_operand:SI 2 "const_int_operand" "")))]
1403 "TARGET_MIPS16 && reload_completed && !TARGET_DEBUG_D_MODE
1404 && GET_CODE (operands[0]) == REG
1405 && M16_REG_P (REGNO (operands[0]))
1406 && GET_CODE (operands[1]) == REG
1407 && M16_REG_P (REGNO (operands[1]))
1408 && REGNO (operands[0]) != REGNO (operands[1])
1409 && GET_CODE (operands[2]) == CONST_INT
1410 && ((INTVAL (operands[2]) > 0x8
1411 && INTVAL (operands[2]) <= 0x8 + 0x80)
1412 || (INTVAL (operands[2]) < - 0x7
1413 && INTVAL (operands[2]) >= - 0x7 - 0x7f))"
1414 [(set (match_dup 0) (minus:SI (match_dup 1) (match_dup 2)))
1415 (set (match_dup 0) (minus:SI (match_dup 0) (match_dup 3)))]
1418 HOST_WIDE_INT val = INTVAL (operands[2]);
1422 operands[2] = GEN_INT (0x8);
1423 operands[3] = GEN_INT (val - 0x8);
1427 operands[2] = GEN_INT (- 0x7);
1428 operands[3] = GEN_INT (val + 0x7);
1432 (define_expand "subdi3"
1433 [(parallel [(set (match_operand:DI 0 "register_operand" "=d")
1434 (minus:DI (match_operand:DI 1 "register_operand" "d")
1435 (match_operand:DI 2 "register_operand" "d")))
1436 (clobber (match_dup 3))])]
1437 "TARGET_64BIT || (!TARGET_DEBUG_G_MODE && !TARGET_MIPS16)"
1442 emit_insn (gen_subdi3_internal_3 (operands[0], operands[1],
1447 operands[3] = gen_reg_rtx (SImode);
1450 (define_insn "subdi3_internal"
1451 [(set (match_operand:DI 0 "register_operand" "=d")
1452 (minus:DI (match_operand:DI 1 "register_operand" "d")
1453 (match_operand:DI 2 "register_operand" "d")))
1454 (clobber (match_operand:SI 3 "register_operand" "=d"))]
1455 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16"
1456 "sltu\\t%3,%L1,%L2\;subu\\t%L0,%L1,%L2\;subu\\t%M0,%M1,%M2\;subu\\t%M0,%M0,%3"
1457 [(set_attr "type" "darith")
1458 (set_attr "mode" "DI")
1459 (set_attr "length" "16")])
1462 [(set (match_operand:DI 0 "register_operand" "")
1463 (minus:DI (match_operand:DI 1 "register_operand" "")
1464 (match_operand:DI 2 "register_operand" "")))
1465 (clobber (match_operand:SI 3 "register_operand" ""))]
1466 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT
1467 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
1468 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
1469 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
1470 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
1473 (ltu:SI (subreg:SI (match_dup 1) 0)
1474 (subreg:SI (match_dup 2) 0)))
1476 (set (subreg:SI (match_dup 0) 0)
1477 (minus:SI (subreg:SI (match_dup 1) 0)
1478 (subreg:SI (match_dup 2) 0)))
1480 (set (subreg:SI (match_dup 0) 4)
1481 (minus:SI (subreg:SI (match_dup 1) 4)
1482 (subreg:SI (match_dup 2) 4)))
1484 (set (subreg:SI (match_dup 0) 4)
1485 (minus:SI (subreg:SI (match_dup 0) 4)
1490 [(set (match_operand:DI 0 "register_operand" "")
1491 (minus:DI (match_operand:DI 1 "register_operand" "")
1492 (match_operand:DI 2 "register_operand" "")))
1493 (clobber (match_operand:SI 3 "register_operand" ""))]
1494 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT
1495 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
1496 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
1497 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
1498 && GET_CODE (operands[2]) == REG && GP_REG_P (REGNO (operands[2]))"
1501 (ltu:SI (subreg:SI (match_dup 1) 4)
1502 (subreg:SI (match_dup 2) 4)))
1504 (set (subreg:SI (match_dup 0) 4)
1505 (minus:SI (subreg:SI (match_dup 1) 4)
1506 (subreg:SI (match_dup 2) 4)))
1508 (set (subreg:SI (match_dup 0) 0)
1509 (minus:SI (subreg:SI (match_dup 1) 0)
1510 (subreg:SI (match_dup 2) 0)))
1512 (set (subreg:SI (match_dup 0) 0)
1513 (minus:SI (subreg:SI (match_dup 0) 0)
1517 (define_insn "subdi3_internal_2"
1518 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
1519 (minus:DI (match_operand:DI 1 "register_operand" "d,d,d")
1520 (match_operand:DI 2 "small_int" "P,J,N")))
1521 (clobber (match_operand:SI 3 "register_operand" "=d,d,d"))]
1522 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
1523 && INTVAL (operands[2]) != -32768"
1525 sltu\\t%3,%L1,%2\;subu\\t%L0,%L1,%2\;subu\\t%M0,%M1,%3
1526 move\\t%L0,%L1\;move\\t%M0,%M1
1527 sltu\\t%3,%L1,%2\;subu\\t%L0,%L1,%2\;subu\\t%M0,%M1,1\;subu\\t%M0,%M0,%3"
1528 [(set_attr "type" "darith")
1529 (set_attr "mode" "DI")
1530 (set_attr "length" "12,8,16")])
1533 [(set (match_operand:DI 0 "register_operand" "")
1534 (minus:DI (match_operand:DI 1 "register_operand" "")
1535 (match_operand:DI 2 "small_int" "")))
1536 (clobber (match_operand:SI 3 "register_operand" ""))]
1537 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT
1538 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
1539 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
1540 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
1541 && INTVAL (operands[2]) > 0"
1544 (ltu:SI (subreg:SI (match_dup 1) 0)
1547 (set (subreg:SI (match_dup 0) 0)
1548 (minus:SI (subreg:SI (match_dup 1) 0)
1551 (set (subreg:SI (match_dup 0) 4)
1552 (minus:SI (subreg:SI (match_dup 1) 4)
1557 [(set (match_operand:DI 0 "register_operand" "")
1558 (minus:DI (match_operand:DI 1 "register_operand" "")
1559 (match_operand:DI 2 "small_int" "")))
1560 (clobber (match_operand:SI 3 "register_operand" ""))]
1561 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT
1562 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
1563 && GET_CODE (operands[0]) == REG && GP_REG_P (REGNO (operands[0]))
1564 && GET_CODE (operands[1]) == REG && GP_REG_P (REGNO (operands[1]))
1565 && INTVAL (operands[2]) > 0"
1568 (ltu:SI (subreg:SI (match_dup 1) 4)
1571 (set (subreg:SI (match_dup 0) 4)
1572 (minus:SI (subreg:SI (match_dup 1) 4)
1575 (set (subreg:SI (match_dup 0) 0)
1576 (minus:SI (subreg:SI (match_dup 1) 0)
1580 (define_insn "subdi3_internal_3"
1581 [(set (match_operand:DI 0 "register_operand" "=d")
1582 (minus:DI (match_operand:DI 1 "reg_or_0_operand" "dJ")
1583 (match_operand:DI 2 "arith_operand" "dI")))]
1584 "TARGET_64BIT && !TARGET_MIPS16
1585 && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768)"
1588 return (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
1589 ? \"daddu\\t%0,%z1,%n2\"
1590 : \"dsubu\\t%0,%z1,%2\";
1592 [(set_attr "type" "darith")
1593 (set_attr "mode" "DI")])
1595 ;; For the mips16, we need to recognize stack pointer subtractions
1596 ;; explicitly, since we don't have a constraint for $sp. These insns
1597 ;; will be generated by the save_restore_insns functions.
1601 (minus:DI (reg:DI 29)
1602 (match_operand:DI 0 "small_int" "I")))]
1604 && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768)"
1606 [(set_attr "type" "arith")
1607 (set_attr "mode" "DI")
1608 (set (attr "length") (if_then_else (match_operand:VOID 0 "m16_nsimm8_8" "")
1613 [(set (match_operand:DI 0 "register_operand" "=d")
1614 (minus:DI (reg:DI 29)
1615 (match_operand:DI 1 "small_int" "I")))]
1617 && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768)"
1619 [(set_attr "type" "arith")
1620 (set_attr "mode" "DI")
1621 (set (attr "length") (if_then_else (match_operand:VOID 0 "m16_nuimm5_4" "")
1626 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
1627 (minus:DI (match_operand:DI 1 "register_operand" "0,d,d")
1628 (match_operand:DI 2 "arith_operand" "I,O,d")))]
1630 && (GET_CODE (operands[2]) != CONST_INT
1631 || (INTVAL (operands[2]) != -32768 && INTVAL (operands[2]) != -0x4000))"
1634 if (REGNO (operands[0]) == REGNO (operands[1]))
1635 return \"dsubu\\t%0,%2\";
1636 return \"dsubu\\t%0,%1,%2\";
1638 [(set_attr "type" "arith")
1639 (set_attr "mode" "DI")
1640 (set_attr_alternative "length"
1641 [(if_then_else (match_operand:VOID 2 "m16_nsimm5_1" "")
1644 (if_then_else (match_operand:VOID 2 "m16_nsimm4_1" "")
1649 ;; On the mips16, we can sometimes split an add of a constant which is
1650 ;; a 4 byte instruction into two adds which are both 2 byte
1651 ;; instructions. There are two cases: one where we are adding a
1652 ;; constant plus a register to another register, and one where we are
1653 ;; simply adding a constant to a register.
1656 [(set (match_operand:DI 0 "register_operand" "")
1657 (minus:DI (match_dup 0)
1658 (match_operand:DI 1 "const_int_operand" "")))]
1659 "TARGET_MIPS16 && TARGET_64BIT && reload_completed && !TARGET_DEBUG_D_MODE
1660 && GET_CODE (operands[0]) == REG
1661 && M16_REG_P (REGNO (operands[0]))
1662 && GET_CODE (operands[1]) == CONST_INT
1663 && ((INTVAL (operands[1]) > 0x10
1664 && INTVAL (operands[1]) <= 0x10 + 0x10)
1665 || (INTVAL (operands[1]) < - 0xf
1666 && INTVAL (operands[1]) >= - 0xf - 0xf))"
1667 [(set (match_dup 0) (minus:DI (match_dup 0) (match_dup 1)))
1668 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 2)))]
1671 HOST_WIDE_INT val = INTVAL (operands[1]);
1675 operands[1] = GEN_INT (0xf);
1676 operands[2] = GEN_INT (val - 0xf);
1680 operands[1] = GEN_INT (- 0x10);
1681 operands[2] = GEN_INT (val + 0x10);
1686 [(set (match_operand:DI 0 "register_operand" "")
1687 (minus:DI (match_operand:DI 1 "register_operand" "")
1688 (match_operand:DI 2 "const_int_operand" "")))]
1689 "TARGET_MIPS16 && TARGET_64BIT && reload_completed && !TARGET_DEBUG_D_MODE
1690 && GET_CODE (operands[0]) == REG
1691 && M16_REG_P (REGNO (operands[0]))
1692 && GET_CODE (operands[1]) == REG
1693 && M16_REG_P (REGNO (operands[1]))
1694 && REGNO (operands[0]) != REGNO (operands[1])
1695 && GET_CODE (operands[2]) == CONST_INT
1696 && ((INTVAL (operands[2]) > 0x8
1697 && INTVAL (operands[2]) <= 0x8 + 0x10)
1698 || (INTVAL (operands[2]) < - 0x7
1699 && INTVAL (operands[2]) >= - 0x7 - 0xf))"
1700 [(set (match_dup 0) (minus:DI (match_dup 1) (match_dup 2)))
1701 (set (match_dup 0) (minus:DI (match_dup 0) (match_dup 3)))]
1704 HOST_WIDE_INT val = INTVAL (operands[2]);
1708 operands[2] = GEN_INT (0x8);
1709 operands[3] = GEN_INT (val - 0x8);
1713 operands[2] = GEN_INT (- 0x7);
1714 operands[3] = GEN_INT (val + 0x7);
1718 (define_insn "subsi3_internal_2"
1719 [(set (match_operand:DI 0 "register_operand" "=d")
1720 (sign_extend:DI (minus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
1721 (match_operand:SI 2 "arith_operand" "dI"))))]
1722 "TARGET_64BIT && !TARGET_MIPS16
1723 && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != -32768)"
1726 return (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
1727 ? \"addu\\t%0,%z1,%n2\"
1728 : \"subu\\t%0,%z1,%2\";
1730 [(set_attr "type" "arith")
1731 (set_attr "mode" "DI")])
1734 [(set (match_operand:DI 0 "register_operand" "=d,d,d")
1735 (sign_extend:DI (minus:SI (match_operand:SI 1 "register_operand" "0,d,d")
1736 (match_operand:SI 2 "arith_operand" "I,O,d"))))]
1737 "TARGET_64BIT && TARGET_MIPS16
1738 && (GET_CODE (operands[2]) != CONST_INT
1739 || (INTVAL (operands[2]) != -32768 && INTVAL (operands[2]) != -0x4000))"
1742 if (REGNO (operands[0]) == REGNO (operands[1]))
1743 return \"subu\\t%0,%2\";
1744 return \"subu\\t%0,%1,%2\";
1746 [(set_attr "type" "arith")
1747 (set_attr "mode" "SI")
1748 (set_attr_alternative "length"
1749 [(if_then_else (match_operand:VOID 2 "m16_nsimm8_1" "")
1752 (if_then_else (match_operand:VOID 2 "m16_nsimm4_1" "")
1760 ;; ....................
1764 ;; ....................
1767 ;; Early Vr4300 silicon has a CPU bug where multiplies with certain
1768 ;; operands may corrupt immediately following multiplies. This is a
1769 ;; simple fix to insert NOPs.
1771 (define_expand "muldf3"
1772 [(set (match_operand:DF 0 "register_operand" "=f")
1773 (mult:DF (match_operand:DF 1 "register_operand" "f")
1774 (match_operand:DF 2 "register_operand" "f")))]
1775 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
1778 if (!TARGET_MIPS4300)
1779 emit_insn (gen_muldf3_internal (operands[0], operands[1], operands[2]));
1781 emit_insn (gen_muldf3_r4300 (operands[0], operands[1], operands[2]));
1785 (define_insn "muldf3_internal"
1786 [(set (match_operand:DF 0 "register_operand" "=f")
1787 (mult:DF (match_operand:DF 1 "register_operand" "f")
1788 (match_operand:DF 2 "register_operand" "f")))]
1789 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && !TARGET_MIPS4300"
1791 [(set_attr "type" "fmul")
1792 (set_attr "mode" "DF")])
1794 (define_insn "muldf3_r4300"
1795 [(set (match_operand:DF 0 "register_operand" "=f")
1796 (mult:DF (match_operand:DF 1 "register_operand" "f")
1797 (match_operand:DF 2 "register_operand" "f")))]
1798 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_MIPS4300"
1801 output_asm_insn (\"mul.d\\t%0,%1,%2\", operands);
1802 if (TARGET_4300_MUL_FIX)
1803 output_asm_insn (\"nop\", operands);
1806 [(set_attr "type" "fmul")
1807 (set_attr "mode" "DF")
1808 (set_attr "length" "8")]) ;; mul.d + nop
1810 (define_expand "mulsf3"
1811 [(set (match_operand:SF 0 "register_operand" "=f")
1812 (mult:SF (match_operand:SF 1 "register_operand" "f")
1813 (match_operand:SF 2 "register_operand" "f")))]
1817 if (!TARGET_MIPS4300)
1818 emit_insn( gen_mulsf3_internal (operands[0], operands[1], operands[2]));
1820 emit_insn( gen_mulsf3_r4300 (operands[0], operands[1], operands[2]));
1824 (define_insn "mulsf3_internal"
1825 [(set (match_operand:SF 0 "register_operand" "=f")
1826 (mult:SF (match_operand:SF 1 "register_operand" "f")
1827 (match_operand:SF 2 "register_operand" "f")))]
1828 "TARGET_HARD_FLOAT && !TARGET_MIPS4300"
1830 [(set_attr "type" "fmul")
1831 (set_attr "mode" "SF")])
1833 (define_insn "mulsf3_r4300"
1834 [(set (match_operand:SF 0 "register_operand" "=f")
1835 (mult:SF (match_operand:SF 1 "register_operand" "f")
1836 (match_operand:SF 2 "register_operand" "f")))]
1837 "TARGET_HARD_FLOAT && TARGET_MIPS4300"
1840 output_asm_insn (\"mul.s\\t%0,%1,%2\", operands);
1841 if (TARGET_4300_MUL_FIX)
1842 output_asm_insn (\"nop\", operands);
1845 [(set_attr "type" "fmul")
1846 (set_attr "mode" "SF")
1847 (set_attr "length" "8")]) ;; mul.s + nop
1850 ;; ??? The R4000 (only) has a cpu bug. If a double-word shift executes while
1851 ;; a multiply is in progress, it may give an incorrect result. Avoid
1852 ;; this by keeping the mflo with the mult on the R4000.
1854 (define_expand "mulsi3"
1855 [(set (match_operand:SI 0 "register_operand" "")
1856 (mult:SI (match_operand:SI 1 "register_operand" "")
1857 (match_operand:SI 2 "register_operand" "")))]
1861 if (GENERATE_MULT3_SI || TARGET_MAD)
1862 emit_insn (gen_mulsi3_mult3 (operands[0], operands[1], operands[2]));
1863 else if (!TARGET_MIPS4000 || TARGET_MIPS16)
1864 emit_insn (gen_mulsi3_internal (operands[0], operands[1], operands[2]));
1866 emit_insn (gen_mulsi3_r4000 (operands[0], operands[1], operands[2]));
1870 (define_insn "mulsi3_mult3"
1871 [(set (match_operand:SI 0 "register_operand" "=d,l")
1872 (mult:SI (match_operand:SI 1 "register_operand" "d,d")
1873 (match_operand:SI 2 "register_operand" "d,d")))
1874 (clobber (match_scratch:SI 3 "=h,h"))
1875 (clobber (match_scratch:SI 4 "=l,X"))]
1880 if (which_alternative == 1)
1881 return \"mult\\t%1,%2\";
1888 return \"mul\\t%0,%1,%2\";
1889 return \"mult\\t%0,%1,%2\";
1891 [(set_attr "type" "imul")
1892 (set_attr "mode" "SI")])
1894 ;; If a register gets allocated to LO, and we spill to memory, the reload
1895 ;; will include a move from LO to a GPR. Merge it into the multiplication
1896 ;; if it can set the GPR directly.
1899 ;; Operand 1: GPR (1st multiplication operand)
1900 ;; Operand 2: GPR (2nd multiplication operand)
1902 ;; Operand 4: GPR (destination)
1905 [(set (match_operand:SI 0 "register_operand" "")
1906 (mult:SI (match_operand:SI 1 "register_operand" "")
1907 (match_operand:SI 2 "register_operand" "")))
1908 (clobber (match_operand:SI 3 "register_operand" ""))
1909 (clobber (scratch:SI))])
1910 (set (match_operand:SI 4 "register_operand" "")
1913 && true_regnum (operands[0]) == LO_REGNUM
1914 && GP_REG_P (true_regnum (operands[4]))
1915 && peep2_reg_dead_p (2, operands[0])"
1918 (mult:SI (match_dup 1)
1920 (clobber (match_dup 3))
1921 (clobber (match_dup 0))])])
1923 (define_insn "mulsi3_internal"
1924 [(set (match_operand:SI 0 "register_operand" "=l")
1925 (mult:SI (match_operand:SI 1 "register_operand" "d")
1926 (match_operand:SI 2 "register_operand" "d")))
1927 (clobber (match_scratch:SI 3 "=h"))]
1928 "!TARGET_MIPS4000 || TARGET_MIPS16"
1930 [(set_attr "type" "imul")
1931 (set_attr "mode" "SI")])
1933 (define_insn "mulsi3_r4000"
1934 [(set (match_operand:SI 0 "register_operand" "=d")
1935 (mult:SI (match_operand:SI 1 "register_operand" "d")
1936 (match_operand:SI 2 "register_operand" "d")))
1937 (clobber (match_scratch:SI 3 "=h"))
1938 (clobber (match_scratch:SI 4 "=l"))]
1939 "TARGET_MIPS4000 && !TARGET_MIPS16"
1940 "mult\t%1,%2\;mflo\t%0"
1941 [(set_attr "type" "imul")
1942 (set_attr "mode" "SI")
1943 (set_attr "length" "8")])
1945 ;; Multiply-accumulate patterns
1947 ;; For processors that can copy the output to a general register:
1949 ;; The all-d alternative is needed because the combiner will find this
1950 ;; pattern and then register alloc/reload will move registers around to
1951 ;; make them fit, and we don't want to trigger unnecessary loads to LO.
1953 ;; The last alternative should be made slightly less desirable, but adding
1954 ;; "?" to the constraint is too strong, and causes values to be loaded into
1955 ;; LO even when that's more costly. For now, using "*d" mostly does the
1957 (define_insn "*mul_acc_si"
1958 [(set (match_operand:SI 0 "register_operand" "=l,*d,*d")
1959 (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "d,d,d")
1960 (match_operand:SI 2 "register_operand" "d,d,d"))
1961 (match_operand:SI 3 "register_operand" "0,l,*d")))
1962 (clobber (match_scratch:SI 4 "=h,h,h"))
1963 (clobber (match_scratch:SI 5 "=X,3,l"))
1964 (clobber (match_scratch:SI 6 "=X,X,&d"))]
1966 || ISA_HAS_MADD_MSUB)
1970 static const char *const madd[] = { \"madd\\t%1,%2\", \"madd\\t%0,%1,%2\" };
1971 if (which_alternative == 2)
1973 if (ISA_HAS_MADD_MSUB && which_alternative != 0)
1975 return madd[which_alternative];
1977 [(set_attr "type" "imadd,imadd,multi")
1978 (set_attr "mode" "SI")
1979 (set_attr "length" "4,4,8")])
1981 ;; Split the above insn if we failed to get LO allocated.
1983 [(set (match_operand:SI 0 "register_operand" "")
1984 (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "")
1985 (match_operand:SI 2 "register_operand" ""))
1986 (match_operand:SI 3 "register_operand" "")))
1987 (clobber (match_scratch:SI 4 ""))
1988 (clobber (match_scratch:SI 5 ""))
1989 (clobber (match_scratch:SI 6 ""))]
1990 "reload_completed && !TARGET_DEBUG_D_MODE
1991 && GP_REG_P (true_regnum (operands[0]))
1992 && GP_REG_P (true_regnum (operands[3]))"
1993 [(parallel [(set (match_dup 6)
1994 (mult:SI (match_dup 1) (match_dup 2)))
1995 (clobber (match_dup 4))
1996 (clobber (match_dup 5))])
1997 (set (match_dup 0) (plus:SI (match_dup 6) (match_dup 3)))]
2000 ;; Splitter to copy result of MADD to a general register
2002 [(set (match_operand:SI 0 "register_operand" "")
2003 (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "")
2004 (match_operand:SI 2 "register_operand" ""))
2005 (match_operand:SI 3 "register_operand" "")))
2006 (clobber (match_scratch:SI 4 ""))
2007 (clobber (match_scratch:SI 5 ""))
2008 (clobber (match_scratch:SI 6 ""))]
2009 "reload_completed && !TARGET_DEBUG_D_MODE
2010 && GP_REG_P (true_regnum (operands[0]))
2011 && true_regnum (operands[3]) == LO_REGNUM"
2012 [(parallel [(set (match_dup 3)
2013 (plus:SI (mult:SI (match_dup 1) (match_dup 2))
2015 (clobber (match_dup 4))
2016 (clobber (match_dup 5))
2017 (clobber (match_dup 6))])
2018 (set (match_dup 0) (match_dup 3))]
2021 (define_insn "*macc"
2022 [(set (match_operand:SI 0 "register_operand" "=l,d")
2023 (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "d,d")
2024 (match_operand:SI 2 "register_operand" "d,d"))
2025 (match_operand:SI 3 "register_operand" "0,l")))
2026 (clobber (match_scratch:SI 4 "=h,h"))
2027 (clobber (match_scratch:SI 5 "=X,3"))]
2031 if (which_alternative == 1)
2032 return \"macc\\t%0,%1,%2\";
2033 else if (TARGET_MIPS5500)
2034 return \"madd\\t%1,%2\";
2036 return \"macc\\t%.,%1,%2\";
2038 [(set_attr "type" "imadd")
2039 (set_attr "mode" "SI")])
2041 ;; Pattern generated by define_peephole2 below
2042 (define_insn "*macc2"
2043 [(set (match_operand:SI 0 "register_operand" "=l")
2044 (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "d")
2045 (match_operand:SI 2 "register_operand" "d"))
2047 (set (match_operand:SI 3 "register_operand" "=d")
2048 (plus:SI (mult:SI (match_dup 1)
2051 (clobber (match_scratch:SI 4 "=h"))]
2052 "ISA_HAS_MACC && reload_completed"
2054 [(set_attr "type" "imadd")
2055 (set_attr "mode" "SI")])
2057 ;; Convert macc $0,<r1>,<r2> & mflo <r3> into macc <r3>,<r1>,<r2>
2060 ;; Operand 1: GPR (1st multiplication operand)
2061 ;; Operand 2: GPR (2nd multiplication operand)
2063 ;; Operand 4: GPR (destination)
2066 [(set (match_operand:SI 0 "register_operand" "")
2067 (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "")
2068 (match_operand:SI 2 "register_operand" ""))
2070 (clobber (match_operand:SI 3 "register_operand" ""))
2071 (clobber (scratch:SI))])
2072 (set (match_operand:SI 4 "register_operand" "")
2075 && true_regnum (operands[0]) == LO_REGNUM
2076 && GP_REG_P (true_regnum (operands[4]))"
2077 [(parallel [(set (match_dup 0)
2078 (plus:SI (mult:SI (match_dup 1)
2082 (plus:SI (mult:SI (match_dup 1)
2085 (clobber (match_dup 3))])]
2088 ;; When we have a three-address multiplication instruction, it should
2089 ;; be faster to do a separate multiply and add, rather than moving
2090 ;; something into LO in order to use a macc instruction.
2092 ;; This peephole needs a scratch register to cater for the case when one
2093 ;; of the multiplication operands is the same as the destination.
2095 ;; Operand 0: GPR (scratch)
2097 ;; Operand 2: GPR (addend)
2098 ;; Operand 3: GPR (destination)
2099 ;; Operand 4: GPR (1st multiplication operand)
2100 ;; Operand 5: GPR (2nd multiplication operand)
2103 [(match_scratch:SI 0 "d")
2104 (set (match_operand:SI 1 "register_operand" "")
2105 (match_operand:SI 2 "register_operand" ""))
2108 [(set (match_operand:SI 3 "register_operand" "")
2109 (plus:SI (mult:SI (match_operand:SI 4 "register_operand" "")
2110 (match_operand:SI 5 "register_operand" ""))
2112 (clobber (match_operand:SI 6 "register_operand" ""))
2113 (clobber (match_dup 1))])]
2114 "ISA_HAS_MACC && GENERATE_MULT3_SI
2115 && true_regnum (operands[1]) == LO_REGNUM
2116 && peep2_reg_dead_p (2, operands[1])
2117 && GP_REG_P (true_regnum (operands[3]))"
2118 [(parallel [(set (match_dup 0)
2119 (mult:SI (match_dup 4)
2121 (clobber (match_dup 6))
2122 (clobber (match_dup 1))])
2124 (plus:SI (match_dup 0)
2128 ;; Same as above, except LO is the initial target of the macc.
2130 ;; Operand 0: GPR (scratch)
2132 ;; Operand 2: GPR (addend)
2133 ;; Operand 3: GPR (1st multiplication operand)
2134 ;; Operand 4: GPR (2nd multiplication operand)
2136 ;; Operand 6: GPR (destination)
2138 [(match_scratch:SI 0 "d")
2139 (set (match_operand:SI 1 "register_operand" "")
2140 (match_operand:SI 2 "register_operand" ""))
2144 (plus:SI (mult:SI (match_operand:SI 3 "register_operand" "")
2145 (match_operand:SI 4 "register_operand" ""))
2147 (clobber (match_operand:SI 5 "register_operand" ""))
2148 (clobber (scratch:SI))])
2150 (set (match_operand:SI 6 "register_operand" "")
2152 "ISA_HAS_MACC && GENERATE_MULT3_SI
2153 && true_regnum (operands[1]) == LO_REGNUM
2154 && peep2_reg_dead_p (3, operands[1])
2155 && GP_REG_P (true_regnum (operands[6]))"
2156 [(parallel [(set (match_dup 0)
2157 (mult:SI (match_dup 3)
2159 (clobber (match_dup 5))
2160 (clobber (match_dup 1))])
2162 (plus:SI (match_dup 0)
2166 (define_insn "*mul_sub_si"
2167 [(set (match_operand:SI 0 "register_operand" "=l,*d,*d")
2168 (minus:SI (match_operand:SI 1 "register_operand" "0,l,*d")
2169 (mult:SI (match_operand:SI 2 "register_operand" "d,d,d")
2170 (match_operand:SI 3 "register_operand" "d,d,d"))))
2171 (clobber (match_scratch:SI 4 "=h,h,h"))
2172 (clobber (match_scratch:SI 5 "=X,1,l"))
2173 (clobber (match_scratch:SI 6 "=X,X,&d"))]
2177 if (which_alternative != 0)
2179 return \"msub\\t%2,%3\";
2181 [(set_attr "type" "imadd,multi,multi")
2182 (set_attr "mode" "SI")
2183 (set_attr "length" "4,8,8")])
2185 ;; Split the above insn if we failed to get LO allocated.
2187 [(set (match_operand:SI 0 "register_operand" "")
2188 (minus:SI (match_operand:SI 1 "register_operand" "")
2189 (mult:SI (match_operand:SI 2 "register_operand" "")
2190 (match_operand:SI 3 "register_operand" ""))))
2191 (clobber (match_scratch:SI 4 ""))
2192 (clobber (match_scratch:SI 5 ""))
2193 (clobber (match_scratch:SI 6 ""))]
2194 "reload_completed && !TARGET_DEBUG_D_MODE
2195 && GP_REG_P (true_regnum (operands[0]))
2196 && GP_REG_P (true_regnum (operands[1]))"
2197 [(parallel [(set (match_dup 6)
2198 (mult:SI (match_dup 2) (match_dup 3)))
2199 (clobber (match_dup 4))
2200 (clobber (match_dup 5))])
2201 (set (match_dup 0) (minus:SI (match_dup 1) (match_dup 6)))]
2204 ;; Splitter to copy result of MSUB to a general register
2206 [(set (match_operand:SI 0 "register_operand" "")
2207 (minus:SI (match_operand:SI 1 "register_operand" "")
2208 (mult:SI (match_operand:SI 2 "register_operand" "")
2209 (match_operand:SI 3 "register_operand" ""))))
2210 (clobber (match_scratch:SI 4 ""))
2211 (clobber (match_scratch:SI 5 ""))
2212 (clobber (match_scratch:SI 6 ""))]
2213 "reload_completed && !TARGET_DEBUG_D_MODE
2214 && GP_REG_P (true_regnum (operands[0]))
2215 && true_regnum (operands[1]) == LO_REGNUM"
2216 [(parallel [(set (match_dup 1)
2217 (minus:SI (match_dup 1)
2218 (mult:SI (match_dup 2) (match_dup 3))))
2219 (clobber (match_dup 4))
2220 (clobber (match_dup 5))
2221 (clobber (match_dup 6))])
2222 (set (match_dup 0) (match_dup 1))]
2225 (define_insn "*muls"
2226 [(set (match_operand:SI 0 "register_operand" "=l,d")
2227 (neg:SI (mult:SI (match_operand:SI 1 "register_operand" "d,d")
2228 (match_operand:SI 2 "register_operand" "d,d"))))
2229 (clobber (match_scratch:SI 3 "=h,h"))
2230 (clobber (match_scratch:SI 4 "=X,l"))]
2235 [(set_attr "type" "imul")
2236 (set_attr "mode" "SI")])
2238 (define_insn "*msac"
2239 [(set (match_operand:SI 0 "register_operand" "=l,d")
2240 (minus:SI (match_operand:SI 1 "register_operand" "0,l")
2241 (mult:SI (match_operand:SI 2 "register_operand" "d,d")
2242 (match_operand:SI 3 "register_operand" "d,d"))))
2243 (clobber (match_scratch:SI 4 "=h,h"))
2244 (clobber (match_scratch:SI 5 "=X,1"))]
2248 if (which_alternative == 1)
2249 return \"msac\\t%0,%2,%3\";
2250 else if (TARGET_MIPS5500)
2251 return \"msub\\t%2,%3\";
2253 return \"msac\\t$0,%2,%3\";
2255 [(set_attr "type" "imadd")
2256 (set_attr "mode" "SI")])
2258 (define_expand "muldi3"
2259 [(set (match_operand:DI 0 "register_operand" "")
2260 (mult:DI (match_operand:DI 1 "register_operand" "")
2261 (match_operand:DI 2 "register_operand" "")))]
2266 if (GENERATE_MULT3_DI || TARGET_MIPS4000)
2267 emit_insn (gen_muldi3_internal2 (operands[0], operands[1], operands[2]));
2269 emit_insn (gen_muldi3_internal (operands[0], operands[1], operands[2]));
2273 (define_insn "muldi3_internal"
2274 [(set (match_operand:DI 0 "register_operand" "=l")
2275 (mult:DI (match_operand:DI 1 "register_operand" "d")
2276 (match_operand:DI 2 "register_operand" "d")))
2277 (clobber (match_scratch:DI 3 "=h"))]
2278 "TARGET_64BIT && !TARGET_MIPS4000"
2280 [(set_attr "type" "imul")
2281 (set_attr "mode" "DI")])
2283 (define_insn "muldi3_internal2"
2284 [(set (match_operand:DI 0 "register_operand" "=d")
2285 (mult:DI (match_operand:DI 1 "register_operand" "d")
2286 (match_operand:DI 2 "register_operand" "d")))
2287 (clobber (match_scratch:DI 3 "=h"))
2288 (clobber (match_scratch:DI 4 "=l"))]
2289 "TARGET_64BIT && (GENERATE_MULT3_DI || TARGET_MIPS4000)"
2291 if (GENERATE_MULT3_DI)
2292 return "dmult\t%0,%1,%2";
2294 return "dmult\t%1,%2\n\tmflo\t%0";
2296 [(set_attr "type" "imul")
2297 (set_attr "mode" "DI")
2298 (set (attr "length")
2299 (if_then_else (ne (symbol_ref "GENERATE_MULT3_DI") (const_int 0))
2303 ;; ??? We could define a mulditi3 pattern when TARGET_64BIT.
2305 (define_expand "mulsidi3"
2307 [(set (match_operand:DI 0 "register_operand" "")
2309 (sign_extend:DI (match_operand:SI 1 "register_operand" ""))
2310 (sign_extend:DI (match_operand:SI 2 "register_operand" ""))))
2311 (clobber (scratch:DI))
2312 (clobber (scratch:DI))
2313 (clobber (scratch:DI))])]
2318 emit_insn (gen_mulsidi3_32bit (operands[0], operands[1], operands[2]));
2323 (define_insn "mulsidi3_32bit"
2324 [(set (match_operand:DI 0 "register_operand" "=x")
2326 (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))
2327 (sign_extend:DI (match_operand:SI 2 "register_operand" "d"))))]
2330 [(set_attr "type" "imul")
2331 (set_attr "mode" "SI")])
2333 (define_insn_and_split "*mulsidi3_64bit"
2334 [(set (match_operand:DI 0 "register_operand" "=d")
2335 (mult:DI (match_operator:DI 1 "extend_operator"
2336 [(match_operand:SI 3 "register_operand" "d")])
2337 (match_operator:DI 2 "extend_operator"
2338 [(match_operand:SI 4 "register_operand" "d")])))
2339 (clobber (match_scratch:DI 5 "=l"))
2340 (clobber (match_scratch:DI 6 "=h"))
2341 (clobber (match_scratch:DI 7 "=d"))]
2342 "TARGET_64BIT && GET_CODE (operands[1]) == GET_CODE (operands[2])"
2344 "&& reload_completed"
2348 (mult:SI (match_dup 3)
2352 (mult:DI (match_dup 1)
2356 ;; OP7 <- LO, OP0 <- HI
2357 (set (match_dup 7) (match_dup 5))
2358 (set (match_dup 0) (match_dup 6))
2362 (ashift:DI (match_dup 7)
2365 (lshiftrt:DI (match_dup 7)
2368 ;; Shift OP0 into place.
2370 (ashift:DI (match_dup 0)
2373 ;; OR the two halves together
2375 (ior:DI (match_dup 0)
2378 [(set_attr "type" "imul")
2379 (set_attr "mode" "SI")
2380 (set_attr "length" "24")])
2382 (define_insn "*mulsidi3_64bit_parts"
2383 [(set (match_operand:DI 0 "register_operand" "=l")
2385 (mult:SI (match_operand:SI 2 "register_operand" "d")
2386 (match_operand:SI 3 "register_operand" "d"))))
2387 (set (match_operand:DI 1 "register_operand" "=h")
2390 (match_operator:DI 4 "extend_operator" [(match_dup 2)])
2391 (match_operator:DI 5 "extend_operator" [(match_dup 3)]))
2393 "TARGET_64BIT && GET_CODE (operands[4]) == GET_CODE (operands[5])"
2395 if (GET_CODE (operands[4]) == SIGN_EXTEND)
2396 return "mult\t%2,%3";
2398 return "multu\t%2,%3";
2400 [(set_attr "type" "imul")
2401 (set_attr "mode" "SI")])
2403 (define_expand "umulsidi3"
2405 [(set (match_operand:DI 0 "register_operand" "")
2407 (zero_extend:DI (match_operand:SI 1 "register_operand" ""))
2408 (zero_extend:DI (match_operand:SI 2 "register_operand" ""))))
2409 (clobber (scratch:DI))
2410 (clobber (scratch:DI))
2411 (clobber (scratch:DI))])]
2416 emit_insn (gen_umulsidi3_32bit (operands[0], operands[1],
2422 (define_insn "umulsidi3_32bit"
2423 [(set (match_operand:DI 0 "register_operand" "=x")
2425 (zero_extend:DI (match_operand:SI 1 "register_operand" "d"))
2426 (zero_extend:DI (match_operand:SI 2 "register_operand" "d"))))]
2429 [(set_attr "type" "imul")
2430 (set_attr "mode" "SI")])
2432 ;; Widening multiply with negation.
2433 (define_insn "*muls_di"
2434 [(set (match_operand:DI 0 "register_operand" "=x")
2437 (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))
2438 (sign_extend:DI (match_operand:SI 2 "register_operand" "d")))))]
2439 "!TARGET_64BIT && ISA_HAS_MULS"
2441 [(set_attr "type" "imul")
2442 (set_attr "length" "4")
2443 (set_attr "mode" "SI")])
2445 (define_insn "*umuls_di"
2446 [(set (match_operand:DI 0 "register_operand" "=x")
2449 (zero_extend:DI (match_operand:SI 1 "register_operand" "d"))
2450 (zero_extend:DI (match_operand:SI 2 "register_operand" "d")))))]
2451 "!TARGET_64BIT && ISA_HAS_MULS"
2453 [(set_attr "type" "imul")
2454 (set_attr "length" "4")
2455 (set_attr "mode" "SI")])
2457 (define_insn "*smsac_di"
2458 [(set (match_operand:DI 0 "register_operand" "=x")
2460 (match_operand:DI 3 "register_operand" "0")
2462 (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))
2463 (sign_extend:DI (match_operand:SI 2 "register_operand" "d")))))]
2464 "!TARGET_64BIT && ISA_HAS_MSAC"
2467 if (TARGET_MIPS5500)
2468 return \"msub\\t%1,%2\";
2470 return \"msac\\t$0,%1,%2\";
2472 [(set_attr "type" "imadd")
2473 (set_attr "length" "4")
2474 (set_attr "mode" "SI")])
2476 (define_insn "*umsac_di"
2477 [(set (match_operand:DI 0 "register_operand" "=x")
2479 (match_operand:DI 3 "register_operand" "0")
2481 (zero_extend:DI (match_operand:SI 1 "register_operand" "d"))
2482 (zero_extend:DI (match_operand:SI 2 "register_operand" "d")))))]
2483 "!TARGET_64BIT && ISA_HAS_MSAC"
2486 if (TARGET_MIPS5500)
2487 return \"msubu\\t%1,%2\";
2489 return \"msacu\\t$0,%1,%2\";
2491 [(set_attr "type" "imadd")
2492 (set_attr "length" "4")
2493 (set_attr "mode" "SI")])
2495 ;; _highpart patterns
2496 (define_expand "umulsi3_highpart"
2497 [(set (match_operand:SI 0 "register_operand" "")
2500 (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" ""))
2501 (zero_extend:DI (match_operand:SI 2 "register_operand" "")))
2507 emit_insn (gen_umulsi3_highpart_mulhi_internal (operands[0], operands[1],
2510 emit_insn (gen_umulsi3_highpart_internal (operands[0], operands[1],
2515 (define_insn "umulsi3_highpart_internal"
2516 [(set (match_operand:SI 0 "register_operand" "=h")
2519 (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "d"))
2520 (zero_extend:DI (match_operand:SI 2 "register_operand" "d")))
2522 (clobber (match_scratch:SI 3 "=l"))]
2525 [(set_attr "type" "imul")
2526 (set_attr "mode" "SI")
2527 (set_attr "length" "4")])
2529 (define_insn "umulsi3_highpart_mulhi_internal"
2530 [(set (match_operand:SI 0 "register_operand" "=h,d")
2533 (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "d,d"))
2534 (zero_extend:DI (match_operand:SI 2 "register_operand" "d,d")))
2536 (clobber (match_scratch:SI 3 "=l,l"))
2537 (clobber (match_scratch:SI 4 "=X,h"))]
2542 [(set_attr "type" "imul")
2543 (set_attr "mode" "SI")
2544 (set_attr "length" "4")])
2546 (define_insn "umulsi3_highpart_neg_mulhi_internal"
2547 [(set (match_operand:SI 0 "register_operand" "=h,d")
2551 (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "d,d"))
2552 (zero_extend:DI (match_operand:SI 2 "register_operand" "d,d"))))
2554 (clobber (match_scratch:SI 3 "=l,l"))
2555 (clobber (match_scratch:SI 4 "=X,h"))]
2560 [(set_attr "type" "imul")
2561 (set_attr "mode" "SI")
2562 (set_attr "length" "4")])
2564 (define_expand "smulsi3_highpart"
2565 [(set (match_operand:SI 0 "register_operand" "")
2568 (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" ""))
2569 (sign_extend:DI (match_operand:SI 2 "register_operand" "")))
2575 emit_insn (gen_smulsi3_highpart_mulhi_internal (operands[0], operands[1],
2578 emit_insn (gen_smulsi3_highpart_internal (operands[0], operands[1],
2583 (define_insn "smulsi3_highpart_internal"
2584 [(set (match_operand:SI 0 "register_operand" "=h")
2587 (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))
2588 (sign_extend:DI (match_operand:SI 2 "register_operand" "d")))
2590 (clobber (match_scratch:SI 3 "=l"))]
2593 [(set_attr "type" "imul")
2594 (set_attr "mode" "SI")
2595 (set_attr "length" "4")])
2597 (define_insn "smulsi3_highpart_mulhi_internal"
2598 [(set (match_operand:SI 0 "register_operand" "=h,d")
2601 (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d,d"))
2602 (sign_extend:DI (match_operand:SI 2 "register_operand" "d,d")))
2604 (clobber (match_scratch:SI 3 "=l,l"))
2605 (clobber (match_scratch:SI 4 "=X,h"))]
2610 [(set_attr "type" "imul")
2611 (set_attr "mode" "SI")
2612 (set_attr "length" "4")])
2614 (define_insn "smulsi3_highpart_neg_mulhi_internal"
2615 [(set (match_operand:SI 0 "register_operand" "=h,d")
2619 (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d,d"))
2620 (sign_extend:DI (match_operand:SI 2 "register_operand" "d,d"))))
2622 (clobber (match_scratch:SI 3 "=l,l"))
2623 (clobber (match_scratch:SI 4 "=X,h"))]
2628 [(set_attr "type" "imul")
2629 (set_attr "mode" "SI")])
2631 (define_insn "smuldi3_highpart"
2632 [(set (match_operand:DI 0 "register_operand" "=h")
2636 (sign_extend:TI (match_operand:DI 1 "register_operand" "d"))
2637 (sign_extend:TI (match_operand:DI 2 "register_operand" "d")))
2639 (clobber (match_scratch:DI 3 "=l"))]
2642 [(set_attr "type" "imul")
2643 (set_attr "mode" "DI")])
2645 (define_insn "umuldi3_highpart"
2646 [(set (match_operand:DI 0 "register_operand" "=h")
2650 (zero_extend:TI (match_operand:DI 1 "register_operand" "d"))
2651 (zero_extend:TI (match_operand:DI 2 "register_operand" "d")))
2653 (clobber (match_scratch:DI 3 "=l"))]
2656 [(set_attr "type" "imul")
2657 (set_attr "mode" "DI")])
2660 ;; The R4650 supports a 32 bit multiply/ 64 bit accumulate
2661 ;; instruction. The HI/LO registers are used as a 64 bit accumulator.
2663 (define_insn "madsi"
2664 [(set (match_operand:SI 0 "register_operand" "+l")
2665 (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "d")
2666 (match_operand:SI 2 "register_operand" "d"))
2668 (clobber (match_scratch:SI 3 "=h"))]
2671 [(set_attr "type" "imadd")
2672 (set_attr "mode" "SI")])
2674 (define_insn "*umul_acc_di"
2675 [(set (match_operand:DI 0 "register_operand" "=x")
2677 (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "d"))
2678 (zero_extend:DI (match_operand:SI 2 "register_operand" "d")))
2679 (match_operand:DI 3 "register_operand" "0")))]
2680 "(TARGET_MAD || ISA_HAS_MACC)
2685 return \"madu\\t%1,%2\";
2686 else if (TARGET_MIPS5500)
2687 return \"maddu\\t%1,%2\";
2689 return \"maccu\\t%.,%1,%2\";
2691 [(set_attr "type" "imadd")
2692 (set_attr "mode" "SI")])
2695 (define_insn "*smul_acc_di"
2696 [(set (match_operand:DI 0 "register_operand" "=x")
2698 (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))
2699 (sign_extend:DI (match_operand:SI 2 "register_operand" "d")))
2700 (match_operand:DI 3 "register_operand" "0")))]
2701 "(TARGET_MAD || ISA_HAS_MACC)
2706 return \"mad\\t%1,%2\";
2707 else if (TARGET_MIPS5500)
2708 return \"madd\\t%1,%2\";
2710 return \"macc\\t%.,%1,%2\";
2712 [(set_attr "type" "imadd")
2713 (set_attr "mode" "SI")])
2715 ;; Floating point multiply accumulate instructions.
2718 [(set (match_operand:DF 0 "register_operand" "=f")
2719 (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
2720 (match_operand:DF 2 "register_operand" "f"))
2721 (match_operand:DF 3 "register_operand" "f")))]
2722 "ISA_HAS_FP4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FUSED_MADD"
2723 "madd.d\\t%0,%3,%1,%2"
2724 [(set_attr "type" "fmadd")
2725 (set_attr "mode" "DF")])
2728 [(set (match_operand:SF 0 "register_operand" "=f")
2729 (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
2730 (match_operand:SF 2 "register_operand" "f"))
2731 (match_operand:SF 3 "register_operand" "f")))]
2732 "ISA_HAS_FP4 && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
2733 "madd.s\\t%0,%3,%1,%2"
2734 [(set_attr "type" "fmadd")
2735 (set_attr "mode" "SF")])
2738 [(set (match_operand:DF 0 "register_operand" "=f")
2739 (minus:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
2740 (match_operand:DF 2 "register_operand" "f"))
2741 (match_operand:DF 3 "register_operand" "f")))]
2742 "ISA_HAS_FP4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FUSED_MADD"
2743 "msub.d\\t%0,%3,%1,%2"
2744 [(set_attr "type" "fmadd")
2745 (set_attr "mode" "DF")])
2748 [(set (match_operand:SF 0 "register_operand" "=f")
2749 (minus:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
2750 (match_operand:SF 2 "register_operand" "f"))
2751 (match_operand:SF 3 "register_operand" "f")))]
2753 "ISA_HAS_FP4 && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
2754 "msub.s\\t%0,%3,%1,%2"
2755 [(set_attr "type" "fmadd")
2756 (set_attr "mode" "SF")])
2759 [(set (match_operand:DF 0 "register_operand" "=f")
2760 (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "register_operand" "f")
2761 (match_operand:DF 2 "register_operand" "f"))
2762 (match_operand:DF 3 "register_operand" "f"))))]
2763 "ISA_HAS_NMADD_NMSUB && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FUSED_MADD"
2764 "nmadd.d\\t%0,%3,%1,%2"
2765 [(set_attr "type" "fmadd")
2766 (set_attr "mode" "DF")])
2769 [(set (match_operand:SF 0 "register_operand" "=f")
2770 (neg:SF (plus:SF (mult:SF (match_operand:SF 1 "register_operand" "f")
2771 (match_operand:SF 2 "register_operand" "f"))
2772 (match_operand:SF 3 "register_operand" "f"))))]
2773 "ISA_HAS_NMADD_NMSUB && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
2774 "nmadd.s\\t%0,%3,%1,%2"
2775 [(set_attr "type" "fmadd")
2776 (set_attr "mode" "SF")])
2779 [(set (match_operand:DF 0 "register_operand" "=f")
2780 (minus:DF (match_operand:DF 1 "register_operand" "f")
2781 (mult:DF (match_operand:DF 2 "register_operand" "f")
2782 (match_operand:DF 3 "register_operand" "f"))))]
2783 "ISA_HAS_NMADD_NMSUB && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FUSED_MADD"
2784 "nmsub.d\\t%0,%1,%2,%3"
2785 [(set_attr "type" "fmadd")
2786 (set_attr "mode" "DF")])
2789 [(set (match_operand:SF 0 "register_operand" "=f")
2790 (minus:SF (match_operand:SF 1 "register_operand" "f")
2791 (mult:SF (match_operand:SF 2 "register_operand" "f")
2792 (match_operand:SF 3 "register_operand" "f"))))]
2793 "ISA_HAS_NMADD_NMSUB && TARGET_HARD_FLOAT && TARGET_FUSED_MADD"
2794 "nmsub.s\\t%0,%1,%2,%3"
2795 [(set_attr "type" "fmadd")
2796 (set_attr "mode" "SF")])
2799 ;; ....................
2801 ;; DIVISION and REMAINDER
2803 ;; ....................
2806 (define_insn "divdf3"
2807 [(set (match_operand:DF 0 "register_operand" "=f")
2808 (div:DF (match_operand:DF 1 "register_operand" "f")
2809 (match_operand:DF 2 "register_operand" "f")))]
2810 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
2812 [(set_attr "type" "fdiv")
2813 (set_attr "mode" "DF")])
2815 (define_insn "divsf3"
2816 [(set (match_operand:SF 0 "register_operand" "=f")
2817 (div:SF (match_operand:SF 1 "register_operand" "f")
2818 (match_operand:SF 2 "register_operand" "f")))]
2821 [(set_attr "type" "fdiv")
2822 (set_attr "mode" "SF")])
2825 [(set (match_operand:DF 0 "register_operand" "=f")
2826 (div:DF (match_operand:DF 1 "const_float_1_operand" "")
2827 (match_operand:DF 2 "register_operand" "f")))]
2828 "ISA_HAS_FP4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && flag_unsafe_math_optimizations"
2830 [(set_attr "type" "fdiv")
2831 (set_attr "mode" "DF")])
2834 [(set (match_operand:SF 0 "register_operand" "=f")
2835 (div:SF (match_operand:SF 1 "const_float_1_operand" "")
2836 (match_operand:SF 2 "register_operand" "f")))]
2837 "ISA_HAS_FP4 && TARGET_HARD_FLOAT && flag_unsafe_math_optimizations"
2839 [(set_attr "type" "fdiv")
2840 (set_attr "mode" "SF")])
2842 (define_insn "divmodsi4"
2843 [(set (match_operand:SI 0 "register_operand" "=l")
2844 (div:SI (match_operand:SI 1 "register_operand" "d")
2845 (match_operand:SI 2 "register_operand" "d")))
2846 (set (match_operand:SI 3 "register_operand" "=h")
2847 (mod:SI (match_dup 1)
2850 { return mips_output_division ("div\\t$0,%1,%2", operands); }
2851 [(set_attr "type" "idiv")
2852 (set_attr "mode" "SI")])
2854 (define_insn "divmoddi4"
2855 [(set (match_operand:DI 0 "register_operand" "=l")
2856 (div:DI (match_operand:DI 1 "register_operand" "d")
2857 (match_operand:DI 2 "register_operand" "d")))
2858 (set (match_operand:DI 3 "register_operand" "=h")
2859 (mod:DI (match_dup 1)
2862 { return mips_output_division ("ddiv\\t$0,%1,%2", operands); }
2863 [(set_attr "type" "idiv")
2864 (set_attr "mode" "DI")])
2866 (define_insn "udivmodsi4"
2867 [(set (match_operand:SI 0 "register_operand" "=l")
2868 (udiv:SI (match_operand:SI 1 "register_operand" "d")
2869 (match_operand:SI 2 "register_operand" "d")))
2870 (set (match_operand:SI 3 "register_operand" "=h")
2871 (umod:SI (match_dup 1)
2874 { return mips_output_division ("divu\\t$0,%1,%2", operands); }
2875 [(set_attr "type" "idiv")
2876 (set_attr "mode" "SI")])
2878 (define_insn "udivmoddi4"
2879 [(set (match_operand:DI 0 "register_operand" "=l")
2880 (udiv:DI (match_operand:DI 1 "register_operand" "d")
2881 (match_operand:DI 2 "register_operand" "d")))
2882 (set (match_operand:DI 3 "register_operand" "=h")
2883 (umod:DI (match_dup 1)
2886 { return mips_output_division ("ddivu\\t$0,%1,%2", operands); }
2887 [(set_attr "type" "idiv")
2888 (set_attr "mode" "DI")])
2890 ;; ....................
2894 ;; ....................
2896 (define_insn "sqrtdf2"
2897 [(set (match_operand:DF 0 "register_operand" "=f")
2898 (sqrt:DF (match_operand:DF 1 "register_operand" "f")))]
2899 "TARGET_HARD_FLOAT && HAVE_SQRT_P() && TARGET_DOUBLE_FLOAT"
2901 [(set_attr "type" "fsqrt")
2902 (set_attr "mode" "DF")])
2904 (define_insn "sqrtsf2"
2905 [(set (match_operand:SF 0 "register_operand" "=f")
2906 (sqrt:SF (match_operand:SF 1 "register_operand" "f")))]
2907 "TARGET_HARD_FLOAT && HAVE_SQRT_P()"
2909 [(set_attr "type" "fsqrt")
2910 (set_attr "mode" "SF")])
2913 [(set (match_operand:DF 0 "register_operand" "=f")
2914 (div:DF (match_operand:DF 1 "const_float_1_operand" "")
2915 (sqrt:DF (match_operand:DF 2 "register_operand" "f"))))]
2916 "ISA_HAS_FP4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && flag_unsafe_math_optimizations"
2918 [(set_attr "type" "frsqrt")
2919 (set_attr "mode" "DF")])
2922 [(set (match_operand:SF 0 "register_operand" "=f")
2923 (div:SF (match_operand:SF 1 "const_float_1_operand" "")
2924 (sqrt:SF (match_operand:SF 2 "register_operand" "f"))))]
2925 "ISA_HAS_FP4 && TARGET_HARD_FLOAT && flag_unsafe_math_optimizations"
2927 [(set_attr "type" "frsqrt")
2928 (set_attr "mode" "SF")])
2932 ;; ....................
2936 ;; ....................
2938 ;; Do not use the integer abs macro instruction, since that signals an
2939 ;; exception on -2147483648 (sigh).
2941 (define_insn "abssi2"
2942 [(set (match_operand:SI 0 "register_operand" "=d")
2943 (abs:SI (match_operand:SI 1 "register_operand" "d")))]
2947 operands[2] = const0_rtx;
2949 if (REGNO (operands[0]) == REGNO (operands[1]))
2951 if (GENERATE_BRANCHLIKELY)
2952 return \"%(bltzl\\t%1,1f\\n\\tsubu\\t%0,%z2,%0\\n%~1:%)\";
2954 return \"bgez\\t%1,1f%#\\n\\tsubu\\t%0,%z2,%0\\n%~1:\";
2957 return \"%(bgez\\t%1,1f\\n\\tmove\\t%0,%1\\n\\tsubu\\t%0,%z2,%0\\n%~1:%)\";
2959 [(set_attr "type" "multi")
2960 (set_attr "mode" "SI")
2961 (set_attr "length" "12")])
2963 (define_insn "absdi2"
2964 [(set (match_operand:DI 0 "register_operand" "=d")
2965 (abs:DI (match_operand:DI 1 "register_operand" "d")))]
2966 "TARGET_64BIT && !TARGET_MIPS16"
2969 unsigned int regno1;
2970 operands[2] = const0_rtx;
2972 if (GET_CODE (operands[1]) == REG)
2973 regno1 = REGNO (operands[1]);
2975 regno1 = REGNO (XEXP (operands[1], 0));
2977 if (REGNO (operands[0]) == regno1)
2978 return \"%(bltzl\\t%1,1f\\n\\tdsubu\\t%0,%z2,%0\\n%~1:%)\";
2980 return \"%(bgez\\t%1,1f\\n\\tmove\\t%0,%1\\n\\tdsubu\\t%0,%z2,%0\\n%~1:%)\";
2982 [(set_attr "type" "multi")
2983 (set_attr "mode" "DI")
2984 (set_attr "length" "12")])
2986 (define_insn "absdf2"
2987 [(set (match_operand:DF 0 "register_operand" "=f")
2988 (abs:DF (match_operand:DF 1 "register_operand" "f")))]
2989 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
2991 [(set_attr "type" "fabs")
2992 (set_attr "mode" "DF")])
2994 (define_insn "abssf2"
2995 [(set (match_operand:SF 0 "register_operand" "=f")
2996 (abs:SF (match_operand:SF 1 "register_operand" "f")))]
2999 [(set_attr "type" "fabs")
3000 (set_attr "mode" "SF")])
3004 ;; ....................
3006 ;; FIND FIRST BIT INSTRUCTION
3008 ;; ....................
3011 (define_insn "ffssi2"
3012 [(set (match_operand:SI 0 "register_operand" "=&d")
3013 (ffs:SI (match_operand:SI 1 "register_operand" "d")))
3014 (clobber (match_scratch:SI 2 "=&d"))
3015 (clobber (match_scratch:SI 3 "=&d"))]
3019 operands[4] = const0_rtx;
3021 if (optimize && find_reg_note (insn, REG_DEAD, operands[1]))
3024 \\tbeq\\t%1,%z4,2f\\n\\
3025 %~1:\\tand\\t%2,%1,0x0001\\n\\
3026 \\taddu\\t%0,%0,1\\n\\
3027 \\tbeq\\t%2,%z4,1b\\n\\
3028 \\tsrl\\t%1,%1,1\\n\\
3033 \\tmove\\t%3,%1\\n\\
3034 \\tbeq\\t%3,%z4,2f\\n\\
3035 %~1:\\tand\\t%2,%3,0x0001\\n\\
3036 \\taddu\\t%0,%0,1\\n\\
3037 \\tbeq\\t%2,%z4,1b\\n\\
3038 \\tsrl\\t%3,%3,1\\n\\
3041 [(set_attr "type" "multi")
3042 (set_attr "mode" "SI")
3043 (set_attr "length" "28")])
3045 (define_insn "ffsdi2"
3046 [(set (match_operand:DI 0 "register_operand" "=&d")
3047 (ffs:DI (match_operand:DI 1 "register_operand" "d")))
3048 (clobber (match_scratch:DI 2 "=&d"))
3049 (clobber (match_scratch:DI 3 "=&d"))]
3050 "TARGET_64BIT && !TARGET_MIPS16"
3053 operands[4] = const0_rtx;
3055 if (optimize && find_reg_note (insn, REG_DEAD, operands[1]))
3058 \\tbeq\\t%1,%z4,2f\\n\\
3059 %~1:\\tand\\t%2,%1,0x0001\\n\\
3060 \\tdaddu\\t%0,%0,1\\n\\
3061 \\tbeq\\t%2,%z4,1b\\n\\
3062 \\tdsrl\\t%1,%1,1\\n\\
3067 \\tmove\\t%3,%1\\n\\
3068 \\tbeq\\t%3,%z4,2f\\n\\
3069 %~1:\\tand\\t%2,%3,0x0001\\n\\
3070 \\tdaddu\\t%0,%0,1\\n\\
3071 \\tbeq\\t%2,%z4,1b\\n\\
3072 \\tdsrl\\t%3,%3,1\\n\\
3075 [(set_attr "type" "multi")
3076 (set_attr "mode" "DI")
3077 (set_attr "length" "28")])
3082 ;; ...................
3084 ;; Count leading zeroes.
3086 ;; ...................
3089 (define_insn "clzsi2"
3090 [(set (match_operand:SI 0 "register_operand" "=d")
3091 (clz:SI (match_operand:SI 1 "register_operand" "d")))]
3094 [(set_attr "type" "arith")
3095 (set_attr "mode" "SI")])
3097 (define_insn "clzdi2"
3098 [(set (match_operand:DI 0 "register_operand" "=d")
3099 (clz:DI (match_operand:DI 1 "register_operand" "d")))]
3102 [(set_attr "type" "arith")
3103 (set_attr "mode" "DI")])
3106 ;; ....................
3108 ;; NEGATION and ONE'S COMPLEMENT
3110 ;; ....................
3112 (define_insn "negsi2"
3113 [(set (match_operand:SI 0 "register_operand" "=d")
3114 (neg:SI (match_operand:SI 1 "register_operand" "d")))]
3119 return \"neg\\t%0,%1\";
3120 operands[2] = const0_rtx;
3121 return \"subu\\t%0,%z2,%1\";
3123 [(set_attr "type" "arith")
3124 (set_attr "mode" "SI")])
3126 (define_expand "negdi2"
3127 [(parallel [(set (match_operand:DI 0 "register_operand" "=d")
3128 (neg:DI (match_operand:DI 1 "register_operand" "d")))
3129 (clobber (match_dup 2))])]
3130 "(TARGET_64BIT || !TARGET_DEBUG_G_MODE) && !TARGET_MIPS16"
3135 emit_insn (gen_negdi2_internal_2 (operands[0], operands[1]));
3139 operands[2] = gen_reg_rtx (SImode);
3142 (define_insn "negdi2_internal"
3143 [(set (match_operand:DI 0 "register_operand" "=d")
3144 (neg:DI (match_operand:DI 1 "register_operand" "d")))
3145 (clobber (match_operand:SI 2 "register_operand" "=d"))]
3146 "! TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16"
3149 operands[3] = const0_rtx;
3150 return \"subu\\t%L0,%z3,%L1\;subu\\t%M0,%z3,%M1\;sltu\\t%2,%z3,%L0\;subu\\t%M0,%M0,%2\";
3152 [(set_attr "type" "darith")
3153 (set_attr "mode" "DI")
3154 (set_attr "length" "16")])
3156 (define_insn "negdi2_internal_2"
3157 [(set (match_operand:DI 0 "register_operand" "=d")
3158 (neg:DI (match_operand:DI 1 "register_operand" "d")))]
3159 "TARGET_64BIT && !TARGET_MIPS16"
3162 operands[2] = const0_rtx;
3163 return \"dsubu\\t%0,%z2,%1\";
3165 [(set_attr "type" "arith")
3166 (set_attr "mode" "DI")])
3168 (define_insn "negdf2"
3169 [(set (match_operand:DF 0 "register_operand" "=f")
3170 (neg:DF (match_operand:DF 1 "register_operand" "f")))]
3171 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
3173 [(set_attr "type" "fneg")
3174 (set_attr "mode" "DF")])
3176 (define_insn "negsf2"
3177 [(set (match_operand:SF 0 "register_operand" "=f")
3178 (neg:SF (match_operand:SF 1 "register_operand" "f")))]
3181 [(set_attr "type" "fneg")
3182 (set_attr "mode" "SF")])
3184 (define_insn "one_cmplsi2"
3185 [(set (match_operand:SI 0 "register_operand" "=d")
3186 (not:SI (match_operand:SI 1 "register_operand" "d")))]
3191 return \"not\\t%0,%1\";
3192 operands[2] = const0_rtx;
3193 return \"nor\\t%0,%z2,%1\";
3195 [(set_attr "type" "arith")
3196 (set_attr "mode" "SI")])
3198 (define_insn "one_cmpldi2"
3199 [(set (match_operand:DI 0 "register_operand" "=d")
3200 (not:DI (match_operand:DI 1 "register_operand" "d")))]
3205 return \"not\\t%0,%1\";
3206 return \"nor\\t%0,%.,%1\";
3208 [(set_attr "type" "darith")
3209 (set_attr "mode" "DI")])
3212 ;; ....................
3216 ;; ....................
3219 ;; Many of these instructions uses trivial define_expands, because we
3220 ;; want to use a different set of constraints when TARGET_MIPS16.
3222 (define_expand "andsi3"
3223 [(set (match_operand:SI 0 "register_operand" "=d,d")
3224 (and:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
3225 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
3231 operands[1] = force_reg (SImode, operands[1]);
3232 operands[2] = force_reg (SImode, operands[2]);
3237 [(set (match_operand:SI 0 "register_operand" "=d,d")
3238 (and:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
3239 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
3244 [(set_attr "type" "arith")
3245 (set_attr "mode" "SI")])
3248 [(set (match_operand:SI 0 "register_operand" "=d")
3249 (and:SI (match_operand:SI 1 "register_operand" "%0")
3250 (match_operand:SI 2 "register_operand" "d")))]
3253 [(set_attr "type" "arith")
3254 (set_attr "mode" "SI")])
3256 (define_expand "anddi3"
3257 [(set (match_operand:DI 0 "register_operand" "")
3258 (and:DI (match_operand:DI 1 "register_operand" "")
3259 (match_operand:DI 2 "uns_arith_operand" "")))]
3265 operands[1] = force_reg (DImode, operands[1]);
3266 operands[2] = force_reg (DImode, operands[2]);
3271 [(set (match_operand:DI 0 "register_operand" "=d,d")
3272 (and:DI (match_operand:DI 1 "register_operand" "d,d")
3273 (match_operand:DI 2 "uns_arith_operand" "d,K")))]
3274 "TARGET_64BIT && !TARGET_MIPS16"
3278 [(set_attr "type" "darith")
3279 (set_attr "mode" "DI")])
3282 [(set (match_operand:DI 0 "register_operand" "=d")
3283 (and:DI (match_operand:DI 1 "register_operand" "0")
3284 (match_operand:DI 2 "register_operand" "d")))]
3285 "TARGET_64BIT && TARGET_MIPS16"
3287 [(set_attr "type" "darith")
3288 (set_attr "mode" "DI")])
3290 (define_expand "iorsi3"
3291 [(set (match_operand:SI 0 "register_operand" "=d,d")
3292 (ior:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
3293 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
3299 operands[1] = force_reg (SImode, operands[1]);
3300 operands[2] = force_reg (SImode, operands[2]);
3305 [(set (match_operand:SI 0 "register_operand" "=d,d")
3306 (ior:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
3307 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
3312 [(set_attr "type" "arith")
3313 (set_attr "mode" "SI")])
3316 [(set (match_operand:SI 0 "register_operand" "=d")
3317 (ior:SI (match_operand:SI 1 "register_operand" "%0")
3318 (match_operand:SI 2 "register_operand" "d")))]
3321 [(set_attr "type" "arith")
3322 (set_attr "mode" "SI")])
3324 (define_expand "iordi3"
3325 [(set (match_operand:DI 0 "register_operand" "")
3326 (ior:DI (match_operand:DI 1 "register_operand" "")
3327 (match_operand:DI 2 "uns_arith_operand" "")))]
3333 operands[1] = force_reg (DImode, operands[1]);
3334 operands[2] = force_reg (DImode, operands[2]);
3339 [(set (match_operand:DI 0 "register_operand" "=d,d")
3340 (ior:DI (match_operand:DI 1 "register_operand" "d,d")
3341 (match_operand:DI 2 "uns_arith_operand" "d,K")))]
3342 "TARGET_64BIT && !TARGET_MIPS16"
3346 [(set_attr "type" "darith")
3347 (set_attr "mode" "DI")])
3350 [(set (match_operand:DI 0 "register_operand" "=d")
3351 (ior:DI (match_operand:DI 1 "register_operand" "0")
3352 (match_operand:DI 2 "register_operand" "d")))]
3353 "TARGET_64BIT && TARGET_MIPS16"
3355 [(set_attr "type" "darith")
3356 (set_attr "mode" "DI")])
3358 (define_expand "xorsi3"
3359 [(set (match_operand:SI 0 "register_operand" "=d,d")
3360 (xor:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
3361 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
3366 [(set (match_operand:SI 0 "register_operand" "=d,d")
3367 (xor:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
3368 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
3373 [(set_attr "type" "arith")
3374 (set_attr "mode" "SI")])
3377 [(set (match_operand:SI 0 "register_operand" "=d,t,t")
3378 (xor:SI (match_operand:SI 1 "uns_arith_operand" "%0,d,d")
3379 (match_operand:SI 2 "uns_arith_operand" "d,K,d")))]
3385 [(set_attr "type" "arith")
3386 (set_attr "mode" "SI")
3387 (set_attr_alternative "length"
3389 (if_then_else (match_operand:VOID 2 "m16_uimm8_1" "")
3394 (define_expand "xordi3"
3395 [(set (match_operand:DI 0 "register_operand" "")
3396 (xor:DI (match_operand:DI 1 "register_operand" "")
3397 (match_operand:DI 2 "uns_arith_operand" "")))]
3403 operands[1] = force_reg (DImode, operands[1]);
3404 operands[2] = force_reg (DImode, operands[2]);
3409 [(set (match_operand:DI 0 "register_operand" "=d,d")
3410 (xor:DI (match_operand:DI 1 "register_operand" "d,d")
3411 (match_operand:DI 2 "uns_arith_operand" "d,K")))]
3412 "TARGET_64BIT && !TARGET_MIPS16"
3416 [(set_attr "type" "darith")
3417 (set_attr "mode" "DI")])
3420 [(set (match_operand:DI 0 "register_operand" "=d,t,t")
3421 (xor:DI (match_operand:DI 1 "register_operand" "%0,d,d")
3422 (match_operand:DI 2 "uns_arith_operand" "d,K,d")))]
3423 "TARGET_64BIT && TARGET_MIPS16"
3428 [(set_attr "type" "arith")
3429 (set_attr "mode" "DI")
3430 (set_attr_alternative "length"
3432 (if_then_else (match_operand:VOID 2 "m16_uimm8_1" "")
3437 (define_insn "*norsi3"
3438 [(set (match_operand:SI 0 "register_operand" "=d")
3439 (and:SI (not:SI (match_operand:SI 1 "register_operand" "d"))
3440 (not:SI (match_operand:SI 2 "register_operand" "d"))))]
3443 [(set_attr "type" "arith")
3444 (set_attr "mode" "SI")])
3446 (define_insn "*nordi3"
3447 [(set (match_operand:DI 0 "register_operand" "=d")
3448 (and:DI (not:DI (match_operand:DI 1 "register_operand" "d"))
3449 (not:DI (match_operand:DI 2 "register_operand" "d"))))]
3450 "TARGET_64BIT && !TARGET_MIPS16"
3452 [(set_attr "type" "darith")
3453 (set_attr "mode" "DI")])
3456 ;; ....................
3460 ;; ....................
3464 (define_insn "truncdfsf2"
3465 [(set (match_operand:SF 0 "register_operand" "=f")
3466 (float_truncate:SF (match_operand:DF 1 "register_operand" "f")))]
3467 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
3469 [(set_attr "type" "fcvt")
3470 (set_attr "mode" "SF")])
3472 ;; Integer truncation patterns. Truncating SImode values to smaller
3473 ;; modes is a no-op, as it is for most other GCC ports. Truncating
3474 ;; DImode values to SImode is not a no-op for TARGET_64BIT since we
3475 ;; need to make sure that the lower 32 bits are properly sign-extended
3476 ;; (see TRULY_NOOP_TRUNCATION). Truncating DImode values into modes
3477 ;; smaller than SImode is equivalent to two separate truncations:
3480 ;; DI ---> HI == DI ---> SI ---> HI
3481 ;; DI ---> QI == DI ---> SI ---> QI
3483 ;; Step A needs a real instruction but step B does not.
3485 (define_insn "truncdisi2"
3486 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,m")
3487 (truncate:SI (match_operand:DI 1 "register_operand" "d,d")))]
3492 [(set_attr "type" "darith,store")
3493 (set_attr "mode" "SI")
3494 (set_attr "extended_mips16" "yes,*")])
3496 (define_insn "truncdihi2"
3497 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,m")
3498 (truncate:HI (match_operand:DI 1 "register_operand" "d,d")))]
3503 [(set_attr "type" "darith,store")
3504 (set_attr "mode" "SI")
3505 (set_attr "extended_mips16" "yes,*")])
3507 (define_insn "truncdiqi2"
3508 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,m")
3509 (truncate:QI (match_operand:DI 1 "register_operand" "d,d")))]
3514 [(set_attr "type" "darith,store")
3515 (set_attr "mode" "SI")
3516 (set_attr "extended_mips16" "yes,*")])
3518 ;; Combiner patterns to optimize shift/truncate combinations.
3521 [(set (match_operand:SI 0 "register_operand" "=d")
3522 (truncate:SI (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
3523 (match_operand:DI 2 "small_int" "I"))))]
3524 "TARGET_64BIT && !TARGET_MIPS16 && INTVAL (operands[2]) >= 32"
3526 [(set_attr "type" "darith")
3527 (set_attr "mode" "SI")])
3530 [(set (match_operand:SI 0 "register_operand" "=d")
3531 (truncate:SI (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
3533 "TARGET_64BIT && !TARGET_MIPS16"
3535 [(set_attr "type" "darith")
3536 (set_attr "mode" "SI")])
3539 ;; Combiner patterns for truncate/sign_extend combinations. They use
3540 ;; the shift/truncate patterns above.
3542 (define_insn_and_split ""
3543 [(set (match_operand:SI 0 "register_operand" "=d")
3545 (truncate:HI (match_operand:DI 1 "register_operand" "d"))))]
3546 "TARGET_64BIT && !TARGET_MIPS16"
3548 "&& reload_completed"
3550 (ashift:DI (match_dup 1)
3553 (truncate:SI (ashiftrt:DI (match_dup 2)
3555 { operands[2] = gen_lowpart (DImode, operands[0]); })
3557 (define_insn_and_split ""
3558 [(set (match_operand:SI 0 "register_operand" "=d")
3560 (truncate:QI (match_operand:DI 1 "register_operand" "d"))))]
3561 "TARGET_64BIT && !TARGET_MIPS16"
3563 "&& reload_completed"
3565 (ashift:DI (match_dup 1)
3568 (truncate:SI (ashiftrt:DI (match_dup 2)
3570 { operands[2] = gen_lowpart (DImode, operands[0]); })
3573 ;; Combiner patterns to optimize truncate/zero_extend combinations.
3576 [(set (match_operand:SI 0 "register_operand" "=d")
3577 (zero_extend:SI (truncate:HI
3578 (match_operand:DI 1 "register_operand" "d"))))]
3579 "TARGET_64BIT && !TARGET_MIPS16"
3580 "andi\\t%0,%1,0xffff"
3581 [(set_attr "type" "darith")
3582 (set_attr "mode" "SI")])
3585 [(set (match_operand:SI 0 "register_operand" "=d")
3586 (zero_extend:SI (truncate:QI
3587 (match_operand:DI 1 "register_operand" "d"))))]
3588 "TARGET_64BIT && !TARGET_MIPS16"
3590 [(set_attr "type" "darith")
3591 (set_attr "mode" "SI")])
3594 [(set (match_operand:HI 0 "register_operand" "=d")
3595 (zero_extend:HI (truncate:QI
3596 (match_operand:DI 1 "register_operand" "d"))))]
3597 "TARGET_64BIT && !TARGET_MIPS16"
3599 [(set_attr "type" "darith")
3600 (set_attr "mode" "HI")])
3604 ;; ....................
3608 ;; ....................
3611 ;; Those for integer source operand are ordered widest source type first.
3613 (define_insn_and_split "zero_extendsidi2"
3614 [(set (match_operand:DI 0 "register_operand" "=d")
3615 (zero_extend:DI (match_operand:SI 1 "register_operand" "d")))]
3618 "&& reload_completed"
3620 (ashift:DI (match_dup 1) (const_int 32)))
3622 (lshiftrt:DI (match_dup 0) (const_int 32)))]
3623 "operands[1] = gen_lowpart (DImode, operands[1]);"
3624 [(set_attr "type" "arith")
3625 (set_attr "mode" "DI")])
3627 (define_insn "*zero_extendsidi2_mem"
3628 [(set (match_operand:DI 0 "register_operand" "=d")
3629 (zero_extend:DI (match_operand:SI 1 "memory_operand" "m")))]
3630 "TARGET_64BIT && !TARGET_MIPS16"
3632 [(set_attr "type" "load")
3633 (set_attr "mode" "DI")])
3635 (define_expand "zero_extendhisi2"
3636 [(set (match_operand:SI 0 "register_operand" "")
3637 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
3641 if (TARGET_MIPS16 && GET_CODE (operands[1]) != MEM)
3643 rtx op = gen_lowpart (SImode, operands[1]);
3644 rtx temp = force_reg (SImode, GEN_INT (0xffff));
3646 emit_insn (gen_andsi3 (operands[0], op, temp));
3652 [(set (match_operand:SI 0 "register_operand" "=d,d")
3653 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "d,m")))]
3658 [(set_attr "type" "arith,load")
3659 (set_attr "mode" "SI")
3660 (set_attr "length" "4,*")])
3663 [(set (match_operand:SI 0 "register_operand" "=d")
3664 (zero_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
3667 [(set_attr "type" "load")
3668 (set_attr "mode" "SI")])
3670 (define_expand "zero_extendhidi2"
3671 [(set (match_operand:DI 0 "register_operand" "")
3672 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "")))]
3676 if (TARGET_MIPS16 && GET_CODE (operands[1]) != MEM)
3678 rtx op = gen_lowpart (DImode, operands[1]);
3679 rtx temp = force_reg (DImode, GEN_INT (0xffff));
3681 emit_insn (gen_anddi3 (operands[0], op, temp));
3687 [(set (match_operand:DI 0 "register_operand" "=d,d")
3688 (zero_extend:DI (match_operand:HI 1 "nonimmediate_operand" "d,m")))]
3689 "TARGET_64BIT && !TARGET_MIPS16"
3693 [(set_attr "type" "arith,load")
3694 (set_attr "mode" "DI")
3695 (set_attr "length" "4,*")])
3698 [(set (match_operand:DI 0 "register_operand" "=d")
3699 (zero_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
3700 "TARGET_64BIT && TARGET_MIPS16"
3702 [(set_attr "type" "load")
3703 (set_attr "mode" "DI")])
3705 (define_expand "zero_extendqihi2"
3706 [(set (match_operand:HI 0 "register_operand" "")
3707 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))]
3711 if (TARGET_MIPS16 && GET_CODE (operands[1]) != MEM)
3713 rtx op0 = gen_lowpart (SImode, operands[0]);
3714 rtx op1 = gen_lowpart (SImode, operands[1]);
3715 rtx temp = force_reg (SImode, GEN_INT (0xff));
3717 emit_insn (gen_andsi3 (op0, op1, temp));
3723 [(set (match_operand:HI 0 "register_operand" "=d,d")
3724 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "d,m")))]
3729 [(set_attr "type" "arith,load")
3730 (set_attr "mode" "HI")
3731 (set_attr "length" "4,*")])
3734 [(set (match_operand:HI 0 "register_operand" "=d")
3735 (zero_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
3738 [(set_attr "type" "load")
3739 (set_attr "mode" "HI")])
3741 (define_expand "zero_extendqisi2"
3742 [(set (match_operand:SI 0 "register_operand" "")
3743 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
3747 if (TARGET_MIPS16 && GET_CODE (operands[1]) != MEM)
3749 rtx op = gen_lowpart (SImode, operands[1]);
3750 rtx temp = force_reg (SImode, GEN_INT (0xff));
3752 emit_insn (gen_andsi3 (operands[0], op, temp));
3758 [(set (match_operand:SI 0 "register_operand" "=d,d")
3759 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "d,m")))]
3764 [(set_attr "type" "arith,load")
3765 (set_attr "mode" "SI")
3766 (set_attr "length" "4,*")])
3769 [(set (match_operand:SI 0 "register_operand" "=d")
3770 (zero_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
3773 [(set_attr "type" "load")
3774 (set_attr "mode" "SI")])
3776 (define_expand "zero_extendqidi2"
3777 [(set (match_operand:DI 0 "register_operand" "")
3778 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "")))]
3782 if (TARGET_MIPS16 && GET_CODE (operands[1]) != MEM)
3784 rtx op = gen_lowpart (DImode, operands[1]);
3785 rtx temp = force_reg (DImode, GEN_INT (0xff));
3787 emit_insn (gen_anddi3 (operands[0], op, temp));
3793 [(set (match_operand:DI 0 "register_operand" "=d,d")
3794 (zero_extend:DI (match_operand:QI 1 "nonimmediate_operand" "d,m")))]
3795 "TARGET_64BIT && !TARGET_MIPS16"
3799 [(set_attr "type" "arith,load")
3800 (set_attr "mode" "DI")
3801 (set_attr "length" "4,*")])
3804 [(set (match_operand:DI 0 "register_operand" "=d")
3805 (zero_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
3806 "TARGET_64BIT && TARGET_MIPS16"
3808 [(set_attr "type" "load")
3809 (set_attr "mode" "DI")])
3812 ;; ....................
3816 ;; ....................
3819 ;; Those for integer source operand are ordered widest source type first.
3821 (define_expand "extendsidi2"
3822 [(set (match_operand:DI 0 "register_operand" "")
3823 (sign_extend:DI (match_operand:SI 1 "move_operand" "")))]
3827 if (symbolic_operand (operands[1], SImode))
3829 emit_move_insn (operands[0], convert_memory_address (DImode, operands[1]));
3835 (define_insn "*extendsidi2"
3836 [(set (match_operand:DI 0 "register_operand" "=d,d")
3837 (sign_extend:DI (match_operand:SI 1 "nonimmediate_operand" "d,m")))]
3842 [(set_attr "type" "arith,load")
3843 (set_attr "mode" "DI")
3844 (set_attr "extended_mips16" "yes,*")])
3846 ;; These patterns originally accepted general_operands, however, slightly
3847 ;; better code is generated by only accepting register_operands, and then
3848 ;; letting combine generate the lh and lb insns.
3850 ;; These expanders originally put values in registers first. We split
3851 ;; all non-mem patterns after reload.
3853 (define_expand "extendhidi2"
3854 [(set (match_operand:DI 0 "register_operand" "")
3855 (sign_extend:DI (match_operand:HI 1 "nonimmediate_operand" "")))]
3859 (define_insn "*extendhidi2"
3860 [(set (match_operand:DI 0 "register_operand" "=d")
3861 (sign_extend:DI (match_operand:HI 1 "register_operand" "d")))]
3866 [(set (match_operand:DI 0 "register_operand" "")
3867 (sign_extend:DI (match_operand:HI 1 "register_operand" "")))]
3868 "TARGET_64BIT && reload_completed"
3870 (ashift:DI (match_dup 1) (const_int 48)))
3872 (ashiftrt:DI (match_dup 0) (const_int 48)))]
3873 "operands[1] = gen_lowpart (DImode, operands[1]);")
3875 (define_insn "*extendhidi2_mem"
3876 [(set (match_operand:DI 0 "register_operand" "=d")
3877 (sign_extend:DI (match_operand:HI 1 "memory_operand" "m")))]
3880 [(set_attr "type" "load")
3881 (set_attr "mode" "DI")])
3883 (define_expand "extendhisi2"
3884 [(set (match_operand:SI 0 "register_operand" "")
3885 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
3888 if (ISA_HAS_SEB_SEH)
3890 emit_insn (gen_extendhisi2_hw (operands[0],
3891 force_reg (HImode, operands[1])));
3896 (define_insn "*extendhisi2"
3897 [(set (match_operand:SI 0 "register_operand" "=d")
3898 (sign_extend:SI (match_operand:HI 1 "register_operand" "d")))]
3903 [(set (match_operand:SI 0 "register_operand" "")
3904 (sign_extend:SI (match_operand:HI 1 "register_operand" "")))]
3907 (ashift:SI (match_dup 1) (const_int 16)))
3909 (ashiftrt:SI (match_dup 0) (const_int 16)))]
3910 "operands[1] = gen_lowpart (SImode, operands[1]);")
3912 (define_insn "extendhisi2_mem"
3913 [(set (match_operand:SI 0 "register_operand" "=d")
3914 (sign_extend:SI (match_operand:HI 1 "memory_operand" "m")))]
3917 [(set_attr "type" "load")
3918 (set_attr "mode" "SI")])
3920 (define_insn "extendhisi2_hw"
3921 [(set (match_operand:SI 0 "register_operand" "=r")
3922 (sign_extend:SI (match_operand:HI 1 "register_operand" "r")))]
3925 [(set_attr "type" "arith")
3926 (set_attr "mode" "SI")])
3928 (define_expand "extendqihi2"
3929 [(set (match_operand:HI 0 "register_operand" "")
3930 (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))]
3934 (define_insn "*extendqihi2"
3935 [(set (match_operand:HI 0 "register_operand" "=d")
3936 (sign_extend:HI (match_operand:QI 1 "register_operand" "d")))]
3941 [(set (match_operand:HI 0 "register_operand" "")
3942 (sign_extend:HI (match_operand:QI 1 "register_operand" "")))]
3945 (ashift:SI (match_dup 1) (const_int 24)))
3947 (ashiftrt:SI (match_dup 0) (const_int 24)))]
3948 "operands[0] = gen_lowpart (SImode, operands[0]);
3949 operands[1] = gen_lowpart (SImode, operands[1]);")
3951 (define_insn "*extendqihi2_internal_mem"
3952 [(set (match_operand:HI 0 "register_operand" "=d")
3953 (sign_extend:HI (match_operand:QI 1 "memory_operand" "m")))]
3956 [(set_attr "type" "load")
3957 (set_attr "mode" "SI")])
3960 (define_expand "extendqisi2"
3961 [(set (match_operand:SI 0 "register_operand" "")
3962 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
3965 if (ISA_HAS_SEB_SEH)
3967 emit_insn (gen_extendqisi2_hw (operands[0],
3968 force_reg (QImode, operands[1])));
3973 (define_insn "*extendqisi2"
3974 [(set (match_operand:SI 0 "register_operand" "=d")
3975 (sign_extend:SI (match_operand:QI 1 "register_operand" "d")))]
3980 [(set (match_operand:SI 0 "register_operand" "")
3981 (sign_extend:SI (match_operand:QI 1 "register_operand" "")))]
3984 (ashift:SI (match_dup 1) (const_int 24)))
3986 (ashiftrt:SI (match_dup 0) (const_int 24)))]
3987 "operands[1] = gen_lowpart (SImode, operands[1]);")
3989 (define_insn "*extendqisi2_mem"
3990 [(set (match_operand:SI 0 "register_operand" "=d")
3991 (sign_extend:SI (match_operand:QI 1 "memory_operand" "m")))]
3994 [(set_attr "type" "load")
3995 (set_attr "mode" "SI")])
3997 (define_insn "extendqisi2_hw"
3998 [(set (match_operand:SI 0 "register_operand" "=r")
3999 (sign_extend:SI (match_operand:QI 1 "register_operand" "r")))]
4002 [(set_attr "type" "arith")
4003 (set_attr "mode" "SI")])
4005 (define_expand "extendqidi2"
4006 [(set (match_operand:DI 0 "register_operand" "")
4007 (sign_extend:DI (match_operand:QI 1 "nonimmediate_operand" "")))]
4011 (define_insn "*extendqidi2"
4012 [(set (match_operand:DI 0 "register_operand" "=d")
4013 (sign_extend:DI (match_operand:QI 1 "register_operand" "d")))]
4018 [(set (match_operand:DI 0 "register_operand" "")
4019 (sign_extend:DI (match_operand:QI 1 "register_operand" "")))]
4020 "TARGET_64BIT && reload_completed"
4022 (ashift:DI (match_dup 1) (const_int 56)))
4024 (ashiftrt:DI (match_dup 0) (const_int 56)))]
4025 "operands[1] = gen_lowpart (DImode, operands[1]);")
4027 (define_insn "*extendqidi2_mem"
4028 [(set (match_operand:DI 0 "register_operand" "=d")
4029 (sign_extend:DI (match_operand:QI 1 "memory_operand" "m")))]
4032 [(set_attr "type" "load")
4033 (set_attr "mode" "DI")])
4035 (define_insn "extendsfdf2"
4036 [(set (match_operand:DF 0 "register_operand" "=f")
4037 (float_extend:DF (match_operand:SF 1 "register_operand" "f")))]
4038 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
4040 [(set_attr "type" "fcvt")
4041 (set_attr "mode" "DF")])
4046 ;; ....................
4050 ;; ....................
4052 (define_expand "fix_truncdfsi2"
4053 [(set (match_operand:SI 0 "register_operand" "=f")
4054 (fix:SI (match_operand:DF 1 "register_operand" "f")))]
4055 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
4057 if (!ISA_HAS_TRUNC_W)
4059 emit_insn (gen_fix_truncdfsi2_macro (operands[0], operands[1]));
4064 (define_insn "fix_truncdfsi2_insn"
4065 [(set (match_operand:SI 0 "register_operand" "=f")
4066 (fix:SI (match_operand:DF 1 "register_operand" "f")))]
4067 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && ISA_HAS_TRUNC_W"
4069 [(set_attr "type" "fcvt")
4070 (set_attr "mode" "DF")
4071 (set_attr "length" "4")])
4073 (define_insn "fix_truncdfsi2_macro"
4074 [(set (match_operand:SI 0 "register_operand" "=f")
4075 (fix:SI (match_operand:DF 1 "register_operand" "f")))
4076 (clobber (match_scratch:DF 2 "=d"))]
4077 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && !ISA_HAS_TRUNC_W"
4080 return ".set\tmacro\n\ttrunc.w.d %0,%1,%2\n\t.set\tmacro";
4081 return "trunc.w.d %0,%1,%2";
4083 [(set_attr "type" "fcvt")
4084 (set_attr "mode" "DF")
4085 (set_attr "length" "36")])
4087 (define_expand "fix_truncsfsi2"
4088 [(set (match_operand:SI 0 "register_operand" "=f")
4089 (fix:SI (match_operand:SF 1 "register_operand" "f")))]
4092 if (!ISA_HAS_TRUNC_W)
4094 emit_insn (gen_fix_truncsfsi2_macro (operands[0], operands[1]));
4099 (define_insn "fix_truncsfsi2_insn"
4100 [(set (match_operand:SI 0 "register_operand" "=f")
4101 (fix:SI (match_operand:SF 1 "register_operand" "f")))]
4102 "TARGET_HARD_FLOAT && ISA_HAS_TRUNC_W"
4104 [(set_attr "type" "fcvt")
4105 (set_attr "mode" "DF")
4106 (set_attr "length" "4")])
4108 (define_insn "fix_truncsfsi2_macro"
4109 [(set (match_operand:SI 0 "register_operand" "=f")
4110 (fix:SI (match_operand:SF 1 "register_operand" "f")))
4111 (clobber (match_scratch:SF 2 "=d"))]
4112 "TARGET_HARD_FLOAT && !ISA_HAS_TRUNC_W"
4115 return ".set\tmacro\n\ttrunc.w.s %0,%1,%2\n\t.set\tmacro";
4116 return "trunc.w.s %0,%1,%2";
4118 [(set_attr "type" "fcvt")
4119 (set_attr "mode" "DF")
4120 (set_attr "length" "36")])
4122 ;;; ??? trunc.l.d is mentioned in the appendix of the 1993 r4000/r4600 manuals
4123 ;;; but not in the chapter that describes the FPU. It is not mentioned at all
4124 ;;; in the 1991 manuals. The r4000 at Cygnus does not have this instruction.
4126 ;;; Deleting this means that we now need two libgcc2.a libraries. One for
4127 ;;; the 32 bit calling convention and one for the 64 bit calling convention.
4129 ;;; If this is disabled, then fixuns_truncdfdi2 must be disabled also.
4131 (define_insn "fix_truncdfdi2"
4132 [(set (match_operand:DI 0 "register_operand" "=f")
4133 (fix:DI (match_operand:DF 1 "register_operand" "f")))]
4134 "TARGET_HARD_FLOAT && TARGET_FLOAT64 && TARGET_DOUBLE_FLOAT"
4136 [(set_attr "type" "fcvt")
4137 (set_attr "mode" "DF")
4138 (set_attr "length" "4")])
4141 ;;; ??? trunc.l.s is mentioned in the appendix of the 1993 r4000/r4600 manuals
4142 ;;; but not in the chapter that describes the FPU. It is not mentioned at all
4143 ;;; in the 1991 manuals. The r4000 at Cygnus does not have this instruction.
4144 (define_insn "fix_truncsfdi2"
4145 [(set (match_operand:DI 0 "register_operand" "=f")
4146 (fix:DI (match_operand:SF 1 "register_operand" "f")))]
4147 "TARGET_HARD_FLOAT && TARGET_FLOAT64 && TARGET_DOUBLE_FLOAT"
4149 [(set_attr "type" "fcvt")
4150 (set_attr "mode" "SF")
4151 (set_attr "length" "4")])
4154 (define_insn "floatsidf2"
4155 [(set (match_operand:DF 0 "register_operand" "=f")
4156 (float:DF (match_operand:SI 1 "register_operand" "f")))]
4157 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
4159 [(set_attr "type" "fcvt")
4160 (set_attr "mode" "DF")
4161 (set_attr "length" "4")])
4164 (define_insn "floatdidf2"
4165 [(set (match_operand:DF 0 "register_operand" "=f")
4166 (float:DF (match_operand:DI 1 "register_operand" "f")))]
4167 "TARGET_HARD_FLOAT && TARGET_FLOAT64 && TARGET_DOUBLE_FLOAT"
4169 [(set_attr "type" "fcvt")
4170 (set_attr "mode" "DF")
4171 (set_attr "length" "4")])
4174 (define_insn "floatsisf2"
4175 [(set (match_operand:SF 0 "register_operand" "=f")
4176 (float:SF (match_operand:SI 1 "register_operand" "f")))]
4179 [(set_attr "type" "fcvt")
4180 (set_attr "mode" "SF")
4181 (set_attr "length" "4")])
4184 (define_insn "floatdisf2"
4185 [(set (match_operand:SF 0 "register_operand" "=f")
4186 (float:SF (match_operand:DI 1 "register_operand" "f")))]
4187 "TARGET_HARD_FLOAT && TARGET_FLOAT64 && TARGET_DOUBLE_FLOAT"
4189 [(set_attr "type" "fcvt")
4190 (set_attr "mode" "SF")
4191 (set_attr "length" "4")])
4194 (define_expand "fixuns_truncdfsi2"
4195 [(set (match_operand:SI 0 "register_operand" "")
4196 (unsigned_fix:SI (match_operand:DF 1 "register_operand" "")))]
4197 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
4200 rtx reg1 = gen_reg_rtx (DFmode);
4201 rtx reg2 = gen_reg_rtx (DFmode);
4202 rtx reg3 = gen_reg_rtx (SImode);
4203 rtx label1 = gen_label_rtx ();
4204 rtx label2 = gen_label_rtx ();
4205 REAL_VALUE_TYPE offset;
4207 real_2expN (&offset, 31);
4209 if (reg1) /* turn off complaints about unreached code */
4211 emit_move_insn (reg1, CONST_DOUBLE_FROM_REAL_VALUE (offset, DFmode));
4212 do_pending_stack_adjust ();
4214 emit_insn (gen_cmpdf (operands[1], reg1));
4215 emit_jump_insn (gen_bge (label1));
4217 emit_insn (gen_fix_truncdfsi2 (operands[0], operands[1]));
4218 emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx,
4219 gen_rtx_LABEL_REF (VOIDmode, label2)));
4222 emit_label (label1);
4223 emit_move_insn (reg2, gen_rtx_MINUS (DFmode, operands[1], reg1));
4224 emit_move_insn (reg3, GEN_INT (trunc_int_for_mode
4225 (BITMASK_HIGH, SImode)));
4227 emit_insn (gen_fix_truncdfsi2 (operands[0], reg2));
4228 emit_insn (gen_iorsi3 (operands[0], operands[0], reg3));
4230 emit_label (label2);
4232 /* allow REG_NOTES to be set on last insn (labels don't have enough
4233 fields, and can't be used for REG_NOTES anyway). */
4234 emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
4240 (define_expand "fixuns_truncdfdi2"
4241 [(set (match_operand:DI 0 "register_operand" "")
4242 (unsigned_fix:DI (match_operand:DF 1 "register_operand" "")))]
4243 "TARGET_HARD_FLOAT && TARGET_64BIT && TARGET_DOUBLE_FLOAT"
4246 rtx reg1 = gen_reg_rtx (DFmode);
4247 rtx reg2 = gen_reg_rtx (DFmode);
4248 rtx reg3 = gen_reg_rtx (DImode);
4249 rtx label1 = gen_label_rtx ();
4250 rtx label2 = gen_label_rtx ();
4251 REAL_VALUE_TYPE offset;
4253 real_2expN (&offset, 63);
4255 if (reg1) /* turn off complaints about unreached code */
4257 emit_move_insn (reg1, CONST_DOUBLE_FROM_REAL_VALUE (offset, DFmode));
4258 do_pending_stack_adjust ();
4260 emit_insn (gen_cmpdf (operands[1], reg1));
4261 emit_jump_insn (gen_bge (label1));
4263 emit_insn (gen_fix_truncdfdi2 (operands[0], operands[1]));
4264 emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx,
4265 gen_rtx_LABEL_REF (VOIDmode, label2)));
4268 emit_label (label1);
4269 emit_move_insn (reg2, gen_rtx_MINUS (DFmode, operands[1], reg1));
4270 emit_move_insn (reg3, GEN_INT (BITMASK_HIGH));
4271 emit_insn (gen_ashldi3 (reg3, reg3, GEN_INT (32)));
4273 emit_insn (gen_fix_truncdfdi2 (operands[0], reg2));
4274 emit_insn (gen_iordi3 (operands[0], operands[0], reg3));
4276 emit_label (label2);
4278 /* allow REG_NOTES to be set on last insn (labels don't have enough
4279 fields, and can't be used for REG_NOTES anyway). */
4280 emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
4286 (define_expand "fixuns_truncsfsi2"
4287 [(set (match_operand:SI 0 "register_operand" "")
4288 (unsigned_fix:SI (match_operand:SF 1 "register_operand" "")))]
4292 rtx reg1 = gen_reg_rtx (SFmode);
4293 rtx reg2 = gen_reg_rtx (SFmode);
4294 rtx reg3 = gen_reg_rtx (SImode);
4295 rtx label1 = gen_label_rtx ();
4296 rtx label2 = gen_label_rtx ();
4297 REAL_VALUE_TYPE offset;
4299 real_2expN (&offset, 31);
4301 if (reg1) /* turn off complaints about unreached code */
4303 emit_move_insn (reg1, CONST_DOUBLE_FROM_REAL_VALUE (offset, SFmode));
4304 do_pending_stack_adjust ();
4306 emit_insn (gen_cmpsf (operands[1], reg1));
4307 emit_jump_insn (gen_bge (label1));
4309 emit_insn (gen_fix_truncsfsi2 (operands[0], operands[1]));
4310 emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx,
4311 gen_rtx_LABEL_REF (VOIDmode, label2)));
4314 emit_label (label1);
4315 emit_move_insn (reg2, gen_rtx_MINUS (SFmode, operands[1], reg1));
4316 emit_move_insn (reg3, GEN_INT (trunc_int_for_mode
4317 (BITMASK_HIGH, SImode)));
4319 emit_insn (gen_fix_truncsfsi2 (operands[0], reg2));
4320 emit_insn (gen_iorsi3 (operands[0], operands[0], reg3));
4322 emit_label (label2);
4324 /* allow REG_NOTES to be set on last insn (labels don't have enough
4325 fields, and can't be used for REG_NOTES anyway). */
4326 emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
4332 (define_expand "fixuns_truncsfdi2"
4333 [(set (match_operand:DI 0 "register_operand" "")
4334 (unsigned_fix:DI (match_operand:SF 1 "register_operand" "")))]
4335 "TARGET_HARD_FLOAT && TARGET_64BIT && TARGET_DOUBLE_FLOAT"
4338 rtx reg1 = gen_reg_rtx (SFmode);
4339 rtx reg2 = gen_reg_rtx (SFmode);
4340 rtx reg3 = gen_reg_rtx (DImode);
4341 rtx label1 = gen_label_rtx ();
4342 rtx label2 = gen_label_rtx ();
4343 REAL_VALUE_TYPE offset;
4345 real_2expN (&offset, 63);
4347 if (reg1) /* turn off complaints about unreached code */
4349 emit_move_insn (reg1, CONST_DOUBLE_FROM_REAL_VALUE (offset, SFmode));
4350 do_pending_stack_adjust ();
4352 emit_insn (gen_cmpsf (operands[1], reg1));
4353 emit_jump_insn (gen_bge (label1));
4355 emit_insn (gen_fix_truncsfdi2 (operands[0], operands[1]));
4356 emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx,
4357 gen_rtx_LABEL_REF (VOIDmode, label2)));
4360 emit_label (label1);
4361 emit_move_insn (reg2, gen_rtx_MINUS (SFmode, operands[1], reg1));
4362 emit_move_insn (reg3, GEN_INT (BITMASK_HIGH));
4363 emit_insn (gen_ashldi3 (reg3, reg3, GEN_INT (32)));
4365 emit_insn (gen_fix_truncsfdi2 (operands[0], reg2));
4366 emit_insn (gen_iordi3 (operands[0], operands[0], reg3));
4368 emit_label (label2);
4370 /* allow REG_NOTES to be set on last insn (labels don't have enough
4371 fields, and can't be used for REG_NOTES anyway). */
4372 emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
4379 ;; ....................
4383 ;; ....................
4385 ;; Bit field extract patterns which use lwl/lwr or ldl/ldr.
4387 (define_expand "extv"
4388 [(set (match_operand 0 "register_operand" "")
4389 (sign_extract (match_operand:QI 1 "memory_operand" "")
4390 (match_operand 2 "immediate_operand" "")
4391 (match_operand 3 "immediate_operand" "")))]
4394 if (mips_expand_unaligned_load (operands[0], operands[1],
4395 INTVAL (operands[2]),
4396 INTVAL (operands[3])))
4402 (define_expand "extzv"
4403 [(set (match_operand 0 "register_operand" "")
4404 (zero_extract (match_operand:QI 1 "memory_operand" "")
4405 (match_operand 2 "immediate_operand" "")
4406 (match_operand 3 "immediate_operand" "")))]
4409 if (mips_expand_unaligned_load (operands[0], operands[1],
4410 INTVAL (operands[2]),
4411 INTVAL (operands[3])))
4417 (define_expand "insv"
4418 [(set (zero_extract (match_operand:QI 0 "memory_operand" "")
4419 (match_operand 1 "immediate_operand" "")
4420 (match_operand 2 "immediate_operand" ""))
4421 (match_operand 3 "reg_or_0_operand" ""))]
4424 if (mips_expand_unaligned_store (operands[0], operands[3],
4425 INTVAL (operands[1]),
4426 INTVAL (operands[2])))
4432 ;; Unaligned word moves generated by the bit field patterns.
4434 ;; As far as the rtl is concerned, both the left-part and right-part
4435 ;; instructions can access the whole field. However, the real operand
4436 ;; refers to just the first or the last byte (depending on endianness).
4437 ;; We therefore use two memory operands to each instruction, one to
4438 ;; describe the rtl effect and one to use in the assembly output.
4440 (define_insn "mov_lwl"
4441 [(set (match_operand:SI 0 "register_operand" "=d")
4442 (unspec:SI [(match_operand:BLK 1 "general_operand" "m")
4443 (match_operand:QI 2 "general_operand" "m")]
4447 [(set_attr "type" "load")
4448 (set_attr "mode" "SI")
4449 (set_attr "hazard" "none")])
4451 (define_insn "mov_lwr"
4452 [(set (match_operand:SI 0 "register_operand" "=d")
4453 (unspec:SI [(match_operand:BLK 1 "general_operand" "m")
4454 (match_operand:QI 2 "general_operand" "m")
4455 (match_operand:SI 3 "register_operand" "0")]
4459 [(set_attr "type" "load")
4460 (set_attr "mode" "SI")])
4463 (define_insn "mov_swl"
4464 [(set (match_operand:BLK 0 "memory_operand" "=m")
4465 (unspec:BLK [(match_operand:SI 1 "reg_or_0_operand" "dJ")
4466 (match_operand:QI 2 "general_operand" "m")]
4470 [(set_attr "type" "store")
4471 (set_attr "mode" "SI")])
4473 (define_insn "mov_swr"
4474 [(set (match_operand:BLK 0 "memory_operand" "+m")
4475 (unspec:BLK [(match_operand:SI 1 "reg_or_0_operand" "dJ")
4476 (match_operand:QI 2 "general_operand" "m")
4481 [(set_attr "type" "store")
4482 (set_attr "mode" "SI")])
4485 (define_insn "mov_ldl"
4486 [(set (match_operand:DI 0 "register_operand" "=d")
4487 (unspec:DI [(match_operand:BLK 1 "general_operand" "m")
4488 (match_operand:QI 2 "general_operand" "m")]
4490 "TARGET_64BIT && !TARGET_MIPS16"
4492 [(set_attr "type" "load")
4493 (set_attr "mode" "DI")])
4495 (define_insn "mov_ldr"
4496 [(set (match_operand:DI 0 "register_operand" "=d")
4497 (unspec:DI [(match_operand:BLK 1 "general_operand" "m")
4498 (match_operand:QI 2 "general_operand" "m")
4499 (match_operand:DI 3 "register_operand" "0")]
4501 "TARGET_64BIT && !TARGET_MIPS16"
4503 [(set_attr "type" "load")
4504 (set_attr "mode" "DI")])
4507 (define_insn "mov_sdl"
4508 [(set (match_operand:BLK 0 "memory_operand" "=m")
4509 (unspec:BLK [(match_operand:DI 1 "reg_or_0_operand" "dJ")
4510 (match_operand:QI 2 "general_operand" "m")]
4512 "TARGET_64BIT && !TARGET_MIPS16"
4514 [(set_attr "type" "store")
4515 (set_attr "mode" "DI")])
4517 (define_insn "mov_sdr"
4518 [(set (match_operand:BLK 0 "memory_operand" "+m")
4519 (unspec:BLK [(match_operand:DI 1 "reg_or_0_operand" "dJ")
4520 (match_operand:QI 2 "general_operand" "m")
4523 "TARGET_64BIT && !TARGET_MIPS16"
4525 [(set_attr "type" "store")
4526 (set_attr "mode" "DI")])
4529 ;; Instructions for loading a relocation expression using "lui".
4531 (define_insn "luisi"
4532 [(set (match_operand:SI 0 "register_operand" "=r")
4533 (unspec:SI [(match_operand 1 "const_arith_operand" "")] UNSPEC_HIGH))]
4536 [(set_attr "type" "arith")])
4538 (define_insn "luidi"
4539 [(set (match_operand:DI 0 "register_operand" "=r")
4540 (unspec:DI [(match_operand 1 "const_arith_operand" "")] UNSPEC_HIGH))]
4543 [(set_attr "type" "arith")])
4546 ;; Instructions for adding the low 16 bits of an address to a register.
4547 ;; Operand 2 is the address: print_operand works out which relocation
4548 ;; should be applied.
4550 (define_insn "lowsi"
4551 [(set (match_operand:SI 0 "register_operand" "=r")
4552 (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
4553 (match_operand:SI 2 "immediate_operand" "")))]
4556 [(set_attr "type" "arith")
4557 (set_attr "mode" "SI")])
4559 (define_insn "lowdi"
4560 [(set (match_operand:DI 0 "register_operand" "=r")
4561 (lo_sum:DI (match_operand:DI 1 "register_operand" "r")
4562 (match_operand:DI 2 "immediate_operand" "")))]
4563 "!TARGET_MIPS16 && TARGET_64BIT"
4564 "daddiu\\t%0,%1,%R2"
4565 [(set_attr "type" "arith")
4566 (set_attr "mode" "DI")])
4568 ;; 64-bit integer moves
4570 ;; Unlike most other insns, the move insns can't be split with
4571 ;; different predicates, because register spilling and other parts of
4572 ;; the compiler, have memoized the insn number already.
4574 (define_expand "movdi"
4575 [(set (match_operand:DI 0 "nonimmediate_operand" "")
4576 (match_operand:DI 1 "" ""))]
4580 if (mips_legitimize_move (DImode, operands[0], operands[1]))
4583 /* If we are generating embedded PIC code, and we are referring to a
4584 symbol in the .text section, we must use an offset from the start
4586 if (TARGET_EMBEDDED_PIC
4587 && (GET_CODE (operands[1]) == LABEL_REF
4588 || (GET_CODE (operands[1]) == SYMBOL_REF
4589 && ! SYMBOL_REF_FLAG (operands[1]))))
4593 temp = embedded_pic_offset (operands[1]);
4594 temp = gen_rtx_PLUS (Pmode, embedded_pic_fnaddr_reg (),
4595 force_reg (DImode, temp));
4596 emit_move_insn (operands[0], force_reg (DImode, temp));
4601 ;; For mips16, we need a special case to handle storing $31 into
4602 ;; memory, since we don't have a constraint to match $31. This
4603 ;; instruction can be generated by save_restore_insns.
4606 [(set (match_operand:DI 0 "memory_operand" "=m")
4608 "TARGET_MIPS16 && TARGET_64BIT"
4610 [(set_attr "type" "store")
4611 (set_attr "mode" "DI")])
4613 (define_insn "movdi_internal"
4614 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,m,*x,*d,*x,*B*C*D,*B*C*D,*d,*m")
4615 (match_operand:DI 1 "general_operand" "d,iF,m,d,J,*x,*d,*d,*m,*B*C*D,*B*C*D"))]
4616 "!TARGET_64BIT && !TARGET_MIPS16
4617 && (register_operand (operands[0], DImode)
4618 || register_operand (operands[1], DImode)
4619 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0)
4620 || operands[1] == CONST0_RTX (DImode))"
4621 { return mips_output_move (operands[0], operands[1]); }
4622 [(set_attr "type" "move,arith,load,store,hilo,hilo,hilo,xfer,load,xfer,store")
4623 (set_attr "mode" "DI")
4624 (set_attr "length" "8,16,*,*,8,8,8,8,*,8,*")])
4627 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,y,d,d,d,d,m,*d")
4628 (match_operand:DI 1 "general_operand" "d,d,y,K,N,m,d,*x"))]
4629 "!TARGET_64BIT && TARGET_MIPS16
4630 && (register_operand (operands[0], DImode)
4631 || register_operand (operands[1], DImode))"
4632 { return mips_output_move (operands[0], operands[1]); }
4633 [(set_attr "type" "move,move,move,arith,arith,load,store,hilo")
4634 (set_attr "mode" "DI")
4635 (set_attr "length" "8,8,8,8,12,*,*,8")])
4637 (define_insn "movdi_internal2"
4638 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,e,d,m,*f,*f,*f,*d,*m,*x,*d,*x,*B*C*D,*B*C*D,*d,*m")
4639 (match_operand:DI 1 "move_operand" "d,U,T,m,dJ,*f,*d*J,*m,*f,*f,*J,*x,*d,*d,*m,*B*C*D,*B*C*D"))]
4640 "TARGET_64BIT && !TARGET_MIPS16
4641 && (register_operand (operands[0], DImode)
4642 || register_operand (operands[1], DImode)
4643 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0)
4644 || operands[1] == CONST0_RTX (DImode))"
4645 { return mips_output_move (operands[0], operands[1]); }
4646 [(set_attr "type" "move,const,const,load,store,move,xfer,load,xfer,store,hilo,hilo,hilo,xfer,load,xfer,store")
4647 (set_attr "mode" "DI")
4648 (set_attr "length" "4,*,*,*,*,4,4,*,4,*,4,4,4,8,*,8,*")])
4650 (define_insn "*movdi_internal2_mips16"
4651 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,y,d,d,d,d,d,m,*d")
4652 (match_operand:DI 1 "move_operand" "d,d,y,K,N,U,m,d,*x"))]
4653 "TARGET_64BIT && TARGET_MIPS16
4654 && (register_operand (operands[0], DImode)
4655 || register_operand (operands[1], DImode))"
4656 { return mips_output_move (operands[0], operands[1]); }
4657 [(set_attr "type" "move,move,move,arith,arith,const,load,store,hilo")
4658 (set_attr "mode" "DI")
4659 (set_attr_alternative "length"
4663 (if_then_else (match_operand:VOID 1 "m16_uimm8_1" "")
4666 (if_then_else (match_operand:VOID 1 "m16_nuimm8_1" "")
4675 ;; On the mips16, we can split ld $r,N($r) into an add and a load,
4676 ;; when the original load is a 4 byte instruction but the add and the
4677 ;; load are 2 2 byte instructions.
4680 [(set (match_operand:DI 0 "register_operand" "")
4681 (mem:DI (plus:DI (match_dup 0)
4682 (match_operand:DI 1 "const_int_operand" ""))))]
4683 "TARGET_64BIT && TARGET_MIPS16 && reload_completed
4684 && !TARGET_DEBUG_D_MODE
4685 && GET_CODE (operands[0]) == REG
4686 && M16_REG_P (REGNO (operands[0]))
4687 && GET_CODE (operands[1]) == CONST_INT
4688 && ((INTVAL (operands[1]) < 0
4689 && INTVAL (operands[1]) >= -0x10)
4690 || (INTVAL (operands[1]) >= 32 * 8
4691 && INTVAL (operands[1]) <= 31 * 8 + 0x8)
4692 || (INTVAL (operands[1]) >= 0
4693 && INTVAL (operands[1]) < 32 * 8
4694 && (INTVAL (operands[1]) & 7) != 0))"
4695 [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 1)))
4696 (set (match_dup 0) (mem:DI (plus:DI (match_dup 0) (match_dup 2))))]
4699 HOST_WIDE_INT val = INTVAL (operands[1]);
4702 operands[2] = GEN_INT (0);
4703 else if (val >= 32 * 8)
4707 operands[1] = GEN_INT (0x8 + off);
4708 operands[2] = GEN_INT (val - off - 0x8);
4714 operands[1] = GEN_INT (off);
4715 operands[2] = GEN_INT (val - off);
4719 ;; 32-bit Integer moves
4721 ;; Unlike most other insns, the move insns can't be split with
4722 ;; different predicates, because register spilling and other parts of
4723 ;; the compiler, have memoized the insn number already.
4725 (define_expand "movsi"
4726 [(set (match_operand:SI 0 "nonimmediate_operand" "")
4727 (match_operand:SI 1 "" ""))]
4731 if (mips_legitimize_move (SImode, operands[0], operands[1]))
4734 /* If we are generating embedded PIC code, and we are referring to a
4735 symbol in the .text section, we must use an offset from the start
4737 if (TARGET_EMBEDDED_PIC
4738 && (GET_CODE (operands[1]) == LABEL_REF
4739 || (GET_CODE (operands[1]) == SYMBOL_REF
4740 && ! SYMBOL_REF_FLAG (operands[1]))))
4744 temp = embedded_pic_offset (operands[1]);
4745 temp = gen_rtx_PLUS (Pmode, embedded_pic_fnaddr_reg (),
4746 force_reg (SImode, temp));
4747 emit_move_insn (operands[0], force_reg (SImode, temp));
4752 ;; We can only store $ra directly into a small sp offset. Should the
4753 ;; offset be too wide, non-constant or not sp-based, leave it up to
4754 ;; reload to choose a scratch register.
4757 [(set (mem:SI (plus:SI (reg:SI 29)
4758 (match_operand:SI 0 "small_int" "n")))
4762 [(set_attr "type" "store")
4763 (set_attr "mode" "SI")
4764 (set_attr_alternative
4767 (lt (symbol_ref "(unsigned HOST_WIDE_INT) INTVAL (operands[0])")
4772 ;; The difference between these two is whether or not ints are allowed
4773 ;; in FP registers (off by default, use -mdebugh to enable).
4775 (define_insn "movsi_internal"
4776 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,e,d,m,*f,*f,*f,*d,*m,*d,*z,*x,*d,*x,*B*C*D,*B*C*D,*d,*m")
4777 (match_operand:SI 1 "move_operand" "d,U,T,m,dJ,*f,*d*J,*m,*f,*f,*z,*d,J,*x,*d,*d,*m,*B*C*D,*B*C*D"))]
4779 && (register_operand (operands[0], SImode)
4780 || register_operand (operands[1], SImode)
4781 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
4782 { return mips_output_move (operands[0], operands[1]); }
4783 [(set_attr "type" "move,const,const,load,store,move,xfer,load,xfer,store,xfer,xfer,hilo,hilo,hilo,xfer,load,xfer,store")
4784 (set_attr "mode" "SI")
4785 (set_attr "length" "4,*,*,*,*,4,4,*,4,*,4,4,4,4,4,4,*,4,*")])
4788 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,y,d,d,d,d,d,m,*d")
4789 (match_operand:SI 1 "move_operand" "d,d,y,K,N,U,m,d,*x"))]
4791 && (register_operand (operands[0], SImode)
4792 || register_operand (operands[1], SImode))"
4793 { return mips_output_move (operands[0], operands[1]); }
4794 [(set_attr "type" "move,move,move,arith,arith,const,load,store,hilo")
4795 (set_attr "mode" "SI")
4796 (set_attr_alternative "length"
4800 (if_then_else (match_operand:VOID 1 "m16_uimm8_1" "")
4803 (if_then_else (match_operand:VOID 1 "m16_nuimm8_1" "")
4811 ;; On the mips16, we can split lw $r,N($r) into an add and a load,
4812 ;; when the original load is a 4 byte instruction but the add and the
4813 ;; load are 2 2 byte instructions.
4816 [(set (match_operand:SI 0 "register_operand" "")
4817 (mem:SI (plus:SI (match_dup 0)
4818 (match_operand:SI 1 "const_int_operand" ""))))]
4819 "TARGET_MIPS16 && reload_completed && !TARGET_DEBUG_D_MODE
4820 && GET_CODE (operands[0]) == REG
4821 && M16_REG_P (REGNO (operands[0]))
4822 && GET_CODE (operands[1]) == CONST_INT
4823 && ((INTVAL (operands[1]) < 0
4824 && INTVAL (operands[1]) >= -0x80)
4825 || (INTVAL (operands[1]) >= 32 * 4
4826 && INTVAL (operands[1]) <= 31 * 4 + 0x7c)
4827 || (INTVAL (operands[1]) >= 0
4828 && INTVAL (operands[1]) < 32 * 4
4829 && (INTVAL (operands[1]) & 3) != 0))"
4830 [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
4831 (set (match_dup 0) (mem:SI (plus:SI (match_dup 0) (match_dup 2))))]
4834 HOST_WIDE_INT val = INTVAL (operands[1]);
4837 operands[2] = GEN_INT (0);
4838 else if (val >= 32 * 4)
4842 operands[1] = GEN_INT (0x7c + off);
4843 operands[2] = GEN_INT (val - off - 0x7c);
4849 operands[1] = GEN_INT (off);
4850 operands[2] = GEN_INT (val - off);
4854 ;; On the mips16, we can split a load of certain constants into a load
4855 ;; and an add. This turns a 4 byte instruction into 2 2 byte
4859 [(set (match_operand:SI 0 "register_operand" "")
4860 (match_operand:SI 1 "const_int_operand" ""))]
4861 "TARGET_MIPS16 && reload_completed && !TARGET_DEBUG_D_MODE
4862 && GET_CODE (operands[0]) == REG
4863 && M16_REG_P (REGNO (operands[0]))
4864 && GET_CODE (operands[1]) == CONST_INT
4865 && INTVAL (operands[1]) >= 0x100
4866 && INTVAL (operands[1]) <= 0xff + 0x7f"
4867 [(set (match_dup 0) (match_dup 1))
4868 (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))]
4871 int val = INTVAL (operands[1]);
4873 operands[1] = GEN_INT (0xff);
4874 operands[2] = GEN_INT (val - 0xff);
4877 ;; On the mips16, we can split a load of a negative constant into a
4878 ;; load and a neg. That's what mips_output_move will generate anyhow.
4881 [(set (match_operand:SI 0 "register_operand" "")
4882 (match_operand:SI 1 "const_int_operand" ""))]
4883 "TARGET_MIPS16 && reload_completed && !TARGET_DEBUG_D_MODE
4884 && GET_CODE (operands[0]) == REG
4885 && M16_REG_P (REGNO (operands[0]))
4886 && GET_CODE (operands[1]) == CONST_INT
4887 && INTVAL (operands[1]) < 0
4888 && INTVAL (operands[1]) > - 0x8000"
4889 [(set (match_dup 0) (match_dup 1))
4890 (set (match_dup 0) (neg:SI (match_dup 0)))]
4893 operands[1] = GEN_INT (- INTVAL (operands[1]));
4896 ;; This insn handles moving CCmode values. It's really just a
4897 ;; slightly simplified copy of movsi_internal2, with additional cases
4898 ;; to move a condition register to a general register and to move
4899 ;; between the general registers and the floating point registers.
4901 (define_insn "movcc"
4902 [(set (match_operand:CC 0 "nonimmediate_operand" "=d,*d,*d,*m,*d,*f,*f,*f,*m")
4903 (match_operand:CC 1 "general_operand" "z,*d,*m,*d,*f,*d,*f,*m,*f"))]
4904 "ISA_HAS_8CC && TARGET_HARD_FLOAT"
4905 { return mips_output_move (operands[0], operands[1]); }
4906 [(set_attr "type" "move,move,load,store,xfer,xfer,move,load,store")
4907 (set_attr "mode" "SI")
4908 (set_attr "length" "8,4,*,*,4,4,4,*,*")])
4910 ;; Reload condition code registers. reload_incc and reload_outcc
4911 ;; both handle moves from arbitrary operands into condition code
4912 ;; registers. reload_incc handles the more common case in which
4913 ;; a source operand is constrained to be in a condition-code
4914 ;; register, but has not been allocated to one.
4916 ;; Sometimes, such as in movcc, we have a CCmode destination whose
4917 ;; constraints do not include 'z'. reload_outcc handles the case
4918 ;; when such an operand is allocated to a condition-code register.
4920 ;; Note that reloads from a condition code register to some
4921 ;; other location can be done using ordinary moves. Moving
4922 ;; into a GPR takes a single movcc, moving elsewhere takes
4923 ;; two. We can leave these cases to the generic reload code.
4924 (define_expand "reload_incc"
4925 [(set (match_operand:CC 0 "fcc_register_operand" "=z")
4926 (match_operand:CC 1 "general_operand" ""))
4927 (clobber (match_operand:TF 2 "register_operand" "=&f"))]
4928 "ISA_HAS_8CC && TARGET_HARD_FLOAT"
4931 mips_emit_fcc_reload (operands[0], operands[1], operands[2]);
4935 (define_expand "reload_outcc"
4936 [(set (match_operand:CC 0 "fcc_register_operand" "=z")
4937 (match_operand:CC 1 "register_operand" ""))
4938 (clobber (match_operand:TF 2 "register_operand" "=&f"))]
4939 "ISA_HAS_8CC && TARGET_HARD_FLOAT"
4942 mips_emit_fcc_reload (operands[0], operands[1], operands[2]);
4946 ;; MIPS4 supports loading and storing a floating point register from
4947 ;; the sum of two general registers. We use two versions for each of
4948 ;; these four instructions: one where the two general registers are
4949 ;; SImode, and one where they are DImode. This is because general
4950 ;; registers will be in SImode when they hold 32 bit values, but,
4951 ;; since the 32 bit values are always sign extended, the [ls][wd]xc1
4952 ;; instructions will still work correctly.
4954 ;; ??? Perhaps it would be better to support these instructions by
4955 ;; modifying GO_IF_LEGITIMATE_ADDRESS and friends. However, since
4956 ;; these instructions can only be used to load and store floating
4957 ;; point registers, that would probably cause trouble in reload.
4960 [(set (match_operand:SF 0 "register_operand" "=f")
4961 (mem:SF (plus:SI (match_operand:SI 1 "register_operand" "d")
4962 (match_operand:SI 2 "register_operand" "d"))))]
4963 "ISA_HAS_FP4 && TARGET_HARD_FLOAT"
4965 [(set_attr "type" "load")
4966 (set_attr "mode" "SF")
4967 (set_attr "length" "4")])
4970 [(set (match_operand:SF 0 "register_operand" "=f")
4971 (mem:SF (plus:DI (match_operand:DI 1 "register_operand" "d")
4972 (match_operand:DI 2 "register_operand" "d"))))]
4973 "ISA_HAS_FP4 && TARGET_HARD_FLOAT"
4975 [(set_attr "type" "load")
4976 (set_attr "mode" "SF")
4977 (set_attr "length" "4")])
4980 [(set (match_operand:DF 0 "register_operand" "=f")
4981 (mem:DF (plus:SI (match_operand:SI 1 "register_operand" "d")
4982 (match_operand:SI 2 "register_operand" "d"))))]
4983 "ISA_HAS_FP4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
4985 [(set_attr "type" "load")
4986 (set_attr "mode" "DF")
4987 (set_attr "length" "4")])
4990 [(set (match_operand:DF 0 "register_operand" "=f")
4991 (mem:DF (plus:DI (match_operand:DI 1 "register_operand" "d")
4992 (match_operand:DI 2 "register_operand" "d"))))]
4993 "ISA_HAS_FP4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
4995 [(set_attr "type" "load")
4996 (set_attr "mode" "DF")
4997 (set_attr "length" "4")])
5000 [(set (mem:SF (plus:SI (match_operand:SI 1 "register_operand" "d")
5001 (match_operand:SI 2 "register_operand" "d")))
5002 (match_operand:SF 0 "register_operand" "f"))]
5003 "ISA_HAS_FP4 && TARGET_HARD_FLOAT"
5005 [(set_attr "type" "store")
5006 (set_attr "mode" "SF")
5007 (set_attr "length" "4")])
5010 [(set (mem:SF (plus:DI (match_operand:DI 1 "register_operand" "d")
5011 (match_operand:DI 2 "register_operand" "d")))
5012 (match_operand:SF 0 "register_operand" "f"))]
5013 "ISA_HAS_FP4 && TARGET_HARD_FLOAT"
5015 [(set_attr "type" "store")
5016 (set_attr "mode" "SF")
5017 (set_attr "length" "4")])
5020 [(set (mem:DF (plus:SI (match_operand:SI 1 "register_operand" "d")
5021 (match_operand:SI 2 "register_operand" "d")))
5022 (match_operand:DF 0 "register_operand" "f"))]
5023 "ISA_HAS_FP4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
5025 [(set_attr "type" "store")
5026 (set_attr "mode" "DF")
5027 (set_attr "length" "4")])
5030 [(set (mem:DF (plus:DI (match_operand:DI 1 "register_operand" "d")
5031 (match_operand:DI 2 "register_operand" "d")))
5032 (match_operand:DF 0 "register_operand" "f"))]
5033 "ISA_HAS_FP4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
5035 [(set_attr "type" "store")
5036 (set_attr "mode" "DF")
5037 (set_attr "length" "4")])
5039 ;; 16-bit Integer moves
5041 ;; Unlike most other insns, the move insns can't be split with
5042 ;; different predicates, because register spilling and other parts of
5043 ;; the compiler, have memoized the insn number already.
5044 ;; Unsigned loads are used because BYTE_LOADS_ZERO_EXTEND is defined
5046 (define_expand "movhi"
5047 [(set (match_operand:HI 0 "nonimmediate_operand" "")
5048 (match_operand:HI 1 "general_operand" ""))]
5052 if ((reload_in_progress | reload_completed) == 0
5053 && !register_operand (operands[0], HImode)
5054 && !register_operand (operands[1], HImode)
5056 || (GET_CODE (operands[1]) != CONST_INT
5057 || INTVAL (operands[1]) != 0)))
5059 rtx temp = force_reg (HImode, operands[1]);
5060 emit_move_insn (operands[0], temp);
5065 ;; The difference between these two is whether or not ints are allowed
5066 ;; in FP registers (off by default, use -mdebugh to enable).
5068 (define_insn "movhi_internal"
5069 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,m,*d,*f,*f,*x,*d")
5070 (match_operand:HI 1 "general_operand" "d,IK,m,dJ,*f,*d,*f,*d,*x"))]
5072 && (register_operand (operands[0], HImode)
5073 || register_operand (operands[1], HImode)
5074 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
5085 [(set_attr "type" "move,arith,load,store,xfer,xfer,move,hilo,hilo")
5086 (set_attr "mode" "HI")
5087 (set_attr "length" "4,4,*,*,4,4,4,4,4")])
5090 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,y,d,d,d,d,m,*d")
5091 (match_operand:HI 1 "general_operand" "d,d,y,K,N,m,d,*x"))]
5093 && (register_operand (operands[0], HImode)
5094 || register_operand (operands[1], HImode))"
5104 [(set_attr "type" "move,move,move,arith,arith,load,store,hilo")
5105 (set_attr "mode" "HI")
5106 (set_attr_alternative "length"
5110 (if_then_else (match_operand:VOID 1 "m16_uimm8_1" "")
5113 (if_then_else (match_operand:VOID 1 "m16_nuimm8_1" "")
5121 ;; On the mips16, we can split lh $r,N($r) into an add and a load,
5122 ;; when the original load is a 4 byte instruction but the add and the
5123 ;; load are 2 2 byte instructions.
5126 [(set (match_operand:HI 0 "register_operand" "")
5127 (mem:HI (plus:SI (match_dup 0)
5128 (match_operand:SI 1 "const_int_operand" ""))))]
5129 "TARGET_MIPS16 && reload_completed && !TARGET_DEBUG_D_MODE
5130 && GET_CODE (operands[0]) == REG
5131 && M16_REG_P (REGNO (operands[0]))
5132 && GET_CODE (operands[1]) == CONST_INT
5133 && ((INTVAL (operands[1]) < 0
5134 && INTVAL (operands[1]) >= -0x80)
5135 || (INTVAL (operands[1]) >= 32 * 2
5136 && INTVAL (operands[1]) <= 31 * 2 + 0x7e)
5137 || (INTVAL (operands[1]) >= 0
5138 && INTVAL (operands[1]) < 32 * 2
5139 && (INTVAL (operands[1]) & 1) != 0))"
5140 [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
5141 (set (match_dup 0) (mem:HI (plus:SI (match_dup 0) (match_dup 2))))]
5144 HOST_WIDE_INT val = INTVAL (operands[1]);
5147 operands[2] = GEN_INT (0);
5148 else if (val >= 32 * 2)
5152 operands[1] = GEN_INT (0x7e + off);
5153 operands[2] = GEN_INT (val - off - 0x7e);
5159 operands[1] = GEN_INT (off);
5160 operands[2] = GEN_INT (val - off);
5164 ;; 8-bit Integer moves
5166 ;; Unlike most other insns, the move insns can't be split with
5167 ;; different predicates, because register spilling and other parts of
5168 ;; the compiler, have memoized the insn number already.
5169 ;; Unsigned loads are used because BYTE_LOADS_ZERO_EXTEND is defined
5171 (define_expand "movqi"
5172 [(set (match_operand:QI 0 "nonimmediate_operand" "")
5173 (match_operand:QI 1 "general_operand" ""))]
5177 if ((reload_in_progress | reload_completed) == 0
5178 && !register_operand (operands[0], QImode)
5179 && !register_operand (operands[1], QImode)
5181 || (GET_CODE (operands[1]) != CONST_INT
5182 || INTVAL (operands[1]) != 0)))
5184 rtx temp = force_reg (QImode, operands[1]);
5185 emit_move_insn (operands[0], temp);
5190 ;; The difference between these two is whether or not ints are allowed
5191 ;; in FP registers (off by default, use -mdebugh to enable).
5193 (define_insn "movqi_internal"
5194 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,m,*d,*f,*f,*x,*d")
5195 (match_operand:QI 1 "general_operand" "d,IK,m,dJ,*f,*d,*f,*d,*x"))]
5197 && (register_operand (operands[0], QImode)
5198 || register_operand (operands[1], QImode)
5199 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
5210 [(set_attr "type" "move,arith,load,store,xfer,xfer,move,hilo,hilo")
5211 (set_attr "mode" "QI")
5212 (set_attr "length" "4,4,*,*,4,4,4,4,4")])
5215 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,y,d,d,d,d,m,*d")
5216 (match_operand:QI 1 "general_operand" "d,d,y,K,N,m,d,*x"))]
5218 && (register_operand (operands[0], QImode)
5219 || register_operand (operands[1], QImode))"
5229 [(set_attr "type" "move,move,move,arith,arith,load,store,hilo")
5230 (set_attr "mode" "QI")
5231 (set_attr "length" "4,4,4,4,8,*,*,4")])
5233 ;; On the mips16, we can split lb $r,N($r) into an add and a load,
5234 ;; when the original load is a 4 byte instruction but the add and the
5235 ;; load are 2 2 byte instructions.
5238 [(set (match_operand:QI 0 "register_operand" "")
5239 (mem:QI (plus:SI (match_dup 0)
5240 (match_operand:SI 1 "const_int_operand" ""))))]
5241 "TARGET_MIPS16 && reload_completed && !TARGET_DEBUG_D_MODE
5242 && GET_CODE (operands[0]) == REG
5243 && M16_REG_P (REGNO (operands[0]))
5244 && GET_CODE (operands[1]) == CONST_INT
5245 && ((INTVAL (operands[1]) < 0
5246 && INTVAL (operands[1]) >= -0x80)
5247 || (INTVAL (operands[1]) >= 32
5248 && INTVAL (operands[1]) <= 31 + 0x7f))"
5249 [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 1)))
5250 (set (match_dup 0) (mem:QI (plus:SI (match_dup 0) (match_dup 2))))]
5253 HOST_WIDE_INT val = INTVAL (operands[1]);
5256 operands[2] = GEN_INT (0);
5259 operands[1] = GEN_INT (0x7f);
5260 operands[2] = GEN_INT (val - 0x7f);
5264 ;; 32-bit floating point moves
5266 (define_expand "movsf"
5267 [(set (match_operand:SF 0 "nonimmediate_operand" "")
5268 (match_operand:SF 1 "general_operand" ""))]
5272 if ((reload_in_progress | reload_completed) == 0
5273 && !register_operand (operands[0], SFmode)
5274 && !nonmemory_operand (operands[1], SFmode))
5275 operands[1] = force_reg (SFmode, operands[1]);
5278 (define_insn "movsf_internal1"
5279 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,f,f,m,*f,*d,*d,*d,*m")
5280 (match_operand:SF 1 "general_operand" "f,G,m,fG,*d,*f,*G*d,*m,*d"))]
5282 && (register_operand (operands[0], SFmode)
5283 || nonmemory_operand (operands[1], SFmode))"
5284 { return mips_output_move (operands[0], operands[1]); }
5285 [(set_attr "type" "move,xfer,load,store,xfer,xfer,move,load,store")
5286 (set_attr "mode" "SF")
5287 (set_attr "length" "4,4,*,*,4,4,4,*,*")])
5289 (define_insn "movsf_internal2"
5290 [(set (match_operand:SF 0 "nonimmediate_operand" "=d,d,m")
5291 (match_operand:SF 1 "general_operand" " Gd,m,d"))]
5292 "TARGET_SOFT_FLOAT && !TARGET_MIPS16
5293 && (register_operand (operands[0], SFmode)
5294 || nonmemory_operand (operands[1], SFmode))"
5295 { return mips_output_move (operands[0], operands[1]); }
5296 [(set_attr "type" "move,load,store")
5297 (set_attr "mode" "SF")
5298 (set_attr "length" "4,*,*")])
5301 [(set (match_operand:SF 0 "nonimmediate_operand" "=d,y,d,d,m")
5302 (match_operand:SF 1 "nonimmediate_operand" "d,d,y,m,d"))]
5304 && (register_operand (operands[0], SFmode)
5305 || register_operand (operands[1], SFmode))"
5306 { return mips_output_move (operands[0], operands[1]); }
5307 [(set_attr "type" "move,move,move,load,store")
5308 (set_attr "mode" "SF")
5309 (set_attr "length" "4,4,4,*,*")])
5312 ;; 64-bit floating point moves
5314 (define_expand "movdf"
5315 [(set (match_operand:DF 0 "nonimmediate_operand" "")
5316 (match_operand:DF 1 "general_operand" ""))]
5320 if ((reload_in_progress | reload_completed) == 0
5321 && !register_operand (operands[0], DFmode)
5322 && !nonmemory_operand (operands[1], DFmode))
5323 operands[1] = force_reg (DFmode, operands[1]);
5326 (define_insn "movdf_internal1a"
5327 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,m,*f,*d,*d,*d,*m")
5328 (match_operand:DF 1 "general_operand" "f,G,m,fG,*d,*f,*d*G,*m,*d"))]
5329 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_64BIT
5330 && (register_operand (operands[0], DFmode)
5331 || nonmemory_operand (operands[1], DFmode))"
5332 { return mips_output_move (operands[0], operands[1]); }
5333 [(set_attr "type" "move,xfer,load,store,xfer,xfer,move,load,store")
5334 (set_attr "mode" "DF")
5335 (set_attr "length" "4,4,*,*,4,4,4,*,*")])
5337 (define_insn "movdf_internal1b"
5338 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f,f,m,*f,*d,*d,*d,*m")
5339 (match_operand:DF 1 "general_operand" "f,G,m,fG,*d,*f,*d*G,*m,*d"))]
5340 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && !TARGET_64BIT
5341 && (register_operand (operands[0], DFmode)
5342 || nonmemory_operand (operands[1], DFmode))"
5343 { return mips_output_move (operands[0], operands[1]); }
5344 [(set_attr "type" "move,xfer,load,store,xfer,xfer,move,load,store")
5345 (set_attr "mode" "DF")
5346 (set_attr "length" "4,8,*,*,8,8,8,*,*")])
5348 (define_insn "movdf_internal2"
5349 [(set (match_operand:DF 0 "nonimmediate_operand" "=d,d,m,d,f,f")
5350 (match_operand:DF 1 "general_operand" "dG,m,dG,f,d,f"))]
5351 "(TARGET_SOFT_FLOAT || TARGET_SINGLE_FLOAT) && !TARGET_MIPS16
5352 && (register_operand (operands[0], DFmode)
5353 || nonmemory_operand (operands[1], DFmode))"
5354 { return mips_output_move (operands[0], operands[1]); }
5355 [(set_attr "type" "move,load,store,xfer,xfer,move")
5356 (set_attr "mode" "DF")
5357 (set_attr "length" "8,*,*,4,4,4")])
5360 [(set (match_operand:DF 0 "nonimmediate_operand" "=d,y,d,d,m")
5361 (match_operand:DF 1 "nonimmediate_operand" "d,d,y,m,d"))]
5363 && (register_operand (operands[0], DFmode)
5364 || register_operand (operands[1], DFmode))"
5365 { return mips_output_move (operands[0], operands[1]); }
5366 [(set_attr "type" "move,move,move,load,store")
5367 (set_attr "mode" "DF")
5368 (set_attr "length" "8,8,8,*,*")])
5371 [(set (match_operand:DI 0 "nonimmediate_operand" "")
5372 (match_operand:DI 1 "general_operand" ""))]
5373 "reload_completed && !TARGET_64BIT
5374 && mips_split_64bit_move_p (operands[0], operands[1])"
5377 mips_split_64bit_move (operands[0], operands[1]);
5382 [(set (match_operand:DF 0 "nonimmediate_operand" "")
5383 (match_operand:DF 1 "general_operand" ""))]
5384 "reload_completed && !TARGET_64BIT
5385 && mips_split_64bit_move_p (operands[0], operands[1])"
5388 mips_split_64bit_move (operands[0], operands[1]);
5392 ;; Patterns for loading or storing part of a paired floating point
5393 ;; register. We need them because odd-numbered floating-point registers
5394 ;; are not fully independent: see mips_split_64bit_move.
5396 ;; Load the low word of operand 0 with operand 1.
5397 (define_insn "load_df_low"
5398 [(set (match_operand:DF 0 "register_operand" "=f,f")
5399 (unspec:DF [(match_operand:SI 1 "general_operand" "dJ,m")]
5400 UNSPEC_LOAD_DF_LOW))]
5401 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && !TARGET_64BIT"
5403 operands[0] = mips_subword (operands[0], 0);
5404 return mips_output_move (operands[0], operands[1]);
5406 [(set_attr "type" "xfer,load")
5407 (set_attr "mode" "SF")
5408 (set_attr "length" "4")])
5410 ;; Load the high word of operand 0 from operand 1, preserving the value
5412 (define_insn "load_df_high"
5413 [(set (match_operand:DF 0 "register_operand" "=f,f")
5414 (unspec:DF [(match_operand:SI 1 "general_operand" "dJ,m")
5415 (match_operand:DF 2 "register_operand" "0,0")]
5416 UNSPEC_LOAD_DF_HIGH))]
5417 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && !TARGET_64BIT"
5419 operands[0] = mips_subword (operands[0], 1);
5420 return mips_output_move (operands[0], operands[1]);
5422 [(set_attr "type" "xfer,load")
5423 (set_attr "mode" "SF")
5424 (set_attr "length" "4")])
5426 ;; Store the high word of operand 1 in operand 0. The corresponding
5427 ;; low-word move is done in the normal way.
5428 (define_insn "store_df_high"
5429 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,m")
5430 (unspec:SI [(match_operand:DF 1 "register_operand" "f,f")]
5431 UNSPEC_STORE_DF_HIGH))]
5432 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && !TARGET_64BIT"
5434 operands[1] = mips_subword (operands[1], 1);
5435 return mips_output_move (operands[0], operands[1]);
5437 [(set_attr "type" "xfer,store")
5438 (set_attr "mode" "SF")
5439 (set_attr "length" "4")])
5441 ;; The use of gp is hidden when not using explicit relocations.
5442 ;; This blockage instruction prevents the gp load from being
5443 ;; scheduled after an implicit use of gp. It also prevents
5444 ;; the load from being deleted as dead.
5445 (define_insn "loadgp_blockage"
5446 [(unspec_volatile [(reg:DI 28)] UNSPEC_BLOCKAGE)]
5449 [(set_attr "type" "unknown")
5450 (set_attr "mode" "none")
5451 (set_attr "length" "0")])
5453 ;; Emit a .cprestore directive, which expands to a single store instruction.
5454 ;; Note that we continue to use .cprestore for explicit reloc code so that
5455 ;; jals inside inlines asms will work correctly.
5456 (define_insn "cprestore"
5457 [(unspec_volatile [(match_operand 0 "const_int_operand" "")]
5461 [(set_attr "type" "store")
5462 (set_attr "length" "4")])
5464 ;; Block moves, see mips.c for more details.
5465 ;; Argument 0 is the destination
5466 ;; Argument 1 is the source
5467 ;; Argument 2 is the length
5468 ;; Argument 3 is the alignment
5470 (define_expand "movstrsi"
5471 [(parallel [(set (match_operand:BLK 0 "general_operand" "")
5472 (match_operand:BLK 1 "general_operand" ""))
5473 (use (match_operand:SI 2 "" ""))
5474 (use (match_operand:SI 3 "const_int_operand" ""))])]
5475 "!TARGET_MIPS16 && !TARGET_MEMCPY"
5477 if (mips_expand_block_move (operands[0], operands[1], operands[2]))
5484 ;; ....................
5488 ;; ....................
5490 ;; Many of these instructions uses trivial define_expands, because we
5491 ;; want to use a different set of constraints when TARGET_MIPS16.
5493 (define_expand "ashlsi3"
5494 [(set (match_operand:SI 0 "register_operand" "=d")
5495 (ashift:SI (match_operand:SI 1 "register_operand" "d")
5496 (match_operand:SI 2 "arith_operand" "dI")))]
5500 /* On the mips16, a shift of more than 8 is a four byte instruction,
5501 so, for a shift between 8 and 16, it is just as fast to do two
5502 shifts of 8 or less. If there is a lot of shifting going on, we
5503 may win in CSE. Otherwise combine will put the shifts back
5504 together again. This can be called by function_arg, so we must
5505 be careful not to allocate a new register if we've reached the
5509 && GET_CODE (operands[2]) == CONST_INT
5510 && INTVAL (operands[2]) > 8
5511 && INTVAL (operands[2]) <= 16
5512 && ! reload_in_progress
5513 && ! reload_completed)
5515 rtx temp = gen_reg_rtx (SImode);
5517 emit_insn (gen_ashlsi3_internal2 (temp, operands[1], GEN_INT (8)));
5518 emit_insn (gen_ashlsi3_internal2 (operands[0], temp,
5519 GEN_INT (INTVAL (operands[2]) - 8)));
5524 (define_insn "ashlsi3_internal1"
5525 [(set (match_operand:SI 0 "register_operand" "=d")
5526 (ashift:SI (match_operand:SI 1 "register_operand" "d")
5527 (match_operand:SI 2 "arith_operand" "dI")))]
5531 if (GET_CODE (operands[2]) == CONST_INT)
5532 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
5534 return \"sll\\t%0,%1,%2\";
5536 [(set_attr "type" "arith")
5537 (set_attr "mode" "SI")])
5539 (define_insn "ashlsi3_internal1_extend"
5540 [(set (match_operand:DI 0 "register_operand" "=d")
5541 (sign_extend:DI (ashift:SI (match_operand:SI 1 "register_operand" "d")
5542 (match_operand:SI 2 "arith_operand" "dI"))))]
5543 "TARGET_64BIT && !TARGET_MIPS16"
5546 if (GET_CODE (operands[2]) == CONST_INT)
5547 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
5549 return \"sll\\t%0,%1,%2\";
5551 [(set_attr "type" "arith")
5552 (set_attr "mode" "DI")])
5555 (define_insn "ashlsi3_internal2"
5556 [(set (match_operand:SI 0 "register_operand" "=d,d")
5557 (ashift:SI (match_operand:SI 1 "register_operand" "0,d")
5558 (match_operand:SI 2 "arith_operand" "d,I")))]
5562 if (which_alternative == 0)
5563 return \"sll\\t%0,%2\";
5565 if (GET_CODE (operands[2]) == CONST_INT)
5566 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
5568 return \"sll\\t%0,%1,%2\";
5570 [(set_attr "type" "arith")
5571 (set_attr "mode" "SI")
5572 (set_attr_alternative "length"
5574 (if_then_else (match_operand:VOID 2 "m16_uimm3_b" "")
5578 ;; On the mips16, we can split a 4 byte shift into 2 2 byte shifts.
5581 [(set (match_operand:SI 0 "register_operand" "")
5582 (ashift:SI (match_operand:SI 1 "register_operand" "")
5583 (match_operand:SI 2 "const_int_operand" "")))]
5584 "TARGET_MIPS16 && reload_completed && !TARGET_DEBUG_D_MODE
5585 && GET_CODE (operands[2]) == CONST_INT
5586 && INTVAL (operands[2]) > 8
5587 && INTVAL (operands[2]) <= 16"
5588 [(set (match_dup 0) (ashift:SI (match_dup 1) (const_int 8)))
5589 (set (match_dup 0) (ashift:SI (match_dup 0) (match_dup 2)))]
5592 operands[2] = GEN_INT (INTVAL (operands[2]) - 8);
5595 (define_expand "ashldi3"
5596 [(parallel [(set (match_operand:DI 0 "register_operand" "")
5597 (ashift:DI (match_operand:DI 1 "register_operand" "")
5598 (match_operand:SI 2 "arith_operand" "")))
5599 (clobber (match_dup 3))])]
5600 "TARGET_64BIT || (!TARGET_DEBUG_G_MODE && !TARGET_MIPS16)"
5605 /* On the mips16, a shift of more than 8 is a four byte
5606 instruction, so, for a shift between 8 and 16, it is just as
5607 fast to do two shifts of 8 or less. If there is a lot of
5608 shifting going on, we may win in CSE. Otherwise combine will
5609 put the shifts back together again. This can be called by
5610 function_arg, so we must be careful not to allocate a new
5611 register if we've reached the reload pass. */
5614 && GET_CODE (operands[2]) == CONST_INT
5615 && INTVAL (operands[2]) > 8
5616 && INTVAL (operands[2]) <= 16
5617 && ! reload_in_progress
5618 && ! reload_completed)
5620 rtx temp = gen_reg_rtx (DImode);
5622 emit_insn (gen_ashldi3_internal4 (temp, operands[1], GEN_INT (8)));
5623 emit_insn (gen_ashldi3_internal4 (operands[0], temp,
5624 GEN_INT (INTVAL (operands[2]) - 8)));
5628 emit_insn (gen_ashldi3_internal4 (operands[0], operands[1],
5633 operands[3] = gen_reg_rtx (SImode);
5637 (define_insn "ashldi3_internal"
5638 [(set (match_operand:DI 0 "register_operand" "=&d")
5639 (ashift:DI (match_operand:DI 1 "register_operand" "d")
5640 (match_operand:SI 2 "register_operand" "d")))
5641 (clobber (match_operand:SI 3 "register_operand" "=d"))]
5642 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16"
5645 operands[4] = const0_rtx;
5647 return \"sll\\t%3,%2,26\\n\\
5648 \\tbgez\\t%3,1f%#\\n\\
5649 \\tsll\\t%M0,%L1,%2\\n\\
5651 \\tmove\\t%L0,%z4%)\\n\\
5654 \\t%(beq\\t%3,%z4,2f\\n\\
5655 \\tsll\\t%M0,%M1,%2%)\\n\\
5657 \\tsubu\\t%3,%z4,%2\\n\\
5658 \\tsrl\\t%3,%L1,%3\\n\\
5659 \\tor\\t%M0,%M0,%3\\n\\
5661 \\tsll\\t%L0,%L1,%2\\n\\
5664 [(set_attr "type" "darith")
5665 (set_attr "mode" "SI")
5666 (set_attr "length" "48")])
5669 (define_insn "ashldi3_internal2"
5670 [(set (match_operand:DI 0 "register_operand" "=d")
5671 (ashift:DI (match_operand:DI 1 "register_operand" "d")
5672 (match_operand:SI 2 "small_int" "IJK")))
5673 (clobber (match_operand:SI 3 "register_operand" "=d"))]
5674 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
5675 && (INTVAL (operands[2]) & 32) != 0"
5678 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
5679 operands[4] = const0_rtx;
5680 return \"sll\\t%M0,%L1,%2\;move\\t%L0,%z4\";
5682 [(set_attr "type" "darith")
5683 (set_attr "mode" "DI")
5684 (set_attr "length" "8")])
5688 [(set (match_operand:DI 0 "register_operand" "")
5689 (ashift:DI (match_operand:DI 1 "register_operand" "")
5690 (match_operand:SI 2 "small_int" "")))
5691 (clobber (match_operand:SI 3 "register_operand" ""))]
5692 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT
5693 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
5694 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
5695 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
5696 && (INTVAL (operands[2]) & 32) != 0"
5698 [(set (subreg:SI (match_dup 0) 4) (ashift:SI (subreg:SI (match_dup 1) 0) (match_dup 2)))
5699 (set (subreg:SI (match_dup 0) 0) (const_int 0))]
5701 "operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);")
5705 [(set (match_operand:DI 0 "register_operand" "")
5706 (ashift:DI (match_operand:DI 1 "register_operand" "")
5707 (match_operand:SI 2 "small_int" "")))
5708 (clobber (match_operand:SI 3 "register_operand" ""))]
5709 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT
5710 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
5711 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
5712 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
5713 && (INTVAL (operands[2]) & 32) != 0"
5715 [(set (subreg:SI (match_dup 0) 0) (ashift:SI (subreg:SI (match_dup 1) 4) (match_dup 2)))
5716 (set (subreg:SI (match_dup 0) 4) (const_int 0))]
5718 "operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);")
5721 (define_insn "ashldi3_internal3"
5722 [(set (match_operand:DI 0 "register_operand" "=d")
5723 (ashift:DI (match_operand:DI 1 "register_operand" "d")
5724 (match_operand:SI 2 "small_int" "IJK")))
5725 (clobber (match_operand:SI 3 "register_operand" "=d"))]
5726 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
5727 && (INTVAL (operands[2]) & 63) < 32
5728 && (INTVAL (operands[2]) & 63) != 0"
5731 int amount = INTVAL (operands[2]);
5733 operands[2] = GEN_INT (amount & 31);
5734 operands[4] = const0_rtx;
5735 operands[5] = GEN_INT ((-amount) & 31);
5737 return \"sll\\t%M0,%M1,%2\;srl\\t%3,%L1,%5\;or\\t%M0,%M0,%3\;sll\\t%L0,%L1,%2\";
5739 [(set_attr "type" "darith")
5740 (set_attr "mode" "DI")
5741 (set_attr "length" "16")])
5745 [(set (match_operand:DI 0 "register_operand" "")
5746 (ashift:DI (match_operand:DI 1 "register_operand" "")
5747 (match_operand:SI 2 "small_int" "")))
5748 (clobber (match_operand:SI 3 "register_operand" ""))]
5749 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT
5750 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
5751 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
5752 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
5753 && (INTVAL (operands[2]) & 63) < 32
5754 && (INTVAL (operands[2]) & 63) != 0"
5756 [(set (subreg:SI (match_dup 0) 4)
5757 (ashift:SI (subreg:SI (match_dup 1) 4)
5761 (lshiftrt:SI (subreg:SI (match_dup 1) 0)
5764 (set (subreg:SI (match_dup 0) 4)
5765 (ior:SI (subreg:SI (match_dup 0) 4)
5768 (set (subreg:SI (match_dup 0) 0)
5769 (ashift:SI (subreg:SI (match_dup 1) 0)
5773 int amount = INTVAL (operands[2]);
5774 operands[2] = GEN_INT (amount & 31);
5775 operands[4] = GEN_INT ((-amount) & 31);
5780 [(set (match_operand:DI 0 "register_operand" "")
5781 (ashift:DI (match_operand:DI 1 "register_operand" "")
5782 (match_operand:SI 2 "small_int" "")))
5783 (clobber (match_operand:SI 3 "register_operand" ""))]
5784 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT
5785 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
5786 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
5787 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
5788 && (INTVAL (operands[2]) & 63) < 32
5789 && (INTVAL (operands[2]) & 63) != 0"
5791 [(set (subreg:SI (match_dup 0) 0)
5792 (ashift:SI (subreg:SI (match_dup 1) 0)
5796 (lshiftrt:SI (subreg:SI (match_dup 1) 4)
5799 (set (subreg:SI (match_dup 0) 0)
5800 (ior:SI (subreg:SI (match_dup 0) 0)
5803 (set (subreg:SI (match_dup 0) 4)
5804 (ashift:SI (subreg:SI (match_dup 1) 4)
5808 int amount = INTVAL (operands[2]);
5809 operands[2] = GEN_INT (amount & 31);
5810 operands[4] = GEN_INT ((-amount) & 31);
5814 (define_insn "ashldi3_internal4"
5815 [(set (match_operand:DI 0 "register_operand" "=d")
5816 (ashift:DI (match_operand:DI 1 "register_operand" "d")
5817 (match_operand:SI 2 "arith_operand" "dI")))]
5818 "TARGET_64BIT && !TARGET_MIPS16"
5821 if (GET_CODE (operands[2]) == CONST_INT)
5822 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f);
5824 return \"dsll\\t%0,%1,%2\";
5826 [(set_attr "type" "arith")
5827 (set_attr "mode" "DI")])
5830 [(set (match_operand:DI 0 "register_operand" "=d,d")
5831 (ashift:DI (match_operand:DI 1 "register_operand" "0,d")
5832 (match_operand:SI 2 "arith_operand" "d,I")))]
5833 "TARGET_64BIT && TARGET_MIPS16"
5836 if (which_alternative == 0)
5837 return \"dsll\\t%0,%2\";
5839 if (GET_CODE (operands[2]) == CONST_INT)
5840 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f);
5842 return \"dsll\\t%0,%1,%2\";
5844 [(set_attr "type" "arith")
5845 (set_attr "mode" "DI")
5846 (set_attr_alternative "length"
5848 (if_then_else (match_operand:VOID 2 "m16_uimm3_b" "")
5853 ;; On the mips16, we can split a 4 byte shift into 2 2 byte shifts.
5856 [(set (match_operand:DI 0 "register_operand" "")
5857 (ashift:DI (match_operand:DI 1 "register_operand" "")
5858 (match_operand:SI 2 "const_int_operand" "")))]
5859 "TARGET_MIPS16 && TARGET_64BIT && !TARGET_DEBUG_D_MODE
5861 && GET_CODE (operands[2]) == CONST_INT
5862 && INTVAL (operands[2]) > 8
5863 && INTVAL (operands[2]) <= 16"
5864 [(set (match_dup 0) (ashift:DI (match_dup 1) (const_int 8)))
5865 (set (match_dup 0) (ashift:DI (match_dup 0) (match_dup 2)))]
5868 operands[2] = GEN_INT (INTVAL (operands[2]) - 8);
5871 (define_expand "ashrsi3"
5872 [(set (match_operand:SI 0 "register_operand" "=d")
5873 (ashiftrt:SI (match_operand:SI 1 "register_operand" "d")
5874 (match_operand:SI 2 "arith_operand" "dI")))]
5878 /* On the mips16, a shift of more than 8 is a four byte instruction,
5879 so, for a shift between 8 and 16, it is just as fast to do two
5880 shifts of 8 or less. If there is a lot of shifting going on, we
5881 may win in CSE. Otherwise combine will put the shifts back
5885 && GET_CODE (operands[2]) == CONST_INT
5886 && INTVAL (operands[2]) > 8
5887 && INTVAL (operands[2]) <= 16)
5889 rtx temp = gen_reg_rtx (SImode);
5891 emit_insn (gen_ashrsi3_internal2 (temp, operands[1], GEN_INT (8)));
5892 emit_insn (gen_ashrsi3_internal2 (operands[0], temp,
5893 GEN_INT (INTVAL (operands[2]) - 8)));
5898 (define_insn "ashrsi3_internal1"
5899 [(set (match_operand:SI 0 "register_operand" "=d")
5900 (ashiftrt:SI (match_operand:SI 1 "register_operand" "d")
5901 (match_operand:SI 2 "arith_operand" "dI")))]
5905 if (GET_CODE (operands[2]) == CONST_INT)
5906 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
5908 return \"sra\\t%0,%1,%2\";
5910 [(set_attr "type" "arith")
5911 (set_attr "mode" "SI")])
5913 (define_insn "ashrsi3_internal2"
5914 [(set (match_operand:SI 0 "register_operand" "=d,d")
5915 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0,d")
5916 (match_operand:SI 2 "arith_operand" "d,I")))]
5920 if (which_alternative == 0)
5921 return \"sra\\t%0,%2\";
5923 if (GET_CODE (operands[2]) == CONST_INT)
5924 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
5926 return \"sra\\t%0,%1,%2\";
5928 [(set_attr "type" "arith")
5929 (set_attr "mode" "SI")
5930 (set_attr_alternative "length"
5932 (if_then_else (match_operand:VOID 2 "m16_uimm3_b" "")
5937 ;; On the mips16, we can split a 4 byte shift into 2 2 byte shifts.
5940 [(set (match_operand:SI 0 "register_operand" "")
5941 (ashiftrt:SI (match_operand:SI 1 "register_operand" "")
5942 (match_operand:SI 2 "const_int_operand" "")))]
5943 "TARGET_MIPS16 && reload_completed && !TARGET_DEBUG_D_MODE
5944 && GET_CODE (operands[2]) == CONST_INT
5945 && INTVAL (operands[2]) > 8
5946 && INTVAL (operands[2]) <= 16"
5947 [(set (match_dup 0) (ashiftrt:SI (match_dup 1) (const_int 8)))
5948 (set (match_dup 0) (ashiftrt:SI (match_dup 0) (match_dup 2)))]
5951 operands[2] = GEN_INT (INTVAL (operands[2]) - 8);
5954 (define_expand "ashrdi3"
5955 [(parallel [(set (match_operand:DI 0 "register_operand" "")
5956 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
5957 (match_operand:SI 2 "arith_operand" "")))
5958 (clobber (match_dup 3))])]
5959 "TARGET_64BIT || (!TARGET_DEBUG_G_MODE && !TARGET_MIPS16)"
5964 /* On the mips16, a shift of more than 8 is a four byte
5965 instruction, so, for a shift between 8 and 16, it is just as
5966 fast to do two shifts of 8 or less. If there is a lot of
5967 shifting going on, we may win in CSE. Otherwise combine will
5968 put the shifts back together again. */
5971 && GET_CODE (operands[2]) == CONST_INT
5972 && INTVAL (operands[2]) > 8
5973 && INTVAL (operands[2]) <= 16)
5975 rtx temp = gen_reg_rtx (DImode);
5977 emit_insn (gen_ashrdi3_internal4 (temp, operands[1], GEN_INT (8)));
5978 emit_insn (gen_ashrdi3_internal4 (operands[0], temp,
5979 GEN_INT (INTVAL (operands[2]) - 8)));
5983 emit_insn (gen_ashrdi3_internal4 (operands[0], operands[1],
5988 operands[3] = gen_reg_rtx (SImode);
5992 (define_insn "ashrdi3_internal"
5993 [(set (match_operand:DI 0 "register_operand" "=&d")
5994 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
5995 (match_operand:SI 2 "register_operand" "d")))
5996 (clobber (match_operand:SI 3 "register_operand" "=d"))]
5997 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16"
6000 operands[4] = const0_rtx;
6002 return \"sll\\t%3,%2,26\\n\\
6003 \\tbgez\\t%3,1f%#\\n\\
6004 \\tsra\\t%L0,%M1,%2\\n\\
6006 \\tsra\\t%M0,%M1,31%)\\n\\
6009 \\t%(beq\\t%3,%z4,2f\\n\\
6010 \\tsrl\\t%L0,%L1,%2%)\\n\\
6012 \\tsubu\\t%3,%z4,%2\\n\\
6013 \\tsll\\t%3,%M1,%3\\n\\
6014 \\tor\\t%L0,%L0,%3\\n\\
6016 \\tsra\\t%M0,%M1,%2\\n\\
6019 [(set_attr "type" "darith")
6020 (set_attr "mode" "DI")
6021 (set_attr "length" "48")])
6024 (define_insn "ashrdi3_internal2"
6025 [(set (match_operand:DI 0 "register_operand" "=d")
6026 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6027 (match_operand:SI 2 "small_int" "IJK")))
6028 (clobber (match_operand:SI 3 "register_operand" "=d"))]
6029 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && (INTVAL (operands[2]) & 32) != 0"
6032 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
6033 return \"sra\\t%L0,%M1,%2\;sra\\t%M0,%M1,31\";
6035 [(set_attr "type" "darith")
6036 (set_attr "mode" "DI")
6037 (set_attr "length" "8")])
6041 [(set (match_operand:DI 0 "register_operand" "")
6042 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
6043 (match_operand:SI 2 "small_int" "")))
6044 (clobber (match_operand:SI 3 "register_operand" ""))]
6045 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT
6046 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
6047 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
6048 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
6049 && (INTVAL (operands[2]) & 32) != 0"
6051 [(set (subreg:SI (match_dup 0) 0) (ashiftrt:SI (subreg:SI (match_dup 1) 4) (match_dup 2)))
6052 (set (subreg:SI (match_dup 0) 4) (ashiftrt:SI (subreg:SI (match_dup 1) 4) (const_int 31)))]
6054 "operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);")
6058 [(set (match_operand:DI 0 "register_operand" "")
6059 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
6060 (match_operand:SI 2 "small_int" "")))
6061 (clobber (match_operand:SI 3 "register_operand" ""))]
6062 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT
6063 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
6064 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
6065 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
6066 && (INTVAL (operands[2]) & 32) != 0"
6068 [(set (subreg:SI (match_dup 0) 4) (ashiftrt:SI (subreg:SI (match_dup 1) 0) (match_dup 2)))
6069 (set (subreg:SI (match_dup 0) 0) (ashiftrt:SI (subreg:SI (match_dup 1) 0) (const_int 31)))]
6071 "operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);")
6074 (define_insn "ashrdi3_internal3"
6075 [(set (match_operand:DI 0 "register_operand" "=d")
6076 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6077 (match_operand:SI 2 "small_int" "IJK")))
6078 (clobber (match_operand:SI 3 "register_operand" "=d"))]
6079 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
6080 && (INTVAL (operands[2]) & 63) < 32
6081 && (INTVAL (operands[2]) & 63) != 0"
6084 int amount = INTVAL (operands[2]);
6086 operands[2] = GEN_INT (amount & 31);
6087 operands[4] = GEN_INT ((-amount) & 31);
6089 return \"srl\\t%L0,%L1,%2\;sll\\t%3,%M1,%4\;or\\t%L0,%L0,%3\;sra\\t%M0,%M1,%2\";
6091 [(set_attr "type" "darith")
6092 (set_attr "mode" "DI")
6093 (set_attr "length" "16")])
6097 [(set (match_operand:DI 0 "register_operand" "")
6098 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
6099 (match_operand:SI 2 "small_int" "")))
6100 (clobber (match_operand:SI 3 "register_operand" ""))]
6101 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT
6102 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
6103 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
6104 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
6105 && (INTVAL (operands[2]) & 63) < 32
6106 && (INTVAL (operands[2]) & 63) != 0"
6108 [(set (subreg:SI (match_dup 0) 0)
6109 (lshiftrt:SI (subreg:SI (match_dup 1) 0)
6113 (ashift:SI (subreg:SI (match_dup 1) 4)
6116 (set (subreg:SI (match_dup 0) 0)
6117 (ior:SI (subreg:SI (match_dup 0) 0)
6120 (set (subreg:SI (match_dup 0) 4)
6121 (ashiftrt:SI (subreg:SI (match_dup 1) 4)
6125 int amount = INTVAL (operands[2]);
6126 operands[2] = GEN_INT (amount & 31);
6127 operands[4] = GEN_INT ((-amount) & 31);
6132 [(set (match_operand:DI 0 "register_operand" "")
6133 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
6134 (match_operand:SI 2 "small_int" "")))
6135 (clobber (match_operand:SI 3 "register_operand" ""))]
6136 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT
6137 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
6138 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
6139 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
6140 && (INTVAL (operands[2]) & 63) < 32
6141 && (INTVAL (operands[2]) & 63) != 0"
6143 [(set (subreg:SI (match_dup 0) 4)
6144 (lshiftrt:SI (subreg:SI (match_dup 1) 4)
6148 (ashift:SI (subreg:SI (match_dup 1) 0)
6151 (set (subreg:SI (match_dup 0) 4)
6152 (ior:SI (subreg:SI (match_dup 0) 4)
6155 (set (subreg:SI (match_dup 0) 0)
6156 (ashiftrt:SI (subreg:SI (match_dup 1) 0)
6160 int amount = INTVAL (operands[2]);
6161 operands[2] = GEN_INT (amount & 31);
6162 operands[4] = GEN_INT ((-amount) & 31);
6166 (define_insn "ashrdi3_internal4"
6167 [(set (match_operand:DI 0 "register_operand" "=d")
6168 (ashiftrt:DI (match_operand:DI 1 "register_operand" "d")
6169 (match_operand:SI 2 "arith_operand" "dI")))]
6170 "TARGET_64BIT && !TARGET_MIPS16"
6173 if (GET_CODE (operands[2]) == CONST_INT)
6174 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f);
6176 return \"dsra\\t%0,%1,%2\";
6178 [(set_attr "type" "arith")
6179 (set_attr "mode" "DI")])
6182 [(set (match_operand:DI 0 "register_operand" "=d,d")
6183 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0,0")
6184 (match_operand:SI 2 "arith_operand" "d,I")))]
6185 "TARGET_64BIT && TARGET_MIPS16"
6188 if (GET_CODE (operands[2]) == CONST_INT)
6189 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f);
6191 return \"dsra\\t%0,%2\";
6193 [(set_attr "type" "arith")
6194 (set_attr "mode" "DI")
6195 (set_attr_alternative "length"
6197 (if_then_else (match_operand:VOID 2 "m16_uimm3_b" "")
6201 ;; On the mips16, we can split a 4 byte shift into 2 2 byte shifts.
6204 [(set (match_operand:DI 0 "register_operand" "")
6205 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
6206 (match_operand:SI 2 "const_int_operand" "")))]
6207 "TARGET_MIPS16 && TARGET_64BIT && !TARGET_DEBUG_D_MODE
6209 && GET_CODE (operands[2]) == CONST_INT
6210 && INTVAL (operands[2]) > 8
6211 && INTVAL (operands[2]) <= 16"
6212 [(set (match_dup 0) (ashiftrt:DI (match_dup 1) (const_int 8)))
6213 (set (match_dup 0) (ashiftrt:DI (match_dup 0) (match_dup 2)))]
6216 operands[2] = GEN_INT (INTVAL (operands[2]) - 8);
6219 (define_expand "lshrsi3"
6220 [(set (match_operand:SI 0 "register_operand" "=d")
6221 (lshiftrt:SI (match_operand:SI 1 "register_operand" "d")
6222 (match_operand:SI 2 "arith_operand" "dI")))]
6226 /* On the mips16, a shift of more than 8 is a four byte instruction,
6227 so, for a shift between 8 and 16, it is just as fast to do two
6228 shifts of 8 or less. If there is a lot of shifting going on, we
6229 may win in CSE. Otherwise combine will put the shifts back
6233 && GET_CODE (operands[2]) == CONST_INT
6234 && INTVAL (operands[2]) > 8
6235 && INTVAL (operands[2]) <= 16)
6237 rtx temp = gen_reg_rtx (SImode);
6239 emit_insn (gen_lshrsi3_internal2 (temp, operands[1], GEN_INT (8)));
6240 emit_insn (gen_lshrsi3_internal2 (operands[0], temp,
6241 GEN_INT (INTVAL (operands[2]) - 8)));
6246 (define_insn "lshrsi3_internal1"
6247 [(set (match_operand:SI 0 "register_operand" "=d")
6248 (lshiftrt:SI (match_operand:SI 1 "register_operand" "d")
6249 (match_operand:SI 2 "arith_operand" "dI")))]
6253 if (GET_CODE (operands[2]) == CONST_INT)
6254 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
6256 return \"srl\\t%0,%1,%2\";
6258 [(set_attr "type" "arith")
6259 (set_attr "mode" "SI")])
6261 (define_insn "lshrsi3_internal2"
6262 [(set (match_operand:SI 0 "register_operand" "=d,d")
6263 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0,d")
6264 (match_operand:SI 2 "arith_operand" "d,I")))]
6268 if (which_alternative == 0)
6269 return \"srl\\t%0,%2\";
6271 if (GET_CODE (operands[2]) == CONST_INT)
6272 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
6274 return \"srl\\t%0,%1,%2\";
6276 [(set_attr "type" "arith")
6277 (set_attr "mode" "SI")
6278 (set_attr_alternative "length"
6280 (if_then_else (match_operand:VOID 2 "m16_uimm3_b" "")
6285 ;; On the mips16, we can split a 4 byte shift into 2 2 byte shifts.
6288 [(set (match_operand:SI 0 "register_operand" "")
6289 (lshiftrt:SI (match_operand:SI 1 "register_operand" "")
6290 (match_operand:SI 2 "const_int_operand" "")))]
6291 "TARGET_MIPS16 && reload_completed && !TARGET_DEBUG_D_MODE
6292 && GET_CODE (operands[2]) == CONST_INT
6293 && INTVAL (operands[2]) > 8
6294 && INTVAL (operands[2]) <= 16"
6295 [(set (match_dup 0) (lshiftrt:SI (match_dup 1) (const_int 8)))
6296 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
6299 operands[2] = GEN_INT (INTVAL (operands[2]) - 8);
6302 ;; If we load a byte on the mips16 as a bitfield, the resulting
6303 ;; sequence of instructions is too complicated for combine, because it
6304 ;; involves four instructions: a load, a shift, a constant load into a
6305 ;; register, and an and (the key problem here is that the mips16 does
6306 ;; not have and immediate). We recognize a shift of a load in order
6307 ;; to make it simple enough for combine to understand.
6309 ;; ??? FIXME: turn into a define_insn_and_split
6311 [(set (match_operand:SI 0 "register_operand" "=d")
6312 (lshiftrt:SI (match_operand:SI 1 "memory_operand" "m")
6313 (match_operand:SI 2 "immediate_operand" "I")))]
6314 "0 && TARGET_MIPS16"
6315 "lw\\t%0,%1\;srl\\t%0,%2"
6316 [(set_attr "type" "load")
6317 (set_attr "mode" "SI")
6318 (set_attr_alternative "length"
6319 [(if_then_else (match_operand:VOID 2 "m16_uimm3_b" "")
6324 [(set (match_operand:SI 0 "register_operand" "")
6325 (lshiftrt:SI (match_operand:SI 1 "memory_operand" "")
6326 (match_operand:SI 2 "immediate_operand" "")))]
6327 "TARGET_MIPS16 && !TARGET_DEBUG_D_MODE"
6328 [(set (match_dup 0) (match_dup 1))
6329 (set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 2)))]
6332 (define_expand "lshrdi3"
6333 [(parallel [(set (match_operand:DI 0 "register_operand" "")
6334 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
6335 (match_operand:SI 2 "arith_operand" "")))
6336 (clobber (match_dup 3))])]
6337 "TARGET_64BIT || (!TARGET_DEBUG_G_MODE && !TARGET_MIPS16)"
6342 /* On the mips16, a shift of more than 8 is a four byte
6343 instruction, so, for a shift between 8 and 16, it is just as
6344 fast to do two shifts of 8 or less. If there is a lot of
6345 shifting going on, we may win in CSE. Otherwise combine will
6346 put the shifts back together again. */
6349 && GET_CODE (operands[2]) == CONST_INT
6350 && INTVAL (operands[2]) > 8
6351 && INTVAL (operands[2]) <= 16)
6353 rtx temp = gen_reg_rtx (DImode);
6355 emit_insn (gen_lshrdi3_internal4 (temp, operands[1], GEN_INT (8)));
6356 emit_insn (gen_lshrdi3_internal4 (operands[0], temp,
6357 GEN_INT (INTVAL (operands[2]) - 8)));
6361 emit_insn (gen_lshrdi3_internal4 (operands[0], operands[1],
6366 operands[3] = gen_reg_rtx (SImode);
6370 (define_insn "lshrdi3_internal"
6371 [(set (match_operand:DI 0 "register_operand" "=&d")
6372 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
6373 (match_operand:SI 2 "register_operand" "d")))
6374 (clobber (match_operand:SI 3 "register_operand" "=d"))]
6375 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16"
6378 operands[4] = const0_rtx;
6380 return \"sll\\t%3,%2,26\\n\\
6381 \\tbgez\\t%3,1f%#\\n\\
6382 \\tsrl\\t%L0,%M1,%2\\n\\
6384 \\tmove\\t%M0,%z4%)\\n\\
6387 \\t%(beq\\t%3,%z4,2f\\n\\
6388 \\tsrl\\t%L0,%L1,%2%)\\n\\
6390 \\tsubu\\t%3,%z4,%2\\n\\
6391 \\tsll\\t%3,%M1,%3\\n\\
6392 \\tor\\t%L0,%L0,%3\\n\\
6394 \\tsrl\\t%M0,%M1,%2\\n\\
6397 [(set_attr "type" "darith")
6398 (set_attr "mode" "DI")
6399 (set_attr "length" "48")])
6402 (define_insn "lshrdi3_internal2"
6403 [(set (match_operand:DI 0 "register_operand" "=d")
6404 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
6405 (match_operand:SI 2 "small_int" "IJK")))
6406 (clobber (match_operand:SI 3 "register_operand" "=d"))]
6407 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
6408 && (INTVAL (operands[2]) & 32) != 0"
6411 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
6412 operands[4] = const0_rtx;
6413 return \"srl\\t%L0,%M1,%2\;move\\t%M0,%z4\";
6415 [(set_attr "type" "darith")
6416 (set_attr "mode" "DI")
6417 (set_attr "length" "8")])
6421 [(set (match_operand:DI 0 "register_operand" "")
6422 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
6423 (match_operand:SI 2 "small_int" "")))
6424 (clobber (match_operand:SI 3 "register_operand" ""))]
6425 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT
6426 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
6427 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
6428 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
6429 && (INTVAL (operands[2]) & 32) != 0"
6431 [(set (subreg:SI (match_dup 0) 0) (lshiftrt:SI (subreg:SI (match_dup 1) 4) (match_dup 2)))
6432 (set (subreg:SI (match_dup 0) 4) (const_int 0))]
6434 "operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);")
6438 [(set (match_operand:DI 0 "register_operand" "")
6439 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
6440 (match_operand:SI 2 "small_int" "")))
6441 (clobber (match_operand:SI 3 "register_operand" ""))]
6442 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT
6443 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
6444 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
6445 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
6446 && (INTVAL (operands[2]) & 32) != 0"
6448 [(set (subreg:SI (match_dup 0) 4) (lshiftrt:SI (subreg:SI (match_dup 1) 0) (match_dup 2)))
6449 (set (subreg:SI (match_dup 0) 0) (const_int 0))]
6451 "operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);")
6454 (define_insn "lshrdi3_internal3"
6455 [(set (match_operand:DI 0 "register_operand" "=d")
6456 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
6457 (match_operand:SI 2 "small_int" "IJK")))
6458 (clobber (match_operand:SI 3 "register_operand" "=d"))]
6459 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
6460 && (INTVAL (operands[2]) & 63) < 32
6461 && (INTVAL (operands[2]) & 63) != 0"
6464 int amount = INTVAL (operands[2]);
6466 operands[2] = GEN_INT (amount & 31);
6467 operands[4] = GEN_INT ((-amount) & 31);
6469 return \"srl\\t%L0,%L1,%2\;sll\\t%3,%M1,%4\;or\\t%L0,%L0,%3\;srl\\t%M0,%M1,%2\";
6471 [(set_attr "type" "darith")
6472 (set_attr "mode" "DI")
6473 (set_attr "length" "16")])
6477 [(set (match_operand:DI 0 "register_operand" "")
6478 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
6479 (match_operand:SI 2 "small_int" "")))
6480 (clobber (match_operand:SI 3 "register_operand" ""))]
6481 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT
6482 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
6483 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
6484 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
6485 && (INTVAL (operands[2]) & 63) < 32
6486 && (INTVAL (operands[2]) & 63) != 0"
6488 [(set (subreg:SI (match_dup 0) 0)
6489 (lshiftrt:SI (subreg:SI (match_dup 1) 0)
6493 (ashift:SI (subreg:SI (match_dup 1) 4)
6496 (set (subreg:SI (match_dup 0) 0)
6497 (ior:SI (subreg:SI (match_dup 0) 0)
6500 (set (subreg:SI (match_dup 0) 4)
6501 (lshiftrt:SI (subreg:SI (match_dup 1) 4)
6505 int amount = INTVAL (operands[2]);
6506 operands[2] = GEN_INT (amount & 31);
6507 operands[4] = GEN_INT ((-amount) & 31);
6512 [(set (match_operand:DI 0 "register_operand" "")
6513 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
6514 (match_operand:SI 2 "small_int" "")))
6515 (clobber (match_operand:SI 3 "register_operand" ""))]
6516 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT
6517 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
6518 && GET_CODE (operands[0]) == REG && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
6519 && GET_CODE (operands[1]) == REG && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
6520 && (INTVAL (operands[2]) & 63) < 32
6521 && (INTVAL (operands[2]) & 63) != 0"
6523 [(set (subreg:SI (match_dup 0) 4)
6524 (lshiftrt:SI (subreg:SI (match_dup 1) 4)
6528 (ashift:SI (subreg:SI (match_dup 1) 0)
6531 (set (subreg:SI (match_dup 0) 4)
6532 (ior:SI (subreg:SI (match_dup 0) 4)
6535 (set (subreg:SI (match_dup 0) 0)
6536 (lshiftrt:SI (subreg:SI (match_dup 1) 0)
6540 int amount = INTVAL (operands[2]);
6541 operands[2] = GEN_INT (amount & 31);
6542 operands[4] = GEN_INT ((-amount) & 31);
6546 (define_insn "lshrdi3_internal4"
6547 [(set (match_operand:DI 0 "register_operand" "=d")
6548 (lshiftrt:DI (match_operand:DI 1 "register_operand" "d")
6549 (match_operand:SI 2 "arith_operand" "dI")))]
6550 "TARGET_64BIT && !TARGET_MIPS16"
6553 if (GET_CODE (operands[2]) == CONST_INT)
6554 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f);
6556 return \"dsrl\\t%0,%1,%2\";
6558 [(set_attr "type" "arith")
6559 (set_attr "mode" "DI")])
6562 [(set (match_operand:DI 0 "register_operand" "=d,d")
6563 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0,0")
6564 (match_operand:SI 2 "arith_operand" "d,I")))]
6565 "TARGET_64BIT && TARGET_MIPS16"
6568 if (GET_CODE (operands[2]) == CONST_INT)
6569 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f);
6571 return \"dsrl\\t%0,%2\";
6573 [(set_attr "type" "arith")
6574 (set_attr "mode" "DI")
6575 (set_attr_alternative "length"
6577 (if_then_else (match_operand:VOID 2 "m16_uimm3_b" "")
6581 (define_insn "rotrsi3"
6582 [(set (match_operand:SI 0 "register_operand" "=d")
6583 (rotatert:SI (match_operand:SI 1 "register_operand" "d")
6584 (match_operand:SI 2 "arith_operand" "dn")))]
6588 if (TARGET_SR71K && GET_CODE (operands[2]) != CONST_INT)
6589 return \"rorv\\t%0,%1,%2\";
6591 if ((GET_CODE (operands[2]) == CONST_INT)
6592 && (INTVAL (operands[2]) < 0 || INTVAL (operands[2]) >= 32))
6595 return \"ror\\t%0,%1,%2\";
6597 [(set_attr "type" "arith")
6598 (set_attr "mode" "SI")])
6600 (define_insn "rotrdi3"
6601 [(set (match_operand:DI 0 "register_operand" "=d")
6602 (rotatert:DI (match_operand:DI 1 "register_operand" "d")
6603 (match_operand:DI 2 "arith_operand" "dn")))]
6609 if (GET_CODE (operands[2]) != CONST_INT)
6610 return \"drorv\\t%0,%1,%2\";
6612 if (INTVAL (operands[2]) >= 32 && INTVAL (operands[2]) <= 63)
6613 return \"dror32\\t%0,%1,%2\";
6616 if ((GET_CODE (operands[2]) == CONST_INT)
6617 && (INTVAL (operands[2]) < 0 || INTVAL (operands[2]) >= 64))
6620 return \"dror\\t%0,%1,%2\";
6622 [(set_attr "type" "arith")
6623 (set_attr "mode" "DI")])
6626 ;; On the mips16, we can split a 4 byte shift into 2 2 byte shifts.
6629 [(set (match_operand:DI 0 "register_operand" "")
6630 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
6631 (match_operand:SI 2 "const_int_operand" "")))]
6632 "TARGET_MIPS16 && reload_completed && !TARGET_DEBUG_D_MODE
6633 && GET_CODE (operands[2]) == CONST_INT
6634 && INTVAL (operands[2]) > 8
6635 && INTVAL (operands[2]) <= 16"
6636 [(set (match_dup 0) (lshiftrt:DI (match_dup 1) (const_int 8)))
6637 (set (match_dup 0) (lshiftrt:DI (match_dup 0) (match_dup 2)))]
6640 operands[2] = GEN_INT (INTVAL (operands[2]) - 8);
6645 ;; ....................
6649 ;; ....................
6651 ;; Flow here is rather complex:
6653 ;; 1) The cmp{si,di,sf,df} routine is called. It deposits the
6654 ;; arguments into the branch_cmp array, and the type into
6655 ;; branch_type. No RTL is generated.
6657 ;; 2) The appropriate branch define_expand is called, which then
6658 ;; creates the appropriate RTL for the comparison and branch.
6659 ;; Different CC modes are used, based on what type of branch is
6660 ;; done, so that we can constrain things appropriately. There
6661 ;; are assumptions in the rest of GCC that break if we fold the
6662 ;; operands into the branchs for integer operations, and use cc0
6663 ;; for floating point, so we use the fp status register instead.
6664 ;; If needed, an appropriate temporary is created to hold the
6665 ;; of the integer compare.
6667 (define_expand "cmpsi"
6669 (compare:CC (match_operand:SI 0 "register_operand" "")
6670 (match_operand:SI 1 "arith_operand" "")))]
6674 if (operands[0]) /* avoid unused code message */
6676 branch_cmp[0] = operands[0];
6677 branch_cmp[1] = operands[1];
6678 branch_type = CMP_SI;
6683 (define_expand "tstsi"
6685 (match_operand:SI 0 "register_operand" ""))]
6689 if (operands[0]) /* avoid unused code message */
6691 branch_cmp[0] = operands[0];
6692 branch_cmp[1] = const0_rtx;
6693 branch_type = CMP_SI;
6698 (define_expand "cmpdi"
6700 (compare:CC (match_operand:DI 0 "register_operand" "")
6701 (match_operand:DI 1 "arith_operand" "")))]
6705 if (operands[0]) /* avoid unused code message */
6707 branch_cmp[0] = operands[0];
6708 branch_cmp[1] = operands[1];
6709 branch_type = CMP_DI;
6714 (define_expand "tstdi"
6716 (match_operand:DI 0 "register_operand" ""))]
6720 if (operands[0]) /* avoid unused code message */
6722 branch_cmp[0] = operands[0];
6723 branch_cmp[1] = const0_rtx;
6724 branch_type = CMP_DI;
6729 (define_expand "cmpdf"
6731 (compare:CC (match_operand:DF 0 "register_operand" "")
6732 (match_operand:DF 1 "register_operand" "")))]
6733 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
6736 if (operands[0]) /* avoid unused code message */
6738 branch_cmp[0] = operands[0];
6739 branch_cmp[1] = operands[1];
6740 branch_type = CMP_DF;
6745 (define_expand "cmpsf"
6747 (compare:CC (match_operand:SF 0 "register_operand" "")
6748 (match_operand:SF 1 "register_operand" "")))]
6752 if (operands[0]) /* avoid unused code message */
6754 branch_cmp[0] = operands[0];
6755 branch_cmp[1] = operands[1];
6756 branch_type = CMP_SF;
6763 ;; ....................
6765 ;; CONDITIONAL BRANCHES
6767 ;; ....................
6769 ;; Conditional branches on floating-point equality tests.
6771 (define_insn "branch_fp"
6774 (match_operator:CC 0 "cmp_op"
6775 [(match_operand:CC 2 "register_operand" "z")
6777 (label_ref (match_operand 1 "" ""))
6782 return mips_output_conditional_branch (insn,
6784 /*two_operands_p=*/0,
6787 get_attr_length (insn));
6789 [(set_attr "type" "branch")
6790 (set_attr "mode" "none")])
6792 (define_insn "branch_fp_inverted"
6795 (match_operator:CC 0 "cmp_op"
6796 [(match_operand:CC 2 "register_operand" "z")
6799 (label_ref (match_operand 1 "" ""))))]
6803 return mips_output_conditional_branch (insn,
6805 /*two_operands_p=*/0,
6808 get_attr_length (insn));
6810 [(set_attr "type" "branch")
6811 (set_attr "mode" "none")])
6813 ;; Conditional branches on comparisons with zero.
6815 (define_insn "branch_zero"
6818 (match_operator:SI 0 "cmp_op"
6819 [(match_operand:SI 2 "register_operand" "d")
6821 (label_ref (match_operand 1 "" ""))
6826 return mips_output_conditional_branch (insn,
6828 /*two_operands_p=*/0,
6831 get_attr_length (insn));
6833 [(set_attr "type" "branch")
6834 (set_attr "mode" "none")])
6836 (define_insn "branch_zero_inverted"
6839 (match_operator:SI 0 "cmp_op"
6840 [(match_operand:SI 2 "register_operand" "d")
6843 (label_ref (match_operand 1 "" ""))))]
6847 return mips_output_conditional_branch (insn,
6849 /*two_operands_p=*/0,
6852 get_attr_length (insn));
6854 [(set_attr "type" "branch")
6855 (set_attr "mode" "none")])
6857 (define_insn "branch_zero_di"
6860 (match_operator:DI 0 "cmp_op"
6861 [(match_operand:DI 2 "register_operand" "d")
6863 (label_ref (match_operand 1 "" ""))
6868 return mips_output_conditional_branch (insn,
6870 /*two_operands_p=*/0,
6873 get_attr_length (insn));
6875 [(set_attr "type" "branch")
6876 (set_attr "mode" "none")])
6878 (define_insn "branch_zero_di_inverted"
6881 (match_operator:DI 0 "cmp_op"
6882 [(match_operand:DI 2 "register_operand" "d")
6885 (label_ref (match_operand 1 "" ""))))]
6889 return mips_output_conditional_branch (insn,
6891 /*two_operands_p=*/0,
6894 get_attr_length (insn));
6896 [(set_attr "type" "branch")
6897 (set_attr "mode" "none")])
6899 ;; Conditional branch on equality comparison.
6901 (define_insn "branch_equality"
6904 (match_operator:SI 0 "equality_op"
6905 [(match_operand:SI 2 "register_operand" "d")
6906 (match_operand:SI 3 "register_operand" "d")])
6907 (label_ref (match_operand 1 "" ""))
6912 return mips_output_conditional_branch (insn,
6914 /*two_operands_p=*/1,
6917 get_attr_length (insn));
6919 [(set_attr "type" "branch")
6920 (set_attr "mode" "none")])
6922 (define_insn "branch_equality_di"
6925 (match_operator:DI 0 "equality_op"
6926 [(match_operand:DI 2 "register_operand" "d")
6927 (match_operand:DI 3 "register_operand" "d")])
6928 (label_ref (match_operand 1 "" ""))
6933 return mips_output_conditional_branch (insn,
6935 /*two_operands_p=*/1,
6938 get_attr_length (insn));
6940 [(set_attr "type" "branch")
6941 (set_attr "mode" "none")])
6943 (define_insn "branch_equality_inverted"
6946 (match_operator:SI 0 "equality_op"
6947 [(match_operand:SI 2 "register_operand" "d")
6948 (match_operand:SI 3 "register_operand" "d")])
6950 (label_ref (match_operand 1 "" ""))))]
6954 return mips_output_conditional_branch (insn,
6956 /*two_operands_p=*/1,
6959 get_attr_length (insn));
6961 [(set_attr "type" "branch")
6962 (set_attr "mode" "none")])
6964 (define_insn "branch_equality_di_inverted"
6967 (match_operator:DI 0 "equality_op"
6968 [(match_operand:DI 2 "register_operand" "d")
6969 (match_operand:DI 3 "register_operand" "d")])
6971 (label_ref (match_operand 1 "" ""))))]
6975 return mips_output_conditional_branch (insn,
6977 /*two_operands_p=*/1,
6980 get_attr_length (insn));
6982 [(set_attr "type" "branch")
6983 (set_attr "mode" "none")])
6989 (if_then_else (match_operator:SI 0 "equality_op"
6990 [(match_operand:SI 1 "register_operand" "d,t")
6992 (match_operand 2 "pc_or_label_operand" "")
6993 (match_operand 3 "pc_or_label_operand" "")))]
6997 if (operands[2] != pc_rtx)
6999 if (which_alternative == 0)
7000 return \"b%C0z\\t%1,%2\";
7002 return \"bt%C0z\\t%2\";
7006 if (which_alternative == 0)
7007 return \"b%N0z\\t%1,%3\";
7009 return \"bt%N0z\\t%3\";
7012 [(set_attr "type" "branch")
7013 (set_attr "mode" "none")
7014 (set_attr "length" "8")])
7018 (if_then_else (match_operator:DI 0 "equality_op"
7019 [(match_operand:DI 1 "register_operand" "d,t")
7021 (match_operand 2 "pc_or_label_operand" "")
7022 (match_operand 3 "pc_or_label_operand" "")))]
7026 if (operands[2] != pc_rtx)
7028 if (which_alternative == 0)
7029 return \"b%C0z\\t%1,%2\";
7031 return \"bt%C0z\\t%2\";
7035 if (which_alternative == 0)
7036 return \"b%N0z\\t%1,%3\";
7038 return \"bt%N0z\\t%3\";
7041 [(set_attr "type" "branch")
7042 (set_attr "mode" "none")
7043 (set_attr "length" "8")])
7045 (define_expand "bunordered"
7047 (if_then_else (unordered:CC (cc0)
7049 (label_ref (match_operand 0 "" ""))
7054 if (operands[0]) /* avoid unused code warning */
7056 gen_conditional_branch (operands, UNORDERED);
7061 (define_expand "bordered"
7063 (if_then_else (ordered:CC (cc0)
7065 (label_ref (match_operand 0 "" ""))
7070 if (operands[0]) /* avoid unused code warning */
7072 gen_conditional_branch (operands, ORDERED);
7077 (define_expand "bunlt"
7079 (if_then_else (unlt:CC (cc0)
7081 (label_ref (match_operand 0 "" ""))
7086 if (operands[0]) /* avoid unused code warning */
7088 gen_conditional_branch (operands, UNLT);
7093 (define_expand "bunge"
7095 (if_then_else (unge:CC (cc0)
7097 (label_ref (match_operand 0 "" ""))
7102 gen_conditional_branch (operands, UNGE);
7106 (define_expand "buneq"
7108 (if_then_else (uneq:CC (cc0)
7110 (label_ref (match_operand 0 "" ""))
7115 if (operands[0]) /* avoid unused code warning */
7117 gen_conditional_branch (operands, UNEQ);
7122 (define_expand "bltgt"
7124 (if_then_else (ltgt:CC (cc0)
7126 (label_ref (match_operand 0 "" ""))
7131 gen_conditional_branch (operands, LTGT);
7135 (define_expand "bunle"
7137 (if_then_else (unle:CC (cc0)
7139 (label_ref (match_operand 0 "" ""))
7144 if (operands[0]) /* avoid unused code warning */
7146 gen_conditional_branch (operands, UNLE);
7151 (define_expand "bungt"
7153 (if_then_else (ungt:CC (cc0)
7155 (label_ref (match_operand 0 "" ""))
7160 gen_conditional_branch (operands, UNGT);
7164 (define_expand "beq"
7166 (if_then_else (eq:CC (cc0)
7168 (label_ref (match_operand 0 "" ""))
7173 if (operands[0]) /* avoid unused code warning */
7175 gen_conditional_branch (operands, EQ);
7180 (define_expand "bne"
7182 (if_then_else (ne:CC (cc0)
7184 (label_ref (match_operand 0 "" ""))
7189 if (operands[0]) /* avoid unused code warning */
7191 gen_conditional_branch (operands, NE);
7196 (define_expand "bgt"
7198 (if_then_else (gt:CC (cc0)
7200 (label_ref (match_operand 0 "" ""))
7205 if (operands[0]) /* avoid unused code warning */
7207 gen_conditional_branch (operands, GT);
7212 (define_expand "bge"
7214 (if_then_else (ge:CC (cc0)
7216 (label_ref (match_operand 0 "" ""))
7221 if (operands[0]) /* avoid unused code warning */
7223 gen_conditional_branch (operands, GE);
7228 (define_expand "blt"
7230 (if_then_else (lt:CC (cc0)
7232 (label_ref (match_operand 0 "" ""))
7237 if (operands[0]) /* avoid unused code warning */
7239 gen_conditional_branch (operands, LT);
7244 (define_expand "ble"
7246 (if_then_else (le:CC (cc0)
7248 (label_ref (match_operand 0 "" ""))
7253 if (operands[0]) /* avoid unused code warning */
7255 gen_conditional_branch (operands, LE);
7260 (define_expand "bgtu"
7262 (if_then_else (gtu:CC (cc0)
7264 (label_ref (match_operand 0 "" ""))
7269 if (operands[0]) /* avoid unused code warning */
7271 gen_conditional_branch (operands, GTU);
7276 (define_expand "bgeu"
7278 (if_then_else (geu:CC (cc0)
7280 (label_ref (match_operand 0 "" ""))
7285 if (operands[0]) /* avoid unused code warning */
7287 gen_conditional_branch (operands, GEU);
7293 (define_expand "bltu"
7295 (if_then_else (ltu:CC (cc0)
7297 (label_ref (match_operand 0 "" ""))
7302 if (operands[0]) /* avoid unused code warning */
7304 gen_conditional_branch (operands, LTU);
7309 (define_expand "bleu"
7311 (if_then_else (leu:CC (cc0)
7313 (label_ref (match_operand 0 "" ""))
7318 if (operands[0]) /* avoid unused code warning */
7320 gen_conditional_branch (operands, LEU);
7327 ;; ....................
7329 ;; SETTING A REGISTER FROM A COMPARISON
7331 ;; ....................
7333 (define_expand "seq"
7334 [(set (match_operand:SI 0 "register_operand" "=d")
7335 (eq:SI (match_dup 1)
7340 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
7343 /* set up operands from compare. */
7344 operands[1] = branch_cmp[0];
7345 operands[2] = branch_cmp[1];
7347 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE || TARGET_MIPS16)
7349 gen_int_relational (EQ, operands[0], operands[1], operands[2], (int *)0);
7353 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
7354 operands[2] = force_reg (SImode, operands[2]);
7356 /* fall through and generate default code */
7360 (define_insn "seq_si_zero"
7361 [(set (match_operand:SI 0 "register_operand" "=d")
7362 (eq:SI (match_operand:SI 1 "register_operand" "d")
7366 [(set_attr "type" "arith")
7367 (set_attr "mode" "SI")])
7370 [(set (match_operand:SI 0 "register_operand" "=t")
7371 (eq:SI (match_operand:SI 1 "register_operand" "d")
7375 [(set_attr "type" "arith")
7376 (set_attr "mode" "SI")])
7378 (define_insn "seq_di_zero"
7379 [(set (match_operand:DI 0 "register_operand" "=d")
7380 (eq:DI (match_operand:DI 1 "register_operand" "d")
7382 "TARGET_64BIT && !TARGET_MIPS16"
7384 [(set_attr "type" "arith")
7385 (set_attr "mode" "DI")])
7388 [(set (match_operand:DI 0 "register_operand" "=t")
7389 (eq:DI (match_operand:DI 1 "register_operand" "d")
7391 "TARGET_64BIT && TARGET_MIPS16"
7393 [(set_attr "type" "arith")
7394 (set_attr "mode" "DI")])
7396 (define_insn "seq_si"
7397 [(set (match_operand:SI 0 "register_operand" "=d,d")
7398 (eq:SI (match_operand:SI 1 "register_operand" "%d,d")
7399 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
7400 "TARGET_DEBUG_C_MODE && !TARGET_MIPS16"
7402 xor\\t%0,%1,%2\;sltu\\t%0,%0,1
7403 xori\\t%0,%1,%2\;sltu\\t%0,%0,1"
7404 [(set_attr "type" "arith")
7405 (set_attr "mode" "SI")
7406 (set_attr "length" "8")])
7409 [(set (match_operand:SI 0 "register_operand" "")
7410 (eq:SI (match_operand:SI 1 "register_operand" "")
7411 (match_operand:SI 2 "uns_arith_operand" "")))]
7412 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE && !TARGET_MIPS16
7413 && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)"
7415 (xor:SI (match_dup 1)
7418 (ltu:SI (match_dup 0)
7422 (define_insn "seq_di"
7423 [(set (match_operand:DI 0 "register_operand" "=d,d")
7424 (eq:DI (match_operand:DI 1 "register_operand" "%d,d")
7425 (match_operand:DI 2 "uns_arith_operand" "d,K")))]
7426 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_MIPS16"
7428 xor\\t%0,%1,%2\;sltu\\t%0,%0,1
7429 xori\\t%0,%1,%2\;sltu\\t%0,%0,1"
7430 [(set_attr "type" "arith")
7431 (set_attr "mode" "DI")
7432 (set_attr "length" "8")])
7435 [(set (match_operand:DI 0 "register_operand" "")
7436 (eq:DI (match_operand:DI 1 "register_operand" "")
7437 (match_operand:DI 2 "uns_arith_operand" "")))]
7438 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE
7440 && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)"
7442 (xor:DI (match_dup 1)
7445 (ltu:DI (match_dup 0)
7449 ;; On the mips16 the default code is better than using sltu.
7451 (define_expand "sne"
7452 [(set (match_operand:SI 0 "register_operand" "=d")
7453 (ne:SI (match_dup 1)
7458 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
7461 /* set up operands from compare. */
7462 operands[1] = branch_cmp[0];
7463 operands[2] = branch_cmp[1];
7465 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
7467 gen_int_relational (NE, operands[0], operands[1], operands[2], (int *)0);
7471 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 0)
7472 operands[2] = force_reg (SImode, operands[2]);
7474 /* fall through and generate default code */
7477 (define_insn "sne_si_zero"
7478 [(set (match_operand:SI 0 "register_operand" "=d")
7479 (ne:SI (match_operand:SI 1 "register_operand" "d")
7483 [(set_attr "type" "arith")
7484 (set_attr "mode" "SI")])
7486 (define_insn "sne_di_zero"
7487 [(set (match_operand:DI 0 "register_operand" "=d")
7488 (ne:DI (match_operand:DI 1 "register_operand" "d")
7490 "TARGET_64BIT && !TARGET_MIPS16"
7492 [(set_attr "type" "arith")
7493 (set_attr "mode" "DI")])
7495 (define_insn "sne_si"
7496 [(set (match_operand:SI 0 "register_operand" "=d,d")
7497 (ne:SI (match_operand:SI 1 "register_operand" "%d,d")
7498 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
7499 "TARGET_DEBUG_C_MODE && !TARGET_MIPS16"
7501 xor\\t%0,%1,%2\;sltu\\t%0,%.,%0
7502 xori\\t%0,%1,%x2\;sltu\\t%0,%.,%0"
7503 [(set_attr "type" "arith")
7504 (set_attr "mode" "SI")
7505 (set_attr "length" "8")])
7508 [(set (match_operand:SI 0 "register_operand" "")
7509 (ne:SI (match_operand:SI 1 "register_operand" "")
7510 (match_operand:SI 2 "uns_arith_operand" "")))]
7511 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE && !TARGET_MIPS16
7512 && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)"
7514 (xor:SI (match_dup 1)
7517 (gtu:SI (match_dup 0)
7521 (define_insn "sne_di"
7522 [(set (match_operand:DI 0 "register_operand" "=d,d")
7523 (ne:DI (match_operand:DI 1 "register_operand" "%d,d")
7524 (match_operand:DI 2 "uns_arith_operand" "d,K")))]
7525 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_MIPS16"
7527 xor\\t%0,%1,%2\;sltu\\t%0,%.,%0
7528 xori\\t%0,%1,%x2\;sltu\\t%0,%.,%0"
7529 [(set_attr "type" "arith")
7530 (set_attr "mode" "DI")
7531 (set_attr "length" "8")])
7534 [(set (match_operand:DI 0 "register_operand" "")
7535 (ne:DI (match_operand:DI 1 "register_operand" "")
7536 (match_operand:DI 2 "uns_arith_operand" "")))]
7537 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE
7539 && (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 0)"
7541 (xor:DI (match_dup 1)
7544 (gtu:DI (match_dup 0)
7548 (define_expand "sgt"
7549 [(set (match_operand:SI 0 "register_operand" "=d")
7550 (gt:SI (match_dup 1)
7555 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
7558 /* set up operands from compare. */
7559 operands[1] = branch_cmp[0];
7560 operands[2] = branch_cmp[1];
7562 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE || TARGET_MIPS16)
7564 gen_int_relational (GT, operands[0], operands[1], operands[2], (int *)0);
7568 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) != 0)
7569 operands[2] = force_reg (SImode, operands[2]);
7571 /* fall through and generate default code */
7574 (define_insn "sgt_si"
7575 [(set (match_operand:SI 0 "register_operand" "=d")
7576 (gt:SI (match_operand:SI 1 "register_operand" "d")
7577 (match_operand:SI 2 "reg_or_0_operand" "dJ")))]
7580 [(set_attr "type" "arith")
7581 (set_attr "mode" "SI")])
7584 [(set (match_operand:SI 0 "register_operand" "=t")
7585 (gt:SI (match_operand:SI 1 "register_operand" "d")
7586 (match_operand:SI 2 "register_operand" "d")))]
7589 [(set_attr "type" "arith")
7590 (set_attr "mode" "SI")])
7592 (define_insn "sgt_di"
7593 [(set (match_operand:DI 0 "register_operand" "=d")
7594 (gt:DI (match_operand:DI 1 "register_operand" "d")
7595 (match_operand:DI 2 "reg_or_0_operand" "dJ")))]
7596 "TARGET_64BIT && !TARGET_MIPS16"
7598 [(set_attr "type" "arith")
7599 (set_attr "mode" "DI")])
7602 [(set (match_operand:DI 0 "register_operand" "=d")
7603 (gt:DI (match_operand:DI 1 "register_operand" "d")
7604 (match_operand:DI 2 "register_operand" "d")))]
7605 "TARGET_64BIT && TARGET_MIPS16"
7607 [(set_attr "type" "arith")
7608 (set_attr "mode" "DI")])
7610 (define_expand "sge"
7611 [(set (match_operand:SI 0 "register_operand" "=d")
7612 (ge:SI (match_dup 1)
7617 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
7620 /* set up operands from compare. */
7621 operands[1] = branch_cmp[0];
7622 operands[2] = branch_cmp[1];
7624 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE || TARGET_MIPS16)
7626 gen_int_relational (GE, operands[0], operands[1], operands[2], (int *)0);
7630 /* fall through and generate default code */
7633 (define_insn "sge_si"
7634 [(set (match_operand:SI 0 "register_operand" "=d")
7635 (ge:SI (match_operand:SI 1 "register_operand" "d")
7636 (match_operand:SI 2 "arith_operand" "dI")))]
7637 "TARGET_DEBUG_C_MODE && !TARGET_MIPS16"
7638 "slt\\t%0,%1,%2\;xori\\t%0,%0,0x0001"
7639 [(set_attr "type" "arith")
7640 (set_attr "mode" "SI")
7641 (set_attr "length" "8")])
7644 [(set (match_operand:SI 0 "register_operand" "")
7645 (ge:SI (match_operand:SI 1 "register_operand" "")
7646 (match_operand:SI 2 "arith_operand" "")))]
7647 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE && !TARGET_MIPS16"
7649 (lt:SI (match_dup 1)
7652 (xor:SI (match_dup 0)
7656 (define_insn "sge_di"
7657 [(set (match_operand:DI 0 "register_operand" "=d")
7658 (ge:DI (match_operand:DI 1 "register_operand" "d")
7659 (match_operand:DI 2 "arith_operand" "dI")))]
7660 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_MIPS16"
7661 "slt\\t%0,%1,%2\;xori\\t%0,%0,0x0001"
7662 [(set_attr "type" "arith")
7663 (set_attr "mode" "DI")
7664 (set_attr "length" "8")])
7667 [(set (match_operand:DI 0 "register_operand" "")
7668 (ge:DI (match_operand:DI 1 "register_operand" "")
7669 (match_operand:DI 2 "arith_operand" "")))]
7670 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE
7673 (lt:DI (match_dup 1)
7676 (xor:DI (match_dup 0)
7680 (define_expand "slt"
7681 [(set (match_operand:SI 0 "register_operand" "=d")
7682 (lt:SI (match_dup 1)
7687 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
7690 /* set up operands from compare. */
7691 operands[1] = branch_cmp[0];
7692 operands[2] = branch_cmp[1];
7694 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE || TARGET_MIPS16)
7696 gen_int_relational (LT, operands[0], operands[1], operands[2], (int *)0);
7700 /* fall through and generate default code */
7703 (define_insn "slt_si"
7704 [(set (match_operand:SI 0 "register_operand" "=d")
7705 (lt:SI (match_operand:SI 1 "register_operand" "d")
7706 (match_operand:SI 2 "arith_operand" "dI")))]
7709 [(set_attr "type" "arith")
7710 (set_attr "mode" "SI")])
7713 [(set (match_operand:SI 0 "register_operand" "=t,t")
7714 (lt:SI (match_operand:SI 1 "register_operand" "d,d")
7715 (match_operand:SI 2 "arith_operand" "d,I")))]
7718 [(set_attr "type" "arith")
7719 (set_attr "mode" "SI")
7720 (set_attr_alternative "length"
7722 (if_then_else (match_operand:VOID 2 "m16_uimm8_1" "")
7726 (define_insn "slt_di"
7727 [(set (match_operand:DI 0 "register_operand" "=d")
7728 (lt:DI (match_operand:DI 1 "register_operand" "d")
7729 (match_operand:DI 2 "arith_operand" "dI")))]
7730 "TARGET_64BIT && !TARGET_MIPS16"
7732 [(set_attr "type" "arith")
7733 (set_attr "mode" "DI")])
7736 [(set (match_operand:DI 0 "register_operand" "=t,t")
7737 (lt:DI (match_operand:DI 1 "register_operand" "d,d")
7738 (match_operand:DI 2 "arith_operand" "d,I")))]
7739 "TARGET_64BIT && TARGET_MIPS16"
7741 [(set_attr "type" "arith")
7742 (set_attr "mode" "DI")
7743 (set_attr_alternative "length"
7745 (if_then_else (match_operand:VOID 2 "m16_uimm8_1" "")
7749 (define_expand "sle"
7750 [(set (match_operand:SI 0 "register_operand" "=d")
7751 (le:SI (match_dup 1)
7756 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
7759 /* set up operands from compare. */
7760 operands[1] = branch_cmp[0];
7761 operands[2] = branch_cmp[1];
7763 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE || TARGET_MIPS16)
7765 gen_int_relational (LE, operands[0], operands[1], operands[2], (int *)0);
7769 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 32767)
7770 operands[2] = force_reg (SImode, operands[2]);
7772 /* fall through and generate default code */
7775 (define_insn "sle_si_const"
7776 [(set (match_operand:SI 0 "register_operand" "=d")
7777 (le:SI (match_operand:SI 1 "register_operand" "d")
7778 (match_operand:SI 2 "small_int" "I")))]
7779 "!TARGET_MIPS16 && INTVAL (operands[2]) < 32767"
7782 operands[2] = GEN_INT (INTVAL (operands[2])+1);
7783 return \"slt\\t%0,%1,%2\";
7785 [(set_attr "type" "arith")
7786 (set_attr "mode" "SI")])
7789 [(set (match_operand:SI 0 "register_operand" "=t")
7790 (le:SI (match_operand:SI 1 "register_operand" "d")
7791 (match_operand:SI 2 "small_int" "I")))]
7792 "TARGET_MIPS16 && INTVAL (operands[2]) < 32767"
7795 operands[2] = GEN_INT (INTVAL (operands[2])+1);
7796 return \"slt\\t%1,%2\";
7798 [(set_attr "type" "arith")
7799 (set_attr "mode" "SI")
7800 (set (attr "length") (if_then_else (match_operand:VOID 2 "m16_uimm8_m1_1" "")
7804 (define_insn "sle_di_const"
7805 [(set (match_operand:DI 0 "register_operand" "=d")
7806 (le:DI (match_operand:DI 1 "register_operand" "d")
7807 (match_operand:DI 2 "small_int" "I")))]
7808 "TARGET_64BIT && !TARGET_MIPS16 && INTVAL (operands[2]) < 32767"
7811 operands[2] = GEN_INT (INTVAL (operands[2])+1);
7812 return \"slt\\t%0,%1,%2\";
7814 [(set_attr "type" "arith")
7815 (set_attr "mode" "DI")])
7818 [(set (match_operand:DI 0 "register_operand" "=t")
7819 (le:DI (match_operand:DI 1 "register_operand" "d")
7820 (match_operand:DI 2 "small_int" "I")))]
7821 "TARGET_64BIT && TARGET_MIPS16 && INTVAL (operands[2]) < 32767"
7824 operands[2] = GEN_INT (INTVAL (operands[2])+1);
7825 return \"slt\\t%1,%2\";
7827 [(set_attr "type" "arith")
7828 (set_attr "mode" "DI")
7829 (set (attr "length") (if_then_else (match_operand:VOID 2 "m16_uimm8_m1_1" "")
7833 (define_insn "sle_si_reg"
7834 [(set (match_operand:SI 0 "register_operand" "=d")
7835 (le:SI (match_operand:SI 1 "register_operand" "d")
7836 (match_operand:SI 2 "register_operand" "d")))]
7837 "TARGET_DEBUG_C_MODE && !TARGET_MIPS16"
7838 "slt\\t%0,%z2,%1\;xori\\t%0,%0,0x0001"
7839 [(set_attr "type" "arith")
7840 (set_attr "mode" "SI")
7841 (set_attr "length" "8")])
7844 [(set (match_operand:SI 0 "register_operand" "")
7845 (le:SI (match_operand:SI 1 "register_operand" "")
7846 (match_operand:SI 2 "register_operand" "")))]
7847 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE && !TARGET_MIPS16"
7849 (lt:SI (match_dup 2)
7852 (xor:SI (match_dup 0)
7856 (define_insn "sle_di_reg"
7857 [(set (match_operand:DI 0 "register_operand" "=d")
7858 (le:DI (match_operand:DI 1 "register_operand" "d")
7859 (match_operand:DI 2 "register_operand" "d")))]
7860 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_MIPS16"
7861 "slt\\t%0,%z2,%1\;xori\\t%0,%0,0x0001"
7862 [(set_attr "type" "arith")
7863 (set_attr "mode" "DI")
7864 (set_attr "length" "8")])
7867 [(set (match_operand:DI 0 "register_operand" "")
7868 (le:DI (match_operand:DI 1 "register_operand" "")
7869 (match_operand:DI 2 "register_operand" "")))]
7870 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE
7873 (lt:DI (match_dup 2)
7876 (xor:DI (match_dup 0)
7880 (define_expand "sgtu"
7881 [(set (match_operand:SI 0 "register_operand" "=d")
7882 (gtu:SI (match_dup 1)
7887 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
7890 /* set up operands from compare. */
7891 operands[1] = branch_cmp[0];
7892 operands[2] = branch_cmp[1];
7894 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE || TARGET_MIPS16)
7896 gen_int_relational (GTU, operands[0], operands[1], operands[2], (int *)0);
7900 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) != 0)
7901 operands[2] = force_reg (SImode, operands[2]);
7903 /* fall through and generate default code */
7906 (define_insn "sgtu_si"
7907 [(set (match_operand:SI 0 "register_operand" "=d")
7908 (gtu:SI (match_operand:SI 1 "register_operand" "d")
7909 (match_operand:SI 2 "reg_or_0_operand" "dJ")))]
7912 [(set_attr "type" "arith")
7913 (set_attr "mode" "SI")])
7916 [(set (match_operand:SI 0 "register_operand" "=t")
7917 (gtu:SI (match_operand:SI 1 "register_operand" "d")
7918 (match_operand:SI 2 "register_operand" "d")))]
7921 [(set_attr "type" "arith")
7922 (set_attr "mode" "SI")])
7924 (define_insn "sgtu_di"
7925 [(set (match_operand:DI 0 "register_operand" "=d")
7926 (gtu:DI (match_operand:DI 1 "register_operand" "d")
7927 (match_operand:DI 2 "reg_or_0_operand" "dJ")))]
7928 "TARGET_64BIT && !TARGET_MIPS16"
7930 [(set_attr "type" "arith")
7931 (set_attr "mode" "DI")])
7934 [(set (match_operand:DI 0 "register_operand" "=t")
7935 (gtu:DI (match_operand:DI 1 "register_operand" "d")
7936 (match_operand:DI 2 "register_operand" "d")))]
7937 "TARGET_64BIT && TARGET_MIPS16"
7939 [(set_attr "type" "arith")
7940 (set_attr "mode" "DI")])
7942 (define_expand "sgeu"
7943 [(set (match_operand:SI 0 "register_operand" "=d")
7944 (geu:SI (match_dup 1)
7949 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
7952 /* set up operands from compare. */
7953 operands[1] = branch_cmp[0];
7954 operands[2] = branch_cmp[1];
7956 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE || TARGET_MIPS16)
7958 gen_int_relational (GEU, operands[0], operands[1], operands[2], (int *)0);
7962 /* fall through and generate default code */
7965 (define_insn "sgeu_si"
7966 [(set (match_operand:SI 0 "register_operand" "=d")
7967 (geu:SI (match_operand:SI 1 "register_operand" "d")
7968 (match_operand:SI 2 "arith_operand" "dI")))]
7969 "TARGET_DEBUG_C_MODE && !TARGET_MIPS16"
7970 "sltu\\t%0,%1,%2\;xori\\t%0,%0,0x0001"
7971 [(set_attr "type" "arith")
7972 (set_attr "mode" "SI")
7973 (set_attr "length" "8")])
7976 [(set (match_operand:SI 0 "register_operand" "")
7977 (geu:SI (match_operand:SI 1 "register_operand" "")
7978 (match_operand:SI 2 "arith_operand" "")))]
7979 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE && !TARGET_MIPS16"
7981 (ltu:SI (match_dup 1)
7984 (xor:SI (match_dup 0)
7988 (define_insn "sgeu_di"
7989 [(set (match_operand:DI 0 "register_operand" "=d")
7990 (geu:DI (match_operand:DI 1 "register_operand" "d")
7991 (match_operand:DI 2 "arith_operand" "dI")))]
7992 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_MIPS16"
7993 "sltu\\t%0,%1,%2\;xori\\t%0,%0,0x0001"
7994 [(set_attr "type" "arith")
7995 (set_attr "mode" "DI")
7996 (set_attr "length" "8")])
7999 [(set (match_operand:DI 0 "register_operand" "")
8000 (geu:DI (match_operand:DI 1 "register_operand" "")
8001 (match_operand:DI 2 "arith_operand" "")))]
8002 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE
8005 (ltu:DI (match_dup 1)
8008 (xor:DI (match_dup 0)
8012 (define_expand "sltu"
8013 [(set (match_operand:SI 0 "register_operand" "=d")
8014 (ltu:SI (match_dup 1)
8019 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
8022 /* set up operands from compare. */
8023 operands[1] = branch_cmp[0];
8024 operands[2] = branch_cmp[1];
8026 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE || TARGET_MIPS16)
8028 gen_int_relational (LTU, operands[0], operands[1], operands[2], (int *)0);
8032 /* fall through and generate default code */
8035 (define_insn "sltu_si"
8036 [(set (match_operand:SI 0 "register_operand" "=d")
8037 (ltu:SI (match_operand:SI 1 "register_operand" "d")
8038 (match_operand:SI 2 "arith_operand" "dI")))]
8041 [(set_attr "type" "arith")
8042 (set_attr "mode" "SI")])
8045 [(set (match_operand:SI 0 "register_operand" "=t,t")
8046 (ltu:SI (match_operand:SI 1 "register_operand" "d,d")
8047 (match_operand:SI 2 "arith_operand" "d,I")))]
8050 [(set_attr "type" "arith")
8051 (set_attr "mode" "SI")
8052 (set_attr_alternative "length"
8054 (if_then_else (match_operand:VOID 2 "m16_uimm8_1" "")
8058 (define_insn "sltu_di"
8059 [(set (match_operand:DI 0 "register_operand" "=d")
8060 (ltu:DI (match_operand:DI 1 "register_operand" "d")
8061 (match_operand:DI 2 "arith_operand" "dI")))]
8062 "TARGET_64BIT && !TARGET_MIPS16"
8064 [(set_attr "type" "arith")
8065 (set_attr "mode" "DI")])
8068 [(set (match_operand:DI 0 "register_operand" "=t,t")
8069 (ltu:DI (match_operand:DI 1 "register_operand" "d,d")
8070 (match_operand:DI 2 "arith_operand" "d,I")))]
8071 "TARGET_64BIT && TARGET_MIPS16"
8073 [(set_attr "type" "arith")
8074 (set_attr "mode" "DI")
8075 (set_attr_alternative "length"
8077 (if_then_else (match_operand:VOID 2 "m16_uimm8_1" "")
8081 (define_expand "sleu"
8082 [(set (match_operand:SI 0 "register_operand" "=d")
8083 (leu:SI (match_dup 1)
8088 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
8091 /* set up operands from compare. */
8092 operands[1] = branch_cmp[0];
8093 operands[2] = branch_cmp[1];
8095 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE || TARGET_MIPS16)
8097 gen_int_relational (LEU, operands[0], operands[1], operands[2], (int *)0);
8101 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 32767)
8102 operands[2] = force_reg (SImode, operands[2]);
8104 /* fall through and generate default code */
8107 (define_insn "sleu_si_const"
8108 [(set (match_operand:SI 0 "register_operand" "=d")
8109 (leu:SI (match_operand:SI 1 "register_operand" "d")
8110 (match_operand:SI 2 "small_int" "I")))]
8111 "!TARGET_MIPS16 && INTVAL (operands[2]) < 32767"
8114 operands[2] = GEN_INT (INTVAL (operands[2]) + 1);
8115 return \"sltu\\t%0,%1,%2\";
8117 [(set_attr "type" "arith")
8118 (set_attr "mode" "SI")])
8121 [(set (match_operand:SI 0 "register_operand" "=t")
8122 (leu:SI (match_operand:SI 1 "register_operand" "d")
8123 (match_operand:SI 2 "small_int" "I")))]
8124 "TARGET_MIPS16 && INTVAL (operands[2]) < 32767"
8127 operands[2] = GEN_INT (INTVAL (operands[2])+1);
8128 return \"sltu\\t%1,%2\";
8130 [(set_attr "type" "arith")
8131 (set_attr "mode" "SI")
8132 (set (attr "length") (if_then_else (match_operand:VOID 2 "m16_uimm8_m1_1" "")
8136 (define_insn "sleu_di_const"
8137 [(set (match_operand:DI 0 "register_operand" "=d")
8138 (leu:DI (match_operand:DI 1 "register_operand" "d")
8139 (match_operand:DI 2 "small_int" "I")))]
8140 "TARGET_64BIT && !TARGET_MIPS16 && INTVAL (operands[2]) < 32767"
8143 operands[2] = GEN_INT (INTVAL (operands[2]) + 1);
8144 return \"sltu\\t%0,%1,%2\";
8146 [(set_attr "type" "arith")
8147 (set_attr "mode" "DI")])
8150 [(set (match_operand:DI 0 "register_operand" "=t")
8151 (leu:DI (match_operand:DI 1 "register_operand" "d")
8152 (match_operand:DI 2 "small_int" "I")))]
8153 "TARGET_64BIT && TARGET_MIPS16 && INTVAL (operands[2]) < 32767"
8156 operands[2] = GEN_INT (INTVAL (operands[2])+1);
8157 return \"sltu\\t%1,%2\";
8159 [(set_attr "type" "arith")
8160 (set_attr "mode" "DI")
8161 (set (attr "length") (if_then_else (match_operand:VOID 2 "m16_uimm8_m1_1" "")
8165 (define_insn "sleu_si_reg"
8166 [(set (match_operand:SI 0 "register_operand" "=d")
8167 (leu:SI (match_operand:SI 1 "register_operand" "d")
8168 (match_operand:SI 2 "register_operand" "d")))]
8169 "TARGET_DEBUG_C_MODE && !TARGET_MIPS16"
8170 "sltu\\t%0,%z2,%1\;xori\\t%0,%0,0x0001"
8171 [(set_attr "type" "arith")
8172 (set_attr "mode" "SI")
8173 (set_attr "length" "8")])
8176 [(set (match_operand:SI 0 "register_operand" "")
8177 (leu:SI (match_operand:SI 1 "register_operand" "")
8178 (match_operand:SI 2 "register_operand" "")))]
8179 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE && !TARGET_MIPS16"
8181 (ltu:SI (match_dup 2)
8184 (xor:SI (match_dup 0)
8188 (define_insn "sleu_di_reg"
8189 [(set (match_operand:DI 0 "register_operand" "=d")
8190 (leu:DI (match_operand:DI 1 "register_operand" "d")
8191 (match_operand:DI 2 "register_operand" "d")))]
8192 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_MIPS16"
8193 "sltu\\t%0,%z2,%1\;xori\\t%0,%0,0x0001"
8194 [(set_attr "type" "arith")
8195 (set_attr "mode" "DI")
8196 (set_attr "length" "8")])
8199 [(set (match_operand:DI 0 "register_operand" "")
8200 (leu:DI (match_operand:DI 1 "register_operand" "")
8201 (match_operand:DI 2 "register_operand" "")))]
8202 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE
8205 (ltu:DI (match_dup 2)
8208 (xor:DI (match_dup 0)
8214 ;; ....................
8216 ;; FLOATING POINT COMPARISONS
8218 ;; ....................
8220 (define_insn "sunordered_df"
8221 [(set (match_operand:CC 0 "register_operand" "=z")
8222 (unordered:CC (match_operand:DF 1 "register_operand" "f")
8223 (match_operand:DF 2 "register_operand" "f")))]
8224 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
8226 [(set_attr "type" "fcmp")
8227 (set_attr "mode" "FPSW")])
8229 (define_insn "sunlt_df"
8230 [(set (match_operand:CC 0 "register_operand" "=z")
8231 (unlt:CC (match_operand:DF 1 "register_operand" "f")
8232 (match_operand:DF 2 "register_operand" "f")))]
8233 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
8235 [(set_attr "type" "fcmp")
8236 (set_attr "mode" "FPSW")])
8238 (define_insn "suneq_df"
8239 [(set (match_operand:CC 0 "register_operand" "=z")
8240 (uneq:CC (match_operand:DF 1 "register_operand" "f")
8241 (match_operand:DF 2 "register_operand" "f")))]
8242 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
8244 [(set_attr "type" "fcmp")
8245 (set_attr "mode" "FPSW")])
8247 (define_insn "sunle_df"
8248 [(set (match_operand:CC 0 "register_operand" "=z")
8249 (unle:CC (match_operand:DF 1 "register_operand" "f")
8250 (match_operand:DF 2 "register_operand" "f")))]
8251 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
8253 [(set_attr "type" "fcmp")
8254 (set_attr "mode" "FPSW")])
8256 (define_insn "seq_df"
8257 [(set (match_operand:CC 0 "register_operand" "=z")
8258 (eq:CC (match_operand:DF 1 "register_operand" "f")
8259 (match_operand:DF 2 "register_operand" "f")))]
8260 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
8262 [(set_attr "type" "fcmp")
8263 (set_attr "mode" "FPSW")])
8265 (define_insn "slt_df"
8266 [(set (match_operand:CC 0 "register_operand" "=z")
8267 (lt:CC (match_operand:DF 1 "register_operand" "f")
8268 (match_operand:DF 2 "register_operand" "f")))]
8269 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
8271 [(set_attr "type" "fcmp")
8272 (set_attr "mode" "FPSW")])
8274 (define_insn "sle_df"
8275 [(set (match_operand:CC 0 "register_operand" "=z")
8276 (le:CC (match_operand:DF 1 "register_operand" "f")
8277 (match_operand:DF 2 "register_operand" "f")))]
8278 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
8280 [(set_attr "type" "fcmp")
8281 (set_attr "mode" "FPSW")])
8283 (define_insn "sgt_df"
8284 [(set (match_operand:CC 0 "register_operand" "=z")
8285 (gt:CC (match_operand:DF 1 "register_operand" "f")
8286 (match_operand:DF 2 "register_operand" "f")))]
8287 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
8289 [(set_attr "type" "fcmp")
8290 (set_attr "mode" "FPSW")])
8292 (define_insn "sge_df"
8293 [(set (match_operand:CC 0 "register_operand" "=z")
8294 (ge:CC (match_operand:DF 1 "register_operand" "f")
8295 (match_operand:DF 2 "register_operand" "f")))]
8296 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
8298 [(set_attr "type" "fcmp")
8299 (set_attr "mode" "FPSW")])
8301 (define_insn "sunordered_sf"
8302 [(set (match_operand:CC 0 "register_operand" "=z")
8303 (unordered:CC (match_operand:SF 1 "register_operand" "f")
8304 (match_operand:SF 2 "register_operand" "f")))]
8307 [(set_attr "type" "fcmp")
8308 (set_attr "mode" "FPSW")])
8310 (define_insn "sunlt_sf"
8311 [(set (match_operand:CC 0 "register_operand" "=z")
8312 (unlt:CC (match_operand:SF 1 "register_operand" "f")
8313 (match_operand:SF 2 "register_operand" "f")))]
8316 [(set_attr "type" "fcmp")
8317 (set_attr "mode" "FPSW")])
8319 (define_insn "suneq_sf"
8320 [(set (match_operand:CC 0 "register_operand" "=z")
8321 (uneq:CC (match_operand:SF 1 "register_operand" "f")
8322 (match_operand:SF 2 "register_operand" "f")))]
8325 [(set_attr "type" "fcmp")
8326 (set_attr "mode" "FPSW")])
8328 (define_insn "sunle_sf"
8329 [(set (match_operand:CC 0 "register_operand" "=z")
8330 (unle:CC (match_operand:SF 1 "register_operand" "f")
8331 (match_operand:SF 2 "register_operand" "f")))]
8334 [(set_attr "type" "fcmp")
8335 (set_attr "mode" "FPSW")])
8337 (define_insn "seq_sf"
8338 [(set (match_operand:CC 0 "register_operand" "=z")
8339 (eq:CC (match_operand:SF 1 "register_operand" "f")
8340 (match_operand:SF 2 "register_operand" "f")))]
8343 [(set_attr "type" "fcmp")
8344 (set_attr "mode" "FPSW")])
8346 (define_insn "slt_sf"
8347 [(set (match_operand:CC 0 "register_operand" "=z")
8348 (lt:CC (match_operand:SF 1 "register_operand" "f")
8349 (match_operand:SF 2 "register_operand" "f")))]
8352 [(set_attr "type" "fcmp")
8353 (set_attr "mode" "FPSW")])
8355 (define_insn "sle_sf"
8356 [(set (match_operand:CC 0 "register_operand" "=z")
8357 (le:CC (match_operand:SF 1 "register_operand" "f")
8358 (match_operand:SF 2 "register_operand" "f")))]
8361 [(set_attr "type" "fcmp")
8362 (set_attr "mode" "FPSW")])
8364 (define_insn "sgt_sf"
8365 [(set (match_operand:CC 0 "register_operand" "=z")
8366 (gt:CC (match_operand:SF 1 "register_operand" "f")
8367 (match_operand:SF 2 "register_operand" "f")))]
8370 [(set_attr "type" "fcmp")
8371 (set_attr "mode" "FPSW")])
8373 (define_insn "sge_sf"
8374 [(set (match_operand:CC 0 "register_operand" "=z")
8375 (ge:CC (match_operand:SF 1 "register_operand" "f")
8376 (match_operand:SF 2 "register_operand" "f")))]
8379 [(set_attr "type" "fcmp")
8380 (set_attr "mode" "FPSW")])
8384 ;; ....................
8386 ;; UNCONDITIONAL BRANCHES
8388 ;; ....................
8390 ;; Unconditional branches.
8394 (label_ref (match_operand 0 "" "")))]
8398 if (flag_pic && ! TARGET_EMBEDDED_PIC)
8400 if (get_attr_length (insn) <= 8)
8401 return \"%*b\\t%l0%/\";
8404 output_asm_insn (mips_output_load_label (), operands);
8405 return \"%*jr\\t%@%/%]\";
8409 return \"%*j\\t%l0%/\";
8411 [(set_attr "type" "jump")
8412 (set_attr "mode" "none")
8413 (set (attr "length")
8414 ;; we can't use `j' when emitting non-embedded PIC, so we emit
8415 ;; branch, if it's in range, or load the address of the branch
8416 ;; target into $at in a PIC-compatible way and then jump to it.
8418 (ior (eq (symbol_ref "flag_pic && ! TARGET_EMBEDDED_PIC")
8420 (lt (abs (minus (match_dup 0)
8421 (plus (pc) (const_int 4))))
8422 (const_int 131072)))
8423 (const_int 4) (const_int 16)))])
8425 ;; We need a different insn for the mips16, because a mips16 branch
8426 ;; does not have a delay slot.
8430 (label_ref (match_operand 0 "" "")))]
8433 [(set_attr "type" "branch")
8434 (set_attr "mode" "none")
8435 (set_attr "length" "8")])
8437 (define_expand "indirect_jump"
8438 [(set (pc) (match_operand 0 "register_operand" "d"))]
8444 if (operands[0]) /* eliminate unused code warnings */
8447 if (GET_CODE (dest) != REG || GET_MODE (dest) != Pmode)
8448 operands[0] = copy_to_mode_reg (Pmode, dest);
8450 if (!(Pmode == DImode))
8451 emit_jump_insn (gen_indirect_jump_internal1 (operands[0]));
8453 emit_jump_insn (gen_indirect_jump_internal2 (operands[0]));
8459 (define_insn "indirect_jump_internal1"
8460 [(set (pc) (match_operand:SI 0 "register_operand" "d"))]
8461 "!(Pmode == DImode)"
8463 [(set_attr "type" "jump")
8464 (set_attr "mode" "none")])
8466 (define_insn "indirect_jump_internal2"
8467 [(set (pc) (match_operand:DI 0 "register_operand" "d"))]
8470 [(set_attr "type" "jump")
8471 (set_attr "mode" "none")])
8473 (define_expand "tablejump"
8475 (match_operand 0 "register_operand" "d"))
8476 (use (label_ref (match_operand 1 "" "")))]
8480 if (operands[0]) /* eliminate unused code warnings */
8484 if (GET_MODE (operands[0]) != HImode)
8486 if (!(Pmode == DImode))
8487 emit_insn (gen_tablejump_mips161 (operands[0], operands[1]));
8489 emit_insn (gen_tablejump_mips162 (operands[0], operands[1]));
8493 if (GET_MODE (operands[0]) != ptr_mode)
8497 operands[0] = expand_binop (ptr_mode, add_optab, operands[0],
8498 pic_offset_table_rtx, 0, 0, OPTAB_WIDEN);
8500 if (Pmode == SImode)
8501 emit_jump_insn (gen_tablejump_internal1 (operands[0], operands[1]));
8503 emit_jump_insn (gen_tablejump_internal2 (operands[0], operands[1]));
8508 (define_insn "tablejump_internal1"
8510 (match_operand:SI 0 "register_operand" "d"))
8511 (use (label_ref (match_operand 1 "" "")))]
8514 [(set_attr "type" "jump")
8515 (set_attr "mode" "none")])
8517 (define_insn "tablejump_internal2"
8519 (match_operand:DI 0 "register_operand" "d"))
8520 (use (label_ref (match_operand 1 "" "")))]
8523 [(set_attr "type" "jump")
8524 (set_attr "mode" "none")])
8526 (define_expand "tablejump_mips161"
8527 [(set (pc) (plus:SI (sign_extend:SI
8528 (match_operand:HI 0 "register_operand" "d"))
8529 (label_ref:SI (match_operand 1 "" ""))))]
8530 "TARGET_MIPS16 && !(Pmode == DImode)"
8533 if (operands[0]) /* eliminate unused code warnings. */
8537 t1 = gen_reg_rtx (SImode);
8538 t2 = gen_reg_rtx (SImode);
8539 t3 = gen_reg_rtx (SImode);
8540 emit_insn (gen_extendhisi2 (t1, operands[0]));
8541 emit_move_insn (t2, gen_rtx_LABEL_REF (SImode, operands[1]));
8542 emit_insn (gen_addsi3 (t3, t1, t2));
8543 emit_jump_insn (gen_tablejump_internal1 (t3, operands[1]));
8548 (define_expand "tablejump_mips162"
8549 [(set (pc) (plus:DI (sign_extend:DI
8550 (match_operand:HI 0 "register_operand" "d"))
8551 (label_ref:DI (match_operand 1 "" ""))))]
8552 "TARGET_MIPS16 && Pmode == DImode"
8555 if (operands[0]) /* eliminate unused code warnings. */
8559 t1 = gen_reg_rtx (DImode);
8560 t2 = gen_reg_rtx (DImode);
8561 t3 = gen_reg_rtx (DImode);
8562 emit_insn (gen_extendhidi2 (t1, operands[0]));
8563 emit_move_insn (t2, gen_rtx_LABEL_REF (DImode, operands[1]));
8564 emit_insn (gen_adddi3 (t3, t1, t2));
8565 emit_jump_insn (gen_tablejump_internal2 (t3, operands[1]));
8570 ;; Implement a switch statement when generating embedded PIC code.
8571 ;; Switches are implemented by `tablejump' when not using -membedded-pic.
8573 (define_expand "casesi"
8575 (minus:SI (match_operand:SI 0 "register_operand" "d")
8576 (match_operand:SI 1 "arith_operand" "dI")))
8578 (compare:CC (match_dup 5)
8579 (match_operand:SI 2 "arith_operand" "")))
8581 (if_then_else (gtu (cc0)
8583 (label_ref (match_operand 4 "" ""))
8587 (mem:SI (plus:SI (mult:SI (match_dup 5)
8589 (label_ref (match_operand 3 "" "")))))
8590 (clobber (match_scratch:SI 6 ""))
8591 (clobber (reg:SI 31))])]
8592 "TARGET_EMBEDDED_PIC"
8597 rtx reg = gen_reg_rtx (SImode);
8599 /* If the index is too large, go to the default label. */
8600 emit_insn (gen_subsi3 (reg, operands[0], operands[1]));
8601 emit_insn (gen_cmpsi (reg, operands[2]));
8602 emit_insn (gen_bgtu (operands[4]));
8604 /* Do the PIC jump. */
8605 if (Pmode != DImode)
8606 emit_jump_insn (gen_casesi_internal (reg, operands[3],
8607 gen_reg_rtx (SImode)));
8609 emit_jump_insn (gen_casesi_internal_di (reg, operands[3],
8610 gen_reg_rtx (DImode)));
8616 ;; An embedded PIC switch statement looks like this:
8618 ;; sll $reg,$index,2
8620 ;; addu $reg,$reg,$31
8621 ;; lw $reg,$L1-$LS1($reg)
8622 ;; addu $reg,$reg,$31
8629 (define_insn "casesi_internal"
8631 (mem:SI (plus:SI (mult:SI (match_operand:SI 0 "register_operand" "d")
8633 (label_ref (match_operand 1 "" "")))))
8634 (clobber (match_operand:SI 2 "register_operand" "=d"))
8635 (clobber (reg:SI 31))]
8636 "TARGET_EMBEDDED_PIC"
8637 "%(bal\\t%S1\;sll\\t%2,%0,2\\n%~%S1:\;addu\\t%2,%2,$31%)\;\\
8638 lw\\t%2,%1-%S1(%2)\;addu\\t%2,%2,$31\\n\\t%*j\\t%2%/"
8639 [(set_attr "type" "jump")
8640 (set_attr "mode" "none")
8641 (set_attr "length" "24")])
8643 ;; This code assumes that the table index will never be >= 29 bits wide,
8644 ;; which allows the 'sign extend' from SI to DI be a no-op.
8645 (define_insn "casesi_internal_di"
8647 (mem:DI (plus:DI (sign_extend:DI
8648 (mult:SI (match_operand:SI 0 "register_operand" "d")
8650 (label_ref (match_operand 1 "" "")))))
8651 (clobber (match_operand:DI 2 "register_operand" "=d"))
8652 (clobber (reg:DI 31))]
8653 "TARGET_EMBEDDED_PIC"
8654 "%(bal\\t%S1\;sll\\t%2,%0,3\\n%~%S1:\;daddu\\t%2,%2,$31%)\;\\
8655 ld\\t%2,%1-%S1(%2)\;daddu\\t%2,%2,$31\\n\\t%*j\\t%2%/"
8656 [(set_attr "type" "jump")
8657 (set_attr "mode" "none")
8658 (set_attr "length" "24")])
8660 ;; For TARGET_ABICALLS, we save the gp in the jmp_buf as well.
8661 ;; While it is possible to either pull it off the stack (in the
8662 ;; o32 case) or recalculate it given t9 and our target label,
8663 ;; it takes 3 or 4 insns to do so.
8665 (define_expand "builtin_setjmp_setup"
8666 [(use (match_operand 0 "register_operand" ""))]
8671 addr = plus_constant (operands[0], GET_MODE_SIZE (Pmode) * 3);
8672 emit_move_insn (gen_rtx_MEM (Pmode, addr), pic_offset_table_rtx);
8676 ;; Restore the gp that we saved above. Despite the comment, it seems that
8677 ;; older code did recalculate the gp from $25. Continue to jump through
8678 ;; $25 for compatibility (we lose nothing by doing so).
8680 (define_expand "builtin_longjmp"
8681 [(use (match_operand 0 "register_operand" "r"))]
8685 /* The elements of the buffer are, in order: */
8686 int W = GET_MODE_SIZE (Pmode);
8687 rtx fp = gen_rtx_MEM (Pmode, operands[0]);
8688 rtx lab = gen_rtx_MEM (Pmode, plus_constant (operands[0], 1*W));
8689 rtx stack = gen_rtx_MEM (Pmode, plus_constant (operands[0], 2*W));
8690 rtx gpv = gen_rtx_MEM (Pmode, plus_constant (operands[0], 3*W));
8691 rtx pv = gen_rtx_REG (Pmode, PIC_FUNCTION_ADDR_REGNUM);
8692 /* Use gen_raw_REG to avoid being given pic_offset_table_rtx.
8693 The target is bound to be using $28 as the global pointer
8694 but the current function might not be. */
8695 rtx gp = gen_raw_REG (Pmode, GLOBAL_POINTER_REGNUM);
8697 /* This bit is similar to expand_builtin_longjmp except that it
8698 restores $gp as well. */
8699 emit_move_insn (hard_frame_pointer_rtx, fp);
8700 emit_move_insn (pv, lab);
8701 emit_stack_restore (SAVE_NONLOCAL, stack, NULL_RTX);
8702 emit_move_insn (gp, gpv);
8703 emit_insn (gen_rtx_USE (VOIDmode, hard_frame_pointer_rtx));
8704 emit_insn (gen_rtx_USE (VOIDmode, stack_pointer_rtx));
8705 emit_insn (gen_rtx_USE (VOIDmode, gp));
8706 emit_indirect_jump (pv);
8711 ;; ....................
8713 ;; Function prologue/epilogue
8715 ;; ....................
8718 (define_expand "prologue"
8723 if (mips_isa >= 0) /* avoid unused code warnings */
8725 mips_expand_prologue ();
8730 ;; Block any insns from being moved before this point, since the
8731 ;; profiling call to mcount can use various registers that aren't
8732 ;; saved or used to pass arguments.
8734 (define_insn "blockage"
8735 [(unspec_volatile [(const_int 0)] UNSPEC_BLOCKAGE)]
8738 [(set_attr "type" "unknown")
8739 (set_attr "mode" "none")
8740 (set_attr "length" "0")])
8742 (define_expand "epilogue"
8746 mips_expand_epilogue (false);
8750 (define_expand "sibcall_epilogue"
8754 mips_expand_epilogue (true);
8758 ;; Trivial return. Make it look like a normal return insn as that
8759 ;; allows jump optimizations to work better .
8760 (define_insn "return"
8762 "mips_can_use_return_insn ()"
8764 [(set_attr "type" "jump")
8765 (set_attr "mode" "none")])
8769 (define_insn "return_internal"
8770 [(use (match_operand 0 "pmode_register_operand" ""))
8774 [(set_attr "type" "jump")
8775 (set_attr "mode" "none")])
8777 ;; When generating embedded PIC code we need to get the address of the
8778 ;; current function. This specialized instruction does just that.
8780 (define_insn "get_fnaddr"
8781 [(set (match_operand 0 "register_operand" "=d")
8782 (unspec [(match_operand 1 "" "")] UNSPEC_GET_FNADDR))
8783 (clobber (reg:SI 31))]
8784 "TARGET_EMBEDDED_PIC
8785 && GET_CODE (operands[1]) == SYMBOL_REF"
8786 "%($LF%= = . + 8\;bal\\t$LF%=\;nop;la\\t%0,%1-$LF%=%)\;addu\\t%0,%0,$31"
8787 [(set_attr "type" "call")
8788 (set_attr "mode" "none")
8789 (set_attr "length" "20")])
8791 ;; This is used in compiling the unwind routines.
8792 (define_expand "eh_return"
8793 [(use (match_operand 0 "general_operand" ""))]
8797 enum machine_mode gpr_mode = TARGET_64BIT ? DImode : SImode;
8799 if (GET_MODE (operands[0]) != gpr_mode)
8800 operands[0] = convert_to_mode (gpr_mode, operands[0], 0);
8802 emit_insn (gen_eh_set_lr_di (operands[0]));
8804 emit_insn (gen_eh_set_lr_si (operands[0]));
8809 ;; Clobber the return address on the stack. We can't expand this
8810 ;; until we know where it will be put in the stack frame.
8812 (define_insn "eh_set_lr_si"
8813 [(unspec [(match_operand:SI 0 "register_operand" "d")] UNSPEC_EH_RETURN)
8814 (clobber (match_scratch:SI 1 "=&d"))]
8818 (define_insn "eh_set_lr_di"
8819 [(unspec [(match_operand:DI 0 "register_operand" "d")] UNSPEC_EH_RETURN)
8820 (clobber (match_scratch:DI 1 "=&d"))]
8825 [(unspec [(match_operand 0 "register_operand" "")] UNSPEC_EH_RETURN)
8826 (clobber (match_scratch 1 ""))]
8827 "reload_completed && !TARGET_DEBUG_D_MODE"
8831 mips_set_return_address (operands[0], operands[1]);
8835 (define_insn "exception_receiver"
8837 (unspec_volatile [(const_int 0)] UNSPEC_EH_RECEIVER))]
8838 "TARGET_ABICALLS && (mips_abi == ABI_32 || mips_abi == ABI_O64)"
8839 { return mips_restore_gp (operands); }
8840 [(set_attr "type" "load")
8841 (set_attr "length" "8")])
8844 ;; ....................
8848 ;; ....................
8850 ;; Sibling calls. All these patterns use direct jumps.
8852 ;; call_insn_operand will only accepts constant addresses if a direct
8853 ;; jump is acceptable. Since the 'S' constraint is defined in terms of
8854 ;; call_insn_operand, the same is true of the contraints.
8856 ;; When we use an indirect jump, we need a register that will be
8857 ;; preserved by the epilogue. Since TARGET_ABICALLS forces us to
8858 ;; use $25 for this purpose -- and $25 is never clobbered by the
8859 ;; epilogue -- we might as well use it for !TARGET_ABICALLS as well.
8861 (define_expand "sibcall"
8862 [(parallel [(call (match_operand 0 "" "")
8863 (match_operand 1 "" ""))
8864 (use (match_operand 2 "" "")) ;; next_arg_reg
8865 (use (match_operand 3 "" ""))])] ;; struct_value_size_rtx
8868 mips_expand_call (0, XEXP (operands[0], 0), operands[1], operands[2], true);
8872 (define_insn "sibcall_internal"
8873 [(call (mem:SI (match_operand 0 "call_insn_operand" "j,S"))
8874 (match_operand 1 "" ""))]
8875 "TARGET_SIBCALLS && SIBLING_CALL_P (insn)"
8879 [(set_attr "type" "call")])
8881 (define_expand "sibcall_value"
8882 [(parallel [(set (match_operand 0 "" "")
8883 (call (match_operand 1 "" "")
8884 (match_operand 2 "" "")))
8885 (use (match_operand 3 "" ""))])] ;; next_arg_reg
8888 mips_expand_call (operands[0], XEXP (operands[1], 0),
8889 operands[2], operands[3], true);
8893 (define_insn "sibcall_value_internal"
8894 [(set (match_operand 0 "register_operand" "=df,df")
8895 (call (mem:SI (match_operand 1 "call_insn_operand" "j,S"))
8896 (match_operand 2 "" "")))]
8897 "TARGET_SIBCALLS && SIBLING_CALL_P (insn)"
8901 [(set_attr "type" "call")])
8903 (define_insn "sibcall_value_multiple_internal"
8904 [(set (match_operand 0 "register_operand" "=df,df")
8905 (call (mem:SI (match_operand 1 "call_insn_operand" "j,S"))
8906 (match_operand 2 "" "")))
8907 (set (match_operand 3 "register_operand" "=df,df")
8908 (call (mem:SI (match_dup 1))
8910 "TARGET_SIBCALLS && SIBLING_CALL_P (insn)"
8914 [(set_attr "type" "call")])
8916 (define_expand "call"
8917 [(parallel [(call (match_operand 0 "" "")
8918 (match_operand 1 "" ""))
8919 (use (match_operand 2 "" "")) ;; next_arg_reg
8920 (use (match_operand 3 "" ""))])] ;; struct_value_size_rtx
8923 mips_expand_call (0, XEXP (operands[0], 0), operands[1], operands[2], false);
8927 (define_insn_and_split "call_internal"
8928 [(call (mem:SI (match_operand 0 "call_insn_operand" "c,S"))
8929 (match_operand 1 "" ""))
8930 (clobber (reg:SI 31))]
8933 "reload_completed && TARGET_SPLIT_CALLS"
8936 emit_call_insn (gen_call_split (operands[0], operands[1]));
8937 emit_insn (gen_exception_receiver ());
8940 [(set_attr "jal" "indirect,direct")
8941 (set_attr "extended_mips16" "no,yes")])
8943 (define_insn "call_split"
8944 [(call (mem:SI (match_operand 0 "call_insn_operand" "c"))
8945 (match_operand 1 "" ""))
8946 (clobber (reg:SI 31))
8948 "TARGET_SPLIT_CALLS"
8950 [(set_attr "type" "call")])
8952 (define_expand "call_value"
8953 [(parallel [(set (match_operand 0 "" "")
8954 (call (match_operand 1 "" "")
8955 (match_operand 2 "" "")))
8956 (use (match_operand 3 "" ""))])] ;; next_arg_reg
8959 mips_expand_call (operands[0], XEXP (operands[1], 0),
8960 operands[2], operands[3], false);
8964 (define_insn_and_split "call_value_internal"
8965 [(set (match_operand 0 "register_operand" "=df,df")
8966 (call (mem:SI (match_operand 1 "call_insn_operand" "c,S"))
8967 (match_operand 2 "" "")))
8968 (clobber (reg:SI 31))]
8971 "reload_completed && TARGET_SPLIT_CALLS"
8974 emit_call_insn (gen_call_value_split (operands[0], operands[1],
8976 emit_insn (gen_exception_receiver ());
8979 [(set_attr "jal" "indirect,direct")
8980 (set_attr "extended_mips16" "no,yes")])
8982 (define_insn "call_value_split"
8983 [(set (match_operand 0 "register_operand" "=df")
8984 (call (mem:SI (match_operand 1 "call_insn_operand" "c"))
8985 (match_operand 2 "" "")))
8986 (clobber (reg:SI 31))
8988 "TARGET_SPLIT_CALLS"
8990 [(set_attr "type" "call")])
8992 (define_insn_and_split "call_value_multiple_internal"
8993 [(set (match_operand 0 "register_operand" "=df,df")
8994 (call (mem:SI (match_operand 1 "call_insn_operand" "c,S"))
8995 (match_operand 2 "" "")))
8996 (set (match_operand 3 "register_operand" "=df,df")
8997 (call (mem:SI (match_dup 1))
8999 (clobber (reg:SI 31))]
9002 "reload_completed && TARGET_SPLIT_CALLS"
9005 emit_call_insn (gen_call_value_multiple_split (operands[0], operands[1],
9006 operands[2], operands[3]));
9007 emit_insn (gen_exception_receiver ());
9010 [(set_attr "jal" "indirect,direct")
9011 (set_attr "extended_mips16" "no,yes")])
9013 (define_insn "call_value_multiple_split"
9014 [(set (match_operand 0 "register_operand" "=df")
9015 (call (mem:SI (match_operand 1 "call_insn_operand" "c"))
9016 (match_operand 2 "" "")))
9017 (set (match_operand 3 "register_operand" "=df")
9018 (call (mem:SI (match_dup 1))
9020 (clobber (reg:SI 31))
9022 "TARGET_SPLIT_CALLS"
9024 [(set_attr "type" "call")])
9026 ;; Call subroutine returning any type.
9028 (define_expand "untyped_call"
9029 [(parallel [(call (match_operand 0 "" "")
9031 (match_operand 1 "" "")
9032 (match_operand 2 "" "")])]
9038 emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
9040 for (i = 0; i < XVECLEN (operands[2], 0); i++)
9042 rtx set = XVECEXP (operands[2], 0, i);
9043 emit_move_insn (SET_DEST (set), SET_SRC (set));
9046 emit_insn (gen_blockage ());
9051 ;; ....................
9055 ;; ....................
9059 (define_expand "prefetch"
9060 [(prefetch (match_operand 0 "address_operand" "")
9061 (match_operand 1 "const_int_operand" "")
9062 (match_operand 2 "const_int_operand" ""))]
9065 if (symbolic_operand (operands[0], GET_MODE (operands[0])))
9066 operands[0] = force_reg (GET_MODE (operands[0]), operands[0]);
9069 (define_insn "prefetch_si_address"
9070 [(prefetch (plus:SI (match_operand:SI 0 "register_operand" "r")
9071 (match_operand:SI 3 "const_int_operand" "i"))
9072 (match_operand:SI 1 "const_int_operand" "n")
9073 (match_operand:SI 2 "const_int_operand" "n"))]
9074 "ISA_HAS_PREFETCH && Pmode == SImode"
9075 "* return mips_emit_prefetch (operands);"
9076 [(set_attr "type" "prefetch")])
9078 (define_insn "prefetch_si"
9079 [(prefetch (match_operand:SI 0 "register_operand" "r")
9080 (match_operand:SI 1 "const_int_operand" "n")
9081 (match_operand:SI 2 "const_int_operand" "n"))]
9082 "ISA_HAS_PREFETCH && Pmode == SImode"
9083 "* return mips_emit_prefetch (operands);"
9084 [(set_attr "type" "prefetch")])
9086 (define_insn "prefetch_di_address"
9087 [(prefetch (plus:DI (match_operand:DI 0 "register_operand" "r")
9088 (match_operand:DI 3 "const_int_operand" "i"))
9089 (match_operand:DI 1 "const_int_operand" "n")
9090 (match_operand:DI 2 "const_int_operand" "n"))]
9091 "ISA_HAS_PREFETCH && Pmode == DImode"
9092 "* return mips_emit_prefetch (operands);"
9093 [(set_attr "type" "prefetch")])
9095 (define_insn "prefetch_di"
9096 [(prefetch (match_operand:DI 0 "register_operand" "r")
9097 (match_operand:DI 1 "const_int_operand" "n")
9098 (match_operand:DI 2 "const_int_operand" "n"))]
9099 "ISA_HAS_PREFETCH && Pmode == DImode"
9100 "* return mips_emit_prefetch (operands);"
9101 [(set_attr "type" "prefetch")])
9107 [(set_attr "type" "nop")
9108 (set_attr "mode" "none")])
9110 ;; Like nop, but commented out when outside a .set noreorder block.
9111 (define_insn "hazard_nop"
9120 [(set_attr "type" "arith")])
9122 ;; The MIPS chip does not seem to require stack probes.
9124 ;; (define_expand "probe"
9125 ;; [(set (match_dup 0)
9130 ;; operands[0] = gen_reg_rtx (SImode);
9131 ;; operands[1] = gen_rtx_MEM (SImode, stack_pointer_rtx);
9132 ;; MEM_VOLATILE_P (operands[1]) = TRUE;
9134 ;; /* fall through and generate default code */
9139 ;; MIPS4 Conditional move instructions.
9142 [(set (match_operand:SI 0 "register_operand" "=d,d")
9144 (match_operator 4 "equality_op"
9145 [(match_operand:SI 1 "register_operand" "d,d")
9147 (match_operand:SI 2 "reg_or_0_operand" "dJ,0")
9148 (match_operand:SI 3 "reg_or_0_operand" "0,dJ")))]
9149 "ISA_HAS_CONDMOVE || ISA_HAS_INT_CONDMOVE"
9153 [(set_attr "type" "move")
9154 (set_attr "mode" "SI")])
9157 [(set (match_operand:SI 0 "register_operand" "=d,d")
9159 (match_operator 4 "equality_op"
9160 [(match_operand:DI 1 "register_operand" "d,d")
9162 (match_operand:SI 2 "reg_or_0_operand" "dJ,0")
9163 (match_operand:SI 3 "reg_or_0_operand" "0,dJ")))]
9164 "ISA_HAS_CONDMOVE || ISA_HAS_INT_CONDMOVE"
9168 [(set_attr "type" "move")
9169 (set_attr "mode" "SI")])
9172 [(set (match_operand:SI 0 "register_operand" "=d,d")
9174 (match_operator 3 "equality_op" [(match_operand:CC 4
9178 (match_operand:SI 1 "reg_or_0_operand" "dJ,0")
9179 (match_operand:SI 2 "reg_or_0_operand" "0,dJ")))]
9180 "ISA_HAS_CONDMOVE && TARGET_HARD_FLOAT"
9184 [(set_attr "type" "move")
9185 (set_attr "mode" "SI")])
9188 [(set (match_operand:DI 0 "register_operand" "=d,d")
9190 (match_operator 4 "equality_op"
9191 [(match_operand:SI 1 "register_operand" "d,d")
9193 (match_operand:DI 2 "reg_or_0_operand" "dJ,0")
9194 (match_operand:DI 3 "reg_or_0_operand" "0,dJ")))]
9195 "(ISA_HAS_CONDMOVE || ISA_HAS_INT_CONDMOVE) && TARGET_64BIT"
9199 [(set_attr "type" "move")
9200 (set_attr "mode" "DI")])
9203 [(set (match_operand:DI 0 "register_operand" "=d,d")
9205 (match_operator 4 "equality_op"
9206 [(match_operand:DI 1 "register_operand" "d,d")
9208 (match_operand:DI 2 "reg_or_0_operand" "dJ,0")
9209 (match_operand:DI 3 "reg_or_0_operand" "0,dJ")))]
9210 "(ISA_HAS_CONDMOVE || ISA_HAS_INT_CONDMOVE) && TARGET_64BIT"
9214 [(set_attr "type" "move")
9215 (set_attr "mode" "DI")])
9218 [(set (match_operand:DI 0 "register_operand" "=d,d")
9220 (match_operator 3 "equality_op" [(match_operand:CC 4
9224 (match_operand:DI 1 "reg_or_0_operand" "dJ,0")
9225 (match_operand:DI 2 "reg_or_0_operand" "0,dJ")))]
9226 "ISA_HAS_CONDMOVE && TARGET_HARD_FLOAT && TARGET_64BIT"
9230 [(set_attr "type" "move")
9231 (set_attr "mode" "DI")])
9234 [(set (match_operand:SF 0 "register_operand" "=f,f")
9236 (match_operator 4 "equality_op"
9237 [(match_operand:SI 1 "register_operand" "d,d")
9239 (match_operand:SF 2 "register_operand" "f,0")
9240 (match_operand:SF 3 "register_operand" "0,f")))]
9241 "ISA_HAS_CONDMOVE && TARGET_HARD_FLOAT"
9244 mov%b4.s\\t%0,%3,%1"
9245 [(set_attr "type" "move")
9246 (set_attr "mode" "SF")])
9249 [(set (match_operand:SF 0 "register_operand" "=f,f")
9251 (match_operator 4 "equality_op"
9252 [(match_operand:DI 1 "register_operand" "d,d")
9254 (match_operand:SF 2 "register_operand" "f,0")
9255 (match_operand:SF 3 "register_operand" "0,f")))]
9256 "ISA_HAS_CONDMOVE && TARGET_HARD_FLOAT"
9259 mov%b4.s\\t%0,%3,%1"
9260 [(set_attr "type" "move")
9261 (set_attr "mode" "SF")])
9264 [(set (match_operand:SF 0 "register_operand" "=f,f")
9266 (match_operator 3 "equality_op" [(match_operand:CC 4
9270 (match_operand:SF 1 "register_operand" "f,0")
9271 (match_operand:SF 2 "register_operand" "0,f")))]
9272 "ISA_HAS_CONDMOVE && TARGET_HARD_FLOAT"
9275 mov%t3.s\\t%0,%2,%4"
9276 [(set_attr "type" "move")
9277 (set_attr "mode" "SF")])
9280 [(set (match_operand:DF 0 "register_operand" "=f,f")
9282 (match_operator 4 "equality_op"
9283 [(match_operand:SI 1 "register_operand" "d,d")
9285 (match_operand:DF 2 "register_operand" "f,0")
9286 (match_operand:DF 3 "register_operand" "0,f")))]
9287 "ISA_HAS_CONDMOVE && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
9290 mov%b4.d\\t%0,%3,%1"
9291 [(set_attr "type" "move")
9292 (set_attr "mode" "DF")])
9295 [(set (match_operand:DF 0 "register_operand" "=f,f")
9297 (match_operator 4 "equality_op"
9298 [(match_operand:DI 1 "register_operand" "d,d")
9300 (match_operand:DF 2 "register_operand" "f,0")
9301 (match_operand:DF 3 "register_operand" "0,f")))]
9302 "ISA_HAS_CONDMOVE && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
9305 mov%b4.d\\t%0,%3,%1"
9306 [(set_attr "type" "move")
9307 (set_attr "mode" "DF")])
9310 [(set (match_operand:DF 0 "register_operand" "=f,f")
9312 (match_operator 3 "equality_op" [(match_operand:CC 4
9316 (match_operand:DF 1 "register_operand" "f,0")
9317 (match_operand:DF 2 "register_operand" "0,f")))]
9318 "ISA_HAS_CONDMOVE && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
9321 mov%t3.d\\t%0,%2,%4"
9322 [(set_attr "type" "move")
9323 (set_attr "mode" "DF")])
9325 ;; These are the main define_expand's used to make conditional moves.
9327 (define_expand "movsicc"
9328 [(set (match_dup 4) (match_operand 1 "comparison_operator" ""))
9329 (set (match_operand:SI 0 "register_operand" "")
9330 (if_then_else:SI (match_dup 5)
9331 (match_operand:SI 2 "reg_or_0_operand" "")
9332 (match_operand:SI 3 "reg_or_0_operand" "")))]
9333 "ISA_HAS_CONDMOVE || ISA_HAS_INT_CONDMOVE"
9336 gen_conditional_move (operands);
9340 (define_expand "movdicc"
9341 [(set (match_dup 4) (match_operand 1 "comparison_operator" ""))
9342 (set (match_operand:DI 0 "register_operand" "")
9343 (if_then_else:DI (match_dup 5)
9344 (match_operand:DI 2 "reg_or_0_operand" "")
9345 (match_operand:DI 3 "reg_or_0_operand" "")))]
9346 "(ISA_HAS_CONDMOVE || ISA_HAS_INT_CONDMOVE) && TARGET_64BIT"
9349 gen_conditional_move (operands);
9353 (define_expand "movsfcc"
9354 [(set (match_dup 4) (match_operand 1 "comparison_operator" ""))
9355 (set (match_operand:SF 0 "register_operand" "")
9356 (if_then_else:SF (match_dup 5)
9357 (match_operand:SF 2 "register_operand" "")
9358 (match_operand:SF 3 "register_operand" "")))]
9359 "ISA_HAS_CONDMOVE && TARGET_HARD_FLOAT"
9362 gen_conditional_move (operands);
9366 (define_expand "movdfcc"
9367 [(set (match_dup 4) (match_operand 1 "comparison_operator" ""))
9368 (set (match_operand:DF 0 "register_operand" "")
9369 (if_then_else:DF (match_dup 5)
9370 (match_operand:DF 2 "register_operand" "")
9371 (match_operand:DF 3 "register_operand" "")))]
9372 "ISA_HAS_CONDMOVE && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
9375 gen_conditional_move (operands);
9380 ;; ....................
9382 ;; mips16 inline constant tables
9384 ;; ....................
9387 (define_insn "consttable_qi"
9388 [(unspec_volatile [(match_operand:QI 0 "consttable_operand" "=g")]
9389 UNSPEC_CONSTTABLE_QI)]
9393 assemble_integer (operands[0], 1, BITS_PER_UNIT, 1);
9396 [(set_attr "type" "unknown")
9397 (set_attr "mode" "QI")
9398 (set_attr "length" "8")])
9400 (define_insn "consttable_hi"
9401 [(unspec_volatile [(match_operand:HI 0 "consttable_operand" "=g")]
9402 UNSPEC_CONSTTABLE_HI)]
9406 assemble_integer (operands[0], 2, BITS_PER_UNIT * 2, 1);
9409 [(set_attr "type" "unknown")
9410 (set_attr "mode" "HI")
9411 (set_attr "length" "8")])
9413 (define_insn "consttable_si"
9414 [(unspec_volatile [(match_operand:SI 0 "consttable_operand" "=g")]
9415 UNSPEC_CONSTTABLE_SI)]
9419 assemble_integer (operands[0], 4, BITS_PER_UNIT * 4, 1);
9422 [(set_attr "type" "unknown")
9423 (set_attr "mode" "SI")
9424 (set_attr "length" "8")])
9426 (define_insn "consttable_di"
9427 [(unspec_volatile [(match_operand:DI 0 "consttable_operand" "=g")]
9428 UNSPEC_CONSTTABLE_DI)]
9432 assemble_integer (operands[0], 8, BITS_PER_UNIT * 8, 1);
9435 [(set_attr "type" "unknown")
9436 (set_attr "mode" "DI")
9437 (set_attr "length" "16")])
9439 (define_insn "consttable_sf"
9440 [(unspec_volatile [(match_operand:SF 0 "consttable_operand" "=g")]
9441 UNSPEC_CONSTTABLE_SF)]
9447 if (GET_CODE (operands[0]) != CONST_DOUBLE)
9449 REAL_VALUE_FROM_CONST_DOUBLE (d, operands[0]);
9450 assemble_real (d, SFmode, GET_MODE_ALIGNMENT (SFmode));
9453 [(set_attr "type" "unknown")
9454 (set_attr "mode" "SF")
9455 (set_attr "length" "8")])
9457 (define_insn "consttable_df"
9458 [(unspec_volatile [(match_operand:DF 0 "consttable_operand" "=g")]
9459 UNSPEC_CONSTTABLE_DF)]
9465 if (GET_CODE (operands[0]) != CONST_DOUBLE)
9467 REAL_VALUE_FROM_CONST_DOUBLE (d, operands[0]);
9468 assemble_real (d, DFmode, GET_MODE_ALIGNMENT (DFmode));
9471 [(set_attr "type" "unknown")
9472 (set_attr "mode" "DF")
9473 (set_attr "length" "16")])
9475 (define_insn "align_2"
9476 [(unspec_volatile [(const_int 0)] UNSPEC_ALIGN_2)]
9479 [(set_attr "type" "unknown")
9480 (set_attr "mode" "HI")
9481 (set_attr "length" "8")])
9483 (define_insn "align_4"
9484 [(unspec_volatile [(const_int 0)] UNSPEC_ALIGN_4)]
9487 [(set_attr "type" "unknown")
9488 (set_attr "mode" "SI")
9489 (set_attr "length" "8")])
9491 (define_insn "align_8"
9492 [(unspec_volatile [(const_int 0)] UNSPEC_ALIGN_8)]
9495 [(set_attr "type" "unknown")
9496 (set_attr "mode" "DI")
9497 (set_attr "length" "12")])
9500 ;; ....................
9504 ;; ....................
9507 ;; On the mips16, reload will sometimes decide that a pseudo register
9508 ;; should go into $24, and then later on have to reload that register.
9509 ;; When that happens, we get a load of a general register followed by
9510 ;; a move from the general register to $24 followed by a branch.
9511 ;; These peepholes catch the common case, and fix it to just use the
9512 ;; general register for the branch.
9515 [(set (match_operand:SI 0 "register_operand" "=t")
9516 (match_operand:SI 1 "register_operand" "d"))
9518 (if_then_else (match_operator:SI 2 "equality_op" [(match_dup 0)
9520 (match_operand 3 "pc_or_label_operand" "")
9521 (match_operand 4 "pc_or_label_operand" "")))]
9523 && GET_CODE (operands[0]) == REG
9524 && REGNO (operands[0]) == 24
9525 && dead_or_set_p (insn, operands[0])
9526 && GET_CODE (operands[1]) == REG
9527 && M16_REG_P (REGNO (operands[1]))"
9530 if (operands[3] != pc_rtx)
9531 return \"b%C2z\\t%1,%3\";
9533 return \"b%N2z\\t%1,%4\";
9535 [(set_attr "type" "branch")
9536 (set_attr "mode" "none")
9537 (set_attr "length" "8")])
9540 [(set (match_operand:DI 0 "register_operand" "=t")
9541 (match_operand:DI 1 "register_operand" "d"))
9543 (if_then_else (match_operator:DI 2 "equality_op" [(match_dup 0)
9545 (match_operand 3 "pc_or_label_operand" "")
9546 (match_operand 4 "pc_or_label_operand" "")))]
9547 "TARGET_MIPS16 && TARGET_64BIT
9548 && GET_CODE (operands[0]) == REG
9549 && REGNO (operands[0]) == 24
9550 && dead_or_set_p (insn, operands[0])
9551 && GET_CODE (operands[1]) == REG
9552 && M16_REG_P (REGNO (operands[1]))"
9555 if (operands[3] != pc_rtx)
9556 return \"b%C2z\\t%1,%3\";
9558 return \"b%N2z\\t%1,%4\";
9560 [(set_attr "type" "branch")
9561 (set_attr "mode" "none")
9562 (set_attr "length" "8")])
9564 ;; We can also have the reverse reload: reload will spill $24 into
9565 ;; another register, and then do a branch on that register when it
9566 ;; could have just stuck with $24.
9569 [(set (match_operand:SI 0 "register_operand" "=d")
9570 (match_operand:SI 1 "register_operand" "t"))
9572 (if_then_else (match_operator:SI 2 "equality_op" [(match_dup 0)
9574 (match_operand 3 "pc_or_label_operand" "")
9575 (match_operand 4 "pc_or_label_operand" "")))]
9577 && GET_CODE (operands[1]) == REG
9578 && REGNO (operands[1]) == 24
9579 && GET_CODE (operands[0]) == REG
9580 && M16_REG_P (REGNO (operands[0]))
9581 && dead_or_set_p (insn, operands[0])"
9584 if (operands[3] != pc_rtx)
9585 return \"bt%C2z\\t%3\";
9587 return \"bt%N2z\\t%4\";
9589 [(set_attr "type" "branch")
9590 (set_attr "mode" "none")
9591 (set_attr "length" "8")])
9594 [(set (match_operand:DI 0 "register_operand" "=d")
9595 (match_operand:DI 1 "register_operand" "t"))
9597 (if_then_else (match_operator:DI 2 "equality_op" [(match_dup 0)
9599 (match_operand 3 "pc_or_label_operand" "")
9600 (match_operand 4 "pc_or_label_operand" "")))]
9601 "TARGET_MIPS16 && TARGET_64BIT
9602 && GET_CODE (operands[1]) == REG
9603 && REGNO (operands[1]) == 24
9604 && GET_CODE (operands[0]) == REG
9605 && M16_REG_P (REGNO (operands[0]))
9606 && dead_or_set_p (insn, operands[0])"
9609 if (operands[3] != pc_rtx)
9610 return \"bt%C2z\\t%3\";
9612 return \"bt%N2z\\t%4\";
9614 [(set_attr "type" "branch")
9615 (set_attr "mode" "none")
9616 (set_attr "length" "8")])