1 ;; iq2000.md Machine Description for Vitesse IQ2000 processors
2 ;; Copyright (C) 2003, 2004, 2005, 2007, 2010, 2011, 2012
3 ;; Free Software Foundation, Inc.
5 ;; This file is part of GCC.
7 ;; GCC is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 3, or (at your option)
12 ;; GCC is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GCC; see the file COPYING3. If not see
19 ;; <http://www.gnu.org/licenses/>.
70 ;; UNSPEC values used in iq2000.md
73 ;; 1 movsi_us, get_fnaddr
75 ;; 20 builtin_setjmp_setup
77 ;; UNSPEC_VOLATILE values
81 ;; 4 exception_receiver
93 ;; ....................
97 ;; ....................
99 ;; Classification of each insn.
100 ;; branch conditional branch
101 ;; jump unconditional jump
102 ;; call unconditional call
103 ;; load load instruction(s)
104 ;; store store instruction(s)
105 ;; move data movement within same register set
106 ;; xfer transfer to/from coprocessor
107 ;; arith integer arithmetic instruction
108 ;; darith double precision integer arithmetic instructions
109 ;; imul integer multiply
110 ;; idiv integer divide
111 ;; icmp integer compare
112 ;; fadd floating point add/subtract
113 ;; fmul floating point multiply
114 ;; fmadd floating point multiply-add
115 ;; fdiv floating point divide
116 ;; fabs floating point absolute value
117 ;; fneg floating point negation
118 ;; fcmp floating point compare
119 ;; fcvt floating point convert
120 ;; fsqrt floating point square root
121 ;; multi multiword sequence (or user asm statements)
125 "unknown,branch,jump,call,load,store,move,xfer,arith,darith,imul,idiv,icmp,fadd,fmul,fmadd,fdiv,fabs,fneg,fcmp,fcvt,fsqrt,multi,nop"
126 (const_string "unknown"))
128 ;; Main data type used by the insn
129 (define_attr "mode" "unknown,none,QI,HI,SI,DI,SF,DF,FPSW" (const_string "unknown"))
131 ;; Length (in # of bytes). A conditional branch is allowed only to a
132 ;; location within a signed 18-bit offset of the delay slot. If that
133 ;; provides too small a range, we use the `j' instruction. This
134 ;; instruction takes a 28-bit value, but that value is not an offset.
135 ;; Instead, it's bitwise-ored with the high-order four bits of the
136 ;; instruction in the delay slot, which means it cannot be used to
137 ;; cross a 256MB boundary. We could fall back back on the jr,
138 ;; instruction which allows full access to the entire address space,
139 ;; but we do not do so at present.
141 (define_attr "length" ""
142 (cond [(eq_attr "type" "branch")
143 (cond [(lt (abs (minus (match_dup 1) (plus (pc) (const_int 4))))
151 (const (symbol_ref "iq2000_cpu_attr")))
153 ;; Does the instruction have a mandatory delay slot? has_dslot
154 ;; Can the instruction be in a delay slot? ok_in_dslot
155 ;; Can the instruction not be in a delay slot? not_in_dslot
156 (define_attr "dslot" "has_dslot,ok_in_dslot,not_in_dslot"
157 (if_then_else (eq_attr "type" "branch,jump,call,xfer,fcmp")
158 (const_string "has_dslot")
159 (const_string "ok_in_dslot")))
161 ;; Attribute defining whether or not we can use the branch-likely instructions
163 (define_attr "branch_likely" "no,yes"
165 (if_then_else (match_test "GENERATE_BRANCHLIKELY")
167 (const_string "no"))))
170 ;; Describe a user's asm statement.
171 (define_asm_attributes
172 [(set_attr "type" "multi")])
176 ;; .........................
178 ;; Delay slots, can't describe load/fcmp/xfer delay slots here
180 ;; .........................
182 (define_delay (eq_attr "type" "jump")
183 [(and (eq_attr "dslot" "ok_in_dslot") (eq_attr "length" "4"))
187 (define_delay (eq_attr "type" "branch")
188 [(and (eq_attr "dslot" "ok_in_dslot") (eq_attr "length" "4"))
190 (and (eq_attr "branch_likely" "yes") (and (eq_attr "dslot" "ok_in_dslot") (eq_attr "length" "4")))])
192 (define_delay (eq_attr "type" "call")
193 [(and (eq_attr "dslot" "ok_in_dslot") (eq_attr "length" "4"))
197 (include "predicates.md")
198 (include "constraints.md")
201 ;; .........................
205 ;; .........................
207 (define_automaton "iq2000")
208 (define_cpu_unit "core,memory" "iq2000")
210 (define_insn_reservation "nonmemory" 1
211 (eq_attr "type" "!load,move,store,xfer")
214 (define_insn_reservation "iq2000_load_move" 3
215 (and (eq_attr "type" "load,move")
216 (eq_attr "cpu" "iq2000"))
219 (define_insn_reservation "other_load_move" 1
220 (and (eq_attr "type" "load,move")
221 (eq_attr "cpu" "!iq2000"))
224 (define_insn_reservation "store" 1
225 (eq_attr "type" "store")
228 (define_insn_reservation "xfer" 2
229 (eq_attr "type" "xfer")
233 ;; ....................
237 ;; ....................
241 [(trap_if (const_int 1) (const_int 0))]
249 ;; ....................
253 ;; ....................
256 (define_expand "addsi3"
257 [(set (match_operand:SI 0 "register_operand" "=d")
258 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
259 (match_operand:SI 2 "arith_operand" "dI")))]
263 (define_insn "addsi3_internal"
264 [(set (match_operand:SI 0 "register_operand" "=d,=d")
265 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ,dJ")
266 (match_operand:SI 2 "arith_operand" "d,I")))]
271 [(set_attr "type" "arith")
272 (set_attr "mode" "SI")])
275 ;; ....................
279 ;; ....................
282 (define_expand "subsi3"
283 [(set (match_operand:SI 0 "register_operand" "=d")
284 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
285 (match_operand:SI 2 "arith_operand" "dI")))]
289 (define_insn "subsi3_internal"
290 [(set (match_operand:SI 0 "register_operand" "=d,=d")
291 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ,dJ")
292 (match_operand:SI 2 "arith_operand" "d,I")))]
297 [(set_attr "type" "arith")
298 (set_attr "mode" "SI")])
301 ;; ....................
303 ;; NEGATION and ONE'S COMPLEMENT
305 ;; ....................
307 (define_insn "negsi2"
308 [(set (match_operand:SI 0 "register_operand" "=d")
309 (neg:SI (match_operand:SI 1 "register_operand" "d")))]
313 operands[2] = const0_rtx;
314 return \"subu\\t%0,%z2,%1\";
316 [(set_attr "type" "arith")
317 (set_attr "mode" "SI")])
319 (define_insn "one_cmplsi2"
320 [(set (match_operand:SI 0 "register_operand" "=d")
321 (not:SI (match_operand:SI 1 "register_operand" "d")))]
325 operands[2] = const0_rtx;
326 return \"nor\\t%0,%z2,%1\";
328 [(set_attr "type" "arith")
329 (set_attr "mode" "SI")])
332 ;; ....................
336 ;; ....................
339 (define_expand "andsi3"
340 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
341 (and:SI (match_operand:SI 1 "uns_arith_operand" "%d,d,d")
342 (match_operand:SI 2 "nonmemory_operand" "d,K,N")))]
347 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
348 (and:SI (match_operand:SI 1 "uns_arith_operand" "%d,d,d")
349 (match_operand:SI 2 "nonmemory_operand" "d,K,N")))]
353 if (which_alternative == 0)
354 return \"and\\t%0,%1,%2\";
355 else if (which_alternative == 1)
356 return \"andi\\t%0,%1,%x2\";
357 else if (which_alternative == 2)
359 if ((INTVAL (operands[2]) & 0xffff) == 0xffff)
361 operands[2] = GEN_INT (INTVAL (operands[2]) >> 16);
362 return \"andoui\\t%0,%1,%x2\";
366 operands[2] = GEN_INT (INTVAL (operands[2]) & 0xffff);
367 return \"andoi\\t%0,%1,%x2\";
373 [(set_attr "type" "arith")
374 (set_attr "mode" "SI")])
376 (define_expand "iorsi3"
377 [(set (match_operand:SI 0 "register_operand" "=d,d")
378 (ior:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
379 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
384 [(set (match_operand:SI 0 "register_operand" "=d,d")
385 (ior:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
386 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
391 [(set_attr "type" "arith")
392 (set_attr "mode" "SI")])
394 (define_expand "xorsi3"
395 [(set (match_operand:SI 0 "register_operand" "=d,d")
396 (xor:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
397 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
402 [(set (match_operand:SI 0 "register_operand" "=d,d")
403 (xor:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
404 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
409 [(set_attr "type" "arith")
410 (set_attr "mode" "SI")])
412 (define_insn "*norsi3"
413 [(set (match_operand:SI 0 "register_operand" "=d")
414 (and:SI (not:SI (match_operand:SI 1 "register_operand" "d"))
415 (not:SI (match_operand:SI 2 "register_operand" "d"))))]
418 [(set_attr "type" "arith")
419 (set_attr "mode" "SI")])
422 ;; ....................
426 ;; ....................
429 ;; Those for integer source operand are ordered widest source type first.
431 (define_expand "zero_extendhisi2"
432 [(set (match_operand:SI 0 "register_operand" "")
433 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
438 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
439 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "d,R,m")))]
443 if (which_alternative == 0)
444 return \"andi\\t%0,%1,0xffff\";
446 return iq2000_move_1word (operands, insn, TRUE);
448 [(set_attr "type" "arith,load,load")
449 (set_attr "mode" "SI")
450 (set_attr "length" "4,4,8")])
452 (define_expand "zero_extendqihi2"
453 [(set (match_operand:HI 0 "register_operand" "")
454 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))]
459 [(set (match_operand:HI 0 "register_operand" "=d,d,d")
460 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "d,R,m")))]
464 if (which_alternative == 0)
465 return \"andi\\t%0,%1,0x00ff\";
467 return iq2000_move_1word (operands, insn, TRUE);
469 [(set_attr "type" "arith,load,load")
470 (set_attr "mode" "HI")
471 (set_attr "length" "4,4,8")])
473 (define_expand "zero_extendqisi2"
474 [(set (match_operand:SI 0 "register_operand" "")
475 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
480 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
481 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "d,R,m")))]
485 if (which_alternative == 0)
486 return \"andi\\t%0,%1,0x00ff\";
488 return iq2000_move_1word (operands, insn, TRUE);
490 [(set_attr "type" "arith,load,load")
491 (set_attr "mode" "SI")
492 (set_attr "length" "4,4,8")])
495 ;; ....................
499 ;; ....................
502 ;; Those for integer source operand are ordered widest source type first.
504 ;; These patterns originally accepted general_operands, however, slightly
505 ;; better code is generated by only accepting register_operands, and then
506 ;; letting combine generate the lh and lb insns.
508 (define_expand "extendhisi2"
509 [(set (match_operand:SI 0 "register_operand" "")
510 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
514 if (optimize && GET_CODE (operands[1]) == MEM)
515 operands[1] = force_not_mem (operands[1]);
517 if (GET_CODE (operands[1]) != MEM)
519 rtx op1 = gen_lowpart (SImode, operands[1]);
520 rtx temp = gen_reg_rtx (SImode);
521 rtx shift = GEN_INT (16);
523 emit_insn (gen_ashlsi3 (temp, op1, shift));
524 emit_insn (gen_ashrsi3 (operands[0], temp, shift));
529 (define_insn "extendhisi2_internal"
530 [(set (match_operand:SI 0 "register_operand" "=d,d")
531 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,m")))]
533 "* return iq2000_move_1word (operands, insn, FALSE);"
534 [(set_attr "type" "load")
535 (set_attr "mode" "SI")
536 (set_attr "length" "4,8")])
538 (define_expand "extendqihi2"
539 [(set (match_operand:HI 0 "register_operand" "")
540 (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))]
544 if (optimize && GET_CODE (operands[1]) == MEM)
545 operands[1] = force_not_mem (operands[1]);
547 if (GET_CODE (operands[1]) != MEM)
549 rtx op0 = gen_lowpart (SImode, operands[0]);
550 rtx op1 = gen_lowpart (SImode, operands[1]);
551 rtx temp = gen_reg_rtx (SImode);
552 rtx shift = GEN_INT (24);
554 emit_insn (gen_ashlsi3 (temp, op1, shift));
555 emit_insn (gen_ashrsi3 (op0, temp, shift));
560 (define_insn "extendqihi2_internal"
561 [(set (match_operand:HI 0 "register_operand" "=d,d")
562 (sign_extend:HI (match_operand:QI 1 "memory_operand" "R,m")))]
564 "* return iq2000_move_1word (operands, insn, FALSE);"
565 [(set_attr "type" "load")
566 (set_attr "mode" "SI")
567 (set_attr "length" "4,8")])
570 (define_expand "extendqisi2"
571 [(set (match_operand:SI 0 "register_operand" "")
572 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
576 if (optimize && GET_CODE (operands[1]) == MEM)
577 operands[1] = force_not_mem (operands[1]);
579 if (GET_CODE (operands[1]) != MEM)
581 rtx op1 = gen_lowpart (SImode, operands[1]);
582 rtx temp = gen_reg_rtx (SImode);
583 rtx shift = GEN_INT (24);
585 emit_insn (gen_ashlsi3 (temp, op1, shift));
586 emit_insn (gen_ashrsi3 (operands[0], temp, shift));
591 (define_insn "extendqisi2_insn"
592 [(set (match_operand:SI 0 "register_operand" "=d,d")
593 (sign_extend:SI (match_operand:QI 1 "memory_operand" "R,m")))]
595 "* return iq2000_move_1word (operands, insn, FALSE);"
596 [(set_attr "type" "load")
597 (set_attr "mode" "SI")
598 (set_attr "length" "4,8")])
601 ;; ........................
603 ;; BIT FIELD EXTRACTION
605 ;; ........................
608 [(set (match_operand:SI 0 "register_operand" "=r")
609 (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
610 (match_operand:SI 2 "const_int_operand" "O")
611 (match_operand:SI 3 "const_int_operand" "O")))]
616 value[2] = INTVAL (operands[2]);
617 value[3] = INTVAL (operands[3]);
618 operands[2] = GEN_INT ((value[3]));
619 operands[3] = GEN_INT ((32 - value[2]));
620 return \"ram\\t%0,%1,%2,%3,0x0\";
622 [(set_attr "type" "arith")])
625 ;; ....................
629 ;; ....................
631 /* Take care of constants that don't fit in single instruction */
633 [(set (match_operand:SI 0 "register_operand" "")
634 (match_operand:SI 1 "general_operand" ""))]
635 "(reload_in_progress || reload_completed)
636 && large_int (operands[1], SImode)"
639 (high:SI (match_dup 1)))
641 (lo_sum:SI (match_dup 0)
645 ;; ??? iq2000_move_1word has support for HIGH, so this pattern may be
649 [(set (match_operand:SI 0 "register_operand" "=r")
650 (high:SI (match_operand:SI 1 "immediate_operand" "")))]
652 "lui\\t%0,%%hi(%1) # high"
653 [(set_attr "type" "move")])
656 [(set (match_operand:SI 0 "register_operand" "=r")
657 (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
658 (match_operand:SI 2 "immediate_operand" "")))]
660 "addiu\\t%0,%1,%%lo(%2) # low"
661 [(set_attr "type" "arith")
662 (set_attr "mode" "SI")])
664 ;; 32-bit Integer moves
667 [(set (match_operand:SI 0 "register_operand" "")
668 (match_operand:SI 1 "large_int" ""))]
669 "reload_in_progress | reload_completed"
673 (ior:SI (match_dup 0)
677 operands[2] = GEN_INT (trunc_int_for_mode (INTVAL (operands[1])
680 operands[3] = GEN_INT (INTVAL (operands[1]) & BITMASK_LOWER16);
683 ;; Unlike most other insns, the move insns can't be split with
684 ;; different predicates, because register spilling and other parts of
685 ;; the compiler, have memoized the insn number already.
687 (define_expand "movsi"
688 [(set (match_operand:SI 0 "nonimmediate_operand" "")
689 (match_operand:SI 1 "general_operand" ""))]
693 if (iq2000_check_split (operands[1], SImode))
695 enum machine_mode mode = GET_MODE (operands[0]);
696 rtx tem = ((reload_in_progress | reload_completed)
697 ? operands[0] : gen_reg_rtx (mode));
699 emit_insn (gen_rtx_SET (VOIDmode, tem,
700 gen_rtx_HIGH (mode, operands[1])));
702 operands[1] = gen_rtx_LO_SUM (mode, tem, operands[1]);
705 if ((reload_in_progress | reload_completed) == 0
706 && !register_operand (operands[0], SImode)
707 && !register_operand (operands[1], SImode)
708 && (GET_CODE (operands[1]) != CONST_INT
709 || INTVAL (operands[1]) != 0))
711 rtx temp = force_reg (SImode, operands[1]);
712 emit_move_insn (operands[0], temp);
716 /* Take care of constants that don't fit in single instruction */
717 if ((reload_in_progress || reload_completed)
718 && CONSTANT_P (operands[1])
719 && GET_CODE (operands[1]) != HIGH
720 && GET_CODE (operands[1]) != LO_SUM
721 && ! SMALL_INT_UNSIGNED (operands[1]))
723 rtx tem = ((reload_in_progress | reload_completed)
724 ? operands[0] : gen_reg_rtx (SImode));
726 emit_insn (gen_rtx_SET (VOIDmode, tem,
727 gen_rtx_HIGH (SImode, operands[1])));
728 operands[1] = gen_rtx_LO_SUM (SImode, tem, operands[1]);
732 ;; The difference between these two is whether or not ints are allowed
733 ;; in FP registers (off by default, use -mdebugh to enable).
735 (define_insn "movsi_internal2"
736 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d,R,m")
737 (match_operand:SI 1 "move_operand" "d,IKL,Mnis,R,m,dJ,dJ"))]
738 "(register_operand (operands[0], SImode)
739 || register_operand (operands[1], SImode)
740 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
741 "* return iq2000_move_1word (operands, insn, FALSE);"
742 [(set_attr "type" "move,arith,arith,load,load,store,store")
743 (set_attr "mode" "SI")
744 (set_attr "length" "4,4,8,8,8,4,8")])
746 ;; 16-bit Integer moves
748 ;; Unlike most other insns, the move insns can't be split with
749 ;; different predicates, because register spilling and other parts of
750 ;; the compiler, have memoized the insn number already.
751 ;; Unsigned loads are used because BYTE_LOADS_ZERO_EXTEND is defined
753 (define_expand "movhi"
754 [(set (match_operand:HI 0 "nonimmediate_operand" "")
755 (match_operand:HI 1 "general_operand" ""))]
759 if ((reload_in_progress | reload_completed) == 0
760 && !register_operand (operands[0], HImode)
761 && !register_operand (operands[1], HImode)
762 && ((GET_CODE (operands[1]) != CONST_INT
763 || INTVAL (operands[1]) != 0)))
765 rtx temp = force_reg (HImode, operands[1]);
766 emit_move_insn (operands[0], temp);
771 ;; The difference between these two is whether or not ints are allowed
772 ;; in FP registers (off by default, use -mdebugh to enable).
774 (define_insn "movhi_internal2"
775 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,R,m")
776 (match_operand:HI 1 "general_operand" "d,IK,R,m,dJ,dJ"))]
777 "(register_operand (operands[0], HImode)
778 || register_operand (operands[1], HImode)
779 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
780 "* return iq2000_move_1word (operands, insn, TRUE);"
781 [(set_attr "type" "move,arith,load,load,store,store")
782 (set_attr "mode" "HI")
783 (set_attr "length" "4,4,4,8,4,8")])
785 ;; 8-bit Integer moves
787 ;; Unlike most other insns, the move insns can't be split with
788 ;; different predicates, because register spilling and other parts of
789 ;; the compiler, have memoized the insn number already.
790 ;; Unsigned loads are used because BYTE_LOADS_ZERO_EXTEND is defined
792 (define_expand "movqi"
793 [(set (match_operand:QI 0 "nonimmediate_operand" "")
794 (match_operand:QI 1 "general_operand" ""))]
798 if ((reload_in_progress | reload_completed) == 0
799 && !register_operand (operands[0], QImode)
800 && !register_operand (operands[1], QImode)
801 && (GET_CODE (operands[1]) != CONST_INT
802 || INTVAL (operands[1]) != 0))
804 rtx temp = force_reg (QImode, operands[1]);
805 emit_move_insn (operands[0], temp);
810 ;; The difference between these two is whether or not ints are allowed
811 ;; in FP registers (off by default, use -mdebugh to enable).
813 (define_insn "movqi_internal2"
814 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,m")
815 (match_operand:QI 1 "general_operand" "d,IK,R,m,dJ,dJ"))]
816 "(register_operand (operands[0], QImode)
817 || register_operand (operands[1], QImode)
818 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
819 "* return iq2000_move_1word (operands, insn, TRUE);"
820 [(set_attr "type" "move,arith,load,load,store,store")
821 (set_attr "mode" "QI")
822 (set_attr "length" "4,4,4,8,4,8")])
824 ;; 32-bit floating point moves
826 (define_expand "movsf"
827 [(set (match_operand:SF 0 "general_operand" "")
828 (match_operand:SF 1 "general_operand" ""))]
832 if (!reload_in_progress
834 && GET_CODE (operands[0]) == MEM
835 && (GET_CODE (operands[1]) == MEM
836 || GET_CODE (operands[1]) == CONST_DOUBLE))
837 operands[1] = copy_to_mode_reg (SFmode, operands[1]);
839 /* Take care of reg <- SF constant */
840 if ( const_double_operand (operands[1], GET_MODE (operands[1]) ) )
842 emit_insn (gen_movsf_high (operands[0], operands[1]));
843 emit_insn (gen_movsf_lo_sum (operands[0], operands[0], operands[1]));
848 (define_insn "movsf_lo_sum"
849 [(set (match_operand:SF 0 "register_operand" "=r")
850 (lo_sum:SF (match_operand:SF 1 "register_operand" "r")
851 (match_operand:SF 2 "const_double_operand" "")))]
858 REAL_VALUE_FROM_CONST_DOUBLE (r, operands[2]);
859 REAL_VALUE_TO_TARGET_SINGLE (r, i);
860 operands[2] = GEN_INT (i);
861 return \"addiu\\t%0,%1,%%lo(%2) # low\";
863 [(set_attr "length" "4")
864 (set_attr "type" "arith")])
866 (define_insn "movsf_high"
867 [(set (match_operand:SF 0 "register_operand" "=r")
868 (high:SF (match_operand:SF 1 "const_double_operand" "")))]
875 REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
876 REAL_VALUE_TO_TARGET_SINGLE (r, i);
877 operands[1] = GEN_INT (i);
878 return \"lui\\t%0,%%hi(%1) # high\";
880 [(set_attr "length" "4")
881 (set_attr "type" "arith")])
883 (define_insn "*movsf_internal"
884 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m")
885 (match_operand:SF 1 "nonimmediate_operand" "r,m,r"))]
886 "!memory_operand (operands[0], SFmode) || !memory_operand (operands[1], SFmode)"
889 iq2000_fill_delay_slot (\"\", DELAY_LOAD, operands, insn);
890 if (which_alternative == 0)
891 return \"or\\t%0,%1,%1\";
892 else if (which_alternative == 1)
893 return \"lw\\t%0,%1\";
894 else if (which_alternative == 2)
895 return \"sw\\t%1,%0\";
899 [(set_attr "length" "4,4,4")
900 (set_attr "type" "arith,load,store")]
904 ;; ....................
908 ;; ....................
910 (define_expand "ashlsi3"
911 [(set (match_operand:SI 0 "register_operand" "=d")
912 (ashift:SI (match_operand:SI 1 "register_operand" "d")
913 (match_operand:SI 2 "arith_operand" "dI")))]
917 (define_insn "ashlsi3_internal1"
918 [(set (match_operand:SI 0 "register_operand" "=d")
919 (ashift:SI (match_operand:SI 1 "register_operand" "d")
920 (match_operand:SI 2 "arith_operand" "dI")))]
924 if (GET_CODE (operands[2]) == CONST_INT)
926 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
927 return \"sll\\t%0,%1,%2\";
930 return \"sllv\\t%0,%1,%2\";
932 [(set_attr "type" "arith")
933 (set_attr "mode" "SI")])
935 (define_expand "ashrsi3"
936 [(set (match_operand:SI 0 "register_operand" "=d")
937 (ashiftrt:SI (match_operand:SI 1 "register_operand" "d")
938 (match_operand:SI 2 "arith_operand" "dI")))]
942 (define_insn "ashrsi3_internal1"
943 [(set (match_operand:SI 0 "register_operand" "=d")
944 (ashiftrt:SI (match_operand:SI 1 "register_operand" "d")
945 (match_operand:SI 2 "arith_operand" "dI")))]
949 if (GET_CODE (operands[2]) == CONST_INT)
951 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
952 return \"sra\\t%0,%1,%2\";
955 return \"srav\\t%0,%1,%2\";
957 [(set_attr "type" "arith")
958 (set_attr "mode" "SI")])
960 (define_expand "lshrsi3"
961 [(set (match_operand:SI 0 "register_operand" "=d")
962 (lshiftrt:SI (match_operand:SI 1 "register_operand" "d")
963 (match_operand:SI 2 "arith_operand" "dI")))]
967 (define_insn "lshrsi3_internal1"
968 [(set (match_operand:SI 0 "register_operand" "=d")
969 (lshiftrt:SI (match_operand:SI 1 "register_operand" "d")
970 (match_operand:SI 2 "arith_operand" "dI")))]
974 if (GET_CODE (operands[2]) == CONST_INT)
976 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
977 return \"srl\\t%0,%1,%2\";
980 return \"srlv\\t%0,%1,%2\";
982 [(set_attr "type" "arith")
983 (set_attr "mode" "SI")])
986 (define_insn "rotrsi3"
987 [(set (match_operand:SI 0 "register_operand" "=r")
988 (rotatert:SI (match_operand:SI 1 "register_operand" "r")
989 (match_operand:SI 2 "uns_arith_operand" "O")))]
991 "ram %0,%1,%2,0x0,0x0"
992 [(set_attr "type" "arith")])
996 ;; ....................
998 ;; CONDITIONAL BRANCHES
1000 ;; ....................
1002 (define_expand "cbranchsi4"
1005 (match_operator 0 "ordered_comparison_operator"
1006 [(match_operand:SI 1 "register_operand")
1007 (match_operand:SI 2 "reg_or_const_operand")])
1008 (label_ref (match_operand 3 ""))
1013 gen_conditional_branch (operands, SImode);
1018 ;; Conditional branches on comparisons with zero.
1020 (define_insn "branch_zero"
1023 (match_operator 0 "cmp_op"
1024 [(match_operand:SI 2 "register_operand" "d")
1026 (label_ref (match_operand 1 "" ""))
1031 return iq2000_output_conditional_branch (insn,
1033 /*two_operands_p=*/0,
1036 get_attr_length (insn));
1038 [(set_attr "type" "branch")
1039 (set_attr "mode" "none")])
1041 (define_insn "branch_zero_inverted"
1044 (match_operator 0 "cmp_op"
1045 [(match_operand:SI 2 "register_operand" "d")
1048 (label_ref (match_operand 1 "" ""))))]
1052 return iq2000_output_conditional_branch (insn,
1054 /*two_operands_p=*/0,
1057 get_attr_length (insn));
1059 [(set_attr "type" "branch")
1060 (set_attr "mode" "none")])
1062 ;; Conditional branch on equality comparison.
1064 (define_insn "branch_equality"
1067 (match_operator 0 "equality_op"
1068 [(match_operand:SI 2 "register_operand" "d")
1069 (match_operand:SI 3 "register_operand" "d")])
1070 (label_ref (match_operand 1 "" ""))
1075 return iq2000_output_conditional_branch (insn,
1077 /*two_operands_p=*/1,
1080 get_attr_length (insn));
1082 [(set_attr "type" "branch")
1083 (set_attr "mode" "none")])
1085 (define_insn "branch_equality_inverted"
1088 (match_operator 0 "equality_op"
1089 [(match_operand:SI 2 "register_operand" "d")
1090 (match_operand:SI 3 "register_operand" "d")])
1092 (label_ref (match_operand 1 "" ""))))]
1096 return iq2000_output_conditional_branch (insn,
1098 /*two_operands_p=*/1,
1101 get_attr_length (insn));
1103 [(set_attr "type" "branch")
1104 (set_attr "mode" "none")])
1107 ;; Recognize bbi and bbin instructions. These use two unusual template
1108 ;; patterns, %Ax and %Px. %Ax outputs an 'i' if operand `x' is a LABEL_REF
1109 ;; otherwise it outputs an 'in'. %Px does nothing if `x' is PC
1110 ;; and outputs the operand if `x' is a LABEL_REF.
1115 (ne (sign_extract:SI (match_operand:SI 0 "register_operand" "r")
1117 (match_operand:SI 1 "arith_operand" "I"))
1119 (match_operand 2 "pc_or_label_operand" "")
1120 (match_operand 3 "pc_or_label_operand" "")))]
1122 "bb%A2\\t%0(31-%1),%P2%P3"
1123 [(set_attr "length" "4")
1124 (set_attr "type" "branch")])
1129 (eq (sign_extract:SI (match_operand:SI 0 "register_operand" "r")
1131 (match_operand:SI 1 "arith_operand" "I"))
1133 (match_operand 2 "pc_or_label_operand" "")
1134 (match_operand 3 "pc_or_label_operand" "")))]
1136 "bb%A3\\t%0(31-%1),%P2%P3"
1137 [(set_attr "length" "4")
1138 (set_attr "type" "branch")])
1143 (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1145 (match_operand:SI 1 "arith_operand" "I"))
1147 (match_operand 2 "pc_or_label_operand" "")
1148 (match_operand 3 "pc_or_label_operand" "")))]
1150 "bb%A2\\t%0(31-%1),%P2%P3"
1151 [(set_attr "length" "4")
1152 (set_attr "type" "branch")])
1157 (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1159 (match_operand:SI 1 "arith_operand" "I"))
1161 (match_operand 2 "pc_or_label_operand" "")
1162 (match_operand 3 "pc_or_label_operand" "")))]
1164 "bb%A3\\t%0(31-%1),%P2%P3"
1165 [(set_attr "length" "4")
1166 (set_attr "type" "branch")])
1171 (eq (and:SI (match_operand:SI 0 "register_operand" "r")
1172 (match_operand:SI 1 "power_of_2_operand" "I"))
1174 (match_operand 2 "pc_or_label_operand" "")
1175 (match_operand 3 "pc_or_label_operand" "")))]
1177 "bb%A3\\t%0(%p1),%P2%P3"
1178 [(set_attr "length" "4")
1179 (set_attr "type" "branch")])
1184 (ne (and:SI (match_operand:SI 0 "register_operand" "r")
1185 (match_operand:SI 1 "power_of_2_operand" "I"))
1187 (match_operand 2 "pc_or_label_operand" "")
1188 (match_operand 3 "pc_or_label_operand" "")))]
1190 "bb%A2\\t%0(%p1),%P2%P3"
1191 [(set_attr "length" "4")
1192 (set_attr "type" "branch")])
1195 ;; ....................
1197 ;; SETTING A REGISTER FROM A COMPARISON
1199 ;; ....................
1201 (define_expand "cstoresi4"
1202 [(set (match_operand:SI 0 "register_operand" "=d")
1203 (match_operator:SI 1 "ordered_comparison_operator"
1204 [(match_operand:SI 2 "register_operand")
1205 (match_operand:SI 3 "reg_or_const_operand")]))]
1209 gen_int_relational (GET_CODE (operands[1]), operands[0],
1210 operands[2], operands[3], (int *)0);
1214 (define_insn "seq_si_zero"
1215 [(set (match_operand:SI 0 "register_operand" "=d")
1216 (eq:SI (match_operand:SI 1 "register_operand" "d")
1220 [(set_attr "type" "arith")
1221 (set_attr "mode" "SI")])
1223 (define_insn "sne_si_zero"
1224 [(set (match_operand:SI 0 "register_operand" "=d")
1225 (ne:SI (match_operand:SI 1 "register_operand" "d")
1229 [(set_attr "type" "arith")
1230 (set_attr "mode" "SI")])
1232 (define_insn "sgt_si"
1233 [(set (match_operand:SI 0 "register_operand" "=d,=d")
1234 (gt:SI (match_operand:SI 1 "register_operand" "d,d")
1235 (match_operand:SI 2 "reg_or_0_operand" "d,J")))]
1240 [(set_attr "type" "arith,arith")
1241 (set_attr "mode" "SI,SI")])
1243 (define_insn "slt_si"
1244 [(set (match_operand:SI 0 "register_operand" "=d,=d")
1245 (lt:SI (match_operand:SI 1 "register_operand" "d,d")
1246 (match_operand:SI 2 "arith_operand" "d,I")))]
1251 [(set_attr "type" "arith,arith")
1252 (set_attr "mode" "SI,SI")])
1254 (define_insn "sle_si_const"
1255 [(set (match_operand:SI 0 "register_operand" "=d")
1256 (le:SI (match_operand:SI 1 "register_operand" "d")
1257 (match_operand:SI 2 "small_int" "I")))]
1258 "INTVAL (operands[2]) < 32767"
1261 operands[2] = GEN_INT (INTVAL (operands[2])+1);
1262 return \"slti\\t%0,%1,%2\";
1264 [(set_attr "type" "arith")
1265 (set_attr "mode" "SI")])
1267 (define_insn "sgtu_si"
1268 [(set (match_operand:SI 0 "register_operand" "=d")
1269 (gtu:SI (match_operand:SI 1 "register_operand" "d")
1270 (match_operand:SI 2 "reg_or_0_operand" "dJ")))]
1273 [(set_attr "type" "arith")
1274 (set_attr "mode" "SI")])
1276 (define_insn "sltu_si"
1277 [(set (match_operand:SI 0 "register_operand" "=d,=d")
1278 (ltu:SI (match_operand:SI 1 "register_operand" "d,d")
1279 (match_operand:SI 2 "arith_operand" "d,I")))]
1284 [(set_attr "type" "arith,arith")
1285 (set_attr "mode" "SI,SI")])
1287 (define_insn "sleu_si_const"
1288 [(set (match_operand:SI 0 "register_operand" "=d")
1289 (leu:SI (match_operand:SI 1 "register_operand" "d")
1290 (match_operand:SI 2 "small_int" "I")))]
1291 "INTVAL (operands[2]) < 32767"
1294 operands[2] = GEN_INT (INTVAL (operands[2]) + 1);
1295 return \"sltiu\\t%0,%1,%2\";
1297 [(set_attr "type" "arith")
1298 (set_attr "mode" "SI")])
1302 ;; ....................
1304 ;; UNCONDITIONAL BRANCHES
1306 ;; ....................
1308 ;; Unconditional branches.
1312 (label_ref (match_operand 0 "" "")))]
1316 if (GET_CODE (operands[0]) == REG)
1319 /* return \"b\\t%l0\";*/
1321 [(set_attr "type" "jump")
1322 (set_attr "mode" "none")])
1324 (define_expand "indirect_jump"
1325 [(set (pc) (match_operand 0 "register_operand" "d"))]
1331 if (operands[0]) /* eliminate unused code warnings */
1334 if (GET_CODE (dest) != REG || GET_MODE (dest) != Pmode)
1335 operands[0] = copy_to_mode_reg (Pmode, dest);
1337 if (!(Pmode == DImode))
1338 emit_jump_insn (gen_indirect_jump_internal1 (operands[0]));
1340 internal_error (\"unimplemented functionality\");
1346 (define_insn "indirect_jump_internal1"
1347 [(set (pc) (match_operand:SI 0 "register_operand" "d"))]
1348 "!(Pmode == DImode)"
1350 [(set_attr "type" "jump")
1351 (set_attr "mode" "none")])
1353 (define_expand "tablejump"
1355 (match_operand 0 "register_operand" "d"))
1356 (use (label_ref (match_operand 1 "" "")))]
1360 if (operands[0]) /* eliminate unused code warnings */
1362 gcc_assert (GET_MODE (operands[0]) == Pmode);
1364 if (!(Pmode == DImode))
1365 emit_jump_insn (gen_tablejump_internal1 (operands[0], operands[1]));
1367 internal_error (\"unimplemented functionality\");
1373 (define_insn "tablejump_internal1"
1375 (match_operand:SI 0 "register_operand" "d"))
1376 (use (label_ref (match_operand 1 "" "")))]
1377 "!(Pmode == DImode)"
1379 [(set_attr "type" "jump")
1380 (set_attr "mode" "none")])
1382 (define_expand "tablejump_internal3"
1383 [(parallel [(set (pc)
1384 (plus:SI (match_operand:SI 0 "register_operand" "d")
1385 (label_ref:SI (match_operand 1 "" ""))))
1386 (use (label_ref:SI (match_dup 1)))])]
1390 ;;; Make sure that this only matches the insn before ADDR_DIFF_VEC. Otherwise
1391 ;;; it is not valid. ??? With the USE, the condition tests may not be required
1394 ;;; ??? The length depends on the ABI. It is two for o32, and one for n32.
1395 ;;; We just use the conservative number here.
1399 (plus:SI (match_operand:SI 0 "register_operand" "d")
1400 (label_ref:SI (match_operand 1 "" ""))))
1401 (use (label_ref:SI (match_dup 1)))]
1402 "!(Pmode == DImode) && next_active_insn (insn) != 0
1403 && GET_CODE (PATTERN (next_active_insn (insn))) == ADDR_DIFF_VEC
1404 && PREV_INSN (next_active_insn (insn)) == operands[1]"
1409 [(set_attr "type" "jump")
1410 (set_attr "mode" "none")
1411 (set_attr "length" "8")])
1414 ;; ....................
1416 ;; Function prologue/epilogue
1418 ;; ....................
1421 (define_expand "prologue"
1426 if (iq2000_isa >= 0) /* avoid unused code warnings */
1428 iq2000_expand_prologue ();
1433 ;; Block any insns from being moved before this point, since the
1434 ;; profiling call to mcount can use various registers that aren't
1435 ;; saved or used to pass arguments.
1437 (define_insn "blockage"
1438 [(unspec_volatile [(const_int 0)] 0)]
1441 [(set_attr "type" "unknown")
1442 (set_attr "mode" "none")
1443 (set_attr "length" "0")])
1445 (define_expand "epilogue"
1450 if (iq2000_isa >= 0) /* avoid unused code warnings */
1452 iq2000_expand_epilogue ();
1457 ;; Trivial return. Make it look like a normal return insn as that
1458 ;; allows jump optimizations to work better .
1459 (define_insn "return"
1461 "iq2000_can_use_return_insn ()"
1463 [(set_attr "type" "jump")
1464 (set_attr "mode" "none")])
1468 (define_insn "return_internal"
1469 [(use (match_operand 0 "pmode_register_operand" ""))
1476 [(set_attr "type" "jump")
1477 (set_attr "mode" "none")])
1479 (define_insn "eh_return_internal"
1486 [(set_attr "type" "jump")
1487 (set_attr "mode" "none")])
1489 (define_expand "eh_return"
1490 [(use (match_operand:SI 0 "register_operand" "r"))]
1494 iq2000_expand_eh_return (operands[0]);
1500 ;; ....................
1504 ;; ....................
1506 ;; calls.c now passes a third argument, make saber happy
1508 (define_expand "call"
1509 [(parallel [(call (match_operand 0 "memory_operand" "m")
1510 (match_operand 1 "" "i"))
1511 (clobber (reg:SI 31))
1512 (use (match_operand 2 "" "")) ;; next_arg_reg
1513 (use (match_operand 3 "" ""))])] ;; struct_value_size_rtx
1519 if (operands[0]) /* eliminate unused code warnings */
1521 addr = XEXP (operands[0], 0);
1522 if ((GET_CODE (addr) != REG && (!CONSTANT_ADDRESS_P (addr)))
1523 || ! call_insn_operand (addr, VOIDmode))
1524 XEXP (operands[0], 0) = copy_to_mode_reg (Pmode, addr);
1526 /* In order to pass small structures by value in registers
1527 compatibly with the IQ2000 compiler, we need to shift the value
1528 into the high part of the register. Function_arg has encoded
1529 a PARALLEL rtx, holding a vector of adjustments to be made
1530 as the next_arg_reg variable, so we split up the insns,
1531 and emit them separately. */
1533 if (operands[2] != (rtx)0 && GET_CODE (operands[2]) == PARALLEL)
1535 rtvec adjust = XVEC (operands[2], 0);
1536 int num = GET_NUM_ELEM (adjust);
1539 for (i = 0; i < num; i++)
1540 emit_insn (RTVEC_ELT (adjust, i));
1543 emit_call_insn (gen_call_internal0 (operands[0], operands[1],
1544 gen_rtx_REG (SImode,
1545 GP_REG_FIRST + 31)));
1550 (define_expand "call_internal0"
1551 [(parallel [(call (match_operand 0 "" "")
1552 (match_operand 1 "" ""))
1553 (clobber (match_operand:SI 2 "" ""))])]
1557 (define_insn "call_internal1"
1558 [(call (mem (match_operand 0 "call_insn_operand" "ri"))
1559 (match_operand 1 "" "i"))
1560 (clobber (match_operand:SI 2 "register_operand" "=d"))]
1564 register rtx target = operands[0];
1566 if (GET_CODE (target) == CONST_INT)
1567 return \"li\\t%@,%0\\n\\tjalr\\t%2,%@\";
1568 else if (CONSTANT_ADDRESS_P (target))
1569 return \"jal\\t%0\";
1571 return \"jalr\\t%2,%0\";
1573 [(set_attr "type" "call")
1574 (set_attr "mode" "none")])
1576 ;; calls.c now passes a fourth argument, make saber happy
1578 (define_expand "call_value"
1579 [(parallel [(set (match_operand 0 "register_operand" "=d")
1580 (call (match_operand 1 "memory_operand" "m")
1581 (match_operand 2 "" "i")))
1582 (clobber (reg:SI 31))
1583 (use (match_operand 3 "" ""))])] ;; next_arg_reg
1589 if (operands[0]) /* eliminate unused code warning */
1591 addr = XEXP (operands[1], 0);
1592 if ((GET_CODE (addr) != REG && (!CONSTANT_ADDRESS_P (addr)))
1593 || ! call_insn_operand (addr, VOIDmode))
1594 XEXP (operands[1], 0) = copy_to_mode_reg (Pmode, addr);
1596 /* In order to pass small structures by value in registers
1597 compatibly with the IQ2000 compiler, we need to shift the value
1598 into the high part of the register. Function_arg has encoded
1599 a PARALLEL rtx, holding a vector of adjustments to be made
1600 as the next_arg_reg variable, so we split up the insns,
1601 and emit them separately. */
1603 if (operands[3] != (rtx)0 && GET_CODE (operands[3]) == PARALLEL)
1605 rtvec adjust = XVEC (operands[3], 0);
1606 int num = GET_NUM_ELEM (adjust);
1609 for (i = 0; i < num; i++)
1610 emit_insn (RTVEC_ELT (adjust, i));
1613 if (GET_CODE (operands[0]) == PARALLEL && XVECLEN (operands[0], 0) > 1)
1615 emit_call_insn (gen_call_value_multiple_internal0
1616 (XEXP (XVECEXP (operands[0], 0, 0), 0),
1617 operands[1], operands[2],
1618 XEXP (XVECEXP (operands[0], 0, 1), 0),
1619 gen_rtx_REG (SImode, GP_REG_FIRST + 31)));
1623 /* We have a call returning a DImode structure in an FP reg.
1624 Strip off the now unnecessary PARALLEL. */
1625 if (GET_CODE (operands[0]) == PARALLEL)
1626 operands[0] = XEXP (XVECEXP (operands[0], 0, 0), 0);
1628 emit_call_insn (gen_call_value_internal0 (operands[0], operands[1], operands[2],
1629 gen_rtx_REG (SImode,
1630 GP_REG_FIRST + 31)));
1636 (define_expand "call_value_internal0"
1637 [(parallel [(set (match_operand 0 "" "")
1638 (call (match_operand 1 "" "")
1639 (match_operand 2 "" "")))
1640 (clobber (match_operand:SI 3 "" ""))])]
1644 (define_insn "call_value_internal1"
1645 [(set (match_operand 0 "register_operand" "=d")
1646 (call (mem (match_operand 1 "call_insn_operand" "r"))
1647 (match_operand 2 "" "i")))
1648 (clobber (match_operand:SI 3 "register_operand" "=d"))]
1652 register rtx target = operands[1];
1654 if (GET_CODE (target) == CONST_INT)
1655 return \"li\\t%@,%1\\n\\tjalr\\t%3,%@\";
1656 else if (CONSTANT_ADDRESS_P (target))
1657 return \"jal\\t%1\";
1659 return \"jalr\\t%3,%1\";
1661 [(set_attr "type" "call")
1662 (set_attr "mode" "none")])
1664 (define_expand "call_value_multiple_internal0"
1665 [(parallel [(set (match_operand 0 "" "")
1666 (call (match_operand 1 "" "")
1667 (match_operand 2 "" "")))
1668 (set (match_operand 3 "" "")
1671 (clobber (match_operand:SI 4 "" ""))])]
1675 ;; ??? May eventually need all 6 versions of the call patterns with multiple
1678 (define_insn "call_value_multiple_internal1"
1679 [(set (match_operand 0 "register_operand" "=d")
1680 (call (mem (match_operand 1 "call_insn_operand" "r"))
1681 (match_operand 2 "" "i")))
1682 (set (match_operand 3 "register_operand" "=d")
1683 (call (mem (match_dup 1))
1685 (clobber (match_operand:SI 4 "register_operand" "=d"))]
1689 register rtx target = operands[1];
1691 if (GET_CODE (target) == CONST_INT)
1692 return \"li\\t%@,%1\\n\\tjalr\\t%4,%@\";
1693 else if (CONSTANT_ADDRESS_P (target))
1694 return \"jal\\t%1\";
1696 return \"jalr\\t%4,%1\";
1698 [(set_attr "type" "call")
1699 (set_attr "mode" "none")])
1701 ;; Call subroutine returning any type.
1703 (define_expand "untyped_call"
1704 [(parallel [(call (match_operand 0 "" "")
1706 (match_operand 1 "" "")
1707 (match_operand 2 "" "")])]
1711 if (operands[0]) /* silence statement not reached warnings */
1715 emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
1717 for (i = 0; i < XVECLEN (operands[2], 0); i++)
1719 rtx set = XVECEXP (operands[2], 0, i);
1720 emit_move_insn (SET_DEST (set), SET_SRC (set));
1723 emit_insn (gen_blockage ());
1729 ;; ....................
1733 ;; ....................
1740 [(set_attr "type" "nop")
1741 (set_attr "mode" "none")])
1744 ;; For the rare case where we need to load an address into a register
1745 ;; that cannot be recognized by the normal movsi/addsi instructions.
1746 ;; I have no idea how many insns this can actually generate. It should
1747 ;; be rare, so over-estimating as 10 instructions should not have any
1748 ;; real performance impact.
1749 (define_insn "leasi"
1750 [(set (match_operand:SI 0 "register_operand" "=d")
1751 (match_operand:SI 1 "address_operand" "p"))]
1757 xoperands[0] = operands[0];
1758 xoperands[1] = XEXP (operands[1], 0);
1759 xoperands[2] = XEXP (operands[1], 1);
1760 output_asm_insn (\"addiu\\t%0,%1,%2\", xoperands);
1763 [(set_attr "type" "arith")
1764 (set_attr "mode" "SI")
1765 (set_attr "length" "40")])
1767 (define_insn "ado16"
1768 [(set (match_operand:SI 0 "register_operand" "=r")
1769 (unspec:SI [(match_operand:SI 1 "register_operand" "r")
1770 (match_operand:SI 2 "register_operand" "r")]
1773 "ado16\\t%0, %1, %2"
1777 [(set (match_operand:SI 0 "register_operand" "=r")
1778 (unspec:SI [(match_operand:SI 1 "register_operand" "r")
1779 (match_operand:SI 2 "const_int_operand" "I")
1780 (match_operand:SI 3 "const_int_operand" "I")
1781 (match_operand:SI 4 "const_int_operand" "I")]
1784 "ram\\t%0, %1, %2, %3, %4"
1787 (define_insn "chkhdr"
1788 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "=r")
1789 (match_operand:SI 1 "register_operand" "r")]
1792 "* return iq2000_fill_delay_slot (\"chkhdr\\t%0, %1\", DELAY_LOAD, operands, insn);"
1793 [(set_attr "dslot" "not_in_dslot")]
1797 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
1798 (match_operand:SI 1 "register_operand" "r")]
1801 "* return iq2000_fill_delay_slot (\"pkrl\\t%0, %1\", DELAY_NONE, operands, insn);"
1802 [(set_attr "dslot" "not_in_dslot")]
1806 [(set (match_operand:SI 0 "register_operand" "=r")
1807 (unspec_volatile:SI [(match_operand:SI 1 "const_int_operand" "I")]
1810 "* return iq2000_fill_delay_slot (\"cfc0\\t%0, %%%1\", DELAY_LOAD, operands, insn);"
1811 [(set_attr "dslot" "ok_in_dslot")]
1815 [(set (match_operand:SI 0 "register_operand" "=r")
1816 (unspec_volatile:SI [(match_operand:SI 1 "const_int_operand" "I")]
1819 "* return iq2000_fill_delay_slot (\"cfc1\\t%0, %%%1\", DELAY_LOAD, operands, insn);"
1820 [(set_attr "dslot" "ok_in_dslot")]
1824 [(set (match_operand:SI 0 "register_operand" "=r")
1825 (unspec_volatile:SI [(match_operand:SI 1 "const_int_operand" "I")]
1828 "* return iq2000_fill_delay_slot (\"cfc2\\t%0, %%%1\", DELAY_LOAD, operands, insn);"
1829 [(set_attr "dslot" "not_in_dslot")]
1833 [(set (match_operand:SI 0 "register_operand" "=r")
1834 (unspec_volatile:SI [(match_operand:SI 1 "const_int_operand" "I")]
1837 "* return iq2000_fill_delay_slot (\"cfc3\\t%0, %%%1\", DELAY_LOAD, operands, insn);"
1838 [(set_attr "dslot" "not_in_dslot")]
1842 [(unspec_volatile:SI [(match_operand:SI 0 "reg_or_0_operand" "rJ")
1843 (match_operand:SI 1 "const_int_operand" "I")]
1846 "* return iq2000_fill_delay_slot (\"ctc0\\t%z0, %%%1\", DELAY_NONE, operands, insn);"
1847 [(set_attr "dslot" "ok_in_dslot")]
1851 [(unspec_volatile:SI [(match_operand:SI 0 "reg_or_0_operand" "rJ")
1852 (match_operand:SI 1 "const_int_operand" "I")]
1855 "* return iq2000_fill_delay_slot (\"ctc1\\t%z0, %%%1\", DELAY_NONE, operands, insn);"
1856 [(set_attr "dslot" "ok_in_dslot")]
1860 [(unspec_volatile:SI [(match_operand:SI 0 "reg_or_0_operand" "rJ")
1861 (match_operand:SI 1 "const_int_operand" "I")]
1864 "* return iq2000_fill_delay_slot (\"ctc2\\t%z0, %%%1\", DELAY_NONE, operands, insn);"
1865 [(set_attr "dslot" "ok_in_dslot")]
1869 [(unspec_volatile:SI [(match_operand:SI 0 "reg_or_0_operand" "rJ")
1870 (match_operand:SI 1 "const_int_operand" "I")]
1873 "* return iq2000_fill_delay_slot (\"ctc3\\t%z0, %%%1\", DELAY_NONE, operands, insn);"
1874 [(set_attr "dslot" "ok_in_dslot")]
1878 [(set (match_operand:SI 0 "register_operand" "=r")
1879 (unspec_volatile:SI [(match_operand:SI 1 "const_int_operand" "I")]
1882 "* return iq2000_fill_delay_slot (\"mfc0\\t%0, %%%1\", DELAY_LOAD, operands, insn);"
1883 [(set_attr "dslot" "ok_in_dslot")]
1887 [(set (match_operand:SI 0 "register_operand" "=r")
1888 (unspec_volatile:SI [(match_operand:SI 1 "const_int_operand" "I")]
1891 "* return iq2000_fill_delay_slot (\"mfc1\\t%0, %%%1\", DELAY_LOAD, operands, insn);"
1892 [(set_attr "dslot" "ok_in_dslot")]
1896 [(set (match_operand:SI 0 "register_operand" "=r")
1897 (unspec_volatile:SI [(match_operand:SI 1 "const_int_operand" "I")]
1900 "* return iq2000_fill_delay_slot (\"mfc2\\t%0, %%%1\", DELAY_LOAD, operands, insn);"
1901 [(set_attr "dslot" "not_in_dslot")]
1905 [(set (match_operand:SI 0 "register_operand" "=r")
1906 (unspec_volatile:SI [(match_operand:SI 1 "const_int_operand" "I")]
1909 "* return iq2000_fill_delay_slot (\"mfc3\\t%0, %%%1\", DELAY_LOAD, operands, insn);"
1910 [(set_attr "dslot" "not_in_dslot")]
1914 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
1915 (match_operand:SI 1 "const_int_operand" "I")]
1918 "* return iq2000_fill_delay_slot (\"mtc0\\t%0, %%%1\", DELAY_NONE, operands, insn);"
1919 [(set_attr "dslot" "ok_in_dslot")]
1923 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
1924 (match_operand:SI 1 "const_int_operand" "I")]
1927 "* return iq2000_fill_delay_slot (\"mtc1\\t%0, %%%1\", DELAY_NONE, operands, insn);"
1928 [(set_attr "dslot" "ok_in_dslot")]
1932 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
1933 (match_operand:SI 1 "const_int_operand" "I")]
1936 "* return iq2000_fill_delay_slot (\"mtc2\\t%0, %%%1\", DELAY_NONE, operands, insn);"
1937 [(set_attr "dslot" "ok_in_dslot")]
1941 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
1942 (match_operand:SI 1 "const_int_operand" "I")]
1945 "* return iq2000_fill_delay_slot (\"mtc3\\t%0, %%%1\", DELAY_NONE, operands, insn);"
1946 [(set_attr "dslot" "ok_in_dslot")]
1950 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
1951 (match_operand:SI 1 "register_operand" "r")]
1954 "* return iq2000_fill_delay_slot (\"lur\\t%0, %1\", DELAY_NONE, operands, insn);"
1955 [(set_attr "dslot" "not_in_dslot")]
1959 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
1960 (match_operand:SI 1 "register_operand" "r")]
1963 "* return iq2000_fill_delay_slot (\"rb\\t%0, %1\", DELAY_NONE, operands, insn);"
1964 [(set_attr "dslot" "not_in_dslot")]
1968 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
1969 (match_operand:SI 1 "register_operand" "r")]
1972 "* return iq2000_fill_delay_slot (\"rx\\t%0, %1\", DELAY_NONE, operands, insn);"
1973 [(set_attr "dslot" "not_in_dslot")]
1977 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")]
1980 "* return iq2000_fill_delay_slot (\"srrd\\t%0\", DELAY_NONE, operands, insn);"
1981 [(set_attr "dslot" "not_in_dslot")]
1985 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
1986 (match_operand:SI 1 "register_operand" "r")]
1989 "* return iq2000_fill_delay_slot (\"srwr\\t%0, %1\", DELAY_NONE, operands, insn);"
1990 [(set_attr "dslot" "not_in_dslot")]
1994 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
1995 (match_operand:SI 1 "register_operand" "r")]
1998 "* return iq2000_fill_delay_slot (\"wb\\t%0, %1\", DELAY_NONE, operands, insn);"
1999 [(set_attr "dslot" "not_in_dslot")]
2003 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
2004 (match_operand:SI 1 "register_operand" "r")]
2007 "* return iq2000_fill_delay_slot (\"wx\\t%0, %1\", DELAY_NONE, operands, insn);"
2008 [(set_attr "dslot" "not_in_dslot")]
2011 (define_insn "luc32"
2012 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
2013 (match_operand:SI 1 "register_operand" "r")]
2016 "* return iq2000_fill_delay_slot (\"luc32\\t%0, %1\", DELAY_NONE, operands, insn);"
2017 [(set_attr "dslot" "not_in_dslot")]
2020 (define_insn "luc32l"
2021 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
2022 (match_operand:SI 1 "register_operand" "r")]
2025 "* return iq2000_fill_delay_slot (\"luc32l\\t%0, %1\", DELAY_NONE, operands, insn);"
2026 [(set_attr "dslot" "not_in_dslot")]
2029 (define_insn "luc64"
2030 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
2031 (match_operand:SI 1 "register_operand" "r")]
2034 "* return iq2000_fill_delay_slot (\"luc64\\t%0, %1\", DELAY_NONE, operands, insn);"
2035 [(set_attr "dslot" "not_in_dslot")]
2038 (define_insn "luc64l"
2039 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
2040 (match_operand:SI 1 "register_operand" "r")]
2043 "* return iq2000_fill_delay_slot (\"luc64l\\t%0, %1\", DELAY_NONE, operands, insn);"
2044 [(set_attr "dslot" "not_in_dslot")]
2048 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
2049 (match_operand:SI 1 "register_operand" "r")]
2052 "* return iq2000_fill_delay_slot (\"luk\\t%0, %1\", DELAY_NONE, operands, insn);"
2053 [(set_attr "dslot" "ok_in_dslot")]
2056 (define_insn "lulck"
2057 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")]
2060 "* return iq2000_fill_delay_slot (\"lulck\\t%0\", DELAY_NONE, operands, insn);"
2061 [(set_attr "dslot" "not_in_dslot")]
2064 (define_insn "lum32"
2065 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
2066 (match_operand:SI 1 "register_operand" "r")]
2069 "* return iq2000_fill_delay_slot (\"lum32\\t%0, %1\", DELAY_NONE, operands, insn);"
2070 [(set_attr "dslot" "not_in_dslot")]
2073 (define_insn "lum32l"
2074 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
2075 (match_operand:SI 1 "register_operand" "r")]
2078 "* return iq2000_fill_delay_slot (\"lum32l\\t%0, %1\", DELAY_NONE, operands, insn);"
2079 [(set_attr "dslot" "not_in_dslot")]
2082 (define_insn "lum64"
2083 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
2084 (match_operand:SI 1 "register_operand" "r")]
2087 "* return iq2000_fill_delay_slot (\"lum64\\t%0, %1\", DELAY_NONE, operands, insn);"
2088 [(set_attr "dslot" "not_in_dslot")]
2091 (define_insn "lum64l"
2092 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
2093 (match_operand:SI 1 "register_operand" "r")]
2096 "* return iq2000_fill_delay_slot (\"lum64l\\t%0, %1\", DELAY_NONE, operands, insn);"
2097 [(set_attr "dslot" "not_in_dslot")]
2101 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
2102 (match_operand:SI 1 "register_operand" "r")]
2105 "* return iq2000_fill_delay_slot (\"lurl\\t%0, %1\", DELAY_NONE, operands, insn);"
2106 [(set_attr "dslot" "not_in_dslot")]
2110 [(set (match_operand:SI 0 "register_operand" "=r")
2111 (unspec_volatile:SI [(match_operand:SI 1 "register_operand" "r")
2112 (match_operand:SI 2 "register_operand" "r")
2113 (match_operand:SI 3 "const_int_operand" "I")]
2116 "* return iq2000_fill_delay_slot (\"mrgb\\t%0, %1, %2, %3\", DELAY_LOAD, operands, insn);"
2117 [(set_attr "dslot" "ok_in_dslot")]
2120 (define_insn "srrdl"
2121 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")]
2124 "* return iq2000_fill_delay_slot (\"srrdl\\t%0\", DELAY_NONE, operands, insn);"
2125 [(set_attr "dslot" "not_in_dslot")]
2128 (define_insn "srulck"
2129 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")]
2132 "* return iq2000_fill_delay_slot (\"srulck\\t%0\", DELAY_NONE, operands, insn);"
2133 [(set_attr "dslot" "not_in_dslot")]
2136 (define_insn "srwru"
2137 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
2138 (match_operand:SI 1 "register_operand" "r")]
2141 "* return iq2000_fill_delay_slot (\"srwru\\t%0, %1\", DELAY_NONE, operands, insn);"
2142 [(set_attr "dslot" "not_in_dslot")]
2145 (define_insn "trapqfl"
2146 [(unspec_volatile:SI [(const_int 1)] UNSPEC_TRAPQFL)]
2148 "* return iq2000_fill_delay_slot (\"trapqfl\", DELAY_NONE, operands, insn);"
2149 [(set_attr "dslot" "not_in_dslot")]
2152 (define_insn "trapqne"
2153 [(unspec_volatile:SI [(const_int 2)] UNSPEC_TRAPQNE)]
2155 "* return iq2000_fill_delay_slot (\"trapqne\", DELAY_NONE, operands, insn);"
2156 [(set_attr "dslot" "not_in_dslot")]
2159 (define_insn "traprel"
2160 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")]
2163 "* return iq2000_fill_delay_slot (\"traprel %0\", DELAY_NONE, operands, insn);"
2164 [(set_attr "dslot" "not_in_dslot")]
2168 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
2169 (match_operand:SI 1 "register_operand" "r")]
2172 "* return iq2000_fill_delay_slot (\"wbu\\t%0, %1\", DELAY_NONE, operands, insn);"
2173 [(set_attr "dslot" "not_in_dslot")]
2176 (define_insn "syscall"
2177 [(unspec_volatile:SI [(const_int 2)] UNSPEC_SYSCALL)]
2180 [(set_attr "dslot" "not_in_dslot")]