1 ;;- Machine description for GNU compiler, Motorola 68000 Version
2 ;; Copyright (C) 1987, 1988, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003
3 ;; Free Software Foundation, Inc.
5 ;; This file is part of GCC.
7 ;; GCC is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 2, or (at your option)
12 ;; GCC is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GCC; see the file COPYING. If not, write to
19 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
20 ;; Boston, MA 02111-1307, USA.
22 ;;- Information about MCF5200 port.
24 ;;- The MCF5200 "ColdFire" architecture is a reduced version of the
25 ;;- 68k ISA. Differences include reduced support for byte and word
26 ;;- operands and the removal of BCD, bitfield, rotate, and integer
27 ;;- divide instructions. The TARGET_COLDFIRE flag turns the use of the
28 ;;- removed opcodes and addressing modes off.
32 ;;- instruction definitions
34 ;;- @@The original PO technology requires these to be ordered by speed,
35 ;;- @@ so that assigner will pick the fastest.
37 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
39 ;;- When naming insn's (operand 0 of define_insn) be careful about using
40 ;;- names from other targets machine descriptions.
42 ;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
43 ;;- updates for most instructions.
45 ;;- Operand classes for the register allocator:
46 ;;- 'a' one of the address registers can be used.
47 ;;- 'd' one of the data registers can be used.
48 ;;- 'f' one of the m68881 registers can be used
49 ;;- 'r' either a data or an address register can be used.
51 ;;- Immediate Floating point operator constraints
52 ;;- 'G' a floating point constant that is *NOT* one of the standard
53 ;; 68881 constant values (to force calling output_move_const_double
54 ;; to get it from rom if it is a 68881 constant).
56 ;; See the functions standard_XXX_constant_p in output-m68k.c for more
59 ;;- Immediate integer operand constraints:
61 ;;- 'J' -32768 .. 32767
62 ;;- 'K' all integers EXCEPT -128 .. 127
64 ;;- 'M' all integers EXCEPT -256 .. 255
70 ;;- "%." size separator ("." or "") move%.l d0,d1
71 ;;- "%#" immediate separator ("#" or "") move%.l %#0,d0
72 ;;- "%-" push operand "sp@-" move%.l d0,%-
73 ;;- "%+" pop operand "sp@+" move%.l d0,%+
74 ;;- "%@" top of stack "sp@" move%.l d0,%@
75 ;;- "%!" fpcr register
76 ;;- "%$" single-precision fp specifier ("s" or "") f%$add.x fp0,fp1
77 ;;- "%&" double-precision fp specifier ("d" or "") f%&add.x fp0,fp1
79 ;;- Information about 68040 port.
81 ;;- The 68040 executes all 68030 and 68881/2 instructions, but some must
82 ;;- be emulated in software by the OS. It is faster to avoid these
83 ;;- instructions and issue a library call rather than trapping into
84 ;;- the kernel. The affected instructions are fintrz and fscale. The
85 ;;- TARGET_68040 flag turns the use of the opcodes off.
87 ;;- The '040 also implements a set of new floating-point instructions
88 ;;- which specify the rounding precision in the opcode. This finally
89 ;;- permit the 68k series to be truly IEEE compliant, and solves all
90 ;;- issues of excess precision accumulating in the extended registers.
91 ;;- By default, GCC does not use these instructions, since such code will
92 ;;- not run on an '030. To use these instructions, use the -m68040-only
93 ;;- switch. By changing TARGET_DEFAULT to include TARGET_68040_ONLY,
94 ;;- you can make these instructions the default.
96 ;;- These new instructions aren't directly in the md. They are brought
97 ;;- into play by defining "%$" and "%&" to expand to "s" and "d" rather
100 ;;- Information about 68060 port.
102 ;;- The 68060 executes all 68030 and 68881/2 instructions, but some must
103 ;;- be emulated in software by the OS. It is faster to avoid these
104 ;;- instructions and issue a library call rather than trapping into
105 ;;- the kernel. The affected instructions are: divs.l <ea>,Dr:Dq;
106 ;;- divu.l <ea>,Dr:Dq; muls.l <ea>,Dr:Dq; mulu.l <ea>,Dr:Dq; and
107 ;;- fscale. The TARGET_68060 flag turns the use of the opcodes off.
109 ;;- Some of these insn's are composites of several m68000 op codes.
110 ;;- The assembler (or final @@??) insures that the appropriate one is
120 ;; UNSPEC_VOLATILE usage:
123 [(UNSPECV_BLOCKAGE 0)
127 [(set (match_operand:DF 0 "push_operand" "=m")
128 (match_operand:DF 1 "general_operand" "ro<>fyE"))]
132 if (FP_REG_P (operands[1]))
133 return \"fmove%.d %f1,%0\";
134 return output_move_double (operands);
137 (define_insn "pushdi"
138 [(set (match_operand:DI 0 "push_operand" "=m")
139 (match_operand:DI 1 "general_operand" "ro<>Fyi"))]
143 return output_move_double (operands);
146 ;; We don't want to allow a constant operand for test insns because
147 ;; (set (cc0) (const_int foo)) has no mode information. Such insns will
148 ;; be folded while optimizing anyway.
150 (define_expand "tstdi"
151 [(parallel [(set (cc0)
152 (match_operand:DI 0 "nonimmediate_operand" ""))
153 (clobber (match_scratch:SI 1 ""))
154 (clobber (match_scratch:DI 2 ""))])]
156 "m68k_last_compare_had_fp_operands = 0;")
160 (match_operand:DI 0 "nonimmediate_operand" "am,d"))
161 (clobber (match_scratch:SI 1 "=X,d"))
162 (clobber (match_scratch:DI 2 "=d,X"))]
166 if (which_alternative == 0)
170 xoperands[0] = operands[2];
171 xoperands[1] = operands[0];
172 output_move_double (xoperands);
173 cc_status.flags |= CC_REVERSED;
174 return \"neg%.l %R2\;negx%.l %2\";
176 if (find_reg_note (insn, REG_DEAD, operands[0]))
178 cc_status.flags |= CC_REVERSED;
179 return \"neg%.l %R0\;negx%.l %0\";
183 ** 'sub' clears %1, and also clears the X cc bit
184 ** 'tst' sets the Z cc bit according to the low part of the DImode operand
185 ** 'subx %1' (i.e. subx #0) acts as a (non-existent) tstx on the high part
187 return \"sub%.l %1,%1\;tst%.l %R0\;subx%.l %1,%0\";
190 (define_expand "tstsi"
192 (match_operand:SI 0 "nonimmediate_operand" ""))]
194 "m68k_last_compare_had_fp_operands = 0;")
198 (match_operand:SI 0 "nonimmediate_operand" "rm"))]
202 if (TARGET_68020 || TARGET_COLDFIRE || ! ADDRESS_REG_P (operands[0]))
203 return \"tst%.l %0\";
204 /* If you think that the 68020 does not support tstl a0,
205 reread page B-167 of the 68020 manual more carefully. */
206 /* On an address reg, cmpw may replace cmpl. */
208 return \"cmp%.w %0,%#0\";
210 return \"cmp%.w %#0,%0\";
214 ;; This can't use an address register, because comparisons
215 ;; with address registers as second operand always test the whole word.
216 (define_expand "tsthi"
218 (match_operand:HI 0 "nonimmediate_operand" ""))]
220 "m68k_last_compare_had_fp_operands = 0;")
224 (match_operand:HI 0 "nonimmediate_operand" "dm"))]
228 (define_expand "tstqi"
230 (match_operand:QI 0 "nonimmediate_operand" ""))]
232 "m68k_last_compare_had_fp_operands = 0;")
236 (match_operand:QI 0 "nonimmediate_operand" "dm"))]
240 (define_expand "tstsf"
242 (match_operand:SF 0 "general_operand" ""))]
246 m68k_last_compare_had_fp_operands = 1;
251 (match_operand:SF 0 "general_operand" "fdm"))]
255 cc_status.flags = CC_IN_68881;
256 if (FP_REG_P (operands[0]))
257 return \"ftst%.x %0\";
258 return \"ftst%.s %0\";
261 (define_expand "tstdf"
263 (match_operand:DF 0 "general_operand" ""))]
267 m68k_last_compare_had_fp_operands = 1;
272 (match_operand:DF 0 "general_operand" "fm"))]
276 cc_status.flags = CC_IN_68881;
277 if (FP_REG_P (operands[0]))
278 return \"ftst%.x %0\";
279 return \"ftst%.d %0\";
282 ;; compare instructions.
284 (define_expand "cmpdi"
287 (compare (match_operand:DI 0 "nonimmediate_operand" "")
288 (match_operand:DI 1 "general_operand" "")))
289 (clobber (match_dup 2))])]
291 "m68k_last_compare_had_fp_operands = 0; operands[2] = gen_reg_rtx (DImode);")
295 (compare (match_operand:DI 1 "nonimmediate_operand" "0,d")
296 (match_operand:DI 2 "general_operand" "d,0")))
297 (clobber (match_operand:DI 0 "register_operand" "=d,d"))]
301 if (rtx_equal_p (operands[0], operands[1]))
302 return \"sub%.l %R2,%R0\;subx%.l %2,%0\";
305 cc_status.flags |= CC_REVERSED;
306 return \"sub%.l %R1,%R0\;subx%.l %1,%0\";
310 ;; This is the second "hook" for PIC code (in addition to movsi). See
311 ;; comment of movsi for a description of PIC handling.
312 (define_expand "cmpsi"
314 (compare (match_operand:SI 0 "nonimmediate_operand" "")
315 (match_operand:SI 1 "general_operand" "")))]
319 m68k_last_compare_had_fp_operands = 0;
320 if (flag_pic && !TARGET_PCREL && symbolic_operand (operands[1], SImode))
322 /* The source is an address which requires PIC relocation.
323 Call legitimize_pic_address with the source, mode, and a relocation
324 register (a new pseudo, or the final destination if reload_in_progress
325 is set). Then fall through normally */
326 rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
327 operands[1] = legitimize_pic_address (operands[1], SImode, temp);
331 ;; A composite of the cmp, cmpa, cmpi & cmpm m68000 op codes.
334 (compare (match_operand:SI 0 "nonimmediate_operand" "rKT,rKs,mSr,mSa,>")
335 (match_operand:SI 1 "general_src_operand" "mSr,mSa,KTr,Ksr,>")))]
339 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
341 return \"cmpm%.l %0,%1\";
343 return \"cmpm%.l %1,%0\";
345 if (REG_P (operands[1])
346 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
347 { cc_status.flags |= CC_REVERSED;
349 return \"cmp%.l %d1,%d0\";
351 return \"cmp%.l %d0,%d1\";
354 if (ADDRESS_REG_P (operands[0])
355 && GET_CODE (operands[1]) == CONST_INT
356 && INTVAL (operands[1]) < 0x8000
357 && INTVAL (operands[1]) >= -0x8000)
360 return \"cmp%.w %0,%1\";
362 return \"cmp%.w %1,%0\";
366 return \"cmp%.l %d0,%d1\";
368 return \"cmp%.l %d1,%d0\";
374 (compare (match_operand:SI 0 "nonimmediate_operand" "mrKs,r")
375 (match_operand:SI 1 "general_operand" "r,mrKs")))]
379 if (REG_P (operands[1])
380 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
381 { cc_status.flags |= CC_REVERSED;
383 return \"cmp%.l %d1,%d0\";
385 return \"cmp%.l %d0,%d1\";
389 return \"cmp%.l %d0,%d1\";
391 return \"cmp%.l %d1,%d0\";
395 (define_expand "cmphi"
397 (compare (match_operand:HI 0 "nonimmediate_src_operand" "")
398 (match_operand:HI 1 "general_src_operand" "")))]
400 "m68k_last_compare_had_fp_operands = 0;")
404 (compare (match_operand:HI 0 "nonimmediate_src_operand" "rnmS,d,n,mS,>")
405 (match_operand:HI 1 "general_src_operand" "d,rnmS,mS,n,>")))]
409 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
411 return \"cmpm%.w %0,%1\";
413 return \"cmpm%.w %1,%0\";
415 if ((REG_P (operands[1]) && !ADDRESS_REG_P (operands[1]))
416 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
417 { cc_status.flags |= CC_REVERSED;
419 return \"cmp%.w %d1,%d0\";
421 return \"cmp%.w %d0,%d1\";
425 return \"cmp%.w %d0,%d1\";
427 return \"cmp%.w %d1,%d0\";
431 (define_expand "cmpqi"
433 (compare (match_operand:QI 0 "nonimmediate_src_operand" "")
434 (match_operand:QI 1 "general_src_operand" "")))]
436 "m68k_last_compare_had_fp_operands = 0;")
440 (compare (match_operand:QI 0 "nonimmediate_src_operand" "dn,dmS,>")
441 (match_operand:QI 1 "general_src_operand" "dmS,nd,>")))]
445 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
447 return \"cmpm%.b %0,%1\";
449 return \"cmpm%.b %1,%0\";
451 if (REG_P (operands[1])
452 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
453 { cc_status.flags |= CC_REVERSED;
455 return \"cmp%.b %d1,%d0\";
457 return \"cmp%.b %d0,%d1\";
461 return \"cmp%.b %d0,%d1\";
463 return \"cmp%.b %d1,%d0\";
467 (define_expand "cmpdf"
469 (compare (match_operand:DF 0 "general_operand" "")
470 (match_operand:DF 1 "general_operand" "")))]
474 m68k_last_compare_had_fp_operands = 1;
479 (compare (match_operand:DF 0 "general_operand" "f,mG")
480 (match_operand:DF 1 "general_operand" "fmG,f")))]
484 cc_status.flags = CC_IN_68881;
486 if (REG_P (operands[0]))
488 if (REG_P (operands[1]))
489 return \"fcmp%.x %0,%1\";
491 return \"fcmp%.d %0,%f1\";
493 cc_status.flags |= CC_REVERSED;
494 return \"fcmp%.d %1,%f0\";
496 if (REG_P (operands[0]))
498 if (REG_P (operands[1]))
499 return \"fcmp%.x %1,%0\";
501 return \"fcmp%.d %f1,%0\";
503 cc_status.flags |= CC_REVERSED;
504 return \"fcmp%.d %f0,%1\";
508 (define_expand "cmpsf"
510 (compare (match_operand:SF 0 "general_operand" "")
511 (match_operand:SF 1 "general_operand" "")))]
515 m68k_last_compare_had_fp_operands = 1;
520 (compare (match_operand:SF 0 "general_operand" "f,mdG")
521 (match_operand:SF 1 "general_operand" "fmdG,f")))]
525 cc_status.flags = CC_IN_68881;
527 if (FP_REG_P (operands[0]))
529 if (FP_REG_P (operands[1]))
530 return \"fcmp%.x %0,%1\";
532 return \"fcmp%.s %0,%f1\";
534 cc_status.flags |= CC_REVERSED;
535 return \"fcmp%.s %1,%f0\";
537 if (FP_REG_P (operands[0]))
539 if (FP_REG_P (operands[1]))
540 return \"fcmp%.x %1,%0\";
542 return \"fcmp%.s %f1,%0\";
544 cc_status.flags |= CC_REVERSED;
545 return \"fcmp%.s %f0,%1\";
549 ;; Recognizers for btst instructions.
551 ;; ColdFire/5200 only allows "<Q>" type addresses when the bit position is
552 ;; specified as a constant, so we must disable all patterns that may extract
553 ;; from a MEM at a constant bit position if we can't use this as a constraint.
556 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_src_operand" "oS")
558 (minus:SI (const_int 7)
559 (match_operand:SI 1 "general_operand" "di"))))]
561 "* { return output_btst (operands, operands[1], operands[0], insn, 7); }")
563 ;; This is the same as the above pattern except for the constraints. The 'i'
567 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "o")
569 (minus:SI (const_int 7)
570 (match_operand:SI 1 "general_operand" "d"))))]
572 "* { return output_btst (operands, operands[1], operands[0], insn, 7); }")
575 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "d")
577 (minus:SI (const_int 31)
578 (match_operand:SI 1 "general_operand" "di"))))]
580 "* { return output_btst (operands, operands[1], operands[0], insn, 31); }")
582 ;; The following two patterns are like the previous two
583 ;; except that they use the fact that bit-number operands
584 ;; are automatically masked to 3 or 5 bits.
587 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "o")
589 (minus:SI (const_int 7)
591 (match_operand:SI 1 "register_operand" "d")
594 "* { return output_btst (operands, operands[1], operands[0], insn, 7); }")
597 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "d")
599 (minus:SI (const_int 31)
601 (match_operand:SI 1 "register_operand" "d")
604 "* { return output_btst (operands, operands[1], operands[0], insn, 31); }")
606 ;; Nonoffsettable mem refs are ok in this one pattern
607 ;; since we don't try to adjust them.
609 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "m")
611 (match_operand:SI 1 "const_int_operand" "n")))]
612 "(unsigned) INTVAL (operands[1]) < 8 && !TARGET_COLDFIRE"
615 operands[1] = GEN_INT (7 - INTVAL (operands[1]));
616 return output_btst (operands, operands[1], operands[0], insn, 7);
620 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "do")
622 (match_operand:SI 1 "const_int_operand" "n")))]
626 if (GET_CODE (operands[0]) == MEM)
628 operands[0] = adjust_address (operands[0], QImode,
629 INTVAL (operands[1]) / 8);
630 operands[1] = GEN_INT (7 - INTVAL (operands[1]) % 8);
631 return output_btst (operands, operands[1], operands[0], insn, 7);
633 operands[1] = GEN_INT (31 - INTVAL (operands[1]));
634 return output_btst (operands, operands[1], operands[0], insn, 31);
637 ;; This is the same as the above pattern except for the constraints.
638 ;; The 'o' has been replaced with 'Q'.
641 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "dQ")
643 (match_operand:SI 1 "const_int_operand" "n")))]
647 if (GET_CODE (operands[0]) == MEM)
649 operands[0] = adjust_address (operands[0], QImode,
650 INTVAL (operands[1]) / 8);
651 operands[1] = GEN_INT (7 - INTVAL (operands[1]) % 8);
652 return output_btst (operands, operands[1], operands[0], insn, 7);
654 operands[1] = GEN_INT (31 - INTVAL (operands[1]));
655 return output_btst (operands, operands[1], operands[0], insn, 31);
661 ;; A special case in which it is not desirable
662 ;; to reload the constant into a data register.
663 (define_insn "pushexthisi_const"
664 [(set (match_operand:SI 0 "push_operand" "=m")
665 (match_operand:SI 1 "const_int_operand" "J"))]
666 "INTVAL (operands[1]) >= -0x8000 && INTVAL (operands[1]) < 0x8000"
669 if (operands[1] == const0_rtx)
670 return \"clr%.l %0\";
675 ;(define_insn "swapsi"
676 ; [(set (match_operand:SI 0 "nonimmediate_operand" "+r")
677 ; (match_operand:SI 1 "general_operand" "+r"))
678 ; (set (match_dup 1) (match_dup 0))]
682 ;; Special case of fullword move when source is zero.
683 ;; The reason this is special is to avoid loading a zero
684 ;; into a data reg with moveq in order to store it elsewhere.
686 (define_insn "movsi_const0"
687 [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
689 ;; clr insns on 68000 read before writing.
690 ;; This isn't so on the 68010, but we have no TARGET_68010.
691 "((TARGET_68020 || TARGET_COLDFIRE)
692 || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0])))"
695 if (ADDRESS_REG_P (operands[0]))
697 /* On the '040, 'subl an,an' takes 2 clocks while lea takes only 1 */
698 if (!TARGET_68040 && !TARGET_68060)
699 return \"sub%.l %0,%0\";
703 /* Many SGS assemblers croak on size specifiers for constants. */
710 /* moveq is faster on the 68000. */
711 if (DATA_REG_P (operands[0]) && (!TARGET_68020 && !TARGET_COLDFIRE))
712 return \"moveq %#0,%0\";
713 return \"clr%.l %0\";
716 ;; General case of fullword move.
718 ;; This is the main "hook" for PIC code. When generating
719 ;; PIC, movsi is responsible for determining when the source address
720 ;; needs PIC relocation and appropriately calling legitimize_pic_address
721 ;; to perform the actual relocation.
723 ;; In both the PIC and non-PIC cases the patterns generated will
724 ;; matched by the next define_insn.
725 (define_expand "movsi"
726 [(set (match_operand:SI 0 "nonimmediate_operand" "")
727 (match_operand:SI 1 "general_operand" ""))]
731 if (flag_pic && !TARGET_PCREL && symbolic_operand (operands[1], SImode))
733 /* The source is an address which requires PIC relocation.
734 Call legitimize_pic_address with the source, mode, and a relocation
735 register (a new pseudo, or the final destination if reload_in_progress
736 is set). Then fall through normally */
737 rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
738 operands[1] = legitimize_pic_address (operands[1], SImode, temp);
740 else if (flag_pic && TARGET_PCREL && ! reload_in_progress)
742 /* Don't allow writes to memory except via a register;
743 the m68k doesn't consider PC-relative addresses to be writable. */
744 if (symbolic_operand (operands[0], SImode))
745 operands[0] = force_reg (SImode, XEXP (operands[0], 0));
746 else if (GET_CODE (operands[0]) == MEM
747 && symbolic_operand (XEXP (operands[0], 0), SImode))
748 operands[0] = gen_rtx (MEM, SImode,
749 force_reg (SImode, XEXP (operands[0], 0)));
753 ;; General case of fullword move. The register constraints
754 ;; force integer constants in range for a moveq to be reloaded
755 ;; if they are headed for memory.
757 ;; Notes: make sure no alternative allows g vs g.
758 ;; We don't allow f-regs since fixed point cannot go in them.
759 [(set (match_operand:SI 0 "nonimmediate_operand" "=g,d,a<")
760 (match_operand:SI 1 "general_src_operand" "daymSKT,n,i"))]
765 return output_move_simode (operands);
769 [(set (match_operand:SI 0 "nonimmediate_operand" "=r<Q>,g")
770 (match_operand:SI 1 "general_operand" "g,r<Q>"))]
772 "* return output_move_simode (operands);")
774 ;; Special case of fullword move, where we need to get a non-GOT PIC
775 ;; reference into an address register.
777 [(set (match_operand:SI 0 "nonimmediate_operand" "=a<")
778 (match_operand:SI 1 "pcrel_address" ""))]
782 if (push_operand (operands[0], SImode))
784 return \"lea %a1,%0\";
787 (define_expand "movhi"
788 [(set (match_operand:HI 0 "nonimmediate_operand" "")
789 (match_operand:HI 1 "general_operand" ""))]
794 [(set (match_operand:HI 0 "nonimmediate_operand" "=g")
795 (match_operand:HI 1 "general_src_operand" "gS"))]
797 "* return output_move_himode (operands);")
800 [(set (match_operand:HI 0 "nonimmediate_operand" "=r<Q>,g")
801 (match_operand:HI 1 "general_operand" "g,r<Q>"))]
803 "* return output_move_himode (operands);")
805 (define_expand "movstricthi"
806 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" ""))
807 (match_operand:HI 1 "general_src_operand" ""))]
812 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
813 (match_operand:HI 1 "general_src_operand" "rmSn"))]
815 "* return output_move_stricthi (operands);")
818 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+d,m"))
819 (match_operand:HI 1 "general_src_operand" "rmn,r"))]
821 "* return output_move_stricthi (operands);")
823 (define_expand "movqi"
824 [(set (match_operand:QI 0 "nonimmediate_operand" "")
825 (match_operand:QI 1 "general_src_operand" ""))]
830 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,*a,m")
831 (match_operand:QI 1 "general_src_operand" "dmSi*a,di*a,dmSi"))]
833 "* return output_move_qimode (operands);")
836 [(set (match_operand:QI 0 "nonimmediate_operand" "=d<Q>,dm,d*a")
837 (match_operand:QI 1 "general_src_operand" "dmi,d<Q>,di*a"))]
839 "* return output_move_qimode (operands);")
841 (define_expand "movstrictqi"
842 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" ""))
843 (match_operand:QI 1 "general_src_operand" ""))]
848 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
849 (match_operand:QI 1 "general_src_operand" "dmSn"))]
851 "* return output_move_strictqi (operands);")
854 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+d,m"))
855 (match_operand:QI 1 "general_src_operand" "dmn,d"))]
857 "* return output_move_strictqi (operands);")
859 (define_expand "pushqi1"
860 [(set (reg:SI 15) (plus:SI (reg:SI 15) (const_int -2)))
861 (set (mem:QI (plus:SI (reg:SI 15) (const_int 1)))
862 (match_operand:QI 0 "general_operand" ""))]
866 (define_expand "movsf"
867 [(set (match_operand:SF 0 "nonimmediate_operand" "")
868 (match_operand:SF 1 "general_operand" ""))]
873 [(set (match_operand:SF 0 "nonimmediate_operand" "=rmf")
874 (match_operand:SF 1 "general_operand" "rmfF"))]
878 if (FP_REG_P (operands[0]))
880 if (FP_REG_P (operands[1]))
881 return \"f%$move%.x %1,%0\";
882 else if (ADDRESS_REG_P (operands[1]))
883 return \"move%.l %1,%-\;f%$move%.s %+,%0\";
884 else if (GET_CODE (operands[1]) == CONST_DOUBLE)
885 return output_move_const_single (operands);
886 return \"f%$move%.s %f1,%0\";
888 if (FP_REG_P (operands[1]))
890 if (ADDRESS_REG_P (operands[0]))
891 return \"fmove%.s %1,%-\;move%.l %+,%0\";
892 return \"fmove%.s %f1,%0\";
894 if (operands[1] == CONST0_RTX (SFmode)
895 /* clr insns on 68000 read before writing.
896 This isn't so on the 68010, but we have no TARGET_68010. */
897 && ((TARGET_68020 || TARGET_COLDFIRE)
898 || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0]))))
900 if (ADDRESS_REG_P (operands[0]))
902 /* On the '040, 'subl an,an' takes 2 clocks while lea takes only 1 */
903 if (!TARGET_68040 && !TARGET_68060)
904 return \"sub%.l %0,%0\";
908 /* Many SGS assemblers croak on size specifiers for constants. */
915 /* moveq is faster on the 68000. */
916 if (DATA_REG_P (operands[0]) && !(TARGET_68020 || TARGET_COLDFIRE))
918 return \"moveq %#0,%0\";
920 return \"clr%.l %0\";
922 return \"move%.l %1,%0\";
926 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,g")
927 (match_operand:SF 1 "general_operand" "g,r"))]
929 "* return \"move%.l %1,%0\";")
931 (define_expand "movdf"
932 [(set (match_operand:DF 0 "nonimmediate_operand" "")
933 (match_operand:DF 1 "general_operand" ""))]
938 [(set (match_operand:DF 0 "nonimmediate_operand" "=rm,rf,rf,&rof<>")
939 (match_operand:DF 1 "general_operand" "*rf,m,0,*rofE<>"))]
940 ; [(set (match_operand:DF 0 "nonimmediate_operand" "=rm,&rf,&rof<>")
941 ; (match_operand:DF 1 "general_operand" "rf,m,rofF<>"))]
945 if (FP_REG_P (operands[0]))
947 if (FP_REG_P (operands[1]))
948 return \"f%&move%.x %1,%0\";
949 if (REG_P (operands[1]))
952 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
953 output_asm_insn (\"move%.l %1,%-\", xoperands);
954 output_asm_insn (\"move%.l %1,%-\", operands);
955 return \"f%&move%.d %+,%0\";
957 if (GET_CODE (operands[1]) == CONST_DOUBLE)
958 return output_move_const_double (operands);
959 return \"f%&move%.d %f1,%0\";
961 else if (FP_REG_P (operands[1]))
963 if (REG_P (operands[0]))
965 output_asm_insn (\"fmove%.d %f1,%-\;move%.l %+,%0\", operands);
966 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
967 return \"move%.l %+,%0\";
970 return \"fmove%.d %f1,%0\";
972 return output_move_double (operands);
976 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,g")
977 (match_operand:DF 1 "general_operand" "g,r"))]
979 "* return output_move_double (operands);")
981 ;; ??? The XFmode patterns are schizophrenic about whether constants are
982 ;; allowed. Most but not all have predicates and constraint that disallow
983 ;; constants. Most but not all have output templates that handle constants.
984 ;; See also LEGITIMATE_CONSTANT_P.
986 (define_expand "movxf"
987 [(set (match_operand:XF 0 "nonimmediate_operand" "")
988 (match_operand:XF 1 "general_operand" ""))]
992 /* We can't rewrite operands during reload. */
993 if (! reload_in_progress)
995 if (CONSTANT_P (operands[1]))
997 operands[1] = force_const_mem (XFmode, operands[1]);
998 if (! memory_address_p (XFmode, XEXP (operands[1], 0)))
999 operands[1] = adjust_address (operands[1], XFmode, 0);
1001 if (flag_pic && TARGET_PCREL)
1003 /* Don't allow writes to memory except via a register; the
1004 m68k doesn't consider PC-relative addresses to be writable. */
1005 if (GET_CODE (operands[0]) == MEM
1006 && symbolic_operand (XEXP (operands[0], 0), SImode))
1007 operands[0] = gen_rtx (MEM, XFmode,
1008 force_reg (SImode, XEXP (operands[0], 0)));
1014 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,!r,!f,!r")
1015 (match_operand:XF 1 "nonimmediate_operand" "m,f,f,f,r,!r"))]
1019 if (FP_REG_P (operands[0]))
1021 if (FP_REG_P (operands[1]))
1022 return \"fmove%.x %1,%0\";
1023 if (REG_P (operands[1]))
1026 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 2);
1027 output_asm_insn (\"move%.l %1,%-\", xoperands);
1028 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1029 output_asm_insn (\"move%.l %1,%-\", xoperands);
1030 output_asm_insn (\"move%.l %1,%-\", operands);
1031 return \"fmove%.x %+,%0\";
1033 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1034 return \"fmove%.x %1,%0\";
1035 return \"fmove%.x %f1,%0\";
1037 if (FP_REG_P (operands[1]))
1039 if (REG_P (operands[0]))
1041 output_asm_insn (\"fmove%.x %f1,%-\;move%.l %+,%0\", operands);
1042 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1043 output_asm_insn (\"move%.l %+,%0\", operands);
1044 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1045 return \"move%.l %+,%0\";
1047 /* Must be memory destination. */
1048 return \"fmove%.x %f1,%0\";
1050 return output_move_double (operands);
1055 [(set (match_operand:XF 0 "nonimmediate_operand" "=rm,rf,&rof<>")
1056 (match_operand:XF 1 "nonimmediate_operand" "rf,m,rof<>"))]
1057 "! TARGET_68881 && ! TARGET_COLDFIRE"
1060 if (FP_REG_P (operands[0]))
1062 if (FP_REG_P (operands[1]))
1063 return \"fmove%.x %1,%0\";
1064 if (REG_P (operands[1]))
1067 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 2);
1068 output_asm_insn (\"move%.l %1,%-\", xoperands);
1069 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1070 output_asm_insn (\"move%.l %1,%-\", xoperands);
1071 output_asm_insn (\"move%.l %1,%-\", operands);
1072 return \"fmove%.x %+,%0\";
1074 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1075 return \"fmove%.x %1,%0\";
1076 return \"fmove%.x %f1,%0\";
1078 if (FP_REG_P (operands[1]))
1080 if (REG_P (operands[0]))
1082 output_asm_insn (\"fmove%.x %f1,%-\;move%.l %+,%0\", operands);
1083 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1084 output_asm_insn (\"move%.l %+,%0\", operands);
1085 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1086 return \"move%.l %+,%0\";
1089 return \"fmove%.x %f1,%0\";
1091 return output_move_double (operands);
1096 [(set (match_operand:XF 0 "nonimmediate_operand" "=r,g")
1097 (match_operand:XF 1 "nonimmediate_operand" "g,r"))]
1098 "! TARGET_68881 && TARGET_COLDFIRE"
1099 "* return output_move_double (operands);")
1101 (define_expand "movdi"
1102 ;; Let's see if it really still needs to handle fp regs, and, if so, why.
1103 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1104 (match_operand:DI 1 "general_operand" ""))]
1108 ;; movdi can apply to fp regs in some cases
1110 ;; Let's see if it really still needs to handle fp regs, and, if so, why.
1111 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r,&ro<>")
1112 (match_operand:DI 1 "general_operand" "rF,m,roi<>F"))]
1113 ; [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,&r,&ro<>,!&rm,!&f")
1114 ; (match_operand:DI 1 "general_operand" "r,m,roi<>,fF"))]
1115 ; [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,&rf,&ro<>,!&rm,!&f")
1116 ; (match_operand:DI 1 "general_operand" "r,m,roi<>,fF,rfF"))]
1120 if (FP_REG_P (operands[0]))
1122 if (FP_REG_P (operands[1]))
1123 return \"fmove%.x %1,%0\";
1124 if (REG_P (operands[1]))
1127 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1128 output_asm_insn (\"move%.l %1,%-\", xoperands);
1129 output_asm_insn (\"move%.l %1,%-\", operands);
1130 return \"fmove%.d %+,%0\";
1132 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1133 return output_move_const_double (operands);
1134 return \"fmove%.d %f1,%0\";
1136 else if (FP_REG_P (operands[1]))
1138 if (REG_P (operands[0]))
1140 output_asm_insn (\"fmove%.d %f1,%-\;move%.l %+,%0\", operands);
1141 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1142 return \"move%.l %+,%0\";
1145 return \"fmove%.d %f1,%0\";
1147 return output_move_double (operands);
1151 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,g")
1152 (match_operand:DI 1 "general_operand" "g,r"))]
1154 "* return output_move_double (operands);")
1156 ;; Thus goes after the move instructions
1157 ;; because the move instructions are better (require no spilling)
1158 ;; when they can apply. It goes before the add/sub insns
1159 ;; so we will prefer it to them.
1161 (define_insn "pushasi"
1162 [(set (match_operand:SI 0 "push_operand" "=m")
1163 (match_operand:SI 1 "address_operand" "p"))]
1167 ;; truncation instructions
1168 (define_insn "truncsiqi2"
1169 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,d")
1171 (match_operand:SI 1 "general_src_operand" "doJS,i")))]
1175 if (GET_CODE (operands[0]) == REG)
1177 /* Must clear condition codes, since the move.l bases them on
1178 the entire 32 bits, not just the desired 8 bits. */
1180 return \"move%.l %1,%0\";
1182 if (GET_CODE (operands[1]) == MEM)
1183 operands[1] = adjust_address (operands[1], QImode, 3);
1184 return \"move%.b %1,%0\";
1187 (define_insn "trunchiqi2"
1188 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,d")
1190 (match_operand:HI 1 "general_src_operand" "doJS,i")))]
1194 if (GET_CODE (operands[0]) == REG
1195 && (GET_CODE (operands[1]) == MEM
1196 || GET_CODE (operands[1]) == CONST_INT))
1198 /* Must clear condition codes, since the move.w bases them on
1199 the entire 16 bits, not just the desired 8 bits. */
1201 return \"move%.w %1,%0\";
1203 if (GET_CODE (operands[0]) == REG)
1205 /* Must clear condition codes, since the move.l bases them on
1206 the entire 32 bits, not just the desired 8 bits. */
1208 return \"move%.l %1,%0\";
1210 if (GET_CODE (operands[1]) == MEM)
1211 operands[1] = adjust_address (operands[1], QImode, 1);
1212 return \"move%.b %1,%0\";
1215 (define_insn "truncsihi2"
1216 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm,d")
1218 (match_operand:SI 1 "general_src_operand" "roJS,i")))]
1222 if (GET_CODE (operands[0]) == REG)
1224 /* Must clear condition codes, since the move.l bases them on
1225 the entire 32 bits, not just the desired 8 bits. */
1227 return \"move%.l %1,%0\";
1229 if (GET_CODE (operands[1]) == MEM)
1230 operands[1] = adjust_address (operands[1], QImode, 2);
1231 return \"move%.w %1,%0\";
1234 ;; zero extension instructions
1236 (define_insn "zero_extendqidi2"
1237 [(set (match_operand:DI 0 "nonimmediate_operand" "=&d")
1238 (zero_extend:DI (match_operand:QI 1 "general_operand" "dm")))]
1243 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1244 return \"moveq %#0,%0\;moveq %#0,%2\;move%.b %1,%2\";
1247 (define_insn "zero_extendhidi2"
1248 [(set (match_operand:DI 0 "nonimmediate_operand" "=&d")
1249 (zero_extend:DI (match_operand:HI 1 "general_operand" "rm")))]
1254 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1255 return \"moveq %#0,%0\;moveq %#0,%2\;move%.w %1,%2\";
1258 ;; this is the canonical form for (lshiftrt:DI x 32)
1259 (define_expand "zero_extendsidi2"
1260 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1261 (zero_extend:DI (match_operand:SI 1 "general_operand" "")))]
1265 (define_insn "*zero_extendsidi2_cf"
1266 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,m")
1267 (zero_extend:DI (match_operand:SI 1 "general_operand" "rm,r")))]
1272 if (GET_CODE (operands[0]) == REG)
1273 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1274 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
1275 return \"move%.l %1,%0\;clr%.l %0\";
1276 else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
1277 return \"clr%.l %0\;move%.l %1,%0\";
1279 operands[2] = adjust_address (operands[0], SImode, 4);
1280 if (GET_CODE (operands[1]) != REG || GET_CODE (operands[2]) != REG
1281 || REGNO (operands[1]) != REGNO (operands[2]))
1282 output_asm_insn (\"move%.l %1,%2\", operands);
1283 if (ADDRESS_REG_P (operands[0]))
1284 return \"sub%.l %0,%0\";
1286 return \"clr%.l %0\";
1289 (define_insn "*zero_extendsidi2"
1290 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
1291 (zero_extend:DI (match_operand:SI 1 "general_operand" "rm")))]
1296 if (GET_CODE (operands[0]) == REG)
1297 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1298 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
1299 return \"move%.l %1,%0\;clr%.l %0\";
1300 else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
1301 return \"clr%.l %0\;move%.l %1,%0\";
1303 operands[2] = adjust_address (operands[0], SImode, 4);
1304 if (GET_CODE (operands[1]) != REG || GET_CODE (operands[2]) != REG
1305 || REGNO (operands[1]) != REGNO (operands[2]))
1306 output_asm_insn (\"move%.l %1,%2\", operands);
1307 if (ADDRESS_REG_P (operands[0]))
1308 return \"sub%.l %0,%0\";
1310 return \"clr%.l %0\";
1313 (define_expand "zero_extendhisi2"
1314 [(set (match_operand:SI 0 "register_operand" "")
1316 (set (strict_low_part (match_dup 2))
1317 (match_operand:HI 1 "general_operand" ""))]
1321 operands[1] = make_safe_from (operands[1], operands[0]);
1322 operands[2] = gen_lowpart_SUBREG (HImode, operands[0]);
1325 (define_expand "zero_extendqihi2"
1326 [(set (match_operand:HI 0 "register_operand" "")
1328 (set (strict_low_part (match_dup 2))
1329 (match_operand:QI 1 "general_operand" ""))]
1333 operands[1] = make_safe_from (operands[1], operands[0]);
1334 operands[2] = gen_lowpart_SUBREG (QImode, operands[0]);
1337 (define_expand "zero_extendqisi2"
1338 [(set (match_operand:SI 0 "register_operand" "")
1340 (set (strict_low_part (match_dup 2))
1341 (match_operand:QI 1 "general_operand" ""))]
1345 operands[1] = make_safe_from (operands[1], operands[0]);
1346 operands[2] = gen_lowpart_SUBREG (QImode, operands[0]);
1349 ;; Patterns to recognize zero-extend insns produced by the combiner.
1350 ;; We don't allow both operands in memory, because of aliasing problems.
1351 ;; Explicitly disallow two memory operands via the condition since reloading
1352 ;; of this case will result in worse code than the uncombined patterns.
1355 [(set (match_operand:SI 0 "nonimmediate_operand" "=do<>,d<")
1356 (zero_extend:SI (match_operand:HI 1 "nonimmediate_src_operand" "r,mS")))]
1357 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
1360 if (DATA_REG_P (operands[0]))
1362 if (GET_CODE (operands[1]) == REG
1363 && REGNO (operands[0]) == REGNO (operands[1]))
1364 return \"and%.l %#0xFFFF,%0\";
1365 if (reg_mentioned_p (operands[0], operands[1]))
1366 return \"move%.w %1,%0\;and%.l %#0xFFFF,%0\";
1367 return \"clr%.l %0\;move%.w %1,%0\";
1369 else if (GET_CODE (operands[0]) == MEM
1370 && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
1371 return \"move%.w %1,%0\;clr%.w %0\";
1372 else if (GET_CODE (operands[0]) == MEM
1373 && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
1374 return \"clr%.w %0\;move%.w %1,%0\";
1377 output_asm_insn (\"clr%.w %0\", operands);
1378 operands[0] = adjust_address (operands[0], HImode, 2);
1379 return \"move%.w %1,%0\";
1384 [(set (match_operand:HI 0 "nonimmediate_operand" "=do<>,d")
1385 (zero_extend:HI (match_operand:QI 1 "nonimmediate_src_operand" "d,mS")))]
1386 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
1389 if (DATA_REG_P (operands[0]))
1391 if (GET_CODE (operands[1]) == REG
1392 && REGNO (operands[0]) == REGNO (operands[1]))
1393 return (!TARGET_COLDFIRE ? \"and%.w %#0xFF,%0\" : \"and%.l %#0xFF,%0\");
1394 if (reg_mentioned_p (operands[0], operands[1]))
1395 return (!TARGET_COLDFIRE ? \"move%.b %1,%0\;and%.w %#0xFF,%0\"
1396 : \"move%.b %1,%0\;and%.l %#0xFF,%0\");
1397 return \"clr%.w %0\;move%.b %1,%0\";
1399 else if (GET_CODE (operands[0]) == MEM
1400 && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
1402 if (REGNO (XEXP (XEXP (operands[0], 0), 0))
1403 == STACK_POINTER_REGNUM)
1405 output_asm_insn (\"clr%.w %-\", operands);
1406 operands[0] = gen_rtx_MEM (GET_MODE (operands[0]),
1407 plus_constant (stack_pointer_rtx, 1));
1408 return \"move%.b %1,%0\";
1411 return \"move%.b %1,%0\;clr%.b %0\";
1413 else if (GET_CODE (operands[0]) == MEM
1414 && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
1415 return \"clr%.b %0\;move%.b %1,%0\";
1418 output_asm_insn (\"clr%.b %0\", operands);
1419 operands[0] = adjust_address (operands[0], QImode, 1);
1420 return \"move%.b %1,%0\";
1425 [(set (match_operand:SI 0 "nonimmediate_operand" "=do<>,d")
1426 (zero_extend:SI (match_operand:QI 1 "nonimmediate_src_operand" "d,mS")))]
1427 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
1430 if (DATA_REG_P (operands[0]))
1432 if (GET_CODE (operands[1]) == REG
1433 && REGNO (operands[0]) == REGNO (operands[1]))
1434 return \"and%.l %#0xFF,%0\";
1435 if (reg_mentioned_p (operands[0], operands[1]))
1436 return \"move%.b %1,%0\;and%.l %#0xFF,%0\";
1437 return \"clr%.l %0\;move%.b %1,%0\";
1439 else if (GET_CODE (operands[0]) == MEM
1440 && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
1442 operands[0] = XEXP (XEXP (operands[0], 0), 0);
1445 \"clr%.l -(%0)\;move%.b %1,3(%0)\" :
1447 \"clr%.l -(%0)\;move%.b %1,(3,%0)\" :
1449 \"clrl %0@-\;moveb %1,%0@(3)\";
1452 else if (GET_CODE (operands[0]) == MEM
1453 && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
1455 operands[0] = XEXP (XEXP (operands[0], 0), 0);
1458 \"clr%.l (%0)+\;move%.b %1,-1(%0)\" :
1460 \"clr%.l (%0)+\;move%.b %1,(-1,%0)\" :
1462 \"clrl %0@+\;moveb %1,%0@(-1)\";
1466 output_asm_insn (\"clr%.l %0\", operands);
1467 operands[0] = adjust_address (operands[0], QImode, 3);
1468 return \"move%.b %1,%0\";
1472 ;; sign extension instructions
1474 (define_insn "extendqidi2"
1475 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
1476 (sign_extend:DI (match_operand:QI 1 "general_src_operand" "rmS")))]
1481 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1482 if (TARGET_68020 || TARGET_COLDFIRE)
1483 return \"move%.b %1,%2\;extb%.l %2\;smi %0\;extb%.l %0\";
1485 return \"move%.b %1,%2\;ext%.w %0\;ext%.l %2\;move%.l %2,%0\;smi %0\";
1488 (define_insn "extendhidi2"
1489 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
1491 (match_operand:HI 1 "general_src_operand" "rmS")))]
1496 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1497 if (TARGET_68020 || TARGET_COLDFIRE)
1498 return \"move%.w %1,%2\;ext%.l %2\;smi %0\;extb%.l %0\";
1500 return \"move%.w %1,%2\;ext%.l %2\;smi %0\;ext%.w %0\;ext%.l %0\";
1503 (define_insn "extendsidi2"
1504 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
1506 (match_operand:SI 1 "general_operand" "rm")))]
1511 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1512 if (TARGET_68020 || TARGET_COLDFIRE)
1513 return \"move%.l %1,%2\;smi %0\;extb%.l %0\";
1515 return \"move%.l %1,%2\;smi %0\;ext%.w %0\;ext%.l %0\";
1518 ;; Special case when one can avoid register clobbering, copy and test
1519 ;; Maybe there is a way to make that the general case, by forcing the
1520 ;; result of the SI tree to be in the lower register of the DI target
1522 (define_insn "extendplussidi"
1523 [(set (match_operand:DI 0 "register_operand" "=d")
1524 (sign_extend:DI (plus:SI (match_operand:SI 1 "general_operand" "%rmn")
1525 (match_operand:SI 2 "general_operand" "rmn"))))]
1530 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1531 if (GET_CODE (operands[1]) == CONST_INT
1532 && (unsigned) INTVAL (operands[1]) > 8)
1534 rtx tmp = operands[1];
1536 operands[1] = operands[2];
1539 if (GET_CODE (operands[1]) == REG
1540 && REGNO (operands[1]) == REGNO (operands[3]))
1541 output_asm_insn (\"add%.l %2,%3\", operands);
1543 output_asm_insn (\"move%.l %2,%3\;add%.l %1,%3\", operands);
1544 if (TARGET_68020 || TARGET_COLDFIRE)
1545 return \"smi %0\;extb%.l %0\";
1547 return \"smi %0\;ext%.w %0\;ext%.l %0\";
1550 (define_insn "extendhisi2"
1551 [(set (match_operand:SI 0 "nonimmediate_operand" "=*d,a")
1553 (match_operand:HI 1 "nonimmediate_src_operand" "0,rmS")))]
1557 if (ADDRESS_REG_P (operands[0]))
1558 return \"move%.w %1,%0\";
1559 return \"ext%.l %0\";
1562 (define_insn "extendqihi2"
1563 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
1564 (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0")))]
1568 (define_insn "extendqisi2"
1569 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
1570 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "0")))]
1571 "TARGET_68020 || TARGET_COLDFIRE"
1574 ;; Conversions between float and double.
1576 (define_expand "extendsfdf2"
1577 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1579 (match_operand:SF 1 "general_operand" "")))]
1584 [(set (match_operand:DF 0 "nonimmediate_operand" "=*fdm,f")
1586 (match_operand:SF 1 "general_operand" "f,dmF")))]
1590 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
1592 if (REGNO (operands[0]) == REGNO (operands[1]))
1594 /* Extending float to double in an fp-reg is a no-op.
1595 NOTICE_UPDATE_CC has already assumed that the
1596 cc will be set. So cancel what it did. */
1597 cc_status = cc_prev_status;
1600 return \"f%&move%.x %1,%0\";
1602 if (FP_REG_P (operands[0]))
1603 return \"f%&move%.s %f1,%0\";
1604 if (DATA_REG_P (operands[0]) && FP_REG_P (operands[1]))
1606 output_asm_insn (\"fmove%.d %f1,%-\;move%.l %+,%0\", operands);
1607 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1608 return \"move%.l %+,%0\";
1610 return \"fmove%.d %f1,%0\";
1613 ;; This cannot output into an f-reg because there is no way to be
1614 ;; sure of truncating in that case.
1615 (define_expand "truncdfsf2"
1616 [(set (match_operand:SF 0 "nonimmediate_operand" "")
1618 (match_operand:DF 1 "general_operand" "")))]
1622 ;; On the '040 we can truncate in a register accurately and easily.
1624 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
1626 (match_operand:DF 1 "general_operand" "fmG")))]
1630 if (FP_REG_P (operands[1]))
1631 return \"f%$move%.x %1,%0\";
1632 return \"f%$move%.d %f1,%0\";
1636 [(set (match_operand:SF 0 "nonimmediate_operand" "=dm")
1638 (match_operand:DF 1 "general_operand" "f")))]
1642 ;; Conversion between fixed point and floating point.
1643 ;; Note that among the fix-to-float insns
1644 ;; the ones that start with SImode come first.
1645 ;; That is so that an operand that is a CONST_INT
1646 ;; (and therefore lacks a specific machine mode).
1647 ;; will be recognized as SImode (which is always valid)
1648 ;; rather than as QImode or HImode.
1650 (define_expand "floatsisf2"
1651 [(set (match_operand:SF 0 "nonimmediate_operand" "")
1652 (float:SF (match_operand:SI 1 "general_operand" "")))]
1657 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
1658 (float:SF (match_operand:SI 1 "general_operand" "dmi")))]
1662 (define_expand "floatsidf2"
1663 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1664 (float:DF (match_operand:SI 1 "general_operand" "")))]
1669 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
1670 (float:DF (match_operand:SI 1 "general_operand" "dmi")))]
1674 (define_insn "floathisf2"
1675 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
1676 (float:SF (match_operand:HI 1 "general_operand" "dmn")))]
1680 (define_insn "floathidf2"
1681 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
1682 (float:DF (match_operand:HI 1 "general_operand" "dmn")))]
1686 (define_insn "floatqisf2"
1687 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
1688 (float:SF (match_operand:QI 1 "general_operand" "dmn")))]
1692 (define_insn "floatqidf2"
1693 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
1694 (float:DF (match_operand:QI 1 "general_operand" "dmn")))]
1698 ;; New routines to convert floating-point values to integers
1699 ;; to be used on the '040. These should be faster than trapping
1700 ;; into the kernel to emulate fintrz. They should also be faster
1701 ;; than calling the subroutines fixsfsi or fixdfsi.
1703 (define_insn "fix_truncdfsi2"
1704 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
1705 (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
1706 (clobber (match_scratch:SI 2 "=d"))
1707 (clobber (match_scratch:SI 3 "=d"))]
1708 "TARGET_68881 && TARGET_68040"
1712 return \"fmovem%.l %!,%2\;moveq %#16,%3\;or%.l %2,%3\;and%.w %#-33,%3\;fmovem%.l %3,%!\;fmove%.l %1,%0\;fmovem%.l %2,%!\";
1715 (define_insn "fix_truncdfhi2"
1716 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
1717 (fix:HI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
1718 (clobber (match_scratch:SI 2 "=d"))
1719 (clobber (match_scratch:SI 3 "=d"))]
1720 "TARGET_68881 && TARGET_68040"
1724 return \"fmovem%.l %!,%2\;moveq %#16,%3\;or%.l %2,%3\;and%.w %#-33,%3\;fmovem%.l %3,%!\;fmove%.w %1,%0\;fmovem%.l %2,%!\";
1727 (define_insn "fix_truncdfqi2"
1728 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
1729 (fix:QI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
1730 (clobber (match_scratch:SI 2 "=d"))
1731 (clobber (match_scratch:SI 3 "=d"))]
1732 "TARGET_68881 && TARGET_68040"
1736 return \"fmovem%.l %!,%2\;moveq %#16,%3\;or%.l %2,%3\;and%.w %#-33,%3\;fmovem%.l %3,%!\;fmove%.b %1,%0\;fmovem%.l %2,%!\";
1739 ;; Convert a float to a float whose value is an integer.
1740 ;; This is the first stage of converting it to an integer type.
1742 (define_insn "ftruncdf2"
1743 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
1744 (fix:DF (match_operand:DF 1 "general_operand" "fFm")))]
1745 "TARGET_68881 && !TARGET_68040"
1748 if (FP_REG_P (operands[1]))
1749 return \"fintrz%.x %f1,%0\";
1750 return \"fintrz%.d %f1,%0\";
1753 (define_insn "ftruncsf2"
1754 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
1755 (fix:SF (match_operand:SF 1 "general_operand" "dfFm")))]
1756 "TARGET_68881 && !TARGET_68040"
1759 if (FP_REG_P (operands[1]))
1760 return \"fintrz%.x %f1,%0\";
1761 return \"fintrz%.s %f1,%0\";
1764 ;; Convert a float whose value is an integer
1765 ;; to an actual integer. Second stage of converting float to integer type.
1766 (define_insn "fixsfqi2"
1767 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
1768 (fix:QI (match_operand:SF 1 "general_operand" "f")))]
1772 (define_insn "fixsfhi2"
1773 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
1774 (fix:HI (match_operand:SF 1 "general_operand" "f")))]
1778 (define_insn "fixsfsi2"
1779 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
1780 (fix:SI (match_operand:SF 1 "general_operand" "f")))]
1784 (define_insn "fixdfqi2"
1785 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
1786 (fix:QI (match_operand:DF 1 "general_operand" "f")))]
1790 (define_insn "fixdfhi2"
1791 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
1792 (fix:HI (match_operand:DF 1 "general_operand" "f")))]
1796 (define_insn "fixdfsi2"
1797 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
1798 (fix:SI (match_operand:DF 1 "general_operand" "f")))]
1804 (define_insn "adddi_lshrdi_63"
1805 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
1806 (plus:DI (lshiftrt:DI (match_operand:DI 1 "general_operand" "rm")
1809 (clobber (match_scratch:SI 2 "=d"))]
1813 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1814 if (REG_P (operands[1]) && REGNO (operands[1]) == REGNO (operands[0]))
1816 \"move%.l %1,%2\;add%.l %2,%2\;subx%.l %2,%2\;sub%.l %2,%3\;subx%.l %2,%0\";
1817 if (GET_CODE (operands[1]) == REG)
1818 operands[4] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1819 else if (GET_CODE (XEXP (operands[1], 0)) == POST_INC
1820 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
1821 operands[4] = operands[1];
1823 operands[4] = adjust_address (operands[1], SImode, 4);
1824 if (GET_CODE (operands[1]) == MEM
1825 && GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
1826 output_asm_insn (\"move%.l %4,%3\", operands);
1827 output_asm_insn (\"move%.l %1,%0\;smi %2\", operands);
1828 if (TARGET_68020 || TARGET_COLDFIRE)
1829 output_asm_insn (\"extb%.l %2\", operands);
1831 output_asm_insn (\"ext%.w %2\;ext%.l %2\", operands);
1832 if (GET_CODE (operands[1]) != MEM
1833 || GET_CODE (XEXP (operands[1], 0)) != PRE_DEC)
1834 output_asm_insn (\"move%.l %4,%3\", operands);
1835 return \"sub%.l %2,%3\;subx%.l %2,%0\";
1838 (define_insn "adddi_sexthishl32"
1839 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,a,*d,*d")
1840 (plus:DI (ashift:DI (sign_extend:DI
1841 (match_operand:HI 1 "general_operand" "rm,rm,rm,rm"))
1843 (match_operand:DI 2 "general_operand" "0,0,0,0")))
1844 (clobber (match_scratch:SI 3 "=&d,X,a,?d"))]
1849 if (ADDRESS_REG_P (operands[0]))
1850 return \"add%.w %1,%0\";
1851 else if (ADDRESS_REG_P (operands[3]))
1852 return \"move%.w %1,%3\;add%.l %3,%0\";
1854 return \"move%.w %1,%3\;ext%.l %3\;add%.l %3,%0\";
1857 (define_insn "adddi_dilshr32"
1858 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,o")
1859 ;; (plus:DI (match_operand:DI 2 "general_operand" "%0")
1860 ;; (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro")
1861 ;; (const_int 32))))]
1862 (plus:DI (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro,d")
1864 (match_operand:DI 2 "general_operand" "0,0")))]
1869 if (GET_CODE (operands[0]) == REG)
1870 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1872 operands[2] = adjust_address (operands[0], SImode, 4);
1873 return \"add%.l %1,%2\;negx%.l %0\;neg%.l %0\";
1876 (define_insn "adddi_dishl32"
1877 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o")
1878 ;; (plus:DI (match_operand:DI 2 "general_operand" "%0")
1879 ;; (ashift:DI (match_operand:DI 1 "general_operand" "ro")
1880 ;; (const_int 32))))]
1881 (plus:DI (ashift:DI (match_operand:DI 1 "general_operand" "ro,d")
1883 (match_operand:DI 2 "general_operand" "0,0")))]
1888 if (GET_CODE (operands[1]) == REG)
1889 operands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1891 operands[1] = adjust_address (operands[1], SImode, 4);
1892 return \"add%.l %1,%0\";
1895 (define_insn "adddi3"
1896 [(set (match_operand:DI 0 "nonimmediate_operand" "=<,o<>,d,d,d")
1897 (plus:DI (match_operand:DI 1 "general_operand" "%0,0,0,0,0")
1898 (match_operand:DI 2 "general_operand" "<,d,no>,d,a")))
1899 (clobber (match_scratch:SI 3 "=X,&d,&d,X,&d"))]
1903 if (DATA_REG_P (operands[0]))
1905 if (DATA_REG_P (operands[2]))
1906 return \"add%.l %R2,%R0\;addx%.l %2,%0\";
1907 else if (GET_CODE (operands[2]) == MEM
1908 && GET_CODE (XEXP (operands[2], 0)) == POST_INC)
1909 return \"move%.l %2,%3\;add%.l %2,%R0\;addx%.l %3,%0\";
1915 if (GET_CODE (operands[2]) == REG)
1917 low = gen_rtx_REG (SImode, REGNO (operands[2]) + 1);
1920 else if (CONSTANT_P (operands[2]))
1921 split_double (operands[2], &high, &low);
1924 low = adjust_address (operands[2], SImode, 4);
1928 operands[1] = low, operands[2] = high;
1929 xoperands[0] = operands[3];
1930 if (GET_CODE (operands[1]) == CONST_INT
1931 && INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
1932 xoperands[1] = GEN_INT (-INTVAL (operands[2]) - 1);
1934 xoperands[1] = operands[2];
1936 output_asm_insn (output_move_simode (xoperands), xoperands);
1937 if (GET_CODE (operands[1]) == CONST_INT)
1939 if (INTVAL (operands[1]) > 0 && INTVAL (operands[1]) <= 8)
1940 return \"addq%.l %1,%R0\;addx%.l %3,%0\";
1941 else if (INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
1943 operands[1] = GEN_INT (-INTVAL (operands[1]));
1944 return \"subq%.l %1,%R0\;subx%.l %3,%0\";
1947 return \"add%.l %1,%R0\;addx%.l %3,%0\";
1950 else if (GET_CODE (operands[0]) == MEM)
1952 if (GET_CODE (operands[2]) == MEM
1953 && GET_CODE (XEXP (operands[2], 0)) == PRE_DEC)
1954 return \"add%.l %2,%0\;addx%.l %2,%0\";
1956 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
1958 operands[1] = gen_rtx_MEM (SImode,
1959 plus_constant (XEXP(operands[0], 0), -8));
1960 return \"move%.l %0,%3\;add%.l %R2,%0\;addx%.l %2,%3\;move%.l %3,%1\";
1962 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
1964 operands[1] = XEXP(operands[0], 0);
1965 return \"add%.l %R2,%0\;move%.l %0,%3\;addx%.l %2,%3\;move%.l %3,%1\";
1969 operands[1] = adjust_address (operands[0], SImode, 4);
1970 return \"add%.l %R2,%1\;move%.l %0,%3\;addx%.l %2,%3\;move%.l %3,%0\";
1977 (define_insn "addsi_lshrsi_31"
1978 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
1979 (plus:SI (lshiftrt:SI (match_operand:SI 1 "general_operand" "rm")
1985 operands[2] = operands[0];
1986 operands[3] = gen_label_rtx();
1987 if (GET_CODE (operands[0]) == MEM)
1989 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
1990 operands[0] = gen_rtx_MEM (SImode, XEXP (XEXP (operands[0], 0), 0));
1991 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
1992 operands[2] = gen_rtx_MEM (SImode, XEXP (XEXP (operands[0], 0), 0));
1994 output_asm_insn (\"move%.l %1,%0\", operands);
1995 output_asm_insn (MOTOROLA ? \"jbpl %l3\" : \"jpl %l3\", operands);
1996 output_asm_insn (\"addq%.l %#1,%2\", operands);
1997 (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
1998 CODE_LABEL_NUMBER (operands[3]));
2002 (define_expand "addsi3"
2003 [(set (match_operand:SI 0 "nonimmediate_operand" "")
2004 (plus:SI (match_operand:SI 1 "general_operand" "")
2005 (match_operand:SI 2 "general_src_operand" "")))]
2009 ;; Note that the middle two alternatives are near-duplicates
2010 ;; in order to handle insns generated by reload.
2011 ;; This is needed since they are not themselves reloaded,
2012 ;; so commutativity won't apply to them.
2013 (define_insn "*addsi3_internal"
2014 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,?a,?a,d,a")
2015 (plus:SI (match_operand:SI 1 "general_operand" "%0,a,rJK,0,0")
2016 (match_operand:SI 2 "general_src_operand" "dIKLT,rJK,a,mSrIKLT,mSrIKLs")))]
2020 "* return output_addsi3 (operands);")
2022 (define_insn "*addsi3_5200"
2023 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,?a,?a,r")
2024 (plus:SI (match_operand:SI 1 "general_operand" "%0,a,rJK,0")
2025 (match_operand:SI 2 "general_src_operand" "d,rJK,a,mrIKLs")))]
2027 "* return output_addsi3 (operands);")
2030 [(set (match_operand:SI 0 "nonimmediate_operand" "=a")
2031 (plus:SI (match_operand:SI 1 "general_operand" "0")
2033 (match_operand:HI 2 "nonimmediate_src_operand" "rmS"))))]
2037 (define_insn "addhi3"
2038 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,r")
2039 (plus:HI (match_operand:HI 1 "general_operand" "%0,0")
2040 (match_operand:HI 2 "general_src_operand" "dn,rmSn")))]
2044 if (GET_CODE (operands[2]) == CONST_INT)
2046 /* If the constant would be a negative number when interpreted as
2047 HImode, make it negative. This is usually, but not always, done
2048 elsewhere in the compiler. First check for constants out of range,
2049 which could confuse us. */
2051 if (INTVAL (operands[2]) >= 32768)
2052 operands[2] = GEN_INT (INTVAL (operands[2]) - 65536);
2054 if (INTVAL (operands[2]) > 0
2055 && INTVAL (operands[2]) <= 8)
2056 return \"addq%.w %2,%0\";
2057 if (INTVAL (operands[2]) < 0
2058 && INTVAL (operands[2]) >= -8)
2060 operands[2] = GEN_INT (- INTVAL (operands[2]));
2061 return \"subq%.w %2,%0\";
2063 /* On the CPU32 it is faster to use two addqw instructions to
2064 add a small integer (8 < N <= 16) to a register.
2065 Likewise for subqw. */
2066 if (TARGET_CPU32 && REG_P (operands[0]))
2068 if (INTVAL (operands[2]) > 8
2069 && INTVAL (operands[2]) <= 16)
2071 operands[2] = GEN_INT (INTVAL (operands[2]) - 8);
2072 return \"addq%.w %#8,%0\;addq%.w %2,%0\";
2074 if (INTVAL (operands[2]) < -8
2075 && INTVAL (operands[2]) >= -16)
2077 operands[2] = GEN_INT (- INTVAL (operands[2]) - 8);
2078 return \"subq%.w %#8,%0\;subq%.w %2,%0\";
2081 if (ADDRESS_REG_P (operands[0]) && !TARGET_68040)
2082 return MOTOROLA ? \"lea (%c2,%0),%0\" : \"lea %0@(%c2),%0\";
2084 return \"add%.w %2,%0\";
2087 ;; These insns must use MATCH_DUP instead of the more expected
2088 ;; use of a matching constraint because the "output" here is also
2089 ;; an input, so you can't use the matching constraint. That also means
2090 ;; that you can't use the "%", so you need patterns with the matched
2091 ;; operand in both positions.
2094 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
2095 (plus:HI (match_dup 0)
2096 (match_operand:HI 1 "general_src_operand" "dn,rmSn")))]
2100 if (GET_CODE (operands[1]) == CONST_INT)
2102 /* If the constant would be a negative number when interpreted as
2103 HImode, make it negative. This is usually, but not always, done
2104 elsewhere in the compiler. First check for constants out of range,
2105 which could confuse us. */
2107 if (INTVAL (operands[1]) >= 32768)
2108 operands[1] = GEN_INT (INTVAL (operands[1]) - 65536);
2110 if (INTVAL (operands[1]) > 0
2111 && INTVAL (operands[1]) <= 8)
2112 return \"addq%.w %1,%0\";
2113 if (INTVAL (operands[1]) < 0
2114 && INTVAL (operands[1]) >= -8)
2116 operands[1] = GEN_INT (- INTVAL (operands[1]));
2117 return \"subq%.w %1,%0\";
2119 /* On the CPU32 it is faster to use two addqw instructions to
2120 add a small integer (8 < N <= 16) to a register.
2121 Likewise for subqw. */
2122 if (TARGET_CPU32 && REG_P (operands[0]))
2124 if (INTVAL (operands[1]) > 8
2125 && INTVAL (operands[1]) <= 16)
2127 operands[1] = GEN_INT (INTVAL (operands[1]) - 8);
2128 return \"addq%.w %#8,%0\;addq%.w %1,%0\";
2130 if (INTVAL (operands[1]) < -8
2131 && INTVAL (operands[1]) >= -16)
2133 operands[1] = GEN_INT (- INTVAL (operands[1]) - 8);
2134 return \"subq%.w %#8,%0\;subq%.w %1,%0\";
2137 if (ADDRESS_REG_P (operands[0]) && !TARGET_68040)
2138 return MOTOROLA ? \"lea (%c1,%0),%0\" : \"lea %0@(%c1),%0\";
2140 return \"add%.w %1,%0\";
2144 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
2145 (plus:HI (match_operand:HI 1 "general_src_operand" "dn,rmSn")
2150 if (GET_CODE (operands[1]) == CONST_INT)
2152 /* If the constant would be a negative number when interpreted as
2153 HImode, make it negative. This is usually, but not always, done
2154 elsewhere in the compiler. First check for constants out of range,
2155 which could confuse us. */
2157 if (INTVAL (operands[1]) >= 32768)
2158 operands[1] = GEN_INT (INTVAL (operands[1]) - 65536);
2160 if (INTVAL (operands[1]) > 0
2161 && INTVAL (operands[1]) <= 8)
2162 return \"addq%.w %1,%0\";
2163 if (INTVAL (operands[1]) < 0
2164 && INTVAL (operands[1]) >= -8)
2166 operands[1] = GEN_INT (- INTVAL (operands[1]));
2167 return \"subq%.w %1,%0\";
2169 /* On the CPU32 it is faster to use two addqw instructions to
2170 add a small integer (8 < N <= 16) to a register.
2171 Likewise for subqw. */
2172 if (TARGET_CPU32 && REG_P (operands[0]))
2174 if (INTVAL (operands[1]) > 8
2175 && INTVAL (operands[1]) <= 16)
2177 operands[1] = GEN_INT (INTVAL (operands[1]) - 8);
2178 return \"addq%.w %#8,%0\;addq%.w %1,%0\";
2180 if (INTVAL (operands[1]) < -8
2181 && INTVAL (operands[1]) >= -16)
2183 operands[1] = GEN_INT (- INTVAL (operands[1]) - 8);
2184 return \"subq%.w %#8,%0\;subq%.w %1,%0\";
2187 if (ADDRESS_REG_P (operands[0]) && !TARGET_68040)
2188 return MOTOROLA ? \"lea (%c1,%0),%0\" : \"lea %0@(%c1),%0\";
2190 return \"add%.w %1,%0\";
2193 (define_insn "addqi3"
2194 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
2195 (plus:QI (match_operand:QI 1 "general_operand" "%0,0")
2196 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
2200 if (GET_CODE (operands[2]) == CONST_INT)
2202 if (INTVAL (operands[2]) >= 128)
2203 operands[2] = GEN_INT (INTVAL (operands[2]) - 256);
2205 if (INTVAL (operands[2]) > 0
2206 && INTVAL (operands[2]) <= 8)
2207 return \"addq%.b %2,%0\";
2208 if (INTVAL (operands[2]) < 0 && INTVAL (operands[2]) >= -8)
2210 operands[2] = GEN_INT (- INTVAL (operands[2]));
2211 return \"subq%.b %2,%0\";
2214 return \"add%.b %2,%0\";
2218 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
2219 (plus:QI (match_dup 0)
2220 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
2224 if (GET_CODE (operands[1]) == CONST_INT)
2226 if (INTVAL (operands[1]) >= 128)
2227 operands[1] = GEN_INT (INTVAL (operands[1]) - 256);
2229 if (INTVAL (operands[1]) > 0
2230 && INTVAL (operands[1]) <= 8)
2231 return \"addq%.b %1,%0\";
2232 if (INTVAL (operands[1]) < 0 && INTVAL (operands[1]) >= -8)
2234 operands[1] = GEN_INT (- INTVAL (operands[1]));
2235 return \"subq%.b %1,%0\";
2238 return \"add%.b %1,%0\";
2242 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
2243 (plus:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn")
2248 if (GET_CODE (operands[1]) == CONST_INT)
2250 if (INTVAL (operands[1]) >= 128)
2251 operands[1] = GEN_INT (INTVAL (operands[1]) - 256);
2253 if (INTVAL (operands[1]) > 0
2254 && INTVAL (operands[1]) <= 8)
2255 return \"addq%.b %1,%0\";
2256 if (INTVAL (operands[1]) < 0 && INTVAL (operands[1]) >= -8)
2258 operands[1] = GEN_INT (- INTVAL (operands[1]));
2259 return \"subq%.b %1,%0\";
2262 return \"add%.b %1,%0\";
2265 (define_expand "adddf3"
2266 [(set (match_operand:DF 0 "nonimmediate_operand" "")
2267 (plus:DF (match_operand:DF 1 "general_operand" "")
2268 (match_operand:DF 2 "general_operand" "")))]
2273 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2274 (plus:DF (float:DF (match_operand:SI 2 "general_operand" "dmi"))
2275 (match_operand:DF 1 "general_operand" "0")))]
2280 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2281 (plus:DF (float:DF (match_operand:HI 2 "general_operand" "dmn"))
2282 (match_operand:DF 1 "general_operand" "0")))]
2287 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2288 (plus:DF (float:DF (match_operand:QI 2 "general_operand" "dmn"))
2289 (match_operand:DF 1 "general_operand" "0")))]
2294 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2295 (plus:DF (match_operand:DF 1 "general_operand" "%0")
2296 (match_operand:DF 2 "general_operand" "fmG")))]
2300 if (REG_P (operands[2]))
2301 return \"f%&add%.x %2,%0\";
2302 return \"f%&add%.d %f2,%0\";
2305 (define_expand "addsf3"
2306 [(set (match_operand:SF 0 "nonimmediate_operand" "")
2307 (plus:SF (match_operand:SF 1 "general_operand" "")
2308 (match_operand:SF 2 "general_operand" "")))]
2313 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2314 (plus:SF (float:SF (match_operand:SI 2 "general_operand" "dmi"))
2315 (match_operand:SF 1 "general_operand" "0")))]
2320 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2321 (plus:SF (float:SF (match_operand:HI 2 "general_operand" "dmn"))
2322 (match_operand:SF 1 "general_operand" "0")))]
2327 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2328 (plus:SF (float:SF (match_operand:QI 2 "general_operand" "dmn"))
2329 (match_operand:SF 1 "general_operand" "0")))]
2334 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2335 (plus:SF (match_operand:SF 1 "general_operand" "%0")
2336 (match_operand:SF 2 "general_operand" "fdmF")))]
2340 if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
2341 return \"f%$add%.x %2,%0\";
2342 return \"f%$add%.s %f2,%0\";
2345 ;; subtract instructions
2347 (define_insn "subdi_sexthishl32"
2348 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,a,*d,*d")
2349 (minus:DI (match_operand:DI 1 "general_operand" "0,0,0,0")
2350 (ashift:DI (sign_extend:DI (match_operand:HI 2 "general_operand" "rm,rm,rm,rm"))
2352 (clobber (match_scratch:SI 3 "=&d,X,a,?d"))]
2357 if (ADDRESS_REG_P (operands[0]))
2358 return \"sub%.w %2,%0\";
2359 else if (ADDRESS_REG_P (operands[3]))
2360 return \"move%.w %2,%3\;sub%.l %3,%0\";
2362 return \"move%.w %2,%3\;ext%.l %3\;sub%.l %3,%0\";
2365 (define_insn "subdi_dishl32"
2366 [(set (match_operand:DI 0 "nonimmediate_operand" "+ro")
2367 (minus:DI (match_dup 0)
2368 (ashift:DI (match_operand:DI 1 "general_operand" "ro")
2374 if (GET_CODE (operands[1]) == REG)
2375 operands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
2377 operands[1] = adjust_address (operands[1], SImode, 4);
2378 return \"sub%.l %1,%0\";
2381 (define_insn "subdi3"
2382 [(set (match_operand:DI 0 "nonimmediate_operand" "=<,o<>,d,d,d")
2383 (minus:DI (match_operand:DI 1 "general_operand" "0,0,0,0,0")
2384 (match_operand:DI 2 "general_operand" "<,d,no>,d,a")))
2385 (clobber (match_scratch:SI 3 "=X,&d,&d,X,&d"))]
2389 if (DATA_REG_P (operands[0]))
2391 if (DATA_REG_P (operands[2]))
2392 return \"sub%.l %R2,%R0\;subx%.l %2,%0\";
2393 else if (GET_CODE (operands[2]) == MEM
2394 && GET_CODE (XEXP (operands[2], 0)) == POST_INC)
2396 return \"move%.l %2,%3\;sub%.l %2,%R0\;subx%.l %3,%0\";
2403 if (GET_CODE (operands[2]) == REG)
2405 low = gen_rtx_REG (SImode, REGNO (operands[2]) + 1);
2408 else if (CONSTANT_P (operands[2]))
2409 split_double (operands[2], &high, &low);
2412 low = adjust_address (operands[2], SImode, 4);
2416 operands[1] = low, operands[2] = high;
2417 xoperands[0] = operands[3];
2418 if (GET_CODE (operands[1]) == CONST_INT
2419 && INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
2420 xoperands[1] = GEN_INT (-INTVAL (operands[2]) - 1);
2422 xoperands[1] = operands[2];
2424 output_asm_insn (output_move_simode (xoperands), xoperands);
2425 if (GET_CODE (operands[1]) == CONST_INT)
2427 if (INTVAL (operands[1]) > 0 && INTVAL (operands[1]) <= 8)
2428 return \"subq%.l %1,%R0\;subx%.l %3,%0\";
2429 else if (INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
2431 operands[1] = GEN_INT (-INTVAL (operands[1]));
2432 return \"addq%.l %1,%R0\;addx%.l %3,%0\";
2435 return \"sub%.l %1,%R0\;subx%.l %3,%0\";
2438 else if (GET_CODE (operands[0]) == MEM)
2440 if (GET_CODE (operands[2]) == MEM
2441 && GET_CODE (XEXP (operands[2], 0)) == PRE_DEC)
2442 return \"sub%.l %2,%0\;subx%.l %2,%0\";
2444 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
2447 = gen_rtx_MEM (SImode, plus_constant (XEXP (operands[0], 0), -8));
2448 return \"move%.l %0,%3\;sub%.l %R2,%0\;subx%.l %2,%3\;move%.l %3,%1\";
2450 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
2452 operands[1] = XEXP(operands[0], 0);
2453 return \"sub%.l %R2,%0\;move%.l %0,%3\;subx%.l %2,%3\;move%.l %3,%1\";
2457 operands[1] = adjust_address (operands[0], SImode, 4);
2458 return \"sub%.l %R2,%1\;move%.l %0,%3\;subx%.l %2,%3\;move%.l %3,%0\";
2465 (define_insn "subsi3"
2466 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,d,a")
2467 (minus:SI (match_operand:SI 1 "general_operand" "0,0,0")
2468 (match_operand:SI 2 "general_src_operand" "dT,mSrT,mSrs")))]
2473 [(set (match_operand:SI 0 "nonimmediate_operand" "=a")
2474 (minus:SI (match_operand:SI 1 "general_operand" "0")
2476 (match_operand:HI 2 "nonimmediate_src_operand" "rmS"))))]
2480 (define_insn "subhi3"
2481 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,r")
2482 (minus:HI (match_operand:HI 1 "general_operand" "0,0")
2483 (match_operand:HI 2 "general_src_operand" "dn,rmSn")))]
2488 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
2489 (minus:HI (match_dup 0)
2490 (match_operand:HI 1 "general_src_operand" "dn,rmSn")))]
2494 (define_insn "subqi3"
2495 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
2496 (minus:QI (match_operand:QI 1 "general_operand" "0,0")
2497 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
2502 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
2503 (minus:QI (match_dup 0)
2504 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
2508 (define_expand "subdf3"
2509 [(set (match_operand:DF 0 "nonimmediate_operand" "")
2510 (minus:DF (match_operand:DF 1 "general_operand" "")
2511 (match_operand:DF 2 "general_operand" "")))]
2516 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2517 (minus:DF (match_operand:DF 1 "general_operand" "0")
2518 (float:DF (match_operand:SI 2 "general_operand" "dmi"))))]
2523 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2524 (minus:DF (match_operand:DF 1 "general_operand" "0")
2525 (float:DF (match_operand:HI 2 "general_operand" "dmn"))))]
2530 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2531 (minus:DF (match_operand:DF 1 "general_operand" "0")
2532 (float:DF (match_operand:QI 2 "general_operand" "dmn"))))]
2537 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2538 (minus:DF (match_operand:DF 1 "general_operand" "0")
2539 (match_operand:DF 2 "general_operand" "fmG")))]
2543 if (REG_P (operands[2]))
2544 return \"f%&sub%.x %2,%0\";
2545 return \"f%&sub%.d %f2,%0\";
2548 (define_expand "subsf3"
2549 [(set (match_operand:SF 0 "nonimmediate_operand" "")
2550 (minus:SF (match_operand:SF 1 "general_operand" "")
2551 (match_operand:SF 2 "general_operand" "")))]
2556 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2557 (minus:SF (match_operand:SF 1 "general_operand" "0")
2558 (float:SF (match_operand:SI 2 "general_operand" "dmi"))))]
2563 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2564 (minus:SF (match_operand:SF 1 "general_operand" "0")
2565 (float:SF (match_operand:HI 2 "general_operand" "dmn"))))]
2570 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2571 (minus:SF (match_operand:SF 1 "general_operand" "0")
2572 (float:SF (match_operand:QI 2 "general_operand" "dmn"))))]
2577 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2578 (minus:SF (match_operand:SF 1 "general_operand" "0")
2579 (match_operand:SF 2 "general_operand" "fdmF")))]
2583 if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
2584 return \"f%$sub%.x %2,%0\";
2585 return \"f%$sub%.s %f2,%0\";
2588 ;; multiply instructions
2590 (define_insn "mulhi3"
2591 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
2592 (mult:HI (match_operand:HI 1 "general_operand" "%0")
2593 (match_operand:HI 2 "general_src_operand" "dmSn")))]
2597 return MOTOROLA ? \"muls%.w %2,%0\" : \"muls %2,%0\";
2600 (define_insn "mulhisi3"
2601 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2602 (mult:SI (sign_extend:SI
2603 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2605 (match_operand:HI 2 "nonimmediate_src_operand" "dmS"))))]
2609 return MOTOROLA ? \"muls%.w %2,%0\" : \"muls %2,%0\";
2613 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2614 (mult:SI (sign_extend:SI
2615 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2616 (match_operand:SI 2 "const_int_operand" "n")))]
2617 "INTVAL (operands[2]) >= -0x8000 && INTVAL (operands[2]) <= 0x7fff"
2620 return MOTOROLA ? \"muls%.w %2,%0\" : \"muls %2,%0\";
2623 (define_expand "mulsi3"
2624 [(set (match_operand:SI 0 "nonimmediate_operand" "")
2625 (mult:SI (match_operand:SI 1 "general_operand" "")
2626 (match_operand:SI 2 "general_operand" "")))]
2627 "TARGET_68020 || TARGET_COLDFIRE"
2631 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2632 (mult:SI (match_operand:SI 1 "general_operand" "%0")
2633 (match_operand:SI 2 "general_src_operand" "dmSTK")))]
2639 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2640 (mult:SI (match_operand:SI 1 "general_operand" "%0")
2641 (match_operand:SI 2 "general_operand" "d<Q>")))]
2645 (define_insn "umulhisi3"
2646 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2647 (mult:SI (zero_extend:SI
2648 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2650 (match_operand:HI 2 "nonimmediate_src_operand" "dmS"))))]
2654 return MOTOROLA ? \"mulu%.w %2,%0\" : \"mulu %2,%0\";
2658 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2659 (mult:SI (zero_extend:SI
2660 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2661 (match_operand:SI 2 "const_int_operand" "n")))]
2662 "INTVAL (operands[2]) >= 0 && INTVAL (operands[2]) <= 0xffff"
2665 return MOTOROLA ? \"mulu%.w %2,%0\" : \"mulu %2,%0\";
2668 ;; We need a separate DEFINE_EXPAND for u?mulsidi3 to be able to use the
2669 ;; proper matching constraint. This is because the matching is between
2670 ;; the high-numbered word of the DImode operand[0] and operand[1].
2671 (define_expand "umulsidi3"
2673 [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 4)
2674 (mult:SI (match_operand:SI 1 "register_operand" "")
2675 (match_operand:SI 2 "register_operand" "")))
2676 (set (subreg:SI (match_dup 0) 0)
2677 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
2678 (zero_extend:DI (match_dup 2)))
2679 (const_int 32))))])]
2680 "TARGET_68020 && !TARGET_68060 && !TARGET_COLDFIRE"
2684 [(set (match_operand:SI 0 "register_operand" "=d")
2685 (mult:SI (match_operand:SI 1 "register_operand" "%0")
2686 (match_operand:SI 2 "nonimmediate_operand" "dm")))
2687 (set (match_operand:SI 3 "register_operand" "=d")
2688 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
2689 (zero_extend:DI (match_dup 2)))
2691 "TARGET_68020 && !TARGET_68060 && !TARGET_COLDFIRE"
2694 ; Match immediate case. For 2.4 only match things < 2^31.
2695 ; It's tricky with larger values in these patterns since we need to match
2696 ; values between the two parallel multiplies, between a CONST_DOUBLE and
2699 [(set (match_operand:SI 0 "register_operand" "=d")
2700 (mult:SI (match_operand:SI 1 "register_operand" "%0")
2701 (match_operand:SI 2 "const_int_operand" "n")))
2702 (set (match_operand:SI 3 "register_operand" "=d")
2703 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
2706 "TARGET_68020 && !TARGET_68060 && !TARGET_COLDFIRE
2707 && (unsigned) INTVAL (operands[2]) <= 0x7fffffff"
2710 (define_expand "mulsidi3"
2712 [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 4)
2713 (mult:SI (match_operand:SI 1 "register_operand" "")
2714 (match_operand:SI 2 "register_operand" "")))
2715 (set (subreg:SI (match_dup 0) 0)
2716 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
2717 (sign_extend:DI (match_dup 2)))
2718 (const_int 32))))])]
2719 "TARGET_68020 && !TARGET_68060 && !TARGET_COLDFIRE"
2723 [(set (match_operand:SI 0 "register_operand" "=d")
2724 (mult:SI (match_operand:SI 1 "register_operand" "%0")
2725 (match_operand:SI 2 "nonimmediate_operand" "dm")))
2726 (set (match_operand:SI 3 "register_operand" "=d")
2727 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
2728 (sign_extend:DI (match_dup 2)))
2730 "TARGET_68020 && !TARGET_68060 && !TARGET_COLDFIRE"
2734 [(set (match_operand:SI 0 "register_operand" "=d")
2735 (mult:SI (match_operand:SI 1 "register_operand" "%0")
2736 (match_operand:SI 2 "const_int_operand" "n")))
2737 (set (match_operand:SI 3 "register_operand" "=d")
2738 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
2741 "TARGET_68020 && !TARGET_68060 && !TARGET_COLDFIRE"
2744 (define_expand "umulsi3_highpart"
2746 [(set (match_operand:SI 0 "register_operand" "")
2749 (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" ""))
2750 (zero_extend:DI (match_operand:SI 2 "general_operand" "")))
2752 (clobber (match_dup 3))])]
2753 "TARGET_68020 && !TARGET_68060 && !TARGET_COLDFIRE"
2756 operands[3] = gen_reg_rtx (SImode);
2758 if (GET_CODE (operands[2]) == CONST_INT)
2760 operands[2] = immed_double_const (INTVAL (operands[2]) & 0xffffffff,
2763 /* We have to adjust the operand order for the matching constraints. */
2764 emit_insn (gen_const_umulsi3_highpart (operands[0], operands[3],
2765 operands[1], operands[2]));
2771 [(set (match_operand:SI 0 "register_operand" "=d")
2774 (mult:DI (zero_extend:DI (match_operand:SI 2 "register_operand" "%1"))
2775 (zero_extend:DI (match_operand:SI 3 "nonimmediate_operand" "dm")))
2777 (clobber (match_operand:SI 1 "register_operand" "=d"))]
2778 "TARGET_68020 && !TARGET_68060 && !TARGET_COLDFIRE"
2781 (define_insn "const_umulsi3_highpart"
2782 [(set (match_operand:SI 0 "register_operand" "=d")
2785 (mult:DI (zero_extend:DI (match_operand:SI 2 "register_operand" "1"))
2786 (match_operand:DI 3 "const_uint32_operand" "n"))
2788 (clobber (match_operand:SI 1 "register_operand" "=d"))]
2789 "TARGET_68020 && !TARGET_68060 && !TARGET_COLDFIRE"
2792 (define_expand "smulsi3_highpart"
2794 [(set (match_operand:SI 0 "register_operand" "")
2797 (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" ""))
2798 (sign_extend:DI (match_operand:SI 2 "general_operand" "")))
2800 (clobber (match_dup 3))])]
2801 "TARGET_68020 && !TARGET_68060 && !TARGET_COLDFIRE"
2804 operands[3] = gen_reg_rtx (SImode);
2805 if (GET_CODE (operands[2]) == CONST_INT)
2807 /* We have to adjust the operand order for the matching constraints. */
2808 emit_insn (gen_const_smulsi3_highpart (operands[0], operands[3],
2809 operands[1], operands[2]));
2815 [(set (match_operand:SI 0 "register_operand" "=d")
2818 (mult:DI (sign_extend:DI (match_operand:SI 2 "register_operand" "%1"))
2819 (sign_extend:DI (match_operand:SI 3 "nonimmediate_operand" "dm")))
2821 (clobber (match_operand:SI 1 "register_operand" "=d"))]
2822 "TARGET_68020 && !TARGET_68060 && !TARGET_COLDFIRE"
2825 (define_insn "const_smulsi3_highpart"
2826 [(set (match_operand:SI 0 "register_operand" "=d")
2829 (mult:DI (sign_extend:DI (match_operand:SI 2 "register_operand" "1"))
2830 (match_operand:DI 3 "const_sint32_operand" "n"))
2832 (clobber (match_operand:SI 1 "register_operand" "=d"))]
2833 "TARGET_68020 && !TARGET_68060 && !TARGET_COLDFIRE"
2836 (define_expand "muldf3"
2837 [(set (match_operand:DF 0 "nonimmediate_operand" "")
2838 (mult:DF (match_operand:DF 1 "general_operand" "")
2839 (match_operand:DF 2 "general_operand" "")))]
2844 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2845 (mult:DF (float:DF (match_operand:SI 2 "general_operand" "dmi"))
2846 (match_operand:DF 1 "general_operand" "0")))]
2851 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2852 (mult:DF (float:DF (match_operand:HI 2 "general_operand" "dmn"))
2853 (match_operand:DF 1 "general_operand" "0")))]
2858 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2859 (mult:DF (float:DF (match_operand:QI 2 "general_operand" "dmn"))
2860 (match_operand:DF 1 "general_operand" "0")))]
2865 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2866 (mult:DF (match_operand:DF 1 "general_operand" "%0")
2867 (match_operand:DF 2 "general_operand" "fmG")))]
2871 if (GET_CODE (operands[2]) == CONST_DOUBLE
2872 && floating_exact_log2 (operands[2]) && !TARGET_68040 && !TARGET_68060)
2874 int i = floating_exact_log2 (operands[2]);
2875 operands[2] = GEN_INT (i);
2876 return \"fscale%.l %2,%0\";
2878 if (REG_P (operands[2]))
2879 return \"f%&mul%.x %2,%0\";
2880 return \"f%&mul%.d %f2,%0\";
2883 (define_expand "mulsf3"
2884 [(set (match_operand:SF 0 "nonimmediate_operand" "")
2885 (mult:SF (match_operand:SF 1 "general_operand" "")
2886 (match_operand:SF 2 "general_operand" "")))]
2891 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2892 (mult:SF (float:SF (match_operand:SI 2 "general_operand" "dmi"))
2893 (match_operand:SF 1 "general_operand" "0")))]
2897 return (TARGET_68040_ONLY
2898 ? \"fsmul%.l %2,%0\"
2899 : \"fsglmul%.l %2,%0\");
2903 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2904 (mult:SF (float:SF (match_operand:HI 2 "general_operand" "dmn"))
2905 (match_operand:SF 1 "general_operand" "0")))]
2909 return (TARGET_68040_ONLY
2910 ? \"fsmul%.w %2,%0\"
2911 : \"fsglmul%.w %2,%0\");
2915 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2916 (mult:SF (float:SF (match_operand:QI 2 "general_operand" "dmn"))
2917 (match_operand:SF 1 "general_operand" "0")))]
2921 return (TARGET_68040_ONLY
2922 ? \"fsmul%.b %2,%0\"
2923 : \"fsglmul%.b %2,%0\");
2927 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2928 (mult:SF (match_operand:SF 1 "general_operand" "%0")
2929 (match_operand:SF 2 "general_operand" "fdmF")))]
2933 if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
2934 return (TARGET_68040_ONLY
2935 ? \"fsmul%.x %2,%0\"
2936 : \"fsglmul%.x %2,%0\");
2937 return (TARGET_68040_ONLY
2938 ? \"fsmul%.s %f2,%0\"
2939 : \"fsglmul%.s %f2,%0\");
2942 ;; divide instructions
2944 (define_expand "divdf3"
2945 [(set (match_operand:DF 0 "nonimmediate_operand" "")
2946 (div:DF (match_operand:DF 1 "general_operand" "")
2947 (match_operand:DF 2 "general_operand" "")))]
2952 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2953 (div:DF (match_operand:DF 1 "general_operand" "0")
2954 (float:DF (match_operand:SI 2 "general_operand" "dmi"))))]
2959 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2960 (div:DF (match_operand:DF 1 "general_operand" "0")
2961 (float:DF (match_operand:HI 2 "general_operand" "dmn"))))]
2966 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2967 (div:DF (match_operand:DF 1 "general_operand" "0")
2968 (float:DF (match_operand:QI 2 "general_operand" "dmn"))))]
2973 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2974 (div:DF (match_operand:DF 1 "general_operand" "0")
2975 (match_operand:DF 2 "general_operand" "fmG")))]
2979 if (REG_P (operands[2]))
2980 return \"f%&div%.x %2,%0\";
2981 return \"f%&div%.d %f2,%0\";
2984 (define_expand "divsf3"
2985 [(set (match_operand:SF 0 "nonimmediate_operand" "")
2986 (div:SF (match_operand:SF 1 "general_operand" "")
2987 (match_operand:SF 2 "general_operand" "")))]
2992 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2993 (div:SF (match_operand:SF 1 "general_operand" "0")
2994 (float:SF (match_operand:SI 2 "general_operand" "dmi"))))]
2998 return (TARGET_68040_ONLY
2999 ? \"fsdiv%.l %2,%0\"
3000 : \"fsgldiv%.l %2,%0\");
3004 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
3005 (div:SF (match_operand:SF 1 "general_operand" "0")
3006 (float:SF (match_operand:HI 2 "general_operand" "dmn"))))]
3010 return (TARGET_68040_ONLY
3011 ? \"fsdiv%.w %2,%0\"
3012 : \"fsgldiv%.w %2,%0\");
3016 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
3017 (div:SF (match_operand:SF 1 "general_operand" "0")
3018 (float:SF (match_operand:QI 2 "general_operand" "dmn"))))]
3022 return (TARGET_68040_ONLY
3023 ? \"fsdiv%.b %2,%0\"
3024 : \"fsgldiv%.b %2,%0\");
3028 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
3029 (div:SF (match_operand:SF 1 "general_operand" "0")
3030 (match_operand:SF 2 "general_operand" "fdmF")))]
3034 if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
3035 return (TARGET_68040_ONLY
3036 ? \"fsdiv%.x %2,%0\"
3037 : \"fsgldiv%.x %2,%0\");
3038 return (TARGET_68040_ONLY
3039 ? \"fsdiv%.s %f2,%0\"
3040 : \"fsgldiv%.s %f2,%0\");
3043 ;; Remainder instructions.
3045 (define_expand "divmodsi4"
3047 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3048 (div:SI (match_operand:SI 1 "general_operand" "")
3049 (match_operand:SI 2 "general_src_operand" "")))
3050 (set (match_operand:SI 3 "nonimmediate_operand" "")
3051 (mod:SI (match_dup 1) (match_dup 2)))])]
3052 "TARGET_68020 || TARGET_CF_HWDIV"
3056 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3057 (div:SI (match_operand:SI 1 "general_operand" "0")
3058 (match_operand:SI 2 "general_src_operand" "d<Q>U")))
3059 (set (match_operand:SI 3 "nonimmediate_operand" "=&d")
3060 (mod:SI (match_dup 1) (match_dup 2)))]
3064 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3065 return \"divs%.l %2,%0\";
3066 else if (find_reg_note (insn, REG_UNUSED, operands[0]))
3067 return \"rems%.l %2,%3:%0\";
3069 return \"rems%.l %2,%3:%0\;divs%.l %2,%0\";
3073 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3074 (div:SI (match_operand:SI 1 "general_operand" "0")
3075 (match_operand:SI 2 "general_src_operand" "dmSTK")))
3076 (set (match_operand:SI 3 "nonimmediate_operand" "=d")
3077 (mod:SI (match_dup 1) (match_dup 2)))]
3081 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3082 return \"divs%.l %2,%0\";
3084 return \"divsl%.l %2,%3:%0\";
3087 (define_expand "udivmodsi4"
3089 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3090 (udiv:SI (match_operand:SI 1 "general_operand" "0")
3091 (match_operand:SI 2 "general_src_operand" "dmSTK")))
3092 (set (match_operand:SI 3 "nonimmediate_operand" "=d")
3093 (umod:SI (match_dup 1) (match_dup 2)))])]
3094 "TARGET_68020 || TARGET_CF_HWDIV"
3098 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3099 (udiv:SI (match_operand:SI 1 "general_operand" "0")
3100 (match_operand:SI 2 "general_src_operand" "d<Q>U")))
3101 (set (match_operand:SI 3 "nonimmediate_operand" "=&d")
3102 (umod:SI (match_dup 1) (match_dup 2)))]
3106 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3107 return \"divu%.l %2,%0\";
3108 else if (find_reg_note (insn, REG_UNUSED, operands[0]))
3109 return \"remu%.l %2,%3:%0\";
3111 return \"remu%.l %2,%3:%0\;divu%.l %2,%0\";
3115 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3116 (udiv:SI (match_operand:SI 1 "general_operand" "0")
3117 (match_operand:SI 2 "general_src_operand" "dmSTK")))
3118 (set (match_operand:SI 3 "nonimmediate_operand" "=d")
3119 (umod:SI (match_dup 1) (match_dup 2)))]
3120 "TARGET_68020 && !TARGET_COLDFIRE"
3123 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3124 return \"divu%.l %2,%0\";
3126 return \"divul%.l %2,%3:%0\";
3129 (define_insn "divmodhi4"
3130 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
3131 (div:HI (match_operand:HI 1 "general_operand" "0")
3132 (match_operand:HI 2 "general_src_operand" "dmSKT")))
3133 (set (match_operand:HI 3 "nonimmediate_operand" "=d")
3134 (mod:HI (match_dup 1) (match_dup 2)))]
3135 "!TARGET_COLDFIRE || TARGET_CF_HWDIV"
3138 output_asm_insn (MOTOROLA ?
3139 \"ext%.l %0\;divs%.w %2,%0\" :
3140 \"extl %0\;divs %2,%0\",
3142 if (!find_reg_note(insn, REG_UNUSED, operands[3]))
3145 return \"move%.l %0,%3\;swap %3\";
3151 (define_insn "udivmodhi4"
3152 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
3153 (udiv:HI (match_operand:HI 1 "general_operand" "0")
3154 (match_operand:HI 2 "general_src_operand" "dmSKT")))
3155 (set (match_operand:HI 3 "nonimmediate_operand" "=d")
3156 (umod:HI (match_dup 1) (match_dup 2)))]
3157 "!TARGET_COLDFIRE || TARGET_CF_HWDIV"
3160 output_asm_insn (MOTOROLA ?
3161 \"and%.l %#0xFFFF,%0\;divu%.w %2,%0\" :
3162 \"and%.l %#0xFFFF,%0\;divu %2,%0\",
3164 if (!find_reg_note(insn, REG_UNUSED, operands[3]))
3167 return \"move%.l %0,%3\;swap %3\";
3173 ;; logical-and instructions
3175 ;; "anddi3" is mainly here to help combine().
3176 (define_insn "anddi3"
3177 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,d")
3178 (and:DI (match_operand:DI 1 "general_operand" "%0,0")
3179 (match_operand:DI 2 "general_operand" "dn,don")))]
3184 /* We can get CONST_DOUBLE, but also const1_rtx etc. */
3185 if (CONSTANT_P (operands[2]))
3189 split_double (operands[2], &hi, &lo);
3191 switch (INTVAL (hi))
3194 output_asm_insn (\"clr%.l %0\", operands);
3202 xoperands[0] = operands[0];
3204 output_asm_insn (output_andsi3 (xoperands), xoperands);
3207 if (GET_CODE (operands[0]) == REG)
3208 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3210 operands[0] = adjust_address (operands[0], SImode, 4);
3211 switch (INTVAL (lo))
3214 output_asm_insn (\"clr%.l %0\", operands);
3222 xoperands[0] = operands[0];
3224 output_asm_insn (output_andsi3 (xoperands), xoperands);
3229 if (GET_CODE (operands[0]) != REG)
3231 operands[1] = adjust_address (operands[0], SImode, 4);
3232 return \"and%.l %2,%0\;and%.l %R2,%1\";
3234 if (GET_CODE (operands[2]) != REG)
3236 operands[1] = adjust_address (operands[2], SImode, 4);
3237 return \"and%.l %2,%0\;and%.l %1,%R0\";
3239 return \"and%.l %2,%0\;and%.l %R2,%R0\";
3242 ;; Prevent AND from being made with sp. This doesn't exist in the machine
3243 ;; and reload will cause inefficient code. Since sp is a FIXED_REG, we
3244 ;; can't allocate pseudos into it.
3246 (define_expand "andsi3"
3247 [(set (match_operand:SI 0 "not_sp_operand" "")
3248 (and:SI (match_operand:SI 1 "general_operand" "")
3249 (match_operand:SI 2 "general_src_operand" "")))]
3253 (define_insn "andsi3_internal"
3254 [(set (match_operand:SI 0 "not_sp_operand" "=m,d")
3255 (and:SI (match_operand:SI 1 "general_operand" "%0,0")
3256 (match_operand:SI 2 "general_src_operand" "dKT,dmSM")))]
3260 return output_andsi3 (operands);
3263 (define_insn "andsi3_5200"
3264 [(set (match_operand:SI 0 "not_sp_operand" "=m,d")
3265 (and:SI (match_operand:SI 1 "general_operand" "%0,0")
3266 (match_operand:SI 2 "general_src_operand" "d,dmsK")))]
3270 (define_insn "andhi3"
3271 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,d")
3272 (and:HI (match_operand:HI 1 "general_operand" "%0,0")
3273 (match_operand:HI 2 "general_src_operand" "dn,dmSn")))]
3278 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3279 (and:HI (match_dup 0)
3280 (match_operand:HI 1 "general_src_operand" "dn,dmSn")))]
3285 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3286 (and:HI (match_operand:HI 1 "general_src_operand" "dn,dmSn")
3291 (define_insn "andqi3"
3292 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
3293 (and:QI (match_operand:QI 1 "general_operand" "%0,0")
3294 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
3299 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3300 (and:QI (match_dup 0)
3301 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
3306 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3307 (and:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn")
3312 ;; inclusive-or instructions
3314 (define_insn "iordi_zext"
3315 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,d")
3316 (ior:DI (zero_extend:DI (match_operand 1 "general_operand" "dn,dmn"))
3317 (match_operand:DI 2 "general_operand" "0,0")))]
3324 if (GET_CODE (operands[0]) == REG)
3325 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3327 operands[0] = adjust_address (operands[0], SImode, 4);
3328 if (GET_MODE (operands[1]) == SImode)
3329 return \"or%.l %1,%0\";
3330 byte_mode = (GET_MODE (operands[1]) == QImode);
3331 if (GET_CODE (operands[0]) == MEM)
3332 operands[0] = adjust_address (operands[0], byte_mode ? QImode : HImode,
3335 return \"or%.b %1,%0\";
3337 return \"or%.w %1,%0\";
3340 ;; "iordi3" is mainly here to help combine().
3341 (define_insn "iordi3"
3342 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,d")
3343 (ior:DI (match_operand:DI 1 "general_operand" "%0,0")
3344 (match_operand:DI 2 "general_operand" "dn,don")))]
3349 /* We can get CONST_DOUBLE, but also const1_rtx etc. */
3350 if (CONSTANT_P (operands[2]))
3354 split_double (operands[2], &hi, &lo);
3356 switch (INTVAL (hi))
3361 /* FIXME : a scratch register would be welcome here if operand[0]
3362 is not a register */
3363 output_asm_insn (\"move%.l %#-1,%0\", operands);
3369 xoperands[0] = operands[0];
3371 output_asm_insn (output_iorsi3 (xoperands), xoperands);
3374 if (GET_CODE (operands[0]) == REG)
3375 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3377 operands[0] = adjust_address (operands[0], SImode, 4);
3378 switch (INTVAL (lo))
3383 /* FIXME : a scratch register would be welcome here if operand[0]
3384 is not a register */
3385 output_asm_insn (\"move%.l %#-1,%0\", operands);
3391 xoperands[0] = operands[0];
3393 output_asm_insn (output_iorsi3 (xoperands), xoperands);
3398 if (GET_CODE (operands[0]) != REG)
3400 operands[1] = adjust_address (operands[0], SImode, 4);
3401 return \"or%.l %2,%0\;or%.l %R2,%1\";
3403 if (GET_CODE (operands[2]) != REG)
3405 operands[1] = adjust_address (operands[2], SImode, 4);
3406 return \"or%.l %2,%0\;or%.l %1,%R0\";
3408 return \"or%.l %2,%0\;or%.l %R2,%R0\";
3411 (define_expand "iorsi3"
3412 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3413 (ior:SI (match_operand:SI 1 "general_operand" "")
3414 (match_operand:SI 2 "general_src_operand" "")))]
3418 (define_insn "iorsi3_internal"
3419 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,d")
3420 (ior:SI (match_operand:SI 1 "general_operand" "%0,0")
3421 (match_operand:SI 2 "general_src_operand" "dKT,dmSMT")))]
3425 return output_iorsi3 (operands);
3428 (define_insn "iorsi3_5200"
3429 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,d")
3430 (ior:SI (match_operand:SI 1 "general_operand" "%0,0")
3431 (match_operand:SI 2 "general_src_operand" "d,dmsK")))]
3435 (define_insn "iorhi3"
3436 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,d")
3437 (ior:HI (match_operand:HI 1 "general_operand" "%0,0")
3438 (match_operand:HI 2 "general_src_operand" "dn,dmSn")))]
3443 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3444 (ior:HI (match_dup 0)
3445 (match_operand:HI 1 "general_src_operand" "dn,dmSn")))]
3450 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3451 (ior:HI (match_operand:HI 1 "general_src_operand" "dn,dmSn")
3456 (define_insn "iorqi3"
3457 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
3458 (ior:QI (match_operand:QI 1 "general_operand" "%0,0")
3459 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
3464 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3465 (ior:QI (match_dup 0)
3466 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
3471 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3472 (ior:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn")
3477 ;; On all 68k models, this makes faster code in a special case.
3478 ;; See also ashlsi_16, ashrsi_16 and lshrsi_16.
3480 (define_insn "iorsi_zexthi_ashl16"
3481 [(set (match_operand:SI 0 "nonimmediate_operand" "=&d")
3482 (ior:SI (zero_extend:SI (match_operand:HI 1 "general_operand" "rmn"))
3483 (ashift:SI (match_operand:SI 2 "general_operand" "or")
3489 if (GET_CODE (operands[2]) != REG)
3490 operands[2] = adjust_address (operands[2], HImode, 2);
3491 if (GET_CODE (operands[2]) != REG
3492 || REGNO (operands[2]) != REGNO (operands[0]))
3493 output_asm_insn (\"move%.w %2,%0\", operands);
3494 return \"swap %0\;mov%.w %1,%0\";
3497 (define_insn "iorsi_zext"
3498 [(set (match_operand:SI 0 "nonimmediate_operand" "=o,d")
3499 (ior:SI (zero_extend:SI (match_operand 1 "general_operand" "dn,dmn"))
3500 (match_operand:SI 2 "general_operand" "0,0")))]
3507 byte_mode = (GET_MODE (operands[1]) == QImode);
3508 if (GET_CODE (operands[0]) == MEM)
3509 operands[0] = adjust_address (operands[0], byte_mode ? QImode : HImode,
3512 return \"or%.b %1,%0\";
3514 return \"or%.w %1,%0\";
3519 ;; "xordi3" is mainly here to help combine().
3520 (define_insn "xordi3"
3521 [(set (match_operand:DI 0 "nonimmediate_operand" "=od")
3522 (xor:DI (match_operand:DI 1 "general_operand" "%0")
3523 (match_operand:DI 2 "general_operand" "dn")))]
3528 /* We can get CONST_DOUBLE, but also const1_rtx etc. */
3530 if (CONSTANT_P (operands[2]))
3534 split_double (operands[2], &hi, &lo);
3536 switch (INTVAL (hi))
3541 output_asm_insn (\"not%.l %0\", operands);
3544 /* FIXME : a scratch register would be welcome here if
3545 -128 <= INTVAL (hi) < -1 */
3549 xoperands[0] = operands[0];
3551 output_asm_insn (output_xorsi3 (xoperands), xoperands);
3554 if (GET_CODE (operands[0]) == REG)
3555 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3557 operands[0] = adjust_address (operands[0], SImode, 4);
3558 switch (INTVAL (lo))
3563 output_asm_insn (\"not%.l %0\", operands);
3566 /* FIXME : a scratch register would be welcome here if
3567 -128 <= INTVAL (lo) < -1 */
3569 /* FIXME : this should be merged with xorsi3 */
3573 xoperands[0] = operands[0];
3575 output_asm_insn (output_xorsi3 (xoperands), xoperands);
3580 if (GET_CODE (operands[0]) != REG)
3582 operands[1] = adjust_address (operands[0], SImode, 4);
3583 return \"eor%.l %2,%0\;eor%.l %R2,%1\";
3585 if (GET_CODE (operands[2]) != REG)
3587 operands[1] = adjust_address (operands[2], SImode, 4);
3588 return \"eor%.l %2,%0\;eor%.l %1,%R0\";
3590 return \"eor%.l %2,%0\;eor%.l %R2,%R0\";
3593 (define_expand "xorsi3"
3594 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3595 (xor:SI (match_operand:SI 1 "general_operand" "")
3596 (match_operand:SI 2 "general_operand" "")))]
3600 (define_insn "xorsi3_internal"
3601 [(set (match_operand:SI 0 "nonimmediate_operand" "=do,m")
3602 (xor:SI (match_operand:SI 1 "general_operand" "%0,0")
3603 (match_operand:SI 2 "general_operand" "di,dKT")))]
3608 return output_xorsi3 (operands);
3611 (define_insn "xorsi3_5200"
3612 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm,d")
3613 (xor:SI (match_operand:SI 1 "general_operand" "%0,0")
3614 (match_operand:SI 2 "general_operand" "d,Ks")))]
3618 (define_insn "xorhi3"
3619 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
3620 (xor:HI (match_operand:HI 1 "general_operand" "%0")
3621 (match_operand:HI 2 "general_operand" "dn")))]
3626 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
3627 (xor:HI (match_dup 0)
3628 (match_operand:HI 1 "general_operand" "dn")))]
3633 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
3634 (xor:HI (match_operand:HI 1 "general_operand" "dn")
3639 (define_insn "xorqi3"
3640 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
3641 (xor:QI (match_operand:QI 1 "general_operand" "%0")
3642 (match_operand:QI 2 "general_operand" "dn")))]
3647 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
3648 (xor:QI (match_dup 0)
3649 (match_operand:QI 1 "general_operand" "dn")))]
3654 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
3655 (xor:QI (match_operand:QI 1 "general_operand" "dn")
3660 ;; negation instructions
3662 (define_expand "negdi2"
3663 [(set (match_operand:DI 0 "nonimmediate_operand" "")
3664 (neg:DI (match_operand:DI 1 "general_operand" "")))]
3668 if (TARGET_COLDFIRE)
3669 emit_insn (gen_negdi2_5200 (operands[0], operands[1]));
3671 emit_insn (gen_negdi2_internal (operands[0], operands[1]));
3675 (define_insn "negdi2_internal"
3676 [(set (match_operand:DI 0 "nonimmediate_operand" "=<,do,!*a")
3677 (neg:DI (match_operand:DI 1 "general_operand" "0,0,0")))]
3681 if (which_alternative == 0)
3682 return \"neg%.l %0\;negx%.l %0\";
3683 if (GET_CODE (operands[0]) == REG)
3684 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3686 operands[1] = adjust_address (operands[0], SImode, 4);
3687 if (ADDRESS_REG_P (operands[0]))
3688 return \"exg %/d0,%1\;neg%.l %/d0\;exg %/d0,%1\;exg %/d0,%0\;negx%.l %/d0\;exg %/d0,%0\";
3690 return \"neg%.l %1\;negx%.l %0\";
3693 (define_insn "negdi2_5200"
3694 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
3695 (neg:DI (match_operand:DI 1 "general_operand" "0")))]
3699 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3700 return \"neg%.l %1\;negx%.l %0\";
3703 (define_expand "negsi2"
3704 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3705 (neg:SI (match_operand:SI 1 "general_operand" "")))]
3709 if (TARGET_COLDFIRE)
3710 emit_insn (gen_negsi2_5200 (operands[0], operands[1]));
3712 emit_insn (gen_negsi2_internal (operands[0], operands[1]));
3716 (define_insn "negsi2_internal"
3717 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
3718 (neg:SI (match_operand:SI 1 "general_operand" "0")))]
3722 (define_insn "negsi2_5200"
3723 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3724 (neg:SI (match_operand:SI 1 "general_operand" "0")))]
3728 (define_insn "neghi2"
3729 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
3730 (neg:HI (match_operand:HI 1 "general_operand" "0")))]
3735 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
3736 (neg:HI (match_dup 0)))]
3740 (define_insn "negqi2"
3741 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
3742 (neg:QI (match_operand:QI 1 "general_operand" "0")))]
3747 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
3748 (neg:QI (match_dup 0)))]
3752 ;; If using software floating point, just flip the sign bit.
3754 (define_expand "negsf2"
3755 [(set (match_operand:SF 0 "nonimmediate_operand" "")
3756 (neg:SF (match_operand:SF 1 "general_operand" "")))]
3765 target = operand_subword_force (operands[0], 0, SFmode);
3766 result = expand_binop (SImode, xor_optab,
3767 operand_subword_force (operands[1], 0, SFmode),
3768 GEN_INT (0x80000000), target, 0, OPTAB_WIDEN);
3772 if (result != target)
3773 emit_move_insn (result, target);
3775 /* Make a place for REG_EQUAL. */
3776 emit_move_insn (operands[0], operands[0]);
3782 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,d")
3783 (neg:SF (match_operand:SF 1 "general_operand" "fdmF,0")))]
3787 if (DATA_REG_P (operands[0]))
3789 operands[1] = GEN_INT (31);
3790 return \"bchg %1,%0\";
3792 if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
3793 return \"f%$neg%.x %1,%0\";
3794 return \"f%$neg%.s %f1,%0\";
3797 (define_expand "negdf2"
3798 [(set (match_operand:DF 0 "nonimmediate_operand" "")
3799 (neg:DF (match_operand:DF 1 "general_operand" "")))]
3810 target = operand_subword (operands[0], 0, 1, DFmode);
3811 result = expand_binop (SImode, xor_optab,
3812 operand_subword_force (operands[1], 0, DFmode),
3813 GEN_INT (0x80000000), target, 0, OPTAB_WIDEN);
3817 if (result != target)
3818 emit_move_insn (result, target);
3820 emit_move_insn (operand_subword (operands[0], 1, 1, DFmode),
3821 operand_subword_force (operands[1], 1, DFmode));
3823 insns = get_insns ();
3826 emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
3832 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,d")
3833 (neg:DF (match_operand:DF 1 "general_operand" "fmF,0")))]
3837 if (DATA_REG_P (operands[0]))
3839 operands[1] = GEN_INT (31);
3840 return \"bchg %1,%0\";
3842 if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
3843 return \"f%&neg%.x %1,%0\";
3844 return \"f%&neg%.d %f1,%0\";
3847 ;; Sqrt instruction for the 68881
3849 (define_insn "sqrtsf2"
3850 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
3851 (sqrt:SF (match_operand:SF 1 "general_operand" "fm")))]
3855 if (FP_REG_P (operands[1]))
3856 return \"f%$sqrt%.x %1,%0\";
3858 return \"f%$sqrt%.s %1,%0\";
3861 (define_insn "sqrtdf2"
3862 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
3863 (sqrt:DF (match_operand:DF 1 "general_operand" "fm")))]
3867 if (FP_REG_P (operands[1]))
3868 return \"f%&sqrt%.x %1,%0\";
3870 return \"f%&sqrt%.d %1,%0\";
3873 ;; Absolute value instructions
3874 ;; If using software floating point, just zero the sign bit.
3876 (define_expand "abssf2"
3877 [(set (match_operand:SF 0 "nonimmediate_operand" "")
3878 (abs:SF (match_operand:SF 1 "general_operand" "")))]
3887 target = operand_subword_force (operands[0], 0, SFmode);
3888 result = expand_binop (SImode, and_optab,
3889 operand_subword_force (operands[1], 0, SFmode),
3890 GEN_INT (0x7fffffff), target, 0, OPTAB_WIDEN);
3894 if (result != target)
3895 emit_move_insn (result, target);
3897 /* Make a place for REG_EQUAL. */
3898 emit_move_insn (operands[0], operands[0]);
3904 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
3905 (abs:SF (match_operand:SF 1 "general_operand" "fdmF")))]
3909 if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
3910 return \"f%$abs%.x %1,%0\";
3911 return \"f%$abs%.s %f1,%0\";
3914 (define_expand "absdf2"
3915 [(set (match_operand:DF 0 "nonimmediate_operand" "")
3916 (abs:DF (match_operand:DF 1 "general_operand" "")))]
3927 target = operand_subword (operands[0], 0, 1, DFmode);
3928 result = expand_binop (SImode, and_optab,
3929 operand_subword_force (operands[1], 0, DFmode),
3930 GEN_INT (0x7fffffff), target, 0, OPTAB_WIDEN);
3934 if (result != target)
3935 emit_move_insn (result, target);
3937 emit_move_insn (operand_subword (operands[0], 1, 1, DFmode),
3938 operand_subword_force (operands[1], 1, DFmode));
3940 insns = get_insns ();
3943 emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
3949 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
3950 (abs:DF (match_operand:DF 1 "general_operand" "fmF")))]
3954 if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
3955 return \"f%&abs%.x %1,%0\";
3956 return \"f%&abs%.d %f1,%0\";
3959 ;; one complement instructions
3961 ;; "one_cmpldi2" is mainly here to help combine().
3962 (define_insn "one_cmpldi2"
3963 [(set (match_operand:DI 0 "nonimmediate_operand" "=dm")
3964 (not:DI (match_operand:DI 1 "general_operand" "0")))]
3969 if (GET_CODE (operands[0]) == REG)
3970 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3971 else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC
3972 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
3973 operands[1] = operands[0];
3975 operands[1] = adjust_address (operands[0], SImode, 4);
3976 return \"not%.l %1\;not%.l %0\";
3979 (define_expand "one_cmplsi2"
3980 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3981 (not:SI (match_operand:SI 1 "general_operand" "")))]
3985 if (TARGET_COLDFIRE)
3986 emit_insn (gen_one_cmplsi2_5200 (operands[0], operands[1]));
3988 emit_insn (gen_one_cmplsi2_internal (operands[0], operands[1]));
3992 (define_insn "one_cmplsi2_internal"
3993 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
3994 (not:SI (match_operand:SI 1 "general_operand" "0")))]
3998 (define_insn "one_cmplsi2_5200"
3999 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
4000 (not:SI (match_operand:SI 1 "general_operand" "0")))]
4004 (define_insn "one_cmplhi2"
4005 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
4006 (not:HI (match_operand:HI 1 "general_operand" "0")))]
4011 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
4012 (not:HI (match_dup 0)))]
4016 (define_insn "one_cmplqi2"
4017 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
4018 (not:QI (match_operand:QI 1 "general_operand" "0")))]
4023 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
4024 (not:QI (match_dup 0)))]
4028 ;; arithmetic shift instructions
4029 ;; We don't need the shift memory by 1 bit instruction
4031 (define_insn "ashldi_extsi"
4032 [(set (match_operand:DI 0 "nonimmediate_operand" "=ro")
4034 (match_operator:DI 2 "extend_operator"
4035 [(match_operand:SI 1 "general_operand" "rm")])
4041 if (GET_CODE (operands[0]) == REG)
4042 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4044 operands[2] = adjust_address (operands[0], SImode, 4);
4045 if (ADDRESS_REG_P (operands[0]))
4046 return \"move%.l %1,%0\;sub%.l %2,%2\";
4048 return \"move%.l %1,%0\;clr%.l %2\";
4051 (define_insn "ashldi_sexthi"
4052 [(set (match_operand:DI 0 "nonimmediate_operand" "=m,a*d")
4053 (ashift:DI (sign_extend:DI (match_operand:HI 1 "general_operand" "rm,rm"))
4055 (clobber (match_scratch:SI 2 "=a,X"))]
4060 if (GET_CODE (operands[0]) == MEM)
4062 if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
4063 return \"clr%.l %0\;move%.w %1,%2\;move%.l %2,%0\";
4064 else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
4065 return \"move%.w %1,%2\;move%.l %2,%0\;clr%.l %0\";
4068 operands[3] = adjust_address (operands[0], SImode, 4);
4069 return \"move%.w %1,%2\;move%.l %2,%0\;clr%.l %3\";
4072 else if (DATA_REG_P (operands[0]))
4073 return \"move%.w %1,%0\;ext%.l %0\;clr%.l %R0\";
4075 return \"move%.w %1,%0\;sub%.l %R0,%R0\";
4078 (define_insn "ashldi_const32"
4079 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
4080 (ashift:DI (match_operand:DI 1 "general_operand" "ro")
4086 if (GET_CODE (operands[1]) == REG)
4087 operands[3] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
4089 operands[3] = adjust_address (operands[1], SImode, 4);
4090 if (GET_CODE (operands[0]) == REG)
4091 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4092 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
4093 return \"clr%.l %0\;move%.l %3,%0\";
4094 else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
4095 return \"move%.l %3,%0\;clr%.l %0\";
4097 operands[2] = adjust_address (operands[0], SImode, 4);
4098 if (ADDRESS_REG_P (operands[2]))
4099 return \"move%.l %3,%0\;sub%.l %2,%2\";
4101 return \"move%.l %3,%0\;clr%.l %2\";
4104 ;; The predicate below must be general_operand, because ashldi3 allows that
4105 (define_insn "ashldi_const"
4106 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
4107 (ashift:DI (match_operand:DI 1 "general_operand" "0")
4108 (match_operand 2 "const_int_operand" "n")))]
4110 && ((INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3)
4111 || INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16
4112 || (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63)))"
4115 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4116 if (INTVAL (operands[2]) == 1)
4117 return \"add%.l %1,%1\;addx%.l %0,%0\";
4118 else if (INTVAL (operands[2]) == 8)
4119 return \"rol%.l %#8,%1\;rol%.l %#8,%0\;move%.b %1,%0\;clr%.b %1\";
4120 else if (INTVAL (operands[2]) == 16)
4121 return \"swap %1\;swap %0\;move%.w %1,%0\;clr%.w %1\";
4122 else if (INTVAL (operands[2]) == 48)
4123 return \"mov%.l %1,%0\;swap %0\;clr%.l %1\;clr%.w %0\";
4124 else if (INTVAL (operands[2]) == 2)
4125 return \"add%.l %1,%1\;addx%.l %0,%0\;add%.l %1,%1\;addx%.l %0,%0\";
4126 else if (INTVAL (operands[2]) == 3)
4127 return \"add%.l %1,%1\;addx%.l %0,%0\;add%.l %1,%1\;addx%.l %0,%0\;add%.l %1,%1\;addx%.l %0,%0\";
4128 else /* 32 < INTVAL (operands[2]) <= 63 */
4130 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
4131 output_asm_insn (INTVAL (operands[2]) <= 8 ? \"asl%.l %2,%1\" :
4132 \"moveq %2,%0\;asl%.l %0,%1\", operands);
4133 return \"mov%.l %1,%0\;moveq %#0,%1\";
4137 (define_expand "ashldi3"
4138 [(set (match_operand:DI 0 "nonimmediate_operand" "")
4139 (ashift:DI (match_operand:DI 1 "general_operand" "")
4140 (match_operand 2 "const_int_operand" "")))]
4144 /* ??? This is a named pattern like this is not allowed to FAIL based
4146 if (GET_CODE (operands[2]) != CONST_INT
4147 || ((INTVAL (operands[2]) < 1 || INTVAL (operands[2]) > 3)
4148 && INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16
4149 && (INTVAL (operands[2]) < 32 || INTVAL (operands[2]) > 63)))
4153 ;; On most 68k models, this makes faster code in a special case.
4155 (define_insn "ashlsi_16"
4156 [(set (match_operand:SI 0 "register_operand" "=d")
4157 (ashift:SI (match_operand:SI 1 "register_operand" "0")
4163 return \"swap %0\;clr%.w %0\";
4166 ;; ashift patterns : use lsl instead of asl, because lsl always clears the
4167 ;; overflow bit, so we must not set CC_NO_OVERFLOW.
4169 ;; On the 68000, this makes faster code in a special case.
4171 (define_insn "ashlsi_17_24"
4172 [(set (match_operand:SI 0 "register_operand" "=d")
4173 (ashift:SI (match_operand:SI 1 "register_operand" "0")
4174 (match_operand:SI 2 "const_int_operand" "n")))]
4175 "(! TARGET_68020 && !TARGET_COLDFIRE
4176 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24)"
4181 operands[2] = GEN_INT (INTVAL (operands[2]) - 16);
4182 return \"lsl%.w %2,%0\;swap %0\;clr%.w %0\";
4185 (define_insn "ashlsi3"
4186 [(set (match_operand:SI 0 "register_operand" "=d")
4187 (ashift:SI (match_operand:SI 1 "register_operand" "0")
4188 (match_operand:SI 2 "general_operand" "dI")))]
4192 if (operands[2] == const1_rtx)
4194 cc_status.flags = CC_NO_OVERFLOW;
4195 return \"add%.l %0,%0\";
4197 return \"lsl%.l %2,%0\";
4200 (define_insn "ashlhi3"
4201 [(set (match_operand:HI 0 "register_operand" "=d")
4202 (ashift:HI (match_operand:HI 1 "register_operand" "0")
4203 (match_operand:HI 2 "general_operand" "dI")))]
4208 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
4209 (ashift:HI (match_dup 0)
4210 (match_operand:HI 1 "general_operand" "dI")))]
4214 (define_insn "ashlqi3"
4215 [(set (match_operand:QI 0 "register_operand" "=d")
4216 (ashift:QI (match_operand:QI 1 "register_operand" "0")
4217 (match_operand:QI 2 "general_operand" "dI")))]
4222 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
4223 (ashift:QI (match_dup 0)
4224 (match_operand:QI 1 "general_operand" "dI")))]
4228 ;; On most 68k models, this makes faster code in a special case.
4230 (define_insn "ashrsi_16"
4231 [(set (match_operand:SI 0 "register_operand" "=d")
4232 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4235 "swap %0\;ext%.l %0")
4237 ;; On the 68000, this makes faster code in a special case.
4240 [(set (match_operand:SI 0 "register_operand" "=d")
4241 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4242 (match_operand:SI 2 "const_int_operand" "n")))]
4243 "(! TARGET_68020 && !TARGET_COLDFIRE
4244 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24)"
4247 operands[2] = GEN_INT (INTVAL (operands[2]) - 16);
4248 return \"swap %0\;asr%.w %2,%0\;ext%.l %0\";
4251 (define_insn "subreghi1ashrdi_const32"
4252 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
4253 (subreg:HI (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro")
4254 (const_int 32)) 6))]
4258 if (GET_CODE (operands[1]) != REG)
4259 operands[1] = adjust_address (operands[1], HImode, 2);
4260 return \"move%.w %1,%0\";
4263 (define_insn "subregsi1ashrdi_const32"
4264 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
4265 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro")
4266 (const_int 32)) 4))]
4270 return \"move%.l %1,%0\";
4273 (define_insn "ashrdi_const32"
4274 [(set (match_operand:DI 0 "register_operand" "=d")
4275 (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro")
4281 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4283 return \"move%.l %1,%2\;smi %0\;extb%.l %0\";
4285 return \"move%.l %1,%2\;smi %0\;ext%.w %0\;ext%.l %0\";
4288 (define_insn "ashrdi_const32_mem"
4289 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,<")
4290 (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro,ro")
4292 (clobber (match_scratch:SI 2 "=d,d"))]
4297 if (which_alternative == 1)
4298 operands[3] = operands[0];
4300 operands[3] = adjust_address (operands[0], SImode, 4);
4302 return \"move%.l %1,%3\;smi %2\;extb%.l %2\;move%.l %2,%0\";
4304 return \"move%.l %1,%3\;smi %2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0\";
4307 ;; The predicate below must be general_operand, because ashrdi3 allows that
4308 (define_insn "ashrdi_const"
4309 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
4310 (ashiftrt:DI (match_operand:DI 1 "general_operand" "0")
4311 (match_operand 2 "const_int_operand" "n")))]
4313 && ((INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3)
4314 || INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16
4315 || INTVAL (operands[2]) == 31
4316 || (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63)))"
4319 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4320 if (INTVAL (operands[2]) == 63)
4321 return \"add%.l %0,%0\;subx%.l %0,%0\;move%.l %0,%1\";
4323 if (INTVAL (operands[2]) == 1)
4324 return \"asr%.l %#1,%0\;roxr%.l %#1,%1\";
4325 else if (INTVAL (operands[2]) == 8)
4326 return \"move%.b %0,%1\;asr%.l %#8,%0\;ror%.l %#8,%1\";
4327 else if (INTVAL (operands[2]) == 16)
4328 return \"move%.w %0,%1\;swap %0\;ext%.l %0\;swap %1\";
4329 else if (INTVAL (operands[2]) == 48)
4330 return \"swap %0\;ext%.l %0\;move%.l %0,%1\;smi %0\;ext%.w %0\";
4331 else if (INTVAL (operands[2]) == 31)
4332 return \"add%.l %1,%1\;addx%.l %0,%0\;move%.l %0,%1\;subx%.l %0,%0\";
4333 else if (INTVAL (operands[2]) == 2)
4334 return \"asr%.l %#1,%0\;roxr%.l %#1,%1\;asr%.l %#1,%0\;roxr%.l %#1,%1\";
4335 else if (INTVAL (operands[2]) == 3)
4336 return \"asr%.l %#1,%0\;roxr%.l %#1,%1\;asr%.l %#1,%0\;roxr%.l %#1,%1\;asr%.l %#1,%0\;roxr%.l %#1,%1\";
4337 else /* 32 < INTVAL (operands[2]) <= 63 */
4339 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
4340 output_asm_insn (INTVAL (operands[2]) <= 8 ? \"asr%.l %2,%0\" :
4341 \"moveq %2,%1\;asr%.l %1,%0\", operands);
4342 output_asm_insn (\"mov%.l %0,%1\;smi %0\", operands);
4343 return INTVAL (operands[2]) >= 15 ? \"ext%.w %d0\" :
4344 TARGET_68020 ? \"extb%.l %0\" : \"ext%.w %0\;ext%.l %0\";
4348 (define_expand "ashrdi3"
4349 [(set (match_operand:DI 0 "nonimmediate_operand" "")
4350 (ashiftrt:DI (match_operand:DI 1 "general_operand" "")
4351 (match_operand 2 "const_int_operand" "")))]
4355 /* ??? This is a named pattern like this is not allowed to FAIL based
4357 if (GET_CODE (operands[2]) != CONST_INT
4358 || ((INTVAL (operands[2]) < 1 || INTVAL (operands[2]) > 3)
4359 && INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16
4360 && (INTVAL (operands[2]) < 31 || INTVAL (operands[2]) > 63)))
4364 ;; On all 68k models, this makes faster code in a special case.
4366 (define_insn "ashrsi_31"
4367 [(set (match_operand:SI 0 "register_operand" "=d")
4368 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4373 return \"add%.l %0,%0\;subx%.l %0,%0\";
4376 (define_insn "ashrsi3"
4377 [(set (match_operand:SI 0 "register_operand" "=d")
4378 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4379 (match_operand:SI 2 "general_operand" "dI")))]
4383 (define_insn "ashrhi3"
4384 [(set (match_operand:HI 0 "register_operand" "=d")
4385 (ashiftrt:HI (match_operand:HI 1 "register_operand" "0")
4386 (match_operand:HI 2 "general_operand" "dI")))]
4391 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
4392 (ashiftrt:HI (match_dup 0)
4393 (match_operand:HI 1 "general_operand" "dI")))]
4397 (define_insn "ashrqi3"
4398 [(set (match_operand:QI 0 "register_operand" "=d")
4399 (ashiftrt:QI (match_operand:QI 1 "register_operand" "0")
4400 (match_operand:QI 2 "general_operand" "dI")))]
4405 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
4406 (ashiftrt:QI (match_dup 0)
4407 (match_operand:QI 1 "general_operand" "dI")))]
4411 ;; logical shift instructions
4413 ;; commented out because of reload problems in 950612-1.c
4416 ;; (subreg:SI (lshiftrt:DI (match_operand:DI 0 "general_operand" "ro")
4417 ;; (const_int 32)) 4))
4418 ;; (set (match_operand:SI 1 "nonimmediate_operand" "=dm")
4419 ;; (subreg:SI (lshiftrt:DI (match_dup 0)
4420 ;; (const_int 32)) 4))]
4424 ;; return \"move%.l %0,%1\";
4429 ;; (subreg:SI (lshiftrt:DI (match_operand:DI 0 "general_operand" "ro")
4430 ;; (const_int 32)) 0))
4431 ;; (set (match_operand:DI 1 "nonimmediate_operand" "=do")
4432 ;; (lshiftrt:DI (match_dup 0)
4433 ;; (const_int 32)))]
4437 ;; if (GET_CODE (operands[1]) == REG)
4438 ;; operands[2] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
4440 ;; operands[2] = adjust_address (operands[1], SImode, 4);
4441 ;; return \"move%.l %0,%2\;clr%.l %1\";
4444 (define_insn "subreg1lshrdi_const32"
4445 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
4446 (subreg:SI (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro")
4447 (const_int 32)) 4))]
4451 return \"move%.l %1,%0\";
4454 (define_insn "lshrdi_const32"
4455 [(set (match_operand:DI 0 "nonimmediate_operand" "=ro,<,>")
4456 (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro,ro,ro")
4462 if (which_alternative == 1)
4463 return \"move%.l %1,%0\;clr%.l %0\";
4464 if (which_alternative == 2)
4465 return \"clr%.l %0\;move%.l %1,%0\";
4466 if (GET_CODE (operands[0]) == REG)
4467 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4469 operands[2] = adjust_address (operands[0], SImode, 4);
4470 if (GET_CODE (operands[1]) == REG)
4471 operands[3] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
4473 operands[3] = adjust_address (operands[1], SImode, 4);
4474 if (ADDRESS_REG_P (operands[0]))
4475 return \"move%.l %1,%2\;sub%.l %0,%0\";
4477 return \"move%.l %1,%2\;clr%.l %0\";
4480 ;; The predicate below must be general_operand, because lshrdi3 allows that
4481 (define_insn "lshrdi_const"
4482 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
4483 (lshiftrt:DI (match_operand:DI 1 "general_operand" "0")
4484 (match_operand 2 "const_int_operand" "n")))]
4486 && ((INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3)
4487 || INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16
4488 || (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63)))"
4491 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4492 if (INTVAL (operands[2]) == 63)
4493 return \"add%.l %0,%0\;clr%.l %0\;clr%.l %1\;addx%.l %1,%1\";
4495 if (INTVAL (operands[2]) == 1)
4496 return \"lsr%.l %#1,%0\;roxr%.l %#1,%1\";
4497 else if (INTVAL (operands[2]) == 8)
4498 return \"move%.b %0,%1\;lsr%.l %#8,%0\;ror%.l %#8,%1\";
4499 else if (INTVAL (operands[2]) == 16)
4500 return \"move%.w %0,%1\;clr%.w %0\;swap %1\;swap %0\";
4501 else if (INTVAL (operands[2]) == 48)
4502 return \"move%.l %0,%1\;clr%.w %1\;clr%.l %0\;swap %1\";
4503 else if (INTVAL (operands[2]) == 2)
4504 return \"lsr%.l %#1,%0\;roxr%.l %#1,%1\;lsr%.l %#1,%0\;roxr%.l %#1,%1\";
4505 else if (INTVAL (operands[2]) == 3)
4506 return \"lsr%.l %#1,%0\;roxr%.l %#1,%1\;lsr%.l %#1,%0\;roxr%.l %#1,%1\;lsr%.l %#1,%0\;roxr%.l %#1,%1\";
4507 else /* 32 < INTVAL (operands[2]) <= 63 */
4509 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
4510 output_asm_insn (INTVAL (operands[2]) <= 8 ? \"lsr%.l %2,%0\" :
4511 \"moveq %2,%1\;lsr%.l %1,%0\", operands);
4512 return \"mov%.l %0,%1\;moveq %#0,%0\";
4516 (define_expand "lshrdi3"
4517 [(set (match_operand:DI 0 "nonimmediate_operand" "")
4518 (lshiftrt:DI (match_operand:DI 1 "general_operand" "")
4519 (match_operand 2 "const_int_operand" "")))]
4523 /* ??? This is a named pattern like this is not allowed to FAIL based
4525 if (GET_CODE (operands[2]) != CONST_INT
4526 || ((INTVAL (operands[2]) < 1 || INTVAL (operands[2]) > 3)
4527 && INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16
4528 && (INTVAL (operands[2]) < 32 || INTVAL (operands[2]) > 63)))
4532 ;; On all 68k models, this makes faster code in a special case.
4534 (define_insn "lshrsi_31"
4535 [(set (match_operand:SI 0 "register_operand" "=d")
4536 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
4541 return \"add%.l %0,%0\;subx%.l %0,%0\;neg%.l %0\";
4544 ;; On most 68k models, this makes faster code in a special case.
4546 (define_insn "lshrsi_16"
4547 [(set (match_operand:SI 0 "register_operand" "=d")
4548 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
4554 return \"clr%.w %0\;swap %0\";
4557 ;; On the 68000, this makes faster code in a special case.
4559 (define_insn "lshrsi_17_24"
4560 [(set (match_operand:SI 0 "register_operand" "=d")
4561 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
4562 (match_operand:SI 2 "const_int_operand" "n")))]
4563 "(! TARGET_68020 && !TARGET_COLDFIRE
4564 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24)"
4567 /* I think lsr%.w sets the CC properly. */
4568 operands[2] = GEN_INT (INTVAL (operands[2]) - 16);
4569 return \"clr%.w %0\;swap %0\;lsr%.w %2,%0\";
4572 (define_insn "lshrsi3"
4573 [(set (match_operand:SI 0 "register_operand" "=d")
4574 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
4575 (match_operand:SI 2 "general_operand" "dI")))]
4579 (define_insn "lshrhi3"
4580 [(set (match_operand:HI 0 "register_operand" "=d")
4581 (lshiftrt:HI (match_operand:HI 1 "register_operand" "0")
4582 (match_operand:HI 2 "general_operand" "dI")))]
4587 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
4588 (lshiftrt:HI (match_dup 0)
4589 (match_operand:HI 1 "general_operand" "dI")))]
4593 (define_insn "lshrqi3"
4594 [(set (match_operand:QI 0 "register_operand" "=d")
4595 (lshiftrt:QI (match_operand:QI 1 "register_operand" "0")
4596 (match_operand:QI 2 "general_operand" "dI")))]
4601 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
4602 (lshiftrt:QI (match_dup 0)
4603 (match_operand:QI 1 "general_operand" "dI")))]
4607 ;; rotate instructions
4609 (define_insn "rotlsi3"
4610 [(set (match_operand:SI 0 "register_operand" "=d")
4611 (rotate:SI (match_operand:SI 1 "register_operand" "0")
4612 (match_operand:SI 2 "general_operand" "dINO")))]
4616 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 16)
4618 else if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 16)
4620 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
4621 return \"ror%.l %2,%0\";
4624 return \"rol%.l %2,%0\";
4627 (define_insn "rotlhi3"
4628 [(set (match_operand:HI 0 "register_operand" "=d")
4629 (rotate:HI (match_operand:HI 1 "register_operand" "0")
4630 (match_operand:HI 2 "general_operand" "dIP")))]
4634 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 8)
4636 operands[2] = GEN_INT (16 - INTVAL (operands[2]));
4637 return \"ror%.w %2,%0\";
4640 return \"rol%.w %2,%0\";
4644 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
4645 (rotate:HI (match_dup 0)
4646 (match_operand:HI 1 "general_operand" "dIP")))]
4650 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 8)
4652 operands[2] = GEN_INT (16 - INTVAL (operands[2]));
4653 return \"ror%.w %2,%0\";
4656 return \"rol%.w %2,%0\";
4659 (define_insn "rotlqi3"
4660 [(set (match_operand:QI 0 "register_operand" "=d")
4661 (rotate:QI (match_operand:QI 1 "register_operand" "0")
4662 (match_operand:QI 2 "general_operand" "dI")))]
4666 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 4)
4668 operands[2] = GEN_INT (8 - INTVAL (operands[2]));
4669 return \"ror%.b %2,%0\";
4672 return \"rol%.b %2,%0\";
4676 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
4677 (rotate:QI (match_dup 0)
4678 (match_operand:QI 1 "general_operand" "dI")))]
4682 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 4)
4684 operands[2] = GEN_INT (8 - INTVAL (operands[2]));
4685 return \"ror%.b %2,%0\";
4688 return \"rol%.b %2,%0\";
4691 (define_insn "rotrsi3"
4692 [(set (match_operand:SI 0 "register_operand" "=d")
4693 (rotatert:SI (match_operand:SI 1 "register_operand" "0")
4694 (match_operand:SI 2 "general_operand" "dI")))]
4698 (define_insn "rotrhi3"
4699 [(set (match_operand:HI 0 "register_operand" "=d")
4700 (rotatert:HI (match_operand:HI 1 "register_operand" "0")
4701 (match_operand:HI 2 "general_operand" "dI")))]
4706 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
4707 (rotatert:HI (match_dup 0)
4708 (match_operand:HI 1 "general_operand" "dI")))]
4712 (define_insn "rotrqi3"
4713 [(set (match_operand:QI 0 "register_operand" "=d")
4714 (rotatert:QI (match_operand:QI 1 "register_operand" "0")
4715 (match_operand:QI 2 "general_operand" "dI")))]
4720 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
4721 (rotatert:QI (match_dup 0)
4722 (match_operand:QI 1 "general_operand" "dI")))]
4727 ;; Bit set/clear in memory byte.
4729 ;; set bit, bit number is int
4730 (define_insn "bsetmemqi"
4731 [(set (match_operand:QI 0 "memory_operand" "+m")
4732 (ior:QI (subreg:QI (ashift:SI (const_int 1)
4733 (match_operand:SI 1 "general_operand" "d")) 3)
4739 return \"bset %1,%0\";
4742 ;; set bit, bit number is (sign/zero)_extended from HImode/QImode
4744 [(set (match_operand:QI 0 "memory_operand" "+m")
4745 (ior:QI (subreg:QI (ashift:SI (const_int 1)
4746 (match_operator:SI 2 "extend_operator"
4747 [(match_operand 1 "general_operand" "d")])) 3)
4753 return \"bset %1,%0\";
4756 ;; clear bit, bit number is int
4757 (define_insn "bclrmemqi"
4758 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+m")
4760 (minus:SI (const_int 7)
4761 (match_operand:SI 1 "general_operand" "d")))
4767 return \"bclr %1,%0\";
4770 ;; clear bit, bit number is (sign/zero)_extended from HImode/QImode
4772 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+m")
4774 (minus:SI (const_int 7)
4775 (match_operator:SI 2 "extend_operator"
4776 [(match_operand 1 "general_operand" "d")])))
4782 return \"bclr %1,%0\";
4785 ;; Special cases of bit-field insns which we should
4786 ;; recognize in preference to the general case.
4787 ;; These handle aligned 8-bit and 16-bit fields,
4788 ;; which can usually be done with move instructions.
4791 ; Special case for 32-bit field in memory. This only occurs when 32-bit
4792 ; alignment of structure members is specified.
4794 ; The move is allowed to be odd byte aligned, because that's still faster
4795 ; than an odd byte aligned bit-field instruction.
4798 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
4800 (match_operand:SI 1 "const_int_operand" "n"))
4801 (match_operand:SI 2 "general_src_operand" "rmSi"))]
4802 "TARGET_68020 && TARGET_BITFIELD
4803 && (INTVAL (operands[1]) % 8) == 0
4804 && ! mode_dependent_address_p (XEXP (operands[0], 0))"
4808 = adjust_address (operands[0], SImode, INTVAL (operands[1]) / 8);
4810 return \"move%.l %2,%0\";
4814 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+do")
4815 (match_operand:SI 1 "const_int_operand" "n")
4816 (match_operand:SI 2 "const_int_operand" "n"))
4817 (match_operand:SI 3 "register_operand" "d"))]
4818 "TARGET_68020 && TARGET_BITFIELD
4819 && (INTVAL (operands[1]) == 8 || INTVAL (operands[1]) == 16)
4820 && INTVAL (operands[2]) % INTVAL (operands[1]) == 0
4821 && (GET_CODE (operands[0]) == REG
4822 || ! mode_dependent_address_p (XEXP (operands[0], 0)))"
4825 if (REG_P (operands[0]))
4827 if (INTVAL (operands[1]) + INTVAL (operands[2]) != 32)
4828 return \"bfins %3,%0{%b2:%b1}\";
4831 operands[0] = adjust_address (operands[0],
4832 INTVAL (operands[1]) == 8 ? QImode : HImode,
4833 INTVAL (operands[2]) / 8);
4835 if (GET_CODE (operands[3]) == MEM)
4836 operands[3] = adjust_address (operands[3],
4837 INTVAL (operands[1]) == 8 ? QImode : HImode,
4838 (32 - INTVAL (operands[1])) / 8);
4840 if (INTVAL (operands[1]) == 8)
4841 return \"move%.b %3,%0\";
4842 return \"move%.w %3,%0\";
4847 ; Special case for 32-bit field in memory. This only occurs when 32-bit
4848 ; alignment of structure members is specified.
4850 ; The move is allowed to be odd byte aligned, because that's still faster
4851 ; than an odd byte aligned bit-field instruction.
4854 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
4855 (zero_extract:SI (match_operand:QI 1 "memory_src_operand" "oS")
4857 (match_operand:SI 2 "const_int_operand" "n")))]
4858 "TARGET_68020 && TARGET_BITFIELD
4859 && (INTVAL (operands[2]) % 8) == 0
4860 && ! mode_dependent_address_p (XEXP (operands[1], 0))"
4864 = adjust_address (operands[1], SImode, INTVAL (operands[2]) / 8);
4866 return \"move%.l %1,%0\";
4870 [(set (match_operand:SI 0 "nonimmediate_operand" "=&d")
4871 (zero_extract:SI (match_operand:SI 1 "register_operand" "do")
4872 (match_operand:SI 2 "const_int_operand" "n")
4873 (match_operand:SI 3 "const_int_operand" "n")))]
4874 "TARGET_68020 && TARGET_BITFIELD
4875 && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
4876 && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
4877 && (GET_CODE (operands[1]) == REG
4878 || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
4881 cc_status.flags |= CC_NOT_NEGATIVE;
4882 if (REG_P (operands[1]))
4884 if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
4885 return \"bfextu %1{%b3:%b2},%0\";
4889 = adjust_address (operands[1], SImode, INTVAL (operands[3]) / 8);
4891 output_asm_insn (\"clr%.l %0\", operands);
4892 if (GET_CODE (operands[0]) == MEM)
4893 operands[0] = adjust_address (operands[0],
4894 INTVAL (operands[2]) == 8 ? QImode : HImode,
4895 (32 - INTVAL (operands[1])) / 8);
4897 if (INTVAL (operands[2]) == 8)
4898 return \"move%.b %1,%0\";
4899 return \"move%.w %1,%0\";
4903 ; Special case for 32-bit field in memory. This only occurs when 32-bit
4904 ; alignment of structure members is specified.
4906 ; The move is allowed to be odd byte aligned, because that's still faster
4907 ; than an odd byte aligned bit-field instruction.
4910 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
4911 (sign_extract:SI (match_operand:QI 1 "memory_src_operand" "oS")
4913 (match_operand:SI 2 "const_int_operand" "n")))]
4914 "TARGET_68020 && TARGET_BITFIELD
4915 && (INTVAL (operands[2]) % 8) == 0
4916 && ! mode_dependent_address_p (XEXP (operands[1], 0))"
4920 = adjust_address (operands[1], SImode, INTVAL (operands[2]) / 8);
4922 return \"move%.l %1,%0\";
4926 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
4927 (sign_extract:SI (match_operand:SI 1 "register_operand" "do")
4928 (match_operand:SI 2 "const_int_operand" "n")
4929 (match_operand:SI 3 "const_int_operand" "n")))]
4930 "TARGET_68020 && TARGET_BITFIELD
4931 && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
4932 && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
4933 && (GET_CODE (operands[1]) == REG
4934 || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
4937 if (REG_P (operands[1]))
4939 if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
4940 return \"bfexts %1{%b3:%b2},%0\";
4944 = adjust_address (operands[1],
4945 INTVAL (operands[2]) == 8 ? QImode : HImode,
4946 INTVAL (operands[3]) / 8);
4948 if (INTVAL (operands[2]) == 8)
4949 return \"move%.b %1,%0\;extb%.l %0\";
4950 return \"move%.w %1,%0\;ext%.l %0\";
4953 ;; Bit-field instructions, general cases.
4954 ;; "o,d" constraint causes a nonoffsettable memref to match the "o"
4955 ;; so that its address is reloaded.
4957 (define_expand "extv"
4958 [(set (match_operand:SI 0 "nonimmediate_operand" "")
4959 (sign_extract:SI (match_operand:SI 1 "general_operand" "")
4960 (match_operand:SI 2 "general_operand" "")
4961 (match_operand:SI 3 "general_operand" "")))]
4962 "TARGET_68020 && TARGET_BITFIELD"
4966 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
4967 (sign_extract:SI (match_operand:QI 1 "memory_operand" "o")
4968 (match_operand:SI 2 "general_operand" "di")
4969 (match_operand:SI 3 "general_operand" "di")))]
4970 "TARGET_68020 && TARGET_BITFIELD"
4971 "bfexts %1{%b3:%b2},%0")
4973 (define_expand "extzv"
4974 [(set (match_operand:SI 0 "nonimmediate_operand" "")
4975 (zero_extract:SI (match_operand:SI 1 "general_operand" "")
4976 (match_operand:SI 2 "general_operand" "")
4977 (match_operand:SI 3 "general_operand" "")))]
4978 "TARGET_68020 && TARGET_BITFIELD"
4982 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d")
4983 (zero_extract:SI (match_operand:QI 1 "memory_operand" "o,d")
4984 (match_operand:SI 2 "general_operand" "di,di")
4985 (match_operand:SI 3 "general_operand" "di,di")))]
4986 "TARGET_68020 && TARGET_BITFIELD"
4989 if (GET_CODE (operands[2]) == CONST_INT)
4991 if (INTVAL (operands[2]) != 32)
4992 cc_status.flags |= CC_NOT_NEGATIVE;
4998 return \"bfextu %1{%b3:%b2},%0\";
5002 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5003 (match_operand:SI 1 "general_operand" "di")
5004 (match_operand:SI 2 "general_operand" "di"))
5005 (xor:SI (zero_extract:SI (match_dup 0) (match_dup 1) (match_dup 2))
5006 (match_operand 3 "const_int_operand" "n")))]
5007 "TARGET_68020 && TARGET_BITFIELD
5008 && (INTVAL (operands[3]) == -1
5009 || (GET_CODE (operands[1]) == CONST_INT
5010 && (~ INTVAL (operands[3]) & ((1 << INTVAL (operands[1]))- 1)) == 0))"
5014 return \"bfchg %0{%b2:%b1}\";
5018 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5019 (match_operand:SI 1 "general_operand" "di")
5020 (match_operand:SI 2 "general_operand" "di"))
5022 "TARGET_68020 && TARGET_BITFIELD"
5026 return \"bfclr %0{%b2:%b1}\";
5030 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5031 (match_operand:SI 1 "general_operand" "di")
5032 (match_operand:SI 2 "general_operand" "di"))
5034 "TARGET_68020 && TARGET_BITFIELD"
5038 return \"bfset %0{%b2:%b1}\";
5041 (define_expand "insv"
5042 [(set (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "")
5043 (match_operand:SI 1 "general_operand" "")
5044 (match_operand:SI 2 "general_operand" ""))
5045 (match_operand:SI 3 "register_operand" ""))]
5046 "TARGET_68020 && TARGET_BITFIELD"
5050 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5051 (match_operand:SI 1 "general_operand" "di")
5052 (match_operand:SI 2 "general_operand" "di"))
5053 (match_operand:SI 3 "register_operand" "d"))]
5054 "TARGET_68020 && TARGET_BITFIELD"
5055 "bfins %3,%0{%b2:%b1}")
5057 ;; Now recognize bit-field insns that operate on registers
5058 ;; (or at least were intended to do so).
5061 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
5062 (sign_extract:SI (match_operand:SI 1 "register_operand" "d")
5063 (match_operand:SI 2 "general_operand" "di")
5064 (match_operand:SI 3 "general_operand" "di")))]
5065 "TARGET_68020 && TARGET_BITFIELD"
5066 "bfexts %1{%b3:%b2},%0")
5069 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
5070 (zero_extract:SI (match_operand:SI 1 "register_operand" "d")
5071 (match_operand:SI 2 "general_operand" "di")
5072 (match_operand:SI 3 "general_operand" "di")))]
5073 "TARGET_68020 && TARGET_BITFIELD"
5076 if (GET_CODE (operands[2]) == CONST_INT)
5078 if (INTVAL (operands[2]) != 32)
5079 cc_status.flags |= CC_NOT_NEGATIVE;
5085 return \"bfextu %1{%b3:%b2},%0\";
5089 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
5090 (match_operand:SI 1 "general_operand" "di")
5091 (match_operand:SI 2 "general_operand" "di"))
5093 "TARGET_68020 && TARGET_BITFIELD"
5097 return \"bfclr %0{%b2:%b1}\";
5101 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
5102 (match_operand:SI 1 "general_operand" "di")
5103 (match_operand:SI 2 "general_operand" "di"))
5105 "TARGET_68020 && TARGET_BITFIELD"
5109 return \"bfset %0{%b2:%b1}\";
5113 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
5114 (match_operand:SI 1 "general_operand" "di")
5115 (match_operand:SI 2 "general_operand" "di"))
5116 (match_operand:SI 3 "register_operand" "d"))]
5117 "TARGET_68020 && TARGET_BITFIELD"
5121 /* These special cases are now recognized by a specific pattern. */
5122 if (GET_CODE (operands[1]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT
5123 && INTVAL (operands[1]) == 16 && INTVAL (operands[2]) == 16)
5124 return \"move%.w %3,%0\";
5125 if (GET_CODE (operands[1]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT
5126 && INTVAL (operands[1]) == 24 && INTVAL (operands[2]) == 8)
5127 return \"move%.b %3,%0\";
5129 return \"bfins %3,%0{%b2:%b1}\";
5132 ;; Special patterns for optimizing bit-field instructions.
5136 (zero_extract:SI (match_operand:QI 0 "memory_operand" "o")
5137 (match_operand:SI 1 "const_int_operand" "n")
5138 (match_operand:SI 2 "general_operand" "di")))]
5139 "TARGET_68020 && TARGET_BITFIELD"
5142 if (operands[1] == const1_rtx
5143 && GET_CODE (operands[2]) == CONST_INT)
5145 int width = GET_CODE (operands[0]) == REG ? 31 : 7;
5146 return output_btst (operands,
5147 GEN_INT (width - INTVAL (operands[2])),
5148 operands[0], insn, 1000);
5149 /* Pass 1000 as SIGNPOS argument so that btst will
5150 not think we are testing the sign bit for an `and'
5151 and assume that nonzero implies a negative result. */
5153 if (INTVAL (operands[1]) != 32)
5154 cc_status.flags = CC_NOT_NEGATIVE;
5155 return \"bftst %0{%b2:%b1}\";
5159 ;;; now handle the register cases
5162 (zero_extract:SI (match_operand:SI 0 "register_operand" "d")
5163 (match_operand:SI 1 "const_int_operand" "n")
5164 (match_operand:SI 2 "general_operand" "di")))]
5165 "TARGET_68020 && TARGET_BITFIELD"
5168 if (operands[1] == const1_rtx
5169 && GET_CODE (operands[2]) == CONST_INT)
5171 int width = GET_CODE (operands[0]) == REG ? 31 : 7;
5172 return output_btst (operands, GEN_INT (width - INTVAL (operands[2])),
5173 operands[0], insn, 1000);
5174 /* Pass 1000 as SIGNPOS argument so that btst will
5175 not think we are testing the sign bit for an `and'
5176 and assume that nonzero implies a negative result. */
5178 if (INTVAL (operands[1]) != 32)
5179 cc_status.flags = CC_NOT_NEGATIVE;
5180 return \"bftst %0{%b2:%b1}\";
5183 (define_insn "scc0_di"
5184 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
5185 (match_operator 1 "valid_dbcc_comparison_p"
5186 [(match_operand:DI 2 "general_operand" "ro") (const_int 0)]))]
5190 return output_scc_di (operands[1], operands[2], const0_rtx, operands[0]);
5193 (define_insn "scc0_di_5200"
5194 [(set (match_operand:QI 0 "nonimmediate_operand" "=d")
5195 (match_operator 1 "valid_dbcc_comparison_p"
5196 [(match_operand:DI 2 "general_operand" "ro") (const_int 0)]))]
5200 return output_scc_di (operands[1], operands[2], const0_rtx, operands[0]);
5203 (define_insn "scc_di"
5204 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,dm")
5205 (match_operator 1 "valid_dbcc_comparison_p"
5206 [(match_operand:DI 2 "general_operand" "ro,r")
5207 (match_operand:DI 3 "general_operand" "r,ro")]))]
5211 return output_scc_di (operands[1], operands[2], operands[3], operands[0]);
5214 (define_insn "scc_di_5200"
5215 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d")
5216 (match_operator 1 "valid_dbcc_comparison_p"
5217 [(match_operand:DI 2 "general_operand" "ro,r")
5218 (match_operand:DI 3 "general_operand" "r,ro")]))]
5222 return output_scc_di (operands[1], operands[2], operands[3], operands[0]);
5225 ;; Note that operand 0 of an SCC insn is supported in the hardware as
5226 ;; memory, but we cannot allow it to be in memory in case the address
5227 ;; needs to be reloaded.
5229 (define_expand "seq"
5230 [(set (match_operand:QI 0 "register_operand" "")
5231 (eq:QI (cc0) (const_int 0)))]
5235 if (TARGET_68060 && m68k_last_compare_had_fp_operands)
5237 m68k_last_compare_had_fp_operands = 0;
5243 [(set (match_operand:QI 0 "register_operand" "=d")
5244 (eq:QI (cc0) (const_int 0)))]
5247 cc_status = cc_prev_status;
5248 OUTPUT_JUMP (\"seq %0\", \"fseq %0\", \"seq %0\");
5251 (define_expand "sne"
5252 [(set (match_operand:QI 0 "register_operand" "")
5253 (ne:QI (cc0) (const_int 0)))]
5257 if (TARGET_68060 && m68k_last_compare_had_fp_operands)
5259 m68k_last_compare_had_fp_operands = 0;
5265 [(set (match_operand:QI 0 "register_operand" "=d")
5266 (ne:QI (cc0) (const_int 0)))]
5269 cc_status = cc_prev_status;
5270 OUTPUT_JUMP (\"sne %0\", \"fsne %0\", \"sne %0\");
5273 (define_expand "sgt"
5274 [(set (match_operand:QI 0 "register_operand" "")
5275 (gt:QI (cc0) (const_int 0)))]
5279 if (TARGET_68060 && m68k_last_compare_had_fp_operands)
5281 m68k_last_compare_had_fp_operands = 0;
5287 [(set (match_operand:QI 0 "register_operand" "=d")
5288 (gt:QI (cc0) (const_int 0)))]
5291 cc_status = cc_prev_status;
5292 OUTPUT_JUMP (\"sgt %0\", \"fsgt %0\", 0);
5295 (define_expand "sgtu"
5296 [(set (match_operand:QI 0 "register_operand" "")
5297 (gtu:QI (cc0) (const_int 0)))]
5302 [(set (match_operand:QI 0 "register_operand" "=d")
5303 (gtu:QI (cc0) (const_int 0)))]
5306 cc_status = cc_prev_status;
5307 return \"shi %0\"; ")
5309 (define_expand "slt"
5310 [(set (match_operand:QI 0 "register_operand" "")
5311 (lt:QI (cc0) (const_int 0)))]
5315 if (TARGET_68060 && m68k_last_compare_had_fp_operands)
5317 m68k_last_compare_had_fp_operands = 0;
5323 [(set (match_operand:QI 0 "register_operand" "=d")
5324 (lt:QI (cc0) (const_int 0)))]
5327 cc_status = cc_prev_status;
5328 OUTPUT_JUMP (\"slt %0\", \"fslt %0\", \"smi %0\"); ")
5330 (define_expand "sltu"
5331 [(set (match_operand:QI 0 "register_operand" "")
5332 (ltu:QI (cc0) (const_int 0)))]
5337 [(set (match_operand:QI 0 "register_operand" "=d")
5338 (ltu:QI (cc0) (const_int 0)))]
5341 cc_status = cc_prev_status;
5342 return \"scs %0\"; ")
5344 (define_expand "sge"
5345 [(set (match_operand:QI 0 "register_operand" "")
5346 (ge:QI (cc0) (const_int 0)))]
5350 if (TARGET_68060 && m68k_last_compare_had_fp_operands)
5352 m68k_last_compare_had_fp_operands = 0;
5358 [(set (match_operand:QI 0 "register_operand" "=d")
5359 (ge:QI (cc0) (const_int 0)))]
5362 cc_status = cc_prev_status;
5363 OUTPUT_JUMP (\"sge %0\", \"fsge %0\", \"spl %0\"); ")
5365 (define_expand "sgeu"
5366 [(set (match_operand:QI 0 "register_operand" "")
5367 (geu:QI (cc0) (const_int 0)))]
5372 [(set (match_operand:QI 0 "register_operand" "=d")
5373 (geu:QI (cc0) (const_int 0)))]
5376 cc_status = cc_prev_status;
5377 return \"scc %0\"; ")
5379 (define_expand "sle"
5380 [(set (match_operand:QI 0 "register_operand" "")
5381 (le:QI (cc0) (const_int 0)))]
5385 if (TARGET_68060 && m68k_last_compare_had_fp_operands)
5387 m68k_last_compare_had_fp_operands = 0;
5393 [(set (match_operand:QI 0 "register_operand" "=d")
5394 (le:QI (cc0) (const_int 0)))]
5397 cc_status = cc_prev_status;
5398 OUTPUT_JUMP (\"sle %0\", \"fsle %0\", 0);
5401 (define_expand "sleu"
5402 [(set (match_operand:QI 0 "register_operand" "")
5403 (leu:QI (cc0) (const_int 0)))]
5408 [(set (match_operand:QI 0 "register_operand" "=d")
5409 (leu:QI (cc0) (const_int 0)))]
5412 cc_status = cc_prev_status;
5413 return \"sls %0\"; ")
5415 (define_expand "sordered"
5416 [(set (match_operand:QI 0 "register_operand" "")
5417 (ordered:QI (cc0) (const_int 0)))]
5418 "TARGET_68881 && !TARGET_68060"
5420 if (! m68k_last_compare_had_fp_operands)
5422 m68k_last_compare_had_fp_operands = 0;
5425 (define_insn "*sordered_1"
5426 [(set (match_operand:QI 0 "register_operand" "=d")
5427 (ordered:QI (cc0) (const_int 0)))]
5428 "TARGET_68881 && !TARGET_68060"
5430 cc_status = cc_prev_status;
5434 (define_expand "sunordered"
5435 [(set (match_operand:QI 0 "register_operand" "")
5436 (unordered:QI (cc0) (const_int 0)))]
5437 "TARGET_68881 && !TARGET_68060"
5439 if (! m68k_last_compare_had_fp_operands)
5441 m68k_last_compare_had_fp_operands = 0;
5444 (define_insn "*sunordered_1"
5445 [(set (match_operand:QI 0 "register_operand" "=d")
5446 (unordered:QI (cc0) (const_int 0)))]
5447 "TARGET_68881 && !TARGET_68060"
5449 cc_status = cc_prev_status;
5453 (define_expand "suneq"
5454 [(set (match_operand:QI 0 "register_operand" "")
5455 (uneq:QI (cc0) (const_int 0)))]
5456 "TARGET_68881 && !TARGET_68060"
5458 if (! m68k_last_compare_had_fp_operands)
5460 m68k_last_compare_had_fp_operands = 0;
5463 (define_insn "*suneq_1"
5464 [(set (match_operand:QI 0 "register_operand" "=d")
5465 (uneq:QI (cc0) (const_int 0)))]
5466 "TARGET_68881 && !TARGET_68060"
5468 cc_status = cc_prev_status;
5472 (define_expand "sunge"
5473 [(set (match_operand:QI 0 "register_operand" "")
5474 (unge:QI (cc0) (const_int 0)))]
5475 "TARGET_68881 && !TARGET_68060"
5477 if (! m68k_last_compare_had_fp_operands)
5479 m68k_last_compare_had_fp_operands = 0;
5482 (define_insn "*sunge_1"
5483 [(set (match_operand:QI 0 "register_operand" "=d")
5484 (unge:QI (cc0) (const_int 0)))]
5485 "TARGET_68881 && !TARGET_68060"
5487 cc_status = cc_prev_status;
5491 (define_expand "sungt"
5492 [(set (match_operand:QI 0 "register_operand" "")
5493 (ungt:QI (cc0) (const_int 0)))]
5494 "TARGET_68881 && !TARGET_68060"
5496 if (! m68k_last_compare_had_fp_operands)
5498 m68k_last_compare_had_fp_operands = 0;
5501 (define_insn "*sungt_1"
5502 [(set (match_operand:QI 0 "register_operand" "=d")
5503 (ungt:QI (cc0) (const_int 0)))]
5504 "TARGET_68881 && !TARGET_68060"
5506 cc_status = cc_prev_status;
5510 (define_expand "sunle"
5511 [(set (match_operand:QI 0 "register_operand" "")
5512 (unle:QI (cc0) (const_int 0)))]
5513 "TARGET_68881 && !TARGET_68060"
5515 if (! m68k_last_compare_had_fp_operands)
5517 m68k_last_compare_had_fp_operands = 0;
5520 (define_insn "*sunle_1"
5521 [(set (match_operand:QI 0 "register_operand" "=d")
5522 (unle:QI (cc0) (const_int 0)))]
5523 "TARGET_68881 && !TARGET_68060"
5525 cc_status = cc_prev_status;
5529 (define_expand "sunlt"
5530 [(set (match_operand:QI 0 "register_operand" "")
5531 (unlt:QI (cc0) (const_int 0)))]
5532 "TARGET_68881 && !TARGET_68060"
5534 if (! m68k_last_compare_had_fp_operands)
5536 m68k_last_compare_had_fp_operands = 0;
5539 (define_insn "*sunlt_1"
5540 [(set (match_operand:QI 0 "register_operand" "=d")
5541 (unlt:QI (cc0) (const_int 0)))]
5542 "TARGET_68881 && !TARGET_68060"
5544 cc_status = cc_prev_status;
5548 (define_expand "sltgt"
5549 [(set (match_operand:QI 0 "register_operand" "")
5550 (ltgt:QI (cc0) (const_int 0)))]
5551 "TARGET_68881 && !TARGET_68060"
5553 if (! m68k_last_compare_had_fp_operands)
5555 m68k_last_compare_had_fp_operands = 0;
5558 (define_insn "*sltgt_1"
5559 [(set (match_operand:QI 0 "register_operand" "=d")
5560 (ltgt:QI (cc0) (const_int 0)))]
5561 "TARGET_68881 && !TARGET_68060"
5563 cc_status = cc_prev_status;
5567 (define_insn "*fsogt_1"
5568 [(set (match_operand:QI 0 "register_operand" "=d")
5569 (not:QI (unle:QI (cc0) (const_int 0))))]
5570 "TARGET_68881 && !TARGET_68060"
5572 cc_status = cc_prev_status;
5576 (define_insn "*fsoge_1"
5577 [(set (match_operand:QI 0 "register_operand" "=d")
5578 (not:QI (unlt:QI (cc0) (const_int 0))))]
5579 "TARGET_68881 && !TARGET_68060"
5581 cc_status = cc_prev_status;
5585 (define_insn "*fsolt_1"
5586 [(set (match_operand:QI 0 "register_operand" "=d")
5587 (not:QI (unge:QI (cc0) (const_int 0))))]
5588 "TARGET_68881 && !TARGET_68060"
5590 cc_status = cc_prev_status;
5594 (define_insn "*fsole_1"
5595 [(set (match_operand:QI 0 "register_operand" "=d")
5596 (not:QI (ungt:QI (cc0) (const_int 0))))]
5597 "TARGET_68881 && !TARGET_68060"
5599 cc_status = cc_prev_status;
5603 ;; Basic conditional jump instructions.
5605 (define_insn "beq0_di"
5607 (if_then_else (eq (match_operand:DI 0 "general_operand" "d*ao,<>")
5609 (label_ref (match_operand 1 "" ","))
5611 (clobber (match_scratch:SI 2 "=d,d"))]
5616 if (which_alternative == 1)
5619 return \"move%.l %0,%2\;or%.l %0,%2\;jbeq %l1\";
5621 return \"move%.l %0,%2\;or%.l %0,%2\;jeq %l1\";
5623 if ((cc_prev_status.value1
5624 && rtx_equal_p (cc_prev_status.value1, operands[0]))
5625 || (cc_prev_status.value2
5626 && rtx_equal_p (cc_prev_status.value2, operands[0])))
5628 cc_status = cc_prev_status;
5629 return MOTOROLA ? \"jbeq %l1\" : \"jeq %l1\";
5631 if (GET_CODE (operands[0]) == REG)
5632 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
5634 operands[3] = adjust_address (operands[0], SImode, 4);
5635 if (! ADDRESS_REG_P (operands[0]))
5637 if (reg_overlap_mentioned_p (operands[2], operands[0]))
5639 if (reg_overlap_mentioned_p (operands[2], operands[3]))
5642 return \"or%.l %0,%2\;jbeq %l1\";
5644 return \"or%.l %0,%2\;jeq %l1\";
5649 return \"or%.l %3,%2\;jbeq %l1\";
5651 return \"or%.l %3,%2\;jeq %l1\";
5655 return \"move%.l %0,%2\;or%.l %3,%2\;jbeq %l1\";
5657 return \"move%.l %0,%2\;or%.l %3,%2\;jeq %l1\";
5659 operands[4] = gen_label_rtx();
5660 if (TARGET_68020 || TARGET_COLDFIRE)
5663 output_asm_insn (\"tst%.l %0\;jbne %l4\;tst%.l %3\;jbeq %l1\", operands);
5665 output_asm_insn (\"tst%.l %0\;jne %l4\;tst%.l %3\;jeq %l1\", operands);
5670 #ifdef SGS_CMP_ORDER
5671 output_asm_insn (\"cmp%.w %0,%#0\;jbne %l4\;cmp%.w %3,%#0\;jbeq %l1\", operands);
5673 output_asm_insn (\"cmp%.w %#0,%0\;jbne %l4\;cmp%.w %#0,%3\;jbeq %l1\", operands);
5676 output_asm_insn (\"cmp%.w %#0,%0\;jne %l4\;cmp%.w %#0,%3\;jeq %l1\", operands);
5678 (*targetm.asm_out.internal_label) (asm_out_file, \"L\",
5679 CODE_LABEL_NUMBER (operands[4]));
5683 (define_insn "bne0_di"
5685 (if_then_else (ne (match_operand:DI 0 "general_operand" "do,*a")
5687 (label_ref (match_operand 1 "" ","))
5689 (clobber (match_scratch:SI 2 "=d,X"))]
5693 if ((cc_prev_status.value1
5694 && rtx_equal_p (cc_prev_status.value1, operands[0]))
5695 || (cc_prev_status.value2
5696 && rtx_equal_p (cc_prev_status.value2, operands[0])))
5698 cc_status = cc_prev_status;
5699 return MOTOROLA ? \"jbne %l1\" : \"jne %l1\";
5702 if (GET_CODE (operands[0]) == REG)
5703 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
5705 operands[3] = adjust_address (operands[0], SImode, 4);
5706 if (!ADDRESS_REG_P (operands[0]))
5708 if (reg_overlap_mentioned_p (operands[2], operands[0]))
5710 if (reg_overlap_mentioned_p (operands[2], operands[3]))
5713 return \"or%.l %0,%2\;jbne %l1\";
5715 return \"or%.l %0,%2\;jne %l1\";
5720 return \"or%.l %3,%2\;jbne %l1\";
5722 return \"or%.l %3,%2\;jne %l1\";
5726 return \"move%.l %0,%2\;or%.l %3,%2\;jbne %l1\";
5728 return \"move%.l %0,%2\;or%.l %3,%2\;jne %l1\";
5730 if (TARGET_68020 || TARGET_COLDFIRE)
5733 return \"tst%.l %0\;jbne %l1\;tst%.l %3\;jbne %l1\";
5735 return \"tst%.l %0\;jne %l1\;tst%.l %3\;jne %l1\";
5740 #ifdef SGS_CMP_ORDER
5741 return \"cmp%.w %0,%#0\;jbne %l1\;cmp%.w %3,%#0\;jbne %l1\";
5743 return \"cmp%.w %#0,%0\;jbne %l1\;cmp%.w %#0,%3\;jbne %l1\";
5746 return \"cmp%.w %#0,%0\;jne %l1\;cmp%.w %#0,%3\;jne %l1\";
5750 (define_insn "bge0_di"
5752 (if_then_else (ge (match_operand:DI 0 "general_operand" "ro")
5754 (label_ref (match_operand 1 "" ""))
5759 if ((cc_prev_status.value1
5760 && rtx_equal_p (cc_prev_status.value1, operands[0]))
5761 || (cc_prev_status.value2
5762 && rtx_equal_p (cc_prev_status.value2, operands[0])))
5764 cc_status = cc_prev_status;
5765 if (cc_status.flags & CC_REVERSED)
5767 return MOTOROLA ? \"jble %l1\" : \"jle %l1\";
5771 return MOTOROLA ? \"jbpl %l1\" : \"jpl %l1\";
5775 if (TARGET_68020 || TARGET_COLDFIRE || ! ADDRESS_REG_P (operands[0]))
5776 output_asm_insn(\"tst%.l %0\", operands);
5779 /* On an address reg, cmpw may replace cmpl. */
5780 #ifdef SGS_CMP_ORDER
5781 output_asm_insn(\"cmp%.w %0,%#0\", operands);
5783 output_asm_insn(\"cmp%.w %#0,%0\", operands);
5787 return MOTOROLA ? \"jbpl %l1\" : \"jpl %l1\";
5790 (define_insn "blt0_di"
5792 (if_then_else (lt (match_operand:DI 0 "general_operand" "ro")
5794 (label_ref (match_operand 1 "" ""))
5799 if ((cc_prev_status.value1
5800 && rtx_equal_p (cc_prev_status.value1, operands[0]))
5801 || (cc_prev_status.value2
5802 && rtx_equal_p (cc_prev_status.value2, operands[0])))
5804 cc_status = cc_prev_status;
5805 if (cc_status.flags & CC_REVERSED)
5807 return MOTOROLA ? \"jbgt %l1\" : \"jgt %l1\";
5811 return MOTOROLA ? \"jbmi %l1\" : \"jmi %l1\";
5815 if (TARGET_68020 || TARGET_COLDFIRE || ! ADDRESS_REG_P (operands[0]))
5816 output_asm_insn(\"tst%.l %0\", operands);
5819 /* On an address reg, cmpw may replace cmpl. */
5820 #ifdef SGS_CMP_ORDER
5821 output_asm_insn(\"cmp%.w %0,%#0\", operands);
5823 output_asm_insn(\"cmp%.w %#0,%0\", operands);
5827 return MOTOROLA ? \"jbmi %l1\" : \"jmi %l1\";
5832 (if_then_else (eq (cc0)
5834 (label_ref (match_operand 0 "" ""))
5840 OUTPUT_JUMP (\"jbeq %l0\", \"fbeq %l0\", \"jbeq %l0\");
5842 OUTPUT_JUMP (\"jeq %l0\", \"fjeq %l0\", \"jeq %l0\");
5847 (if_then_else (ne (cc0)
5849 (label_ref (match_operand 0 "" ""))
5855 OUTPUT_JUMP (\"jbne %l0\", \"fbne %l0\", \"jbne %l0\");
5857 OUTPUT_JUMP (\"jne %l0\", \"fjne %l0\", \"jne %l0\");
5862 (if_then_else (gt (cc0)
5864 (label_ref (match_operand 0 "" ""))
5869 OUTPUT_JUMP (\"jbgt %l0\", \"fbgt %l0\", 0);
5871 OUTPUT_JUMP (\"jgt %l0\", \"fjgt %l0\", 0);
5876 (if_then_else (gtu (cc0)
5878 (label_ref (match_operand 0 "" ""))
5882 return MOTOROLA ? \"jbhi %l0\" : \"jhi %l0\";
5887 (if_then_else (lt (cc0)
5889 (label_ref (match_operand 0 "" ""))
5894 OUTPUT_JUMP (\"jblt %l0\", \"fblt %l0\", \"jbmi %l0\");
5896 OUTPUT_JUMP (\"jlt %l0\", \"fjlt %l0\", \"jmi %l0\");
5901 (if_then_else (ltu (cc0)
5903 (label_ref (match_operand 0 "" ""))
5907 return MOTOROLA ? \"jbcs %l0\" : \"jcs %l0\";
5912 (if_then_else (ge (cc0)
5914 (label_ref (match_operand 0 "" ""))
5919 OUTPUT_JUMP (\"jbge %l0\", \"fbge %l0\", \"jbpl %l0\");
5921 OUTPUT_JUMP (\"jge %l0\", \"fjge %l0\", \"jpl %l0\");
5926 (if_then_else (geu (cc0)
5928 (label_ref (match_operand 0 "" ""))
5932 return MOTOROLA ? \"jbcc %l0\" : \"jcc %l0\";
5937 (if_then_else (le (cc0)
5939 (label_ref (match_operand 0 "" ""))
5944 OUTPUT_JUMP (\"jble %l0\", \"fble %l0\", 0);
5946 OUTPUT_JUMP (\"jle %l0\", \"fjle %l0\", 0);
5951 (if_then_else (leu (cc0)
5953 (label_ref (match_operand 0 "" ""))
5957 return MOTOROLA ? \"jbls %l0\" : \"jls %l0\";
5960 (define_insn "bordered"
5962 (if_then_else (ordered (cc0) (const_int 0))
5963 (label_ref (match_operand 0 "" ""))
5967 if (!(cc_prev_status.flags & CC_IN_68881))
5969 return MOTOROLA ? "fbor %l0" : "fjor %l0";
5972 (define_insn "bunordered"
5974 (if_then_else (unordered (cc0) (const_int 0))
5975 (label_ref (match_operand 0 "" ""))
5979 if (!(cc_prev_status.flags & CC_IN_68881))
5981 return MOTOROLA ? "fbun %l0" : "fjun %l0";
5984 (define_insn "buneq"
5986 (if_then_else (uneq (cc0) (const_int 0))
5987 (label_ref (match_operand 0 "" ""))
5991 if (!(cc_prev_status.flags & CC_IN_68881))
5993 return MOTOROLA ? "fbueq %l0" : "fjueq %l0";
5996 (define_insn "bunge"
5998 (if_then_else (unge (cc0) (const_int 0))
5999 (label_ref (match_operand 0 "" ""))
6003 if (!(cc_prev_status.flags & CC_IN_68881))
6005 return MOTOROLA ? "fbuge %l0" : "fjuge %l0";
6008 (define_insn "bungt"
6010 (if_then_else (ungt (cc0) (const_int 0))
6011 (label_ref (match_operand 0 "" ""))
6015 if (!(cc_prev_status.flags & CC_IN_68881))
6017 return MOTOROLA ? "fbugt %l0" : "fjugt %l0";
6020 (define_insn "bunle"
6022 (if_then_else (unle (cc0) (const_int 0))
6023 (label_ref (match_operand 0 "" ""))
6027 if (!(cc_prev_status.flags & CC_IN_68881))
6029 return MOTOROLA ? "fbule %l0" : "fjule %l0";
6032 (define_insn "bunlt"
6034 (if_then_else (unlt (cc0) (const_int 0))
6035 (label_ref (match_operand 0 "" ""))
6039 if (!(cc_prev_status.flags & CC_IN_68881))
6041 return MOTOROLA ? "fbult %l0" : "fjult %l0";
6044 (define_insn "bltgt"
6046 (if_then_else (ltgt (cc0) (const_int 0))
6047 (label_ref (match_operand 0 "" ""))
6051 if (!(cc_prev_status.flags & CC_IN_68881))
6053 return MOTOROLA ? "fbogl %l0" : "fjogl %l0";
6056 ;; Negated conditional jump instructions.
6060 (if_then_else (eq (cc0)
6063 (label_ref (match_operand 0 "" ""))))]
6068 OUTPUT_JUMP (\"jbne %l0\", \"fbne %l0\", \"jbne %l0\");
6070 OUTPUT_JUMP (\"jne %l0\", \"fjne %l0\", \"jne %l0\");
6075 (if_then_else (ne (cc0)
6078 (label_ref (match_operand 0 "" ""))))]
6083 OUTPUT_JUMP (\"jbeq %l0\", \"fbeq %l0\", \"jbeq %l0\");
6085 OUTPUT_JUMP (\"jeq %l0\", \"fjeq %l0\", \"jeq %l0\");
6090 (if_then_else (gt (cc0)
6093 (label_ref (match_operand 0 "" ""))))]
6097 OUTPUT_JUMP (\"jble %l0\", \"fbngt %l0\", 0);
6099 OUTPUT_JUMP (\"jle %l0\", \"fjngt %l0\", 0);
6104 (if_then_else (gtu (cc0)
6107 (label_ref (match_operand 0 "" ""))))]
6110 return MOTOROLA ? \"jbls %l0\" : \"jls %l0\";
6115 (if_then_else (lt (cc0)
6118 (label_ref (match_operand 0 "" ""))))]
6122 OUTPUT_JUMP (\"jbge %l0\", \"fbnlt %l0\", \"jbpl %l0\");
6124 OUTPUT_JUMP (\"jge %l0\", \"fjnlt %l0\", \"jpl %l0\");
6129 (if_then_else (ltu (cc0)
6132 (label_ref (match_operand 0 "" ""))))]
6135 return MOTOROLA ? \"jbcc %l0\" : \"jcc %l0\";
6140 (if_then_else (ge (cc0)
6143 (label_ref (match_operand 0 "" ""))))]
6147 OUTPUT_JUMP (\"jblt %l0\", \"fbnge %l0\", \"jbmi %l0\");
6149 OUTPUT_JUMP (\"jlt %l0\", \"fjnge %l0\", \"jmi %l0\");
6154 (if_then_else (geu (cc0)
6157 (label_ref (match_operand 0 "" ""))))]
6160 return MOTOROLA ? \"jbcs %l0\" : \"jcs %l0\";
6165 (if_then_else (le (cc0)
6168 (label_ref (match_operand 0 "" ""))))]
6172 OUTPUT_JUMP (\"jbgt %l0\", \"fbnle %l0\", 0);
6174 OUTPUT_JUMP (\"jgt %l0\", \"fjnle %l0\", 0);
6179 (if_then_else (leu (cc0)
6182 (label_ref (match_operand 0 "" ""))))]
6185 return MOTOROLA ? \"jbhi %l0\" : \"jhi %l0\";
6188 (define_insn "*bordered_rev"
6190 (if_then_else (ordered (cc0) (const_int 0))
6192 (label_ref (match_operand 0 "" ""))))]
6195 if (!(cc_prev_status.flags & CC_IN_68881))
6197 return MOTOROLA ? "fbun %l0" : "fjun %l0";
6200 (define_insn "*bunordered_rev"
6202 (if_then_else (unordered (cc0) (const_int 0))
6204 (label_ref (match_operand 0 "" ""))))]
6207 if (!(cc_prev_status.flags & CC_IN_68881))
6209 return MOTOROLA ? "fbor %l0" : "fjor %l0";
6212 (define_insn "*buneq_rev"
6214 (if_then_else (uneq (cc0) (const_int 0))
6216 (label_ref (match_operand 0 "" ""))))]
6219 if (!(cc_prev_status.flags & CC_IN_68881))
6221 return MOTOROLA ? "fbogl %l0" : "fjogl %l0";
6224 (define_insn "*bunge_rev"
6226 (if_then_else (unge (cc0) (const_int 0))
6228 (label_ref (match_operand 0 "" ""))))]
6231 if (!(cc_prev_status.flags & CC_IN_68881))
6233 return MOTOROLA ? "fbolt %l0" : "fjolt %l0";
6236 (define_insn "*bunle_rev"
6238 (if_then_else (unle (cc0) (const_int 0))
6240 (label_ref (match_operand 0 "" ""))))]
6243 if (!(cc_prev_status.flags & CC_IN_68881))
6245 return MOTOROLA ? "fbogt %l0" : "fjogt %l0";
6248 (define_insn "*bunlt_rev"
6250 (if_then_else (unlt (cc0) (const_int 0))
6252 (label_ref (match_operand 0 "" ""))))]
6255 if (!(cc_prev_status.flags & CC_IN_68881))
6257 return MOTOROLA ? "fboge %l0" : "fjoge %l0";
6260 (define_insn "*bltgt_rev"
6262 (if_then_else (ltgt (cc0) (const_int 0))
6264 (label_ref (match_operand 0 "" ""))))]
6267 if (!(cc_prev_status.flags & CC_IN_68881))
6269 return MOTOROLA ? "fbueq %l0" : "fjueq %l0";
6272 ;; Unconditional and other jump instructions
6275 (label_ref (match_operand 0 "" "")))]
6278 return MOTOROLA ? \"jbra %l0\" : \"jra %l0\";
6281 ;; We support two different ways of handling dispatch tables.
6282 ;; The NeXT uses absolute tables, and other machines use relative.
6283 ;; This define_expand can generate either kind.
6284 (define_expand "tablejump"
6285 [(parallel [(set (pc) (match_operand 0 "" ""))
6286 (use (label_ref (match_operand 1 "" "")))])]
6290 #ifdef CASE_VECTOR_PC_RELATIVE
6291 operands[0] = gen_rtx_PLUS (SImode, pc_rtx,
6292 gen_rtx_SIGN_EXTEND (SImode, operands[0]));
6296 ;; Jump to variable address from dispatch table of absolute addresses.
6298 [(set (pc) (match_operand:SI 0 "register_operand" "a"))
6299 (use (label_ref (match_operand 1 "" "")))]
6302 return MOTOROLA ? \"jmp (%0)\" : \"jmp %0@\";
6305 ;; Jump to variable address from dispatch table of relative addresses.
6309 (sign_extend:SI (match_operand:HI 0 "register_operand" "r"))))
6310 (use (label_ref (match_operand 1 "" "")))]
6313 #ifdef ASM_RETURN_CASE_JUMP
6314 ASM_RETURN_CASE_JUMP;
6317 #ifdef ASM_OUTPUT_CASE_LABEL
6318 if (TARGET_COLDFIRE)
6320 if (ADDRESS_REG_P (operands[0]))
6321 return \"jmp 6(%%pc,%0.l)\";
6323 return \"ext%.l %0\;jmp 6(%%pc,%0.l)\";
6326 return \"jmp 6(%%pc,%0.w)\";
6328 if (TARGET_COLDFIRE)
6330 if (ADDRESS_REG_P (operands[0]))
6331 return \"jmp 2(%%pc,%0.l)\";
6333 return \"extl %0\;jmp 2(%%pc,%0.l)\";
6336 return \"jmp 2(%%pc,%0.w)\";
6339 if (TARGET_COLDFIRE)
6341 if (ADDRESS_REG_P (operands[0]))
6343 return MOTOROLA ? \"jmp (2,pc,%0.l)\" : \"jmp pc@(2,%0:l)\";
6346 return \"ext%.l %0\;jmp (2,pc,%0.l)\";
6348 return \"extl %0\;jmp pc@(2,%0:l)\";
6352 return MOTOROLA ? \"jmp (2,pc,%0.w)\" : \"jmp pc@(2,%0:w)\";
6358 ;; Decrement-and-branch insns.
6362 (ne (match_operand:HI 0 "nonimmediate_operand" "+d*g")
6364 (label_ref (match_operand 1 "" ""))
6367 (plus:HI (match_dup 0)
6373 if (DATA_REG_P (operands[0]))
6374 return \"dbra %0,%l1\";
6375 if (GET_CODE (operands[0]) == MEM)
6378 return \"subq%.w %#1,%0\;jbcc %l1\";
6380 return \"subqw %#1,%0\;jcc %l1\";
6383 #ifdef SGS_CMP_ORDER
6384 return \"subq%.w %#1,%0\;cmp%.w %0,%#-1\;jbne %l1\";
6385 #else /* not SGS_CMP_ORDER */
6386 return \"subq%.w %#1,%0\;cmp%.w %#-1,%0\;jbne %l1\";
6389 return \"subqw %#1,%0\;cmpw %#-1,%0\;jne %l1\";
6395 (ne (match_operand:SI 0 "nonimmediate_operand" "+d*g")
6397 (label_ref (match_operand 1 "" ""))
6400 (plus:SI (match_dup 0)
6408 if (DATA_REG_P (operands[0]))
6409 return \"dbra %0,%l1\;clr%.w %0\;subq%.l %#1,%0\;jbcc %l1\";
6410 if (GET_CODE (operands[0]) == MEM)
6411 return \"subq%.l %#1,%0\;jbcc %l1\";
6412 #ifdef SGS_CMP_ORDER
6413 return \"subq.l %#1,%0\;cmp.l %0,%#-1\;jbne %l1\";
6414 #else /* not SGS_CMP_ORDER */
6415 return \"subq.l %#1,%0\;cmp.l %#-1,%0\;jbne %l1\";
6416 #endif /* not SGS_CMP_ORDER */
6420 if (DATA_REG_P (operands[0]))
6421 return \"dbra %0,%l1\;clr%.w %0\;subql %#1,%0\;jcc %l1\";
6422 if (GET_CODE (operands[0]) == MEM)
6423 return \"subql %#1,%0\;jcc %l1\";
6424 return \"subql %#1,%0\;cmpl %#-1,%0\;jne %l1\";
6428 ;; Two dbra patterns that use REG_NOTES info generated by strength_reduce.
6433 (ge (plus:HI (match_operand:HI 0 "nonimmediate_operand" "+d*am")
6436 (label_ref (match_operand 1 "" ""))
6439 (plus:HI (match_dup 0)
6441 "!TARGET_COLDFIRE && find_reg_note (insn, REG_NONNEG, 0)"
6447 if (DATA_REG_P (operands[0]))
6448 return \"dbra %0,%l1\";
6449 if (GET_CODE (operands[0]) == MEM)
6450 return \"subq%.w %#1,%0\;jbcc %l1\";
6451 #ifdef SGS_CMP_ORDER
6452 return \"subq.w %#1,%0\;cmp.w %0,%#-1\;jbne %l1\";
6453 #else /* not SGS_CMP_ORDER */
6454 return \"subq.w %#1,%0\;cmp.w %#-1,%0\;jbne %l1\";
6455 #endif /* not SGS_CMP_ORDER */
6459 if (DATA_REG_P (operands[0]))
6460 return \"dbra %0,%l1\";
6461 if (GET_CODE (operands[0]) == MEM)
6462 return \"subqw %#1,%0\;jcc %l1\";
6463 return \"subqw %#1,%0\;cmpw %#-1,%0\;jne %l1\";
6467 (define_expand "decrement_and_branch_until_zero"
6468 [(parallel [(set (pc)
6470 (ge (plus:SI (match_operand:SI 0 "nonimmediate_operand" "")
6473 (label_ref (match_operand 1 "" ""))
6476 (plus:SI (match_dup 0)
6484 (ge (plus:SI (match_operand:SI 0 "nonimmediate_operand" "+d*am")
6487 (label_ref (match_operand 1 "" ""))
6490 (plus:SI (match_dup 0)
6492 "!TARGET_COLDFIRE && find_reg_note (insn, REG_NONNEG, 0)"
6498 if (DATA_REG_P (operands[0]))
6499 return \"dbra %0,%l1\;clr%.w %0\;subq%.l %#1,%0\;jbcc %l1\";
6500 if (GET_CODE (operands[0]) == MEM)
6501 return \"subq%.l %#1,%0\;jbcc %l1\";
6502 #ifdef SGS_CMP_ORDER
6503 return \"subq.l %#1,%0\;cmp.l %0,%#-1\;jbne %l1\";
6504 #else /* not SGS_CMP_ORDER */
6505 return \"subq.l %#1,%0\;cmp.l %#-1,%0\;jbne %l1\";
6506 #endif /* not SGS_CMP_ORDER */
6510 if (DATA_REG_P (operands[0]))
6511 return \"dbra %0,%l1\;clr%.w %0\;subql %#1,%0\;jcc %l1\";
6512 if (GET_CODE (operands[0]) == MEM)
6513 return \"subql %#1,%0\;jcc %l1\";
6514 return \"subql %#1,%0\;cmpl %#-1,%0\;jne %l1\";
6519 ;; For PIC calls, in order to be able to support
6520 ;; dynamic linker LAZY BINDING, all the procedure calls need to go
6521 ;; through the PLT (Procedure Linkage Table) section in PIC mode.
6523 ;; PIC calls are handled by loading the address of the function into a
6524 ;; register (via movsi), then emitting a register indirect call using
6525 ;; the "jsr" function call syntax.
6527 ;; When outputting MIT syntax (e.g. on Suns), we add a bogus extra
6528 ;; operand to the jbsr statement to indicate that this call should
6529 ;; go through the PLT (why? because this is the way that Sun does it).
6531 ;; We have different patterns for PIC calls and non-PIC calls. The
6532 ;; different patterns are only used to choose the right syntax.
6534 ;; The svr4 m68k assembler recognizes this syntax: `bsr FUNC@PLTPC' and it
6535 ;; will create the correct relocation entry (R_68K_PLT32) for `FUNC',
6536 ;; that tells the linker editor to create an entry for `FUNC' in PLT
6537 ;; section at link time. However, all global objects reference are still
6538 ;; done by using `OBJ@GOT'. So, the goal here is to output the function
6539 ;; call operand as `FUNC@PLTPC', but output object operand as `OBJ@GOT'.
6540 ;; We need to have a way to differentiate these two different operands.
6542 ;; The strategy I use here is to use SYMBOL_REF_FLAG to differentiate
6543 ;; these two different operands. The macro LEGITIMATE_PIC_OPERAND_P needs
6544 ;; to be changed to recognize function calls symbol_ref operand as a valid
6545 ;; PIC operand (by checking whether SYMBOL_REF_FLAG is set). This will
6546 ;; avoid the compiler to load this symbol_ref operand into a register.
6547 ;; Remember, the operand "foo@PLTPC" cannot be called via jsr directly
6548 ;; since the value is a PC relative offset, not a real address.
6550 ;; All global objects are treated in the similar way as in SUN3. The only
6551 ;; difference is: on m68k svr4, the reference of such global object needs
6552 ;; to end with a suffix "@GOT" so the assembler and linker know to create
6553 ;; an entry for it in GOT (Global Offset Table) section. This is done in
6556 ;; Call subroutine with no return value.
6557 (define_expand "call"
6558 [(call (match_operand:QI 0 "memory_operand" "")
6559 (match_operand:SI 1 "general_operand" ""))]
6560 ;; Operand 1 not really used on the m68000.
6565 if (flag_pic && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
6566 SYMBOL_REF_FLAG (XEXP (operands[0], 0)) = 1;
6569 ;; This is a normal call sequence.
6571 [(call (match_operand:QI 0 "memory_operand" "o")
6572 (match_operand:SI 1 "general_operand" "g"))]
6573 ;; Operand 1 not really used on the m68000.
6577 #if MOTOROLA && !defined (USE_GAS)
6584 ;; This is a PIC call sequence.
6586 [(call (match_operand:QI 0 "memory_operand" "o")
6587 (match_operand:SI 1 "general_operand" "g"))]
6588 ;; Operand 1 not really used on the m68000.
6592 m68k_output_pic_call(operands[0]);
6596 ;; Call subroutine, returning value in operand 0
6597 ;; (which must be a hard register).
6598 ;; See comments before "call" regarding PIC calls.
6599 (define_expand "call_value"
6600 [(set (match_operand 0 "" "")
6601 (call (match_operand:QI 1 "memory_operand" "")
6602 (match_operand:SI 2 "general_operand" "")))]
6603 ;; Operand 2 not really used on the m68000.
6607 if (flag_pic && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
6608 SYMBOL_REF_FLAG (XEXP (operands[1], 0)) = 1;
6611 ;; This is a normal call_value
6613 [(set (match_operand 0 "" "=rf")
6614 (call (match_operand:QI 1 "memory_operand" "o")
6615 (match_operand:SI 2 "general_operand" "g")))]
6616 ;; Operand 2 not really used on the m68000.
6619 #if MOTOROLA && !defined (USE_GAS)
6626 ;; This is a PIC call_value
6628 [(set (match_operand 0 "" "=rf")
6629 (call (match_operand:QI 1 "memory_operand" "o")
6630 (match_operand:SI 2 "general_operand" "g")))]
6631 ;; Operand 2 not really used on the m68000.
6634 m68k_output_pic_call(operands[1]);
6638 ;; Call subroutine returning any type.
6640 (define_expand "untyped_call"
6641 [(parallel [(call (match_operand 0 "" "")
6643 (match_operand 1 "" "")
6644 (match_operand 2 "" "")])]
6645 "NEEDS_UNTYPED_CALL"
6650 emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
6652 for (i = 0; i < XVECLEN (operands[2], 0); i++)
6654 rtx set = XVECEXP (operands[2], 0, i);
6655 emit_move_insn (SET_DEST (set), SET_SRC (set));
6658 /* The optimizer does not know that the call sets the function value
6659 registers we stored in the result block. We avoid problems by
6660 claiming that all hard registers are used and clobbered at this
6662 emit_insn (gen_blockage ());
6667 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
6668 ;; all of memory. This blocks insns from being moved across this point.
6670 (define_insn "blockage"
6671 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
6680 ;; Used for frameless functions which save no regs and allocate no locals.
6681 (define_insn "return"
6686 if (current_function_pops_args == 0)
6688 operands[0] = GEN_INT (current_function_pops_args);
6692 (define_insn "indirect_jump"
6693 [(set (pc) (match_operand:SI 0 "address_operand" "p"))]
6697 ;; This should not be used unless the add/sub insns can't be.
6700 [(set (match_operand:SI 0 "nonimmediate_operand" "=a")
6701 (match_operand:QI 1 "address_operand" "p"))]
6705 /* Recognize an insn that refers to a table of offsets. Such an insn will
6706 need to refer to a label on the insn. So output one. Use the
6707 label-number of the table of offsets to generate this label. This code,
6708 and similar code above, assumes that there will be at most one reference
6710 if (GET_CODE (operands[1]) == PLUS
6711 && GET_CODE (XEXP (operands[1], 1)) == LABEL_REF
6712 && GET_CODE (XEXP (operands[1], 0)) != PLUS)
6714 rtx labelref = XEXP (operands[1], 1);
6715 #if MOTOROLA && !defined (SGS_SWITCH_TABLES)
6717 asm_fprintf (asm_out_file, \"\\tset %LLI%d,.+2\\n\",
6718 CODE_LABEL_NUMBER (XEXP (labelref, 0)));
6720 asm_fprintf (asm_out_file, \"\\t.set %LLI%d,.+2\\n\",
6721 CODE_LABEL_NUMBER (XEXP (labelref, 0)));
6722 #endif /* not SGS */
6723 #else /* SGS_SWITCH_TABLES or not MOTOROLA */
6724 (*targetm.asm_out.internal_label) (asm_out_file, \"LI\",
6725 CODE_LABEL_NUMBER (XEXP (labelref, 0)));
6726 #ifdef SGS_SWITCH_TABLES
6727 /* Set flag saying we need to define the symbol
6728 LD%n (with value L%n-LI%n) at the end of the switch table. */
6729 switch_table_difference_label_flag = 1;
6730 #endif /* SGS_SWITCH_TABLES */
6731 #endif /* SGS_SWITCH_TABLES or not MOTOROLA */
6734 return \"lea %a1,%0\";
6737 ;; This is the first machine-dependent peephole optimization.
6738 ;; It is useful when a floating value is returned from a function call
6739 ;; and then is moved into an FP register.
6740 ;; But it is mainly intended to test the support for these optimizations.
6743 [(set (reg:SI 15) (plus:SI (reg:SI 15) (const_int 4)))
6744 (set (match_operand:DF 0 "register_operand" "=f")
6745 (match_operand:DF 1 "register_operand" "ad"))]
6746 "FP_REG_P (operands[0]) && ! FP_REG_P (operands[1])"
6750 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
6751 output_asm_insn (\"move%.l %1,%@\", xoperands);
6752 output_asm_insn (\"move%.l %1,%-\", operands);
6753 return \"fmove%.d %+,%0\";
6757 ;; Optimize a stack-adjust followed by a push of an argument.
6758 ;; This is said to happen frequently with -msoft-float
6759 ;; when there are consecutive library calls.
6762 [(set (reg:SI 15) (plus:SI (reg:SI 15)
6763 (match_operand:SI 0 "const_int_operand" "n")))
6764 (set (match_operand:SF 1 "push_operand" "=m")
6765 (match_operand:SF 2 "general_operand" "rmfF"))]
6766 "INTVAL (operands[0]) >= 4
6767 && ! reg_mentioned_p (stack_pointer_rtx, operands[2])"
6770 if (INTVAL (operands[0]) > 4)
6773 xoperands[0] = stack_pointer_rtx;
6774 xoperands[1] = GEN_INT (INTVAL (operands[0]) - 4);
6775 if (INTVAL (xoperands[1]) <= 8)
6777 if (!TARGET_COLDFIRE)
6778 output_asm_insn (\"addq%.w %1,%0\", xoperands);
6780 output_asm_insn (\"addq%.l %1,%0\", xoperands);
6782 else if (TARGET_CPU32 && INTVAL (xoperands[1]) <= 16)
6784 xoperands[1] = GEN_INT (INTVAL (xoperands[1]) - 8);
6785 output_asm_insn (\"addq%.w %#8,%0\;addq%.w %1,%0\", xoperands);
6787 else if (INTVAL (xoperands[1]) <= 0x7FFF)
6790 output_asm_insn (\"add%.w %1,%0\", xoperands);
6792 output_asm_insn (\"lea (%c1,%0),%0\", xoperands);
6794 output_asm_insn (\"lea %0@(%c1),%0\", xoperands);
6797 output_asm_insn (\"add%.l %1,%0\", xoperands);
6799 if (FP_REG_P (operands[2]))
6800 return \"fmove%.s %2,%@\";
6801 return \"move%.l %2,%@\";
6804 ;; Speed up stack adjust followed by a fullword fixedpoint push.
6807 [(set (reg:SI 15) (plus:SI (reg:SI 15)
6808 (match_operand:SI 0 "const_int_operand" "n")))
6809 (set (match_operand:SI 1 "push_operand" "=m")
6810 (match_operand:SI 2 "general_operand" "g"))]
6811 "INTVAL (operands[0]) >= 4
6812 && ! reg_mentioned_p (stack_pointer_rtx, operands[2])"
6815 if (INTVAL (operands[0]) > 4)
6818 xoperands[0] = stack_pointer_rtx;
6819 xoperands[1] = GEN_INT (INTVAL (operands[0]) - 4);
6820 if (INTVAL (xoperands[1]) <= 8)
6822 if (!TARGET_COLDFIRE)
6823 output_asm_insn (\"addq%.w %1,%0\", xoperands);
6825 output_asm_insn (\"addq%.l %1,%0\", xoperands);
6827 else if (TARGET_CPU32 && INTVAL (xoperands[1]) <= 16)
6829 xoperands[1] = GEN_INT (INTVAL (xoperands[1]) - 8);
6830 output_asm_insn (\"addq%.w %#8,%0\;addq%.w %1,%0\", xoperands);
6832 else if (INTVAL (xoperands[1]) <= 0x7FFF)
6835 output_asm_insn (\"add%.w %1,%0\", xoperands);
6837 output_asm_insn (\"lea (%c1,%0),%0\", xoperands);
6839 output_asm_insn (\"lea %0@(%c1),%0\", xoperands);
6842 output_asm_insn (\"add%.l %1,%0\", xoperands);
6844 if (operands[2] == const0_rtx)
6845 return \"clr%.l %@\";
6846 return \"move%.l %2,%@\";
6849 ;; Speed up pushing a single byte but leaving four bytes of space.
6852 [(set (mem:QI (pre_dec:SI (reg:SI 15)))
6853 (match_operand:QI 1 "general_operand" "dami"))
6854 (set (reg:SI 15) (minus:SI (reg:SI 15) (const_int 2)))]
6855 "! reg_mentioned_p (stack_pointer_rtx, operands[1])"
6860 if (GET_CODE (operands[1]) == REG)
6861 return \"move%.l %1,%-\";
6863 xoperands[1] = operands[1];
6865 = gen_rtx_MEM (QImode, plus_constant (stack_pointer_rtx, 3));
6866 xoperands[3] = stack_pointer_rtx;
6867 if (!TARGET_COLDFIRE)
6868 output_asm_insn (\"subq%.w %#4,%3\;move%.b %1,%2\", xoperands);
6870 output_asm_insn (\"subq%.l %#4,%3\;move%.b %1,%2\", xoperands);
6875 [(set (match_operand:SI 0 "register_operand" "=d")
6877 (set (strict_low_part (subreg:HI (match_dup 0) 2))
6878 (match_operand:HI 1 "general_operand" "rmn"))]
6879 "strict_low_part_peephole_ok (HImode, prev_nonnote_insn (insn), operands[0])"
6882 if (GET_CODE (operands[1]) == CONST_INT)
6884 if (operands[1] == const0_rtx
6885 && (DATA_REG_P (operands[0])
6886 || GET_CODE (operands[0]) == MEM)
6887 /* clr insns on 68000 read before writing.
6888 This isn't so on the 68010, but we have no TARGET_68010. */
6889 && ((TARGET_68020 || TARGET_COLDFIRE)
6890 || !(GET_CODE (operands[0]) == MEM
6891 && MEM_VOLATILE_P (operands[0]))))
6892 return \"clr%.w %0\";
6894 return \"move%.w %1,%0\";
6902 ;; jCC label ; abnormal loop termination
6903 ;; dbra dN, loop ; normal loop termination
6911 ;; Which moves the jCC condition outside the inner loop for free.
6915 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
6916 [(cc0) (const_int 0)])
6917 (label_ref (match_operand 2 "" ""))
6922 (ne (match_operand:HI 0 "register_operand" "")
6924 (label_ref (match_operand 1 "" ""))
6927 (plus:HI (match_dup 0)
6929 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
6933 output_dbcc_and_branch (operands);
6938 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
6939 [(cc0) (const_int 0)])
6940 (label_ref (match_operand 2 "" ""))
6945 (ne (match_operand:SI 0 "register_operand" "")
6947 (label_ref (match_operand 1 "" ""))
6950 (plus:SI (match_dup 0)
6952 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
6956 output_dbcc_and_branch (operands);
6961 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
6962 [(cc0) (const_int 0)])
6963 (label_ref (match_operand 2 "" ""))
6968 (ge (plus:HI (match_operand:HI 0 "register_operand" "")
6971 (label_ref (match_operand 1 "" ""))
6974 (plus:HI (match_dup 0)
6976 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
6980 output_dbcc_and_branch (operands);
6985 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
6986 [(cc0) (const_int 0)])
6987 (label_ref (match_operand 2 "" ""))
6992 (ge (plus:SI (match_operand:SI 0 "register_operand" "")
6995 (label_ref (match_operand 1 "" ""))
6998 (plus:SI (match_dup 0)
7000 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
7004 output_dbcc_and_branch (operands);
7009 (define_expand "tstxf"
7011 (match_operand:XF 0 "nonimmediate_operand" ""))]
7013 "m68k_last_compare_had_fp_operands = 1;")
7017 (match_operand:XF 0 "nonimmediate_operand" "fm"))]
7021 cc_status.flags = CC_IN_68881;
7022 return \"ftst%.x %0\";
7025 (define_expand "cmpxf"
7027 (compare (match_operand:XF 0 "nonimmediate_operand" "")
7028 (match_operand:XF 1 "nonimmediate_operand" "")))]
7030 "m68k_last_compare_had_fp_operands = 1;")
7034 (compare (match_operand:XF 0 "nonimmediate_operand" "f,m")
7035 (match_operand:XF 1 "nonimmediate_operand" "fm,f")))]
7039 cc_status.flags = CC_IN_68881;
7040 #ifdef SGS_CMP_ORDER
7041 if (REG_P (operands[0]))
7043 if (REG_P (operands[1]))
7044 return \"fcmp%.x %0,%1\";
7046 return \"fcmp%.x %0,%f1\";
7048 cc_status.flags |= CC_REVERSED;
7049 return \"fcmp%.x %1,%f0\";
7051 if (REG_P (operands[0]))
7053 if (REG_P (operands[1]))
7054 return \"fcmp%.x %1,%0\";
7056 return \"fcmp%.x %f1,%0\";
7058 cc_status.flags |= CC_REVERSED;
7059 return \"fcmp%.x %f0,%1\";
7063 (define_insn "extendsfxf2"
7064 [(set (match_operand:XF 0 "nonimmediate_operand" "=fm,f")
7065 (float_extend:XF (match_operand:SF 1 "general_operand" "f,rmF")))]
7069 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
7071 if (REGNO (operands[0]) == REGNO (operands[1]))
7073 /* Extending float to double in an fp-reg is a no-op.
7074 NOTICE_UPDATE_CC has already assumed that the
7075 cc will be set. So cancel what it did. */
7076 cc_status = cc_prev_status;
7079 return \"f%$move%.x %1,%0\";
7081 if (FP_REG_P (operands[0]))
7083 if (FP_REG_P (operands[1]))
7084 return \"f%$move%.x %1,%0\";
7085 else if (ADDRESS_REG_P (operands[1]))
7086 return \"move%.l %1,%-\;f%$move%.s %+,%0\";
7087 else if (GET_CODE (operands[1]) == CONST_DOUBLE)
7088 return output_move_const_single (operands);
7089 return \"f%$move%.s %f1,%0\";
7091 return \"fmove%.x %f1,%0\";
7095 (define_insn "extenddfxf2"
7096 [(set (match_operand:XF 0 "nonimmediate_operand" "=fm,f")
7098 (match_operand:DF 1 "general_operand" "f,rmE")))]
7102 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
7104 if (REGNO (operands[0]) == REGNO (operands[1]))
7106 /* Extending float to double in an fp-reg is a no-op.
7107 NOTICE_UPDATE_CC has already assumed that the
7108 cc will be set. So cancel what it did. */
7109 cc_status = cc_prev_status;
7112 return \"fmove%.x %1,%0\";
7114 if (FP_REG_P (operands[0]))
7116 if (REG_P (operands[1]))
7119 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
7120 output_asm_insn (\"move%.l %1,%-\", xoperands);
7121 output_asm_insn (\"move%.l %1,%-\", operands);
7122 return \"f%&move%.d %+,%0\";
7124 if (GET_CODE (operands[1]) == CONST_DOUBLE)
7125 return output_move_const_double (operands);
7126 return \"f%&move%.d %f1,%0\";
7128 return \"fmove%.x %f1,%0\";
7131 (define_insn "truncxfdf2"
7132 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,!r")
7134 (match_operand:XF 1 "general_operand" "f,f")))]
7138 if (REG_P (operands[0]))
7140 output_asm_insn (\"fmove%.d %f1,%-\;move%.l %+,%0\", operands);
7141 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
7142 return \"move%.l %+,%0\";
7144 return \"fmove%.d %f1,%0\";
7147 (define_insn "truncxfsf2"
7148 [(set (match_operand:SF 0 "nonimmediate_operand" "=dm")
7150 (match_operand:XF 1 "general_operand" "f")))]
7154 (define_insn "floatsixf2"
7155 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7156 (float:XF (match_operand:SI 1 "general_operand" "dmi")))]
7160 (define_insn "floathixf2"
7161 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7162 (float:XF (match_operand:HI 1 "general_operand" "dmn")))]
7166 (define_insn "floatqixf2"
7167 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7168 (float:XF (match_operand:QI 1 "general_operand" "dmn")))]
7172 (define_insn "ftruncxf2"
7173 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7174 (fix:XF (match_operand:XF 1 "general_operand" "fFm")))]
7178 if (FP_REG_P (operands[1]))
7179 return \"fintrz%.x %f1,%0\";
7180 return \"fintrz%.x %f1,%0\";
7183 (define_insn "fixxfqi2"
7184 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
7185 (fix:QI (match_operand:XF 1 "general_operand" "f")))]
7189 (define_insn "fixxfhi2"
7190 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
7191 (fix:HI (match_operand:XF 1 "general_operand" "f")))]
7195 (define_insn "fixxfsi2"
7196 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
7197 (fix:SI (match_operand:XF 1 "general_operand" "f")))]
7202 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7203 (plus:XF (float:XF (match_operand:SI 2 "general_operand" "dmi"))
7204 (match_operand:XF 1 "nonimmediate_operand" "0")))]
7209 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7210 (plus:XF (float:XF (match_operand:HI 2 "general_operand" "dmn"))
7211 (match_operand:XF 1 "nonimmediate_operand" "0")))]
7216 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7217 (plus:XF (float:XF (match_operand:QI 2 "general_operand" "dmn"))
7218 (match_operand:XF 1 "general_operand" "0")))]
7222 (define_insn "addxf3"
7223 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7224 (plus:XF (match_operand:XF 1 "nonimmediate_operand" "%0")
7225 (match_operand:XF 2 "nonimmediate_operand" "fm")))]
7229 if (REG_P (operands[2]))
7230 return \"fadd%.x %2,%0\";
7231 return \"fadd%.x %f2,%0\";
7235 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7236 (minus:XF (match_operand:XF 1 "nonimmediate_operand" "0")
7237 (float:XF (match_operand:SI 2 "general_operand" "dmi"))))]
7242 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7243 (minus:XF (match_operand:XF 1 "nonimmediate_operand" "0")
7244 (float:XF (match_operand:HI 2 "general_operand" "dmn"))))]
7249 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7250 (minus:XF (match_operand:XF 1 "nonimmediate_operand" "0")
7251 (float:XF (match_operand:QI 2 "general_operand" "dmn"))))]
7255 (define_insn "subxf3"
7256 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7257 (minus:XF (match_operand:XF 1 "nonimmediate_operand" "0")
7258 (match_operand:XF 2 "nonimmediate_operand" "fm")))]
7262 if (REG_P (operands[2]))
7263 return \"fsub%.x %2,%0\";
7264 return \"fsub%.x %f2,%0\";
7268 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7269 (mult:XF (float:XF (match_operand:SI 2 "general_operand" "dmi"))
7270 (match_operand:XF 1 "nonimmediate_operand" "0")))]
7275 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7276 (mult:XF (float:XF (match_operand:HI 2 "general_operand" "dmn"))
7277 (match_operand:XF 1 "nonimmediate_operand" "0")))]
7282 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7283 (mult:XF (float:XF (match_operand:QI 2 "general_operand" "dmn"))
7284 (match_operand:XF 1 "nonimmediate_operand" "0")))]
7288 (define_insn "mulxf3"
7289 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7290 (mult:XF (match_operand:XF 1 "nonimmediate_operand" "%0")
7291 (match_operand:XF 2 "nonimmediate_operand" "fm")))]
7295 if (REG_P (operands[2]))
7296 return \"fmul%.x %2,%0\";
7297 return \"fmul%.x %f2,%0\";
7301 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7302 (div:XF (match_operand:XF 1 "nonimmediate_operand" "0")
7303 (float:XF (match_operand:SI 2 "general_operand" "dmi"))))]
7308 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7309 (div:XF (match_operand:XF 1 "nonimmediate_operand" "0")
7310 (float:XF (match_operand:HI 2 "general_operand" "dmn"))))]
7315 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7316 (div:XF (match_operand:XF 1 "nonimmediate_operand" "0")
7317 (float:XF (match_operand:QI 2 "general_operand" "dmn"))))]
7321 (define_insn "divxf3"
7322 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7323 (div:XF (match_operand:XF 1 "nonimmediate_operand" "0")
7324 (match_operand:XF 2 "nonimmediate_operand" "fm")))]
7328 if (REG_P (operands[2]))
7329 return \"fdiv%.x %2,%0\";
7330 return \"fdiv%.x %f2,%0\";
7333 (define_expand "negxf2"
7334 [(set (match_operand:XF 0 "nonimmediate_operand" "")
7335 (neg:XF (match_operand:XF 1 "nonimmediate_operand" "")))]
7346 target = operand_subword (operands[0], 0, 1, XFmode);
7347 result = expand_binop (SImode, xor_optab,
7348 operand_subword_force (operands[1], 0, XFmode),
7349 GEN_INT (0x80000000), target, 0, OPTAB_WIDEN);
7353 if (result != target)
7354 emit_move_insn (result, target);
7356 emit_move_insn (operand_subword (operands[0], 1, 1, XFmode),
7357 operand_subword_force (operands[1], 1, XFmode));
7358 emit_move_insn (operand_subword (operands[0], 2, 1, XFmode),
7359 operand_subword_force (operands[1], 2, XFmode));
7361 insns = get_insns ();
7364 emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
7369 (define_insn "negxf2_68881"
7370 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7371 (neg:XF (match_operand:XF 1 "nonimmediate_operand" "fm")))]
7375 if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
7376 return \"fneg%.x %1,%0\";
7377 return \"fneg%.x %f1,%0\";
7380 (define_expand "absxf2"
7381 [(set (match_operand:XF 0 "nonimmediate_operand" "")
7382 (abs:XF (match_operand:XF 1 "nonimmediate_operand" "")))]
7393 target = operand_subword (operands[0], 0, 1, XFmode);
7394 result = expand_binop (SImode, and_optab,
7395 operand_subword_force (operands[1], 0, XFmode),
7396 GEN_INT (0x7fffffff), target, 0, OPTAB_WIDEN);
7400 if (result != target)
7401 emit_move_insn (result, target);
7403 emit_move_insn (operand_subword (operands[0], 1, 1, XFmode),
7404 operand_subword_force (operands[1], 1, XFmode));
7405 emit_move_insn (operand_subword (operands[0], 2, 1, XFmode),
7406 operand_subword_force (operands[1], 2, XFmode));
7408 insns = get_insns ();
7411 emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
7416 (define_insn "absxf2_68881"
7417 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7418 (abs:XF (match_operand:XF 1 "nonimmediate_operand" "fm")))]
7422 if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
7423 return \"fabs%.x %1,%0\";
7424 return \"fabs%.x %f1,%0\";
7427 (define_insn "sqrtxf2"
7428 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7429 (sqrt:XF (match_operand:XF 1 "nonimmediate_operand" "fm")))]
7433 (define_insn "sinsf2"
7434 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
7435 (unspec:SF [(match_operand:SF 1 "general_operand" "fm")] UNSPEC_SIN))]
7436 "TARGET_68881 && flag_unsafe_math_optimizations"
7439 if (FP_REG_P (operands[1]))
7440 return \"fsin%.x %1,%0\";
7442 return \"fsin%.s %1,%0\";
7445 (define_insn "sindf2"
7446 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
7447 (unspec:DF [(match_operand:DF 1 "general_operand" "fm")] UNSPEC_SIN))]
7448 "TARGET_68881 && flag_unsafe_math_optimizations"
7451 if (FP_REG_P (operands[1]))
7452 return \"fsin%.x %1,%0\";
7454 return \"fsin%.d %1,%0\";
7457 (define_insn "sinxf2"
7458 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7459 (unspec:XF [(match_operand:XF 1 "nonimmediate_operand" "fm")] UNSPEC_SIN))]
7460 "TARGET_68881 && flag_unsafe_math_optimizations"
7463 (define_insn "cossf2"
7464 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
7465 (unspec:SF [(match_operand:SF 1 "general_operand" "fm")] UNSPEC_COS))]
7466 "TARGET_68881 && flag_unsafe_math_optimizations"
7469 if (FP_REG_P (operands[1]))
7470 return \"fcos%.x %1,%0\";
7472 return \"fcos%.s %1,%0\";
7475 (define_insn "cosdf2"
7476 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
7477 (unspec:DF [(match_operand:DF 1 "general_operand" "fm")] UNSPEC_COS))]
7478 "TARGET_68881 && flag_unsafe_math_optimizations"
7481 if (FP_REG_P (operands[1]))
7482 return \"fcos%.x %1,%0\";
7484 return \"fcos%.d %1,%0\";
7487 (define_insn "cosxf2"
7488 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7489 (unspec:XF [(match_operand:XF 1 "nonimmediate_operand" "fm")] UNSPEC_COS))]
7490 "TARGET_68881 && flag_unsafe_math_optimizations"
7494 [(trap_if (const_int -1) (const_int 7))]
7498 (define_insn "conditional_trap"
7499 [(trap_if (match_operator 0 "valid_dbcc_comparison_p"
7500 [(cc0) (const_int 0)])
7501 (match_operand:SI 1 "const_int_operand" "I"))]
7502 "TARGET_68020 && ! flags_in_68881 ()"
7505 switch (GET_CODE (operands[0]))
7507 case EQ: return \"trapeq\";
7508 case NE: return \"trapne\";
7509 case GT: return \"trapgt\";
7510 case GTU: return \"traphi\";
7511 case LT: return \"traplt\";
7512 case LTU: return \"trapcs\";
7513 case GE: return \"trapge\";
7514 case GEU: return \"trapcc\";
7515 case LE: return \"traple\";
7516 case LEU: return \"trapls\";