1 ;; iq2000.md Machine Description for Vitesse IQ2000 processors
2 ;; Copyright (C) 2003-2015 Free Software Foundation, Inc.
4 ;; This file is part of GCC.
6 ;; GCC is free software; you can redistribute it and/or modify
7 ;; it under the terms of the GNU General Public License as published by
8 ;; the Free Software Foundation; either version 3, or (at your option)
11 ;; GCC is distributed in the hope that it will be useful,
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;; GNU General Public License for more details.
16 ;; You should have received a copy of the GNU General Public License
17 ;; along with GCC; see the file COPYING3. If not see
18 ;; <http://www.gnu.org/licenses/>.
69 ;; UNSPEC values used in iq2000.md
72 ;; 1 movsi_us, get_fnaddr
74 ;; 20 builtin_setjmp_setup
76 ;; UNSPEC_VOLATILE values
80 ;; 4 exception_receiver
92 ;; ....................
96 ;; ....................
98 ;; Classification of each insn.
99 ;; branch conditional branch
100 ;; jump unconditional jump
101 ;; call unconditional call
102 ;; load load instruction(s)
103 ;; store store instruction(s)
104 ;; move data movement within same register set
105 ;; xfer transfer to/from coprocessor
106 ;; arith integer arithmetic instruction
107 ;; darith double precision integer arithmetic instructions
108 ;; imul integer multiply
109 ;; idiv integer divide
110 ;; icmp integer compare
111 ;; fadd floating point add/subtract
112 ;; fmul floating point multiply
113 ;; fmadd floating point multiply-add
114 ;; fdiv floating point divide
115 ;; fabs floating point absolute value
116 ;; fneg floating point negation
117 ;; fcmp floating point compare
118 ;; fcvt floating point convert
119 ;; fsqrt floating point square root
120 ;; multi multiword sequence (or user asm statements)
124 "unknown,branch,jump,call,load,store,move,xfer,arith,darith,imul,idiv,icmp,fadd,fmul,fmadd,fdiv,fabs,fneg,fcmp,fcvt,fsqrt,multi,nop"
125 (const_string "unknown"))
127 ;; Main data type used by the insn
128 (define_attr "mode" "unknown,none,QI,HI,SI,DI,SF,DF,FPSW" (const_string "unknown"))
130 ;; Length (in # of bytes). A conditional branch is allowed only to a
131 ;; location within a signed 18-bit offset of the delay slot. If that
132 ;; provides too small a range, we use the `j' instruction. This
133 ;; instruction takes a 28-bit value, but that value is not an offset.
134 ;; Instead, it's bitwise-ored with the high-order four bits of the
135 ;; instruction in the delay slot, which means it cannot be used to
136 ;; cross a 256MB boundary. We could fall back back on the jr,
137 ;; instruction which allows full access to the entire address space,
138 ;; but we do not do so at present.
140 (define_attr "length" ""
141 (cond [(eq_attr "type" "branch")
142 (cond [(lt (abs (minus (match_dup 1) (plus (pc) (const_int 4))))
150 (const (symbol_ref "iq2000_cpu_attr")))
152 ;; Does the instruction have a mandatory delay slot? has_dslot
153 ;; Can the instruction be in a delay slot? ok_in_dslot
154 ;; Can the instruction not be in a delay slot? not_in_dslot
155 (define_attr "dslot" "has_dslot,ok_in_dslot,not_in_dslot"
156 (if_then_else (eq_attr "type" "branch,jump,call,xfer,fcmp")
157 (const_string "has_dslot")
158 (const_string "ok_in_dslot")))
160 ;; Attribute defining whether or not we can use the branch-likely instructions
162 (define_attr "branch_likely" "no,yes"
164 (if_then_else (match_test "GENERATE_BRANCHLIKELY")
166 (const_string "no"))))
169 ;; Describe a user's asm statement.
170 (define_asm_attributes
171 [(set_attr "type" "multi")])
175 ;; .........................
177 ;; Delay slots, can't describe load/fcmp/xfer delay slots here
179 ;; .........................
181 (define_delay (eq_attr "type" "jump")
182 [(and (eq_attr "dslot" "ok_in_dslot") (eq_attr "length" "4"))
186 (define_delay (eq_attr "type" "branch")
187 [(and (eq_attr "dslot" "ok_in_dslot") (eq_attr "length" "4"))
189 (and (eq_attr "branch_likely" "yes") (and (eq_attr "dslot" "ok_in_dslot") (eq_attr "length" "4")))])
191 (define_delay (eq_attr "type" "call")
192 [(and (eq_attr "dslot" "ok_in_dslot") (eq_attr "length" "4"))
196 (include "predicates.md")
197 (include "constraints.md")
200 ;; .........................
204 ;; .........................
206 (define_automaton "iq2000")
207 (define_cpu_unit "core,memory" "iq2000")
209 (define_insn_reservation "nonmemory" 1
210 (eq_attr "type" "!load,move,store,xfer")
213 (define_insn_reservation "iq2000_load_move" 3
214 (and (eq_attr "type" "load,move")
215 (eq_attr "cpu" "iq2000"))
218 (define_insn_reservation "other_load_move" 1
219 (and (eq_attr "type" "load,move")
220 (eq_attr "cpu" "!iq2000"))
223 (define_insn_reservation "store" 1
224 (eq_attr "type" "store")
227 (define_insn_reservation "xfer" 2
228 (eq_attr "type" "xfer")
232 ;; ....................
236 ;; ....................
240 [(trap_if (const_int 1) (const_int 0))]
248 ;; ....................
252 ;; ....................
255 (define_expand "addsi3"
256 [(set (match_operand:SI 0 "register_operand" "=d")
257 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
258 (match_operand:SI 2 "arith_operand" "dI")))]
262 (define_insn "addsi3_internal"
263 [(set (match_operand:SI 0 "register_operand" "=d,d")
264 (plus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ,dJ")
265 (match_operand:SI 2 "arith_operand" "d,I")))]
270 [(set_attr "type" "arith")
271 (set_attr "mode" "SI")])
274 ;; ....................
278 ;; ....................
281 (define_expand "subsi3"
282 [(set (match_operand:SI 0 "register_operand" "=d")
283 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ")
284 (match_operand:SI 2 "arith_operand" "dI")))]
288 (define_insn "subsi3_internal"
289 [(set (match_operand:SI 0 "register_operand" "=d,d")
290 (minus:SI (match_operand:SI 1 "reg_or_0_operand" "dJ,dJ")
291 (match_operand:SI 2 "arith_operand" "d,I")))]
296 [(set_attr "type" "arith")
297 (set_attr "mode" "SI")])
300 ;; ....................
302 ;; NEGATION and ONE'S COMPLEMENT
304 ;; ....................
306 (define_insn "negsi2"
307 [(set (match_operand:SI 0 "register_operand" "=d")
308 (neg:SI (match_operand:SI 1 "register_operand" "d")))]
312 operands[2] = const0_rtx;
313 return \"subu\\t%0,%z2,%1\";
315 [(set_attr "type" "arith")
316 (set_attr "mode" "SI")])
318 (define_insn "one_cmplsi2"
319 [(set (match_operand:SI 0 "register_operand" "=d")
320 (not:SI (match_operand:SI 1 "register_operand" "d")))]
324 operands[2] = const0_rtx;
325 return \"nor\\t%0,%z2,%1\";
327 [(set_attr "type" "arith")
328 (set_attr "mode" "SI")])
331 ;; ....................
335 ;; ....................
338 (define_expand "andsi3"
339 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
340 (and:SI (match_operand:SI 1 "uns_arith_operand" "%d,d,d")
341 (match_operand:SI 2 "nonmemory_operand" "d,K,N")))]
346 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
347 (and:SI (match_operand:SI 1 "uns_arith_operand" "%d,d,d")
348 (match_operand:SI 2 "nonmemory_operand" "d,K,N")))]
352 if (which_alternative == 0)
353 return \"and\\t%0,%1,%2\";
354 else if (which_alternative == 1)
355 return \"andi\\t%0,%1,%x2\";
356 else if (which_alternative == 2)
358 if ((INTVAL (operands[2]) & 0xffff) == 0xffff)
360 operands[2] = GEN_INT (INTVAL (operands[2]) >> 16);
361 return \"andoui\\t%0,%1,%x2\";
365 operands[2] = GEN_INT (INTVAL (operands[2]) & 0xffff);
366 return \"andoi\\t%0,%1,%x2\";
372 [(set_attr "type" "arith")
373 (set_attr "mode" "SI")])
375 (define_expand "iorsi3"
376 [(set (match_operand:SI 0 "register_operand" "=d,d")
377 (ior:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
378 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
383 [(set (match_operand:SI 0 "register_operand" "=d,d")
384 (ior:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
385 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
390 [(set_attr "type" "arith")
391 (set_attr "mode" "SI")])
393 (define_expand "xorsi3"
394 [(set (match_operand:SI 0 "register_operand" "=d,d")
395 (xor:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
396 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
401 [(set (match_operand:SI 0 "register_operand" "=d,d")
402 (xor:SI (match_operand:SI 1 "uns_arith_operand" "%d,d")
403 (match_operand:SI 2 "uns_arith_operand" "d,K")))]
408 [(set_attr "type" "arith")
409 (set_attr "mode" "SI")])
411 (define_insn "*norsi3"
412 [(set (match_operand:SI 0 "register_operand" "=d")
413 (and:SI (not:SI (match_operand:SI 1 "register_operand" "d"))
414 (not:SI (match_operand:SI 2 "register_operand" "d"))))]
417 [(set_attr "type" "arith")
418 (set_attr "mode" "SI")])
421 ;; ....................
425 ;; ....................
428 ;; Those for integer source operand are ordered widest source type first.
430 (define_expand "zero_extendhisi2"
431 [(set (match_operand:SI 0 "register_operand" "")
432 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
437 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
438 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "d,R,m")))]
442 if (which_alternative == 0)
443 return \"andi\\t%0,%1,0xffff\";
445 return iq2000_move_1word (operands, insn, TRUE);
447 [(set_attr "type" "arith,load,load")
448 (set_attr "mode" "SI")
449 (set_attr "length" "4,4,8")])
451 (define_expand "zero_extendqihi2"
452 [(set (match_operand:HI 0 "register_operand" "")
453 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))]
458 [(set (match_operand:HI 0 "register_operand" "=d,d,d")
459 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "d,R,m")))]
463 if (which_alternative == 0)
464 return \"andi\\t%0,%1,0x00ff\";
466 return iq2000_move_1word (operands, insn, TRUE);
468 [(set_attr "type" "arith,load,load")
469 (set_attr "mode" "HI")
470 (set_attr "length" "4,4,8")])
472 (define_expand "zero_extendqisi2"
473 [(set (match_operand:SI 0 "register_operand" "")
474 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
479 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
480 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "d,R,m")))]
484 if (which_alternative == 0)
485 return \"andi\\t%0,%1,0x00ff\";
487 return iq2000_move_1word (operands, insn, TRUE);
489 [(set_attr "type" "arith,load,load")
490 (set_attr "mode" "SI")
491 (set_attr "length" "4,4,8")])
494 ;; ....................
498 ;; ....................
501 ;; Those for integer source operand are ordered widest source type first.
503 ;; These patterns originally accepted general_operands, however, slightly
504 ;; better code is generated by only accepting register_operands, and then
505 ;; letting combine generate the lh and lb insns.
507 (define_expand "extendhisi2"
508 [(set (match_operand:SI 0 "register_operand" "")
509 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "")))]
513 if (optimize && GET_CODE (operands[1]) == MEM)
514 operands[1] = force_not_mem (operands[1]);
516 if (GET_CODE (operands[1]) != MEM)
518 rtx op1 = gen_lowpart (SImode, operands[1]);
519 rtx temp = gen_reg_rtx (SImode);
520 rtx shift = GEN_INT (16);
522 emit_insn (gen_ashlsi3 (temp, op1, shift));
523 emit_insn (gen_ashrsi3 (operands[0], temp, shift));
528 (define_insn "extendhisi2_internal"
529 [(set (match_operand:SI 0 "register_operand" "=d,d")
530 (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,m")))]
532 "* return iq2000_move_1word (operands, insn, FALSE);"
533 [(set_attr "type" "load")
534 (set_attr "mode" "SI")
535 (set_attr "length" "4,8")])
537 (define_expand "extendqihi2"
538 [(set (match_operand:HI 0 "register_operand" "")
539 (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "")))]
543 if (optimize && GET_CODE (operands[1]) == MEM)
544 operands[1] = force_not_mem (operands[1]);
546 if (GET_CODE (operands[1]) != MEM)
548 rtx op0 = gen_lowpart (SImode, operands[0]);
549 rtx op1 = gen_lowpart (SImode, operands[1]);
550 rtx temp = gen_reg_rtx (SImode);
551 rtx shift = GEN_INT (24);
553 emit_insn (gen_ashlsi3 (temp, op1, shift));
554 emit_insn (gen_ashrsi3 (op0, temp, shift));
559 (define_insn "extendqihi2_internal"
560 [(set (match_operand:HI 0 "register_operand" "=d,d")
561 (sign_extend:HI (match_operand:QI 1 "memory_operand" "R,m")))]
563 "* return iq2000_move_1word (operands, insn, FALSE);"
564 [(set_attr "type" "load")
565 (set_attr "mode" "SI")
566 (set_attr "length" "4,8")])
569 (define_expand "extendqisi2"
570 [(set (match_operand:SI 0 "register_operand" "")
571 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
575 if (optimize && GET_CODE (operands[1]) == MEM)
576 operands[1] = force_not_mem (operands[1]);
578 if (GET_CODE (operands[1]) != MEM)
580 rtx op1 = gen_lowpart (SImode, operands[1]);
581 rtx temp = gen_reg_rtx (SImode);
582 rtx shift = GEN_INT (24);
584 emit_insn (gen_ashlsi3 (temp, op1, shift));
585 emit_insn (gen_ashrsi3 (operands[0], temp, shift));
590 (define_insn "extendqisi2_insn"
591 [(set (match_operand:SI 0 "register_operand" "=d,d")
592 (sign_extend:SI (match_operand:QI 1 "memory_operand" "R,m")))]
594 "* return iq2000_move_1word (operands, insn, FALSE);"
595 [(set_attr "type" "load")
596 (set_attr "mode" "SI")
597 (set_attr "length" "4,8")])
600 ;; ........................
602 ;; BIT FIELD EXTRACTION
604 ;; ........................
607 [(set (match_operand:SI 0 "register_operand" "=r")
608 (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
609 (match_operand:SI 2 "const_int_operand" "O")
610 (match_operand:SI 3 "const_int_operand" "O")))]
615 value[2] = INTVAL (operands[2]);
616 value[3] = INTVAL (operands[3]);
617 operands[2] = GEN_INT ((value[3]));
618 operands[3] = GEN_INT ((32 - value[2]));
619 return \"ram\\t%0,%1,%2,%3,0x0\";
621 [(set_attr "type" "arith")])
624 ;; ....................
628 ;; ....................
630 /* Take care of constants that don't fit in single instruction */
632 [(set (match_operand:SI 0 "register_operand" "")
633 (match_operand:SI 1 "general_operand" ""))]
634 "(reload_in_progress || reload_completed)
635 && large_int (operands[1], SImode)"
638 (high:SI (match_dup 1)))
640 (lo_sum:SI (match_dup 0)
644 ;; ??? iq2000_move_1word has support for HIGH, so this pattern may be
648 [(set (match_operand:SI 0 "register_operand" "=r")
649 (high:SI (match_operand:SI 1 "immediate_operand" "")))]
651 "lui\\t%0,%%hi(%1) # high"
652 [(set_attr "type" "move")])
655 [(set (match_operand:SI 0 "register_operand" "=r")
656 (lo_sum:SI (match_operand:SI 1 "register_operand" "r")
657 (match_operand:SI 2 "immediate_operand" "")))]
659 "addiu\\t%0,%1,%%lo(%2) # low"
660 [(set_attr "type" "arith")
661 (set_attr "mode" "SI")])
663 ;; 32-bit Integer moves
666 [(set (match_operand:SI 0 "register_operand" "")
667 (match_operand:SI 1 "large_int" ""))]
668 "reload_in_progress | reload_completed"
672 (ior:SI (match_dup 0)
676 operands[2] = GEN_INT (trunc_int_for_mode (INTVAL (operands[1])
679 operands[3] = GEN_INT (INTVAL (operands[1]) & BITMASK_LOWER16);
682 ;; Unlike most other insns, the move insns can't be split with
683 ;; different predicates, because register spilling and other parts of
684 ;; the compiler, have memoized the insn number already.
686 (define_expand "movsi"
687 [(set (match_operand:SI 0 "nonimmediate_operand" "")
688 (match_operand:SI 1 "general_operand" ""))]
692 if (iq2000_check_split (operands[1], SImode))
694 machine_mode mode = GET_MODE (operands[0]);
695 rtx tem = ((reload_in_progress | reload_completed)
696 ? operands[0] : gen_reg_rtx (mode));
698 emit_insn (gen_rtx_SET (tem, gen_rtx_HIGH (mode, operands[1])));
700 operands[1] = gen_rtx_LO_SUM (mode, tem, operands[1]);
703 if ((reload_in_progress | reload_completed) == 0
704 && !register_operand (operands[0], SImode)
705 && !register_operand (operands[1], SImode)
706 && (GET_CODE (operands[1]) != CONST_INT
707 || INTVAL (operands[1]) != 0))
709 rtx temp = force_reg (SImode, operands[1]);
710 emit_move_insn (operands[0], temp);
714 /* Take care of constants that don't fit in single instruction */
715 if ((reload_in_progress || reload_completed)
716 && CONSTANT_P (operands[1])
717 && GET_CODE (operands[1]) != HIGH
718 && GET_CODE (operands[1]) != LO_SUM
719 && ! SMALL_INT_UNSIGNED (operands[1]))
721 rtx tem = ((reload_in_progress | reload_completed)
722 ? operands[0] : gen_reg_rtx (SImode));
724 emit_insn (gen_rtx_SET (tem, gen_rtx_HIGH (SImode, operands[1])));
725 operands[1] = gen_rtx_LO_SUM (SImode, tem, operands[1]);
729 ;; The difference between these two is whether or not ints are allowed
730 ;; in FP registers (off by default, use -mdebugh to enable).
732 (define_insn "movsi_internal2"
733 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d,R,m")
734 (match_operand:SI 1 "move_operand" "d,IKL,Mnis,R,m,dJ,dJ"))]
735 "(register_operand (operands[0], SImode)
736 || register_operand (operands[1], SImode)
737 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
738 "* return iq2000_move_1word (operands, insn, FALSE);"
739 [(set_attr "type" "move,arith,arith,load,load,store,store")
740 (set_attr "mode" "SI")
741 (set_attr "length" "4,4,8,8,8,4,8")])
743 ;; 16-bit Integer moves
745 ;; Unlike most other insns, the move insns can't be split with
746 ;; different predicates, because register spilling and other parts of
747 ;; the compiler, have memoized the insn number already.
748 ;; Unsigned loads are used because BYTE_LOADS_ZERO_EXTEND is defined
750 (define_expand "movhi"
751 [(set (match_operand:HI 0 "nonimmediate_operand" "")
752 (match_operand:HI 1 "general_operand" ""))]
756 if ((reload_in_progress | reload_completed) == 0
757 && !register_operand (operands[0], HImode)
758 && !register_operand (operands[1], HImode)
759 && ((GET_CODE (operands[1]) != CONST_INT
760 || INTVAL (operands[1]) != 0)))
762 rtx temp = force_reg (HImode, operands[1]);
763 emit_move_insn (operands[0], temp);
768 ;; The difference between these two is whether or not ints are allowed
769 ;; in FP registers (off by default, use -mdebugh to enable).
771 (define_insn "movhi_internal2"
772 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,d,R,m")
773 (match_operand:HI 1 "general_operand" "d,IK,R,m,dJ,dJ"))]
774 "(register_operand (operands[0], HImode)
775 || register_operand (operands[1], HImode)
776 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
777 "* return iq2000_move_1word (operands, insn, TRUE);"
778 [(set_attr "type" "move,arith,load,load,store,store")
779 (set_attr "mode" "HI")
780 (set_attr "length" "4,4,4,8,4,8")])
782 ;; 8-bit Integer moves
784 ;; Unlike most other insns, the move insns can't be split with
785 ;; different predicates, because register spilling and other parts of
786 ;; the compiler, have memoized the insn number already.
787 ;; Unsigned loads are used because BYTE_LOADS_ZERO_EXTEND is defined
789 (define_expand "movqi"
790 [(set (match_operand:QI 0 "nonimmediate_operand" "")
791 (match_operand:QI 1 "general_operand" ""))]
795 if ((reload_in_progress | reload_completed) == 0
796 && !register_operand (operands[0], QImode)
797 && !register_operand (operands[1], QImode)
798 && (GET_CODE (operands[1]) != CONST_INT
799 || INTVAL (operands[1]) != 0))
801 rtx temp = force_reg (QImode, operands[1]);
802 emit_move_insn (operands[0], temp);
807 ;; The difference between these two is whether or not ints are allowed
808 ;; in FP registers (off by default, use -mdebugh to enable).
810 (define_insn "movqi_internal2"
811 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,d,R,m")
812 (match_operand:QI 1 "general_operand" "d,IK,R,m,dJ,dJ"))]
813 "(register_operand (operands[0], QImode)
814 || register_operand (operands[1], QImode)
815 || (GET_CODE (operands[1]) == CONST_INT && INTVAL (operands[1]) == 0))"
816 "* return iq2000_move_1word (operands, insn, TRUE);"
817 [(set_attr "type" "move,arith,load,load,store,store")
818 (set_attr "mode" "QI")
819 (set_attr "length" "4,4,4,8,4,8")])
821 ;; 32-bit floating point moves
823 (define_expand "movsf"
824 [(set (match_operand:SF 0 "general_operand" "")
825 (match_operand:SF 1 "general_operand" ""))]
829 if (!reload_in_progress
831 && GET_CODE (operands[0]) == MEM
832 && (GET_CODE (operands[1]) == MEM
833 || GET_CODE (operands[1]) == CONST_DOUBLE))
834 operands[1] = copy_to_mode_reg (SFmode, operands[1]);
836 /* Take care of reg <- SF constant */
837 if ( const_double_operand (operands[1], GET_MODE (operands[1]) ) )
839 emit_insn (gen_movsf_high (operands[0], operands[1]));
840 emit_insn (gen_movsf_lo_sum (operands[0], operands[0], operands[1]));
845 (define_insn "movsf_lo_sum"
846 [(set (match_operand:SF 0 "register_operand" "=r")
847 (lo_sum:SF (match_operand:SF 1 "register_operand" "r")
848 (match_operand:SF 2 "const_double_operand" "")))]
855 REAL_VALUE_FROM_CONST_DOUBLE (r, operands[2]);
856 REAL_VALUE_TO_TARGET_SINGLE (r, i);
857 operands[2] = GEN_INT (i);
858 return \"addiu\\t%0,%1,%%lo(%2) # low\";
860 [(set_attr "length" "4")
861 (set_attr "type" "arith")])
863 (define_insn "movsf_high"
864 [(set (match_operand:SF 0 "register_operand" "=r")
865 (high:SF (match_operand:SF 1 "const_double_operand" "")))]
872 REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
873 REAL_VALUE_TO_TARGET_SINGLE (r, i);
874 operands[1] = GEN_INT (i);
875 return \"lui\\t%0,%%hi(%1) # high\";
877 [(set_attr "length" "4")
878 (set_attr "type" "arith")])
880 (define_insn "*movsf_internal"
881 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,r,m")
882 (match_operand:SF 1 "nonimmediate_operand" "r,m,r"))]
883 "!memory_operand (operands[0], SFmode) || !memory_operand (operands[1], SFmode)"
886 iq2000_fill_delay_slot (\"\", DELAY_LOAD, operands, insn);
887 if (which_alternative == 0)
888 return \"or\\t%0,%1,%1\";
889 else if (which_alternative == 1)
890 return \"lw\\t%0,%1\";
891 else if (which_alternative == 2)
892 return \"sw\\t%1,%0\";
896 [(set_attr "length" "4,4,4")
897 (set_attr "type" "arith,load,store")]
901 ;; ....................
905 ;; ....................
907 (define_expand "ashlsi3"
908 [(set (match_operand:SI 0 "register_operand" "=d")
909 (ashift:SI (match_operand:SI 1 "register_operand" "d")
910 (match_operand:SI 2 "arith_operand" "dI")))]
914 (define_insn "ashlsi3_internal1"
915 [(set (match_operand:SI 0 "register_operand" "=d")
916 (ashift:SI (match_operand:SI 1 "register_operand" "d")
917 (match_operand:SI 2 "arith_operand" "dI")))]
921 if (GET_CODE (operands[2]) == CONST_INT)
923 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
924 return \"sll\\t%0,%1,%2\";
927 return \"sllv\\t%0,%1,%2\";
929 [(set_attr "type" "arith")
930 (set_attr "mode" "SI")])
932 (define_expand "ashrsi3"
933 [(set (match_operand:SI 0 "register_operand" "=d")
934 (ashiftrt:SI (match_operand:SI 1 "register_operand" "d")
935 (match_operand:SI 2 "arith_operand" "dI")))]
939 (define_insn "ashrsi3_internal1"
940 [(set (match_operand:SI 0 "register_operand" "=d")
941 (ashiftrt:SI (match_operand:SI 1 "register_operand" "d")
942 (match_operand:SI 2 "arith_operand" "dI")))]
946 if (GET_CODE (operands[2]) == CONST_INT)
948 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
949 return \"sra\\t%0,%1,%2\";
952 return \"srav\\t%0,%1,%2\";
954 [(set_attr "type" "arith")
955 (set_attr "mode" "SI")])
957 (define_expand "lshrsi3"
958 [(set (match_operand:SI 0 "register_operand" "=d")
959 (lshiftrt:SI (match_operand:SI 1 "register_operand" "d")
960 (match_operand:SI 2 "arith_operand" "dI")))]
964 (define_insn "lshrsi3_internal1"
965 [(set (match_operand:SI 0 "register_operand" "=d")
966 (lshiftrt:SI (match_operand:SI 1 "register_operand" "d")
967 (match_operand:SI 2 "arith_operand" "dI")))]
971 if (GET_CODE (operands[2]) == CONST_INT)
973 operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
974 return \"srl\\t%0,%1,%2\";
977 return \"srlv\\t%0,%1,%2\";
979 [(set_attr "type" "arith")
980 (set_attr "mode" "SI")])
983 (define_insn "rotrsi3"
984 [(set (match_operand:SI 0 "register_operand" "=r")
985 (rotatert:SI (match_operand:SI 1 "register_operand" "r")
986 (match_operand:SI 2 "uns_arith_operand" "O")))]
988 "ram %0,%1,%2,0x0,0x0"
989 [(set_attr "type" "arith")])
993 ;; ....................
995 ;; CONDITIONAL BRANCHES
997 ;; ....................
999 (define_expand "cbranchsi4"
1002 (match_operator 0 "ordered_comparison_operator"
1003 [(match_operand:SI 1 "register_operand")
1004 (match_operand:SI 2 "reg_or_const_operand")])
1005 (label_ref (match_operand 3 ""))
1010 gen_conditional_branch (operands, SImode);
1015 ;; Conditional branches on comparisons with zero.
1017 (define_insn "branch_zero"
1020 (match_operator 0 "cmp_op"
1021 [(match_operand:SI 2 "register_operand" "d")
1023 (label_ref (match_operand 1 "" ""))
1028 return iq2000_output_conditional_branch (insn,
1030 /*two_operands_p=*/0,
1033 get_attr_length (insn));
1035 [(set_attr "type" "branch")
1036 (set_attr "mode" "none")])
1038 (define_insn "branch_zero_inverted"
1041 (match_operator 0 "cmp_op"
1042 [(match_operand:SI 2 "register_operand" "d")
1045 (label_ref (match_operand 1 "" ""))))]
1049 return iq2000_output_conditional_branch (insn,
1051 /*two_operands_p=*/0,
1054 get_attr_length (insn));
1056 [(set_attr "type" "branch")
1057 (set_attr "mode" "none")])
1059 ;; Conditional branch on equality comparison.
1061 (define_insn "branch_equality"
1064 (match_operator 0 "equality_op"
1065 [(match_operand:SI 2 "register_operand" "d")
1066 (match_operand:SI 3 "register_operand" "d")])
1067 (label_ref (match_operand 1 "" ""))
1072 return iq2000_output_conditional_branch (insn,
1074 /*two_operands_p=*/1,
1077 get_attr_length (insn));
1079 [(set_attr "type" "branch")
1080 (set_attr "mode" "none")])
1082 (define_insn "branch_equality_inverted"
1085 (match_operator 0 "equality_op"
1086 [(match_operand:SI 2 "register_operand" "d")
1087 (match_operand:SI 3 "register_operand" "d")])
1089 (label_ref (match_operand 1 "" ""))))]
1093 return iq2000_output_conditional_branch (insn,
1095 /*two_operands_p=*/1,
1098 get_attr_length (insn));
1100 [(set_attr "type" "branch")
1101 (set_attr "mode" "none")])
1104 ;; Recognize bbi and bbin instructions. These use two unusual template
1105 ;; patterns, %Ax and %Px. %Ax outputs an 'i' if operand `x' is a LABEL_REF
1106 ;; otherwise it outputs an 'in'. %Px does nothing if `x' is PC
1107 ;; and outputs the operand if `x' is a LABEL_REF.
1112 (ne (sign_extract:SI (match_operand:SI 0 "register_operand" "r")
1114 (match_operand:SI 1 "arith_operand" "I"))
1116 (match_operand 2 "pc_or_label_operand" "")
1117 (match_operand 3 "pc_or_label_operand" "")))]
1119 "bb%A2\\t%0(31-%1),%P2%P3"
1120 [(set_attr "length" "4")
1121 (set_attr "type" "branch")])
1126 (eq (sign_extract:SI (match_operand:SI 0 "register_operand" "r")
1128 (match_operand:SI 1 "arith_operand" "I"))
1130 (match_operand 2 "pc_or_label_operand" "")
1131 (match_operand 3 "pc_or_label_operand" "")))]
1133 "bb%A3\\t%0(31-%1),%P2%P3"
1134 [(set_attr "length" "4")
1135 (set_attr "type" "branch")])
1140 (ne (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1142 (match_operand:SI 1 "arith_operand" "I"))
1144 (match_operand 2 "pc_or_label_operand" "")
1145 (match_operand 3 "pc_or_label_operand" "")))]
1147 "bb%A2\\t%0(31-%1),%P2%P3"
1148 [(set_attr "length" "4")
1149 (set_attr "type" "branch")])
1154 (eq (zero_extract:SI (match_operand:SI 0 "register_operand" "r")
1156 (match_operand:SI 1 "arith_operand" "I"))
1158 (match_operand 2 "pc_or_label_operand" "")
1159 (match_operand 3 "pc_or_label_operand" "")))]
1161 "bb%A3\\t%0(31-%1),%P2%P3"
1162 [(set_attr "length" "4")
1163 (set_attr "type" "branch")])
1168 (eq (and:SI (match_operand:SI 0 "register_operand" "r")
1169 (match_operand:SI 1 "power_of_2_operand" "I"))
1171 (match_operand 2 "pc_or_label_operand" "")
1172 (match_operand 3 "pc_or_label_operand" "")))]
1174 "bb%A3\\t%0(%p1),%P2%P3"
1175 [(set_attr "length" "4")
1176 (set_attr "type" "branch")])
1181 (ne (and:SI (match_operand:SI 0 "register_operand" "r")
1182 (match_operand:SI 1 "power_of_2_operand" "I"))
1184 (match_operand 2 "pc_or_label_operand" "")
1185 (match_operand 3 "pc_or_label_operand" "")))]
1187 "bb%A2\\t%0(%p1),%P2%P3"
1188 [(set_attr "length" "4")
1189 (set_attr "type" "branch")])
1192 ;; ....................
1194 ;; SETTING A REGISTER FROM A COMPARISON
1196 ;; ....................
1198 (define_expand "cstoresi4"
1199 [(set (match_operand:SI 0 "register_operand" "=d")
1200 (match_operator:SI 1 "ordered_comparison_operator"
1201 [(match_operand:SI 2 "register_operand")
1202 (match_operand:SI 3 "reg_or_const_operand")]))]
1206 gen_int_relational (GET_CODE (operands[1]), operands[0],
1207 operands[2], operands[3], (int *)0);
1211 (define_insn "seq_si_zero"
1212 [(set (match_operand:SI 0 "register_operand" "=d")
1213 (eq:SI (match_operand:SI 1 "register_operand" "d")
1217 [(set_attr "type" "arith")
1218 (set_attr "mode" "SI")])
1220 (define_insn "sne_si_zero"
1221 [(set (match_operand:SI 0 "register_operand" "=d")
1222 (ne:SI (match_operand:SI 1 "register_operand" "d")
1226 [(set_attr "type" "arith")
1227 (set_attr "mode" "SI")])
1229 (define_insn "sgt_si"
1230 [(set (match_operand:SI 0 "register_operand" "=d,d")
1231 (gt:SI (match_operand:SI 1 "register_operand" "d,d")
1232 (match_operand:SI 2 "reg_or_0_operand" "d,J")))]
1237 [(set_attr "type" "arith,arith")
1238 (set_attr "mode" "SI,SI")])
1240 (define_insn "slt_si"
1241 [(set (match_operand:SI 0 "register_operand" "=d,d")
1242 (lt:SI (match_operand:SI 1 "register_operand" "d,d")
1243 (match_operand:SI 2 "arith_operand" "d,I")))]
1248 [(set_attr "type" "arith,arith")
1249 (set_attr "mode" "SI,SI")])
1251 (define_insn "sle_si_const"
1252 [(set (match_operand:SI 0 "register_operand" "=d")
1253 (le:SI (match_operand:SI 1 "register_operand" "d")
1254 (match_operand:SI 2 "small_int" "I")))]
1255 "INTVAL (operands[2]) < 32767"
1258 operands[2] = GEN_INT (INTVAL (operands[2])+1);
1259 return \"slti\\t%0,%1,%2\";
1261 [(set_attr "type" "arith")
1262 (set_attr "mode" "SI")])
1264 (define_insn "sgtu_si"
1265 [(set (match_operand:SI 0 "register_operand" "=d")
1266 (gtu:SI (match_operand:SI 1 "register_operand" "d")
1267 (match_operand:SI 2 "reg_or_0_operand" "dJ")))]
1270 [(set_attr "type" "arith")
1271 (set_attr "mode" "SI")])
1273 (define_insn "sltu_si"
1274 [(set (match_operand:SI 0 "register_operand" "=d,d")
1275 (ltu:SI (match_operand:SI 1 "register_operand" "d,d")
1276 (match_operand:SI 2 "arith_operand" "d,I")))]
1281 [(set_attr "type" "arith,arith")
1282 (set_attr "mode" "SI,SI")])
1284 (define_insn "sleu_si_const"
1285 [(set (match_operand:SI 0 "register_operand" "=d")
1286 (leu:SI (match_operand:SI 1 "register_operand" "d")
1287 (match_operand:SI 2 "small_int" "I")))]
1288 "INTVAL (operands[2]) < 32767"
1291 operands[2] = GEN_INT (INTVAL (operands[2]) + 1);
1292 return \"sltiu\\t%0,%1,%2\";
1294 [(set_attr "type" "arith")
1295 (set_attr "mode" "SI")])
1299 ;; ....................
1301 ;; UNCONDITIONAL BRANCHES
1303 ;; ....................
1305 ;; Unconditional branches.
1309 (label_ref (match_operand 0 "" "")))]
1313 if (GET_CODE (operands[0]) == REG)
1316 /* return \"b\\t%l0\";*/
1318 [(set_attr "type" "jump")
1319 (set_attr "mode" "none")])
1321 (define_expand "indirect_jump"
1322 [(set (pc) (match_operand 0 "register_operand" "d"))]
1328 if (operands[0]) /* eliminate unused code warnings */
1331 if (GET_CODE (dest) != REG || GET_MODE (dest) != Pmode)
1332 operands[0] = copy_to_mode_reg (Pmode, dest);
1334 if (!(Pmode == DImode))
1335 emit_jump_insn (gen_indirect_jump_internal1 (operands[0]));
1337 internal_error (\"unimplemented functionality\");
1343 (define_insn "indirect_jump_internal1"
1344 [(set (pc) (match_operand:SI 0 "register_operand" "d"))]
1345 "!(Pmode == DImode)"
1347 [(set_attr "type" "jump")
1348 (set_attr "mode" "none")])
1350 (define_expand "tablejump"
1352 (match_operand 0 "register_operand" "d"))
1353 (use (label_ref (match_operand 1 "" "")))]
1357 if (operands[0]) /* eliminate unused code warnings */
1359 gcc_assert (GET_MODE (operands[0]) == Pmode);
1361 if (!(Pmode == DImode))
1362 emit_jump_insn (gen_tablejump_internal1 (operands[0], operands[1]));
1364 internal_error (\"unimplemented functionality\");
1370 (define_insn "tablejump_internal1"
1372 (match_operand:SI 0 "register_operand" "d"))
1373 (use (label_ref (match_operand 1 "" "")))]
1374 "!(Pmode == DImode)"
1376 [(set_attr "type" "jump")
1377 (set_attr "mode" "none")])
1379 (define_expand "tablejump_internal3"
1380 [(parallel [(set (pc)
1381 (plus:SI (match_operand:SI 0 "register_operand" "d")
1382 (label_ref:SI (match_operand 1 "" ""))))
1383 (use (label_ref:SI (match_dup 1)))])]
1387 ;;; Make sure that this only matches the insn before ADDR_DIFF_VEC. Otherwise
1388 ;;; it is not valid. ??? With the USE, the condition tests may not be required
1391 ;;; ??? The length depends on the ABI. It is two for o32, and one for n32.
1392 ;;; We just use the conservative number here.
1396 (plus:SI (match_operand:SI 0 "register_operand" "d")
1397 (label_ref:SI (match_operand 1 "" ""))))
1398 (use (label_ref:SI (match_dup 1)))]
1399 "!(Pmode == DImode) && NEXT_INSN (as_a <rtx_insn *> (operands[1])) != 0
1400 && GET_CODE (PATTERN (NEXT_INSN (as_a <rtx_insn *> (operands[1])))) == ADDR_DIFF_VEC"
1405 [(set_attr "type" "jump")
1406 (set_attr "mode" "none")
1407 (set_attr "length" "8")])
1410 ;; ....................
1412 ;; Function prologue/epilogue
1414 ;; ....................
1417 (define_expand "prologue"
1422 if (iq2000_isa >= 0) /* avoid unused code warnings */
1424 iq2000_expand_prologue ();
1429 ;; Block any insns from being moved before this point, since the
1430 ;; profiling call to mcount can use various registers that aren't
1431 ;; saved or used to pass arguments.
1433 (define_insn "blockage"
1434 [(unspec_volatile [(const_int 0)] 0)]
1437 [(set_attr "type" "unknown")
1438 (set_attr "mode" "none")
1439 (set_attr "length" "0")])
1441 (define_expand "epilogue"
1446 if (iq2000_isa >= 0) /* avoid unused code warnings */
1448 iq2000_expand_epilogue ();
1453 ;; Trivial return. Make it look like a normal return insn as that
1454 ;; allows jump optimizations to work better .
1455 (define_insn "return"
1457 "iq2000_can_use_return_insn ()"
1459 [(set_attr "type" "jump")
1460 (set_attr "mode" "none")])
1464 (define_insn "return_internal"
1465 [(use (match_operand 0 "pmode_register_operand" ""))
1472 [(set_attr "type" "jump")
1473 (set_attr "mode" "none")])
1475 (define_insn "eh_return_internal"
1482 [(set_attr "type" "jump")
1483 (set_attr "mode" "none")])
1485 (define_expand "eh_return"
1486 [(use (match_operand:SI 0 "register_operand" "r"))]
1490 iq2000_expand_eh_return (operands[0]);
1496 ;; ....................
1500 ;; ....................
1502 ;; calls.c now passes a third argument, make saber happy
1504 (define_expand "call"
1505 [(parallel [(call (match_operand 0 "memory_operand" "m")
1506 (match_operand 1 "" "i"))
1507 (clobber (reg:SI 31))
1508 (use (match_operand 2 "" "")) ;; next_arg_reg
1509 (use (match_operand 3 "" ""))])] ;; struct_value_size_rtx
1515 if (operands[0]) /* eliminate unused code warnings */
1517 addr = XEXP (operands[0], 0);
1518 if ((GET_CODE (addr) != REG && (!CONSTANT_ADDRESS_P (addr)))
1519 || ! call_insn_operand (addr, VOIDmode))
1520 XEXP (operands[0], 0) = copy_to_mode_reg (Pmode, addr);
1522 /* In order to pass small structures by value in registers
1523 compatibly with the IQ2000 compiler, we need to shift the value
1524 into the high part of the register. Function_arg has encoded
1525 a PARALLEL rtx, holding a vector of adjustments to be made
1526 as the next_arg_reg variable, so we split up the insns,
1527 and emit them separately. */
1529 if (operands[2] != (rtx)0 && GET_CODE (operands[2]) == PARALLEL)
1531 rtvec adjust = XVEC (operands[2], 0);
1532 int num = GET_NUM_ELEM (adjust);
1535 for (i = 0; i < num; i++)
1536 emit_insn (RTVEC_ELT (adjust, i));
1539 emit_call_insn (gen_call_internal0 (operands[0], operands[1],
1540 gen_rtx_REG (SImode,
1541 GP_REG_FIRST + 31)));
1546 (define_expand "call_internal0"
1547 [(parallel [(call (match_operand 0 "" "")
1548 (match_operand 1 "" ""))
1549 (clobber (match_operand:SI 2 "" ""))])]
1553 (define_insn "call_internal1"
1554 [(call (mem (match_operand 0 "call_insn_operand" "ri"))
1555 (match_operand 1 "" "i"))
1556 (clobber (match_operand:SI 2 "register_operand" "=d"))]
1560 register rtx target = operands[0];
1562 if (GET_CODE (target) == CONST_INT)
1563 return \"li\\t%@,%0\\n\\tjalr\\t%2,%@\";
1564 else if (CONSTANT_ADDRESS_P (target))
1565 return \"jal\\t%0\";
1567 return \"jalr\\t%2,%0\";
1569 [(set_attr "type" "call")
1570 (set_attr "mode" "none")])
1572 ;; calls.c now passes a fourth argument, make saber happy
1574 (define_expand "call_value"
1575 [(parallel [(set (match_operand 0 "register_operand" "=d")
1576 (call (match_operand 1 "memory_operand" "m")
1577 (match_operand 2 "" "i")))
1578 (clobber (reg:SI 31))
1579 (use (match_operand 3 "" ""))])] ;; next_arg_reg
1585 if (operands[0]) /* eliminate unused code warning */
1587 addr = XEXP (operands[1], 0);
1588 if ((GET_CODE (addr) != REG && (!CONSTANT_ADDRESS_P (addr)))
1589 || ! call_insn_operand (addr, VOIDmode))
1590 XEXP (operands[1], 0) = copy_to_mode_reg (Pmode, addr);
1592 /* In order to pass small structures by value in registers
1593 compatibly with the IQ2000 compiler, we need to shift the value
1594 into the high part of the register. Function_arg has encoded
1595 a PARALLEL rtx, holding a vector of adjustments to be made
1596 as the next_arg_reg variable, so we split up the insns,
1597 and emit them separately. */
1599 if (operands[3] != (rtx)0 && GET_CODE (operands[3]) == PARALLEL)
1601 rtvec adjust = XVEC (operands[3], 0);
1602 int num = GET_NUM_ELEM (adjust);
1605 for (i = 0; i < num; i++)
1606 emit_insn (RTVEC_ELT (adjust, i));
1609 if (GET_CODE (operands[0]) == PARALLEL && XVECLEN (operands[0], 0) > 1)
1611 emit_call_insn (gen_call_value_multiple_internal0
1612 (XEXP (XVECEXP (operands[0], 0, 0), 0),
1613 operands[1], operands[2],
1614 XEXP (XVECEXP (operands[0], 0, 1), 0),
1615 gen_rtx_REG (SImode, GP_REG_FIRST + 31)));
1619 /* We have a call returning a DImode structure in an FP reg.
1620 Strip off the now unnecessary PARALLEL. */
1621 if (GET_CODE (operands[0]) == PARALLEL)
1622 operands[0] = XEXP (XVECEXP (operands[0], 0, 0), 0);
1624 emit_call_insn (gen_call_value_internal0 (operands[0], operands[1], operands[2],
1625 gen_rtx_REG (SImode,
1626 GP_REG_FIRST + 31)));
1632 (define_expand "call_value_internal0"
1633 [(parallel [(set (match_operand 0 "" "")
1634 (call (match_operand 1 "" "")
1635 (match_operand 2 "" "")))
1636 (clobber (match_operand:SI 3 "" ""))])]
1640 (define_insn "call_value_internal1"
1641 [(set (match_operand 0 "register_operand" "=d")
1642 (call (mem (match_operand 1 "call_insn_operand" "r"))
1643 (match_operand 2 "" "i")))
1644 (clobber (match_operand:SI 3 "register_operand" "=d"))]
1648 register rtx target = operands[1];
1650 if (GET_CODE (target) == CONST_INT)
1651 return \"li\\t%@,%1\\n\\tjalr\\t%3,%@\";
1652 else if (CONSTANT_ADDRESS_P (target))
1653 return \"jal\\t%1\";
1655 return \"jalr\\t%3,%1\";
1657 [(set_attr "type" "call")
1658 (set_attr "mode" "none")])
1660 (define_expand "call_value_multiple_internal0"
1661 [(parallel [(set (match_operand 0 "" "")
1662 (call (match_operand 1 "" "")
1663 (match_operand 2 "" "")))
1664 (set (match_operand 3 "" "")
1667 (clobber (match_operand:SI 4 "" ""))])]
1671 ;; ??? May eventually need all 6 versions of the call patterns with multiple
1674 (define_insn "call_value_multiple_internal1"
1675 [(set (match_operand 0 "register_operand" "=d")
1676 (call (mem (match_operand 1 "call_insn_operand" "r"))
1677 (match_operand 2 "" "i")))
1678 (set (match_operand 3 "register_operand" "=d")
1679 (call (mem (match_dup 1))
1681 (clobber (match_operand:SI 4 "register_operand" "=d"))]
1685 register rtx target = operands[1];
1687 if (GET_CODE (target) == CONST_INT)
1688 return \"li\\t%@,%1\\n\\tjalr\\t%4,%@\";
1689 else if (CONSTANT_ADDRESS_P (target))
1690 return \"jal\\t%1\";
1692 return \"jalr\\t%4,%1\";
1694 [(set_attr "type" "call")
1695 (set_attr "mode" "none")])
1697 ;; Call subroutine returning any type.
1699 (define_expand "untyped_call"
1700 [(parallel [(call (match_operand 0 "" "")
1702 (match_operand 1 "" "")
1703 (match_operand 2 "" "")])]
1707 if (operands[0]) /* silence statement not reached warnings */
1711 emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
1713 for (i = 0; i < XVECLEN (operands[2], 0); i++)
1715 rtx set = XVECEXP (operands[2], 0, i);
1716 emit_move_insn (SET_DEST (set), SET_SRC (set));
1719 emit_insn (gen_blockage ());
1725 ;; ....................
1729 ;; ....................
1736 [(set_attr "type" "nop")
1737 (set_attr "mode" "none")])
1740 ;; For the rare case where we need to load an address into a register
1741 ;; that cannot be recognized by the normal movsi/addsi instructions.
1742 ;; I have no idea how many insns this can actually generate. It should
1743 ;; be rare, so over-estimating as 10 instructions should not have any
1744 ;; real performance impact.
1745 (define_insn "leasi"
1746 [(set (match_operand:SI 0 "register_operand" "=d")
1747 (match_operand:SI 1 "address_operand" "p"))]
1753 xoperands[0] = operands[0];
1754 xoperands[1] = XEXP (operands[1], 0);
1755 xoperands[2] = XEXP (operands[1], 1);
1756 output_asm_insn (\"addiu\\t%0,%1,%2\", xoperands);
1759 [(set_attr "type" "arith")
1760 (set_attr "mode" "SI")
1761 (set_attr "length" "40")])
1763 (define_insn "ado16"
1764 [(set (match_operand:SI 0 "register_operand" "=r")
1765 (unspec:SI [(match_operand:SI 1 "register_operand" "r")
1766 (match_operand:SI 2 "register_operand" "r")]
1769 "ado16\\t%0, %1, %2"
1773 [(set (match_operand:SI 0 "register_operand" "=r")
1774 (unspec:SI [(match_operand:SI 1 "register_operand" "r")
1775 (match_operand:SI 2 "const_int_operand" "I")
1776 (match_operand:SI 3 "const_int_operand" "I")
1777 (match_operand:SI 4 "const_int_operand" "I")]
1780 "ram\\t%0, %1, %2, %3, %4"
1783 (define_insn "chkhdr"
1784 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "=r")
1785 (match_operand:SI 1 "register_operand" "r")]
1788 "* return iq2000_fill_delay_slot (\"chkhdr\\t%0, %1\", DELAY_LOAD, operands, insn);"
1789 [(set_attr "dslot" "not_in_dslot")]
1793 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
1794 (match_operand:SI 1 "register_operand" "r")]
1797 "* return iq2000_fill_delay_slot (\"pkrl\\t%0, %1\", DELAY_NONE, operands, insn);"
1798 [(set_attr "dslot" "not_in_dslot")]
1802 [(set (match_operand:SI 0 "register_operand" "=r")
1803 (unspec_volatile:SI [(match_operand:SI 1 "const_int_operand" "I")]
1806 "* return iq2000_fill_delay_slot (\"cfc0\\t%0, %%%1\", DELAY_LOAD, operands, insn);"
1807 [(set_attr "dslot" "ok_in_dslot")]
1811 [(set (match_operand:SI 0 "register_operand" "=r")
1812 (unspec_volatile:SI [(match_operand:SI 1 "const_int_operand" "I")]
1815 "* return iq2000_fill_delay_slot (\"cfc1\\t%0, %%%1\", DELAY_LOAD, operands, insn);"
1816 [(set_attr "dslot" "ok_in_dslot")]
1820 [(set (match_operand:SI 0 "register_operand" "=r")
1821 (unspec_volatile:SI [(match_operand:SI 1 "const_int_operand" "I")]
1824 "* return iq2000_fill_delay_slot (\"cfc2\\t%0, %%%1\", DELAY_LOAD, operands, insn);"
1825 [(set_attr "dslot" "not_in_dslot")]
1829 [(set (match_operand:SI 0 "register_operand" "=r")
1830 (unspec_volatile:SI [(match_operand:SI 1 "const_int_operand" "I")]
1833 "* return iq2000_fill_delay_slot (\"cfc3\\t%0, %%%1\", DELAY_LOAD, operands, insn);"
1834 [(set_attr "dslot" "not_in_dslot")]
1838 [(unspec_volatile:SI [(match_operand:SI 0 "reg_or_0_operand" "rJ")
1839 (match_operand:SI 1 "const_int_operand" "I")]
1842 "* return iq2000_fill_delay_slot (\"ctc0\\t%z0, %%%1\", DELAY_NONE, operands, insn);"
1843 [(set_attr "dslot" "ok_in_dslot")]
1847 [(unspec_volatile:SI [(match_operand:SI 0 "reg_or_0_operand" "rJ")
1848 (match_operand:SI 1 "const_int_operand" "I")]
1851 "* return iq2000_fill_delay_slot (\"ctc1\\t%z0, %%%1\", DELAY_NONE, operands, insn);"
1852 [(set_attr "dslot" "ok_in_dslot")]
1856 [(unspec_volatile:SI [(match_operand:SI 0 "reg_or_0_operand" "rJ")
1857 (match_operand:SI 1 "const_int_operand" "I")]
1860 "* return iq2000_fill_delay_slot (\"ctc2\\t%z0, %%%1\", DELAY_NONE, operands, insn);"
1861 [(set_attr "dslot" "ok_in_dslot")]
1865 [(unspec_volatile:SI [(match_operand:SI 0 "reg_or_0_operand" "rJ")
1866 (match_operand:SI 1 "const_int_operand" "I")]
1869 "* return iq2000_fill_delay_slot (\"ctc3\\t%z0, %%%1\", DELAY_NONE, operands, insn);"
1870 [(set_attr "dslot" "ok_in_dslot")]
1874 [(set (match_operand:SI 0 "register_operand" "=r")
1875 (unspec_volatile:SI [(match_operand:SI 1 "const_int_operand" "I")]
1878 "* return iq2000_fill_delay_slot (\"mfc0\\t%0, %%%1\", DELAY_LOAD, operands, insn);"
1879 [(set_attr "dslot" "ok_in_dslot")]
1883 [(set (match_operand:SI 0 "register_operand" "=r")
1884 (unspec_volatile:SI [(match_operand:SI 1 "const_int_operand" "I")]
1887 "* return iq2000_fill_delay_slot (\"mfc1\\t%0, %%%1\", DELAY_LOAD, operands, insn);"
1888 [(set_attr "dslot" "ok_in_dslot")]
1892 [(set (match_operand:SI 0 "register_operand" "=r")
1893 (unspec_volatile:SI [(match_operand:SI 1 "const_int_operand" "I")]
1896 "* return iq2000_fill_delay_slot (\"mfc2\\t%0, %%%1\", DELAY_LOAD, operands, insn);"
1897 [(set_attr "dslot" "not_in_dslot")]
1901 [(set (match_operand:SI 0 "register_operand" "=r")
1902 (unspec_volatile:SI [(match_operand:SI 1 "const_int_operand" "I")]
1905 "* return iq2000_fill_delay_slot (\"mfc3\\t%0, %%%1\", DELAY_LOAD, operands, insn);"
1906 [(set_attr "dslot" "not_in_dslot")]
1910 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
1911 (match_operand:SI 1 "const_int_operand" "I")]
1914 "* return iq2000_fill_delay_slot (\"mtc0\\t%0, %%%1\", DELAY_NONE, operands, insn);"
1915 [(set_attr "dslot" "ok_in_dslot")]
1919 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
1920 (match_operand:SI 1 "const_int_operand" "I")]
1923 "* return iq2000_fill_delay_slot (\"mtc1\\t%0, %%%1\", DELAY_NONE, operands, insn);"
1924 [(set_attr "dslot" "ok_in_dslot")]
1928 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
1929 (match_operand:SI 1 "const_int_operand" "I")]
1932 "* return iq2000_fill_delay_slot (\"mtc2\\t%0, %%%1\", DELAY_NONE, operands, insn);"
1933 [(set_attr "dslot" "ok_in_dslot")]
1937 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
1938 (match_operand:SI 1 "const_int_operand" "I")]
1941 "* return iq2000_fill_delay_slot (\"mtc3\\t%0, %%%1\", DELAY_NONE, operands, insn);"
1942 [(set_attr "dslot" "ok_in_dslot")]
1946 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
1947 (match_operand:SI 1 "register_operand" "r")]
1950 "* return iq2000_fill_delay_slot (\"lur\\t%0, %1\", DELAY_NONE, operands, insn);"
1951 [(set_attr "dslot" "not_in_dslot")]
1955 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
1956 (match_operand:SI 1 "register_operand" "r")]
1959 "* return iq2000_fill_delay_slot (\"rb\\t%0, %1\", DELAY_NONE, operands, insn);"
1960 [(set_attr "dslot" "not_in_dslot")]
1964 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
1965 (match_operand:SI 1 "register_operand" "r")]
1968 "* return iq2000_fill_delay_slot (\"rx\\t%0, %1\", DELAY_NONE, operands, insn);"
1969 [(set_attr "dslot" "not_in_dslot")]
1973 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")]
1976 "* return iq2000_fill_delay_slot (\"srrd\\t%0\", DELAY_NONE, operands, insn);"
1977 [(set_attr "dslot" "not_in_dslot")]
1981 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
1982 (match_operand:SI 1 "register_operand" "r")]
1985 "* return iq2000_fill_delay_slot (\"srwr\\t%0, %1\", DELAY_NONE, operands, insn);"
1986 [(set_attr "dslot" "not_in_dslot")]
1990 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
1991 (match_operand:SI 1 "register_operand" "r")]
1994 "* return iq2000_fill_delay_slot (\"wb\\t%0, %1\", DELAY_NONE, operands, insn);"
1995 [(set_attr "dslot" "not_in_dslot")]
1999 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
2000 (match_operand:SI 1 "register_operand" "r")]
2003 "* return iq2000_fill_delay_slot (\"wx\\t%0, %1\", DELAY_NONE, operands, insn);"
2004 [(set_attr "dslot" "not_in_dslot")]
2007 (define_insn "luc32"
2008 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
2009 (match_operand:SI 1 "register_operand" "r")]
2012 "* return iq2000_fill_delay_slot (\"luc32\\t%0, %1\", DELAY_NONE, operands, insn);"
2013 [(set_attr "dslot" "not_in_dslot")]
2016 (define_insn "luc32l"
2017 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
2018 (match_operand:SI 1 "register_operand" "r")]
2021 "* return iq2000_fill_delay_slot (\"luc32l\\t%0, %1\", DELAY_NONE, operands, insn);"
2022 [(set_attr "dslot" "not_in_dslot")]
2025 (define_insn "luc64"
2026 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
2027 (match_operand:SI 1 "register_operand" "r")]
2030 "* return iq2000_fill_delay_slot (\"luc64\\t%0, %1\", DELAY_NONE, operands, insn);"
2031 [(set_attr "dslot" "not_in_dslot")]
2034 (define_insn "luc64l"
2035 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
2036 (match_operand:SI 1 "register_operand" "r")]
2039 "* return iq2000_fill_delay_slot (\"luc64l\\t%0, %1\", DELAY_NONE, operands, insn);"
2040 [(set_attr "dslot" "not_in_dslot")]
2044 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
2045 (match_operand:SI 1 "register_operand" "r")]
2048 "* return iq2000_fill_delay_slot (\"luk\\t%0, %1\", DELAY_NONE, operands, insn);"
2049 [(set_attr "dslot" "ok_in_dslot")]
2052 (define_insn "lulck"
2053 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")]
2056 "* return iq2000_fill_delay_slot (\"lulck\\t%0\", DELAY_NONE, operands, insn);"
2057 [(set_attr "dslot" "not_in_dslot")]
2060 (define_insn "lum32"
2061 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
2062 (match_operand:SI 1 "register_operand" "r")]
2065 "* return iq2000_fill_delay_slot (\"lum32\\t%0, %1\", DELAY_NONE, operands, insn);"
2066 [(set_attr "dslot" "not_in_dslot")]
2069 (define_insn "lum32l"
2070 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
2071 (match_operand:SI 1 "register_operand" "r")]
2074 "* return iq2000_fill_delay_slot (\"lum32l\\t%0, %1\", DELAY_NONE, operands, insn);"
2075 [(set_attr "dslot" "not_in_dslot")]
2078 (define_insn "lum64"
2079 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
2080 (match_operand:SI 1 "register_operand" "r")]
2083 "* return iq2000_fill_delay_slot (\"lum64\\t%0, %1\", DELAY_NONE, operands, insn);"
2084 [(set_attr "dslot" "not_in_dslot")]
2087 (define_insn "lum64l"
2088 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
2089 (match_operand:SI 1 "register_operand" "r")]
2092 "* return iq2000_fill_delay_slot (\"lum64l\\t%0, %1\", DELAY_NONE, operands, insn);"
2093 [(set_attr "dslot" "not_in_dslot")]
2097 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
2098 (match_operand:SI 1 "register_operand" "r")]
2101 "* return iq2000_fill_delay_slot (\"lurl\\t%0, %1\", DELAY_NONE, operands, insn);"
2102 [(set_attr "dslot" "not_in_dslot")]
2106 [(set (match_operand:SI 0 "register_operand" "=r")
2107 (unspec_volatile:SI [(match_operand:SI 1 "register_operand" "r")
2108 (match_operand:SI 2 "register_operand" "r")
2109 (match_operand:SI 3 "const_int_operand" "I")]
2112 "* return iq2000_fill_delay_slot (\"mrgb\\t%0, %1, %2, %3\", DELAY_LOAD, operands, insn);"
2113 [(set_attr "dslot" "ok_in_dslot")]
2116 (define_insn "srrdl"
2117 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")]
2120 "* return iq2000_fill_delay_slot (\"srrdl\\t%0\", DELAY_NONE, operands, insn);"
2121 [(set_attr "dslot" "not_in_dslot")]
2124 (define_insn "srulck"
2125 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")]
2128 "* return iq2000_fill_delay_slot (\"srulck\\t%0\", DELAY_NONE, operands, insn);"
2129 [(set_attr "dslot" "not_in_dslot")]
2132 (define_insn "srwru"
2133 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
2134 (match_operand:SI 1 "register_operand" "r")]
2137 "* return iq2000_fill_delay_slot (\"srwru\\t%0, %1\", DELAY_NONE, operands, insn);"
2138 [(set_attr "dslot" "not_in_dslot")]
2141 (define_insn "trapqfl"
2142 [(unspec_volatile:SI [(const_int 1)] UNSPEC_TRAPQFL)]
2144 "* return iq2000_fill_delay_slot (\"trapqfl\", DELAY_NONE, operands, insn);"
2145 [(set_attr "dslot" "not_in_dslot")]
2148 (define_insn "trapqne"
2149 [(unspec_volatile:SI [(const_int 2)] UNSPEC_TRAPQNE)]
2151 "* return iq2000_fill_delay_slot (\"trapqne\", DELAY_NONE, operands, insn);"
2152 [(set_attr "dslot" "not_in_dslot")]
2155 (define_insn "traprel"
2156 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")]
2159 "* return iq2000_fill_delay_slot (\"traprel %0\", DELAY_NONE, operands, insn);"
2160 [(set_attr "dslot" "not_in_dslot")]
2164 [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")
2165 (match_operand:SI 1 "register_operand" "r")]
2168 "* return iq2000_fill_delay_slot (\"wbu\\t%0, %1\", DELAY_NONE, operands, insn);"
2169 [(set_attr "dslot" "not_in_dslot")]
2172 (define_insn "syscall"
2173 [(unspec_volatile:SI [(const_int 2)] UNSPEC_SYSCALL)]
2176 [(set_attr "dslot" "not_in_dslot")]