1 ;;- Machine description for GNU compiler, Motorola 68000 Version
2 ;; Copyright (C) 1987, 1988, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001,
4 ;; Free Software Foundation, Inc.
6 ;; This file is part of GCC.
8 ;; GCC is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; GCC is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING. If not, write to
20 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
21 ;; Boston, MA 02111-1307, USA.
23 ;;- Information about MCF5200 port.
25 ;;- The MCF5200 "ColdFire" architecture is a reduced version of the
26 ;;- 68k ISA. Differences include reduced support for byte and word
27 ;;- operands and the removal of BCD, bitfield, rotate, and integer
28 ;;- divide instructions. The TARGET_COLDFIRE flag turns the use of the
29 ;;- removed opcodes and addressing modes off.
33 ;;- instruction definitions
35 ;;- @@The original PO technology requires these to be ordered by speed,
36 ;;- @@ so that assigner will pick the fastest.
38 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
40 ;;- When naming insn's (operand 0 of define_insn) be careful about using
41 ;;- names from other targets machine descriptions.
43 ;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
44 ;;- updates for most instructions.
46 ;;- Operand classes for the register allocator:
47 ;;- 'a' one of the address registers can be used.
48 ;;- 'd' one of the data registers can be used.
49 ;;- 'f' one of the m68881 registers can be used
50 ;;- 'r' either a data or an address register can be used.
52 ;;- Immediate Floating point operator constraints
53 ;;- 'G' a floating point constant that is *NOT* one of the standard
54 ;; 68881 constant values (to force calling output_move_const_double
55 ;; to get it from rom if it is a 68881 constant).
57 ;; See the functions standard_XXX_constant_p in output-m68k.c for more
60 ;;- Immediate integer operand constraints:
62 ;;- 'J' -32768 .. 32767
63 ;;- 'K' all integers EXCEPT -128 .. 127
65 ;;- 'M' all integers EXCEPT -256 .. 255
71 ;;- "%." size separator ("." or "") move%.l d0,d1
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)
126 ;; Registers by name.
133 [(set (match_operand:DF 0 "push_operand" "=m")
134 (match_operand:DF 1 "general_operand" "ro<>fyE"))]
137 if (FP_REG_P (operands[1]))
138 return "fmove%.d %f1,%0";
139 return output_move_double (operands);
142 (define_insn "pushdi"
143 [(set (match_operand:DI 0 "push_operand" "=m")
144 (match_operand:DI 1 "general_operand" "ro<>Fyi"))]
147 return output_move_double (operands);
150 ;; We don't want to allow a constant operand for test insns because
151 ;; (set (cc0) (const_int foo)) has no mode information. Such insns will
152 ;; be folded while optimizing anyway.
154 (define_expand "tstdi"
155 [(parallel [(set (cc0)
156 (match_operand:DI 0 "nonimmediate_operand" ""))
157 (clobber (match_scratch:SI 1 ""))
158 (clobber (match_scratch:DI 2 ""))])]
160 "m68k_last_compare_had_fp_operands = 0;")
164 (match_operand:DI 0 "nonimmediate_operand" "am,d"))
165 (clobber (match_scratch:SI 1 "=X,d"))
166 (clobber (match_scratch:DI 2 "=d,X"))]
169 if (which_alternative == 0)
173 xoperands[0] = operands[2];
174 xoperands[1] = operands[0];
175 output_move_double (xoperands);
176 cc_status.flags |= CC_REVERSED;
177 return "neg%.l %R2\;negx%.l %2";
179 if (find_reg_note (insn, REG_DEAD, operands[0]))
181 cc_status.flags |= CC_REVERSED;
182 return "neg%.l %R0\;negx%.l %0";
186 'sub' clears %1, and also clears the X cc bit
187 'tst' sets the Z cc bit according to the low part of the DImode operand
188 'subx %1' (i.e. subx #0) acts as a (non-existent) tstx on the high part.
190 return "sub%.l %1,%1\;tst%.l %R0\;subx%.l %1,%0";
193 (define_expand "tstsi"
195 (match_operand:SI 0 "nonimmediate_operand" ""))]
197 "m68k_last_compare_had_fp_operands = 0;")
201 (match_operand:SI 0 "nonimmediate_operand" "rm"))]
204 if (TARGET_68020 || TARGET_COLDFIRE || ! ADDRESS_REG_P (operands[0]))
206 /* If you think that the 68020 does not support tstl a0,
207 reread page B-167 of the 68020 manual more carefully. */
208 /* On an address reg, cmpw may replace cmpl. */
209 return "cmp%.w #0,%0";
212 ;; This can't use an address register, because comparisons
213 ;; with address registers as second operand always test the whole word.
214 (define_expand "tsthi"
216 (match_operand:HI 0 "nonimmediate_operand" ""))]
218 "m68k_last_compare_had_fp_operands = 0;")
222 (match_operand:HI 0 "nonimmediate_operand" "dm"))]
226 (define_expand "tstqi"
228 (match_operand:QI 0 "nonimmediate_operand" ""))]
230 "m68k_last_compare_had_fp_operands = 0;")
234 (match_operand:QI 0 "nonimmediate_operand" "dm"))]
238 (define_expand "tstsf"
240 (match_operand:SF 0 "general_operand" ""))]
243 m68k_last_compare_had_fp_operands = 1;
248 (match_operand:SF 0 "general_operand" "fdm"))]
251 cc_status.flags = CC_IN_68881;
252 if (FP_REG_P (operands[0]))
257 (define_expand "tstdf"
259 (match_operand:DF 0 "general_operand" ""))]
262 m68k_last_compare_had_fp_operands = 1;
267 (match_operand:DF 0 "general_operand" "fm"))]
270 cc_status.flags = CC_IN_68881;
271 if (FP_REG_P (operands[0]))
276 ;; compare instructions.
278 (define_expand "cmpdi"
281 (compare (match_operand:DI 0 "nonimmediate_operand" "")
282 (match_operand:DI 1 "general_operand" "")))
283 (clobber (match_dup 2))])]
285 "m68k_last_compare_had_fp_operands = 0; operands[2] = gen_reg_rtx (DImode);")
289 (compare (match_operand:DI 1 "nonimmediate_operand" "0,d")
290 (match_operand:DI 2 "general_operand" "d,0")))
291 (clobber (match_operand:DI 0 "register_operand" "=d,d"))]
294 if (rtx_equal_p (operands[0], operands[1]))
295 return "sub%.l %R2,%R0\;subx%.l %2,%0";
298 cc_status.flags |= CC_REVERSED;
299 return "sub%.l %R1,%R0\;subx%.l %1,%0";
303 ;; This is the second "hook" for PIC code (in addition to movsi). See
304 ;; comment of movsi for a description of PIC handling.
305 (define_expand "cmpsi"
307 (compare (match_operand:SI 0 "nonimmediate_operand" "")
308 (match_operand:SI 1 "general_operand" "")))]
311 m68k_last_compare_had_fp_operands = 0;
312 if (flag_pic && !TARGET_PCREL && symbolic_operand (operands[1], SImode))
314 /* The source is an address which requires PIC relocation.
315 Call legitimize_pic_address with the source, mode, and a relocation
316 register (a new pseudo, or the final destination if reload_in_progress
317 is set). Then fall through normally */
318 rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
319 operands[1] = legitimize_pic_address (operands[1], SImode, temp);
323 ;; A composite of the cmp, cmpa, cmpi & cmpm m68000 op codes.
326 (compare (match_operand:SI 0 "nonimmediate_operand" "rKT,rKs,mSr,mSa,>")
327 (match_operand:SI 1 "general_src_operand" "mSr,mSa,KTr,Ksr,>")))]
330 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
331 return "cmpm%.l %1,%0";
332 if (REG_P (operands[1])
333 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
335 cc_status.flags |= CC_REVERSED;
336 return "cmp%.l %d0,%d1";
338 if (ADDRESS_REG_P (operands[0])
339 && GET_CODE (operands[1]) == CONST_INT
340 && INTVAL (operands[1]) < 0x8000
341 && INTVAL (operands[1]) >= -0x8000)
342 return "cmp%.w %1,%0";
343 return "cmp%.l %d1,%d0";
348 (compare (match_operand:SI 0 "nonimmediate_operand" "mrKs,r")
349 (match_operand:SI 1 "general_operand" "r,mrKs")))]
352 if (REG_P (operands[1])
353 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
355 cc_status.flags |= CC_REVERSED;
356 return "cmp%.l %d0,%d1";
358 return "cmp%.l %d1,%d0";
361 (define_expand "cmphi"
363 (compare (match_operand:HI 0 "nonimmediate_src_operand" "")
364 (match_operand:HI 1 "general_src_operand" "")))]
366 "m68k_last_compare_had_fp_operands = 0;")
370 (compare (match_operand:HI 0 "nonimmediate_src_operand" "rnmS,d,n,mS,>")
371 (match_operand:HI 1 "general_src_operand" "d,rnmS,mS,n,>")))]
374 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
375 return "cmpm%.w %1,%0";
376 if ((REG_P (operands[1]) && !ADDRESS_REG_P (operands[1]))
377 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
379 cc_status.flags |= CC_REVERSED;
380 return "cmp%.w %d0,%d1";
382 return "cmp%.w %d1,%d0";
385 (define_expand "cmpqi"
387 (compare (match_operand:QI 0 "nonimmediate_src_operand" "")
388 (match_operand:QI 1 "general_src_operand" "")))]
390 "m68k_last_compare_had_fp_operands = 0;")
394 (compare (match_operand:QI 0 "nonimmediate_src_operand" "dn,dmS,>")
395 (match_operand:QI 1 "general_src_operand" "dmS,nd,>")))]
398 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
399 return "cmpm%.b %1,%0";
400 if (REG_P (operands[1])
401 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
403 cc_status.flags |= CC_REVERSED;
404 return "cmp%.b %d0,%d1";
406 return "cmp%.b %d1,%d0";
409 (define_expand "cmpdf"
411 (compare (match_operand:DF 0 "general_operand" "")
412 (match_operand:DF 1 "general_operand" "")))]
415 m68k_last_compare_had_fp_operands = 1;
420 (compare (match_operand:DF 0 "general_operand" "f,mG")
421 (match_operand:DF 1 "general_operand" "fmG,f")))]
424 cc_status.flags = CC_IN_68881;
425 if (REG_P (operands[0]))
427 if (REG_P (operands[1]))
428 return "fcmp%.x %1,%0";
430 return "fcmp%.d %f1,%0";
432 cc_status.flags |= CC_REVERSED;
433 return "fcmp%.d %f0,%1";
436 (define_expand "cmpsf"
438 (compare (match_operand:SF 0 "general_operand" "")
439 (match_operand:SF 1 "general_operand" "")))]
442 m68k_last_compare_had_fp_operands = 1;
447 (compare (match_operand:SF 0 "general_operand" "f,mdG")
448 (match_operand:SF 1 "general_operand" "fmdG,f")))]
451 cc_status.flags = CC_IN_68881;
452 if (FP_REG_P (operands[0]))
454 if (FP_REG_P (operands[1]))
455 return "fcmp%.x %1,%0";
457 return "fcmp%.s %f1,%0";
459 cc_status.flags |= CC_REVERSED;
460 return "fcmp%.s %f0,%1";
463 ;; Recognizers for btst instructions.
465 ;; ColdFire/5200 only allows "<Q>" type addresses when the bit position is
466 ;; specified as a constant, so we must disable all patterns that may extract
467 ;; from a MEM at a constant bit position if we can't use this as a constraint.
470 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_src_operand" "oS")
472 (minus:SI (const_int 7)
473 (match_operand:SI 1 "general_operand" "di"))))]
476 return output_btst (operands, operands[1], operands[0], insn, 7);
479 ;; This is the same as the above pattern except for the constraints. The 'i'
483 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "o")
485 (minus:SI (const_int 7)
486 (match_operand:SI 1 "general_operand" "d"))))]
489 return output_btst (operands, operands[1], operands[0], insn, 7);
493 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "d")
495 (minus:SI (const_int 31)
496 (match_operand:SI 1 "general_operand" "di"))))]
499 return output_btst (operands, operands[1], operands[0], insn, 31);
502 ;; The following two patterns are like the previous two
503 ;; except that they use the fact that bit-number operands
504 ;; are automatically masked to 3 or 5 bits.
507 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "o")
509 (minus:SI (const_int 7)
511 (match_operand:SI 1 "register_operand" "d")
515 return output_btst (operands, operands[1], operands[0], insn, 7);
519 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "d")
521 (minus:SI (const_int 31)
523 (match_operand:SI 1 "register_operand" "d")
527 return output_btst (operands, operands[1], operands[0], insn, 31);
530 ;; Nonoffsettable mem refs are ok in this one pattern
531 ;; since we don't try to adjust them.
533 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "m")
535 (match_operand:SI 1 "const_int_operand" "n")))]
536 "(unsigned) INTVAL (operands[1]) < 8 && !TARGET_COLDFIRE"
538 operands[1] = GEN_INT (7 - INTVAL (operands[1]));
539 return output_btst (operands, operands[1], operands[0], insn, 7);
543 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "do")
545 (match_operand:SI 1 "const_int_operand" "n")))]
548 if (GET_CODE (operands[0]) == MEM)
550 operands[0] = adjust_address (operands[0], QImode,
551 INTVAL (operands[1]) / 8);
552 operands[1] = GEN_INT (7 - INTVAL (operands[1]) % 8);
553 return output_btst (operands, operands[1], operands[0], insn, 7);
555 operands[1] = GEN_INT (31 - INTVAL (operands[1]));
556 return output_btst (operands, operands[1], operands[0], insn, 31);
559 ;; This is the same as the above pattern except for the constraints.
560 ;; The 'o' has been replaced with 'Q'.
563 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "dQ")
565 (match_operand:SI 1 "const_int_operand" "n")))]
568 if (GET_CODE (operands[0]) == MEM)
570 operands[0] = adjust_address (operands[0], QImode,
571 INTVAL (operands[1]) / 8);
572 operands[1] = GEN_INT (7 - INTVAL (operands[1]) % 8);
573 return output_btst (operands, operands[1], operands[0], insn, 7);
575 operands[1] = GEN_INT (31 - INTVAL (operands[1]));
576 return output_btst (operands, operands[1], operands[0], insn, 31);
582 ;; A special case in which it is not desirable
583 ;; to reload the constant into a data register.
584 (define_insn "pushexthisi_const"
585 [(set (match_operand:SI 0 "push_operand" "=m")
586 (match_operand:SI 1 "const_int_operand" "J"))]
587 "INTVAL (operands[1]) >= -0x8000 && INTVAL (operands[1]) < 0x8000"
589 if (operands[1] == const0_rtx)
591 if (valid_mov3q_const(operands[1]))
592 return "mov3q%.l %1,%-";
597 ;(define_insn "swapsi"
598 ; [(set (match_operand:SI 0 "nonimmediate_operand" "+r")
599 ; (match_operand:SI 1 "general_operand" "+r"))
600 ; (set (match_dup 1) (match_dup 0))]
604 ;; Special case of fullword move when source is zero.
605 ;; The reason this is special is to avoid loading a zero
606 ;; into a data reg with moveq in order to store it elsewhere.
608 (define_insn "movsi_const0"
609 [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
611 ;; clr insns on 68000 read before writing.
612 ;; This isn't so on the 68010, but we have no TARGET_68010.
613 "((TARGET_68020 || TARGET_COLDFIRE)
614 || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0])))"
616 if (ADDRESS_REG_P (operands[0]))
618 /* On the '040, 'subl an,an' takes 2 clocks while lea takes only 1 */
619 if (!TARGET_68040 && !TARGET_68060)
620 return "sub%.l %0,%0";
622 return MOTOROLA ? "lea 0.w,%0" : "lea 0:w,%0";
624 /* moveq is faster on the 68000. */
625 if (DATA_REG_P (operands[0]) && (!TARGET_68020 && !TARGET_COLDFIRE))
626 return "moveq #0,%0";
630 ;; General case of fullword move.
632 ;; This is the main "hook" for PIC code. When generating
633 ;; PIC, movsi is responsible for determining when the source address
634 ;; needs PIC relocation and appropriately calling legitimize_pic_address
635 ;; to perform the actual relocation.
637 ;; In both the PIC and non-PIC cases the patterns generated will
638 ;; matched by the next define_insn.
639 (define_expand "movsi"
640 [(set (match_operand:SI 0 "nonimmediate_operand" "")
641 (match_operand:SI 1 "general_operand" ""))]
644 if (flag_pic && !TARGET_PCREL && symbolic_operand (operands[1], SImode))
646 /* The source is an address which requires PIC relocation.
647 Call legitimize_pic_address with the source, mode, and a relocation
648 register (a new pseudo, or the final destination if reload_in_progress
649 is set). Then fall through normally */
650 rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
651 operands[1] = legitimize_pic_address (operands[1], SImode, temp);
653 else if (flag_pic && TARGET_PCREL && ! reload_in_progress)
655 /* Don't allow writes to memory except via a register;
656 the m68k doesn't consider PC-relative addresses to be writable. */
657 if (symbolic_operand (operands[0], SImode))
658 operands[0] = force_reg (SImode, XEXP (operands[0], 0));
659 else if (GET_CODE (operands[0]) == MEM
660 && symbolic_operand (XEXP (operands[0], 0), SImode))
661 operands[0] = gen_rtx_MEM (SImode,
662 force_reg (SImode, XEXP (operands[0], 0)));
666 ;; General case of fullword move. The register constraints
667 ;; force integer constants in range for a moveq to be reloaded
668 ;; if they are headed for memory.
670 ;; Notes: make sure no alternative allows g vs g.
671 ;; We don't allow f-regs since fixed point cannot go in them.
672 [(set (match_operand:SI 0 "nonimmediate_operand" "=g,d,a<")
673 (match_operand:SI 1 "general_src_operand" "daymSKT,n,i"))]
677 return output_move_simode (operands);
680 (define_insn "*movsi_cf"
681 [(set (match_operand:SI 0 "nonimmediate_operand" "=r<Q>,g,U")
682 (match_operand:SI 1 "general_operand" "g,r<Q>,U"))]
683 "TARGET_COLDFIRE && !TARGET_CFV4"
684 "* return output_move_simode (operands);")
686 (define_insn "*movsi_cfv4"
687 [(set (match_operand:SI 0 "nonimmediate_operand" "=r<Q>,g,U")
688 (match_operand:SI 1 "general_operand" "Rg,Rr<Q>,U"))]
690 "* return output_move_simode (operands);")
692 ;; Special case of fullword move, where we need to get a non-GOT PIC
693 ;; reference into an address register.
695 [(set (match_operand:SI 0 "nonimmediate_operand" "=a<")
696 (match_operand:SI 1 "pcrel_address" ""))]
699 if (push_operand (operands[0], SImode))
704 (define_expand "movhi"
705 [(set (match_operand:HI 0 "nonimmediate_operand" "")
706 (match_operand:HI 1 "general_operand" ""))]
711 [(set (match_operand:HI 0 "nonimmediate_operand" "=g")
712 (match_operand:HI 1 "general_src_operand" "gS"))]
714 "* return output_move_himode (operands);")
717 [(set (match_operand:HI 0 "nonimmediate_operand" "=r<Q>,g,U")
718 (match_operand:HI 1 "general_operand" "g,r<Q>,U"))]
720 "* return output_move_himode (operands);")
722 (define_expand "movstricthi"
723 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" ""))
724 (match_operand:HI 1 "general_src_operand" ""))]
729 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
730 (match_operand:HI 1 "general_src_operand" "rmSn"))]
732 "* return output_move_stricthi (operands);")
735 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+d,m"))
736 (match_operand:HI 1 "general_src_operand" "rmn,r"))]
738 "* return output_move_stricthi (operands);")
740 (define_expand "movqi"
741 [(set (match_operand:QI 0 "nonimmediate_operand" "")
742 (match_operand:QI 1 "general_src_operand" ""))]
747 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,*a,m")
748 (match_operand:QI 1 "general_src_operand" "dmSi*a,di*a,dmSi"))]
750 "* return output_move_qimode (operands);")
753 [(set (match_operand:QI 0 "nonimmediate_operand" "=d<Q>,dm,U,d*a")
754 (match_operand:QI 1 "general_src_operand" "dmi,d<Q>,U,di*a"))]
756 "* return output_move_qimode (operands);")
758 (define_expand "movstrictqi"
759 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" ""))
760 (match_operand:QI 1 "general_src_operand" ""))]
765 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
766 (match_operand:QI 1 "general_src_operand" "dmSn"))]
768 "* return output_move_strictqi (operands);")
771 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+d,m"))
772 (match_operand:QI 1 "general_src_operand" "dmn,d"))]
774 "* return output_move_strictqi (operands);")
776 (define_expand "pushqi1"
777 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -2)))
778 (set (mem:QI (plus:SI (reg:SI SP_REG) (const_int 1)))
779 (match_operand:QI 0 "general_operand" ""))]
783 (define_expand "movsf"
784 [(set (match_operand:SF 0 "nonimmediate_operand" "")
785 (match_operand:SF 1 "general_operand" ""))]
790 [(set (match_operand:SF 0 "nonimmediate_operand" "=rmf")
791 (match_operand:SF 1 "general_operand" "rmfF"))]
794 if (FP_REG_P (operands[0]))
796 if (FP_REG_P (operands[1]))
797 return "f%$move%.x %1,%0";
798 else if (ADDRESS_REG_P (operands[1]))
799 return "move%.l %1,%-\;f%$move%.s %+,%0";
800 else if (GET_CODE (operands[1]) == CONST_DOUBLE)
801 return output_move_const_single (operands);
802 return "f%$move%.s %f1,%0";
804 if (FP_REG_P (operands[1]))
806 if (ADDRESS_REG_P (operands[0]))
807 return "fmove%.s %1,%-\;move%.l %+,%0";
808 return "fmove%.s %f1,%0";
810 if (operands[1] == CONST0_RTX (SFmode)
811 /* clr insns on 68000 read before writing.
812 This isn't so on the 68010, but we have no TARGET_68010. */
813 && ((TARGET_68020 || TARGET_COLDFIRE)
814 || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0]))))
816 if (ADDRESS_REG_P (operands[0]))
818 /* On the '040, 'subl an,an' takes 2 clocks while lea takes only 1 */
819 if (!TARGET_68040 && !TARGET_68060)
820 return "sub%.l %0,%0";
822 return MOTOROLA ? "lea 0.w,%0" : "lea 0:w,%0";
824 /* moveq is faster on the 68000. */
825 if (DATA_REG_P (operands[0]) && !(TARGET_68020 || TARGET_COLDFIRE))
827 return "moveq #0,%0";
831 return "move%.l %1,%0";
835 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,g")
836 (match_operand:SF 1 "general_operand" "g,r"))]
839 return "move%.l %1,%0";
842 (define_expand "movdf"
843 [(set (match_operand:DF 0 "nonimmediate_operand" "")
844 (match_operand:DF 1 "general_operand" ""))]
849 [(set (match_operand:DF 0 "nonimmediate_operand" "=rm,rf,rf,&rof<>")
850 (match_operand:DF 1 "general_operand" "*rf,m,0,*rofE<>"))]
851 ; [(set (match_operand:DF 0 "nonimmediate_operand" "=rm,&rf,&rof<>")
852 ; (match_operand:DF 1 "general_operand" "rf,m,rofF<>"))]
855 if (FP_REG_P (operands[0]))
857 if (FP_REG_P (operands[1]))
858 return "f%&move%.x %1,%0";
859 if (REG_P (operands[1]))
862 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
863 output_asm_insn ("move%.l %1,%-", xoperands);
864 output_asm_insn ("move%.l %1,%-", operands);
865 return "f%&move%.d %+,%0";
867 if (GET_CODE (operands[1]) == CONST_DOUBLE)
868 return output_move_const_double (operands);
869 return "f%&move%.d %f1,%0";
871 else if (FP_REG_P (operands[1]))
873 if (REG_P (operands[0]))
875 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
876 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
877 return "move%.l %+,%0";
880 return "fmove%.d %f1,%0";
882 return output_move_double (operands);
886 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,g")
887 (match_operand:DF 1 "general_operand" "g,r"))]
890 return output_move_double (operands);
893 ;; ??? The XFmode patterns are schizophrenic about whether constants are
894 ;; allowed. Most but not all have predicates and constraint that disallow
895 ;; constants. Most but not all have output templates that handle constants.
896 ;; See also LEGITIMATE_CONSTANT_P.
898 (define_expand "movxf"
899 [(set (match_operand:XF 0 "nonimmediate_operand" "")
900 (match_operand:XF 1 "general_operand" ""))]
903 /* We can't rewrite operands during reload. */
904 if (! reload_in_progress)
906 if (CONSTANT_P (operands[1]))
908 operands[1] = force_const_mem (XFmode, operands[1]);
909 if (! memory_address_p (XFmode, XEXP (operands[1], 0)))
910 operands[1] = adjust_address (operands[1], XFmode, 0);
912 if (flag_pic && TARGET_PCREL)
914 /* Don't allow writes to memory except via a register; the
915 m68k doesn't consider PC-relative addresses to be writable. */
916 if (GET_CODE (operands[0]) == MEM
917 && symbolic_operand (XEXP (operands[0], 0), SImode))
918 operands[0] = gen_rtx_MEM (XFmode,
919 force_reg (SImode, XEXP (operands[0], 0)));
925 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,!r,!f,!r")
926 (match_operand:XF 1 "nonimmediate_operand" "m,f,f,f,r,!r"))]
929 if (FP_REG_P (operands[0]))
931 if (FP_REG_P (operands[1]))
932 return "fmove%.x %1,%0";
933 if (REG_P (operands[1]))
936 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 2);
937 output_asm_insn ("move%.l %1,%-", xoperands);
938 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
939 output_asm_insn ("move%.l %1,%-", xoperands);
940 output_asm_insn ("move%.l %1,%-", operands);
941 return "fmove%.x %+,%0";
943 if (GET_CODE (operands[1]) == CONST_DOUBLE)
944 return "fmove%.x %1,%0";
945 return "fmove%.x %f1,%0";
947 if (FP_REG_P (operands[1]))
949 if (REG_P (operands[0]))
951 output_asm_insn ("fmove%.x %f1,%-\;move%.l %+,%0", operands);
952 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
953 output_asm_insn ("move%.l %+,%0", operands);
954 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
955 return "move%.l %+,%0";
957 /* Must be memory destination. */
958 return "fmove%.x %f1,%0";
960 return output_move_double (operands);
964 [(set (match_operand:XF 0 "nonimmediate_operand" "=rm,rf,&rof<>")
965 (match_operand:XF 1 "nonimmediate_operand" "rf,m,rof<>"))]
966 "! TARGET_68881 && ! TARGET_COLDFIRE"
968 if (FP_REG_P (operands[0]))
970 if (FP_REG_P (operands[1]))
971 return "fmove%.x %1,%0";
972 if (REG_P (operands[1]))
975 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 2);
976 output_asm_insn ("move%.l %1,%-", xoperands);
977 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
978 output_asm_insn ("move%.l %1,%-", xoperands);
979 output_asm_insn ("move%.l %1,%-", operands);
980 return "fmove%.x %+,%0";
982 if (GET_CODE (operands[1]) == CONST_DOUBLE)
983 return "fmove%.x %1,%0";
984 return "fmove%.x %f1,%0";
986 if (FP_REG_P (operands[1]))
988 if (REG_P (operands[0]))
990 output_asm_insn ("fmove%.x %f1,%-\;move%.l %+,%0", operands);
991 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
992 output_asm_insn ("move%.l %+,%0", operands);
993 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
994 return "move%.l %+,%0";
997 return "fmove%.x %f1,%0";
999 return output_move_double (operands);
1003 [(set (match_operand:XF 0 "nonimmediate_operand" "=r,g")
1004 (match_operand:XF 1 "nonimmediate_operand" "g,r"))]
1005 "! TARGET_68881 && TARGET_COLDFIRE"
1006 "* return output_move_double (operands);")
1008 (define_expand "movdi"
1009 ;; Let's see if it really still needs to handle fp regs, and, if so, why.
1010 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1011 (match_operand:DI 1 "general_operand" ""))]
1015 ;; movdi can apply to fp regs in some cases
1017 ;; Let's see if it really still needs to handle fp regs, and, if so, why.
1018 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r,&ro<>")
1019 (match_operand:DI 1 "general_operand" "rF,m,roi<>F"))]
1020 ; [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,&r,&ro<>,!&rm,!&f")
1021 ; (match_operand:DI 1 "general_operand" "r,m,roi<>,fF"))]
1022 ; [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,&rf,&ro<>,!&rm,!&f")
1023 ; (match_operand:DI 1 "general_operand" "r,m,roi<>,fF,rfF"))]
1026 if (FP_REG_P (operands[0]))
1028 if (FP_REG_P (operands[1]))
1029 return "fmove%.x %1,%0";
1030 if (REG_P (operands[1]))
1033 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1034 output_asm_insn ("move%.l %1,%-", xoperands);
1035 output_asm_insn ("move%.l %1,%-", operands);
1036 return "fmove%.d %+,%0";
1038 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1039 return output_move_const_double (operands);
1040 return "fmove%.d %f1,%0";
1042 else if (FP_REG_P (operands[1]))
1044 if (REG_P (operands[0]))
1046 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
1047 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1048 return "move%.l %+,%0";
1051 return "fmove%.d %f1,%0";
1053 return output_move_double (operands);
1057 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,g")
1058 (match_operand:DI 1 "general_operand" "g,r"))]
1060 "* return output_move_double (operands);")
1062 ;; Thus goes after the move instructions
1063 ;; because the move instructions are better (require no spilling)
1064 ;; when they can apply. It goes before the add/sub insns
1065 ;; so we will prefer it to them.
1067 (define_insn "pushasi"
1068 [(set (match_operand:SI 0 "push_operand" "=m")
1069 (match_operand:SI 1 "address_operand" "p"))]
1073 ;; truncation instructions
1074 (define_insn "truncsiqi2"
1075 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,d")
1077 (match_operand:SI 1 "general_src_operand" "doJS,i")))]
1080 if (GET_CODE (operands[0]) == REG)
1082 /* Must clear condition codes, since the move.l bases them on
1083 the entire 32 bits, not just the desired 8 bits. */
1085 return "move%.l %1,%0";
1087 if (GET_CODE (operands[1]) == MEM)
1088 operands[1] = adjust_address (operands[1], QImode, 3);
1089 return "move%.b %1,%0";
1092 (define_insn "trunchiqi2"
1093 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,d")
1095 (match_operand:HI 1 "general_src_operand" "doJS,i")))]
1098 if (GET_CODE (operands[0]) == REG
1099 && (GET_CODE (operands[1]) == MEM
1100 || GET_CODE (operands[1]) == CONST_INT))
1102 /* Must clear condition codes, since the move.w bases them on
1103 the entire 16 bits, not just the desired 8 bits. */
1105 return "move%.w %1,%0";
1107 if (GET_CODE (operands[0]) == REG)
1109 /* Must clear condition codes, since the move.l bases them on
1110 the entire 32 bits, not just the desired 8 bits. */
1112 return "move%.l %1,%0";
1114 if (GET_CODE (operands[1]) == MEM)
1115 operands[1] = adjust_address (operands[1], QImode, 1);
1116 return "move%.b %1,%0";
1119 (define_insn "truncsihi2"
1120 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm,d")
1122 (match_operand:SI 1 "general_src_operand" "roJS,i")))]
1125 if (GET_CODE (operands[0]) == REG)
1127 /* Must clear condition codes, since the move.l bases them on
1128 the entire 32 bits, not just the desired 8 bits. */
1130 return "move%.l %1,%0";
1132 if (GET_CODE (operands[1]) == MEM)
1133 operands[1] = adjust_address (operands[1], QImode, 2);
1134 return "move%.w %1,%0";
1137 ;; zero extension instructions
1139 ;; two special patterns to match various post_inc/pre_dec patterns
1140 (define_insn_and_split "*zero_extend_inc"
1141 [(set (match_operand 0 "post_inc_operand" "")
1142 (zero_extend (match_operand 1 "register_operand" "")))]
1143 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT &&
1144 GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT &&
1145 GET_MODE_SIZE (GET_MODE (operands[0])) == GET_MODE_SIZE (GET_MODE (operands[1])) * 2"
1153 operands[0] = adjust_address (operands[0], GET_MODE (operands[1]), 0);
1156 (define_insn_and_split "*zero_extend_dec"
1157 [(set (match_operand 0 "pre_dec_operand" "")
1158 (zero_extend (match_operand 1 "register_operand" "")))]
1159 "(GET_MODE (operands[0]) != HImode || XEXP (XEXP (operands[0], 0), 0) != stack_pointer_rtx) &&
1160 GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT &&
1161 GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT &&
1162 GET_MODE_SIZE (GET_MODE (operands[0])) == GET_MODE_SIZE (GET_MODE (operands[1])) * 2"
1170 operands[0] = adjust_address (operands[0], GET_MODE (operands[1]), 0);
1173 (define_insn_and_split "zero_extendqidi2"
1174 [(set (match_operand:DI 0 "register_operand" "")
1175 (zero_extend:DI (match_operand:QI 1 "nonimmediate_src_operand" "")))]
1180 (zero_extend:SI (match_dup 1)))
1184 operands[2] = gen_lowpart (SImode, operands[0]);
1185 operands[3] = gen_highpart (SImode, operands[0]);
1188 (define_insn_and_split "zero_extendhidi2"
1189 [(set (match_operand:DI 0 "register_operand" "")
1190 (zero_extend:DI (match_operand:HI 1 "nonimmediate_src_operand" "")))]
1195 (zero_extend:SI (match_dup 1)))
1199 operands[2] = gen_lowpart (SImode, operands[0]);
1200 operands[3] = gen_highpart (SImode, operands[0]);
1203 (define_expand "zero_extendsidi2"
1204 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1205 (zero_extend:DI (match_operand:SI 1 "nonimmediate_src_operand" "")))]
1209 (define_insn_and_split "*zero_extendsidi2"
1210 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1211 (zero_extend:DI (match_operand:SI 1 "nonimmediate_src_operand" "")))]
1212 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
1220 operands[2] = gen_lowpart (SImode, operands[0]);
1221 operands[3] = gen_highpart (SImode, operands[0]);
1224 (define_insn "*zero_extendhisi2_cf"
1225 [(set (match_operand:SI 0 "register_operand" "=d")
1226 (zero_extend:SI (match_operand:HI 1 "nonimmediate_src_operand" "rmS")))]
1230 (define_insn "zero_extendhisi2"
1231 [(set (match_operand:SI 0 "register_operand" "=d")
1232 (zero_extend:SI (match_operand:HI 1 "nonimmediate_src_operand" "rmS")))]
1236 (define_expand "zero_extendqihi2"
1237 [(set (match_operand:HI 0 "register_operand" "")
1238 (zero_extend:HI (match_operand:QI 1 "nonimmediate_src_operand" "")))]
1242 (define_insn "*zero_extendqihi2"
1243 [(set (match_operand:HI 0 "register_operand" "=d")
1244 (zero_extend:HI (match_operand:QI 1 "nonimmediate_src_operand" "dmS")))]
1248 (define_insn "*zero_extendqisi2_cfv4"
1249 [(set (match_operand:SI 0 "register_operand" "=d")
1250 (zero_extend:SI (match_operand:QI 1 "nonimmediate_src_operand" "dmS")))]
1254 (define_insn "zero_extendqisi2"
1255 [(set (match_operand:SI 0 "register_operand" "=d")
1256 (zero_extend:SI (match_operand:QI 1 "nonimmediate_src_operand" "dmS")))]
1260 ;; these two pattern split everything else which isn't matched by
1261 ;; something else above
1263 [(set (match_operand 0 "register_operand" "")
1264 (zero_extend (match_operand 1 "nonimmediate_src_operand" "")))]
1265 "!TARGET_CFV4 && reload_completed && reg_mentioned_p (operands[0], operands[1])"
1266 [(set (strict_low_part (match_dup 2))
1269 (match_op_dup 4 [(match_dup 0) (match_dup 3)]))]
1271 operands[2] = gen_lowpart (GET_MODE (operands[1]), operands[0]);
1272 operands[3] = GEN_INT (GET_MODE_MASK (GET_MODE (operands[1])));
1273 operands[4] = gen_rtx_AND (GET_MODE (operands[0]), operands[0], operands[3]);
1277 [(set (match_operand 0 "register_operand" "")
1278 (zero_extend (match_operand 1 "nonimmediate_src_operand" "")))]
1279 "!TARGET_CFV4 && reload_completed"
1282 (set (strict_low_part (match_dup 2))
1285 operands[2] = gen_lowpart (GET_MODE (operands[1]), operands[0]);
1288 ;; sign extension instructions
1290 (define_insn "extendqidi2"
1291 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
1292 (sign_extend:DI (match_operand:QI 1 "general_src_operand" "rmS")))]
1296 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1298 return "mvs%.b %1,%2\;smi %0\;extb%.l %0";
1299 if (TARGET_68020 || TARGET_COLDFIRE)
1300 return "move%.b %1,%2\;extb%.l %2\;smi %0\;extb%.l %0";
1302 return "move%.b %1,%2\;ext%.w %0\;ext%.l %2\;move%.l %2,%0\;smi %0";
1305 (define_insn "extendhidi2"
1306 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
1308 (match_operand:HI 1 "general_src_operand" "rmS")))]
1312 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1314 return "mvs%.w %1,%2\;smi %0\;extb%.l %0";
1315 if (TARGET_68020 || TARGET_COLDFIRE)
1316 return "move%.w %1,%2\;ext%.l %2\;smi %0\;extb%.l %0";
1318 return "move%.w %1,%2\;ext%.l %2\;smi %0\;ext%.w %0\;ext%.l %0";
1321 (define_insn "extendsidi2"
1322 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
1324 (match_operand:SI 1 "general_operand" "rm")))]
1328 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1329 if (TARGET_68020 || TARGET_COLDFIRE)
1330 return "move%.l %1,%2\;smi %0\;extb%.l %0";
1332 return "move%.l %1,%2\;smi %0\;ext%.w %0\;ext%.l %0";
1335 ;; Special case when one can avoid register clobbering, copy and test
1336 ;; Maybe there is a way to make that the general case, by forcing the
1337 ;; result of the SI tree to be in the lower register of the DI target
1339 (define_insn "extendplussidi"
1340 [(set (match_operand:DI 0 "register_operand" "=d")
1341 (sign_extend:DI (plus:SI (match_operand:SI 1 "general_operand" "%rmn")
1342 (match_operand:SI 2 "general_operand" "rmn"))))]
1346 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1347 if (GET_CODE (operands[1]) == CONST_INT
1348 && (unsigned) INTVAL (operands[1]) > 8)
1350 rtx tmp = operands[1];
1352 operands[1] = operands[2];
1355 if (GET_CODE (operands[1]) == REG
1356 && REGNO (operands[1]) == REGNO (operands[3]))
1357 output_asm_insn ("add%.l %2,%3", operands);
1359 output_asm_insn ("move%.l %2,%3\;add%.l %1,%3", operands);
1360 if (TARGET_68020 || TARGET_COLDFIRE)
1361 return "smi %0\;extb%.l %0";
1363 return "smi %0\;ext%.w %0\;ext%.l %0";
1366 (define_expand "extendhisi2"
1367 [(set (match_operand:SI 0 "nonimmediate_operand" "")
1369 (match_operand:HI 1 "nonimmediate_src_operand" "")))]
1373 (define_insn "*cfv4_extendhisi2"
1374 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
1376 (match_operand:HI 1 "nonimmediate_src_operand" "rmS")))]
1380 (define_insn "*68k_extendhisi2"
1381 [(set (match_operand:SI 0 "nonimmediate_operand" "=*d,a")
1383 (match_operand:HI 1 "nonimmediate_src_operand" "0,rmS")))]
1386 if (ADDRESS_REG_P (operands[0]))
1387 return "move%.w %1,%0";
1391 (define_insn "extendqihi2"
1392 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
1393 (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0")))]
1397 (define_expand "extendqisi2"
1398 [(set (match_operand:SI 0 "nonimmediate_operand" "")
1399 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
1400 "TARGET_68020 || TARGET_COLDFIRE"
1403 (define_insn "*cfv4_extendqisi2"
1404 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
1405 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "rms")))]
1409 (define_insn "*68k_extendqisi2"
1410 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
1411 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "0")))]
1412 "TARGET_68020 || (TARGET_COLDFIRE && !TARGET_CFV4)"
1415 ;; Conversions between float and double.
1417 (define_expand "extendsfdf2"
1418 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1420 (match_operand:SF 1 "general_operand" "")))]
1425 [(set (match_operand:DF 0 "nonimmediate_operand" "=*fdm,f")
1427 (match_operand:SF 1 "general_operand" "f,dmF")))]
1430 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
1432 if (REGNO (operands[0]) == REGNO (operands[1]))
1434 /* Extending float to double in an fp-reg is a no-op.
1435 NOTICE_UPDATE_CC has already assumed that the
1436 cc will be set. So cancel what it did. */
1437 cc_status = cc_prev_status;
1440 return "f%&move%.x %1,%0";
1442 if (FP_REG_P (operands[0]))
1443 return "f%&move%.s %f1,%0";
1444 if (DATA_REG_P (operands[0]) && FP_REG_P (operands[1]))
1446 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
1447 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1448 return "move%.l %+,%0";
1450 return "fmove%.d %f1,%0";
1453 ;; This cannot output into an f-reg because there is no way to be
1454 ;; sure of truncating in that case.
1455 (define_expand "truncdfsf2"
1456 [(set (match_operand:SF 0 "nonimmediate_operand" "")
1458 (match_operand:DF 1 "general_operand" "")))]
1462 ;; On the '040 we can truncate in a register accurately and easily.
1464 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
1466 (match_operand:DF 1 "general_operand" "fmG")))]
1467 "TARGET_68881 && TARGET_68040_ONLY"
1469 if (FP_REG_P (operands[1]))
1470 return "f%$move%.x %1,%0";
1471 return "f%$move%.d %f1,%0";
1475 [(set (match_operand:SF 0 "nonimmediate_operand" "=dm")
1477 (match_operand:DF 1 "general_operand" "f")))]
1481 ;; Conversion between fixed point and floating point.
1482 ;; Note that among the fix-to-float insns
1483 ;; the ones that start with SImode come first.
1484 ;; That is so that an operand that is a CONST_INT
1485 ;; (and therefore lacks a specific machine mode).
1486 ;; will be recognized as SImode (which is always valid)
1487 ;; rather than as QImode or HImode.
1489 (define_expand "floatsisf2"
1490 [(set (match_operand:SF 0 "nonimmediate_operand" "")
1491 (float:SF (match_operand:SI 1 "general_operand" "")))]
1496 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
1497 (float:SF (match_operand:SI 1 "general_operand" "dmi")))]
1501 (define_expand "floatsidf2"
1502 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1503 (float:DF (match_operand:SI 1 "general_operand" "")))]
1508 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
1509 (float:DF (match_operand:SI 1 "general_operand" "dmi")))]
1513 (define_insn "floathisf2"
1514 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
1515 (float:SF (match_operand:HI 1 "general_operand" "dmn")))]
1519 (define_insn "floathidf2"
1520 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
1521 (float:DF (match_operand:HI 1 "general_operand" "dmn")))]
1525 (define_insn "floatqisf2"
1526 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
1527 (float:SF (match_operand:QI 1 "general_operand" "dmn")))]
1531 (define_insn "floatqidf2"
1532 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
1533 (float:DF (match_operand:QI 1 "general_operand" "dmn")))]
1537 ;; New routines to convert floating-point values to integers
1538 ;; to be used on the '040. These should be faster than trapping
1539 ;; into the kernel to emulate fintrz. They should also be faster
1540 ;; than calling the subroutines fixsfsi or fixdfsi.
1542 (define_insn "fix_truncdfsi2"
1543 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
1544 (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
1545 (clobber (match_scratch:SI 2 "=d"))
1546 (clobber (match_scratch:SI 3 "=d"))]
1547 "TARGET_68881 && TARGET_68040"
1550 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,%!";
1553 (define_insn "fix_truncdfhi2"
1554 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
1555 (fix:HI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
1556 (clobber (match_scratch:SI 2 "=d"))
1557 (clobber (match_scratch:SI 3 "=d"))]
1558 "TARGET_68881 && TARGET_68040"
1561 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,%!";
1564 (define_insn "fix_truncdfqi2"
1565 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
1566 (fix:QI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
1567 (clobber (match_scratch:SI 2 "=d"))
1568 (clobber (match_scratch:SI 3 "=d"))]
1569 "TARGET_68881 && TARGET_68040"
1572 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,%!";
1575 ;; Convert a float to a float whose value is an integer.
1576 ;; This is the first stage of converting it to an integer type.
1578 (define_insn "ftruncdf2"
1579 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
1580 (fix:DF (match_operand:DF 1 "general_operand" "fFm")))]
1581 "TARGET_68881 && !TARGET_68040"
1583 if (FP_REG_P (operands[1]))
1584 return "fintrz%.x %f1,%0";
1585 return "fintrz%.d %f1,%0";
1588 (define_insn "ftruncsf2"
1589 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
1590 (fix:SF (match_operand:SF 1 "general_operand" "dfFm")))]
1591 "TARGET_68881 && !TARGET_68040"
1593 if (FP_REG_P (operands[1]))
1594 return "fintrz%.x %f1,%0";
1595 return "fintrz%.s %f1,%0";
1598 ;; Convert a float whose value is an integer
1599 ;; to an actual integer. Second stage of converting float to integer type.
1600 (define_insn "fixsfqi2"
1601 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
1602 (fix:QI (match_operand:SF 1 "general_operand" "f")))]
1606 (define_insn "fixsfhi2"
1607 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
1608 (fix:HI (match_operand:SF 1 "general_operand" "f")))]
1612 (define_insn "fixsfsi2"
1613 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
1614 (fix:SI (match_operand:SF 1 "general_operand" "f")))]
1618 (define_insn "fixdfqi2"
1619 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
1620 (fix:QI (match_operand:DF 1 "general_operand" "f")))]
1624 (define_insn "fixdfhi2"
1625 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
1626 (fix:HI (match_operand:DF 1 "general_operand" "f")))]
1630 (define_insn "fixdfsi2"
1631 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
1632 (fix:SI (match_operand:DF 1 "general_operand" "f")))]
1638 (define_insn "adddi_lshrdi_63"
1639 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
1640 (plus:DI (lshiftrt:DI (match_operand:DI 1 "general_operand" "rm")
1643 (clobber (match_scratch:SI 2 "=d"))]
1646 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1647 if (REG_P (operands[1]) && REGNO (operands[1]) == REGNO (operands[0]))
1649 "move%.l %1,%2\;add%.l %2,%2\;subx%.l %2,%2\;sub%.l %2,%3\;subx%.l %2,%0";
1650 if (GET_CODE (operands[1]) == REG)
1651 operands[4] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1652 else if (GET_CODE (XEXP (operands[1], 0)) == POST_INC
1653 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
1654 operands[4] = operands[1];
1656 operands[4] = adjust_address (operands[1], SImode, 4);
1657 if (GET_CODE (operands[1]) == MEM
1658 && GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
1659 output_asm_insn ("move%.l %4,%3", operands);
1660 output_asm_insn ("move%.l %1,%0\;smi %2", operands);
1661 if (TARGET_68020 || TARGET_COLDFIRE)
1662 output_asm_insn ("extb%.l %2", operands);
1664 output_asm_insn ("ext%.w %2\;ext%.l %2", operands);
1665 if (GET_CODE (operands[1]) != MEM
1666 || GET_CODE (XEXP (operands[1], 0)) != PRE_DEC)
1667 output_asm_insn ("move%.l %4,%3", operands);
1668 return "sub%.l %2,%3\;subx%.l %2,%0";
1671 (define_insn "adddi_sexthishl32"
1672 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,a,*d,*d")
1673 (plus:DI (ashift:DI (sign_extend:DI
1674 (match_operand:HI 1 "general_operand" "rm,rm,rm,rm"))
1676 (match_operand:DI 2 "general_operand" "0,0,0,0")))
1677 (clobber (match_scratch:SI 3 "=&d,X,a,?d"))]
1681 if (ADDRESS_REG_P (operands[0]))
1682 return "add%.w %1,%0";
1683 else if (ADDRESS_REG_P (operands[3]))
1684 return "move%.w %1,%3\;add%.l %3,%0";
1686 return "move%.w %1,%3\;ext%.l %3\;add%.l %3,%0";
1689 (define_insn "adddi_dilshr32"
1690 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,o")
1691 ;; (plus:DI (match_operand:DI 2 "general_operand" "%0")
1692 ;; (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro")
1693 ;; (const_int 32))))]
1694 (plus:DI (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro,d")
1696 (match_operand:DI 2 "general_operand" "0,0")))]
1700 if (GET_CODE (operands[0]) == REG)
1701 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1703 operands[2] = adjust_address (operands[0], SImode, 4);
1704 return "add%.l %1,%2\;negx%.l %0\;neg%.l %0";
1707 (define_insn "adddi_dishl32"
1708 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o")
1709 ;; (plus:DI (match_operand:DI 2 "general_operand" "%0")
1710 ;; (ashift:DI (match_operand:DI 1 "general_operand" "ro")
1711 ;; (const_int 32))))]
1712 (plus:DI (ashift:DI (match_operand:DI 1 "general_operand" "ro,d")
1714 (match_operand:DI 2 "general_operand" "0,0")))]
1718 if (GET_CODE (operands[1]) == REG)
1719 operands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1721 operands[1] = adjust_address (operands[1], SImode, 4);
1722 return "add%.l %1,%0";
1725 (define_insn "adddi3"
1726 [(set (match_operand:DI 0 "nonimmediate_operand" "=<,o<>,d,d,d")
1727 (plus:DI (match_operand:DI 1 "general_operand" "%0,0,0,0,0")
1728 (match_operand:DI 2 "general_operand" "<,d,no>,d,a")))
1729 (clobber (match_scratch:SI 3 "=X,&d,&d,X,&d"))]
1732 if (DATA_REG_P (operands[0]))
1734 if (DATA_REG_P (operands[2]))
1735 return "add%.l %R2,%R0\;addx%.l %2,%0";
1736 else if (GET_CODE (operands[2]) == MEM
1737 && GET_CODE (XEXP (operands[2], 0)) == POST_INC)
1738 return "move%.l %2,%3\;add%.l %2,%R0\;addx%.l %3,%0";
1744 if (GET_CODE (operands[2]) == REG)
1746 low = gen_rtx_REG (SImode, REGNO (operands[2]) + 1);
1749 else if (CONSTANT_P (operands[2]))
1750 split_double (operands[2], &high, &low);
1753 low = adjust_address (operands[2], SImode, 4);
1757 operands[1] = low, operands[2] = high;
1758 xoperands[0] = operands[3];
1759 if (GET_CODE (operands[1]) == CONST_INT
1760 && INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
1761 xoperands[1] = GEN_INT (-INTVAL (operands[2]) - 1);
1763 xoperands[1] = operands[2];
1765 output_asm_insn (output_move_simode (xoperands), xoperands);
1766 if (GET_CODE (operands[1]) == CONST_INT)
1768 if (INTVAL (operands[1]) > 0 && INTVAL (operands[1]) <= 8)
1769 return "addq%.l %1,%R0\;addx%.l %3,%0";
1770 else if (INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
1772 operands[1] = GEN_INT (-INTVAL (operands[1]));
1773 return "subq%.l %1,%R0\;subx%.l %3,%0";
1776 return "add%.l %1,%R0\;addx%.l %3,%0";
1779 else if (GET_CODE (operands[0]) == MEM)
1781 if (GET_CODE (operands[2]) == MEM
1782 && GET_CODE (XEXP (operands[2], 0)) == PRE_DEC)
1783 return "add%.l %2,%0\;addx%.l %2,%0";
1785 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
1787 operands[1] = gen_rtx_MEM (SImode,
1788 plus_constant (XEXP(operands[0], 0), -8));
1789 return "move%.l %0,%3\;add%.l %R2,%0\;addx%.l %2,%3\;move%.l %3,%1";
1791 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
1793 operands[1] = XEXP(operands[0], 0);
1794 return "add%.l %R2,%0\;move%.l %0,%3\;addx%.l %2,%3\;move%.l %3,%1";
1798 operands[1] = adjust_address (operands[0], SImode, 4);
1799 return "add%.l %R2,%1\;move%.l %0,%3\;addx%.l %2,%3\;move%.l %3,%0";
1806 (define_insn "addsi_lshrsi_31"
1807 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
1808 (plus:SI (lshiftrt:SI (match_operand:SI 1 "general_operand" "rm")
1813 operands[2] = operands[0];
1814 operands[3] = gen_label_rtx();
1815 if (GET_CODE (operands[0]) == MEM)
1817 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
1818 operands[0] = gen_rtx_MEM (SImode, XEXP (XEXP (operands[0], 0), 0));
1819 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
1820 operands[2] = gen_rtx_MEM (SImode, XEXP (XEXP (operands[0], 0), 0));
1822 output_asm_insn ("move%.l %1,%0", operands);
1823 output_asm_insn (MOTOROLA ? "jbpl %l3" : "jpl %l3", operands);
1824 output_asm_insn ("addq%.l #1,%2", operands);
1825 (*targetm.asm_out.internal_label) (asm_out_file, "L",
1826 CODE_LABEL_NUMBER (operands[3]));
1830 (define_expand "addsi3"
1831 [(set (match_operand:SI 0 "nonimmediate_operand" "")
1832 (plus:SI (match_operand:SI 1 "general_operand" "")
1833 (match_operand:SI 2 "general_src_operand" "")))]
1837 ;; Note that the middle two alternatives are near-duplicates
1838 ;; in order to handle insns generated by reload.
1839 ;; This is needed since they are not themselves reloaded,
1840 ;; so commutativity won't apply to them.
1841 (define_insn "*addsi3_internal"
1842 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,?a,?a,d,a")
1843 (plus:SI (match_operand:SI 1 "general_operand" "%0,a,rJK,0,0")
1844 (match_operand:SI 2 "general_src_operand" "dIKLT,rJK,a,mSrIKLT,mSrIKLs")))]
1848 "* return output_addsi3 (operands);")
1850 (define_insn "*addsi3_5200"
1851 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,?a,?a,r")
1852 (plus:SI (match_operand:SI 1 "general_operand" "%0,a,rJK,0")
1853 (match_operand:SI 2 "general_src_operand" "d,rJK,a,mrIKLs")))]
1855 "* return output_addsi3 (operands);")
1858 [(set (match_operand:SI 0 "nonimmediate_operand" "=a")
1859 (plus:SI (match_operand:SI 1 "general_operand" "0")
1861 (match_operand:HI 2 "nonimmediate_src_operand" "rmS"))))]
1865 (define_insn "addhi3"
1866 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,r")
1867 (plus:HI (match_operand:HI 1 "general_operand" "%0,0")
1868 (match_operand:HI 2 "general_src_operand" "dn,rmSn")))]
1871 if (GET_CODE (operands[2]) == CONST_INT)
1873 /* If the constant would be a negative number when interpreted as
1874 HImode, make it negative. This is usually, but not always, done
1875 elsewhere in the compiler. First check for constants out of range,
1876 which could confuse us. */
1878 if (INTVAL (operands[2]) >= 32768)
1879 operands[2] = GEN_INT (INTVAL (operands[2]) - 65536);
1881 if (INTVAL (operands[2]) > 0
1882 && INTVAL (operands[2]) <= 8)
1883 return "addq%.w %2,%0";
1884 if (INTVAL (operands[2]) < 0
1885 && INTVAL (operands[2]) >= -8)
1887 operands[2] = GEN_INT (- INTVAL (operands[2]));
1888 return "subq%.w %2,%0";
1890 /* On the CPU32 it is faster to use two addqw instructions to
1891 add a small integer (8 < N <= 16) to a register.
1892 Likewise for subqw. */
1893 if (TARGET_CPU32 && REG_P (operands[0]))
1895 if (INTVAL (operands[2]) > 8
1896 && INTVAL (operands[2]) <= 16)
1898 operands[2] = GEN_INT (INTVAL (operands[2]) - 8);
1899 return "addq%.w #8,%0\;addq%.w %2,%0";
1901 if (INTVAL (operands[2]) < -8
1902 && INTVAL (operands[2]) >= -16)
1904 operands[2] = GEN_INT (- INTVAL (operands[2]) - 8);
1905 return "subq%.w #8,%0\;subq%.w %2,%0";
1908 if (ADDRESS_REG_P (operands[0]) && !TARGET_68040)
1909 return MOTOROLA ? "lea (%c2,%0),%0" : "lea %0@(%c2),%0";
1911 return "add%.w %2,%0";
1914 ;; These insns must use MATCH_DUP instead of the more expected
1915 ;; use of a matching constraint because the "output" here is also
1916 ;; an input, so you can't use the matching constraint. That also means
1917 ;; that you can't use the "%", so you need patterns with the matched
1918 ;; operand in both positions.
1921 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
1922 (plus:HI (match_dup 0)
1923 (match_operand:HI 1 "general_src_operand" "dn,rmSn")))]
1926 if (GET_CODE (operands[1]) == CONST_INT)
1928 /* If the constant would be a negative number when interpreted as
1929 HImode, make it negative. This is usually, but not always, done
1930 elsewhere in the compiler. First check for constants out of range,
1931 which could confuse us. */
1933 if (INTVAL (operands[1]) >= 32768)
1934 operands[1] = GEN_INT (INTVAL (operands[1]) - 65536);
1936 if (INTVAL (operands[1]) > 0
1937 && INTVAL (operands[1]) <= 8)
1938 return "addq%.w %1,%0";
1939 if (INTVAL (operands[1]) < 0
1940 && INTVAL (operands[1]) >= -8)
1942 operands[1] = GEN_INT (- INTVAL (operands[1]));
1943 return "subq%.w %1,%0";
1945 /* On the CPU32 it is faster to use two addqw instructions to
1946 add a small integer (8 < N <= 16) to a register.
1947 Likewise for subqw. */
1948 if (TARGET_CPU32 && REG_P (operands[0]))
1950 if (INTVAL (operands[1]) > 8
1951 && INTVAL (operands[1]) <= 16)
1953 operands[1] = GEN_INT (INTVAL (operands[1]) - 8);
1954 return "addq%.w #8,%0\;addq%.w %1,%0";
1956 if (INTVAL (operands[1]) < -8
1957 && INTVAL (operands[1]) >= -16)
1959 operands[1] = GEN_INT (- INTVAL (operands[1]) - 8);
1960 return "subq%.w #8,%0\;subq%.w %1,%0";
1963 if (ADDRESS_REG_P (operands[0]) && !TARGET_68040)
1964 return MOTOROLA ? "lea (%c1,%0),%0" : "lea %0@(%c1),%0";
1966 return "add%.w %1,%0";
1970 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
1971 (plus:HI (match_operand:HI 1 "general_src_operand" "dn,rmSn")
1975 if (GET_CODE (operands[1]) == CONST_INT)
1977 /* If the constant would be a negative number when interpreted as
1978 HImode, make it negative. This is usually, but not always, done
1979 elsewhere in the compiler. First check for constants out of range,
1980 which could confuse us. */
1982 if (INTVAL (operands[1]) >= 32768)
1983 operands[1] = GEN_INT (INTVAL (operands[1]) - 65536);
1985 if (INTVAL (operands[1]) > 0
1986 && INTVAL (operands[1]) <= 8)
1987 return "addq%.w %1,%0";
1988 if (INTVAL (operands[1]) < 0
1989 && INTVAL (operands[1]) >= -8)
1991 operands[1] = GEN_INT (- INTVAL (operands[1]));
1992 return "subq%.w %1,%0";
1994 /* On the CPU32 it is faster to use two addqw instructions to
1995 add a small integer (8 < N <= 16) to a register.
1996 Likewise for subqw. */
1997 if (TARGET_CPU32 && REG_P (operands[0]))
1999 if (INTVAL (operands[1]) > 8
2000 && INTVAL (operands[1]) <= 16)
2002 operands[1] = GEN_INT (INTVAL (operands[1]) - 8);
2003 return "addq%.w #8,%0\;addq%.w %1,%0";
2005 if (INTVAL (operands[1]) < -8
2006 && INTVAL (operands[1]) >= -16)
2008 operands[1] = GEN_INT (- INTVAL (operands[1]) - 8);
2009 return "subq%.w #8,%0\;subq%.w %1,%0";
2012 if (ADDRESS_REG_P (operands[0]) && !TARGET_68040)
2013 return MOTOROLA ? "lea (%c1,%0),%0" : "lea %0@(%c1),%0";
2015 return "add%.w %1,%0";
2018 (define_insn "addqi3"
2019 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
2020 (plus:QI (match_operand:QI 1 "general_operand" "%0,0")
2021 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
2024 if (GET_CODE (operands[2]) == CONST_INT)
2026 if (INTVAL (operands[2]) >= 128)
2027 operands[2] = GEN_INT (INTVAL (operands[2]) - 256);
2029 if (INTVAL (operands[2]) > 0
2030 && INTVAL (operands[2]) <= 8)
2031 return "addq%.b %2,%0";
2032 if (INTVAL (operands[2]) < 0 && INTVAL (operands[2]) >= -8)
2034 operands[2] = GEN_INT (- INTVAL (operands[2]));
2035 return "subq%.b %2,%0";
2038 return "add%.b %2,%0";
2042 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
2043 (plus:QI (match_dup 0)
2044 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
2047 if (GET_CODE (operands[1]) == CONST_INT)
2049 if (INTVAL (operands[1]) >= 128)
2050 operands[1] = GEN_INT (INTVAL (operands[1]) - 256);
2052 if (INTVAL (operands[1]) > 0
2053 && INTVAL (operands[1]) <= 8)
2054 return "addq%.b %1,%0";
2055 if (INTVAL (operands[1]) < 0 && INTVAL (operands[1]) >= -8)
2057 operands[1] = GEN_INT (- INTVAL (operands[1]));
2058 return "subq%.b %1,%0";
2061 return "add%.b %1,%0";
2065 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
2066 (plus:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn")
2070 if (GET_CODE (operands[1]) == CONST_INT)
2072 if (INTVAL (operands[1]) >= 128)
2073 operands[1] = GEN_INT (INTVAL (operands[1]) - 256);
2075 if (INTVAL (operands[1]) > 0
2076 && INTVAL (operands[1]) <= 8)
2077 return "addq%.b %1,%0";
2078 if (INTVAL (operands[1]) < 0 && INTVAL (operands[1]) >= -8)
2080 operands[1] = GEN_INT (- INTVAL (operands[1]));
2081 return "subq%.b %1,%0";
2084 return "add%.b %1,%0";
2087 (define_expand "adddf3"
2088 [(set (match_operand:DF 0 "nonimmediate_operand" "")
2089 (plus:DF (match_operand:DF 1 "general_operand" "")
2090 (match_operand:DF 2 "general_operand" "")))]
2095 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2096 (plus:DF (float:DF (match_operand:SI 2 "general_operand" "dmi"))
2097 (match_operand:DF 1 "general_operand" "0")))]
2102 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2103 (plus:DF (float:DF (match_operand:HI 2 "general_operand" "dmn"))
2104 (match_operand:DF 1 "general_operand" "0")))]
2109 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2110 (plus:DF (float:DF (match_operand:QI 2 "general_operand" "dmn"))
2111 (match_operand:DF 1 "general_operand" "0")))]
2116 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2117 (plus:DF (match_operand:DF 1 "general_operand" "%0")
2118 (match_operand:DF 2 "general_operand" "fmG")))]
2121 if (REG_P (operands[2]))
2122 return "f%&add%.x %2,%0";
2123 return "f%&add%.d %f2,%0";
2126 (define_expand "addsf3"
2127 [(set (match_operand:SF 0 "nonimmediate_operand" "")
2128 (plus:SF (match_operand:SF 1 "general_operand" "")
2129 (match_operand:SF 2 "general_operand" "")))]
2134 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2135 (plus:SF (float:SF (match_operand:SI 2 "general_operand" "dmi"))
2136 (match_operand:SF 1 "general_operand" "0")))]
2141 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2142 (plus:SF (float:SF (match_operand:HI 2 "general_operand" "dmn"))
2143 (match_operand:SF 1 "general_operand" "0")))]
2148 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2149 (plus:SF (float:SF (match_operand:QI 2 "general_operand" "dmn"))
2150 (match_operand:SF 1 "general_operand" "0")))]
2155 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2156 (plus:SF (match_operand:SF 1 "general_operand" "%0")
2157 (match_operand:SF 2 "general_operand" "fdmF")))]
2160 if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
2161 return "f%$add%.x %2,%0";
2162 return "f%$add%.s %f2,%0";
2165 ;; subtract instructions
2167 (define_insn "subdi_sexthishl32"
2168 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,a,*d,*d")
2169 (minus:DI (match_operand:DI 1 "general_operand" "0,0,0,0")
2170 (ashift:DI (sign_extend:DI (match_operand:HI 2 "general_operand" "rm,rm,rm,rm"))
2172 (clobber (match_scratch:SI 3 "=&d,X,a,?d"))]
2176 if (ADDRESS_REG_P (operands[0]))
2177 return "sub%.w %2,%0";
2178 else if (ADDRESS_REG_P (operands[3]))
2179 return "move%.w %2,%3\;sub%.l %3,%0";
2181 return "move%.w %2,%3\;ext%.l %3\;sub%.l %3,%0";
2184 (define_insn "subdi_dishl32"
2185 [(set (match_operand:DI 0 "nonimmediate_operand" "+ro")
2186 (minus:DI (match_dup 0)
2187 (ashift:DI (match_operand:DI 1 "general_operand" "ro")
2192 if (GET_CODE (operands[1]) == REG)
2193 operands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
2195 operands[1] = adjust_address (operands[1], SImode, 4);
2196 return "sub%.l %1,%0";
2199 (define_insn "subdi3"
2200 [(set (match_operand:DI 0 "nonimmediate_operand" "=<,o<>,d,d,d")
2201 (minus:DI (match_operand:DI 1 "general_operand" "0,0,0,0,0")
2202 (match_operand:DI 2 "general_operand" "<,d,no>,d,a")))
2203 (clobber (match_scratch:SI 3 "=X,&d,&d,X,&d"))]
2206 if (DATA_REG_P (operands[0]))
2208 if (DATA_REG_P (operands[2]))
2209 return "sub%.l %R2,%R0\;subx%.l %2,%0";
2210 else if (GET_CODE (operands[2]) == MEM
2211 && GET_CODE (XEXP (operands[2], 0)) == POST_INC)
2213 return "move%.l %2,%3\;sub%.l %2,%R0\;subx%.l %3,%0";
2220 if (GET_CODE (operands[2]) == REG)
2222 low = gen_rtx_REG (SImode, REGNO (operands[2]) + 1);
2225 else if (CONSTANT_P (operands[2]))
2226 split_double (operands[2], &high, &low);
2229 low = adjust_address (operands[2], SImode, 4);
2233 operands[1] = low, operands[2] = high;
2234 xoperands[0] = operands[3];
2235 if (GET_CODE (operands[1]) == CONST_INT
2236 && INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
2237 xoperands[1] = GEN_INT (-INTVAL (operands[2]) - 1);
2239 xoperands[1] = operands[2];
2241 output_asm_insn (output_move_simode (xoperands), xoperands);
2242 if (GET_CODE (operands[1]) == CONST_INT)
2244 if (INTVAL (operands[1]) > 0 && INTVAL (operands[1]) <= 8)
2245 return "subq%.l %1,%R0\;subx%.l %3,%0";
2246 else if (INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
2248 operands[1] = GEN_INT (-INTVAL (operands[1]));
2249 return "addq%.l %1,%R0\;addx%.l %3,%0";
2252 return "sub%.l %1,%R0\;subx%.l %3,%0";
2255 else if (GET_CODE (operands[0]) == MEM)
2257 if (GET_CODE (operands[2]) == MEM
2258 && GET_CODE (XEXP (operands[2], 0)) == PRE_DEC)
2259 return "sub%.l %2,%0\;subx%.l %2,%0";
2261 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
2264 = gen_rtx_MEM (SImode, plus_constant (XEXP (operands[0], 0), -8));
2265 return "move%.l %0,%3\;sub%.l %R2,%0\;subx%.l %2,%3\;move%.l %3,%1";
2267 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
2269 operands[1] = XEXP(operands[0], 0);
2270 return "sub%.l %R2,%0\;move%.l %0,%3\;subx%.l %2,%3\;move%.l %3,%1";
2274 operands[1] = adjust_address (operands[0], SImode, 4);
2275 return "sub%.l %R2,%1\;move%.l %0,%3\;subx%.l %2,%3\;move%.l %3,%0";
2282 (define_insn "subsi3"
2283 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,d,a")
2284 (minus:SI (match_operand:SI 1 "general_operand" "0,0,0")
2285 (match_operand:SI 2 "general_src_operand" "dT,mSrT,mSrs")))]
2290 [(set (match_operand:SI 0 "nonimmediate_operand" "=a")
2291 (minus:SI (match_operand:SI 1 "general_operand" "0")
2293 (match_operand:HI 2 "nonimmediate_src_operand" "rmS"))))]
2297 (define_insn "subhi3"
2298 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,r")
2299 (minus:HI (match_operand:HI 1 "general_operand" "0,0")
2300 (match_operand:HI 2 "general_src_operand" "dn,rmSn")))]
2305 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
2306 (minus:HI (match_dup 0)
2307 (match_operand:HI 1 "general_src_operand" "dn,rmSn")))]
2311 (define_insn "subqi3"
2312 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
2313 (minus:QI (match_operand:QI 1 "general_operand" "0,0")
2314 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
2319 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
2320 (minus:QI (match_dup 0)
2321 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
2325 (define_expand "subdf3"
2326 [(set (match_operand:DF 0 "nonimmediate_operand" "")
2327 (minus:DF (match_operand:DF 1 "general_operand" "")
2328 (match_operand:DF 2 "general_operand" "")))]
2333 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2334 (minus:DF (match_operand:DF 1 "general_operand" "0")
2335 (float:DF (match_operand:SI 2 "general_operand" "dmi"))))]
2340 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2341 (minus:DF (match_operand:DF 1 "general_operand" "0")
2342 (float:DF (match_operand:HI 2 "general_operand" "dmn"))))]
2347 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2348 (minus:DF (match_operand:DF 1 "general_operand" "0")
2349 (float:DF (match_operand:QI 2 "general_operand" "dmn"))))]
2354 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2355 (minus:DF (match_operand:DF 1 "general_operand" "0")
2356 (match_operand:DF 2 "general_operand" "fmG")))]
2359 if (REG_P (operands[2]))
2360 return "f%&sub%.x %2,%0";
2361 return "f%&sub%.d %f2,%0";
2364 (define_expand "subsf3"
2365 [(set (match_operand:SF 0 "nonimmediate_operand" "")
2366 (minus:SF (match_operand:SF 1 "general_operand" "")
2367 (match_operand:SF 2 "general_operand" "")))]
2372 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2373 (minus:SF (match_operand:SF 1 "general_operand" "0")
2374 (float:SF (match_operand:SI 2 "general_operand" "dmi"))))]
2379 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2380 (minus:SF (match_operand:SF 1 "general_operand" "0")
2381 (float:SF (match_operand:HI 2 "general_operand" "dmn"))))]
2386 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2387 (minus:SF (match_operand:SF 1 "general_operand" "0")
2388 (float:SF (match_operand:QI 2 "general_operand" "dmn"))))]
2393 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2394 (minus:SF (match_operand:SF 1 "general_operand" "0")
2395 (match_operand:SF 2 "general_operand" "fdmF")))]
2398 if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
2399 return "f%$sub%.x %2,%0";
2400 return "f%$sub%.s %f2,%0";
2403 ;; multiply instructions
2405 (define_insn "mulhi3"
2406 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
2407 (mult:HI (match_operand:HI 1 "general_operand" "%0")
2408 (match_operand:HI 2 "general_src_operand" "dmSn")))]
2411 return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0";
2414 (define_insn "mulhisi3"
2415 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2416 (mult:SI (sign_extend:SI
2417 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2419 (match_operand:HI 2 "nonimmediate_src_operand" "dmS"))))]
2422 return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0";
2426 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2427 (mult:SI (sign_extend:SI
2428 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2429 (match_operand:SI 2 "const_int_operand" "n")))]
2430 "INTVAL (operands[2]) >= -0x8000 && INTVAL (operands[2]) <= 0x7fff"
2432 return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0";
2435 (define_expand "mulsi3"
2436 [(set (match_operand:SI 0 "nonimmediate_operand" "")
2437 (mult:SI (match_operand:SI 1 "general_operand" "")
2438 (match_operand:SI 2 "general_operand" "")))]
2439 "TARGET_68020 || TARGET_COLDFIRE"
2443 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2444 (mult:SI (match_operand:SI 1 "general_operand" "%0")
2445 (match_operand:SI 2 "general_src_operand" "dmSTK")))]
2451 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2452 (mult:SI (match_operand:SI 1 "general_operand" "%0")
2453 (match_operand:SI 2 "general_operand" "d<Q>")))]
2457 (define_insn "umulhisi3"
2458 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2459 (mult:SI (zero_extend:SI
2460 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2462 (match_operand:HI 2 "nonimmediate_src_operand" "dmS"))))]
2465 return MOTOROLA ? "mulu%.w %2,%0" : "mulu %2,%0";
2469 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2470 (mult:SI (zero_extend:SI
2471 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2472 (match_operand:SI 2 "const_int_operand" "n")))]
2473 "INTVAL (operands[2]) >= 0 && INTVAL (operands[2]) <= 0xffff"
2475 return MOTOROLA ? "mulu%.w %2,%0" : "mulu %2,%0";
2478 ;; We need a separate DEFINE_EXPAND for u?mulsidi3 to be able to use the
2479 ;; proper matching constraint. This is because the matching is between
2480 ;; the high-numbered word of the DImode operand[0] and operand[1].
2481 (define_expand "umulsidi3"
2483 [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 4)
2484 (mult:SI (match_operand:SI 1 "register_operand" "")
2485 (match_operand:SI 2 "register_operand" "")))
2486 (set (subreg:SI (match_dup 0) 0)
2487 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
2488 (zero_extend:DI (match_dup 2)))
2489 (const_int 32))))])]
2490 "TARGET_68020 && !TARGET_68060 && !TARGET_COLDFIRE"
2494 [(set (match_operand:SI 0 "register_operand" "=d")
2495 (mult:SI (match_operand:SI 1 "register_operand" "%0")
2496 (match_operand:SI 2 "nonimmediate_operand" "dm")))
2497 (set (match_operand:SI 3 "register_operand" "=d")
2498 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
2499 (zero_extend:DI (match_dup 2)))
2501 "TARGET_68020 && !TARGET_68060 && !TARGET_COLDFIRE"
2504 ; Match immediate case. For 2.4 only match things < 2^31.
2505 ; It's tricky with larger values in these patterns since we need to match
2506 ; values between the two parallel multiplies, between a CONST_DOUBLE and
2509 [(set (match_operand:SI 0 "register_operand" "=d")
2510 (mult:SI (match_operand:SI 1 "register_operand" "%0")
2511 (match_operand:SI 2 "const_int_operand" "n")))
2512 (set (match_operand:SI 3 "register_operand" "=d")
2513 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
2516 "TARGET_68020 && !TARGET_68060 && !TARGET_COLDFIRE
2517 && (unsigned) INTVAL (operands[2]) <= 0x7fffffff"
2520 (define_expand "mulsidi3"
2522 [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 4)
2523 (mult:SI (match_operand:SI 1 "register_operand" "")
2524 (match_operand:SI 2 "register_operand" "")))
2525 (set (subreg:SI (match_dup 0) 0)
2526 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
2527 (sign_extend:DI (match_dup 2)))
2528 (const_int 32))))])]
2529 "TARGET_68020 && !TARGET_68060 && !TARGET_COLDFIRE"
2533 [(set (match_operand:SI 0 "register_operand" "=d")
2534 (mult:SI (match_operand:SI 1 "register_operand" "%0")
2535 (match_operand:SI 2 "nonimmediate_operand" "dm")))
2536 (set (match_operand:SI 3 "register_operand" "=d")
2537 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
2538 (sign_extend:DI (match_dup 2)))
2540 "TARGET_68020 && !TARGET_68060 && !TARGET_COLDFIRE"
2544 [(set (match_operand:SI 0 "register_operand" "=d")
2545 (mult:SI (match_operand:SI 1 "register_operand" "%0")
2546 (match_operand:SI 2 "const_int_operand" "n")))
2547 (set (match_operand:SI 3 "register_operand" "=d")
2548 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
2551 "TARGET_68020 && !TARGET_68060 && !TARGET_COLDFIRE"
2554 (define_expand "umulsi3_highpart"
2556 [(set (match_operand:SI 0 "register_operand" "")
2559 (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" ""))
2560 (zero_extend:DI (match_operand:SI 2 "general_operand" "")))
2562 (clobber (match_dup 3))])]
2563 "TARGET_68020 && !TARGET_68060 && !TARGET_COLDFIRE"
2565 operands[3] = gen_reg_rtx (SImode);
2567 if (GET_CODE (operands[2]) == CONST_INT)
2569 operands[2] = immed_double_const (INTVAL (operands[2]) & 0xffffffff,
2572 /* We have to adjust the operand order for the matching constraints. */
2573 emit_insn (gen_const_umulsi3_highpart (operands[0], operands[3],
2574 operands[1], operands[2]));
2580 [(set (match_operand:SI 0 "register_operand" "=d")
2583 (mult:DI (zero_extend:DI (match_operand:SI 2 "register_operand" "%1"))
2584 (zero_extend:DI (match_operand:SI 3 "nonimmediate_operand" "dm")))
2586 (clobber (match_operand:SI 1 "register_operand" "=d"))]
2587 "TARGET_68020 && !TARGET_68060 && !TARGET_COLDFIRE"
2590 (define_insn "const_umulsi3_highpart"
2591 [(set (match_operand:SI 0 "register_operand" "=d")
2594 (mult:DI (zero_extend:DI (match_operand:SI 2 "register_operand" "1"))
2595 (match_operand:DI 3 "const_uint32_operand" "n"))
2597 (clobber (match_operand:SI 1 "register_operand" "=d"))]
2598 "TARGET_68020 && !TARGET_68060 && !TARGET_COLDFIRE"
2601 (define_expand "smulsi3_highpart"
2603 [(set (match_operand:SI 0 "register_operand" "")
2606 (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" ""))
2607 (sign_extend:DI (match_operand:SI 2 "general_operand" "")))
2609 (clobber (match_dup 3))])]
2610 "TARGET_68020 && !TARGET_68060 && !TARGET_COLDFIRE"
2612 operands[3] = gen_reg_rtx (SImode);
2613 if (GET_CODE (operands[2]) == CONST_INT)
2615 /* We have to adjust the operand order for the matching constraints. */
2616 emit_insn (gen_const_smulsi3_highpart (operands[0], operands[3],
2617 operands[1], operands[2]));
2623 [(set (match_operand:SI 0 "register_operand" "=d")
2626 (mult:DI (sign_extend:DI (match_operand:SI 2 "register_operand" "%1"))
2627 (sign_extend:DI (match_operand:SI 3 "nonimmediate_operand" "dm")))
2629 (clobber (match_operand:SI 1 "register_operand" "=d"))]
2630 "TARGET_68020 && !TARGET_68060 && !TARGET_COLDFIRE"
2633 (define_insn "const_smulsi3_highpart"
2634 [(set (match_operand:SI 0 "register_operand" "=d")
2637 (mult:DI (sign_extend:DI (match_operand:SI 2 "register_operand" "1"))
2638 (match_operand:DI 3 "const_sint32_operand" "n"))
2640 (clobber (match_operand:SI 1 "register_operand" "=d"))]
2641 "TARGET_68020 && !TARGET_68060 && !TARGET_COLDFIRE"
2644 (define_expand "muldf3"
2645 [(set (match_operand:DF 0 "nonimmediate_operand" "")
2646 (mult:DF (match_operand:DF 1 "general_operand" "")
2647 (match_operand:DF 2 "general_operand" "")))]
2652 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2653 (mult:DF (float:DF (match_operand:SI 2 "general_operand" "dmi"))
2654 (match_operand:DF 1 "general_operand" "0")))]
2659 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2660 (mult:DF (float:DF (match_operand:HI 2 "general_operand" "dmn"))
2661 (match_operand:DF 1 "general_operand" "0")))]
2666 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2667 (mult:DF (float:DF (match_operand:QI 2 "general_operand" "dmn"))
2668 (match_operand:DF 1 "general_operand" "0")))]
2673 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2674 (mult:DF (match_operand:DF 1 "general_operand" "%0")
2675 (match_operand:DF 2 "general_operand" "fmG")))]
2678 if (GET_CODE (operands[2]) == CONST_DOUBLE
2679 && floating_exact_log2 (operands[2]) && !TARGET_68040 && !TARGET_68060)
2681 int i = floating_exact_log2 (operands[2]);
2682 operands[2] = GEN_INT (i);
2683 return "fscale%.l %2,%0";
2685 if (REG_P (operands[2]))
2686 return "f%&mul%.x %2,%0";
2687 return "f%&mul%.d %f2,%0";
2690 (define_expand "mulsf3"
2691 [(set (match_operand:SF 0 "nonimmediate_operand" "")
2692 (mult:SF (match_operand:SF 1 "general_operand" "")
2693 (match_operand:SF 2 "general_operand" "")))]
2698 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2699 (mult:SF (float:SF (match_operand:SI 2 "general_operand" "dmi"))
2700 (match_operand:SF 1 "general_operand" "0")))]
2703 return (TARGET_68040_ONLY
2705 : "fsglmul%.l %2,%0");
2709 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2710 (mult:SF (float:SF (match_operand:HI 2 "general_operand" "dmn"))
2711 (match_operand:SF 1 "general_operand" "0")))]
2714 return (TARGET_68040_ONLY
2716 : "fsglmul%.w %2,%0");
2720 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2721 (mult:SF (float:SF (match_operand:QI 2 "general_operand" "dmn"))
2722 (match_operand:SF 1 "general_operand" "0")))]
2725 return (TARGET_68040_ONLY
2727 : "fsglmul%.b %2,%0");
2731 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2732 (mult:SF (match_operand:SF 1 "general_operand" "%0")
2733 (match_operand:SF 2 "general_operand" "fdmF")))]
2736 if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
2737 return (TARGET_68040_ONLY
2739 : "fsglmul%.x %2,%0");
2740 return (TARGET_68040_ONLY
2742 : "fsglmul%.s %f2,%0");
2745 ;; divide instructions
2747 (define_expand "divdf3"
2748 [(set (match_operand:DF 0 "nonimmediate_operand" "")
2749 (div:DF (match_operand:DF 1 "general_operand" "")
2750 (match_operand:DF 2 "general_operand" "")))]
2755 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2756 (div:DF (match_operand:DF 1 "general_operand" "0")
2757 (float:DF (match_operand:SI 2 "general_operand" "dmi"))))]
2762 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2763 (div:DF (match_operand:DF 1 "general_operand" "0")
2764 (float:DF (match_operand:HI 2 "general_operand" "dmn"))))]
2769 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2770 (div:DF (match_operand:DF 1 "general_operand" "0")
2771 (float:DF (match_operand:QI 2 "general_operand" "dmn"))))]
2776 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2777 (div:DF (match_operand:DF 1 "general_operand" "0")
2778 (match_operand:DF 2 "general_operand" "fmG")))]
2781 if (REG_P (operands[2]))
2782 return "f%&div%.x %2,%0";
2783 return "f%&div%.d %f2,%0";
2786 (define_expand "divsf3"
2787 [(set (match_operand:SF 0 "nonimmediate_operand" "")
2788 (div:SF (match_operand:SF 1 "general_operand" "")
2789 (match_operand:SF 2 "general_operand" "")))]
2794 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2795 (div:SF (match_operand:SF 1 "general_operand" "0")
2796 (float:SF (match_operand:SI 2 "general_operand" "dmi"))))]
2799 return (TARGET_68040_ONLY
2801 : "fsgldiv%.l %2,%0");
2805 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2806 (div:SF (match_operand:SF 1 "general_operand" "0")
2807 (float:SF (match_operand:HI 2 "general_operand" "dmn"))))]
2810 return (TARGET_68040_ONLY
2812 : "fsgldiv%.w %2,%0");
2816 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2817 (div:SF (match_operand:SF 1 "general_operand" "0")
2818 (float:SF (match_operand:QI 2 "general_operand" "dmn"))))]
2821 return (TARGET_68040_ONLY
2823 : "fsgldiv%.b %2,%0");
2827 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2828 (div:SF (match_operand:SF 1 "general_operand" "0")
2829 (match_operand:SF 2 "general_operand" "fdmF")))]
2832 if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
2833 return (TARGET_68040_ONLY
2835 : "fsgldiv%.x %2,%0");
2836 return (TARGET_68040_ONLY
2838 : "fsgldiv%.s %f2,%0");
2841 ;; Remainder instructions.
2843 (define_expand "divmodsi4"
2845 [(set (match_operand:SI 0 "nonimmediate_operand" "")
2846 (div:SI (match_operand:SI 1 "general_operand" "")
2847 (match_operand:SI 2 "general_src_operand" "")))
2848 (set (match_operand:SI 3 "nonimmediate_operand" "")
2849 (mod:SI (match_dup 1) (match_dup 2)))])]
2850 "TARGET_68020 || TARGET_CF_HWDIV"
2854 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2855 (div:SI (match_operand:SI 1 "general_operand" "0")
2856 (match_operand:SI 2 "general_src_operand" "d<Q>U")))
2857 (set (match_operand:SI 3 "nonimmediate_operand" "=&d")
2858 (mod:SI (match_dup 1) (match_dup 2)))]
2861 if (find_reg_note (insn, REG_UNUSED, operands[3]))
2862 return "divs%.l %2,%0";
2863 else if (find_reg_note (insn, REG_UNUSED, operands[0]))
2864 return "rems%.l %2,%3:%0";
2866 return "rems%.l %2,%3:%0\;divs%.l %2,%0";
2870 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2871 (div:SI (match_operand:SI 1 "general_operand" "0")
2872 (match_operand:SI 2 "general_src_operand" "dmSTK")))
2873 (set (match_operand:SI 3 "nonimmediate_operand" "=d")
2874 (mod:SI (match_dup 1) (match_dup 2)))]
2877 if (find_reg_note (insn, REG_UNUSED, operands[3]))
2878 return "divs%.l %2,%0";
2880 return "divsl%.l %2,%3:%0";
2883 (define_expand "udivmodsi4"
2885 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2886 (udiv:SI (match_operand:SI 1 "general_operand" "0")
2887 (match_operand:SI 2 "general_src_operand" "dmSTK")))
2888 (set (match_operand:SI 3 "nonimmediate_operand" "=d")
2889 (umod:SI (match_dup 1) (match_dup 2)))])]
2890 "TARGET_68020 || TARGET_CF_HWDIV"
2894 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2895 (udiv:SI (match_operand:SI 1 "general_operand" "0")
2896 (match_operand:SI 2 "general_src_operand" "d<Q>U")))
2897 (set (match_operand:SI 3 "nonimmediate_operand" "=&d")
2898 (umod:SI (match_dup 1) (match_dup 2)))]
2901 if (find_reg_note (insn, REG_UNUSED, operands[3]))
2902 return "divu%.l %2,%0";
2903 else if (find_reg_note (insn, REG_UNUSED, operands[0]))
2904 return "remu%.l %2,%3:%0";
2906 return "remu%.l %2,%3:%0\;divu%.l %2,%0";
2910 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2911 (udiv:SI (match_operand:SI 1 "general_operand" "0")
2912 (match_operand:SI 2 "general_src_operand" "dmSTK")))
2913 (set (match_operand:SI 3 "nonimmediate_operand" "=d")
2914 (umod:SI (match_dup 1) (match_dup 2)))]
2915 "TARGET_68020 && !TARGET_COLDFIRE"
2917 if (find_reg_note (insn, REG_UNUSED, operands[3]))
2918 return "divu%.l %2,%0";
2920 return "divul%.l %2,%3:%0";
2923 (define_insn "divmodhi4"
2924 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
2925 (div:HI (match_operand:HI 1 "general_operand" "0")
2926 (match_operand:HI 2 "general_src_operand" "dmSKT")))
2927 (set (match_operand:HI 3 "nonimmediate_operand" "=d")
2928 (mod:HI (match_dup 1) (match_dup 2)))]
2929 "!TARGET_COLDFIRE || TARGET_CF_HWDIV"
2931 output_asm_insn (MOTOROLA ?
2932 "ext%.l %0\;divs%.w %2,%0" :
2933 "extl %0\;divs %2,%0",
2935 if (!find_reg_note(insn, REG_UNUSED, operands[3]))
2938 return "move%.l %0,%3\;swap %3";
2944 (define_insn "udivmodhi4"
2945 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
2946 (udiv:HI (match_operand:HI 1 "general_operand" "0")
2947 (match_operand:HI 2 "general_src_operand" "dmSKT")))
2948 (set (match_operand:HI 3 "nonimmediate_operand" "=d")
2949 (umod:HI (match_dup 1) (match_dup 2)))]
2950 "!TARGET_COLDFIRE || TARGET_CF_HWDIV"
2953 output_asm_insn (MOTOROLA ?
2954 "mvz%.w %0,%0\;divu%.w %2,%0" :
2955 "mvz%.w %0,%0\;divu %2,%0",
2958 output_asm_insn (MOTOROLA ?
2959 "and%.l #0xFFFF,%0\;divu%.w %2,%0" :
2960 "and%.l #0xFFFF,%0\;divu %2,%0",
2963 if (!find_reg_note(insn, REG_UNUSED, operands[3]))
2966 return "move%.l %0,%3\;swap %3";
2972 ;; logical-and instructions
2974 ;; "anddi3" is mainly here to help combine().
2975 (define_insn "anddi3"
2976 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,d")
2977 (and:DI (match_operand:DI 1 "general_operand" "%0,0")
2978 (match_operand:DI 2 "general_operand" "dn,don")))]
2982 /* We can get CONST_DOUBLE, but also const1_rtx etc. */
2983 if (CONSTANT_P (operands[2]))
2987 split_double (operands[2], &hi, &lo);
2989 switch (INTVAL (hi))
2992 output_asm_insn ("clr%.l %0", operands);
3000 xoperands[0] = operands[0];
3002 output_asm_insn (output_andsi3 (xoperands), xoperands);
3005 if (GET_CODE (operands[0]) == REG)
3006 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3008 operands[0] = adjust_address (operands[0], SImode, 4);
3009 switch (INTVAL (lo))
3012 output_asm_insn ("clr%.l %0", operands);
3020 xoperands[0] = operands[0];
3022 output_asm_insn (output_andsi3 (xoperands), xoperands);
3027 if (GET_CODE (operands[0]) != REG)
3029 operands[1] = adjust_address (operands[0], SImode, 4);
3030 return "and%.l %2,%0\;and%.l %R2,%1";
3032 if (GET_CODE (operands[2]) != REG)
3034 operands[1] = adjust_address (operands[2], SImode, 4);
3035 return "and%.l %2,%0\;and%.l %1,%R0";
3037 return "and%.l %2,%0\;and%.l %R2,%R0";
3040 ;; Prevent AND from being made with sp. This doesn't exist in the machine
3041 ;; and reload will cause inefficient code. Since sp is a FIXED_REG, we
3042 ;; can't allocate pseudos into it.
3044 (define_expand "andsi3"
3045 [(set (match_operand:SI 0 "not_sp_operand" "")
3046 (and:SI (match_operand:SI 1 "general_operand" "")
3047 (match_operand:SI 2 "general_src_operand" "")))]
3051 ;; produced by split operations after reload finished
3052 (define_insn "*andsi3_split"
3053 [(set (match_operand:SI 0 "register_operand" "=d")
3054 (and:SI (match_operand:SI 1 "register_operand" "0")
3055 (match_operand:SI 2 "const_int_operand" "i")))]
3056 "reload_completed && !TARGET_COLDFIRE"
3058 return output_andsi3 (operands);
3061 (define_insn "andsi3_internal"
3062 [(set (match_operand:SI 0 "not_sp_operand" "=m,d")
3063 (and:SI (match_operand:SI 1 "general_operand" "%0,0")
3064 (match_operand:SI 2 "general_src_operand" "dKT,dmSM")))]
3067 return output_andsi3 (operands);
3070 (define_insn "andsi3_5200"
3071 [(set (match_operand:SI 0 "not_sp_operand" "=m,d")
3072 (and:SI (match_operand:SI 1 "general_operand" "%0,0")
3073 (match_operand:SI 2 "general_src_operand" "d,dmsK")))]
3076 if (TARGET_CFV4 && DATA_REG_P (operands[0])
3077 && GET_CODE (operands[2]) == CONST_INT)
3079 if (INTVAL (operands[2]) == 0x000000ff)
3080 return "mvz%.b %0,%0";
3081 else if (INTVAL (operands[2]) == 0x0000ffff)
3082 return "mvz%.w %0,%0";
3084 return output_andsi3 (operands);
3087 (define_insn "andhi3"
3088 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,d")
3089 (and:HI (match_operand:HI 1 "general_operand" "%0,0")
3090 (match_operand:HI 2 "general_src_operand" "dn,dmSn")))]
3095 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3096 (and:HI (match_dup 0)
3097 (match_operand:HI 1 "general_src_operand" "dn,dmSn")))]
3102 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3103 (and:HI (match_operand:HI 1 "general_src_operand" "dn,dmSn")
3108 (define_insn "andqi3"
3109 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
3110 (and:QI (match_operand:QI 1 "general_operand" "%0,0")
3111 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
3116 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3117 (and:QI (match_dup 0)
3118 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
3123 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3124 (and:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn")
3129 ;; inclusive-or instructions
3131 (define_insn "iordi_zext"
3132 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,d")
3133 (ior:DI (zero_extend:DI (match_operand 1 "general_operand" "dn,dmn"))
3134 (match_operand:DI 2 "general_operand" "0,0")))]
3140 if (GET_CODE (operands[0]) == REG)
3141 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3143 operands[0] = adjust_address (operands[0], SImode, 4);
3144 if (GET_MODE (operands[1]) == SImode)
3145 return "or%.l %1,%0";
3146 byte_mode = (GET_MODE (operands[1]) == QImode);
3147 if (GET_CODE (operands[0]) == MEM)
3148 operands[0] = adjust_address (operands[0], byte_mode ? QImode : HImode,
3151 return "or%.b %1,%0";
3153 return "or%.w %1,%0";
3156 ;; "iordi3" is mainly here to help combine().
3157 (define_insn "iordi3"
3158 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,d")
3159 (ior:DI (match_operand:DI 1 "general_operand" "%0,0")
3160 (match_operand:DI 2 "general_operand" "dn,don")))]
3164 /* We can get CONST_DOUBLE, but also const1_rtx etc. */
3165 if (CONSTANT_P (operands[2]))
3169 split_double (operands[2], &hi, &lo);
3171 switch (INTVAL (hi))
3176 /* FIXME : a scratch register would be welcome here if operand[0]
3177 is not a register */
3178 output_asm_insn ("move%.l #-1,%0", operands);
3184 xoperands[0] = operands[0];
3186 output_asm_insn (output_iorsi3 (xoperands), xoperands);
3189 if (GET_CODE (operands[0]) == REG)
3190 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3192 operands[0] = adjust_address (operands[0], SImode, 4);
3193 switch (INTVAL (lo))
3198 /* FIXME : a scratch register would be welcome here if operand[0]
3199 is not a register */
3200 output_asm_insn ("move%.l #-1,%0", operands);
3206 xoperands[0] = operands[0];
3208 output_asm_insn (output_iorsi3 (xoperands), xoperands);
3213 if (GET_CODE (operands[0]) != REG)
3215 operands[1] = adjust_address (operands[0], SImode, 4);
3216 return "or%.l %2,%0\;or%.l %R2,%1";
3218 if (GET_CODE (operands[2]) != REG)
3220 operands[1] = adjust_address (operands[2], SImode, 4);
3221 return "or%.l %2,%0\;or%.l %1,%R0";
3223 return "or%.l %2,%0\;or%.l %R2,%R0";
3226 (define_expand "iorsi3"
3227 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3228 (ior:SI (match_operand:SI 1 "general_operand" "")
3229 (match_operand:SI 2 "general_src_operand" "")))]
3233 (define_insn "iorsi3_internal"
3234 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,d")
3235 (ior:SI (match_operand:SI 1 "general_operand" "%0,0")
3236 (match_operand:SI 2 "general_src_operand" "dKT,dmSMT")))]
3239 return output_iorsi3 (operands);
3242 (define_insn "iorsi3_5200"
3243 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,d")
3244 (ior:SI (match_operand:SI 1 "general_operand" "%0,0")
3245 (match_operand:SI 2 "general_src_operand" "d,dmsK")))]
3248 return output_iorsi3 (operands);
3251 (define_insn "iorhi3"
3252 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,d")
3253 (ior:HI (match_operand:HI 1 "general_operand" "%0,0")
3254 (match_operand:HI 2 "general_src_operand" "dn,dmSn")))]
3259 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3260 (ior:HI (match_dup 0)
3261 (match_operand:HI 1 "general_src_operand" "dn,dmSn")))]
3266 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3267 (ior:HI (match_operand:HI 1 "general_src_operand" "dn,dmSn")
3272 (define_insn "iorqi3"
3273 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
3274 (ior:QI (match_operand:QI 1 "general_operand" "%0,0")
3275 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
3280 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3281 (ior:QI (match_dup 0)
3282 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
3287 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3288 (ior:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn")
3293 ;; On all 68k models, this makes faster code in a special case.
3294 ;; See also ashlsi_16, ashrsi_16 and lshrsi_16.
3296 (define_insn "iorsi_zexthi_ashl16"
3297 [(set (match_operand:SI 0 "nonimmediate_operand" "=&d")
3298 (ior:SI (zero_extend:SI (match_operand:HI 1 "general_operand" "rmn"))
3299 (ashift:SI (match_operand:SI 2 "general_operand" "or")
3304 if (GET_CODE (operands[2]) != REG)
3305 operands[2] = adjust_address (operands[2], HImode, 2);
3306 if (GET_CODE (operands[2]) != REG
3307 || REGNO (operands[2]) != REGNO (operands[0]))
3308 output_asm_insn ("move%.w %2,%0", operands);
3309 return "swap %0\;mov%.w %1,%0";
3312 (define_insn "iorsi_zext"
3313 [(set (match_operand:SI 0 "nonimmediate_operand" "=o,d")
3314 (ior:SI (zero_extend:SI (match_operand 1 "general_operand" "dn,dmn"))
3315 (match_operand:SI 2 "general_operand" "0,0")))]
3321 byte_mode = (GET_MODE (operands[1]) == QImode);
3322 if (GET_CODE (operands[0]) == MEM)
3323 operands[0] = adjust_address (operands[0], byte_mode ? QImode : HImode,
3326 return "or%.b %1,%0";
3328 return "or%.w %1,%0";
3333 ;; "xordi3" is mainly here to help combine().
3334 (define_insn "xordi3"
3335 [(set (match_operand:DI 0 "nonimmediate_operand" "=od")
3336 (xor:DI (match_operand:DI 1 "general_operand" "%0")
3337 (match_operand:DI 2 "general_operand" "dn")))]
3341 /* We can get CONST_DOUBLE, but also const1_rtx etc. */
3343 if (CONSTANT_P (operands[2]))
3347 split_double (operands[2], &hi, &lo);
3349 switch (INTVAL (hi))
3354 output_asm_insn ("not%.l %0", operands);
3357 /* FIXME : a scratch register would be welcome here if
3358 -128 <= INTVAL (hi) < -1 */
3362 xoperands[0] = operands[0];
3364 output_asm_insn (output_xorsi3 (xoperands), xoperands);
3367 if (GET_CODE (operands[0]) == REG)
3368 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3370 operands[0] = adjust_address (operands[0], SImode, 4);
3371 switch (INTVAL (lo))
3376 output_asm_insn ("not%.l %0", operands);
3379 /* FIXME : a scratch register would be welcome here if
3380 -128 <= INTVAL (lo) < -1 */
3382 /* FIXME : this should be merged with xorsi3 */
3386 xoperands[0] = operands[0];
3388 output_asm_insn (output_xorsi3 (xoperands), xoperands);
3393 if (GET_CODE (operands[0]) != REG)
3395 operands[1] = adjust_address (operands[0], SImode, 4);
3396 return "eor%.l %2,%0\;eor%.l %R2,%1";
3398 if (GET_CODE (operands[2]) != REG)
3400 operands[1] = adjust_address (operands[2], SImode, 4);
3401 return "eor%.l %2,%0\;eor%.l %1,%R0";
3403 return "eor%.l %2,%0\;eor%.l %R2,%R0";
3406 (define_expand "xorsi3"
3407 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3408 (xor:SI (match_operand:SI 1 "general_operand" "")
3409 (match_operand:SI 2 "general_operand" "")))]
3413 (define_insn "xorsi3_internal"
3414 [(set (match_operand:SI 0 "nonimmediate_operand" "=do,m")
3415 (xor:SI (match_operand:SI 1 "general_operand" "%0,0")
3416 (match_operand:SI 2 "general_operand" "di,dKT")))]
3420 return output_xorsi3 (operands);
3423 (define_insn "xorsi3_5200"
3424 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm,d")
3425 (xor:SI (match_operand:SI 1 "general_operand" "%0,0")
3426 (match_operand:SI 2 "general_operand" "d,Ks")))]
3429 return output_xorsi3 (operands);
3432 (define_insn "xorhi3"
3433 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
3434 (xor:HI (match_operand:HI 1 "general_operand" "%0")
3435 (match_operand:HI 2 "general_operand" "dn")))]
3440 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
3441 (xor:HI (match_dup 0)
3442 (match_operand:HI 1 "general_operand" "dn")))]
3447 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
3448 (xor:HI (match_operand:HI 1 "general_operand" "dn")
3453 (define_insn "xorqi3"
3454 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
3455 (xor:QI (match_operand:QI 1 "general_operand" "%0")
3456 (match_operand:QI 2 "general_operand" "dn")))]
3461 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
3462 (xor:QI (match_dup 0)
3463 (match_operand:QI 1 "general_operand" "dn")))]
3468 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
3469 (xor:QI (match_operand:QI 1 "general_operand" "dn")
3474 ;; negation instructions
3476 (define_expand "negdi2"
3477 [(set (match_operand:DI 0 "nonimmediate_operand" "")
3478 (neg:DI (match_operand:DI 1 "general_operand" "")))]
3481 if (TARGET_COLDFIRE)
3482 emit_insn (gen_negdi2_5200 (operands[0], operands[1]));
3484 emit_insn (gen_negdi2_internal (operands[0], operands[1]));
3488 (define_insn "negdi2_internal"
3489 [(set (match_operand:DI 0 "nonimmediate_operand" "=<,do,!*a")
3490 (neg:DI (match_operand:DI 1 "general_operand" "0,0,0")))]
3493 if (which_alternative == 0)
3494 return "neg%.l %0\;negx%.l %0";
3495 if (GET_CODE (operands[0]) == REG)
3496 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3498 operands[1] = adjust_address (operands[0], SImode, 4);
3499 if (ADDRESS_REG_P (operands[0]))
3500 return "exg %/d0,%1\;neg%.l %/d0\;exg %/d0,%1\;exg %/d0,%0\;negx%.l %/d0\;exg %/d0,%0";
3502 return "neg%.l %1\;negx%.l %0";
3505 (define_insn "negdi2_5200"
3506 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
3507 (neg:DI (match_operand:DI 1 "general_operand" "0")))]
3510 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3511 return "neg%.l %1\;negx%.l %0";
3514 (define_expand "negsi2"
3515 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3516 (neg:SI (match_operand:SI 1 "general_operand" "")))]
3519 if (TARGET_COLDFIRE)
3520 emit_insn (gen_negsi2_5200 (operands[0], operands[1]));
3522 emit_insn (gen_negsi2_internal (operands[0], operands[1]));
3526 (define_insn "negsi2_internal"
3527 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
3528 (neg:SI (match_operand:SI 1 "general_operand" "0")))]
3532 (define_insn "negsi2_5200"
3533 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3534 (neg:SI (match_operand:SI 1 "general_operand" "0")))]
3538 (define_insn "neghi2"
3539 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
3540 (neg:HI (match_operand:HI 1 "general_operand" "0")))]
3545 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
3546 (neg:HI (match_dup 0)))]
3550 (define_insn "negqi2"
3551 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
3552 (neg:QI (match_operand:QI 1 "general_operand" "0")))]
3557 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
3558 (neg:QI (match_dup 0)))]
3562 ;; If using software floating point, just flip the sign bit.
3564 (define_expand "negsf2"
3565 [(set (match_operand:SF 0 "nonimmediate_operand" "")
3566 (neg:SF (match_operand:SF 1 "general_operand" "")))]
3574 target = operand_subword_force (operands[0], 0, SFmode);
3575 result = expand_binop (SImode, xor_optab,
3576 operand_subword_force (operands[1], 0, SFmode),
3577 GEN_INT (0x80000000), target, 0, OPTAB_WIDEN);
3581 if (result != target)
3582 emit_move_insn (result, target);
3584 /* Make a place for REG_EQUAL. */
3585 emit_move_insn (operands[0], operands[0]);
3591 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,d")
3592 (neg:SF (match_operand:SF 1 "general_operand" "fdmF,0")))]
3595 if (DATA_REG_P (operands[0]))
3597 operands[1] = GEN_INT (31);
3598 return "bchg %1,%0";
3600 if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
3601 return "f%$neg%.x %1,%0";
3602 return "f%$neg%.s %f1,%0";
3605 (define_expand "negdf2"
3606 [(set (match_operand:DF 0 "nonimmediate_operand" "")
3607 (neg:DF (match_operand:DF 1 "general_operand" "")))]
3617 target = operand_subword (operands[0], 0, 1, DFmode);
3618 result = expand_binop (SImode, xor_optab,
3619 operand_subword_force (operands[1], 0, DFmode),
3620 GEN_INT (0x80000000), target, 0, OPTAB_WIDEN);
3624 if (result != target)
3625 emit_move_insn (result, target);
3627 emit_move_insn (operand_subword (operands[0], 1, 1, DFmode),
3628 operand_subword_force (operands[1], 1, DFmode));
3630 insns = get_insns ();
3633 emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
3639 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,d")
3640 (neg:DF (match_operand:DF 1 "general_operand" "fmF,0")))]
3643 if (DATA_REG_P (operands[0]))
3645 operands[1] = GEN_INT (31);
3646 return "bchg %1,%0";
3648 if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
3649 return "f%&neg%.x %1,%0";
3650 return "f%&neg%.d %f1,%0";
3653 ;; Sqrt instruction for the 68881
3655 (define_insn "sqrtsf2"
3656 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
3657 (sqrt:SF (match_operand:SF 1 "general_operand" "fm")))]
3660 if (FP_REG_P (operands[1]))
3661 return "f%$sqrt%.x %1,%0";
3663 return "f%$sqrt%.s %1,%0";
3666 (define_insn "sqrtdf2"
3667 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
3668 (sqrt:DF (match_operand:DF 1 "general_operand" "fm")))]
3671 if (FP_REG_P (operands[1]))
3672 return "f%&sqrt%.x %1,%0";
3674 return "f%&sqrt%.d %1,%0";
3677 ;; Absolute value instructions
3678 ;; If using software floating point, just zero the sign bit.
3680 (define_expand "abssf2"
3681 [(set (match_operand:SF 0 "nonimmediate_operand" "")
3682 (abs:SF (match_operand:SF 1 "general_operand" "")))]
3690 target = operand_subword_force (operands[0], 0, SFmode);
3691 result = expand_binop (SImode, and_optab,
3692 operand_subword_force (operands[1], 0, SFmode),
3693 GEN_INT (0x7fffffff), target, 0, OPTAB_WIDEN);
3697 if (result != target)
3698 emit_move_insn (result, target);
3700 /* Make a place for REG_EQUAL. */
3701 emit_move_insn (operands[0], operands[0]);
3707 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
3708 (abs:SF (match_operand:SF 1 "general_operand" "fdmF")))]
3711 if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
3712 return "f%$abs%.x %1,%0";
3713 return "f%$abs%.s %f1,%0";
3716 (define_expand "absdf2"
3717 [(set (match_operand:DF 0 "nonimmediate_operand" "")
3718 (abs:DF (match_operand:DF 1 "general_operand" "")))]
3728 target = operand_subword (operands[0], 0, 1, DFmode);
3729 result = expand_binop (SImode, and_optab,
3730 operand_subword_force (operands[1], 0, DFmode),
3731 GEN_INT (0x7fffffff), target, 0, OPTAB_WIDEN);
3735 if (result != target)
3736 emit_move_insn (result, target);
3738 emit_move_insn (operand_subword (operands[0], 1, 1, DFmode),
3739 operand_subword_force (operands[1], 1, DFmode));
3741 insns = get_insns ();
3744 emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
3750 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
3751 (abs:DF (match_operand:DF 1 "general_operand" "fmF")))]
3754 if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
3755 return "f%&abs%.x %1,%0";
3756 return "f%&abs%.d %f1,%0";
3759 ;; one complement instructions
3761 ;; "one_cmpldi2" is mainly here to help combine().
3762 (define_insn "one_cmpldi2"
3763 [(set (match_operand:DI 0 "nonimmediate_operand" "=dm")
3764 (not:DI (match_operand:DI 1 "general_operand" "0")))]
3768 if (GET_CODE (operands[0]) == REG)
3769 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3770 else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC
3771 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
3772 operands[1] = operands[0];
3774 operands[1] = adjust_address (operands[0], SImode, 4);
3775 return "not%.l %1\;not%.l %0";
3778 (define_expand "one_cmplsi2"
3779 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3780 (not:SI (match_operand:SI 1 "general_operand" "")))]
3783 if (TARGET_COLDFIRE)
3784 emit_insn (gen_one_cmplsi2_5200 (operands[0], operands[1]));
3786 emit_insn (gen_one_cmplsi2_internal (operands[0], operands[1]));
3790 (define_insn "one_cmplsi2_internal"
3791 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
3792 (not:SI (match_operand:SI 1 "general_operand" "0")))]
3796 (define_insn "one_cmplsi2_5200"
3797 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3798 (not:SI (match_operand:SI 1 "general_operand" "0")))]
3802 (define_insn "one_cmplhi2"
3803 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
3804 (not:HI (match_operand:HI 1 "general_operand" "0")))]
3809 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
3810 (not:HI (match_dup 0)))]
3814 (define_insn "one_cmplqi2"
3815 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
3816 (not:QI (match_operand:QI 1 "general_operand" "0")))]
3821 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
3822 (not:QI (match_dup 0)))]
3826 ;; arithmetic shift instructions
3827 ;; We don't need the shift memory by 1 bit instruction
3829 (define_insn "ashldi_extsi"
3830 [(set (match_operand:DI 0 "nonimmediate_operand" "=ro")
3832 (match_operator:DI 2 "extend_operator"
3833 [(match_operand:SI 1 "general_operand" "rm")])
3838 if (GET_CODE (operands[0]) == REG)
3839 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3841 operands[2] = adjust_address (operands[0], SImode, 4);
3842 if (ADDRESS_REG_P (operands[0]))
3843 return "move%.l %1,%0\;sub%.l %2,%2";
3845 return "move%.l %1,%0\;clr%.l %2";
3848 (define_insn "ashldi_sexthi"
3849 [(set (match_operand:DI 0 "nonimmediate_operand" "=m,a*d")
3850 (ashift:DI (sign_extend:DI (match_operand:HI 1 "general_operand" "rm,rm"))
3852 (clobber (match_scratch:SI 2 "=a,X"))]
3856 if (GET_CODE (operands[0]) == MEM)
3858 if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
3859 return "clr%.l %0\;move%.w %1,%2\;move%.l %2,%0";
3860 else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
3861 return "move%.w %1,%2\;move%.l %2,%0\;clr%.l %0";
3864 operands[3] = adjust_address (operands[0], SImode, 4);
3865 return "move%.w %1,%2\;move%.l %2,%0\;clr%.l %3";
3868 else if (DATA_REG_P (operands[0]))
3869 return "move%.w %1,%0\;ext%.l %0\;clr%.l %R0";
3871 return "move%.w %1,%0\;sub%.l %R0,%R0";
3874 (define_insn "ashldi_const32"
3875 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm")
3876 (ashift:DI (match_operand:DI 1 "general_operand" "ro")
3881 if (GET_CODE (operands[1]) == REG)
3882 operands[3] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
3884 operands[3] = adjust_address (operands[1], SImode, 4);
3885 if (GET_CODE (operands[0]) == REG)
3886 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3887 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
3888 return "clr%.l %0\;move%.l %3,%0";
3889 else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
3890 return "move%.l %3,%0\;clr%.l %0";
3892 operands[2] = adjust_address (operands[0], SImode, 4);
3893 if (ADDRESS_REG_P (operands[2]))
3894 return "move%.l %3,%0\;sub%.l %2,%2";
3896 return "move%.l %3,%0\;clr%.l %2";
3899 ;; The predicate below must be general_operand, because ashldi3 allows that
3900 (define_insn "ashldi_const"
3901 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
3902 (ashift:DI (match_operand:DI 1 "general_operand" "0")
3903 (match_operand 2 "const_int_operand" "n")))]
3905 && ((INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3)
3906 || INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16
3907 || (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63)))"
3909 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3910 if (INTVAL (operands[2]) == 1)
3911 return "add%.l %1,%1\;addx%.l %0,%0";
3912 else if (INTVAL (operands[2]) == 8)
3913 return "rol%.l #8,%1\;rol%.l #8,%0\;move%.b %1,%0\;clr%.b %1";
3914 else if (INTVAL (operands[2]) == 16)
3915 return "swap %1\;swap %0\;move%.w %1,%0\;clr%.w %1";
3916 else if (INTVAL (operands[2]) == 48)
3917 return "mov%.l %1,%0\;swap %0\;clr%.l %1\;clr%.w %0";
3918 else if (INTVAL (operands[2]) == 2)
3919 return "add%.l %1,%1\;addx%.l %0,%0\;add%.l %1,%1\;addx%.l %0,%0";
3920 else if (INTVAL (operands[2]) == 3)
3921 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";
3922 else /* 32 < INTVAL (operands[2]) <= 63 */
3924 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
3925 output_asm_insn (INTVAL (operands[2]) <= 8 ? "asl%.l %2,%1" :
3926 "moveq %2,%0\;asl%.l %0,%1", operands);
3927 return "mov%.l %1,%0\;moveq #0,%1";
3931 (define_expand "ashldi3"
3932 [(set (match_operand:DI 0 "nonimmediate_operand" "")
3933 (ashift:DI (match_operand:DI 1 "general_operand" "")
3934 (match_operand 2 "const_int_operand" "")))]
3938 /* ??? This is a named pattern like this is not allowed to FAIL based
3940 if (GET_CODE (operands[2]) != CONST_INT
3941 || ((INTVAL (operands[2]) < 1 || INTVAL (operands[2]) > 3)
3942 && INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16
3943 && (INTVAL (operands[2]) < 32 || INTVAL (operands[2]) > 63)))
3947 ;; On most 68k models, this makes faster code in a special case.
3949 (define_insn "ashlsi_16"
3950 [(set (match_operand:SI 0 "register_operand" "=d")
3951 (ashift:SI (match_operand:SI 1 "register_operand" "0")
3956 return "swap %0\;clr%.w %0";
3959 ;; ashift patterns : use lsl instead of asl, because lsl always clears the
3960 ;; overflow bit, so we must not set CC_NO_OVERFLOW.
3962 ;; On the 68000, this makes faster code in a special case.
3964 (define_insn "ashlsi_17_24"
3965 [(set (match_operand:SI 0 "register_operand" "=d")
3966 (ashift:SI (match_operand:SI 1 "register_operand" "0")
3967 (match_operand:SI 2 "const_int_operand" "n")))]
3968 "(! TARGET_68020 && !TARGET_COLDFIRE
3969 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24)"
3973 operands[2] = GEN_INT (INTVAL (operands[2]) - 16);
3974 return "lsl%.w %2,%0\;swap %0\;clr%.w %0";
3977 (define_insn "ashlsi3"
3978 [(set (match_operand:SI 0 "register_operand" "=d")
3979 (ashift:SI (match_operand:SI 1 "register_operand" "0")
3980 (match_operand:SI 2 "general_operand" "dI")))]
3983 if (operands[2] == const1_rtx)
3985 cc_status.flags = CC_NO_OVERFLOW;
3986 return "add%.l %0,%0";
3988 return "lsl%.l %2,%0";
3991 (define_insn "ashlhi3"
3992 [(set (match_operand:HI 0 "register_operand" "=d")
3993 (ashift:HI (match_operand:HI 1 "register_operand" "0")
3994 (match_operand:HI 2 "general_operand" "dI")))]
3999 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
4000 (ashift:HI (match_dup 0)
4001 (match_operand:HI 1 "general_operand" "dI")))]
4005 (define_insn "ashlqi3"
4006 [(set (match_operand:QI 0 "register_operand" "=d")
4007 (ashift:QI (match_operand:QI 1 "register_operand" "0")
4008 (match_operand:QI 2 "general_operand" "dI")))]
4013 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
4014 (ashift:QI (match_dup 0)
4015 (match_operand:QI 1 "general_operand" "dI")))]
4019 ;; On most 68k models, this makes faster code in a special case.
4021 (define_insn "ashrsi_16"
4022 [(set (match_operand:SI 0 "register_operand" "=d")
4023 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4026 "swap %0\;ext%.l %0")
4028 ;; On the 68000, this makes faster code in a special case.
4031 [(set (match_operand:SI 0 "register_operand" "=d")
4032 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4033 (match_operand:SI 2 "const_int_operand" "n")))]
4034 "(! TARGET_68020 && !TARGET_COLDFIRE
4035 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24)"
4037 operands[2] = GEN_INT (INTVAL (operands[2]) - 16);
4038 return "swap %0\;asr%.w %2,%0\;ext%.l %0";
4041 (define_insn "subreghi1ashrdi_const32"
4042 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
4043 (subreg:HI (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro")
4044 (const_int 32)) 6))]
4047 if (GET_CODE (operands[1]) != REG)
4048 operands[1] = adjust_address (operands[1], HImode, 2);
4049 return "move%.w %1,%0";
4052 (define_insn "subregsi1ashrdi_const32"
4053 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
4054 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro")
4055 (const_int 32)) 4))]
4058 return "move%.l %1,%0";
4061 (define_insn "ashrdi_const32"
4062 [(set (match_operand:DI 0 "register_operand" "=d")
4063 (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro")
4068 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4070 return "move%.l %1,%2\;smi %0\;extb%.l %0";
4072 return "move%.l %1,%2\;smi %0\;ext%.w %0\;ext%.l %0";
4075 (define_insn "ashrdi_const32_mem"
4076 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,<")
4077 (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro,ro")
4079 (clobber (match_scratch:SI 2 "=d,d"))]
4083 if (which_alternative == 1)
4084 operands[3] = operands[0];
4086 operands[3] = adjust_address (operands[0], SImode, 4);
4088 return "move%.l %1,%3\;smi %2\;extb%.l %2\;move%.l %2,%0";
4090 return "move%.l %1,%3\;smi %2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0";
4093 ;; The predicate below must be general_operand, because ashrdi3 allows that
4094 (define_insn "ashrdi_const"
4095 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
4096 (ashiftrt:DI (match_operand:DI 1 "general_operand" "0")
4097 (match_operand 2 "const_int_operand" "n")))]
4099 && ((INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3)
4100 || INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16
4101 || INTVAL (operands[2]) == 31
4102 || (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63)))"
4104 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4105 if (INTVAL (operands[2]) == 63)
4106 return "add%.l %0,%0\;subx%.l %0,%0\;move%.l %0,%1";
4108 if (INTVAL (operands[2]) == 1)
4109 return "asr%.l #1,%0\;roxr%.l #1,%1";
4110 else if (INTVAL (operands[2]) == 8)
4111 return "move%.b %0,%1\;asr%.l #8,%0\;ror%.l #8,%1";
4112 else if (INTVAL (operands[2]) == 16)
4113 return "move%.w %0,%1\;swap %0\;ext%.l %0\;swap %1";
4114 else if (INTVAL (operands[2]) == 48)
4115 return "swap %0\;ext%.l %0\;move%.l %0,%1\;smi %0\;ext%.w %0";
4116 else if (INTVAL (operands[2]) == 31)
4117 return "add%.l %1,%1\;addx%.l %0,%0\;move%.l %0,%1\;subx%.l %0,%0";
4118 else if (INTVAL (operands[2]) == 2)
4119 return "asr%.l #1,%0\;roxr%.l #1,%1\;asr%.l #1,%0\;roxr%.l #1,%1";
4120 else if (INTVAL (operands[2]) == 3)
4121 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";
4122 else /* 32 < INTVAL (operands[2]) <= 63 */
4124 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
4125 output_asm_insn (INTVAL (operands[2]) <= 8 ? "asr%.l %2,%0" :
4126 "moveq %2,%1\;asr%.l %1,%0", operands);
4127 output_asm_insn ("mov%.l %0,%1\;smi %0", operands);
4128 return INTVAL (operands[2]) >= 15 ? "ext%.w %d0" :
4129 TARGET_68020 ? "extb%.l %0" : "ext%.w %0\;ext%.l %0";
4133 (define_expand "ashrdi3"
4134 [(set (match_operand:DI 0 "nonimmediate_operand" "")
4135 (ashiftrt:DI (match_operand:DI 1 "general_operand" "")
4136 (match_operand 2 "const_int_operand" "")))]
4140 /* ??? This is a named pattern like this is not allowed to FAIL based
4142 if (GET_CODE (operands[2]) != CONST_INT
4143 || ((INTVAL (operands[2]) < 1 || INTVAL (operands[2]) > 3)
4144 && INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16
4145 && (INTVAL (operands[2]) < 31 || INTVAL (operands[2]) > 63)))
4149 ;; On all 68k models, this makes faster code in a special case.
4151 (define_insn "ashrsi_31"
4152 [(set (match_operand:SI 0 "register_operand" "=d")
4153 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4157 return "add%.l %0,%0\;subx%.l %0,%0";
4160 (define_insn "ashrsi3"
4161 [(set (match_operand:SI 0 "register_operand" "=d")
4162 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4163 (match_operand:SI 2 "general_operand" "dI")))]
4167 (define_insn "ashrhi3"
4168 [(set (match_operand:HI 0 "register_operand" "=d")
4169 (ashiftrt:HI (match_operand:HI 1 "register_operand" "0")
4170 (match_operand:HI 2 "general_operand" "dI")))]
4175 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
4176 (ashiftrt:HI (match_dup 0)
4177 (match_operand:HI 1 "general_operand" "dI")))]
4181 (define_insn "ashrqi3"
4182 [(set (match_operand:QI 0 "register_operand" "=d")
4183 (ashiftrt:QI (match_operand:QI 1 "register_operand" "0")
4184 (match_operand:QI 2 "general_operand" "dI")))]
4189 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
4190 (ashiftrt:QI (match_dup 0)
4191 (match_operand:QI 1 "general_operand" "dI")))]
4195 ;; logical shift instructions
4197 ;; commented out because of reload problems in 950612-1.c
4200 ;; (subreg:SI (lshiftrt:DI (match_operand:DI 0 "general_operand" "ro")
4201 ;; (const_int 32)) 4))
4202 ;; (set (match_operand:SI 1 "nonimmediate_operand" "=dm")
4203 ;; (subreg:SI (lshiftrt:DI (match_dup 0)
4204 ;; (const_int 32)) 4))]
4207 ;; return "move%.l %0,%1";
4212 ;; (subreg:SI (lshiftrt:DI (match_operand:DI 0 "general_operand" "ro")
4213 ;; (const_int 32)) 0))
4214 ;; (set (match_operand:DI 1 "nonimmediate_operand" "=do")
4215 ;; (lshiftrt:DI (match_dup 0)
4216 ;; (const_int 32)))]
4219 ;; if (GET_CODE (operands[1]) == REG)
4220 ;; operands[2] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
4222 ;; operands[2] = adjust_address (operands[1], SImode, 4);
4223 ;; return "move%.l %0,%2\;clr%.l %1";
4226 (define_insn "subreg1lshrdi_const32"
4227 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
4228 (subreg:SI (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro")
4229 (const_int 32)) 4))]
4232 return "move%.l %1,%0";
4235 (define_insn "lshrdi_const32"
4236 [(set (match_operand:DI 0 "nonimmediate_operand" "=ro,<,>")
4237 (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro,ro,ro")
4242 if (which_alternative == 1)
4243 return "move%.l %1,%0\;clr%.l %0";
4244 if (which_alternative == 2)
4245 return "clr%.l %0\;move%.l %1,%0";
4246 if (GET_CODE (operands[0]) == REG)
4247 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4249 operands[2] = adjust_address (operands[0], SImode, 4);
4250 if (GET_CODE (operands[1]) == REG)
4251 operands[3] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
4253 operands[3] = adjust_address (operands[1], SImode, 4);
4254 if (ADDRESS_REG_P (operands[0]))
4255 return "move%.l %1,%2\;sub%.l %0,%0";
4257 return "move%.l %1,%2\;clr%.l %0";
4260 ;; The predicate below must be general_operand, because lshrdi3 allows that
4261 (define_insn "lshrdi_const"
4262 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
4263 (lshiftrt:DI (match_operand:DI 1 "general_operand" "0")
4264 (match_operand 2 "const_int_operand" "n")))]
4266 && ((INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3)
4267 || INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16
4268 || (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63)))"
4270 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4271 if (INTVAL (operands[2]) == 63)
4272 return "add%.l %0,%0\;clr%.l %0\;clr%.l %1\;addx%.l %1,%1";
4274 if (INTVAL (operands[2]) == 1)
4275 return "lsr%.l #1,%0\;roxr%.l #1,%1";
4276 else if (INTVAL (operands[2]) == 8)
4277 return "move%.b %0,%1\;lsr%.l #8,%0\;ror%.l #8,%1";
4278 else if (INTVAL (operands[2]) == 16)
4279 return "move%.w %0,%1\;clr%.w %0\;swap %1\;swap %0";
4280 else if (INTVAL (operands[2]) == 48)
4281 return "move%.l %0,%1\;clr%.w %1\;clr%.l %0\;swap %1";
4282 else if (INTVAL (operands[2]) == 2)
4283 return "lsr%.l #1,%0\;roxr%.l #1,%1\;lsr%.l #1,%0\;roxr%.l #1,%1";
4284 else if (INTVAL (operands[2]) == 3)
4285 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";
4286 else /* 32 < INTVAL (operands[2]) <= 63 */
4288 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
4289 output_asm_insn (INTVAL (operands[2]) <= 8 ? "lsr%.l %2,%0" :
4290 "moveq %2,%1\;lsr%.l %1,%0", operands);
4291 return "mov%.l %0,%1\;moveq #0,%0";
4295 (define_expand "lshrdi3"
4296 [(set (match_operand:DI 0 "nonimmediate_operand" "")
4297 (lshiftrt:DI (match_operand:DI 1 "general_operand" "")
4298 (match_operand 2 "const_int_operand" "")))]
4301 /* ??? This is a named pattern like this is not allowed to FAIL based
4303 if (GET_CODE (operands[2]) != CONST_INT
4304 || ((INTVAL (operands[2]) < 1 || INTVAL (operands[2]) > 3)
4305 && INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16
4306 && (INTVAL (operands[2]) < 32 || INTVAL (operands[2]) > 63)))
4310 ;; On all 68k models, this makes faster code in a special case.
4312 (define_insn "lshrsi_31"
4313 [(set (match_operand:SI 0 "register_operand" "=d")
4314 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
4318 return "add%.l %0,%0\;subx%.l %0,%0\;neg%.l %0";
4321 ;; On most 68k models, this makes faster code in a special case.
4323 (define_insn "lshrsi_16"
4324 [(set (match_operand:SI 0 "register_operand" "=d")
4325 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
4330 return "clr%.w %0\;swap %0";
4333 ;; On the 68000, this makes faster code in a special case.
4335 (define_insn "lshrsi_17_24"
4336 [(set (match_operand:SI 0 "register_operand" "=d")
4337 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
4338 (match_operand:SI 2 "const_int_operand" "n")))]
4339 "(! TARGET_68020 && !TARGET_COLDFIRE
4340 && INTVAL (operands[2]) > 16 && INTVAL (operands[2]) <= 24)"
4342 /* I think lsr%.w sets the CC properly. */
4343 operands[2] = GEN_INT (INTVAL (operands[2]) - 16);
4344 return "clr%.w %0\;swap %0\;lsr%.w %2,%0";
4347 (define_insn "lshrsi3"
4348 [(set (match_operand:SI 0 "register_operand" "=d")
4349 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
4350 (match_operand:SI 2 "general_operand" "dI")))]
4354 (define_insn "lshrhi3"
4355 [(set (match_operand:HI 0 "register_operand" "=d")
4356 (lshiftrt:HI (match_operand:HI 1 "register_operand" "0")
4357 (match_operand:HI 2 "general_operand" "dI")))]
4362 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
4363 (lshiftrt:HI (match_dup 0)
4364 (match_operand:HI 1 "general_operand" "dI")))]
4368 (define_insn "lshrqi3"
4369 [(set (match_operand:QI 0 "register_operand" "=d")
4370 (lshiftrt:QI (match_operand:QI 1 "register_operand" "0")
4371 (match_operand:QI 2 "general_operand" "dI")))]
4376 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
4377 (lshiftrt:QI (match_dup 0)
4378 (match_operand:QI 1 "general_operand" "dI")))]
4382 ;; rotate instructions
4384 (define_insn "rotlsi3"
4385 [(set (match_operand:SI 0 "register_operand" "=d")
4386 (rotate:SI (match_operand:SI 1 "register_operand" "0")
4387 (match_operand:SI 2 "general_operand" "dINO")))]
4390 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 16)
4392 else if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 16)
4394 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
4395 return "ror%.l %2,%0";
4398 return "rol%.l %2,%0";
4401 (define_insn "rotlhi3"
4402 [(set (match_operand:HI 0 "register_operand" "=d")
4403 (rotate:HI (match_operand:HI 1 "register_operand" "0")
4404 (match_operand:HI 2 "general_operand" "dIP")))]
4407 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 8)
4409 operands[2] = GEN_INT (16 - INTVAL (operands[2]));
4410 return "ror%.w %2,%0";
4413 return "rol%.w %2,%0";
4417 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
4418 (rotate:HI (match_dup 0)
4419 (match_operand:HI 1 "general_operand" "dIP")))]
4422 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 8)
4424 operands[2] = GEN_INT (16 - INTVAL (operands[2]));
4425 return "ror%.w %2,%0";
4428 return "rol%.w %2,%0";
4431 (define_insn "rotlqi3"
4432 [(set (match_operand:QI 0 "register_operand" "=d")
4433 (rotate:QI (match_operand:QI 1 "register_operand" "0")
4434 (match_operand:QI 2 "general_operand" "dI")))]
4437 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 4)
4439 operands[2] = GEN_INT (8 - INTVAL (operands[2]));
4440 return "ror%.b %2,%0";
4443 return "rol%.b %2,%0";
4447 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
4448 (rotate:QI (match_dup 0)
4449 (match_operand:QI 1 "general_operand" "dI")))]
4452 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 4)
4454 operands[2] = GEN_INT (8 - INTVAL (operands[2]));
4455 return "ror%.b %2,%0";
4458 return "rol%.b %2,%0";
4461 (define_insn "rotrsi3"
4462 [(set (match_operand:SI 0 "register_operand" "=d")
4463 (rotatert:SI (match_operand:SI 1 "register_operand" "0")
4464 (match_operand:SI 2 "general_operand" "dI")))]
4468 (define_insn "rotrhi3"
4469 [(set (match_operand:HI 0 "register_operand" "=d")
4470 (rotatert:HI (match_operand:HI 1 "register_operand" "0")
4471 (match_operand:HI 2 "general_operand" "dI")))]
4476 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
4477 (rotatert:HI (match_dup 0)
4478 (match_operand:HI 1 "general_operand" "dI")))]
4482 (define_insn "rotrqi3"
4483 [(set (match_operand:QI 0 "register_operand" "=d")
4484 (rotatert:QI (match_operand:QI 1 "register_operand" "0")
4485 (match_operand:QI 2 "general_operand" "dI")))]
4490 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
4491 (rotatert:QI (match_dup 0)
4492 (match_operand:QI 1 "general_operand" "dI")))]
4497 ;; Bit set/clear in memory byte.
4499 ;; set bit, bit number is int
4500 (define_insn "bsetmemqi"
4501 [(set (match_operand:QI 0 "memory_operand" "+m")
4502 (ior:QI (subreg:QI (ashift:SI (const_int 1)
4503 (match_operand:SI 1 "general_operand" "d")) 3)
4508 return "bset %1,%0";
4511 ;; set bit, bit number is (sign/zero)_extended from HImode/QImode
4513 [(set (match_operand:QI 0 "memory_operand" "+m")
4514 (ior:QI (subreg:QI (ashift:SI (const_int 1)
4515 (match_operator:SI 2 "extend_operator"
4516 [(match_operand 1 "general_operand" "d")])) 3)
4521 return "bset %1,%0";
4524 ;; clear bit, bit number is int
4525 (define_insn "bclrmemqi"
4526 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+m")
4528 (minus:SI (const_int 7)
4529 (match_operand:SI 1 "general_operand" "d")))
4534 return "bclr %1,%0";
4537 ;; clear bit, bit number is (sign/zero)_extended from HImode/QImode
4539 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+m")
4541 (minus:SI (const_int 7)
4542 (match_operator:SI 2 "extend_operator"
4543 [(match_operand 1 "general_operand" "d")])))
4548 return "bclr %1,%0";
4551 ;; Special cases of bit-field insns which we should
4552 ;; recognize in preference to the general case.
4553 ;; These handle aligned 8-bit and 16-bit fields,
4554 ;; which can usually be done with move instructions.
4557 ; Special case for 32-bit field in memory. This only occurs when 32-bit
4558 ; alignment of structure members is specified.
4560 ; The move is allowed to be odd byte aligned, because that's still faster
4561 ; than an odd byte aligned bit-field instruction.
4564 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
4566 (match_operand:SI 1 "const_int_operand" "n"))
4567 (match_operand:SI 2 "general_src_operand" "rmSi"))]
4568 "TARGET_68020 && TARGET_BITFIELD
4569 && (INTVAL (operands[1]) % 8) == 0
4570 && ! mode_dependent_address_p (XEXP (operands[0], 0))"
4573 = adjust_address (operands[0], SImode, INTVAL (operands[1]) / 8);
4575 return "move%.l %2,%0";
4579 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+do")
4580 (match_operand:SI 1 "const_int_operand" "n")
4581 (match_operand:SI 2 "const_int_operand" "n"))
4582 (match_operand:SI 3 "register_operand" "d"))]
4583 "TARGET_68020 && TARGET_BITFIELD
4584 && (INTVAL (operands[1]) == 8 || INTVAL (operands[1]) == 16)
4585 && INTVAL (operands[2]) % INTVAL (operands[1]) == 0
4586 && (GET_CODE (operands[0]) == REG
4587 || ! mode_dependent_address_p (XEXP (operands[0], 0)))"
4589 if (REG_P (operands[0]))
4591 if (INTVAL (operands[1]) + INTVAL (operands[2]) != 32)
4592 return "bfins %3,%0{%b2:%b1}";
4595 operands[0] = adjust_address (operands[0],
4596 INTVAL (operands[1]) == 8 ? QImode : HImode,
4597 INTVAL (operands[2]) / 8);
4599 if (GET_CODE (operands[3]) == MEM)
4600 operands[3] = adjust_address (operands[3],
4601 INTVAL (operands[1]) == 8 ? QImode : HImode,
4602 (32 - INTVAL (operands[1])) / 8);
4604 if (INTVAL (operands[1]) == 8)
4605 return "move%.b %3,%0";
4606 return "move%.w %3,%0";
4611 ; Special case for 32-bit field in memory. This only occurs when 32-bit
4612 ; alignment of structure members is specified.
4614 ; The move is allowed to be odd byte aligned, because that's still faster
4615 ; than an odd byte aligned bit-field instruction.
4618 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
4619 (zero_extract:SI (match_operand:QI 1 "memory_src_operand" "oS")
4621 (match_operand:SI 2 "const_int_operand" "n")))]
4622 "TARGET_68020 && TARGET_BITFIELD
4623 && (INTVAL (operands[2]) % 8) == 0
4624 && ! mode_dependent_address_p (XEXP (operands[1], 0))"
4627 = adjust_address (operands[1], SImode, INTVAL (operands[2]) / 8);
4629 return "move%.l %1,%0";
4633 [(set (match_operand:SI 0 "nonimmediate_operand" "=&d")
4634 (zero_extract:SI (match_operand:SI 1 "register_operand" "do")
4635 (match_operand:SI 2 "const_int_operand" "n")
4636 (match_operand:SI 3 "const_int_operand" "n")))]
4637 "TARGET_68020 && TARGET_BITFIELD
4638 && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
4639 && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
4640 && (GET_CODE (operands[1]) == REG
4641 || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
4643 cc_status.flags |= CC_NOT_NEGATIVE;
4644 if (REG_P (operands[1]))
4646 if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
4647 return "bfextu %1{%b3:%b2},%0";
4651 = adjust_address (operands[1], SImode, INTVAL (operands[3]) / 8);
4653 output_asm_insn ("clr%.l %0", operands);
4654 if (GET_CODE (operands[0]) == MEM)
4655 operands[0] = adjust_address (operands[0],
4656 INTVAL (operands[2]) == 8 ? QImode : HImode,
4657 (32 - INTVAL (operands[1])) / 8);
4659 if (INTVAL (operands[2]) == 8)
4660 return "move%.b %1,%0";
4661 return "move%.w %1,%0";
4665 ; Special case for 32-bit field in memory. This only occurs when 32-bit
4666 ; alignment of structure members is specified.
4668 ; The move is allowed to be odd byte aligned, because that's still faster
4669 ; than an odd byte aligned bit-field instruction.
4672 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
4673 (sign_extract:SI (match_operand:QI 1 "memory_src_operand" "oS")
4675 (match_operand:SI 2 "const_int_operand" "n")))]
4676 "TARGET_68020 && TARGET_BITFIELD
4677 && (INTVAL (operands[2]) % 8) == 0
4678 && ! mode_dependent_address_p (XEXP (operands[1], 0))"
4681 = adjust_address (operands[1], SImode, INTVAL (operands[2]) / 8);
4683 return "move%.l %1,%0";
4687 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
4688 (sign_extract:SI (match_operand:SI 1 "register_operand" "do")
4689 (match_operand:SI 2 "const_int_operand" "n")
4690 (match_operand:SI 3 "const_int_operand" "n")))]
4691 "TARGET_68020 && TARGET_BITFIELD
4692 && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
4693 && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
4694 && (GET_CODE (operands[1]) == REG
4695 || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
4697 if (REG_P (operands[1]))
4699 if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
4700 return "bfexts %1{%b3:%b2},%0";
4704 = adjust_address (operands[1],
4705 INTVAL (operands[2]) == 8 ? QImode : HImode,
4706 INTVAL (operands[3]) / 8);
4708 if (INTVAL (operands[2]) == 8)
4709 return "move%.b %1,%0\;extb%.l %0";
4710 return "move%.w %1,%0\;ext%.l %0";
4713 ;; Bit-field instructions, general cases.
4714 ;; "o,d" constraint causes a nonoffsettable memref to match the "o"
4715 ;; so that its address is reloaded.
4717 (define_expand "extv"
4718 [(set (match_operand:SI 0 "nonimmediate_operand" "")
4719 (sign_extract:SI (match_operand:SI 1 "general_operand" "")
4720 (match_operand:SI 2 "general_operand" "")
4721 (match_operand:SI 3 "general_operand" "")))]
4722 "TARGET_68020 && TARGET_BITFIELD"
4726 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
4727 (sign_extract:SI (match_operand:QI 1 "memory_operand" "o")
4728 (match_operand:SI 2 "general_operand" "dn")
4729 (match_operand:SI 3 "general_operand" "dn")))]
4730 "TARGET_68020 && TARGET_BITFIELD"
4731 "bfexts %1{%b3:%b2},%0")
4733 (define_expand "extzv"
4734 [(set (match_operand:SI 0 "nonimmediate_operand" "")
4735 (zero_extract:SI (match_operand:SI 1 "general_operand" "")
4736 (match_operand:SI 2 "general_operand" "")
4737 (match_operand:SI 3 "general_operand" "")))]
4738 "TARGET_68020 && TARGET_BITFIELD"
4742 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d")
4743 (zero_extract:SI (match_operand:QI 1 "memory_operand" "o,d")
4744 (match_operand:SI 2 "general_operand" "dn,dn")
4745 (match_operand:SI 3 "general_operand" "dn,dn")))]
4746 "TARGET_68020 && TARGET_BITFIELD"
4748 if (GET_CODE (operands[2]) == CONST_INT)
4750 if (INTVAL (operands[2]) != 32)
4751 cc_status.flags |= CC_NOT_NEGATIVE;
4757 return "bfextu %1{%b3:%b2},%0";
4761 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
4762 (match_operand:SI 1 "general_operand" "dn")
4763 (match_operand:SI 2 "general_operand" "dn"))
4764 (xor:SI (zero_extract:SI (match_dup 0) (match_dup 1) (match_dup 2))
4765 (match_operand 3 "const_int_operand" "n")))]
4766 "TARGET_68020 && TARGET_BITFIELD
4767 && (INTVAL (operands[3]) == -1
4768 || (GET_CODE (operands[1]) == CONST_INT
4769 && (~ INTVAL (operands[3]) & ((1 << INTVAL (operands[1]))- 1)) == 0))"
4772 return "bfchg %0{%b2:%b1}";
4776 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
4777 (match_operand:SI 1 "general_operand" "dn")
4778 (match_operand:SI 2 "general_operand" "dn"))
4780 "TARGET_68020 && TARGET_BITFIELD"
4783 return "bfclr %0{%b2:%b1}";
4787 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
4788 (match_operand:SI 1 "general_operand" "dn")
4789 (match_operand:SI 2 "general_operand" "dn"))
4791 "TARGET_68020 && TARGET_BITFIELD"
4794 return "bfset %0{%b2:%b1}";
4797 (define_expand "insv"
4798 [(set (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "")
4799 (match_operand:SI 1 "general_operand" "")
4800 (match_operand:SI 2 "general_operand" ""))
4801 (match_operand:SI 3 "register_operand" ""))]
4802 "TARGET_68020 && TARGET_BITFIELD"
4806 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
4807 (match_operand:SI 1 "general_operand" "dn")
4808 (match_operand:SI 2 "general_operand" "dn"))
4809 (match_operand:SI 3 "register_operand" "d"))]
4810 "TARGET_68020 && TARGET_BITFIELD"
4811 "bfins %3,%0{%b2:%b1}")
4813 ;; Now recognize bit-field insns that operate on registers
4814 ;; (or at least were intended to do so).
4817 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
4818 (sign_extract:SI (match_operand:SI 1 "register_operand" "d")
4819 (match_operand:SI 2 "general_operand" "dn")
4820 (match_operand:SI 3 "general_operand" "dn")))]
4821 "TARGET_68020 && TARGET_BITFIELD"
4822 "bfexts %1{%b3:%b2},%0")
4825 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
4826 (zero_extract:SI (match_operand:SI 1 "register_operand" "d")
4827 (match_operand:SI 2 "general_operand" "dn")
4828 (match_operand:SI 3 "general_operand" "dn")))]
4829 "TARGET_68020 && TARGET_BITFIELD"
4831 if (GET_CODE (operands[2]) == CONST_INT)
4833 if (INTVAL (operands[2]) != 32)
4834 cc_status.flags |= CC_NOT_NEGATIVE;
4840 return "bfextu %1{%b3:%b2},%0";
4844 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
4845 (match_operand:SI 1 "general_operand" "dn")
4846 (match_operand:SI 2 "general_operand" "dn"))
4848 "TARGET_68020 && TARGET_BITFIELD"
4851 return "bfclr %0{%b2:%b1}";
4855 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
4856 (match_operand:SI 1 "general_operand" "dn")
4857 (match_operand:SI 2 "general_operand" "dn"))
4859 "TARGET_68020 && TARGET_BITFIELD"
4862 return "bfset %0{%b2:%b1}";
4866 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
4867 (match_operand:SI 1 "general_operand" "dn")
4868 (match_operand:SI 2 "general_operand" "dn"))
4869 (match_operand:SI 3 "register_operand" "d"))]
4870 "TARGET_68020 && TARGET_BITFIELD"
4873 /* These special cases are now recognized by a specific pattern. */
4874 if (GET_CODE (operands[1]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT
4875 && INTVAL (operands[1]) == 16 && INTVAL (operands[2]) == 16)
4876 return "move%.w %3,%0";
4877 if (GET_CODE (operands[1]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT
4878 && INTVAL (operands[1]) == 24 && INTVAL (operands[2]) == 8)
4879 return "move%.b %3,%0";
4881 return "bfins %3,%0{%b2:%b1}";
4884 ;; Special patterns for optimizing bit-field instructions.
4888 (zero_extract:SI (match_operand:QI 0 "memory_operand" "o")
4889 (match_operand:SI 1 "const_int_operand" "n")
4890 (match_operand:SI 2 "general_operand" "dn")))]
4891 "TARGET_68020 && TARGET_BITFIELD"
4893 if (operands[1] == const1_rtx
4894 && GET_CODE (operands[2]) == CONST_INT)
4896 int width = GET_CODE (operands[0]) == REG ? 31 : 7;
4897 return output_btst (operands,
4898 GEN_INT (width - INTVAL (operands[2])),
4899 operands[0], insn, 1000);
4900 /* Pass 1000 as SIGNPOS argument so that btst will
4901 not think we are testing the sign bit for an `and'
4902 and assume that nonzero implies a negative result. */
4904 if (INTVAL (operands[1]) != 32)
4905 cc_status.flags = CC_NOT_NEGATIVE;
4906 return "bftst %0{%b2:%b1}";
4910 ;;; now handle the register cases
4913 (zero_extract:SI (match_operand:SI 0 "register_operand" "d")
4914 (match_operand:SI 1 "const_int_operand" "n")
4915 (match_operand:SI 2 "general_operand" "dn")))]
4916 "TARGET_68020 && TARGET_BITFIELD"
4918 if (operands[1] == const1_rtx
4919 && GET_CODE (operands[2]) == CONST_INT)
4921 int width = GET_CODE (operands[0]) == REG ? 31 : 7;
4922 return output_btst (operands, GEN_INT (width - INTVAL (operands[2])),
4923 operands[0], insn, 1000);
4924 /* Pass 1000 as SIGNPOS argument so that btst will
4925 not think we are testing the sign bit for an `and'
4926 and assume that nonzero implies a negative result. */
4928 if (INTVAL (operands[1]) != 32)
4929 cc_status.flags = CC_NOT_NEGATIVE;
4930 return "bftst %0{%b2:%b1}";
4933 (define_insn "scc0_di"
4934 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
4935 (match_operator 1 "valid_dbcc_comparison_p"
4936 [(match_operand:DI 2 "general_operand" "ro") (const_int 0)]))]
4939 return output_scc_di (operands[1], operands[2], const0_rtx, operands[0]);
4942 (define_insn "scc0_di_5200"
4943 [(set (match_operand:QI 0 "nonimmediate_operand" "=d")
4944 (match_operator 1 "valid_dbcc_comparison_p"
4945 [(match_operand:DI 2 "general_operand" "ro") (const_int 0)]))]
4948 return output_scc_di (operands[1], operands[2], const0_rtx, operands[0]);
4951 (define_insn "scc_di"
4952 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,dm")
4953 (match_operator 1 "valid_dbcc_comparison_p"
4954 [(match_operand:DI 2 "general_operand" "ro,r")
4955 (match_operand:DI 3 "general_operand" "r,ro")]))]
4958 return output_scc_di (operands[1], operands[2], operands[3], operands[0]);
4961 (define_insn "scc_di_5200"
4962 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d")
4963 (match_operator 1 "valid_dbcc_comparison_p"
4964 [(match_operand:DI 2 "general_operand" "ro,r")
4965 (match_operand:DI 3 "general_operand" "r,ro")]))]
4968 return output_scc_di (operands[1], operands[2], operands[3], operands[0]);
4971 ;; Note that operand 0 of an SCC insn is supported in the hardware as
4972 ;; memory, but we cannot allow it to be in memory in case the address
4973 ;; needs to be reloaded.
4975 (define_expand "seq"
4976 [(set (match_operand:QI 0 "register_operand" "")
4977 (eq:QI (cc0) (const_int 0)))]
4980 if (TARGET_68060 && m68k_last_compare_had_fp_operands)
4982 m68k_last_compare_had_fp_operands = 0;
4988 [(set (match_operand:QI 0 "register_operand" "=d")
4989 (eq:QI (cc0) (const_int 0)))]
4992 cc_status = cc_prev_status;
4993 OUTPUT_JUMP ("seq %0", "fseq %0", "seq %0");
4996 (define_expand "sne"
4997 [(set (match_operand:QI 0 "register_operand" "")
4998 (ne:QI (cc0) (const_int 0)))]
5001 if (TARGET_68060 && m68k_last_compare_had_fp_operands)
5003 m68k_last_compare_had_fp_operands = 0;
5009 [(set (match_operand:QI 0 "register_operand" "=d")
5010 (ne:QI (cc0) (const_int 0)))]
5013 cc_status = cc_prev_status;
5014 OUTPUT_JUMP ("sne %0", "fsne %0", "sne %0");
5017 (define_expand "sgt"
5018 [(set (match_operand:QI 0 "register_operand" "")
5019 (gt:QI (cc0) (const_int 0)))]
5022 if (TARGET_68060 && m68k_last_compare_had_fp_operands)
5024 m68k_last_compare_had_fp_operands = 0;
5030 [(set (match_operand:QI 0 "register_operand" "=d")
5031 (gt:QI (cc0) (const_int 0)))]
5034 cc_status = cc_prev_status;
5035 OUTPUT_JUMP ("sgt %0", "fsgt %0", 0);
5038 (define_expand "sgtu"
5039 [(set (match_operand:QI 0 "register_operand" "")
5040 (gtu:QI (cc0) (const_int 0)))]
5045 [(set (match_operand:QI 0 "register_operand" "=d")
5046 (gtu:QI (cc0) (const_int 0)))]
5049 cc_status = cc_prev_status;
5053 (define_expand "slt"
5054 [(set (match_operand:QI 0 "register_operand" "")
5055 (lt:QI (cc0) (const_int 0)))]
5058 if (TARGET_68060 && m68k_last_compare_had_fp_operands)
5060 m68k_last_compare_had_fp_operands = 0;
5066 [(set (match_operand:QI 0 "register_operand" "=d")
5067 (lt:QI (cc0) (const_int 0)))]
5070 cc_status = cc_prev_status;
5071 OUTPUT_JUMP ("slt %0", "fslt %0", "smi %0");
5074 (define_expand "sltu"
5075 [(set (match_operand:QI 0 "register_operand" "")
5076 (ltu:QI (cc0) (const_int 0)))]
5081 [(set (match_operand:QI 0 "register_operand" "=d")
5082 (ltu:QI (cc0) (const_int 0)))]
5085 cc_status = cc_prev_status;
5089 (define_expand "sge"
5090 [(set (match_operand:QI 0 "register_operand" "")
5091 (ge:QI (cc0) (const_int 0)))]
5094 if (TARGET_68060 && m68k_last_compare_had_fp_operands)
5096 m68k_last_compare_had_fp_operands = 0;
5102 [(set (match_operand:QI 0 "register_operand" "=d")
5103 (ge:QI (cc0) (const_int 0)))]
5106 cc_status = cc_prev_status;
5107 OUTPUT_JUMP ("sge %0", "fsge %0", "spl %0");
5110 (define_expand "sgeu"
5111 [(set (match_operand:QI 0 "register_operand" "")
5112 (geu:QI (cc0) (const_int 0)))]
5117 [(set (match_operand:QI 0 "register_operand" "=d")
5118 (geu:QI (cc0) (const_int 0)))]
5121 cc_status = cc_prev_status;
5125 (define_expand "sle"
5126 [(set (match_operand:QI 0 "register_operand" "")
5127 (le:QI (cc0) (const_int 0)))]
5130 if (TARGET_68060 && m68k_last_compare_had_fp_operands)
5132 m68k_last_compare_had_fp_operands = 0;
5138 [(set (match_operand:QI 0 "register_operand" "=d")
5139 (le:QI (cc0) (const_int 0)))]
5142 cc_status = cc_prev_status;
5143 OUTPUT_JUMP ("sle %0", "fsle %0", 0);
5146 (define_expand "sleu"
5147 [(set (match_operand:QI 0 "register_operand" "")
5148 (leu:QI (cc0) (const_int 0)))]
5153 [(set (match_operand:QI 0 "register_operand" "=d")
5154 (leu:QI (cc0) (const_int 0)))]
5157 cc_status = cc_prev_status;
5161 (define_expand "sordered"
5162 [(set (match_operand:QI 0 "register_operand" "")
5163 (ordered:QI (cc0) (const_int 0)))]
5164 "TARGET_68881 && !TARGET_68060"
5166 if (! m68k_last_compare_had_fp_operands)
5168 m68k_last_compare_had_fp_operands = 0;
5171 (define_insn "*sordered_1"
5172 [(set (match_operand:QI 0 "register_operand" "=d")
5173 (ordered:QI (cc0) (const_int 0)))]
5174 "TARGET_68881 && !TARGET_68060"
5176 cc_status = cc_prev_status;
5180 (define_expand "sunordered"
5181 [(set (match_operand:QI 0 "register_operand" "")
5182 (unordered:QI (cc0) (const_int 0)))]
5183 "TARGET_68881 && !TARGET_68060"
5185 if (! m68k_last_compare_had_fp_operands)
5187 m68k_last_compare_had_fp_operands = 0;
5190 (define_insn "*sunordered_1"
5191 [(set (match_operand:QI 0 "register_operand" "=d")
5192 (unordered:QI (cc0) (const_int 0)))]
5193 "TARGET_68881 && !TARGET_68060"
5195 cc_status = cc_prev_status;
5199 (define_expand "suneq"
5200 [(set (match_operand:QI 0 "register_operand" "")
5201 (uneq:QI (cc0) (const_int 0)))]
5202 "TARGET_68881 && !TARGET_68060"
5204 if (! m68k_last_compare_had_fp_operands)
5206 m68k_last_compare_had_fp_operands = 0;
5209 (define_insn "*suneq_1"
5210 [(set (match_operand:QI 0 "register_operand" "=d")
5211 (uneq:QI (cc0) (const_int 0)))]
5212 "TARGET_68881 && !TARGET_68060"
5214 cc_status = cc_prev_status;
5218 (define_expand "sunge"
5219 [(set (match_operand:QI 0 "register_operand" "")
5220 (unge:QI (cc0) (const_int 0)))]
5221 "TARGET_68881 && !TARGET_68060"
5223 if (! m68k_last_compare_had_fp_operands)
5225 m68k_last_compare_had_fp_operands = 0;
5228 (define_insn "*sunge_1"
5229 [(set (match_operand:QI 0 "register_operand" "=d")
5230 (unge:QI (cc0) (const_int 0)))]
5231 "TARGET_68881 && !TARGET_68060"
5233 cc_status = cc_prev_status;
5237 (define_expand "sungt"
5238 [(set (match_operand:QI 0 "register_operand" "")
5239 (ungt:QI (cc0) (const_int 0)))]
5240 "TARGET_68881 && !TARGET_68060"
5242 if (! m68k_last_compare_had_fp_operands)
5244 m68k_last_compare_had_fp_operands = 0;
5247 (define_insn "*sungt_1"
5248 [(set (match_operand:QI 0 "register_operand" "=d")
5249 (ungt:QI (cc0) (const_int 0)))]
5250 "TARGET_68881 && !TARGET_68060"
5252 cc_status = cc_prev_status;
5256 (define_expand "sunle"
5257 [(set (match_operand:QI 0 "register_operand" "")
5258 (unle:QI (cc0) (const_int 0)))]
5259 "TARGET_68881 && !TARGET_68060"
5261 if (! m68k_last_compare_had_fp_operands)
5263 m68k_last_compare_had_fp_operands = 0;
5266 (define_insn "*sunle_1"
5267 [(set (match_operand:QI 0 "register_operand" "=d")
5268 (unle:QI (cc0) (const_int 0)))]
5269 "TARGET_68881 && !TARGET_68060"
5271 cc_status = cc_prev_status;
5275 (define_expand "sunlt"
5276 [(set (match_operand:QI 0 "register_operand" "")
5277 (unlt:QI (cc0) (const_int 0)))]
5278 "TARGET_68881 && !TARGET_68060"
5280 if (! m68k_last_compare_had_fp_operands)
5282 m68k_last_compare_had_fp_operands = 0;
5285 (define_insn "*sunlt_1"
5286 [(set (match_operand:QI 0 "register_operand" "=d")
5287 (unlt:QI (cc0) (const_int 0)))]
5288 "TARGET_68881 && !TARGET_68060"
5290 cc_status = cc_prev_status;
5294 (define_expand "sltgt"
5295 [(set (match_operand:QI 0 "register_operand" "")
5296 (ltgt:QI (cc0) (const_int 0)))]
5297 "TARGET_68881 && !TARGET_68060"
5299 if (! m68k_last_compare_had_fp_operands)
5301 m68k_last_compare_had_fp_operands = 0;
5304 (define_insn "*sltgt_1"
5305 [(set (match_operand:QI 0 "register_operand" "=d")
5306 (ltgt:QI (cc0) (const_int 0)))]
5307 "TARGET_68881 && !TARGET_68060"
5309 cc_status = cc_prev_status;
5313 (define_insn "*fsogt_1"
5314 [(set (match_operand:QI 0 "register_operand" "=d")
5315 (not:QI (unle:QI (cc0) (const_int 0))))]
5316 "TARGET_68881 && !TARGET_68060"
5318 cc_status = cc_prev_status;
5322 (define_insn "*fsoge_1"
5323 [(set (match_operand:QI 0 "register_operand" "=d")
5324 (not:QI (unlt:QI (cc0) (const_int 0))))]
5325 "TARGET_68881 && !TARGET_68060"
5327 cc_status = cc_prev_status;
5331 (define_insn "*fsolt_1"
5332 [(set (match_operand:QI 0 "register_operand" "=d")
5333 (not:QI (unge:QI (cc0) (const_int 0))))]
5334 "TARGET_68881 && !TARGET_68060"
5336 cc_status = cc_prev_status;
5340 (define_insn "*fsole_1"
5341 [(set (match_operand:QI 0 "register_operand" "=d")
5342 (not:QI (ungt:QI (cc0) (const_int 0))))]
5343 "TARGET_68881 && !TARGET_68060"
5345 cc_status = cc_prev_status;
5349 ;; Basic conditional jump instructions.
5351 (define_insn "beq0_di"
5353 (if_then_else (eq (match_operand:DI 0 "general_operand" "d*ao,<>")
5355 (label_ref (match_operand 1 "" ","))
5357 (clobber (match_scratch:SI 2 "=d,d"))]
5361 if (which_alternative == 1)
5364 return "move%.l %0,%2\;or%.l %0,%2\;jbeq %l1";
5366 return "move%.l %0,%2\;or%.l %0,%2\;jeq %l1";
5368 if ((cc_prev_status.value1
5369 && rtx_equal_p (cc_prev_status.value1, operands[0]))
5370 || (cc_prev_status.value2
5371 && rtx_equal_p (cc_prev_status.value2, operands[0])))
5373 cc_status = cc_prev_status;
5374 return MOTOROLA ? "jbeq %l1" : "jeq %l1";
5376 if (GET_CODE (operands[0]) == REG)
5377 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
5379 operands[3] = adjust_address (operands[0], SImode, 4);
5380 if (! ADDRESS_REG_P (operands[0]))
5382 if (reg_overlap_mentioned_p (operands[2], operands[0]))
5384 if (reg_overlap_mentioned_p (operands[2], operands[3]))
5387 return "or%.l %0,%2\;jbeq %l1";
5389 return "or%.l %0,%2\;jeq %l1";
5394 return "or%.l %3,%2\;jbeq %l1";
5396 return "or%.l %3,%2\;jeq %l1";
5400 return "move%.l %0,%2\;or%.l %3,%2\;jbeq %l1";
5402 return "move%.l %0,%2\;or%.l %3,%2\;jeq %l1";
5404 operands[4] = gen_label_rtx();
5405 if (TARGET_68020 || TARGET_COLDFIRE)
5408 output_asm_insn ("tst%.l %0\;jbne %l4\;tst%.l %3\;jbeq %l1", operands);
5410 output_asm_insn ("tst%.l %0\;jne %l4\;tst%.l %3\;jeq %l1", operands);
5415 output_asm_insn ("cmp%.w #0,%0\;jbne %l4\;cmp%.w #0,%3\;jbeq %l1", operands);
5417 output_asm_insn ("cmp%.w #0,%0\;jne %l4\;cmp%.w #0,%3\;jeq %l1", operands);
5419 (*targetm.asm_out.internal_label) (asm_out_file, "L",
5420 CODE_LABEL_NUMBER (operands[4]));
5424 (define_insn "bne0_di"
5426 (if_then_else (ne (match_operand:DI 0 "general_operand" "do,*a")
5428 (label_ref (match_operand 1 "" ","))
5430 (clobber (match_scratch:SI 2 "=d,X"))]
5433 if ((cc_prev_status.value1
5434 && rtx_equal_p (cc_prev_status.value1, operands[0]))
5435 || (cc_prev_status.value2
5436 && rtx_equal_p (cc_prev_status.value2, operands[0])))
5438 cc_status = cc_prev_status;
5439 return MOTOROLA ? "jbne %l1" : "jne %l1";
5442 if (GET_CODE (operands[0]) == REG)
5443 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
5445 operands[3] = adjust_address (operands[0], SImode, 4);
5446 if (!ADDRESS_REG_P (operands[0]))
5448 if (reg_overlap_mentioned_p (operands[2], operands[0]))
5450 if (reg_overlap_mentioned_p (operands[2], operands[3]))
5453 return "or%.l %0,%2\;jbne %l1";
5455 return "or%.l %0,%2\;jne %l1";
5460 return "or%.l %3,%2\;jbne %l1";
5462 return "or%.l %3,%2\;jne %l1";
5466 return "move%.l %0,%2\;or%.l %3,%2\;jbne %l1";
5468 return "move%.l %0,%2\;or%.l %3,%2\;jne %l1";
5470 if (TARGET_68020 || TARGET_COLDFIRE)
5473 return "tst%.l %0\;jbne %l1\;tst%.l %3\;jbne %l1";
5475 return "tst%.l %0\;jne %l1\;tst%.l %3\;jne %l1";
5480 return "cmp%.w #0,%0\;jbne %l1\;cmp%.w #0,%3\;jbne %l1";
5482 return "cmp%.w #0,%0\;jne %l1\;cmp%.w #0,%3\;jne %l1";
5486 (define_insn "bge0_di"
5488 (if_then_else (ge (match_operand:DI 0 "general_operand" "ro")
5490 (label_ref (match_operand 1 "" ""))
5494 if ((cc_prev_status.value1
5495 && rtx_equal_p (cc_prev_status.value1, operands[0]))
5496 || (cc_prev_status.value2
5497 && rtx_equal_p (cc_prev_status.value2, operands[0])))
5499 cc_status = cc_prev_status;
5500 if (cc_status.flags & CC_REVERSED)
5502 return MOTOROLA ? "jble %l1" : "jle %l1";
5506 return MOTOROLA ? "jbpl %l1" : "jpl %l1";
5510 if (TARGET_68020 || TARGET_COLDFIRE || ! ADDRESS_REG_P (operands[0]))
5511 output_asm_insn("tst%.l %0", operands);
5514 /* On an address reg, cmpw may replace cmpl. */
5515 output_asm_insn("cmp%.w #0,%0", operands);
5517 return MOTOROLA ? "jbpl %l1" : "jpl %l1";
5520 (define_insn "blt0_di"
5522 (if_then_else (lt (match_operand:DI 0 "general_operand" "ro")
5524 (label_ref (match_operand 1 "" ""))
5528 if ((cc_prev_status.value1
5529 && rtx_equal_p (cc_prev_status.value1, operands[0]))
5530 || (cc_prev_status.value2
5531 && rtx_equal_p (cc_prev_status.value2, operands[0])))
5533 cc_status = cc_prev_status;
5534 if (cc_status.flags & CC_REVERSED)
5536 return MOTOROLA ? "jbgt %l1" : "jgt %l1";
5540 return MOTOROLA ? "jbmi %l1" : "jmi %l1";
5544 if (TARGET_68020 || TARGET_COLDFIRE || ! ADDRESS_REG_P (operands[0]))
5545 output_asm_insn("tst%.l %0", operands);
5548 /* On an address reg, cmpw may replace cmpl. */
5549 output_asm_insn("cmp%.w #0,%0", operands);
5552 return MOTOROLA ? "jbmi %l1" : "jmi %l1";
5557 (if_then_else (eq (cc0)
5559 (label_ref (match_operand 0 "" ""))
5564 OUTPUT_JUMP ("jbeq %l0", "fbeq %l0", "jbeq %l0");
5566 OUTPUT_JUMP ("jeq %l0", "fjeq %l0", "jeq %l0");
5571 (if_then_else (ne (cc0)
5573 (label_ref (match_operand 0 "" ""))
5578 OUTPUT_JUMP ("jbne %l0", "fbne %l0", "jbne %l0");
5580 OUTPUT_JUMP ("jne %l0", "fjne %l0", "jne %l0");
5585 (if_then_else (gt (cc0)
5587 (label_ref (match_operand 0 "" ""))
5592 OUTPUT_JUMP ("jbgt %l0", "fbgt %l0", 0);
5594 OUTPUT_JUMP ("jgt %l0", "fjgt %l0", 0);
5599 (if_then_else (gtu (cc0)
5601 (label_ref (match_operand 0 "" ""))
5605 return MOTOROLA ? "jbhi %l0" : "jhi %l0";
5610 (if_then_else (lt (cc0)
5612 (label_ref (match_operand 0 "" ""))
5617 OUTPUT_JUMP ("jblt %l0", "fblt %l0", "jbmi %l0");
5619 OUTPUT_JUMP ("jlt %l0", "fjlt %l0", "jmi %l0");
5624 (if_then_else (ltu (cc0)
5626 (label_ref (match_operand 0 "" ""))
5630 return MOTOROLA ? "jbcs %l0" : "jcs %l0";
5635 (if_then_else (ge (cc0)
5637 (label_ref (match_operand 0 "" ""))
5642 OUTPUT_JUMP ("jbge %l0", "fbge %l0", "jbpl %l0");
5644 OUTPUT_JUMP ("jge %l0", "fjge %l0", "jpl %l0");
5649 (if_then_else (geu (cc0)
5651 (label_ref (match_operand 0 "" ""))
5655 return MOTOROLA ? "jbcc %l0" : "jcc %l0";
5660 (if_then_else (le (cc0)
5662 (label_ref (match_operand 0 "" ""))
5667 OUTPUT_JUMP ("jble %l0", "fble %l0", 0);
5669 OUTPUT_JUMP ("jle %l0", "fjle %l0", 0);
5674 (if_then_else (leu (cc0)
5676 (label_ref (match_operand 0 "" ""))
5680 return MOTOROLA ? "jbls %l0" : "jls %l0";
5683 (define_insn "bordered"
5685 (if_then_else (ordered (cc0) (const_int 0))
5686 (label_ref (match_operand 0 "" ""))
5690 if (!(cc_prev_status.flags & CC_IN_68881))
5692 return MOTOROLA ? "fbor %l0" : "fjor %l0";
5695 (define_insn "bunordered"
5697 (if_then_else (unordered (cc0) (const_int 0))
5698 (label_ref (match_operand 0 "" ""))
5702 if (!(cc_prev_status.flags & CC_IN_68881))
5704 return MOTOROLA ? "fbun %l0" : "fjun %l0";
5707 (define_insn "buneq"
5709 (if_then_else (uneq (cc0) (const_int 0))
5710 (label_ref (match_operand 0 "" ""))
5714 if (!(cc_prev_status.flags & CC_IN_68881))
5716 return MOTOROLA ? "fbueq %l0" : "fjueq %l0";
5719 (define_insn "bunge"
5721 (if_then_else (unge (cc0) (const_int 0))
5722 (label_ref (match_operand 0 "" ""))
5726 if (!(cc_prev_status.flags & CC_IN_68881))
5728 return MOTOROLA ? "fbuge %l0" : "fjuge %l0";
5731 (define_insn "bungt"
5733 (if_then_else (ungt (cc0) (const_int 0))
5734 (label_ref (match_operand 0 "" ""))
5738 if (!(cc_prev_status.flags & CC_IN_68881))
5740 return MOTOROLA ? "fbugt %l0" : "fjugt %l0";
5743 (define_insn "bunle"
5745 (if_then_else (unle (cc0) (const_int 0))
5746 (label_ref (match_operand 0 "" ""))
5750 if (!(cc_prev_status.flags & CC_IN_68881))
5752 return MOTOROLA ? "fbule %l0" : "fjule %l0";
5755 (define_insn "bunlt"
5757 (if_then_else (unlt (cc0) (const_int 0))
5758 (label_ref (match_operand 0 "" ""))
5762 if (!(cc_prev_status.flags & CC_IN_68881))
5764 return MOTOROLA ? "fbult %l0" : "fjult %l0";
5767 (define_insn "bltgt"
5769 (if_then_else (ltgt (cc0) (const_int 0))
5770 (label_ref (match_operand 0 "" ""))
5774 if (!(cc_prev_status.flags & CC_IN_68881))
5776 return MOTOROLA ? "fbogl %l0" : "fjogl %l0";
5779 ;; Negated conditional jump instructions.
5783 (if_then_else (eq (cc0)
5786 (label_ref (match_operand 0 "" ""))))]
5790 OUTPUT_JUMP ("jbne %l0", "fbne %l0", "jbne %l0");
5792 OUTPUT_JUMP ("jne %l0", "fjne %l0", "jne %l0");
5797 (if_then_else (ne (cc0)
5800 (label_ref (match_operand 0 "" ""))))]
5804 OUTPUT_JUMP ("jbeq %l0", "fbeq %l0", "jbeq %l0");
5806 OUTPUT_JUMP ("jeq %l0", "fjeq %l0", "jeq %l0");
5811 (if_then_else (gt (cc0)
5814 (label_ref (match_operand 0 "" ""))))]
5818 OUTPUT_JUMP ("jble %l0", "fbngt %l0", 0);
5820 OUTPUT_JUMP ("jle %l0", "fjngt %l0", 0);
5825 (if_then_else (gtu (cc0)
5828 (label_ref (match_operand 0 "" ""))))]
5831 return MOTOROLA ? "jbls %l0" : "jls %l0";
5836 (if_then_else (lt (cc0)
5839 (label_ref (match_operand 0 "" ""))))]
5843 OUTPUT_JUMP ("jbge %l0", "fbnlt %l0", "jbpl %l0");
5845 OUTPUT_JUMP ("jge %l0", "fjnlt %l0", "jpl %l0");
5850 (if_then_else (ltu (cc0)
5853 (label_ref (match_operand 0 "" ""))))]
5856 return MOTOROLA ? "jbcc %l0" : "jcc %l0";
5861 (if_then_else (ge (cc0)
5864 (label_ref (match_operand 0 "" ""))))]
5868 OUTPUT_JUMP ("jblt %l0", "fbnge %l0", "jbmi %l0");
5870 OUTPUT_JUMP ("jlt %l0", "fjnge %l0", "jmi %l0");
5875 (if_then_else (geu (cc0)
5878 (label_ref (match_operand 0 "" ""))))]
5881 return MOTOROLA ? "jbcs %l0" : "jcs %l0";
5886 (if_then_else (le (cc0)
5889 (label_ref (match_operand 0 "" ""))))]
5893 OUTPUT_JUMP ("jbgt %l0", "fbnle %l0", 0);
5895 OUTPUT_JUMP ("jgt %l0", "fjnle %l0", 0);
5900 (if_then_else (leu (cc0)
5903 (label_ref (match_operand 0 "" ""))))]
5906 return MOTOROLA ? "jbhi %l0" : "jhi %l0";
5909 (define_insn "*bordered_rev"
5911 (if_then_else (ordered (cc0) (const_int 0))
5913 (label_ref (match_operand 0 "" ""))))]
5916 if (!(cc_prev_status.flags & CC_IN_68881))
5918 return MOTOROLA ? "fbun %l0" : "fjun %l0";
5921 (define_insn "*bunordered_rev"
5923 (if_then_else (unordered (cc0) (const_int 0))
5925 (label_ref (match_operand 0 "" ""))))]
5928 if (!(cc_prev_status.flags & CC_IN_68881))
5930 return MOTOROLA ? "fbor %l0" : "fjor %l0";
5933 (define_insn "*buneq_rev"
5935 (if_then_else (uneq (cc0) (const_int 0))
5937 (label_ref (match_operand 0 "" ""))))]
5940 if (!(cc_prev_status.flags & CC_IN_68881))
5942 return MOTOROLA ? "fbogl %l0" : "fjogl %l0";
5945 (define_insn "*bunge_rev"
5947 (if_then_else (unge (cc0) (const_int 0))
5949 (label_ref (match_operand 0 "" ""))))]
5952 if (!(cc_prev_status.flags & CC_IN_68881))
5954 return MOTOROLA ? "fbolt %l0" : "fjolt %l0";
5957 (define_insn "*bunle_rev"
5959 (if_then_else (unle (cc0) (const_int 0))
5961 (label_ref (match_operand 0 "" ""))))]
5964 if (!(cc_prev_status.flags & CC_IN_68881))
5966 return MOTOROLA ? "fbogt %l0" : "fjogt %l0";
5969 (define_insn "*bunlt_rev"
5971 (if_then_else (unlt (cc0) (const_int 0))
5973 (label_ref (match_operand 0 "" ""))))]
5976 if (!(cc_prev_status.flags & CC_IN_68881))
5978 return MOTOROLA ? "fboge %l0" : "fjoge %l0";
5981 (define_insn "*bltgt_rev"
5983 (if_then_else (ltgt (cc0) (const_int 0))
5985 (label_ref (match_operand 0 "" ""))))]
5988 if (!(cc_prev_status.flags & CC_IN_68881))
5990 return MOTOROLA ? "fbueq %l0" : "fjueq %l0";
5993 ;; Unconditional and other jump instructions
5996 (label_ref (match_operand 0 "" "")))]
5999 return MOTOROLA ? "jbra %l0" : "jra %l0";
6002 (define_expand "tablejump"
6003 [(parallel [(set (pc) (match_operand 0 "" ""))
6004 (use (label_ref (match_operand 1 "" "")))])]
6007 #ifdef CASE_VECTOR_PC_RELATIVE
6008 operands[0] = gen_rtx_PLUS (SImode, pc_rtx,
6009 gen_rtx_SIGN_EXTEND (SImode, operands[0]));
6013 ;; Jump to variable address from dispatch table of absolute addresses.
6015 [(set (pc) (match_operand:SI 0 "register_operand" "a"))
6016 (use (label_ref (match_operand 1 "" "")))]
6019 return MOTOROLA ? "jmp (%0)" : "jmp %0@";
6022 ;; Jump to variable address from dispatch table of relative addresses.
6026 (sign_extend:SI (match_operand:HI 0 "register_operand" "r"))))
6027 (use (label_ref (match_operand 1 "" "")))]
6030 #ifdef ASM_RETURN_CASE_JUMP
6031 ASM_RETURN_CASE_JUMP;
6033 if (TARGET_COLDFIRE)
6035 if (ADDRESS_REG_P (operands[0]))
6036 return MOTOROLA ? "jmp (2,pc,%0.l)" : "jmp pc@(2,%0:l)";
6038 return "ext%.l %0\;jmp (2,pc,%0.l)";
6040 return "extl %0\;jmp pc@(2,%0:l)";
6043 return MOTOROLA ? "jmp (2,pc,%0.w)" : "jmp pc@(2,%0:w)";
6047 ;; Decrement-and-branch insns.
6051 (ne (match_operand:HI 0 "nonimmediate_operand" "+d*g")
6053 (label_ref (match_operand 1 "" ""))
6056 (plus:HI (match_dup 0)
6061 if (DATA_REG_P (operands[0]))
6062 return "dbra %0,%l1";
6063 if (GET_CODE (operands[0]) == MEM)
6065 "subq%.w #1,%0\;jbcc %l1" :
6066 "subqw #1,%0\;jcc %l1";
6068 "subq%.w #1,%0\;cmp%.w #-1,%0\;jbne %l1" :
6069 "subqw #1,%0\;cmpw #-1,%0\;jne %l1";
6075 (ne (match_operand:SI 0 "nonimmediate_operand" "+d*g")
6077 (label_ref (match_operand 1 "" ""))
6080 (plus:SI (match_dup 0)
6085 if (DATA_REG_P (operands[0]))
6087 "dbra %0,%l1\;clr%.w %0\;subq%.l #1,%0\;jbcc %l1" :
6088 "dbra %0,%l1\;clr%.w %0\;subq%.l #1,%0\;jcc %l1";
6089 if (GET_CODE (operands[0]) == MEM)
6091 "subq%.l #1,%0\;jbcc %l1" :
6092 "subq%.l #1,%0\;jcc %l1";
6094 "subq.l #1,%0\;cmp.l #-1,%0\;jbne %l1" :
6095 "subql #1,%0\;cmpl #-1,%0\;jne %l1";
6098 ;; Two dbra patterns that use REG_NOTES info generated by strength_reduce.
6103 (ge (plus:HI (match_operand:HI 0 "nonimmediate_operand" "+d*am")
6106 (label_ref (match_operand 1 "" ""))
6109 (plus:HI (match_dup 0)
6111 "!TARGET_COLDFIRE && find_reg_note (insn, REG_NONNEG, 0)"
6114 if (DATA_REG_P (operands[0]))
6115 return "dbra %0,%l1";
6116 if (GET_CODE (operands[0]) == MEM)
6118 "subq%.w #1,%0\;jbcc %l1" :
6119 "subq%.w #1,%0\;jcc %l1";
6121 "subq.w #1,%0\;cmp.w #-1,%0\;jbne %l1" :
6122 "subqw #1,%0\;cmpw #-1,%0\;jne %l1";
6125 (define_expand "decrement_and_branch_until_zero"
6126 [(parallel [(set (pc)
6128 (ge (plus:SI (match_operand:SI 0 "nonimmediate_operand" "")
6131 (label_ref (match_operand 1 "" ""))
6134 (plus:SI (match_dup 0)
6142 (ge (plus:SI (match_operand:SI 0 "nonimmediate_operand" "+d*am")
6145 (label_ref (match_operand 1 "" ""))
6148 (plus:SI (match_dup 0)
6150 "!TARGET_COLDFIRE && find_reg_note (insn, REG_NONNEG, 0)"
6153 if (DATA_REG_P (operands[0]))
6155 "dbra %0,%l1\;clr%.w %0\;subq%.l #1,%0\;jbcc %l1" :
6156 "dbra %0,%l1\;clr%.w %0\;subql #1,%0\;jcc %l1";
6157 if (GET_CODE (operands[0]) == MEM)
6159 "subq%.l #1,%0\;jbcc %l1" :
6160 "subql #1,%0\;jcc %l1";
6162 "subq.l #1,%0\;cmp.l #-1,%0\;jbne %l1" :
6163 "subql #1,%0\;cmpl #-1,%0\;jne %l1";
6167 ;; For PIC calls, in order to be able to support
6168 ;; dynamic linker LAZY BINDING, all the procedure calls need to go
6169 ;; through the PLT (Procedure Linkage Table) section in PIC mode.
6171 ;; PIC calls are handled by loading the address of the function into a
6172 ;; register (via movsi), then emitting a register indirect call using
6173 ;; the "jsr" function call syntax.
6175 ;; When outputting MIT syntax (e.g. on Suns), we add a bogus extra
6176 ;; operand to the jbsr statement to indicate that this call should
6177 ;; go through the PLT (why? because this is the way that Sun does it).
6179 ;; We have different patterns for PIC calls and non-PIC calls. The
6180 ;; different patterns are only used to choose the right syntax.
6182 ;; The svr4 m68k assembler recognizes this syntax: `bsr FUNC@PLTPC' and it
6183 ;; will create the correct relocation entry (R_68K_PLT32) for `FUNC',
6184 ;; that tells the linker editor to create an entry for `FUNC' in PLT
6185 ;; section at link time. However, all global objects reference are still
6186 ;; done by using `OBJ@GOT'. So, the goal here is to output the function
6187 ;; call operand as `FUNC@PLTPC', but output object operand as `OBJ@GOT'.
6188 ;; We need to have a way to differentiate these two different operands.
6190 ;; The strategy I use here is to use SYMBOL_REF_FLAG to differentiate
6191 ;; these two different operands. The macro LEGITIMATE_PIC_OPERAND_P needs
6192 ;; to be changed to recognize function calls symbol_ref operand as a valid
6193 ;; PIC operand (by checking whether SYMBOL_REF_FLAG is set). This will
6194 ;; avoid the compiler to load this symbol_ref operand into a register.
6195 ;; Remember, the operand "foo@PLTPC" cannot be called via jsr directly
6196 ;; since the value is a PC relative offset, not a real address.
6198 ;; All global objects are treated in the similar way as in SUN3. The only
6199 ;; difference is: on m68k svr4, the reference of such global object needs
6200 ;; to end with a suffix "@GOT" so the assembler and linker know to create
6201 ;; an entry for it in GOT (Global Offset Table) section. This is done in
6204 ;; Call subroutine with no return value.
6205 (define_expand "call"
6206 [(call (match_operand:QI 0 "memory_operand" "")
6207 (match_operand:SI 1 "general_operand" ""))]
6208 ;; Operand 1 not really used on the m68000.
6212 if (flag_pic && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
6213 SYMBOL_REF_FLAG (XEXP (operands[0], 0)) = 1;
6216 ;; This is a normal call sequence.
6218 [(call (match_operand:QI 0 "memory_operand" "o")
6219 (match_operand:SI 1 "general_operand" "g"))]
6220 ;; Operand 1 not really used on the m68000.
6224 #if MOTOROLA && !defined (USE_GAS)
6231 ;; This is a PIC call sequence.
6233 [(call (match_operand:QI 0 "memory_operand" "o")
6234 (match_operand:SI 1 "general_operand" "g"))]
6235 ;; Operand 1 not really used on the m68000.
6239 m68k_output_pic_call(operands[0]);
6243 ;; Call subroutine, returning value in operand 0
6244 ;; (which must be a hard register).
6245 ;; See comments before "call" regarding PIC calls.
6246 (define_expand "call_value"
6247 [(set (match_operand 0 "" "")
6248 (call (match_operand:QI 1 "memory_operand" "")
6249 (match_operand:SI 2 "general_operand" "")))]
6250 ;; Operand 2 not really used on the m68000.
6253 if (flag_pic && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
6254 SYMBOL_REF_FLAG (XEXP (operands[1], 0)) = 1;
6257 ;; This is a normal call_value
6259 [(set (match_operand 0 "" "=rf")
6260 (call (match_operand:QI 1 "memory_operand" "o")
6261 (match_operand:SI 2 "general_operand" "g")))]
6262 ;; Operand 2 not really used on the m68000.
6265 #if MOTOROLA && !defined (USE_GAS)
6272 ;; This is a PIC call_value
6274 [(set (match_operand 0 "" "=rf")
6275 (call (match_operand:QI 1 "memory_operand" "o")
6276 (match_operand:SI 2 "general_operand" "g")))]
6277 ;; Operand 2 not really used on the m68000.
6280 m68k_output_pic_call(operands[1]);
6284 ;; Call subroutine returning any type.
6286 (define_expand "untyped_call"
6287 [(parallel [(call (match_operand 0 "" "")
6289 (match_operand 1 "" "")
6290 (match_operand 2 "" "")])]
6291 "NEEDS_UNTYPED_CALL"
6295 emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
6297 for (i = 0; i < XVECLEN (operands[2], 0); i++)
6299 rtx set = XVECEXP (operands[2], 0, i);
6300 emit_move_insn (SET_DEST (set), SET_SRC (set));
6303 /* The optimizer does not know that the call sets the function value
6304 registers we stored in the result block. We avoid problems by
6305 claiming that all hard registers are used and clobbered at this
6307 emit_insn (gen_blockage ());
6312 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
6313 ;; all of memory. This blocks insns from being moved across this point.
6315 (define_insn "blockage"
6316 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
6325 ;; Used for frameless functions which save no regs and allocate no locals.
6326 (define_insn "return"
6330 if (current_function_pops_args == 0)
6332 operands[0] = GEN_INT (current_function_pops_args);
6336 (define_insn "indirect_jump"
6337 [(set (pc) (match_operand:SI 0 "address_operand" "p"))]
6341 ;; This should not be used unless the add/sub insns can't be.
6344 [(set (match_operand:SI 0 "nonimmediate_operand" "=a")
6345 (match_operand:QI 1 "address_operand" "p"))]
6348 /* Recognize an insn that refers to a table of offsets. Such an insn will
6349 need to refer to a label on the insn. So output one. Use the
6350 label-number of the table of offsets to generate this label. This code,
6351 and similar code above, assumes that there will be at most one reference
6353 if (GET_CODE (operands[1]) == PLUS
6354 && GET_CODE (XEXP (operands[1], 1)) == LABEL_REF
6355 && GET_CODE (XEXP (operands[1], 0)) != PLUS)
6357 rtx labelref = XEXP (operands[1], 1);
6359 asm_fprintf (asm_out_file, "\\t.set %LLI%d,.+2\\n",
6360 CODE_LABEL_NUMBER (XEXP (labelref, 0)));
6362 (*targetm.asm_out.internal_label) (asm_out_file, "LI",
6363 CODE_LABEL_NUMBER (XEXP (labelref, 0)));
6365 return "lea %a1,%0";
6368 ;; This is the first machine-dependent peephole optimization.
6369 ;; It is useful when a floating value is returned from a function call
6370 ;; and then is moved into an FP register.
6371 ;; But it is mainly intended to test the support for these optimizations.
6374 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))
6375 (set (match_operand:DF 0 "register_operand" "=f")
6376 (match_operand:DF 1 "register_operand" "ad"))]
6377 "FP_REG_P (operands[0]) && ! FP_REG_P (operands[1])"
6380 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
6381 output_asm_insn ("move%.l %1,%@", xoperands);
6382 output_asm_insn ("move%.l %1,%-", operands);
6383 return "fmove%.d %+,%0";
6386 ;; Optimize a stack-adjust followed by a push of an argument.
6387 ;; This is said to happen frequently with -msoft-float
6388 ;; when there are consecutive library calls.
6391 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
6392 (match_operand:SI 0 "const_int_operand" "n")))
6393 (set (match_operand:SF 1 "push_operand" "=m")
6394 (match_operand:SF 2 "general_operand" "rmfF"))]
6395 "INTVAL (operands[0]) >= 4
6396 && ! reg_mentioned_p (stack_pointer_rtx, operands[2])"
6398 if (INTVAL (operands[0]) > 4)
6401 xoperands[0] = stack_pointer_rtx;
6402 xoperands[1] = GEN_INT (INTVAL (operands[0]) - 4);
6403 if (INTVAL (xoperands[1]) <= 8)
6405 if (!TARGET_COLDFIRE)
6406 output_asm_insn ("addq%.w %1,%0", xoperands);
6408 output_asm_insn ("addq%.l %1,%0", xoperands);
6410 else if (TARGET_CPU32 && INTVAL (xoperands[1]) <= 16)
6412 xoperands[1] = GEN_INT (INTVAL (xoperands[1]) - 8);
6413 output_asm_insn ("addq%.w #8,%0\;addq%.w %1,%0", xoperands);
6415 else if (INTVAL (xoperands[1]) <= 0x7FFF)
6418 output_asm_insn ("add%.w %1,%0", xoperands);
6420 output_asm_insn ("lea (%c1,%0),%0", xoperands);
6422 output_asm_insn ("lea %0@(%c1),%0", xoperands);
6425 output_asm_insn ("add%.l %1,%0", xoperands);
6427 if (FP_REG_P (operands[2]))
6428 return "fmove%.s %2,%@";
6429 return "move%.l %2,%@";
6432 ;; Speed up stack adjust followed by a fullword fixedpoint push.
6435 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
6436 (match_operand:SI 0 "const_int_operand" "n")))
6437 (set (match_operand:SI 1 "push_operand" "=m")
6438 (match_operand:SI 2 "general_operand" "g"))]
6439 "INTVAL (operands[0]) >= 4
6440 && ! reg_mentioned_p (stack_pointer_rtx, operands[2])"
6442 if (INTVAL (operands[0]) > 4)
6445 xoperands[0] = stack_pointer_rtx;
6446 xoperands[1] = GEN_INT (INTVAL (operands[0]) - 4);
6447 if (INTVAL (xoperands[1]) <= 8)
6449 if (!TARGET_COLDFIRE)
6450 output_asm_insn ("addq%.w %1,%0", xoperands);
6452 output_asm_insn ("addq%.l %1,%0", xoperands);
6454 else if (TARGET_CPU32 && INTVAL (xoperands[1]) <= 16)
6456 xoperands[1] = GEN_INT (INTVAL (xoperands[1]) - 8);
6457 output_asm_insn ("addq%.w #8,%0\;addq%.w %1,%0", xoperands);
6459 else if (INTVAL (xoperands[1]) <= 0x7FFF)
6462 output_asm_insn ("add%.w %1,%0", xoperands);
6464 output_asm_insn ("lea (%c1,%0),%0", xoperands);
6466 output_asm_insn ("lea %0@(%c1),%0", xoperands);
6469 output_asm_insn ("add%.l %1,%0", xoperands);
6471 if (operands[2] == const0_rtx)
6473 return "move%.l %2,%@";
6476 ;; Speed up pushing a single byte but leaving four bytes of space.
6479 [(set (mem:QI (pre_dec:SI (reg:SI SP_REG)))
6480 (match_operand:QI 1 "general_operand" "dami"))
6481 (set (reg:SI SP_REG) (minus:SI (reg:SI SP_REG) (const_int 2)))]
6482 "! reg_mentioned_p (stack_pointer_rtx, operands[1])"
6486 if (GET_CODE (operands[1]) == REG)
6487 return "move%.l %1,%-";
6489 xoperands[1] = operands[1];
6491 = gen_rtx_MEM (QImode, plus_constant (stack_pointer_rtx, 3));
6492 xoperands[3] = stack_pointer_rtx;
6493 if (!TARGET_COLDFIRE)
6494 output_asm_insn ("subq%.w #4,%3\;move%.b %1,%2", xoperands);
6496 output_asm_insn ("subq%.l #4,%3\;move%.b %1,%2", xoperands);
6501 [(set (match_operand:SI 0 "register_operand" "=d")
6503 (set (strict_low_part (subreg:HI (match_dup 0) 2))
6504 (match_operand:HI 1 "general_operand" "rmn"))]
6505 "strict_low_part_peephole_ok (HImode, prev_nonnote_insn (insn), operands[0])"
6507 if (GET_CODE (operands[1]) == CONST_INT)
6509 if (operands[1] == const0_rtx
6510 && (DATA_REG_P (operands[0])
6511 || GET_CODE (operands[0]) == MEM)
6512 /* clr insns on 68000 read before writing.
6513 This isn't so on the 68010, but we have no TARGET_68010. */
6514 && ((TARGET_68020 || TARGET_COLDFIRE)
6515 || !(GET_CODE (operands[0]) == MEM
6516 && MEM_VOLATILE_P (operands[0]))))
6519 return "move%.w %1,%0";
6527 ;; jCC label ; abnormal loop termination
6528 ;; dbra dN, loop ; normal loop termination
6536 ;; Which moves the jCC condition outside the inner loop for free.
6540 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
6541 [(cc0) (const_int 0)])
6542 (label_ref (match_operand 2 "" ""))
6547 (ne (match_operand:HI 0 "register_operand" "")
6549 (label_ref (match_operand 1 "" ""))
6552 (plus:HI (match_dup 0)
6554 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
6557 output_dbcc_and_branch (operands);
6562 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
6563 [(cc0) (const_int 0)])
6564 (label_ref (match_operand 2 "" ""))
6569 (ne (match_operand:SI 0 "register_operand" "")
6571 (label_ref (match_operand 1 "" ""))
6574 (plus:SI (match_dup 0)
6576 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
6579 output_dbcc_and_branch (operands);
6584 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
6585 [(cc0) (const_int 0)])
6586 (label_ref (match_operand 2 "" ""))
6591 (ge (plus:HI (match_operand:HI 0 "register_operand" "")
6594 (label_ref (match_operand 1 "" ""))
6597 (plus:HI (match_dup 0)
6599 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
6602 output_dbcc_and_branch (operands);
6607 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
6608 [(cc0) (const_int 0)])
6609 (label_ref (match_operand 2 "" ""))
6614 (ge (plus:SI (match_operand:SI 0 "register_operand" "")
6617 (label_ref (match_operand 1 "" ""))
6620 (plus:SI (match_dup 0)
6622 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
6625 output_dbcc_and_branch (operands);
6630 (define_expand "tstxf"
6632 (match_operand:XF 0 "nonimmediate_operand" ""))]
6634 "m68k_last_compare_had_fp_operands = 1;")
6638 (match_operand:XF 0 "nonimmediate_operand" "fm"))]
6641 cc_status.flags = CC_IN_68881;
6642 return "ftst%.x %0";
6645 (define_expand "cmpxf"
6647 (compare (match_operand:XF 0 "nonimmediate_operand" "")
6648 (match_operand:XF 1 "nonimmediate_operand" "")))]
6650 "m68k_last_compare_had_fp_operands = 1;")
6654 (compare (match_operand:XF 0 "nonimmediate_operand" "f,m")
6655 (match_operand:XF 1 "nonimmediate_operand" "fm,f")))]
6658 cc_status.flags = CC_IN_68881;
6659 if (REG_P (operands[0]))
6661 if (REG_P (operands[1]))
6662 return "fcmp%.x %1,%0";
6664 return "fcmp%.x %f1,%0";
6666 cc_status.flags |= CC_REVERSED;
6667 return "fcmp%.x %f0,%1";
6670 (define_insn "extendsfxf2"
6671 [(set (match_operand:XF 0 "nonimmediate_operand" "=fm,f")
6672 (float_extend:XF (match_operand:SF 1 "general_operand" "f,rmF")))]
6675 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
6677 if (REGNO (operands[0]) == REGNO (operands[1]))
6679 /* Extending float to double in an fp-reg is a no-op.
6680 NOTICE_UPDATE_CC has already assumed that the
6681 cc will be set. So cancel what it did. */
6682 cc_status = cc_prev_status;
6685 return "f%$move%.x %1,%0";
6687 if (FP_REG_P (operands[0]))
6689 if (FP_REG_P (operands[1]))
6690 return "f%$move%.x %1,%0";
6691 else if (ADDRESS_REG_P (operands[1]))
6692 return "move%.l %1,%-\;f%$move%.s %+,%0";
6693 else if (GET_CODE (operands[1]) == CONST_DOUBLE)
6694 return output_move_const_single (operands);
6695 return "f%$move%.s %f1,%0";
6697 return "fmove%.x %f1,%0";
6701 (define_insn "extenddfxf2"
6702 [(set (match_operand:XF 0 "nonimmediate_operand" "=fm,f")
6704 (match_operand:DF 1 "general_operand" "f,rmE")))]
6707 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
6709 if (REGNO (operands[0]) == REGNO (operands[1]))
6711 /* Extending float to double in an fp-reg is a no-op.
6712 NOTICE_UPDATE_CC has already assumed that the
6713 cc will be set. So cancel what it did. */
6714 cc_status = cc_prev_status;
6717 return "fmove%.x %1,%0";
6719 if (FP_REG_P (operands[0]))
6721 if (REG_P (operands[1]))
6724 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
6725 output_asm_insn ("move%.l %1,%-", xoperands);
6726 output_asm_insn ("move%.l %1,%-", operands);
6727 return "f%&move%.d %+,%0";
6729 if (GET_CODE (operands[1]) == CONST_DOUBLE)
6730 return output_move_const_double (operands);
6731 return "f%&move%.d %f1,%0";
6733 return "fmove%.x %f1,%0";
6736 (define_insn "truncxfdf2"
6737 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,!r")
6739 (match_operand:XF 1 "general_operand" "f,f")))]
6742 if (REG_P (operands[0]))
6744 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
6745 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
6746 return "move%.l %+,%0";
6748 return "fmove%.d %f1,%0";
6751 (define_insn "truncxfsf2"
6752 [(set (match_operand:SF 0 "nonimmediate_operand" "=dm")
6754 (match_operand:XF 1 "general_operand" "f")))]
6758 (define_insn "floatsixf2"
6759 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
6760 (float:XF (match_operand:SI 1 "general_operand" "dmi")))]
6764 (define_insn "floathixf2"
6765 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
6766 (float:XF (match_operand:HI 1 "general_operand" "dmn")))]
6770 (define_insn "floatqixf2"
6771 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
6772 (float:XF (match_operand:QI 1 "general_operand" "dmn")))]
6776 (define_insn "ftruncxf2"
6777 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
6778 (fix:XF (match_operand:XF 1 "general_operand" "fFm")))]
6781 if (FP_REG_P (operands[1]))
6782 return "fintrz%.x %f1,%0";
6783 return "fintrz%.x %f1,%0";
6786 (define_insn "fixxfqi2"
6787 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
6788 (fix:QI (match_operand:XF 1 "general_operand" "f")))]
6792 (define_insn "fixxfhi2"
6793 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
6794 (fix:HI (match_operand:XF 1 "general_operand" "f")))]
6798 (define_insn "fixxfsi2"
6799 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
6800 (fix:SI (match_operand:XF 1 "general_operand" "f")))]
6805 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
6806 (plus:XF (float:XF (match_operand:SI 2 "general_operand" "dmi"))
6807 (match_operand:XF 1 "nonimmediate_operand" "0")))]
6812 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
6813 (plus:XF (float:XF (match_operand:HI 2 "general_operand" "dmn"))
6814 (match_operand:XF 1 "nonimmediate_operand" "0")))]
6819 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
6820 (plus:XF (float:XF (match_operand:QI 2 "general_operand" "dmn"))
6821 (match_operand:XF 1 "general_operand" "0")))]
6825 (define_insn "addxf3"
6826 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
6827 (plus:XF (match_operand:XF 1 "nonimmediate_operand" "%0")
6828 (match_operand:XF 2 "nonimmediate_operand" "fm")))]
6831 if (REG_P (operands[2]))
6832 return "fadd%.x %2,%0";
6833 return "fadd%.x %f2,%0";
6837 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
6838 (minus:XF (match_operand:XF 1 "nonimmediate_operand" "0")
6839 (float:XF (match_operand:SI 2 "general_operand" "dmi"))))]
6844 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
6845 (minus:XF (match_operand:XF 1 "nonimmediate_operand" "0")
6846 (float:XF (match_operand:HI 2 "general_operand" "dmn"))))]
6851 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
6852 (minus:XF (match_operand:XF 1 "nonimmediate_operand" "0")
6853 (float:XF (match_operand:QI 2 "general_operand" "dmn"))))]
6857 (define_insn "subxf3"
6858 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
6859 (minus:XF (match_operand:XF 1 "nonimmediate_operand" "0")
6860 (match_operand:XF 2 "nonimmediate_operand" "fm")))]
6863 if (REG_P (operands[2]))
6864 return "fsub%.x %2,%0";
6865 return "fsub%.x %f2,%0";
6869 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
6870 (mult:XF (float:XF (match_operand:SI 2 "general_operand" "dmi"))
6871 (match_operand:XF 1 "nonimmediate_operand" "0")))]
6876 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
6877 (mult:XF (float:XF (match_operand:HI 2 "general_operand" "dmn"))
6878 (match_operand:XF 1 "nonimmediate_operand" "0")))]
6883 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
6884 (mult:XF (float:XF (match_operand:QI 2 "general_operand" "dmn"))
6885 (match_operand:XF 1 "nonimmediate_operand" "0")))]
6889 (define_insn "mulxf3"
6890 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
6891 (mult:XF (match_operand:XF 1 "nonimmediate_operand" "%0")
6892 (match_operand:XF 2 "nonimmediate_operand" "fm")))]
6895 if (REG_P (operands[2]))
6896 return "fmul%.x %2,%0";
6897 return "fmul%.x %f2,%0";
6901 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
6902 (div:XF (match_operand:XF 1 "nonimmediate_operand" "0")
6903 (float:XF (match_operand:SI 2 "general_operand" "dmi"))))]
6908 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
6909 (div:XF (match_operand:XF 1 "nonimmediate_operand" "0")
6910 (float:XF (match_operand:HI 2 "general_operand" "dmn"))))]
6915 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
6916 (div:XF (match_operand:XF 1 "nonimmediate_operand" "0")
6917 (float:XF (match_operand:QI 2 "general_operand" "dmn"))))]
6921 (define_insn "divxf3"
6922 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
6923 (div:XF (match_operand:XF 1 "nonimmediate_operand" "0")
6924 (match_operand:XF 2 "nonimmediate_operand" "fm")))]
6927 if (REG_P (operands[2]))
6928 return "fdiv%.x %2,%0";
6929 return "fdiv%.x %f2,%0";
6932 (define_expand "negxf2"
6933 [(set (match_operand:XF 0 "nonimmediate_operand" "")
6934 (neg:XF (match_operand:XF 1 "nonimmediate_operand" "")))]
6944 target = operand_subword (operands[0], 0, 1, XFmode);
6945 result = expand_binop (SImode, xor_optab,
6946 operand_subword_force (operands[1], 0, XFmode),
6947 GEN_INT (0x80000000), target, 0, OPTAB_WIDEN);
6951 if (result != target)
6952 emit_move_insn (result, target);
6954 emit_move_insn (operand_subword (operands[0], 1, 1, XFmode),
6955 operand_subword_force (operands[1], 1, XFmode));
6956 emit_move_insn (operand_subword (operands[0], 2, 1, XFmode),
6957 operand_subword_force (operands[1], 2, XFmode));
6959 insns = get_insns ();
6962 emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
6967 (define_insn "negxf2_68881"
6968 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
6969 (neg:XF (match_operand:XF 1 "nonimmediate_operand" "fm")))]
6972 if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
6973 return "fneg%.x %1,%0";
6974 return "fneg%.x %f1,%0";
6977 (define_expand "absxf2"
6978 [(set (match_operand:XF 0 "nonimmediate_operand" "")
6979 (abs:XF (match_operand:XF 1 "nonimmediate_operand" "")))]
6989 target = operand_subword (operands[0], 0, 1, XFmode);
6990 result = expand_binop (SImode, and_optab,
6991 operand_subword_force (operands[1], 0, XFmode),
6992 GEN_INT (0x7fffffff), target, 0, OPTAB_WIDEN);
6996 if (result != target)
6997 emit_move_insn (result, target);
6999 emit_move_insn (operand_subword (operands[0], 1, 1, XFmode),
7000 operand_subword_force (operands[1], 1, XFmode));
7001 emit_move_insn (operand_subword (operands[0], 2, 1, XFmode),
7002 operand_subword_force (operands[1], 2, XFmode));
7004 insns = get_insns ();
7007 emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
7012 (define_insn "absxf2_68881"
7013 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7014 (abs:XF (match_operand:XF 1 "nonimmediate_operand" "fm")))]
7017 if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
7018 return "fabs%.x %1,%0";
7019 return "fabs%.x %f1,%0";
7022 (define_insn "sqrtxf2"
7023 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7024 (sqrt:XF (match_operand:XF 1 "nonimmediate_operand" "fm")))]
7028 (define_insn "sinsf2"
7029 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
7030 (unspec:SF [(match_operand:SF 1 "general_operand" "fm")] UNSPEC_SIN))]
7031 "TARGET_68881 && flag_unsafe_math_optimizations"
7033 if (FP_REG_P (operands[1]))
7034 return "fsin%.x %1,%0";
7036 return "fsin%.s %1,%0";
7039 (define_insn "sindf2"
7040 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
7041 (unspec:DF [(match_operand:DF 1 "general_operand" "fm")] UNSPEC_SIN))]
7042 "TARGET_68881 && flag_unsafe_math_optimizations"
7044 if (FP_REG_P (operands[1]))
7045 return "fsin%.x %1,%0";
7047 return "fsin%.d %1,%0";
7050 (define_insn "sinxf2"
7051 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7052 (unspec:XF [(match_operand:XF 1 "nonimmediate_operand" "fm")] UNSPEC_SIN))]
7053 "TARGET_68881 && flag_unsafe_math_optimizations"
7056 (define_insn "cossf2"
7057 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
7058 (unspec:SF [(match_operand:SF 1 "general_operand" "fm")] UNSPEC_COS))]
7059 "TARGET_68881 && flag_unsafe_math_optimizations"
7061 if (FP_REG_P (operands[1]))
7062 return "fcos%.x %1,%0";
7064 return "fcos%.s %1,%0";
7067 (define_insn "cosdf2"
7068 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
7069 (unspec:DF [(match_operand:DF 1 "general_operand" "fm")] UNSPEC_COS))]
7070 "TARGET_68881 && flag_unsafe_math_optimizations"
7072 if (FP_REG_P (operands[1]))
7073 return "fcos%.x %1,%0";
7075 return "fcos%.d %1,%0";
7078 (define_insn "cosxf2"
7079 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
7080 (unspec:XF [(match_operand:XF 1 "nonimmediate_operand" "fm")] UNSPEC_COS))]
7081 "TARGET_68881 && flag_unsafe_math_optimizations"
7085 [(trap_if (const_int -1) (const_int 7))]
7089 (define_insn "conditional_trap"
7090 [(trap_if (match_operator 0 "valid_dbcc_comparison_p"
7091 [(cc0) (const_int 0)])
7092 (match_operand:SI 1 "const_int_operand" "I"))]
7093 "TARGET_68020 && ! flags_in_68881 ()"
7095 switch (GET_CODE (operands[0]))
7097 case EQ: return "trapeq";
7098 case NE: return "trapne";
7099 case GT: return "trapgt";
7100 case GTU: return "traphi";
7101 case LT: return "traplt";
7102 case LTU: return "trapcs";
7103 case GE: return "trapge";
7104 case GEU: return "trapcc";
7105 case LE: return "traple";
7106 case LEU: return "trapls";