1 ;; Mips.md Machine Description for MIPS based processors
2 ;; Contributed by A. Lichnewsky, lich@inria.inria.fr
3 ;; Changes by Michael Meissner, meissner@osf.org
4 ;;
64 bit r4000 support by Ian Lance Taylor, ian@cygnus.com, and
5 ;; Brendan Eich, brendan@microunity.com.
6 ;; Copyright (C)
1989,
90-
97,
1998 Free Software Foundation, Inc.
8 ;; This file is part of GNU CC.
10 ;; GNU CC is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version
2, or (at your option)
15 ;; GNU CC is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU CC; see the file COPYING. If not, write to
22 ;; the Free Software Foundation,
59 Temple Place - Suite
330,
23 ;; Boston, MA
02111-
1307, USA.
25 ;; ??? Currently does not have define_function_unit support for the R8000.
26 ;; Must include new entries for fmadd in addition to existing entries.
30 ;; ....................
34 ;; ....................
36 ;; Classification of each insn.
37 ;; branch conditional branch
38 ;; jump unconditional jump
39 ;; call unconditional call
40 ;; load load instruction(s)
41 ;; store store instruction(s)
42 ;; move data movement within same register set
43 ;; xfer transfer to/from coprocessor
44 ;; hilo transfer of hi/lo registers
45 ;; arith integer arithmetic instruction
46 ;; darith double precision integer arithmetic instructions
47 ;; imul integer multiply
48 ;; idiv integer divide
49 ;; icmp integer compare
50 ;; fadd floating point add/subtract
51 ;; fmul floating point multiply
52 ;; fmadd floating point multiply-add
53 ;; fdiv floating point divide
54 ;; fabs floating point absolute value
55 ;; fneg floating point negation
56 ;; fcmp floating point compare
57 ;; fcvt floating point convert
58 ;; fsqrt floating point square root
59 ;; multi multiword sequence (or user asm statements)
63 "unknown,branch,jump,call,load,store,move,xfer,hilo,arith,darith,imul,idiv,icmp,fadd,fmul,fmadd,fdiv,fabs,fneg,fcmp,fcvt,fsqrt,multi,nop"
64 (const_string "unknown"))
66 ;; Main data type used by the insn
67 (define_attr "mode" "unknown,none,QI,HI,SI,DI,SF,DF,FPSW" (const_string "unknown"))
69 ;; # instructions (
4 bytes each)
70 (define_attr "length" "" (const_int
1))
72 ;; whether or not an instruction has a mandatory delay slot
73 (define_attr "dslot" "no,yes"
74 (if_then_else (ior (eq_attr "type" "branch,jump,call,xfer,hilo,fcmp")
75 (and (eq_attr "type" "load")
76 (and (eq (symbol_ref "mips_isa") (const_int
1))
77 (eq (symbol_ref "mips16") (const_int
0)))))
81 ;; Attribute describing the processor. This attribute must match exactly
82 ;; with the processor_type enumeration in mips.h.
84 ;; Attribute describing the processor
85 ;; (define_attr "cpu" "default,r3000,r6000,r4000"
87 ;; (cond [(eq (symbol_ref "mips_cpu") (symbol_ref "PROCESSOR_R3000")) (const_string "r3000")
88 ;; (eq (symbol_ref "mips_cpu") (symbol_ref "PROCESSOR_R4000")) (const_string "r4000")
89 ;; (eq (symbol_ref "mips_cpu") (symbol_ref "PROCESSOR_R6000")) (const_string "r6000")]
90 ;; (const_string "default"))))
92 ;; ??? Fix everything that tests this attribute.
94 "default,r3000,r3900,r6000,r4000,r4100,r4300,r4600,r4650,r5000,r8000"
95 (const (symbol_ref "mips_cpu_attr")))
97 ;; Attribute defining whether or not we can use the branch-likely instructions
99 (define_attr "branch_likely" "no,yes"
101 (if_then_else (ne (symbol_ref "GENERATE_BRANCHLIKELY") (const_int
0))
103 (const_string "no"))))
106 ;; Describe a user's asm statement.
107 (define_asm_attributes
108 [(set_attr "type" "multi")])
110 ;; whether or not generating calls to position independent functions
111 (define_attr "abicalls" "no,yes"
112 (const (symbol_ref "mips_abicalls_attr")))
116 ;; .........................
118 ;; Delay slots, can't describe load/fcmp/xfer delay slots here
120 ;; .........................
122 (define_delay (and (eq_attr "type" "branch")
123 (eq (symbol_ref "mips16") (const_int
0)))
124 [(and (eq_attr "dslot" "no") (eq_attr "length" "
1"))
126 (and (eq_attr "branch_likely" "yes") (and (eq_attr "dslot" "no") (eq_attr "length" "
1")))])
128 (define_delay (eq_attr "type" "jump")
129 [(and (eq_attr "dslot" "no") (eq_attr "length" "
1"))
133 (define_delay (and (eq_attr "type" "call") (eq_attr "abicalls" "no"))
134 [(and (eq_attr "dslot" "no") (eq_attr "length" "
1"))
140 ;; .........................
144 ;; .........................
146 ; (define_function_unit NAME MULTIPLICITY SIMULTANEITY
147 ; TEST READY-DELAY ISSUE-DELAY [CONFLICT-LIST])
149 ;; Make the default case (PROCESSOR_DEFAULT) handle the worst case
151 (define_function_unit "memory"
1 0
152 (and (eq_attr "type" "load")
153 (eq_attr "cpu" "!r3000,r3900,r4600,r4650,r4100,r4300,r5000"))
156 (define_function_unit "memory"
1 0
157 (and (eq_attr "type" "load")
158 (eq_attr "cpu" "r3000,r3900,r4600,r4650,r4100,r4300,r5000"))
161 (define_function_unit "memory"
1 0 (eq_attr "type" "store")
1 0)
163 (define_function_unit "memory"
1 0 (eq_attr "type" "xfer")
2 0)
165 (define_function_unit "imuldiv"
1 0
166 (eq_attr "type" "hilo")
169 (define_function_unit "imuldiv"
1 0
170 (and (eq_attr "type" "imul")
171 (eq_attr "cpu" "!r3000,r3900,r4000,r4600,r4650,r4100,r4300,r5000"))
174 ;; On them mips16, we want to stronly discourage a mult from appearing
175 ;; after an mflo, since that requires explicit nop instructions. We
176 ;; do this by pretending that mflo ties up the function unit for long
177 ;; enough that the scheduler will ignore load stalls and the like when
178 ;; selecting instructions to between the two instructions.
180 (define_function_unit "imuldiv"
1 0
181 (and (eq_attr "type" "hilo") (ne (symbol_ref "mips16") (const_int
0)))
184 (define_function_unit "imuldiv"
1 0
185 (and (eq_attr "type" "imul") (eq_attr "cpu" "r3000,r3900"))
188 (define_function_unit "imuldiv"
1 0
189 (and (eq_attr "type" "imul") (eq_attr "cpu" "r4000,r4600"))
192 (define_function_unit "imuldiv"
1 0
193 (and (eq_attr "type" "imul") (eq_attr "cpu" "r4650"))
196 (define_function_unit "imuldiv"
1 0
197 (and (eq_attr "type" "imul")
198 (and (eq_attr "mode" "SI") (eq_attr "cpu" "r4100")))
201 (define_function_unit "imuldiv"
1 0
202 (and (eq_attr "type" "imul")
203 (and (eq_attr "mode" "DI") (eq_attr "cpu" "r4100")))
206 (define_function_unit "imuldiv"
1 0
207 (and (eq_attr "type" "imul")
208 (and (eq_attr "mode" "SI") (eq_attr "cpu" "r4300,r5000")))
211 (define_function_unit "imuldiv"
1 0
212 (and (eq_attr "type" "imul")
213 (and (eq_attr "mode" "DI") (eq_attr "cpu" "r4300")))
216 (define_function_unit "imuldiv"
1 0
217 (and (eq_attr "type" "imul")
218 (and (eq_attr "mode" "DI") (eq_attr "cpu" "r5000")))
221 (define_function_unit "imuldiv"
1 0
222 (and (eq_attr "type" "idiv")
223 (eq_attr "cpu" "!r3000,r3900,r4000,r4600,r4650,r4100,r4300,r5000"))
226 (define_function_unit "imuldiv"
1 0
227 (and (eq_attr "type" "idiv") (eq_attr "cpu" "r3000,r3900"))
230 (define_function_unit "imuldiv"
1 0
231 (and (eq_attr "type" "idiv") (eq_attr "cpu" "r4600"))
234 (define_function_unit "imuldiv"
1 0
235 (and (eq_attr "type" "idiv") (eq_attr "cpu" "r4650"))
238 (define_function_unit "imuldiv"
1 0
239 (and (eq_attr "type" "idiv") (eq_attr "cpu" "r4000"))
242 (define_function_unit "imuldiv"
1 0
243 (and (eq_attr "type" "idiv")
244 (and (eq_attr "mode" "SI") (eq_attr "cpu" "r4100")))
247 (define_function_unit "imuldiv"
1 0
248 (and (eq_attr "type" "idiv")
249 (and (eq_attr "mode" "DI") (eq_attr "cpu" "r4100")))
252 (define_function_unit "imuldiv"
1 0
253 (and (eq_attr "type" "idiv")
254 (and (eq_attr "mode" "SI") (eq_attr "cpu" "r4300")))
257 (define_function_unit "imuldiv"
1 0
258 (and (eq_attr "type" "idiv")
259 (and (eq_attr "mode" "DI") (eq_attr "cpu" "r4300")))
262 (define_function_unit "imuldiv"
1 0
263 (and (eq_attr "type" "idiv")
264 (and (eq_attr "mode" "SI") (eq_attr "cpu" "r5000")))
267 (define_function_unit "imuldiv"
1 0
268 (and (eq_attr "type" "idiv")
269 (and (eq_attr "mode" "DI") (eq_attr "cpu" "r5000")))
272 ;; The R4300 does *NOT* have a separate Floating Point Unit, instead
273 ;; the FP hardware is part of the normal ALU circuitry. This means FP
274 ;; instructions affect the pipe-line, and no functional unit
275 ;; parallelism can occur on R4300 processors. To force GCC into coding
276 ;; for only a single functional unit, we force the R4300 FP
277 ;; instructions to be processed in the "imuldiv" unit.
279 (define_function_unit "adder"
1 1
280 (and (eq_attr "type" "fcmp") (eq_attr "cpu" "!r3000,r3900,r6000,r4300,r5000"))
283 (define_function_unit "adder"
1 1
284 (and (eq_attr "type" "fcmp") (eq_attr "cpu" "r3000,r3900,r6000"))
287 (define_function_unit "adder"
1 1
288 (and (eq_attr "type" "fcmp") (eq_attr "cpu" "r5000"))
291 (define_function_unit "adder"
1 1
292 (and (eq_attr "type" "fadd") (eq_attr "cpu" "!r3000,r3900,r6000,r4300"))
295 (define_function_unit "adder"
1 1
296 (and (eq_attr "type" "fadd") (eq_attr "cpu" "r3000,r3900"))
299 (define_function_unit "adder"
1 1
300 (and (eq_attr "type" "fadd") (eq_attr "cpu" "r6000"))
303 (define_function_unit "adder"
1 1
304 (and (eq_attr "type" "fabs,fneg")
305 (eq_attr "cpu" "!r3000,r3900,r4600,r4650,r4300,r5000"))
308 (define_function_unit "adder"
1 1
309 (and (eq_attr "type" "fabs,fneg") (eq_attr "cpu" "r3000,r3900,r4600,r4650,r5000"))
312 (define_function_unit "mult"
1 1
313 (and (eq_attr "type" "fmul")
314 (and (eq_attr "mode" "SF")
315 (eq_attr "cpu" "!r3000,r3900,r6000,r4600,r4650,r4300,r5000")))
318 (define_function_unit "mult"
1 1
319 (and (eq_attr "type" "fmul")
320 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r3000,r3900,r5000")))
323 (define_function_unit "mult"
1 1
324 (and (eq_attr "type" "fmul")
325 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r6000")))
328 (define_function_unit "mult"
1 1
329 (and (eq_attr "type" "fmul")
330 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r4600,r4650")))
333 (define_function_unit "mult"
1 1
334 (and (eq_attr "type" "fmul")
335 (and (eq_attr "mode" "DF") (eq_attr "cpu" "!r3000,r3900,r6000,r4300,r5000")))
338 (define_function_unit "mult"
1 1
339 (and (eq_attr "type" "fmul")
340 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r3000,r3900,r5000")))
343 (define_function_unit "mult"
1 1
344 (and (eq_attr "type" "fmul")
345 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r6000")))
348 (define_function_unit "divide"
1 1
349 (and (eq_attr "type" "fdiv")
350 (and (eq_attr "mode" "SF")
351 (eq_attr "cpu" "!r3000,r3900,r6000,r4600,r4650,r4300,r5000")))
354 (define_function_unit "divide"
1 1
355 (and (eq_attr "type" "fdiv")
356 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r3000,r3900")))
359 (define_function_unit "divide"
1 1
360 (and (eq_attr "type" "fdiv")
361 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r6000")))
364 (define_function_unit "divide"
1 1
365 (and (eq_attr "type" "fdiv")
366 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r4600,r4650")))
369 (define_function_unit "divide"
1 1
370 (and (eq_attr "type" "fdiv")
371 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r5000")))
374 (define_function_unit "divide"
1 1
375 (and (eq_attr "type" "fdiv")
376 (and (eq_attr "mode" "DF")
377 (eq_attr "cpu" "!r3000,r3900,r6000,r4600,r4650,r4300")))
380 (define_function_unit "divide"
1 1
381 (and (eq_attr "type" "fdiv")
382 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r3000,r3900")))
385 (define_function_unit "divide"
1 1
386 (and (eq_attr "type" "fdiv")
387 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r6000")))
390 (define_function_unit "divide"
1 1
391 (and (eq_attr "type" "fdiv")
392 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r4600,r4650")))
395 ;;; ??? Is this number right?
396 (define_function_unit "divide"
1 1
397 (and (eq_attr "type" "fsqrt")
398 (and (eq_attr "mode" "SF") (eq_attr "cpu" "!r4600,r4650,r4300,r5000")))
401 (define_function_unit "divide"
1 1
402 (and (eq_attr "type" "fsqrt")
403 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r4600,r4650")))
406 (define_function_unit "divide"
1 1
407 (and (eq_attr "type" "fsqrt")
408 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r5000")))
411 ;;; ??? Is this number right?
412 (define_function_unit "divide"
1 1
413 (and (eq_attr "type" "fsqrt")
414 (and (eq_attr "mode" "DF") (eq_attr "cpu" "!r4600,r4650,r4300,r5000")))
417 (define_function_unit "divide"
1 1
418 (and (eq_attr "type" "fsqrt")
419 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r4600,r4650")))
422 (define_function_unit "divide"
1 1
423 (and (eq_attr "type" "fsqrt")
424 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r5000")))
427 ;; R4300 FP instruction classes treated as part of the "imuldiv"
430 (define_function_unit "imuldiv"
1 0
431 (and (eq_attr "type" "fadd") (eq_attr "cpu" "r4300"))
434 (define_function_unit "imuldiv"
1 0
435 (and (eq_attr "type" "fcmp,fabs,fneg") (eq_attr "cpu" "r4300"))
438 (define_function_unit "imuldiv"
1 0
439 (and (eq_attr "type" "fmul") (and (eq_attr "mode" "SF") (eq_attr "cpu" "r4300")))
441 (define_function_unit "imuldiv"
1 0
442 (and (eq_attr "type" "fmul") (and (eq_attr "mode" "DF") (eq_attr "cpu" "r4300")))
445 (define_function_unit "imuldiv"
1 0
446 (and (and (eq_attr "type" "fdiv") (eq_attr "type" "fsqrt"))
447 (and (eq_attr "mode" "SF") (eq_attr "cpu" "r4300")))
449 (define_function_unit "imuldiv"
1 0
450 (and (and (eq_attr "type" "fdiv") (eq_attr "type" "fsqrt"))
451 (and (eq_attr "mode" "DF") (eq_attr "cpu" "r4300")))
454 ;; The following functional units do not use the cpu type, and use
455 ;; much less memory in genattrtab.c.
457 ;; (define_function_unit "memory"
1 0 (eq_attr "type" "load")
3 0)
458 ;; (define_function_unit "memory"
1 0 (eq_attr "type" "store")
1 0)
460 ;; (define_function_unit "fp_comp"
1 0 (eq_attr "type" "fcmp")
2 0)
462 ;; (define_function_unit "transfer"
1 0 (eq_attr "type" "xfer")
2 0)
463 ;; (define_function_unit "transfer"
1 0 (eq_attr "type" "hilo")
3 0)
465 ;; (define_function_unit "imuldiv"
1 1 (eq_attr "type" "imul")
17 0)
466 ;; (define_function_unit "imuldiv"
1 1 (eq_attr "type" "idiv")
38 0)
468 ;; (define_function_unit "adder"
1 1 (eq_attr "type" "fadd")
4 0)
469 ;; (define_function_unit "adder"
1 1 (eq_attr "type" "fabs,fneg")
2 0)
471 ;; (define_function_unit "mult"
1 1 (and (eq_attr "type" "fmul") (eq_attr "mode" "SF"))
7 0)
472 ;; (define_function_unit "mult"
1 1 (and (eq_attr "type" "fmul") (eq_attr "mode" "DF"))
8 0)
474 ;; (define_function_unit "divide"
1 1 (and (eq_attr "type" "fdiv") (eq_attr "mode" "SF"))
23 0)
475 ;; (define_function_unit "divide"
1 1 (and (eq_attr "type" "fdiv") (eq_attr "mode" "DF"))
36 0)
477 ;; (define_function_unit "sqrt"
1 1 (and (eq_attr "type" "fsqrt") (eq_attr "mode" "SF"))
54 0)
478 ;; (define_function_unit "sqrt"
1 1 (and (eq_attr "type" "fsqrt") (eq_attr "mode" "DF"))
112 0)
482 ;; ....................
486 ;; ....................
489 (define_insn "adddf3"
490 [(set (match_operand:DF
0 "register_operand" "=f")
491 (plus:DF (match_operand:DF
1 "register_operand" "f")
492 (match_operand:DF
2 "register_operand" "f")))]
493 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
495 [(set_attr "type" "fadd")
496 (set_attr "mode" "DF")
497 (set_attr "length" "
1")])
499 (define_insn "addsf3"
500 [(set (match_operand:SF
0 "register_operand" "=f")
501 (plus:SF (match_operand:SF
1 "register_operand" "f")
502 (match_operand:SF
2 "register_operand" "f")))]
505 [(set_attr "type" "fadd")
506 (set_attr "mode" "SF")
507 (set_attr "length" "
1")])
509 (define_expand "addsi3"
510 [(set (match_operand:SI
0 "register_operand" "=d")
511 (plus:SI (match_operand:SI
1 "reg_or_0_operand" "dJ")
512 (match_operand:SI
2 "arith_operand" "dI")))]
516 /* The mips16 assembler handles -
32768 correctly, and so does gas,
517 but some other MIPS assemblers think that -
32768 needs to be
518 loaded into a register before it can be added in. */
521 && GET_CODE (operands[
2]) == CONST_INT
522 && INTVAL (operands[
2]) == -
32768)
523 operands[
2] = force_reg (SImode, operands[
2]);
526 (define_insn "addsi3_internal"
527 [(set (match_operand:SI
0 "register_operand" "=d")
528 (plus:SI (match_operand:SI
1 "reg_or_0_operand" "dJ")
529 (match_operand:SI
2 "arith_operand" "dI")))]
532 || GET_CODE (operands[
2]) != CONST_INT
533 || INTVAL (operands[
2]) != -
32768)"
535 [(set_attr "type" "arith")
536 (set_attr "mode" "SI")
537 (set_attr "length" "
1")])
539 ;; For the mips16, we need to recognize stack pointer additions
540 ;; explicitly, since we don't have a constraint for $sp. These insns
541 ;; will be generated by the save_restore_insns functions.
546 (match_operand:SI
0 "small_int" "I")))]
549 [(set_attr "type" "arith")
550 (set_attr "mode" "SI")
551 (set (attr "length") (if_then_else (match_operand:VOID
0 "m16_simm8_8" "")
556 [(set (match_operand:SI
0 "register_operand" "=d")
558 (match_operand:SI
1 "small_int" "I")))]
561 [(set_attr "type" "arith")
562 (set_attr "mode" "SI")
563 (set (attr "length") (if_then_else (match_operand:VOID
1 "m16_uimm8_4" "")
568 [(set (match_operand:SI
0 "register_operand" "=d,d,d")
569 (plus:SI (match_operand:SI
1 "register_operand" "
0,d,d")
570 (match_operand:SI
2 "arith_operand" "IQ,O,d")))]
572 && (GET_CODE (operands[
1]) != REG
573 || REGNO (operands[
1]) >= FIRST_PSEUDO_REGISTER
574 || M16_REG_P (REGNO (operands[
1]))
575 || REGNO (operands[
1]) == ARG_POINTER_REGNUM
576 || REGNO (operands[
1]) == FRAME_POINTER_REGNUM
577 || REGNO (operands[
1]) == STACK_POINTER_REGNUM)
578 && (GET_CODE (operands[
2]) != REG
579 || REGNO (operands[
2]) >= FIRST_PSEUDO_REGISTER
580 || M16_REG_P (REGNO (operands[
2]))
581 || REGNO (operands[
2]) == ARG_POINTER_REGNUM
582 || REGNO (operands[
2]) == FRAME_POINTER_REGNUM
583 || REGNO (operands[
2]) == STACK_POINTER_REGNUM)"
586 if (REGNO (operands[
0]) == REGNO (operands[
1]))
587 return
\"addu
\\t%
0,%
2\";
588 return
\"addu
\\t%
0,%
1,%
2\";
590 [(set_attr "type" "arith")
591 (set_attr "mode" "SI")
592 (set_attr_alternative "length"
593 [(if_then_else (match_operand:VOID
2 "m16_simm8_1" "")
596 (if_then_else (match_operand:VOID
2 "m16_simm4_1" "")
602 ;; On the mips16, we can sometimes split an add of a constant which is
603 ;; a
4 byte instruction into two adds which are both
2 byte
604 ;; instructions. There are two cases: one where we are adding a
605 ;; constant plus a register to another register, and one where we are
606 ;; simply adding a constant to a register.
609 [(set (match_operand:SI
0 "register_operand" "")
610 (plus:SI (match_dup
0)
611 (match_operand:SI
1 "const_int_operand" "")))]
612 "TARGET_MIPS16 && reload_completed
613 && GET_CODE (operands[
0]) == REG
614 && M16_REG_P (REGNO (operands[
0]))
615 && GET_CODE (operands[
1]) == CONST_INT
616 && ((INTVAL (operands[
1]) >
0x7f
617 && INTVAL (operands[
1]) <=
0x7f +
0x7f)
618 || (INTVAL (operands[
1]) < -
0x80
619 && INTVAL (operands[
1]) >= -
0x80 -
0x80))"
620 [(set (match_dup
0) (plus:SI (match_dup
0) (match_dup
1)))
621 (set (match_dup
0) (plus:SI (match_dup
0) (match_dup
2)))]
624 HOST_WIDE_INT val = INTVAL (operands[
1]);
628 operands[
1] = GEN_INT (
0x7f);
629 operands[
2] = GEN_INT (val -
0x7f);
633 operands[
1] = GEN_INT (-
0x80);
634 operands[
2] = GEN_INT (val +
0x80);
639 [(set (match_operand:SI
0 "register_operand" "")
640 (plus:SI (match_operand:SI
1 "register_operand" "")
641 (match_operand:SI
2 "const_int_operand" "")))]
642 "TARGET_MIPS16 && reload_completed
643 && GET_CODE (operands[
0]) == REG
644 && M16_REG_P (REGNO (operands[
0]))
645 && GET_CODE (operands[
1]) == REG
646 && M16_REG_P (REGNO (operands[
1]))
647 && REGNO (operands[
0]) != REGNO (operands[
1])
648 && GET_CODE (operands[
2]) == CONST_INT
649 && ((INTVAL (operands[
2]) >
0x7
650 && INTVAL (operands[
2]) <=
0x7 +
0x7f)
651 || (INTVAL (operands[
2]) < -
0x8
652 && INTVAL (operands[
2]) >= -
0x8 -
0x80))"
653 [(set (match_dup
0) (plus:SI (match_dup
1) (match_dup
2)))
654 (set (match_dup
0) (plus:SI (match_dup
0) (match_dup
3)))]
657 HOST_WIDE_INT val = INTVAL (operands[
2]);
661 operands[
2] = GEN_INT (
0x7);
662 operands[
3] = GEN_INT (val -
0x7);
666 operands[
2] = GEN_INT (-
0x8);
667 operands[
3] = GEN_INT (val +
0x8);
671 (define_expand "adddi3"
672 [(parallel [(set (match_operand:DI
0 "register_operand" "")
673 (plus:DI (match_operand:DI
1 "se_register_operand" "")
674 (match_operand:DI
2 "se_arith_operand" "")))
675 (clobber (match_dup
3))])]
676 "TARGET_64BIT || (!TARGET_DEBUG_G_MODE && !TARGET_MIPS16)"
679 /* The mips16 assembler handles -
32768 correctly, and so does gas,
680 but some other MIPS assemblers think that -
32768 needs to be
681 loaded into a register before it can be added in. */
684 && GET_CODE (operands[
2]) == CONST_INT
685 && INTVAL (operands[
2]) == -
32768)
686 operands[
2] = force_reg (DImode, operands[
2]);
690 emit_insn (gen_adddi3_internal_3 (operands[
0], operands[
1],
695 operands[
3] = gen_reg_rtx (SImode);
698 (define_insn "adddi3_internal_1"
699 [(set (match_operand:DI
0 "register_operand" "=d,&d")
700 (plus:DI (match_operand:DI
1 "register_operand" "
0,d")
701 (match_operand:DI
2 "register_operand" "d,d")))
702 (clobber (match_operand:SI
3 "register_operand" "=d,d"))]
703 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16"
706 return (REGNO (operands[
0]) == REGNO (operands[
1])
707 && REGNO (operands[
0]) == REGNO (operands[
2]))
708 ?
\"srl
\\t%
3,%L0,
31\;sll
\\t%M0,%M0,
1\;sll
\\t%L0,%L1,
1\;addu
\\t%M0,%M0,%
3\"
709 :
\"addu
\\t%L0,%L1,%L2\;sltu
\\t%
3,%L0,%L2\;addu
\\t%M0,%M1,%M2\;addu
\\t%M0,%M0,%
3\";
711 [(set_attr "type" "darith")
712 (set_attr "mode" "DI")
713 (set_attr "length" "
4")])
716 [(set (match_operand:DI
0 "register_operand" "")
717 (plus:DI (match_operand:DI
1 "register_operand" "")
718 (match_operand:DI
2 "register_operand" "")))
719 (clobber (match_operand:SI
3 "register_operand" ""))]
720 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT
721 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
722 && GET_CODE (operands[
0]) == REG && GP_REG_P (REGNO (operands[
0]))
723 && GET_CODE (operands[
1]) == REG && GP_REG_P (REGNO (operands[
1]))
724 && GET_CODE (operands[
2]) == REG && GP_REG_P (REGNO (operands[
2]))
725 && (REGNO (operands[
0]) != REGNO (operands[
1])
726 || REGNO (operands[
0]) != REGNO (operands[
2]))"
728 [(set (subreg:SI (match_dup
0)
0)
729 (plus:SI (subreg:SI (match_dup
1)
0)
730 (subreg:SI (match_dup
2)
0)))
733 (ltu:SI (subreg:SI (match_dup
0)
0)
734 (subreg:SI (match_dup
2)
0)))
736 (set (subreg:SI (match_dup
0)
1)
737 (plus:SI (subreg:SI (match_dup
1)
1)
738 (subreg:SI (match_dup
2)
1)))
740 (set (subreg:SI (match_dup
0)
1)
741 (plus:SI (subreg:SI (match_dup
0)
1)
746 [(set (match_operand:DI
0 "register_operand" "")
747 (plus:DI (match_operand:DI
1 "register_operand" "")
748 (match_operand:DI
2 "register_operand" "")))
749 (clobber (match_operand:SI
3 "register_operand" ""))]
750 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT
751 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
752 && GET_CODE (operands[
0]) == REG && GP_REG_P (REGNO (operands[
0]))
753 && GET_CODE (operands[
1]) == REG && GP_REG_P (REGNO (operands[
1]))
754 && GET_CODE (operands[
2]) == REG && GP_REG_P (REGNO (operands[
2]))
755 && (REGNO (operands[
0]) != REGNO (operands[
1])
756 || REGNO (operands[
0]) != REGNO (operands[
2]))"
758 [(set (subreg:SI (match_dup
0)
1)
759 (plus:SI (subreg:SI (match_dup
1)
1)
760 (subreg:SI (match_dup
2)
1)))
763 (ltu:SI (subreg:SI (match_dup
0)
1)
764 (subreg:SI (match_dup
2)
1)))
766 (set (subreg:SI (match_dup
0)
0)
767 (plus:SI (subreg:SI (match_dup
1)
0)
768 (subreg:SI (match_dup
2)
0)))
770 (set (subreg:SI (match_dup
0)
0)
771 (plus:SI (subreg:SI (match_dup
0)
0)
775 (define_insn "adddi3_internal_2"
776 [(set (match_operand:DI
0 "register_operand" "=d,d,d")
777 (plus:DI (match_operand:DI
1 "register_operand" "%d,%d,%d")
778 (match_operand:DI
2 "small_int" "P,J,N")))
779 (clobber (match_operand:SI
3 "register_operand" "=d,d,d"))]
780 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
781 && INTVAL (operands[
2]) != -
32768"
783 addu
\\t%L0,%L1,%
2\;sltu
\\t%
3,%L0,%
2\;addu
\\t%M0,%M1,%
3
784 move
\\t%L0,%L1\;move
\\t%M0,%M1
785 subu
\\t%L0,%L1,%n2\;sltu
\\t%
3,%L0,%
2\;subu
\\t%M0,%M1,
1\;addu
\\t%M0,%M0,%
3"
786 [(set_attr "type" "darith")
787 (set_attr "mode" "DI")
788 (set_attr "length" "
3,
2,
4")])
791 [(set (match_operand:DI
0 "register_operand" "")
792 (plus:DI (match_operand:DI
1 "register_operand" "")
793 (match_operand:DI
2 "small_int" "")))
794 (clobber (match_operand:SI
3 "register_operand" "=d"))]
795 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT
796 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
797 && GET_CODE (operands[
0]) == REG && GP_REG_P (REGNO (operands[
0]))
798 && GET_CODE (operands[
1]) == REG && GP_REG_P (REGNO (operands[
1]))
799 && INTVAL (operands[
2]) >
0"
801 [(set (subreg:SI (match_dup
0)
0)
802 (plus:SI (subreg:SI (match_dup
1)
0)
806 (ltu:SI (subreg:SI (match_dup
0)
0)
809 (set (subreg:SI (match_dup
0)
1)
810 (plus:SI (subreg:SI (match_dup
1)
1)
815 [(set (match_operand:DI
0 "register_operand" "")
816 (plus:DI (match_operand:DI
1 "register_operand" "")
817 (match_operand:DI
2 "small_int" "")))
818 (clobber (match_operand:SI
3 "register_operand" "=d"))]
819 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT
820 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
821 && GET_CODE (operands[
0]) == REG && GP_REG_P (REGNO (operands[
0]))
822 && GET_CODE (operands[
1]) == REG && GP_REG_P (REGNO (operands[
1]))
823 && INTVAL (operands[
2]) >
0"
825 [(set (subreg:SI (match_dup
0)
1)
826 (plus:SI (subreg:SI (match_dup
1)
1)
830 (ltu:SI (subreg:SI (match_dup
0)
1)
833 (set (subreg:SI (match_dup
0)
0)
834 (plus:SI (subreg:SI (match_dup
1)
0)
838 (define_insn "adddi3_internal_3"
839 [(set (match_operand:DI
0 "register_operand" "=d")
840 (plus:DI (match_operand:DI
1 "se_reg_or_0_operand" "dJ")
841 (match_operand:DI
2 "se_arith_operand" "dI")))]
845 || GET_CODE (operands[
2]) != CONST_INT
846 || INTVAL (operands[
2]) != -
32768)"
849 return (GET_CODE (operands[
2]) == CONST_INT && INTVAL (operands[
2]) <
0)
850 ?
\"dsubu
\\t%
0,%z1,%n2
\"
851 :
\"daddu
\\t%
0,%z1,%
2\";
853 [(set_attr "type" "darith")
854 (set_attr "mode" "DI")
855 (set_attr "length" "
1")])
857 ;; For the mips16, we need to recognize stack pointer additions
858 ;; explicitly, since we don't have a constraint for $sp. These insns
859 ;; will be generated by the save_restore_insns functions.
864 (match_operand:DI
0 "small_int" "I")))]
865 "TARGET_MIPS16 && TARGET_64BIT"
867 [(set_attr "type" "arith")
868 (set_attr "mode" "DI")
869 (set (attr "length") (if_then_else (match_operand:VOID
0 "m16_simm8_8" "")
874 [(set (match_operand:DI
0 "register_operand" "=d")
876 (match_operand:DI
1 "small_int" "I")))]
877 "TARGET_MIPS16 && TARGET_64BIT"
879 [(set_attr "type" "arith")
880 (set_attr "mode" "DI")
881 (set (attr "length") (if_then_else (match_operand:VOID
0 "m16_uimm5_4" "")
886 [(set (match_operand:DI
0 "register_operand" "=d,d,d")
887 (plus:DI (match_operand:DI
1 "register_operand" "
0,d,d")
888 (match_operand:DI
2 "arith_operand" "IQ,O,d")))]
889 "TARGET_MIPS16 && TARGET_64BIT
890 && (GET_CODE (operands[
1]) != REG
891 || REGNO (operands[
1]) >= FIRST_PSEUDO_REGISTER
892 || M16_REG_P (REGNO (operands[
1]))
893 || REGNO (operands[
1]) == ARG_POINTER_REGNUM
894 || REGNO (operands[
1]) == FRAME_POINTER_REGNUM
895 || REGNO (operands[
1]) == STACK_POINTER_REGNUM)
896 && (GET_CODE (operands[
2]) != REG
897 || REGNO (operands[
2]) >= FIRST_PSEUDO_REGISTER
898 || M16_REG_P (REGNO (operands[
2]))
899 || REGNO (operands[
2]) == ARG_POINTER_REGNUM
900 || REGNO (operands[
2]) == FRAME_POINTER_REGNUM
901 || REGNO (operands[
2]) == STACK_POINTER_REGNUM)"
904 if (REGNO (operands[
0]) == REGNO (operands[
1]))
905 return
\"daddu
\\t%
0,%
2\";
906 return
\"daddu
\\t%
0,%
1,%
2\";
908 [(set_attr "type" "arith")
909 (set_attr "mode" "DI")
910 (set_attr_alternative "length"
911 [(if_then_else (match_operand:VOID
2 "m16_simm5_1" "")
914 (if_then_else (match_operand:VOID
2 "m16_simm4_1" "")
920 ;; On the mips16, we can sometimes split an add of a constant which is
921 ;; a
4 byte instruction into two adds which are both
2 byte
922 ;; instructions. There are two cases: one where we are adding a
923 ;; constant plus a register to another register, and one where we are
924 ;; simply adding a constant to a register.
927 [(set (match_operand:DI
0 "register_operand" "")
928 (plus:DI (match_dup
0)
929 (match_operand:DI
1 "const_int_operand" "")))]
930 "TARGET_MIPS16 && TARGET_64BIT && reload_completed
931 && GET_CODE (operands[
0]) == REG
932 && M16_REG_P (REGNO (operands[
0]))
933 && GET_CODE (operands[
1]) == CONST_INT
934 && ((INTVAL (operands[
1]) >
0xf
935 && INTVAL (operands[
1]) <=
0xf +
0xf)
936 || (INTVAL (operands[
1]) < -
0x10
937 && INTVAL (operands[
1]) >= -
0x10 -
0x10))"
938 [(set (match_dup
0) (plus:DI (match_dup
0) (match_dup
1)))
939 (set (match_dup
0) (plus:DI (match_dup
0) (match_dup
2)))]
942 HOST_WIDE_INT val = INTVAL (operands[
1]);
946 operands[
1] = GEN_INT (
0xf);
947 operands[
2] = GEN_INT (val -
0xf);
951 operands[
1] = GEN_INT (-
0x10);
952 operands[
2] = GEN_INT (val +
0x10);
957 [(set (match_operand:DI
0 "register_operand" "")
958 (plus:DI (match_operand:DI
1 "register_operand" "")
959 (match_operand:DI
2 "const_int_operand" "")))]
960 "TARGET_MIPS16 && TARGET_64BIT && reload_completed
961 && GET_CODE (operands[
0]) == REG
962 && M16_REG_P (REGNO (operands[
0]))
963 && GET_CODE (operands[
1]) == REG
964 && M16_REG_P (REGNO (operands[
1]))
965 && REGNO (operands[
0]) != REGNO (operands[
1])
966 && GET_CODE (operands[
2]) == CONST_INT
967 && ((INTVAL (operands[
2]) >
0x7
968 && INTVAL (operands[
2]) <=
0x7 +
0xf)
969 || (INTVAL (operands[
2]) < -
0x8
970 && INTVAL (operands[
2]) >= -
0x8 -
0x10))"
971 [(set (match_dup
0) (plus:DI (match_dup
1) (match_dup
2)))
972 (set (match_dup
0) (plus:DI (match_dup
0) (match_dup
3)))]
975 HOST_WIDE_INT val = INTVAL (operands[
2]);
979 operands[
2] = GEN_INT (
0x7);
980 operands[
3] = GEN_INT (val -
0x7);
984 operands[
2] = GEN_INT (-
0x8);
985 operands[
3] = GEN_INT (val +
0x8);
989 (define_insn "addsi3_internal_2"
990 [(set (match_operand:DI
0 "register_operand" "=d")
991 (sign_extend:DI (plus:SI (match_operand:SI
1 "reg_or_0_operand" "dJ")
992 (match_operand:SI
2 "arith_operand" "dI"))))]
996 || GET_CODE (operands[
2]) != CONST_INT
997 || INTVAL (operands[
2]) != -
32768)"
1000 return (GET_CODE (operands[
2]) == CONST_INT && INTVAL (operands[
2]) <
0)
1001 ?
\"subu
\\t%
0,%z1,%n2
\"
1002 :
\"addu
\\t%
0,%z1,%
2\";
1004 [(set_attr "type" "arith")
1005 (set_attr "mode" "SI")
1006 (set_attr "length" "
1")])
1009 [(set (match_operand:DI
0 "register_operand" "=d,d,d")
1010 (sign_extend:DI (plus:SI (match_operand:SI
1 "register_operand" "
0,d,d")
1011 (match_operand:SI
2 "arith_operand" "I,O,d"))))]
1012 "TARGET_MIPS16 && TARGET_64BIT"
1015 if (REGNO (operands[
0]) == REGNO (operands[
1]))
1016 return
\"addu
\\t%
0,%
2\";
1017 return
\"addu
\\t%
0,%
1,%
2\";
1019 [(set_attr "type" "arith")
1020 (set_attr "mode" "SI")
1021 (set_attr_alternative "length"
1022 [(if_then_else (match_operand:VOID
2 "m16_simm8_1" "")
1025 (if_then_else (match_operand:VOID
2 "m16_simm4_1" "")
1032 ;; ....................
1036 ;; ....................
1039 (define_insn "subdf3"
1040 [(set (match_operand:DF
0 "register_operand" "=f")
1041 (minus:DF (match_operand:DF
1 "register_operand" "f")
1042 (match_operand:DF
2 "register_operand" "f")))]
1043 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
1045 [(set_attr "type" "fadd")
1046 (set_attr "mode" "DF")
1047 (set_attr "length" "
1")])
1049 (define_insn "subsf3"
1050 [(set (match_operand:SF
0 "register_operand" "=f")
1051 (minus:SF (match_operand:SF
1 "register_operand" "f")
1052 (match_operand:SF
2 "register_operand" "f")))]
1055 [(set_attr "type" "fadd")
1056 (set_attr "mode" "SF")
1057 (set_attr "length" "
1")])
1059 (define_expand "subsi3"
1060 [(set (match_operand:SI
0 "register_operand" "=d")
1061 (minus:SI (match_operand:SI
1 "reg_or_0_operand" "dJ")
1062 (match_operand:SI
2 "arith_operand" "dI")))]
1066 if (GET_CODE (operands[
2]) == CONST_INT
1067 && (INTVAL (operands[
2]) == -
32768
1069 && INTVAL (operands[
2]) == -
0x4000)))
1070 operands[
2] = force_reg (SImode, operands[
2]);
1073 (define_insn "subsi3_internal"
1074 [(set (match_operand:SI
0 "register_operand" "=d")
1075 (minus:SI (match_operand:SI
1 "reg_or_0_operand" "dJ")
1076 (match_operand:SI
2 "arith_operand" "dI")))]
1078 && (GET_CODE (operands[
2]) != CONST_INT || INTVAL (operands[
2]) != -
32768)"
1080 [(set_attr "type" "arith")
1081 (set_attr "mode" "SI")
1082 (set_attr "length" "
1")])
1084 ;; For the mips16, we need to recognize stack pointer subtractions
1085 ;; explicitly, since we don't have a constraint for $sp. These insns
1086 ;; will be generated by the save_restore_insns functions.
1090 (minus:SI (reg:SI
29)
1091 (match_operand:SI
0 "small_int" "I")))]
1093 && (GET_CODE (operands[
2]) != CONST_INT || INTVAL (operands[
2]) != -
32768)"
1095 [(set_attr "type" "arith")
1096 (set_attr "mode" "SI")
1097 (set (attr "length") (if_then_else (match_operand:VOID
0 "m16_nsimm8_8" "")
1102 [(set (match_operand:SI
0 "register_operand" "=d")
1103 (minus:SI (reg:SI
29)
1104 (match_operand:SI
1 "small_int" "I")))]
1106 && (GET_CODE (operands[
2]) != CONST_INT || INTVAL (operands[
2]) != -
32768)"
1108 [(set_attr "type" "arith")
1109 (set_attr "mode" "SI")
1110 (set (attr "length") (if_then_else (match_operand:VOID
1 "m16_nuimm8_4" "")
1116 [(set (match_operand:SI
0 "register_operand" "=d,d,d")
1117 (minus:SI (match_operand:SI
1 "register_operand" "
0,d,d")
1118 (match_operand:SI
2 "arith_operand" "I,O,d")))]
1120 && (GET_CODE (operands[
2]) != CONST_INT
1121 || (INTVAL (operands[
2]) != -
32768 && INTVAL (operands[
2]) != -
0x4000))"
1124 if (REGNO (operands[
0]) == REGNO (operands[
1]))
1125 return
\"subu
\\t%
0,%
2\";
1126 return
\"subu
\\t%
0,%
1,%
2\";
1128 [(set_attr "type" "arith")
1129 (set_attr "mode" "SI")
1130 (set_attr_alternative "length"
1131 [(if_then_else (match_operand:VOID
2 "m16_nsimm8_1" "")
1134 (if_then_else (match_operand:VOID
2 "m16_nsimm4_1" "")
1139 ;; On the mips16, we can sometimes split an subtract of a constant
1140 ;; which is a
4 byte instruction into two adds which are both
2 byte
1141 ;; instructions. There are two cases: one where we are setting a
1142 ;; register to a register minus a constant, and one where we are
1143 ;; simply subtracting a constant from a register.
1146 [(set (match_operand:SI
0 "register_operand" "")
1147 (minus:SI (match_dup
0)
1148 (match_operand:SI
1 "const_int_operand" "")))]
1149 "TARGET_MIPS16 && reload_completed
1150 && GET_CODE (operands[
0]) == REG
1151 && M16_REG_P (REGNO (operands[
0]))
1152 && GET_CODE (operands[
1]) == CONST_INT
1153 && ((INTVAL (operands[
1]) >
0x80
1154 && INTVAL (operands[
1]) <=
0x80 +
0x80)
1155 || (INTVAL (operands[
1]) < -
0x7f
1156 && INTVAL (operands[
1]) >= -
0x7f -
0x7f))"
1157 [(set (match_dup
0) (minus:SI (match_dup
0) (match_dup
1)))
1158 (set (match_dup
0) (minus:SI (match_dup
0) (match_dup
2)))]
1161 HOST_WIDE_INT val = INTVAL (operands[
1]);
1165 operands[
1] = GEN_INT (
0x80);
1166 operands[
2] = GEN_INT (val -
0x80);
1170 operands[
1] = GEN_INT (-
0x7f);
1171 operands[
2] = GEN_INT (val +
0x7f);
1176 [(set (match_operand:SI
0 "register_operand" "")
1177 (minus:SI (match_operand:SI
1 "register_operand" "")
1178 (match_operand:SI
2 "const_int_operand" "")))]
1179 "TARGET_MIPS16 && reload_completed
1180 && GET_CODE (operands[
0]) == REG
1181 && M16_REG_P (REGNO (operands[
0]))
1182 && GET_CODE (operands[
1]) == REG
1183 && M16_REG_P (REGNO (operands[
1]))
1184 && REGNO (operands[
0]) != REGNO (operands[
1])
1185 && GET_CODE (operands[
2]) == CONST_INT
1186 && ((INTVAL (operands[
2]) >
0x8
1187 && INTVAL (operands[
2]) <=
0x8 +
0x80)
1188 || (INTVAL (operands[
2]) < -
0x7
1189 && INTVAL (operands[
2]) >= -
0x7 -
0x7f))"
1190 [(set (match_dup
0) (minus:SI (match_dup
1) (match_dup
2)))
1191 (set (match_dup
0) (minus:SI (match_dup
0) (match_dup
3)))]
1194 HOST_WIDE_INT val = INTVAL (operands[
2]);
1198 operands[
2] = GEN_INT (
0x8);
1199 operands[
3] = GEN_INT (val -
0x8);
1203 operands[
2] = GEN_INT (-
0x7);
1204 operands[
3] = GEN_INT (val +
0x7);
1208 (define_expand "subdi3"
1209 [(parallel [(set (match_operand:DI
0 "register_operand" "=d")
1210 (minus:DI (match_operand:DI
1 "se_register_operand" "d")
1211 (match_operand:DI
2 "se_register_operand" "d")))
1212 (clobber (match_dup
3))])]
1213 "TARGET_64BIT || (!TARGET_DEBUG_G_MODE && !TARGET_MIPS16)"
1218 emit_insn (gen_subdi3_internal_3 (operands[
0], operands[
1],
1223 operands[
3] = gen_reg_rtx (SImode);
1226 (define_insn "subdi3_internal"
1227 [(set (match_operand:DI
0 "register_operand" "=d")
1228 (minus:DI (match_operand:DI
1 "register_operand" "d")
1229 (match_operand:DI
2 "register_operand" "d")))
1230 (clobber (match_operand:SI
3 "register_operand" "=d"))]
1231 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16"
1232 "sltu
\\t%
3,%L1,%L2\;subu
\\t%L0,%L1,%L2\;subu
\\t%M0,%M1,%M2\;subu
\\t%M0,%M0,%
3"
1233 [(set_attr "type" "darith")
1234 (set_attr "mode" "DI")
1235 (set_attr "length" "
4")])
1238 [(set (match_operand:DI
0 "register_operand" "")
1239 (minus:DI (match_operand:DI
1 "register_operand" "")
1240 (match_operand:DI
2 "register_operand" "")))
1241 (clobber (match_operand:SI
3 "register_operand" ""))]
1242 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT
1243 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
1244 && GET_CODE (operands[
0]) == REG && GP_REG_P (REGNO (operands[
0]))
1245 && GET_CODE (operands[
1]) == REG && GP_REG_P (REGNO (operands[
1]))
1246 && GET_CODE (operands[
2]) == REG && GP_REG_P (REGNO (operands[
2]))"
1249 (ltu:SI (subreg:SI (match_dup
1)
0)
1250 (subreg:SI (match_dup
2)
0)))
1252 (set (subreg:SI (match_dup
0)
0)
1253 (minus:SI (subreg:SI (match_dup
1)
0)
1254 (subreg:SI (match_dup
2)
0)))
1256 (set (subreg:SI (match_dup
0)
1)
1257 (minus:SI (subreg:SI (match_dup
1)
1)
1258 (subreg:SI (match_dup
2)
1)))
1260 (set (subreg:SI (match_dup
0)
1)
1261 (minus:SI (subreg:SI (match_dup
0)
1)
1266 [(set (match_operand:DI
0 "register_operand" "")
1267 (minus:DI (match_operand:DI
1 "register_operand" "")
1268 (match_operand:DI
2 "register_operand" "")))
1269 (clobber (match_operand:SI
3 "register_operand" ""))]
1270 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT
1271 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
1272 && GET_CODE (operands[
0]) == REG && GP_REG_P (REGNO (operands[
0]))
1273 && GET_CODE (operands[
1]) == REG && GP_REG_P (REGNO (operands[
1]))
1274 && GET_CODE (operands[
2]) == REG && GP_REG_P (REGNO (operands[
2]))"
1277 (ltu:SI (subreg:SI (match_dup
1)
1)
1278 (subreg:SI (match_dup
2)
1)))
1280 (set (subreg:SI (match_dup
0)
1)
1281 (minus:SI (subreg:SI (match_dup
1)
1)
1282 (subreg:SI (match_dup
2)
1)))
1284 (set (subreg:SI (match_dup
0)
0)
1285 (minus:SI (subreg:SI (match_dup
1)
0)
1286 (subreg:SI (match_dup
2)
0)))
1288 (set (subreg:SI (match_dup
0)
0)
1289 (minus:SI (subreg:SI (match_dup
0)
0)
1293 (define_insn "subdi3_internal_2"
1294 [(set (match_operand:DI
0 "register_operand" "=d,d,d")
1295 (minus:DI (match_operand:DI
1 "register_operand" "d,d,d")
1296 (match_operand:DI
2 "small_int" "P,J,N")))
1297 (clobber (match_operand:SI
3 "register_operand" "=d,d,d"))]
1298 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
1299 && INTVAL (operands[
2]) != -
32768"
1301 sltu
\\t%
3,%L1,%
2\;subu
\\t%L0,%L1,%
2\;subu
\\t%M0,%M1,%
3
1302 move
\\t%L0,%L1\;move
\\t%M0,%M1
1303 sltu
\\t%
3,%L1,%
2\;subu
\\t%L0,%L1,%
2\;subu
\\t%M0,%M1,
1\;subu
\\t%M0,%M0,%
3"
1304 [(set_attr "type" "darith")
1305 (set_attr "mode" "DI")
1306 (set_attr "length" "
3,
2,
4")])
1309 [(set (match_operand:DI
0 "register_operand" "")
1310 (minus:DI (match_operand:DI
1 "register_operand" "")
1311 (match_operand:DI
2 "small_int" "")))
1312 (clobber (match_operand:SI
3 "register_operand" ""))]
1313 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT
1314 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
1315 && GET_CODE (operands[
0]) == REG && GP_REG_P (REGNO (operands[
0]))
1316 && GET_CODE (operands[
1]) == REG && GP_REG_P (REGNO (operands[
1]))
1317 && INTVAL (operands[
2]) >
0"
1320 (ltu:SI (subreg:SI (match_dup
1)
0)
1323 (set (subreg:SI (match_dup
0)
0)
1324 (minus:SI (subreg:SI (match_dup
1)
0)
1327 (set (subreg:SI (match_dup
0)
1)
1328 (minus:SI (subreg:SI (match_dup
1)
1)
1333 [(set (match_operand:DI
0 "register_operand" "")
1334 (minus:DI (match_operand:DI
1 "register_operand" "")
1335 (match_operand:DI
2 "small_int" "")))
1336 (clobber (match_operand:SI
3 "register_operand" ""))]
1337 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT
1338 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
1339 && GET_CODE (operands[
0]) == REG && GP_REG_P (REGNO (operands[
0]))
1340 && GET_CODE (operands[
1]) == REG && GP_REG_P (REGNO (operands[
1]))
1341 && INTVAL (operands[
2]) >
0"
1344 (ltu:SI (subreg:SI (match_dup
1)
1)
1347 (set (subreg:SI (match_dup
0)
1)
1348 (minus:SI (subreg:SI (match_dup
1)
1)
1351 (set (subreg:SI (match_dup
0)
0)
1352 (minus:SI (subreg:SI (match_dup
1)
0)
1356 (define_insn "subdi3_internal_3"
1357 [(set (match_operand:DI
0 "register_operand" "=d")
1358 (minus:DI (match_operand:DI
1 "se_reg_or_0_operand" "dJ")
1359 (match_operand:DI
2 "se_arith_operand" "dI")))]
1360 "TARGET_64BIT && !TARGET_MIPS16
1361 && (GET_CODE (operands[
2]) != CONST_INT || INTVAL (operands[
2]) != -
32768)"
1364 return (GET_CODE (operands[
2]) == CONST_INT && INTVAL (operands[
2]) <
0)
1365 ?
\"daddu
\\t%
0,%z1,%n2
\"
1366 :
\"dsubu
\\t%
0,%z1,%
2\";
1368 [(set_attr "type" "darith")
1369 (set_attr "mode" "DI")
1370 (set_attr "length" "
1")])
1372 ;; For the mips16, we need to recognize stack pointer subtractions
1373 ;; explicitly, since we don't have a constraint for $sp. These insns
1374 ;; will be generated by the save_restore_insns functions.
1378 (minus:DI (reg:DI
29)
1379 (match_operand:DI
0 "small_int" "I")))]
1381 && (GET_CODE (operands[
2]) != CONST_INT || INTVAL (operands[
2]) != -
32768)"
1383 [(set_attr "type" "arith")
1384 (set_attr "mode" "DI")
1385 (set (attr "length") (if_then_else (match_operand:VOID
0 "m16_nsimm8_8" "")
1390 [(set (match_operand:DI
0 "register_operand" "=d")
1391 (minus:DI (reg:DI
29)
1392 (match_operand:DI
1 "small_int" "I")))]
1394 && (GET_CODE (operands[
2]) != CONST_INT || INTVAL (operands[
2]) != -
32768)"
1396 [(set_attr "type" "arith")
1397 (set_attr "mode" "DI")
1398 (set (attr "length") (if_then_else (match_operand:VOID
0 "m16_nuimm5_4" "")
1403 [(set (match_operand:DI
0 "register_operand" "=d,d,d")
1404 (minus:DI (match_operand:DI
1 "register_operand" "
0,d,d")
1405 (match_operand:DI
2 "arith_operand" "I,O,d")))]
1407 && (GET_CODE (operands[
2]) != CONST_INT
1408 || (INTVAL (operands[
2]) != -
32768 && INTVAL (operands[
2]) != -
0x4000))"
1411 if (REGNO (operands[
0]) == REGNO (operands[
1]))
1412 return
\"dsubu
\\t%
0,%
2\";
1413 return
\"dsubu
\\t%
0,%
1,%
2\";
1415 [(set_attr "type" "arith")
1416 (set_attr "mode" "DI")
1417 (set_attr_alternative "length"
1418 [(if_then_else (match_operand:VOID
2 "m16_nsimm5_1" "")
1421 (if_then_else (match_operand:VOID
2 "m16_nsimm4_1" "")
1426 ;; On the mips16, we can sometimes split an add of a constant which is
1427 ;; a
4 byte instruction into two adds which are both
2 byte
1428 ;; instructions. There are two cases: one where we are adding a
1429 ;; constant plus a register to another register, and one where we are
1430 ;; simply adding a constant to a register.
1433 [(set (match_operand:DI
0 "register_operand" "")
1434 (minus:DI (match_dup
0)
1435 (match_operand:DI
1 "const_int_operand" "")))]
1436 "TARGET_MIPS16 && TARGET_64BIT && reload_completed
1437 && GET_CODE (operands[
0]) == REG
1438 && M16_REG_P (REGNO (operands[
0]))
1439 && GET_CODE (operands[
1]) == CONST_INT
1440 && ((INTVAL (operands[
1]) >
0x10
1441 && INTVAL (operands[
1]) <=
0x10 +
0x10)
1442 || (INTVAL (operands[
1]) < -
0xf
1443 && INTVAL (operands[
1]) >= -
0xf -
0xf))"
1444 [(set (match_dup
0) (minus:DI (match_dup
0) (match_dup
1)))
1445 (set (match_dup
0) (minus:DI (match_dup
0) (match_dup
2)))]
1448 HOST_WIDE_INT val = INTVAL (operands[
1]);
1452 operands[
1] = GEN_INT (
0xf);
1453 operands[
2] = GEN_INT (val -
0xf);
1457 operands[
1] = GEN_INT (-
0x10);
1458 operands[
2] = GEN_INT (val +
0x10);
1463 [(set (match_operand:DI
0 "register_operand" "")
1464 (minus:DI (match_operand:DI
1 "register_operand" "")
1465 (match_operand:DI
2 "const_int_operand" "")))]
1466 "TARGET_MIPS16 && TARGET_64BIT && reload_completed
1467 && GET_CODE (operands[
0]) == REG
1468 && M16_REG_P (REGNO (operands[
0]))
1469 && GET_CODE (operands[
1]) == REG
1470 && M16_REG_P (REGNO (operands[
1]))
1471 && REGNO (operands[
0]) != REGNO (operands[
1])
1472 && GET_CODE (operands[
2]) == CONST_INT
1473 && ((INTVAL (operands[
2]) >
0x8
1474 && INTVAL (operands[
2]) <=
0x8 +
0x10)
1475 || (INTVAL (operands[
2]) < -
0x7
1476 && INTVAL (operands[
2]) >= -
0x7 -
0xf))"
1477 [(set (match_dup
0) (minus:DI (match_dup
1) (match_dup
2)))
1478 (set (match_dup
0) (minus:DI (match_dup
0) (match_dup
3)))]
1481 HOST_WIDE_INT val = INTVAL (operands[
2]);
1485 operands[
2] = GEN_INT (
0x8);
1486 operands[
3] = GEN_INT (val -
0x8);
1490 operands[
2] = GEN_INT (-
0x7);
1491 operands[
3] = GEN_INT (val +
0x7);
1495 (define_insn "subsi3_internal_2"
1496 [(set (match_operand:DI
0 "register_operand" "=d")
1497 (sign_extend:DI (minus:SI (match_operand:SI
1 "reg_or_0_operand" "dJ")
1498 (match_operand:SI
2 "arith_operand" "dI"))))]
1499 "TARGET_64BIT && !TARGET_MIPS16
1500 && (GET_CODE (operands[
2]) != CONST_INT || INTVAL (operands[
2]) != -
32768)"
1503 return (GET_CODE (operands[
2]) == CONST_INT && INTVAL (operands[
2]) <
0)
1504 ?
\"addu
\\t%
0,%z1,%n2
\"
1505 :
\"subu
\\t%
0,%z1,%
2\";
1507 [(set_attr "type" "arith")
1508 (set_attr "mode" "DI")
1509 (set_attr "length" "
1")])
1512 [(set (match_operand:DI
0 "register_operand" "=d,d,d")
1513 (sign_extend:DI (minus:SI (match_operand:SI
1 "register_operand" "
0,d,d")
1514 (match_operand:SI
2 "arith_operand" "I,O,d"))))]
1515 "TARGET_64BIT && TARGET_MIPS16
1516 && (GET_CODE (operands[
2]) != CONST_INT
1517 || (INTVAL (operands[
2]) != -
32768 && INTVAL (operands[
2]) != -
0x4000))"
1520 if (REGNO (operands[
0]) == REGNO (operands[
1]))
1521 return
\"subu
\\t%
0,%
2\";
1522 return
\"subu
\\t%
0,%
1,%
2\";
1524 [(set_attr "type" "arith")
1525 (set_attr "mode" "SI")
1526 (set_attr_alternative "length"
1527 [(if_then_else (match_operand:VOID
2 "m16_nsimm8_1" "")
1530 (if_then_else (match_operand:VOID
2 "m16_nsimm4_1" "")
1538 ;; ....................
1542 ;; ....................
1545 ;; Early Vr4300 silicon has a CPU bug where multiplies with certain
1546 ;; operands may corrupt immediately following multiplies. This is a
1547 ;; simple fix to insert NOPs.
1549 (define_expand "muldf3"
1550 [(set (match_operand:DF
0 "register_operand" "=f")
1551 (mult:DF (match_operand:DF
1 "register_operand" "f")
1552 (match_operand:DF
2 "register_operand" "f")))]
1553 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
1556 if (mips_cpu != PROCESSOR_R4300)
1557 emit_insn (gen_muldf3_internal (operands[
0], operands[
1], operands[
2]));
1559 emit_insn (gen_muldf3_r4300 (operands[
0], operands[
1], operands[
2]));
1563 (define_insn "muldf3_internal"
1564 [(set (match_operand:DF
0 "register_operand" "=f")
1565 (mult:DF (match_operand:DF
1 "register_operand" "f")
1566 (match_operand:DF
2 "register_operand" "f")))]
1567 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && mips_cpu != PROCESSOR_R4300"
1569 [(set_attr "type" "fmul")
1570 (set_attr "mode" "DF")
1571 (set_attr "length" "
1")])
1573 (define_insn "muldf3_r4300"
1574 [(set (match_operand:DF
0 "register_operand" "=f")
1575 (mult:DF (match_operand:DF
1 "register_operand" "f")
1576 (match_operand:DF
2 "register_operand" "f")))]
1577 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && mips_cpu == PROCESSOR_R4300"
1580 output_asm_insn (
\"mul.d
\\t%
0,%
1,%
2\", operands);
1581 if (TARGET_4300_MUL_FIX)
1582 output_asm_insn (
\"nop
\", operands);
1585 [(set_attr "type" "fmul")
1586 (set_attr "mode" "DF")
1587 (set_attr "length" "
2")]) ;; mul.d + nop
1589 (define_expand "mulsf3"
1590 [(set (match_operand:SF
0 "register_operand" "=f")
1591 (mult:SF (match_operand:SF
1 "register_operand" "f")
1592 (match_operand:SF
2 "register_operand" "f")))]
1596 if (mips_cpu != PROCESSOR_R4300)
1597 emit_insn( gen_mulsf3_internal (operands[
0], operands[
1], operands[
2]));
1599 emit_insn( gen_mulsf3_r4300 (operands[
0], operands[
1], operands[
2]));
1603 (define_insn "mulsf3_internal"
1604 [(set (match_operand:SF
0 "register_operand" "=f")
1605 (mult:SF (match_operand:SF
1 "register_operand" "f")
1606 (match_operand:SF
2 "register_operand" "f")))]
1607 "TARGET_HARD_FLOAT && mips_cpu != PROCESSOR_R4300"
1609 [(set_attr "type" "fmul")
1610 (set_attr "mode" "SF")
1611 (set_attr "length" "
1")])
1613 (define_insn "mulsf3_r4300"
1614 [(set (match_operand:SF
0 "register_operand" "=f")
1615 (mult:SF (match_operand:SF
1 "register_operand" "f")
1616 (match_operand:SF
2 "register_operand" "f")))]
1617 "TARGET_HARD_FLOAT && mips_cpu == PROCESSOR_R4300"
1620 output_asm_insn (
\"mul.s
\\t%
0,%
1,%
2\", operands);
1621 if (TARGET_4300_MUL_FIX)
1622 output_asm_insn (
\"nop
\", operands);
1625 [(set_attr "type" "fmul")
1626 (set_attr "mode" "SF")
1627 (set_attr "length" "
2")]) ;; mul.s + nop
1629 ;; ??? The R4000 (only) has a cpu bug. If a double-word shift executes while
1630 ;; a multiply is in progress, it may give an incorrect result. Avoid
1631 ;; this by keeping the mflo with the mult on the R4000.
1633 (define_expand "mulsi3"
1634 [(set (match_operand:SI
0 "register_operand" "=l")
1635 (mult:SI (match_operand:SI
1 "register_operand" "d")
1636 (match_operand:SI
2 "register_operand" "d")))
1637 (clobber (match_scratch:SI
3 "=h"))
1638 (clobber (match_scratch:SI
4 "=a"))]
1643 emit_insn (gen_mulsi3_mult3 (operands[
0], operands[
1], operands[
2]));
1644 else if (TARGET_MAD)
1645 emit_insn (gen_mulsi3_r4650 (operands[
0], operands[
1], operands[
2]));
1646 else if (mips_cpu != PROCESSOR_R4000 || TARGET_MIPS16)
1647 emit_insn (gen_mulsi3_internal (operands[
0], operands[
1], operands[
2]));
1649 emit_insn (gen_mulsi3_r4000 (operands[
0], operands[
1], operands[
2]));
1653 (define_insn "mulsi3_mult3"
1654 [(set (match_operand:SI
0 "register_operand" "=d")
1655 (mult:SI (match_operand:SI
1 "register_operand" "d")
1656 (match_operand:SI
2 "register_operand" "d")))
1657 (clobber (match_scratch:SI
3 "=h"))
1658 (clobber (match_scratch:SI
4 "=l"))
1659 (clobber (match_scratch:SI
5 "=a"))]
1662 [(set_attr "type" "imul")
1663 (set_attr "mode" "SI")
1664 (set_attr "length" "
1")])
1666 (define_insn "mulsi3_internal"
1667 [(set (match_operand:SI
0 "register_operand" "=l")
1668 (mult:SI (match_operand:SI
1 "register_operand" "d")
1669 (match_operand:SI
2 "register_operand" "d")))
1670 (clobber (match_scratch:SI
3 "=h"))
1671 (clobber (match_scratch:SI
4 "=a"))]
1672 "mips_cpu != PROCESSOR_R4000 || TARGET_MIPS16"
1674 [(set_attr "type" "imul")
1675 (set_attr "mode" "SI")
1676 (set_attr "length" "
1")])
1678 (define_insn "mulsi3_r4000"
1679 [(set (match_operand:SI
0 "register_operand" "=d")
1680 (mult:SI (match_operand:SI
1 "register_operand" "d")
1681 (match_operand:SI
2 "register_operand" "d")))
1682 (clobber (match_scratch:SI
3 "=h"))
1683 (clobber (match_scratch:SI
4 "=l"))
1684 (clobber (match_scratch:SI
5 "=a"))]
1685 "mips_cpu == PROCESSOR_R4000 && !TARGET_MIPS16"
1690 xoperands[
0] = operands[
0];
1691 xoperands[
1] = gen_rtx (REG, SImode, LO_REGNUM);
1693 output_asm_insn (
\"mult
\\t%
1,%
2\", operands);
1694 output_asm_insn (mips_move_1word (xoperands, insn, FALSE), xoperands);
1697 [(set_attr "type" "imul")
1698 (set_attr "mode" "SI")
1699 (set_attr "length" "
3")]) ;; mult + mflo + delay
1701 (define_insn "mulsi3_r4650"
1702 [(set (match_operand:SI
0 "register_operand" "=d")
1703 (mult:SI (match_operand:SI
1 "register_operand" "d")
1704 (match_operand:SI
2 "register_operand" "d")))
1705 (clobber (match_scratch:SI
3 "=h"))
1706 (clobber (match_scratch:SI
4 "=l"))
1707 (clobber (match_scratch:SI
5 "=a"))]
1710 [(set_attr "type" "imul")
1711 (set_attr "mode" "SI")
1712 (set_attr "length" "
1")])
1714 (define_expand "muldi3"
1715 [(set (match_operand:DI
0 "register_operand" "=l")
1716 (mult:DI (match_operand:DI
1 "se_register_operand" "d")
1717 (match_operand:DI
2 "register_operand" "d")))
1718 (clobber (match_scratch:DI
3 "=h"))
1719 (clobber (match_scratch:DI
4 "=a"))]
1723 if (GENERATE_MULT3 || mips_cpu == PROCESSOR_R4000 || TARGET_MIPS16)
1724 emit_insn (gen_muldi3_internal2 (operands[
0], operands[
1], operands[
2]));
1726 emit_insn (gen_muldi3_internal (operands[
0], operands[
1], operands[
2]));
1730 ;; Don't accept both operands using se_register_operand, because if
1731 ;; both operands are sign extended we would prefer to use mult in the
1732 ;; mulsidi3 pattern. Commutativity should permit either operand to be
1735 (define_insn "muldi3_internal"
1736 [(set (match_operand:DI
0 "register_operand" "=l")
1737 (mult:DI (match_operand:DI
1 "se_register_operand" "d")
1738 (match_operand:DI
2 "register_operand" "d")))
1739 (clobber (match_scratch:DI
3 "=h"))
1740 (clobber (match_scratch:DI
4 "=a"))]
1741 "TARGET_64BIT && mips_cpu != PROCESSOR_R4000 && !TARGET_MIPS16"
1743 [(set_attr "type" "imul")
1744 (set_attr "mode" "DI")
1745 (set_attr "length" "
1")])
1747 (define_insn "muldi3_internal2"
1748 [(set (match_operand:DI
0 "register_operand" "=d")
1749 (mult:DI (match_operand:DI
1 "se_register_operand" "d")
1750 (match_operand:DI
2 "register_operand" "d")))
1751 (clobber (match_scratch:DI
3 "=h"))
1752 (clobber (match_scratch:DI
4 "=l"))
1753 (clobber (match_scratch:DI
5 "=a"))]
1754 "TARGET_64BIT && (GENERATE_MULT3 || mips_cpu == PROCESSOR_R4000 || TARGET_MIPS16)"
1758 output_asm_insn (
\"dmult
\\t%
0,%
1,%
2\", operands);
1763 xoperands[
0] = operands[
0];
1764 xoperands[
1] = gen_rtx (REG, DImode, LO_REGNUM);
1766 output_asm_insn (
\"dmult
\\t%
1,%
2\", operands);
1767 output_asm_insn (mips_move_1word (xoperands, insn, FALSE), xoperands);
1771 [(set_attr "type" "imul")
1772 (set_attr "mode" "DI")
1773 (set (attr "length")
1774 (if_then_else (ne (symbol_ref "GENERATE_MULT3") (const_int
0))
1776 (const_int
3)))]) ;; mult + mflo + delay
1778 ;; ??? We could define a mulditi3 pattern when TARGET_64BIT.
1780 (define_expand "mulsidi3"
1781 [(set (match_operand:DI
0 "register_operand" "=x")
1782 (mult:DI (sign_extend:DI (match_operand:SI
1 "register_operand" "d"))
1783 (sign_extend:DI (match_operand:SI
2 "register_operand" "d"))))]
1788 emit_insn (gen_mulsidi3_64bit (operands[
0], operands[
1], operands[
2]));
1790 emit_insn (gen_mulsidi3_internal (operands[
0], operands[
1], operands[
2]));
1794 (define_insn "mulsidi3_internal"
1795 [(set (match_operand:DI
0 "register_operand" "=x")
1796 (mult:DI (sign_extend:DI (match_operand:SI
1 "register_operand" "d"))
1797 (sign_extend:DI (match_operand:SI
2 "register_operand" "d"))))
1798 (clobber (match_scratch:SI
3 "=a"))]
1801 [(set_attr "type" "imul")
1802 (set_attr "mode" "SI")
1803 (set_attr "length" "
1")])
1805 (define_insn "mulsidi3_64bit"
1806 [(set (match_operand:DI
0 "register_operand" "=a")
1807 (mult:DI (sign_extend:DI (match_operand:SI
1 "register_operand" "d"))
1808 (sign_extend:DI (match_operand:SI
2 "register_operand" "d"))))
1809 (clobber (match_scratch:DI
3 "=l"))
1810 (clobber (match_scratch:DI
4 "=h"))]
1813 [(set_attr "type" "imul")
1814 (set_attr "mode" "SI")
1815 (set_attr "length" "
1")])
1817 (define_insn "smulsi3_highpart"
1818 [(set (match_operand:SI
0 "register_operand" "=h")
1820 (lshiftrt:DI (mult:DI (sign_extend:DI (match_operand:SI
1 "register_operand" "d"))
1821 (sign_extend:DI (match_operand:SI
2 "register_operand" "d")))
1823 (clobber (match_scratch:SI
3 "=l"))
1824 (clobber (match_scratch:SI
4 "=a"))]
1827 [(set_attr "type" "imul")
1828 (set_attr "mode" "SI")
1829 (set_attr "length" "
1")])
1831 (define_expand "umulsidi3"
1832 [(set (match_operand:DI
0 "register_operand" "=x")
1833 (mult:DI (zero_extend:DI (match_operand:SI
1 "register_operand" "d"))
1834 (zero_extend:DI (match_operand:SI
2 "register_operand" "d"))))]
1839 emit_insn (gen_umulsidi3_64bit (operands[
0], operands[
1], operands[
2]));
1841 emit_insn (gen_umulsidi3_internal (operands[
0], operands[
1], operands[
2]));
1845 (define_insn "umulsidi3_internal"
1846 [(set (match_operand:DI
0 "register_operand" "=x")
1847 (mult:DI (zero_extend:DI (match_operand:SI
1 "register_operand" "d"))
1848 (zero_extend:DI (match_operand:SI
2 "register_operand" "d"))))
1849 (clobber (match_scratch:SI
3 "=a"))]
1852 [(set_attr "type" "imul")
1853 (set_attr "mode" "SI")
1854 (set_attr "length" "
1")])
1856 (define_insn "umulsidi3_64bit"
1857 [(set (match_operand:DI
0 "register_operand" "=a")
1858 (mult:DI (zero_extend:DI (match_operand:SI
1 "register_operand" "d"))
1859 (zero_extend:DI (match_operand:SI
2 "register_operand" "d"))))
1860 (clobber (match_scratch:DI
3 "=l"))
1861 (clobber (match_scratch:DI
4 "=h"))]
1864 [(set_attr "type" "imul")
1865 (set_attr "mode" "SI")
1866 (set_attr "length" "
1")])
1868 (define_insn "umulsi3_highpart"
1869 [(set (match_operand:SI
0 "register_operand" "=h")
1871 (lshiftrt:DI (mult:DI (zero_extend:DI (match_operand:SI
1 "register_operand" "d"))
1872 (zero_extend:DI (match_operand:SI
2 "register_operand" "d")))
1874 (clobber (match_scratch:SI
3 "=l"))
1875 (clobber (match_scratch:SI
4 "=a"))]
1878 [(set_attr "type" "imul")
1879 (set_attr "mode" "SI")
1880 (set_attr "length" "
1")])
1882 (define_insn "smuldi3_highpart"
1883 [(set (match_operand:DI
0 "register_operand" "=h")
1885 (lshiftrt:TI (mult:TI (sign_extend:TI (match_operand:DI
1 "se_register_operand" "d"))
1886 (sign_extend:TI (match_operand:DI
2 "se_register_operand" "d")))
1888 (clobber (match_scratch:DI
3 "=l"))
1889 (clobber (match_scratch:DI
4 "=a"))]
1892 [(set_attr "type" "imul")
1893 (set_attr "mode" "DI")
1894 (set_attr "length" "
1")])
1896 (define_insn "umuldi3_highpart"
1897 [(set (match_operand:DI
0 "register_operand" "=h")
1899 (lshiftrt:TI (mult:TI (zero_extend:TI (match_operand:DI
1 "se_register_operand" "d"))
1900 (zero_extend:TI (match_operand:DI
2 "se_register_operand" "d")))
1902 (clobber (match_scratch:DI
3 "=l"))
1903 (clobber (match_scratch:DI
4 "=a"))]
1906 [(set_attr "type" "imul")
1907 (set_attr "mode" "DI")
1908 (set_attr "length" "
1")])
1910 ;; The R4650 supports a
32 bit multiply/
64 bit accumulate
1911 ;; instruction. The HI/LO registers are used as a
64 bit accumulator.
1913 (define_insn "madsi"
1914 [(set (match_operand:SI
0 "register_operand" "+l")
1915 (plus:SI (mult:SI (match_operand:SI
1 "register_operand" "d")
1916 (match_operand:SI
2 "register_operand" "d"))
1918 (clobber (match_scratch:SI
3 "=h"))
1919 (clobber (match_scratch:SI
4 "=a"))]
1920 "TARGET_MAD || GENERATE_MADD"
1924 return
\"mad
\\t%
1,%
2\";
1926 return
\"madd
\\t%
1,%
2\";
1928 [(set_attr "type" "imul")
1929 (set_attr "mode" "SI")
1930 (set_attr "length" "
1")])
1932 (define_insn "maddi"
1933 [(set (match_operand:DI
0 "register_operand" "+x")
1934 (plus:DI (mult:DI (sign_extend:DI
1935 (match_operand:SI
1 "register_operand" "d"))
1937 (match_operand:SI
2 "register_operand" "d")))
1939 (clobber (match_scratch:SI
3 "=a"))]
1940 "TARGET_MAD && ! TARGET_64BIT"
1942 [(set_attr "type" "imul")
1943 (set_attr "mode" "SI")
1944 (set_attr "length" "
1")])
1946 (define_insn "maddi_64bit"
1947 [(set (match_operand:DI
0 "register_operand" "+a")
1948 (plus:DI (mult:DI (sign_extend:DI
1949 (match_operand:SI
1 "register_operand" "d"))
1951 (match_operand:SI
2 "register_operand" "d")))
1953 (clobber (match_scratch:DI
3 "=l"))
1954 (clobber (match_scratch:DI
4 "=h"))]
1955 "TARGET_MAD && TARGET_64BIT"
1957 [(set_attr "type" "imul")
1958 (set_attr "mode" "SI")
1959 (set_attr "length" "
1")])
1961 (define_insn "umaddi"
1962 [(set (match_operand:DI
0 "register_operand" "+x")
1963 (plus:DI (mult:DI (zero_extend:DI
1964 (match_operand:SI
1 "register_operand" "d"))
1966 (match_operand:SI
2 "register_operand" "d")))
1968 (clobber (match_scratch:SI
3 "=a"))]
1969 "TARGET_MAD && ! TARGET_64BIT"
1971 [(set_attr "type" "imul")
1972 (set_attr "mode" "SI")
1973 (set_attr "length" "
1")])
1975 (define_insn "umaddi_64bit"
1976 [(set (match_operand:DI
0 "register_operand" "+a")
1977 (plus:DI (mult:DI (zero_extend:DI
1978 (match_operand:SI
1 "register_operand" "d"))
1980 (match_operand:SI
2 "register_operand" "d")))
1982 (clobber (match_scratch:DI
3 "=l"))
1983 (clobber (match_scratch:DI
4 "=h"))]
1984 "TARGET_MAD && TARGET_64BIT"
1986 [(set_attr "type" "imul")
1987 (set_attr "mode" "SI")
1988 (set_attr "length" "
1")])
1990 (define_insn "madd3"
1991 [(set (match_operand:SI
0 "register_operand" "=d")
1992 (plus:SI (mult:SI (match_operand:SI
1 "register_operand" "d")
1993 (match_operand:SI
2 "register_operand" "d"))
1994 (match_operand:SI
3 "register_operand" "l")))
1995 (clobber (match_scratch:SI
4 "=l"))
1996 (clobber (match_scratch:SI
5 "=h"))
1997 (clobber (match_scratch:SI
6 "=a"))]
2000 [(set_attr "type" "imul")
2001 (set_attr "mode" "SI")
2002 (set_attr "length" "
1")])
2004 ;; Floating point multiply accumulate instructions.
2007 [(set (match_operand:DF
0 "register_operand" "=f")
2008 (plus:DF (mult:DF (match_operand:DF
1 "register_operand" "f")
2009 (match_operand:DF
2 "register_operand" "f"))
2010 (match_operand:DF
3 "register_operand" "f")))]
2011 "mips_isa >=
4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
2012 "madd.d
\\t%
0,%
3,%
1,%
2"
2013 [(set_attr "type" "fmadd")
2014 (set_attr "mode" "DF")
2015 (set_attr "length" "
1")])
2018 [(set (match_operand:SF
0 "register_operand" "=f")
2019 (plus:SF (mult:SF (match_operand:SF
1 "register_operand" "f")
2020 (match_operand:SF
2 "register_operand" "f"))
2021 (match_operand:SF
3 "register_operand" "f")))]
2022 "mips_isa >=
4 && TARGET_HARD_FLOAT"
2023 "madd.s
\\t%
0,%
3,%
1,%
2"
2024 [(set_attr "type" "fmadd")
2025 (set_attr "mode" "SF")
2026 (set_attr "length" "
1")])
2029 [(set (match_operand:DF
0 "register_operand" "=f")
2030 (minus:DF (mult:DF (match_operand:DF
1 "register_operand" "f")
2031 (match_operand:DF
2 "register_operand" "f"))
2032 (match_operand:DF
3 "register_operand" "f")))]
2033 "mips_isa >=
4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
2034 "msub.d
\\t%
0,%
3,%
1,%
2"
2035 [(set_attr "type" "fmadd")
2036 (set_attr "mode" "DF")
2037 (set_attr "length" "
1")])
2040 [(set (match_operand:SF
0 "register_operand" "=f")
2041 (minus:SF (mult:SF (match_operand:SF
1 "register_operand" "f")
2042 (match_operand:SF
2 "register_operand" "f"))
2043 (match_operand:SF
3 "register_operand" "f")))]
2045 "mips_isa >=
4 && TARGET_HARD_FLOAT"
2046 "msub.s
\\t%
0,%
3,%
1,%
2"
2047 [(set_attr "type" "fmadd")
2048 (set_attr "mode" "SF")
2049 (set_attr "length" "
1")])
2052 [(set (match_operand:DF
0 "register_operand" "=f")
2053 (neg:DF (plus:DF (mult:DF (match_operand:DF
1 "register_operand" "f")
2054 (match_operand:DF
2 "register_operand" "f"))
2055 (match_operand:DF
3 "register_operand" "f"))))]
2056 "mips_isa >=
4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
2057 "nmadd.d
\\t%
0,%
3,%
1,%
2"
2058 [(set_attr "type" "fmadd")
2059 (set_attr "mode" "DF")
2060 (set_attr "length" "
1")])
2063 [(set (match_operand:SF
0 "register_operand" "=f")
2064 (neg:SF (plus:SF (mult:SF (match_operand:SF
1 "register_operand" "f")
2065 (match_operand:SF
2 "register_operand" "f"))
2066 (match_operand:SF
3 "register_operand" "f"))))]
2067 "mips_isa >=
4 && TARGET_HARD_FLOAT"
2068 "nmadd.s
\\t%
0,%
3,%
1,%
2"
2069 [(set_attr "type" "fmadd")
2070 (set_attr "mode" "SF")
2071 (set_attr "length" "
1")])
2074 [(set (match_operand:DF
0 "register_operand" "=f")
2075 (minus:DF (match_operand:DF
1 "register_operand" "f")
2076 (mult:DF (match_operand:DF
2 "register_operand" "f")
2077 (match_operand:DF
3 "register_operand" "f"))))]
2078 "mips_isa >=
4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
2079 "nmsub.d
\\t%
0,%
1,%
2,%
3"
2080 [(set_attr "type" "fmadd")
2081 (set_attr "mode" "DF")
2082 (set_attr "length" "
1")])
2085 [(set (match_operand:SF
0 "register_operand" "=f")
2086 (minus:SF (match_operand:SF
1 "register_operand" "f")
2087 (mult:SF (match_operand:SF
2 "register_operand" "f")
2088 (match_operand:SF
3 "register_operand" "f"))))]
2089 "mips_isa >=
4 && TARGET_HARD_FLOAT"
2090 "nmsub.s
\\t%
0,%
1,%
2,%
3"
2091 [(set_attr "type" "fmadd")
2092 (set_attr "mode" "SF")
2093 (set_attr "length" "
1")])
2096 ;; ....................
2098 ;; DIVISION and REMAINDER
2100 ;; ....................
2103 (define_insn "divdf3"
2104 [(set (match_operand:DF
0 "register_operand" "=f")
2105 (div:DF (match_operand:DF
1 "register_operand" "f")
2106 (match_operand:DF
2 "register_operand" "f")))]
2107 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
2109 [(set_attr "type" "fdiv")
2110 (set_attr "mode" "DF")
2111 (set_attr "length" "
1")])
2113 (define_insn "divsf3"
2114 [(set (match_operand:SF
0 "register_operand" "=f")
2115 (div:SF (match_operand:SF
1 "register_operand" "f")
2116 (match_operand:SF
2 "register_operand" "f")))]
2119 [(set_attr "type" "fdiv")
2120 (set_attr "mode" "SF")
2121 (set_attr "length" "
1")])
2124 [(set (match_operand:DF
0 "register_operand" "=f")
2125 (div:DF (match_operand:DF
1 "const_float_1_operand" "")
2126 (match_operand:DF
2 "register_operand" "f")))]
2127 "mips_isa >=
4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && flag_fast_math"
2129 [(set_attr "type" "fdiv")
2130 (set_attr "mode" "DF")
2131 (set_attr "length" "
1")])
2134 [(set (match_operand:SF
0 "register_operand" "=f")
2135 (div:SF (match_operand:SF
1 "const_float_1_operand" "")
2136 (match_operand:SF
2 "register_operand" "f")))]
2137 "mips_isa >=
4 && TARGET_HARD_FLOAT && flag_fast_math"
2139 [(set_attr "type" "fdiv")
2140 (set_attr "mode" "SF")
2141 (set_attr "length" "
1")])
2143 ;; If optimizing, prefer the divmod functions over separate div and
2144 ;; mod functions, since this will allow using one instruction for both
2145 ;; the quotient and remainder. At present, the divmod is not moved out
2146 ;; of loops if it is constant within the loop, so allow -mdebugc to
2147 ;; use the old method of doing things.
2149 ;;
64 is the multiply/divide hi register
2150 ;;
65 is the multiply/divide lo register
2152 ;; ??? We can't accept constants here, because the MIPS assembler will replace
2153 ;; a divide by power of
2 with a shift, and then the remainder is no longer
2156 (define_insn "divmodsi4"
2157 [(set (match_operand:SI
0 "register_operand" "=d")
2158 (div:SI (match_operand:SI
1 "register_operand" "d")
2159 (match_operand:SI
2 "register_operand" "d")))
2160 (set (match_operand:SI
3 "register_operand" "=d")
2161 (mod:SI (match_dup
1)
2163 (clobber (match_scratch:SI
4 "=l"))
2164 (clobber (match_scratch:SI
5 "=h"))
2165 (clobber (match_scratch:SI
6 "=a"))]
2169 if (find_reg_note (insn, REG_UNUSED, operands[
3]))
2170 return
\"div
\\t%
0,%
1,%
2\";
2172 if (find_reg_note (insn, REG_UNUSED, operands[
0]))
2173 return
\"rem
\\t%
3,%
1,%
2\";
2175 return
\"div
\\t%
0,%
1,%
2\;mfhi
\\t%
3\";
2177 [(set_attr "type" "idiv")
2178 (set_attr "mode" "SI")
2179 (set_attr "length" "
14")]) ;; various tests for dividing by
0 and such
2181 (define_insn "divmoddi4"
2182 [(set (match_operand:DI
0 "register_operand" "=d")
2183 (div:DI (match_operand:DI
1 "se_register_operand" "d")
2184 (match_operand:DI
2 "se_register_operand" "d")))
2185 (set (match_operand:DI
3 "register_operand" "=d")
2186 (mod:DI (match_dup
1)
2188 (clobber (match_scratch:DI
4 "=l"))
2189 (clobber (match_scratch:DI
5 "=h"))
2190 (clobber (match_scratch:DI
6 "=a"))]
2191 "TARGET_64BIT && optimize"
2194 if (find_reg_note (insn, REG_UNUSED, operands[
3]))
2195 return
\"ddiv
\\t%
0,%
1,%
2\";
2197 if (find_reg_note (insn, REG_UNUSED, operands[
0]))
2198 return
\"drem
\\t%
3,%
1,%
2\";
2200 return
\"ddiv
\\t%
0,%
1,%
2\;mfhi
\\t%
3\";
2202 [(set_attr "type" "idiv")
2203 (set_attr "mode" "DI")
2204 (set_attr "length" "
15")]) ;; various tests for dividing by
0 and such
2206 (define_insn "udivmodsi4"
2207 [(set (match_operand:SI
0 "register_operand" "=d")
2208 (udiv:SI (match_operand:SI
1 "register_operand" "d")
2209 (match_operand:SI
2 "register_operand" "d")))
2210 (set (match_operand:SI
3 "register_operand" "=d")
2211 (umod:SI (match_dup
1)
2213 (clobber (match_scratch:SI
4 "=l"))
2214 (clobber (match_scratch:SI
5 "=h"))
2215 (clobber (match_scratch:SI
6 "=a"))]
2219 if (find_reg_note (insn, REG_UNUSED, operands[
3]))
2220 return
\"divu
\\t%
0,%
1,%
2\";
2222 if (find_reg_note (insn, REG_UNUSED, operands[
0]))
2223 return
\"remu
\\t%
3,%
1,%
2\";
2225 return
\"divu
\\t%
0,%
1,%
2\;mfhi
\\t%
3\";
2227 [(set_attr "type" "idiv")
2228 (set_attr "mode" "SI")
2229 (set_attr "length" "
8")]) ;; various tests for dividing by
0 and such
2231 (define_insn "udivmoddi4"
2232 [(set (match_operand:DI
0 "register_operand" "=d")
2233 (udiv:DI (match_operand:DI
1 "se_register_operand" "d")
2234 (match_operand:DI
2 "se_register_operand" "d")))
2235 (set (match_operand:DI
3 "register_operand" "=d")
2236 (umod:DI (match_dup
1)
2238 (clobber (match_scratch:DI
4 "=l"))
2239 (clobber (match_scratch:DI
5 "=h"))
2240 (clobber (match_scratch:DI
6 "=a"))]
2241 "TARGET_64BIT && optimize"
2244 if (find_reg_note (insn, REG_UNUSED, operands[
3]))
2245 return
\"ddivu
\\t%
0,%
1,%
2\";
2247 if (find_reg_note (insn, REG_UNUSED, operands[
0]))
2248 return
\"dremu
\\t%
3,%
1,%
2\";
2250 return
\"ddivu
\\t%
0,%
1,%
2\;mfhi
\\t%
3\";
2252 [(set_attr "type" "idiv")
2253 (set_attr "mode" "DI")
2254 (set_attr "length" "
8")]) ;; various tests for dividing by
0 and such
2256 (define_expand "divsi3"
2257 [(set (match_operand:SI
0 "register_operand" "=d")
2258 (div:SI (match_operand:SI
1 "register_operand" "d")
2259 (match_operand:SI
2 "nonmemory_operand" "di")))
2260 (clobber (match_scratch:SI
3 "=l"))
2261 (clobber (match_scratch:SI
4 "=h"))
2262 (clobber (match_scratch:SI
6 "=a"))]
2266 /* MIPS16 needs div/rem ops in registers. */
2268 operands[
2] = force_reg (SImode, operands[
2]);
2271 (define_insn "divsi3_internal"
2272 [(set (match_operand:SI
0 "register_operand" "=d")
2273 (div:SI (match_operand:SI
1 "register_operand" "d")
2274 (match_operand:SI
2 "nonmemory_operand" "di")))]
2277 [(set_attr "type" "idiv")
2278 (set_attr "mode" "SI")
2279 (set_attr "length" "
13")]) ;; various tests for dividing by
0 and such
2281 (define_expand "divdi3"
2282 [(set (match_operand:DI
0 "register_operand" "=d")
2283 (div:DI (match_operand:DI
1 "se_register_operand" "d")
2284 (match_operand:DI
2 "se_nonmemory_operand" "di")))
2285 (clobber (match_scratch:DI
3 "=l"))
2286 (clobber (match_scratch:DI
4 "=h"))
2287 (clobber (match_scratch:DI
6 "=a"))]
2288 "TARGET_64BIT && !optimize"
2291 /* MIPS16 needs div/rem ops in registers. */
2293 operands[
2] = force_reg (DImode, operands[
2]);
2296 (define_insn "divdi3_internal"
2297 [(set (match_operand:DI
0 "register_operand" "=d")
2298 (div:DI (match_operand:DI
1 "se_register_operand" "d")
2299 (match_operand:DI
2 "se_nonmemory_operand" "di")))]
2300 "TARGET_64BIT && !optimize"
2302 [(set_attr "type" "idiv")
2303 (set_attr "mode" "DI")
2304 (set_attr "length" "
14")]) ;; various tests for dividing by
0 and such
2306 (define_expand "modsi3"
2307 [(set (match_operand:SI
0 "register_operand" "=d")
2308 (mod:SI (match_operand:SI
1 "register_operand" "d")
2309 (match_operand:SI
2 "nonmemory_operand" "di")))
2310 (clobber (match_scratch:SI
3 "=l"))
2311 (clobber (match_scratch:SI
4 "=h"))
2312 (clobber (match_scratch:SI
6 "=a"))]
2316 /* MIPS16 needs div/rem ops in registers. */
2318 operands[
2] = force_reg (SImode, operands[
2]);
2321 (define_insn "modsi3_internal"
2322 [(set (match_operand:SI
0 "register_operand" "=d")
2323 (mod:SI (match_operand:SI
1 "register_operand" "d")
2324 (match_operand:SI
2 "nonmemory_operand" "di")))]
2327 [(set_attr "type" "idiv")
2328 (set_attr "mode" "SI")
2329 (set_attr "length" "
13")]) ;; various tests for dividing by
0 and such
2331 (define_expand "moddi3"
2332 [(set (match_operand:DI
0 "register_operand" "=d")
2333 (mod:DI (match_operand:DI
1 "se_register_operand" "d")
2334 (match_operand:DI
2 "se_nonmemory_operand" "di")))
2335 (clobber (match_scratch:DI
3 "=l"))
2336 (clobber (match_scratch:DI
4 "=h"))
2337 (clobber (match_scratch:DI
6 "=a"))]
2338 "TARGET_64BIT && !optimize"
2341 /* MIPS16 needs div/rem ops in registers. */
2343 operands[
2] = force_reg (DImode, operands[
2]);
2346 (define_insn "moddi3_internal"
2347 [(set (match_operand:DI
0 "register_operand" "=d")
2348 (mod:DI (match_operand:DI
1 "se_register_operand" "d")
2349 (match_operand:DI
2 "se_nonmemory_operand" "di")))]
2350 "TARGET_64BIT && !optimize"
2352 [(set_attr "type" "idiv")
2353 (set_attr "mode" "DI")
2354 (set_attr "length" "
14")]) ;; various tests for dividing by
0 and such
2356 (define_expand "udivsi3"
2357 [(set (match_operand:SI
0 "register_operand" "=d")
2358 (udiv:SI (match_operand:SI
1 "register_operand" "d")
2359 (match_operand:SI
2 "nonmemory_operand" "di")))
2360 (clobber (match_scratch:SI
3 "=l"))
2361 (clobber (match_scratch:SI
4 "=h"))
2362 (clobber (match_scratch:SI
6 "=a"))]
2366 /* MIPS16 needs div/rem ops in registers. */
2368 operands[
2] = force_reg (SImode, operands[
2]);
2371 (define_insn "udivsi3_internal"
2372 [(set (match_operand:SI
0 "register_operand" "=d")
2373 (udiv:SI (match_operand:SI
1 "register_operand" "d")
2374 (match_operand:SI
2 "nonmemory_operand" "di")))]
2377 [(set_attr "type" "idiv")
2378 (set_attr "mode" "SI")
2379 (set_attr "length" "
7")]) ;; various tests for dividing by
0 and such
2381 (define_expand "udivdi3"
2382 [(set (match_operand:DI
0 "register_operand" "=d")
2383 (udiv:DI (match_operand:DI
1 "se_register_operand" "d")
2384 (match_operand:DI
2 "se_nonmemory_operand" "di")))
2385 (clobber (match_scratch:DI
3 "=l"))
2386 (clobber (match_scratch:DI
4 "=h"))
2387 (clobber (match_scratch:DI
6 "=a"))]
2388 "TARGET_64BIT && !optimize"
2391 /* MIPS16 needs div/rem ops in registers. */
2393 operands[
2] = force_reg (DImode, operands[
2]);
2396 (define_insn "udivdi3_internal"
2397 [(set (match_operand:DI
0 "register_operand" "=d")
2398 (udiv:DI (match_operand:DI
1 "se_register_operand" "d")
2399 (match_operand:DI
2 "se_nonmemory_operand" "di")))]
2400 "TARGET_64BIT && !optimize"
2402 [(set_attr "type" "idiv")
2403 (set_attr "mode" "DI")
2404 (set_attr "length" "
7")]) ;; various tests for dividing by
0 and such
2406 (define_expand "umodsi3"
2407 [(set (match_operand:SI
0 "register_operand" "=d")
2408 (umod:SI (match_operand:SI
1 "register_operand" "d")
2409 (match_operand:SI
2 "nonmemory_operand" "di")))
2410 (clobber (match_scratch:SI
3 "=l"))
2411 (clobber (match_scratch:SI
4 "=h"))
2412 (clobber (match_scratch:SI
6 "=a"))]
2416 /* MIPS16 needs div/rem ops in registers. */
2418 operands[
2] = force_reg (SImode, operands[
2]);
2421 (define_insn "umodsi3_internal"
2422 [(set (match_operand:SI
0 "register_operand" "=d")
2423 (umod:SI (match_operand:SI
1 "register_operand" "d")
2424 (match_operand:SI
2 "nonmemory_operand" "di")))]
2427 [(set_attr "type" "idiv")
2428 (set_attr "mode" "SI")
2429 (set_attr "length" "
7")]) ;; various tests for dividing by
0 and such
2431 (define_expand "umoddi3"
2432 [(set (match_operand:DI
0 "register_operand" "=d")
2433 (umod:DI (match_operand:DI
1 "se_register_operand" "d")
2434 (match_operand:DI
2 "se_nonmemory_operand" "di")))
2435 (clobber (match_scratch:DI
3 "=l"))
2436 (clobber (match_scratch:DI
4 "=h"))
2437 (clobber (match_scratch:DI
6 "=a"))]
2438 "TARGET_64BIT && !optimize"
2441 /* MIPS16 needs div/rem ops in registers. */
2443 operands[
2] = force_reg (DImode, operands[
2]);
2446 (define_insn "umoddi3_internal"
2447 [(set (match_operand:DI
0 "register_operand" "=d")
2448 (umod:DI (match_operand:DI
1 "se_register_operand" "d")
2449 (match_operand:DI
2 "se_nonmemory_operand" "di")))]
2450 "TARGET_64BIT && !optimize"
2452 [(set_attr "type" "idiv")
2453 (set_attr "mode" "DI")
2454 (set_attr "length" "
7")]) ;; various tests for dividing by
0 and such
2458 ;; ....................
2462 ;; ....................
2464 (define_insn "sqrtdf2"
2465 [(set (match_operand:DF
0 "register_operand" "=f")
2466 (sqrt:DF (match_operand:DF
1 "register_operand" "f")))]
2467 "TARGET_HARD_FLOAT && HAVE_SQRT_P() && TARGET_DOUBLE_FLOAT"
2469 [(set_attr "type" "fsqrt")
2470 (set_attr "mode" "DF")
2471 (set_attr "length" "
1")])
2473 (define_insn "sqrtsf2"
2474 [(set (match_operand:SF
0 "register_operand" "=f")
2475 (sqrt:SF (match_operand:SF
1 "register_operand" "f")))]
2476 "TARGET_HARD_FLOAT && HAVE_SQRT_P()"
2478 [(set_attr "type" "fsqrt")
2479 (set_attr "mode" "SF")
2480 (set_attr "length" "
1")])
2483 [(set (match_operand:DF
0 "register_operand" "=f")
2484 (div:DF (match_operand:DF
1 "const_float_1_operand" "")
2485 (sqrt:DF (match_operand:DF
2 "register_operand" "f"))))]
2486 "mips_isa >=
4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && flag_fast_math"
2488 [(set_attr "type" "fsqrt")
2489 (set_attr "mode" "DF")
2490 (set_attr "length" "
1")])
2493 [(set (match_operand:SF
0 "register_operand" "=f")
2494 (div:SF (match_operand:SF
1 "const_float_1_operand" "")
2495 (sqrt:SF (match_operand:SF
2 "register_operand" "f"))))]
2496 "mips_isa >=
4 && TARGET_HARD_FLOAT && flag_fast_math"
2498 [(set_attr "type" "fsqrt")
2499 (set_attr "mode" "SF")
2500 (set_attr "length" "
1")])
2504 ;; ....................
2508 ;; ....................
2510 ;; Do not use the integer abs macro instruction, since that signals an
2511 ;; exception on -
2147483648 (sigh).
2513 (define_insn "abssi2"
2514 [(set (match_operand:SI
0 "register_operand" "=d")
2515 (abs:SI (match_operand:SI
1 "register_operand" "d")))]
2519 dslots_jump_total++;
2520 dslots_jump_filled++;
2521 operands[
2] = const0_rtx;
2523 if (REGNO (operands[
0]) == REGNO (operands[
1]))
2525 if (GENERATE_BRANCHLIKELY)
2526 return
\"%(bltzl
\\t%
1,
1f
\\n
\\tsubu
\\t%
0,%z2,%
0\\n1:%)
\";
2528 return
\"bgez
\\t%
1,
1f%#
\\n
\\tsubu
\\t%
0,%z2,%
0\\n1:
\";
2531 return
\"%(bgez
\\t%
1,
1f
\\n
\\tmove
\\t%
0,%
1\\n
\\tsubu
\\t%
0,%z2,%
0\\n1:%)
\";
2533 [(set_attr "type" "multi")
2534 (set_attr "mode" "SI")
2535 (set_attr "length" "
3")])
2537 (define_insn "absdi2"
2538 [(set (match_operand:DI
0 "register_operand" "=d")
2539 (abs:DI (match_operand:DI
1 "se_register_operand" "d")))]
2540 "TARGET_64BIT && !TARGET_MIPS16"
2543 dslots_jump_total++;
2544 dslots_jump_filled++;
2545 operands[
2] = const0_rtx;
2547 if (REGNO (operands[
0]) == REGNO (operands[
1]))
2548 return
\"%(bltzl
\\t%
1,
1f
\\n
\\tdsubu
\\t%
0,%z2,%
0\\n1:%)
\";
2550 return
\"%(bgez
\\t%
1,
1f
\\n
\\tmove
\\t%
0,%
1\\n
\\tdsubu
\\t%
0,%z2,%
0\\n1:%)
\";
2552 [(set_attr "type" "multi")
2553 (set_attr "mode" "DI")
2554 (set_attr "length" "
3")])
2556 (define_insn "absdf2"
2557 [(set (match_operand:DF
0 "register_operand" "=f")
2558 (abs:DF (match_operand:DF
1 "register_operand" "f")))]
2559 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
2561 [(set_attr "type" "fabs")
2562 (set_attr "mode" "DF")
2563 (set_attr "length" "
1")])
2565 (define_insn "abssf2"
2566 [(set (match_operand:SF
0 "register_operand" "=f")
2567 (abs:SF (match_operand:SF
1 "register_operand" "f")))]
2570 [(set_attr "type" "fabs")
2571 (set_attr "mode" "SF")
2572 (set_attr "length" "
1")])
2576 ;; ....................
2578 ;; FIND FIRST BIT INSTRUCTION
2580 ;; ....................
2583 (define_insn "ffssi2"
2584 [(set (match_operand:SI
0 "register_operand" "=&d")
2585 (ffs:SI (match_operand:SI
1 "register_operand" "d")))
2586 (clobber (match_scratch:SI
2 "=&d"))
2587 (clobber (match_scratch:SI
3 "=&d"))]
2591 dslots_jump_total +=
2;
2592 dslots_jump_filled +=
2;
2593 operands[
4] = const0_rtx;
2595 if (optimize && find_reg_note (insn, REG_DEAD, operands[
1]))
2598 \\tbeq
\\t%
1,%z4,
2f
\\n
\\
2599 1:
\\tand
\\t%
2,%
1,
0x0001\\n
\\
2600 \\taddu
\\t%
0,%
0,
1\\n
\\
2601 \\tbeq
\\t%
2,%z4,
1b
\\n
\\
2602 \\tsrl
\\t%
1,%
1,
1\\n
\\
2607 \\tmove
\\t%
3,%
1\\n
\\
2608 \\tbeq
\\t%
3,%z4,
2f
\\n
\\
2609 1:
\\tand
\\t%
2,%
3,
0x0001\\n
\\
2610 \\taddu
\\t%
0,%
0,
1\\n
\\
2611 \\tbeq
\\t%
2,%z4,
1b
\\n
\\
2612 \\tsrl
\\t%
3,%
3,
1\\n
\\
2615 [(set_attr "type" "multi")
2616 (set_attr "mode" "SI")
2617 (set_attr "length" "
6")])
2619 (define_insn "ffsdi2"
2620 [(set (match_operand:DI
0 "register_operand" "=&d")
2621 (ffs:DI (match_operand:DI
1 "se_register_operand" "d")))
2622 (clobber (match_scratch:DI
2 "=&d"))
2623 (clobber (match_scratch:DI
3 "=&d"))]
2624 "TARGET_64BIT && !TARGET_MIPS16"
2627 dslots_jump_total +=
2;
2628 dslots_jump_filled +=
2;
2629 operands[
4] = const0_rtx;
2631 if (optimize && find_reg_note (insn, REG_DEAD, operands[
1]))
2634 \\tbeq
\\t%
1,%z4,
2f
\\n
\\
2635 1:
\\tand
\\t%
2,%
1,
0x0001\\n
\\
2636 \\tdaddu
\\t%
0,%
0,
1\\n
\\
2637 \\tbeq
\\t%
2,%z4,
1b
\\n
\\
2638 \\tdsrl
\\t%
1,%
1,
1\\n
\\
2643 \\tmove
\\t%
3,%
1\\n
\\
2644 \\tbeq
\\t%
3,%z4,
2f
\\n
\\
2645 1:
\\tand
\\t%
2,%
3,
0x0001\\n
\\
2646 \\tdaddu
\\t%
0,%
0,
1\\n
\\
2647 \\tbeq
\\t%
2,%z4,
1b
\\n
\\
2648 \\tdsrl
\\t%
3,%
3,
1\\n
\\
2651 [(set_attr "type" "multi")
2652 (set_attr "mode" "DI")
2653 (set_attr "length" "
6")])
2657 ;; ....................
2659 ;; NEGATION and ONE'S COMPLEMENT
2661 ;; ....................
2663 (define_insn "negsi2"
2664 [(set (match_operand:SI
0 "register_operand" "=d")
2665 (neg:SI (match_operand:SI
1 "register_operand" "d")))]
2670 return
\"neg
\\t%
0,%
1\";
2671 operands[
2] = const0_rtx;
2672 return
\"subu
\\t%
0,%z2,%
1\";
2674 [(set_attr "type" "arith")
2675 (set_attr "mode" "SI")
2676 (set_attr "length" "
1")])
2678 (define_expand "negdi2"
2679 [(parallel [(set (match_operand:DI
0 "register_operand" "=d")
2680 (neg:DI (match_operand:DI
1 "se_register_operand" "d")))
2681 (clobber (match_dup
2))])]
2682 "(TARGET_64BIT || !TARGET_DEBUG_G_MODE) && !TARGET_MIPS16"
2687 emit_insn (gen_negdi2_internal_2 (operands[
0], operands[
1]));
2691 operands[
2] = gen_reg_rtx (SImode);
2694 (define_insn "negdi2_internal"
2695 [(set (match_operand:DI
0 "register_operand" "=d")
2696 (neg:DI (match_operand:DI
1 "register_operand" "d")))
2697 (clobber (match_operand:SI
2 "register_operand" "=d"))]
2698 "! TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16"
2701 operands[
3] = const0_rtx;
2702 return
\"subu
\\t%L0,%z3,%L1\;subu
\\t%M0,%z3,%M1\;sltu
\\t%
2,%z3,%L0\;subu
\\t%M0,%M0,%
2\";
2704 [(set_attr "type" "darith")
2705 (set_attr "mode" "DI")
2706 (set_attr "length" "
4")])
2708 (define_insn "negdi2_internal_2"
2709 [(set (match_operand:DI
0 "register_operand" "=d")
2710 (neg:DI (match_operand:DI
1 "se_register_operand" "d")))]
2711 "TARGET_64BIT && !TARGET_MIPS16"
2714 operands[
2] = const0_rtx;
2715 return
\"dsubu
\\t%
0,%z2,%
1\";
2717 [(set_attr "type" "arith")
2718 (set_attr "mode" "DI")
2719 (set_attr "length" "
1")])
2721 (define_insn "negdf2"
2722 [(set (match_operand:DF
0 "register_operand" "=f")
2723 (neg:DF (match_operand:DF
1 "register_operand" "f")))]
2724 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
2726 [(set_attr "type" "fneg")
2727 (set_attr "mode" "DF")
2728 (set_attr "length" "
1")])
2730 (define_insn "negsf2"
2731 [(set (match_operand:SF
0 "register_operand" "=f")
2732 (neg:SF (match_operand:SF
1 "register_operand" "f")))]
2735 [(set_attr "type" "fneg")
2736 (set_attr "mode" "SF")
2737 (set_attr "length" "
1")])
2739 (define_insn "one_cmplsi2"
2740 [(set (match_operand:SI
0 "register_operand" "=d")
2741 (not:SI (match_operand:SI
1 "register_operand" "d")))]
2746 return
\"not
\\t%
0,%
1\";
2747 operands[
2] = const0_rtx;
2748 return
\"nor
\\t%
0,%z2,%
1\";
2750 [(set_attr "type" "arith")
2751 (set_attr "mode" "SI")
2752 (set_attr "length" "
1")])
2754 (define_insn "one_cmpldi2"
2755 [(set (match_operand:DI
0 "register_operand" "=d")
2756 (not:DI (match_operand:DI
1 "se_register_operand" "d")))]
2763 return
\"not
\\t%
0,%
1\";
2764 return
\"not
\\t%M0,%M1\;not
\\t%L0,%L1
\";
2766 operands[
2] = const0_rtx;
2768 return
\"nor
\\t%
0,%z2,%
1\";
2769 return
\"nor
\\t%M0,%z2,%M1\;nor
\\t%L0,%z2,%L1
\";
2771 [(set_attr "type" "darith")
2772 (set_attr "mode" "DI")
2773 (set (attr "length")
2774 (if_then_else (ge (symbol_ref "mips_isa") (const_int
3))
2779 [(set (match_operand:DI
0 "register_operand" "")
2780 (not:DI (match_operand:DI
1 "register_operand" "")))]
2781 "reload_completed && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
2782 && GET_CODE (operands[
0]) == REG && GP_REG_P (REGNO (operands[
0]))
2783 && GET_CODE (operands[
1]) == REG && GP_REG_P (REGNO (operands[
1]))"
2785 [(set (subreg:SI (match_dup
0)
0) (not:SI (subreg:SI (match_dup
1)
0)))
2786 (set (subreg:SI (match_dup
0)
1) (not:SI (subreg:SI (match_dup
1)
1)))]
2791 ;; ....................
2795 ;; ....................
2798 ;; Many of these instructions uses trivial define_expands, because we
2799 ;; want to use a different set of constraints when TARGET_MIPS16.
2801 (define_expand "andsi3"
2802 [(set (match_operand:SI
0 "register_operand" "=d,d")
2803 (and:SI (match_operand:SI
1 "uns_arith_operand" "%d,d")
2804 (match_operand:SI
2 "uns_arith_operand" "d,K")))]
2809 operands[
2] = force_reg (SImode, operands[
2]);
2813 [(set (match_operand:SI
0 "register_operand" "=d,d")
2814 (and:SI (match_operand:SI
1 "uns_arith_operand" "%d,d")
2815 (match_operand:SI
2 "uns_arith_operand" "d,K")))]
2820 [(set_attr "type" "arith")
2821 (set_attr "mode" "SI")
2822 (set_attr "length" "
1")])
2825 [(set (match_operand:SI
0 "register_operand" "=d")
2826 (and:SI (match_operand:SI
1 "register_operand" "%
0")
2827 (match_operand:SI
2 "register_operand" "d")))]
2830 [(set_attr "type" "arith")
2831 (set_attr "mode" "SI")
2832 (set_attr "length" "
1")])
2834 (define_expand "anddi3"
2835 [(set (match_operand:DI
0 "register_operand" "=d")
2836 (and:DI (match_operand:DI
1 "se_register_operand" "d")
2837 (match_operand:DI
2 "se_register_operand" "d")))]
2838 "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
2842 operands[
2] = force_reg (DImode, operands[
2]);
2846 [(set (match_operand:DI
0 "register_operand" "=d")
2847 (and:DI (match_operand:DI
1 "se_register_operand" "d")
2848 (match_operand:DI
2 "se_register_operand" "d")))]
2849 "(TARGET_64BIT || !TARGET_DEBUG_G_MODE) && !TARGET_MIPS16"
2853 return
\"and
\\t%
0,%
1,%
2\";
2854 return
\"and
\\t%M0,%M1,%M2\;and
\\t%L0,%L1,%L2
\";
2856 [(set_attr "type" "darith")
2857 (set_attr "mode" "DI")
2858 (set (attr "length")
2859 (if_then_else (ne (symbol_ref "TARGET_64BIT") (const_int
0))
2864 [(set (match_operand:DI
0 "register_operand" "=d")
2865 (and:DI (match_operand:DI
1 "se_register_operand" "
0")
2866 (match_operand:DI
2 "se_register_operand" "d")))]
2867 "(TARGET_64BIT || !TARGET_DEBUG_G_MODE) && TARGET_MIPS16"
2871 return
\"and
\\t%
0,%
2\";
2872 return
\"and
\\t%M0,%M2\;and
\\t%L0,%L2
\";
2874 [(set_attr "type" "darith")
2875 (set_attr "mode" "DI")
2876 (set (attr "length")
2877 (if_then_else (ge (symbol_ref "mips_isa") (const_int
3))
2882 [(set (match_operand:DI
0 "register_operand" "")
2883 (and:DI (match_operand:DI
1 "register_operand" "")
2884 (match_operand:DI
2 "register_operand" "")))]
2885 "reload_completed && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
2886 && GET_CODE (operands[
0]) == REG && GP_REG_P (REGNO (operands[
0]))
2887 && GET_CODE (operands[
1]) == REG && GP_REG_P (REGNO (operands[
1]))
2888 && GET_CODE (operands[
2]) == REG && GP_REG_P (REGNO (operands[
2]))"
2890 [(set (subreg:SI (match_dup
0)
0) (and:SI (subreg:SI (match_dup
1)
0) (subreg:SI (match_dup
2)
0)))
2891 (set (subreg:SI (match_dup
0)
1) (and:SI (subreg:SI (match_dup
1)
1) (subreg:SI (match_dup
2)
1)))]
2894 (define_insn "anddi3_internal1"
2895 [(set (match_operand:DI
0 "register_operand" "=d,d")
2896 (and:DI (match_operand:DI
1 "se_register_operand" "%d,d")
2897 (match_operand:DI
2 "se_uns_arith_operand" "d,K")))]
2898 "TARGET_64BIT && !TARGET_MIPS16"
2902 [(set_attr "type" "arith")
2903 (set_attr "mode" "DI")
2904 (set_attr "length" "
1")])
2906 (define_expand "iorsi3"
2907 [(set (match_operand:SI
0 "register_operand" "=d,d")
2908 (ior:SI (match_operand:SI
1 "uns_arith_operand" "%d,d")
2909 (match_operand:SI
2 "uns_arith_operand" "d,K")))]
2914 operands[
2] = force_reg (SImode, operands[
2]);
2918 [(set (match_operand:SI
0 "register_operand" "=d,d")
2919 (ior:SI (match_operand:SI
1 "uns_arith_operand" "%d,d")
2920 (match_operand:SI
2 "uns_arith_operand" "d,K")))]
2925 [(set_attr "type" "arith")
2926 (set_attr "mode" "SI")
2927 (set_attr "length" "
1")])
2930 [(set (match_operand:SI
0 "register_operand" "=d")
2931 (ior:SI (match_operand:SI
1 "register_operand" "%
0")
2932 (match_operand:SI
2 "register_operand" "d")))]
2935 [(set_attr "type" "arith")
2936 (set_attr "mode" "SI")
2937 (set_attr "length" "
1")])
2939 ;;; ??? There is no iordi3 pattern which accepts 'K' constants when
2942 (define_expand "iordi3"
2943 [(set (match_operand:DI
0 "register_operand" "=d")
2944 (ior:DI (match_operand:DI
1 "se_register_operand" "d")
2945 (match_operand:DI
2 "se_register_operand" "d")))]
2946 "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
2950 [(set (match_operand:DI
0 "register_operand" "=d")
2951 (ior:DI (match_operand:DI
1 "se_register_operand" "d")
2952 (match_operand:DI
2 "se_register_operand" "d")))]
2953 "(TARGET_64BIT || !TARGET_DEBUG_G_MODE) && !TARGET_MIPS16"
2957 return
\"or
\\t%
0,%
1,%
2\";
2958 return
\"or
\\t%M0,%M1,%M2\;or
\\t%L0,%L1,%L2
\";
2960 [(set_attr "type" "darith")
2961 (set_attr "mode" "DI")
2962 (set (attr "length")
2963 (if_then_else (ne (symbol_ref "TARGET_64BIT") (const_int
0))
2968 [(set (match_operand:DI
0 "register_operand" "=d")
2969 (ior:DI (match_operand:DI
1 "se_register_operand" "
0")
2970 (match_operand:DI
2 "se_register_operand" "d")))]
2971 "(TARGET_64BIT || !TARGET_DEBUG_G_MODE) && TARGET_MIPS16"
2975 return
\"or
\\t%
0,%
2\";
2976 return
\"or
\\t%M0,%M2\;or
\\t%L0,%L2
\";
2978 [(set_attr "type" "darith")
2979 (set_attr "mode" "DI")
2980 (set (attr "length")
2981 (if_then_else (ge (symbol_ref "mips_isa") (const_int
3))
2986 [(set (match_operand:DI
0 "register_operand" "")
2987 (ior:DI (match_operand:DI
1 "register_operand" "")
2988 (match_operand:DI
2 "register_operand" "")))]
2989 "reload_completed && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
2990 && GET_CODE (operands[
0]) == REG && GP_REG_P (REGNO (operands[
0]))
2991 && GET_CODE (operands[
1]) == REG && GP_REG_P (REGNO (operands[
1]))
2992 && GET_CODE (operands[
2]) == REG && GP_REG_P (REGNO (operands[
2]))"
2994 [(set (subreg:SI (match_dup
0)
0) (ior:SI (subreg:SI (match_dup
1)
0) (subreg:SI (match_dup
2)
0)))
2995 (set (subreg:SI (match_dup
0)
1) (ior:SI (subreg:SI (match_dup
1)
1) (subreg:SI (match_dup
2)
1)))]
2998 (define_expand "xorsi3"
2999 [(set (match_operand:SI
0 "register_operand" "=d,d")
3000 (xor:SI (match_operand:SI
1 "uns_arith_operand" "%d,d")
3001 (match_operand:SI
2 "uns_arith_operand" "d,K")))]
3006 [(set (match_operand:SI
0 "register_operand" "=d,d")
3007 (xor:SI (match_operand:SI
1 "uns_arith_operand" "%d,d")
3008 (match_operand:SI
2 "uns_arith_operand" "d,K")))]
3013 [(set_attr "type" "arith")
3014 (set_attr "mode" "SI")
3015 (set_attr "length" "
1")])
3018 [(set (match_operand:SI
0 "register_operand" "=d,t,t")
3019 (xor:SI (match_operand:SI
1 "uns_arith_operand" "%
0,d,d")
3020 (match_operand:SI
2 "uns_arith_operand" "d,K,d")))]
3026 [(set_attr "type" "arith")
3027 (set_attr "mode" "SI")
3028 (set_attr_alternative "length"
3030 (if_then_else (match_operand:VOID
2 "m16_uimm8_1" "")
3035 ;; ??? If delete the
32-bit long long patterns, then could merge this with
3036 ;; the following xordi3_internal pattern.
3037 (define_expand "xordi3"
3038 [(set (match_operand:DI
0 "register_operand" "=d")
3039 (xor:DI (match_operand:DI
1 "se_register_operand" "d")
3040 (match_operand:DI
2 "se_register_operand" "d")))]
3041 "TARGET_64BIT || !TARGET_DEBUG_G_MODE"
3045 [(set (match_operand:DI
0 "register_operand" "=d")
3046 (xor:DI (match_operand:DI
1 "se_register_operand" "d")
3047 (match_operand:DI
2 "se_register_operand" "d")))]
3048 "(TARGET_64BIT || !TARGET_DEBUG_G_MODE) && !TARGET_MIPS16"
3052 return
\"xor
\\t%
0,%
1,%
2\";
3053 return
\"xor
\\t%M0,%M1,%M2\;xor
\\t%L0,%L1,%L2
\";
3055 [(set_attr "type" "darith")
3056 (set_attr "mode" "DI")
3057 (set (attr "length")
3058 (if_then_else (ne (symbol_ref "TARGET_64BIT") (const_int
0))
3063 [(set (match_operand:DI
0 "register_operand" "=d")
3064 (xor:DI (match_operand:DI
1 "se_register_operand" "
0")
3065 (match_operand:DI
2 "se_register_operand" "d")))]
3066 "!TARGET_64BIT && TARGET_MIPS16"
3067 "xor
\\t%M0,%M2\;xor
\\t%L0,%L2"
3068 [(set_attr "type" "darith")
3069 (set_attr "mode" "DI")
3070 (set_attr "length" "
2")])
3073 [(set (match_operand:DI
0 "register_operand" "=d,t,t")
3074 (xor:DI (match_operand:DI
1 "se_register_operand" "%
0,d,d")
3075 (match_operand:DI
2 "se_uns_arith_operand" "d,K,d")))]
3076 "TARGET_64BIT && TARGET_MIPS16"
3081 [(set_attr "type" "arith")
3082 (set_attr "mode" "DI")
3083 (set_attr_alternative "length"
3085 (if_then_else (match_operand:VOID
2 "m16_uimm8_1" "")
3091 [(set (match_operand:DI
0 "register_operand" "")
3092 (xor:DI (match_operand:DI
1 "register_operand" "")
3093 (match_operand:DI
2 "register_operand" "")))]
3094 "reload_completed && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
3095 && GET_CODE (operands[
0]) == REG && GP_REG_P (REGNO (operands[
0]))
3096 && GET_CODE (operands[
1]) == REG && GP_REG_P (REGNO (operands[
1]))
3097 && GET_CODE (operands[
2]) == REG && GP_REG_P (REGNO (operands[
2]))"
3099 [(set (subreg:SI (match_dup
0)
0) (xor:SI (subreg:SI (match_dup
1)
0) (subreg:SI (match_dup
2)
0)))
3100 (set (subreg:SI (match_dup
0)
1) (xor:SI (subreg:SI (match_dup
1)
1) (subreg:SI (match_dup
2)
1)))]
3103 (define_insn "xordi3_immed"
3104 [(set (match_operand:DI
0 "register_operand" "=d")
3105 (xor:DI (match_operand:DI
1 "se_register_operand" "d")
3106 (match_operand:DI
2 "se_uns_arith_operand" "K")))]
3107 "TARGET_64BIT && !TARGET_MIPS16"
3109 [(set_attr "type" "arith")
3110 (set_attr "mode" "DI")
3111 (set_attr "length" "
1")])
3113 (define_insn "*norsi3"
3114 [(set (match_operand:SI
0 "register_operand" "=d")
3115 (and:SI (not:SI (match_operand:SI
1 "register_operand" "d"))
3116 (not:SI (match_operand:SI
2 "register_operand" "d"))))]
3119 [(set_attr "type" "arith")
3120 (set_attr "mode" "SI")
3121 (set_attr "length" "
1")])
3123 (define_insn "*nordi3"
3124 [(set (match_operand:DI
0 "register_operand" "=d")
3125 (and:DI (not:DI (match_operand:DI
1 "se_register_operand" "d"))
3126 (not:DI (match_operand:DI
2 "se_register_operand" "d"))))]
3131 return
\"nor
\\t%
0,%z1,%z2
\";
3132 return
\"nor
\\t%M0,%M1,%M2\;nor
\\t%L0,%L1,%L2
\";
3134 [(set_attr "type" "darith")
3135 (set_attr "mode" "DI")
3136 (set (attr "length")
3137 (if_then_else (ne (symbol_ref "TARGET_64BIT") (const_int
0))
3142 [(set (match_operand:DI
0 "register_operand" "")
3143 (and:DI (not:DI (match_operand:DI
1 "register_operand" ""))
3144 (not:DI (match_operand:DI
2 "register_operand" ""))))]
3145 "reload_completed && !TARGET_MIPS16 && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
3146 && GET_CODE (operands[
0]) == REG && GP_REG_P (REGNO (operands[
0]))
3147 && GET_CODE (operands[
1]) == REG && GP_REG_P (REGNO (operands[
1]))
3148 && GET_CODE (operands[
2]) == REG && GP_REG_P (REGNO (operands[
2]))"
3150 [(set (subreg:SI (match_dup
0)
0) (and:SI (not:SI (subreg:SI (match_dup
1)
0)) (not:SI (subreg:SI (match_dup
2)
0))))
3151 (set (subreg:SI (match_dup
0)
1) (and:SI (not:SI (subreg:SI (match_dup
1)
1)) (not:SI (subreg:SI (match_dup
2)
1))))]
3155 ;; ....................
3159 ;; ....................
3161 (define_insn "truncdfsf2"
3162 [(set (match_operand:SF
0 "register_operand" "=f")
3163 (float_truncate:SF (match_operand:DF
1 "register_operand" "f")))]
3164 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
3166 [(set_attr "type" "fcvt")
3167 (set_attr "mode" "SF")
3168 (set_attr "length" "
1")])
3170 (define_insn "truncdisi2"
3171 [(set (match_operand:SI
0 "register_operand" "=d")
3172 (truncate:SI (match_operand:DI
1 "se_register_operand" "d")))]
3177 return
\"dsll
\\t%
0,%
1,
32\;dsra
\\t%
0,
32\";
3178 return
\"dsll
\\t%
0,%
1,
32\;dsra
\\t%
0,%
0,
32\";
3180 [(set_attr "type" "darith")
3181 (set_attr "mode" "SI")
3182 (set (attr "length") (if_then_else (eq (symbol_ref "mips16") (const_int
0))
3186 (define_insn "truncdihi2"
3187 [(set (match_operand:HI
0 "register_operand" "=d")
3188 (truncate:HI (match_operand:DI
1 "se_register_operand" "d")))]
3189 "TARGET_64BIT && !TARGET_MIPS16"
3190 "andi
\\t%
0,%
1,
0xffff"
3191 [(set_attr "type" "darith")
3192 (set_attr "mode" "HI")
3193 (set_attr "length" "
1")])
3195 (define_insn "truncdiqi2"
3196 [(set (match_operand:QI
0 "register_operand" "=d")
3197 (truncate:QI (match_operand:DI
1 "se_register_operand" "d")))]
3198 "TARGET_64BIT && !TARGET_MIPS16"
3199 "andi
\\t%
0,%
1,
0x00ff"
3200 [(set_attr "type" "darith")
3201 (set_attr "mode" "QI")
3202 (set_attr "length" "
1")])
3204 ;; Combiner patterns to optimize shift/truncate combinations.
3206 [(set (match_operand:SI
0 "register_operand" "=d")
3207 (truncate:SI (ashiftrt:DI (match_operand:DI
1 "se_register_operand" "d")
3208 (match_operand:DI
2 "small_int" "I"))))]
3209 "TARGET_64BIT && !TARGET_MIPS16"
3212 int shift_amt = INTVAL (operands[
2]) &
0x3f;
3216 operands[
2] = GEN_INT (
32 - shift_amt);
3217 return
\"dsll
\\t%
0,%
1,%
2\;dsra
\\t%
0,%
0,
32\";
3221 operands[
2] = GEN_INT (shift_amt);
3222 return
\"dsra
\\t%
0,%
1,%
2\";
3225 [(set_attr "type" "darith")
3226 (set_attr "mode" "SI")
3227 (set_attr "length" "
2")])
3230 [(set (match_operand:SI
0 "register_operand" "=d")
3231 (truncate:SI (lshiftrt:DI (match_operand:DI
1 "se_register_operand" "d")
3232 (match_operand:DI
2 "small_int" "I"))))]
3233 "TARGET_64BIT && !TARGET_MIPS16"
3236 int shift_amt = INTVAL (operands[
2]) &
0x3f;
3240 operands[
2] = GEN_INT (
32 - shift_amt);
3241 return
\"dsll
\\t%
0,%
1,%
2\;dsra
\\t%
0,%
0,
32\";
3243 else if (shift_amt ==
32)
3244 return
\"dsra
\\t%
0,%
1,
32\";
3247 operands[
2] = GEN_INT (shift_amt);
3248 return
\"dsrl
\\t%
0,%
1,%
2\";
3251 [(set_attr "type" "darith")
3252 (set_attr "mode" "SI")
3253 (set_attr "length" "
2")])
3256 [(set (match_operand:SI
0 "register_operand" "=d")
3257 (truncate:SI (ashift:DI (match_operand:DI
1 "se_register_operand" "d")
3258 (match_operand:DI
2 "small_int" "I"))))]
3262 int shift_amt = INTVAL (operands[
2]) &
0x3f;
3266 operands[
2] = GEN_INT (
32 + shift_amt);
3268 return
\"dsll
\\t%
0,%
1,%
2\;dsra
\\t%
0,
32\";
3269 return
\"dsll
\\t%
0,%
1,%
2\;dsra
\\t%
0,%
0,
32\";
3272 return
\"move
\\t%
0,%.
\";
3274 [(set_attr "type" "darith")
3275 (set_attr "mode" "SI")
3276 (set_attr "length" "
2")])
3278 ;; Combiner patterns to optimize truncate/zero_extend combinations.
3281 [(set (match_operand:SI
0 "register_operand" "=d")
3282 (zero_extend:SI (truncate:HI
3283 (match_operand:DI
1 "se_register_operand" "d"))))]
3284 "TARGET_64BIT && !TARGET_MIPS16"
3285 "andi
\\t%
0,%
1,
0xffff"
3286 [(set_attr "type" "darith")
3287 (set_attr "mode" "SI")
3288 (set_attr "length" "
1")])
3291 [(set (match_operand:SI
0 "register_operand" "=d")
3292 (zero_extend:SI (truncate:QI
3293 (match_operand:DI
1 "se_register_operand" "d"))))]
3294 "TARGET_64BIT && !TARGET_MIPS16"
3296 [(set_attr "type" "darith")
3297 (set_attr "mode" "SI")
3298 (set_attr "length" "
1")])
3301 [(set (match_operand:HI
0 "register_operand" "=d")
3302 (zero_extend:HI (truncate:QI
3303 (match_operand:DI
1 "se_register_operand" "d"))))]
3304 "TARGET_64BIT && !TARGET_MIPS16"
3306 [(set_attr "type" "darith")
3307 (set_attr "mode" "HI")
3308 (set_attr "length" "
1")])
3311 ;; ....................
3315 ;; ....................
3318 ;; Those for integer source operand are ordered widest source type first.
3320 (define_expand "zero_extendsidi2"
3321 [(set (match_operand:DI
0 "register_operand" "")
3322 (zero_extend:DI (match_operand:SI
1 "nonimmediate_operand" "")))]
3326 if (optimize && GET_CODE (operands[
1]) == MEM)
3327 operands[
1] = force_not_mem (operands[
1]);
3329 if (GET_CODE (operands[
1]) != MEM)
3331 rtx op1 = gen_lowpart (DImode, operands[
1]);
3332 rtx temp = gen_reg_rtx (DImode);
3333 rtx shift = gen_rtx (CONST_INT, VOIDmode,
32);
3335 emit_insn (gen_ashldi3 (temp, op1, shift));
3336 emit_insn (gen_lshrdi3 (operands[
0], temp, shift));
3341 (define_insn "zero_extendsidi2_internal"
3342 [(set (match_operand:DI
0 "register_operand" "=d,d")
3343 (zero_extend:DI (match_operand:SI
1 "memory_operand" "R,m")))]
3345 "* return mips_move_1word (operands, insn, TRUE);"
3346 [(set_attr "type" "load")
3347 (set_attr "mode" "DI")
3348 (set_attr "length" "
1,
2")])
3350 (define_expand "zero_extendhisi2"
3351 [(set (match_operand:SI
0 "register_operand" "")
3352 (zero_extend:SI (match_operand:HI
1 "nonimmediate_operand" "")))]
3356 if (TARGET_MIPS16 && GET_CODE (operands[
1]) != MEM)
3358 rtx op = gen_lowpart (SImode, operands[
1]);
3359 rtx temp = force_reg (SImode, GEN_INT (
0xffff));
3361 emit_insn (gen_andsi3 (operands[
0], op, temp));
3367 [(set (match_operand:SI
0 "register_operand" "=d,d,d")
3368 (zero_extend:SI (match_operand:HI
1 "nonimmediate_operand" "d,R,m")))]
3372 if (which_alternative ==
0)
3373 return
\"andi
\\t%
0,%
1,
0xffff\";
3375 return mips_move_1word (operands, insn, TRUE);
3377 [(set_attr "type" "arith,load,load")
3378 (set_attr "mode" "SI")
3379 (set_attr "length" "
1,
1,
2")])
3382 [(set (match_operand:SI
0 "register_operand" "=d,d")
3383 (zero_extend:SI (match_operand:HI
1 "memory_operand" "R,m")))]
3385 "* return mips_move_1word (operands, insn, TRUE);"
3386 [(set_attr "type" "load,load")
3387 (set_attr "mode" "SI")
3388 (set_attr "length" "
1,
2")])
3390 (define_expand "zero_extendhidi2"
3391 [(set (match_operand:DI
0 "register_operand" "")
3392 (zero_extend:DI (match_operand:HI
1 "nonimmediate_operand" "")))]
3396 if (TARGET_MIPS16 && GET_CODE (operands[
1]) != MEM)
3398 rtx op = gen_lowpart (DImode, operands[
1]);
3399 rtx temp = force_reg (DImode, GEN_INT (
0xffff));
3401 emit_insn (gen_anddi3 (operands[
0], op, temp));
3407 [(set (match_operand:DI
0 "register_operand" "=d,d,d")
3408 (zero_extend:DI (match_operand:HI
1 "nonimmediate_operand" "d,R,m")))]
3409 "TARGET_64BIT && !TARGET_MIPS16"
3412 if (which_alternative ==
0)
3413 return
\"andi
\\t%
0,%
1,
0xffff\";
3415 return mips_move_1word (operands, insn, TRUE);
3417 [(set_attr "type" "arith,load,load")
3418 (set_attr "mode" "DI")
3419 (set_attr "length" "
1,
1,
2")])
3422 [(set (match_operand:DI
0 "register_operand" "=d,d")
3423 (zero_extend:DI (match_operand:HI
1 "memory_operand" "R,m")))]
3424 "TARGET_64BIT && TARGET_MIPS16"
3425 "* return mips_move_1word (operands, insn, TRUE);"
3426 [(set_attr "type" "load,load")
3427 (set_attr "mode" "DI")
3428 (set_attr "length" "
1,
2")])
3430 (define_expand "zero_extendqihi2"
3431 [(set (match_operand:HI
0 "register_operand" "")
3432 (zero_extend:HI (match_operand:QI
1 "nonimmediate_operand" "")))]
3436 if (TARGET_MIPS16 && GET_CODE (operands[
1]) != MEM)
3438 rtx op0 = gen_lowpart (SImode, operands[
0]);
3439 rtx op1 = gen_lowpart (SImode, operands[
1]);
3440 rtx temp = force_reg (SImode, GEN_INT (
0xff));
3442 emit_insn (gen_andsi3 (op0, op1, temp));
3448 [(set (match_operand:HI
0 "register_operand" "=d,d,d")
3449 (zero_extend:HI (match_operand:QI
1 "nonimmediate_operand" "d,R,m")))]
3453 if (which_alternative ==
0)
3454 return
\"andi
\\t%
0,%
1,
0x00ff\";
3456 return mips_move_1word (operands, insn, TRUE);
3458 [(set_attr "type" "arith,load,load")
3459 (set_attr "mode" "HI")
3460 (set_attr "length" "
1,
1,
2")])
3463 [(set (match_operand:HI
0 "register_operand" "=d,d")
3464 (zero_extend:HI (match_operand:QI
1 "memory_operand" "R,m")))]
3466 "* return mips_move_1word (operands, insn, TRUE);"
3467 [(set_attr "type" "load,load")
3468 (set_attr "mode" "HI")
3469 (set_attr "length" "
1,
2")])
3471 (define_expand "zero_extendqisi2"
3472 [(set (match_operand:SI
0 "register_operand" "")
3473 (zero_extend:SI (match_operand:QI
1 "nonimmediate_operand" "")))]
3477 if (TARGET_MIPS16 && GET_CODE (operands[
1]) != MEM)
3479 rtx op = gen_lowpart (SImode, operands[
1]);
3480 rtx temp = force_reg (SImode, GEN_INT (
0xff));
3482 emit_insn (gen_andsi3 (operands[
0], op, temp));
3488 [(set (match_operand:SI
0 "register_operand" "=d,d,d")
3489 (zero_extend:SI (match_operand:QI
1 "nonimmediate_operand" "d,R,m")))]
3493 if (which_alternative ==
0)
3494 return
\"andi
\\t%
0,%
1,
0x00ff\";
3496 return mips_move_1word (operands, insn, TRUE);
3498 [(set_attr "type" "arith,load,load")
3499 (set_attr "mode" "SI")
3500 (set_attr "length" "
1,
1,
2")])
3503 [(set (match_operand:SI
0 "register_operand" "=d,d")
3504 (zero_extend:SI (match_operand:QI
1 "memory_operand" "R,m")))]
3506 "* return mips_move_1word (operands, insn, TRUE);"
3507 [(set_attr "type" "load,load")
3508 (set_attr "mode" "SI")
3509 (set_attr "length" "
1,
2")])
3511 (define_expand "zero_extendqidi2"
3512 [(set (match_operand:DI
0 "register_operand" "")
3513 (zero_extend:DI (match_operand:QI
1 "nonimmediate_operand" "")))]
3517 if (TARGET_MIPS16 && GET_CODE (operands[
1]) != MEM)
3519 rtx op = gen_lowpart (DImode, operands[
1]);
3520 rtx temp = force_reg (DImode, GEN_INT (
0xff));
3522 emit_insn (gen_anddi3 (operands[
0], op, temp));
3528 [(set (match_operand:DI
0 "register_operand" "=d,d,d")
3529 (zero_extend:DI (match_operand:QI
1 "nonimmediate_operand" "d,R,m")))]
3530 "TARGET_64BIT && !TARGET_MIPS16"
3533 if (which_alternative ==
0)
3534 return
\"andi
\\t%
0,%
1,
0x00ff\";
3536 return mips_move_1word (operands, insn, TRUE);
3538 [(set_attr "type" "arith,load,load")
3539 (set_attr "mode" "DI")
3540 (set_attr "length" "
1,
1,
2")])
3542 ;; These can be created when a paradoxical subreg operand with an implicit
3543 ;; sign_extend operator is reloaded. Because of the subreg, this is really
3545 ;; ??? It might be possible to eliminate the need for these patterns by adding
3546 ;; more support to reload for implicit sign_extend operators.
3547 (define_insn "*paradoxical_extendhidi2"
3548 [(set (match_operand:DI
0 "register_operand" "=d,d")
3550 (subreg:SI (match_operand:HI
1 "memory_operand" "R,m")
0)))]
3554 return mips_move_1word (operands, insn, TRUE);
3556 [(set_attr "type" "load,load")
3557 (set_attr "mode" "DI")
3558 (set_attr "length" "
1,
2")])
3561 [(set (match_operand:DI
0 "register_operand" "=d,d")
3562 (zero_extend:DI (match_operand:QI
1 "memory_operand" "R,m")))]
3563 "TARGET_64BIT && TARGET_MIPS16"
3564 "* return mips_move_1word (operands, insn, TRUE);"
3565 [(set_attr "type" "load,load")
3566 (set_attr "mode" "DI")
3567 (set_attr "length" "
1,
2")])
3570 ;; ....................
3574 ;; ....................
3577 ;; Those for integer source operand are ordered widest source type first.
3579 ;; In
64 bit mode,
32 bit values in general registers are always
3580 ;; correctly sign extended. That means that if the target is a
3581 ;; general register, we can sign extend from SImode to DImode just by
3584 (define_insn "extendsidi2"
3585 [(set (match_operand:DI
0 "register_operand" "=d,*d,d,d")
3586 (sign_extend:DI (match_operand:SI
1 "nonimmediate_operand" "d,*x,R,m")))]
3588 "* return mips_move_1word (operands, insn, FALSE);"
3589 [(set_attr "type" "move,hilo,load,load")
3590 (set_attr "mode" "DI")
3591 (set_attr "length" "
1,
1,
1,
2")])
3593 ;; These patterns originally accepted general_operands, however, slightly
3594 ;; better code is generated by only accepting register_operands, and then
3595 ;; letting combine generate the lh and lb insns.
3597 (define_expand "extendhidi2"
3598 [(set (match_operand:DI
0 "register_operand" "")
3599 (sign_extend:DI (match_operand:HI
1 "nonimmediate_operand" "")))]
3603 if (optimize && GET_CODE (operands[
1]) == MEM)
3604 operands[
1] = force_not_mem (operands[
1]);
3606 if (GET_CODE (operands[
1]) != MEM)
3608 rtx op1 = gen_lowpart (DImode, operands[
1]);
3609 rtx temp = gen_reg_rtx (DImode);
3610 rtx shift = gen_rtx (CONST_INT, VOIDmode,
48);
3612 emit_insn (gen_ashldi3 (temp, op1, shift));
3613 emit_insn (gen_ashrdi3 (operands[
0], temp, shift));
3618 (define_insn "extendhidi2_internal"
3619 [(set (match_operand:DI
0 "register_operand" "=d,d")
3620 (sign_extend:DI (match_operand:HI
1 "memory_operand" "R,m")))]
3622 "* return mips_move_1word (operands, insn, FALSE);"
3623 [(set_attr "type" "load")
3624 (set_attr "mode" "DI")
3625 (set_attr "length" "
1,
2")])
3627 (define_expand "extendhisi2"
3628 [(set (match_operand:SI
0 "register_operand" "")
3629 (sign_extend:SI (match_operand:HI
1 "nonimmediate_operand" "")))]
3633 if (optimize && GET_CODE (operands[
1]) == MEM)
3634 operands[
1] = force_not_mem (operands[
1]);
3636 if (GET_CODE (operands[
1]) != MEM)
3638 rtx op1 = gen_lowpart (SImode, operands[
1]);
3639 rtx temp = gen_reg_rtx (SImode);
3640 rtx shift = gen_rtx (CONST_INT, VOIDmode,
16);
3642 emit_insn (gen_ashlsi3 (temp, op1, shift));
3643 emit_insn (gen_ashrsi3 (operands[
0], temp, shift));
3648 (define_insn "extendhisi2_internal"
3649 [(set (match_operand:SI
0 "register_operand" "=d,d")
3650 (sign_extend:SI (match_operand:HI
1 "memory_operand" "R,m")))]
3652 "* return mips_move_1word (operands, insn, FALSE);"
3653 [(set_attr "type" "load")
3654 (set_attr "mode" "SI")
3655 (set_attr "length" "
1,
2")])
3657 (define_expand "extendqihi2"
3658 [(set (match_operand:HI
0 "register_operand" "")
3659 (sign_extend:HI (match_operand:QI
1 "nonimmediate_operand" "")))]
3663 if (optimize && GET_CODE (operands[
1]) == MEM)
3664 operands[
1] = force_not_mem (operands[
1]);
3666 if (GET_CODE (operands[
1]) != MEM)
3668 rtx op0 = gen_lowpart (SImode, operands[
0]);
3669 rtx op1 = gen_lowpart (SImode, operands[
1]);
3670 rtx temp = gen_reg_rtx (SImode);
3671 rtx shift = gen_rtx (CONST_INT, VOIDmode,
24);
3673 emit_insn (gen_ashlsi3 (temp, op1, shift));
3674 emit_insn (gen_ashrsi3 (op0, temp, shift));
3679 (define_insn "extendqihi2_internal"
3680 [(set (match_operand:HI
0 "register_operand" "=d,d")
3681 (sign_extend:HI (match_operand:QI
1 "memory_operand" "R,m")))]
3683 "* return mips_move_1word (operands, insn, FALSE);"
3684 [(set_attr "type" "load")
3685 (set_attr "mode" "SI")
3686 (set_attr "length" "
1,
2")])
3689 (define_expand "extendqisi2"
3690 [(set (match_operand:SI
0 "register_operand" "")
3691 (sign_extend:SI (match_operand:QI
1 "nonimmediate_operand" "")))]
3695 if (optimize && GET_CODE (operands[
1]) == MEM)
3696 operands[
1] = force_not_mem (operands[
1]);
3698 if (GET_CODE (operands[
1]) != MEM)
3700 rtx op1 = gen_lowpart (SImode, operands[
1]);
3701 rtx temp = gen_reg_rtx (SImode);
3702 rtx shift = gen_rtx (CONST_INT, VOIDmode,
24);
3704 emit_insn (gen_ashlsi3 (temp, op1, shift));
3705 emit_insn (gen_ashrsi3 (operands[
0], temp, shift));
3710 (define_insn "extendqisi2_insn"
3711 [(set (match_operand:SI
0 "register_operand" "=d,d")
3712 (sign_extend:SI (match_operand:QI
1 "memory_operand" "R,m")))]
3714 "* return mips_move_1word (operands, insn, FALSE);"
3715 [(set_attr "type" "load")
3716 (set_attr "mode" "SI")
3717 (set_attr "length" "
1,
2")])
3719 (define_expand "extendqidi2"
3720 [(set (match_operand:DI
0 "register_operand" "")
3721 (sign_extend:DI (match_operand:QI
1 "nonimmediate_operand" "")))]
3725 if (optimize && GET_CODE (operands[
1]) == MEM)
3726 operands[
1] = force_not_mem (operands[
1]);
3728 if (GET_CODE (operands[
1]) != MEM)
3730 rtx op1 = gen_lowpart (DImode, operands[
1]);
3731 rtx temp = gen_reg_rtx (DImode);
3732 rtx shift = gen_rtx (CONST_INT, VOIDmode,
56);
3734 emit_insn (gen_ashldi3 (temp, op1, shift));
3735 emit_insn (gen_ashrdi3 (operands[
0], temp, shift));
3740 (define_insn "extendqidi2_insn"
3741 [(set (match_operand:DI
0 "register_operand" "=d,d")
3742 (sign_extend:DI (match_operand:QI
1 "memory_operand" "R,m")))]
3744 "* return mips_move_1word (operands, insn, FALSE);"
3745 [(set_attr "type" "load")
3746 (set_attr "mode" "DI")
3747 (set_attr "length" "
1,
2")])
3750 (define_insn "extendsfdf2"
3751 [(set (match_operand:DF
0 "register_operand" "=f")
3752 (float_extend:DF (match_operand:SF
1 "register_operand" "f")))]
3753 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
3755 [(set_attr "type" "fcvt")
3756 (set_attr "mode" "DF")
3757 (set_attr "length" "
1")])
3762 ;; ....................
3766 ;; ....................
3768 ;; The SImode scratch register can not be shared with address regs used for
3769 ;; operand zero, because then the address in the move instruction will be
3770 ;; clobbered. We mark the scratch register as early clobbered to prevent this.
3772 ;; We need the ?X in alternative
1 so that it will be choosen only if the
3773 ;; destination is a floating point register. Otherwise, alternative
1 can
3774 ;; have lower cost than alternative
0 (because there is one less loser), and
3775 ;; can be choosen when it won't work (because integral reloads into FP
3776 ;; registers are not supported).
3778 (define_insn "fix_truncdfsi2"
3779 [(set (match_operand:SI
0 "general_operand" "=d,*f,R,To")
3780 (fix:SI (match_operand:DF
1 "register_operand" "f,*f,f,f")))
3781 (clobber (match_scratch:SI
2 "=d,*d,&d,&d"))
3782 (clobber (match_scratch:DF
3 "=f,?*X,f,f"))]
3783 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
3788 if (which_alternative ==
1)
3789 return
\"trunc.w.d %
0,%
1,%
2\";
3791 output_asm_insn (
\"trunc.w.d %
3,%
1,%
2\", operands);
3793 xoperands[
0] = operands[
0];
3794 xoperands[
1] = operands[
3];
3795 output_asm_insn (mips_move_1word (xoperands, insn, FALSE), xoperands);
3798 [(set_attr "type" "fcvt")
3799 (set_attr "mode" "DF")
3800 (set_attr "length" "
11,
9,
10,
11")])
3803 (define_insn "fix_truncsfsi2"
3804 [(set (match_operand:SI
0 "general_operand" "=d,*f,R,To")
3805 (fix:SI (match_operand:SF
1 "register_operand" "f,*f,f,f")))
3806 (clobber (match_scratch:SI
2 "=d,*d,&d,&d"))
3807 (clobber (match_scratch:SF
3 "=f,?*X,f,f"))]
3813 if (which_alternative ==
1)
3814 return
\"trunc.w.s %
0,%
1,%
2\";
3816 output_asm_insn (
\"trunc.w.s %
3,%
1,%
2\", operands);
3818 xoperands[
0] = operands[
0];
3819 xoperands[
1] = operands[
3];
3820 output_asm_insn (mips_move_1word (xoperands, insn, FALSE), xoperands);
3823 [(set_attr "type" "fcvt")
3824 (set_attr "mode" "SF")
3825 (set_attr "length" "
11,
9,
10,
11")])
3828 ;;; ??? trunc.l.d is mentioned in the appendix of the
1993 r4000/r4600 manuals
3829 ;;; but not in the chapter that describes the FPU. It is not mentioned at all
3830 ;;; in the
1991 manuals. The r4000 at Cygnus does not have this instruction.
3832 ;;; Deleting this means that we now need two libgcc2.a libraries. One for
3833 ;;; the
32 bit calling convention and one for the
64 bit calling convention.
3835 ;;; If this is disabled, then fixuns_truncdfdi2 must be disabled also.
3837 (define_insn "fix_truncdfdi2"
3838 [(set (match_operand:DI
0 "general_operand" "=d,*f,R,To")
3839 (fix:DI (match_operand:DF
1 "register_operand" "f,*f,f,f")))
3840 (clobber (match_scratch:DF
2 "=f,?*X,f,f"))]
3841 "TARGET_HARD_FLOAT && TARGET_64BIT && TARGET_DOUBLE_FLOAT"
3846 if (which_alternative ==
1)
3847 return
\"trunc.l.d %
0,%
1\";
3849 output_asm_insn (
\"trunc.l.d %
2,%
1\", operands);
3851 xoperands[
0] = operands[
0];
3852 xoperands[
1] = operands[
2];
3853 output_asm_insn (mips_move_2words (xoperands, insn, FALSE), xoperands);
3856 [(set_attr "type" "fcvt")
3857 (set_attr "mode" "DF")
3858 (set_attr "length" "
2,
1,
2,
3")])
3861 ;;; ??? trunc.l.s is mentioned in the appendix of the
1993 r4000/r4600 manuals
3862 ;;; but not in the chapter that describes the FPU. It is not mentioned at all
3863 ;;; in the
1991 manuals. The r4000 at Cygnus does not have this instruction.
3864 (define_insn "fix_truncsfdi2"
3865 [(set (match_operand:DI
0 "general_operand" "=d,*f,R,To")
3866 (fix:DI (match_operand:SF
1 "register_operand" "f,*f,f,f")))
3867 (clobber (match_scratch:DF
2 "=f,?*X,f,f"))]
3868 "TARGET_HARD_FLOAT && TARGET_64BIT && TARGET_DOUBLE_FLOAT"
3873 if (which_alternative ==
1)
3874 return
\"trunc.l.s %
0,%
1\";
3876 output_asm_insn (
\"trunc.l.s %
2,%
1\", operands);
3878 xoperands[
0] = operands[
0];
3879 xoperands[
1] = operands[
2];
3880 output_asm_insn (mips_move_2words (xoperands, insn, FALSE), xoperands);
3883 [(set_attr "type" "fcvt")
3884 (set_attr "mode" "SF")
3885 (set_attr "length" "
2,
1,
2,
3")])
3888 (define_insn "floatsidf2"
3889 [(set (match_operand:DF
0 "register_operand" "=f,f,f")
3890 (float:DF (match_operand:SI
1 "nonimmediate_operand" "d,R,m")))]
3891 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
3894 dslots_load_total++;
3895 if (GET_CODE (operands[
1]) == MEM)
3896 return
\"l.s
\\t%
0,%
1%#\;cvt.d.w
\\t%
0,%
0\";
3898 return
\"mtc1
\\t%
1,%
0%#\;cvt.d.w
\\t%
0,%
0\";
3900 [(set_attr "type" "fcvt")
3901 (set_attr "mode" "DF")
3902 (set_attr "length" "
3,
4,
3")])
3905 (define_insn "floatdidf2"
3906 [(set (match_operand:DF
0 "register_operand" "=f,f,f")
3907 (float:DF (match_operand:DI
1 "se_nonimmediate_operand" "d,R,m")))]
3908 "TARGET_HARD_FLOAT && TARGET_64BIT && TARGET_DOUBLE_FLOAT"
3911 dslots_load_total++;
3912 if (GET_CODE (operands[
1]) == MEM)
3913 return
\"l.d
\\t%
0,%
1%#\;cvt.d.l
\\t%
0,%
0\";
3915 return
\"dmtc1
\\t%
1,%
0%#\;cvt.d.l
\\t%
0,%
0\";
3917 [(set_attr "type" "fcvt")
3918 (set_attr "mode" "DF")
3919 (set_attr "length" "
3,
4,
3")])
3922 (define_insn "floatsisf2"
3923 [(set (match_operand:SF
0 "register_operand" "=f,f,f")
3924 (float:SF (match_operand:SI
1 "nonimmediate_operand" "d,R,m")))]
3928 dslots_load_total++;
3929 if (GET_CODE (operands[
1]) == MEM)
3930 return
\"l.s
\\t%
0,%
1%#\;cvt.s.w
\\t%
0,%
0\";
3932 return
\"mtc1
\\t%
1,%
0%#\;cvt.s.w
\\t%
0,%
0\";
3934 [(set_attr "type" "fcvt")
3935 (set_attr "mode" "SF")
3936 (set_attr "length" "
3,
4,
3")])
3939 (define_insn "floatdisf2"
3940 [(set (match_operand:SF
0 "register_operand" "=f,f,f")
3941 (float:SF (match_operand:DI
1 "se_nonimmediate_operand" "d,R,m")))]
3942 "TARGET_HARD_FLOAT && TARGET_64BIT && TARGET_DOUBLE_FLOAT"
3945 dslots_load_total++;
3946 if (GET_CODE (operands[
1]) == MEM)
3947 return
\"l.d
\\t%
0,%
1%#\;cvt.s.l
\\t%
0,%
0\";
3949 return
\"dmtc1
\\t%
1,%
0%#\;cvt.s.l
\\t%
0,%
0\";
3951 [(set_attr "type" "fcvt")
3952 (set_attr "mode" "SF")
3953 (set_attr "length" "
3,
4,
3")])
3956 (define_expand "fixuns_truncdfsi2"
3957 [(set (match_operand:SI
0 "register_operand" "")
3958 (unsigned_fix:SI (match_operand:DF
1 "register_operand" "")))]
3959 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
3962 rtx reg1 = gen_reg_rtx (DFmode);
3963 rtx reg2 = gen_reg_rtx (DFmode);
3964 rtx reg3 = gen_reg_rtx (SImode);
3965 rtx label1 = gen_label_rtx ();
3966 rtx label2 = gen_label_rtx ();
3967 REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (
1.0,
31);
3969 if (reg1) /* turn off complaints about unreached code */
3971 emit_move_insn (reg1, immed_real_const_1 (offset, DFmode));
3972 do_pending_stack_adjust ();
3974 emit_insn (gen_cmpdf (operands[
1], reg1));
3975 emit_jump_insn (gen_bge (label1));
3977 emit_insn (gen_fix_truncdfsi2 (operands[
0], operands[
1]));
3978 emit_jump_insn (gen_rtx (SET, VOIDmode, pc_rtx,
3979 gen_rtx (LABEL_REF, VOIDmode, label2)));
3982 emit_label (label1);
3983 emit_move_insn (reg2, gen_rtx (MINUS, DFmode, operands[
1], reg1));
3984 emit_move_insn (reg3, gen_rtx (CONST_INT, VOIDmode,
0x80000000));
3986 emit_insn (gen_fix_truncdfsi2 (operands[
0], reg2));
3987 emit_insn (gen_iorsi3 (operands[
0], operands[
0], reg3));
3989 emit_label (label2);
3991 /* allow REG_NOTES to be set on last insn (labels don't have enough
3992 fields, and can't be used for REG_NOTES anyway). */
3993 emit_insn (gen_rtx (USE, VOIDmode, stack_pointer_rtx));
3999 (define_expand "fixuns_truncdfdi2"
4000 [(set (match_operand:DI
0 "register_operand" "")
4001 (unsigned_fix:DI (match_operand:DF
1 "register_operand" "")))]
4002 "TARGET_HARD_FLOAT && TARGET_64BIT && TARGET_DOUBLE_FLOAT"
4005 rtx reg1 = gen_reg_rtx (DFmode);
4006 rtx reg2 = gen_reg_rtx (DFmode);
4007 rtx reg3 = gen_reg_rtx (DImode);
4008 rtx label1 = gen_label_rtx ();
4009 rtx label2 = gen_label_rtx ();
4010 REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (
1.0,
63);
4012 if (reg1) /* turn off complaints about unreached code */
4014 emit_move_insn (reg1, immed_real_const_1 (offset, DFmode));
4015 do_pending_stack_adjust ();
4017 emit_insn (gen_cmpdf (operands[
1], reg1));
4018 emit_jump_insn (gen_bge (label1));
4020 emit_insn (gen_fix_truncdfdi2 (operands[
0], operands[
1]));
4021 emit_jump_insn (gen_rtx (SET, VOIDmode, pc_rtx,
4022 gen_rtx (LABEL_REF, VOIDmode, label2)));
4025 emit_label (label1);
4026 emit_move_insn (reg2, gen_rtx (MINUS, DFmode, operands[
1], reg1));
4027 emit_move_insn (reg3, gen_rtx (CONST_INT, VOIDmode,
0x80000000));
4028 emit_insn (gen_ashldi3 (reg3, reg3, GEN_INT (
32)));
4030 emit_insn (gen_fix_truncdfdi2 (operands[
0], reg2));
4031 emit_insn (gen_iordi3 (operands[
0], operands[
0], reg3));
4033 emit_label (label2);
4035 /* allow REG_NOTES to be set on last insn (labels don't have enough
4036 fields, and can't be used for REG_NOTES anyway). */
4037 emit_insn (gen_rtx (USE, VOIDmode, stack_pointer_rtx));
4043 (define_expand "fixuns_truncsfsi2"
4044 [(set (match_operand:SI
0 "register_operand" "")
4045 (unsigned_fix:SI (match_operand:SF
1 "register_operand" "")))]
4049 rtx reg1 = gen_reg_rtx (SFmode);
4050 rtx reg2 = gen_reg_rtx (SFmode);
4051 rtx reg3 = gen_reg_rtx (SImode);
4052 rtx label1 = gen_label_rtx ();
4053 rtx label2 = gen_label_rtx ();
4054 REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (
1.0,
31);
4056 if (reg1) /* turn off complaints about unreached code */
4058 emit_move_insn (reg1, immed_real_const_1 (offset, SFmode));
4059 do_pending_stack_adjust ();
4061 emit_insn (gen_cmpsf (operands[
1], reg1));
4062 emit_jump_insn (gen_bge (label1));
4064 emit_insn (gen_fix_truncsfsi2 (operands[
0], operands[
1]));
4065 emit_jump_insn (gen_rtx (SET, VOIDmode, pc_rtx,
4066 gen_rtx (LABEL_REF, VOIDmode, label2)));
4069 emit_label (label1);
4070 emit_move_insn (reg2, gen_rtx (MINUS, SFmode, operands[
1], reg1));
4071 emit_move_insn (reg3, gen_rtx (CONST_INT, VOIDmode,
0x80000000));
4073 emit_insn (gen_fix_truncsfsi2 (operands[
0], reg2));
4074 emit_insn (gen_iorsi3 (operands[
0], operands[
0], reg3));
4076 emit_label (label2);
4078 /* allow REG_NOTES to be set on last insn (labels don't have enough
4079 fields, and can't be used for REG_NOTES anyway). */
4080 emit_insn (gen_rtx (USE, VOIDmode, stack_pointer_rtx));
4086 (define_expand "fixuns_truncsfdi2"
4087 [(set (match_operand:DI
0 "register_operand" "")
4088 (unsigned_fix:DI (match_operand:SF
1 "register_operand" "")))]
4089 "TARGET_HARD_FLOAT && TARGET_64BIT && TARGET_DOUBLE_FLOAT"
4092 rtx reg1 = gen_reg_rtx (SFmode);
4093 rtx reg2 = gen_reg_rtx (SFmode);
4094 rtx reg3 = gen_reg_rtx (DImode);
4095 rtx label1 = gen_label_rtx ();
4096 rtx label2 = gen_label_rtx ();
4097 REAL_VALUE_TYPE offset = REAL_VALUE_LDEXP (
1.0,
63);
4099 if (reg1) /* turn off complaints about unreached code */
4101 emit_move_insn (reg1, immed_real_const_1 (offset, SFmode));
4102 do_pending_stack_adjust ();
4104 emit_insn (gen_cmpsf (operands[
1], reg1));
4105 emit_jump_insn (gen_bge (label1));
4107 emit_insn (gen_fix_truncsfdi2 (operands[
0], operands[
1]));
4108 emit_jump_insn (gen_rtx (SET, VOIDmode, pc_rtx,
4109 gen_rtx (LABEL_REF, VOIDmode, label2)));
4112 emit_label (label1);
4113 emit_move_insn (reg2, gen_rtx (MINUS, SFmode, operands[
1], reg1));
4114 emit_move_insn (reg3, gen_rtx (CONST_INT, VOIDmode,
0x80000000));
4115 emit_insn (gen_ashldi3 (reg3, reg3, GEN_INT (
32)));
4117 emit_insn (gen_fix_truncsfdi2 (operands[
0], reg2));
4118 emit_insn (gen_iordi3 (operands[
0], operands[
0], reg3));
4120 emit_label (label2);
4122 /* allow REG_NOTES to be set on last insn (labels don't have enough
4123 fields, and can't be used for REG_NOTES anyway). */
4124 emit_insn (gen_rtx (USE, VOIDmode, stack_pointer_rtx));
4131 ;; ....................
4135 ;; ....................
4137 ;; Bit field extract patterns which use lwl/lwr.
4139 ;; ??? There should be DImode variants for
64 bit code, but the current
4140 ;; bitfield scheme can't handle that. We would need to add new optabs
4141 ;; in order to make that work.
4143 ;; ??? There could be HImode variants for the ulh/ulhu/ush macros.
4144 ;; It isn't clear whether this will give better code.
4146 (define_expand "extv"
4147 [(set (match_operand:SI
0 "register_operand" "")
4148 (sign_extract:SI (match_operand:QI
1 "memory_operand" "")
4149 (match_operand:SI
2 "immediate_operand" "")
4150 (match_operand:SI
3 "immediate_operand" "")))]
4154 /* If this isn't a
32 bit field, and it doesn't start on a byte boundary
4156 if (INTVAL (operands[
2]) !=
32 || (INTVAL (operands[
3]) %
8) !=
0)
4159 /* This can happen for a
64 bit target, when extracting a value from
4160 a
64 bit union member. extract_bit_field doesn't verify that our
4161 source matches the predicate, so we force it to be a MEM here. */
4162 if (GET_CODE (operands[
1]) != MEM)
4165 /* Change the mode to BLKmode for aliasing purposes. */
4166 operands[
1] = change_address (operands[
1], BLKmode, XEXP (operands[
1],
0));
4168 /* Otherwise, emit a lwl/lwr pair to load the value. */
4169 emit_insn (gen_movsi_ulw (operands[
0], operands[
1]));
4173 (define_expand "extzv"
4174 [(set (match_operand:SI
0 "register_operand" "")
4175 (zero_extract:SI (match_operand:QI
1 "memory_operand" "")
4176 (match_operand:SI
2 "immediate_operand" "")
4177 (match_operand:SI
3 "immediate_operand" "")))]
4181 /* If this isn't a
32 bit field, and it doesn't start on a byte boundary
4183 if (INTVAL (operands[
2]) !=
32 || (INTVAL (operands[
3]) %
8) !=
0)
4186 /* This can happen for a
64 bit target, when extracting a value from
4187 a
64 bit union member. extract_bit_field doesn't verify that our
4188 source matches the predicate, so we force it to be a MEM here. */
4189 if (GET_CODE (operands[
1]) != MEM)
4192 /* Change the mode to BLKmode for aliasing purposes. */
4193 operands[
1] = change_address (operands[
1], BLKmode, XEXP (operands[
1],
0));
4195 /* Otherwise, emit a lwl/lwr pair to load the value. */
4196 emit_insn (gen_movsi_ulw (operands[
0], operands[
1]));
4200 (define_expand "insv"
4201 [(set (zero_extract:SI (match_operand:QI
0 "memory_operand" "")
4202 (match_operand:SI
1 "immediate_operand" "")
4203 (match_operand:SI
2 "immediate_operand" ""))
4204 (match_operand:SI
3 "register_operand" ""))]
4208 /* If this isn't a
32 bit field, and it doesn't start on a byte boundary
4210 if (INTVAL (operands[
1]) !=
32 || (INTVAL (operands[
2]) %
8) !=
0)
4213 /* This can happen for a
64 bit target, when storing into a
32 bit union
4214 member. store_bit_field doesn't verify that our target matches the
4215 predicate, so we force it to be a MEM here. */
4216 if (GET_CODE (operands[
0]) != MEM)
4219 /* Change the mode to BLKmode for aliasing purposes. */
4220 operands[
0] = change_address (operands[
0], BLKmode, XEXP (operands[
0],
0));
4222 /* Otherwise, emit a swl/swr pair to load the value. */
4223 emit_insn (gen_movsi_usw (operands[
0], operands[
3]));
4227 ;; unaligned word moves generated by the bit field patterns
4229 (define_insn "movsi_ulw"
4230 [(set (match_operand:SI
0 "register_operand" "=&d,&d")
4231 (unspec:SI [(match_operand:BLK
1 "general_operand" "R,o")]
0))]
4235 rtx offset = const0_rtx;
4236 rtx addr = XEXP (operands[
1],
0);
4237 rtx mem_addr = eliminate_constant_term (addr, &offset);
4241 mips_count_memory_refs (operands[
1],
2);
4243 /* The stack/frame pointers are always aligned, so we can convert
4244 to the faster lw if we are referencing an aligned stack location. */
4246 if ((INTVAL (offset) &
3) ==
0
4247 && (mem_addr == stack_pointer_rtx || mem_addr == frame_pointer_rtx))
4248 ret =
\"lw
\\t%
0,%
1\";
4250 ret =
\"ulw
\\t%
0,%
1\";
4252 return mips_fill_delay_slot (ret, DELAY_LOAD, operands, insn);
4254 [(set_attr "type" "load,load")
4255 (set_attr "mode" "SI")
4256 (set_attr "length" "
2,
4")])
4258 (define_insn "movsi_usw"
4259 [(set (match_operand:BLK
0 "memory_operand" "=R,o")
4260 (unspec:BLK [(match_operand:SI
1 "reg_or_0_operand" "dJ,dJ")]
1))]
4264 rtx offset = const0_rtx;
4265 rtx addr = XEXP (operands[
0],
0);
4266 rtx mem_addr = eliminate_constant_term (addr, &offset);
4269 mips_count_memory_refs (operands[
0],
2);
4271 /* The stack/frame pointers are always aligned, so we can convert
4272 to the faster sw if we are referencing an aligned stack location. */
4274 if ((INTVAL (offset) &
3) ==
0
4275 && (mem_addr == stack_pointer_rtx || mem_addr == frame_pointer_rtx))
4276 return
\"sw
\\t%
1,%
0\";
4278 return
\"usw
\\t%z1,%
0\";
4280 [(set_attr "type" "store")
4281 (set_attr "mode" "SI")
4282 (set_attr "length" "
2,
4")])
4284 ;; These two patterns support loading addresses with two instructions instead
4285 ;; of using the macro instruction la.
4287 ;; ??? mips_move_1word has support for HIGH, so this pattern may be
4291 [(set (match_operand:SI
0 "register_operand" "=r")
4292 (high:SI (match_operand:SI
1 "immediate_operand" "")))]
4293 "mips_split_addresses && !TARGET_MIPS16"
4294 "lui
\\t%
0,%%hi(%
1) # high"
4295 [(set_attr "type" "move")
4296 (set_attr "length" "
1")])
4299 [(set (match_operand:SI
0 "register_operand" "=r")
4300 (lo_sum:SI (match_operand:SI
1 "register_operand" "r")
4301 (match_operand:SI
2 "immediate_operand" "")))]
4302 "mips_split_addresses && !TARGET_MIPS16"
4303 "addiu
\\t%
0,%
1,%%lo(%
2) # low"
4304 [(set_attr "type" "arith")
4305 (set_attr "mode" "SI")
4306 (set_attr "length" "
1")])
4308 ;;
64-bit integer moves
4310 ;; Unlike most other insns, the move insns can't be split with
4311 ;; different predicates, because register spilling and other parts of
4312 ;; the compiler, have memoized the insn number already.
4314 (define_expand "movdi"
4315 [(set (match_operand:DI
0 "nonimmediate_operand" "")
4316 (match_operand:DI
1 "general_operand" ""))]
4320 if (mips_split_addresses && mips_check_split (operands[
1], DImode))
4322 enum machine_mode mode = GET_MODE (operands[
0]);
4323 rtx tem = ((reload_in_progress | reload_completed)
4324 ? operands[
0] : gen_reg_rtx (mode));
4326 emit_insn (gen_rtx (SET, VOIDmode, tem,
4327 gen_rtx (HIGH, mode, operands[
1])));
4329 operands[
1] = gen_rtx (LO_SUM, mode, tem, operands[
1]);
4332 /* If we are generating embedded PIC code, and we are referring to a
4333 symbol in the .text section, we must use an offset from the start
4335 if (TARGET_EMBEDDED_PIC
4336 && (GET_CODE (operands[
1]) == LABEL_REF
4337 || (GET_CODE (operands[
1]) == SYMBOL_REF
4338 && ! SYMBOL_REF_FLAG (operands[
1]))))
4342 temp = embedded_pic_offset (operands[
1]);
4343 temp = gen_rtx (PLUS, Pmode, embedded_pic_fnaddr_rtx,
4344 force_reg (DImode, temp));
4345 emit_move_insn (operands[
0], force_reg (DImode, temp));
4349 /* If operands[
1] is a constant address illegal for pic, then we need to
4350 handle it just like LEGITIMIZE_ADDRESS does. */
4351 if (flag_pic && pic_address_needs_scratch (operands[
1]))
4353 rtx temp = force_reg (DImode, XEXP (XEXP (operands[
1],
0),
0));
4354 rtx temp2 = XEXP (XEXP (operands[
1],
0),
1);
4356 if (! SMALL_INT (temp2))
4357 temp2 = force_reg (DImode, temp2);
4359 emit_move_insn (operands[
0], gen_rtx (PLUS, DImode, temp, temp2));
4363 /* On the mips16, we can handle a GP relative reference by adding in
4364 $gp. We need to check the name to see whether this is a string
4367 && register_operand (operands[
0], DImode)
4368 && GET_CODE (operands[
1]) == SYMBOL_REF
4369 && SYMBOL_REF_FLAG (operands[
1]))
4371 char *name = XSTR (operands[
1],
0);
4374 || strncmp (name +
1, LOCAL_LABEL_PREFIX,
4375 sizeof LOCAL_LABEL_PREFIX -
1) !=
0)
4379 if (reload_in_progress || reload_completed)
4381 /* In movsi we use the constant table here. However, in
4382 this case, we're better off copying $
28 into a
4383 register and adding, because the constant table entry
4384 would be
8 bytes. */
4385 base_reg = operands[
0];
4386 emit_move_insn (base_reg,
4387 gen_rtx (CONST, DImode,
4388 gen_rtx (REG, DImode,
4389 GP_REG_FIRST +
28)));
4393 base_reg = gen_reg_rtx (Pmode);
4394 emit_move_insn (base_reg, mips16_gp_pseudo_reg ());
4397 emit_move_insn (operands[
0],
4398 gen_rtx (PLUS, SImode, base_reg,
4399 mips16_gp_offset (operands[
1])));
4404 if ((reload_in_progress | reload_completed) ==
0
4405 && !register_operand (operands[
0], DImode)
4406 && !register_operand (operands[
1], DImode)
4408 || (GET_CODE (operands[
1]) != CONST_INT || INTVAL (operands[
1]) !=
0)
4409 && operands[
1] != CONST0_RTX (DImode)))
4411 rtx temp = force_reg (DImode, operands[
1]);
4412 emit_move_insn (operands[
0], temp);
4417 ;; For mips16, we need a special case to handle storing $
31 into
4418 ;; memory, since we don't have a constraint to match $
31. This
4419 ;; instruction can be generated by save_restore_insns.
4422 [(set (match_operand:DI
0 "memory_operand" "R,m")
4424 "TARGET_MIPS16 && TARGET_64BIT"
4427 operands[
1] = gen_rtx (REG, DImode,
31);
4428 return mips_move_2words (operands, insn);
4430 [(set_attr "type" "store")
4431 (set_attr "mode" "DI")
4432 (set_attr "length" "
1,
2")])
4434 (define_insn "movdi_internal"
4435 [(set (match_operand:DI
0 "nonimmediate_operand" "=d,d,d,d,R,o,*x,*d,*x")
4436 (match_operand:DI
1 "general_operand" "d,iF,R,o,d,d,J,*x,*d"))]
4437 "!TARGET_64BIT && !TARGET_MIPS16
4438 && (register_operand (operands[
0], DImode)
4439 || register_operand (operands[
1], DImode)
4440 || (GET_CODE (operands[
1]) == CONST_INT && INTVAL (operands[
1]) ==
0)
4441 || operands[
1] == CONST0_RTX (DImode))"
4442 "* return mips_move_2words (operands, insn); "
4443 [(set_attr "type" "move,arith,load,load,store,store,hilo,hilo,hilo")
4444 (set_attr "mode" "DI")
4445 (set_attr "length" "
2,
4,
2,
4,
2,
4,
2,
2,
2")])
4448 [(set (match_operand:DI
0 "nonimmediate_operand" "=d,y,d,d,d,d,d,R,To,*d")
4449 (match_operand:DI
1 "general_operand" "d,d,y,K,N,R,To,d,d,*x"))]
4450 "!TARGET_64BIT && TARGET_MIPS16
4451 && (register_operand (operands[
0], DImode)
4452 || register_operand (operands[
1], DImode))"
4453 "* return mips_move_2words (operands, insn);"
4454 [(set_attr "type" "move,move,move,arith,arith,load,load,store,store,hilo")
4455 (set_attr "mode" "DI")
4456 (set_attr "length" "
2,
2,
2,
2,
3,
2,
4,
2,
4,
2")])
4459 [(set (match_operand:DI
0 "register_operand" "")
4460 (match_operand:DI
1 "register_operand" ""))]
4461 "reload_completed && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
4462 && GET_CODE (operands[
0]) == REG && GP_REG_P (REGNO (operands[
0]))
4463 && GET_CODE (operands[
1]) == REG && GP_REG_P (REGNO (operands[
1]))"
4465 [(set (subreg:SI (match_dup
0)
0) (subreg:SI (match_dup
1)
0))
4466 (set (subreg:SI (match_dup
0)
1) (subreg:SI (match_dup
1)
1))]
4469 (define_insn "movdi_internal2"
4470 [(set (match_operand:DI
0 "nonimmediate_operand" "=d,d,d,d,d,d,R,m,*x,*d,*x,*a")
4471 (match_operand:DI
1 "movdi_operand" "d,S,IKL,Mnis,R,m,dJ,dJ,J,*x,*d,*J"))]
4472 "TARGET_64BIT && !TARGET_MIPS16
4473 && (register_operand (operands[
0], DImode)
4474 || se_register_operand (operands[
1], DImode)
4475 || (GET_CODE (operands[
1]) == CONST_INT && INTVAL (operands[
1]) ==
0)
4476 || operands[
1] == CONST0_RTX (DImode))"
4477 "* return mips_move_2words (operands, insn); "
4478 [(set_attr "type" "move,load,arith,arith,load,load,store,store,hilo,hilo,hilo,hilo")
4479 (set_attr "mode" "DI")
4480 (set_attr "length" "
1,
2,
1,
2,
1,
2,
1,
2,
1,
1,
1,
2")])
4483 [(set (match_operand:DI
0 "nonimmediate_operand" "=d,y,d,d,d,d,d,d,R,m,*d")
4484 (match_operand:DI
1 "movdi_operand" "d,d,y,K,N,s,R,m,d,d,*x"))]
4485 "TARGET_64BIT && TARGET_MIPS16
4486 && (register_operand (operands[
0], DImode)
4487 || se_register_operand (operands[
1], DImode))"
4488 "* return mips_move_2words (operands, insn);"
4489 [(set_attr "type" "move,move,move,arith,arith,arith,load,load,store,store,hilo")
4490 (set_attr "mode" "DI")
4491 (set_attr_alternative "length"
4495 (if_then_else (match_operand:VOID
1 "m16_uimm8_1" "")
4498 (if_then_else (match_operand:VOID
1 "m16_nuimm8_1" "")
4501 (if_then_else (match_operand:VOID
1 "m16_usym5_4" "")
4510 ;; On the mips16, we can split ld $r,N($r) into an add and a load,
4511 ;; when the original load is a
4 byte instruction but the add and the
4512 ;; load are
2 2 byte instructions.
4515 [(set (match_operand:DI
0 "register_operand" "")
4516 (mem:DI (plus:DI (match_dup
0)
4517 (match_operand:DI
1 "const_int_operand" ""))))]
4518 "TARGET_64BIT && TARGET_MIPS16 && reload_completed
4519 && GET_CODE (operands[
0]) == REG
4520 && M16_REG_P (REGNO (operands[
0]))
4521 && GET_CODE (operands[
1]) == CONST_INT
4522 && ((INTVAL (operands[
1]) <
0
4523 && INTVAL (operands[
1]) >= -
0x10)
4524 || (INTVAL (operands[
1]) >=
32 *
8
4525 && INTVAL (operands[
1]) <=
31 *
8 +
0x8)
4526 || (INTVAL (operands[
1]) >=
0
4527 && INTVAL (operands[
1]) <
32 *
8
4528 && (INTVAL (operands[
1]) &
7) !=
0))"
4529 [(set (match_dup
0) (plus:DI (match_dup
0) (match_dup
1)))
4530 (set (match_dup
0) (mem:DI (plus:DI (match_dup
0) (match_dup
2))))]
4533 HOST_WIDE_INT val = INTVAL (operands[
1]);
4536 operands[
2] = GEN_INT (
0);
4537 else if (val >=
32 *
8)
4541 operands[
1] = GEN_INT (
0x8 + off);
4542 operands[
2] = GEN_INT (val - off -
0x8);
4548 operands[
1] = GEN_INT (off);
4549 operands[
2] = GEN_INT (val - off);
4553 ;; Handle input reloads in DImode.
4554 ;; This is mainly to handle reloading HILO_REGNUM. Note that we may
4555 ;; see it as the source or the destination, depending upon which way
4556 ;; reload handles the instruction.
4557 ;; Making the second operand TImode is a trick. The compiler may
4558 ;; reuse the same register for operand
0 and operand
2. Using TImode
4559 ;; gives us two registers, so we can always use the one which is not
4562 (define_expand "reload_indi"
4563 [(set (match_operand:DI
0 "register_operand" "=b")
4564 (match_operand:DI
1 "movdi_operand" "b"))
4565 (clobber (match_operand:TI
2 "register_operand" "=&d"))]
4569 rtx scratch = gen_rtx (REG, DImode,
4570 (REGNO (operands[
0]) == REGNO (operands[
2])
4571 ? REGNO (operands[
2]) +
1
4572 : REGNO (operands[
2])));
4574 if (GET_CODE (operands[
0]) == REG && REGNO (operands[
0]) == HILO_REGNUM)
4576 if (GET_CODE (operands[
1]) == MEM)
4578 rtx memword, offword, hiword, loword;
4580 scratch = gen_rtx (REG, SImode, REGNO (scratch));
4581 memword = change_address (operands[
1], SImode, NULL_RTX);
4582 offword = change_address (adj_offsettable_operand (operands[
1],
4),
4584 if (BYTES_BIG_ENDIAN)
4594 emit_move_insn (scratch, hiword);
4595 emit_move_insn (gen_rtx (REG, SImode,
64), scratch);
4596 emit_move_insn (scratch, loword);
4597 emit_move_insn (gen_rtx (REG, SImode,
65), scratch);
4601 emit_insn (gen_ashrdi3 (scratch, operands[
1], GEN_INT (
32)));
4602 emit_insn (gen_movdi (gen_rtx (REG, DImode,
64), scratch));
4603 emit_insn (gen_ashldi3 (scratch, operands[
1], GEN_INT (
32)));
4604 emit_insn (gen_ashrdi3 (scratch, scratch, GEN_INT (
32)));
4605 emit_insn (gen_movdi (gen_rtx (REG, DImode,
65), scratch));
4609 if (GET_CODE (operands[
1]) == REG && REGNO (operands[
1]) == HILO_REGNUM)
4611 emit_insn (gen_movdi (scratch, gen_rtx (REG, DImode,
65)));
4612 emit_insn (gen_ashldi3 (scratch, scratch, GEN_INT (
32)));
4613 emit_insn (gen_lshrdi3 (scratch, scratch, GEN_INT (
32)));
4614 emit_insn (gen_movdi (operands[
0], gen_rtx (REG, DImode,
64)));
4615 emit_insn (gen_ashldi3 (operands[
0], operands[
0], GEN_INT (
32)));
4616 emit_insn (gen_iordi3 (operands[
0], operands[
0], scratch));
4619 /* This handles moves between a float register and HI/LO. */
4620 emit_move_insn (scratch, operands[
1]);
4621 emit_move_insn (operands[
0], scratch);
4625 ;; Handle output reloads in DImode.
4627 (define_expand "reload_outdi"
4628 [(set (match_operand:DI
0 "general_operand" "=b")
4629 (match_operand:DI
1 "se_register_operand" "b"))
4630 (clobber (match_operand:DI
2 "register_operand" "=&d"))]
4634 if (GET_CODE (operands[
0]) == REG && REGNO (operands[
0]) == HILO_REGNUM)
4636 emit_insn (gen_ashrdi3 (operands[
2], operands[
1], GEN_INT (
32)));
4637 emit_insn (gen_movdi (gen_rtx (REG, DImode,
64), operands[
2]));
4638 emit_insn (gen_ashldi3 (operands[
2], operands[
1], GEN_INT (
32)));
4639 emit_insn (gen_ashrdi3 (operands[
2], operands[
2], GEN_INT (
32)));
4640 emit_insn (gen_movdi (gen_rtx (REG, DImode,
65), operands[
2]));
4643 if (GET_CODE (operands[
1]) == REG && REGNO (operands[
1]) == HILO_REGNUM)
4645 if (GET_CODE (operands[
0]) == MEM)
4647 rtx scratch, memword, offword, hiword, loword;
4649 scratch = gen_rtx (REG, SImode, REGNO (operands[
2]));
4650 memword = change_address (operands[
0], SImode, NULL_RTX);
4651 offword = change_address (adj_offsettable_operand (operands[
0],
4),
4653 if (BYTES_BIG_ENDIAN)
4663 emit_move_insn (scratch, gen_rtx (REG, SImode,
64));
4664 emit_move_insn (hiword, scratch);
4665 emit_move_insn (scratch, gen_rtx (REG, SImode,
65));
4666 emit_move_insn (loword, scratch);
4670 emit_insn (gen_movdi (operands[
2], gen_rtx (REG, DImode,
65)));
4671 emit_insn (gen_ashldi3 (operands[
2], operands[
2], GEN_INT (
32)));
4672 emit_insn (gen_lshrdi3 (operands[
2], operands[
2], GEN_INT (
32)));
4673 emit_insn (gen_movdi (operands[
0], gen_rtx (REG, DImode,
64)));
4674 emit_insn (gen_ashldi3 (operands[
0], operands[
0], GEN_INT (
32)));
4675 emit_insn (gen_iordi3 (operands[
0], operands[
0], operands[
2]));
4679 /* This handles moves between a float register and HI/LO. */
4680 emit_move_insn (operands[
2], operands[
1]);
4681 emit_move_insn (operands[
0], operands[
2]);
4685 ;;
32-bit Integer moves
4688 [(set (match_operand:SI
0 "register_operand" "")
4689 (match_operand:SI
1 "large_int" ""))]
4690 "!TARGET_DEBUG_D_MODE && !TARGET_MIPS16"
4694 (ior:SI (match_dup
0)
4698 operands[
2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[
1]) &
0xffff0000);
4699 operands[
3] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[
1]) &
0x0000ffff);
4702 ;; Unlike most other insns, the move insns can't be split with
4703 ;; different predicates, because register spilling and other parts of
4704 ;; the compiler, have memoized the insn number already.
4706 (define_expand "movsi"
4707 [(set (match_operand:SI
0 "nonimmediate_operand" "")
4708 (match_operand:SI
1 "general_operand" ""))]
4712 if (mips_split_addresses && mips_check_split (operands[
1], SImode))
4714 enum machine_mode mode = GET_MODE (operands[
0]);
4715 rtx tem = ((reload_in_progress | reload_completed)
4716 ? operands[
0] : gen_reg_rtx (mode));
4718 emit_insn (gen_rtx (SET, VOIDmode, tem,
4719 gen_rtx (HIGH, mode, operands[
1])));
4721 operands[
1] = gen_rtx (LO_SUM, mode, tem, operands[
1]);
4724 /* If we are generating embedded PIC code, and we are referring to a
4725 symbol in the .text section, we must use an offset from the start
4727 if (TARGET_EMBEDDED_PIC
4728 && (GET_CODE (operands[
1]) == LABEL_REF
4729 || (GET_CODE (operands[
1]) == SYMBOL_REF
4730 && ! SYMBOL_REF_FLAG (operands[
1]))))
4734 temp = embedded_pic_offset (operands[
1]);
4735 temp = gen_rtx (PLUS, Pmode, embedded_pic_fnaddr_rtx,
4736 force_reg (SImode, temp));
4737 emit_move_insn (operands[
0], force_reg (SImode, temp));
4741 /* If operands[
1] is a constant address invalid for pic, then we need to
4742 handle it just like LEGITIMIZE_ADDRESS does. */
4743 if (flag_pic && pic_address_needs_scratch (operands[
1]))
4745 rtx temp = force_reg (SImode, XEXP (XEXP (operands[
1],
0),
0));
4746 rtx temp2 = XEXP (XEXP (operands[
1],
0),
1);
4748 if (! SMALL_INT (temp2))
4749 temp2 = force_reg (SImode, temp2);
4751 emit_move_insn (operands[
0], gen_rtx (PLUS, SImode, temp, temp2));
4755 /* On the mips16, we can handle a GP relative reference by adding in
4756 $gp. We need to check the name to see whether this is a string
4759 && register_operand (operands[
0], SImode)
4760 && GET_CODE (operands[
1]) == SYMBOL_REF
4761 && SYMBOL_REF_FLAG (operands[
1]))
4763 char *name = XSTR (operands[
1],
0);
4766 || strncmp (name +
1, LOCAL_LABEL_PREFIX,
4767 sizeof LOCAL_LABEL_PREFIX -
1) !=
0)
4771 if (reload_in_progress || reload_completed)
4773 /* We need to reload this address. In this case we
4774 aren't going to have a chance to combine loading the
4775 address with the load or store. That means that we
4776 can either generate a
2 byte move followed by a
4
4777 byte addition, or a
2 byte load with a
4 byte entry
4778 in the constant table. Since the entry in the
4779 constant table might be shared, we're better off, on
4780 average, loading the address from the constant table. */
4781 emit_move_insn (operands[
0],
4782 force_const_mem (SImode, operands[
1]));
4786 base_reg = gen_reg_rtx (Pmode);
4787 emit_move_insn (base_reg, mips16_gp_pseudo_reg ());
4789 emit_move_insn (operands[
0],
4790 gen_rtx (PLUS, SImode, base_reg,
4791 mips16_gp_offset (operands[
1])));
4796 if ((reload_in_progress | reload_completed) ==
0
4797 && !register_operand (operands[
0], SImode)
4798 && !register_operand (operands[
1], SImode)
4800 || GET_CODE (operands[
1]) != CONST_INT
4801 || INTVAL (operands[
1]) !=
0))
4803 rtx temp = force_reg (SImode, operands[
1]);
4804 emit_move_insn (operands[
0], temp);
4809 ;; For mips16, we need a special case to handle storing $
31 into
4810 ;; memory, since we don't have a constraint to match $
31. This
4811 ;; instruction can be generated by save_restore_insns.
4814 [(set (match_operand:SI
0 "memory_operand" "R,m")
4819 operands[
1] = gen_rtx (REG, SImode,
31);
4820 return mips_move_1word (operands, insn, FALSE);
4822 [(set_attr "type" "store")
4823 (set_attr "mode" "SI")
4824 (set_attr "length" "
1,
2")])
4826 ;; The difference between these two is whether or not ints are allowed
4827 ;; in FP registers (off by default, use -mdebugh to enable).
4829 (define_insn "movsi_internal1"
4830 [(set (match_operand:SI
0 "nonimmediate_operand" "=d,d,d,d,d,d,R,m,*d,*f*z,*f,*f,*f,*R,*m,*x,*x,*d,*d")
4831 (match_operand:SI
1 "move_operand" "d,S,IKL,Mnis,R,m,dJ,dJ,*f*z,*d,*f,*R,*m,*f,*f,J,*d,*x,*a"))]
4832 "TARGET_DEBUG_H_MODE && !TARGET_MIPS16
4833 && (register_operand (operands[
0], SImode)
4834 || register_operand (operands[
1], SImode)
4835 || (GET_CODE (operands[
1]) == CONST_INT && INTVAL (operands[
1]) ==
0))"
4836 "* return mips_move_1word (operands, insn, FALSE);"
4837 [(set_attr "type" "move,load,arith,arith,load,load,store,store,xfer,xfer,move,load,load,store,store,hilo,hilo,hilo,hilo")
4838 (set_attr "mode" "SI")
4839 (set_attr "length" "
1,
2,
1,
2,
1,
2,
1,
2,
1,
1,
1,
1,
2,
1,
2,
1,
1,
1,
1")])
4841 (define_insn "movsi_internal2"
4842 [(set (match_operand:SI
0 "nonimmediate_operand" "=d,d,d,d,d,d,R,m,*d,*z,*x,*d,*x,*d")
4843 (match_operand:SI
1 "move_operand" "d,S,IKL,Mnis,R,m,dJ,dJ,*z,*d,J,*x,*d,*a"))]
4844 "!TARGET_DEBUG_H_MODE && !TARGET_MIPS16
4845 && (register_operand (operands[
0], SImode)
4846 || register_operand (operands[
1], SImode)
4847 || (GET_CODE (operands[
1]) == CONST_INT && INTVAL (operands[
1]) ==
0))"
4848 "* return mips_move_1word (operands, insn, FALSE);"
4849 [(set_attr "type" "move,load,arith,arith,load,load,store,store,xfer,xfer,hilo,hilo,hilo,hilo")
4850 (set_attr "mode" "SI")
4851 (set_attr "length" "
1,
2,
1,
2,
1,
2,
1,
2,
1,
1,
1,
1,
1,
1")])
4853 ;; This is the mips16 movsi instruction. We accept a small integer as
4854 ;; the source if the destination is a GP memory reference. This is
4855 ;; because we want the combine pass to turn adding a GP reference to a
4856 ;; register into a direct GP reference, but the combine pass will pass
4857 ;; in the source as a constant if it finds an equivalent one. If the
4858 ;; instruction is recognized, reload will force the constant back out
4862 [(set (match_operand:SI
0 "nonimmediate_operand" "=d,y,d,d,d,d,d,d,d,R,m,*d,*d")
4863 (match_operand:SI
1 "move_operand" "d,d,y,S,K,N,s,R,m,d,d,*x,*a"))]
4865 && (register_operand (operands[
0], SImode)
4866 || register_operand (operands[
1], SImode)
4867 || (GET_CODE (operands[
0]) == MEM
4868 && GET_CODE (XEXP (operands[
0],
0)) == PLUS
4869 && GET_CODE (XEXP (XEXP (operands[
0],
0),
1)) == CONST
4870 && mips16_gp_offset_p (XEXP (XEXP (operands[
0],
0),
1))
4871 && GET_CODE (operands[
1]) == CONST_INT
4872 && (SMALL_INT (operands[
1])
4873 || SMALL_INT_UNSIGNED (operands[
1]))))"
4874 "* return mips_move_1word (operands, insn, FALSE);"
4875 [(set_attr "type" "move,move,move,load,arith,arith,arith,load,load,store,store,hilo,hilo")
4876 (set_attr "mode" "SI")
4877 (set_attr_alternative "length"
4882 (if_then_else (match_operand:VOID
1 "m16_uimm8_1" "")
4885 (if_then_else (match_operand:VOID
1 "m16_nuimm8_1" "")
4888 (if_then_else (match_operand:VOID
1 "m16_usym8_4" "")
4898 ;; On the mips16, we can split lw $r,N($r) into an add and a load,
4899 ;; when the original load is a
4 byte instruction but the add and the
4900 ;; load are
2 2 byte instructions.
4903 [(set (match_operand:SI
0 "register_operand" "")
4904 (mem:SI (plus:SI (match_dup
0)
4905 (match_operand:SI
1 "const_int_operand" ""))))]
4906 "TARGET_MIPS16 && reload_completed
4907 && GET_CODE (operands[
0]) == REG
4908 && M16_REG_P (REGNO (operands[
0]))
4909 && GET_CODE (operands[
1]) == CONST_INT
4910 && ((INTVAL (operands[
1]) <
0
4911 && INTVAL (operands[
1]) >= -
0x80)
4912 || (INTVAL (operands[
1]) >=
32 *
4
4913 && INTVAL (operands[
1]) <=
31 *
4 +
0x7c)
4914 || (INTVAL (operands[
1]) >=
0
4915 && INTVAL (operands[
1]) <
32 *
4
4916 && (INTVAL (operands[
1]) &
3) !=
0))"
4917 [(set (match_dup
0) (plus:SI (match_dup
0) (match_dup
1)))
4918 (set (match_dup
0) (mem:SI (plus:SI (match_dup
0) (match_dup
2))))]
4921 HOST_WIDE_INT val = INTVAL (operands[
1]);
4924 operands[
2] = GEN_INT (
0);
4925 else if (val >=
32 *
4)
4929 operands[
1] = GEN_INT (
0x7c + off);
4930 operands[
2] = GEN_INT (val - off -
0x7c);
4936 operands[
1] = GEN_INT (off);
4937 operands[
2] = GEN_INT (val - off);
4941 ;; On the mips16, we can split a load of certain constants into a load
4942 ;; and an add. This turns a
4 byte instruction into
2 2 byte
4946 [(set (match_operand:SI
0 "register_operand" "")
4947 (match_operand:SI
1 "const_int_operand" ""))]
4948 "TARGET_MIPS16 && reload_completed
4949 && GET_CODE (operands[
0]) == REG
4950 && M16_REG_P (REGNO (operands[
0]))
4951 && GET_CODE (operands[
1]) == CONST_INT
4952 && INTVAL (operands[
1]) >=
0x100
4953 && INTVAL (operands[
1]) <=
0xff +
0x7f"
4954 [(set (match_dup
0) (match_dup
1))
4955 (set (match_dup
0) (plus:SI (match_dup
0) (match_dup
2)))]
4958 int val = INTVAL (operands[
1]);
4960 operands[
1] = GEN_INT (
0xff);
4961 operands[
2] = GEN_INT (val -
0xff);
4964 ;; On the mips16, we can split a load of a negative constant into a
4965 ;; load and a neg. That's what mips_move_1word will generate anyhow.
4968 [(set (match_operand:SI
0 "register_operand" "")
4969 (match_operand:SI
1 "const_int_operand" ""))]
4970 "TARGET_MIPS16 && reload_completed
4971 && GET_CODE (operands[
0]) == REG
4972 && M16_REG_P (REGNO (operands[
0]))
4973 && GET_CODE (operands[
1]) == CONST_INT
4974 && INTVAL (operands[
1]) <
0
4975 && INTVAL (operands[
1]) > -
0x8000"
4976 [(set (match_dup
0) (match_dup
1))
4977 (set (match_dup
0) (neg:SI (match_dup
0)))]
4980 operands[
1] = GEN_INT (- INTVAL (operands[
1]));
4983 ;; Reload HILO_REGNUM in SI mode. This needs a scratch register in
4984 ;; order to set the sign bit correctly in the HI register.
4986 (define_expand "reload_outsi"
4987 [(set (match_operand:SI
0 "general_operand" "=b")
4988 (match_operand:SI
1 "register_operand" "b"))
4989 (clobber (match_operand:SI
2 "register_operand" "=&d"))]
4990 "TARGET_64BIT || TARGET_MIPS16"
4994 && GET_CODE (operands[
0]) == REG && REGNO (operands[
0]) == HILO_REGNUM)
4996 emit_insn (gen_movsi (gen_rtx (REG, SImode,
65), operands[
1]));
4997 emit_insn (gen_ashrsi3 (operands[
2], operands[
1], GEN_INT (
31)));
4998 emit_insn (gen_movsi (gen_rtx (REG, SImode,
64), operands[
2]));
5001 /* Use a mult to reload LO on mips16. ??? This is hideous. */
5003 && GET_CODE (operands[
0]) == REG && REGNO (operands[
0]) == LO_REGNUM)
5005 emit_insn (gen_movsi (operands[
2], GEN_INT (
1)));
5006 /* This is gen_mulsi3_internal, but we need to fill in the
5007 scratch registers. */
5008 emit_insn (gen_rtx (PARALLEL, VOIDmode,
5010 gen_rtx (SET, VOIDmode,
5012 gen_rtx (MULT, SImode,
5015 gen_rtx (CLOBBER, VOIDmode,
5016 gen_rtx (REG, SImode,
64)),
5017 gen_rtx (CLOBBER, VOIDmode,
5018 gen_rtx (REG, SImode,
66)))));
5021 /* FIXME: I don't know how to get a value into the HI register. */
5022 if (GET_CODE (operands[
0]) == REG && GP_REG_P (operands[
0]))
5024 emit_move_insn (operands[
0], operands[
1]);
5027 /* This handles moves between a float register and HI/LO. */
5028 emit_move_insn (operands[
2], operands[
1]);
5029 emit_move_insn (operands[
0], operands[
2]);
5033 ;; Reload a value into HI or LO. There is no mthi or mtlo on mips16,
5034 ;; so we use a mult. ??? This is hideous, and we ought to figure out
5035 ;; something better.
5037 (define_expand "reload_insi"
5038 [(set (match_operand:SI
0 "register_operand" "=b")
5039 (match_operand:SI
1 "register_operand" "b"))
5040 (clobber (match_operand:SI
2 "register_operand" "=&d"))]
5045 && GET_CODE (operands[
0]) == REG && REGNO (operands[
0]) == LO_REGNUM)
5047 emit_insn (gen_movsi (operands[
2], GEN_INT (
1)));
5048 /* This is gen_mulsi3_internal, but we need to fill in the
5049 scratch registers. */
5050 emit_insn (gen_rtx (PARALLEL, VOIDmode,
5052 gen_rtx (SET, VOIDmode,
5054 gen_rtx (MULT, SImode,
5057 gen_rtx (CLOBBER, VOIDmode,
5058 gen_rtx (REG, SImode,
64)),
5059 gen_rtx (CLOBBER, VOIDmode,
5060 gen_rtx (REG, SImode,
66)))));
5063 /* FIXME: I don't know how to get a value into the HI register. */
5064 emit_move_insn (operands[
0], operands[
1]);
5068 ;; This insn handles moving CCmode values. It's really just a
5069 ;; slightly simplified copy of movsi_internal2, with additional cases
5070 ;; to move a condition register to a general register and to move
5071 ;; between the general registers and the floating point registers.
5073 (define_insn "movcc"
5074 [(set (match_operand:CC
0 "nonimmediate_operand" "=d,*d,*d,*d,*R,*m,*d,*f,*f,*f,*f,*R,*m")
5075 (match_operand:CC
1 "general_operand" "z,*d,*R,*m,*d,*d,*f,*d,*f,*R,*m,*f,*f"))]
5076 "mips_isa >=
4 && TARGET_HARD_FLOAT"
5077 "* return mips_move_1word (operands, insn, FALSE);"
5078 [(set_attr "type" "move,move,load,load,store,store,xfer,xfer,move,load,load,store,store")
5079 (set_attr "mode" "SI")
5080 (set_attr "length" "
2,
1,
1,
2,
1,
2,
1,
1,
1,
1,
2,
1,
2")])
5082 ;; Reload condition code registers. These need scratch registers.
5084 (define_expand "reload_incc"
5085 [(set (match_operand:CC
0 "register_operand" "=z")
5086 (match_operand:CC
1 "general_operand" "z"))
5087 (clobber (match_operand:TF
2 "register_operand" "=&f"))]
5088 "mips_isa >=
4 && TARGET_HARD_FLOAT"
5094 /* This is called when are copying some value into a condition code
5095 register. Operand
0 is the condition code register. Operand
1
5096 is the source. Operand
2 is a scratch register; we use TFmode
5097 because we actually need two floating point registers. */
5098 if (! ST_REG_P (true_regnum (operands[
0]))
5099 || ! FP_REG_P (true_regnum (operands[
2])))
5102 /* We need to get the source in SFmode so that the insn is
5104 if (GET_CODE (operands[
1]) == MEM)
5105 source = change_address (operands[
1], SFmode, NULL_RTX);
5106 else if (GET_CODE (operands[
1]) == REG || GET_CODE (operands[
1]) == SUBREG)
5107 source = gen_rtx (REG, SFmode, true_regnum (operands[
1]));
5109 source = operands[
1];
5111 fp1 = gen_rtx (REG, SFmode, REGNO (operands[
2]));
5112 fp2 = gen_rtx (REG, SFmode, REGNO (operands[
2]) +
1);
5114 emit_insn (gen_move_insn (fp1, source));
5115 emit_insn (gen_move_insn (fp2, gen_rtx (REG, SFmode,
0)));
5116 emit_insn (gen_rtx (SET, VOIDmode, operands[
0],
5117 gen_rtx (LT, CCmode, fp2, fp1)));
5122 (define_expand "reload_outcc"
5123 [(set (match_operand:CC
0 "general_operand" "=z")
5124 (match_operand:CC
1 "register_operand" "z"))
5125 (clobber (match_operand:CC
2 "register_operand" "=&d"))]
5126 "mips_isa >=
4 && TARGET_HARD_FLOAT"
5129 /* This is called when we are copying a condition code register out
5130 to save it somewhere. Operand
0 should be the location we are
5131 going to save it to. Operand
1 should be the condition code
5132 register. Operand
2 should be a scratch general purpose register
5133 created for us by reload. The mips_secondary_reload_class
5134 function should have told reload that we don't need a scratch
5135 register if the destination is a general purpose register anyhow. */
5136 if (ST_REG_P (true_regnum (operands[
0]))
5137 || GP_REG_P (true_regnum (operands[
0]))
5138 || ! ST_REG_P (true_regnum (operands[
1]))
5139 || ! GP_REG_P (true_regnum (operands[
2])))
5142 /* All we have to do is copy the value from the condition code to
5143 the data register, which movcc can handle, and then store the
5144 value into the real final destination. */
5145 emit_insn (gen_move_insn (operands[
2], operands[
1]));
5146 emit_insn (gen_move_insn (operands[
0], operands[
2]));
5151 ;; MIPS4 supports loading and storing a floating point register from
5152 ;; the sum of two general registers. We use two versions for each of
5153 ;; these four instructions: one where the two general registers are
5154 ;; SImode, and one where they are DImode. This is because general
5155 ;; registers will be in SImode when they hold
32 bit values, but,
5156 ;; since the
32 bit values are always sign extended, the [ls][wd]xc1
5157 ;; instructions will still work correctly.
5159 ;; ??? Perhaps it would be better to support these instructions by
5160 ;; modifying GO_IF_LEGITIMATE_ADDRESS and friends. However, since
5161 ;; these instructions can only be used to load and store floating
5162 ;; point registers, that would probably cause trouble in reload.
5165 [(set (match_operand:SF
0 "register_operand" "=f")
5166 (mem:SF (plus:SI (match_operand:SI
1 "register_operand" "d")
5167 (match_operand:SI
2 "register_operand" "d"))))]
5168 "mips_isa >=
4 && TARGET_HARD_FLOAT"
5170 [(set_attr "type" "load")
5171 (set_attr "mode" "SF")
5172 (set_attr "length" "
1")])
5175 [(set (match_operand:SF
0 "register_operand" "=f")
5176 (mem:SF (plus:DI (match_operand:DI
1 "se_register_operand" "d")
5177 (match_operand:DI
2 "se_register_operand" "d"))))]
5178 "mips_isa >=
4 && TARGET_HARD_FLOAT"
5180 [(set_attr "type" "load")
5181 (set_attr "mode" "SF")
5182 (set_attr "length" "
1")])
5185 [(set (match_operand:DF
0 "register_operand" "=f")
5186 (mem:DF (plus:SI (match_operand:SI
1 "register_operand" "d")
5187 (match_operand:SI
2 "register_operand" "d"))))]
5188 "mips_isa >=
4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
5190 [(set_attr "type" "load")
5191 (set_attr "mode" "DF")
5192 (set_attr "length" "
1")])
5195 [(set (match_operand:DF
0 "register_operand" "=f")
5196 (mem:DF (plus:DI (match_operand:DI
1 "se_register_operand" "d")
5197 (match_operand:DI
2 "se_register_operand" "d"))))]
5198 "mips_isa >=
4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
5200 [(set_attr "type" "load")
5201 (set_attr "mode" "DF")
5202 (set_attr "length" "
1")])
5205 [(set (mem:SF (plus:SI (match_operand:SI
1 "register_operand" "d")
5206 (match_operand:SI
2 "register_operand" "d")))
5207 (match_operand:SF
0 "register_operand" "=f"))]
5208 "mips_isa >=
4 && TARGET_HARD_FLOAT"
5210 [(set_attr "type" "store")
5211 (set_attr "mode" "SF")
5212 (set_attr "length" "
1")])
5215 [(set (mem:SF (plus:DI (match_operand:DI
1 "se_register_operand" "d")
5216 (match_operand:DI
2 "se_register_operand" "d")))
5217 (match_operand:SF
0 "register_operand" "=f"))]
5218 "mips_isa >=
4 && TARGET_HARD_FLOAT"
5220 [(set_attr "type" "store")
5221 (set_attr "mode" "SF")
5222 (set_attr "length" "
1")])
5225 [(set (mem:DF (plus:SI (match_operand:SI
1 "register_operand" "d")
5226 (match_operand:SI
2 "register_operand" "d")))
5227 (match_operand:DF
0 "register_operand" "=f"))]
5228 "mips_isa >=
4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
5230 [(set_attr "type" "store")
5231 (set_attr "mode" "DF")
5232 (set_attr "length" "
1")])
5235 [(set (mem:DF (plus:DI (match_operand:DI
1 "se_register_operand" "d")
5236 (match_operand:DI
2 "se_register_operand" "d")))
5237 (match_operand:DF
0 "register_operand" "=f"))]
5238 "mips_isa >=
4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
5240 [(set_attr "type" "store")
5241 (set_attr "mode" "DF")
5242 (set_attr "length" "
1")])
5244 ;;
16-bit Integer moves
5246 ;; Unlike most other insns, the move insns can't be split with
5247 ;; different predicates, because register spilling and other parts of
5248 ;; the compiler, have memoized the insn number already.
5249 ;; Unsigned loads are used because BYTE_LOADS_ZERO_EXTEND is defined
5251 (define_expand "movhi"
5252 [(set (match_operand:HI
0 "nonimmediate_operand" "")
5253 (match_operand:HI
1 "general_operand" ""))]
5257 if ((reload_in_progress | reload_completed) ==
0
5258 && !register_operand (operands[
0], HImode)
5259 && !register_operand (operands[
1], HImode)
5261 || (GET_CODE (operands[
1]) != CONST_INT
5262 || INTVAL (operands[
1]) !=
0)))
5264 rtx temp = force_reg (HImode, operands[
1]);
5265 emit_move_insn (operands[
0], temp);
5270 ;; The difference between these two is whether or not ints are allowed
5271 ;; in FP registers (off by default, use -mdebugh to enable).
5273 (define_insn "movhi_internal1"
5274 [(set (match_operand:HI
0 "nonimmediate_operand" "=d,d,d,d,R,m,*d,*f,*f*z,*x,*d")
5275 (match_operand:HI
1 "general_operand" "d,IK,R,m,dJ,dJ,*f*z,*d,*f,*d,*x"))]
5276 "TARGET_DEBUG_H_MODE && !TARGET_MIPS16
5277 && (register_operand (operands[
0], HImode)
5278 || register_operand (operands[
1], HImode)
5279 || (GET_CODE (operands[
1]) == CONST_INT && INTVAL (operands[
1]) ==
0))"
5280 "* return mips_move_1word (operands, insn, TRUE);"
5281 [(set_attr "type" "move,arith,load,load,store,store,xfer,xfer,move,hilo,hilo")
5282 (set_attr "mode" "HI")
5283 (set_attr "length" "
1,
1,
1,
2,
1,
2,
1,
1,
1,
1,
1")])
5285 (define_insn "movhi_internal2"
5286 [(set (match_operand:HI
0 "nonimmediate_operand" "=d,d,d,d,R,m,*d,*z,*x,*d")
5287 (match_operand:HI
1 "general_operand" "d,IK,R,m,dJ,dJ,*z,*d,*d,*x"))]
5288 "!TARGET_DEBUG_H_MODE && !TARGET_MIPS16
5289 && (register_operand (operands[
0], HImode)
5290 || register_operand (operands[
1], HImode)
5291 || (GET_CODE (operands[
1]) == CONST_INT && INTVAL (operands[
1]) ==
0))"
5292 "* return mips_move_1word (operands, insn, TRUE);"
5293 [(set_attr "type" "move,arith,load,load,store,store,xfer,xfer,hilo,hilo")
5294 (set_attr "mode" "HI")
5295 (set_attr "length" "
1,
1,
1,
2,
1,
2,
1,
1,
1,
1")])
5298 [(set (match_operand:HI
0 "nonimmediate_operand" "=d,y,d,d,d,d,d,R,m,*d")
5299 (match_operand:HI
1 "general_operand" "d,d,y,K,N,R,m,d,d,*x"))]
5301 && (register_operand (operands[
0], HImode)
5302 || register_operand (operands[
1], HImode))"
5303 "* return mips_move_1word (operands, insn, TRUE);"
5304 [(set_attr "type" "move,move,move,arith,arith,load,load,store,store,hilo")
5305 (set_attr "mode" "HI")
5306 (set_attr_alternative "length"
5310 (if_then_else (match_operand:VOID
1 "m16_uimm8_1" "")
5313 (if_then_else (match_operand:VOID
1 "m16_nuimm8_1" "")
5323 ;; On the mips16, we can split lh $r,N($r) into an add and a load,
5324 ;; when the original load is a
4 byte instruction but the add and the
5325 ;; load are
2 2 byte instructions.
5328 [(set (match_operand:HI
0 "register_operand" "")
5329 (mem:SI (plus:SI (match_dup
0)
5330 (match_operand:SI
1 "const_int_operand" ""))))]
5331 "TARGET_MIPS16 && reload_completed
5332 && GET_CODE (operands[
0]) == REG
5333 && M16_REG_P (REGNO (operands[
0]))
5334 && GET_CODE (operands[
1]) == CONST_INT
5335 && ((INTVAL (operands[
1]) <
0
5336 && INTVAL (operands[
1]) >= -
0x80)
5337 || (INTVAL (operands[
1]) >=
32 *
2
5338 && INTVAL (operands[
1]) <=
31 *
2 +
0x7e)
5339 || (INTVAL (operands[
1]) >=
0
5340 && INTVAL (operands[
1]) <
32 *
2
5341 && (INTVAL (operands[
1]) &
1) !=
0))"
5342 [(set (match_dup
0) (plus:SI (match_dup
0) (match_dup
1)))
5343 (set (match_dup
0) (mem:HI (plus:SI (match_dup
0) (match_dup
2))))]
5346 HOST_WIDE_INT val = INTVAL (operands[
1]);
5349 operands[
2] = GEN_INT (
0);
5350 else if (val >=
32 *
2)
5354 operands[
1] = GEN_INT (
0x7e + off);
5355 operands[
2] = GEN_INT (val - off -
0x7e);
5361 operands[
1] = GEN_INT (off);
5362 operands[
2] = GEN_INT (val - off);
5366 ;;
8-bit Integer moves
5368 ;; Unlike most other insns, the move insns can't be split with
5369 ;; different predicates, because register spilling and other parts of
5370 ;; the compiler, have memoized the insn number already.
5371 ;; Unsigned loads are used because BYTE_LOADS_ZERO_EXTEND is defined
5373 (define_expand "movqi"
5374 [(set (match_operand:QI
0 "nonimmediate_operand" "")
5375 (match_operand:QI
1 "general_operand" ""))]
5379 if ((reload_in_progress | reload_completed) ==
0
5380 && !register_operand (operands[
0], QImode)
5381 && !register_operand (operands[
1], QImode)
5383 || (GET_CODE (operands[
1]) != CONST_INT
5384 || INTVAL (operands[
1]) !=
0)))
5386 rtx temp = force_reg (QImode, operands[
1]);
5387 emit_move_insn (operands[
0], temp);
5392 ;; The difference between these two is whether or not ints are allowed
5393 ;; in FP registers (off by default, use -mdebugh to enable).
5395 (define_insn "movqi_internal1"
5396 [(set (match_operand:QI
0 "nonimmediate_operand" "=d,d,d,d,R,m,*d,*f*z,*f,*x,*d")
5397 (match_operand:QI
1 "general_operand" "d,IK,R,m,dJ,dJ,*f*z,*d,*f,*d,*x"))]
5398 "TARGET_DEBUG_H_MODE && !TARGET_MIPS16
5399 && (register_operand (operands[
0], QImode)
5400 || register_operand (operands[
1], QImode)
5401 || (GET_CODE (operands[
1]) == CONST_INT && INTVAL (operands[
1]) ==
0))"
5402 "* return mips_move_1word (operands, insn, TRUE);"
5403 [(set_attr "type" "move,arith,load,load,store,store,xfer,xfer,move,hilo,hilo")
5404 (set_attr "mode" "QI")
5405 (set_attr "length" "
1,
1,
1,
2,
1,
2,
1,
1,
1,
1,
1")])
5407 (define_insn "movqi_internal2"
5408 [(set (match_operand:QI
0 "nonimmediate_operand" "=d,d,d,d,R,m,*d,*z,*x,*d")
5409 (match_operand:QI
1 "general_operand" "d,IK,R,m,dJ,dJ,*z,*d,*d,*x"))]
5410 "!TARGET_DEBUG_H_MODE && !TARGET_MIPS16
5411 && (register_operand (operands[
0], QImode)
5412 || register_operand (operands[
1], QImode)
5413 || (GET_CODE (operands[
1]) == CONST_INT && INTVAL (operands[
1]) ==
0))"
5414 "* return mips_move_1word (operands, insn, TRUE);"
5415 [(set_attr "type" "move,arith,load,load,store,store,xfer,xfer,hilo,hilo")
5416 (set_attr "mode" "QI")
5417 (set_attr "length" "
1,
1,
1,
2,
1,
2,
1,
1,
1,
1")])
5420 [(set (match_operand:QI
0 "nonimmediate_operand" "=d,y,d,d,d,d,d,R,m,*d")
5421 (match_operand:QI
1 "general_operand" "d,d,y,K,N,R,m,d,d,*x"))]
5423 && (register_operand (operands[
0], QImode)
5424 || register_operand (operands[
1], QImode))"
5425 "* return mips_move_1word (operands, insn, TRUE);"
5426 [(set_attr "type" "move,move,move,arith,arith,load,load,store,store,hilo")
5427 (set_attr "mode" "QI")
5428 (set_attr_alternative "length"
5432 (if_then_else (match_operand:VOID
1 "m16_uimm8_1" "")
5435 (if_then_else (match_operand:VOID
1 "m16_nuimm8_1" "")
5445 ;; On the mips16, we can split lb $r,N($r) into an add and a load,
5446 ;; when the original load is a
4 byte instruction but the add and the
5447 ;; load are
2 2 byte instructions.
5450 [(set (match_operand:QI
0 "register_operand" "")
5451 (mem:QI (plus:SI (match_dup
0)
5452 (match_operand:SI
1 "const_int_operand" ""))))]
5453 "TARGET_MIPS16 && reload_completed
5454 && GET_CODE (operands[
0]) == REG
5455 && M16_REG_P (REGNO (operands[
0]))
5456 && GET_CODE (operands[
1]) == CONST_INT
5457 && ((INTVAL (operands[
1]) <
0
5458 && INTVAL (operands[
1]) >= -
0x80)
5459 || (INTVAL (operands[
1]) >=
32
5460 && INTVAL (operands[
1]) <=
31 +
0x7f))"
5461 [(set (match_dup
0) (plus:SI (match_dup
0) (match_dup
1)))
5462 (set (match_dup
0) (mem:QI (plus:SI (match_dup
0) (match_dup
2))))]
5465 HOST_WIDE_INT val = INTVAL (operands[
1]);
5468 operands[
2] = GEN_INT (
0);
5471 operands[
1] = GEN_INT (
0x7f);
5472 operands[
2] = GEN_INT (val -
0x7f);
5476 ;;
32-bit floating point moves
5478 (define_expand "movsf"
5479 [(set (match_operand:SF
0 "nonimmediate_operand" "")
5480 (match_operand:SF
1 "general_operand" ""))]
5484 if ((reload_in_progress | reload_completed) ==
0
5485 && !register_operand (operands[
0], SFmode)
5486 && !register_operand (operands[
1], SFmode)
5488 || (GET_CODE (operands[
1]) != CONST_INT || INTVAL (operands[
1]) !=
0)
5489 && operands[
1] != CONST0_RTX (SFmode)))
5491 rtx temp = force_reg (SFmode, operands[
1]);
5492 emit_move_insn (operands[
0], temp);
5497 (define_insn "movsf_internal1"
5498 [(set (match_operand:SF
0 "nonimmediate_operand" "=f,f,f,f,R,m,*f,*d,*d,*d,*d,*R,*m")
5499 (match_operand:SF
1 "general_operand" "f,G,R,Fm,fG,fG,*d,*f,*G*d,*R,*F*m,*d,*d"))]
5501 && (register_operand (operands[
0], SFmode)
5502 || register_operand (operands[
1], SFmode)
5503 || (GET_CODE (operands[
1]) == CONST_INT && INTVAL (operands[
1]) ==
0)
5504 || operands[
1] == CONST0_RTX (SFmode))"
5505 "* return mips_move_1word (operands, insn, FALSE);"
5506 [(set_attr "type" "move,xfer,load,load,store,store,xfer,xfer,move,load,load,store,store")
5507 (set_attr "mode" "SF")
5508 (set_attr "length" "
1,
1,
1,
2,
1,
2,
1,
1,
1,
1,
2,
1,
2")])
5511 (define_insn "movsf_internal2"
5512 [(set (match_operand:SF
0 "nonimmediate_operand" "=d,d,d,R,m")
5513 (match_operand:SF
1 "general_operand" " Gd,R,Fm,d,d"))]
5514 "TARGET_SOFT_FLOAT && !TARGET_MIPS16
5515 && (register_operand (operands[
0], SFmode)
5516 || register_operand (operands[
1], SFmode)
5517 || (GET_CODE (operands[
1]) == CONST_INT && INTVAL (operands[
1]) ==
0)
5518 || operands[
1] == CONST0_RTX (SFmode))"
5519 "* return mips_move_1word (operands, insn, FALSE);"
5520 [(set_attr "type" "move,load,load,store,store")
5521 (set_attr "mode" "SF")
5522 (set_attr "length" "
1,
1,
2,
1,
2")])
5525 [(set (match_operand:SF
0 "nonimmediate_operand" "=d,y,d,d,d,R,m")
5526 (match_operand:SF
1 "general_operand" "d,d,y,R,Fm,d,d"))]
5528 && (register_operand (operands[
0], SFmode)
5529 || register_operand (operands[
1], SFmode))"
5530 "* return mips_move_1word (operands, insn, FALSE);"
5531 [(set_attr "type" "move,move,move,load,load,store,store")
5532 (set_attr "mode" "SF")
5533 (set_attr "length" "
1,
1,
1,
1,
2,
1,
2")])
5536 ;;
64-bit floating point moves
5538 (define_expand "movdf"
5539 [(set (match_operand:DF
0 "nonimmediate_operand" "")
5540 (match_operand:DF
1 "general_operand" ""))]
5544 if ((reload_in_progress | reload_completed) ==
0
5545 && !register_operand (operands[
0], DFmode)
5546 && !register_operand (operands[
1], DFmode)
5548 || (GET_CODE (operands[
1]) != CONST_INT || INTVAL (operands[
1]) !=
0)
5549 && operands[
1] != CONST0_RTX (DFmode)))
5551 rtx temp = force_reg (DFmode, operands[
1]);
5552 emit_move_insn (operands[
0], temp);
5557 (define_insn "movdf_internal1"
5558 [(set (match_operand:DF
0 "nonimmediate_operand" "=f,f,f,R,To,f,*f,*d,*d,*d,*d,*R,*T")
5559 (match_operand:DF
1 "general_operand" "f,R,To,fG,fG,F,*d,*f,*d*G,*R,*T*F,*d,*d"))]
5560 "TARGET_HARD_FLOAT && !(TARGET_FLOAT64 && !TARGET_64BIT)
5561 && TARGET_DOUBLE_FLOAT
5562 && (register_operand (operands[
0], DFmode)
5563 || register_operand (operands[
1], DFmode)
5564 || (GET_CODE (operands[
1]) == CONST_INT && INTVAL (operands[
1]) ==
0)
5565 || operands[
1] == CONST0_RTX (DFmode))"
5566 "* return mips_move_2words (operands, insn); "
5567 [(set_attr "type" "move,load,load,store,store,load,xfer,xfer,move,load,load,store,store")
5568 (set_attr "mode" "DF")
5569 (set_attr "length" "
1,
2,
4,
2,
4,
4,
2,
2,
2,
2,
4,
2,
4")])
5571 (define_insn "movdf_internal1a"
5572 [(set (match_operand:DF
0 "nonimmediate_operand" "=f,f,R,R,To,To,f,*d,*d,*d,*To,*R")
5573 (match_operand:DF
1 "general_operand" " f,To,f,G,f,G,F,*F,*To,*R,*d,*d"))]
5574 "TARGET_HARD_FLOAT && (TARGET_FLOAT64 && !TARGET_64BIT)
5575 && TARGET_DOUBLE_FLOAT
5576 && (register_operand (operands[
0], DFmode)
5577 || register_operand (operands[
1], DFmode))
5578 || (GET_CODE (operands [
0]) == MEM
5579 && ((GET_CODE (operands[
1]) == CONST_INT
5580 && INTVAL (operands[
1]) ==
0)
5581 || operands[
1] == CONST0_RTX (DFmode)))"
5582 "* return mips_move_2words (operands, insn); "
5583 [(set_attr "type" "move,load,store,store,store,store,load,load,load,load,store,store")
5584 (set_attr "mode" "DF")
5585 (set_attr "length" "
1,
2,
1,
1,
2,
2,
2,
2,
2,
1,
2,
1")])
5587 (define_insn "movdf_internal2"
5588 [(set (match_operand:DF
0 "nonimmediate_operand" "=d,d,d,R,To")
5589 (match_operand:DF
1 "general_operand" "dG,R,ToF,d,d"))]
5590 "(TARGET_SOFT_FLOAT || TARGET_SINGLE_FLOAT) && !TARGET_MIPS16
5591 && (register_operand (operands[
0], DFmode)
5592 || register_operand (operands[
1], DFmode)
5593 || (GET_CODE (operands[
1]) == CONST_INT && INTVAL (operands[
1]) ==
0)
5594 || operands[
1] == CONST0_RTX (DFmode))"
5595 "* return mips_move_2words (operands, insn); "
5596 [(set_attr "type" "move,load,load,store,store")
5597 (set_attr "mode" "DF")
5598 (set_attr "length" "
2,
2,
4,
2,
4")])
5601 [(set (match_operand:DF
0 "nonimmediate_operand" "=d,y,d,d,d,R,To")
5602 (match_operand:DF
1 "general_operand" "d,d,y,R,ToF,d,d"))]
5604 && (register_operand (operands[
0], DFmode)
5605 || register_operand (operands[
1], DFmode))"
5606 "* return mips_move_2words (operands, insn);"
5607 [(set_attr "type" "move,move,move,load,load,store,store")
5608 (set_attr "mode" "DF")
5609 (set_attr "length" "
2,
2,
2,
2,
4,
2,
4")])
5612 [(set (match_operand:DF
0 "register_operand" "")
5613 (match_operand:DF
1 "register_operand" ""))]
5614 "reload_completed && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
5615 && GET_CODE (operands[
0]) == REG && GP_REG_P (REGNO (operands[
0]))
5616 && GET_CODE (operands[
1]) == REG && GP_REG_P (REGNO (operands[
1]))"
5617 [(set (subreg:SI (match_dup
0)
0) (subreg:SI (match_dup
1)
0))
5618 (set (subreg:SI (match_dup
0)
1) (subreg:SI (match_dup
1)
1))]
5621 ;; Instructions to load the global pointer register.
5622 ;; This is volatile to make sure that the scheduler won't move any symbol_ref
5623 ;; uses in front of it. All symbol_refs implicitly use the gp reg.
5625 (define_insn "loadgp"
5627 (unspec_volatile:DI [(match_operand:DI
0 "address_operand" "")]
2))
5628 (clobber (reg:DI
1))]
5630 "%[lui
\\t$
1,%%hi(%%neg(%%gp_rel(%a0)))
\\n
\\taddiu
\\t$
1,$
1,%%lo(%%neg(%%gp_rel(%a0)))
\\n
\\tdaddu
\\t$gp,$
1,$
25%]"
5631 [(set_attr "type" "move")
5632 (set_attr "mode" "DI")
5633 (set_attr "length" "
3")])
5635 ;; Block moves, see mips.c for more details.
5636 ;; Argument
0 is the destination
5637 ;; Argument
1 is the source
5638 ;; Argument
2 is the length
5639 ;; Argument
3 is the alignment
5641 (define_expand "movstrsi"
5642 [(parallel [(set (match_operand:BLK
0 "general_operand" "")
5643 (match_operand:BLK
1 "general_operand" ""))
5644 (use (match_operand:SI
2 "arith32_operand" ""))
5645 (use (match_operand:SI
3 "immediate_operand" ""))])]
5649 if (operands[
0]) /* avoid unused code messages */
5651 expand_block_move (operands);
5656 ;; Insn generated by block moves
5658 (define_insn "movstrsi_internal"
5659 [(set (match_operand:BLK
0 "memory_operand" "=o") ;; destination
5660 (match_operand:BLK
1 "memory_operand" "o")) ;; source
5661 (clobber (match_scratch:SI
4 "=&d")) ;; temp
1
5662 (clobber (match_scratch:SI
5 "=&d")) ;; temp
2
5663 (clobber (match_scratch:SI
6 "=&d")) ;; temp
3
5664 (clobber (match_scratch:SI
7 "=&d")) ;; temp
4
5665 (use (match_operand:SI
2 "small_int" "I")) ;; # bytes to move
5666 (use (match_operand:SI
3 "small_int" "I")) ;; alignment
5667 (use (const_int
0))] ;; normal block move
5669 "* return output_block_move (insn, operands,
4, BLOCK_MOVE_NORMAL);"
5670 [(set_attr "type" "store")
5671 (set_attr "mode" "none")
5672 (set_attr "length" "
20")])
5674 ;; We need mips16 versions, because an offset from the stack pointer
5675 ;; is not offsettable, since the stack pointer can only handle
4 and
8
5679 [(set (match_operand:BLK
0 "memory_operand" "=d") ;; destination
5680 (match_operand:BLK
1 "memory_operand" "d")) ;; source
5681 (clobber (match_scratch:SI
4 "=&d")) ;; temp
1
5682 (clobber (match_scratch:SI
5 "=&d")) ;; temp
2
5683 (clobber (match_scratch:SI
6 "=&d")) ;; temp
3
5684 (clobber (match_scratch:SI
7 "=&d")) ;; temp
4
5685 (use (match_operand:SI
2 "small_int" "I")) ;; # bytes to move
5686 (use (match_operand:SI
3 "small_int" "I")) ;; alignment
5687 (use (const_int
0))] ;; normal block move
5689 "* return output_block_move (insn, operands,
4, BLOCK_MOVE_NORMAL);"
5690 [(set_attr "type" "multi")
5691 (set_attr "mode" "none")
5692 (set_attr "length" "
20")])
5695 [(set (match_operand:BLK
0 "memory_operand" "=d") ;; destination
5696 (match_operand:BLK
1 "memory_operand" "o")) ;; source
5697 (clobber (match_scratch:SI
4 "=&d")) ;; temp
1
5698 (clobber (match_scratch:SI
5 "=&d")) ;; temp
2
5699 (clobber (match_scratch:SI
6 "=&d")) ;; temp
3
5700 (clobber (match_scratch:SI
7 "=&d")) ;; temp
4
5701 (use (match_operand:SI
2 "small_int" "I")) ;; # bytes to move
5702 (use (match_operand:SI
3 "small_int" "I")) ;; alignment
5703 (use (const_int
0))] ;; normal block move
5705 "* return output_block_move (insn, operands,
4, BLOCK_MOVE_NORMAL);"
5706 [(set_attr "type" "multi")
5707 (set_attr "mode" "none")
5708 (set_attr "length" "
20")])
5711 [(set (match_operand:BLK
0 "memory_operand" "=o") ;; destination
5712 (match_operand:BLK
1 "memory_operand" "d")) ;; source
5713 (clobber (match_scratch:SI
4 "=&d")) ;; temp
1
5714 (clobber (match_scratch:SI
5 "=&d")) ;; temp
2
5715 (clobber (match_scratch:SI
6 "=&d")) ;; temp
3
5716 (clobber (match_scratch:SI
7 "=&d")) ;; temp
4
5717 (use (match_operand:SI
2 "small_int" "I")) ;; # bytes to move
5718 (use (match_operand:SI
3 "small_int" "I")) ;; alignment
5719 (use (const_int
0))] ;; normal block move
5721 "* return output_block_move (insn, operands,
4, BLOCK_MOVE_NORMAL);"
5722 [(set_attr "type" "multi")
5723 (set_attr "mode" "none")
5724 (set_attr "length" "
20")])
5726 ;; Split a block move into
2 parts, the first part is everything
5727 ;; except for the last move, and the second part is just the last
5728 ;; store, which is exactly
1 instruction (ie, not a usw), so it can
5729 ;; fill a delay slot. This also prevents a bug in delayed branches
5730 ;; from showing up, which reuses one of the registers in our clobbers.
5733 [(set (mem:BLK (match_operand:SI
0 "register_operand" ""))
5734 (mem:BLK (match_operand:SI
1 "register_operand" "")))
5735 (clobber (match_operand:SI
4 "register_operand" ""))
5736 (clobber (match_operand:SI
5 "register_operand" ""))
5737 (clobber (match_operand:SI
6 "register_operand" ""))
5738 (clobber (match_operand:SI
7 "register_operand" ""))
5739 (use (match_operand:SI
2 "small_int" ""))
5740 (use (match_operand:SI
3 "small_int" ""))
5741 (use (const_int
0))]
5743 "reload_completed && !TARGET_DEBUG_D_MODE && INTVAL (operands[
2]) >
0"
5745 ;; All but the last move
5746 [(parallel [(set (mem:BLK (match_dup
0))
5747 (mem:BLK (match_dup
1)))
5748 (clobber (match_dup
4))
5749 (clobber (match_dup
5))
5750 (clobber (match_dup
6))
5751 (clobber (match_dup
7))
5754 (use (const_int
1))])
5756 ;; The last store, so it can fill a delay slot
5757 (parallel [(set (mem:BLK (match_dup
0))
5758 (mem:BLK (match_dup
1)))
5759 (clobber (match_dup
4))
5760 (clobber (match_dup
5))
5761 (clobber (match_dup
6))
5762 (clobber (match_dup
7))
5765 (use (const_int
2))])]
5769 (define_insn "movstrsi_internal2"
5770 [(set (match_operand:BLK
0 "memory_operand" "=o") ;; destination
5771 (match_operand:BLK
1 "memory_operand" "o")) ;; source
5772 (clobber (match_scratch:SI
4 "=&d")) ;; temp
1
5773 (clobber (match_scratch:SI
5 "=&d")) ;; temp
2
5774 (clobber (match_scratch:SI
6 "=&d")) ;; temp
3
5775 (clobber (match_scratch:SI
7 "=&d")) ;; temp
4
5776 (use (match_operand:SI
2 "small_int" "I")) ;; # bytes to move
5777 (use (match_operand:SI
3 "small_int" "I")) ;; alignment
5778 (use (const_int
1))] ;; all but last store
5780 "* return output_block_move (insn, operands,
4, BLOCK_MOVE_NOT_LAST);"
5781 [(set_attr "type" "store")
5782 (set_attr "mode" "none")
5783 (set_attr "length" "
20")])
5786 [(set (match_operand:BLK
0 "memory_operand" "=d") ;; destination
5787 (match_operand:BLK
1 "memory_operand" "d")) ;; source
5788 (clobber (match_scratch:SI
4 "=&d")) ;; temp
1
5789 (clobber (match_scratch:SI
5 "=&d")) ;; temp
2
5790 (clobber (match_scratch:SI
6 "=&d")) ;; temp
3
5791 (clobber (match_scratch:SI
7 "=&d")) ;; temp
4
5792 (use (match_operand:SI
2 "small_int" "I")) ;; # bytes to move
5793 (use (match_operand:SI
3 "small_int" "I")) ;; alignment
5794 (use (const_int
1))] ;; all but last store
5796 "* return output_block_move (insn, operands,
4, BLOCK_MOVE_NOT_LAST);"
5797 [(set_attr "type" "multi")
5798 (set_attr "mode" "none")
5799 (set_attr "length" "
20")])
5801 (define_insn "movstrsi_internal3"
5802 [(set (match_operand:BLK
0 "memory_operand" "=Ro") ;; destination
5803 (match_operand:BLK
1 "memory_operand" "Ro")) ;; source
5804 (clobber (match_scratch:SI
4 "=&d")) ;; temp
1
5805 (clobber (match_scratch:SI
5 "=&d")) ;; temp
2
5806 (clobber (match_scratch:SI
6 "=&d")) ;; temp
3
5807 (clobber (match_scratch:SI
7 "=&d")) ;; temp
4
5808 (use (match_operand:SI
2 "small_int" "I")) ;; # bytes to move
5809 (use (match_operand:SI
3 "small_int" "I")) ;; alignment
5810 (use (const_int
2))] ;; just last store of block move
5812 "* return output_block_move (insn, operands,
4, BLOCK_MOVE_LAST);"
5813 [(set_attr "type" "store")
5814 (set_attr "mode" "none")
5815 (set_attr "length" "
1")])
5818 [(set (match_operand:BLK
0 "memory_operand" "=d") ;; destination
5819 (match_operand:BLK
1 "memory_operand" "d")) ;; source
5820 (clobber (match_scratch:SI
4 "=&d")) ;; temp
1
5821 (clobber (match_scratch:SI
5 "=&d")) ;; temp
2
5822 (clobber (match_scratch:SI
6 "=&d")) ;; temp
3
5823 (clobber (match_scratch:SI
7 "=&d")) ;; temp
4
5824 (use (match_operand:SI
2 "small_int" "I")) ;; # bytes to move
5825 (use (match_operand:SI
3 "small_int" "I")) ;; alignment
5826 (use (const_int
2))] ;; just last store of block move
5828 "* return output_block_move (insn, operands,
4, BLOCK_MOVE_LAST);"
5829 [(set_attr "type" "store")
5830 (set_attr "mode" "none")
5831 (set_attr "length" "
1")])
5835 ;; ....................
5839 ;; ....................
5841 ;; Many of these instructions uses trivial define_expands, because we
5842 ;; want to use a different set of constraints when TARGET_MIPS16.
5844 (define_expand "ashlsi3"
5845 [(set (match_operand:SI
0 "register_operand" "=d")
5846 (ashift:SI (match_operand:SI
1 "register_operand" "d")
5847 (match_operand:SI
2 "arith_operand" "dI")))]
5851 /* On the mips16, a shift of more than
8 is a four byte instruction,
5852 so, for a shift between
8 and
16, it is just as fast to do two
5853 shifts of
8 or less. If there is a lot of shifting going on, we
5854 may win in CSE. Otherwise combine will put the shifts back
5855 together again. This can be called by function_arg, so we must
5856 be careful not to allocate a new register if we've reached the
5860 && GET_CODE (operands[
2]) == CONST_INT
5861 && INTVAL (operands[
2]) >
8
5862 && INTVAL (operands[
2]) <=
16
5863 && ! reload_in_progress
5864 && ! reload_completed)
5866 rtx temp = gen_reg_rtx (SImode);
5868 emit_insn (gen_ashlsi3_internal2 (temp, operands[
1], GEN_INT (
8)));
5869 emit_insn (gen_ashlsi3_internal2 (operands[
0], temp,
5870 GEN_INT (INTVAL (operands[
2]) -
8)));
5875 (define_insn "ashlsi3_internal1"
5876 [(set (match_operand:SI
0 "register_operand" "=d")
5877 (ashift:SI (match_operand:SI
1 "register_operand" "d")
5878 (match_operand:SI
2 "arith_operand" "dI")))]
5882 if (GET_CODE (operands[
2]) == CONST_INT)
5883 operands[
2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[
2]) &
0x1f);
5885 return
\"sll
\\t%
0,%
1,%
2\";
5887 [(set_attr "type" "arith")
5888 (set_attr "mode" "SI")
5889 (set_attr "length" "
1")])
5891 (define_insn "ashlsi3_internal2"
5892 [(set (match_operand:SI
0 "register_operand" "=d,d")
5893 (ashift:SI (match_operand:SI
1 "register_operand" "
0,d")
5894 (match_operand:SI
2 "arith_operand" "d,I")))]
5898 if (which_alternative ==
0)
5899 return
\"sll
\\t%
0,%
2\";
5901 if (GET_CODE (operands[
2]) == CONST_INT)
5902 operands[
2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[
2]) &
0x1f);
5904 return
\"sll
\\t%
0,%
1,%
2\";
5906 [(set_attr "type" "arith")
5907 (set_attr "mode" "SI")
5908 (set_attr_alternative "length"
5910 (if_then_else (match_operand:VOID
2 "m16_uimm3_b" "")
5914 ;; On the mips16, we can split a
4 byte shift into
2 2 byte shifts.
5917 [(set (match_operand:SI
0 "register_operand" "")
5918 (ashift:SI (match_operand:SI
1 "register_operand" "")
5919 (match_operand:SI
2 "const_int_operand" "")))]
5922 && GET_CODE (operands[
2]) == CONST_INT
5923 && INTVAL (operands[
2]) >
8
5924 && INTVAL (operands[
2]) <=
16"
5925 [(set (match_dup
0) (ashift:SI (match_dup
1) (const_int
8)))
5926 (set (match_dup
0) (ashift:SI (match_dup
0) (match_dup
2)))]
5929 operands[
2] = GEN_INT (INTVAL (operands[
2]) -
8);
5932 (define_expand "ashldi3"
5933 [(parallel [(set (match_operand:DI
0 "register_operand" "")
5934 (ashift:DI (match_operand:DI
1 "se_register_operand" "")
5935 (match_operand:SI
2 "arith_operand" "")))
5936 (clobber (match_dup
3))])]
5937 "TARGET_64BIT || (!TARGET_DEBUG_G_MODE && !TARGET_MIPS16)"
5942 /* On the mips16, a shift of more than
8 is a four byte
5943 instruction, so, for a shift between
8 and
16, it is just as
5944 fast to do two shifts of
8 or less. If there is a lot of
5945 shifting going on, we may win in CSE. Otherwise combine will
5946 put the shifts back together again. This can be called by
5947 function_arg, so we must be careful not to allocate a new
5948 register if we've reached the reload pass. */
5951 && GET_CODE (operands[
2]) == CONST_INT
5952 && INTVAL (operands[
2]) >
8
5953 && INTVAL (operands[
2]) <=
16
5954 && ! reload_in_progress
5955 && ! reload_completed)
5957 rtx temp = gen_reg_rtx (DImode);
5959 emit_insn (gen_ashldi3_internal4 (temp, operands[
1], GEN_INT (
8)));
5960 emit_insn (gen_ashldi3_internal4 (operands[
0], temp,
5961 GEN_INT (INTVAL (operands[
2]) -
8)));
5965 emit_insn (gen_ashldi3_internal4 (operands[
0], operands[
1],
5970 operands[
3] = gen_reg_rtx (SImode);
5974 (define_insn "ashldi3_internal"
5975 [(set (match_operand:DI
0 "register_operand" "=&d")
5976 (ashift:DI (match_operand:DI
1 "register_operand" "d")
5977 (match_operand:SI
2 "register_operand" "d")))
5978 (clobber (match_operand:SI
3 "register_operand" "=d"))]
5979 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16"
5982 operands[
4] = const0_rtx;
5983 dslots_jump_total +=
3;
5984 dslots_jump_filled +=
2;
5986 return
\"sll
\\t%
3,%
2,
26\\n
\\
5987 \\tbgez
\\t%
3,
1f
\\n
\\
5988 \\tsll
\\t%M0,%L1,%
2\\n
\\
5990 \\tmove
\\t%L0,%z4%)
\\n
\\
5993 \\t%(beq
\\t%
3,%z4,
2f
\\n
\\
5994 \\tsll
\\t%M0,%M1,%
2%)
\\n
\\
5996 \\tsubu
\\t%
3,%z4,%
2\\n
\\
5997 \\tsrl
\\t%
3,%L1,%
3\\n
\\
5998 \\tor
\\t%M0,%M0,%
3\\n
\\
6000 \\tsll
\\t%L0,%L1,%
2\\n
\\
6003 [(set_attr "type" "darith")
6004 (set_attr "mode" "SI")
6005 (set_attr "length" "
12")])
6008 (define_insn "ashldi3_internal2"
6009 [(set (match_operand:DI
0 "register_operand" "=d")
6010 (ashift:DI (match_operand:DI
1 "register_operand" "d")
6011 (match_operand:SI
2 "small_int" "IJK")))
6012 (clobber (match_operand:SI
3 "register_operand" "=d"))]
6013 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
6014 && (INTVAL (operands[
2]) &
32) !=
0"
6017 operands[
2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[
2]) &
0x1f);
6018 operands[
4] = const0_rtx;
6019 return
\"sll
\\t%M0,%L1,%
2\;move
\\t%L0,%z4
\";
6021 [(set_attr "type" "darith")
6022 (set_attr "mode" "DI")
6023 (set_attr "length" "
2")])
6027 [(set (match_operand:DI
0 "register_operand" "")
6028 (ashift:DI (match_operand:DI
1 "register_operand" "")
6029 (match_operand:SI
2 "small_int" "")))
6030 (clobber (match_operand:SI
3 "register_operand" ""))]
6031 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT
6032 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
6033 && GET_CODE (operands[
0]) == REG && REGNO (operands[
0]) < FIRST_PSEUDO_REGISTER
6034 && GET_CODE (operands[
1]) == REG && REGNO (operands[
1]) < FIRST_PSEUDO_REGISTER
6035 && (INTVAL (operands[
2]) &
32) !=
0"
6037 [(set (subreg:SI (match_dup
0)
1) (ashift:SI (subreg:SI (match_dup
1)
0) (match_dup
2)))
6038 (set (subreg:SI (match_dup
0)
0) (const_int
0))]
6040 "operands[
2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[
2]) &
0x1f);")
6044 [(set (match_operand:DI
0 "register_operand" "")
6045 (ashift:DI (match_operand:DI
1 "register_operand" "")
6046 (match_operand:SI
2 "small_int" "")))
6047 (clobber (match_operand:SI
3 "register_operand" ""))]
6048 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT
6049 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
6050 && GET_CODE (operands[
0]) == REG && REGNO (operands[
0]) < FIRST_PSEUDO_REGISTER
6051 && GET_CODE (operands[
1]) == REG && REGNO (operands[
1]) < FIRST_PSEUDO_REGISTER
6052 && (INTVAL (operands[
2]) &
32) !=
0"
6054 [(set (subreg:SI (match_dup
0)
0) (ashift:SI (subreg:SI (match_dup
1)
1) (match_dup
2)))
6055 (set (subreg:SI (match_dup
0)
1) (const_int
0))]
6057 "operands[
2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[
2]) &
0x1f);")
6060 (define_insn "ashldi3_internal3"
6061 [(set (match_operand:DI
0 "register_operand" "=d")
6062 (ashift:DI (match_operand:DI
1 "register_operand" "d")
6063 (match_operand:SI
2 "small_int" "IJK")))
6064 (clobber (match_operand:SI
3 "register_operand" "=d"))]
6065 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
6066 && (INTVAL (operands[
2]) &
63) <
32
6067 && (INTVAL (operands[
2]) &
63) !=
0"
6070 int amount = INTVAL (operands[
2]);
6072 operands[
2] = gen_rtx (CONST_INT, VOIDmode, (amount &
31));
6073 operands[
4] = const0_rtx;
6074 operands[
5] = gen_rtx (CONST_INT, VOIDmode, ((-amount) &
31));
6076 return
\"sll
\\t%M0,%M1,%
2\;srl
\\t%
3,%L1,%
5\;or
\\t%M0,%M0,%
3\;sll
\\t%L0,%L1,%
2\";
6078 [(set_attr "type" "darith")
6079 (set_attr "mode" "DI")
6080 (set_attr "length" "
4")])
6084 [(set (match_operand:DI
0 "register_operand" "")
6085 (ashift:DI (match_operand:DI
1 "register_operand" "")
6086 (match_operand:SI
2 "small_int" "")))
6087 (clobber (match_operand:SI
3 "register_operand" ""))]
6088 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT
6089 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
6090 && GET_CODE (operands[
0]) == REG && REGNO (operands[
0]) < FIRST_PSEUDO_REGISTER
6091 && GET_CODE (operands[
1]) == REG && REGNO (operands[
1]) < FIRST_PSEUDO_REGISTER
6092 && (INTVAL (operands[
2]) &
63) <
32
6093 && (INTVAL (operands[
2]) &
63) !=
0"
6095 [(set (subreg:SI (match_dup
0)
1)
6096 (ashift:SI (subreg:SI (match_dup
1)
1)
6100 (lshiftrt:SI (subreg:SI (match_dup
1)
0)
6103 (set (subreg:SI (match_dup
0)
1)
6104 (ior:SI (subreg:SI (match_dup
0)
1)
6107 (set (subreg:SI (match_dup
0)
0)
6108 (ashift:SI (subreg:SI (match_dup
1)
0)
6112 int amount = INTVAL (operands[
2]);
6113 operands[
2] = gen_rtx (CONST_INT, VOIDmode, (amount &
31));
6114 operands[
4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) &
31));
6119 [(set (match_operand:DI
0 "register_operand" "")
6120 (ashift:DI (match_operand:DI
1 "register_operand" "")
6121 (match_operand:SI
2 "small_int" "")))
6122 (clobber (match_operand:SI
3 "register_operand" ""))]
6123 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT
6124 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
6125 && GET_CODE (operands[
0]) == REG && REGNO (operands[
0]) < FIRST_PSEUDO_REGISTER
6126 && GET_CODE (operands[
1]) == REG && REGNO (operands[
1]) < FIRST_PSEUDO_REGISTER
6127 && (INTVAL (operands[
2]) &
63) <
32
6128 && (INTVAL (operands[
2]) &
63) !=
0"
6130 [(set (subreg:SI (match_dup
0)
0)
6131 (ashift:SI (subreg:SI (match_dup
1)
0)
6135 (lshiftrt:SI (subreg:SI (match_dup
1)
1)
6138 (set (subreg:SI (match_dup
0)
0)
6139 (ior:SI (subreg:SI (match_dup
0)
0)
6142 (set (subreg:SI (match_dup
0)
1)
6143 (ashift:SI (subreg:SI (match_dup
1)
1)
6147 int amount = INTVAL (operands[
2]);
6148 operands[
2] = gen_rtx (CONST_INT, VOIDmode, (amount &
31));
6149 operands[
4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) &
31));
6153 (define_insn "ashldi3_internal4"
6154 [(set (match_operand:DI
0 "register_operand" "=d")
6155 (ashift:DI (match_operand:DI
1 "se_register_operand" "d")
6156 (match_operand:SI
2 "arith_operand" "dI")))]
6157 "TARGET_64BIT && !TARGET_MIPS16"
6160 if (GET_CODE (operands[
2]) == CONST_INT)
6161 operands[
2] = GEN_INT (INTVAL (operands[
2]) &
0x3f);
6163 return
\"dsll
\\t%
0,%
1,%
2\";
6165 [(set_attr "type" "arith")
6166 (set_attr "mode" "DI")
6167 (set_attr "length" "
1")])
6170 [(set (match_operand:DI
0 "register_operand" "=d,d")
6171 (ashift:DI (match_operand:DI
1 "se_register_operand" "
0,d")
6172 (match_operand:SI
2 "arith_operand" "d,I")))]
6173 "TARGET_64BIT && TARGET_MIPS16"
6176 if (which_alternative ==
0)
6177 return
\"dsll
\\t%
0,%
2\";
6179 if (GET_CODE (operands[
2]) == CONST_INT)
6180 operands[
2] = GEN_INT (INTVAL (operands[
2]) &
0x3f);
6182 return
\"dsll
\\t%
0,%
1,%
2\";
6184 [(set_attr "type" "arith")
6185 (set_attr "mode" "DI")
6186 (set_attr_alternative "length"
6188 (if_then_else (match_operand:VOID
2 "m16_uimm3_b" "")
6193 ;; On the mips16, we can split a
4 byte shift into
2 2 byte shifts.
6196 [(set (match_operand:DI
0 "register_operand" "")
6197 (ashift:DI (match_operand:DI
1 "register_operand" "")
6198 (match_operand:SI
2 "const_int_operand" "")))]
6199 "TARGET_MIPS16 && TARGET_64BIT
6201 && GET_CODE (operands[
2]) == CONST_INT
6202 && INTVAL (operands[
2]) >
8
6203 && INTVAL (operands[
2]) <=
16"
6204 [(set (match_dup
0) (ashift:DI (match_dup
1) (const_int
8)))
6205 (set (match_dup
0) (ashift:DI (match_dup
0) (match_dup
2)))]
6208 operands[
2] = GEN_INT (INTVAL (operands[
2]) -
8);
6211 (define_expand "ashrsi3"
6212 [(set (match_operand:SI
0 "register_operand" "=d")
6213 (ashiftrt:SI (match_operand:SI
1 "register_operand" "d")
6214 (match_operand:SI
2 "arith_operand" "dI")))]
6218 /* On the mips16, a shift of more than
8 is a four byte instruction,
6219 so, for a shift between
8 and
16, it is just as fast to do two
6220 shifts of
8 or less. If there is a lot of shifting going on, we
6221 may win in CSE. Otherwise combine will put the shifts back
6225 && GET_CODE (operands[
2]) == CONST_INT
6226 && INTVAL (operands[
2]) >
8
6227 && INTVAL (operands[
2]) <=
16)
6229 rtx temp = gen_reg_rtx (SImode);
6231 emit_insn (gen_ashrsi3_internal2 (temp, operands[
1], GEN_INT (
8)));
6232 emit_insn (gen_ashrsi3_internal2 (operands[
0], temp,
6233 GEN_INT (INTVAL (operands[
2]) -
8)));
6238 (define_insn "ashrsi3_internal1"
6239 [(set (match_operand:SI
0 "register_operand" "=d")
6240 (ashiftrt:SI (match_operand:SI
1 "register_operand" "d")
6241 (match_operand:SI
2 "arith_operand" "dI")))]
6245 if (GET_CODE (operands[
2]) == CONST_INT)
6246 operands[
2] = GEN_INT (INTVAL (operands[
2]) &
0x1f);
6248 return
\"sra
\\t%
0,%
1,%
2\";
6250 [(set_attr "type" "arith")
6251 (set_attr "mode" "SI")
6252 (set_attr "length" "
1")])
6254 (define_insn "ashrsi3_internal2"
6255 [(set (match_operand:SI
0 "register_operand" "=d,d")
6256 (ashiftrt:SI (match_operand:SI
1 "register_operand" "
0,d")
6257 (match_operand:SI
2 "arith_operand" "d,I")))]
6261 if (which_alternative ==
0)
6262 return
\"sra
\\t%
0,%
2\";
6264 if (GET_CODE (operands[
2]) == CONST_INT)
6265 operands[
2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[
2]) &
0x1f);
6267 return
\"sra
\\t%
0,%
1,%
2\";
6269 [(set_attr "type" "arith")
6270 (set_attr "mode" "SI")
6271 (set_attr_alternative "length"
6273 (if_then_else (match_operand:VOID
2 "m16_uimm3_b" "")
6278 ;; On the mips16, we can split a
4 byte shift into
2 2 byte shifts.
6281 [(set (match_operand:SI
0 "register_operand" "")
6282 (ashiftrt:SI (match_operand:SI
1 "register_operand" "")
6283 (match_operand:SI
2 "const_int_operand" "")))]
6286 && GET_CODE (operands[
2]) == CONST_INT
6287 && INTVAL (operands[
2]) >
8
6288 && INTVAL (operands[
2]) <=
16"
6289 [(set (match_dup
0) (ashiftrt:SI (match_dup
1) (const_int
8)))
6290 (set (match_dup
0) (ashiftrt:SI (match_dup
0) (match_dup
2)))]
6293 operands[
2] = GEN_INT (INTVAL (operands[
2]) -
8);
6296 (define_expand "ashrdi3"
6297 [(parallel [(set (match_operand:DI
0 "register_operand" "")
6298 (ashiftrt:DI (match_operand:DI
1 "se_register_operand" "")
6299 (match_operand:SI
2 "arith_operand" "")))
6300 (clobber (match_dup
3))])]
6301 "TARGET_64BIT || (!TARGET_DEBUG_G_MODE && !TARGET_MIPS16)"
6306 /* On the mips16, a shift of more than
8 is a four byte
6307 instruction, so, for a shift between
8 and
16, it is just as
6308 fast to do two shifts of
8 or less. If there is a lot of
6309 shifting going on, we may win in CSE. Otherwise combine will
6310 put the shifts back together again. */
6313 && GET_CODE (operands[
2]) == CONST_INT
6314 && INTVAL (operands[
2]) >
8
6315 && INTVAL (operands[
2]) <=
16)
6317 rtx temp = gen_reg_rtx (DImode);
6319 emit_insn (gen_ashrdi3_internal4 (temp, operands[
1], GEN_INT (
8)));
6320 emit_insn (gen_ashrdi3_internal4 (operands[
0], temp,
6321 GEN_INT (INTVAL (operands[
2]) -
8)));
6325 emit_insn (gen_ashrdi3_internal4 (operands[
0], operands[
1],
6330 operands[
3] = gen_reg_rtx (SImode);
6334 (define_insn "ashrdi3_internal"
6335 [(set (match_operand:DI
0 "register_operand" "=&d")
6336 (ashiftrt:DI (match_operand:DI
1 "register_operand" "d")
6337 (match_operand:SI
2 "register_operand" "d")))
6338 (clobber (match_operand:SI
3 "register_operand" "=d"))]
6339 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16"
6342 operands[
4] = const0_rtx;
6343 dslots_jump_total +=
3;
6344 dslots_jump_filled +=
2;
6346 return
\"sll
\\t%
3,%
2,
26\\n
\\
6347 \\tbgez
\\t%
3,
1f
\\n
\\
6348 \\tsra
\\t%L0,%M1,%
2\\n
\\
6350 \\tsra
\\t%M0,%M1,
31%)
\\n
\\
6353 \\t%(beq
\\t%
3,%z4,
2f
\\n
\\
6354 \\tsrl
\\t%L0,%L1,%
2%)
\\n
\\
6356 \\tsubu
\\t%
3,%z4,%
2\\n
\\
6357 \\tsll
\\t%
3,%M1,%
3\\n
\\
6358 \\tor
\\t%L0,%L0,%
3\\n
\\
6360 \\tsra
\\t%M0,%M1,%
2\\n
\\
6363 [(set_attr "type" "darith")
6364 (set_attr "mode" "DI")
6365 (set_attr "length" "
12")])
6368 (define_insn "ashrdi3_internal2"
6369 [(set (match_operand:DI
0 "register_operand" "=d")
6370 (ashiftrt:DI (match_operand:DI
1 "register_operand" "d")
6371 (match_operand:SI
2 "small_int" "IJK")))
6372 (clobber (match_operand:SI
3 "register_operand" "=d"))]
6373 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && (INTVAL (operands[
2]) &
32) !=
0"
6376 operands[
2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[
2]) &
0x1f);
6377 return
\"sra
\\t%L0,%M1,%
2\;sra
\\t%M0,%M1,
31\";
6379 [(set_attr "type" "darith")
6380 (set_attr "mode" "DI")
6381 (set_attr "length" "
2")])
6385 [(set (match_operand:DI
0 "register_operand" "")
6386 (ashiftrt:DI (match_operand:DI
1 "register_operand" "")
6387 (match_operand:SI
2 "small_int" "")))
6388 (clobber (match_operand:SI
3 "register_operand" ""))]
6389 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
6390 && GET_CODE (operands[
0]) == REG && REGNO (operands[
0]) < FIRST_PSEUDO_REGISTER
6391 && GET_CODE (operands[
1]) == REG && REGNO (operands[
1]) < FIRST_PSEUDO_REGISTER
6392 && (INTVAL (operands[
2]) &
32) !=
0"
6394 [(set (subreg:SI (match_dup
0)
0) (ashiftrt:SI (subreg:SI (match_dup
1)
1) (match_dup
2)))
6395 (set (subreg:SI (match_dup
0)
1) (ashiftrt:SI (subreg:SI (match_dup
1)
1) (const_int
31)))]
6397 "operands[
2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[
2]) &
0x1f);")
6401 [(set (match_operand:DI
0 "register_operand" "")
6402 (ashiftrt:DI (match_operand:DI
1 "register_operand" "")
6403 (match_operand:SI
2 "small_int" "")))
6404 (clobber (match_operand:SI
3 "register_operand" ""))]
6405 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE
6406 && GET_CODE (operands[
0]) == REG && REGNO (operands[
0]) < FIRST_PSEUDO_REGISTER
6407 && GET_CODE (operands[
1]) == REG && REGNO (operands[
1]) < FIRST_PSEUDO_REGISTER
6408 && (INTVAL (operands[
2]) &
32) !=
0"
6410 [(set (subreg:SI (match_dup
0)
1) (ashiftrt:SI (subreg:SI (match_dup
1)
0) (match_dup
2)))
6411 (set (subreg:SI (match_dup
0)
0) (ashiftrt:SI (subreg:SI (match_dup
1)
0) (const_int
31)))]
6413 "operands[
2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[
2]) &
0x1f);")
6416 (define_insn "ashrdi3_internal3"
6417 [(set (match_operand:DI
0 "register_operand" "=d")
6418 (ashiftrt:DI (match_operand:DI
1 "register_operand" "d")
6419 (match_operand:SI
2 "small_int" "IJK")))
6420 (clobber (match_operand:SI
3 "register_operand" "=d"))]
6421 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
6422 && (INTVAL (operands[
2]) &
63) <
32
6423 && (INTVAL (operands[
2]) &
63) !=
0"
6426 int amount = INTVAL (operands[
2]);
6428 operands[
2] = gen_rtx (CONST_INT, VOIDmode, (amount &
31));
6429 operands[
4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) &
31));
6431 return
\"srl
\\t%L0,%L1,%
2\;sll
\\t%
3,%M1,%
4\;or
\\t%L0,%L0,%
3\;sra
\\t%M0,%M1,%
2\";
6433 [(set_attr "type" "darith")
6434 (set_attr "mode" "DI")
6435 (set_attr "length" "
4")])
6439 [(set (match_operand:DI
0 "register_operand" "")
6440 (ashiftrt:DI (match_operand:DI
1 "register_operand" "")
6441 (match_operand:SI
2 "small_int" "")))
6442 (clobber (match_operand:SI
3 "register_operand" ""))]
6443 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT
6444 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
6445 && GET_CODE (operands[
0]) == REG && REGNO (operands[
0]) < FIRST_PSEUDO_REGISTER
6446 && GET_CODE (operands[
1]) == REG && REGNO (operands[
1]) < FIRST_PSEUDO_REGISTER
6447 && (INTVAL (operands[
2]) &
63) <
32
6448 && (INTVAL (operands[
2]) &
63) !=
0"
6450 [(set (subreg:SI (match_dup
0)
0)
6451 (lshiftrt:SI (subreg:SI (match_dup
1)
0)
6455 (ashift:SI (subreg:SI (match_dup
1)
1)
6458 (set (subreg:SI (match_dup
0)
0)
6459 (ior:SI (subreg:SI (match_dup
0)
0)
6462 (set (subreg:SI (match_dup
0)
1)
6463 (ashiftrt:SI (subreg:SI (match_dup
1)
1)
6467 int amount = INTVAL (operands[
2]);
6468 operands[
2] = gen_rtx (CONST_INT, VOIDmode, (amount &
31));
6469 operands[
4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) &
31));
6474 [(set (match_operand:DI
0 "register_operand" "")
6475 (ashiftrt:DI (match_operand:DI
1 "register_operand" "")
6476 (match_operand:SI
2 "small_int" "")))
6477 (clobber (match_operand:SI
3 "register_operand" ""))]
6478 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT
6479 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
6480 && GET_CODE (operands[
0]) == REG && REGNO (operands[
0]) < FIRST_PSEUDO_REGISTER
6481 && GET_CODE (operands[
1]) == REG && REGNO (operands[
1]) < FIRST_PSEUDO_REGISTER
6482 && (INTVAL (operands[
2]) &
63) <
32
6483 && (INTVAL (operands[
2]) &
63) !=
0"
6485 [(set (subreg:SI (match_dup
0)
1)
6486 (lshiftrt:SI (subreg:SI (match_dup
1)
1)
6490 (ashift:SI (subreg:SI (match_dup
1)
0)
6493 (set (subreg:SI (match_dup
0)
1)
6494 (ior:SI (subreg:SI (match_dup
0)
1)
6497 (set (subreg:SI (match_dup
0)
0)
6498 (ashiftrt:SI (subreg:SI (match_dup
1)
0)
6502 int amount = INTVAL (operands[
2]);
6503 operands[
2] = gen_rtx (CONST_INT, VOIDmode, (amount &
31));
6504 operands[
4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) &
31));
6508 (define_insn "ashrdi3_internal4"
6509 [(set (match_operand:DI
0 "register_operand" "=d")
6510 (ashiftrt:DI (match_operand:DI
1 "se_register_operand" "d")
6511 (match_operand:SI
2 "arith_operand" "dI")))]
6512 "TARGET_64BIT && !TARGET_MIPS16"
6515 if (GET_CODE (operands[
2]) == CONST_INT)
6516 operands[
2] = GEN_INT (INTVAL (operands[
2]) &
0x3f);
6518 return
\"dsra
\\t%
0,%
1,%
2\";
6520 [(set_attr "type" "arith")
6521 (set_attr "mode" "DI")
6522 (set_attr "length" "
1")])
6525 [(set (match_operand:DI
0 "register_operand" "=d,d")
6526 (ashiftrt:DI (match_operand:DI
1 "se_register_operand" "
0,
0")
6527 (match_operand:SI
2 "arith_operand" "d,I")))]
6528 "TARGET_64BIT && TARGET_MIPS16"
6531 if (GET_CODE (operands[
2]) == CONST_INT)
6532 operands[
2] = GEN_INT (INTVAL (operands[
2]) &
0x3f);
6534 return
\"dsra
\\t%
0,%
2\";
6536 [(set_attr "type" "arith")
6537 (set_attr "mode" "DI")
6538 (set_attr_alternative "length"
6540 (if_then_else (match_operand:VOID
2 "m16_uimm3_b" "")
6544 ;; On the mips16, we can split a
4 byte shift into
2 2 byte shifts.
6547 [(set (match_operand:DI
0 "register_operand" "")
6548 (ashiftrt:DI (match_operand:DI
1 "register_operand" "")
6549 (match_operand:SI
2 "const_int_operand" "")))]
6550 "TARGET_MIPS16 && TARGET_64BIT
6552 && GET_CODE (operands[
2]) == CONST_INT
6553 && INTVAL (operands[
2]) >
8
6554 && INTVAL (operands[
2]) <=
16"
6555 [(set (match_dup
0) (ashiftrt:DI (match_dup
1) (const_int
8)))
6556 (set (match_dup
0) (ashiftrt:DI (match_dup
0) (match_dup
2)))]
6559 operands[
2] = GEN_INT (INTVAL (operands[
2]) -
8);
6562 (define_expand "lshrsi3"
6563 [(set (match_operand:SI
0 "register_operand" "=d")
6564 (lshiftrt:SI (match_operand:SI
1 "register_operand" "d")
6565 (match_operand:SI
2 "arith_operand" "dI")))]
6569 /* On the mips16, a shift of more than
8 is a four byte instruction,
6570 so, for a shift between
8 and
16, it is just as fast to do two
6571 shifts of
8 or less. If there is a lot of shifting going on, we
6572 may win in CSE. Otherwise combine will put the shifts back
6576 && GET_CODE (operands[
2]) == CONST_INT
6577 && INTVAL (operands[
2]) >
8
6578 && INTVAL (operands[
2]) <=
16)
6580 rtx temp = gen_reg_rtx (SImode);
6582 emit_insn (gen_lshrsi3_internal2 (temp, operands[
1], GEN_INT (
8)));
6583 emit_insn (gen_lshrsi3_internal2 (operands[
0], temp,
6584 GEN_INT (INTVAL (operands[
2]) -
8)));
6589 (define_insn "lshrsi3_internal1"
6590 [(set (match_operand:SI
0 "register_operand" "=d")
6591 (lshiftrt:SI (match_operand:SI
1 "register_operand" "d")
6592 (match_operand:SI
2 "arith_operand" "dI")))]
6596 if (GET_CODE (operands[
2]) == CONST_INT)
6597 operands[
2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[
2]) &
0x1f);
6599 return
\"srl
\\t%
0,%
1,%
2\";
6601 [(set_attr "type" "arith")
6602 (set_attr "mode" "SI")
6603 (set_attr "length" "
1")])
6605 (define_insn "lshrsi3_internal2"
6606 [(set (match_operand:SI
0 "register_operand" "=d,d")
6607 (lshiftrt:SI (match_operand:SI
1 "register_operand" "
0,d")
6608 (match_operand:SI
2 "arith_operand" "d,I")))]
6612 if (which_alternative ==
0)
6613 return
\"srl
\\t%
0,%
2\";
6615 if (GET_CODE (operands[
2]) == CONST_INT)
6616 operands[
2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[
2]) &
0x1f);
6618 return
\"srl
\\t%
0,%
1,%
2\";
6620 [(set_attr "type" "arith")
6621 (set_attr "mode" "SI")
6622 (set_attr_alternative "length"
6624 (if_then_else (match_operand:VOID
2 "m16_uimm3_b" "")
6629 ;; On the mips16, we can split a
4 byte shift into
2 2 byte shifts.
6632 [(set (match_operand:SI
0 "register_operand" "")
6633 (lshiftrt:SI (match_operand:SI
1 "register_operand" "")
6634 (match_operand:SI
2 "const_int_operand" "")))]
6637 && GET_CODE (operands[
2]) == CONST_INT
6638 && INTVAL (operands[
2]) >
8
6639 && INTVAL (operands[
2]) <=
16"
6640 [(set (match_dup
0) (lshiftrt:SI (match_dup
1) (const_int
8)))
6641 (set (match_dup
0) (lshiftrt:SI (match_dup
0) (match_dup
2)))]
6644 operands[
2] = GEN_INT (INTVAL (operands[
2]) -
8);
6647 ;; If we load a byte on the mips16 as a bitfield, the resulting
6648 ;; sequence of instructions is too complicated for combine, because it
6649 ;; involves four instructions: a load, a shift, a constant load into a
6650 ;; register, and an and (the key problem here is that the mips16 does
6651 ;; not have and immediate). We recognize a shift of a load in order
6652 ;; to make it simple enough for combine to understand.
6655 [(set (match_operand:SI
0 "register_operand" "d,d")
6656 (lshiftrt:SI (match_operand:SI
1 "memory_operand" "R,m")
6657 (match_operand:SI
2 "immediate_operand" "I,I")))]
6659 "lw
\\t%
0,%
1\;srl
\\t%
0,%
2"
6660 [(set_attr "type" "load")
6661 (set_attr "mode" "SI")
6662 (set_attr_alternative "length"
6663 [(if_then_else (match_operand:VOID
2 "m16_uimm3_b" "")
6666 (if_then_else (match_operand:VOID
2 "m16_uimm3_b" "")
6671 [(set (match_operand:SI
0 "register_operand" "")
6672 (lshiftrt:SI (match_operand:SI
1 "memory_operand" "")
6673 (match_operand:SI
2 "immediate_operand" "")))]
6675 [(set (match_dup
0) (match_dup
1))
6676 (set (match_dup
0) (lshiftrt:SI (match_dup
0) (match_dup
2)))]
6679 (define_expand "lshrdi3"
6680 [(parallel [(set (match_operand:DI
0 "register_operand" "")
6681 (lshiftrt:DI (match_operand:DI
1 "se_register_operand" "")
6682 (match_operand:SI
2 "arith_operand" "")))
6683 (clobber (match_dup
3))])]
6684 "TARGET_64BIT || (!TARGET_DEBUG_G_MODE && !TARGET_MIPS16)"
6689 /* On the mips16, a shift of more than
8 is a four byte
6690 instruction, so, for a shift between
8 and
16, it is just as
6691 fast to do two shifts of
8 or less. If there is a lot of
6692 shifting going on, we may win in CSE. Otherwise combine will
6693 put the shifts back together again. */
6696 && GET_CODE (operands[
2]) == CONST_INT
6697 && INTVAL (operands[
2]) >
8
6698 && INTVAL (operands[
2]) <=
16)
6700 rtx temp = gen_reg_rtx (DImode);
6702 emit_insn (gen_lshrdi3_internal4 (temp, operands[
1], GEN_INT (
8)));
6703 emit_insn (gen_lshrdi3_internal4 (operands[
0], temp,
6704 GEN_INT (INTVAL (operands[
2]) -
8)));
6708 emit_insn (gen_lshrdi3_internal4 (operands[
0], operands[
1],
6713 operands[
3] = gen_reg_rtx (SImode);
6717 (define_insn "lshrdi3_internal"
6718 [(set (match_operand:DI
0 "register_operand" "=&d")
6719 (lshiftrt:DI (match_operand:DI
1 "register_operand" "d")
6720 (match_operand:SI
2 "register_operand" "d")))
6721 (clobber (match_operand:SI
3 "register_operand" "=d"))]
6722 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16"
6725 operands[
4] = const0_rtx;
6726 dslots_jump_total +=
3;
6727 dslots_jump_filled +=
2;
6729 return
\"sll
\\t%
3,%
2,
26\\n
\\
6730 \\tbgez
\\t%
3,
1f
\\n
\\
6731 \\tsrl
\\t%L0,%M1,%
2\\n
\\
6733 \\tmove
\\t%M0,%z4%)
\\n
\\
6736 \\t%(beq
\\t%
3,%z4,
2f
\\n
\\
6737 \\tsrl
\\t%L0,%L1,%
2%)
\\n
\\
6739 \\tsubu
\\t%
3,%z4,%
2\\n
\\
6740 \\tsll
\\t%
3,%M1,%
3\\n
\\
6741 \\tor
\\t%L0,%L0,%
3\\n
\\
6743 \\tsrl
\\t%M0,%M1,%
2\\n
\\
6746 [(set_attr "type" "darith")
6747 (set_attr "mode" "DI")
6748 (set_attr "length" "
12")])
6751 (define_insn "lshrdi3_internal2"
6752 [(set (match_operand:DI
0 "register_operand" "=d")
6753 (lshiftrt:DI (match_operand:DI
1 "register_operand" "d")
6754 (match_operand:SI
2 "small_int" "IJK")))
6755 (clobber (match_operand:SI
3 "register_operand" "=d"))]
6756 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
6757 && (INTVAL (operands[
2]) &
32) !=
0"
6760 operands[
2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[
2]) &
0x1f);
6761 operands[
4] = const0_rtx;
6762 return
\"srl
\\t%L0,%M1,%
2\;move
\\t%M0,%z4
\";
6764 [(set_attr "type" "darith")
6765 (set_attr "mode" "DI")
6766 (set_attr "length" "
2")])
6770 [(set (match_operand:DI
0 "register_operand" "")
6771 (lshiftrt:DI (match_operand:DI
1 "register_operand" "")
6772 (match_operand:SI
2 "small_int" "")))
6773 (clobber (match_operand:SI
3 "register_operand" ""))]
6774 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT
6775 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
6776 && GET_CODE (operands[
0]) == REG && REGNO (operands[
0]) < FIRST_PSEUDO_REGISTER
6777 && GET_CODE (operands[
1]) == REG && REGNO (operands[
1]) < FIRST_PSEUDO_REGISTER
6778 && (INTVAL (operands[
2]) &
32) !=
0"
6780 [(set (subreg:SI (match_dup
0)
0) (lshiftrt:SI (subreg:SI (match_dup
1)
1) (match_dup
2)))
6781 (set (subreg:SI (match_dup
0)
1) (const_int
0))]
6783 "operands[
2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[
2]) &
0x1f);")
6787 [(set (match_operand:DI
0 "register_operand" "")
6788 (lshiftrt:DI (match_operand:DI
1 "register_operand" "")
6789 (match_operand:SI
2 "small_int" "")))
6790 (clobber (match_operand:SI
3 "register_operand" ""))]
6791 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT
6792 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
6793 && GET_CODE (operands[
0]) == REG && REGNO (operands[
0]) < FIRST_PSEUDO_REGISTER
6794 && GET_CODE (operands[
1]) == REG && REGNO (operands[
1]) < FIRST_PSEUDO_REGISTER
6795 && (INTVAL (operands[
2]) &
32) !=
0"
6797 [(set (subreg:SI (match_dup
0)
1) (lshiftrt:SI (subreg:SI (match_dup
1)
0) (match_dup
2)))
6798 (set (subreg:SI (match_dup
0)
0) (const_int
0))]
6800 "operands[
2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[
2]) &
0x1f);")
6803 (define_insn "lshrdi3_internal3"
6804 [(set (match_operand:DI
0 "register_operand" "=d")
6805 (lshiftrt:DI (match_operand:DI
1 "register_operand" "d")
6806 (match_operand:SI
2 "small_int" "IJK")))
6807 (clobber (match_operand:SI
3 "register_operand" "=d"))]
6808 "!TARGET_64BIT && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
6809 && (INTVAL (operands[
2]) &
63) <
32
6810 && (INTVAL (operands[
2]) &
63) !=
0"
6813 int amount = INTVAL (operands[
2]);
6815 operands[
2] = gen_rtx (CONST_INT, VOIDmode, (amount &
31));
6816 operands[
4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) &
31));
6818 return
\"srl
\\t%L0,%L1,%
2\;sll
\\t%
3,%M1,%
4\;or
\\t%L0,%L0,%
3\;srl
\\t%M0,%M1,%
2\";
6820 [(set_attr "type" "darith")
6821 (set_attr "mode" "DI")
6822 (set_attr "length" "
4")])
6826 [(set (match_operand:DI
0 "register_operand" "")
6827 (lshiftrt:DI (match_operand:DI
1 "register_operand" "")
6828 (match_operand:SI
2 "small_int" "")))
6829 (clobber (match_operand:SI
3 "register_operand" ""))]
6830 "reload_completed && !WORDS_BIG_ENDIAN && !TARGET_64BIT
6831 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
6832 && GET_CODE (operands[
0]) == REG && REGNO (operands[
0]) < FIRST_PSEUDO_REGISTER
6833 && GET_CODE (operands[
1]) == REG && REGNO (operands[
1]) < FIRST_PSEUDO_REGISTER
6834 && (INTVAL (operands[
2]) &
63) <
32
6835 && (INTVAL (operands[
2]) &
63) !=
0"
6837 [(set (subreg:SI (match_dup
0)
0)
6838 (lshiftrt:SI (subreg:SI (match_dup
1)
0)
6842 (ashift:SI (subreg:SI (match_dup
1)
1)
6845 (set (subreg:SI (match_dup
0)
0)
6846 (ior:SI (subreg:SI (match_dup
0)
0)
6849 (set (subreg:SI (match_dup
0)
1)
6850 (lshiftrt:SI (subreg:SI (match_dup
1)
1)
6854 int amount = INTVAL (operands[
2]);
6855 operands[
2] = gen_rtx (CONST_INT, VOIDmode, (amount &
31));
6856 operands[
4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) &
31));
6861 [(set (match_operand:DI
0 "register_operand" "")
6862 (lshiftrt:DI (match_operand:DI
1 "register_operand" "")
6863 (match_operand:SI
2 "small_int" "")))
6864 (clobber (match_operand:SI
3 "register_operand" ""))]
6865 "reload_completed && WORDS_BIG_ENDIAN && !TARGET_64BIT
6866 && !TARGET_DEBUG_D_MODE && !TARGET_DEBUG_G_MODE && !TARGET_MIPS16
6867 && GET_CODE (operands[
0]) == REG && REGNO (operands[
0]) < FIRST_PSEUDO_REGISTER
6868 && GET_CODE (operands[
1]) == REG && REGNO (operands[
1]) < FIRST_PSEUDO_REGISTER
6869 && (INTVAL (operands[
2]) &
63) <
32
6870 && (INTVAL (operands[
2]) &
63) !=
0"
6872 [(set (subreg:SI (match_dup
0)
1)
6873 (lshiftrt:SI (subreg:SI (match_dup
1)
1)
6877 (ashift:SI (subreg:SI (match_dup
1)
0)
6880 (set (subreg:SI (match_dup
0)
1)
6881 (ior:SI (subreg:SI (match_dup
0)
1)
6884 (set (subreg:SI (match_dup
0)
0)
6885 (lshiftrt:SI (subreg:SI (match_dup
1)
0)
6889 int amount = INTVAL (operands[
2]);
6890 operands[
2] = gen_rtx (CONST_INT, VOIDmode, (amount &
31));
6891 operands[
4] = gen_rtx (CONST_INT, VOIDmode, ((-amount) &
31));
6895 (define_insn "lshrdi3_internal4"
6896 [(set (match_operand:DI
0 "register_operand" "=d")
6897 (lshiftrt:DI (match_operand:DI
1 "se_register_operand" "d")
6898 (match_operand:SI
2 "arith_operand" "dI")))]
6899 "TARGET_64BIT && !TARGET_MIPS16"
6902 if (GET_CODE (operands[
2]) == CONST_INT)
6903 operands[
2] = GEN_INT (INTVAL (operands[
2]) &
0x3f);
6905 return
\"dsrl
\\t%
0,%
1,%
2\";
6907 [(set_attr "type" "arith")
6908 (set_attr "mode" "DI")
6909 (set_attr "length" "
1")])
6912 [(set (match_operand:DI
0 "register_operand" "=d,d")
6913 (lshiftrt:DI (match_operand:DI
1 "se_register_operand" "
0,
0")
6914 (match_operand:SI
2 "arith_operand" "d,I")))]
6915 "TARGET_64BIT && TARGET_MIPS16"
6918 if (GET_CODE (operands[
2]) == CONST_INT)
6919 operands[
2] = GEN_INT (INTVAL (operands[
2]) &
0x3f);
6921 return
\"dsrl
\\t%
0,%
2\";
6923 [(set_attr "type" "arith")
6924 (set_attr "mode" "DI")
6925 (set_attr_alternative "length"
6927 (if_then_else (match_operand:VOID
2 "m16_uimm3_b" "")
6931 ;; On the mips16, we can split a
4 byte shift into
2 2 byte shifts.
6934 [(set (match_operand:DI
0 "register_operand" "")
6935 (lshiftrt:DI (match_operand:DI
1 "register_operand" "")
6936 (match_operand:SI
2 "const_int_operand" "")))]
6939 && GET_CODE (operands[
2]) == CONST_INT
6940 && INTVAL (operands[
2]) >
8
6941 && INTVAL (operands[
2]) <=
16"
6942 [(set (match_dup
0) (lshiftrt:DI (match_dup
1) (const_int
8)))
6943 (set (match_dup
0) (lshiftrt:DI (match_dup
0) (match_dup
2)))]
6946 operands[
2] = GEN_INT (INTVAL (operands[
2]) -
8);
6951 ;; ....................
6955 ;; ....................
6957 ;; Flow here is rather complex:
6959 ;;
1) The cmp{si,di,sf,df} routine is called. It deposits the
6960 ;; arguments into the branch_cmp array, and the type into
6961 ;; branch_type. No RTL is generated.
6963 ;;
2) The appropriate branch define_expand is called, which then
6964 ;; creates the appropriate RTL for the comparison and branch.
6965 ;; Different CC modes are used, based on what type of branch is
6966 ;; done, so that we can constrain things appropriately. There
6967 ;; are assumptions in the rest of GCC that break if we fold the
6968 ;; operands into the branchs for integer operations, and use cc0
6969 ;; for floating point, so we use the fp status register instead.
6970 ;; If needed, an appropriate temporary is created to hold the
6971 ;; of the integer compare.
6973 (define_expand "cmpsi"
6975 (compare:CC (match_operand:SI
0 "register_operand" "")
6976 (match_operand:SI
1 "arith_operand" "")))]
6980 if (operands[
0]) /* avoid unused code message */
6982 branch_cmp[
0] = operands[
0];
6983 branch_cmp[
1] = operands[
1];
6984 branch_type = CMP_SI;
6989 (define_expand "tstsi"
6991 (match_operand:SI
0 "register_operand" ""))]
6995 if (operands[
0]) /* avoid unused code message */
6997 branch_cmp[
0] = operands[
0];
6998 branch_cmp[
1] = const0_rtx;
6999 branch_type = CMP_SI;
7004 (define_expand "cmpdi"
7006 (compare:CC (match_operand:DI
0 "se_register_operand" "")
7007 (match_operand:DI
1 "se_arith_operand" "")))]
7011 if (operands[
0]) /* avoid unused code message */
7013 branch_cmp[
0] = operands[
0];
7014 branch_cmp[
1] = operands[
1];
7015 branch_type = CMP_DI;
7020 (define_expand "tstdi"
7022 (match_operand:DI
0 "se_register_operand" ""))]
7026 if (operands[
0]) /* avoid unused code message */
7028 branch_cmp[
0] = operands[
0];
7029 branch_cmp[
1] = const0_rtx;
7030 branch_type = CMP_DI;
7035 (define_expand "cmpdf"
7037 (compare:CC (match_operand:DF
0 "register_operand" "")
7038 (match_operand:DF
1 "register_operand" "")))]
7039 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
7042 if (operands[
0]) /* avoid unused code message */
7044 branch_cmp[
0] = operands[
0];
7045 branch_cmp[
1] = operands[
1];
7046 branch_type = CMP_DF;
7051 (define_expand "cmpsf"
7053 (compare:CC (match_operand:SF
0 "register_operand" "")
7054 (match_operand:SF
1 "register_operand" "")))]
7058 if (operands[
0]) /* avoid unused code message */
7060 branch_cmp[
0] = operands[
0];
7061 branch_cmp[
1] = operands[
1];
7062 branch_type = CMP_SF;
7069 ;; ....................
7071 ;; CONDITIONAL BRANCHES
7073 ;; ....................
7075 (define_insn "branch_fp_ne"
7077 (if_then_else (ne:CC (match_operand:CC
0 "register_operand" "z")
7079 (match_operand
1 "pc_or_label_operand" "")
7080 (match_operand
2 "pc_or_label_operand" "")))]
7084 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
7085 return (operands[
1] != pc_rtx) ?
\"%*bc1t%?
\\t%Z0%
1\" :
\"%*bc1f%?
\\t%Z0%
2\";
7087 [(set_attr "type" "branch")
7088 (set_attr "mode" "none")
7089 (set_attr "length" "
1")])
7091 (define_insn "branch_fp_eq"
7093 (if_then_else (eq:CC (match_operand:CC
0 "register_operand" "z")
7095 (match_operand
1 "pc_or_label_operand" "")
7096 (match_operand
2 "pc_or_label_operand" "")))]
7100 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
7101 return (operands[
1] != pc_rtx) ?
\"%*bc1f%?
\\t%Z0%
1\" :
\"%*bc1t%?
\\t%Z0%
2\";
7103 [(set_attr "type" "branch")
7104 (set_attr "mode" "none")
7105 (set_attr "length" "
1")])
7107 (define_insn "branch_zero"
7109 (if_then_else (match_operator:SI
0 "cmp_op"
7110 [(match_operand:SI
1 "register_operand" "d")
7112 (match_operand
2 "pc_or_label_operand" "")
7113 (match_operand
3 "pc_or_label_operand" "")))]
7117 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
7118 if (operands[
2] != pc_rtx)
7120 switch (GET_CODE (operands[
0]))
7122 case EQ: return
\"%*beq%?
\\t%z1,%.,%
2\";
7123 case NE: return
\"%*bne%?
\\t%z1,%.,%
2\";
7124 case GTU: return
\"%*bne%?
\\t%z1,%.,%
2\";
7125 case LEU: return
\"%*beq%?
\\t%z1,%.,%
2\";
7126 case GEU: return
\"%*j
\\t%
2\";
7127 case LTU: return
\"%*bne%?
\\t%.,%.,%
2\";
7130 return
\"%*b%C0z%?
\\t%z1,%
2\";
7133 { /* inverted jump */
7134 switch (GET_CODE (operands[
0]))
7136 case EQ: return
\"%*bne%?
\\t%z1,%.,%
3\";
7137 case NE: return
\"%*beq%?
\\t%z1,%.,%
3\";
7138 case GTU: return
\"%*beq%?
\\t%z1,%.,%
3\";
7139 case LEU: return
\"%*bne%?
\\t%z1,%.,%
3\";
7140 case GEU: return
\"%*beq%?
\\t%.,%.,%
3\";
7141 case LTU: return
\"%*j
\\t%
3\";
7144 return
\"%*b%N0z%?
\\t%z1,%
3\";
7147 [(set_attr "type" "branch")
7148 (set_attr "mode" "none")
7149 (set_attr "length" "
1")])
7154 (if_then_else (match_operator:SI
0 "equality_op"
7155 [(match_operand:SI
1 "register_operand" "d,t")
7157 (match_operand
2 "pc_or_label_operand" "")
7158 (match_operand
3 "pc_or_label_operand" "")))]
7162 if (operands[
2] != pc_rtx)
7164 if (which_alternative ==
0)
7165 return
\"%*b%C0z
\\t%
1,%
2\";
7167 return
\"%*bt%C0z
\\t%
2\";
7171 if (which_alternative ==
0)
7172 return
\"%*b%N0z
\\t%
1,%
3\";
7174 return
\"%*bt%N0z
\\t%
3\";
7177 [(set_attr "type" "branch")
7178 (set_attr "mode" "none")
7179 (set_attr "length" "
2")])
7181 (define_insn "branch_zero_di"
7183 (if_then_else (match_operator:DI
0 "cmp_op"
7184 [(match_operand:DI
1 "se_register_operand" "d")
7186 (match_operand
2 "pc_or_label_operand" "")
7187 (match_operand
3 "pc_or_label_operand" "")))]
7191 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
7192 if (operands[
2] != pc_rtx)
7194 switch (GET_CODE (operands[
0]))
7196 case EQ: return
\"%*beq%?
\\t%z1,%.,%
2\";
7197 case NE: return
\"%*bne%?
\\t%z1,%.,%
2\";
7198 case GTU: return
\"%*bne%?
\\t%z1,%.,%
2\";
7199 case LEU: return
\"%*beq%?
\\t%z1,%.,%
2\";
7200 case GEU: return
\"%*j
\\t%
2\";
7201 case LTU: return
\"%*bne%?
\\t%.,%.,%
2\";
7204 return
\"%*b%C0z%?
\\t%z1,%
2\";
7207 { /* inverted jump */
7208 switch (GET_CODE (operands[
0]))
7210 case EQ: return
\"%*bne%?
\\t%z1,%.,%
3\";
7211 case NE: return
\"%*beq%?
\\t%z1,%.,%
3\";
7212 case GTU: return
\"%*beq%?
\\t%z1,%.,%
3\";
7213 case LEU: return
\"%*bne%?
\\t%z1,%.,%
3\";
7214 case GEU: return
\"%*beq%?
\\t%.,%.,%
3\";
7215 case LTU: return
\"%*j
\\t%
3\";
7218 return
\"%*b%N0z%?
\\t%z1,%
3\";
7221 [(set_attr "type" "branch")
7222 (set_attr "mode" "none")
7223 (set_attr "length" "
1")])
7227 (if_then_else (match_operator:DI
0 "equality_op"
7228 [(match_operand:DI
1 "se_register_operand" "d,t")
7230 (match_operand
2 "pc_or_label_operand" "")
7231 (match_operand
3 "pc_or_label_operand" "")))]
7235 if (operands[
2] != pc_rtx)
7237 if (which_alternative ==
0)
7238 return
\"%*b%C0z
\\t%
1,%
2\";
7240 return
\"%*bt%C0z
\\t%
2\";
7244 if (which_alternative ==
0)
7245 return
\"%*b%N0z
\\t%
1,%
3\";
7247 return
\"%*bt%N0z
\\t%
3\";
7250 [(set_attr "type" "branch")
7251 (set_attr "mode" "none")
7252 (set_attr "length" "
2")])
7255 (define_insn "branch_equality"
7257 (if_then_else (match_operator:SI
0 "equality_op"
7258 [(match_operand:SI
1 "register_operand" "d")
7259 (match_operand:SI
2 "register_operand" "d")])
7260 (match_operand
3 "pc_or_label_operand" "")
7261 (match_operand
4 "pc_or_label_operand" "")))]
7265 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
7266 return (operands[
3] != pc_rtx)
7267 ?
\"%*b%C0%?
\\t%z1,%z2,%
3\"
7268 :
\"%*b%N0%?
\\t%z1,%z2,%
4\";
7270 [(set_attr "type" "branch")
7271 (set_attr "mode" "none")
7272 (set_attr "length" "
1")])
7275 (define_insn "branch_equality_di"
7277 (if_then_else (match_operator:DI
0 "equality_op"
7278 [(match_operand:DI
1 "se_register_operand" "d")
7279 (match_operand:DI
2 "se_register_operand" "d")])
7280 (match_operand
3 "pc_or_label_operand" "")
7281 (match_operand
4 "pc_or_label_operand" "")))]
7285 mips_branch_likely = (final_sequence && INSN_ANNULLED_BRANCH_P (insn));
7286 return (operands[
3] != pc_rtx)
7287 ?
\"%*b%C0%?
\\t%z1,%z2,%
3\"
7288 :
\"%*b%N0%?
\\t%z1,%z2,%
4\";
7290 [(set_attr "type" "branch")
7291 (set_attr "mode" "none")
7292 (set_attr "length" "
1")])
7295 (define_expand "beq"
7297 (if_then_else (eq:CC (cc0)
7299 (label_ref (match_operand
0 "" ""))
7304 if (operands[
0]) /* avoid unused code warning */
7306 gen_conditional_branch (operands, EQ);
7311 (define_expand "bne"
7313 (if_then_else (ne:CC (cc0)
7315 (label_ref (match_operand
0 "" ""))
7320 if (operands[
0]) /* avoid unused code warning */
7322 gen_conditional_branch (operands, NE);
7327 (define_expand "bgt"
7329 (if_then_else (gt:CC (cc0)
7331 (label_ref (match_operand
0 "" ""))
7336 if (operands[
0]) /* avoid unused code warning */
7338 gen_conditional_branch (operands, GT);
7343 (define_expand "bge"
7345 (if_then_else (ge:CC (cc0)
7347 (label_ref (match_operand
0 "" ""))
7352 if (operands[
0]) /* avoid unused code warning */
7354 gen_conditional_branch (operands, GE);
7359 (define_expand "blt"
7361 (if_then_else (lt:CC (cc0)
7363 (label_ref (match_operand
0 "" ""))
7368 if (operands[
0]) /* avoid unused code warning */
7370 gen_conditional_branch (operands, LT);
7375 (define_expand "ble"
7377 (if_then_else (le:CC (cc0)
7379 (label_ref (match_operand
0 "" ""))
7384 if (operands[
0]) /* avoid unused code warning */
7386 gen_conditional_branch (operands, LE);
7391 (define_expand "bgtu"
7393 (if_then_else (gtu:CC (cc0)
7395 (label_ref (match_operand
0 "" ""))
7400 if (operands[
0]) /* avoid unused code warning */
7402 gen_conditional_branch (operands, GTU);
7407 (define_expand "bgeu"
7409 (if_then_else (geu:CC (cc0)
7411 (label_ref (match_operand
0 "" ""))
7416 if (operands[
0]) /* avoid unused code warning */
7418 gen_conditional_branch (operands, GEU);
7424 (define_expand "bltu"
7426 (if_then_else (ltu:CC (cc0)
7428 (label_ref (match_operand
0 "" ""))
7433 if (operands[
0]) /* avoid unused code warning */
7435 gen_conditional_branch (operands, LTU);
7440 (define_expand "bleu"
7442 (if_then_else (leu:CC (cc0)
7444 (label_ref (match_operand
0 "" ""))
7449 if (operands[
0]) /* avoid unused code warning */
7451 gen_conditional_branch (operands, LEU);
7458 ;; ....................
7460 ;; SETTING A REGISTER FROM A COMPARISON
7462 ;; ....................
7464 (define_expand "seq"
7465 [(set (match_operand:SI
0 "register_operand" "=d")
7466 (eq:SI (match_dup
1)
7471 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
7474 /* set up operands from compare. */
7475 operands[
1] = branch_cmp[
0];
7476 operands[
2] = branch_cmp[
1];
7478 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE || TARGET_MIPS16)
7480 gen_int_relational (EQ, operands[
0], operands[
1], operands[
2], (int *)
0);
7484 if (GET_CODE (operands[
2]) == CONST_INT && INTVAL (operands[
2]) <
0)
7485 operands[
2] = force_reg (SImode, operands[
2]);
7487 /* fall through and generate default code */
7491 (define_insn "seq_si_zero"
7492 [(set (match_operand:SI
0 "register_operand" "=d")
7493 (eq:SI (match_operand:SI
1 "register_operand" "d")
7497 [(set_attr "type" "arith")
7498 (set_attr "mode" "SI")
7499 (set_attr "length" "
1")])
7502 [(set (match_operand:SI
0 "register_operand" "=t")
7503 (eq:SI (match_operand:SI
1 "register_operand" "d")
7507 [(set_attr "type" "arith")
7508 (set_attr "mode" "SI")
7509 (set_attr "length" "
1")])
7511 (define_insn "seq_di_zero"
7512 [(set (match_operand:DI
0 "register_operand" "=d")
7513 (eq:DI (match_operand:DI
1 "se_register_operand" "d")
7515 "TARGET_64BIT && !TARGET_MIPS16"
7517 [(set_attr "type" "arith")
7518 (set_attr "mode" "DI")
7519 (set_attr "length" "
1")])
7522 [(set (match_operand:DI
0 "register_operand" "=t")
7523 (eq:DI (match_operand:DI
1 "se_register_operand" "d")
7525 "TARGET_64BIT && TARGET_MIPS16"
7527 [(set_attr "type" "arith")
7528 (set_attr "mode" "DI")
7529 (set_attr "length" "
1")])
7531 (define_insn "seq_si"
7532 [(set (match_operand:SI
0 "register_operand" "=d,d")
7533 (eq:SI (match_operand:SI
1 "register_operand" "%d,d")
7534 (match_operand:SI
2 "uns_arith_operand" "d,K")))]
7535 "TARGET_DEBUG_C_MODE && !TARGET_MIPS16"
7537 xor
\\t%
0,%
1,%
2\;sltu
\\t%
0,%
0,
1
7538 xori
\\t%
0,%
1,%
2\;sltu
\\t%
0,%
0,
1"
7539 [(set_attr "type" "arith")
7540 (set_attr "mode" "SI")
7541 (set_attr "length" "
2")])
7544 [(set (match_operand:SI
0 "register_operand" "")
7545 (eq:SI (match_operand:SI
1 "register_operand" "")
7546 (match_operand:SI
2 "uns_arith_operand" "")))]
7547 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE && !TARGET_MIPS16
7548 && (GET_CODE (operands[
2]) != CONST_INT || INTVAL (operands[
2]) !=
0)"
7550 (xor:SI (match_dup
1)
7553 (ltu:SI (match_dup
0)
7557 (define_insn "seq_di"
7558 [(set (match_operand:DI
0 "register_operand" "=d,d")
7559 (eq:DI (match_operand:DI
1 "se_register_operand" "%d,d")
7560 (match_operand:DI
2 "se_uns_arith_operand" "d,K")))]
7561 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_MIPS16"
7563 xor
\\t%
0,%
1,%
2\;sltu
\\t%
0,%
0,
1
7564 xori
\\t%
0,%
1,%
2\;sltu
\\t%
0,%
0,
1"
7565 [(set_attr "type" "arith")
7566 (set_attr "mode" "DI")
7567 (set_attr "length" "
2")])
7570 [(set (match_operand:DI
0 "register_operand" "")
7571 (eq:DI (match_operand:DI
1 "se_register_operand" "")
7572 (match_operand:DI
2 "se_uns_arith_operand" "")))]
7573 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE
7575 && (GET_CODE (operands[
2]) != CONST_INT || INTVAL (operands[
2]) !=
0)"
7577 (xor:DI (match_dup
1)
7580 (ltu:DI (match_dup
0)
7584 ;; On the mips16 the default code is better than using sltu.
7586 (define_expand "sne"
7587 [(set (match_operand:SI
0 "register_operand" "=d")
7588 (ne:SI (match_dup
1)
7593 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
7596 /* set up operands from compare. */
7597 operands[
1] = branch_cmp[
0];
7598 operands[
2] = branch_cmp[
1];
7600 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE)
7602 gen_int_relational (NE, operands[
0], operands[
1], operands[
2], (int *)
0);
7606 if (GET_CODE (operands[
2]) == CONST_INT && INTVAL (operands[
2]) <
0)
7607 operands[
2] = force_reg (SImode, operands[
2]);
7609 /* fall through and generate default code */
7612 (define_insn "sne_si_zero"
7613 [(set (match_operand:SI
0 "register_operand" "=d")
7614 (ne:SI (match_operand:SI
1 "register_operand" "d")
7618 [(set_attr "type" "arith")
7619 (set_attr "mode" "SI")
7620 (set_attr "length" "
1")])
7622 (define_insn "sne_di_zero"
7623 [(set (match_operand:DI
0 "register_operand" "=d")
7624 (ne:DI (match_operand:DI
1 "se_register_operand" "d")
7626 "TARGET_64BIT && !TARGET_MIPS16"
7628 [(set_attr "type" "arith")
7629 (set_attr "mode" "DI")
7630 (set_attr "length" "
1")])
7632 (define_insn "sne_si"
7633 [(set (match_operand:SI
0 "register_operand" "=d,d")
7634 (ne:SI (match_operand:SI
1 "register_operand" "%d,d")
7635 (match_operand:SI
2 "uns_arith_operand" "d,K")))]
7636 "TARGET_DEBUG_C_MODE && !TARGET_MIPS16"
7638 xor
\\t%
0,%
1,%
2\;sltu
\\t%
0,%.,%
0
7639 xori
\\t%
0,%
1,%x2\;sltu
\\t%
0,%.,%
0"
7640 [(set_attr "type" "arith")
7641 (set_attr "mode" "SI")
7642 (set_attr "length" "
2")])
7645 [(set (match_operand:SI
0 "register_operand" "")
7646 (ne:SI (match_operand:SI
1 "register_operand" "")
7647 (match_operand:SI
2 "uns_arith_operand" "")))]
7648 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE && !TARGET_MIPS16
7649 && (GET_CODE (operands[
2]) != CONST_INT || INTVAL (operands[
2]) !=
0)"
7651 (xor:SI (match_dup
1)
7654 (gtu:SI (match_dup
0)
7658 (define_insn "sne_di"
7659 [(set (match_operand:DI
0 "register_operand" "=d,d")
7660 (ne:DI (match_operand:DI
1 "se_register_operand" "%d,d")
7661 (match_operand:DI
2 "se_uns_arith_operand" "d,K")))]
7662 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_MIPS16"
7664 xor
\\t%
0,%
1,%
2\;sltu
\\t%
0,%.,%
0
7665 xori
\\t%
0,%
1,%x2\;sltu
\\t%
0,%.,%
0"
7666 [(set_attr "type" "arith")
7667 (set_attr "mode" "DI")
7668 (set_attr "length" "
2")])
7671 [(set (match_operand:DI
0 "register_operand" "")
7672 (ne:DI (match_operand:DI
1 "se_register_operand" "")
7673 (match_operand:DI
2 "se_uns_arith_operand" "")))]
7674 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE
7676 && (GET_CODE (operands[
2]) != CONST_INT || INTVAL (operands[
2]) !=
0)"
7678 (xor:DI (match_dup
1)
7681 (gtu:DI (match_dup
0)
7685 (define_expand "sgt"
7686 [(set (match_operand:SI
0 "register_operand" "=d")
7687 (gt:SI (match_dup
1)
7692 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
7695 /* set up operands from compare. */
7696 operands[
1] = branch_cmp[
0];
7697 operands[
2] = branch_cmp[
1];
7699 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE || TARGET_MIPS16)
7701 gen_int_relational (GT, operands[
0], operands[
1], operands[
2], (int *)
0);
7705 if (GET_CODE (operands[
2]) == CONST_INT && INTVAL (operands[
2]) !=
0)
7706 operands[
2] = force_reg (SImode, operands[
2]);
7708 /* fall through and generate default code */
7711 (define_insn "sgt_si"
7712 [(set (match_operand:SI
0 "register_operand" "=d")
7713 (gt:SI (match_operand:SI
1 "register_operand" "d")
7714 (match_operand:SI
2 "reg_or_0_operand" "dJ")))]
7717 [(set_attr "type" "arith")
7718 (set_attr "mode" "SI")
7719 (set_attr "length" "
1")])
7722 [(set (match_operand:SI
0 "register_operand" "=t")
7723 (gt:SI (match_operand:SI
1 "register_operand" "d")
7724 (match_operand:SI
2 "register_operand" "d")))]
7727 [(set_attr "type" "arith")
7728 (set_attr "mode" "SI")
7729 (set_attr "length" "
1")])
7731 (define_insn "sgt_di"
7732 [(set (match_operand:DI
0 "register_operand" "=d")
7733 (gt:DI (match_operand:DI
1 "se_register_operand" "d")
7734 (match_operand:DI
2 "se_reg_or_0_operand" "dJ")))]
7735 "TARGET_64BIT && !TARGET_MIPS16"
7737 [(set_attr "type" "arith")
7738 (set_attr "mode" "DI")
7739 (set_attr "length" "
1")])
7742 [(set (match_operand:DI
0 "register_operand" "=d")
7743 (gt:DI (match_operand:DI
1 "se_register_operand" "d")
7744 (match_operand:DI
2 "se_register_operand" "d")))]
7745 "TARGET_64BIT && TARGET_MIPS16"
7747 [(set_attr "type" "arith")
7748 (set_attr "mode" "DI")
7749 (set_attr "length" "
1")])
7751 (define_expand "sge"
7752 [(set (match_operand:SI
0 "register_operand" "=d")
7753 (ge:SI (match_dup
1)
7758 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
7761 /* set up operands from compare. */
7762 operands[
1] = branch_cmp[
0];
7763 operands[
2] = branch_cmp[
1];
7765 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE || TARGET_MIPS16)
7767 gen_int_relational (GE, operands[
0], operands[
1], operands[
2], (int *)
0);
7771 /* fall through and generate default code */
7774 (define_insn "sge_si"
7775 [(set (match_operand:SI
0 "register_operand" "=d")
7776 (ge:SI (match_operand:SI
1 "register_operand" "d")
7777 (match_operand:SI
2 "arith_operand" "dI")))]
7778 "TARGET_DEBUG_C_MODE && !TARGET_MIPS16"
7779 "slt
\\t%
0,%
1,%
2\;xori
\\t%
0,%
0,
0x0001"
7780 [(set_attr "type" "arith")
7781 (set_attr "mode" "SI")
7782 (set_attr "length" "
2")])
7785 [(set (match_operand:SI
0 "register_operand" "")
7786 (ge:SI (match_operand:SI
1 "register_operand" "")
7787 (match_operand:SI
2 "arith_operand" "")))]
7788 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE && !TARGET_MIPS16"
7790 (lt:SI (match_dup
1)
7793 (xor:SI (match_dup
0)
7797 (define_insn "sge_di"
7798 [(set (match_operand:DI
0 "register_operand" "=d")
7799 (ge:DI (match_operand:DI
1 "se_register_operand" "d")
7800 (match_operand:DI
2 "se_arith_operand" "dI")))]
7801 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_MIPS16"
7802 "slt
\\t%
0,%
1,%
2\;xori
\\t%
0,%
0,
0x0001"
7803 [(set_attr "type" "arith")
7804 (set_attr "mode" "DI")
7805 (set_attr "length" "
2")])
7808 [(set (match_operand:DI
0 "register_operand" "")
7809 (ge:DI (match_operand:DI
1 "se_register_operand" "")
7810 (match_operand:DI
2 "se_arith_operand" "")))]
7811 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE
7814 (lt:DI (match_dup
1)
7817 (xor:DI (match_dup
0)
7821 (define_expand "slt"
7822 [(set (match_operand:SI
0 "register_operand" "=d")
7823 (lt:SI (match_dup
1)
7828 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
7831 /* set up operands from compare. */
7832 operands[
1] = branch_cmp[
0];
7833 operands[
2] = branch_cmp[
1];
7835 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE || TARGET_MIPS16)
7837 gen_int_relational (LT, operands[
0], operands[
1], operands[
2], (int *)
0);
7841 /* fall through and generate default code */
7844 (define_insn "slt_si"
7845 [(set (match_operand:SI
0 "register_operand" "=d")
7846 (lt:SI (match_operand:SI
1 "register_operand" "d")
7847 (match_operand:SI
2 "arith_operand" "dI")))]
7850 [(set_attr "type" "arith")
7851 (set_attr "mode" "SI")
7852 (set_attr "length" "
1")])
7855 [(set (match_operand:SI
0 "register_operand" "=t,t")
7856 (lt:SI (match_operand:SI
1 "register_operand" "d,d")
7857 (match_operand:SI
2 "arith_operand" "d,I")))]
7860 [(set_attr "type" "arith")
7861 (set_attr "mode" "SI")
7862 (set_attr_alternative "length"
7864 (if_then_else (match_operand:VOID
2 "m16_uimm8_1" "")
7868 (define_insn "slt_di"
7869 [(set (match_operand:DI
0 "register_operand" "=d")
7870 (lt:DI (match_operand:DI
1 "se_register_operand" "d")
7871 (match_operand:DI
2 "se_arith_operand" "dI")))]
7872 "TARGET_64BIT && !TARGET_MIPS16"
7874 [(set_attr "type" "arith")
7875 (set_attr "mode" "DI")
7876 (set_attr "length" "
1")])
7879 [(set (match_operand:DI
0 "register_operand" "=t,t")
7880 (lt:DI (match_operand:DI
1 "se_register_operand" "d,d")
7881 (match_operand:DI
2 "se_arith_operand" "d,I")))]
7882 "TARGET_64BIT && TARGET_MIPS16"
7884 [(set_attr "type" "arith")
7885 (set_attr "mode" "DI")
7886 (set_attr_alternative "length"
7888 (if_then_else (match_operand:VOID
2 "m16_uimm8_1" "")
7892 (define_expand "sle"
7893 [(set (match_operand:SI
0 "register_operand" "=d")
7894 (le:SI (match_dup
1)
7899 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
7902 /* set up operands from compare. */
7903 operands[
1] = branch_cmp[
0];
7904 operands[
2] = branch_cmp[
1];
7906 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE || TARGET_MIPS16)
7908 gen_int_relational (LE, operands[
0], operands[
1], operands[
2], (int *)
0);
7912 if (GET_CODE (operands[
2]) == CONST_INT && INTVAL (operands[
2]) >=
32767)
7913 operands[
2] = force_reg (SImode, operands[
2]);
7915 /* fall through and generate default code */
7918 (define_insn "sle_si_const"
7919 [(set (match_operand:SI
0 "register_operand" "=d")
7920 (le:SI (match_operand:SI
1 "register_operand" "d")
7921 (match_operand:SI
2 "small_int" "I")))]
7922 "!TARGET_MIPS16 && INTVAL (operands[
2]) <
32767"
7925 operands[
2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[
2])+
1);
7926 return
\"slt
\\t%
0,%
1,%
2\";
7928 [(set_attr "type" "arith")
7929 (set_attr "mode" "SI")
7930 (set_attr "length" "
1")])
7933 [(set (match_operand:SI
0 "register_operand" "=t")
7934 (le:SI (match_operand:SI
1 "register_operand" "d")
7935 (match_operand:SI
2 "small_int" "I")))]
7936 "TARGET_MIPS16 && INTVAL (operands[
2]) <
32767"
7939 operands[
2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[
2])+
1);
7940 return
\"slt
\\t%
1,%
2\";
7942 [(set_attr "type" "arith")
7943 (set_attr "mode" "SI")
7944 (set (attr "length") (if_then_else (match_operand:VOID
2 "m16_uimm8_m1_1" "")
7948 (define_insn "sle_di_const"
7949 [(set (match_operand:DI
0 "register_operand" "=d")
7950 (le:DI (match_operand:DI
1 "se_register_operand" "d")
7951 (match_operand:DI
2 "small_int" "I")))]
7952 "TARGET_64BIT && !TARGET_MIPS16 && INTVAL (operands[
2]) <
32767"
7955 operands[
2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[
2])+
1);
7956 return
\"slt
\\t%
0,%
1,%
2\";
7958 [(set_attr "type" "arith")
7959 (set_attr "mode" "DI")
7960 (set_attr "length" "
1")])
7963 [(set (match_operand:DI
0 "register_operand" "=t")
7964 (le:DI (match_operand:DI
1 "se_register_operand" "d")
7965 (match_operand:DI
2 "small_int" "I")))]
7966 "TARGET_64BIT && TARGET_MIPS16 && INTVAL (operands[
2]) <
32767"
7969 operands[
2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[
2])+
1);
7970 return
\"slt
\\t%
1,%
2\";
7972 [(set_attr "type" "arith")
7973 (set_attr "mode" "DI")
7974 (set (attr "length") (if_then_else (match_operand:VOID
2 "m16_uimm8_m1_1" "")
7978 (define_insn "sle_si_reg"
7979 [(set (match_operand:SI
0 "register_operand" "=d")
7980 (le:SI (match_operand:SI
1 "register_operand" "d")
7981 (match_operand:SI
2 "register_operand" "d")))]
7982 "TARGET_DEBUG_C_MODE && !TARGET_MIPS16"
7983 "slt
\\t%
0,%z2,%
1\;xori
\\t%
0,%
0,
0x0001"
7984 [(set_attr "type" "arith")
7985 (set_attr "mode" "SI")
7986 (set_attr "length" "
2")])
7989 [(set (match_operand:SI
0 "register_operand" "")
7990 (le:SI (match_operand:SI
1 "register_operand" "")
7991 (match_operand:SI
2 "register_operand" "")))]
7992 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE && !TARGET_MIPS16"
7994 (lt:SI (match_dup
2)
7997 (xor:SI (match_dup
0)
8001 (define_insn "sle_di_reg"
8002 [(set (match_operand:DI
0 "register_operand" "=d")
8003 (le:DI (match_operand:DI
1 "se_register_operand" "d")
8004 (match_operand:DI
2 "se_register_operand" "d")))]
8005 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_MIPS16"
8006 "slt
\\t%
0,%z2,%
1\;xori
\\t%
0,%
0,
0x0001"
8007 [(set_attr "type" "arith")
8008 (set_attr "mode" "DI")
8009 (set_attr "length" "
2")])
8012 [(set (match_operand:DI
0 "register_operand" "")
8013 (le:DI (match_operand:DI
1 "se_register_operand" "")
8014 (match_operand:DI
2 "se_register_operand" "")))]
8015 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE
8018 (lt:DI (match_dup
2)
8021 (xor:DI (match_dup
0)
8025 (define_expand "sgtu"
8026 [(set (match_operand:SI
0 "register_operand" "=d")
8027 (gtu:SI (match_dup
1)
8032 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
8035 /* set up operands from compare. */
8036 operands[
1] = branch_cmp[
0];
8037 operands[
2] = branch_cmp[
1];
8039 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE || TARGET_MIPS16)
8041 gen_int_relational (GTU, operands[
0], operands[
1], operands[
2], (int *)
0);
8045 if (GET_CODE (operands[
2]) == CONST_INT && INTVAL (operands[
2]) !=
0)
8046 operands[
2] = force_reg (SImode, operands[
2]);
8048 /* fall through and generate default code */
8051 (define_insn "sgtu_si"
8052 [(set (match_operand:SI
0 "register_operand" "=d")
8053 (gtu:SI (match_operand:SI
1 "register_operand" "d")
8054 (match_operand:SI
2 "reg_or_0_operand" "dJ")))]
8057 [(set_attr "type" "arith")
8058 (set_attr "mode" "SI")
8059 (set_attr "length" "
1")])
8062 [(set (match_operand:SI
0 "register_operand" "=t")
8063 (gtu:SI (match_operand:SI
1 "register_operand" "d")
8064 (match_operand:SI
2 "register_operand" "d")))]
8067 [(set_attr "type" "arith")
8068 (set_attr "mode" "SI")
8069 (set_attr "length" "
1")])
8071 (define_insn "sgtu_di"
8072 [(set (match_operand:DI
0 "register_operand" "=d")
8073 (gtu:DI (match_operand:DI
1 "se_register_operand" "d")
8074 (match_operand:DI
2 "se_reg_or_0_operand" "dJ")))]
8077 [(set_attr "type" "arith")
8078 (set_attr "mode" "DI")
8079 (set_attr "length" "
1")])
8082 [(set (match_operand:DI
0 "register_operand" "=t")
8083 (gtu:DI (match_operand:DI
1 "se_register_operand" "d")
8084 (match_operand:DI
2 "se_register_operand" "d")))]
8087 [(set_attr "type" "arith")
8088 (set_attr "mode" "DI")
8089 (set_attr "length" "
1")])
8091 (define_expand "sgeu"
8092 [(set (match_operand:SI
0 "register_operand" "=d")
8093 (geu:SI (match_dup
1)
8098 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
8101 /* set up operands from compare. */
8102 operands[
1] = branch_cmp[
0];
8103 operands[
2] = branch_cmp[
1];
8105 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE || TARGET_MIPS16)
8107 gen_int_relational (GEU, operands[
0], operands[
1], operands[
2], (int *)
0);
8111 /* fall through and generate default code */
8114 (define_insn "sgeu_si"
8115 [(set (match_operand:SI
0 "register_operand" "=d")
8116 (geu:SI (match_operand:SI
1 "register_operand" "d")
8117 (match_operand:SI
2 "arith_operand" "dI")))]
8118 "TARGET_DEBUG_C_MODE && !TARGET_MIPS16"
8119 "sltu
\\t%
0,%
1,%
2\;xori
\\t%
0,%
0,
0x0001"
8120 [(set_attr "type" "arith")
8121 (set_attr "mode" "SI")
8122 (set_attr "length" "
2")])
8125 [(set (match_operand:SI
0 "register_operand" "")
8126 (geu:SI (match_operand:SI
1 "register_operand" "")
8127 (match_operand:SI
2 "arith_operand" "")))]
8128 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE && !TARGET_MIPS16"
8130 (ltu:SI (match_dup
1)
8133 (xor:SI (match_dup
0)
8137 (define_insn "sgeu_di"
8138 [(set (match_operand:DI
0 "register_operand" "=d")
8139 (geu:DI (match_operand:DI
1 "se_register_operand" "d")
8140 (match_operand:DI
2 "se_arith_operand" "dI")))]
8141 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_MIPS16"
8142 "sltu
\\t%
0,%
1,%
2\;xori
\\t%
0,%
0,
0x0001"
8143 [(set_attr "type" "arith")
8144 (set_attr "mode" "DI")
8145 (set_attr "length" "
2")])
8148 [(set (match_operand:DI
0 "register_operand" "")
8149 (geu:DI (match_operand:DI
1 "se_register_operand" "")
8150 (match_operand:DI
2 "se_arith_operand" "")))]
8151 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE
8154 (ltu:DI (match_dup
1)
8157 (xor:DI (match_dup
0)
8161 (define_expand "sltu"
8162 [(set (match_operand:SI
0 "register_operand" "=d")
8163 (ltu:SI (match_dup
1)
8168 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
8171 /* set up operands from compare. */
8172 operands[
1] = branch_cmp[
0];
8173 operands[
2] = branch_cmp[
1];
8175 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE || TARGET_MIPS16)
8177 gen_int_relational (LTU, operands[
0], operands[
1], operands[
2], (int *)
0);
8181 /* fall through and generate default code */
8184 (define_insn "sltu_si"
8185 [(set (match_operand:SI
0 "register_operand" "=d")
8186 (ltu:SI (match_operand:SI
1 "register_operand" "d")
8187 (match_operand:SI
2 "arith_operand" "dI")))]
8190 [(set_attr "type" "arith")
8191 (set_attr "mode" "SI")
8192 (set_attr "length" "
1")])
8195 [(set (match_operand:SI
0 "register_operand" "=t,t")
8196 (ltu:SI (match_operand:SI
1 "register_operand" "d,d")
8197 (match_operand:SI
2 "arith_operand" "d,I")))]
8200 [(set_attr "type" "arith")
8201 (set_attr "mode" "SI")
8202 (set_attr_alternative "length"
8204 (if_then_else (match_operand:VOID
2 "m16_uimm8_1" "")
8208 (define_insn "sltu_di"
8209 [(set (match_operand:DI
0 "register_operand" "=d")
8210 (ltu:DI (match_operand:DI
1 "se_register_operand" "d")
8211 (match_operand:DI
2 "se_arith_operand" "dI")))]
8212 "TARGET_64BIT && !TARGET_MIPS16"
8214 [(set_attr "type" "arith")
8215 (set_attr "mode" "DI")
8216 (set_attr "length" "
1")])
8219 [(set (match_operand:DI
0 "register_operand" "=t,t")
8220 (ltu:DI (match_operand:DI
1 "se_register_operand" "d,d")
8221 (match_operand:DI
2 "se_arith_operand" "d,I")))]
8222 "TARGET_64BIT && TARGET_MIPS16"
8224 [(set_attr "type" "arith")
8225 (set_attr "mode" "DI")
8226 (set_attr_alternative "length"
8228 (if_then_else (match_operand:VOID
2 "m16_uimm8_1" "")
8232 (define_expand "sleu"
8233 [(set (match_operand:SI
0 "register_operand" "=d")
8234 (leu:SI (match_dup
1)
8239 if (branch_type != CMP_SI && (!TARGET_64BIT || branch_type != CMP_DI))
8242 /* set up operands from compare. */
8243 operands[
1] = branch_cmp[
0];
8244 operands[
2] = branch_cmp[
1];
8246 if (TARGET_64BIT || !TARGET_DEBUG_C_MODE || TARGET_MIPS16)
8248 gen_int_relational (LEU, operands[
0], operands[
1], operands[
2], (int *)
0);
8252 if (GET_CODE (operands[
2]) == CONST_INT && INTVAL (operands[
2]) >=
32767)
8253 operands[
2] = force_reg (SImode, operands[
2]);
8255 /* fall through and generate default code */
8258 (define_insn "sleu_si_const"
8259 [(set (match_operand:SI
0 "register_operand" "=d")
8260 (leu:SI (match_operand:SI
1 "register_operand" "d")
8261 (match_operand:SI
2 "small_int" "I")))]
8262 "!TARGET_MIPS16 && INTVAL (operands[
2]) <
32767"
8265 operands[
2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[
2])+
1);
8266 return
\"sltu
\\t%
0,%
1,%
2\";
8268 [(set_attr "type" "arith")
8269 (set_attr "mode" "SI")
8270 (set_attr "length" "
1")])
8273 [(set (match_operand:SI
0 "register_operand" "=t")
8274 (leu:SI (match_operand:SI
1 "register_operand" "d")
8275 (match_operand:SI
2 "small_int" "I")))]
8276 "TARGET_MIPS16 && INTVAL (operands[
2]) <
32767"
8279 operands[
2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[
2])+
1);
8280 return
\"sltu
\\t%
1,%
2\";
8282 [(set_attr "type" "arith")
8283 (set_attr "mode" "SI")
8284 (set (attr "length") (if_then_else (match_operand:VOID
2 "m16_uimm8_m1_1" "")
8288 (define_insn "sleu_di_const"
8289 [(set (match_operand:DI
0 "register_operand" "=d")
8290 (leu:DI (match_operand:DI
1 "se_register_operand" "d")
8291 (match_operand:DI
2 "small_int" "I")))]
8292 "TARGET_64BIT && !TARGET_MIPS16 && INTVAL (operands[
2]) <
32767"
8295 operands[
2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[
2])+
1);
8296 return
\"sltu
\\t%
0,%
1,%
2\";
8298 [(set_attr "type" "arith")
8299 (set_attr "mode" "DI")
8300 (set_attr "length" "
1")])
8303 [(set (match_operand:DI
0 "register_operand" "=t")
8304 (leu:DI (match_operand:DI
1 "se_register_operand" "d")
8305 (match_operand:DI
2 "small_int" "I")))]
8306 "TARGET_64BIT && TARGET_MIPS16 && INTVAL (operands[
2]) <
32767"
8309 operands[
2] = gen_rtx (CONST_INT, VOIDmode, INTVAL (operands[
2])+
1);
8310 return
\"sltu
\\t%
1,%
2\";
8312 [(set_attr "type" "arith")
8313 (set_attr "mode" "DI")
8314 (set (attr "length") (if_then_else (match_operand:VOID
2 "m16_uimm8_m1_1" "")
8318 (define_insn "sleu_si_reg"
8319 [(set (match_operand:SI
0 "register_operand" "=d")
8320 (leu:SI (match_operand:SI
1 "register_operand" "d")
8321 (match_operand:SI
2 "register_operand" "d")))]
8322 "TARGET_DEBUG_C_MODE && !TARGET_MIPS16"
8323 "sltu
\\t%
0,%z2,%
1\;xori
\\t%
0,%
0,
0x0001"
8324 [(set_attr "type" "arith")
8325 (set_attr "mode" "SI")
8326 (set_attr "length" "
2")])
8329 [(set (match_operand:SI
0 "register_operand" "")
8330 (leu:SI (match_operand:SI
1 "register_operand" "")
8331 (match_operand:SI
2 "register_operand" "")))]
8332 "TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE && !TARGET_MIPS16"
8334 (ltu:SI (match_dup
2)
8337 (xor:SI (match_dup
0)
8341 (define_insn "sleu_di_reg"
8342 [(set (match_operand:DI
0 "register_operand" "=d")
8343 (leu:DI (match_operand:DI
1 "se_register_operand" "d")
8344 (match_operand:DI
2 "se_register_operand" "d")))]
8345 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_MIPS16"
8346 "sltu
\\t%
0,%z2,%
1\;xori
\\t%
0,%
0,
0x0001"
8347 [(set_attr "type" "arith")
8348 (set_attr "mode" "DI")
8349 (set_attr "length" "
2")])
8352 [(set (match_operand:DI
0 "register_operand" "")
8353 (leu:DI (match_operand:DI
1 "se_register_operand" "")
8354 (match_operand:DI
2 "se_register_operand" "")))]
8355 "TARGET_64BIT && TARGET_DEBUG_C_MODE && !TARGET_DEBUG_D_MODE
8358 (ltu:DI (match_dup
2)
8361 (xor:DI (match_dup
0)
8367 ;; ....................
8369 ;; FLOATING POINT COMPARISONS
8371 ;; ....................
8373 (define_insn "seq_df"
8374 [(set (match_operand:CC
0 "register_operand" "=z")
8375 (eq:CC (match_operand:DF
1 "register_operand" "f")
8376 (match_operand:DF
2 "register_operand" "f")))]
8377 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
8380 return mips_fill_delay_slot (
\"c.eq.d
\\t%Z0%
1,%
2\", DELAY_FCMP, operands, insn);
8382 [(set_attr "type" "fcmp")
8383 (set_attr "mode" "FPSW")
8384 (set_attr "length" "
1")])
8386 (define_insn "slt_df"
8387 [(set (match_operand:CC
0 "register_operand" "=z")
8388 (lt:CC (match_operand:DF
1 "register_operand" "f")
8389 (match_operand:DF
2 "register_operand" "f")))]
8390 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
8393 return mips_fill_delay_slot (
\"c.lt.d
\\t%Z0%
1,%
2\", DELAY_FCMP, operands, insn);
8395 [(set_attr "type" "fcmp")
8396 (set_attr "mode" "FPSW")
8397 (set_attr "length" "
1")])
8399 (define_insn "sle_df"
8400 [(set (match_operand:CC
0 "register_operand" "=z")
8401 (le:CC (match_operand:DF
1 "register_operand" "f")
8402 (match_operand:DF
2 "register_operand" "f")))]
8403 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
8406 return mips_fill_delay_slot (
\"c.le.d
\\t%Z0%
1,%
2\", DELAY_FCMP, operands, insn);
8408 [(set_attr "type" "fcmp")
8409 (set_attr "mode" "FPSW")
8410 (set_attr "length" "
1")])
8412 (define_insn "sgt_df"
8413 [(set (match_operand:CC
0 "register_operand" "=z")
8414 (gt:CC (match_operand:DF
1 "register_operand" "f")
8415 (match_operand:DF
2 "register_operand" "f")))]
8416 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
8419 return mips_fill_delay_slot (
\"c.lt.d
\\t%Z0%
2,%
1\", DELAY_FCMP, operands, insn);
8421 [(set_attr "type" "fcmp")
8422 (set_attr "mode" "FPSW")
8423 (set_attr "length" "
1")])
8425 (define_insn "sge_df"
8426 [(set (match_operand:CC
0 "register_operand" "=z")
8427 (ge:CC (match_operand:DF
1 "register_operand" "f")
8428 (match_operand:DF
2 "register_operand" "f")))]
8429 "TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
8432 return mips_fill_delay_slot (
\"c.le.d
\\t%Z0%
2,%
1\", DELAY_FCMP, operands, insn);
8434 [(set_attr "type" "fcmp")
8435 (set_attr "mode" "FPSW")
8436 (set_attr "length" "
1")])
8438 (define_insn "seq_sf"
8439 [(set (match_operand:CC
0 "register_operand" "=z")
8440 (eq:CC (match_operand:SF
1 "register_operand" "f")
8441 (match_operand:SF
2 "register_operand" "f")))]
8445 return mips_fill_delay_slot (
\"c.eq.s
\\t%Z0%
1,%
2\", DELAY_FCMP, operands, insn);
8447 [(set_attr "type" "fcmp")
8448 (set_attr "mode" "FPSW")
8449 (set_attr "length" "
1")])
8451 (define_insn "slt_sf"
8452 [(set (match_operand:CC
0 "register_operand" "=z")
8453 (lt:CC (match_operand:SF
1 "register_operand" "f")
8454 (match_operand:SF
2 "register_operand" "f")))]
8458 return mips_fill_delay_slot (
\"c.lt.s
\\t%Z0%
1,%
2\", DELAY_FCMP, operands, insn);
8460 [(set_attr "type" "fcmp")
8461 (set_attr "mode" "FPSW")
8462 (set_attr "length" "
1")])
8464 (define_insn "sle_sf"
8465 [(set (match_operand:CC
0 "register_operand" "=z")
8466 (le:CC (match_operand:SF
1 "register_operand" "f")
8467 (match_operand:SF
2 "register_operand" "f")))]
8471 return mips_fill_delay_slot (
\"c.le.s
\\t%Z0%
1,%
2\", DELAY_FCMP, operands, insn);
8473 [(set_attr "type" "fcmp")
8474 (set_attr "mode" "FPSW")
8475 (set_attr "length" "
1")])
8477 (define_insn "sgt_sf"
8478 [(set (match_operand:CC
0 "register_operand" "=z")
8479 (gt:CC (match_operand:SF
1 "register_operand" "f")
8480 (match_operand:SF
2 "register_operand" "f")))]
8484 return mips_fill_delay_slot (
\"c.lt.s
\\t%Z0%
2,%
1\", DELAY_FCMP, operands, insn);
8486 [(set_attr "type" "fcmp")
8487 (set_attr "mode" "FPSW")
8488 (set_attr "length" "
1")])
8490 (define_insn "sge_sf"
8491 [(set (match_operand:CC
0 "register_operand" "=z")
8492 (ge:CC (match_operand:SF
1 "register_operand" "f")
8493 (match_operand:SF
2 "register_operand" "f")))]
8497 return mips_fill_delay_slot (
\"c.le.s
\\t%Z0%
2,%
1\", DELAY_FCMP, operands, insn);
8499 [(set_attr "type" "fcmp")
8500 (set_attr "mode" "FPSW")
8501 (set_attr "length" "
1")])
8505 ;; ....................
8507 ;; UNCONDITIONAL BRANCHES
8509 ;; ....................
8511 ;; Unconditional branches.
8515 (label_ref (match_operand
0 "" "")))]
8519 if (GET_CODE (operands[
0]) == REG)
8520 return
\"%*j
\\t%
0\";
8521 /* ??? I don't know why this is necessary. This works around an
8522 assembler problem that appears when a label is defined, then referenced
8523 in a switch table, then used in a
`j' instruction. */
8524 else if (mips_abi != ABI_32)
8525 return \"%*b\\t%l0\";
8527 return \"%*j\\t%l0\";
8529 [(set_attr "type" "jump")
8530 (set_attr "mode" "none")
8531 (set_attr "length" "1")])
8533 ;; We need a different insn for the mips16, because a mips16 branch
8534 ;; does not have a delay slot.
8538 (label_ref (match_operand 0 "" "")))]
8539 "TARGET_MIPS16 && GET_CODE (operands[0]) != REG"
8541 [(set_attr "type" "branch")
8542 (set_attr "mode" "none")
8543 (set_attr "length" "2")])
8545 (define_expand "indirect_jump"
8546 [(set (pc) (match_operand 0 "register_operand" "d"))]
8552 if (operands[0]) /* eliminate unused code warnings */
8555 if (GET_CODE (dest) != REG || GET_MODE (dest) != Pmode)
8556 operands[0] = copy_to_mode_reg (Pmode, dest);
8559 emit_jump_insn (gen_indirect_jump_internal1 (operands[0]));
8561 emit_jump_insn (gen_indirect_jump_internal2 (operands[0]));
8567 (define_insn "indirect_jump_internal1"
8568 [(set (pc) (match_operand:SI 0 "register_operand" "d"))]
8571 [(set_attr "type" "jump")
8572 (set_attr "mode" "none")
8573 (set_attr "length" "1")])
8575 (define_insn "indirect_jump_internal2"
8576 [(set (pc) (match_operand:DI 0 "se_register_operand" "d"))]
8579 [(set_attr "type" "jump")
8580 (set_attr "mode" "none")
8581 (set_attr "length" "1")])
8583 (define_expand "tablejump"
8585 (match_operand 0 "register_operand" "d"))
8586 (use (label_ref (match_operand 1 "" "")))]
8592 if (operands[0]) /* eliminate unused code warnings */
8596 if (GET_MODE (operands[0]) != HImode)
8599 emit_jump_insn (gen_tablejump_mips161 (operands[0], operands[1]));
8601 emit_jump_insn (gen_tablejump_mips162 (operands[0], operands[1]));
8605 if (GET_MODE (operands[0]) != Pmode)
8611 emit_jump_insn (gen_tablejump_internal1 (operands[0], operands[1]));
8613 emit_jump_insn (gen_tablejump_internal2 (operands[0], operands[1]));
8618 emit_jump_insn (gen_tablejump_internal3 (operands[0], operands[1]));
8620 emit_jump_insn (gen_tablejump_internal4 (operands[0], operands[1]));
8627 (define_insn "tablejump_internal1"
8629 (match_operand:SI 0 "register_operand" "d"))
8630 (use (label_ref (match_operand 1 "" "")))]
8633 [(set_attr "type" "jump")
8634 (set_attr "mode" "none")
8635 (set_attr "length" "1")])
8637 (define_insn "tablejump_internal2"
8639 (match_operand:DI 0 "se_register_operand" "d"))
8640 (use (label_ref (match_operand 1 "" "")))]
8643 [(set_attr "type" "jump")
8644 (set_attr "mode" "none")
8645 (set_attr "length" "1")])
8647 (define_expand "tablejump_internal3"
8649 (plus:SI (match_operand:SI 0 "register_operand" "d")
8650 (label_ref:SI (match_operand:SI 1 "" ""))))]
8654 (define_expand "tablejump_mips161"
8655 [(set (pc) (plus:SI (sign_extend:SI
8656 (match_operand:HI 0 "register_operand" "d"))
8657 (label_ref:SI (match_operand:SI 1 "" ""))))]
8658 "TARGET_MIPS16 && !TARGET_LONG64"
8661 if (operands[0]) /* eliminate unused code warnings. */
8665 t1 = gen_reg_rtx (SImode);
8666 t2 = gen_reg_rtx (SImode);
8667 t3 = gen_reg_rtx (SImode);
8668 emit_insn (gen_extendhisi2 (t1, operands[0]));
8669 emit_move_insn (t2, gen_rtx (LABEL_REF, SImode, operands[1]));
8670 emit_insn (gen_addsi3 (t3, t1, t2));
8671 emit_insn (gen_tablejump_internal1 (t3, operands[1]));
8676 (define_expand "tablejump_mips162"
8677 [(set (pc) (plus:DI (sign_extend:DI
8678 (match_operand:HI 0 "register_operand" "d"))
8679 (label_ref:DI (match_operand:SI 1 "" ""))))]
8680 "TARGET_MIPS16 && TARGET_LONG64"
8683 if (operands[0]) /* eliminate unused code warnings. */
8687 t1 = gen_reg_rtx (DImode);
8688 t2 = gen_reg_rtx (DImode);
8689 t3 = gen_reg_rtx (DImode);
8690 emit_insn (gen_extendhidi2 (t1, operands[0]));
8691 emit_move_insn (t2, gen_rtx (LABEL_REF, DImode, operands[1]));
8692 emit_insn (gen_adddi3 (t3, t1, t2));
8693 emit_insn (gen_tablejump_internal2 (t3, operands[1]));
8698 ;;; Make sure that this only matches the insn before ADDR_DIFF_VEC. Otherwise
8699 ;;; it is not valid.
8701 ;;; ??? The length depends on the ABI. It is two for o32, and one for n32.
8702 ;;; We just use the conservative number here.
8706 (plus:SI (match_operand:SI 0 "register_operand" "d")
8707 (label_ref:SI (match_operand:SI 1 "" ""))))]
8708 "!TARGET_LONG64 && next_active_insn (insn) != 0
8709 && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
8710 && PREV_INSN (next_active_insn (insn)) == operands[1]"
8713 /* .cpadd expands to add REG,REG,$gp when pic, and nothing when not pic. */
8714 if (mips_abi == ABI_32)
8715 output_asm_insn (\".cpadd\\t%0\", operands);
8716 return \"%*j\\t%0\";
8718 [(set_attr "type" "jump")
8719 (set_attr "mode" "none")
8720 (set_attr "length" "2")])
8722 (define_expand "tablejump_internal4"
8724 (plus:DI (match_operand:DI 0 "se_register_operand" "d")
8725 (label_ref:DI (match_operand:SI 1 "" ""))))]
8729 ;;; Make sure that this only matches the insn before ADDR_DIFF_VEC. Otherwise
8730 ;;; it is not valid.
8734 (plus:DI (match_operand:DI 0 "se_register_operand" "d")
8735 (label_ref:DI (match_operand:SI 1 "" ""))))]
8736 "TARGET_LONG64 && next_active_insn (insn) != 0
8737 && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
8738 && PREV_INSN (next_active_insn (insn)) == operands[1]"
8740 [(set_attr "type" "jump")
8741 (set_attr "mode" "none")
8742 (set_attr "length" "1")])
8744 ;; Implement a switch statement when generating embedded PIC code.
8745 ;; Switches are implemented by `tablejump' when not using -membedded-pic.
8747 (define_expand "casesi"
8749 (minus:SI (match_operand:SI
0 "register_operand" "d")
8750 (match_operand:SI
1 "arith_operand" "dI")))
8752 (compare:CC (match_dup
5)
8753 (match_operand:SI
2 "arith_operand" "")))
8755 (if_then_else (gtu (cc0)
8757 (label_ref (match_operand
4 "" ""))
8761 (mem:SI (plus:SI (mult:SI (match_dup
5)
8763 (label_ref (match_operand
3 "" "")))))
8764 (clobber (match_scratch:SI
6 ""))
8765 (clobber (reg:SI
31))])]
8766 "TARGET_EMBEDDED_PIC"
8769 /* We need slightly different code for eight byte table entries. */
8775 rtx reg = gen_reg_rtx (SImode);
8777 /* If the index is too large, go to the default label. */
8778 emit_insn (gen_subsi3 (reg, operands[
0], operands[
1]));
8779 emit_insn (gen_cmpsi (reg, operands[
2]));
8780 emit_insn (gen_bgtu (operands[
4]));
8782 /* Do the PIC jump. */
8783 emit_insn (gen_casesi_internal (reg, operands[
3], gen_reg_rtx (SImode)));
8789 ;; An embedded PIC switch statement looks like this:
8791 ;; sll $reg,$index,
2
8793 ;; addu $reg,$reg,$
31
8794 ;; lw $reg,$L1-$LS1($reg)
8795 ;; addu $reg,$reg,$
31
8802 (define_insn "casesi_internal"
8804 (mem:SI (plus:SI (mult:SI (match_operand:SI
0 "register_operand" "d")
8806 (label_ref (match_operand
1 "" "")))))
8807 (clobber (match_operand:SI
2 "register_operand" "d"))
8808 (clobber (reg:SI
31))]
8809 "TARGET_EMBEDDED_PIC"
8812 output_asm_insn (
\"%(bal
\\t%S1\;sll
\\t%
0,
2\\n%S1:
\", operands);
8813 output_asm_insn (
\"addu
\\t%
0,%
0,$
31%)
\", operands);
8814 output_asm_insn (
\"lw
\\t%
0,%
1-%S1(%
0)\;addu
\\t%
0,%
0,$
31\", operands);
8817 [(set_attr "type" "jump")
8818 (set_attr "mode" "none")
8819 (set_attr "length" "
6")])
8821 ;; ??? This is a hack to work around a problem with expand_builtin_setjmp.
8822 ;; It restores the frame pointer, and then does a call to restore the global
8823 ;; pointer (gp) register. The call insn implicitly (via the assembler) reloads
8824 ;; gp from the stack. However, call insns do not depend on $fp, so it is
8825 ;; possible for the instruction scheduler to move the fp restore after the
8826 ;; call, which then causes gp to be corrupted. We fix this by emitting a
8827 ;; scheduler barrier. A better fix is to put code here that restores the
8828 ;; $gp, and then the call is unnecessary. This is only a problem when PIC
8829 ;; (TARGET_ABICALLS), and only when the gp register is caller-saved
8830 ;; (irix5/o32, but not irix6/n32/n64).
8832 (define_expand "nonlocal_goto_receiver"
8837 emit_insn (gen_blockage ());
8840 ;; For n32/n64, we need to restore gp after a builtin setjmp. We do this
8841 ;; by making use of the fact that we've just called __dummy.
8843 (define_expand "builtin_setjmp_receiver"
8845 "TARGET_ABICALLS && mips_abi != ABI_32"
8848 emit_insn (gen_loadgp (gen_rtx (SYMBOL_REF, Pmode,
\"__dummy
\")));
8849 emit_insn (gen_blockage ());
8853 ;; ....................
8855 ;; Function prologue/epilogue
8857 ;; ....................
8860 (define_expand "prologue"
8865 if (mips_isa >=
0) /* avoid unused code warnings */
8867 mips_expand_prologue ();
8872 ;; Block any insns from being moved before this point, since the
8873 ;; profiling call to mcount can use various registers that aren't
8874 ;; saved or used to pass arguments.
8876 (define_insn "blockage"
8877 [(unspec_volatile [(const_int
0)]
0)]
8880 [(set_attr "type" "unknown")
8881 (set_attr "mode" "none")
8882 (set_attr "length" "
0")])
8884 (define_expand "epilogue"
8889 if (mips_isa >=
0) /* avoid unused code warnings */
8891 mips_expand_epilogue ();
8896 ;; Trivial return. Make it look like a normal return insn as that
8897 ;; allows jump optimizations to work better .
8898 (define_insn "return"
8900 "mips_can_use_return_insn ()"
8902 [(set_attr "type" "jump")
8903 (set_attr "mode" "none")
8904 (set_attr "length" "
1")])
8907 ;; We match any mode for the return address, so that this will work with
8908 ;; both
32 bit and
64 bit targets.
8909 (define_insn "return_internal"
8910 [(use (match_operand
0 "register_operand" ""))
8915 return
\"%*j
\\t%
0\";
8917 [(set_attr "type" "jump")
8918 (set_attr "mode" "none")
8919 (set_attr "length" "
1")])
8921 ;; When generating embedded PIC code we need to get the address of the
8922 ;; current function. This specialized instruction does just that.
8924 (define_insn "get_fnaddr"
8925 [(set (match_operand
0 "register_operand" "=d")
8926 (unspec [(match_operand
1 "" "")]
1))
8927 (clobber (reg:SI
31))]
8928 "TARGET_EMBEDDED_PIC
8929 && GET_CODE (operands[
1]) == SYMBOL_REF"
8930 "%($LF%= = . +
8\;bal
\\t$LF%=\;la
\\t%
0,%
1-$LF%=%)\;addu
\\t%
0,%
0,$
31"
8931 [(set_attr "type" "call")
8932 (set_attr "mode" "none")
8933 (set_attr "length" "
4")])
8937 ;; ....................
8941 ;; ....................
8943 ;; calls.c now passes a third argument, make saber happy
8945 (define_expand "call"
8946 [(parallel [(call (match_operand
0 "memory_operand" "m")
8947 (match_operand
1 "" "i"))
8948 (clobber (reg:SI
31))
8949 (use (match_operand
2 "" "")) ;; next_arg_reg
8950 (use (match_operand
3 "" ""))])] ;; struct_value_size_rtx
8956 if (operands[
0]) /* eliminate unused code warnings */
8958 addr = XEXP (operands[
0],
0);
8959 if ((GET_CODE (addr) != REG && (!CONSTANT_ADDRESS_P (addr) || TARGET_LONG_CALLS))
8960 || ! call_insn_operand (addr, VOIDmode))
8961 XEXP (operands[
0],
0) = copy_to_mode_reg (Pmode, addr);
8963 /* In order to pass small structures by value in registers
8964 compatibly with the MIPS compiler, we need to shift the value
8965 into the high part of the register. Function_arg has encoded
8966 a PARALLEL rtx, holding a vector of adjustments to be made
8967 as the next_arg_reg variable, so we split up the insns,
8968 and emit them separately. */
8970 if (operands[
2] != (rtx)
0 && GET_CODE (operands[
2]) == PARALLEL)
8972 rtvec adjust = XVEC (operands[
2],
0);
8973 int num = GET_NUM_ELEM (adjust);
8976 for (i =
0; i < num; i++)
8977 emit_insn (RTVEC_ELT (adjust, i));
8981 && mips16_hard_float
8983 && (int) GET_MODE (operands[
2]) !=
0)
8985 if (build_mips16_call_stub (NULL_RTX, operands[
0], operands[
1],
8986 (int) GET_MODE (operands[
2])))
8990 emit_call_insn (gen_call_internal0 (operands[
0], operands[
1],
8991 gen_rtx (REG, SImode, GP_REG_FIRST +
31)));
8997 (define_expand "call_internal0"
8998 [(parallel [(call (match_operand
0 "" "")
8999 (match_operand
1 "" ""))
9000 (clobber (match_operand:SI
2 "" ""))])]
9004 ;; We need to recognize reg:SI
31 specially for the mips16, because we
9005 ;; don't have a constraint letter for it.
9008 [(call (mem (match_operand
0 "call_insn_operand" "ei"))
9009 (match_operand
1 "" "i"))
9010 (clobber (match_operand:SI
2 "register_operand" "=y"))]
9011 "TARGET_MIPS16 && !TARGET_ABICALLS && !TARGET_LONG_CALLS
9012 && GET_CODE (operands[
2]) == REG && REGNO (operands[
2]) ==
31"
9014 [(set_attr "type" "call")
9015 (set_attr "mode" "none")
9016 (set_attr "length" "
2")])
9018 (define_insn "call_internal1"
9019 [(call (mem (match_operand
0 "call_insn_operand" "ri"))
9020 (match_operand
1 "" "i"))
9021 (clobber (match_operand:SI
2 "register_operand" "=d"))]
9022 "!TARGET_ABICALLS && !TARGET_LONG_CALLS"
9025 register rtx target = operands[
0];
9027 if (GET_CODE (target) == SYMBOL_REF)
9028 return
\"%*jal
\\t%
0\";
9029 else if (GET_CODE (target) == CONST_INT)
9030 return
\"%[li
\\t%@,%
0\\n
\\t%*jal
\\t%
2,%@%]
\";
9032 return
\"%*jal
\\t%
2,%
0\";
9034 [(set_attr "type" "call")
9035 (set_attr "mode" "none")
9036 (set_attr "length" "
1")])
9038 (define_insn "call_internal2"
9039 [(call (mem (match_operand
0 "call_insn_operand" "ri"))
9040 (match_operand
1 "" "i"))
9041 (clobber (match_operand:SI
2 "register_operand" "=d"))]
9042 "TARGET_ABICALLS && !TARGET_LONG_CALLS"
9045 register rtx target = operands[
0];
9047 if (GET_CODE (target) == SYMBOL_REF)
9049 if (GET_MODE (target) == SImode)
9050 return
\"la
\\t%^,%
0\\n
\\tjal
\\t%
2,%^
\";
9052 return
\"dla
\\t%^,%
0\\n
\\tjal
\\t%
2,%^
\";
9054 else if (GET_CODE (target) == CONST_INT)
9055 return
\"li
\\t%^,%
0\\n
\\tjal
\\t%
2,%^
\";
9056 else if (REGNO (target) != PIC_FUNCTION_ADDR_REGNUM)
9057 return
\"move
\\t%^,%
0\\n
\\tjal
\\t%
2,%^
\";
9059 return
\"jal
\\t%
2,%
0\";
9061 [(set_attr "type" "call")
9062 (set_attr "mode" "none")
9063 (set_attr "length" "
2")])
9065 (define_insn "call_internal3a"
9066 [(call (mem:SI (match_operand:SI
0 "register_operand" "r"))
9067 (match_operand
1 "" "i"))
9068 (clobber (match_operand:SI
2 "register_operand" "=d"))]
9069 "!TARGET_LONG64 && !TARGET_ABICALLS && TARGET_LONG_CALLS"
9071 [(set_attr "type" "call")
9072 (set_attr "mode" "none")
9073 (set_attr "length" "
1")])
9075 (define_insn "call_internal3b"
9076 [(call (mem:DI (match_operand:DI
0 "se_register_operand" "r"))
9077 (match_operand
1 "" "i"))
9078 (clobber (match_operand:SI
2 "register_operand" "=d"))]
9079 "TARGET_LONG64 && !TARGET_ABICALLS && TARGET_LONG_CALLS"
9081 [(set_attr "type" "call")
9082 (set_attr "mode" "none")
9083 (set_attr "length" "
1")])
9085 (define_insn "call_internal4a"
9086 [(call (mem:SI (match_operand:SI
0 "register_operand" "r"))
9087 (match_operand
1 "" "i"))
9088 (clobber (match_operand:SI
2 "register_operand" "=d"))]
9089 "!TARGET_LONG64 && TARGET_ABICALLS && TARGET_LONG_CALLS"
9092 if (REGNO (operands[
0]) != PIC_FUNCTION_ADDR_REGNUM)
9093 return
\"move
\\t%^,%
0\\n
\\tjal
\\t%
2,%^
\";
9095 return
\"jal
\\t%
2,%
0\";
9097 [(set_attr "type" "call")
9098 (set_attr "mode" "none")
9099 (set_attr "length" "
2")])
9101 (define_insn "call_internal4b"
9102 [(call (mem:DI (match_operand:DI
0 "se_register_operand" "r"))
9103 (match_operand
1 "" "i"))
9104 (clobber (match_operand:SI
2 "register_operand" "=d"))]
9105 "TARGET_LONG64 && TARGET_ABICALLS && TARGET_LONG_CALLS"
9108 if (REGNO (operands[
0]) != PIC_FUNCTION_ADDR_REGNUM)
9109 return
\"move
\\t%^,%
0\\n
\\tjal
\\t%
2,%^
\";
9111 return
\"jal
\\t%
2,%
0\";
9113 [(set_attr "type" "call")
9114 (set_attr "mode" "none")
9115 (set_attr "length" "
2")])
9117 ;; calls.c now passes a fourth argument, make saber happy
9119 (define_expand "call_value"
9120 [(parallel [(set (match_operand
0 "register_operand" "=df")
9121 (call (match_operand
1 "memory_operand" "m")
9122 (match_operand
2 "" "i")))
9123 (clobber (reg:SI
31))
9124 (use (match_operand
3 "" ""))])] ;; next_arg_reg
9130 if (operands[
0]) /* eliminate unused code warning */
9132 addr = XEXP (operands[
1],
0);
9133 if ((GET_CODE (addr) != REG && (!CONSTANT_ADDRESS_P (addr) || TARGET_LONG_CALLS))
9134 || ! call_insn_operand (addr, VOIDmode))
9135 XEXP (operands[
1],
0) = copy_to_mode_reg (Pmode, addr);
9137 /* In order to pass small structures by value in registers
9138 compatibly with the MIPS compiler, we need to shift the value
9139 into the high part of the register. Function_arg has encoded
9140 a PARALLEL rtx, holding a vector of adjustments to be made
9141 as the next_arg_reg variable, so we split up the insns,
9142 and emit them separately. */
9144 if (operands[
3] != (rtx)
0 && GET_CODE (operands[
3]) == PARALLEL)
9146 rtvec adjust = XVEC (operands[
3],
0);
9147 int num = GET_NUM_ELEM (adjust);
9150 for (i =
0; i < num; i++)
9151 emit_insn (RTVEC_ELT (adjust, i));
9155 && mips16_hard_float
9156 && ((operands[
3] !=
0
9157 && (int) GET_MODE (operands[
3]) !=
0)
9158 || GET_MODE_CLASS (GET_MODE (operands[
0])) == MODE_FLOAT))
9160 if (build_mips16_call_stub (operands[
0], operands[
1], operands[
2],
9161 (operands[
3] ==
0 ?
0
9162 : (int) GET_MODE (operands[
3]))))
9166 /* Handle Irix6 function calls that have multiple non-contiguous
9168 if (GET_CODE (operands[
0]) == PARALLEL && XVECLEN (operands[
0],
0) >
1)
9170 emit_call_insn (gen_call_value_multiple_internal0
9171 (XEXP (XVECEXP (operands[
0],
0,
0),
0),
9172 operands[
1], operands[
2],
9173 XEXP (XVECEXP (operands[
0],
0,
1),
0),
9174 gen_rtx (REG, SImode, GP_REG_FIRST +
31)));
9178 /* We have a call returning a DImode structure in an FP reg.
9179 Strip off the now unnecessary PARALLEL. */
9180 if (GET_CODE (operands[
0]) == PARALLEL)
9181 operands[
0] = XEXP (XVECEXP (operands[
0],
0,
0),
0);
9183 emit_call_insn (gen_call_value_internal0 (operands[
0], operands[
1], operands[
2],
9184 gen_rtx (REG, SImode, GP_REG_FIRST +
31)));
9190 (define_expand "call_value_internal0"
9191 [(parallel [(set (match_operand
0 "" "")
9192 (call (match_operand
1 "" "")
9193 (match_operand
2 "" "")))
9194 (clobber (match_operand:SI
3 "" ""))])]
9198 ;; Recognize $
31 specially on the mips16, because we don't have a
9199 ;; constraint letter for it.
9202 [(set (match_operand
0 "register_operand" "=d")
9203 (call (mem (match_operand
1 "call_insn_operand" "ei"))
9204 (match_operand
2 "" "i")))
9205 (clobber (match_operand:SI
3 "register_operand" "=y"))]
9206 "TARGET_MIPS16 && !TARGET_ABICALLS && !TARGET_LONG_CALLS
9207 && GET_CODE (operands[
3]) == REG && REGNO (operands[
3]) ==
31"
9209 [(set_attr "type" "call")
9210 (set_attr "mode" "none")
9211 (set_attr "length" "
2")])
9213 (define_insn "call_value_internal1"
9214 [(set (match_operand
0 "register_operand" "=df")
9215 (call (mem (match_operand
1 "call_insn_operand" "ri"))
9216 (match_operand
2 "" "i")))
9217 (clobber (match_operand:SI
3 "register_operand" "=d"))]
9218 "!TARGET_ABICALLS && !TARGET_LONG_CALLS"
9221 register rtx target = operands[
1];
9223 if (GET_CODE (target) == SYMBOL_REF)
9224 return
\"%*jal
\\t%
1\";
9225 else if (GET_CODE (target) == CONST_INT)
9226 return
\"%[li
\\t%@,%
1\\n
\\t%*jal
\\t%
3,%@%]
\";
9228 return
\"%*jal
\\t%
3,%
1\";
9230 [(set_attr "type" "call")
9231 (set_attr "mode" "none")
9232 (set_attr "length" "
1")])
9234 (define_insn "call_value_internal2"
9235 [(set (match_operand
0 "register_operand" "=df")
9236 (call (mem (match_operand
1 "call_insn_operand" "ri"))
9237 (match_operand
2 "" "i")))
9238 (clobber (match_operand:SI
3 "register_operand" "=d"))]
9239 "TARGET_ABICALLS && !TARGET_LONG_CALLS"
9242 register rtx target = operands[
1];
9244 if (GET_CODE (target) == SYMBOL_REF)
9246 if (GET_MODE (target) == SImode)
9247 return
\"la
\\t%^,%
1\\n
\\tjal
\\t%
3,%^
\";
9249 return
\"dla
\\t%^,%
1\\n
\\tjal
\\t%
3,%^
\";
9251 else if (GET_CODE (target) == CONST_INT)
9252 return
\"li
\\t%^,%
1\\n
\\tjal
\\t%
3,%^
\";
9253 else if (REGNO (target) != PIC_FUNCTION_ADDR_REGNUM)
9254 return
\"move
\\t%^,%
1\\n
\\tjal
\\t%
3,%^
\";
9256 return
\"jal
\\t%
3,%
1\";
9258 [(set_attr "type" "call")
9259 (set_attr "mode" "none")
9260 (set_attr "length" "
2")])
9262 (define_insn "call_value_internal3a"
9263 [(set (match_operand
0 "register_operand" "=df")
9264 (call (mem:SI (match_operand:SI
1 "register_operand" "r"))
9265 (match_operand
2 "" "i")))
9266 (clobber (match_operand:SI
3 "register_operand" "=d"))]
9267 "!TARGET_LONG64 && !TARGET_ABICALLS && TARGET_LONG_CALLS"
9269 [(set_attr "type" "call")
9270 (set_attr "mode" "none")
9271 (set_attr "length" "
1")])
9273 (define_insn "call_value_internal3b"
9274 [(set (match_operand
0 "register_operand" "=df")
9275 (call (mem:DI (match_operand:DI
1 "se_register_operand" "r"))
9276 (match_operand
2 "" "i")))
9277 (clobber (match_operand:SI
3 "register_operand" "=d"))]
9278 "TARGET_LONG64 && !TARGET_ABICALLS && TARGET_LONG_CALLS"
9280 [(set_attr "type" "call")
9281 (set_attr "mode" "none")
9282 (set_attr "length" "
1")])
9284 (define_insn "call_value_internal4a"
9285 [(set (match_operand
0 "register_operand" "=df")
9286 (call (mem:SI (match_operand:SI
1 "register_operand" "r"))
9287 (match_operand
2 "" "i")))
9288 (clobber (match_operand:SI
3 "register_operand" "=d"))]
9289 "!TARGET_LONG64 && TARGET_ABICALLS && TARGET_LONG_CALLS"
9292 if (REGNO (operands[
1]) != PIC_FUNCTION_ADDR_REGNUM)
9293 return
\"move
\\t%^,%
1\\n
\\tjal
\\t%
3,%^
\";
9295 return
\"jal
\\t%
3,%
1\";
9297 [(set_attr "type" "call")
9298 (set_attr "mode" "none")
9299 (set_attr "length" "
2")])
9301 (define_insn "call_value_internal4b"
9302 [(set (match_operand
0 "register_operand" "=df")
9303 (call (mem:DI (match_operand:DI
1 "se_register_operand" "r"))
9304 (match_operand
2 "" "i")))
9305 (clobber (match_operand:SI
3 "register_operand" "=d"))]
9306 "TARGET_LONG64 && TARGET_ABICALLS && TARGET_LONG_CALLS"
9309 if (REGNO (operands[
1]) != PIC_FUNCTION_ADDR_REGNUM)
9310 return
\"move
\\t%^,%
1\\n
\\tjal
\\t%
3,%^
\";
9312 return
\"jal
\\t%
3,%
1\";
9314 [(set_attr "type" "call")
9315 (set_attr "mode" "none")
9316 (set_attr "length" "
2")])
9318 (define_expand "call_value_multiple_internal0"
9319 [(parallel [(set (match_operand
0 "" "")
9320 (call (match_operand
1 "" "")
9321 (match_operand
2 "" "")))
9322 (set (match_operand
3 "" "")
9325 (clobber (match_operand:SI
4 "" ""))])]
9329 ;; ??? May eventually need all
6 versions of the call patterns with multiple
9332 (define_insn "call_value_multiple_internal2"
9333 [(set (match_operand
0 "register_operand" "=df")
9334 (call (mem (match_operand
1 "call_insn_operand" "ri"))
9335 (match_operand
2 "" "i")))
9336 (set (match_operand
3 "register_operand" "=df")
9337 (call (mem (match_dup
1))
9339 (clobber (match_operand:SI
4 "register_operand" "=d"))]
9340 "TARGET_ABICALLS && !TARGET_LONG_CALLS"
9343 register rtx target = operands[
1];
9345 if (GET_CODE (target) == SYMBOL_REF)
9347 if (GET_MODE (target) == SImode)
9348 return
\"la
\\t%^,%
1\\n
\\tjal
\\t%
4,%^
\";
9350 return
\"la
\\t%^,%
1\\n
\\tjal
\\t%
4,%^
\";
9352 else if (GET_CODE (target) == CONST_INT)
9353 return
\"li
\\t%^,%
1\\n
\\tjal
\\t%
4,%^
\";
9354 else if (REGNO (target) != PIC_FUNCTION_ADDR_REGNUM)
9355 return
\"move
\\t%^,%
1\\n
\\tjal
\\t%
4,%^
\";
9357 return
\"jal
\\t%
4,%
1\";
9359 [(set_attr "type" "call")
9360 (set_attr "mode" "none")
9361 (set_attr "length" "
2")])
9364 ;; Call subroutine returning any type.
9366 (define_expand "untyped_call"
9367 [(parallel [(call (match_operand
0 "" "")
9369 (match_operand
1 "" "")
9370 (match_operand
2 "" "")])]
9374 if (operands[
0]) /* silence statement not reached warnings */
9378 emit_call_insn (gen_call (operands[
0], const0_rtx, NULL, const0_rtx));
9380 for (i =
0; i < XVECLEN (operands[
2],
0); i++)
9382 rtx set = XVECEXP (operands[
2],
0, i);
9383 emit_move_insn (SET_DEST (set), SET_SRC (set));
9386 emit_insn (gen_blockage ());
9392 ;; ....................
9396 ;; ....................
9403 [(set_attr "type" "nop")
9404 (set_attr "mode" "none")
9405 (set_attr "length" "
1")])
9407 ;; The MIPS chip does not seem to require stack probes.
9409 ;; (define_expand "probe"
9410 ;; [(set (match_dup
0)
9415 ;; operands[
0] = gen_reg_rtx (SImode);
9416 ;; operands[
1] = gen_rtx (MEM, SImode, stack_pointer_rtx);
9417 ;; MEM_VOLATILE_P (operands[
1]) = TRUE;
9419 ;; /* fall through and generate default code */
9424 ;; MIPS4 Conditional move instructions.
9427 [(set (match_operand:SI
0 "register_operand" "=d,d")
9429 (match_operator
4 "equality_op"
9430 [(match_operand:SI
1 "register_operand" "d,d")
9432 (match_operand:SI
2 "reg_or_0_operand" "dJ,
0")
9433 (match_operand:SI
3 "reg_or_0_operand" "
0,dJ")))]
9438 [(set_attr "type" "move")
9439 (set_attr "mode" "SI")])
9442 [(set (match_operand:SI
0 "register_operand" "=d,d")
9444 (match_operator
4 "equality_op"
9445 [(match_operand:DI
1 "se_register_operand" "d,d")
9447 (match_operand:SI
2 "reg_or_0_operand" "dJ,
0")
9448 (match_operand:SI
3 "reg_or_0_operand" "
0,dJ")))]
9453 [(set_attr "type" "move")
9454 (set_attr "mode" "SI")])
9457 [(set (match_operand:SI
0 "register_operand" "=d,d")
9459 (match_operator
3 "equality_op" [(match_operand:CC
4
9463 (match_operand:SI
1 "reg_or_0_operand" "dJ,
0")
9464 (match_operand:SI
2 "reg_or_0_operand" "
0,dJ")))]
9465 "mips_isa >=
4 && TARGET_HARD_FLOAT"
9469 [(set_attr "type" "move")
9470 (set_attr "mode" "SI")])
9473 [(set (match_operand:DI
0 "register_operand" "=d,d")
9475 (match_operator
4 "equality_op"
9476 [(match_operand:SI
1 "register_operand" "d,d")
9478 (match_operand:DI
2 "se_reg_or_0_operand" "dJ,
0")
9479 (match_operand:DI
3 "se_reg_or_0_operand" "
0,dJ")))]
9484 [(set_attr "type" "move")
9485 (set_attr "mode" "DI")])
9488 [(set (match_operand:DI
0 "register_operand" "=d,d")
9490 (match_operator
4 "equality_op"
9491 [(match_operand:DI
1 "se_register_operand" "d,d")
9493 (match_operand:DI
2 "se_reg_or_0_operand" "dJ,
0")
9494 (match_operand:DI
3 "se_reg_or_0_operand" "
0,dJ")))]
9499 [(set_attr "type" "move")
9500 (set_attr "mode" "DI")])
9503 [(set (match_operand:DI
0 "register_operand" "=d,d")
9505 (match_operator
3 "equality_op" [(match_operand:CC
4
9509 (match_operand:DI
1 "se_reg_or_0_operand" "dJ,
0")
9510 (match_operand:DI
2 "se_reg_or_0_operand" "
0,dJ")))]
9511 "mips_isa >=
4 && TARGET_HARD_FLOAT"
9515 [(set_attr "type" "move")
9516 (set_attr "mode" "DI")])
9519 [(set (match_operand:SF
0 "register_operand" "=f,f")
9521 (match_operator
4 "equality_op"
9522 [(match_operand:SI
1 "register_operand" "d,d")
9524 (match_operand:SF
2 "register_operand" "f,
0")
9525 (match_operand:SF
3 "register_operand" "
0,f")))]
9526 "mips_isa >=
4 && TARGET_HARD_FLOAT"
9529 mov%b4.s
\\t%
0,%
3,%
1"
9530 [(set_attr "type" "move")
9531 (set_attr "mode" "SF")])
9534 [(set (match_operand:SF
0 "register_operand" "=f,f")
9536 (match_operator
3 "equality_op" [(match_operand:CC
4
9540 (match_operand:SF
1 "register_operand" "f,
0")
9541 (match_operand:SF
2 "register_operand" "
0,f")))]
9542 "mips_isa >=
4 && TARGET_HARD_FLOAT"
9545 mov%t3.s
\\t%
0,%
2,%
4"
9546 [(set_attr "type" "move")
9547 (set_attr "mode" "SF")])
9550 [(set (match_operand:DF
0 "register_operand" "=f,f")
9552 (match_operator
4 "equality_op"
9553 [(match_operand:SI
1 "register_operand" "d,d")
9555 (match_operand:DF
2 "register_operand" "f,
0")
9556 (match_operand:DF
3 "register_operand" "
0,f")))]
9557 "mips_isa >=
4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
9560 mov%b4.d
\\t%
0,%
3,%
1"
9561 [(set_attr "type" "move")
9562 (set_attr "mode" "DF")])
9565 [(set (match_operand:DF
0 "register_operand" "=f,f")
9567 (match_operator
3 "equality_op" [(match_operand:CC
4
9571 (match_operand:DF
1 "register_operand" "f,
0")
9572 (match_operand:DF
2 "register_operand" "
0,f")))]
9573 "mips_isa >=
4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
9576 mov%t3.d
\\t%
0,%
2,%
4"
9577 [(set_attr "type" "move")
9578 (set_attr "mode" "DF")])
9580 ;; These are the main define_expand's used to make conditional moves.
9582 (define_expand "movsicc"
9583 [(set (match_dup
4) (match_operand
1 "comparison_operator" ""))
9584 (set (match_operand:SI
0 "register_operand" "")
9585 (if_then_else:SI (match_dup
5)
9586 (match_operand:SI
2 "reg_or_0_operand" "")
9587 (match_operand:SI
3 "reg_or_0_operand" "")))]
9591 gen_conditional_move (operands);
9595 (define_expand "movdicc"
9596 [(set (match_dup
4) (match_operand
1 "comparison_operator" ""))
9597 (set (match_operand:DI
0 "register_operand" "")
9598 (if_then_else:DI (match_dup
5)
9599 (match_operand:DI
2 "se_reg_or_0_operand" "")
9600 (match_operand:DI
3 "se_reg_or_0_operand" "")))]
9604 gen_conditional_move (operands);
9608 (define_expand "movsfcc"
9609 [(set (match_dup
4) (match_operand
1 "comparison_operator" ""))
9610 (set (match_operand:SF
0 "register_operand" "")
9611 (if_then_else:SF (match_dup
5)
9612 (match_operand:SF
2 "register_operand" "")
9613 (match_operand:SF
3 "register_operand" "")))]
9614 "mips_isa >=
4 && TARGET_HARD_FLOAT"
9617 gen_conditional_move (operands);
9621 (define_expand "movdfcc"
9622 [(set (match_dup
4) (match_operand
1 "comparison_operator" ""))
9623 (set (match_operand:DF
0 "register_operand" "")
9624 (if_then_else:DF (match_dup
5)
9625 (match_operand:DF
2 "register_operand" "")
9626 (match_operand:DF
3 "register_operand" "")))]
9627 "mips_isa >=
4 && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT"
9630 gen_conditional_move (operands);
9635 ;; ....................
9637 ;; mips16 inline constant tables
9639 ;; ....................
9642 (define_insn "consttable_qi"
9643 [(unspec_volatile [(match_operand:QI
0 "consttable_operand" "=g")]
10)]
9647 assemble_integer (operands[
0],
1,
1);
9650 [(set_attr "type" "unknown")
9651 (set_attr "mode" "QI")
9652 (set_attr "length" "
2")])
9654 (define_insn "consttable_hi"
9655 [(unspec_volatile [(match_operand:HI
0 "consttable_operand" "=g")]
11)]
9659 assemble_integer (operands[
0],
2,
1);
9662 [(set_attr "type" "unknown")
9663 (set_attr "mode" "HI")
9664 (set_attr "length" "
2")])
9666 (define_insn "consttable_si"
9667 [(unspec_volatile [(match_operand:SI
0 "consttable_operand" "=g")]
12)]
9671 assemble_integer (operands[
0],
4,
1);
9674 [(set_attr "type" "unknown")
9675 (set_attr "mode" "SI")
9676 (set_attr "length" "
2")])
9678 (define_insn "consttable_di"
9679 [(unspec_volatile [(match_operand:DI
0 "consttable_operand" "=g")]
13)]
9683 assemble_integer (operands[
0],
8,
1);
9686 [(set_attr "type" "unknown")
9687 (set_attr "mode" "DI")
9688 (set_attr "length" "
4")])
9690 (define_insn "consttable_sf"
9691 [(unspec_volatile [(match_operand:SF
0 "consttable_operand" "=g")]
14)]
9695 union real_extract u;
9697 if (GET_CODE (operands[
0]) != CONST_DOUBLE)
9699 bcopy ((char *) &CONST_DOUBLE_LOW (operands[
0]), (char *) &u, sizeof u);
9700 assemble_real (u.d, SFmode);
9703 [(set_attr "type" "unknown")
9704 (set_attr "mode" "SF")
9705 (set_attr "length" "
2")])
9707 (define_insn "consttable_df"
9708 [(unspec_volatile [(match_operand:DF
0 "consttable_operand" "=g")]
15)]
9712 union real_extract u;
9714 if (GET_CODE (operands[
0]) != CONST_DOUBLE)
9716 bcopy ((char *) &CONST_DOUBLE_LOW (operands[
0]), (char *) &u, sizeof u);
9717 assemble_real (u.d, DFmode);
9720 [(set_attr "type" "unknown")
9721 (set_attr "mode" "DF")
9722 (set_attr "length" "
4")])
9724 (define_insn "align_2"
9725 [(unspec_volatile [(const_int
0)]
16)]
9728 [(set_attr "type" "unknown")
9729 (set_attr "mode" "HI")
9730 (set_attr "length" "
2")])
9732 (define_insn "align_4"
9733 [(unspec_volatile [(const_int
0)]
17)]
9736 [(set_attr "type" "unknown")
9737 (set_attr "mode" "SI")
9738 (set_attr "length" "
2")])
9740 (define_insn "align_8"
9741 [(unspec_volatile [(const_int
0)]
18)]
9744 [(set_attr "type" "unknown")
9745 (set_attr "mode" "DI")
9746 (set_attr "length" "
3")])
9749 ;; ....................
9753 ;; ....................
9756 ;; On the mips16, reload will sometimes decide that a pseudo register
9757 ;; should go into $
24, and then later on have to reload that register.
9758 ;; When that happens, we get a load of a general register followed by
9759 ;; a move from the general register to $
24 followed by a branch.
9760 ;; These peepholes catch the common case, and fix it to just use the
9761 ;; general register for the branch.
9764 [(set (match_operand:SI
0 "register_operand" "=t")
9765 (match_operand:SI
1 "register_operand" "d"))
9767 (if_then_else (match_operator:SI
2 "equality_op" [(match_dup
0)
9769 (match_operand
3 "pc_or_label_operand" "")
9770 (match_operand
4 "pc_or_label_operand" "")))]
9772 && GET_CODE (operands[
0]) == REG
9773 && REGNO (operands[
0]) ==
24
9774 ;; ??? This is WRONG, dead_or_set_p cannot be used after reload
9775 ;; because the REG_DEAD notes are not maintained after reload.
9776 && dead_or_set_p (insn, operands[
0])
9777 && GET_CODE (operands[
1]) == REG
9778 && M16_REG_P (REGNO (operands[
1]))"
9781 if (operands[
3] != pc_rtx)
9782 return
\"%*b%C2z
\\t%
1,%
3\";
9784 return
\"%*b%N2z
\\t%
1,%
4\";
9786 [(set_attr "type" "branch")
9787 (set_attr "mode" "none")
9788 (set_attr "length" "
2")])
9791 [(set (match_operand:DI
0 "register_operand" "=t")
9792 (match_operand:DI
1 "register_operand" "d"))
9794 (if_then_else (match_operator:DI
2 "equality_op" [(match_dup
0)
9796 (match_operand
3 "pc_or_label_operand" "")
9797 (match_operand
4 "pc_or_label_operand" "")))]
9798 "TARGET_MIPS16 && TARGET_64BIT
9799 && GET_CODE (operands[
0]) == REG
9800 && REGNO (operands[
0]) ==
24
9801 ;; ??? This is WRONG, dead_or_set_p cannot be used after reload
9802 ;; because the REG_DEAD notes are not maintained after reload.
9803 && dead_or_set_p (insn, operands[
0])
9804 && GET_CODE (operands[
1]) == REG
9805 && M16_REG_P (REGNO (operands[
1]))"
9808 if (operands[
3] != pc_rtx)
9809 return
\"%*b%C2z
\\t%
1,%
3\";
9811 return
\"%*b%N2z
\\t%
1,%
4\";
9813 [(set_attr "type" "branch")
9814 (set_attr "mode" "none")
9815 (set_attr "length" "
2")])
9817 ;; We can also have the reverse reload: reload will spill $
24 into
9818 ;; another register, and then do a branch on that register when it
9819 ;; could have just stuck with $
24.
9822 [(set (match_operand:SI
0 "register_operand" "=d")
9823 (match_operand:SI
1 "register_operand" "t"))
9825 (if_then_else (match_operator:SI
2 "equality_op" [(match_dup
0)
9827 (match_operand
3 "pc_or_label_operand" "")
9828 (match_operand
4 "pc_or_label_operand" "")))]
9830 && GET_CODE (operands[
1]) == REG
9831 && REGNO (operands[
1]) ==
24
9832 && GET_CODE (operands[
0]) == REG
9833 && M16_REG_P (REGNO (operands[
0]))
9834 ;; ??? This is WRONG, dead_or_set_p cannot be used after reload
9835 ;; because the REG_DEAD notes are not maintained after reload.
9836 && dead_or_set_p (insn, operands[
0])"
9839 if (operands[
3] != pc_rtx)
9840 return
\"%*bt%C2z
\\t%
3\";
9842 return
\"%*bt%N2z
\\t%
4\";
9844 [(set_attr "type" "branch")
9845 (set_attr "mode" "none")
9846 (set_attr "length" "
2")])
9849 [(set (match_operand:DI
0 "register_operand" "=d")
9850 (match_operand:DI
1 "register_operand" "t"))
9852 (if_then_else (match_operator:DI
2 "equality_op" [(match_dup
0)
9854 (match_operand
3 "pc_or_label_operand" "")
9855 (match_operand
4 "pc_or_label_operand" "")))]
9856 "TARGET_MIPS16 && TARGET_64BIT
9857 && GET_CODE (operands[
1]) == REG
9858 && REGNO (operands[
1]) ==
24
9859 && GET_CODE (operands[
0]) == REG
9860 && M16_REG_P (REGNO (operands[
0]))
9861 ;; ??? This is WRONG, dead_or_set_p cannot be used after reload
9862 ;; because the REG_DEAD notes are not maintained after reload.
9863 && dead_or_set_p (insn, operands[
0])"
9866 if (operands[
3] != pc_rtx)
9867 return
\"%*bt%C2z
\\t%
3\";
9869 return
\"%*bt%N2z
\\t%
4\";
9871 [(set_attr "type" "branch")
9872 (set_attr "mode" "none")
9873 (set_attr "length" "
2")])