1 ;;- Machine description for ROMP chip for GNU C compiler
2 ;; Copyright (C) 1988, 1991, 1993, 1994 Free Software Foundation, Inc.
3 ;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
5 ;; This file is part of GNU CC.
7 ;; GNU CC 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 2, or (at your option)
12 ;; GNU CC 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 GNU CC; see the file COPYING. If not, write to
19 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
22 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
24 ;; Define the attributes for the ROMP.
26 ;; Insn type. Used to default other attribute values.
29 "branch,ibranch,return,fp,load,loadz,store,call,address,arith,compare,multi,misc"
30 (const_string "arith"))
34 (define_attr "length" ""
35 (cond [(eq_attr "type" "branch")
36 (if_then_else (and (ge (minus (pc) (match_dup 0))
38 (le (minus (pc) (match_dup 0))
42 (eq_attr "type" "return,ibranch") (const_int 2)
43 (eq_attr "type" "fp") (const_int 10)
44 (eq_attr "type" "call") (const_int 4)
45 (eq_attr "type" "load")
46 (cond [(match_operand 1 "short_memory_operand" "") (const_int 2)
47 (match_operand 1 "symbolic_memory_operand" "") (const_int 8)]
49 (eq_attr "type" "loadz")
50 (cond [(match_operand 1 "zero_memory_operand" "") (const_int 2)
51 (match_operand 1 "symbolic_memory_operand" "") (const_int 8)]
53 (eq_attr "type" "store")
54 (cond [(match_operand 0 "short_memory_operand" "") (const_int 2)
55 (match_operand 0 "symbolic_memory_operand" "") (const_int 8)]
59 ;; Whether insn can be placed in a delay slot.
61 (define_attr "in_delay_slot" "yes,no"
62 (cond [(eq_attr "length" "8,10,38") (const_string "no")
63 (eq_attr "type" "branch,ibranch,return,call,multi")
65 (const_string "yes")))
67 ;; Whether insn needs a delay slot. We have to say that two-byte
68 ;; branches do not need a delay slot. Otherwise, branch shortening will
69 ;; try to do something with delay slot insns (we want it to on the PA).
70 ;; This is a kludge, which should be cleaned up at some point.
72 (define_attr "needs_delay_slot" "yes,no"
73 (if_then_else (ior (and (eq_attr "type" "branch")
74 (eq_attr "length" "4"))
75 (eq_attr "type" "ibranch,return,call"))
76 (const_string "yes") (const_string "no")))
78 ;; What insn does to the condition code.
81 "clobber,none,sets,change0,copy1to0,compare,tbit"
82 (cond [(eq_attr "type" "load,loadz") (const_string "change0")
83 (eq_attr "type" "store") (const_string "none")
84 (eq_attr "type" "fp,call") (const_string "clobber")
85 (eq_attr "type" "branch,ibranch,return") (const_string "none")
86 (eq_attr "type" "address") (const_string "change0")
87 (eq_attr "type" "compare") (const_string "compare")
88 (eq_attr "type" "arith") (const_string "sets")]
89 (const_string "clobber")))
91 ;; Define attributes for `asm' insns.
93 (define_asm_attributes [(set_attr "type" "misc")
94 (set_attr "length" "8")
95 (set_attr "in_delay_slot" "no")
96 (set_attr "cc" "clobber")])
98 ;; Define the delay slot requirements for branches and calls. We don't have
99 ;; any annulled insns.
101 (define_delay (eq_attr "needs_delay_slot" "yes")
102 [(eq_attr "in_delay_slot" "yes") (nil) (nil)])
104 ;; We cannot give a floating-point comparison a delay slot, even though it
105 ;; could make use of it. This is because it would confuse next_cc0_user
106 ;; to do so. Other fp insns can't get a delay slow because they set their
107 ;; result and use their input after the delay slot insn is executed. This
108 ;; isn't what reorg.c expects.
110 ;; Define load & store delays. These were obtained by measurements done by
111 ;; jfc@athena.mit.edu.
113 ;; In general, the memory unit can support at most two simultaneous operations.
115 ;; Loads take 5 cycles to return the data and can be pipelined up to the
116 ;; limit of two simultaneous operations.
117 (define_function_unit "memory" 1 2 (eq_attr "type" "load,loadz") 5 0)
119 ;; Stores do not return data, but tie up the memory unit for 2 cycles if the
120 ;; next insn is also a store.
121 (define_function_unit "memory" 1 2 (eq_attr "type" "store") 1 2
122 [(eq_attr "type" "store")])
124 ;; Move word instructions.
126 ;; If destination is memory but source is not register, force source to
129 ;; If source is a constant that is too large to load in a single insn, build
132 ;; If destination is memory and source is a register, a temporary register
133 ;; will be needed. In that case, make a PARALLEL of the SET and a
134 ;; CLOBBER of a SCRATCH to allocate the required temporary.
136 ;; This temporary is ACTUALLY only needed when the destination is a
137 ;; relocatable expression. For generating RTL, however, we always
138 ;; place the CLOBBER. In insns where it is not needed, the SCRATCH will
139 ;; not be allocated to a register.
141 ;; Also, avoid creating pseudo-registers or SCRATCH rtx's during reload as
142 ;; they will not be correctly handled. We never need pseudos for that
145 ;; We do not use DEFINE_SPLIT for loading constants because the number
146 ;; of cases in the resulting unsplit insn would be too high to deal
148 (define_expand "movsi"
149 [(set (match_operand:SI 0 "general_operand" "")
150 (match_operand:SI 1 "general_operand" ""))]
153 { rtx op0 = operands[0];
154 rtx op1 = operands[1];
156 if (GET_CODE (op1) == REG && REGNO (op1) == 16)
159 if (GET_CODE (op0) == REG && REGNO (op0) == 16)
162 if (GET_CODE (op0) == MEM && ! reload_in_progress)
164 emit_insn (gen_storesi (operands[0], force_reg (SImode, operands[1])));
167 else if (GET_CODE (op1) == CONST_INT)
169 int const_val = INTVAL (op1);
171 /* Try a number of cases to see how to best load the constant. */
172 if ((const_val & 0xffff) == 0
173 || (const_val & 0xffff0000) == 0
174 || (unsigned) (const_val + 0x8000) < 0x10000)
175 /* Can do this in one insn, so generate it. */
177 else if (((- const_val) & 0xffff) == 0
178 || ((- const_val) & 0xffff0000) == 0
179 || (unsigned) ((- const_val) + 0x8000) < 0x10000)
181 /* Can do this by loading the negative constant and then negating. */
182 emit_move_insn (operands[0],
183 gen_rtx (CONST_INT, VOIDmode, - const_val));
184 emit_insn (gen_negsi2 (operands[0], operands[0]));
188 /* Do this the long way. */
190 unsigned int high_part = const_val & 0xffff0000;
191 unsigned int low_part = const_val & 0xffff;
194 if (low_part >= 0x10 && exact_log2 (low_part) >= 0)
195 i = high_part, high_part = low_part, low_part = i;
197 emit_move_insn (operands[0],
198 gen_rtx (CONST_INT, VOIDmode, low_part));
199 emit_insn (gen_iorsi3 (operands[0], operands[0],
200 gen_rtx (CONST_INT, VOIDmode, high_part)));
206 ;; Move from a symbolic memory location to a register is special. In this
207 ;; case, we know in advance that the register cannot be r0, so we can improve
208 ;; register allocation by treating it separately.
211 [(set (match_operand:SI 0 "register_operand" "=b")
212 (match_operand:SI 1 "symbolic_memory_operand" "m"))]
215 [(set_attr "type" "load")])
217 ;; Generic single-word move insn. We avoid the case where the destination is
218 ;; a symbolic address, as that needs a temporary register.
221 [(set (match_operand:SI 0 "reg_or_nonsymb_mem_operand" "=r,r,r,r,r,r,r,r,b,Q")
222 (match_operand:SI 1 "romp_operand" "rR,I,K,L,M,S,s,Q,m,r"))]
223 "register_operand (operands[0], SImode)
224 || register_operand (operands[1], SImode)"
236 [(set_attr "type" "address,address,address,address,address,arith,misc,load,load,store")
237 (set_attr "length" "2,2,4,4,4,4,8,*,*,*")])
239 (define_insn "storesi"
240 [(set (match_operand:SI 0 "memory_operand" "=Q,m")
241 (match_operand:SI 1 "register_operand" "r,r"))
242 (clobber (match_scratch:SI 2 "=X,&b"))]
247 [(set_attr "type" "store")])
249 ;; This pattern is used by reload when we store into a symbolic address. It
250 ;; provides the temporary register required. This pattern is only used
251 ;; when SECONDARY_OUTPUT_RELOAD_CLASS returns something other than
252 ;; NO_REGS, so we need not have any predicates here.
254 (define_expand "reload_outsi"
255 [(parallel [(set (match_operand:SI 0 "symbolic_memory_operand" "=m")
256 (match_operand:SI 1 "" "r"))
257 (clobber (match_operand:SI 2 "" "=&b"))])]
261 ;; Now do the same for the QI move instructions.
262 (define_expand "movqi"
263 [(set (match_operand:QI 0 "general_operand" "")
264 (match_operand:QI 1 "general_operand" ""))]
267 { rtx op0 = operands[0];
269 if (GET_CODE (op0) == MEM && ! reload_in_progress)
271 emit_insn (gen_storeqi (operands[0], force_reg (QImode, operands[1])));
277 [(set (match_operand:QI 0 "register_operand" "=b")
278 (match_operand:QI 1 "symbolic_memory_operand" "m"))]
281 [(set_attr "type" "load")])
284 [(set (match_operand:QI 0 "reg_or_nonsymb_mem_operand" "=r,r,r,r,r,b,Q")
285 (match_operand:QI 1 "romp_operand" "r,I,n,s,Q,m,r"))]
286 "register_operand (operands[0], QImode)
287 || register_operand (operands[1], QImode)"
296 [(set_attr "type" "address,address,address,misc,load,load,store")
297 (set_attr "length" "2,2,4,8,*,*,*")])
299 (define_insn "storeqi"
300 [(set (match_operand:QI 0 "memory_operand" "=Q,m")
301 (match_operand:QI 1 "register_operand" "r,r"))
302 (clobber (match_scratch:SI 2 "=X,&b"))]
307 [(set_attr "type" "store")])
309 (define_expand "reload_outqi"
310 [(parallel [(set (match_operand:QI 0 "symbolic_memory_operand" "=m")
311 (match_operand:QI 1 "" "r"))
312 (clobber (match_operand:SI 2 "" "=&b"))])]
316 ;; Finally, the HI instructions.
317 (define_expand "movhi"
318 [(set (match_operand:HI 0 "general_operand" "")
319 (match_operand:HI 1 "general_operand" ""))]
322 { rtx op0 = operands[0];
324 if (GET_CODE (op0) == MEM && ! reload_in_progress)
326 emit_insn (gen_storehi (operands[0], force_reg (HImode, operands[1])));
332 [(set (match_operand:HI 0 "register_operand" "=b")
333 (match_operand:HI 1 "symbolic_memory_operand" "m"))]
336 [(set_attr "type" "load")])
339 ;; use cal16 instead of cal for constant source because combine requires
340 ;; the high bits of the register to be 0 after a HImode load of a constant
343 [(set (match_operand:HI 0 "reg_or_nonsymb_mem_operand" "=r,r,r,r,r,b,Q")
344 (match_operand:HI 1 "romp_operand" "r,I,n,s,Q,m,r"))]
345 "register_operand (operands[0], HImode)
346 || register_operand (operands[1], HImode)"
355 [(set_attr "type" "address,address,address,misc,loadz,loadz,store")
356 (set_attr "length" "2,2,4,8,*,*,*")])
358 (define_insn "storehi"
359 [(set (match_operand:HI 0 "memory_operand" "=Q,m")
360 (match_operand:HI 1 "register_operand" "r,r"))
361 (clobber (match_scratch:SI 2 "=X,&b"))]
366 [(set_attr "type" "store")])
368 (define_expand "reload_outhi"
369 [(parallel [(set (match_operand:HI 0 "symbolic_memory_operand" "=m")
370 (match_operand:HI 1 "" "r"))
371 (clobber (match_operand:SI 2 "" "=&b"))])]
375 ;; For DI move, if we have a constant, break the operation apart into
376 ;; two SImode moves because the optimizer may be able to do a better job
377 ;; with the resulting code.
379 ;; For memory stores, make the required pseudo for a temporary in case we
380 ;; are storing into an absolute address.
382 ;; We need to be careful about the cases where the output is a register that is
383 ;; the second register of the input.
385 (define_expand "movdi"
386 [(set (match_operand:DI 0 "general_operand" "")
387 (match_operand:DI 1 "general_operand" ""))]
390 { rtx op0 = operands[0];
391 rtx op1 = operands[1];
393 if (CONSTANT_P (op1))
398 emit_move_insn (operand_subword (op0, 0, 1, DImode),
399 operand_subword (op1, 0, 1, DImode));
400 emit_move_insn (operand_subword (op0, 1, 1, DImode),
401 operand_subword (op1, 1, 1, DImode));
402 insns = get_insns ();
405 emit_no_conflict_block (insns, op0, op1, 0, op1);
409 if (GET_CODE (op0) == MEM && ! reload_in_progress)
411 emit_insn (gen_storedi (operands[0], force_reg (DImode, operands[1])));
417 [(set (match_operand:DI 0 "reg_or_nonsymb_mem_operand" "=r,r,r,Q")
418 (match_operand:DI 1 "reg_or_mem_operand" "r,Q,m,r"))]
419 "register_operand (operands[0], DImode)
420 || register_operand (operands[1], DImode)"
423 switch (which_alternative)
426 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
427 return \"cas %O0,%O1,r0\;cas %0,%1,r0\";
429 return \"cas %0,%1,r0\;cas %O0,%O1,r0\";
431 /* Here we must see which word to load first. We default to the
432 low-order word unless it occurs in the address. */
433 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
435 return \"l%M1 %O0,%O1\;l%M1 %0,%1\";
437 return \"l%M1 %0,%1\;l%M1 %O0,%O1\";
439 return \"get %O0,$%1\;ls %0,0(%O0)\;ls %O0,4(%O0)\";
441 return \"st%M0 %1,%0\;st%M0 %O1,%O0\";
444 [(set_attr "type" "multi")
445 (set_attr "cc" "change0,change0,change0,none")
446 (set_attr "length" "4,12,8,8")])
448 (define_insn "storedi"
449 [(set (match_operand:DI 0 "memory_operand" "=Q,m")
450 (match_operand:DI 1 "register_operand" "r,r"))
451 (clobber (match_scratch:SI 2 "=X,&b"))]
454 st%M0 %1,%0\;st%M0 %O1,%O0
455 get %2,$%0\;sts %1,0(%2)\;sts %O1,4(%2)"
456 [(set_attr "type" "multi,multi")
457 (set_attr "cc" "none,none")
458 (set_attr "length" "8,12")])
460 (define_expand "reload_outdi"
461 [(parallel [(set (match_operand:DI 0 "symbolic_memory_operand" "=m")
462 (match_operand:DI 1 "" "r"))
463 (clobber (match_operand:SI 2 "" "=&b"))])]
467 ;; Split symbolic memory operands differently. We first load the address
468 ;; into a register and then do the two loads or stores. We can only do
469 ;; this if operand_subword won't produce a SUBREG, which is only when
470 ;; operands[0] is a hard register. Thus, these won't be used during the
471 ;; first insn scheduling pass.
473 [(set (match_operand:DI 0 "register_operand" "")
474 (match_operand:DI 1 "symbolic_memory_operand" ""))]
475 "GET_CODE (operands[0]) == REG
476 && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER"
477 [(set (match_dup 2) (match_dup 3))
478 (set (match_dup 4) (match_dup 5))
479 (set (match_dup 6) (match_dup 7))]
481 { operands[2] = operand_subword (operands[0], 1, 0, DImode);
482 operands[3] = XEXP (operands[1], 0);
483 operands[4] = operand_subword (operands[0], 0, 0, DImode);
484 operands[5] = gen_rtx (MEM, SImode, operands[2]);
485 operands[6] = operands[2];
486 operands[7] = gen_rtx (MEM, SImode,
487 gen_rtx (PLUS, SImode, operands[2],
488 gen_rtx (CONST_INT, VOIDmode, 4)));
490 if (operands[2] == 0 || operands[4] == 0)
495 [(set (match_operand:DI 0 "symbolic_memory_operand" "")
496 (match_operand:DI 1 "register_operand" ""))
497 (clobber (match_operand:SI 2 "register_operand" ""))]
498 "GET_CODE (operands[0]) == REG
499 && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER"
500 [(set (match_dup 2) (match_dup 3))
501 (set (match_dup 4) (match_dup 5))
502 (set (match_dup 6) (match_dup 7))]
504 { operands[3] = XEXP (operands[0], 0);
505 operands[4] = gen_rtx (MEM, SImode, operands[2]);
506 operands[5] = operand_subword (operands[1], 0, 0, DImode);
507 operands[6] = gen_rtx (MEM, SImode,
508 gen_rtx (PLUS, SImode, operands[2],
509 gen_rtx (CONST_INT, VOIDmode, 4)));
510 operands[7] = operand_subword (operands[1], 1, 0, DImode);
512 if (operands[5] == 0 || operands[7] == 0)
516 ;; If the output is a register and the input is memory, we have to be careful
517 ;; and see which word needs to be loaded first.
519 ;; Note that this case doesn't have a CLOBBER. Therefore, we must either
520 ;; be after reload or operand[0] must not be a MEM. So we don't need a
521 ;; CLOBBER on the new insns either.
523 ;; Due to a bug in sched.c, we do not want to split this insn if both
524 ;; operands are registers and they overlap unless reload has completed.
526 [(set (match_operand:DI 0 "general_operand" "")
527 (match_operand:DI 1 "general_operand" ""))]
528 "! symbolic_memory_operand (operands[0], DImode)
529 && ! symbolic_memory_operand (operands[1], DImode)
530 && ! (GET_CODE (operands[0]) == REG
531 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)
532 && ! (GET_CODE (operands[1]) == REG
533 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)
534 && ! (GET_CODE (operands[0]) == REG && GET_CODE (operands[1]) == REG
535 && ! reload_completed
536 && reg_overlap_mentioned_p (operands[0], operands[1]))"
537 [(set (match_dup 2) (match_dup 3))
538 (set (match_dup 4) (match_dup 5))]
540 { if (GET_CODE (operands[0]) != REG
541 || ! refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
544 operands[2] = operand_subword (operands[0], 0, 0, DImode);
545 operands[3] = operand_subword (operands[1], 0, 0, DImode);
546 operands[4] = operand_subword (operands[0], 1, 0, DImode);
547 operands[5] = operand_subword (operands[1], 1, 0, DImode);
551 operands[2] = operand_subword (operands[0], 1, 0, DImode);
552 operands[3] = operand_subword (operands[1], 1, 0, DImode);
553 operands[4] = operand_subword (operands[0], 0, 0, DImode);
554 operands[5] = operand_subword (operands[1], 0, 0, DImode);
557 if (operands[2] == 0 || operands[3] == 0
558 || operands[4] == 0 || operands[5] == 0)
563 [(set (match_operand:DI 0 "general_operand" "")
564 (match_operand:DI 1 "general_operand" ""))
565 (clobber (match_operand:SI 6 "register_operand" ""))]
566 "! symbolic_memory_operand (operands[0], DImode)
567 && ! symbolic_memory_operand (operands[1], DImode)
568 && ! (GET_CODE (operands[0]) == REG
569 && REGNO (operands[0]) >= FIRST_PSEUDO_REGISTER)
570 && ! (GET_CODE (operands[1]) == REG
571 && REGNO (operands[1]) >= FIRST_PSEUDO_REGISTER)
572 && ! (GET_CODE (operands[0]) == REG && GET_CODE (operands[1]) == REG
573 && ! reload_completed
574 && reg_overlap_mentioned_p (operands[0], operands[1]))"
575 [(parallel [(set (match_dup 2) (match_dup 3))
576 (clobber (match_dup 7))])
577 (parallel [(set (match_dup 4) (match_dup 5))
578 (clobber (match_dup 8))])]
580 { if (GET_CODE (operands[0]) != REG
581 || ! refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
584 operands[2] = operand_subword (operands[0], 0, 0, DImode);
585 operands[3] = operand_subword (operands[1], 0, 0, DImode);
586 operands[4] = operand_subword (operands[0], 1, 0, DImode);
587 operands[5] = operand_subword (operands[1], 1, 0, DImode);
591 operands[2] = operand_subword (operands[0], 1, 0, DImode);
592 operands[3] = operand_subword (operands[1], 1, 0, DImode);
593 operands[4] = operand_subword (operands[0], 0, 0, DImode);
594 operands[5] = operand_subword (operands[1], 0, 0, DImode);
597 if (operands[2] == 0 || operands[3] == 0
598 || operands[4] == 0 || operands[5] == 0)
601 /* We must be sure to make two different SCRATCH operands, since they
602 are not allowed to be shared. After reload, however, we only have
603 a SCRATCH if we won't use the operand, so it is allowed to share it
605 if (reload_completed || GET_CODE (operands[6]) != SCRATCH)
606 operands[7] = operands[8] = operands[6];
609 operands[7] = gen_rtx (SCRATCH, SImode);
610 operands[8] = gen_rtx (SCRATCH, SImode);
614 ;; Define move insns for SF, and DF.
616 ;; For register-register copies or a copy of something to itself, emit a
617 ;; single SET insn since it will likely be optimized away.
619 ;; Otherwise, emit a floating-point move operation unless both input and
620 ;; output are either constant, memory, or a non-floating-point hard register.
621 (define_expand "movdf"
622 [(parallel [(set (match_operand:DF 0 "general_operand" "")
623 (match_operand:DF 1 "general_operand" ""))
625 (clobber (reg:SI 15))])]
628 { rtx op0 = operands[0];
629 rtx op1 = operands[1];
633 emit_insn (gen_rtx (SET, VOIDmode, op0, op1));
637 if ((GET_CODE (op0) == MEM
638 || (GET_CODE (op0) == REG && REGNO (op0) < FIRST_PSEUDO_REGISTER
639 && ! FP_REGNO_P (REGNO (op0))))
640 && (GET_CODE (op1) == MEM
641 || GET_CODE (op1) == CONST_DOUBLE
642 || (GET_CODE (op1) == REG && REGNO (op1) < FIRST_PSEUDO_REGISTER
643 && ! FP_REGNO_P (REGNO (op1)) && ! rtx_equal_p (op0, op1))))
647 if (GET_CODE (op1) == CONST_DOUBLE)
648 op1 = force_const_mem (DFmode, op1);
651 if (GET_CODE (operands[0]) != REG
652 || ! refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
655 emit_move_insn (operand_subword (op0, 0, 1, DFmode),
656 operand_subword_force (op1, 0, DFmode));
657 emit_move_insn (operand_subword (op0, 1, 1, DFmode),
658 operand_subword_force (op1, 1, DFmode));
662 emit_move_insn (operand_subword (op0, 1, 1, DFmode),
663 operand_subword_force (op1, 1, DFmode));
664 emit_move_insn (operand_subword (op0, 0, 1, DFmode),
665 operand_subword_force (op1, 0, DFmode));
668 insns = get_insns ();
671 emit_no_conflict_block (insns, op0, op1, 0, op1);
676 (define_expand "movsf"
677 [(parallel [(set (match_operand:SF 0 "general_operand" "")
678 (match_operand:SF 1 "general_operand" ""))
680 (clobber (reg:SI 15))])]
683 { rtx op0 = operands[0];
684 rtx op1 = operands[1];
688 emit_insn (gen_rtx (SET, VOIDmode, op0, op1));
692 if ((GET_CODE (op0) == MEM
693 || (GET_CODE (op0) == REG && REGNO (op0) < FIRST_PSEUDO_REGISTER
694 && ! FP_REGNO_P (REGNO (op0))))
695 && (GET_CODE (op1) == MEM
696 || GET_CODE (op1) == CONST_DOUBLE
697 || (GET_CODE (op1) == REG && REGNO (op1) < FIRST_PSEUDO_REGISTER
698 && ! FP_REGNO_P (REGNO (op1)))))
702 if (GET_CODE (op1) == CONST_DOUBLE)
703 op1 = force_const_mem (SFmode, op1);
705 last = emit_move_insn (operand_subword (op0, 0, 1, SFmode),
706 operand_subword_force (op1, 0, SFmode));
708 REG_NOTES (last) = gen_rtx (EXPR_LIST, REG_EQUAL, op1, REG_NOTES (last));
713 ;; Define the move insns for SF and DF. Check for all general regs
714 ;; in the FP insns and make them non-FP if so. Do the same if the input and
715 ;; output are the same (the insn will be deleted in this case and we don't
716 ;; want to think there are FP insns when there might not be).
718 [(set (match_operand:SF 0 "general_operand" "=*frg")
722 [(set_attr "type" "address")
723 (set_attr "length" "2")])
726 [(set (match_operand:SF 0 "general_operand" "=r,*fr,r,r,Q,m,frg")
727 (match_operand:SF 1 "general_operand" "r,0,Q,m,r,r,frg"))
728 (clobber (match_operand:SI 2 "reg_0_operand" "=&z,z,z,z,z,z,z"))
729 (clobber (match_operand:SI 3 "reg_15_operand" "=&t,t,t,t,t,t,t"))]
732 { switch (which_alternative)
735 return \"cas %0,%1,r0\";
739 return \"l%M1 %0,%1\";
741 return \"load %0,%1\";
743 return \"st%M0 %1,%0\";
745 return \"store %1,%0,%3\";
747 return output_fpop (SET, operands[0], operands[1], 0, insn);
750 [(set_attr "type" "address,address,load,load,store,store,fp")
751 (set_attr "length" "2,2,*,*,*,*,*")])
754 [(set (match_operand:DF 0 "general_operand" "=*frg")
758 [(set_attr "type" "address")
759 (set_attr "length" "2")])
762 [(set (match_operand:DF 0 "general_operand" "=r,*fr,r,r,Q,m,frg")
763 (match_operand:DF 1 "general_operand" "r,0,Q,m,r,r,*frg"))
764 (clobber (match_operand:SI 2 "reg_0_operand" "=&z,z,z,z,z,z,z"))
765 (clobber (match_operand:SI 3 "reg_15_operand" "=&t,t,t,t,t,t,t"))]
768 { switch (which_alternative)
771 if (REGNO (operands[0]) == REGNO (operands[1]) + 1)
772 return \"cas %O0,%O1,r0\;cas %0,%1,r0\";
774 return \"cas %0,%1,r0\;cas %O0,%O1,r0\";
778 /* Here we must see which word to load first. We default to the
779 low-order word unless it occurs in the address. */
780 if (refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
782 return \"l%M1 %O0,%O1\;l%M1 %0,%1\";
784 return \"l%M1 %0,%1\;l%M1 %O0,%O1\";
786 return \"get %3,$%1\;ls %0,0(%3)\;ls %O0,4(%3)\";
788 return \"st%M0 %1,%0\;st%M0 %O1,%O0\";
790 return \"get %3,$%0\;sts %1,0(%3)\;sts %O1,4(%3)\";
792 return output_fpop (SET, operands[0], operands[1], 0, insn);
795 [(set_attr "type" "address,multi,multi,multi,multi,multi,fp")
796 (set_attr "length" "2,4,*,*,*,*,*")])
798 ;; Split all the above cases that involve multiple insns and no floating-point
799 ;; data block. If before reload, we can make a SCRATCH. Otherwise, use
803 [(set (match_operand:DF 0 "register_operand" "")
804 (match_operand:DF 1 "symbolic_memory_operand" ""))
806 (clobber (reg:SI 15))]
807 "GET_CODE (operands[0]) == REG && REGNO (operands[0]) < 16"
808 [(set (reg:SI 15) (match_dup 2))
809 (set (match_dup 3) (match_dup 4))
810 (set (match_dup 5) (match_dup 6))]
812 { operands[2] = XEXP (operands[1], 0);
813 operands[3] = operand_subword (operands[0], 0, 0, DFmode);
814 operands[4] = gen_rtx (MEM, SImode, gen_rtx (REG, SImode, 15));
815 operands[5] = operand_subword (operands[0], 1, 0, DFmode);
816 operands[6] = gen_rtx (MEM, SImode,
817 gen_rtx (PLUS, SImode, gen_rtx (REG, SImode, 15),
818 gen_rtx (CONST_INT, VOIDmode, 4)));
820 if (operands[3] == 0 || operands[5] == 0)
825 [(set (match_operand:DF 0 "symbolic_memory_operand" "")
826 (match_operand:DF 1 "register_operand" ""))
828 (clobber (reg:SI 15))]
829 "GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 16"
830 [(set (reg:SI 15) (match_dup 2))
831 (set (match_dup 3) (match_dup 4))
832 (set (match_dup 5) (match_dup 6))]
834 { operands[2] = XEXP (operands[0], 0);
835 operands[3] = gen_rtx (MEM, SImode, gen_rtx (REG, SImode, 15));
836 operands[4] = operand_subword (operands[1], 0, 0, DFmode);
837 operands[5] = gen_rtx (MEM, SImode,
838 gen_rtx (PLUS, SImode, gen_rtx (REG, SImode, 15),
839 gen_rtx (CONST_INT, VOIDmode, 4)));
840 operands[6] = operand_subword (operands[1], 1, 0, DFmode);
842 if (operands[4] == 0 || operands[6] == 0)
846 ;; If the output is a register and the input is memory, we have to be careful
847 ;; and see which word needs to be loaded first. We also cannot to the
848 ;; split if the input is a constant because it would result in invalid
849 ;; insns. When the output is a MEM, we must put a CLOBBER on each of the
850 ;; resulting insn, when it is not a MEM, we must not.
852 [(set (match_operand:DF 0 "memory_operand" "")
853 (match_operand:DF 1 "register_operand" ""))
855 (clobber (reg:SI 15))]
856 "GET_CODE (operands[1]) == REG && REGNO (operands[1]) < 15"
857 [(parallel [(set (match_dup 2) (match_dup 3))
858 (clobber (match_dup 6))])
859 (parallel [(set (match_dup 4) (match_dup 5))
860 (clobber (match_dup 7))])]
862 { operands[2] = operand_subword (operands[0], 0, 0, DFmode);
863 operands[3] = operand_subword (operands[1], 0, 0, DFmode);
864 operands[4] = operand_subword (operands[0], 1, 0, DFmode);
865 operands[5] = operand_subword (operands[1], 1, 0, DFmode);
867 if (operands[2] == 0 || operands[3] == 0
868 || operands[4] == 0 || operands[5] == 0)
871 if (reload_completed)
872 operands[6] = operands[7] = gen_rtx (REG, SImode, 15);
875 operands[6] = gen_rtx (SCRATCH, SImode);
876 operands[7] = gen_rtx (SCRATCH, SImode);
881 [(set (match_operand:DF 0 "nonmemory_operand" "")
882 (match_operand:DF 1 "general_operand" ""))
884 (clobber (reg:SI 15))]
885 "! symbolic_memory_operand (operands[1], DFmode)
886 && GET_CODE (operands[1]) != CONST_DOUBLE
887 && (GET_CODE (operands[0]) != REG || REGNO (operands[0]) < 15)
888 && (GET_CODE (operands[1]) != REG || REGNO (operands[1]) < 15)
889 && (GET_CODE (operands[0]) == REG || GET_CODE (operands[1]) == REG)
890 && ! (GET_CODE (operands[0]) == REG && GET_CODE (operands[1]) == REG
891 && ! reload_completed
892 && reg_overlap_mentioned_p (operands[0], operands[1]))"
893 [(set (match_dup 2) (match_dup 3))
894 (set (match_dup 4) (match_dup 5))]
896 { if (GET_CODE (operands[0]) != REG
897 || ! refers_to_regno_p (REGNO (operands[0]), REGNO (operands[0]) + 1,
900 operands[2] = operand_subword (operands[0], 0, 0, DFmode);
901 operands[3] = operand_subword (operands[1], 0, 0, DFmode);
902 operands[4] = operand_subword (operands[0], 1, 0, DFmode);
903 operands[5] = operand_subword (operands[1], 1, 0, DFmode);
907 operands[2] = operand_subword (operands[0], 1, 0, DFmode);
908 operands[3] = operand_subword (operands[1], 1, 0, DFmode);
909 operands[4] = operand_subword (operands[0], 0, 0, DFmode);
910 operands[5] = operand_subword (operands[1], 0, 0, DFmode);
913 if (operands[2] == 0 || operands[3] == 0
914 || operands[4] == 0 || operands[5] == 0)
918 ;; Conversions from one integer mode to another.
919 ;; It is possible sometimes to sign- or zero-extend while fetching from memory.
921 ;; First, sign-extensions:
922 (define_expand "extendhisi2"
923 [(set (match_operand:SI 0 "register_operand" "")
924 (sign_extend:SI (match_operand:HI 1 "register_operand" "")))]
929 [(set (match_operand:SI 0 "register_operand" "=b")
930 (sign_extend:SI (match_operand:HI 1 "symbolic_memory_operand" "m")))]
933 [(set_attr "type" "load")])
936 [(set (match_operand:SI 0 "register_operand" "=r,r,b")
937 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,Q,m")))]
943 [(set_attr "type" "arith,load,load")
944 (set_attr "length" "2,*,*")])
946 (define_expand "extendqisi2"
948 (ashift:SI (match_operand:QI 1 "register_operand" "")
950 (set (match_operand:SI 0 "register_operand" "")
951 (ashiftrt:SI (match_dup 2)
955 { operands[1] = gen_lowpart (SImode, operands[1]);
956 operands[2] = gen_reg_rtx (SImode); }")
958 (define_expand "extendqihi2"
960 (ashift:SI (match_operand:QI 1 "register_operand" "")
962 (set (match_operand:HI 0 "register_operand" "")
963 (ashiftrt:SI (match_dup 2)
967 { operands[0] = gen_lowpart (SImode, operands[0]);
968 operands[1] = gen_lowpart (SImode, operands[1]);
969 operands[2] = gen_reg_rtx (SImode); }")
971 ;; Define peepholes to eliminate an instruction when we are doing a sign
972 ;; extension but cannot clobber the input.
974 ;; In this case we will shift left 24 bits, but need a copy first. The shift
975 ;; can be replaced by a "mc03" instruction, but this can only be done if
976 ;; followed by the right shift of 24 or more bits.
978 [(set (match_operand:SI 0 "register_operand" "")
979 (subreg:SI (match_operand:QI 1 "register_operand" "") 0))
981 (ashift:SI (match_dup 0)
984 (ashiftrt:SI (match_dup 0)
985 (match_operand:SI 2 "const_int_operand" "")))]
986 "INTVAL (operands[2]) >= 24"
987 "mc03 %0,%1\;sari16 %0,%S2"
988 [(set_attr "type" "multi")
989 (set_attr "length" "4")
990 (set_attr "cc" "sets")])
992 ;; Now zero extensions:
993 (define_expand "zero_extendhisi2"
994 [(set (match_operand:SI 0 "register_operand" "")
995 (zero_extend:SI (match_operand:HI 1 "register_operand" "")))]
1000 [(set (match_operand:SI 0 "register_operand" "=b")
1001 (zero_extend:SI (match_operand:HI 1 "symbolic_memory_operand" "m")))]
1004 [(set_attr "type" "load")])
1007 [(set (match_operand:SI 0 "register_operand" "=r,r,b")
1008 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,Q,m")))]
1014 [(set_attr "type" "arith,loadz,load")])
1016 (define_expand "zero_extendqisi2"
1017 [(set (match_operand:SI 0 "register_operand" "")
1018 (zero_extend:SI (match_operand:QI 1 "register_operand" "")))]
1023 [(set (match_operand:SI 0 "register_operand" "=b")
1024 (zero_extend:SI (match_operand:QI 1 "symbolic_memory_operand" "m")))]
1027 [(set_attr "type" "load")])
1030 [(set (match_operand:SI 0 "register_operand" "=r,r,b")
1031 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "r,Q,m")))]
1037 [(set_attr "type" "arith,load,load")])
1039 (define_expand "zero_extendqihi2"
1040 [(set (match_operand:HI 0 "register_operand" "")
1041 (zero_extend:HI (match_operand:QI 1 "register_operand" "")))]
1046 [(set (match_operand:HI 0 "register_operand" "=b")
1047 (zero_extend:HI (match_operand:QI 1 "symbolic_memory_operand" "m")))]
1050 [(set_attr "type" "load")])
1053 [(set (match_operand:HI 0 "register_operand" "=r,r,b")
1054 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "r,Q,m")))]
1060 [(set_attr "type" "arith,load,load")])
1062 ;; Various extract and insertion operations.
1063 (define_expand "extzv"
1064 [(set (match_operand:SI 0 "register_operand" "")
1065 (zero_extract:SI (match_operand:SI 1 "register_operand" "")
1066 (match_operand:SI 2 "const_int_operand" "")
1067 (match_operand:SI 3 "const_int_operand" "")))]
1071 if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) != 8)
1074 if (GET_CODE (operands[3]) != CONST_INT)
1077 if (INTVAL (operands[3]) != 0 && INTVAL (operands[3]) != 8
1078 && INTVAL (operands[3]) != 16 && INTVAL (operands[3]) != 24)
1083 [(set (match_operand:SI 0 "register_operand" "=&r")
1084 (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
1086 (match_operand:SI 2 "const_int_operand" "n")))]
1087 "(INTVAL (operands[2]) & 7) == 0"
1088 "lis %0,0\;mc3%B2 %0,%1"
1089 [(set_attr "type" "multi")
1090 (set_attr "cc" "change0")])
1093 [(set (match_operand:SI 0 "register_operand" "=&r")
1094 (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
1096 (match_operand:SI 2 "const_int_operand" "n")))]
1097 "(INTVAL (operands[2]) & 7) == 0"
1098 [(set (match_dup 0) (const_int 0))
1099 (set (zero_extract:SI (match_dup 0) (const_int 8) (const_int 24))
1100 (zero_extract:SI (match_dup 1) (const_int 8) (match_dup 2)))]
1104 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
1107 (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
1109 (match_operand:SI 2 "const_int_operand" "n")))]
1110 "(INTVAL (operands[2]) & 7) == 0"
1112 [(set_attr "type" "address")
1113 (set_attr "length" "2")])
1115 (define_expand "insv"
1116 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "")
1117 (match_operand:SI 1 "const_int_operand" "")
1118 (match_operand:SI 2 "const_int_operand" ""))
1119 (match_operand:SI 3 "register_operand" ""))]
1123 if (GET_CODE (operands[2]) != CONST_INT)
1126 if (GET_CODE (operands[1]) != CONST_INT)
1129 if (INTVAL (operands[1]) == 1)
1131 emit_insn (gen_bit_insv (operands[0], operands[1], operands[2],
1135 else if (INTVAL (operands[1]) == 8
1136 && (INTVAL (operands[2]) % 8 == 0))
1137 ; /* Accept aligned byte-wide field. */
1142 ;; For a single-bit insert, it is better to explicitly generate references
1143 ;; to the T bit. We will call the T bit "CC0" because it can be clobbered
1144 ;; by some CC0 sets (single-bit tests).
1146 (define_expand "bit_insv"
1148 (zero_extract:SI (match_operand:SI 3 "register_operand" "")
1151 (parallel [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "")
1152 (match_operand:SI 1 "const_int_operand" "")
1153 (match_operand:SI 2 "const_int_operand" ""))
1154 (ne (cc0) (const_int 0)))
1155 (clobber (match_scratch:SI 4 ""))])]
1160 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
1162 (match_operand:SI 1 "const_int_operand" "n"))
1163 (match_operand:SI 2 "register_operand" "r"))]
1164 "(INTVAL (operands[1]) & 7) == 0"
1166 [(set_attr "type" "address")
1167 (set_attr "length" "2")])
1169 ;; This pattern cannot have any input reloads since if references CC0.
1170 ;; So we have to add code to support memory, which is the only other
1171 ;; thing that a "register_operand" can become. There is still a problem
1172 ;; if the address isn't valid and *it* needs a reload, but there is no
1173 ;; way to solve that problem, so let's hope it never happens.
1176 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r,m")
1178 (match_operand:SI 1 "const_int_operand" "n,m"))
1179 (ne (cc0) (const_int 0)))
1180 (clobber (match_scratch:SI 2 "=X,b"))]
1184 l%M0 %2,%0\;mftb%t1 %2,%S1\;st%M0 %2,%0"
1185 [(set_attr "type" "*,multi")
1186 (set_attr "cc" "none,none")
1187 (set_attr "length" "2,10")])
1189 ;; Arithmetic instructions. First, add and subtract.
1191 ;; It may be that the second input is either large or small enough that
1192 ;; the operation cannot be done in a single insn. In that case, emit two.
1193 (define_expand "addsi3"
1194 [(set (match_operand:SI 0 "register_operand" "")
1195 (plus:SI (match_operand:SI 1 "register_operand" "")
1196 (match_operand:SI 2 "nonmemory_operand" "")))]
1200 if (GET_CODE (operands[2]) == CONST_INT
1201 && (unsigned) (INTVAL (operands[2]) + 0x8000) >= 0x10000
1202 && (INTVAL (operands[2]) & 0xffff) != 0)
1204 int low = INTVAL (operands[2]) & 0xffff;
1205 int high = (unsigned) INTVAL (operands[2]) >> 16;
1208 high++, low |= 0xffff0000;
1210 emit_insn (gen_addsi3 (operands[0], operands[1],
1211 gen_rtx (CONST_INT, VOIDmode, high << 16)));
1212 operands[1] = operands[0];
1213 operands[2] = gen_rtx (CONST_INT, VOIDmode, low);
1217 ;; Put the insn to add a symbolic constant to a register separately to
1218 ;; improve register allocation since it has different register requirements.
1220 [(set (match_operand:SI 0 "register_operand" "=b")
1221 (plus:SI (match_operand:SI 1 "register_operand" "%b")
1222 (match_operand:SI 2 "romp_symbolic_operand" "s")))]
1225 [(set_attr "type" "address")
1226 (set_attr "length" "8")])
1229 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r,r,b")
1230 (plus:SI (match_operand:SI 1 "reg_or_add_operand" "%0,0,r,b,0,r,b")
1231 (match_operand:SI 2 "reg_or_add_operand" "I,J,K,M,r,b,s")))]
1232 "register_operand (operands[1], SImode)
1233 || register_operand (operands[2], SImode)"
1242 [(set_attr "type" "arith,arith,arith,address,arith,address,misc")
1243 (set_attr "length" "2,2,4,4,2,2,8")])
1247 ;; 1. If third operand is constant integer, convert it to add of the negative
1249 ;; 2. If the second operand is not a valid constant integer, force it into a
1251 (define_expand "subsi3"
1252 [(set (match_operand:SI 0 "register_operand" "")
1253 (minus:SI (match_operand:SI 1 "reg_or_any_cint_operand" "")
1254 (match_operand:SI 2 "reg_or_any_cint_operand" "")))]
1258 if (GET_CODE (operands [2]) == CONST_INT)
1260 emit_insn (gen_addsi3 (operands[0], operands[1],
1262 VOIDmode, - INTVAL (operands[2]))));
1266 operands[2] = force_reg (SImode, operands[2]);
1268 if (GET_CODE (operands[1]) != CONST_INT
1269 || (unsigned) (INTVAL (operands[1]) + 0x8000) >= 0x10000)
1270 operands[1] = force_reg (SImode, operands[1]);
1274 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
1275 (minus:SI (match_operand:SI 1 "reg_or_D_operand" "K,0,r")
1276 (match_operand:SI 2 "register_operand" "r,r,0")))]
1282 [(set_attr "length" "4,2,2")])
1284 ;; Multiply either calls a special RT routine or is done in-line, depending
1285 ;; on the value of a -m flag.
1287 ;; First define the way we call the subroutine.
1288 (define_expand "mulsi3_subr"
1289 [(set (reg:SI 2) (match_operand:SI 1 "register_operand" ""))
1290 (set (reg:SI 3) (match_operand:SI 2 "register_operand" ""))
1291 (parallel [(set (reg:SI 2) (mult:SI (reg:SI 2) (reg:SI 3)))
1292 (clobber (reg:SI 0))
1293 (clobber (reg:SI 15))])
1294 (set (match_operand:SI 0 "register_operand" "")
1299 (define_expand "mulsi3"
1300 [(set (match_operand:SI 0 "register_operand" "")
1301 (mult:SI (match_operand:SI 1 "register_operand" "")
1302 (match_operand:SI 2 "register_operand" "")))]
1306 if (! TARGET_IN_LINE_MUL)
1308 emit_insn (gen_mulsi3_subr (operands[0], operands[1], operands[2]));
1313 ;; Define the patterns to match.
1314 ;; We would like to provide a delay slot for the insns that call internal
1315 ;; routines, but doing so is risky since reorg will think that the use of
1316 ;; r2 and r3 is completed in the insn needing the delay slot. Also, it
1317 ;; won't know that the cc will be clobbered. So take the safe approach
1318 ;; and don't give them delay slots.
1321 (mult:SI (reg:SI 2) (reg:SI 3)))
1322 (clobber (reg:SI 0))
1323 (clobber (reg:SI 15))]
1324 "! TARGET_IN_LINE_MUL"
1326 [(set_attr "type" "misc")
1327 (set_attr "in_delay_slot" "no")])
1330 [(set (match_operand:SI 0 "register_operand" "=&r")
1331 (mult:SI (match_operand:SI 1 "register_operand" "%r")
1332 (match_operand:SI 2 "register_operand" "r")))]
1333 "TARGET_IN_LINE_MUL"
1335 { return output_in_line_mul (); }"
1336 [(set_attr "length" "38")
1337 (set_attr "type" "multi")])
1339 ;; Handle divide and modulus. The same function returns both values,
1340 ;; so use divmodsi4. This divides arg 1 by arg 2 with quotient to go
1341 ;; into arg 0 and remainder in arg 3.
1343 ;; We want to put REG_EQUAL notes for the two outputs. So we need a
1344 ;; function to do everything else.
1345 (define_expand "divmodsi4_doit"
1347 (match_operand:SI 0 "register_operand" ""))
1349 (match_operand:SI 1 "register_operand" ""))
1350 (parallel [(set (reg:SI 2) (div:SI (reg:SI 2) (reg:SI 3)))
1351 (set (reg:SI 3) (mod:SI (reg:SI 2) (reg:SI 3)))
1352 (clobber (reg:SI 0))
1353 (clobber (reg:SI 15))])]
1357 (define_expand "divmodsi4"
1358 [(parallel [(set (match_operand:SI 0 "register_operand" "")
1359 (div:SI (match_operand:SI 1 "register_operand" "")
1360 (match_operand:SI 2 "register_operand" "")))
1361 (set (match_operand:SI 3 "register_operand" "")
1362 (mod:SI (match_dup 1) (match_dup 2)))])]
1368 emit_insn (gen_divmodsi4_doit (operands[1], operands[2]));
1369 insn = emit_move_insn (operands[0], gen_rtx (REG, SImode, 2));
1370 REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_EQUAL,
1371 gen_rtx (DIV, SImode, operands[1],
1374 insn = emit_move_insn (operands[3], gen_rtx (REG, SImode, 3));
1375 REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_EQUAL,
1376 gen_rtx (MOD, SImode, operands[1],
1384 (div:SI (reg:SI 2) (reg:SI 3)))
1386 (mod:SI (reg:SI 2) (reg:SI 3)))
1387 (clobber (reg:SI 0))
1388 (clobber (reg:SI 15))]
1391 [(set_attr "type" "misc")
1392 (set_attr "in_delay_slot" "no")])
1394 ;; Similarly for unsigned divide.
1395 (define_expand "udivmodsi4_doit"
1397 (match_operand:SI 0 "register_operand" ""))
1399 (match_operand:SI 1 "register_operand" ""))
1400 (parallel [(set (reg:SI 2) (udiv:SI (reg:SI 2) (reg:SI 3)))
1401 (set (reg:SI 3) (umod:SI (reg:SI 2) (reg:SI 3)))
1402 (clobber (reg:SI 0))
1403 (clobber (reg:SI 15))])]
1407 (define_expand "udivmodsi4"
1408 [(parallel [(set (match_operand:SI 0 "register_operand" "")
1409 (udiv:SI (match_operand:SI 1 "register_operand" "")
1410 (match_operand:SI 2 "register_operand" "")))
1411 (set (match_operand:SI 3 "register_operand" "")
1412 (umod:SI (match_dup 1) (match_dup 2)))])]
1418 emit_insn (gen_udivmodsi4_doit (operands[1], operands[2]));
1419 insn = emit_move_insn (operands[0], gen_rtx (REG, SImode, 2));
1420 REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_EQUAL,
1421 gen_rtx (UDIV, SImode, operands[1],
1424 insn = emit_move_insn (operands[3], gen_rtx (REG, SImode, 3));
1425 REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_EQUAL,
1426 gen_rtx (UMOD, SImode, operands[1],
1434 (udiv:SI (reg:SI 2) (reg:SI 3)))
1436 (umod:SI (reg:SI 2) (reg:SI 3)))
1437 (clobber (reg:SI 0))
1438 (clobber (reg:SI 15))]
1440 "bali%# r15,uldiv$$"
1441 [(set_attr "type" "misc")
1442 (set_attr "in_delay_slot" "no")])
1444 ;; Define DImode arithmetic operations.
1446 ;; It is possible to do certain adds and subtracts with constants in a single
1447 ;; insn, but it doesn't seem worth the trouble.
1449 ;; Don't use DEFINE_SPLIT on these because the dependency on CC can't be
1450 ;; easily tracked in that case!
1451 (define_insn "adddi3"
1452 [(set (match_operand:DI 0 "register_operand" "=r")
1453 (plus:DI (match_operand:DI 1 "register_operand" "%0")
1454 (match_operand:DI 2 "register_operand" "r")))]
1456 "a %O0,%O2\;ae %0,%2"
1457 [(set_attr "type" "multi")])
1459 (define_insn "subdi3"
1460 [(set (match_operand:DI 0 "register_operand" "=r")
1461 (minus:DI (match_operand:DI 1 "register_operand" "0")
1462 (match_operand:DI 2 "register_operand" "r")))]
1464 "s %O0,%O2\;se %0,%2"
1465 [(set_attr "type" "multi")])
1467 (define_insn "negdi2"
1468 [(set (match_operand:DI 0 "register_operand" "=r,&r")
1469 (neg:DI (match_operand:DI 1 "register_operand" "0,r")))]
1471 "twoc %O0,%O1\;onec %0,%1\;aei %0,%0,0"
1472 [(set_attr "type" "multi")
1473 (set_attr "length" "8")])
1475 ;; Unary arithmetic operations.
1476 (define_insn "abssi2"
1477 [(set (match_operand:SI 0 "register_operand" "=r")
1478 (abs:SI (match_operand:SI 1 "register_operand" "r")))]
1481 [(set_attr "length" "2")])
1483 (define_insn "negsi2"
1484 [(set (match_operand:SI 0 "register_operand" "=r")
1485 (neg:SI (match_operand:SI 1 "register_operand" "r")))]
1488 [(set_attr "length" "2")])
1490 (define_insn "one_cmplsi2"
1491 [(set (match_operand:SI 0 "register_operand" "=r")
1492 (not:SI (match_operand:SI 1 "register_operand" "r")))]
1495 [(set_attr "length" "2")])
1498 ;; Logical insns: AND, IOR, and XOR
1500 ;; If the operation is being performed on a 32-bit constant such that
1501 ;; it cannot be done in one insn, do it in two. We may lose a bit on
1502 ;; CSE in pathological cases, but it seems better doing it this way.
1503 (define_expand "andsi3"
1504 [(set (match_operand:SI 0 "register_operand" "")
1505 (and:SI (match_operand:SI 1 "register_operand" "")
1506 (match_operand:SI 2 "reg_or_any_cint_operand" "")))]
1510 if (GET_CODE (operands[2]) == CONST_INT)
1512 int top = (unsigned) INTVAL (operands[2]) >> 16;
1513 int bottom = INTVAL (operands[2]) & 0xffff;
1515 if (top != 0 && top != 0xffff && bottom != 0 && bottom != 0xffff)
1517 emit_insn (gen_andsi3 (operands[0], operands[1],
1518 gen_rtx (CONST_INT, VOIDmode,
1519 (top << 16) | 0xffff)));
1520 operands[1] = operands[0];
1521 operands[2] = gen_rtx (CONST_INT, VOIDmode, 0xffff0000 | bottom);
1527 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
1528 (and:SI (match_operand:SI 1 "reg_or_and_operand" "%0,r,0")
1529 (match_operand:SI 2 "reg_or_and_operand" "P,LMO,r")))]
1530 "register_operand (operands[1], SImode)
1531 || register_operand (operands[2], SImode)"
1536 [(set_attr "length" "2,4,2")])
1539 (define_expand "iorsi3"
1540 [(set (match_operand:SI 0 "register_operand" "")
1541 (ior:SI (match_operand:SI 1 "register_operand" "")
1542 (match_operand:SI 2 "reg_or_any_cint_operand" "")))]
1546 if (GET_CODE (operands[2]) == CONST_INT)
1548 int top = (unsigned) INTVAL (operands[2]) >> 16;
1549 int bottom = INTVAL (operands[2]) & 0xffff;
1551 if (top != 0 && bottom != 0)
1553 emit_insn (gen_iorsi3 (operands[0], operands[1],
1554 gen_rtx (CONST_INT, VOIDmode, (top << 16))));
1555 operands[1] = operands[0];
1556 operands[2] = gen_rtx (CONST_INT, VOIDmode, bottom);
1562 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
1563 (ior:SI (match_operand:SI 1 "reg_or_cint_operand" "%0,r,0")
1564 (match_operand:SI 2 "reg_or_cint_operand" "N,LM,r")))]
1565 "register_operand (operands[1], SImode)
1566 || register_operand (operands[2], SImode)"
1571 [(set_attr "length" "2,4,2")])
1573 ;; exclusive-or (XOR)
1574 (define_expand "xorsi3"
1575 [(set (match_operand:SI 0 "register_operand" "")
1576 (xor:SI (match_operand:SI 1 "register_operand" "")
1577 (match_operand:SI 2 "reg_or_any_cint_operand" "")))]
1581 if (GET_CODE (operands[2]) == CONST_INT)
1583 int top = (unsigned) INTVAL (operands[2]) >> 16;
1584 int bottom = INTVAL (operands[2]) & 0xffff;
1586 if (top == 0xffff && bottom == 0xffff)
1588 emit_insn (gen_one_cmplsi2 (operands[0], operands[1]));
1591 else if (top != 0 && bottom != 0)
1593 emit_insn (gen_xorsi3 (operands[0], operands[1],
1594 gen_rtx (CONST_INT, VOIDmode, (top << 16))));
1595 operands[1] = operands[0];
1596 operands[2] = gen_rtx (CONST_INT, VOIDmode, bottom);
1602 [(set (match_operand:SI 0 "register_operand" "=r,r")
1603 (xor:SI (match_operand:SI 1 "reg_or_cint_operand" "%r,0")
1604 (match_operand:SI 2 "reg_or_cint_operand" "LM,r")))]
1605 "register_operand (operands[1], SImode)
1606 || register_operand (operands[2], SImode)"
1610 [(set_attr "length" "4,2")])
1612 ;; Various shift insns
1613 (define_insn "ashrsi3"
1614 [(set (match_operand:SI 0 "register_operand" "=r,r")
1615 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
1616 (match_operand:SI 2 "reg_or_cint_operand" "r,n")))]
1621 [(set_attr "length" "2")])
1623 (define_insn "lshrsi3"
1624 [(set (match_operand:SI 0 "register_operand" "=r,r")
1625 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0,0")
1626 (match_operand:SI 2 "reg_or_cint_operand" "r,n")))]
1631 [(set_attr "length" "2")])
1634 [(set (match_operand:SI 0 "register_operand" "=r")
1635 (ashift:SI (match_operand:SI 1 "register_operand" "b")
1639 [(set_attr "length" "2")
1640 (set_attr "type" "address")])
1642 (define_insn "ashlsi3"
1643 [(set (match_operand:SI 0 "register_operand" "=r,r")
1644 (ashift:SI (match_operand:SI 1 "register_operand" "0,0")
1645 (match_operand:SI 2 "reg_or_cint_operand" "r,n")))]
1650 [(set_attr "length" "2")])
1652 ;; Function call insns:
1654 ;; On the ROMP, &fcn is actually a pointer to the data area, which is passed
1655 ;; to the function in r0. &.fcn is the actual starting address of the
1656 ;; function. Also, the word at &fcn contains &.fcn.
1658 ;; For both functions that do and don't return values, there are two cases:
1659 ;; where the function's address is a constant, and where it isn't.
1661 ;; Operand 1 (2 for `call_value') is the number of arguments and is not used.
1662 (define_expand "call"
1664 (parallel [(call (mem:SI (match_operand:SI 0 "address_operand" ""))
1665 (match_operand 1 "" ""))
1666 (clobber (reg:SI 15))])]
1670 if (GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != CONST_INT)
1673 operands[0] = XEXP (operands[0], 0);
1674 if (GET_CODE (operands[0]) == SYMBOL_REF)
1676 extern rtx get_symref ();
1677 char *real_fcnname =
1678 (char *) alloca (strlen (XSTR (operands[0], 0)) + 2);
1680 /* Copy the data area address to r0. */
1681 emit_move_insn (gen_rtx (REG, SImode, 0),
1682 force_reg (SImode, operands[0]));
1683 strcpy (real_fcnname, \".\");
1684 strcat (real_fcnname, XSTR (operands[0], 0));
1685 operands[0] = get_symref (real_fcnname);
1691 emit_move_insn (gen_rtx (REG, SImode, 0),
1692 force_reg (SImode, operands[0]));
1693 data_access = gen_rtx (MEM, SImode, operands[0]);
1694 RTX_UNCHANGING_P (data_access) = 1;
1695 operands[0] = copy_to_reg (data_access);
1700 [(call (mem:SI (match_operand:SI 0 "register_operand" "b"))
1701 (match_operand 1 "" "g"))
1702 (clobber (reg:SI 15))]
1705 [(set_attr "type" "call")
1706 (set_attr "length" "2")])
1709 [(call (mem:SI (match_operand:SI 0 "romp_symbolic_operand" "i"))
1710 (match_operand 1 "" "g"))
1711 (clobber (reg:SI 15))]
1712 "GET_CODE (operands[0]) == SYMBOL_REF"
1714 [(set_attr "type" "call")])
1716 ;; Call a function and return a value.
1717 (define_expand "call_value"
1719 (parallel [(set (match_operand 0 "" "=fg")
1720 (call (mem:SI (match_operand:SI 1 "address_operand" ""))
1721 (match_operand 2 "" "")))
1722 (clobber (reg:SI 15))])]
1726 if (GET_CODE (operands[1]) != MEM || GET_CODE (operands[2]) != CONST_INT)
1729 operands[1] = XEXP (operands[1], 0);
1730 if (GET_CODE (operands[1]) == SYMBOL_REF)
1732 extern rtx get_symref ();
1733 char *real_fcnname =
1734 (char *) alloca (strlen (XSTR (operands[1], 0)) + 2);
1736 /* Copy the data area address to r0. */
1737 emit_move_insn (gen_rtx (REG, SImode, 0),
1738 force_reg (SImode, operands[1]));
1739 strcpy (real_fcnname, \".\");
1740 strcat (real_fcnname, XSTR (operands[1], 0));
1741 operands[1] = get_symref (real_fcnname);
1747 emit_move_insn (gen_rtx (REG, SImode, 0),
1748 force_reg (SImode, operands[1]));
1749 data_access = gen_rtx (MEM, SImode, operands[1]);
1750 RTX_UNCHANGING_P (data_access) = 1;
1751 operands[1] = copy_to_reg (data_access);
1756 [(set (match_operand 0 "" "=fg")
1757 (call (mem:SI (match_operand:SI 1 "register_operand" "b"))
1758 (match_operand 2 "" "g")))
1759 (clobber (reg:SI 15))]
1762 [(set_attr "length" "2")
1763 (set_attr "type" "call")])
1766 [(set (match_operand 0 "" "=fg")
1767 (call (mem:SI (match_operand:SI 1 "romp_symbolic_operand" "i"))
1768 (match_operand 2 "" "g")))
1769 (clobber (reg:SI 15))]
1770 "GET_CODE (operands[1]) == SYMBOL_REF"
1772 [(set_attr "type" "call")])
1774 ;; Call subroutine returning any type.
1776 (define_expand "untyped_call"
1777 [(parallel [(call (match_operand 0 "" "")
1779 (match_operand 1 "" "")
1780 (match_operand 2 "" "")])]
1786 emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
1788 for (i = 0; i < XVECLEN (operands[2], 0); i++)
1790 rtx set = XVECEXP (operands[2], 0, i);
1791 emit_move_insn (SET_DEST (set), SET_SRC (set));
1794 /* The optimizer does not know that the call sets the function value
1795 registers we stored in the result block. We avoid problems by
1796 claiming that all hard registers are used and clobbered at this
1798 emit_insn (gen_blockage ());
1803 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
1804 ;; all of memory. This blocks insns from being moved across this point.
1806 (define_insn "blockage"
1807 [(unspec_volatile [(const_int 0)] 0)]
1811 ;; No operation insn.
1816 [(set_attr "type" "address")
1817 (set_attr "length" "2")
1818 (set_attr "cc" "none")])
1820 ;; Here are the floating-point operations.
1822 ;; Start by providing DEFINE_EXPAND for each operation.
1823 ;; The insns will be handled with MATCH_OPERATOR; the methodology will be
1826 ;; First the conversion operations.
1828 (define_expand "truncdfsf2"
1829 [(parallel [(set (match_operand:SF 0 "general_operand" "")
1830 (float_truncate:SF (match_operand:DF 1 "general_operand" "")))
1831 (clobber (reg:SI 0))
1832 (clobber (reg:SI 15))])]
1836 (define_expand "extendsfdf2"
1837 [(parallel [(set (match_operand:DF 0 "general_operand" "")
1838 (float_extend:DF (match_operand:SF 1 "general_operand" "")))
1839 (clobber (reg:SI 0))
1840 (clobber (reg:SI 15))])]
1844 (define_expand "floatsisf2"
1845 [(parallel [(set (match_operand:SF 0 "general_operand" "")
1846 (float:SF (match_operand:SI 1 "general_operand" "")))
1847 (clobber (reg:SI 0))
1848 (clobber (reg:SI 15))])]
1852 (define_expand "floatsidf2"
1853 [(parallel [(set (match_operand:DF 0 "general_operand" "")
1854 (float:DF (match_operand:SI 1 "general_operand" "")))
1855 (clobber (reg:SI 0))
1856 (clobber (reg:SI 15))])]
1860 (define_expand "fix_truncsfsi2"
1861 [(parallel [(set (match_operand:SI 0 "general_operand" "")
1862 (fix:SI (match_operand:SF 1 "general_operand" "")))
1863 (clobber (reg:SI 0))
1864 (clobber (reg:SI 15))])]
1868 (define_expand "fix_truncdfsi2"
1869 [(parallel [(set (match_operand:SI 0 "general_operand" "")
1870 (fix:SI (match_operand:DF 1 "general_operand" "")))
1871 (clobber (reg:SI 0))
1872 (clobber (reg:SI 15))])]
1876 ;; Now the binary operations.
1878 (define_expand "addsf3"
1879 [(parallel [(set (match_operand:SF 0 "general_operand" "")
1880 (plus:SF (match_operand:SF 1 "general_operand" "")
1881 (match_operand:SF 2 "general_operand" "")))
1882 (clobber (reg:SI 0))
1883 (clobber (reg:SI 15))])]
1887 (define_expand "adddf3"
1888 [(parallel [(set (match_operand:DF 0 "general_operand" "")
1889 (plus:DF (match_operand:DF 1 "general_operand" "")
1890 (match_operand:DF 2 "general_operand" "")))
1891 (clobber (reg:SI 0))
1892 (clobber (reg:SI 15))])]
1896 (define_expand "subsf3"
1897 [(parallel [(set (match_operand:SF 0 "general_operand" "")
1898 (minus:SF (match_operand:SF 1 "general_operand" "")
1899 (match_operand:SF 2 "general_operand" "")))
1900 (clobber (reg:SI 0))
1901 (clobber (reg:SI 15))])]
1905 (define_expand "subdf3"
1906 [(parallel [(set (match_operand:DF 0 "general_operand" "")
1907 (minus:DF (match_operand:DF 1 "general_operand" "")
1908 (match_operand:DF 2 "general_operand" "")))
1909 (clobber (reg:SI 0))
1910 (clobber (reg:SI 15))])]
1914 (define_expand "mulsf3"
1915 [(parallel [(set (match_operand:SF 0 "general_operand" "")
1916 (mult:SF (match_operand:SF 1 "general_operand" "")
1917 (match_operand:SF 2 "general_operand" "")))
1918 (clobber (reg:SI 0))
1919 (clobber (reg:SI 15))])]
1923 (define_expand "muldf3"
1924 [(parallel [(set (match_operand:DF 0 "general_operand" "")
1925 (mult:DF (match_operand:DF 1 "general_operand" "")
1926 (match_operand:DF 2 "general_operand" "")))
1927 (clobber (reg:SI 0))
1928 (clobber (reg:SI 15))])]
1932 (define_expand "divsf3"
1933 [(parallel [(set (match_operand:SF 0 "general_operand" "")
1934 (div:SF (match_operand:SF 1 "general_operand" "")
1935 (match_operand:SF 2 "general_operand" "")))
1936 (clobber (reg:SI 0))
1937 (clobber (reg:SI 15))])]
1941 (define_expand "divdf3"
1942 [(parallel [(set (match_operand:DF 0 "general_operand" "")
1943 (div:DF (match_operand:DF 1 "general_operand" "")
1944 (match_operand:DF 2 "general_operand" "")))
1945 (clobber (reg:SI 0))
1946 (clobber (reg:SI 15))])]
1950 ;; Unary floating-point operations.
1952 ;; Negations can be done without floating-point, since this is IEEE.
1953 ;; But we cannot do this if an operand is a hard FP register, since
1954 ;; the SUBREG we create would not be valid.
1955 (define_expand "negsf2"
1956 [(set (match_operand:SF 0 "register_operand" "")
1957 (neg:SF (match_operand:SF 1 "register_operand" "")))]
1961 if (! (GET_CODE (operands[0]) == REG
1962 && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
1963 && FP_REGNO_P (REGNO (operands[0])))
1964 && ! (GET_CODE (operands[1]) == REG
1965 && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
1966 && FP_REGNO_P (REGNO (operands[1]))))
1969 rtx target = operand_subword (operands[0], 0, 1, SFmode);
1971 result = expand_binop (SImode, xor_optab,
1972 operand_subword_force (operands[1], 0, SFmode),
1973 gen_rtx (CONST_INT, VOIDmode, 0x80000000),
1974 target, 0, OPTAB_WIDEN);
1978 if (result != target)
1979 emit_move_insn (result, target);
1981 /* Make a place for REG_EQUAL. */
1982 emit_move_insn (operands[0], operands[0]);
1987 (define_expand "negdf2"
1988 [(set (match_operand:DF 0 "register_operand" "")
1989 (neg:DF (match_operand:DF 1 "register_operand" "")))]
1993 if (! (GET_CODE (operands[0]) == REG
1994 && REGNO (operands[0]) < FIRST_PSEUDO_REGISTER
1995 && FP_REGNO_P (REGNO (operands[0])))
1996 && ! (GET_CODE (operands[1]) == REG
1997 && REGNO (operands[1]) < FIRST_PSEUDO_REGISTER
1998 && FP_REGNO_P (REGNO (operands[1]))))
2001 rtx target = operand_subword (operands[0], 0, 1, DFmode);
2005 result = expand_binop (SImode, xor_optab,
2006 operand_subword_force (operands[1], 0, DFmode),
2007 gen_rtx (CONST_INT, VOIDmode, 0x80000000),
2008 target, 0, OPTAB_WIDEN);
2012 if (result != target)
2013 emit_move_insn (result, target);
2015 emit_move_insn (operand_subword (operands[0], 1, 1, DFmode),
2016 operand_subword_force (operands[1], 1, DFmode));
2018 insns = get_insns ();
2021 emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
2026 (define_expand "abssf2"
2027 [(parallel [(set (match_operand:SF 0 "general_operand" "")
2028 (abs:SF (match_operand:SF 1 "general_operand" "")))
2029 (clobber (reg:SI 0))
2030 (clobber (reg:SI 15))])]
2034 (define_expand "absdf2"
2035 [(parallel [(set (match_operand:DF 0 "general_operand" "")
2036 (abs:DF (match_operand:DF 1 "general_operand" "")))
2037 (clobber (reg:SI 0))
2038 (clobber (reg:SI 15))])]
2042 ;; Any floating-point operation can be either SFmode or DFmode, and each
2043 ;; operand (including the output) can be either a normal operand or a
2044 ;; conversion from a normal operand.
2046 ;; We use MATCH_OPERATOR to match a floating-point binary or unary operator
2047 ;; and input and output conversions. So we need 2^N patterns for each type
2048 ;; of operation, where N is the number of operands, including the output.
2049 ;; There are thus a total of 14 patterns, 8 for binary operations, 4 for
2050 ;; unary operations and two for conversion/move operations (only one
2051 ;; operand can have a conversion for move operations). In addition, we have
2052 ;; to be careful that a floating-point reload register doesn't get allocated
2053 ;; for an integer. We take care of this for inputs with PREFERRED_RELOAD_CLASS
2054 ;; but need to have two different constraints for outputs. This means that
2055 ;; we have to duplicate each pattern where the output could be an integer.
2056 ;; This adds another 7 patterns, for a total of 21.
2058 ;; Start with conversion operations (moves are done above).
2061 [(set (match_operand:SI 0 "general_operand" "=g")
2062 (match_operator 1 "float_conversion"
2063 [(match_operand 2 "general_operand" "frg")]))
2064 (clobber (match_operand:SI 3 "reg_0_operand" "=&z"))
2065 (clobber (match_operand:SI 4 "reg_15_operand" "=&t"))]
2068 { return output_fpop (SET, operands[0], operands[2], 0, insn);
2070 [(set_attr "type" "fp")])
2073 [(set (match_operand 0 "general_operand" "=frg")
2074 (match_operator 1 "float_conversion"
2075 [(match_operand 2 "general_operand" "frg")]))
2076 (clobber (match_operand:SI 3 "reg_0_operand" "=&z"))
2077 (clobber (match_operand:SI 4 "reg_15_operand" "=&t"))]
2080 { return output_fpop (SET, operands[0], operands[2], 0, insn);
2082 [(set_attr "type" "fp")])
2084 ;; Next, binary floating-point operations.
2087 [(set (match_operand 0 "general_operand" "=frg")
2088 (match_operator 1 "float_binary"
2089 [(match_operand 2 "general_operand" "frg")
2090 (match_operand 3 "general_operand" "frg")]))
2091 (clobber (match_operand:SI 4 "reg_0_operand" "=&z"))
2092 (clobber (match_operand:SI 5 "reg_15_operand" "=&t"))]
2093 "check_precision (GET_MODE (operands[1]), operands[2], operands[3])"
2095 { return output_fpop (GET_CODE (operands[1]), operands[0],
2096 operands[2], operands[3], insn);
2098 [(set_attr "type" "fp")])
2101 [(set (match_operand 0 "general_operand" "=frg")
2102 (match_operator 1 "float_binary"
2103 [(match_operand 2 "general_operand" "frg")
2104 (match_operator 3 "float_conversion"
2105 [(match_operand 4 "general_operand" "frg")])]))
2106 (clobber (match_operand:SI 5 "reg_0_operand" "=&z"))
2107 (clobber (match_operand:SI 6 "reg_15_operand" "=&t"))]
2108 "check_precision (GET_MODE (operands[1]), operands[2], operands[4])"
2110 { return output_fpop (GET_CODE (operands[1]), operands[0],
2111 operands[2], operands[4], insn);
2113 [(set_attr "type" "fp")])
2116 [(set (match_operand 0 "general_operand" "=frg")
2117 (match_operator 1 "float_binary"
2118 [(match_operator 2 "float_conversion"
2119 [(match_operand 3 "general_operand" "frg")])
2120 (match_operand 4 "general_operand" "frg")]))
2121 (clobber (match_operand:SI 5 "reg_0_operand" "=&z"))
2122 (clobber (match_operand:SI 6 "reg_15_operand" "=&t"))]
2123 "check_precision (GET_MODE (operands[1]), operands[3], operands[4])"
2125 { return output_fpop (GET_CODE (operands[1]), operands[0],
2126 operands[3], operands[4], insn);
2128 [(set_attr "type" "fp")])
2131 [(set (match_operand 0 "general_operand" "=frg")
2132 (match_operator 1 "float_binary"
2133 [(match_operator 2 "float_conversion"
2134 [(match_operand 3 "general_operand" "frg")])
2135 (match_operator 4 "float_conversion"
2136 [(match_operand 5 "general_operand" "frg")])]))
2137 (clobber (match_operand:SI 6 "reg_0_operand" "=&z"))
2138 (clobber (match_operand:SI 7 "reg_15_operand" "=&t"))]
2139 "check_precision (GET_MODE (operands[1]), operands[3], operands[5])"
2141 { return output_fpop (GET_CODE (operands[1]), operands[0],
2142 operands[3], operands[5], insn);
2144 [(set_attr "type" "fp")])
2147 [(set (match_operand:SI 0 "general_operand" "=g")
2148 (match_operator 1 "float_conversion"
2149 [(match_operator 2 "float_binary"
2150 [(match_operand 3 "general_operand" "frg")
2151 (match_operand 4 "general_operand" "frg")])]))
2152 (clobber (match_operand:SI 5 "reg_0_operand" "=&z"))
2153 (clobber (match_operand:SI 6 "reg_15_operand" "=&t"))]
2154 "check_precision (GET_MODE (operands[2]), operands[3], operands[4])"
2156 { return output_fpop (GET_CODE (operands[2]), operands[0],
2157 operands[3], operands[4], insn);
2159 [(set_attr "type" "fp")])
2162 [(set (match_operand 0 "general_operand" "=frg")
2163 (match_operator 1 "float_conversion"
2164 [(match_operator 2 "float_binary"
2165 [(match_operand 3 "general_operand" "frg")
2166 (match_operand 4 "general_operand" "frg")])]))
2167 (clobber (match_operand:SI 5 "reg_0_operand" "=&z"))
2168 (clobber (match_operand:SI 6 "reg_15_operand" "=&t"))]
2169 "check_precision (GET_MODE (operands[2]), operands[3], operands[4])"
2171 { return output_fpop (GET_CODE (operands[2]), operands[0],
2172 operands[3], operands[4], insn);
2174 [(set_attr "type" "fp")])
2177 [(set (match_operand:SI 0 "general_operand" "=g")
2178 (match_operator 1 "float_conversion"
2179 [(match_operator 2 "float_binary"
2180 [(match_operand 3 "general_operand" "frg")
2181 (match_operator 4 "float_conversion"
2182 [(match_operand 5 "general_operand" "frg")])])]))
2183 (clobber (match_operand:SI 6 "reg_0_operand" "=&z"))
2184 (clobber (match_operand:SI 7 "reg_15_operand" "=&t"))]
2185 "check_precision (GET_MODE (operands[2]), operands[3], operands[4])"
2187 { return output_fpop (GET_CODE (operands[2]), operands[0],
2188 operands[3], operands[5], insn);
2190 [(set_attr "type" "fp")])
2193 [(set (match_operand 0 "general_operand" "=frg")
2194 (match_operator 1 "float_conversion"
2195 [(match_operator 2 "float_binary"
2196 [(match_operand 3 "general_operand" "frg")
2197 (match_operator 4 "float_conversion"
2198 [(match_operand 5 "general_operand" "frg")])])]))
2199 (clobber (match_operand:SI 6 "reg_0_operand" "=&z"))
2200 (clobber (match_operand:SI 7 "reg_15_operand" "=&t"))]
2201 "check_precision (GET_MODE (operands[2]), operands[3], operands[4])"
2203 { return output_fpop (GET_CODE (operands[2]), operands[0],
2204 operands[3], operands[5], insn);
2206 [(set_attr "type" "fp")])
2209 [(set (match_operand:SI 0 "general_operand" "=g")
2210 (match_operator 1 "float_conversion"
2211 [(match_operator 2 "float_binary"
2212 [(match_operator 3 "float_conversion"
2213 [(match_operand 4 "general_operand" "frg")])
2214 (match_operand 5 "general_operand" "frg")])]))
2215 (clobber (match_operand:SI 6 "reg_0_operand" "=&z"))
2216 (clobber (match_operand:SI 7 "reg_15_operand" "=&t"))]
2217 "check_precision (GET_MODE (operands[2]), operands[4], operands[5])"
2219 { return output_fpop (GET_CODE (operands[2]), operands[0],
2220 operands[4], operands[5], insn);
2222 [(set_attr "type" "fp")])
2225 [(set (match_operand 0 "general_operand" "=frg")
2226 (match_operator 1 "float_conversion"
2227 [(match_operator 2 "float_binary"
2228 [(match_operator 3 "float_conversion"
2229 [(match_operand 4 "general_operand" "frg")])
2230 (match_operand 5 "general_operand" "frg")])]))
2231 (clobber (match_operand:SI 6 "reg_0_operand" "=&z"))
2232 (clobber (match_operand:SI 7 "reg_15_operand" "=&t"))]
2233 "check_precision (GET_MODE (operands[2]), operands[4], operands[5])"
2235 { return output_fpop (GET_CODE (operands[2]), operands[0],
2236 operands[4], operands[5], insn);
2238 [(set_attr "type" "fp")])
2241 [(set (match_operand:SI 0 "general_operand" "=g")
2242 (match_operator 1 "float_conversion"
2243 [(match_operator 2 "float_binary"
2244 [(match_operator 3 "float_conversion"
2245 [(match_operand 4 "general_operand" "frg")])
2246 (match_operator 5 "float_conversion"
2247 [(match_operand 6 "general_operand" "frg")])])]))
2248 (clobber (match_operand:SI 7 "reg_0_operand" "=&z"))
2249 (clobber (match_operand:SI 8 "reg_15_operand" "=&t"))]
2250 "check_precision (GET_MODE (operands[2]), operands[4], operands[6])"
2252 { return output_fpop (GET_CODE (operands[2]), operands[0],
2253 operands[4], operands[6], insn);
2255 [(set_attr "type" "fp")])
2258 [(set (match_operand 0 "general_operand" "=frg")
2259 (match_operator 1 "float_conversion"
2260 [(match_operator 2 "float_binary"
2261 [(match_operator 3 "float_conversion"
2262 [(match_operand 4 "general_operand" "frg")])
2263 (match_operator 5 "float_conversion"
2264 [(match_operand 6 "general_operand" "frg")])])]))
2265 (clobber (match_operand:SI 7 "reg_0_operand" "=&z"))
2266 (clobber (match_operand:SI 8 "reg_15_operand" "=&t"))]
2267 "check_precision (GET_MODE (operands[2]), operands[4], operands[6])"
2269 { return output_fpop (GET_CODE (operands[2]), operands[0],
2270 operands[4], operands[6], insn);
2272 [(set_attr "type" "fp")])
2274 ;; Unary floating-point operations.
2277 [(set (match_operand 0 "general_operand" "=frg")
2278 (match_operator 1 "float_unary"
2279 [(match_operand 2 "general_operand" "frg")]))
2280 (clobber (match_operand:SI 3 "reg_0_operand" "=&z"))
2281 (clobber (match_operand:SI 4 "reg_15_operand" "=&t"))]
2282 "check_precision (GET_MODE (operands[1]), operands[2], 0)"
2284 { return output_fpop (GET_CODE (operands[1]), operands[0], operands[2],
2287 [(set_attr "type" "fp")])
2290 [(set (match_operand 0 "general_operand" "=frg")
2291 (match_operator 1 "float_unary"
2292 [(match_operator 2 "float_conversion"
2293 [(match_operand 3 "general_operand" "frg")])]))
2294 (clobber (match_operand:SI 4 "reg_0_operand" "=&z"))
2295 (clobber (match_operand:SI 5 "reg_15_operand" "=&t"))]
2296 "check_precision (GET_MODE (operands[1]), operands[3], 0)"
2298 { return output_fpop (GET_CODE (operands[1]), operands[0], operands[3],
2301 [(set_attr "type" "fp")])
2304 [(set (match_operand:SI 0 "general_operand" "=g")
2305 (match_operator 1 "float_conversion"
2306 [(match_operator 2 "float_unary"
2307 [(match_operand 3 "general_operand" "frg")])]))
2308 (clobber (match_operand:SI 4 "reg_0_operand" "=&z"))
2309 (clobber (match_operand:SI 5 "reg_15_operand" "=&t"))]
2310 "check_precision (GET_MODE (operands[2]), operands[3], 0)"
2312 { return output_fpop (GET_CODE (operands[2]), operands[0], operands[3],
2315 [(set_attr "type" "fp")])
2318 [(set (match_operand 0 "general_operand" "=frg")
2319 (match_operator 1 "float_conversion"
2320 [(match_operator 2 "float_unary"
2321 [(match_operand 3 "general_operand" "frg")])]))
2322 (clobber (match_operand:SI 4 "reg_0_operand" "=&z"))
2323 (clobber (match_operand:SI 5 "reg_15_operand" "=&t"))]
2324 "check_precision (GET_MODE (operands[2]), operands[3], 0)"
2326 { return output_fpop (GET_CODE (operands[2]), operands[0], operands[3],
2329 [(set_attr "type" "fp")])
2332 [(set (match_operand:SI 0 "general_operand" "=g")
2333 (match_operator 1 "float_conversion"
2334 [(match_operator 2 "float_unary"
2335 [(match_operator 3 "float_conversion"
2336 [(match_operand 4 "general_operand" "frg")])])]))
2337 (clobber (match_operand:SI 5 "reg_0_operand" "=&z"))
2338 (clobber (match_operand:SI 6 "reg_15_operand" "=&t"))]
2339 "check_precision (GET_MODE (operands[2]), operands[4], 0)"
2341 { return output_fpop (GET_CODE (operands[2]), operands[0], operands[4],
2344 [(set_attr "type" "fp")])
2347 [(set (match_operand 0 "general_operand" "=frg")
2348 (match_operator 1 "float_conversion"
2349 [(match_operator 2 "float_unary"
2350 [(match_operator 3 "float_conversion"
2351 [(match_operand 4 "general_operand" "frg")])])]))
2352 (clobber (match_operand:SI 5 "reg_0_operand" "=&z"))
2353 (clobber (match_operand:SI 6 "reg_15_operand" "=&t"))]
2354 "check_precision (GET_MODE (operands[2]), operands[4], 0)"
2356 { return output_fpop (GET_CODE (operands[2]), operands[0], operands[4],
2359 [(set_attr "type" "fp")])
2361 ;; Compare insns are next. Note that the ROMP has two types of compares,
2362 ;; signed & unsigned, and one type of branch. Use the routine
2363 ;; `next_insn_tests_no_unsigned' to see which type to use.
2364 (define_expand "tstsi"
2366 (match_operand:SI 0 "register_operand" "r"))]
2370 (define_expand "cmpsi"
2372 (compare (match_operand:SI 0 "register_operand" "")
2373 (match_operand:SI 1 "reg_or_cint_operand" "")))]
2377 ;; Signed compare, `test' first.
2381 (match_operand:SI 0 "register_operand" "r"))]
2382 "next_insn_tests_no_unsigned (insn)"
2384 [(set_attr "length" "2")
2385 (set_attr "type" "compare")])
2388 [(set (cc0) (match_operand:SI 0 "register_operand" "r,r,r"))
2389 (set (match_operand:SI 1 "reg_or_nonsymb_mem_operand" "=0,r,Q")
2391 "next_insn_tests_no_unsigned (insn)"
2395 st%M1 %0,%1\;cis %0,0"
2396 [(set_attr "type" "compare,compare,store")
2397 (set_attr "length" "2,4,6")
2398 (set_attr "cc" "compare")])
2402 (compare (match_operand:SI 0 "register_operand" "r,r,r")
2403 (match_operand:SI 1 "reg_or_cint_operand" "I,K,r")))]
2404 "next_insn_tests_no_unsigned (insn)"
2409 [(set_attr "length" "2,4,2")
2410 (set_attr "type" "compare")])
2412 ;; Unsigned comparisons, `test' first, again.
2415 (match_operand:SI 0 "register_operand" "r"))]
2416 "! next_insn_tests_no_unsigned (insn)"
2418 [(set_attr "type" "compare")])
2422 (compare (match_operand:SI 0 "register_operand" "r,r")
2423 (match_operand:SI 1 "reg_or_cint_operand" "K,r")))]
2424 "! next_insn_tests_no_unsigned (insn)"
2428 [(set_attr "length" "4,2")
2429 (set_attr "type" "compare")])
2431 ;; Bit test insn. Many cases are converted into this by combine. This
2432 ;; uses the ROMP test bit.
2436 (zero_extract (match_operand:SI 0 "register_operand" "r,r")
2438 (match_operand:SI 1 "reg_or_any_cint_operand" "r,n")))]
2439 "next_insn_tests_no_inequality (insn)"
2443 [(set_attr "length" "2")
2444 (set_attr "type" "compare")
2445 (set_attr "cc" "tbit")])
2447 ;; Floating-point comparisons. There are two, equality and order.
2448 ;; The difference will be that a trap for NaN will be given on the orderr
2449 ;; comparisons only.
2451 (define_expand "cmpsf"
2452 [(parallel [(set (cc0) (compare (match_operand:SF 0 "general_operand" "")
2453 (match_operand:SF 1 "general_operand" "")))
2454 (clobber (reg:SI 0))
2455 (clobber (reg:SI 15))])]
2459 (define_expand "cmpdf"
2460 [(parallel [(set (cc0) (compare (match_operand:DF 0 "general_operand" "")
2461 (match_operand:DF 1 "general_operand" "")))
2462 (clobber (reg:SI 0))
2463 (clobber (reg:SI 15))])]
2467 (define_expand "tstsf"
2468 [(parallel [(set (cc0) (match_operand:SF 0 "general_operand" ""))
2469 (clobber (reg:SI 0))
2470 (clobber (reg:SI 15))])]
2474 (define_expand "tstdf"
2475 [(parallel [(set (cc0) (match_operand:DF 0 "general_operand" ""))
2476 (clobber (reg:SI 0))
2477 (clobber (reg:SI 15))])]
2481 ;; There are four cases for compare and two for test. These correspond
2482 ;; to each input having a floating-point conversion or not.
2485 [(set (cc0) (compare (match_operand 0 "general_operand" "frg")
2486 (match_operand 1 "general_operand" "frg")))
2487 (clobber (match_operand:SI 2 "reg_0_operand" "=&z"))
2488 (clobber (match_operand:SI 3 "reg_15_operand" "=&t"))]
2489 "GET_MODE (operands[1]) == SFmode || GET_MODE (operands[1]) == DFmode"
2491 { return output_fpop (next_insn_tests_no_inequality (insn) ? EQ : GE,
2492 operands[0], operands[1], 0, insn);
2494 [(set_attr "type" "fp")
2495 (set_attr "cc" "compare")])
2498 [(set (cc0) (compare (match_operand 0 "general_operand" "frg")
2499 (match_operator 1 "float_conversion"
2500 [(match_operand 2 "general_operand" "frg")])))
2501 (clobber (match_operand:SI 3 "reg_0_operand" "=&z"))
2502 (clobber (match_operand:SI 4 "reg_15_operand" "=&t"))]
2505 { return output_fpop (next_insn_tests_no_inequality (insn) ? EQ : GE,
2506 operands[0], operands[2], 0, insn);
2508 [(set_attr "type" "fp")
2509 (set_attr "cc" "compare")])
2512 [(set (cc0) (compare (match_operator 0 "float_conversion"
2513 [(match_operand 1 "general_operand" "frg")])
2514 (match_operand 2 "general_operand" "frg")))
2515 (clobber (match_operand:SI 3 "reg_0_operand" "=&z"))
2516 (clobber (match_operand:SI 4 "reg_15_operand" "=&t"))]
2519 { return output_fpop (next_insn_tests_no_inequality (insn) ? EQ : GE,
2520 operands[1], operands[2], 0, insn);
2522 [(set_attr "type" "fp")
2523 (set_attr "cc" "compare")])
2526 [(set (cc0) (compare (match_operator 0 "float_conversion"
2527 [(match_operand 1 "general_operand" "frg")])
2528 (match_operator 2 "float_conversion"
2529 [(match_operand 3 "general_operand" "frg")])))
2530 (clobber (match_operand:SI 4 "reg_0_operand" "=&z"))
2531 (clobber (match_operand:SI 5 "reg_15_operand" "=&t"))]
2534 { return output_fpop (next_insn_tests_no_inequality (insn) ? EQ : GE,
2535 operands[1], operands[3], 0, insn);
2537 [(set_attr "type" "fp")
2538 (set_attr "cc" "compare")])
2541 [(set (cc0) (match_operand 0 "general_operand" "frg"))
2542 (clobber (match_operand:SI 1 "reg_0_operand" "=&z"))
2543 (clobber (match_operand:SI 2 "reg_15_operand" "=&t"))]
2544 "GET_MODE (operands[0]) == SFmode || GET_MODE (operands[0]) == DFmode"
2546 { return output_fpop (next_insn_tests_no_inequality (insn) ? EQ : GE,
2547 operands[0], CONST0_RTX (GET_MODE (operands[0])),
2550 [(set_attr "type" "fp")
2551 (set_attr "cc" "compare")])
2554 [(set (cc0) (match_operator 0 "float_conversion"
2555 [(match_operand 1 "general_operand" "frg")]))
2556 (clobber (match_operand:SI 2 "reg_0_operand" "=&z"))
2557 (clobber (match_operand:SI 3 "reg_15_operand" "=&t"))]
2560 { return output_fpop (next_insn_tests_no_inequality (insn) ? EQ : GE,
2561 operands[1], CONST0_RTX (GET_MODE (operands[1])),
2564 [(set_attr "type" "fp")
2565 (set_attr "cc" "compare")])
2567 ;; Branch insns. Unsigned vs. signed have already
2568 ;; been taken care of. The only insns that need to be concerned about the
2569 ;; test bit are beq and bne because the rest are either always true,
2570 ;; always false, or converted to EQ or NE.
2572 ;; For conditional branches, we use `define_expand' and just have two patterns
2573 ;; that match them. Operand printing does most of the work.
2575 (define_expand "beq"
2577 (if_then_else (eq (cc0)
2579 (label_ref (match_operand 0 "" ""))
2584 (define_expand "bne"
2586 (if_then_else (ne (cc0)
2588 (label_ref (match_operand 0 "" ""))
2593 (define_expand "bgt"
2595 (if_then_else (gt (cc0)
2597 (label_ref (match_operand 0 "" ""))
2602 (define_expand "bgtu"
2604 (if_then_else (gtu (cc0)
2606 (label_ref (match_operand 0 "" ""))
2611 (define_expand "blt"
2613 (if_then_else (lt (cc0)
2615 (label_ref (match_operand 0 "" ""))
2620 (define_expand "bltu"
2622 (if_then_else (ltu (cc0)
2624 (label_ref (match_operand 0 "" ""))
2629 (define_expand "bge"
2631 (if_then_else (ge (cc0)
2633 (label_ref (match_operand 0 "" ""))
2638 (define_expand "bgeu"
2640 (if_then_else (geu (cc0)
2642 (label_ref (match_operand 0 "" ""))
2647 (define_expand "ble"
2649 (if_then_else (le (cc0)
2651 (label_ref (match_operand 0 "" ""))
2656 (define_expand "bleu"
2658 (if_then_else (leu (cc0)
2660 (label_ref (match_operand 0 "" ""))
2665 ;; Define both directions of branch and return.
2669 (if_then_else (match_operator 1 "comparison_operator"
2670 [(cc0) (const_int 0)])
2671 (label_ref (match_operand 0 "" ""))
2676 if (restore_compare_p (operands[1]))
2678 else if (get_attr_length (insn) == 2)
2679 return \"j%j1 %l0\";
2681 return \"b%j1%# %l0\";
2683 [(set_attr "type" "branch")])
2687 (if_then_else (match_operator 0 "comparison_operator"
2688 [(cc0) (const_int 0)])
2694 if (restore_compare_p (operands[0]))
2697 return \"b%j0r%# r15\";
2699 [(set_attr "type" "return")])
2703 (if_then_else (match_operator 1 "comparison_operator"
2704 [(cc0) (const_int 0)])
2706 (label_ref (match_operand 0 "" ""))))]
2710 if (restore_compare_p (operands[1]))
2712 else if (get_attr_length (insn) == 2)
2713 return \"j%J1 %l0\";
2715 return \"b%J1%# %l0\";
2717 [(set_attr "type" "branch")])
2721 (if_then_else (match_operator 0 "comparison_operator"
2722 [(cc0) (const_int 0)])
2728 if (restore_compare_p (operands[0]))
2731 return \"b%J0r%# r15\";
2733 [(set_attr "type" "return")])
2735 ;; Unconditional branch and return.
2739 (label_ref (match_operand 0 "" "")))]
2743 if (get_attr_length (insn) == 2)
2748 [(set_attr "type" "branch")])
2750 (define_insn "return"
2754 [(set_attr "type" "return")])
2756 (define_insn "indirect_jump"
2757 [(set (pc) (match_operand:SI 0 "register_operand" "r"))]
2760 [(set_attr "type" "ibranch")])
2762 ;; Table jump for switch statements:
2763 (define_insn "tablejump"
2765 (match_operand:SI 0 "register_operand" "r"))
2766 (use (label_ref (match_operand 1 "" "")))]
2769 [(set_attr "type" "ibranch")])