1 ;;- Machine description for GNU compiler, Motorola 68000 Version
2 ;; Copyright (C) 1987, 1988, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001,
3 ;; 2002, 2003, 2004, 2005, 2006
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, 51 Franklin Street, Fifth Floor,
21 ;; Boston, MA 02110-1301, 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/fpu 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 ;;- TUNE_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
95 ;;- These new instructions aren't directly in the md. They are brought
96 ;;- into play by defining "%$" and "%&" to expand to "s" and "d" rather
99 ;;- Information about 68060 port.
101 ;;- The 68060 executes all 68030 and 68881/2 instructions, but some must
102 ;;- be emulated in software by the OS. It is faster to avoid these
103 ;;- instructions and issue a library call rather than trapping into
104 ;;- the kernel. The affected instructions are: divs.l <ea>,Dr:Dq;
105 ;;- divu.l <ea>,Dr:Dq; muls.l <ea>,Dr:Dq; mulu.l <ea>,Dr:Dq; and
106 ;;- fscale. The TUNE_68060 flag turns the use of the opcodes off.
108 ;;- Some of these insn's are composites of several m68000 op codes.
109 ;;- The assembler (or final @@??) insures that the appropriate one is
120 ;; UNSPEC_VOLATILE usage:
123 [(UNSPECV_BLOCKAGE 0)
126 ;; Registers by name.
136 (include "predicates.md")
138 ;; Mode macros for floating point operations.
139 ;; Valid floating point modes
140 (define_mode_macro FP [SF DF (XF "TARGET_68881")])
141 ;; Mnemonic infix to round result
142 (define_mode_attr round [(SF "%$") (DF "%&") (XF "")])
143 ;; Mnemonic infix to round result for mul or div instruction
144 (define_mode_attr round_mul [(SF "sgl") (DF "%&") (XF "")])
145 ;; Suffix specifying source operand format
146 (define_mode_attr prec [(SF "s") (DF "d") (XF "x")])
147 ;; Allowable D registers
148 (define_mode_attr dreg [(SF "d") (DF "") (XF "")])
149 ;; Allowable 68881 constant constraints
150 (define_mode_attr const [(SF "F") (DF "G") (XF "")])
153 [(set (match_operand:DF 0 "push_operand" "=m")
154 (match_operand:DF 1 "general_operand" "ro<>fE"))]
157 if (FP_REG_P (operands[1]))
158 return "fmove%.d %f1,%0";
159 return output_move_double (operands);
162 (define_insn "pushdi"
163 [(set (match_operand:DI 0 "push_operand" "=m")
164 (match_operand:DI 1 "general_operand" "ro<>Fi"))]
167 return output_move_double (operands);
170 ;; We don't want to allow a constant operand for test insns because
171 ;; (set (cc0) (const_int foo)) has no mode information. Such insns will
172 ;; be folded while optimizing anyway.
174 (define_expand "tstdi"
175 [(parallel [(set (cc0)
176 (match_operand:DI 0 "nonimmediate_operand" ""))
177 (clobber (match_scratch:SI 1 ""))
178 (clobber (match_scratch:DI 2 ""))])]
180 "m68k_last_compare_had_fp_operands = 0;")
184 (match_operand:DI 0 "nonimmediate_operand" "am,d"))
185 (clobber (match_scratch:SI 1 "=X,d"))
186 (clobber (match_scratch:DI 2 "=d,X"))]
189 if (which_alternative == 0)
193 xoperands[0] = operands[2];
194 xoperands[1] = operands[0];
195 output_move_double (xoperands);
196 cc_status.flags |= CC_REVERSED;
197 return "neg%.l %R2\;negx%.l %2";
199 if (find_reg_note (insn, REG_DEAD, operands[0]))
201 cc_status.flags |= CC_REVERSED;
202 return "neg%.l %R0\;negx%.l %0";
206 'sub' clears %1, and also clears the X cc bit
207 'tst' sets the Z cc bit according to the low part of the DImode operand
208 'subx %1' (i.e. subx #0) acts as a (non-existent) tstx on the high part.
210 return "sub%.l %1,%1\;tst%.l %R0\;subx%.l %1,%0";
213 (define_expand "tstsi"
215 (match_operand:SI 0 "nonimmediate_operand" ""))]
217 "m68k_last_compare_had_fp_operands = 0;")
221 (match_operand:SI 0 "nonimmediate_operand" "rm"))]
224 if (TARGET_68020 || TARGET_COLDFIRE || ! ADDRESS_REG_P (operands[0]))
226 /* If you think that the 68020 does not support tstl a0,
227 reread page B-167 of the 68020 manual more carefully. */
228 /* On an address reg, cmpw may replace cmpl. */
229 return "cmp%.w #0,%0";
232 ;; This can't use an address register, because comparisons
233 ;; with address registers as second operand always test the whole word.
234 (define_expand "tsthi"
236 (match_operand:HI 0 "nonimmediate_operand" ""))]
238 "m68k_last_compare_had_fp_operands = 0;")
242 (match_operand:HI 0 "nonimmediate_operand" "dm"))]
246 (define_expand "tstqi"
248 (match_operand:QI 0 "nonimmediate_operand" ""))]
250 "m68k_last_compare_had_fp_operands = 0;")
254 (match_operand:QI 0 "nonimmediate_operand" "dm"))]
258 (define_expand "tst<mode>"
260 (match_operand:FP 0 "general_operand" ""))]
263 m68k_last_compare_had_fp_operands = 1;
266 (define_insn "tst<mode>_68881"
268 (match_operand:FP 0 "general_operand" "f<FP:dreg>m"))]
271 cc_status.flags = CC_IN_68881;
272 if (FP_REG_P (operands[0]))
274 return "ftst%.<FP:prec> %0";
277 (define_insn "tst<mode>_cf"
279 (match_operand:FP 0 "general_operand" "f<FP:dreg><Q>U"))]
280 "TARGET_COLDFIRE_FPU"
282 cc_status.flags = CC_IN_68881;
283 if (FP_REG_P (operands[0]))
285 return "ftst%.<FP:prec> %0";
289 ;; compare instructions.
291 (define_expand "cmpdi"
294 (compare (match_operand:DI 0 "nonimmediate_operand" "")
295 (match_operand:DI 1 "general_operand" "")))
296 (clobber (match_dup 2))])]
298 "m68k_last_compare_had_fp_operands = 0; operands[2] = gen_reg_rtx (DImode);")
302 (compare (match_operand:DI 1 "nonimmediate_operand" "0,d")
303 (match_operand:DI 2 "general_operand" "d,0")))
304 (clobber (match_operand:DI 0 "register_operand" "=d,d"))]
307 if (rtx_equal_p (operands[0], operands[1]))
308 return "sub%.l %R2,%R0\;subx%.l %2,%0";
311 cc_status.flags |= CC_REVERSED;
312 return "sub%.l %R1,%R0\;subx%.l %1,%0";
316 (define_expand "cmpsi"
318 (compare (match_operand:SI 0 "nonimmediate_operand" "")
319 (match_operand:SI 1 "general_operand" "")))]
322 m68k_last_compare_had_fp_operands = 0;
325 ;; A composite of the cmp, cmpa, cmpi & cmpm m68000 op codes.
328 (compare (match_operand:SI 0 "nonimmediate_operand" "rKT,rKs,mSr,mSa,>")
329 (match_operand:SI 1 "general_src_operand" "mSr,mSa,KTr,Ksr,>")))]
332 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
333 return "cmpm%.l %1,%0";
334 if (REG_P (operands[1])
335 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
337 cc_status.flags |= CC_REVERSED;
338 return "cmp%.l %d0,%d1";
340 if (ADDRESS_REG_P (operands[0])
341 && GET_CODE (operands[1]) == CONST_INT
342 && INTVAL (operands[1]) < 0x8000
343 && INTVAL (operands[1]) >= -0x8000)
344 return "cmp%.w %1,%0";
345 return "cmp%.l %d1,%d0";
350 (compare (match_operand:SI 0 "nonimmediate_operand" "mrKs,r")
351 (match_operand:SI 1 "general_operand" "r,mrKs")))]
354 if (REG_P (operands[1])
355 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
357 cc_status.flags |= CC_REVERSED;
358 return "cmp%.l %d0,%d1";
360 return "cmp%.l %d1,%d0";
363 (define_expand "cmphi"
365 (compare (match_operand:HI 0 "nonimmediate_src_operand" "")
366 (match_operand:HI 1 "general_src_operand" "")))]
368 "m68k_last_compare_had_fp_operands = 0;")
372 (compare (match_operand:HI 0 "nonimmediate_src_operand" "rnmS,d,n,mS,>")
373 (match_operand:HI 1 "general_src_operand" "d,rnmS,mS,n,>")))]
376 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
377 return "cmpm%.w %1,%0";
378 if ((REG_P (operands[1]) && !ADDRESS_REG_P (operands[1]))
379 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
381 cc_status.flags |= CC_REVERSED;
382 return "cmp%.w %d0,%d1";
384 return "cmp%.w %d1,%d0";
387 (define_expand "cmpqi"
389 (compare (match_operand:QI 0 "nonimmediate_src_operand" "")
390 (match_operand:QI 1 "general_src_operand" "")))]
392 "m68k_last_compare_had_fp_operands = 0;")
396 (compare (match_operand:QI 0 "nonimmediate_src_operand" "dn,dmS,>")
397 (match_operand:QI 1 "general_src_operand" "dmS,nd,>")))]
400 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
401 return "cmpm%.b %1,%0";
402 if (REG_P (operands[1])
403 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
405 cc_status.flags |= CC_REVERSED;
406 return "cmp%.b %d0,%d1";
408 return "cmp%.b %d1,%d0";
411 (define_expand "cmp<mode>"
413 (compare (match_operand:FP 0 "general_operand" "")
414 (match_operand:FP 1 "general_operand" "")))]
417 m68k_last_compare_had_fp_operands = 1;
418 if (TARGET_COLDFIRE && !reload_completed)
419 operands[1] = force_reg (<MODE>mode, operands[1]);
422 (define_insn "cmp<mode>_68881"
424 (compare (match_operand:FP 0 "general_operand" "f,m<FP:const>")
425 (match_operand:FP 1 "general_operand" "f<FP:dreg>m<FP:const>,f")))]
428 cc_status.flags = CC_IN_68881;
429 if (FP_REG_P (operands[0]))
431 if (FP_REG_P (operands[1]))
432 return "fcmp%.x %1,%0";
434 return "fcmp%.<FP:prec> %f1,%0";
436 cc_status.flags |= CC_REVERSED;
437 return "fcmp%.<FP:prec> %f0,%1";
440 (define_insn "cmp<mode>_cf"
442 (compare (match_operand:FP 0 "general_operand" "f,<FP:dreg><Q>U")
443 (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U,f")))]
444 "TARGET_COLDFIRE_FPU"
446 cc_status.flags = CC_IN_68881;
447 if (FP_REG_P (operands[0]))
449 if (FP_REG_P (operands[1]))
450 return "fcmp%.d %1,%0";
452 return "fcmp%.<FP:prec> %f1,%0";
454 cc_status.flags |= CC_REVERSED;
455 return "fcmp%.<FP:prec> %f0,%1";
458 ;; Recognizers for btst instructions.
460 ;; ColdFire/5200 only allows "<Q>" type addresses when the bit position is
461 ;; specified as a constant, so we must disable all patterns that may extract
462 ;; from a MEM at a constant bit position if we can't use this as a constraint.
465 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_src_operand" "oS")
467 (minus:SI (const_int 7)
468 (match_operand:SI 1 "general_operand" "di"))))]
471 return output_btst (operands, operands[1], operands[0], insn, 7);
474 ;; This is the same as the above pattern except for the constraints. The 'i'
478 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "o")
480 (minus:SI (const_int 7)
481 (match_operand:SI 1 "general_operand" "d"))))]
484 return output_btst (operands, operands[1], operands[0], insn, 7);
488 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "d")
490 (minus:SI (const_int 31)
491 (match_operand:SI 1 "general_operand" "di"))))]
494 return output_btst (operands, operands[1], operands[0], insn, 31);
497 ;; The following two patterns are like the previous two
498 ;; except that they use the fact that bit-number operands
499 ;; are automatically masked to 3 or 5 bits.
502 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "o")
504 (minus:SI (const_int 7)
506 (match_operand:SI 1 "register_operand" "d")
510 return output_btst (operands, operands[1], operands[0], insn, 7);
514 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "d")
516 (minus:SI (const_int 31)
518 (match_operand:SI 1 "register_operand" "d")
522 return output_btst (operands, operands[1], operands[0], insn, 31);
525 ;; Nonoffsettable mem refs are ok in this one pattern
526 ;; since we don't try to adjust them.
528 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "m")
530 (match_operand:SI 1 "const_int_operand" "n")))]
531 "(unsigned) INTVAL (operands[1]) < 8 && !TARGET_COLDFIRE"
533 operands[1] = GEN_INT (7 - INTVAL (operands[1]));
534 return output_btst (operands, operands[1], operands[0], insn, 7);
538 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "do")
540 (match_operand:SI 1 "const_int_operand" "n")))]
543 if (GET_CODE (operands[0]) == MEM)
545 operands[0] = adjust_address (operands[0], QImode,
546 INTVAL (operands[1]) / 8);
547 operands[1] = GEN_INT (7 - INTVAL (operands[1]) % 8);
548 return output_btst (operands, operands[1], operands[0], insn, 7);
550 operands[1] = GEN_INT (31 - INTVAL (operands[1]));
551 return output_btst (operands, operands[1], operands[0], insn, 31);
554 ;; This is the same as the above pattern except for the constraints.
555 ;; The 'o' has been replaced with 'Q'.
558 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "dQ")
560 (match_operand:SI 1 "const_int_operand" "n")))]
563 if (GET_CODE (operands[0]) == MEM)
565 operands[0] = adjust_address (operands[0], QImode,
566 INTVAL (operands[1]) / 8);
567 operands[1] = GEN_INT (7 - INTVAL (operands[1]) % 8);
568 return output_btst (operands, operands[1], operands[0], insn, 7);
570 operands[1] = GEN_INT (31 - INTVAL (operands[1]));
571 return output_btst (operands, operands[1], operands[0], insn, 31);
577 ;; A special case in which it is not desirable
578 ;; to reload the constant into a data register.
579 (define_insn "pushexthisi_const"
580 [(set (match_operand:SI 0 "push_operand" "=m")
581 (match_operand:SI 1 "const_int_operand" "J"))]
582 "INTVAL (operands[1]) >= -0x8000 && INTVAL (operands[1]) < 0x8000"
584 if (operands[1] == const0_rtx)
586 if (valid_mov3q_const (INTVAL (operands[1])))
587 return "mov3q%.l %1,%-";
592 ;(define_insn "swapsi"
593 ; [(set (match_operand:SI 0 "nonimmediate_operand" "+r")
594 ; (match_operand:SI 1 "general_operand" "+r"))
595 ; (set (match_dup 1) (match_dup 0))]
599 ;; Special case of fullword move when source is zero.
600 ;; The reason this is special is to avoid loading a zero
601 ;; into a data reg with moveq in order to store it elsewhere.
603 (define_insn "movsi_const0"
604 [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
606 ;; clr insns on 68000 read before writing.
607 "((TARGET_68010 || TARGET_COLDFIRE)
608 || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0])))"
610 if (ADDRESS_REG_P (operands[0]))
612 /* On the '040, 'subl an,an' takes 2 clocks while lea takes only 1 */
614 return MOTOROLA ? "lea 0.w,%0" : "lea 0:w,%0";
616 return "sub%.l %0,%0";
618 /* moveq is faster on the 68000. */
619 if (DATA_REG_P (operands[0]) && TUNE_68000_10)
620 return "moveq #0,%0";
624 ;; General case of fullword move.
626 ;; This is the main "hook" for PIC code. When generating
627 ;; PIC, movsi is responsible for determining when the source address
628 ;; needs PIC relocation and appropriately calling legitimize_pic_address
629 ;; to perform the actual relocation.
631 ;; In both the PIC and non-PIC cases the patterns generated will
632 ;; matched by the next define_insn.
633 (define_expand "movsi"
634 [(set (match_operand:SI 0 "" "")
635 (match_operand:SI 1 "" ""))]
638 rtx tmp, base, offset;
640 if (flag_pic && !TARGET_PCREL && symbolic_operand (operands[1], SImode))
642 /* The source is an address which requires PIC relocation.
643 Call legitimize_pic_address with the source, mode, and a relocation
644 register (a new pseudo, or the final destination if reload_in_progress
645 is set). Then fall through normally */
646 rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
647 operands[1] = legitimize_pic_address (operands[1], SImode, temp);
649 else if (flag_pic && TARGET_PCREL && ! reload_in_progress)
651 /* Don't allow writes to memory except via a register;
652 the m68k doesn't consider PC-relative addresses to be writable. */
653 if (symbolic_operand (operands[0], SImode))
654 operands[0] = force_reg (SImode, XEXP (operands[0], 0));
655 else if (GET_CODE (operands[0]) == MEM
656 && symbolic_operand (XEXP (operands[0], 0), SImode))
657 operands[0] = gen_rtx_MEM (SImode,
658 force_reg (SImode, XEXP (operands[0], 0)));
660 if (M68K_OFFSETS_MUST_BE_WITHIN_SECTIONS_P)
662 split_const (operands[1], &base, &offset);
663 if (GET_CODE (base) == SYMBOL_REF
664 && !offset_within_block_p (base, INTVAL (offset)))
666 tmp = no_new_pseudos ? operands[0] : gen_reg_rtx (SImode);
667 emit_move_insn (tmp, base);
668 emit_insn (gen_addsi3 (operands[0], tmp, offset));
674 ;; General case of fullword move. The register constraints
675 ;; force integer constants in range for a moveq to be reloaded
676 ;; if they are headed for memory.
678 ;; Notes: make sure no alternative allows g vs g.
679 ;; We don't allow f-regs since fixed point cannot go in them.
680 [(set (match_operand:SI 0 "nonimmediate_operand" "=g,d,a<")
681 (match_operand:SI 1 "general_src_operand" "damSKT,n,i"))]
685 return output_move_simode (operands);
688 ;; ColdFire move instructions can have at most one operand of mode >= 6.
689 (define_insn "*movsi_cf"
690 [(set (match_operand:SI 0 "nonimmediate_operand" "=r<Q>,g,U")
691 (match_operand:SI 1 "general_operand" "g,Rr<Q>,U"))]
693 "* return output_move_simode (operands);")
695 ;; Special case of fullword move, where we need to get a non-GOT PIC
696 ;; reference into an address register.
698 [(set (match_operand:SI 0 "nonimmediate_operand" "=a<")
699 (match_operand:SI 1 "pcrel_address" ""))]
702 if (push_operand (operands[0], SImode))
707 (define_expand "movhi"
708 [(set (match_operand:HI 0 "nonimmediate_operand" "")
709 (match_operand:HI 1 "general_operand" ""))]
714 [(set (match_operand:HI 0 "nonimmediate_operand" "=g")
715 (match_operand:HI 1 "general_src_operand" "gS"))]
717 "* return output_move_himode (operands);")
720 [(set (match_operand:HI 0 "nonimmediate_operand" "=r<Q>,g,U")
721 (match_operand:HI 1 "general_operand" "g,r<Q>,U"))]
723 "* return output_move_himode (operands);")
725 (define_expand "movstricthi"
726 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" ""))
727 (match_operand:HI 1 "general_src_operand" ""))]
732 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
733 (match_operand:HI 1 "general_src_operand" "rmSn"))]
735 "* return output_move_stricthi (operands);")
738 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+d,m"))
739 (match_operand:HI 1 "general_src_operand" "rmn,r"))]
741 "* return output_move_stricthi (operands);")
743 (define_expand "movqi"
744 [(set (match_operand:QI 0 "nonimmediate_operand" "")
745 (match_operand:QI 1 "general_src_operand" ""))]
750 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,*a,m")
751 (match_operand:QI 1 "general_src_operand" "dmSi*a,di*a,dmSi"))]
753 "* return output_move_qimode (operands);")
756 [(set (match_operand:QI 0 "nonimmediate_operand" "=d<Q>,dm,U,d*a")
757 (match_operand:QI 1 "general_src_operand" "dmi,d<Q>,U,di*a"))]
759 "* return output_move_qimode (operands);")
761 (define_expand "movstrictqi"
762 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" ""))
763 (match_operand:QI 1 "general_src_operand" ""))]
768 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
769 (match_operand:QI 1 "general_src_operand" "dmSn"))]
771 "* return output_move_strictqi (operands);")
774 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+d,m"))
775 (match_operand:QI 1 "general_src_operand" "dmn,d"))]
777 "* return output_move_strictqi (operands);")
779 (define_expand "pushqi1"
780 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -2)))
781 (set (mem:QI (plus:SI (reg:SI SP_REG) (const_int 1)))
782 (match_operand:QI 0 "general_operand" ""))]
786 (define_expand "reload_insf"
787 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
788 (match_operand:SF 1 "general_operand" "mf"))
789 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
790 "TARGET_COLDFIRE_FPU"
792 if (emit_move_sequence (operands, SFmode, operands[2]))
795 /* We don't want the clobber emitted, so handle this ourselves. */
796 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
800 (define_expand "reload_outsf"
801 [(set (match_operand:SF 0 "general_operand" "")
802 (match_operand:SF 1 "register_operand" "f"))
803 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
804 "TARGET_COLDFIRE_FPU"
806 if (emit_move_sequence (operands, SFmode, operands[2]))
809 /* We don't want the clobber emitted, so handle this ourselves. */
810 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
814 (define_expand "movsf"
815 [(set (match_operand:SF 0 "nonimmediate_operand" "")
816 (match_operand:SF 1 "general_operand" ""))]
821 [(set (match_operand:SF 0 "nonimmediate_operand" "=rmf")
822 (match_operand:SF 1 "general_operand" "rmfF"))]
825 if (FP_REG_P (operands[0]))
827 if (FP_REG_P (operands[1]))
828 return "f%$move%.x %1,%0";
829 else if (ADDRESS_REG_P (operands[1]))
830 return "move%.l %1,%-\;f%$move%.s %+,%0";
831 else if (GET_CODE (operands[1]) == CONST_DOUBLE)
832 return output_move_const_single (operands);
833 return "f%$move%.s %f1,%0";
835 if (FP_REG_P (operands[1]))
837 if (ADDRESS_REG_P (operands[0]))
838 return "fmove%.s %1,%-\;move%.l %+,%0";
839 return "fmove%.s %f1,%0";
841 if (operands[1] == CONST0_RTX (SFmode)
842 /* clr insns on 68000 read before writing. */
843 && ((TARGET_68010 || TARGET_COLDFIRE)
844 || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0]))))
846 if (ADDRESS_REG_P (operands[0]))
848 /* On the '040, 'subl an,an' takes 2 clocks while lea takes only 1 */
850 return MOTOROLA ? "lea 0.w,%0" : "lea 0:w,%0";
852 return "sub%.l %0,%0";
854 /* moveq is faster on the 68000. */
855 if (DATA_REG_P (operands[0]) && TUNE_68000_10)
856 return "moveq #0,%0";
859 return "move%.l %1,%0";
862 (define_insn "movsf_cf_soft"
863 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,g")
864 (match_operand:SF 1 "general_operand" "g,r"))]
865 "TARGET_COLDFIRE && !TARGET_COLDFIRE_FPU"
867 return "move%.l %1,%0";
870 (define_insn "movsf_cf_hard"
871 [(set (match_operand:SF 0 "nonimmediate_operand" "=r<Q>U, f, f,mr,f,r<Q>,f
873 (match_operand:SF 1 "general_operand" " f, r<Q>U,f,rm,F,F, m
875 "TARGET_COLDFIRE_FPU"
877 if (which_alternative == 4 || which_alternative == 5) {
881 REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
882 REAL_VALUE_TO_TARGET_SINGLE (r, l);
883 xoperands[0] = operands[0];
884 xoperands[1] = GEN_INT (l);
885 if (which_alternative == 5) {
887 if (ADDRESS_REG_P (xoperands[0]))
888 output_asm_insn ("sub%.l %0,%0", xoperands);
890 output_asm_insn ("clr%.l %0", xoperands);
892 if (GET_CODE (operands[0]) == MEM
893 && symbolic_operand (XEXP (operands[0], 0), SImode))
894 output_asm_insn ("move%.l %1,%-;move%.l %+,%0", xoperands);
896 output_asm_insn ("move%.l %1,%0", xoperands);
900 output_asm_insn ("move%.l %1,%-;fsmove%.s %+,%0", xoperands);
902 output_asm_insn ("clr%.l %-;fsmove%.s %+,%0", xoperands);
905 if (FP_REG_P (operands[0]))
907 if (ADDRESS_REG_P (operands[1]))
908 return "move%.l %1,%-;fsmove%.s %+,%0";
909 if (FP_REG_P (operands[1]))
910 return "fsmove%.d %1,%0";
911 return "fsmove%.s %f1,%0";
913 if (FP_REG_P (operands[1]))
915 if (ADDRESS_REG_P (operands[0]))
916 return "fmove%.s %1,%-;move%.l %+,%0";
917 return "fmove%.s %f1,%0";
919 if (operands[1] == CONST0_RTX (SFmode))
921 if (ADDRESS_REG_P (operands[0]))
922 return "sub%.l %0,%0";
925 return "move%.l %1,%0";
928 (define_expand "reload_indf"
929 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
930 (match_operand:DF 1 "general_operand" "mf"))
931 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
932 "TARGET_COLDFIRE_FPU"
934 if (emit_move_sequence (operands, DFmode, operands[2]))
937 /* We don't want the clobber emitted, so handle this ourselves. */
938 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
942 (define_expand "reload_outdf"
943 [(set (match_operand:DF 0 "general_operand" "")
944 (match_operand:DF 1 "register_operand" "f"))
945 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
946 "TARGET_COLDFIRE_FPU"
948 if (emit_move_sequence (operands, DFmode, operands[2]))
951 /* We don't want the clobber emitted, so handle this ourselves. */
952 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
956 (define_expand "movdf"
957 [(set (match_operand:DF 0 "nonimmediate_operand" "")
958 (match_operand:DF 1 "general_operand" ""))]
961 if (TARGET_COLDFIRE_FPU)
962 if (emit_move_sequence (operands, DFmode, 0))
967 [(set (match_operand:DF 0 "nonimmediate_operand" "=rm,rf,rf,&rof<>")
968 (match_operand:DF 1 "general_operand" "*rf,m,0,*rofE<>"))]
969 ; [(set (match_operand:DF 0 "nonimmediate_operand" "=rm,&rf,&rof<>")
970 ; (match_operand:DF 1 "general_operand" "rf,m,rofF<>"))]
973 if (FP_REG_P (operands[0]))
975 if (FP_REG_P (operands[1]))
976 return "f%&move%.x %1,%0";
977 if (REG_P (operands[1]))
980 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
981 output_asm_insn ("move%.l %1,%-", xoperands);
982 output_asm_insn ("move%.l %1,%-", operands);
983 return "f%&move%.d %+,%0";
985 if (GET_CODE (operands[1]) == CONST_DOUBLE)
986 return output_move_const_double (operands);
987 return "f%&move%.d %f1,%0";
989 else if (FP_REG_P (operands[1]))
991 if (REG_P (operands[0]))
993 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
994 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
995 return "move%.l %+,%0";
998 return "fmove%.d %f1,%0";
1000 return output_move_double (operands);
1003 (define_insn "movdf_cf_soft"
1004 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,g")
1005 (match_operand:DF 1 "general_operand" "g,r"))]
1006 "TARGET_COLDFIRE && !TARGET_COLDFIRE_FPU"
1008 return output_move_double (operands);
1011 (define_insn "movdf_cf_hard"
1012 [(set (match_operand:DF 0 "nonimmediate_operand" "=f, <Q>U,r,f,r,r,m,f")
1013 (match_operand:DF 1 "general_operand" " f<Q>U,f, f,r,r,m,r,E"))]
1014 "TARGET_COLDFIRE_FPU"
1020 switch (which_alternative)
1023 return "fdmove%.d %1,%0";
1025 return "fmove%.d %1,%0";
1027 return "fmove%.d %1,%-;move%.l %+,%0;move%.l %+,%R0";
1029 return "move%.l %R1,%-;move%.l %1,%-;fdmove%.d %+,%0";
1030 case 4: case 5: case 6:
1031 return output_move_double (operands);
1033 REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
1034 REAL_VALUE_TO_TARGET_DOUBLE (r, l);
1035 xoperands[0] = operands[0];
1036 xoperands[1] = GEN_INT (l[0]);
1037 xoperands[2] = GEN_INT (l[1]);
1038 if (operands[1] == CONST0_RTX (DFmode))
1039 output_asm_insn ("clr%.l %-;clr%.l %-;fdmove%.d %+,%0",
1043 output_asm_insn ("clr%.l %-;move%.l %1,%-;fdmove%.d %+,%0",
1046 output_asm_insn ("move%.l %2,%-;move%.l %1,%-;fdmove%.d %+,%0",
1052 ;; ??? The XFmode patterns are schizophrenic about whether constants are
1053 ;; allowed. Most but not all have predicates and constraint that disallow
1054 ;; constants. Most but not all have output templates that handle constants.
1055 ;; See also LEGITIMATE_CONSTANT_P.
1057 (define_expand "movxf"
1058 [(set (match_operand:XF 0 "nonimmediate_operand" "")
1059 (match_operand:XF 1 "general_operand" ""))]
1062 /* We can't rewrite operands during reload. */
1063 if (! reload_in_progress)
1065 if (CONSTANT_P (operands[1]))
1067 operands[1] = force_const_mem (XFmode, operands[1]);
1068 if (! memory_address_p (XFmode, XEXP (operands[1], 0)))
1069 operands[1] = adjust_address (operands[1], XFmode, 0);
1071 if (flag_pic && TARGET_PCREL)
1073 /* Don't allow writes to memory except via a register; the
1074 m68k doesn't consider PC-relative addresses to be writable. */
1075 if (GET_CODE (operands[0]) == MEM
1076 && symbolic_operand (XEXP (operands[0], 0), SImode))
1077 operands[0] = gen_rtx_MEM (XFmode,
1078 force_reg (SImode, XEXP (operands[0], 0)));
1084 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,!r,!f,!r,m,!r")
1085 (match_operand:XF 1 "nonimmediate_operand" "m,f,f,f,r,!r,!r,m"))]
1088 if (FP_REG_P (operands[0]))
1090 if (FP_REG_P (operands[1]))
1091 return "fmove%.x %1,%0";
1092 if (REG_P (operands[1]))
1095 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 2);
1096 output_asm_insn ("move%.l %1,%-", xoperands);
1097 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1098 output_asm_insn ("move%.l %1,%-", xoperands);
1099 output_asm_insn ("move%.l %1,%-", operands);
1100 return "fmove%.x %+,%0";
1102 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1103 return "fmove%.x %1,%0";
1104 return "fmove%.x %f1,%0";
1106 if (FP_REG_P (operands[1]))
1108 if (REG_P (operands[0]))
1110 output_asm_insn ("fmove%.x %f1,%-\;move%.l %+,%0", operands);
1111 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1112 output_asm_insn ("move%.l %+,%0", operands);
1113 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1114 return "move%.l %+,%0";
1116 /* Must be memory destination. */
1117 return "fmove%.x %f1,%0";
1119 return output_move_double (operands);
1123 [(set (match_operand:XF 0 "nonimmediate_operand" "=rm,rf,&rof<>")
1124 (match_operand:XF 1 "nonimmediate_operand" "rf,m,rof<>"))]
1125 "! TARGET_68881 && ! TARGET_COLDFIRE"
1127 if (FP_REG_P (operands[0]))
1129 if (FP_REG_P (operands[1]))
1130 return "fmove%.x %1,%0";
1131 if (REG_P (operands[1]))
1134 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 2);
1135 output_asm_insn ("move%.l %1,%-", xoperands);
1136 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1137 output_asm_insn ("move%.l %1,%-", xoperands);
1138 output_asm_insn ("move%.l %1,%-", operands);
1139 return "fmove%.x %+,%0";
1141 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1142 return "fmove%.x %1,%0";
1143 return "fmove%.x %f1,%0";
1145 if (FP_REG_P (operands[1]))
1147 if (REG_P (operands[0]))
1149 output_asm_insn ("fmove%.x %f1,%-\;move%.l %+,%0", operands);
1150 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1151 output_asm_insn ("move%.l %+,%0", operands);
1152 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1153 return "move%.l %+,%0";
1156 return "fmove%.x %f1,%0";
1158 return output_move_double (operands);
1162 [(set (match_operand:XF 0 "nonimmediate_operand" "=r,g")
1163 (match_operand:XF 1 "nonimmediate_operand" "g,r"))]
1164 "! TARGET_68881 && TARGET_COLDFIRE"
1165 "* return output_move_double (operands);")
1167 (define_expand "movdi"
1168 ;; Let's see if it really still needs to handle fp regs, and, if so, why.
1169 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1170 (match_operand:DI 1 "general_operand" ""))]
1174 ;; movdi can apply to fp regs in some cases
1176 ;; Let's see if it really still needs to handle fp regs, and, if so, why.
1177 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r,&ro<>")
1178 (match_operand:DI 1 "general_operand" "rF,m,roi<>F"))]
1179 ; [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,&r,&ro<>,!&rm,!&f")
1180 ; (match_operand:DI 1 "general_operand" "r,m,roi<>,fF"))]
1181 ; [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,&rf,&ro<>,!&rm,!&f")
1182 ; (match_operand:DI 1 "general_operand" "r,m,roi<>,fF,rfF"))]
1185 if (FP_REG_P (operands[0]))
1187 if (FP_REG_P (operands[1]))
1188 return "fmove%.x %1,%0";
1189 if (REG_P (operands[1]))
1192 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1193 output_asm_insn ("move%.l %1,%-", xoperands);
1194 output_asm_insn ("move%.l %1,%-", operands);
1195 return "fmove%.d %+,%0";
1197 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1198 return output_move_const_double (operands);
1199 return "fmove%.d %f1,%0";
1201 else if (FP_REG_P (operands[1]))
1203 if (REG_P (operands[0]))
1205 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
1206 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1207 return "move%.l %+,%0";
1210 return "fmove%.d %f1,%0";
1212 return output_move_double (operands);
1216 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,g")
1217 (match_operand:DI 1 "general_operand" "g,r"))]
1219 "* return output_move_double (operands);")
1221 ;; Thus goes after the move instructions
1222 ;; because the move instructions are better (require no spilling)
1223 ;; when they can apply. It goes before the add/sub insns
1224 ;; so we will prefer it to them.
1226 (define_insn "pushasi"
1227 [(set (match_operand:SI 0 "push_operand" "=m")
1228 (match_operand:SI 1 "address_operand" "p"))]
1232 ;; truncation instructions
1233 (define_insn "truncsiqi2"
1234 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,d")
1236 (match_operand:SI 1 "general_src_operand" "doJS,i")))]
1239 if (GET_CODE (operands[0]) == REG)
1241 /* Must clear condition codes, since the move.l bases them on
1242 the entire 32 bits, not just the desired 8 bits. */
1244 return "move%.l %1,%0";
1246 if (GET_CODE (operands[1]) == MEM)
1247 operands[1] = adjust_address (operands[1], QImode, 3);
1248 return "move%.b %1,%0";
1251 (define_insn "trunchiqi2"
1252 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,d")
1254 (match_operand:HI 1 "general_src_operand" "doJS,i")))]
1257 if (GET_CODE (operands[0]) == REG
1258 && (GET_CODE (operands[1]) == MEM
1259 || GET_CODE (operands[1]) == CONST_INT))
1261 /* Must clear condition codes, since the move.w bases them on
1262 the entire 16 bits, not just the desired 8 bits. */
1264 return "move%.w %1,%0";
1266 if (GET_CODE (operands[0]) == REG)
1268 /* Must clear condition codes, since the move.l bases them on
1269 the entire 32 bits, not just the desired 8 bits. */
1271 return "move%.l %1,%0";
1273 if (GET_CODE (operands[1]) == MEM)
1274 operands[1] = adjust_address (operands[1], QImode, 1);
1275 return "move%.b %1,%0";
1278 (define_insn "truncsihi2"
1279 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm,d")
1281 (match_operand:SI 1 "general_src_operand" "roJS,i")))]
1284 if (GET_CODE (operands[0]) == REG)
1286 /* Must clear condition codes, since the move.l bases them on
1287 the entire 32 bits, not just the desired 8 bits. */
1289 return "move%.l %1,%0";
1291 if (GET_CODE (operands[1]) == MEM)
1292 operands[1] = adjust_address (operands[1], QImode, 2);
1293 return "move%.w %1,%0";
1296 ;; zero extension instructions
1298 ;; two special patterns to match various post_inc/pre_dec patterns
1299 (define_insn_and_split "*zero_extend_inc"
1300 [(set (match_operand 0 "post_inc_operand" "")
1301 (zero_extend (match_operand 1 "register_operand" "")))]
1302 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT &&
1303 GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT &&
1304 GET_MODE_SIZE (GET_MODE (operands[0])) == GET_MODE_SIZE (GET_MODE (operands[1])) * 2"
1312 operands[0] = adjust_address (operands[0], GET_MODE (operands[1]), 0);
1315 (define_insn_and_split "*zero_extend_dec"
1316 [(set (match_operand 0 "pre_dec_operand" "")
1317 (zero_extend (match_operand 1 "register_operand" "")))]
1318 "(GET_MODE (operands[0]) != HImode || XEXP (XEXP (operands[0], 0), 0) != stack_pointer_rtx) &&
1319 GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT &&
1320 GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT &&
1321 GET_MODE_SIZE (GET_MODE (operands[0])) == GET_MODE_SIZE (GET_MODE (operands[1])) * 2"
1329 operands[0] = adjust_address (operands[0], GET_MODE (operands[1]), 0);
1332 (define_insn_and_split "zero_extendqidi2"
1333 [(set (match_operand:DI 0 "register_operand" "")
1334 (zero_extend:DI (match_operand:QI 1 "nonimmediate_src_operand" "")))]
1339 (zero_extend:SI (match_dup 1)))
1343 operands[2] = gen_lowpart (SImode, operands[0]);
1344 operands[3] = gen_highpart (SImode, operands[0]);
1347 (define_insn_and_split "zero_extendhidi2"
1348 [(set (match_operand:DI 0 "register_operand" "")
1349 (zero_extend:DI (match_operand:HI 1 "nonimmediate_src_operand" "")))]
1354 (zero_extend:SI (match_dup 1)))
1358 operands[2] = gen_lowpart (SImode, operands[0]);
1359 operands[3] = gen_highpart (SImode, operands[0]);
1362 (define_expand "zero_extendsidi2"
1363 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1364 (zero_extend:DI (match_operand:SI 1 "nonimmediate_src_operand" "")))]
1367 if (GET_CODE (operands[0]) == MEM
1368 && GET_CODE (operands[1]) == MEM)
1369 operands[1] = force_reg (SImode, operands[1]);
1372 (define_insn_and_split "*zero_extendsidi2"
1373 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1374 (zero_extend:DI (match_operand:SI 1 "nonimmediate_src_operand" "")))]
1375 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
1383 operands[2] = gen_lowpart (SImode, operands[0]);
1384 operands[3] = gen_highpart (SImode, operands[0]);
1387 (define_insn "*zero_extendhisi2_cf"
1388 [(set (match_operand:SI 0 "register_operand" "=d")
1389 (zero_extend:SI (match_operand:HI 1 "nonimmediate_src_operand" "rmS")))]
1393 (define_insn "zero_extendhisi2"
1394 [(set (match_operand:SI 0 "register_operand" "=d")
1395 (zero_extend:SI (match_operand:HI 1 "nonimmediate_src_operand" "rmS")))]
1399 (define_expand "zero_extendqihi2"
1400 [(set (match_operand:HI 0 "register_operand" "")
1401 (zero_extend:HI (match_operand:QI 1 "nonimmediate_src_operand" "")))]
1405 (define_insn "*zero_extendqihi2"
1406 [(set (match_operand:HI 0 "register_operand" "=d")
1407 (zero_extend:HI (match_operand:QI 1 "nonimmediate_src_operand" "dmS")))]
1411 (define_insn "*zero_extendqisi2_cfv4"
1412 [(set (match_operand:SI 0 "register_operand" "=d")
1413 (zero_extend:SI (match_operand:QI 1 "nonimmediate_src_operand" "dmS")))]
1417 (define_insn "zero_extendqisi2"
1418 [(set (match_operand:SI 0 "register_operand" "=d")
1419 (zero_extend:SI (match_operand:QI 1 "nonimmediate_src_operand" "dmS")))]
1423 ;; these two pattern split everything else which isn't matched by
1424 ;; something else above
1426 [(set (match_operand 0 "register_operand" "")
1427 (zero_extend (match_operand 1 "nonimmediate_src_operand" "")))]
1430 && reg_mentioned_p (operands[0], operands[1])"
1431 [(set (strict_low_part (match_dup 2))
1434 (match_op_dup 4 [(match_dup 0) (match_dup 3)]))]
1436 operands[2] = gen_lowpart (GET_MODE (operands[1]), operands[0]);
1437 operands[3] = GEN_INT (GET_MODE_MASK (GET_MODE (operands[1])));
1438 operands[4] = gen_rtx_AND (GET_MODE (operands[0]), operands[0], operands[3]);
1442 [(set (match_operand 0 "register_operand" "")
1443 (zero_extend (match_operand 1 "nonimmediate_src_operand" "")))]
1444 "!TARGET_ISAB && reload_completed"
1447 (set (strict_low_part (match_dup 2))
1450 operands[2] = gen_lowpart (GET_MODE (operands[1]), operands[0]);
1453 ;; sign extension instructions
1455 (define_insn "extendqidi2"
1456 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
1457 (sign_extend:DI (match_operand:QI 1 "general_src_operand" "rmS")))]
1461 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1463 return "mvs%.b %1,%2\;smi %0\;extb%.l %0";
1464 if (TARGET_68020 || TARGET_COLDFIRE)
1466 if (ADDRESS_REG_P (operands[1]))
1467 return "move%.w %1,%2\;extb%.l %2\;smi %0\;extb%.l %0";
1469 return "move%.b %1,%2\;extb%.l %2\;smi %0\;extb%.l %0";
1473 if (ADDRESS_REG_P (operands[1]))
1474 return "move%.w %1,%2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0\;smi %0";
1476 return "move%.b %1,%2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0\;smi %0";
1480 (define_insn "extendhidi2"
1481 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
1483 (match_operand:HI 1 "general_src_operand" "rmS")))]
1487 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1489 return "mvs%.w %1,%2\;smi %0\;extb%.l %0";
1490 if (TARGET_68020 || TARGET_COLDFIRE)
1491 return "move%.w %1,%2\;ext%.l %2\;smi %0\;extb%.l %0";
1493 return "move%.w %1,%2\;ext%.l %2\;smi %0\;ext%.w %0\;ext%.l %0";
1496 (define_insn "extendsidi2"
1497 [(set (match_operand:DI 0 "register_operand" "=d")
1498 (sign_extend:DI (match_operand:SI 1 "nonimmediate_src_operand" "rm")))]
1502 if (TARGET_68020 || TARGET_COLDFIRE)
1503 return "move%.l %1,%R0\;smi %0\;extb%.l %0";
1505 return "move%.l %1,%R0\;smi %0\;ext%.w %0\;ext%.l %0";
1508 (define_insn "*extendsidi2_mem"
1509 [(set (match_operand:DI 0 "memory_operand" "=o,<")
1510 (sign_extend:DI (match_operand:SI 1 "nonimmediate_src_operand" "rm,rm")))
1511 (clobber (match_scratch:SI 2 "=d,d"))]
1515 operands[3] = adjust_address (operands[0], SImode,
1516 which_alternative == 0 ? 4 : 0);
1517 operands[0] = adjust_address (operands[0], SImode, 0);
1518 if (TARGET_68020 || TARGET_COLDFIRE)
1519 return "move%.l %1,%3\;smi %2\;extb%.l %2\;move%.l %2,%0";
1521 return "move%.l %1,%3\;smi %2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0";
1524 ;; Special case when one can avoid register clobbering, copy and test
1525 ;; Maybe there is a way to make that the general case, by forcing the
1526 ;; result of the SI tree to be in the lower register of the DI target
1528 (define_insn "extendplussidi"
1529 [(set (match_operand:DI 0 "register_operand" "=d")
1530 (sign_extend:DI (plus:SI (match_operand:SI 1 "general_operand" "%rmn")
1531 (match_operand:SI 2 "general_operand" "rmn"))))]
1535 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1536 if (GET_CODE (operands[1]) == CONST_INT
1537 && (unsigned) INTVAL (operands[1]) > 8)
1539 rtx tmp = operands[1];
1541 operands[1] = operands[2];
1544 if (GET_CODE (operands[1]) == REG
1545 && REGNO (operands[1]) == REGNO (operands[3]))
1546 output_asm_insn ("add%.l %2,%3", operands);
1548 output_asm_insn ("move%.l %2,%3\;add%.l %1,%3", operands);
1549 if (TARGET_68020 || TARGET_COLDFIRE)
1550 return "smi %0\;extb%.l %0";
1552 return "smi %0\;ext%.w %0\;ext%.l %0";
1555 (define_expand "extendhisi2"
1556 [(set (match_operand:SI 0 "nonimmediate_operand" "")
1558 (match_operand:HI 1 "nonimmediate_src_operand" "")))]
1562 (define_insn "*cfv4_extendhisi2"
1563 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
1565 (match_operand:HI 1 "nonimmediate_src_operand" "rmS")))]
1569 (define_insn "*68k_extendhisi2"
1570 [(set (match_operand:SI 0 "nonimmediate_operand" "=*d,a")
1572 (match_operand:HI 1 "nonimmediate_src_operand" "0,rmS")))]
1575 if (ADDRESS_REG_P (operands[0]))
1576 return "move%.w %1,%0";
1580 (define_insn "extendqihi2"
1581 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
1582 (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0")))]
1586 (define_expand "extendqisi2"
1587 [(set (match_operand:SI 0 "nonimmediate_operand" "")
1588 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
1589 "TARGET_68020 || TARGET_COLDFIRE"
1592 (define_insn "*cfv4_extendqisi2"
1593 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
1594 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "rms")))]
1598 (define_insn "*68k_extendqisi2"
1599 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
1600 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "0")))]
1601 "TARGET_68020 || (TARGET_COLDFIRE && !TARGET_ISAB)"
1604 ;; Conversions between float and double.
1606 (define_expand "extendsfdf2"
1607 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1609 (match_operand:SF 1 "general_operand" "")))]
1614 [(set (match_operand:DF 0 "nonimmediate_operand" "=*fdm,f")
1616 (match_operand:SF 1 "general_operand" "f,dmF")))]
1619 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
1621 if (REGNO (operands[0]) == REGNO (operands[1]))
1623 /* Extending float to double in an fp-reg is a no-op.
1624 NOTICE_UPDATE_CC has already assumed that the
1625 cc will be set. So cancel what it did. */
1626 cc_status = cc_prev_status;
1629 return "f%&move%.x %1,%0";
1631 if (FP_REG_P (operands[0]))
1632 return "f%&move%.s %f1,%0";
1633 if (DATA_REG_P (operands[0]) && FP_REG_P (operands[1]))
1635 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
1636 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1637 return "move%.l %+,%0";
1639 return "fmove%.d %f1,%0";
1642 (define_insn "extendsfdf2_cf"
1643 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f")
1645 (match_operand:SF 1 "general_operand" "f,<Q>U")))]
1646 "TARGET_COLDFIRE_FPU"
1648 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
1650 if (REGNO (operands[0]) == REGNO (operands[1]))
1652 /* Extending float to double in an fp-reg is a no-op.
1653 NOTICE_UPDATE_CC has already assumed that the
1654 cc will be set. So cancel what it did. */
1655 cc_status = cc_prev_status;
1658 return "fdmove%.d %1,%0";
1660 return "fdmove%.s %f1,%0";
1663 ;; This cannot output into an f-reg because there is no way to be
1664 ;; sure of truncating in that case.
1665 (define_expand "truncdfsf2"
1666 [(set (match_operand:SF 0 "nonimmediate_operand" "")
1668 (match_operand:DF 1 "general_operand" "")))]
1672 ;; On the '040 we can truncate in a register accurately and easily.
1674 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
1676 (match_operand:DF 1 "general_operand" "fmG")))]
1677 "TARGET_68881 && TARGET_68040"
1679 if (FP_REG_P (operands[1]))
1680 return "f%$move%.x %1,%0";
1681 return "f%$move%.d %f1,%0";
1684 (define_insn "truncdfsf2_cf"
1685 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,d<Q>U")
1687 (match_operand:DF 1 "general_operand" "<Q>U,f")))]
1688 "TARGET_COLDFIRE_FPU"
1694 [(set (match_operand:SF 0 "nonimmediate_operand" "=dm")
1696 (match_operand:DF 1 "general_operand" "f")))]
1700 ;; Conversion between fixed point and floating point.
1701 ;; Note that among the fix-to-float insns
1702 ;; the ones that start with SImode come first.
1703 ;; That is so that an operand that is a CONST_INT
1704 ;; (and therefore lacks a specific machine mode).
1705 ;; will be recognized as SImode (which is always valid)
1706 ;; rather than as QImode or HImode.
1708 (define_expand "floatsi<mode>2"
1709 [(set (match_operand:FP 0 "nonimmediate_operand" "")
1710 (float:FP (match_operand:SI 1 "general_operand" "")))]
1714 (define_insn "floatsi<mode>2_68881"
1715 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1716 (float:FP (match_operand:SI 1 "general_operand" "dmi")))]
1718 "f<FP:round>move%.l %1,%0")
1720 (define_insn "floatsi<mode>2_cf"
1721 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1722 (float:FP (match_operand:SI 1 "general_operand" "d<Q>U")))]
1723 "TARGET_COLDFIRE_FPU"
1724 "f<FP:prec>move%.l %1,%0")
1727 (define_expand "floathi<mode>2"
1728 [(set (match_operand:FP 0 "nonimmediate_operand" "")
1729 (float:FP (match_operand:HI 1 "general_operand" "")))]
1733 (define_insn "floathi<mode>2_68881"
1734 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1735 (float:FP (match_operand:HI 1 "general_operand" "dmn")))]
1739 (define_insn "floathi<mode>2_cf"
1740 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1741 (float:FP (match_operand:HI 1 "general_operand" "d<Q>U")))]
1742 "TARGET_COLDFIRE_FPU"
1746 (define_expand "floatqi<mode>2"
1747 [(set (match_operand:FP 0 "nonimmediate_operand" "")
1748 (float:FP (match_operand:QI 1 "general_operand" "")))]
1752 (define_insn "floatqi<mode>2_68881"
1753 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1754 (float:FP (match_operand:QI 1 "general_operand" "dmn")))]
1758 (define_insn "floatqi<mode>2_cf"
1759 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1760 (float:FP (match_operand:QI 1 "general_operand" "d<Q>U")))]
1761 "TARGET_COLDFIRE_FPU"
1765 ;; New routines to convert floating-point values to integers
1766 ;; to be used on the '040. These should be faster than trapping
1767 ;; into the kernel to emulate fintrz. They should also be faster
1768 ;; than calling the subroutines fixsfsi or fixdfsi.
1770 (define_insn "fix_truncdfsi2"
1771 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
1772 (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
1773 (clobber (match_scratch:SI 2 "=d"))
1774 (clobber (match_scratch:SI 3 "=d"))]
1775 "TARGET_68881 && TUNE_68040"
1778 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,%!";
1781 (define_insn "fix_truncdfhi2"
1782 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
1783 (fix:HI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
1784 (clobber (match_scratch:SI 2 "=d"))
1785 (clobber (match_scratch:SI 3 "=d"))]
1786 "TARGET_68881 && TUNE_68040"
1789 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,%!";
1792 (define_insn "fix_truncdfqi2"
1793 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
1794 (fix:QI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
1795 (clobber (match_scratch:SI 2 "=d"))
1796 (clobber (match_scratch:SI 3 "=d"))]
1797 "TARGET_68881 && TUNE_68040"
1800 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,%!";
1803 ;; Convert a float to a float whose value is an integer.
1804 ;; This is the first stage of converting it to an integer type.
1806 (define_expand "ftrunc<mode>2"
1807 [(set (match_operand:FP 0 "nonimmediate_operand" "")
1808 (fix:FP (match_operand:FP 1 "general_operand" "")))]
1809 "TARGET_HARD_FLOAT && !TUNE_68040"
1812 (define_insn "ftrunc<mode>2_68881"
1813 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1814 (fix:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m")))]
1815 "TARGET_68881 && !TUNE_68040"
1817 if (FP_REG_P (operands[1]))
1818 return "fintrz%.x %f1,%0";
1819 return "fintrz%.<FP:prec> %f1,%0";
1822 (define_insn "ftrunc<mode>2_cf"
1823 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1824 (fix:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U")))]
1825 "TARGET_COLDFIRE_FPU"
1827 if (FP_REG_P (operands[1]))
1828 return "fintrz%.d %f1,%0";
1829 return "fintrz%.<FP:prec> %f1,%0";
1832 ;; Convert a float whose value is an integer
1833 ;; to an actual integer. Second stage of converting float to integer type.
1834 (define_expand "fix<mode>qi2"
1835 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1836 (fix:QI (match_operand:FP 1 "general_operand" "")))]
1840 (define_insn "fix<mode>qi2_68881"
1841 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
1842 (fix:QI (match_operand:FP 1 "general_operand" "f")))]
1846 (define_insn "fix<mode>qi2_cf"
1847 [(set (match_operand:QI 0 "nonimmediate_operand" "=d<Q>U")
1848 (fix:QI (match_operand:FP 1 "general_operand" "f")))]
1849 "TARGET_COLDFIRE_FPU"
1852 (define_expand "fix<mode>hi2"
1853 [(set (match_operand:HI 0 "nonimmediate_operand" "")
1854 (fix:HI (match_operand:FP 1 "general_operand" "")))]
1858 (define_insn "fix<mode>hi2_68881"
1859 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
1860 (fix:HI (match_operand:FP 1 "general_operand" "f")))]
1864 (define_insn "fix<mode>hi2_cf"
1865 [(set (match_operand:HI 0 "nonimmediate_operand" "=d<Q>U")
1866 (fix:HI (match_operand:FP 1 "general_operand" "f")))]
1867 "TARGET_COLDFIRE_FPU"
1870 (define_expand "fix<mode>si2"
1871 [(set (match_operand:SI 0 "nonimmediate_operand" "")
1872 (fix:SI (match_operand:FP 1 "general_operand" "")))]
1876 (define_insn "fix<mode>si2_68881"
1877 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
1878 (fix:SI (match_operand:FP 1 "general_operand" "f")))]
1882 (define_insn "fix<mode>si2_cf"
1883 [(set (match_operand:SI 0 "nonimmediate_operand" "=d<Q>U")
1884 (fix:SI (match_operand:FP 1 "general_operand" "f")))]
1885 "TARGET_COLDFIRE_FPU"
1891 (define_insn "adddi_lshrdi_63"
1892 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
1893 (plus:DI (lshiftrt:DI (match_operand:DI 1 "general_operand" "rm")
1896 (clobber (match_scratch:SI 2 "=d"))]
1899 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1900 if (REG_P (operands[1]) && REGNO (operands[1]) == REGNO (operands[0]))
1902 "move%.l %1,%2\;add%.l %2,%2\;subx%.l %2,%2\;sub%.l %2,%3\;subx%.l %2,%0";
1903 if (GET_CODE (operands[1]) == REG)
1904 operands[4] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1905 else if (GET_CODE (XEXP (operands[1], 0)) == POST_INC
1906 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
1907 operands[4] = operands[1];
1909 operands[4] = adjust_address (operands[1], SImode, 4);
1910 if (GET_CODE (operands[1]) == MEM
1911 && GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
1912 output_asm_insn ("move%.l %4,%3", operands);
1913 output_asm_insn ("move%.l %1,%0\;smi %2", operands);
1914 if (TARGET_68020 || TARGET_COLDFIRE)
1915 output_asm_insn ("extb%.l %2", operands);
1917 output_asm_insn ("ext%.w %2\;ext%.l %2", operands);
1918 if (GET_CODE (operands[1]) != MEM
1919 || GET_CODE (XEXP (operands[1], 0)) != PRE_DEC)
1920 output_asm_insn ("move%.l %4,%3", operands);
1921 return "sub%.l %2,%3\;subx%.l %2,%0";
1924 (define_insn "adddi_sexthishl32"
1925 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,a,*d,*d")
1926 (plus:DI (ashift:DI (sign_extend:DI
1927 (match_operand:HI 1 "general_operand" "rm,rm,rm,rm"))
1929 (match_operand:DI 2 "general_operand" "0,0,0,0")))
1930 (clobber (match_scratch:SI 3 "=&d,X,a,?d"))]
1934 if (ADDRESS_REG_P (operands[0]))
1935 return "add%.w %1,%0";
1936 else if (ADDRESS_REG_P (operands[3]))
1937 return "move%.w %1,%3\;add%.l %3,%0";
1939 return "move%.w %1,%3\;ext%.l %3\;add%.l %3,%0";
1942 (define_insn "*adddi_dilshr32"
1943 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,o")
1944 (plus:DI (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro,d")
1946 (match_operand:DI 2 "general_operand" "0,0")))]
1950 if (GET_CODE (operands[0]) == REG)
1951 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1953 operands[2] = adjust_address (operands[0], SImode, 4);
1954 return "add%.l %1,%2\;negx%.l %0\;neg%.l %0";
1957 (define_insn "*adddi_dilshr32_cf"
1958 [(set (match_operand:DI 0 "register_operand" "=d")
1959 (plus:DI (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "ro")
1961 (match_operand:DI 2 "register_operand" "0")))]
1965 return "add%.l %1,%R0\;negx%.l %0\;neg%.l %0";
1968 (define_insn "adddi_dishl32"
1969 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o")
1970 ;; (plus:DI (match_operand:DI 2 "general_operand" "%0")
1971 ;; (ashift:DI (match_operand:DI 1 "general_operand" "ro")
1972 ;; (const_int 32))))]
1973 (plus:DI (ashift:DI (match_operand:DI 1 "general_operand" "ro,d")
1975 (match_operand:DI 2 "general_operand" "0,0")))]
1979 if (GET_CODE (operands[1]) == REG)
1980 operands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1982 operands[1] = adjust_address (operands[1], SImode, 4);
1983 return "add%.l %1,%0";
1986 (define_insn "adddi3"
1987 [(set (match_operand:DI 0 "nonimmediate_operand" "=o<>,d,d,d")
1988 (plus:DI (match_operand:DI 1 "general_operand" "%0,0,0,0")
1989 (match_operand:DI 2 "general_operand" "d,no>,d,a")))
1990 (clobber (match_scratch:SI 3 "=&d,&d,X,&d"))]
1993 if (DATA_REG_P (operands[0]))
1995 if (DATA_REG_P (operands[2]))
1996 return "add%.l %R2,%R0\;addx%.l %2,%0";
1997 else if (GET_CODE (operands[2]) == MEM
1998 && GET_CODE (XEXP (operands[2], 0)) == POST_INC)
1999 return "move%.l %2,%3\;add%.l %2,%R0\;addx%.l %3,%0";
2005 if (GET_CODE (operands[2]) == REG)
2007 low = gen_rtx_REG (SImode, REGNO (operands[2]) + 1);
2010 else if (CONSTANT_P (operands[2]))
2011 split_double (operands[2], &high, &low);
2014 low = adjust_address (operands[2], SImode, 4);
2018 operands[1] = low, operands[2] = high;
2019 xoperands[0] = operands[3];
2020 if (GET_CODE (operands[1]) == CONST_INT
2021 && INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
2022 xoperands[1] = GEN_INT (-INTVAL (operands[2]) - 1);
2024 xoperands[1] = operands[2];
2026 output_asm_insn (output_move_simode (xoperands), xoperands);
2027 if (GET_CODE (operands[1]) == CONST_INT)
2029 if (INTVAL (operands[1]) > 0 && INTVAL (operands[1]) <= 8)
2030 return "addq%.l %1,%R0\;addx%.l %3,%0";
2031 else if (INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
2033 operands[1] = GEN_INT (-INTVAL (operands[1]));
2034 return "subq%.l %1,%R0\;subx%.l %3,%0";
2037 return "add%.l %1,%R0\;addx%.l %3,%0";
2042 gcc_assert (GET_CODE (operands[0]) == MEM);
2044 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
2046 operands[1] = gen_rtx_MEM (SImode,
2047 plus_constant (XEXP(operands[0], 0), -8));
2048 return "move%.l %0,%3\;add%.l %R2,%0\;addx%.l %2,%3\;move%.l %3,%1";
2050 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
2052 operands[1] = XEXP(operands[0], 0);
2053 return "add%.l %R2,%0\;move%.l %0,%3\;addx%.l %2,%3\;move%.l %3,%1";
2057 operands[1] = adjust_address (operands[0], SImode, 4);
2058 return "add%.l %R2,%1\;move%.l %0,%3\;addx%.l %2,%3\;move%.l %3,%0";
2063 (define_insn "addsi_lshrsi_31"
2064 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
2065 (plus:SI (lshiftrt:SI (match_operand:SI 1 "general_operand" "rm")
2070 operands[2] = operands[0];
2071 operands[3] = gen_label_rtx();
2072 if (GET_CODE (operands[0]) == MEM)
2074 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
2075 operands[0] = gen_rtx_MEM (SImode, XEXP (XEXP (operands[0], 0), 0));
2076 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
2077 operands[2] = gen_rtx_MEM (SImode, XEXP (XEXP (operands[0], 0), 0));
2079 output_asm_insn ("move%.l %1,%0", operands);
2080 output_asm_insn (MOTOROLA ? "jbpl %l3" : "jpl %l3", operands);
2081 output_asm_insn ("addq%.l #1,%2", operands);
2082 (*targetm.asm_out.internal_label) (asm_out_file, "L",
2083 CODE_LABEL_NUMBER (operands[3]));
2087 (define_expand "addsi3"
2088 [(set (match_operand:SI 0 "nonimmediate_operand" "")
2089 (plus:SI (match_operand:SI 1 "general_operand" "")
2090 (match_operand:SI 2 "general_src_operand" "")))]
2094 ;; Note that the middle two alternatives are near-duplicates
2095 ;; in order to handle insns generated by reload.
2096 ;; This is needed since they are not themselves reloaded,
2097 ;; so commutativity won't apply to them.
2098 (define_insn "*addsi3_internal"
2099 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,?a,?a,d,a")
2100 (plus:SI (match_operand:SI 1 "general_operand" "%0,a,rJK,0,0")
2101 (match_operand:SI 2 "general_src_operand" "dIKLT,rJK,a,mSrIKLT,mSrIKLs")))]
2105 "* return output_addsi3 (operands);")
2107 (define_insn "*addsi3_5200"
2108 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,?a,?a,r")
2109 (plus:SI (match_operand:SI 1 "general_operand" "%0,a,rJK,0")
2110 (match_operand:SI 2 "general_src_operand" "dIL,rJK,a,mrIKLi")))]
2112 "* return output_addsi3 (operands);")
2115 [(set (match_operand:SI 0 "nonimmediate_operand" "=a")
2116 (plus:SI (match_operand:SI 1 "general_operand" "0")
2118 (match_operand:HI 2 "nonimmediate_src_operand" "rmS"))))]
2122 (define_insn "addhi3"
2123 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,r")
2124 (plus:HI (match_operand:HI 1 "general_operand" "%0,0")
2125 (match_operand:HI 2 "general_src_operand" "dn,rmSn")))]
2128 if (GET_CODE (operands[2]) == CONST_INT)
2130 /* If the constant would be a negative number when interpreted as
2131 HImode, make it negative. This is usually, but not always, done
2132 elsewhere in the compiler. First check for constants out of range,
2133 which could confuse us. */
2135 if (INTVAL (operands[2]) >= 32768)
2136 operands[2] = GEN_INT (INTVAL (operands[2]) - 65536);
2138 if (INTVAL (operands[2]) > 0
2139 && INTVAL (operands[2]) <= 8)
2140 return "addq%.w %2,%0";
2141 if (INTVAL (operands[2]) < 0
2142 && INTVAL (operands[2]) >= -8)
2144 operands[2] = GEN_INT (- INTVAL (operands[2]));
2145 return "subq%.w %2,%0";
2147 /* On the CPU32 it is faster to use two addqw instructions to
2148 add a small integer (8 < N <= 16) to a register.
2149 Likewise for subqw. */
2150 if (TUNE_CPU32 && REG_P (operands[0]))
2152 if (INTVAL (operands[2]) > 8
2153 && INTVAL (operands[2]) <= 16)
2155 operands[2] = GEN_INT (INTVAL (operands[2]) - 8);
2156 return "addq%.w #8,%0\;addq%.w %2,%0";
2158 if (INTVAL (operands[2]) < -8
2159 && INTVAL (operands[2]) >= -16)
2161 operands[2] = GEN_INT (- INTVAL (operands[2]) - 8);
2162 return "subq%.w #8,%0\;subq%.w %2,%0";
2165 if (ADDRESS_REG_P (operands[0]) && !TUNE_68040)
2166 return MOTOROLA ? "lea (%c2,%0),%0" : "lea %0@(%c2),%0";
2168 return "add%.w %2,%0";
2171 ;; These insns must use MATCH_DUP instead of the more expected
2172 ;; use of a matching constraint because the "output" here is also
2173 ;; an input, so you can't use the matching constraint. That also means
2174 ;; that you can't use the "%", so you need patterns with the matched
2175 ;; operand in both positions.
2178 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
2179 (plus:HI (match_dup 0)
2180 (match_operand:HI 1 "general_src_operand" "dn,rmSn")))]
2183 if (GET_CODE (operands[1]) == CONST_INT)
2185 /* If the constant would be a negative number when interpreted as
2186 HImode, make it negative. This is usually, but not always, done
2187 elsewhere in the compiler. First check for constants out of range,
2188 which could confuse us. */
2190 if (INTVAL (operands[1]) >= 32768)
2191 operands[1] = GEN_INT (INTVAL (operands[1]) - 65536);
2193 if (INTVAL (operands[1]) > 0
2194 && INTVAL (operands[1]) <= 8)
2195 return "addq%.w %1,%0";
2196 if (INTVAL (operands[1]) < 0
2197 && INTVAL (operands[1]) >= -8)
2199 operands[1] = GEN_INT (- INTVAL (operands[1]));
2200 return "subq%.w %1,%0";
2202 /* On the CPU32 it is faster to use two addqw instructions to
2203 add a small integer (8 < N <= 16) to a register.
2204 Likewise for subqw. */
2205 if (TUNE_CPU32 && REG_P (operands[0]))
2207 if (INTVAL (operands[1]) > 8
2208 && INTVAL (operands[1]) <= 16)
2210 operands[1] = GEN_INT (INTVAL (operands[1]) - 8);
2211 return "addq%.w #8,%0\;addq%.w %1,%0";
2213 if (INTVAL (operands[1]) < -8
2214 && INTVAL (operands[1]) >= -16)
2216 operands[1] = GEN_INT (- INTVAL (operands[1]) - 8);
2217 return "subq%.w #8,%0\;subq%.w %1,%0";
2220 if (ADDRESS_REG_P (operands[0]) && !TUNE_68040)
2221 return MOTOROLA ? "lea (%c1,%0),%0" : "lea %0@(%c1),%0";
2223 return "add%.w %1,%0";
2227 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
2228 (plus:HI (match_operand:HI 1 "general_src_operand" "dn,rmSn")
2232 if (GET_CODE (operands[1]) == CONST_INT)
2234 /* If the constant would be a negative number when interpreted as
2235 HImode, make it negative. This is usually, but not always, done
2236 elsewhere in the compiler. First check for constants out of range,
2237 which could confuse us. */
2239 if (INTVAL (operands[1]) >= 32768)
2240 operands[1] = GEN_INT (INTVAL (operands[1]) - 65536);
2242 if (INTVAL (operands[1]) > 0
2243 && INTVAL (operands[1]) <= 8)
2244 return "addq%.w %1,%0";
2245 if (INTVAL (operands[1]) < 0
2246 && INTVAL (operands[1]) >= -8)
2248 operands[1] = GEN_INT (- INTVAL (operands[1]));
2249 return "subq%.w %1,%0";
2251 /* On the CPU32 it is faster to use two addqw instructions to
2252 add a small integer (8 < N <= 16) to a register.
2253 Likewise for subqw. */
2254 if (TUNE_CPU32 && REG_P (operands[0]))
2256 if (INTVAL (operands[1]) > 8
2257 && INTVAL (operands[1]) <= 16)
2259 operands[1] = GEN_INT (INTVAL (operands[1]) - 8);
2260 return "addq%.w #8,%0\;addq%.w %1,%0";
2262 if (INTVAL (operands[1]) < -8
2263 && INTVAL (operands[1]) >= -16)
2265 operands[1] = GEN_INT (- INTVAL (operands[1]) - 8);
2266 return "subq%.w #8,%0\;subq%.w %1,%0";
2269 if (ADDRESS_REG_P (operands[0]) && !TUNE_68040)
2270 return MOTOROLA ? "lea (%c1,%0),%0" : "lea %0@(%c1),%0";
2272 return "add%.w %1,%0";
2275 (define_insn "addqi3"
2276 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
2277 (plus:QI (match_operand:QI 1 "general_operand" "%0,0")
2278 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
2281 if (GET_CODE (operands[2]) == CONST_INT)
2283 if (INTVAL (operands[2]) >= 128)
2284 operands[2] = GEN_INT (INTVAL (operands[2]) - 256);
2286 if (INTVAL (operands[2]) > 0
2287 && INTVAL (operands[2]) <= 8)
2288 return "addq%.b %2,%0";
2289 if (INTVAL (operands[2]) < 0 && INTVAL (operands[2]) >= -8)
2291 operands[2] = GEN_INT (- INTVAL (operands[2]));
2292 return "subq%.b %2,%0";
2295 return "add%.b %2,%0";
2299 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
2300 (plus:QI (match_dup 0)
2301 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
2304 if (GET_CODE (operands[1]) == CONST_INT)
2306 if (INTVAL (operands[1]) >= 128)
2307 operands[1] = GEN_INT (INTVAL (operands[1]) - 256);
2309 if (INTVAL (operands[1]) > 0
2310 && INTVAL (operands[1]) <= 8)
2311 return "addq%.b %1,%0";
2312 if (INTVAL (operands[1]) < 0 && INTVAL (operands[1]) >= -8)
2314 operands[1] = GEN_INT (- INTVAL (operands[1]));
2315 return "subq%.b %1,%0";
2318 return "add%.b %1,%0";
2322 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
2323 (plus:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn")
2327 if (GET_CODE (operands[1]) == CONST_INT)
2329 if (INTVAL (operands[1]) >= 128)
2330 operands[1] = GEN_INT (INTVAL (operands[1]) - 256);
2332 if (INTVAL (operands[1]) > 0
2333 && INTVAL (operands[1]) <= 8)
2334 return "addq%.b %1,%0";
2335 if (INTVAL (operands[1]) < 0 && INTVAL (operands[1]) >= -8)
2337 operands[1] = GEN_INT (- INTVAL (operands[1]));
2338 return "subq%.b %1,%0";
2341 return "add%.b %1,%0";
2344 (define_expand "add<mode>3"
2345 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2346 (plus:FP (match_operand:FP 1 "general_operand" "")
2347 (match_operand:FP 2 "general_operand" "")))]
2351 (define_insn "add<mode>3_floatsi_68881"
2352 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2353 (plus:FP (float:FP (match_operand:SI 2 "general_operand" "dmi"))
2354 (match_operand:FP 1 "general_operand" "0")))]
2356 "f<FP:round>add%.l %2,%0")
2358 (define_insn "add<mode>3_floathi_68881"
2359 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2360 (plus:FP (float:FP (match_operand:HI 2 "general_operand" "dmn"))
2361 (match_operand:FP 1 "general_operand" "0")))]
2363 "f<FP:round>add%.w %2,%0")
2365 (define_insn "add<mode>3_floatqi_68881"
2366 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2367 (plus:FP (float:FP (match_operand:QI 2 "general_operand" "dmn"))
2368 (match_operand:FP 1 "general_operand" "0")))]
2370 "f<FP:round>add%.b %2,%0")
2372 (define_insn "add<mode>3_68881"
2373 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2374 (plus:FP (match_operand:FP 1 "general_operand" "%0")
2375 (match_operand:FP 2 "general_operand" "f<FP:dreg>m<FP:const>")))]
2378 if (FP_REG_P (operands[2]))
2379 return "f<FP:round>add%.x %2,%0";
2380 return "f<FP:round>add%.<FP:prec> %f2,%0";
2383 (define_insn "add<mode>3_cf"
2384 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2385 (plus:FP (match_operand:FP 1 "general_operand" "%0")
2386 (match_operand:FP 2 "general_operand" "f<FP:dreg><Q>U")))]
2387 "TARGET_COLDFIRE_FPU"
2389 if (FP_REG_P (operands[2]))
2390 return "f<FP:prec>add%.d %2,%0";
2391 return "f<FP:prec>add%.<FP:prec> %2,%0";
2394 ;; subtract instructions
2396 (define_insn "subdi_sexthishl32"
2397 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,a,*d,*d")
2398 (minus:DI (match_operand:DI 1 "general_operand" "0,0,0,0")
2399 (ashift:DI (sign_extend:DI (match_operand:HI 2 "general_operand" "rm,rm,rm,rm"))
2401 (clobber (match_scratch:SI 3 "=&d,X,a,?d"))]
2405 if (ADDRESS_REG_P (operands[0]))
2406 return "sub%.w %2,%0";
2407 else if (ADDRESS_REG_P (operands[3]))
2408 return "move%.w %2,%3\;sub%.l %3,%0";
2410 return "move%.w %2,%3\;ext%.l %3\;sub%.l %3,%0";
2413 (define_insn "subdi_dishl32"
2414 [(set (match_operand:DI 0 "nonimmediate_operand" "+ro")
2415 (minus:DI (match_dup 0)
2416 (ashift:DI (match_operand:DI 1 "general_operand" "ro")
2421 if (GET_CODE (operands[1]) == REG)
2422 operands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
2424 operands[1] = adjust_address (operands[1], SImode, 4);
2425 return "sub%.l %1,%0";
2428 (define_insn "subdi3"
2429 [(set (match_operand:DI 0 "nonimmediate_operand" "=o<>,d,d,d")
2430 (minus:DI (match_operand:DI 1 "general_operand" "0,0,0,0")
2431 (match_operand:DI 2 "general_operand" "d,no>,d,a")))
2432 (clobber (match_scratch:SI 3 "=&d,&d,X,&d"))]
2435 if (DATA_REG_P (operands[0]))
2437 if (DATA_REG_P (operands[2]))
2438 return "sub%.l %R2,%R0\;subx%.l %2,%0";
2439 else if (GET_CODE (operands[2]) == MEM
2440 && GET_CODE (XEXP (operands[2], 0)) == POST_INC)
2442 return "move%.l %2,%3\;sub%.l %2,%R0\;subx%.l %3,%0";
2449 if (GET_CODE (operands[2]) == REG)
2451 low = gen_rtx_REG (SImode, REGNO (operands[2]) + 1);
2454 else if (CONSTANT_P (operands[2]))
2455 split_double (operands[2], &high, &low);
2458 low = adjust_address (operands[2], SImode, 4);
2462 operands[1] = low, operands[2] = high;
2463 xoperands[0] = operands[3];
2464 if (GET_CODE (operands[1]) == CONST_INT
2465 && INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
2466 xoperands[1] = GEN_INT (-INTVAL (operands[2]) - 1);
2468 xoperands[1] = operands[2];
2470 output_asm_insn (output_move_simode (xoperands), xoperands);
2471 if (GET_CODE (operands[1]) == CONST_INT)
2473 if (INTVAL (operands[1]) > 0 && INTVAL (operands[1]) <= 8)
2474 return "subq%.l %1,%R0\;subx%.l %3,%0";
2475 else if (INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
2477 operands[1] = GEN_INT (-INTVAL (operands[1]));
2478 return "addq%.l %1,%R0\;addx%.l %3,%0";
2481 return "sub%.l %1,%R0\;subx%.l %3,%0";
2486 gcc_assert (GET_CODE (operands[0]) == MEM);
2488 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
2491 = gen_rtx_MEM (SImode, plus_constant (XEXP (operands[0], 0), -8));
2492 return "move%.l %0,%3\;sub%.l %R2,%0\;subx%.l %2,%3\;move%.l %3,%1";
2494 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
2496 operands[1] = XEXP(operands[0], 0);
2497 return "sub%.l %R2,%0\;move%.l %0,%3\;subx%.l %2,%3\;move%.l %3,%1";
2501 operands[1] = adjust_address (operands[0], SImode, 4);
2502 return "sub%.l %R2,%1\;move%.l %0,%3\;subx%.l %2,%3\;move%.l %3,%0";
2507 (define_insn "subsi3"
2508 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,d,a")
2509 (minus:SI (match_operand:SI 1 "general_operand" "0,0,0")
2510 (match_operand:SI 2 "general_src_operand" "dT,mSrT,mSrs")))]
2515 [(set (match_operand:SI 0 "nonimmediate_operand" "=a")
2516 (minus:SI (match_operand:SI 1 "general_operand" "0")
2518 (match_operand:HI 2 "nonimmediate_src_operand" "rmS"))))]
2522 (define_insn "subhi3"
2523 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,r")
2524 (minus:HI (match_operand:HI 1 "general_operand" "0,0")
2525 (match_operand:HI 2 "general_src_operand" "dn,rmSn")))]
2530 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
2531 (minus:HI (match_dup 0)
2532 (match_operand:HI 1 "general_src_operand" "dn,rmSn")))]
2536 (define_insn "subqi3"
2537 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
2538 (minus:QI (match_operand:QI 1 "general_operand" "0,0")
2539 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
2544 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
2545 (minus:QI (match_dup 0)
2546 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
2550 (define_expand "sub<mode>3"
2551 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2552 (minus:FP (match_operand:FP 1 "general_operand" "")
2553 (match_operand:FP 2 "general_operand" "")))]
2557 (define_insn "sub<mode>3_floatsi_68881"
2558 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2559 (minus:FP (match_operand:FP 1 "general_operand" "0")
2560 (float:FP (match_operand:SI 2 "general_operand" "dmi"))))]
2562 "f<FP:round>sub%.l %2,%0")
2564 (define_insn "sub<mode>3_floathi_68881"
2565 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2566 (minus:FP (match_operand:FP 1 "general_operand" "0")
2567 (float:FP (match_operand:HI 2 "general_operand" "dmn"))))]
2569 "f<FP:round>sub%.w %2,%0")
2571 (define_insn "sub<mode>3_floatqi_68881"
2572 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2573 (minus:FP (match_operand:FP 1 "general_operand" "0")
2574 (float:FP (match_operand:QI 2 "general_operand" "dmn"))))]
2576 "f<FP:round>sub%.b %2,%0")
2578 (define_insn "sub<mode>3_68881"
2579 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2580 (minus:FP (match_operand:FP 1 "general_operand" "0")
2581 (match_operand:FP 2 "general_operand" "f<FP:dreg>m<FP:const>")))]
2584 if (FP_REG_P (operands[2]))
2585 return "f<FP:round>sub%.x %2,%0";
2586 return "f<FP:round>sub%.<FP:prec> %f2,%0";
2589 (define_insn "sub<mode>3_cf"
2590 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2591 (minus:FP (match_operand:FP 1 "general_operand" "0")
2592 (match_operand:FP 2 "general_operand" "f<FP:dreg><Q>U")))]
2593 "TARGET_COLDFIRE_FPU"
2595 if (FP_REG_P (operands[2]))
2596 return "f<FP:prec>sub%.d %2,%0";
2597 return "f<FP:prec>sub%.<FP:prec> %2,%0";
2600 ;; multiply instructions
2602 (define_insn "mulhi3"
2603 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
2604 (mult:HI (match_operand:HI 1 "general_operand" "%0")
2605 (match_operand:HI 2 "general_src_operand" "dmSn")))]
2608 return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0";
2611 (define_insn "mulhisi3"
2612 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2613 (mult:SI (sign_extend:SI
2614 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2616 (match_operand:HI 2 "nonimmediate_src_operand" "dmS"))))]
2619 return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0";
2623 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2624 (mult:SI (sign_extend:SI
2625 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2626 (match_operand:SI 2 "const_int_operand" "n")))]
2627 "INTVAL (operands[2]) >= -0x8000 && INTVAL (operands[2]) <= 0x7fff"
2629 return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0";
2632 (define_expand "mulsi3"
2633 [(set (match_operand:SI 0 "nonimmediate_operand" "")
2634 (mult:SI (match_operand:SI 1 "general_operand" "")
2635 (match_operand:SI 2 "general_operand" "")))]
2636 "TARGET_68020 || TARGET_COLDFIRE"
2640 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2641 (mult:SI (match_operand:SI 1 "general_operand" "%0")
2642 (match_operand:SI 2 "general_src_operand" "dmSTK")))]
2648 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2649 (mult:SI (match_operand:SI 1 "general_operand" "%0")
2650 (match_operand:SI 2 "general_operand" "d<Q>")))]
2654 (define_insn "umulhisi3"
2655 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2656 (mult:SI (zero_extend:SI
2657 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2659 (match_operand:HI 2 "nonimmediate_src_operand" "dmS"))))]
2662 return MOTOROLA ? "mulu%.w %2,%0" : "mulu %2,%0";
2666 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2667 (mult:SI (zero_extend:SI
2668 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2669 (match_operand:SI 2 "const_int_operand" "n")))]
2670 "INTVAL (operands[2]) >= 0 && INTVAL (operands[2]) <= 0xffff"
2672 return MOTOROLA ? "mulu%.w %2,%0" : "mulu %2,%0";
2675 ;; We need a separate DEFINE_EXPAND for u?mulsidi3 to be able to use the
2676 ;; proper matching constraint. This is because the matching is between
2677 ;; the high-numbered word of the DImode operand[0] and operand[1].
2678 (define_expand "umulsidi3"
2680 [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 4)
2681 (mult:SI (match_operand:SI 1 "register_operand" "")
2682 (match_operand:SI 2 "register_operand" "")))
2683 (set (subreg:SI (match_dup 0) 0)
2684 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
2685 (zero_extend:DI (match_dup 2)))
2686 (const_int 32))))])]
2687 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2691 [(set (match_operand:SI 0 "register_operand" "=d")
2692 (mult:SI (match_operand:SI 1 "register_operand" "%0")
2693 (match_operand:SI 2 "nonimmediate_operand" "dm")))
2694 (set (match_operand:SI 3 "register_operand" "=d")
2695 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
2696 (zero_extend:DI (match_dup 2)))
2698 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2701 ; Match immediate case. For 2.4 only match things < 2^31.
2702 ; It's tricky with larger values in these patterns since we need to match
2703 ; values between the two parallel multiplies, between a CONST_DOUBLE and
2706 [(set (match_operand:SI 0 "register_operand" "=d")
2707 (mult:SI (match_operand:SI 1 "register_operand" "%0")
2708 (match_operand:SI 2 "const_int_operand" "n")))
2709 (set (match_operand:SI 3 "register_operand" "=d")
2710 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
2713 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE
2714 && (unsigned) INTVAL (operands[2]) <= 0x7fffffff"
2717 (define_expand "mulsidi3"
2719 [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 4)
2720 (mult:SI (match_operand:SI 1 "register_operand" "")
2721 (match_operand:SI 2 "register_operand" "")))
2722 (set (subreg:SI (match_dup 0) 0)
2723 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
2724 (sign_extend:DI (match_dup 2)))
2725 (const_int 32))))])]
2726 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2730 [(set (match_operand:SI 0 "register_operand" "=d")
2731 (mult:SI (match_operand:SI 1 "register_operand" "%0")
2732 (match_operand:SI 2 "nonimmediate_operand" "dm")))
2733 (set (match_operand:SI 3 "register_operand" "=d")
2734 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
2735 (sign_extend:DI (match_dup 2)))
2737 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2741 [(set (match_operand:SI 0 "register_operand" "=d")
2742 (mult:SI (match_operand:SI 1 "register_operand" "%0")
2743 (match_operand:SI 2 "const_int_operand" "n")))
2744 (set (match_operand:SI 3 "register_operand" "=d")
2745 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
2748 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2751 (define_expand "umulsi3_highpart"
2753 [(set (match_operand:SI 0 "register_operand" "")
2756 (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" ""))
2757 (zero_extend:DI (match_operand:SI 2 "general_operand" "")))
2759 (clobber (match_dup 3))])]
2760 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2762 operands[3] = gen_reg_rtx (SImode);
2764 if (GET_CODE (operands[2]) == CONST_INT)
2766 operands[2] = immed_double_const (INTVAL (operands[2]) & 0xffffffff,
2769 /* We have to adjust the operand order for the matching constraints. */
2770 emit_insn (gen_const_umulsi3_highpart (operands[0], operands[3],
2771 operands[1], operands[2]));
2777 [(set (match_operand:SI 0 "register_operand" "=d")
2780 (mult:DI (zero_extend:DI (match_operand:SI 2 "register_operand" "%1"))
2781 (zero_extend:DI (match_operand:SI 3 "nonimmediate_operand" "dm")))
2783 (clobber (match_operand:SI 1 "register_operand" "=d"))]
2784 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2787 (define_insn "const_umulsi3_highpart"
2788 [(set (match_operand:SI 0 "register_operand" "=d")
2791 (mult:DI (zero_extend:DI (match_operand:SI 2 "register_operand" "1"))
2792 (match_operand:DI 3 "const_uint32_operand" "n"))
2794 (clobber (match_operand:SI 1 "register_operand" "=d"))]
2795 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2798 (define_expand "smulsi3_highpart"
2800 [(set (match_operand:SI 0 "register_operand" "")
2803 (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" ""))
2804 (sign_extend:DI (match_operand:SI 2 "general_operand" "")))
2806 (clobber (match_dup 3))])]
2807 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2809 operands[3] = gen_reg_rtx (SImode);
2810 if (GET_CODE (operands[2]) == CONST_INT)
2812 /* We have to adjust the operand order for the matching constraints. */
2813 emit_insn (gen_const_smulsi3_highpart (operands[0], operands[3],
2814 operands[1], operands[2]));
2820 [(set (match_operand:SI 0 "register_operand" "=d")
2823 (mult:DI (sign_extend:DI (match_operand:SI 2 "register_operand" "%1"))
2824 (sign_extend:DI (match_operand:SI 3 "nonimmediate_operand" "dm")))
2826 (clobber (match_operand:SI 1 "register_operand" "=d"))]
2827 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2830 (define_insn "const_smulsi3_highpart"
2831 [(set (match_operand:SI 0 "register_operand" "=d")
2834 (mult:DI (sign_extend:DI (match_operand:SI 2 "register_operand" "1"))
2835 (match_operand:DI 3 "const_sint32_operand" "n"))
2837 (clobber (match_operand:SI 1 "register_operand" "=d"))]
2838 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2841 (define_expand "mul<mode>3"
2842 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2843 (mult:FP (match_operand:FP 1 "general_operand" "")
2844 (match_operand:FP 2 "general_operand" "")))]
2848 (define_insn "mul<mode>3_floatsi_68881"
2849 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2850 (mult:FP (float:FP (match_operand:SI 2 "general_operand" "dmi"))
2851 (match_operand:FP 1 "general_operand" "0")))]
2855 ? "f<FP:round>mul%.l %2,%0"
2856 : "f<FP:round_mul>mul%.l %2,%0";
2859 (define_insn "mul<mode>3_floathi_68881"
2860 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2861 (mult:FP (float:FP (match_operand:HI 2 "general_operand" "dmn"))
2862 (match_operand:FP 1 "general_operand" "0")))]
2866 ? "f<FP:round>mul%.w %2,%0"
2867 : "f<FP:round_mul>mul%.w %2,%0";
2870 (define_insn "mul<mode>3_floatqi_68881"
2871 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2872 (mult:FP (float:FP (match_operand:QI 2 "general_operand" "dmn"))
2873 (match_operand:FP 1 "general_operand" "0")))]
2877 ? "f<FP:round>mul%.b %2,%0"
2878 : "f<FP:round_mul>mul%.b %2,%0";
2881 (define_insn "muldf_68881"
2882 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2883 (mult:DF (match_operand:DF 1 "general_operand" "%0")
2884 (match_operand:DF 2 "general_operand" "fmG")))]
2887 if (GET_CODE (operands[2]) == CONST_DOUBLE
2888 && floating_exact_log2 (operands[2]) && !TUNE_68040_60)
2890 int i = floating_exact_log2 (operands[2]);
2891 operands[2] = GEN_INT (i);
2892 return "fscale%.l %2,%0";
2894 if (REG_P (operands[2]))
2895 return "f%&mul%.x %2,%0";
2896 return "f%&mul%.d %f2,%0";
2899 (define_insn "mulsf_68881"
2900 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2901 (mult:SF (match_operand:SF 1 "general_operand" "%0")
2902 (match_operand:SF 2 "general_operand" "fdmF")))]
2905 if (FP_REG_P (operands[2]))
2906 return (TARGET_68040
2908 : "fsglmul%.x %2,%0");
2909 return (TARGET_68040
2911 : "fsglmul%.s %f2,%0");
2914 (define_insn "mulxf3_68881"
2915 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
2916 (mult:XF (match_operand:XF 1 "nonimmediate_operand" "%0")
2917 (match_operand:XF 2 "nonimmediate_operand" "fm")))]
2920 return "fmul%.x %f2,%0";
2923 (define_insn "fmul<mode>3_cf"
2924 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2925 (mult:FP (match_operand:FP 1 "general_operand" "%0")
2926 (match_operand:FP 2 "general_operand" "f<Q>U<FP:dreg>")))]
2927 "TARGET_COLDFIRE_FPU"
2929 if (FP_REG_P (operands[2]))
2930 return "f<FP:prec>mul%.d %2,%0";
2931 return "f<FP:prec>mul%.<FP:prec> %2,%0";
2934 ;; divide instructions
2936 (define_expand "div<mode>3"
2937 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2938 (div:FP (match_operand:FP 1 "general_operand" "")
2939 (match_operand:FP 2 "general_operand" "")))]
2943 (define_insn "div<mode>3_floatsi_68881"
2944 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2945 (div:FP (match_operand:FP 1 "general_operand" "0")
2946 (float:FP (match_operand:SI 2 "general_operand" "dmi"))))]
2950 ? "f<FP:round>div%.l %2,%0"
2951 : "f<FP:round_mul>div%.l %2,%0";
2954 (define_insn "div<mode>3_floathi_68881"
2955 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2956 (div:FP (match_operand:FP 1 "general_operand" "0")
2957 (float:FP (match_operand:HI 2 "general_operand" "dmn"))))]
2961 ? "f<FP:round>div%.w %2,%0"
2962 : "f<FP:round_mul>div%.w %2,%0";
2965 (define_insn "div<mode>3_floatqi_68881"
2966 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2967 (div:FP (match_operand:FP 1 "general_operand" "0")
2968 (float:FP (match_operand:QI 2 "general_operand" "dmn"))))]
2972 ? "f<FP:round>div%.b %2,%0"
2973 : "f<FP:round_mul>div%.b %2,%0";
2976 (define_insn "div<mode>3_68881"
2977 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2978 (div:FP (match_operand:FP 1 "general_operand" "0")
2979 (match_operand:FP 2 "general_operand" "f<FP:dreg>m<FP:const>")))]
2982 if (FP_REG_P (operands[2]))
2983 return (TARGET_68040
2984 ? "f<FP:round>div%.x %2,%0"
2985 : "f<FP:round_mul>div%.x %2,%0");
2986 return (TARGET_68040
2987 ? "f<FP:round>div%.<FP:prec> %f2,%0"
2988 : "f<FP:round_mul>div%.<FP:prec> %f2,%0");
2991 (define_insn "div<mode>3_cf"
2992 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2993 (div:FP (match_operand:FP 1 "general_operand" "0")
2994 (match_operand:FP 2 "general_operand" "f<Q>U<FP:dreg>")))]
2995 "TARGET_COLDFIRE_FPU"
2997 if (FP_REG_P (operands[2]))
2998 return "f<FP:prec>div%.d %2,%0";
2999 return "f<FP:prec>div%.<FP:prec> %2,%0";
3002 ;; Remainder instructions.
3004 (define_expand "divmodsi4"
3006 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3007 (div:SI (match_operand:SI 1 "general_operand" "")
3008 (match_operand:SI 2 "general_src_operand" "")))
3009 (set (match_operand:SI 3 "nonimmediate_operand" "")
3010 (mod:SI (match_dup 1) (match_dup 2)))])]
3011 "TARGET_68020 || TARGET_CF_HWDIV"
3015 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3016 (div:SI (match_operand:SI 1 "general_operand" "0")
3017 (match_operand:SI 2 "general_src_operand" "d<Q>U")))
3018 (set (match_operand:SI 3 "nonimmediate_operand" "=&d")
3019 (mod:SI (match_dup 1) (match_dup 2)))]
3022 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3023 return "divs%.l %2,%0";
3024 else if (find_reg_note (insn, REG_UNUSED, operands[0]))
3025 return "rems%.l %2,%3:%0";
3027 return "rems%.l %2,%3:%0\;divs%.l %2,%0";
3031 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3032 (div:SI (match_operand:SI 1 "general_operand" "0")
3033 (match_operand:SI 2 "general_src_operand" "dmSTK")))
3034 (set (match_operand:SI 3 "nonimmediate_operand" "=d")
3035 (mod:SI (match_dup 1) (match_dup 2)))]
3038 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3039 return "divs%.l %2,%0";
3041 return "divsl%.l %2,%3:%0";
3044 (define_expand "udivmodsi4"
3046 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3047 (udiv:SI (match_operand:SI 1 "general_operand" "0")
3048 (match_operand:SI 2 "general_src_operand" "dmSTK")))
3049 (set (match_operand:SI 3 "nonimmediate_operand" "=d")
3050 (umod:SI (match_dup 1) (match_dup 2)))])]
3051 "TARGET_68020 || TARGET_CF_HWDIV"
3055 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3056 (udiv:SI (match_operand:SI 1 "general_operand" "0")
3057 (match_operand:SI 2 "general_src_operand" "d<Q>U")))
3058 (set (match_operand:SI 3 "nonimmediate_operand" "=&d")
3059 (umod:SI (match_dup 1) (match_dup 2)))]
3062 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3063 return "divu%.l %2,%0";
3064 else if (find_reg_note (insn, REG_UNUSED, operands[0]))
3065 return "remu%.l %2,%3:%0";
3067 return "remu%.l %2,%3:%0\;divu%.l %2,%0";
3071 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3072 (udiv:SI (match_operand:SI 1 "general_operand" "0")
3073 (match_operand:SI 2 "general_src_operand" "dmSTK")))
3074 (set (match_operand:SI 3 "nonimmediate_operand" "=d")
3075 (umod:SI (match_dup 1) (match_dup 2)))]
3076 "TARGET_68020 && !TARGET_COLDFIRE"
3078 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3079 return "divu%.l %2,%0";
3081 return "divul%.l %2,%3:%0";
3084 (define_insn "divmodhi4"
3085 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
3086 (div:HI (match_operand:HI 1 "general_operand" "0")
3087 (match_operand:HI 2 "general_src_operand" "dmSKT")))
3088 (set (match_operand:HI 3 "nonimmediate_operand" "=d")
3089 (mod:HI (match_dup 1) (match_dup 2)))]
3090 "!TARGET_COLDFIRE || TARGET_CF_HWDIV"
3092 output_asm_insn (MOTOROLA ?
3093 "ext%.l %0\;divs%.w %2,%0" :
3094 "extl %0\;divs %2,%0",
3096 if (!find_reg_note(insn, REG_UNUSED, operands[3]))
3099 return "move%.l %0,%3\;swap %3";
3105 (define_insn "udivmodhi4"
3106 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
3107 (udiv:HI (match_operand:HI 1 "general_operand" "0")
3108 (match_operand:HI 2 "general_src_operand" "dmSKT")))
3109 (set (match_operand:HI 3 "nonimmediate_operand" "=d")
3110 (umod:HI (match_dup 1) (match_dup 2)))]
3111 "!TARGET_COLDFIRE || TARGET_CF_HWDIV"
3114 output_asm_insn (MOTOROLA ?
3115 "mvz%.w %0,%0\;divu%.w %2,%0" :
3116 "mvz%.w %0,%0\;divu %2,%0",
3119 output_asm_insn (MOTOROLA ?
3120 "and%.l #0xFFFF,%0\;divu%.w %2,%0" :
3121 "and%.l #0xFFFF,%0\;divu %2,%0",
3124 if (!find_reg_note(insn, REG_UNUSED, operands[3]))
3127 return "move%.l %0,%3\;swap %3";
3133 ;; logical-and instructions
3135 ;; "anddi3" is mainly here to help combine().
3136 (define_insn "anddi3"
3137 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,d")
3138 (and:DI (match_operand:DI 1 "general_operand" "%0,0")
3139 (match_operand:DI 2 "general_operand" "dn,don")))]
3143 /* We can get CONST_DOUBLE, but also const1_rtx etc. */
3144 if (CONSTANT_P (operands[2]))
3148 split_double (operands[2], &hi, &lo);
3150 switch (INTVAL (hi))
3153 output_asm_insn ("clr%.l %0", operands);
3161 xoperands[0] = operands[0];
3163 output_asm_insn (output_andsi3 (xoperands), xoperands);
3166 if (GET_CODE (operands[0]) == REG)
3167 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3169 operands[0] = adjust_address (operands[0], SImode, 4);
3170 switch (INTVAL (lo))
3173 output_asm_insn ("clr%.l %0", operands);
3181 xoperands[0] = operands[0];
3183 output_asm_insn (output_andsi3 (xoperands), xoperands);
3188 if (GET_CODE (operands[0]) != REG)
3190 operands[1] = adjust_address (operands[0], SImode, 4);
3191 return "and%.l %2,%0\;and%.l %R2,%1";
3193 if (GET_CODE (operands[2]) != REG)
3195 operands[1] = adjust_address (operands[2], SImode, 4);
3196 return "and%.l %2,%0\;and%.l %1,%R0";
3198 return "and%.l %2,%0\;and%.l %R2,%R0";
3201 ;; Prevent AND from being made with sp. This doesn't exist in the machine
3202 ;; and reload will cause inefficient code. Since sp is a FIXED_REG, we
3203 ;; can't allocate pseudos into it.
3205 (define_expand "andsi3"
3206 [(set (match_operand:SI 0 "not_sp_operand" "")
3207 (and:SI (match_operand:SI 1 "general_operand" "")
3208 (match_operand:SI 2 "general_src_operand" "")))]
3212 ;; produced by split operations after reload finished
3213 (define_insn "*andsi3_split"
3214 [(set (match_operand:SI 0 "register_operand" "=d")
3215 (and:SI (match_operand:SI 1 "register_operand" "0")
3216 (match_operand:SI 2 "const_int_operand" "i")))]
3217 "reload_completed && !TARGET_COLDFIRE"
3219 return output_andsi3 (operands);
3222 (define_insn "andsi3_internal"
3223 [(set (match_operand:SI 0 "not_sp_operand" "=m,d")
3224 (and:SI (match_operand:SI 1 "general_operand" "%0,0")
3225 (match_operand:SI 2 "general_src_operand" "dKT,dmSM")))]
3228 return output_andsi3 (operands);
3231 (define_insn "andsi3_5200"
3232 [(set (match_operand:SI 0 "not_sp_operand" "=m,d")
3233 (and:SI (match_operand:SI 1 "general_operand" "%0,0")
3234 (match_operand:SI 2 "general_src_operand" "d,dmsK")))]
3238 && DATA_REG_P (operands[0])
3239 && GET_CODE (operands[2]) == CONST_INT)
3241 if (INTVAL (operands[2]) == 0x000000ff)
3242 return "mvz%.b %0,%0";
3243 else if (INTVAL (operands[2]) == 0x0000ffff)
3244 return "mvz%.w %0,%0";
3246 return output_andsi3 (operands);
3249 (define_insn "andhi3"
3250 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,d")
3251 (and:HI (match_operand:HI 1 "general_operand" "%0,0")
3252 (match_operand:HI 2 "general_src_operand" "dn,dmSn")))]
3257 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3258 (and:HI (match_dup 0)
3259 (match_operand:HI 1 "general_src_operand" "dn,dmSn")))]
3264 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3265 (and:HI (match_operand:HI 1 "general_src_operand" "dn,dmSn")
3270 (define_insn "andqi3"
3271 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
3272 (and:QI (match_operand:QI 1 "general_operand" "%0,0")
3273 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
3278 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3279 (and:QI (match_dup 0)
3280 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
3285 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3286 (and:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn")
3291 ;; inclusive-or instructions
3293 (define_insn "iordi_zext"
3294 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,d")
3295 (ior:DI (zero_extend:DI (match_operand 1 "general_operand" "dn,dmn"))
3296 (match_operand:DI 2 "general_operand" "0,0")))]
3302 if (GET_CODE (operands[0]) == REG)
3303 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3305 operands[0] = adjust_address (operands[0], SImode, 4);
3306 if (GET_MODE (operands[1]) == SImode)
3307 return "or%.l %1,%0";
3308 byte_mode = (GET_MODE (operands[1]) == QImode);
3309 if (GET_CODE (operands[0]) == MEM)
3310 operands[0] = adjust_address (operands[0], byte_mode ? QImode : HImode,
3313 return "or%.b %1,%0";
3315 return "or%.w %1,%0";
3318 ;; "iordi3" is mainly here to help combine().
3319 (define_insn "iordi3"
3320 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,d")
3321 (ior:DI (match_operand:DI 1 "general_operand" "%0,0")
3322 (match_operand:DI 2 "general_operand" "dn,don")))]
3326 /* We can get CONST_DOUBLE, but also const1_rtx etc. */
3327 if (CONSTANT_P (operands[2]))
3331 split_double (operands[2], &hi, &lo);
3333 switch (INTVAL (hi))
3338 /* FIXME : a scratch register would be welcome here if operand[0]
3339 is not a register */
3340 output_asm_insn ("move%.l #-1,%0", operands);
3346 xoperands[0] = operands[0];
3348 output_asm_insn (output_iorsi3 (xoperands), xoperands);
3351 if (GET_CODE (operands[0]) == REG)
3352 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3354 operands[0] = adjust_address (operands[0], SImode, 4);
3355 switch (INTVAL (lo))
3360 /* FIXME : a scratch register would be welcome here if operand[0]
3361 is not a register */
3362 output_asm_insn ("move%.l #-1,%0", operands);
3368 xoperands[0] = operands[0];
3370 output_asm_insn (output_iorsi3 (xoperands), xoperands);
3375 if (GET_CODE (operands[0]) != REG)
3377 operands[1] = adjust_address (operands[0], SImode, 4);
3378 return "or%.l %2,%0\;or%.l %R2,%1";
3380 if (GET_CODE (operands[2]) != REG)
3382 operands[1] = adjust_address (operands[2], SImode, 4);
3383 return "or%.l %2,%0\;or%.l %1,%R0";
3385 return "or%.l %2,%0\;or%.l %R2,%R0";
3388 (define_expand "iorsi3"
3389 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3390 (ior:SI (match_operand:SI 1 "general_operand" "")
3391 (match_operand:SI 2 "general_src_operand" "")))]
3395 (define_insn "iorsi3_internal"
3396 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,d")
3397 (ior:SI (match_operand:SI 1 "general_operand" "%0,0")
3398 (match_operand:SI 2 "general_src_operand" "dKT,dmSMT")))]
3401 return output_iorsi3 (operands);
3404 (define_insn "iorsi3_5200"
3405 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,d")
3406 (ior:SI (match_operand:SI 1 "general_operand" "%0,0")
3407 (match_operand:SI 2 "general_src_operand" "d,dmsK")))]
3410 return output_iorsi3 (operands);
3413 (define_insn "iorhi3"
3414 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,d")
3415 (ior:HI (match_operand:HI 1 "general_operand" "%0,0")
3416 (match_operand:HI 2 "general_src_operand" "dn,dmSn")))]
3421 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3422 (ior:HI (match_dup 0)
3423 (match_operand:HI 1 "general_src_operand" "dn,dmSn")))]
3428 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3429 (ior:HI (match_operand:HI 1 "general_src_operand" "dn,dmSn")
3434 (define_insn "iorqi3"
3435 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
3436 (ior:QI (match_operand:QI 1 "general_operand" "%0,0")
3437 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
3442 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3443 (ior:QI (match_dup 0)
3444 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
3449 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3450 (ior:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn")
3455 ;; On all 68k models, this makes faster code in a special case.
3456 ;; See also ashlsi_16, ashrsi_16 and lshrsi_16.
3458 (define_insn "iorsi_zexthi_ashl16"
3459 [(set (match_operand:SI 0 "nonimmediate_operand" "=&d")
3460 (ior:SI (zero_extend:SI (match_operand:HI 1 "general_operand" "rmn"))
3461 (ashift:SI (match_operand:SI 2 "general_operand" "or")
3466 if (GET_CODE (operands[2]) != REG)
3467 operands[2] = adjust_address (operands[2], HImode, 2);
3468 if (GET_CODE (operands[2]) != REG
3469 || REGNO (operands[2]) != REGNO (operands[0]))
3470 output_asm_insn ("move%.w %2,%0", operands);
3471 return "swap %0\;mov%.w %1,%0";
3474 (define_insn "iorsi_zext"
3475 [(set (match_operand:SI 0 "nonimmediate_operand" "=o,d")
3476 (ior:SI (zero_extend:SI (match_operand 1 "general_operand" "dn,dmn"))
3477 (match_operand:SI 2 "general_operand" "0,0")))]
3483 byte_mode = (GET_MODE (operands[1]) == QImode);
3484 if (GET_CODE (operands[0]) == MEM)
3485 operands[0] = adjust_address (operands[0], byte_mode ? QImode : HImode,
3488 return "or%.b %1,%0";
3490 return "or%.w %1,%0";
3495 ;; "xordi3" is mainly here to help combine().
3496 (define_insn "xordi3"
3497 [(set (match_operand:DI 0 "nonimmediate_operand" "=od")
3498 (xor:DI (match_operand:DI 1 "general_operand" "%0")
3499 (match_operand:DI 2 "general_operand" "dn")))]
3503 /* We can get CONST_DOUBLE, but also const1_rtx etc. */
3505 if (CONSTANT_P (operands[2]))
3509 split_double (operands[2], &hi, &lo);
3511 switch (INTVAL (hi))
3516 output_asm_insn ("not%.l %0", operands);
3519 /* FIXME : a scratch register would be welcome here if
3520 -128 <= INTVAL (hi) < -1 */
3524 xoperands[0] = operands[0];
3526 output_asm_insn (output_xorsi3 (xoperands), xoperands);
3529 if (GET_CODE (operands[0]) == REG)
3530 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3532 operands[0] = adjust_address (operands[0], SImode, 4);
3533 switch (INTVAL (lo))
3538 output_asm_insn ("not%.l %0", operands);
3541 /* FIXME : a scratch register would be welcome here if
3542 -128 <= INTVAL (lo) < -1 */
3544 /* FIXME : this should be merged with xorsi3 */
3548 xoperands[0] = operands[0];
3550 output_asm_insn (output_xorsi3 (xoperands), xoperands);
3555 if (GET_CODE (operands[0]) != REG)
3557 operands[1] = adjust_address (operands[0], SImode, 4);
3558 return "eor%.l %2,%0\;eor%.l %R2,%1";
3560 if (GET_CODE (operands[2]) != REG)
3562 operands[1] = adjust_address (operands[2], SImode, 4);
3563 return "eor%.l %2,%0\;eor%.l %1,%R0";
3565 return "eor%.l %2,%0\;eor%.l %R2,%R0";
3568 (define_expand "xorsi3"
3569 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3570 (xor:SI (match_operand:SI 1 "general_operand" "")
3571 (match_operand:SI 2 "general_operand" "")))]
3575 (define_insn "xorsi3_internal"
3576 [(set (match_operand:SI 0 "nonimmediate_operand" "=do,m")
3577 (xor:SI (match_operand:SI 1 "general_operand" "%0,0")
3578 (match_operand:SI 2 "general_operand" "di,dKT")))]
3582 return output_xorsi3 (operands);
3585 (define_insn "xorsi3_5200"
3586 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm,d")
3587 (xor:SI (match_operand:SI 1 "general_operand" "%0,0")
3588 (match_operand:SI 2 "general_operand" "d,Ks")))]
3591 return output_xorsi3 (operands);
3594 (define_insn "xorhi3"
3595 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
3596 (xor:HI (match_operand:HI 1 "general_operand" "%0")
3597 (match_operand:HI 2 "general_operand" "dn")))]
3602 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
3603 (xor:HI (match_dup 0)
3604 (match_operand:HI 1 "general_operand" "dn")))]
3609 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
3610 (xor:HI (match_operand:HI 1 "general_operand" "dn")
3615 (define_insn "xorqi3"
3616 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
3617 (xor:QI (match_operand:QI 1 "general_operand" "%0")
3618 (match_operand:QI 2 "general_operand" "dn")))]
3623 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
3624 (xor:QI (match_dup 0)
3625 (match_operand:QI 1 "general_operand" "dn")))]
3630 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
3631 (xor:QI (match_operand:QI 1 "general_operand" "dn")
3636 ;; negation instructions
3638 (define_expand "negdi2"
3639 [(set (match_operand:DI 0 "nonimmediate_operand" "")
3640 (neg:DI (match_operand:DI 1 "general_operand" "")))]
3643 if (TARGET_COLDFIRE)
3644 emit_insn (gen_negdi2_5200 (operands[0], operands[1]));
3646 emit_insn (gen_negdi2_internal (operands[0], operands[1]));
3650 (define_insn "negdi2_internal"
3651 [(set (match_operand:DI 0 "nonimmediate_operand" "=<,do,!*a")
3652 (neg:DI (match_operand:DI 1 "general_operand" "0,0,0")))]
3655 if (which_alternative == 0)
3656 return "neg%.l %0\;negx%.l %0";
3657 if (GET_CODE (operands[0]) == REG)
3658 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3660 operands[1] = adjust_address (operands[0], SImode, 4);
3661 if (ADDRESS_REG_P (operands[0]))
3662 return "exg %/d0,%1\;neg%.l %/d0\;exg %/d0,%1\;exg %/d0,%0\;negx%.l %/d0\;exg %/d0,%0";
3664 return "neg%.l %1\;negx%.l %0";
3667 (define_insn "negdi2_5200"
3668 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
3669 (neg:DI (match_operand:DI 1 "general_operand" "0")))]
3672 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3673 return "neg%.l %1\;negx%.l %0";
3676 (define_expand "negsi2"
3677 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3678 (neg:SI (match_operand:SI 1 "general_operand" "")))]
3681 if (TARGET_COLDFIRE)
3682 emit_insn (gen_negsi2_5200 (operands[0], operands[1]));
3684 emit_insn (gen_negsi2_internal (operands[0], operands[1]));
3688 (define_insn "negsi2_internal"
3689 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
3690 (neg:SI (match_operand:SI 1 "general_operand" "0")))]
3694 (define_insn "negsi2_5200"
3695 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3696 (neg:SI (match_operand:SI 1 "general_operand" "0")))]
3700 (define_insn "neghi2"
3701 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
3702 (neg:HI (match_operand:HI 1 "general_operand" "0")))]
3707 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
3708 (neg:HI (match_dup 0)))]
3712 (define_insn "negqi2"
3713 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
3714 (neg:QI (match_operand:QI 1 "general_operand" "0")))]
3719 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
3720 (neg:QI (match_dup 0)))]
3724 ;; If using software floating point, just flip the sign bit.
3726 (define_expand "negsf2"
3727 [(set (match_operand:SF 0 "nonimmediate_operand" "")
3728 (neg:SF (match_operand:SF 1 "general_operand" "")))]
3731 if (!TARGET_HARD_FLOAT)
3736 target = operand_subword_force (operands[0], 0, SFmode);
3737 result = expand_binop (SImode, xor_optab,
3738 operand_subword_force (operands[1], 0, SFmode),
3739 GEN_INT (-2147483647 - 1), target, 0, OPTAB_WIDEN);
3740 gcc_assert (result);
3742 if (result != target)
3743 emit_move_insn (result, target);
3745 /* Make a place for REG_EQUAL. */
3746 emit_move_insn (operands[0], operands[0]);
3751 (define_expand "negdf2"
3752 [(set (match_operand:DF 0 "nonimmediate_operand" "")
3753 (neg:DF (match_operand:DF 1 "general_operand" "")))]
3756 if (!TARGET_HARD_FLOAT)
3763 target = operand_subword (operands[0], 0, 1, DFmode);
3764 result = expand_binop (SImode, xor_optab,
3765 operand_subword_force (operands[1], 0, DFmode),
3766 GEN_INT (-2147483647 - 1), target, 0, OPTAB_WIDEN);
3767 gcc_assert (result);
3769 if (result != target)
3770 emit_move_insn (result, target);
3772 emit_move_insn (operand_subword (operands[0], 1, 1, DFmode),
3773 operand_subword_force (operands[1], 1, DFmode));
3775 insns = get_insns ();
3778 emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
3783 (define_expand "negxf2"
3784 [(set (match_operand:XF 0 "nonimmediate_operand" "")
3785 (neg:XF (match_operand:XF 1 "nonimmediate_operand" "")))]
3795 target = operand_subword (operands[0], 0, 1, XFmode);
3796 result = expand_binop (SImode, xor_optab,
3797 operand_subword_force (operands[1], 0, XFmode),
3798 GEN_INT (-2147483647 - 1), target, 0, OPTAB_WIDEN);
3799 gcc_assert (result);
3801 if (result != target)
3802 emit_move_insn (result, target);
3804 emit_move_insn (operand_subword (operands[0], 1, 1, XFmode),
3805 operand_subword_force (operands[1], 1, XFmode));
3806 emit_move_insn (operand_subword (operands[0], 2, 1, XFmode),
3807 operand_subword_force (operands[1], 2, XFmode));
3809 insns = get_insns ();
3812 emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
3817 (define_insn "neg<mode>2_68881"
3818 [(set (match_operand:FP 0 "nonimmediate_operand" "=f,d")
3819 (neg:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m<FP:const>,0")))]
3822 if (DATA_REG_P (operands[0]))
3824 operands[1] = GEN_INT (31);
3825 return "bchg %1,%0";
3827 if (FP_REG_P (operands[1]))
3828 return "f<FP:round>neg%.x %1,%0";
3829 return "f<FP:round>neg%.<FP:prec> %f1,%0";
3832 (define_insn "neg<mode>2_cf"
3833 [(set (match_operand:FP 0 "nonimmediate_operand" "=f,d")
3834 (neg:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U,0")))]
3835 "TARGET_COLDFIRE_FPU"
3837 if (DATA_REG_P (operands[0]))
3839 operands[1] = GEN_INT (31);
3840 return "bchg %1,%0";
3842 if (FP_REG_P (operands[1]))
3843 return "f<FP:prec>neg%.d %1,%0";
3844 return "f<FP:prec>neg%.<FP:prec> %1,%0";
3847 ;; Sqrt instruction for the 68881
3849 (define_expand "sqrt<mode>2"
3850 [(set (match_operand:FP 0 "nonimmediate_operand" "")
3851 (sqrt:FP (match_operand:FP 1 "general_operand" "")))]
3855 (define_insn "sqrt<mode>2_68881"
3856 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3857 (sqrt:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m")))]
3860 if (FP_REG_P (operands[1]))
3861 return "f<FP:round>sqrt%.x %1,%0";
3862 return "f<FP:round>sqrt%.<FP:prec> %1,%0";
3865 (define_insn "sqrt<mode>2_cf"
3866 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3867 (sqrt:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U")))]
3868 "TARGET_COLDFIRE_FPU"
3870 if (FP_REG_P (operands[1]))
3871 return "f<FP:prec>sqrt%.d %1,%0";
3872 return "f<FP:prec>sqrt%.<FP:prec> %1,%0";
3874 ;; Absolute value instructions
3875 ;; If using software floating point, just zero the sign bit.
3877 (define_expand "abssf2"
3878 [(set (match_operand:SF 0 "nonimmediate_operand" "")
3879 (abs:SF (match_operand:SF 1 "general_operand" "")))]
3882 if (!TARGET_HARD_FLOAT)
3887 target = operand_subword_force (operands[0], 0, SFmode);
3888 result = expand_binop (SImode, and_optab,
3889 operand_subword_force (operands[1], 0, SFmode),
3890 GEN_INT (0x7fffffff), target, 0, OPTAB_WIDEN);
3891 gcc_assert (result);
3893 if (result != target)
3894 emit_move_insn (result, target);
3896 /* Make a place for REG_EQUAL. */
3897 emit_move_insn (operands[0], operands[0]);
3902 (define_expand "absdf2"
3903 [(set (match_operand:DF 0 "nonimmediate_operand" "")
3904 (abs:DF (match_operand:DF 1 "general_operand" "")))]
3907 if (!TARGET_HARD_FLOAT)
3914 target = operand_subword (operands[0], 0, 1, DFmode);
3915 result = expand_binop (SImode, and_optab,
3916 operand_subword_force (operands[1], 0, DFmode),
3917 GEN_INT (0x7fffffff), target, 0, OPTAB_WIDEN);
3918 gcc_assert (result);
3920 if (result != target)
3921 emit_move_insn (result, target);
3923 emit_move_insn (operand_subword (operands[0], 1, 1, DFmode),
3924 operand_subword_force (operands[1], 1, DFmode));
3926 insns = get_insns ();
3929 emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
3934 (define_expand "absxf2"
3935 [(set (match_operand:XF 0 "nonimmediate_operand" "")
3936 (abs:XF (match_operand:XF 1 "nonimmediate_operand" "")))]
3946 target = operand_subword (operands[0], 0, 1, XFmode);
3947 result = expand_binop (SImode, and_optab,
3948 operand_subword_force (operands[1], 0, XFmode),
3949 GEN_INT (0x7fffffff), target, 0, OPTAB_WIDEN);
3950 gcc_assert (result);
3952 if (result != target)
3953 emit_move_insn (result, target);
3955 emit_move_insn (operand_subword (operands[0], 1, 1, XFmode),
3956 operand_subword_force (operands[1], 1, XFmode));
3957 emit_move_insn (operand_subword (operands[0], 2, 1, XFmode),
3958 operand_subword_force (operands[1], 2, XFmode));
3960 insns = get_insns ();
3963 emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
3968 (define_insn "abs<mode>2_68881"
3969 [(set (match_operand:FP 0 "nonimmediate_operand" "=f,d")
3970 (abs:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m<FP:const>,0")))]
3973 if (DATA_REG_P (operands[0]))
3975 operands[1] = GEN_INT (31);
3976 return "bclr %1,%0";
3978 if (FP_REG_P (operands[1]))
3979 return "f<FP:round>abs%.x %1,%0";
3980 return "f<FP:round>abs%.<FP:prec> %f1,%0";
3983 (define_insn "abs<mode>2_cf"
3984 [(set (match_operand:FP 0 "nonimmediate_operand" "=f,d")
3985 (abs:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U,0")))]
3986 "TARGET_COLDFIRE_FPU"
3988 if (DATA_REG_P (operands[0]))
3990 operands[1] = GEN_INT (31);
3991 return "bclr %1,%0";
3993 if (FP_REG_P (operands[1]))
3994 return "f<FP:prec>abs%.d %1,%0";
3995 return "f<FP:prec>abs%.<FP:prec> %1,%0";
3998 ;; bit indexing instructions
4000 ;; ColdFire ff1 instruction implements clz.
4001 (define_insn "clzsi2"
4002 [(set (match_operand:SI 0 "register_operand" "=d")
4003 (clz:SI (match_operand:SI 1 "register_operand" "0")))]
4004 "TARGET_ISAAPLUS || TARGET_ISAC"
4007 ;; one complement instructions
4009 ;; "one_cmpldi2" is mainly here to help combine().
4010 (define_insn "one_cmpldi2"
4011 [(set (match_operand:DI 0 "nonimmediate_operand" "=dm")
4012 (not:DI (match_operand:DI 1 "general_operand" "0")))]
4016 if (GET_CODE (operands[0]) == REG)
4017 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4018 else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC
4019 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
4020 operands[1] = operands[0];
4022 operands[1] = adjust_address (operands[0], SImode, 4);
4023 return "not%.l %1\;not%.l %0";
4026 (define_expand "one_cmplsi2"
4027 [(set (match_operand:SI 0 "nonimmediate_operand" "")
4028 (not:SI (match_operand:SI 1 "general_operand" "")))]
4031 if (TARGET_COLDFIRE)
4032 emit_insn (gen_one_cmplsi2_5200 (operands[0], operands[1]));
4034 emit_insn (gen_one_cmplsi2_internal (operands[0], operands[1]));
4038 (define_insn "one_cmplsi2_internal"
4039 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
4040 (not:SI (match_operand:SI 1 "general_operand" "0")))]
4044 (define_insn "one_cmplsi2_5200"
4045 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
4046 (not:SI (match_operand:SI 1 "general_operand" "0")))]
4050 (define_insn "one_cmplhi2"
4051 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
4052 (not:HI (match_operand:HI 1 "general_operand" "0")))]
4057 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
4058 (not:HI (match_dup 0)))]
4062 (define_insn "one_cmplqi2"
4063 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
4064 (not:QI (match_operand:QI 1 "general_operand" "0")))]
4069 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
4070 (not:QI (match_dup 0)))]
4074 ;; arithmetic shift instructions
4075 ;; We don't need the shift memory by 1 bit instruction
4077 (define_insn "ashldi_extsi"
4078 [(set (match_operand:DI 0 "nonimmediate_operand" "=ro")
4080 (match_operator:DI 2 "extend_operator"
4081 [(match_operand:SI 1 "general_operand" "rm")])
4086 if (GET_CODE (operands[0]) == REG)
4087 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4089 operands[2] = adjust_address (operands[0], SImode, 4);
4090 if (ADDRESS_REG_P (operands[0]))
4091 return "move%.l %1,%0\;sub%.l %2,%2";
4093 return "move%.l %1,%0\;clr%.l %2";
4096 (define_insn "ashldi_sexthi"
4097 [(set (match_operand:DI 0 "nonimmediate_operand" "=m,a*d")
4098 (ashift:DI (sign_extend:DI (match_operand:HI 1 "general_operand" "rm,rm"))
4100 (clobber (match_scratch:SI 2 "=a,X"))]
4104 if (GET_CODE (operands[0]) == MEM)
4106 if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
4107 return "clr%.l %0\;move%.w %1,%2\;move%.l %2,%0";
4108 else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
4109 return "move%.w %1,%2\;move%.l %2,%0\;clr%.l %0";
4112 operands[3] = adjust_address (operands[0], SImode, 4);
4113 return "move%.w %1,%2\;move%.l %2,%0\;clr%.l %3";
4116 else if (DATA_REG_P (operands[0]))
4117 return "move%.w %1,%0\;ext%.l %0\;clr%.l %R0";
4119 return "move%.w %1,%0\;sub%.l %R0,%R0";
4122 (define_insn "*ashldi3_const1"
4123 [(set (match_operand:DI 0 "register_operand" "=d")
4124 (ashift:DI (match_operand:DI 1 "register_operand" "0")
4127 "add%.l %R0,%R0\;addx%.l %0,%0")
4130 [(set (match_operand:DI 0 "register_operand" "")
4131 (ashift:DI (match_operand:DI 1 "register_operand" "")
4133 "reload_completed && !TARGET_COLDFIRE"
4135 (ashift:DI (match_dup 1) (const_int 1)))
4137 (ashift:DI (match_dup 0) (const_int 1)))]
4141 [(set (match_operand:DI 0 "register_operand" "")
4142 (ashift:DI (match_operand:DI 1 "register_operand" "")
4144 "reload_completed && !TARGET_COLDFIRE"
4146 (ashift:DI (match_dup 1) (const_int 2)))
4148 (ashift:DI (match_dup 0) (const_int 1)))]
4152 [(set (match_operand:DI 0 "register_operand" "")
4153 (ashift:DI (match_operand:DI 1 "register_operand" "")
4155 "reload_completed && !TARGET_COLDFIRE"
4157 (rotate:SI (match_dup 2) (const_int 8)))
4159 (rotate:SI (match_dup 3) (const_int 8)))
4160 (set (strict_low_part (subreg:QI (match_dup 0) 3))
4161 (subreg:QI (match_dup 0) 7))
4162 (set (strict_low_part (subreg:QI (match_dup 0) 7))
4165 operands[2] = gen_highpart (SImode, operands[0]);
4166 operands[3] = gen_lowpart (SImode, operands[0]);
4170 [(set (match_operand:DI 0 "register_operand" "")
4171 (ashift:DI (match_operand:DI 1 "register_operand" "")
4173 "reload_completed && !TARGET_COLDFIRE"
4175 (rotate:SI (match_dup 2) (const_int 16)))
4177 (rotate:SI (match_dup 3) (const_int 16)))
4178 (set (strict_low_part (subreg:HI (match_dup 0) 2))
4179 (subreg:HI (match_dup 0) 6))
4180 (set (strict_low_part (subreg:HI (match_dup 0) 6))
4183 operands[2] = gen_highpart (SImode, operands[0]);
4184 operands[3] = gen_lowpart (SImode, operands[0]);
4188 [(set (match_operand:DI 0 "pre_dec_operand" "")
4189 (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "")
4192 [(set (match_dup 0) (const_int 0))
4193 (set (match_dup 0) (match_dup 1))]
4195 operands[0] = adjust_address(operands[0], SImode, 0);
4196 operands[1] = gen_lowpart(SImode, operands[1]);
4200 [(set (match_operand:DI 0 "post_inc_operand" "")
4201 (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "")
4204 [(set (match_dup 0) (match_dup 1))
4205 (set (match_dup 0) (const_int 0))]
4207 operands[0] = adjust_address(operands[0], SImode, 0);
4208 operands[1] = gen_lowpart(SImode, operands[1]);
4211 (define_insn_and_split "*ashldi3_const32"
4212 [(set (match_operand:DI 0 "nonimmediate_operand" "=ro<>")
4213 (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "ro")
4217 "&& reload_completed"
4218 [(set (match_dup 4) (match_dup 3))
4219 (set (match_dup 2) (const_int 0))]
4220 "split_di(operands, 2, operands + 2, operands + 4);")
4223 [(set (match_operand:DI 0 "register_operand" "")
4224 (ashift:DI (match_operand:DI 1 "register_operand" "")
4225 (match_operand 2 "const_int_operand" "")))]
4226 "reload_completed && !TARGET_COLDFIRE
4227 && INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 40"
4228 [(set (match_dup 4) (ashift:SI (match_dup 4) (match_dup 2)))
4229 (set (match_dup 3) (match_dup 4))
4230 (set (match_dup 4) (const_int 0))]
4232 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
4233 operands[3] = gen_highpart (SImode, operands[0]);
4234 operands[4] = gen_lowpart (SImode, operands[0]);
4238 [(set (match_operand:DI 0 "register_operand" "")
4239 (ashift:DI (match_operand:DI 1 "register_operand" "")
4241 "reload_completed && !TARGET_COLDFIRE"
4242 [(set (match_dup 2) (match_dup 3))
4244 (rotate:SI (match_dup 2) (const_int 16)))
4245 (set (match_dup 3) (const_int 0))
4246 (set (strict_low_part (subreg:HI (match_dup 0) 2))
4249 operands[2] = gen_highpart (SImode, operands[0]);
4250 operands[3] = gen_lowpart (SImode, operands[0]);
4254 [(set (match_operand:DI 0 "register_operand" "")
4255 (ashift:DI (match_operand:DI 1 "register_operand" "")
4256 (match_operand 2 "const_int_operand" "")))]
4257 "reload_completed && !TARGET_COLDFIRE
4258 && INTVAL (operands[2]) > 40 && INTVAL (operands[2]) <= 63"
4259 [(set (match_dup 3) (match_dup 2))
4260 (set (match_dup 4) (ashift:SI (match_dup 4) (match_dup 3)))
4261 (set (match_dup 3) (match_dup 4))
4262 (set (match_dup 4) (const_int 0))]
4264 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
4265 operands[3] = gen_highpart (SImode, operands[0]);
4266 operands[4] = gen_lowpart (SImode, operands[0]);
4269 (define_insn "*ashldi3"
4270 [(set (match_operand:DI 0 "register_operand" "=d")
4271 (ashift:DI (match_operand:DI 1 "register_operand" "0")
4272 (match_operand 2 "const_int_operand" "n")))]
4274 && ((INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3)
4275 || INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16
4276 || (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63))"
4279 (define_expand "ashldi3"
4280 [(set (match_operand:DI 0 "register_operand" "")
4281 (ashift:DI (match_operand:DI 1 "register_operand" "")
4282 (match_operand 2 "const_int_operand" "")))]
4285 /* ??? This is a named pattern like this is not allowed to FAIL based
4287 if (GET_CODE (operands[2]) != CONST_INT
4288 || ((INTVAL (operands[2]) < 1 || INTVAL (operands[2]) > 3)
4289 && INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16
4290 && (INTVAL (operands[2]) < 32 || INTVAL (operands[2]) > 63)))
4294 ;; On most 68k models, this makes faster code in a special case.
4296 (define_insn "ashlsi_16"
4297 [(set (match_operand:SI 0 "register_operand" "=d")
4298 (ashift:SI (match_operand:SI 1 "register_operand" "0")
4303 return "swap %0\;clr%.w %0";
4306 ;; ashift patterns : use lsl instead of asl, because lsl always clears the
4307 ;; overflow bit, so we must not set CC_NO_OVERFLOW.
4309 ;; On the 68000, this makes faster code in a special case.
4311 (define_insn "ashlsi_17_24"
4312 [(set (match_operand:SI 0 "register_operand" "=d")
4313 (ashift:SI (match_operand:SI 1 "register_operand" "0")
4314 (match_operand:SI 2 "const_int_operand" "n")))]
4316 && INTVAL (operands[2]) > 16
4317 && INTVAL (operands[2]) <= 24"
4321 operands[2] = GEN_INT (INTVAL (operands[2]) - 16);
4322 return "lsl%.w %2,%0\;swap %0\;clr%.w %0";
4325 (define_insn "ashlsi3"
4326 [(set (match_operand:SI 0 "register_operand" "=d")
4327 (ashift:SI (match_operand:SI 1 "register_operand" "0")
4328 (match_operand:SI 2 "general_operand" "dI")))]
4331 if (operands[2] == const1_rtx)
4333 cc_status.flags = CC_NO_OVERFLOW;
4334 return "add%.l %0,%0";
4336 return "lsl%.l %2,%0";
4339 (define_insn "ashlhi3"
4340 [(set (match_operand:HI 0 "register_operand" "=d")
4341 (ashift:HI (match_operand:HI 1 "register_operand" "0")
4342 (match_operand:HI 2 "general_operand" "dI")))]
4347 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
4348 (ashift:HI (match_dup 0)
4349 (match_operand:HI 1 "general_operand" "dI")))]
4353 (define_insn "ashlqi3"
4354 [(set (match_operand:QI 0 "register_operand" "=d")
4355 (ashift:QI (match_operand:QI 1 "register_operand" "0")
4356 (match_operand:QI 2 "general_operand" "dI")))]
4361 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
4362 (ashift:QI (match_dup 0)
4363 (match_operand:QI 1 "general_operand" "dI")))]
4367 ;; On most 68k models, this makes faster code in a special case.
4369 (define_insn "ashrsi_16"
4370 [(set (match_operand:SI 0 "register_operand" "=d")
4371 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4374 "swap %0\;ext%.l %0")
4376 ;; On the 68000, this makes faster code in a special case.
4379 [(set (match_operand:SI 0 "register_operand" "=d")
4380 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4381 (match_operand:SI 2 "const_int_operand" "n")))]
4383 && INTVAL (operands[2]) > 16
4384 && INTVAL (operands[2]) <= 24"
4386 operands[2] = GEN_INT (INTVAL (operands[2]) - 16);
4387 return "swap %0\;asr%.w %2,%0\;ext%.l %0";
4390 (define_insn "subreghi1ashrdi_const32"
4391 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
4392 (subreg:HI (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro")
4393 (const_int 32)) 6))]
4396 if (GET_CODE (operands[1]) != REG)
4397 operands[1] = adjust_address (operands[1], HImode, 2);
4398 return "move%.w %1,%0";
4401 (define_insn "subregsi1ashrdi_const32"
4402 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
4403 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro")
4404 (const_int 32)) 4))]
4407 return "move%.l %1,%0";
4410 (define_insn "*ashrdi3_const1"
4411 [(set (match_operand:DI 0 "register_operand" "=d")
4412 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
4416 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4417 return "asr%.l #1,%0\;roxr%.l #1,%1";
4421 [(set (match_operand:DI 0 "register_operand" "")
4422 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4424 "reload_completed && !TARGET_COLDFIRE"
4426 (ashiftrt:DI (match_dup 1) (const_int 1)))
4428 (ashiftrt:DI (match_dup 0) (const_int 1)))]
4432 [(set (match_operand:DI 0 "register_operand" "")
4433 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4435 "reload_completed && !TARGET_COLDFIRE"
4437 (ashiftrt:DI (match_dup 1) (const_int 2)))
4439 (ashiftrt:DI (match_dup 0) (const_int 1)))]
4443 [(set (match_operand:DI 0 "register_operand" "")
4444 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4446 "reload_completed && !TARGET_COLDFIRE"
4447 [(set (strict_low_part (subreg:QI (match_dup 0) 7))
4448 (subreg:QI (match_dup 0) 3))
4450 (ashiftrt:SI (match_dup 2) (const_int 8)))
4452 (rotatert:SI (match_dup 3) (const_int 8)))]
4454 operands[2] = gen_highpart (SImode, operands[0]);
4455 operands[3] = gen_lowpart (SImode, operands[0]);
4459 [(set (match_operand:DI 0 "register_operand" "")
4460 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4462 "reload_completed && !TARGET_COLDFIRE"
4463 [(set (strict_low_part (subreg:HI (match_dup 0) 6))
4464 (subreg:HI (match_dup 0) 2))
4466 (rotate:SI (match_dup 2) (const_int 16)))
4468 (rotate:SI (match_dup 3) (const_int 16)))
4470 (sign_extend:SI (subreg:HI (match_dup 2) 2)))]
4472 operands[2] = gen_highpart (SImode, operands[0]);
4473 operands[3] = gen_lowpart (SImode, operands[0]);
4476 (define_insn "*ashrdi_const32"
4477 [(set (match_operand:DI 0 "register_operand" "=d")
4478 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_src_operand" "ro")
4484 return "move%.l %1,%R0\;smi %0\;extb%.l %0";
4486 return "move%.l %1,%R0\;smi %0\;ext%.w %0\;ext%.l %0";
4489 (define_insn "*ashrdi_const32_mem"
4490 [(set (match_operand:DI 0 "memory_operand" "=o,<")
4491 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_src_operand" "ro,ro")
4493 (clobber (match_scratch:SI 2 "=d,d"))]
4497 operands[3] = adjust_address (operands[0], SImode,
4498 which_alternative == 0 ? 4 : 0);
4499 operands[0] = adjust_address (operands[0], SImode, 0);
4500 if (TARGET_68020 || TARGET_COLDFIRE)
4501 return "move%.l %1,%3\;smi %2\;extb%.l %2\;move%.l %2,%0";
4503 return "move%.l %1,%3\;smi %2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0";
4507 [(set (match_operand:DI 0 "register_operand" "")
4508 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4510 "reload_completed && !TARGET_COLDFIRE"
4512 (ashiftrt:SI (match_dup 3) (const_int 31)))
4515 "split_di(operands, 1, operands + 2, operands + 3);")
4517 ;; The predicate below must be general_operand, because ashrdi3 allows that
4518 (define_insn "ashrdi_const"
4519 [(set (match_operand:DI 0 "register_operand" "=d")
4520 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
4521 (match_operand 2 "const_int_operand" "n")))]
4523 && ((INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3)
4524 || INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16
4525 || INTVAL (operands[2]) == 31
4526 || (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63))"
4528 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4530 if (INTVAL (operands[2]) == 48)
4531 return "swap %0\;ext%.l %0\;move%.l %0,%1\;smi %0\;ext%.w %0";
4532 if (INTVAL (operands[2]) == 31)
4533 return "add%.l %1,%1\;addx%.l %0,%0\;move%.l %0,%1\;subx%.l %0,%0";
4534 if (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63)
4536 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
4537 output_asm_insn (INTVAL (operands[2]) <= 8 ? "asr%.l %2,%0" :
4538 "moveq %2,%1\;asr%.l %1,%0", operands);
4539 output_asm_insn ("mov%.l %0,%1\;smi %0", operands);
4540 return INTVAL (operands[2]) >= 15 ? "ext%.w %d0" :
4541 TARGET_68020 ? "extb%.l %0" : "ext%.w %0\;ext%.l %0";
4546 (define_expand "ashrdi3"
4547 [(set (match_operand:DI 0 "register_operand" "")
4548 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4549 (match_operand 2 "const_int_operand" "")))]
4552 /* ??? This is a named pattern like this is not allowed to FAIL based
4554 if (GET_CODE (operands[2]) != CONST_INT
4555 || ((INTVAL (operands[2]) < 1 || INTVAL (operands[2]) > 3)
4556 && INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16
4557 && (INTVAL (operands[2]) < 31 || INTVAL (operands[2]) > 63)))
4561 ;; On all 68k models, this makes faster code in a special case.
4563 (define_insn "ashrsi_31"
4564 [(set (match_operand:SI 0 "register_operand" "=d")
4565 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4569 return "add%.l %0,%0\;subx%.l %0,%0";
4572 (define_insn "ashrsi3"
4573 [(set (match_operand:SI 0 "register_operand" "=d")
4574 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4575 (match_operand:SI 2 "general_operand" "dI")))]
4579 (define_insn "ashrhi3"
4580 [(set (match_operand:HI 0 "register_operand" "=d")
4581 (ashiftrt:HI (match_operand:HI 1 "register_operand" "0")
4582 (match_operand:HI 2 "general_operand" "dI")))]
4587 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
4588 (ashiftrt:HI (match_dup 0)
4589 (match_operand:HI 1 "general_operand" "dI")))]
4593 (define_insn "ashrqi3"
4594 [(set (match_operand:QI 0 "register_operand" "=d")
4595 (ashiftrt:QI (match_operand:QI 1 "register_operand" "0")
4596 (match_operand:QI 2 "general_operand" "dI")))]
4601 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
4602 (ashiftrt:QI (match_dup 0)
4603 (match_operand:QI 1 "general_operand" "dI")))]
4607 ;; logical shift instructions
4609 ;; commented out because of reload problems in 950612-1.c
4612 ;; (subreg:SI (lshiftrt:DI (match_operand:DI 0 "general_operand" "ro")
4613 ;; (const_int 32)) 4))
4614 ;; (set (match_operand:SI 1 "nonimmediate_operand" "=dm")
4615 ;; (subreg:SI (lshiftrt:DI (match_dup 0)
4616 ;; (const_int 32)) 4))]
4619 ;; return "move%.l %0,%1";
4624 ;; (subreg:SI (lshiftrt:DI (match_operand:DI 0 "general_operand" "ro")
4625 ;; (const_int 32)) 0))
4626 ;; (set (match_operand:DI 1 "nonimmediate_operand" "=do")
4627 ;; (lshiftrt:DI (match_dup 0)
4628 ;; (const_int 32)))]
4631 ;; if (GET_CODE (operands[1]) == REG)
4632 ;; operands[2] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
4634 ;; operands[2] = adjust_address (operands[1], SImode, 4);
4635 ;; return "move%.l %0,%2\;clr%.l %1";
4638 (define_insn "subreg1lshrdi_const32"
4639 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
4640 (subreg:SI (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro")
4641 (const_int 32)) 4))]
4644 return "move%.l %1,%0";
4647 (define_insn "*lshrdi3_const1"
4648 [(set (match_operand:DI 0 "register_operand" "=d")
4649 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
4652 "lsr%.l #1,%0\;roxr%.l #1,%R0")
4655 [(set (match_operand:DI 0 "register_operand" "")
4656 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
4658 "reload_completed && !TARGET_COLDFIRE"
4660 (lshiftrt:DI (match_dup 1) (const_int 1)))
4662 (lshiftrt:DI (match_dup 0) (const_int 1)))]
4666 [(set (match_operand:DI 0 "register_operand" "")
4667 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
4669 "reload_completed && !TARGET_COLDFIRE"
4671 (lshiftrt:DI (match_dup 1) (const_int 2)))
4673 (lshiftrt:DI (match_dup 0) (const_int 1)))]
4677 [(set (match_operand:DI 0 "register_operand" "")
4678 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
4680 "reload_completed && !TARGET_COLDFIRE"
4681 [(set (strict_low_part (subreg:QI (match_dup 0) 7))
4682 (subreg:QI (match_dup 0) 3))
4684 (lshiftrt:SI (match_dup 2) (const_int 8)))
4686 (rotatert:SI (match_dup 3) (const_int 8)))]
4688 operands[2] = gen_highpart (SImode, operands[0]);
4689 operands[3] = gen_lowpart (SImode, operands[0]);
4693 [(set (match_operand:DI 0 "register_operand" "")
4694 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
4696 "reload_completed && !TARGET_COLDFIRE"
4697 [(set (strict_low_part (subreg:HI (match_dup 0) 6))
4698 (subreg:HI (match_dup 0) 2))
4699 (set (strict_low_part (subreg:HI (match_dup 0) 2))
4702 (rotate:SI (match_dup 3) (const_int 16)))
4704 (rotate:SI (match_dup 2) (const_int 16)))]
4706 operands[2] = gen_highpart (SImode, operands[0]);
4707 operands[3] = gen_lowpart (SImode, operands[0]);
4711 [(set (match_operand:DI 0 "pre_dec_operand" "")
4712 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "")
4715 [(set (match_dup 0) (match_dup 1))
4716 (set (match_dup 0) (const_int 0))]
4718 operands[0] = adjust_address(operands[0], SImode, 0);
4719 operands[1] = gen_highpart(SImode, operands[1]);
4723 [(set (match_operand:DI 0 "post_inc_operand" "")
4724 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "")
4727 [(set (match_dup 0) (const_int 0))
4728 (set (match_dup 0) (match_dup 1))]
4730 operands[0] = adjust_address(operands[0], SImode, 0);
4731 operands[1] = gen_highpart(SImode, operands[1]);
4735 [(set (match_operand:DI 0 "nonimmediate_operand" "")
4736 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "")
4739 [(set (match_dup 2) (match_dup 5))
4740 (set (match_dup 4) (const_int 0))]
4741 "split_di(operands, 2, operands + 2, operands + 4);")
4743 (define_insn "*lshrdi_const32"
4744 [(set (match_operand:DI 0 "nonimmediate_operand" "=ro<>")
4745 (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro")
4751 [(set (match_operand:DI 0 "register_operand" "")
4752 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
4753 (match_operand 2 "const_int_operand" "")))]
4754 "reload_completed && !TARGET_COLDFIRE
4755 && INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 40"
4756 [(set (match_dup 3) (lshiftrt:SI (match_dup 3) (match_dup 2)))
4757 (set (match_dup 4) (match_dup 3))
4758 (set (match_dup 3) (const_int 0))]
4760 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
4761 operands[3] = gen_highpart (SImode, operands[0]);
4762 operands[4] = gen_lowpart (SImode, operands[0]);
4766 [(set (match_operand:DI 0 "register_operand" "")
4767 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
4770 [(set (match_dup 3) (match_dup 2))
4771 (set (strict_low_part (subreg:HI (match_dup 0) 6))
4773 (set (match_dup 2) (const_int 0))
4775 (rotate:SI (match_dup 3) (const_int 16)))]
4777 operands[2] = gen_highpart (SImode, operands[0]);
4778 operands[3] = gen_lowpart (SImode, operands[0]);
4782 [(set (match_operand:DI 0 "register_operand" "")
4783 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
4784 (match_operand 2 "const_int_operand" "")))]
4785 "reload_completed && !TARGET_COLDFIRE
4786 && INTVAL (operands[2]) > 40 && INTVAL (operands[2]) <= 62"
4787 [(set (match_dup 4) (match_dup 2))
4788 (set (match_dup 3) (lshiftrt:SI (match_dup 3) (match_dup 4)))
4789 (set (match_dup 4) (match_dup 3))
4790 (set (match_dup 3) (const_int 0))]
4792 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
4793 operands[3] = gen_highpart (SImode, operands[0]);
4794 operands[4] = gen_lowpart (SImode, operands[0]);
4797 (define_insn "*lshrdi_const63"
4798 [(set (match_operand:DI 0 "register_operand" "=d")
4799 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
4802 "add%.l %0,%0\;clr%.l %0\;clr%.l %R1\;addx%.l %R1,%R1")
4804 (define_insn "*lshrdi3_const"
4805 [(set (match_operand:DI 0 "register_operand" "=d")
4806 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
4807 (match_operand 2 "const_int_operand" "n")))]
4809 && ((INTVAL (operands[2]) >= 2 && INTVAL (operands[2]) <= 3)
4810 || INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16
4811 || (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63)))"
4814 (define_expand "lshrdi3"
4815 [(set (match_operand:DI 0 "register_operand" "")
4816 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
4817 (match_operand 2 "const_int_operand" "")))]
4820 /* ??? This is a named pattern like this is not allowed to FAIL based
4822 if (GET_CODE (operands[2]) != CONST_INT
4823 || ((INTVAL (operands[2]) < 1 || INTVAL (operands[2]) > 3)
4824 && INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16
4825 && (INTVAL (operands[2]) < 32 || INTVAL (operands[2]) > 63)))
4829 ;; On all 68k models, this makes faster code in a special case.
4831 (define_insn "lshrsi_31"
4832 [(set (match_operand:SI 0 "register_operand" "=d")
4833 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
4837 return "add%.l %0,%0\;subx%.l %0,%0\;neg%.l %0";
4840 ;; On most 68k models, this makes faster code in a special case.
4842 (define_insn "lshrsi_16"
4843 [(set (match_operand:SI 0 "register_operand" "=d")
4844 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
4849 return "clr%.w %0\;swap %0";
4852 ;; On the 68000, this makes faster code in a special case.
4854 (define_insn "lshrsi_17_24"
4855 [(set (match_operand:SI 0 "register_operand" "=d")
4856 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
4857 (match_operand:SI 2 "const_int_operand" "n")))]
4859 && INTVAL (operands[2]) > 16
4860 && INTVAL (operands[2]) <= 24"
4862 /* I think lsr%.w sets the CC properly. */
4863 operands[2] = GEN_INT (INTVAL (operands[2]) - 16);
4864 return "clr%.w %0\;swap %0\;lsr%.w %2,%0";
4867 (define_insn "lshrsi3"
4868 [(set (match_operand:SI 0 "register_operand" "=d")
4869 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
4870 (match_operand:SI 2 "general_operand" "dI")))]
4874 (define_insn "lshrhi3"
4875 [(set (match_operand:HI 0 "register_operand" "=d")
4876 (lshiftrt:HI (match_operand:HI 1 "register_operand" "0")
4877 (match_operand:HI 2 "general_operand" "dI")))]
4882 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
4883 (lshiftrt:HI (match_dup 0)
4884 (match_operand:HI 1 "general_operand" "dI")))]
4888 (define_insn "lshrqi3"
4889 [(set (match_operand:QI 0 "register_operand" "=d")
4890 (lshiftrt:QI (match_operand:QI 1 "register_operand" "0")
4891 (match_operand:QI 2 "general_operand" "dI")))]
4896 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
4897 (lshiftrt:QI (match_dup 0)
4898 (match_operand:QI 1 "general_operand" "dI")))]
4902 ;; rotate instructions
4904 (define_insn "rotlsi3"
4905 [(set (match_operand:SI 0 "register_operand" "=d")
4906 (rotate:SI (match_operand:SI 1 "register_operand" "0")
4907 (match_operand:SI 2 "general_operand" "dINO")))]
4910 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 16)
4912 else if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 16)
4914 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
4915 return "ror%.l %2,%0";
4918 return "rol%.l %2,%0";
4921 (define_insn "rotlhi3"
4922 [(set (match_operand:HI 0 "register_operand" "=d")
4923 (rotate:HI (match_operand:HI 1 "register_operand" "0")
4924 (match_operand:HI 2 "general_operand" "dIP")))]
4927 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 8)
4929 operands[2] = GEN_INT (16 - INTVAL (operands[2]));
4930 return "ror%.w %2,%0";
4933 return "rol%.w %2,%0";
4937 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
4938 (rotate:HI (match_dup 0)
4939 (match_operand:HI 1 "general_operand" "dIP")))]
4942 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 8)
4944 operands[2] = GEN_INT (16 - INTVAL (operands[2]));
4945 return "ror%.w %2,%0";
4948 return "rol%.w %2,%0";
4951 (define_insn "rotlqi3"
4952 [(set (match_operand:QI 0 "register_operand" "=d")
4953 (rotate:QI (match_operand:QI 1 "register_operand" "0")
4954 (match_operand:QI 2 "general_operand" "dI")))]
4957 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 4)
4959 operands[2] = GEN_INT (8 - INTVAL (operands[2]));
4960 return "ror%.b %2,%0";
4963 return "rol%.b %2,%0";
4967 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
4968 (rotate:QI (match_dup 0)
4969 (match_operand:QI 1 "general_operand" "dI")))]
4972 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 4)
4974 operands[2] = GEN_INT (8 - INTVAL (operands[2]));
4975 return "ror%.b %2,%0";
4978 return "rol%.b %2,%0";
4981 (define_insn "rotrsi3"
4982 [(set (match_operand:SI 0 "register_operand" "=d")
4983 (rotatert:SI (match_operand:SI 1 "register_operand" "0")
4984 (match_operand:SI 2 "general_operand" "dI")))]
4988 (define_insn "rotrhi3"
4989 [(set (match_operand:HI 0 "register_operand" "=d")
4990 (rotatert:HI (match_operand:HI 1 "register_operand" "0")
4991 (match_operand:HI 2 "general_operand" "dI")))]
4996 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
4997 (rotatert:HI (match_dup 0)
4998 (match_operand:HI 1 "general_operand" "dI")))]
5002 (define_insn "rotrqi3"
5003 [(set (match_operand:QI 0 "register_operand" "=d")
5004 (rotatert:QI (match_operand:QI 1 "register_operand" "0")
5005 (match_operand:QI 2 "general_operand" "dI")))]
5010 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
5011 (rotatert:QI (match_dup 0)
5012 (match_operand:QI 1 "general_operand" "dI")))]
5017 ;; Bit set/clear in memory byte.
5019 ;; set bit, bit number is int
5020 (define_insn "bsetmemqi"
5021 [(set (match_operand:QI 0 "memory_operand" "+m")
5022 (ior:QI (subreg:QI (ashift:SI (const_int 1)
5023 (match_operand:SI 1 "general_operand" "d")) 3)
5028 return "bset %1,%0";
5031 ;; set bit, bit number is (sign/zero)_extended from HImode/QImode
5033 [(set (match_operand:QI 0 "memory_operand" "+m")
5034 (ior:QI (subreg:QI (ashift:SI (const_int 1)
5035 (match_operator:SI 2 "extend_operator"
5036 [(match_operand 1 "general_operand" "d")])) 3)
5041 return "bset %1,%0";
5044 ;; clear bit, bit number is int
5045 (define_insn "bclrmemqi"
5046 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+m")
5048 (minus:SI (const_int 7)
5049 (match_operand:SI 1 "general_operand" "d")))
5054 return "bclr %1,%0";
5057 ;; clear bit, bit number is (sign/zero)_extended from HImode/QImode
5059 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+m")
5061 (minus:SI (const_int 7)
5062 (match_operator:SI 2 "extend_operator"
5063 [(match_operand 1 "general_operand" "d")])))
5068 return "bclr %1,%0";
5071 ;; Special cases of bit-field insns which we should
5072 ;; recognize in preference to the general case.
5073 ;; These handle aligned 8-bit and 16-bit fields,
5074 ;; which can usually be done with move instructions.
5077 ; Special case for 32-bit field in memory. This only occurs when 32-bit
5078 ; alignment of structure members is specified.
5080 ; The move is allowed to be odd byte aligned, because that's still faster
5081 ; than an odd byte aligned bit-field instruction.
5084 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5086 (match_operand:SI 1 "const_int_operand" "n"))
5087 (match_operand:SI 2 "general_src_operand" "rmSi"))]
5088 "TARGET_68020 && TARGET_BITFIELD
5089 && (INTVAL (operands[1]) % 8) == 0
5090 && ! mode_dependent_address_p (XEXP (operands[0], 0))"
5093 = adjust_address (operands[0], SImode, INTVAL (operands[1]) / 8);
5095 return "move%.l %2,%0";
5099 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+do")
5100 (match_operand:SI 1 "const_int_operand" "n")
5101 (match_operand:SI 2 "const_int_operand" "n"))
5102 (match_operand:SI 3 "register_operand" "d"))]
5103 "TARGET_68020 && TARGET_BITFIELD
5104 && (INTVAL (operands[1]) == 8 || INTVAL (operands[1]) == 16)
5105 && INTVAL (operands[2]) % INTVAL (operands[1]) == 0
5106 && (GET_CODE (operands[0]) == REG
5107 || ! mode_dependent_address_p (XEXP (operands[0], 0)))"
5109 if (REG_P (operands[0]))
5111 if (INTVAL (operands[1]) + INTVAL (operands[2]) != 32)
5112 return "bfins %3,%0{%b2:%b1}";
5115 operands[0] = adjust_address (operands[0],
5116 INTVAL (operands[1]) == 8 ? QImode : HImode,
5117 INTVAL (operands[2]) / 8);
5119 if (GET_CODE (operands[3]) == MEM)
5120 operands[3] = adjust_address (operands[3],
5121 INTVAL (operands[1]) == 8 ? QImode : HImode,
5122 (32 - INTVAL (operands[1])) / 8);
5124 if (INTVAL (operands[1]) == 8)
5125 return "move%.b %3,%0";
5126 return "move%.w %3,%0";
5131 ; Special case for 32-bit field in memory. This only occurs when 32-bit
5132 ; alignment of structure members is specified.
5134 ; The move is allowed to be odd byte aligned, because that's still faster
5135 ; than an odd byte aligned bit-field instruction.
5138 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
5139 (zero_extract:SI (match_operand:QI 1 "memory_src_operand" "oS")
5141 (match_operand:SI 2 "const_int_operand" "n")))]
5142 "TARGET_68020 && TARGET_BITFIELD
5143 && (INTVAL (operands[2]) % 8) == 0
5144 && ! mode_dependent_address_p (XEXP (operands[1], 0))"
5147 = adjust_address (operands[1], SImode, INTVAL (operands[2]) / 8);
5149 return "move%.l %1,%0";
5153 [(set (match_operand:SI 0 "nonimmediate_operand" "=&d")
5154 (zero_extract:SI (match_operand:SI 1 "register_operand" "do")
5155 (match_operand:SI 2 "const_int_operand" "n")
5156 (match_operand:SI 3 "const_int_operand" "n")))]
5157 "TARGET_68020 && TARGET_BITFIELD
5158 && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
5159 && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
5160 && (GET_CODE (operands[1]) == REG
5161 || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
5163 cc_status.flags |= CC_NOT_NEGATIVE;
5164 if (REG_P (operands[1]))
5166 if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
5167 return "bfextu %1{%b3:%b2},%0";
5171 = adjust_address (operands[1], SImode, INTVAL (operands[3]) / 8);
5173 output_asm_insn ("clr%.l %0", operands);
5174 if (GET_CODE (operands[0]) == MEM)
5175 operands[0] = adjust_address (operands[0],
5176 INTVAL (operands[2]) == 8 ? QImode : HImode,
5177 (32 - INTVAL (operands[1])) / 8);
5179 if (INTVAL (operands[2]) == 8)
5180 return "move%.b %1,%0";
5181 return "move%.w %1,%0";
5185 ; Special case for 32-bit field in memory. This only occurs when 32-bit
5186 ; alignment of structure members is specified.
5188 ; The move is allowed to be odd byte aligned, because that's still faster
5189 ; than an odd byte aligned bit-field instruction.
5192 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
5193 (sign_extract:SI (match_operand:QI 1 "memory_src_operand" "oS")
5195 (match_operand:SI 2 "const_int_operand" "n")))]
5196 "TARGET_68020 && TARGET_BITFIELD
5197 && (INTVAL (operands[2]) % 8) == 0
5198 && ! mode_dependent_address_p (XEXP (operands[1], 0))"
5201 = adjust_address (operands[1], SImode, INTVAL (operands[2]) / 8);
5203 return "move%.l %1,%0";
5207 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
5208 (sign_extract:SI (match_operand:SI 1 "register_operand" "do")
5209 (match_operand:SI 2 "const_int_operand" "n")
5210 (match_operand:SI 3 "const_int_operand" "n")))]
5211 "TARGET_68020 && TARGET_BITFIELD
5212 && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
5213 && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
5214 && (GET_CODE (operands[1]) == REG
5215 || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
5217 if (REG_P (operands[1]))
5219 if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
5220 return "bfexts %1{%b3:%b2},%0";
5224 = adjust_address (operands[1],
5225 INTVAL (operands[2]) == 8 ? QImode : HImode,
5226 INTVAL (operands[3]) / 8);
5228 if (INTVAL (operands[2]) == 8)
5229 return "move%.b %1,%0\;extb%.l %0";
5230 return "move%.w %1,%0\;ext%.l %0";
5233 ;; Bit-field instructions, general cases.
5234 ;; "o,d" constraint causes a nonoffsettable memref to match the "o"
5235 ;; so that its address is reloaded.
5237 (define_expand "extv"
5238 [(set (match_operand:SI 0 "register_operand" "")
5239 (sign_extract:SI (match_operand:SI 1 "general_operand" "")
5240 (match_operand:SI 2 "const_int_operand" "")
5241 (match_operand:SI 3 "const_int_operand" "")))]
5242 "TARGET_68020 && TARGET_BITFIELD"
5246 [(set (match_operand:SI 0 "register_operand" "=d")
5247 (sign_extract:SI (match_operand:QI 1 "memory_operand" "o")
5248 (match_operand:SI 2 "nonmemory_operand" "dn")
5249 (match_operand:SI 3 "nonmemory_operand" "dn")))]
5250 "TARGET_68020 && TARGET_BITFIELD"
5251 "bfexts %1{%b3:%b2},%0")
5253 (define_expand "extzv"
5254 [(set (match_operand:SI 0 "register_operand" "")
5255 (zero_extract:SI (match_operand:SI 1 "general_operand" "")
5256 (match_operand:SI 2 "const_int_operand" "")
5257 (match_operand:SI 3 "const_int_operand" "")))]
5258 "TARGET_68020 && TARGET_BITFIELD"
5262 [(set (match_operand:SI 0 "register_operand" "=d")
5263 (zero_extract:SI (match_operand:QI 1 "memory_operand" "o")
5264 (match_operand:SI 2 "nonmemory_operand" "dn")
5265 (match_operand:SI 3 "nonmemory_operand" "dn")))]
5266 "TARGET_68020 && TARGET_BITFIELD"
5268 if (GET_CODE (operands[2]) == CONST_INT)
5270 if (INTVAL (operands[2]) != 32)
5271 cc_status.flags |= CC_NOT_NEGATIVE;
5277 return "bfextu %1{%b3:%b2},%0";
5281 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5282 (match_operand:SI 1 "nonmemory_operand" "dn")
5283 (match_operand:SI 2 "nonmemory_operand" "dn"))
5284 (xor:SI (zero_extract:SI (match_dup 0) (match_dup 1) (match_dup 2))
5285 (match_operand 3 "const_int_operand" "n")))]
5286 "TARGET_68020 && TARGET_BITFIELD
5287 && (INTVAL (operands[3]) == -1
5288 || (GET_CODE (operands[1]) == CONST_INT
5289 && (~ INTVAL (operands[3]) & ((1 << INTVAL (operands[1]))- 1)) == 0))"
5292 return "bfchg %0{%b2:%b1}";
5296 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5297 (match_operand:SI 1 "nonmemory_operand" "dn")
5298 (match_operand:SI 2 "nonmemory_operand" "dn"))
5300 "TARGET_68020 && TARGET_BITFIELD"
5303 return "bfclr %0{%b2:%b1}";
5307 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5308 (match_operand:SI 1 "general_operand" "dn")
5309 (match_operand:SI 2 "general_operand" "dn"))
5311 "TARGET_68020 && TARGET_BITFIELD"
5314 return "bfset %0{%b2:%b1}";
5317 (define_expand "insv"
5318 [(set (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "")
5319 (match_operand:SI 1 "const_int_operand" "")
5320 (match_operand:SI 2 "const_int_operand" ""))
5321 (match_operand:SI 3 "register_operand" ""))]
5322 "TARGET_68020 && TARGET_BITFIELD"
5326 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5327 (match_operand:SI 1 "nonmemory_operand" "dn")
5328 (match_operand:SI 2 "nonmemory_operand" "dn"))
5329 (match_operand:SI 3 "register_operand" "d"))]
5330 "TARGET_68020 && TARGET_BITFIELD"
5331 "bfins %3,%0{%b2:%b1}")
5333 ;; Now recognize bit-field insns that operate on registers
5334 ;; (or at least were intended to do so).
5337 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
5338 (sign_extract:SI (match_operand:SI 1 "register_operand" "d")
5339 (match_operand:SI 2 "const_int_operand" "n")
5340 (match_operand:SI 3 "const_int_operand" "n")))]
5341 "TARGET_68020 && TARGET_BITFIELD"
5342 "bfexts %1{%b3:%b2},%0")
5345 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
5346 (zero_extract:SI (match_operand:SI 1 "register_operand" "d")
5347 (match_operand:SI 2 "const_int_operand" "n")
5348 (match_operand:SI 3 "const_int_operand" "n")))]
5349 "TARGET_68020 && TARGET_BITFIELD"
5351 if (GET_CODE (operands[2]) == CONST_INT)
5353 if (INTVAL (operands[2]) != 32)
5354 cc_status.flags |= CC_NOT_NEGATIVE;
5360 return "bfextu %1{%b3:%b2},%0";
5364 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
5365 (match_operand:SI 1 "const_int_operand" "n")
5366 (match_operand:SI 2 "const_int_operand" "n"))
5368 "TARGET_68020 && TARGET_BITFIELD"
5371 return "bfclr %0{%b2:%b1}";
5375 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
5376 (match_operand:SI 1 "const_int_operand" "n")
5377 (match_operand:SI 2 "const_int_operand" "n"))
5379 "TARGET_68020 && TARGET_BITFIELD"
5382 return "bfset %0{%b2:%b1}";
5386 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
5387 (match_operand:SI 1 "const_int_operand" "n")
5388 (match_operand:SI 2 "const_int_operand" "n"))
5389 (match_operand:SI 3 "register_operand" "d"))]
5390 "TARGET_68020 && TARGET_BITFIELD"
5393 /* These special cases are now recognized by a specific pattern. */
5394 if (GET_CODE (operands[1]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT
5395 && INTVAL (operands[1]) == 16 && INTVAL (operands[2]) == 16)
5396 return "move%.w %3,%0";
5397 if (GET_CODE (operands[1]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT
5398 && INTVAL (operands[1]) == 24 && INTVAL (operands[2]) == 8)
5399 return "move%.b %3,%0";
5401 return "bfins %3,%0{%b2:%b1}";
5404 ;; Special patterns for optimizing bit-field instructions.
5408 (zero_extract:SI (match_operand:QI 0 "memory_operand" "o")
5409 (match_operand:SI 1 "const_int_operand" "n")
5410 (match_operand:SI 2 "general_operand" "dn")))]
5411 "TARGET_68020 && TARGET_BITFIELD"
5413 if (operands[1] == const1_rtx
5414 && GET_CODE (operands[2]) == CONST_INT)
5416 int width = GET_CODE (operands[0]) == REG ? 31 : 7;
5417 return output_btst (operands,
5418 GEN_INT (width - INTVAL (operands[2])),
5419 operands[0], insn, 1000);
5420 /* Pass 1000 as SIGNPOS argument so that btst will
5421 not think we are testing the sign bit for an `and'
5422 and assume that nonzero implies a negative result. */
5424 if (INTVAL (operands[1]) != 32)
5425 cc_status.flags = CC_NOT_NEGATIVE;
5426 return "bftst %0{%b2:%b1}";
5430 ;;; now handle the register cases
5433 (zero_extract:SI (match_operand:SI 0 "register_operand" "d")
5434 (match_operand:SI 1 "const_int_operand" "n")
5435 (match_operand:SI 2 "general_operand" "dn")))]
5436 "TARGET_68020 && TARGET_BITFIELD"
5438 if (operands[1] == const1_rtx
5439 && GET_CODE (operands[2]) == CONST_INT)
5441 int width = GET_CODE (operands[0]) == REG ? 31 : 7;
5442 return output_btst (operands, GEN_INT (width - INTVAL (operands[2])),
5443 operands[0], insn, 1000);
5444 /* Pass 1000 as SIGNPOS argument so that btst will
5445 not think we are testing the sign bit for an `and'
5446 and assume that nonzero implies a negative result. */
5448 if (INTVAL (operands[1]) != 32)
5449 cc_status.flags = CC_NOT_NEGATIVE;
5450 return "bftst %0{%b2:%b1}";
5453 (define_insn "scc0_di"
5454 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
5455 (match_operator 1 "valid_dbcc_comparison_p"
5456 [(match_operand:DI 2 "general_operand" "ro") (const_int 0)]))]
5459 return output_scc_di (operands[1], operands[2], const0_rtx, operands[0]);
5462 (define_insn "scc0_di_5200"
5463 [(set (match_operand:QI 0 "nonimmediate_operand" "=d")
5464 (match_operator 1 "valid_dbcc_comparison_p"
5465 [(match_operand:DI 2 "general_operand" "ro") (const_int 0)]))]
5468 return output_scc_di (operands[1], operands[2], const0_rtx, operands[0]);
5471 (define_insn "scc_di"
5472 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,dm")
5473 (match_operator 1 "valid_dbcc_comparison_p"
5474 [(match_operand:DI 2 "general_operand" "ro,r")
5475 (match_operand:DI 3 "general_operand" "r,ro")]))]
5478 return output_scc_di (operands[1], operands[2], operands[3], operands[0]);
5481 (define_insn "scc_di_5200"
5482 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d")
5483 (match_operator 1 "valid_dbcc_comparison_p"
5484 [(match_operand:DI 2 "general_operand" "ro,r")
5485 (match_operand:DI 3 "general_operand" "r,ro")]))]
5488 return output_scc_di (operands[1], operands[2], operands[3], operands[0]);
5491 ;; Note that operand 0 of an SCC insn is supported in the hardware as
5492 ;; memory, but we cannot allow it to be in memory in case the address
5493 ;; needs to be reloaded.
5495 (define_expand "seq"
5496 [(set (match_operand:QI 0 "register_operand" "")
5497 (eq:QI (cc0) (const_int 0)))]
5500 if ((TUNE_68060 || TARGET_COLDFIRE_FPU)
5501 && m68k_last_compare_had_fp_operands)
5503 m68k_last_compare_had_fp_operands = 0;
5509 [(set (match_operand:QI 0 "register_operand" "=d")
5510 (eq:QI (cc0) (const_int 0)))]
5513 cc_status = cc_prev_status;
5514 OUTPUT_JUMP ("seq %0", "fseq %0", "seq %0");
5517 (define_expand "sne"
5518 [(set (match_operand:QI 0 "register_operand" "")
5519 (ne:QI (cc0) (const_int 0)))]
5522 if ((TUNE_68060 || TARGET_COLDFIRE_FPU)
5523 && m68k_last_compare_had_fp_operands)
5525 m68k_last_compare_had_fp_operands = 0;
5531 [(set (match_operand:QI 0 "register_operand" "=d")
5532 (ne:QI (cc0) (const_int 0)))]
5535 cc_status = cc_prev_status;
5536 OUTPUT_JUMP ("sne %0", "fsne %0", "sne %0");
5539 (define_expand "sgt"
5540 [(set (match_operand:QI 0 "register_operand" "")
5541 (gt:QI (cc0) (const_int 0)))]
5544 if ((TUNE_68060 || TARGET_COLDFIRE_FPU)
5545 && m68k_last_compare_had_fp_operands)
5547 m68k_last_compare_had_fp_operands = 0;
5553 [(set (match_operand:QI 0 "register_operand" "=d")
5554 (gt:QI (cc0) (const_int 0)))]
5557 cc_status = cc_prev_status;
5558 OUTPUT_JUMP ("sgt %0", "fsgt %0", 0);
5561 (define_expand "sgtu"
5562 [(set (match_operand:QI 0 "register_operand" "")
5563 (gtu:QI (cc0) (const_int 0)))]
5568 [(set (match_operand:QI 0 "register_operand" "=d")
5569 (gtu:QI (cc0) (const_int 0)))]
5572 cc_status = cc_prev_status;
5576 (define_expand "slt"
5577 [(set (match_operand:QI 0 "register_operand" "")
5578 (lt:QI (cc0) (const_int 0)))]
5581 if ((TUNE_68060 || TARGET_COLDFIRE_FPU)
5582 && m68k_last_compare_had_fp_operands)
5584 m68k_last_compare_had_fp_operands = 0;
5590 [(set (match_operand:QI 0 "register_operand" "=d")
5591 (lt:QI (cc0) (const_int 0)))]
5594 cc_status = cc_prev_status;
5595 OUTPUT_JUMP ("slt %0", "fslt %0", "smi %0");
5598 (define_expand "sltu"
5599 [(set (match_operand:QI 0 "register_operand" "")
5600 (ltu:QI (cc0) (const_int 0)))]
5605 [(set (match_operand:QI 0 "register_operand" "=d")
5606 (ltu:QI (cc0) (const_int 0)))]
5609 cc_status = cc_prev_status;
5613 (define_expand "sge"
5614 [(set (match_operand:QI 0 "register_operand" "")
5615 (ge:QI (cc0) (const_int 0)))]
5618 if ((TUNE_68060 || TARGET_COLDFIRE_FPU)
5619 && m68k_last_compare_had_fp_operands)
5621 m68k_last_compare_had_fp_operands = 0;
5627 [(set (match_operand:QI 0 "register_operand" "=d")
5628 (ge:QI (cc0) (const_int 0)))]
5631 cc_status = cc_prev_status;
5632 OUTPUT_JUMP ("sge %0", "fsge %0", "spl %0");
5635 (define_expand "sgeu"
5636 [(set (match_operand:QI 0 "register_operand" "")
5637 (geu:QI (cc0) (const_int 0)))]
5642 [(set (match_operand:QI 0 "register_operand" "=d")
5643 (geu:QI (cc0) (const_int 0)))]
5646 cc_status = cc_prev_status;
5650 (define_expand "sle"
5651 [(set (match_operand:QI 0 "register_operand" "")
5652 (le:QI (cc0) (const_int 0)))]
5655 if ((TUNE_68060 || TARGET_COLDFIRE_FPU)
5656 && m68k_last_compare_had_fp_operands)
5658 m68k_last_compare_had_fp_operands = 0;
5664 [(set (match_operand:QI 0 "register_operand" "=d")
5665 (le:QI (cc0) (const_int 0)))]
5668 cc_status = cc_prev_status;
5669 OUTPUT_JUMP ("sle %0", "fsle %0", 0);
5672 (define_expand "sleu"
5673 [(set (match_operand:QI 0 "register_operand" "")
5674 (leu:QI (cc0) (const_int 0)))]
5679 [(set (match_operand:QI 0 "register_operand" "=d")
5680 (leu:QI (cc0) (const_int 0)))]
5683 cc_status = cc_prev_status;
5687 (define_expand "sordered"
5688 [(set (match_operand:QI 0 "register_operand" "")
5689 (ordered:QI (cc0) (const_int 0)))]
5690 "TARGET_68881 && !TUNE_68060"
5692 gcc_assert (m68k_last_compare_had_fp_operands);
5693 m68k_last_compare_had_fp_operands = 0;
5696 (define_insn "*sordered_1"
5697 [(set (match_operand:QI 0 "register_operand" "=d")
5698 (ordered:QI (cc0) (const_int 0)))]
5699 "TARGET_68881 && !TUNE_68060"
5701 cc_status = cc_prev_status;
5705 (define_expand "sunordered"
5706 [(set (match_operand:QI 0 "register_operand" "")
5707 (unordered:QI (cc0) (const_int 0)))]
5708 "TARGET_68881 && !TUNE_68060"
5710 gcc_assert (m68k_last_compare_had_fp_operands);
5711 m68k_last_compare_had_fp_operands = 0;
5714 (define_insn "*sunordered_1"
5715 [(set (match_operand:QI 0 "register_operand" "=d")
5716 (unordered:QI (cc0) (const_int 0)))]
5717 "TARGET_68881 && !TUNE_68060"
5719 cc_status = cc_prev_status;
5723 (define_expand "suneq"
5724 [(set (match_operand:QI 0 "register_operand" "")
5725 (uneq:QI (cc0) (const_int 0)))]
5726 "TARGET_68881 && !TUNE_68060"
5728 gcc_assert (m68k_last_compare_had_fp_operands);
5729 m68k_last_compare_had_fp_operands = 0;
5732 (define_insn "*suneq_1"
5733 [(set (match_operand:QI 0 "register_operand" "=d")
5734 (uneq:QI (cc0) (const_int 0)))]
5735 "TARGET_68881 && !TUNE_68060"
5737 cc_status = cc_prev_status;
5741 (define_expand "sunge"
5742 [(set (match_operand:QI 0 "register_operand" "")
5743 (unge:QI (cc0) (const_int 0)))]
5744 "TARGET_68881 && !TUNE_68060"
5746 gcc_assert (m68k_last_compare_had_fp_operands);
5747 m68k_last_compare_had_fp_operands = 0;
5750 (define_insn "*sunge_1"
5751 [(set (match_operand:QI 0 "register_operand" "=d")
5752 (unge:QI (cc0) (const_int 0)))]
5753 "TARGET_68881 && !TUNE_68060"
5755 cc_status = cc_prev_status;
5759 (define_expand "sungt"
5760 [(set (match_operand:QI 0 "register_operand" "")
5761 (ungt:QI (cc0) (const_int 0)))]
5762 "TARGET_68881 && !TUNE_68060"
5764 gcc_assert (m68k_last_compare_had_fp_operands);
5765 m68k_last_compare_had_fp_operands = 0;
5768 (define_insn "*sungt_1"
5769 [(set (match_operand:QI 0 "register_operand" "=d")
5770 (ungt:QI (cc0) (const_int 0)))]
5771 "TARGET_68881 && !TUNE_68060"
5773 cc_status = cc_prev_status;
5777 (define_expand "sunle"
5778 [(set (match_operand:QI 0 "register_operand" "")
5779 (unle:QI (cc0) (const_int 0)))]
5780 "TARGET_68881 && !TUNE_68060"
5782 gcc_assert (m68k_last_compare_had_fp_operands);
5783 m68k_last_compare_had_fp_operands = 0;
5786 (define_insn "*sunle_1"
5787 [(set (match_operand:QI 0 "register_operand" "=d")
5788 (unle:QI (cc0) (const_int 0)))]
5789 "TARGET_68881 && !TUNE_68060"
5791 cc_status = cc_prev_status;
5795 (define_expand "sunlt"
5796 [(set (match_operand:QI 0 "register_operand" "")
5797 (unlt:QI (cc0) (const_int 0)))]
5798 "TARGET_68881 && !TUNE_68060"
5800 gcc_assert (m68k_last_compare_had_fp_operands);
5801 m68k_last_compare_had_fp_operands = 0;
5804 (define_insn "*sunlt_1"
5805 [(set (match_operand:QI 0 "register_operand" "=d")
5806 (unlt:QI (cc0) (const_int 0)))]
5807 "TARGET_68881 && !TUNE_68060"
5809 cc_status = cc_prev_status;
5813 (define_expand "sltgt"
5814 [(set (match_operand:QI 0 "register_operand" "")
5815 (ltgt:QI (cc0) (const_int 0)))]
5816 "TARGET_68881 && !TUNE_68060"
5818 gcc_assert (m68k_last_compare_had_fp_operands);
5819 m68k_last_compare_had_fp_operands = 0;
5822 (define_insn "*sltgt_1"
5823 [(set (match_operand:QI 0 "register_operand" "=d")
5824 (ltgt:QI (cc0) (const_int 0)))]
5825 "TARGET_68881 && !TUNE_68060"
5827 cc_status = cc_prev_status;
5831 (define_insn "*fsogt_1"
5832 [(set (match_operand:QI 0 "register_operand" "=d")
5833 (not:QI (unle:QI (cc0) (const_int 0))))]
5834 "TARGET_68881 && !TUNE_68060"
5836 cc_status = cc_prev_status;
5840 (define_insn "*fsoge_1"
5841 [(set (match_operand:QI 0 "register_operand" "=d")
5842 (not:QI (unlt:QI (cc0) (const_int 0))))]
5843 "TARGET_68881 && !TUNE_68060"
5845 cc_status = cc_prev_status;
5849 (define_insn "*fsolt_1"
5850 [(set (match_operand:QI 0 "register_operand" "=d")
5851 (not:QI (unge:QI (cc0) (const_int 0))))]
5852 "TARGET_68881 && !TUNE_68060"
5854 cc_status = cc_prev_status;
5858 (define_insn "*fsole_1"
5859 [(set (match_operand:QI 0 "register_operand" "=d")
5860 (not:QI (ungt:QI (cc0) (const_int 0))))]
5861 "TARGET_68881 && !TUNE_68060"
5863 cc_status = cc_prev_status;
5867 ;; Basic conditional jump instructions.
5869 (define_insn "beq0_di"
5871 (if_then_else (eq (match_operand:DI 0 "general_operand" "d*ao,<>")
5873 (label_ref (match_operand 1 "" ","))
5875 (clobber (match_scratch:SI 2 "=d,d"))]
5879 if (which_alternative == 1)
5882 return "move%.l %0,%2\;or%.l %0,%2\;jbeq %l1";
5884 return "move%.l %0,%2\;or%.l %0,%2\;jeq %l1";
5886 if ((cc_prev_status.value1
5887 && rtx_equal_p (cc_prev_status.value1, operands[0]))
5888 || (cc_prev_status.value2
5889 && rtx_equal_p (cc_prev_status.value2, operands[0])))
5891 cc_status = cc_prev_status;
5892 return MOTOROLA ? "jbeq %l1" : "jeq %l1";
5894 if (GET_CODE (operands[0]) == REG)
5895 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
5897 operands[3] = adjust_address (operands[0], SImode, 4);
5898 if (! ADDRESS_REG_P (operands[0]))
5900 if (reg_overlap_mentioned_p (operands[2], operands[0]))
5902 if (reg_overlap_mentioned_p (operands[2], operands[3]))
5905 return "or%.l %0,%2\;jbeq %l1";
5907 return "or%.l %0,%2\;jeq %l1";
5912 return "or%.l %3,%2\;jbeq %l1";
5914 return "or%.l %3,%2\;jeq %l1";
5918 return "move%.l %0,%2\;or%.l %3,%2\;jbeq %l1";
5920 return "move%.l %0,%2\;or%.l %3,%2\;jeq %l1";
5922 operands[4] = gen_label_rtx();
5923 if (TARGET_68020 || TARGET_COLDFIRE)
5926 output_asm_insn ("tst%.l %0\;jbne %l4\;tst%.l %3\;jbeq %l1", operands);
5928 output_asm_insn ("tst%.l %0\;jne %l4\;tst%.l %3\;jeq %l1", operands);
5933 output_asm_insn ("cmp%.w #0,%0\;jbne %l4\;cmp%.w #0,%3\;jbeq %l1", operands);
5935 output_asm_insn ("cmp%.w #0,%0\;jne %l4\;cmp%.w #0,%3\;jeq %l1", operands);
5937 (*targetm.asm_out.internal_label) (asm_out_file, "L",
5938 CODE_LABEL_NUMBER (operands[4]));
5942 (define_insn "bne0_di"
5944 (if_then_else (ne (match_operand:DI 0 "general_operand" "do,*a")
5946 (label_ref (match_operand 1 "" ","))
5948 (clobber (match_scratch:SI 2 "=d,X"))]
5951 if ((cc_prev_status.value1
5952 && rtx_equal_p (cc_prev_status.value1, operands[0]))
5953 || (cc_prev_status.value2
5954 && rtx_equal_p (cc_prev_status.value2, operands[0])))
5956 cc_status = cc_prev_status;
5957 return MOTOROLA ? "jbne %l1" : "jne %l1";
5960 if (GET_CODE (operands[0]) == REG)
5961 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
5963 operands[3] = adjust_address (operands[0], SImode, 4);
5964 if (!ADDRESS_REG_P (operands[0]))
5966 if (reg_overlap_mentioned_p (operands[2], operands[0]))
5968 if (reg_overlap_mentioned_p (operands[2], operands[3]))
5971 return "or%.l %0,%2\;jbne %l1";
5973 return "or%.l %0,%2\;jne %l1";
5978 return "or%.l %3,%2\;jbne %l1";
5980 return "or%.l %3,%2\;jne %l1";
5984 return "move%.l %0,%2\;or%.l %3,%2\;jbne %l1";
5986 return "move%.l %0,%2\;or%.l %3,%2\;jne %l1";
5988 if (TARGET_68020 || TARGET_COLDFIRE)
5991 return "tst%.l %0\;jbne %l1\;tst%.l %3\;jbne %l1";
5993 return "tst%.l %0\;jne %l1\;tst%.l %3\;jne %l1";
5998 return "cmp%.w #0,%0\;jbne %l1\;cmp%.w #0,%3\;jbne %l1";
6000 return "cmp%.w #0,%0\;jne %l1\;cmp%.w #0,%3\;jne %l1";
6004 (define_insn "bge0_di"
6006 (if_then_else (ge (match_operand:DI 0 "general_operand" "ro")
6008 (label_ref (match_operand 1 "" ""))
6012 if ((cc_prev_status.value1
6013 && rtx_equal_p (cc_prev_status.value1, operands[0]))
6014 || (cc_prev_status.value2
6015 && rtx_equal_p (cc_prev_status.value2, operands[0])))
6017 cc_status = cc_prev_status;
6018 if (cc_status.flags & CC_REVERSED)
6020 return MOTOROLA ? "jble %l1" : "jle %l1";
6024 return MOTOROLA ? "jbpl %l1" : "jpl %l1";
6028 if (TARGET_68020 || TARGET_COLDFIRE || ! ADDRESS_REG_P (operands[0]))
6029 output_asm_insn("tst%.l %0", operands);
6032 /* On an address reg, cmpw may replace cmpl. */
6033 output_asm_insn("cmp%.w #0,%0", operands);
6035 return MOTOROLA ? "jbpl %l1" : "jpl %l1";
6038 (define_insn "blt0_di"
6040 (if_then_else (lt (match_operand:DI 0 "general_operand" "ro")
6042 (label_ref (match_operand 1 "" ""))
6046 if ((cc_prev_status.value1
6047 && rtx_equal_p (cc_prev_status.value1, operands[0]))
6048 || (cc_prev_status.value2
6049 && rtx_equal_p (cc_prev_status.value2, operands[0])))
6051 cc_status = cc_prev_status;
6052 if (cc_status.flags & CC_REVERSED)
6054 return MOTOROLA ? "jbgt %l1" : "jgt %l1";
6058 return MOTOROLA ? "jbmi %l1" : "jmi %l1";
6062 if (TARGET_68020 || TARGET_COLDFIRE || ! ADDRESS_REG_P (operands[0]))
6063 output_asm_insn("tst%.l %0", operands);
6066 /* On an address reg, cmpw may replace cmpl. */
6067 output_asm_insn("cmp%.w #0,%0", operands);
6070 return MOTOROLA ? "jbmi %l1" : "jmi %l1";
6075 (if_then_else (eq (cc0)
6077 (label_ref (match_operand 0 "" ""))
6082 OUTPUT_JUMP ("jbeq %l0", "fbeq %l0", "jbeq %l0");
6084 OUTPUT_JUMP ("jeq %l0", "fjeq %l0", "jeq %l0");
6089 (if_then_else (ne (cc0)
6091 (label_ref (match_operand 0 "" ""))
6096 OUTPUT_JUMP ("jbne %l0", "fbne %l0", "jbne %l0");
6098 OUTPUT_JUMP ("jne %l0", "fjne %l0", "jne %l0");
6103 (if_then_else (gt (cc0)
6105 (label_ref (match_operand 0 "" ""))
6110 OUTPUT_JUMP ("jbgt %l0", "fbgt %l0", 0);
6112 OUTPUT_JUMP ("jgt %l0", "fjgt %l0", 0);
6117 (if_then_else (gtu (cc0)
6119 (label_ref (match_operand 0 "" ""))
6123 return MOTOROLA ? "jbhi %l0" : "jhi %l0";
6128 (if_then_else (lt (cc0)
6130 (label_ref (match_operand 0 "" ""))
6135 OUTPUT_JUMP ("jblt %l0", "fblt %l0", "jbmi %l0");
6137 OUTPUT_JUMP ("jlt %l0", "fjlt %l0", "jmi %l0");
6142 (if_then_else (ltu (cc0)
6144 (label_ref (match_operand 0 "" ""))
6148 return MOTOROLA ? "jbcs %l0" : "jcs %l0";
6153 (if_then_else (ge (cc0)
6155 (label_ref (match_operand 0 "" ""))
6160 OUTPUT_JUMP ("jbge %l0", "fbge %l0", "jbpl %l0");
6162 OUTPUT_JUMP ("jge %l0", "fjge %l0", "jpl %l0");
6167 (if_then_else (geu (cc0)
6169 (label_ref (match_operand 0 "" ""))
6173 return MOTOROLA ? "jbcc %l0" : "jcc %l0";
6178 (if_then_else (le (cc0)
6180 (label_ref (match_operand 0 "" ""))
6185 OUTPUT_JUMP ("jble %l0", "fble %l0", 0);
6187 OUTPUT_JUMP ("jle %l0", "fjle %l0", 0);
6192 (if_then_else (leu (cc0)
6194 (label_ref (match_operand 0 "" ""))
6198 return MOTOROLA ? "jbls %l0" : "jls %l0";
6201 (define_insn "bordered"
6203 (if_then_else (ordered (cc0) (const_int 0))
6204 (label_ref (match_operand 0 "" ""))
6208 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6209 return MOTOROLA ? "fbor %l0" : "fjor %l0";
6212 (define_insn "bunordered"
6214 (if_then_else (unordered (cc0) (const_int 0))
6215 (label_ref (match_operand 0 "" ""))
6219 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6220 return MOTOROLA ? "fbun %l0" : "fjun %l0";
6223 (define_insn "buneq"
6225 (if_then_else (uneq (cc0) (const_int 0))
6226 (label_ref (match_operand 0 "" ""))
6230 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6231 return MOTOROLA ? "fbueq %l0" : "fjueq %l0";
6234 (define_insn "bunge"
6236 (if_then_else (unge (cc0) (const_int 0))
6237 (label_ref (match_operand 0 "" ""))
6241 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6242 return MOTOROLA ? "fbuge %l0" : "fjuge %l0";
6245 (define_insn "bungt"
6247 (if_then_else (ungt (cc0) (const_int 0))
6248 (label_ref (match_operand 0 "" ""))
6252 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6253 return MOTOROLA ? "fbugt %l0" : "fjugt %l0";
6256 (define_insn "bunle"
6258 (if_then_else (unle (cc0) (const_int 0))
6259 (label_ref (match_operand 0 "" ""))
6263 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6264 return MOTOROLA ? "fbule %l0" : "fjule %l0";
6267 (define_insn "bunlt"
6269 (if_then_else (unlt (cc0) (const_int 0))
6270 (label_ref (match_operand 0 "" ""))
6274 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6275 return MOTOROLA ? "fbult %l0" : "fjult %l0";
6278 (define_insn "bltgt"
6280 (if_then_else (ltgt (cc0) (const_int 0))
6281 (label_ref (match_operand 0 "" ""))
6285 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6286 return MOTOROLA ? "fbogl %l0" : "fjogl %l0";
6289 ;; Negated conditional jump instructions.
6293 (if_then_else (eq (cc0)
6296 (label_ref (match_operand 0 "" ""))))]
6300 OUTPUT_JUMP ("jbne %l0", "fbne %l0", "jbne %l0");
6302 OUTPUT_JUMP ("jne %l0", "fjne %l0", "jne %l0");
6307 (if_then_else (ne (cc0)
6310 (label_ref (match_operand 0 "" ""))))]
6314 OUTPUT_JUMP ("jbeq %l0", "fbeq %l0", "jbeq %l0");
6316 OUTPUT_JUMP ("jeq %l0", "fjeq %l0", "jeq %l0");
6321 (if_then_else (gt (cc0)
6324 (label_ref (match_operand 0 "" ""))))]
6328 OUTPUT_JUMP ("jble %l0", "fbngt %l0", 0);
6330 OUTPUT_JUMP ("jle %l0", "fjngt %l0", 0);
6335 (if_then_else (gtu (cc0)
6338 (label_ref (match_operand 0 "" ""))))]
6341 return MOTOROLA ? "jbls %l0" : "jls %l0";
6346 (if_then_else (lt (cc0)
6349 (label_ref (match_operand 0 "" ""))))]
6353 OUTPUT_JUMP ("jbge %l0", "fbnlt %l0", "jbpl %l0");
6355 OUTPUT_JUMP ("jge %l0", "fjnlt %l0", "jpl %l0");
6360 (if_then_else (ltu (cc0)
6363 (label_ref (match_operand 0 "" ""))))]
6366 return MOTOROLA ? "jbcc %l0" : "jcc %l0";
6371 (if_then_else (ge (cc0)
6374 (label_ref (match_operand 0 "" ""))))]
6378 OUTPUT_JUMP ("jblt %l0", "fbnge %l0", "jbmi %l0");
6380 OUTPUT_JUMP ("jlt %l0", "fjnge %l0", "jmi %l0");
6385 (if_then_else (geu (cc0)
6388 (label_ref (match_operand 0 "" ""))))]
6391 return MOTOROLA ? "jbcs %l0" : "jcs %l0";
6396 (if_then_else (le (cc0)
6399 (label_ref (match_operand 0 "" ""))))]
6403 OUTPUT_JUMP ("jbgt %l0", "fbnle %l0", 0);
6405 OUTPUT_JUMP ("jgt %l0", "fjnle %l0", 0);
6410 (if_then_else (leu (cc0)
6413 (label_ref (match_operand 0 "" ""))))]
6416 return MOTOROLA ? "jbhi %l0" : "jhi %l0";
6419 (define_insn "*bordered_rev"
6421 (if_then_else (ordered (cc0) (const_int 0))
6423 (label_ref (match_operand 0 "" ""))))]
6426 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6427 return MOTOROLA ? "fbun %l0" : "fjun %l0";
6430 (define_insn "*bunordered_rev"
6432 (if_then_else (unordered (cc0) (const_int 0))
6434 (label_ref (match_operand 0 "" ""))))]
6437 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6438 return MOTOROLA ? "fbor %l0" : "fjor %l0";
6441 (define_insn "*buneq_rev"
6443 (if_then_else (uneq (cc0) (const_int 0))
6445 (label_ref (match_operand 0 "" ""))))]
6448 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6449 return MOTOROLA ? "fbogl %l0" : "fjogl %l0";
6452 (define_insn "*bunge_rev"
6454 (if_then_else (unge (cc0) (const_int 0))
6456 (label_ref (match_operand 0 "" ""))))]
6459 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6460 return MOTOROLA ? "fbolt %l0" : "fjolt %l0";
6463 (define_insn "*bungt_rev"
6465 (if_then_else (ungt (cc0) (const_int 0))
6467 (label_ref (match_operand 0 "" ""))))]
6470 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6471 return MOTOROLA ? "fbole %l0" : "fjole %l0";
6474 (define_insn "*bunle_rev"
6476 (if_then_else (unle (cc0) (const_int 0))
6478 (label_ref (match_operand 0 "" ""))))]
6481 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6482 return MOTOROLA ? "fbogt %l0" : "fjogt %l0";
6485 (define_insn "*bunlt_rev"
6487 (if_then_else (unlt (cc0) (const_int 0))
6489 (label_ref (match_operand 0 "" ""))))]
6492 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6493 return MOTOROLA ? "fboge %l0" : "fjoge %l0";
6496 (define_insn "*bltgt_rev"
6498 (if_then_else (ltgt (cc0) (const_int 0))
6500 (label_ref (match_operand 0 "" ""))))]
6503 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6504 return MOTOROLA ? "fbueq %l0" : "fjueq %l0";
6507 ;; Unconditional and other jump instructions
6510 (label_ref (match_operand 0 "" "")))]
6513 return MOTOROLA ? "jbra %l0" : "jra %l0";
6516 (define_expand "tablejump"
6517 [(parallel [(set (pc) (match_operand 0 "" ""))
6518 (use (label_ref (match_operand 1 "" "")))])]
6521 #ifdef CASE_VECTOR_PC_RELATIVE
6522 operands[0] = gen_rtx_PLUS (SImode, pc_rtx,
6523 gen_rtx_SIGN_EXTEND (SImode, operands[0]));
6527 ;; Jump to variable address from dispatch table of absolute addresses.
6529 [(set (pc) (match_operand:SI 0 "register_operand" "a"))
6530 (use (label_ref (match_operand 1 "" "")))]
6533 return MOTOROLA ? "jmp (%0)" : "jmp %0@";
6536 ;; Jump to variable address from dispatch table of relative addresses.
6540 (sign_extend:SI (match_operand:HI 0 "register_operand" "r"))))
6541 (use (label_ref (match_operand 1 "" "")))]
6544 #ifdef ASM_RETURN_CASE_JUMP
6545 ASM_RETURN_CASE_JUMP;
6547 if (TARGET_COLDFIRE)
6549 if (ADDRESS_REG_P (operands[0]))
6550 return MOTOROLA ? "jmp (2,pc,%0.l)" : "jmp pc@(2,%0:l)";
6552 return "ext%.l %0\;jmp (2,pc,%0.l)";
6554 return "extl %0\;jmp pc@(2,%0:l)";
6557 return MOTOROLA ? "jmp (2,pc,%0.w)" : "jmp pc@(2,%0:w)";
6561 ;; Decrement-and-branch insns.
6565 (ne (match_operand:HI 0 "nonimmediate_operand" "+d*g")
6567 (label_ref (match_operand 1 "" ""))
6570 (plus:HI (match_dup 0)
6575 if (DATA_REG_P (operands[0]))
6576 return "dbra %0,%l1";
6577 if (GET_CODE (operands[0]) == MEM)
6579 "subq%.w #1,%0\;jbcc %l1" :
6580 "subqw #1,%0\;jcc %l1";
6582 "subq%.w #1,%0\;cmp%.w #-1,%0\;jbne %l1" :
6583 "subqw #1,%0\;cmpw #-1,%0\;jne %l1";
6589 (ne (match_operand:SI 0 "nonimmediate_operand" "+d*g")
6591 (label_ref (match_operand 1 "" ""))
6594 (plus:SI (match_dup 0)
6599 if (DATA_REG_P (operands[0]))
6601 "dbra %0,%l1\;clr%.w %0\;subq%.l #1,%0\;jbcc %l1" :
6602 "dbra %0,%l1\;clr%.w %0\;subq%.l #1,%0\;jcc %l1";
6603 if (GET_CODE (operands[0]) == MEM)
6605 "subq%.l #1,%0\;jbcc %l1" :
6606 "subq%.l #1,%0\;jcc %l1";
6608 "subq.l #1,%0\;cmp.l #-1,%0\;jbne %l1" :
6609 "subql #1,%0\;cmpl #-1,%0\;jne %l1";
6612 ;; Two dbra patterns that use REG_NOTES info generated by strength_reduce.
6617 (ge (plus:HI (match_operand:HI 0 "nonimmediate_operand" "+d*am")
6620 (label_ref (match_operand 1 "" ""))
6623 (plus:HI (match_dup 0)
6625 "!TARGET_COLDFIRE && find_reg_note (insn, REG_NONNEG, 0)"
6628 if (DATA_REG_P (operands[0]))
6629 return "dbra %0,%l1";
6630 if (GET_CODE (operands[0]) == MEM)
6632 "subq%.w #1,%0\;jbcc %l1" :
6633 "subq%.w #1,%0\;jcc %l1";
6635 "subq.w #1,%0\;cmp.w #-1,%0\;jbne %l1" :
6636 "subqw #1,%0\;cmpw #-1,%0\;jne %l1";
6639 (define_expand "decrement_and_branch_until_zero"
6640 [(parallel [(set (pc)
6642 (ge (plus:SI (match_operand:SI 0 "nonimmediate_operand" "")
6645 (label_ref (match_operand 1 "" ""))
6648 (plus:SI (match_dup 0)
6656 (ge (plus:SI (match_operand:SI 0 "nonimmediate_operand" "+d*am")
6659 (label_ref (match_operand 1 "" ""))
6662 (plus:SI (match_dup 0)
6664 "!TARGET_COLDFIRE && find_reg_note (insn, REG_NONNEG, 0)"
6667 if (DATA_REG_P (operands[0]))
6669 "dbra %0,%l1\;clr%.w %0\;subq%.l #1,%0\;jbcc %l1" :
6670 "dbra %0,%l1\;clr%.w %0\;subql #1,%0\;jcc %l1";
6671 if (GET_CODE (operands[0]) == MEM)
6673 "subq%.l #1,%0\;jbcc %l1" :
6674 "subql #1,%0\;jcc %l1";
6676 "subq.l #1,%0\;cmp.l #-1,%0\;jbne %l1" :
6677 "subql #1,%0\;cmpl #-1,%0\;jne %l1";
6680 ;; Call subroutine with no return value.
6681 (define_expand "call"
6682 [(call (match_operand:QI 0 "memory_operand" "")
6683 (match_operand:SI 1 "general_operand" ""))]
6684 ;; Operand 1 not really used on the m68000.
6687 operands[0] = m68k_legitimize_call_address (operands[0]);
6690 (define_insn "*call"
6691 [(call (mem:QI (match_operand:SI 0 "call_operand" "a,W"))
6692 (match_operand:SI 1 "general_operand" "g,g"))]
6693 ;; Operand 1 not really used on the m68000.
6696 return output_call (operands[0]);
6699 ;; Call subroutine, returning value in operand 0
6700 ;; (which must be a hard register).
6701 (define_expand "call_value"
6702 [(set (match_operand 0 "" "")
6703 (call (match_operand:QI 1 "memory_operand" "")
6704 (match_operand:SI 2 "general_operand" "")))]
6705 ;; Operand 2 not really used on the m68000.
6708 operands[1] = m68k_legitimize_call_address (operands[1]);
6711 (define_insn "*call_value"
6712 [(set (match_operand 0 "" "=rf,rf")
6713 (call (mem:QI (match_operand:SI 1 "call_operand" "a,W"))
6714 (match_operand:SI 2 "general_operand" "g,g")))]
6715 ;; Operand 2 not really used on the m68000.
6718 operands[0] = operands[1];
6719 return output_call (operands[0]);
6722 ;; Call subroutine returning any type.
6724 (define_expand "untyped_call"
6725 [(parallel [(call (match_operand 0 "" "")
6727 (match_operand 1 "" "")
6728 (match_operand 2 "" "")])]
6729 "NEEDS_UNTYPED_CALL"
6733 emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
6735 for (i = 0; i < XVECLEN (operands[2], 0); i++)
6737 rtx set = XVECEXP (operands[2], 0, i);
6738 emit_move_insn (SET_DEST (set), SET_SRC (set));
6741 /* The optimizer does not know that the call sets the function value
6742 registers we stored in the result block. We avoid problems by
6743 claiming that all hard registers are used and clobbered at this
6745 emit_insn (gen_blockage ());
6750 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
6751 ;; all of memory. This blocks insns from being moved across this point.
6753 (define_insn "blockage"
6754 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
6763 (define_expand "prologue"
6767 m68k_expand_prologue ();
6771 (define_expand "epilogue"
6775 m68k_expand_epilogue ();
6779 ;; Used for frameless functions which save no regs and allocate no locals.
6780 (define_expand "return"
6782 "m68k_use_return_insn ()"
6785 (define_insn "*return"
6789 if (m68k_interrupt_function_p (current_function_decl))
6791 else if (current_function_pops_args)
6793 operands[0] = GEN_INT (current_function_pops_args);
6800 (define_insn "*m68k_store_multiple"
6801 [(match_parallel 0 "" [(match_operand 1 "")])]
6802 "m68k_movem_pattern_p (operands[0], NULL, 0, true)"
6804 return m68k_output_movem (operands, operands[0], 0, true);
6807 (define_insn "*m68k_store_multiple_automod"
6808 [(match_parallel 0 ""
6809 [(set (match_operand:SI 1 "register_operand" "=a")
6810 (plus:SI (match_operand:SI 2 "register_operand" "1")
6811 (match_operand:SI 3 "const_int_operand")))])]
6812 "m68k_movem_pattern_p (operands[0], operands[1], INTVAL (operands[3]), true)"
6814 return m68k_output_movem (operands, operands[0], INTVAL (operands[3]), true);
6817 (define_insn "*m68k_load_multiple"
6818 [(match_parallel 0 "" [(match_operand 1 "")])]
6819 "m68k_movem_pattern_p (operands[0], NULL, 0, false)"
6821 return m68k_output_movem (operands, operands[0], 0, false);
6824 (define_insn "*m68k_load_multiple_automod"
6825 [(match_parallel 0 ""
6826 [(set (match_operand:SI 1 "register_operand" "=a")
6827 (plus:SI (match_operand:SI 2 "register_operand" "1")
6828 (match_operand:SI 3 "const_int_operand")))])]
6829 "m68k_movem_pattern_p (operands[0], operands[1],
6830 INTVAL (operands[3]), false)"
6832 return m68k_output_movem (operands, operands[0],
6833 INTVAL (operands[3]), false);
6836 (define_expand "link"
6838 [(set (match_operand:SI 0 "register_operand")
6839 (plus:SI (reg:SI SP_REG) (const_int -4)))
6842 (set (reg:SI SP_REG)
6843 (plus:SI (reg:SI SP_REG)
6844 (match_operand:SI 1 "const_int_operand")))])]
6845 "TARGET_68020 || INTVAL (operands[1]) >= -0x8004"
6847 operands[2] = gen_frame_mem (SImode, plus_constant (stack_pointer_rtx, -4));
6850 (define_insn "*link"
6851 [(set (match_operand:SI 0 "register_operand" "+r")
6852 (plus:SI (reg:SI SP_REG) (const_int -4)))
6853 (set (mem:SI (plus:SI (reg:SI SP_REG) (const_int -4)))
6855 (set (reg:SI SP_REG)
6856 (plus:SI (reg:SI SP_REG)
6857 (match_operand:SI 1 "const_int_operand")))]
6858 "TARGET_68020 || INTVAL (operands[1]) >= -0x8004"
6860 operands[1] = GEN_INT (INTVAL (operands[1]) + 4);
6862 return "link %0,%1";
6863 else if (INTVAL (operands[1]) >= -0x8000)
6864 return "link.w %0,%1";
6866 return "link.l %0,%1";
6869 (define_expand "unlink"
6871 [(set (match_operand:SI 0 "register_operand")
6873 (set (reg:SI SP_REG)
6874 (plus:SI (match_dup 0)
6878 operands[1] = gen_frame_mem (SImode, copy_rtx (operands[0]));
6881 (define_insn "*unlink"
6882 [(set (match_operand:SI 0 "register_operand" "+r")
6883 (mem:SI (match_dup 0)))
6884 (set (reg:SI SP_REG)
6885 (plus:SI (match_dup 0)
6890 (define_insn "load_got"
6891 [(set (match_operand:SI 0 "register_operand" "=a")
6892 (unspec:SI [(const_int 0)] UNSPEC_GOT))]
6895 if (TARGET_ID_SHARED_LIBRARY)
6897 operands[1] = gen_rtx_REG (Pmode, PIC_REG);
6898 return MOTOROLA ? "move.l %?(%1),%0" : "movel %1@(%?), %0";
6902 if (TARGET_COLDFIRE)
6903 /* Load the full 32-bit PC-relative offset of
6904 _GLOBAL_OFFSET_TABLE_ into the PIC register, then use it to
6905 calculate the absolute value. The offset and "lea"
6906 operation word together occupy 6 bytes. */
6907 return ("move.l #_GLOBAL_OFFSET_TABLE_@GOTPC, %0\n\t"
6908 "lea (-6, %%pc, %0), %0");
6910 return "lea (%%pc, _GLOBAL_OFFSET_TABLE_@GOTPC), %0";
6913 return ("movel #_GLOBAL_OFFSET_TABLE_, %0\n\t"
6914 "lea %%pc@(0,%0:l),%0");
6917 (define_insn "indirect_jump"
6918 [(set (pc) (match_operand:SI 0 "address_operand" "p"))]
6922 ;; This should not be used unless the add/sub insns can't be.
6925 [(set (match_operand:SI 0 "nonimmediate_operand" "=a")
6926 (match_operand:QI 1 "address_operand" "p"))]
6929 /* Recognize an insn that refers to a table of offsets. Such an insn will
6930 need to refer to a label on the insn. So output one. Use the
6931 label-number of the table of offsets to generate this label. This code,
6932 and similar code above, assumes that there will be at most one reference
6934 if (GET_CODE (operands[1]) == PLUS
6935 && GET_CODE (XEXP (operands[1], 1)) == LABEL_REF
6936 && GET_CODE (XEXP (operands[1], 0)) != PLUS)
6938 rtx labelref = XEXP (operands[1], 1);
6940 asm_fprintf (asm_out_file, "\\t.set %LLI%d,.+2\\n",
6941 CODE_LABEL_NUMBER (XEXP (labelref, 0)));
6943 (*targetm.asm_out.internal_label) (asm_out_file, "LI",
6944 CODE_LABEL_NUMBER (XEXP (labelref, 0)));
6946 return "lea %a1,%0";
6949 ;; This is the first machine-dependent peephole optimization.
6950 ;; It is useful when a floating value is returned from a function call
6951 ;; and then is moved into an FP register.
6952 ;; But it is mainly intended to test the support for these optimizations.
6955 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))
6956 (set (match_operand:DF 0 "register_operand" "=f")
6957 (match_operand:DF 1 "register_operand" "ad"))]
6958 "FP_REG_P (operands[0]) && ! FP_REG_P (operands[1])"
6961 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
6962 output_asm_insn ("move%.l %1,%@", xoperands);
6963 output_asm_insn ("move%.l %1,%-", operands);
6964 return "fmove%.d %+,%0";
6967 ;; Optimize a stack-adjust followed by a push of an argument.
6968 ;; This is said to happen frequently with -msoft-float
6969 ;; when there are consecutive library calls.
6972 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
6973 (match_operand:SI 0 "const_int_operand" "n")))
6974 (set (match_operand:SF 1 "push_operand" "=m")
6975 (match_operand:SF 2 "general_operand" "rmfF"))]
6976 "INTVAL (operands[0]) >= 4
6977 && ! reg_mentioned_p (stack_pointer_rtx, operands[2])"
6979 if (INTVAL (operands[0]) > 4)
6982 xoperands[0] = stack_pointer_rtx;
6983 xoperands[1] = GEN_INT (INTVAL (operands[0]) - 4);
6984 if (INTVAL (xoperands[1]) <= 8)
6986 if (!TARGET_COLDFIRE)
6987 output_asm_insn ("addq%.w %1,%0", xoperands);
6989 output_asm_insn ("addq%.l %1,%0", xoperands);
6991 else if (TUNE_CPU32 && INTVAL (xoperands[1]) <= 16)
6993 xoperands[1] = GEN_INT (INTVAL (xoperands[1]) - 8);
6994 output_asm_insn ("addq%.w #8,%0\;addq%.w %1,%0", xoperands);
6996 else if (INTVAL (xoperands[1]) <= 0x7FFF)
6999 output_asm_insn ("add%.w %1,%0", xoperands);
7001 output_asm_insn ("lea (%c1,%0),%0", xoperands);
7003 output_asm_insn ("lea %0@(%c1),%0", xoperands);
7006 output_asm_insn ("add%.l %1,%0", xoperands);
7008 if (FP_REG_P (operands[2]))
7009 return "fmove%.s %2,%@";
7010 return "move%.l %2,%@";
7013 ;; Speed up stack adjust followed by a fullword fixedpoint push.
7016 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
7017 (match_operand:SI 0 "const_int_operand" "n")))
7018 (set (match_operand:SI 1 "push_operand" "=m")
7019 (match_operand:SI 2 "general_operand" "g"))]
7020 "INTVAL (operands[0]) >= 4
7021 && ! reg_mentioned_p (stack_pointer_rtx, operands[2])"
7023 if (INTVAL (operands[0]) > 4)
7026 xoperands[0] = stack_pointer_rtx;
7027 xoperands[1] = GEN_INT (INTVAL (operands[0]) - 4);
7028 if (INTVAL (xoperands[1]) <= 8)
7030 if (!TARGET_COLDFIRE)
7031 output_asm_insn ("addq%.w %1,%0", xoperands);
7033 output_asm_insn ("addq%.l %1,%0", xoperands);
7035 else if (TUNE_CPU32 && INTVAL (xoperands[1]) <= 16)
7037 xoperands[1] = GEN_INT (INTVAL (xoperands[1]) - 8);
7038 output_asm_insn ("addq%.w #8,%0\;addq%.w %1,%0", xoperands);
7040 else if (INTVAL (xoperands[1]) <= 0x7FFF)
7043 output_asm_insn ("add%.w %1,%0", xoperands);
7045 output_asm_insn ("lea (%c1,%0),%0", xoperands);
7047 output_asm_insn ("lea %0@(%c1),%0", xoperands);
7050 output_asm_insn ("add%.l %1,%0", xoperands);
7052 if (operands[2] == const0_rtx)
7054 return "move%.l %2,%@";
7057 ;; Speed up pushing a single byte but leaving four bytes of space.
7060 [(set (mem:QI (pre_dec:SI (reg:SI SP_REG)))
7061 (match_operand:QI 1 "general_operand" "dami"))
7062 (set (reg:SI SP_REG) (minus:SI (reg:SI SP_REG) (const_int 2)))]
7063 "! reg_mentioned_p (stack_pointer_rtx, operands[1])"
7067 if (GET_CODE (operands[1]) == REG)
7068 return "move%.l %1,%-";
7070 xoperands[1] = operands[1];
7072 = gen_rtx_MEM (QImode, plus_constant (stack_pointer_rtx, 3));
7073 xoperands[3] = stack_pointer_rtx;
7074 if (!TARGET_COLDFIRE)
7075 output_asm_insn ("subq%.w #4,%3\;move%.b %1,%2", xoperands);
7077 output_asm_insn ("subq%.l #4,%3\;move%.b %1,%2", xoperands);
7082 [(set (match_operand:SI 0 "register_operand" "=d")
7084 (set (strict_low_part (subreg:HI (match_dup 0) 2))
7085 (match_operand:HI 1 "general_operand" "rmn"))]
7086 "strict_low_part_peephole_ok (HImode, prev_nonnote_insn (insn), operands[0])"
7088 if (GET_CODE (operands[1]) == CONST_INT)
7090 if (operands[1] == const0_rtx
7091 && (DATA_REG_P (operands[0])
7092 || GET_CODE (operands[0]) == MEM)
7093 /* clr insns on 68000 read before writing. */
7094 && ((TARGET_68010 || TARGET_COLDFIRE)
7095 || !(GET_CODE (operands[0]) == MEM
7096 && MEM_VOLATILE_P (operands[0]))))
7099 return "move%.w %1,%0";
7107 ;; jCC label ; abnormal loop termination
7108 ;; dbra dN, loop ; normal loop termination
7116 ;; Which moves the jCC condition outside the inner loop for free.
7120 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
7121 [(cc0) (const_int 0)])
7122 (label_ref (match_operand 2 "" ""))
7127 (ne (match_operand:HI 0 "register_operand" "")
7129 (label_ref (match_operand 1 "" ""))
7132 (plus:HI (match_dup 0)
7134 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
7137 output_dbcc_and_branch (operands);
7142 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
7143 [(cc0) (const_int 0)])
7144 (label_ref (match_operand 2 "" ""))
7149 (ne (match_operand:SI 0 "register_operand" "")
7151 (label_ref (match_operand 1 "" ""))
7154 (plus:SI (match_dup 0)
7156 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
7159 output_dbcc_and_branch (operands);
7164 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
7165 [(cc0) (const_int 0)])
7166 (label_ref (match_operand 2 "" ""))
7171 (ge (plus:HI (match_operand:HI 0 "register_operand" "")
7174 (label_ref (match_operand 1 "" ""))
7177 (plus:HI (match_dup 0)
7179 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
7182 output_dbcc_and_branch (operands);
7187 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
7188 [(cc0) (const_int 0)])
7189 (label_ref (match_operand 2 "" ""))
7194 (ge (plus:SI (match_operand:SI 0 "register_operand" "")
7197 (label_ref (match_operand 1 "" ""))
7200 (plus:SI (match_dup 0)
7202 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
7205 output_dbcc_and_branch (operands);
7210 (define_insn "extendsfxf2"
7211 [(set (match_operand:XF 0 "nonimmediate_operand" "=fm,f")
7212 (float_extend:XF (match_operand:SF 1 "general_operand" "f,rmF")))]
7215 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
7217 if (REGNO (operands[0]) == REGNO (operands[1]))
7219 /* Extending float to double in an fp-reg is a no-op.
7220 NOTICE_UPDATE_CC has already assumed that the
7221 cc will be set. So cancel what it did. */
7222 cc_status = cc_prev_status;
7225 return "f%$move%.x %1,%0";
7227 if (FP_REG_P (operands[0]))
7229 if (FP_REG_P (operands[1]))
7230 return "f%$move%.x %1,%0";
7231 else if (ADDRESS_REG_P (operands[1]))
7232 return "move%.l %1,%-\;f%$move%.s %+,%0";
7233 else if (GET_CODE (operands[1]) == CONST_DOUBLE)
7234 return output_move_const_single (operands);
7235 return "f%$move%.s %f1,%0";
7237 return "fmove%.x %f1,%0";
7241 (define_insn "extenddfxf2"
7242 [(set (match_operand:XF 0 "nonimmediate_operand" "=fm,f")
7244 (match_operand:DF 1 "general_operand" "f,rmE")))]
7247 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
7249 if (REGNO (operands[0]) == REGNO (operands[1]))
7251 /* Extending float to double in an fp-reg is a no-op.
7252 NOTICE_UPDATE_CC has already assumed that the
7253 cc will be set. So cancel what it did. */
7254 cc_status = cc_prev_status;
7257 return "fmove%.x %1,%0";
7259 if (FP_REG_P (operands[0]))
7261 if (REG_P (operands[1]))
7264 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
7265 output_asm_insn ("move%.l %1,%-", xoperands);
7266 output_asm_insn ("move%.l %1,%-", operands);
7267 return "f%&move%.d %+,%0";
7269 if (GET_CODE (operands[1]) == CONST_DOUBLE)
7270 return output_move_const_double (operands);
7271 return "f%&move%.d %f1,%0";
7273 return "fmove%.x %f1,%0";
7276 (define_insn "truncxfdf2"
7277 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,!r")
7279 (match_operand:XF 1 "general_operand" "f,f")))]
7282 if (REG_P (operands[0]))
7284 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
7285 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
7286 return "move%.l %+,%0";
7288 return "fmove%.d %f1,%0";
7291 (define_insn "truncxfsf2"
7292 [(set (match_operand:SF 0 "nonimmediate_operand" "=dm")
7294 (match_operand:XF 1 "general_operand" "f")))]
7298 (define_insn "sin<mode>2"
7299 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
7301 [(match_operand:FP 1 "general_operand" "f<FP:dreg>m")] UNSPEC_SIN))]
7302 "TARGET_68881 && flag_unsafe_math_optimizations"
7304 if (FP_REG_P (operands[1]))
7305 return "fsin%.x %1,%0";
7307 return "fsin%.<FP:prec> %1,%0";
7310 (define_insn "cos<mode>2"
7311 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
7313 [(match_operand:FP 1 "general_operand" "f<FP:dreg>m")] UNSPEC_COS))]
7314 "TARGET_68881 && flag_unsafe_math_optimizations"
7316 if (FP_REG_P (operands[1]))
7317 return "fcos%.x %1,%0";
7319 return "fcos%.<FP:prec> %1,%0";
7323 [(trap_if (const_int -1) (const_int 7))]
7327 (define_insn "conditional_trap"
7328 [(trap_if (match_operator 0 "valid_dbcc_comparison_p"
7329 [(cc0) (const_int 0)])
7330 (match_operand:SI 1 "const_int_operand" "I"))]
7331 "TARGET_68020 && ! flags_in_68881 ()"
7333 switch (GET_CODE (operands[0]))
7335 case EQ: return "trapeq";
7336 case NE: return "trapne";
7337 case GT: return "trapgt";
7338 case GTU: return "traphi";
7339 case LT: return "traplt";
7340 case LTU: return "trapcs";
7341 case GE: return "trapge";
7342 case GEU: return "trapcc";
7343 case LE: return "traple";
7344 case LEU: return "trapls";
7345 default: gcc_unreachable ();