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<Q>,g,U")
864 (match_operand:SF 1 "general_operand" "g,r<Q>,U"))]
865 "TARGET_COLDFIRE && !TARGET_COLDFIRE_FPU"
867 return "move%.l %1,%0";
870 ;; SFmode MEMs are restricted to modes 2-4 if TARGET_COLDFIRE_FPU.
871 ;; The move instructions can handle all combinations.
872 (define_insn "movsf_cf_hard"
873 [(set (match_operand:SF 0 "nonimmediate_operand" "=r<Q>U, f, f,mr,f,r<Q>,f
875 (match_operand:SF 1 "general_operand" " f, r<Q>U,f,rm,F,F, m
877 "TARGET_COLDFIRE_FPU"
879 if (which_alternative == 4 || which_alternative == 5) {
883 REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
884 REAL_VALUE_TO_TARGET_SINGLE (r, l);
885 xoperands[0] = operands[0];
886 xoperands[1] = GEN_INT (l);
887 if (which_alternative == 5) {
889 if (ADDRESS_REG_P (xoperands[0]))
890 output_asm_insn ("sub%.l %0,%0", xoperands);
892 output_asm_insn ("clr%.l %0", xoperands);
894 if (GET_CODE (operands[0]) == MEM
895 && symbolic_operand (XEXP (operands[0], 0), SImode))
896 output_asm_insn ("move%.l %1,%-;move%.l %+,%0", xoperands);
898 output_asm_insn ("move%.l %1,%0", xoperands);
902 output_asm_insn ("move%.l %1,%-;fsmove%.s %+,%0", xoperands);
904 output_asm_insn ("clr%.l %-;fsmove%.s %+,%0", xoperands);
907 if (FP_REG_P (operands[0]))
909 if (ADDRESS_REG_P (operands[1]))
910 return "move%.l %1,%-;fsmove%.s %+,%0";
911 if (FP_REG_P (operands[1]))
912 return "fsmove%.d %1,%0";
913 return "fsmove%.s %f1,%0";
915 if (FP_REG_P (operands[1]))
917 if (ADDRESS_REG_P (operands[0]))
918 return "fmove%.s %1,%-;move%.l %+,%0";
919 return "fmove%.s %f1,%0";
921 if (operands[1] == CONST0_RTX (SFmode))
923 if (ADDRESS_REG_P (operands[0]))
924 return "sub%.l %0,%0";
927 return "move%.l %1,%0";
930 (define_expand "reload_indf"
931 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
932 (match_operand:DF 1 "general_operand" "mf"))
933 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
934 "TARGET_COLDFIRE_FPU"
936 if (emit_move_sequence (operands, DFmode, operands[2]))
939 /* We don't want the clobber emitted, so handle this ourselves. */
940 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
944 (define_expand "reload_outdf"
945 [(set (match_operand:DF 0 "general_operand" "")
946 (match_operand:DF 1 "register_operand" "f"))
947 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
948 "TARGET_COLDFIRE_FPU"
950 if (emit_move_sequence (operands, DFmode, operands[2]))
953 /* We don't want the clobber emitted, so handle this ourselves. */
954 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
958 (define_expand "movdf"
959 [(set (match_operand:DF 0 "nonimmediate_operand" "")
960 (match_operand:DF 1 "general_operand" ""))]
963 if (TARGET_COLDFIRE_FPU)
964 if (emit_move_sequence (operands, DFmode, 0))
969 [(set (match_operand:DF 0 "nonimmediate_operand" "=rm,rf,rf,&rof<>")
970 (match_operand:DF 1 "general_operand" "*rf,m,0,*rofE<>"))]
971 ; [(set (match_operand:DF 0 "nonimmediate_operand" "=rm,&rf,&rof<>")
972 ; (match_operand:DF 1 "general_operand" "rf,m,rofF<>"))]
975 if (FP_REG_P (operands[0]))
977 if (FP_REG_P (operands[1]))
978 return "f%&move%.x %1,%0";
979 if (REG_P (operands[1]))
982 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
983 output_asm_insn ("move%.l %1,%-", xoperands);
984 output_asm_insn ("move%.l %1,%-", operands);
985 return "f%&move%.d %+,%0";
987 if (GET_CODE (operands[1]) == CONST_DOUBLE)
988 return output_move_const_double (operands);
989 return "f%&move%.d %f1,%0";
991 else if (FP_REG_P (operands[1]))
993 if (REG_P (operands[0]))
995 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
996 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
997 return "move%.l %+,%0";
1000 return "fmove%.d %f1,%0";
1002 return output_move_double (operands);
1005 (define_insn "movdf_cf_soft"
1006 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,g")
1007 (match_operand:DF 1 "general_operand" "g,r"))]
1008 "TARGET_COLDFIRE && !TARGET_COLDFIRE_FPU"
1010 return output_move_double (operands);
1013 (define_insn "movdf_cf_hard"
1014 [(set (match_operand:DF 0 "nonimmediate_operand" "=f, <Q>U,r,f,r,r,m,f")
1015 (match_operand:DF 1 "general_operand" " f<Q>U,f, f,r,r,m,r,E"))]
1016 "TARGET_COLDFIRE_FPU"
1022 switch (which_alternative)
1025 return "fdmove%.d %1,%0";
1027 return "fmove%.d %1,%0";
1029 return "fmove%.d %1,%-;move%.l %+,%0;move%.l %+,%R0";
1031 return "move%.l %R1,%-;move%.l %1,%-;fdmove%.d %+,%0";
1032 case 4: case 5: case 6:
1033 return output_move_double (operands);
1035 REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
1036 REAL_VALUE_TO_TARGET_DOUBLE (r, l);
1037 xoperands[0] = operands[0];
1038 xoperands[1] = GEN_INT (l[0]);
1039 xoperands[2] = GEN_INT (l[1]);
1040 if (operands[1] == CONST0_RTX (DFmode))
1041 output_asm_insn ("clr%.l %-;clr%.l %-;fdmove%.d %+,%0",
1045 output_asm_insn ("clr%.l %-;move%.l %1,%-;fdmove%.d %+,%0",
1048 output_asm_insn ("move%.l %2,%-;move%.l %1,%-;fdmove%.d %+,%0",
1054 ;; ??? The XFmode patterns are schizophrenic about whether constants are
1055 ;; allowed. Most but not all have predicates and constraint that disallow
1056 ;; constants. Most but not all have output templates that handle constants.
1057 ;; See also LEGITIMATE_CONSTANT_P.
1059 (define_expand "movxf"
1060 [(set (match_operand:XF 0 "nonimmediate_operand" "")
1061 (match_operand:XF 1 "general_operand" ""))]
1064 /* We can't rewrite operands during reload. */
1065 if (! reload_in_progress)
1067 if (CONSTANT_P (operands[1]))
1069 operands[1] = force_const_mem (XFmode, operands[1]);
1070 if (! memory_address_p (XFmode, XEXP (operands[1], 0)))
1071 operands[1] = adjust_address (operands[1], XFmode, 0);
1073 if (flag_pic && TARGET_PCREL)
1075 /* Don't allow writes to memory except via a register; the
1076 m68k doesn't consider PC-relative addresses to be writable. */
1077 if (GET_CODE (operands[0]) == MEM
1078 && symbolic_operand (XEXP (operands[0], 0), SImode))
1079 operands[0] = gen_rtx_MEM (XFmode,
1080 force_reg (SImode, XEXP (operands[0], 0)));
1086 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,!r,!f,!r,m,!r")
1087 (match_operand:XF 1 "nonimmediate_operand" "m,f,f,f,r,!r,!r,m"))]
1090 if (FP_REG_P (operands[0]))
1092 if (FP_REG_P (operands[1]))
1093 return "fmove%.x %1,%0";
1094 if (REG_P (operands[1]))
1097 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 2);
1098 output_asm_insn ("move%.l %1,%-", xoperands);
1099 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1100 output_asm_insn ("move%.l %1,%-", xoperands);
1101 output_asm_insn ("move%.l %1,%-", operands);
1102 return "fmove%.x %+,%0";
1104 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1105 return "fmove%.x %1,%0";
1106 return "fmove%.x %f1,%0";
1108 if (FP_REG_P (operands[1]))
1110 if (REG_P (operands[0]))
1112 output_asm_insn ("fmove%.x %f1,%-\;move%.l %+,%0", operands);
1113 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1114 output_asm_insn ("move%.l %+,%0", operands);
1115 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1116 return "move%.l %+,%0";
1118 /* Must be memory destination. */
1119 return "fmove%.x %f1,%0";
1121 return output_move_double (operands);
1125 [(set (match_operand:XF 0 "nonimmediate_operand" "=rm,rf,&rof<>")
1126 (match_operand:XF 1 "nonimmediate_operand" "rf,m,rof<>"))]
1127 "! TARGET_68881 && ! TARGET_COLDFIRE"
1129 if (FP_REG_P (operands[0]))
1131 if (FP_REG_P (operands[1]))
1132 return "fmove%.x %1,%0";
1133 if (REG_P (operands[1]))
1136 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 2);
1137 output_asm_insn ("move%.l %1,%-", xoperands);
1138 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1139 output_asm_insn ("move%.l %1,%-", xoperands);
1140 output_asm_insn ("move%.l %1,%-", operands);
1141 return "fmove%.x %+,%0";
1143 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1144 return "fmove%.x %1,%0";
1145 return "fmove%.x %f1,%0";
1147 if (FP_REG_P (operands[1]))
1149 if (REG_P (operands[0]))
1151 output_asm_insn ("fmove%.x %f1,%-\;move%.l %+,%0", operands);
1152 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1153 output_asm_insn ("move%.l %+,%0", operands);
1154 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1155 return "move%.l %+,%0";
1158 return "fmove%.x %f1,%0";
1160 return output_move_double (operands);
1164 [(set (match_operand:XF 0 "nonimmediate_operand" "=r,g")
1165 (match_operand:XF 1 "nonimmediate_operand" "g,r"))]
1166 "! TARGET_68881 && TARGET_COLDFIRE"
1167 "* return output_move_double (operands);")
1169 (define_expand "movdi"
1170 ;; Let's see if it really still needs to handle fp regs, and, if so, why.
1171 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1172 (match_operand:DI 1 "general_operand" ""))]
1176 ;; movdi can apply to fp regs in some cases
1178 ;; Let's see if it really still needs to handle fp regs, and, if so, why.
1179 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r,&ro<>")
1180 (match_operand:DI 1 "general_operand" "rF,m,roi<>F"))]
1181 ; [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,&r,&ro<>,!&rm,!&f")
1182 ; (match_operand:DI 1 "general_operand" "r,m,roi<>,fF"))]
1183 ; [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,&rf,&ro<>,!&rm,!&f")
1184 ; (match_operand:DI 1 "general_operand" "r,m,roi<>,fF,rfF"))]
1187 if (FP_REG_P (operands[0]))
1189 if (FP_REG_P (operands[1]))
1190 return "fmove%.x %1,%0";
1191 if (REG_P (operands[1]))
1194 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1195 output_asm_insn ("move%.l %1,%-", xoperands);
1196 output_asm_insn ("move%.l %1,%-", operands);
1197 return "fmove%.d %+,%0";
1199 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1200 return output_move_const_double (operands);
1201 return "fmove%.d %f1,%0";
1203 else if (FP_REG_P (operands[1]))
1205 if (REG_P (operands[0]))
1207 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
1208 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1209 return "move%.l %+,%0";
1212 return "fmove%.d %f1,%0";
1214 return output_move_double (operands);
1218 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,g")
1219 (match_operand:DI 1 "general_operand" "g,r"))]
1221 "* return output_move_double (operands);")
1223 ;; Thus goes after the move instructions
1224 ;; because the move instructions are better (require no spilling)
1225 ;; when they can apply. It goes before the add/sub insns
1226 ;; so we will prefer it to them.
1228 (define_insn "pushasi"
1229 [(set (match_operand:SI 0 "push_operand" "=m")
1230 (match_operand:SI 1 "address_operand" "p"))]
1234 ;; truncation instructions
1235 (define_insn "truncsiqi2"
1236 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,d")
1238 (match_operand:SI 1 "general_src_operand" "doJS,i")))]
1241 if (GET_CODE (operands[0]) == REG)
1243 /* Must clear condition codes, since the move.l bases them on
1244 the entire 32 bits, not just the desired 8 bits. */
1246 return "move%.l %1,%0";
1248 if (GET_CODE (operands[1]) == MEM)
1249 operands[1] = adjust_address (operands[1], QImode, 3);
1250 return "move%.b %1,%0";
1253 (define_insn "trunchiqi2"
1254 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,d")
1256 (match_operand:HI 1 "general_src_operand" "doJS,i")))]
1259 if (GET_CODE (operands[0]) == REG
1260 && (GET_CODE (operands[1]) == MEM
1261 || GET_CODE (operands[1]) == CONST_INT))
1263 /* Must clear condition codes, since the move.w bases them on
1264 the entire 16 bits, not just the desired 8 bits. */
1266 return "move%.w %1,%0";
1268 if (GET_CODE (operands[0]) == REG)
1270 /* Must clear condition codes, since the move.l bases them on
1271 the entire 32 bits, not just the desired 8 bits. */
1273 return "move%.l %1,%0";
1275 if (GET_CODE (operands[1]) == MEM)
1276 operands[1] = adjust_address (operands[1], QImode, 1);
1277 return "move%.b %1,%0";
1280 (define_insn "truncsihi2"
1281 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm,d")
1283 (match_operand:SI 1 "general_src_operand" "roJS,i")))]
1286 if (GET_CODE (operands[0]) == REG)
1288 /* Must clear condition codes, since the move.l bases them on
1289 the entire 32 bits, not just the desired 8 bits. */
1291 return "move%.l %1,%0";
1293 if (GET_CODE (operands[1]) == MEM)
1294 operands[1] = adjust_address (operands[1], QImode, 2);
1295 return "move%.w %1,%0";
1298 ;; zero extension instructions
1300 ;; two special patterns to match various post_inc/pre_dec patterns
1301 (define_insn_and_split "*zero_extend_inc"
1302 [(set (match_operand 0 "post_inc_operand" "")
1303 (zero_extend (match_operand 1 "register_operand" "")))]
1304 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT &&
1305 GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT &&
1306 GET_MODE_SIZE (GET_MODE (operands[0])) == GET_MODE_SIZE (GET_MODE (operands[1])) * 2"
1314 operands[0] = adjust_address (operands[0], GET_MODE (operands[1]), 0);
1317 (define_insn_and_split "*zero_extend_dec"
1318 [(set (match_operand 0 "pre_dec_operand" "")
1319 (zero_extend (match_operand 1 "register_operand" "")))]
1320 "(GET_MODE (operands[0]) != HImode || XEXP (XEXP (operands[0], 0), 0) != stack_pointer_rtx) &&
1321 GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT &&
1322 GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT &&
1323 GET_MODE_SIZE (GET_MODE (operands[0])) == GET_MODE_SIZE (GET_MODE (operands[1])) * 2"
1331 operands[0] = adjust_address (operands[0], GET_MODE (operands[1]), 0);
1334 (define_insn_and_split "zero_extendqidi2"
1335 [(set (match_operand:DI 0 "register_operand" "")
1336 (zero_extend:DI (match_operand:QI 1 "nonimmediate_src_operand" "")))]
1341 (zero_extend:SI (match_dup 1)))
1345 operands[2] = gen_lowpart (SImode, operands[0]);
1346 operands[3] = gen_highpart (SImode, operands[0]);
1349 (define_insn_and_split "zero_extendhidi2"
1350 [(set (match_operand:DI 0 "register_operand" "")
1351 (zero_extend:DI (match_operand:HI 1 "nonimmediate_src_operand" "")))]
1356 (zero_extend:SI (match_dup 1)))
1360 operands[2] = gen_lowpart (SImode, operands[0]);
1361 operands[3] = gen_highpart (SImode, operands[0]);
1364 (define_expand "zero_extendsidi2"
1365 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1366 (zero_extend:DI (match_operand:SI 1 "nonimmediate_src_operand" "")))]
1369 if (GET_CODE (operands[0]) == MEM
1370 && GET_CODE (operands[1]) == MEM)
1371 operands[1] = force_reg (SImode, operands[1]);
1374 (define_insn_and_split "*zero_extendsidi2"
1375 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1376 (zero_extend:DI (match_operand:SI 1 "nonimmediate_src_operand" "")))]
1377 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
1385 operands[2] = gen_lowpart (SImode, operands[0]);
1386 operands[3] = gen_highpart (SImode, operands[0]);
1389 (define_insn "*zero_extendhisi2_cf"
1390 [(set (match_operand:SI 0 "register_operand" "=d")
1391 (zero_extend:SI (match_operand:HI 1 "nonimmediate_src_operand" "rmS")))]
1395 (define_insn "zero_extendhisi2"
1396 [(set (match_operand:SI 0 "register_operand" "=d")
1397 (zero_extend:SI (match_operand:HI 1 "nonimmediate_src_operand" "rmS")))]
1401 (define_expand "zero_extendqihi2"
1402 [(set (match_operand:HI 0 "register_operand" "")
1403 (zero_extend:HI (match_operand:QI 1 "nonimmediate_src_operand" "")))]
1407 (define_insn "*zero_extendqihi2"
1408 [(set (match_operand:HI 0 "register_operand" "=d")
1409 (zero_extend:HI (match_operand:QI 1 "nonimmediate_src_operand" "dmS")))]
1413 (define_insn "*zero_extendqisi2_cfv4"
1414 [(set (match_operand:SI 0 "register_operand" "=d")
1415 (zero_extend:SI (match_operand:QI 1 "nonimmediate_src_operand" "dmS")))]
1419 (define_insn "zero_extendqisi2"
1420 [(set (match_operand:SI 0 "register_operand" "=d")
1421 (zero_extend:SI (match_operand:QI 1 "nonimmediate_src_operand" "dmS")))]
1425 ;; these two pattern split everything else which isn't matched by
1426 ;; something else above
1428 [(set (match_operand 0 "register_operand" "")
1429 (zero_extend (match_operand 1 "nonimmediate_src_operand" "")))]
1432 && reg_mentioned_p (operands[0], operands[1])"
1433 [(set (strict_low_part (match_dup 2))
1436 (match_op_dup 4 [(match_dup 0) (match_dup 3)]))]
1438 operands[2] = gen_lowpart (GET_MODE (operands[1]), operands[0]);
1439 operands[3] = GEN_INT (GET_MODE_MASK (GET_MODE (operands[1])));
1440 operands[4] = gen_rtx_AND (GET_MODE (operands[0]), operands[0], operands[3]);
1444 [(set (match_operand 0 "register_operand" "")
1445 (zero_extend (match_operand 1 "nonimmediate_src_operand" "")))]
1446 "!TARGET_ISAB && reload_completed"
1449 (set (strict_low_part (match_dup 2))
1452 operands[2] = gen_lowpart (GET_MODE (operands[1]), operands[0]);
1455 ;; sign extension instructions
1457 (define_insn "extendqidi2"
1458 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
1459 (sign_extend:DI (match_operand:QI 1 "general_src_operand" "rmS")))]
1463 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1465 return "mvs%.b %1,%2\;smi %0\;extb%.l %0";
1466 if (TARGET_68020 || TARGET_COLDFIRE)
1468 if (ADDRESS_REG_P (operands[1]))
1469 return "move%.w %1,%2\;extb%.l %2\;smi %0\;extb%.l %0";
1471 return "move%.b %1,%2\;extb%.l %2\;smi %0\;extb%.l %0";
1475 if (ADDRESS_REG_P (operands[1]))
1476 return "move%.w %1,%2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0\;smi %0";
1478 return "move%.b %1,%2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0\;smi %0";
1482 (define_insn "extendhidi2"
1483 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
1485 (match_operand:HI 1 "general_src_operand" "rmS")))]
1489 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1491 return "mvs%.w %1,%2\;smi %0\;extb%.l %0";
1492 if (TARGET_68020 || TARGET_COLDFIRE)
1493 return "move%.w %1,%2\;ext%.l %2\;smi %0\;extb%.l %0";
1495 return "move%.w %1,%2\;ext%.l %2\;smi %0\;ext%.w %0\;ext%.l %0";
1498 (define_insn "extendsidi2"
1499 [(set (match_operand:DI 0 "register_operand" "=d")
1500 (sign_extend:DI (match_operand:SI 1 "nonimmediate_src_operand" "rm")))]
1504 if (TARGET_68020 || TARGET_COLDFIRE)
1505 return "move%.l %1,%R0\;smi %0\;extb%.l %0";
1507 return "move%.l %1,%R0\;smi %0\;ext%.w %0\;ext%.l %0";
1510 (define_insn "*extendsidi2_mem"
1511 [(set (match_operand:DI 0 "memory_operand" "=o,<")
1512 (sign_extend:DI (match_operand:SI 1 "nonimmediate_src_operand" "rm,rm")))
1513 (clobber (match_scratch:SI 2 "=d,d"))]
1517 operands[3] = adjust_address (operands[0], SImode,
1518 which_alternative == 0 ? 4 : 0);
1519 operands[0] = adjust_address (operands[0], SImode, 0);
1520 if (TARGET_68020 || TARGET_COLDFIRE)
1521 return "move%.l %1,%3\;smi %2\;extb%.l %2\;move%.l %2,%0";
1523 return "move%.l %1,%3\;smi %2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0";
1526 ;; Special case when one can avoid register clobbering, copy and test
1527 ;; Maybe there is a way to make that the general case, by forcing the
1528 ;; result of the SI tree to be in the lower register of the DI target
1530 (define_insn "extendplussidi"
1531 [(set (match_operand:DI 0 "register_operand" "=d")
1532 (sign_extend:DI (plus:SI (match_operand:SI 1 "general_operand" "%rmn")
1533 (match_operand:SI 2 "general_operand" "rmn"))))]
1537 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1538 if (GET_CODE (operands[1]) == CONST_INT
1539 && (unsigned) INTVAL (operands[1]) > 8)
1541 rtx tmp = operands[1];
1543 operands[1] = operands[2];
1546 if (GET_CODE (operands[1]) == REG
1547 && REGNO (operands[1]) == REGNO (operands[3]))
1548 output_asm_insn ("add%.l %2,%3", operands);
1550 output_asm_insn ("move%.l %2,%3\;add%.l %1,%3", operands);
1551 if (TARGET_68020 || TARGET_COLDFIRE)
1552 return "smi %0\;extb%.l %0";
1554 return "smi %0\;ext%.w %0\;ext%.l %0";
1557 (define_expand "extendhisi2"
1558 [(set (match_operand:SI 0 "nonimmediate_operand" "")
1560 (match_operand:HI 1 "nonimmediate_src_operand" "")))]
1564 (define_insn "*cfv4_extendhisi2"
1565 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
1567 (match_operand:HI 1 "nonimmediate_src_operand" "rmS")))]
1571 (define_insn "*68k_extendhisi2"
1572 [(set (match_operand:SI 0 "nonimmediate_operand" "=*d,a")
1574 (match_operand:HI 1 "nonimmediate_src_operand" "0,rmS")))]
1577 if (ADDRESS_REG_P (operands[0]))
1578 return "move%.w %1,%0";
1582 (define_insn "extendqihi2"
1583 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
1584 (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0")))]
1588 (define_expand "extendqisi2"
1589 [(set (match_operand:SI 0 "nonimmediate_operand" "")
1590 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
1591 "TARGET_68020 || TARGET_COLDFIRE"
1594 (define_insn "*cfv4_extendqisi2"
1595 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
1596 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "rms")))]
1600 (define_insn "*68k_extendqisi2"
1601 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
1602 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "0")))]
1603 "TARGET_68020 || (TARGET_COLDFIRE && !TARGET_ISAB)"
1606 ;; Conversions between float and double.
1608 (define_expand "extendsfdf2"
1609 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1611 (match_operand:SF 1 "general_operand" "")))]
1616 [(set (match_operand:DF 0 "nonimmediate_operand" "=*fdm,f")
1618 (match_operand:SF 1 "general_operand" "f,dmF")))]
1621 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
1623 if (REGNO (operands[0]) == REGNO (operands[1]))
1625 /* Extending float to double in an fp-reg is a no-op.
1626 NOTICE_UPDATE_CC has already assumed that the
1627 cc will be set. So cancel what it did. */
1628 cc_status = cc_prev_status;
1631 return "f%&move%.x %1,%0";
1633 if (FP_REG_P (operands[0]))
1634 return "f%&move%.s %f1,%0";
1635 if (DATA_REG_P (operands[0]) && FP_REG_P (operands[1]))
1637 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
1638 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1639 return "move%.l %+,%0";
1641 return "fmove%.d %f1,%0";
1644 (define_insn "extendsfdf2_cf"
1645 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f")
1647 (match_operand:SF 1 "general_operand" "f,<Q>U")))]
1648 "TARGET_COLDFIRE_FPU"
1650 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
1652 if (REGNO (operands[0]) == REGNO (operands[1]))
1654 /* Extending float to double in an fp-reg is a no-op.
1655 NOTICE_UPDATE_CC has already assumed that the
1656 cc will be set. So cancel what it did. */
1657 cc_status = cc_prev_status;
1660 return "fdmove%.d %1,%0";
1662 return "fdmove%.s %f1,%0";
1665 ;; This cannot output into an f-reg because there is no way to be
1666 ;; sure of truncating in that case.
1667 (define_expand "truncdfsf2"
1668 [(set (match_operand:SF 0 "nonimmediate_operand" "")
1670 (match_operand:DF 1 "general_operand" "")))]
1674 ;; On the '040 we can truncate in a register accurately and easily.
1676 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
1678 (match_operand:DF 1 "general_operand" "fmG")))]
1679 "TARGET_68881 && TARGET_68040"
1681 if (FP_REG_P (operands[1]))
1682 return "f%$move%.x %1,%0";
1683 return "f%$move%.d %f1,%0";
1686 (define_insn "truncdfsf2_cf"
1687 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,d<Q>U")
1689 (match_operand:DF 1 "general_operand" "<Q>U,f")))]
1690 "TARGET_COLDFIRE_FPU"
1696 [(set (match_operand:SF 0 "nonimmediate_operand" "=dm")
1698 (match_operand:DF 1 "general_operand" "f")))]
1702 ;; Conversion between fixed point and floating point.
1703 ;; Note that among the fix-to-float insns
1704 ;; the ones that start with SImode come first.
1705 ;; That is so that an operand that is a CONST_INT
1706 ;; (and therefore lacks a specific machine mode).
1707 ;; will be recognized as SImode (which is always valid)
1708 ;; rather than as QImode or HImode.
1710 (define_expand "floatsi<mode>2"
1711 [(set (match_operand:FP 0 "nonimmediate_operand" "")
1712 (float:FP (match_operand:SI 1 "general_operand" "")))]
1716 (define_insn "floatsi<mode>2_68881"
1717 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1718 (float:FP (match_operand:SI 1 "general_operand" "dmi")))]
1720 "f<FP:round>move%.l %1,%0")
1722 (define_insn "floatsi<mode>2_cf"
1723 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1724 (float:FP (match_operand:SI 1 "general_operand" "d<Q>U")))]
1725 "TARGET_COLDFIRE_FPU"
1726 "f<FP:prec>move%.l %1,%0")
1729 (define_expand "floathi<mode>2"
1730 [(set (match_operand:FP 0 "nonimmediate_operand" "")
1731 (float:FP (match_operand:HI 1 "general_operand" "")))]
1735 (define_insn "floathi<mode>2_68881"
1736 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1737 (float:FP (match_operand:HI 1 "general_operand" "dmn")))]
1741 (define_insn "floathi<mode>2_cf"
1742 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1743 (float:FP (match_operand:HI 1 "general_operand" "d<Q>U")))]
1744 "TARGET_COLDFIRE_FPU"
1748 (define_expand "floatqi<mode>2"
1749 [(set (match_operand:FP 0 "nonimmediate_operand" "")
1750 (float:FP (match_operand:QI 1 "general_operand" "")))]
1754 (define_insn "floatqi<mode>2_68881"
1755 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1756 (float:FP (match_operand:QI 1 "general_operand" "dmn")))]
1760 (define_insn "floatqi<mode>2_cf"
1761 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1762 (float:FP (match_operand:QI 1 "general_operand" "d<Q>U")))]
1763 "TARGET_COLDFIRE_FPU"
1767 ;; New routines to convert floating-point values to integers
1768 ;; to be used on the '040. These should be faster than trapping
1769 ;; into the kernel to emulate fintrz. They should also be faster
1770 ;; than calling the subroutines fixsfsi or fixdfsi.
1772 (define_insn "fix_truncdfsi2"
1773 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
1774 (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
1775 (clobber (match_scratch:SI 2 "=d"))
1776 (clobber (match_scratch:SI 3 "=d"))]
1777 "TARGET_68881 && TUNE_68040"
1780 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,%!";
1783 (define_insn "fix_truncdfhi2"
1784 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
1785 (fix:HI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
1786 (clobber (match_scratch:SI 2 "=d"))
1787 (clobber (match_scratch:SI 3 "=d"))]
1788 "TARGET_68881 && TUNE_68040"
1791 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,%!";
1794 (define_insn "fix_truncdfqi2"
1795 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
1796 (fix:QI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
1797 (clobber (match_scratch:SI 2 "=d"))
1798 (clobber (match_scratch:SI 3 "=d"))]
1799 "TARGET_68881 && TUNE_68040"
1802 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,%!";
1805 ;; Convert a float to a float whose value is an integer.
1806 ;; This is the first stage of converting it to an integer type.
1808 (define_expand "ftrunc<mode>2"
1809 [(set (match_operand:FP 0 "nonimmediate_operand" "")
1810 (fix:FP (match_operand:FP 1 "general_operand" "")))]
1811 "TARGET_HARD_FLOAT && !TUNE_68040"
1814 (define_insn "ftrunc<mode>2_68881"
1815 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1816 (fix:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m")))]
1817 "TARGET_68881 && !TUNE_68040"
1819 if (FP_REG_P (operands[1]))
1820 return "fintrz%.x %f1,%0";
1821 return "fintrz%.<FP:prec> %f1,%0";
1824 (define_insn "ftrunc<mode>2_cf"
1825 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1826 (fix:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U")))]
1827 "TARGET_COLDFIRE_FPU"
1829 if (FP_REG_P (operands[1]))
1830 return "fintrz%.d %f1,%0";
1831 return "fintrz%.<FP:prec> %f1,%0";
1834 ;; Convert a float whose value is an integer
1835 ;; to an actual integer. Second stage of converting float to integer type.
1836 (define_expand "fix<mode>qi2"
1837 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1838 (fix:QI (match_operand:FP 1 "general_operand" "")))]
1842 (define_insn "fix<mode>qi2_68881"
1843 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
1844 (fix:QI (match_operand:FP 1 "general_operand" "f")))]
1848 (define_insn "fix<mode>qi2_cf"
1849 [(set (match_operand:QI 0 "nonimmediate_operand" "=d<Q>U")
1850 (fix:QI (match_operand:FP 1 "general_operand" "f")))]
1851 "TARGET_COLDFIRE_FPU"
1854 (define_expand "fix<mode>hi2"
1855 [(set (match_operand:HI 0 "nonimmediate_operand" "")
1856 (fix:HI (match_operand:FP 1 "general_operand" "")))]
1860 (define_insn "fix<mode>hi2_68881"
1861 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
1862 (fix:HI (match_operand:FP 1 "general_operand" "f")))]
1866 (define_insn "fix<mode>hi2_cf"
1867 [(set (match_operand:HI 0 "nonimmediate_operand" "=d<Q>U")
1868 (fix:HI (match_operand:FP 1 "general_operand" "f")))]
1869 "TARGET_COLDFIRE_FPU"
1872 (define_expand "fix<mode>si2"
1873 [(set (match_operand:SI 0 "nonimmediate_operand" "")
1874 (fix:SI (match_operand:FP 1 "general_operand" "")))]
1878 (define_insn "fix<mode>si2_68881"
1879 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
1880 (fix:SI (match_operand:FP 1 "general_operand" "f")))]
1884 (define_insn "fix<mode>si2_cf"
1885 [(set (match_operand:SI 0 "nonimmediate_operand" "=d<Q>U")
1886 (fix:SI (match_operand:FP 1 "general_operand" "f")))]
1887 "TARGET_COLDFIRE_FPU"
1893 (define_insn "adddi_lshrdi_63"
1894 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
1895 (plus:DI (lshiftrt:DI (match_operand:DI 1 "general_operand" "rm")
1898 (clobber (match_scratch:SI 2 "=d"))]
1901 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1902 if (REG_P (operands[1]) && REGNO (operands[1]) == REGNO (operands[0]))
1904 "move%.l %1,%2\;add%.l %2,%2\;subx%.l %2,%2\;sub%.l %2,%3\;subx%.l %2,%0";
1905 if (GET_CODE (operands[1]) == REG)
1906 operands[4] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1907 else if (GET_CODE (XEXP (operands[1], 0)) == POST_INC
1908 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
1909 operands[4] = operands[1];
1911 operands[4] = adjust_address (operands[1], SImode, 4);
1912 if (GET_CODE (operands[1]) == MEM
1913 && GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
1914 output_asm_insn ("move%.l %4,%3", operands);
1915 output_asm_insn ("move%.l %1,%0\;smi %2", operands);
1916 if (TARGET_68020 || TARGET_COLDFIRE)
1917 output_asm_insn ("extb%.l %2", operands);
1919 output_asm_insn ("ext%.w %2\;ext%.l %2", operands);
1920 if (GET_CODE (operands[1]) != MEM
1921 || GET_CODE (XEXP (operands[1], 0)) != PRE_DEC)
1922 output_asm_insn ("move%.l %4,%3", operands);
1923 return "sub%.l %2,%3\;subx%.l %2,%0";
1926 (define_insn "adddi_sexthishl32"
1927 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,a,*d,*d")
1928 (plus:DI (ashift:DI (sign_extend:DI
1929 (match_operand:HI 1 "general_operand" "rm,rm,rm,rm"))
1931 (match_operand:DI 2 "general_operand" "0,0,0,0")))
1932 (clobber (match_scratch:SI 3 "=&d,X,a,?d"))]
1936 if (ADDRESS_REG_P (operands[0]))
1937 return "add%.w %1,%0";
1938 else if (ADDRESS_REG_P (operands[3]))
1939 return "move%.w %1,%3\;add%.l %3,%0";
1941 return "move%.w %1,%3\;ext%.l %3\;add%.l %3,%0";
1944 (define_insn "*adddi_dilshr32"
1945 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,o")
1946 (plus:DI (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro,d")
1948 (match_operand:DI 2 "general_operand" "0,0")))]
1952 if (GET_CODE (operands[0]) == REG)
1953 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1955 operands[2] = adjust_address (operands[0], SImode, 4);
1956 return "add%.l %1,%2\;negx%.l %0\;neg%.l %0";
1959 (define_insn "*adddi_dilshr32_cf"
1960 [(set (match_operand:DI 0 "register_operand" "=d")
1961 (plus:DI (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "ro")
1963 (match_operand:DI 2 "register_operand" "0")))]
1967 return "add%.l %1,%R0\;negx%.l %0\;neg%.l %0";
1970 (define_insn "adddi_dishl32"
1971 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o")
1972 ;; (plus:DI (match_operand:DI 2 "general_operand" "%0")
1973 ;; (ashift:DI (match_operand:DI 1 "general_operand" "ro")
1974 ;; (const_int 32))))]
1975 (plus:DI (ashift:DI (match_operand:DI 1 "general_operand" "ro,d")
1977 (match_operand:DI 2 "general_operand" "0,0")))]
1981 if (GET_CODE (operands[1]) == REG)
1982 operands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1984 operands[1] = adjust_address (operands[1], SImode, 4);
1985 return "add%.l %1,%0";
1988 (define_insn "adddi3"
1989 [(set (match_operand:DI 0 "nonimmediate_operand" "=o<>,d,d,d")
1990 (plus:DI (match_operand:DI 1 "general_operand" "%0,0,0,0")
1991 (match_operand:DI 2 "general_operand" "d,no>,d,a")))
1992 (clobber (match_scratch:SI 3 "=&d,&d,X,&d"))]
1995 if (DATA_REG_P (operands[0]))
1997 if (DATA_REG_P (operands[2]))
1998 return "add%.l %R2,%R0\;addx%.l %2,%0";
1999 else if (GET_CODE (operands[2]) == MEM
2000 && GET_CODE (XEXP (operands[2], 0)) == POST_INC)
2001 return "move%.l %2,%3\;add%.l %2,%R0\;addx%.l %3,%0";
2007 if (GET_CODE (operands[2]) == REG)
2009 low = gen_rtx_REG (SImode, REGNO (operands[2]) + 1);
2012 else if (CONSTANT_P (operands[2]))
2013 split_double (operands[2], &high, &low);
2016 low = adjust_address (operands[2], SImode, 4);
2020 operands[1] = low, operands[2] = high;
2021 xoperands[0] = operands[3];
2022 if (GET_CODE (operands[1]) == CONST_INT
2023 && INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
2024 xoperands[1] = GEN_INT (-INTVAL (operands[2]) - 1);
2026 xoperands[1] = operands[2];
2028 output_asm_insn (output_move_simode (xoperands), xoperands);
2029 if (GET_CODE (operands[1]) == CONST_INT)
2031 if (INTVAL (operands[1]) > 0 && INTVAL (operands[1]) <= 8)
2032 return "addq%.l %1,%R0\;addx%.l %3,%0";
2033 else if (INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
2035 operands[1] = GEN_INT (-INTVAL (operands[1]));
2036 return "subq%.l %1,%R0\;subx%.l %3,%0";
2039 return "add%.l %1,%R0\;addx%.l %3,%0";
2044 gcc_assert (GET_CODE (operands[0]) == MEM);
2046 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
2048 operands[1] = gen_rtx_MEM (SImode,
2049 plus_constant (XEXP(operands[0], 0), -8));
2050 return "move%.l %0,%3\;add%.l %R2,%0\;addx%.l %2,%3\;move%.l %3,%1";
2052 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
2054 operands[1] = XEXP(operands[0], 0);
2055 return "add%.l %R2,%0\;move%.l %0,%3\;addx%.l %2,%3\;move%.l %3,%1";
2059 operands[1] = adjust_address (operands[0], SImode, 4);
2060 return "add%.l %R2,%1\;move%.l %0,%3\;addx%.l %2,%3\;move%.l %3,%0";
2065 (define_insn "addsi_lshrsi_31"
2066 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
2067 (plus:SI (lshiftrt:SI (match_operand:SI 1 "general_operand" "rm")
2072 operands[2] = operands[0];
2073 operands[3] = gen_label_rtx();
2074 if (GET_CODE (operands[0]) == MEM)
2076 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
2077 operands[0] = gen_rtx_MEM (SImode, XEXP (XEXP (operands[0], 0), 0));
2078 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
2079 operands[2] = gen_rtx_MEM (SImode, XEXP (XEXP (operands[0], 0), 0));
2081 output_asm_insn ("move%.l %1,%0", operands);
2082 output_asm_insn (MOTOROLA ? "jbpl %l3" : "jpl %l3", operands);
2083 output_asm_insn ("addq%.l #1,%2", operands);
2084 (*targetm.asm_out.internal_label) (asm_out_file, "L",
2085 CODE_LABEL_NUMBER (operands[3]));
2089 (define_expand "addsi3"
2090 [(set (match_operand:SI 0 "nonimmediate_operand" "")
2091 (plus:SI (match_operand:SI 1 "general_operand" "")
2092 (match_operand:SI 2 "general_src_operand" "")))]
2096 ;; Note that the middle two alternatives are near-duplicates
2097 ;; in order to handle insns generated by reload.
2098 ;; This is needed since they are not themselves reloaded,
2099 ;; so commutativity won't apply to them.
2100 (define_insn "*addsi3_internal"
2101 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,?a,?a,d,a")
2102 (plus:SI (match_operand:SI 1 "general_operand" "%0,a,rJK,0,0")
2103 (match_operand:SI 2 "general_src_operand" "dIKLT,rJK,a,mSrIKLT,mSrIKLs")))]
2107 "* return output_addsi3 (operands);")
2109 (define_insn "*addsi3_5200"
2110 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,?a,?a,r")
2111 (plus:SI (match_operand:SI 1 "general_operand" "%0,a,rJK,0")
2112 (match_operand:SI 2 "general_src_operand" "dIL,rJK,a,mrIKLi")))]
2114 "* return output_addsi3 (operands);")
2117 [(set (match_operand:SI 0 "nonimmediate_operand" "=a")
2118 (plus:SI (match_operand:SI 1 "general_operand" "0")
2120 (match_operand:HI 2 "nonimmediate_src_operand" "rmS"))))]
2124 (define_insn "addhi3"
2125 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,r")
2126 (plus:HI (match_operand:HI 1 "general_operand" "%0,0")
2127 (match_operand:HI 2 "general_src_operand" "dn,rmSn")))]
2130 if (GET_CODE (operands[2]) == CONST_INT)
2132 /* If the constant would be a negative number when interpreted as
2133 HImode, make it negative. This is usually, but not always, done
2134 elsewhere in the compiler. First check for constants out of range,
2135 which could confuse us. */
2137 if (INTVAL (operands[2]) >= 32768)
2138 operands[2] = GEN_INT (INTVAL (operands[2]) - 65536);
2140 if (INTVAL (operands[2]) > 0
2141 && INTVAL (operands[2]) <= 8)
2142 return "addq%.w %2,%0";
2143 if (INTVAL (operands[2]) < 0
2144 && INTVAL (operands[2]) >= -8)
2146 operands[2] = GEN_INT (- INTVAL (operands[2]));
2147 return "subq%.w %2,%0";
2149 /* On the CPU32 it is faster to use two addqw instructions to
2150 add a small integer (8 < N <= 16) to a register.
2151 Likewise for subqw. */
2152 if (TUNE_CPU32 && REG_P (operands[0]))
2154 if (INTVAL (operands[2]) > 8
2155 && INTVAL (operands[2]) <= 16)
2157 operands[2] = GEN_INT (INTVAL (operands[2]) - 8);
2158 return "addq%.w #8,%0\;addq%.w %2,%0";
2160 if (INTVAL (operands[2]) < -8
2161 && INTVAL (operands[2]) >= -16)
2163 operands[2] = GEN_INT (- INTVAL (operands[2]) - 8);
2164 return "subq%.w #8,%0\;subq%.w %2,%0";
2167 if (ADDRESS_REG_P (operands[0]) && !TUNE_68040)
2168 return MOTOROLA ? "lea (%c2,%0),%0" : "lea %0@(%c2),%0";
2170 return "add%.w %2,%0";
2173 ;; These insns must use MATCH_DUP instead of the more expected
2174 ;; use of a matching constraint because the "output" here is also
2175 ;; an input, so you can't use the matching constraint. That also means
2176 ;; that you can't use the "%", so you need patterns with the matched
2177 ;; operand in both positions.
2180 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
2181 (plus:HI (match_dup 0)
2182 (match_operand:HI 1 "general_src_operand" "dn,rmSn")))]
2185 if (GET_CODE (operands[1]) == CONST_INT)
2187 /* If the constant would be a negative number when interpreted as
2188 HImode, make it negative. This is usually, but not always, done
2189 elsewhere in the compiler. First check for constants out of range,
2190 which could confuse us. */
2192 if (INTVAL (operands[1]) >= 32768)
2193 operands[1] = GEN_INT (INTVAL (operands[1]) - 65536);
2195 if (INTVAL (operands[1]) > 0
2196 && INTVAL (operands[1]) <= 8)
2197 return "addq%.w %1,%0";
2198 if (INTVAL (operands[1]) < 0
2199 && INTVAL (operands[1]) >= -8)
2201 operands[1] = GEN_INT (- INTVAL (operands[1]));
2202 return "subq%.w %1,%0";
2204 /* On the CPU32 it is faster to use two addqw instructions to
2205 add a small integer (8 < N <= 16) to a register.
2206 Likewise for subqw. */
2207 if (TUNE_CPU32 && REG_P (operands[0]))
2209 if (INTVAL (operands[1]) > 8
2210 && INTVAL (operands[1]) <= 16)
2212 operands[1] = GEN_INT (INTVAL (operands[1]) - 8);
2213 return "addq%.w #8,%0\;addq%.w %1,%0";
2215 if (INTVAL (operands[1]) < -8
2216 && INTVAL (operands[1]) >= -16)
2218 operands[1] = GEN_INT (- INTVAL (operands[1]) - 8);
2219 return "subq%.w #8,%0\;subq%.w %1,%0";
2222 if (ADDRESS_REG_P (operands[0]) && !TUNE_68040)
2223 return MOTOROLA ? "lea (%c1,%0),%0" : "lea %0@(%c1),%0";
2225 return "add%.w %1,%0";
2229 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
2230 (plus:HI (match_operand:HI 1 "general_src_operand" "dn,rmSn")
2234 if (GET_CODE (operands[1]) == CONST_INT)
2236 /* If the constant would be a negative number when interpreted as
2237 HImode, make it negative. This is usually, but not always, done
2238 elsewhere in the compiler. First check for constants out of range,
2239 which could confuse us. */
2241 if (INTVAL (operands[1]) >= 32768)
2242 operands[1] = GEN_INT (INTVAL (operands[1]) - 65536);
2244 if (INTVAL (operands[1]) > 0
2245 && INTVAL (operands[1]) <= 8)
2246 return "addq%.w %1,%0";
2247 if (INTVAL (operands[1]) < 0
2248 && INTVAL (operands[1]) >= -8)
2250 operands[1] = GEN_INT (- INTVAL (operands[1]));
2251 return "subq%.w %1,%0";
2253 /* On the CPU32 it is faster to use two addqw instructions to
2254 add a small integer (8 < N <= 16) to a register.
2255 Likewise for subqw. */
2256 if (TUNE_CPU32 && REG_P (operands[0]))
2258 if (INTVAL (operands[1]) > 8
2259 && INTVAL (operands[1]) <= 16)
2261 operands[1] = GEN_INT (INTVAL (operands[1]) - 8);
2262 return "addq%.w #8,%0\;addq%.w %1,%0";
2264 if (INTVAL (operands[1]) < -8
2265 && INTVAL (operands[1]) >= -16)
2267 operands[1] = GEN_INT (- INTVAL (operands[1]) - 8);
2268 return "subq%.w #8,%0\;subq%.w %1,%0";
2271 if (ADDRESS_REG_P (operands[0]) && !TUNE_68040)
2272 return MOTOROLA ? "lea (%c1,%0),%0" : "lea %0@(%c1),%0";
2274 return "add%.w %1,%0";
2277 (define_insn "addqi3"
2278 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
2279 (plus:QI (match_operand:QI 1 "general_operand" "%0,0")
2280 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
2283 if (GET_CODE (operands[2]) == CONST_INT)
2285 if (INTVAL (operands[2]) >= 128)
2286 operands[2] = GEN_INT (INTVAL (operands[2]) - 256);
2288 if (INTVAL (operands[2]) > 0
2289 && INTVAL (operands[2]) <= 8)
2290 return "addq%.b %2,%0";
2291 if (INTVAL (operands[2]) < 0 && INTVAL (operands[2]) >= -8)
2293 operands[2] = GEN_INT (- INTVAL (operands[2]));
2294 return "subq%.b %2,%0";
2297 return "add%.b %2,%0";
2301 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
2302 (plus:QI (match_dup 0)
2303 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
2306 if (GET_CODE (operands[1]) == CONST_INT)
2308 if (INTVAL (operands[1]) >= 128)
2309 operands[1] = GEN_INT (INTVAL (operands[1]) - 256);
2311 if (INTVAL (operands[1]) > 0
2312 && INTVAL (operands[1]) <= 8)
2313 return "addq%.b %1,%0";
2314 if (INTVAL (operands[1]) < 0 && INTVAL (operands[1]) >= -8)
2316 operands[1] = GEN_INT (- INTVAL (operands[1]));
2317 return "subq%.b %1,%0";
2320 return "add%.b %1,%0";
2324 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
2325 (plus:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn")
2329 if (GET_CODE (operands[1]) == CONST_INT)
2331 if (INTVAL (operands[1]) >= 128)
2332 operands[1] = GEN_INT (INTVAL (operands[1]) - 256);
2334 if (INTVAL (operands[1]) > 0
2335 && INTVAL (operands[1]) <= 8)
2336 return "addq%.b %1,%0";
2337 if (INTVAL (operands[1]) < 0 && INTVAL (operands[1]) >= -8)
2339 operands[1] = GEN_INT (- INTVAL (operands[1]));
2340 return "subq%.b %1,%0";
2343 return "add%.b %1,%0";
2346 (define_expand "add<mode>3"
2347 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2348 (plus:FP (match_operand:FP 1 "general_operand" "")
2349 (match_operand:FP 2 "general_operand" "")))]
2353 (define_insn "add<mode>3_floatsi_68881"
2354 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2355 (plus:FP (float:FP (match_operand:SI 2 "general_operand" "dmi"))
2356 (match_operand:FP 1 "general_operand" "0")))]
2358 "f<FP:round>add%.l %2,%0")
2360 (define_insn "add<mode>3_floathi_68881"
2361 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2362 (plus:FP (float:FP (match_operand:HI 2 "general_operand" "dmn"))
2363 (match_operand:FP 1 "general_operand" "0")))]
2365 "f<FP:round>add%.w %2,%0")
2367 (define_insn "add<mode>3_floatqi_68881"
2368 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2369 (plus:FP (float:FP (match_operand:QI 2 "general_operand" "dmn"))
2370 (match_operand:FP 1 "general_operand" "0")))]
2372 "f<FP:round>add%.b %2,%0")
2374 (define_insn "add<mode>3_68881"
2375 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2376 (plus:FP (match_operand:FP 1 "general_operand" "%0")
2377 (match_operand:FP 2 "general_operand" "f<FP:dreg>m<FP:const>")))]
2380 if (FP_REG_P (operands[2]))
2381 return "f<FP:round>add%.x %2,%0";
2382 return "f<FP:round>add%.<FP:prec> %f2,%0";
2385 (define_insn "add<mode>3_cf"
2386 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2387 (plus:FP (match_operand:FP 1 "general_operand" "%0")
2388 (match_operand:FP 2 "general_operand" "f<FP:dreg><Q>U")))]
2389 "TARGET_COLDFIRE_FPU"
2391 if (FP_REG_P (operands[2]))
2392 return "f<FP:prec>add%.d %2,%0";
2393 return "f<FP:prec>add%.<FP:prec> %2,%0";
2396 ;; subtract instructions
2398 (define_insn "subdi_sexthishl32"
2399 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,a,*d,*d")
2400 (minus:DI (match_operand:DI 1 "general_operand" "0,0,0,0")
2401 (ashift:DI (sign_extend:DI (match_operand:HI 2 "general_operand" "rm,rm,rm,rm"))
2403 (clobber (match_scratch:SI 3 "=&d,X,a,?d"))]
2407 if (ADDRESS_REG_P (operands[0]))
2408 return "sub%.w %2,%0";
2409 else if (ADDRESS_REG_P (operands[3]))
2410 return "move%.w %2,%3\;sub%.l %3,%0";
2412 return "move%.w %2,%3\;ext%.l %3\;sub%.l %3,%0";
2415 (define_insn "subdi_dishl32"
2416 [(set (match_operand:DI 0 "nonimmediate_operand" "+ro")
2417 (minus:DI (match_dup 0)
2418 (ashift:DI (match_operand:DI 1 "general_operand" "ro")
2423 if (GET_CODE (operands[1]) == REG)
2424 operands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
2426 operands[1] = adjust_address (operands[1], SImode, 4);
2427 return "sub%.l %1,%0";
2430 (define_insn "subdi3"
2431 [(set (match_operand:DI 0 "nonimmediate_operand" "=o<>,d,d,d")
2432 (minus:DI (match_operand:DI 1 "general_operand" "0,0,0,0")
2433 (match_operand:DI 2 "general_operand" "d,no>,d,a")))
2434 (clobber (match_scratch:SI 3 "=&d,&d,X,&d"))]
2437 if (DATA_REG_P (operands[0]))
2439 if (DATA_REG_P (operands[2]))
2440 return "sub%.l %R2,%R0\;subx%.l %2,%0";
2441 else if (GET_CODE (operands[2]) == MEM
2442 && GET_CODE (XEXP (operands[2], 0)) == POST_INC)
2444 return "move%.l %2,%3\;sub%.l %2,%R0\;subx%.l %3,%0";
2451 if (GET_CODE (operands[2]) == REG)
2453 low = gen_rtx_REG (SImode, REGNO (operands[2]) + 1);
2456 else if (CONSTANT_P (operands[2]))
2457 split_double (operands[2], &high, &low);
2460 low = adjust_address (operands[2], SImode, 4);
2464 operands[1] = low, operands[2] = high;
2465 xoperands[0] = operands[3];
2466 if (GET_CODE (operands[1]) == CONST_INT
2467 && INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
2468 xoperands[1] = GEN_INT (-INTVAL (operands[2]) - 1);
2470 xoperands[1] = operands[2];
2472 output_asm_insn (output_move_simode (xoperands), xoperands);
2473 if (GET_CODE (operands[1]) == CONST_INT)
2475 if (INTVAL (operands[1]) > 0 && INTVAL (operands[1]) <= 8)
2476 return "subq%.l %1,%R0\;subx%.l %3,%0";
2477 else if (INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
2479 operands[1] = GEN_INT (-INTVAL (operands[1]));
2480 return "addq%.l %1,%R0\;addx%.l %3,%0";
2483 return "sub%.l %1,%R0\;subx%.l %3,%0";
2488 gcc_assert (GET_CODE (operands[0]) == MEM);
2490 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
2493 = gen_rtx_MEM (SImode, plus_constant (XEXP (operands[0], 0), -8));
2494 return "move%.l %0,%3\;sub%.l %R2,%0\;subx%.l %2,%3\;move%.l %3,%1";
2496 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
2498 operands[1] = XEXP(operands[0], 0);
2499 return "sub%.l %R2,%0\;move%.l %0,%3\;subx%.l %2,%3\;move%.l %3,%1";
2503 operands[1] = adjust_address (operands[0], SImode, 4);
2504 return "sub%.l %R2,%1\;move%.l %0,%3\;subx%.l %2,%3\;move%.l %3,%0";
2509 (define_insn "subsi3"
2510 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,d,a")
2511 (minus:SI (match_operand:SI 1 "general_operand" "0,0,0")
2512 (match_operand:SI 2 "general_src_operand" "dT,mSrT,mSrs")))]
2517 [(set (match_operand:SI 0 "nonimmediate_operand" "=a")
2518 (minus:SI (match_operand:SI 1 "general_operand" "0")
2520 (match_operand:HI 2 "nonimmediate_src_operand" "rmS"))))]
2524 (define_insn "subhi3"
2525 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,r")
2526 (minus:HI (match_operand:HI 1 "general_operand" "0,0")
2527 (match_operand:HI 2 "general_src_operand" "dn,rmSn")))]
2532 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
2533 (minus:HI (match_dup 0)
2534 (match_operand:HI 1 "general_src_operand" "dn,rmSn")))]
2538 (define_insn "subqi3"
2539 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
2540 (minus:QI (match_operand:QI 1 "general_operand" "0,0")
2541 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
2546 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
2547 (minus:QI (match_dup 0)
2548 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
2552 (define_expand "sub<mode>3"
2553 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2554 (minus:FP (match_operand:FP 1 "general_operand" "")
2555 (match_operand:FP 2 "general_operand" "")))]
2559 (define_insn "sub<mode>3_floatsi_68881"
2560 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2561 (minus:FP (match_operand:FP 1 "general_operand" "0")
2562 (float:FP (match_operand:SI 2 "general_operand" "dmi"))))]
2564 "f<FP:round>sub%.l %2,%0")
2566 (define_insn "sub<mode>3_floathi_68881"
2567 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2568 (minus:FP (match_operand:FP 1 "general_operand" "0")
2569 (float:FP (match_operand:HI 2 "general_operand" "dmn"))))]
2571 "f<FP:round>sub%.w %2,%0")
2573 (define_insn "sub<mode>3_floatqi_68881"
2574 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2575 (minus:FP (match_operand:FP 1 "general_operand" "0")
2576 (float:FP (match_operand:QI 2 "general_operand" "dmn"))))]
2578 "f<FP:round>sub%.b %2,%0")
2580 (define_insn "sub<mode>3_68881"
2581 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2582 (minus:FP (match_operand:FP 1 "general_operand" "0")
2583 (match_operand:FP 2 "general_operand" "f<FP:dreg>m<FP:const>")))]
2586 if (FP_REG_P (operands[2]))
2587 return "f<FP:round>sub%.x %2,%0";
2588 return "f<FP:round>sub%.<FP:prec> %f2,%0";
2591 (define_insn "sub<mode>3_cf"
2592 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2593 (minus:FP (match_operand:FP 1 "general_operand" "0")
2594 (match_operand:FP 2 "general_operand" "f<FP:dreg><Q>U")))]
2595 "TARGET_COLDFIRE_FPU"
2597 if (FP_REG_P (operands[2]))
2598 return "f<FP:prec>sub%.d %2,%0";
2599 return "f<FP:prec>sub%.<FP:prec> %2,%0";
2602 ;; multiply instructions
2604 (define_insn "mulhi3"
2605 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
2606 (mult:HI (match_operand:HI 1 "general_operand" "%0")
2607 (match_operand:HI 2 "general_src_operand" "dmSn")))]
2610 return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0";
2613 (define_insn "mulhisi3"
2614 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2615 (mult:SI (sign_extend:SI
2616 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2618 (match_operand:HI 2 "nonimmediate_src_operand" "dmS"))))]
2621 return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0";
2625 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2626 (mult:SI (sign_extend:SI
2627 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2628 (match_operand:SI 2 "const_int_operand" "n")))]
2629 "INTVAL (operands[2]) >= -0x8000 && INTVAL (operands[2]) <= 0x7fff"
2631 return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0";
2634 (define_expand "mulsi3"
2635 [(set (match_operand:SI 0 "nonimmediate_operand" "")
2636 (mult:SI (match_operand:SI 1 "general_operand" "")
2637 (match_operand:SI 2 "general_operand" "")))]
2638 "TARGET_68020 || TARGET_COLDFIRE"
2642 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2643 (mult:SI (match_operand:SI 1 "general_operand" "%0")
2644 (match_operand:SI 2 "general_src_operand" "dmSTK")))]
2650 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2651 (mult:SI (match_operand:SI 1 "general_operand" "%0")
2652 (match_operand:SI 2 "general_operand" "d<Q>")))]
2656 (define_insn "umulhisi3"
2657 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2658 (mult:SI (zero_extend:SI
2659 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2661 (match_operand:HI 2 "nonimmediate_src_operand" "dmS"))))]
2664 return MOTOROLA ? "mulu%.w %2,%0" : "mulu %2,%0";
2668 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2669 (mult:SI (zero_extend:SI
2670 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2671 (match_operand:SI 2 "const_int_operand" "n")))]
2672 "INTVAL (operands[2]) >= 0 && INTVAL (operands[2]) <= 0xffff"
2674 return MOTOROLA ? "mulu%.w %2,%0" : "mulu %2,%0";
2677 ;; We need a separate DEFINE_EXPAND for u?mulsidi3 to be able to use the
2678 ;; proper matching constraint. This is because the matching is between
2679 ;; the high-numbered word of the DImode operand[0] and operand[1].
2680 (define_expand "umulsidi3"
2682 [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 4)
2683 (mult:SI (match_operand:SI 1 "register_operand" "")
2684 (match_operand:SI 2 "register_operand" "")))
2685 (set (subreg:SI (match_dup 0) 0)
2686 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
2687 (zero_extend:DI (match_dup 2)))
2688 (const_int 32))))])]
2689 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2693 [(set (match_operand:SI 0 "register_operand" "=d")
2694 (mult:SI (match_operand:SI 1 "register_operand" "%0")
2695 (match_operand:SI 2 "nonimmediate_operand" "dm")))
2696 (set (match_operand:SI 3 "register_operand" "=d")
2697 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
2698 (zero_extend:DI (match_dup 2)))
2700 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2703 ; Match immediate case. For 2.4 only match things < 2^31.
2704 ; It's tricky with larger values in these patterns since we need to match
2705 ; values between the two parallel multiplies, between a CONST_DOUBLE and
2708 [(set (match_operand:SI 0 "register_operand" "=d")
2709 (mult:SI (match_operand:SI 1 "register_operand" "%0")
2710 (match_operand:SI 2 "const_int_operand" "n")))
2711 (set (match_operand:SI 3 "register_operand" "=d")
2712 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
2715 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE
2716 && (unsigned) INTVAL (operands[2]) <= 0x7fffffff"
2719 (define_expand "mulsidi3"
2721 [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 4)
2722 (mult:SI (match_operand:SI 1 "register_operand" "")
2723 (match_operand:SI 2 "register_operand" "")))
2724 (set (subreg:SI (match_dup 0) 0)
2725 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
2726 (sign_extend:DI (match_dup 2)))
2727 (const_int 32))))])]
2728 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2732 [(set (match_operand:SI 0 "register_operand" "=d")
2733 (mult:SI (match_operand:SI 1 "register_operand" "%0")
2734 (match_operand:SI 2 "nonimmediate_operand" "dm")))
2735 (set (match_operand:SI 3 "register_operand" "=d")
2736 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
2737 (sign_extend:DI (match_dup 2)))
2739 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2743 [(set (match_operand:SI 0 "register_operand" "=d")
2744 (mult:SI (match_operand:SI 1 "register_operand" "%0")
2745 (match_operand:SI 2 "const_int_operand" "n")))
2746 (set (match_operand:SI 3 "register_operand" "=d")
2747 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
2750 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2753 (define_expand "umulsi3_highpart"
2755 [(set (match_operand:SI 0 "register_operand" "")
2758 (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" ""))
2759 (zero_extend:DI (match_operand:SI 2 "general_operand" "")))
2761 (clobber (match_dup 3))])]
2762 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2764 operands[3] = gen_reg_rtx (SImode);
2766 if (GET_CODE (operands[2]) == CONST_INT)
2768 operands[2] = immed_double_const (INTVAL (operands[2]) & 0xffffffff,
2771 /* We have to adjust the operand order for the matching constraints. */
2772 emit_insn (gen_const_umulsi3_highpart (operands[0], operands[3],
2773 operands[1], operands[2]));
2779 [(set (match_operand:SI 0 "register_operand" "=d")
2782 (mult:DI (zero_extend:DI (match_operand:SI 2 "register_operand" "%1"))
2783 (zero_extend:DI (match_operand:SI 3 "nonimmediate_operand" "dm")))
2785 (clobber (match_operand:SI 1 "register_operand" "=d"))]
2786 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2789 (define_insn "const_umulsi3_highpart"
2790 [(set (match_operand:SI 0 "register_operand" "=d")
2793 (mult:DI (zero_extend:DI (match_operand:SI 2 "register_operand" "1"))
2794 (match_operand:DI 3 "const_uint32_operand" "n"))
2796 (clobber (match_operand:SI 1 "register_operand" "=d"))]
2797 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2800 (define_expand "smulsi3_highpart"
2802 [(set (match_operand:SI 0 "register_operand" "")
2805 (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" ""))
2806 (sign_extend:DI (match_operand:SI 2 "general_operand" "")))
2808 (clobber (match_dup 3))])]
2809 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2811 operands[3] = gen_reg_rtx (SImode);
2812 if (GET_CODE (operands[2]) == CONST_INT)
2814 /* We have to adjust the operand order for the matching constraints. */
2815 emit_insn (gen_const_smulsi3_highpart (operands[0], operands[3],
2816 operands[1], operands[2]));
2822 [(set (match_operand:SI 0 "register_operand" "=d")
2825 (mult:DI (sign_extend:DI (match_operand:SI 2 "register_operand" "%1"))
2826 (sign_extend:DI (match_operand:SI 3 "nonimmediate_operand" "dm")))
2828 (clobber (match_operand:SI 1 "register_operand" "=d"))]
2829 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2832 (define_insn "const_smulsi3_highpart"
2833 [(set (match_operand:SI 0 "register_operand" "=d")
2836 (mult:DI (sign_extend:DI (match_operand:SI 2 "register_operand" "1"))
2837 (match_operand:DI 3 "const_sint32_operand" "n"))
2839 (clobber (match_operand:SI 1 "register_operand" "=d"))]
2840 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2843 (define_expand "mul<mode>3"
2844 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2845 (mult:FP (match_operand:FP 1 "general_operand" "")
2846 (match_operand:FP 2 "general_operand" "")))]
2850 (define_insn "mul<mode>3_floatsi_68881"
2851 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2852 (mult:FP (float:FP (match_operand:SI 2 "general_operand" "dmi"))
2853 (match_operand:FP 1 "general_operand" "0")))]
2857 ? "f<FP:round>mul%.l %2,%0"
2858 : "f<FP:round_mul>mul%.l %2,%0";
2861 (define_insn "mul<mode>3_floathi_68881"
2862 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2863 (mult:FP (float:FP (match_operand:HI 2 "general_operand" "dmn"))
2864 (match_operand:FP 1 "general_operand" "0")))]
2868 ? "f<FP:round>mul%.w %2,%0"
2869 : "f<FP:round_mul>mul%.w %2,%0";
2872 (define_insn "mul<mode>3_floatqi_68881"
2873 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2874 (mult:FP (float:FP (match_operand:QI 2 "general_operand" "dmn"))
2875 (match_operand:FP 1 "general_operand" "0")))]
2879 ? "f<FP:round>mul%.b %2,%0"
2880 : "f<FP:round_mul>mul%.b %2,%0";
2883 (define_insn "muldf_68881"
2884 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2885 (mult:DF (match_operand:DF 1 "general_operand" "%0")
2886 (match_operand:DF 2 "general_operand" "fmG")))]
2889 if (GET_CODE (operands[2]) == CONST_DOUBLE
2890 && floating_exact_log2 (operands[2]) && !TUNE_68040_60)
2892 int i = floating_exact_log2 (operands[2]);
2893 operands[2] = GEN_INT (i);
2894 return "fscale%.l %2,%0";
2896 if (REG_P (operands[2]))
2897 return "f%&mul%.x %2,%0";
2898 return "f%&mul%.d %f2,%0";
2901 (define_insn "mulsf_68881"
2902 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2903 (mult:SF (match_operand:SF 1 "general_operand" "%0")
2904 (match_operand:SF 2 "general_operand" "fdmF")))]
2907 if (FP_REG_P (operands[2]))
2908 return (TARGET_68040
2910 : "fsglmul%.x %2,%0");
2911 return (TARGET_68040
2913 : "fsglmul%.s %f2,%0");
2916 (define_insn "mulxf3_68881"
2917 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
2918 (mult:XF (match_operand:XF 1 "nonimmediate_operand" "%0")
2919 (match_operand:XF 2 "nonimmediate_operand" "fm")))]
2922 return "fmul%.x %f2,%0";
2925 (define_insn "fmul<mode>3_cf"
2926 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2927 (mult:FP (match_operand:FP 1 "general_operand" "%0")
2928 (match_operand:FP 2 "general_operand" "f<Q>U<FP:dreg>")))]
2929 "TARGET_COLDFIRE_FPU"
2931 if (FP_REG_P (operands[2]))
2932 return "f<FP:prec>mul%.d %2,%0";
2933 return "f<FP:prec>mul%.<FP:prec> %2,%0";
2936 ;; divide instructions
2938 (define_expand "div<mode>3"
2939 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2940 (div:FP (match_operand:FP 1 "general_operand" "")
2941 (match_operand:FP 2 "general_operand" "")))]
2945 (define_insn "div<mode>3_floatsi_68881"
2946 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2947 (div:FP (match_operand:FP 1 "general_operand" "0")
2948 (float:FP (match_operand:SI 2 "general_operand" "dmi"))))]
2952 ? "f<FP:round>div%.l %2,%0"
2953 : "f<FP:round_mul>div%.l %2,%0";
2956 (define_insn "div<mode>3_floathi_68881"
2957 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2958 (div:FP (match_operand:FP 1 "general_operand" "0")
2959 (float:FP (match_operand:HI 2 "general_operand" "dmn"))))]
2963 ? "f<FP:round>div%.w %2,%0"
2964 : "f<FP:round_mul>div%.w %2,%0";
2967 (define_insn "div<mode>3_floatqi_68881"
2968 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2969 (div:FP (match_operand:FP 1 "general_operand" "0")
2970 (float:FP (match_operand:QI 2 "general_operand" "dmn"))))]
2974 ? "f<FP:round>div%.b %2,%0"
2975 : "f<FP:round_mul>div%.b %2,%0";
2978 (define_insn "div<mode>3_68881"
2979 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2980 (div:FP (match_operand:FP 1 "general_operand" "0")
2981 (match_operand:FP 2 "general_operand" "f<FP:dreg>m<FP:const>")))]
2984 if (FP_REG_P (operands[2]))
2985 return (TARGET_68040
2986 ? "f<FP:round>div%.x %2,%0"
2987 : "f<FP:round_mul>div%.x %2,%0");
2988 return (TARGET_68040
2989 ? "f<FP:round>div%.<FP:prec> %f2,%0"
2990 : "f<FP:round_mul>div%.<FP:prec> %f2,%0");
2993 (define_insn "div<mode>3_cf"
2994 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2995 (div:FP (match_operand:FP 1 "general_operand" "0")
2996 (match_operand:FP 2 "general_operand" "f<Q>U<FP:dreg>")))]
2997 "TARGET_COLDFIRE_FPU"
2999 if (FP_REG_P (operands[2]))
3000 return "f<FP:prec>div%.d %2,%0";
3001 return "f<FP:prec>div%.<FP:prec> %2,%0";
3004 ;; Remainder instructions.
3006 (define_expand "divmodsi4"
3008 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3009 (div:SI (match_operand:SI 1 "general_operand" "")
3010 (match_operand:SI 2 "general_src_operand" "")))
3011 (set (match_operand:SI 3 "nonimmediate_operand" "")
3012 (mod:SI (match_dup 1) (match_dup 2)))])]
3013 "TARGET_68020 || TARGET_CF_HWDIV"
3017 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3018 (div:SI (match_operand:SI 1 "general_operand" "0")
3019 (match_operand:SI 2 "general_src_operand" "d<Q>U")))
3020 (set (match_operand:SI 3 "nonimmediate_operand" "=&d")
3021 (mod:SI (match_dup 1) (match_dup 2)))]
3024 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3025 return "divs%.l %2,%0";
3026 else if (find_reg_note (insn, REG_UNUSED, operands[0]))
3027 return "rems%.l %2,%3:%0";
3029 return "rems%.l %2,%3:%0\;divs%.l %2,%0";
3033 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3034 (div:SI (match_operand:SI 1 "general_operand" "0")
3035 (match_operand:SI 2 "general_src_operand" "dmSTK")))
3036 (set (match_operand:SI 3 "nonimmediate_operand" "=d")
3037 (mod:SI (match_dup 1) (match_dup 2)))]
3040 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3041 return "divs%.l %2,%0";
3043 return "divsl%.l %2,%3:%0";
3046 (define_expand "udivmodsi4"
3048 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3049 (udiv:SI (match_operand:SI 1 "general_operand" "0")
3050 (match_operand:SI 2 "general_src_operand" "dmSTK")))
3051 (set (match_operand:SI 3 "nonimmediate_operand" "=d")
3052 (umod:SI (match_dup 1) (match_dup 2)))])]
3053 "TARGET_68020 || TARGET_CF_HWDIV"
3057 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3058 (udiv:SI (match_operand:SI 1 "general_operand" "0")
3059 (match_operand:SI 2 "general_src_operand" "d<Q>U")))
3060 (set (match_operand:SI 3 "nonimmediate_operand" "=&d")
3061 (umod:SI (match_dup 1) (match_dup 2)))]
3064 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3065 return "divu%.l %2,%0";
3066 else if (find_reg_note (insn, REG_UNUSED, operands[0]))
3067 return "remu%.l %2,%3:%0";
3069 return "remu%.l %2,%3:%0\;divu%.l %2,%0";
3073 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3074 (udiv:SI (match_operand:SI 1 "general_operand" "0")
3075 (match_operand:SI 2 "general_src_operand" "dmSTK")))
3076 (set (match_operand:SI 3 "nonimmediate_operand" "=d")
3077 (umod:SI (match_dup 1) (match_dup 2)))]
3078 "TARGET_68020 && !TARGET_COLDFIRE"
3080 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3081 return "divu%.l %2,%0";
3083 return "divul%.l %2,%3:%0";
3086 (define_insn "divmodhi4"
3087 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
3088 (div:HI (match_operand:HI 1 "general_operand" "0")
3089 (match_operand:HI 2 "general_src_operand" "dmSKT")))
3090 (set (match_operand:HI 3 "nonimmediate_operand" "=d")
3091 (mod:HI (match_dup 1) (match_dup 2)))]
3092 "!TARGET_COLDFIRE || TARGET_CF_HWDIV"
3094 output_asm_insn (MOTOROLA ?
3095 "ext%.l %0\;divs%.w %2,%0" :
3096 "extl %0\;divs %2,%0",
3098 if (!find_reg_note(insn, REG_UNUSED, operands[3]))
3101 return "move%.l %0,%3\;swap %3";
3107 (define_insn "udivmodhi4"
3108 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
3109 (udiv:HI (match_operand:HI 1 "general_operand" "0")
3110 (match_operand:HI 2 "general_src_operand" "dmSKT")))
3111 (set (match_operand:HI 3 "nonimmediate_operand" "=d")
3112 (umod:HI (match_dup 1) (match_dup 2)))]
3113 "!TARGET_COLDFIRE || TARGET_CF_HWDIV"
3116 output_asm_insn (MOTOROLA ?
3117 "mvz%.w %0,%0\;divu%.w %2,%0" :
3118 "mvz%.w %0,%0\;divu %2,%0",
3121 output_asm_insn (MOTOROLA ?
3122 "and%.l #0xFFFF,%0\;divu%.w %2,%0" :
3123 "and%.l #0xFFFF,%0\;divu %2,%0",
3126 if (!find_reg_note(insn, REG_UNUSED, operands[3]))
3129 return "move%.l %0,%3\;swap %3";
3135 ;; logical-and instructions
3137 ;; "anddi3" is mainly here to help combine().
3138 (define_insn "anddi3"
3139 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,d")
3140 (and:DI (match_operand:DI 1 "general_operand" "%0,0")
3141 (match_operand:DI 2 "general_operand" "dn,don")))]
3145 /* We can get CONST_DOUBLE, but also const1_rtx etc. */
3146 if (CONSTANT_P (operands[2]))
3150 split_double (operands[2], &hi, &lo);
3152 switch (INTVAL (hi))
3155 output_asm_insn ("clr%.l %0", operands);
3163 xoperands[0] = operands[0];
3165 output_asm_insn (output_andsi3 (xoperands), xoperands);
3168 if (GET_CODE (operands[0]) == REG)
3169 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3171 operands[0] = adjust_address (operands[0], SImode, 4);
3172 switch (INTVAL (lo))
3175 output_asm_insn ("clr%.l %0", operands);
3183 xoperands[0] = operands[0];
3185 output_asm_insn (output_andsi3 (xoperands), xoperands);
3190 if (GET_CODE (operands[0]) != REG)
3192 operands[1] = adjust_address (operands[0], SImode, 4);
3193 return "and%.l %2,%0\;and%.l %R2,%1";
3195 if (GET_CODE (operands[2]) != REG)
3197 operands[1] = adjust_address (operands[2], SImode, 4);
3198 return "and%.l %2,%0\;and%.l %1,%R0";
3200 return "and%.l %2,%0\;and%.l %R2,%R0";
3203 ;; Prevent AND from being made with sp. This doesn't exist in the machine
3204 ;; and reload will cause inefficient code. Since sp is a FIXED_REG, we
3205 ;; can't allocate pseudos into it.
3207 (define_expand "andsi3"
3208 [(set (match_operand:SI 0 "not_sp_operand" "")
3209 (and:SI (match_operand:SI 1 "general_operand" "")
3210 (match_operand:SI 2 "general_src_operand" "")))]
3214 ;; produced by split operations after reload finished
3215 (define_insn "*andsi3_split"
3216 [(set (match_operand:SI 0 "register_operand" "=d")
3217 (and:SI (match_operand:SI 1 "register_operand" "0")
3218 (match_operand:SI 2 "const_int_operand" "i")))]
3219 "reload_completed && !TARGET_COLDFIRE"
3221 return output_andsi3 (operands);
3224 (define_insn "andsi3_internal"
3225 [(set (match_operand:SI 0 "not_sp_operand" "=m,d")
3226 (and:SI (match_operand:SI 1 "general_operand" "%0,0")
3227 (match_operand:SI 2 "general_src_operand" "dKT,dmSM")))]
3230 return output_andsi3 (operands);
3233 (define_insn "andsi3_5200"
3234 [(set (match_operand:SI 0 "not_sp_operand" "=m,d")
3235 (and:SI (match_operand:SI 1 "general_operand" "%0,0")
3236 (match_operand:SI 2 "general_src_operand" "d,dmsK")))]
3240 && DATA_REG_P (operands[0])
3241 && GET_CODE (operands[2]) == CONST_INT)
3243 if (INTVAL (operands[2]) == 0x000000ff)
3244 return "mvz%.b %0,%0";
3245 else if (INTVAL (operands[2]) == 0x0000ffff)
3246 return "mvz%.w %0,%0";
3248 return output_andsi3 (operands);
3251 (define_insn "andhi3"
3252 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,d")
3253 (and:HI (match_operand:HI 1 "general_operand" "%0,0")
3254 (match_operand:HI 2 "general_src_operand" "dn,dmSn")))]
3259 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3260 (and:HI (match_dup 0)
3261 (match_operand:HI 1 "general_src_operand" "dn,dmSn")))]
3266 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3267 (and:HI (match_operand:HI 1 "general_src_operand" "dn,dmSn")
3272 (define_insn "andqi3"
3273 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
3274 (and:QI (match_operand:QI 1 "general_operand" "%0,0")
3275 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
3280 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3281 (and:QI (match_dup 0)
3282 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
3287 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3288 (and:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn")
3293 ;; inclusive-or instructions
3295 (define_insn "iordi_zext"
3296 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,d")
3297 (ior:DI (zero_extend:DI (match_operand 1 "general_operand" "dn,dmn"))
3298 (match_operand:DI 2 "general_operand" "0,0")))]
3304 if (GET_CODE (operands[0]) == REG)
3305 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3307 operands[0] = adjust_address (operands[0], SImode, 4);
3308 if (GET_MODE (operands[1]) == SImode)
3309 return "or%.l %1,%0";
3310 byte_mode = (GET_MODE (operands[1]) == QImode);
3311 if (GET_CODE (operands[0]) == MEM)
3312 operands[0] = adjust_address (operands[0], byte_mode ? QImode : HImode,
3315 return "or%.b %1,%0";
3317 return "or%.w %1,%0";
3320 ;; "iordi3" is mainly here to help combine().
3321 (define_insn "iordi3"
3322 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,d")
3323 (ior:DI (match_operand:DI 1 "general_operand" "%0,0")
3324 (match_operand:DI 2 "general_operand" "dn,don")))]
3328 /* We can get CONST_DOUBLE, but also const1_rtx etc. */
3329 if (CONSTANT_P (operands[2]))
3333 split_double (operands[2], &hi, &lo);
3335 switch (INTVAL (hi))
3340 /* FIXME : a scratch register would be welcome here if operand[0]
3341 is not a register */
3342 output_asm_insn ("move%.l #-1,%0", operands);
3348 xoperands[0] = operands[0];
3350 output_asm_insn (output_iorsi3 (xoperands), xoperands);
3353 if (GET_CODE (operands[0]) == REG)
3354 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3356 operands[0] = adjust_address (operands[0], SImode, 4);
3357 switch (INTVAL (lo))
3362 /* FIXME : a scratch register would be welcome here if operand[0]
3363 is not a register */
3364 output_asm_insn ("move%.l #-1,%0", operands);
3370 xoperands[0] = operands[0];
3372 output_asm_insn (output_iorsi3 (xoperands), xoperands);
3377 if (GET_CODE (operands[0]) != REG)
3379 operands[1] = adjust_address (operands[0], SImode, 4);
3380 return "or%.l %2,%0\;or%.l %R2,%1";
3382 if (GET_CODE (operands[2]) != REG)
3384 operands[1] = adjust_address (operands[2], SImode, 4);
3385 return "or%.l %2,%0\;or%.l %1,%R0";
3387 return "or%.l %2,%0\;or%.l %R2,%R0";
3390 (define_expand "iorsi3"
3391 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3392 (ior:SI (match_operand:SI 1 "general_operand" "")
3393 (match_operand:SI 2 "general_src_operand" "")))]
3397 (define_insn "iorsi3_internal"
3398 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,d")
3399 (ior:SI (match_operand:SI 1 "general_operand" "%0,0")
3400 (match_operand:SI 2 "general_src_operand" "dKT,dmSMT")))]
3403 return output_iorsi3 (operands);
3406 (define_insn "iorsi3_5200"
3407 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,d")
3408 (ior:SI (match_operand:SI 1 "general_operand" "%0,0")
3409 (match_operand:SI 2 "general_src_operand" "d,dmsK")))]
3412 return output_iorsi3 (operands);
3415 (define_insn "iorhi3"
3416 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,d")
3417 (ior:HI (match_operand:HI 1 "general_operand" "%0,0")
3418 (match_operand:HI 2 "general_src_operand" "dn,dmSn")))]
3423 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3424 (ior:HI (match_dup 0)
3425 (match_operand:HI 1 "general_src_operand" "dn,dmSn")))]
3430 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3431 (ior:HI (match_operand:HI 1 "general_src_operand" "dn,dmSn")
3436 (define_insn "iorqi3"
3437 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
3438 (ior:QI (match_operand:QI 1 "general_operand" "%0,0")
3439 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
3444 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3445 (ior:QI (match_dup 0)
3446 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
3451 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3452 (ior:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn")
3457 ;; On all 68k models, this makes faster code in a special case.
3458 ;; See also ashlsi_16, ashrsi_16 and lshrsi_16.
3460 (define_insn "iorsi_zexthi_ashl16"
3461 [(set (match_operand:SI 0 "nonimmediate_operand" "=&d")
3462 (ior:SI (zero_extend:SI (match_operand:HI 1 "general_operand" "rmn"))
3463 (ashift:SI (match_operand:SI 2 "general_operand" "or")
3468 if (GET_CODE (operands[2]) != REG)
3469 operands[2] = adjust_address (operands[2], HImode, 2);
3470 if (GET_CODE (operands[2]) != REG
3471 || REGNO (operands[2]) != REGNO (operands[0]))
3472 output_asm_insn ("move%.w %2,%0", operands);
3473 return "swap %0\;mov%.w %1,%0";
3476 (define_insn "iorsi_zext"
3477 [(set (match_operand:SI 0 "nonimmediate_operand" "=o,d")
3478 (ior:SI (zero_extend:SI (match_operand 1 "general_operand" "dn,dmn"))
3479 (match_operand:SI 2 "general_operand" "0,0")))]
3485 byte_mode = (GET_MODE (operands[1]) == QImode);
3486 if (GET_CODE (operands[0]) == MEM)
3487 operands[0] = adjust_address (operands[0], byte_mode ? QImode : HImode,
3490 return "or%.b %1,%0";
3492 return "or%.w %1,%0";
3497 ;; "xordi3" is mainly here to help combine().
3498 (define_insn "xordi3"
3499 [(set (match_operand:DI 0 "nonimmediate_operand" "=od")
3500 (xor:DI (match_operand:DI 1 "general_operand" "%0")
3501 (match_operand:DI 2 "general_operand" "dn")))]
3505 /* We can get CONST_DOUBLE, but also const1_rtx etc. */
3507 if (CONSTANT_P (operands[2]))
3511 split_double (operands[2], &hi, &lo);
3513 switch (INTVAL (hi))
3518 output_asm_insn ("not%.l %0", operands);
3521 /* FIXME : a scratch register would be welcome here if
3522 -128 <= INTVAL (hi) < -1 */
3526 xoperands[0] = operands[0];
3528 output_asm_insn (output_xorsi3 (xoperands), xoperands);
3531 if (GET_CODE (operands[0]) == REG)
3532 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3534 operands[0] = adjust_address (operands[0], SImode, 4);
3535 switch (INTVAL (lo))
3540 output_asm_insn ("not%.l %0", operands);
3543 /* FIXME : a scratch register would be welcome here if
3544 -128 <= INTVAL (lo) < -1 */
3546 /* FIXME : this should be merged with xorsi3 */
3550 xoperands[0] = operands[0];
3552 output_asm_insn (output_xorsi3 (xoperands), xoperands);
3557 if (GET_CODE (operands[0]) != REG)
3559 operands[1] = adjust_address (operands[0], SImode, 4);
3560 return "eor%.l %2,%0\;eor%.l %R2,%1";
3562 if (GET_CODE (operands[2]) != REG)
3564 operands[1] = adjust_address (operands[2], SImode, 4);
3565 return "eor%.l %2,%0\;eor%.l %1,%R0";
3567 return "eor%.l %2,%0\;eor%.l %R2,%R0";
3570 (define_expand "xorsi3"
3571 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3572 (xor:SI (match_operand:SI 1 "general_operand" "")
3573 (match_operand:SI 2 "general_operand" "")))]
3577 (define_insn "xorsi3_internal"
3578 [(set (match_operand:SI 0 "nonimmediate_operand" "=do,m")
3579 (xor:SI (match_operand:SI 1 "general_operand" "%0,0")
3580 (match_operand:SI 2 "general_operand" "di,dKT")))]
3584 return output_xorsi3 (operands);
3587 (define_insn "xorsi3_5200"
3588 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm,d")
3589 (xor:SI (match_operand:SI 1 "general_operand" "%0,0")
3590 (match_operand:SI 2 "general_operand" "d,Ks")))]
3593 return output_xorsi3 (operands);
3596 (define_insn "xorhi3"
3597 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
3598 (xor:HI (match_operand:HI 1 "general_operand" "%0")
3599 (match_operand:HI 2 "general_operand" "dn")))]
3604 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
3605 (xor:HI (match_dup 0)
3606 (match_operand:HI 1 "general_operand" "dn")))]
3611 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
3612 (xor:HI (match_operand:HI 1 "general_operand" "dn")
3617 (define_insn "xorqi3"
3618 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
3619 (xor:QI (match_operand:QI 1 "general_operand" "%0")
3620 (match_operand:QI 2 "general_operand" "dn")))]
3625 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
3626 (xor:QI (match_dup 0)
3627 (match_operand:QI 1 "general_operand" "dn")))]
3632 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
3633 (xor:QI (match_operand:QI 1 "general_operand" "dn")
3638 ;; negation instructions
3640 (define_expand "negdi2"
3641 [(set (match_operand:DI 0 "nonimmediate_operand" "")
3642 (neg:DI (match_operand:DI 1 "general_operand" "")))]
3645 if (TARGET_COLDFIRE)
3646 emit_insn (gen_negdi2_5200 (operands[0], operands[1]));
3648 emit_insn (gen_negdi2_internal (operands[0], operands[1]));
3652 (define_insn "negdi2_internal"
3653 [(set (match_operand:DI 0 "nonimmediate_operand" "=<,do,!*a")
3654 (neg:DI (match_operand:DI 1 "general_operand" "0,0,0")))]
3657 if (which_alternative == 0)
3658 return "neg%.l %0\;negx%.l %0";
3659 if (GET_CODE (operands[0]) == REG)
3660 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3662 operands[1] = adjust_address (operands[0], SImode, 4);
3663 if (ADDRESS_REG_P (operands[0]))
3664 return "exg %/d0,%1\;neg%.l %/d0\;exg %/d0,%1\;exg %/d0,%0\;negx%.l %/d0\;exg %/d0,%0";
3666 return "neg%.l %1\;negx%.l %0";
3669 (define_insn "negdi2_5200"
3670 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
3671 (neg:DI (match_operand:DI 1 "general_operand" "0")))]
3674 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3675 return "neg%.l %1\;negx%.l %0";
3678 (define_expand "negsi2"
3679 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3680 (neg:SI (match_operand:SI 1 "general_operand" "")))]
3683 if (TARGET_COLDFIRE)
3684 emit_insn (gen_negsi2_5200 (operands[0], operands[1]));
3686 emit_insn (gen_negsi2_internal (operands[0], operands[1]));
3690 (define_insn "negsi2_internal"
3691 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
3692 (neg:SI (match_operand:SI 1 "general_operand" "0")))]
3696 (define_insn "negsi2_5200"
3697 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3698 (neg:SI (match_operand:SI 1 "general_operand" "0")))]
3702 (define_insn "neghi2"
3703 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
3704 (neg:HI (match_operand:HI 1 "general_operand" "0")))]
3709 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
3710 (neg:HI (match_dup 0)))]
3714 (define_insn "negqi2"
3715 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
3716 (neg:QI (match_operand:QI 1 "general_operand" "0")))]
3721 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
3722 (neg:QI (match_dup 0)))]
3726 ;; If using software floating point, just flip the sign bit.
3728 (define_expand "negsf2"
3729 [(set (match_operand:SF 0 "nonimmediate_operand" "")
3730 (neg:SF (match_operand:SF 1 "general_operand" "")))]
3733 if (!TARGET_HARD_FLOAT)
3738 target = operand_subword_force (operands[0], 0, SFmode);
3739 result = expand_binop (SImode, xor_optab,
3740 operand_subword_force (operands[1], 0, SFmode),
3741 GEN_INT (-2147483647 - 1), target, 0, OPTAB_WIDEN);
3742 gcc_assert (result);
3744 if (result != target)
3745 emit_move_insn (result, target);
3747 /* Make a place for REG_EQUAL. */
3748 emit_move_insn (operands[0], operands[0]);
3753 (define_expand "negdf2"
3754 [(set (match_operand:DF 0 "nonimmediate_operand" "")
3755 (neg:DF (match_operand:DF 1 "general_operand" "")))]
3758 if (!TARGET_HARD_FLOAT)
3765 target = operand_subword (operands[0], 0, 1, DFmode);
3766 result = expand_binop (SImode, xor_optab,
3767 operand_subword_force (operands[1], 0, DFmode),
3768 GEN_INT (-2147483647 - 1), target, 0, OPTAB_WIDEN);
3769 gcc_assert (result);
3771 if (result != target)
3772 emit_move_insn (result, target);
3774 emit_move_insn (operand_subword (operands[0], 1, 1, DFmode),
3775 operand_subword_force (operands[1], 1, DFmode));
3777 insns = get_insns ();
3780 emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
3785 (define_expand "negxf2"
3786 [(set (match_operand:XF 0 "nonimmediate_operand" "")
3787 (neg:XF (match_operand:XF 1 "nonimmediate_operand" "")))]
3797 target = operand_subword (operands[0], 0, 1, XFmode);
3798 result = expand_binop (SImode, xor_optab,
3799 operand_subword_force (operands[1], 0, XFmode),
3800 GEN_INT (-2147483647 - 1), target, 0, OPTAB_WIDEN);
3801 gcc_assert (result);
3803 if (result != target)
3804 emit_move_insn (result, target);
3806 emit_move_insn (operand_subword (operands[0], 1, 1, XFmode),
3807 operand_subword_force (operands[1], 1, XFmode));
3808 emit_move_insn (operand_subword (operands[0], 2, 1, XFmode),
3809 operand_subword_force (operands[1], 2, XFmode));
3811 insns = get_insns ();
3814 emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
3819 (define_insn "neg<mode>2_68881"
3820 [(set (match_operand:FP 0 "nonimmediate_operand" "=f,d")
3821 (neg:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m<FP:const>,0")))]
3824 if (DATA_REG_P (operands[0]))
3826 operands[1] = GEN_INT (31);
3827 return "bchg %1,%0";
3829 if (FP_REG_P (operands[1]))
3830 return "f<FP:round>neg%.x %1,%0";
3831 return "f<FP:round>neg%.<FP:prec> %f1,%0";
3834 (define_insn "neg<mode>2_cf"
3835 [(set (match_operand:FP 0 "nonimmediate_operand" "=f,d")
3836 (neg:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U,0")))]
3837 "TARGET_COLDFIRE_FPU"
3839 if (DATA_REG_P (operands[0]))
3841 operands[1] = GEN_INT (31);
3842 return "bchg %1,%0";
3844 if (FP_REG_P (operands[1]))
3845 return "f<FP:prec>neg%.d %1,%0";
3846 return "f<FP:prec>neg%.<FP:prec> %1,%0";
3849 ;; Sqrt instruction for the 68881
3851 (define_expand "sqrt<mode>2"
3852 [(set (match_operand:FP 0 "nonimmediate_operand" "")
3853 (sqrt:FP (match_operand:FP 1 "general_operand" "")))]
3857 (define_insn "sqrt<mode>2_68881"
3858 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3859 (sqrt:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m")))]
3862 if (FP_REG_P (operands[1]))
3863 return "f<FP:round>sqrt%.x %1,%0";
3864 return "f<FP:round>sqrt%.<FP:prec> %1,%0";
3867 (define_insn "sqrt<mode>2_cf"
3868 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3869 (sqrt:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U")))]
3870 "TARGET_COLDFIRE_FPU"
3872 if (FP_REG_P (operands[1]))
3873 return "f<FP:prec>sqrt%.d %1,%0";
3874 return "f<FP:prec>sqrt%.<FP:prec> %1,%0";
3876 ;; Absolute value instructions
3877 ;; If using software floating point, just zero the sign bit.
3879 (define_expand "abssf2"
3880 [(set (match_operand:SF 0 "nonimmediate_operand" "")
3881 (abs:SF (match_operand:SF 1 "general_operand" "")))]
3884 if (!TARGET_HARD_FLOAT)
3889 target = operand_subword_force (operands[0], 0, SFmode);
3890 result = expand_binop (SImode, and_optab,
3891 operand_subword_force (operands[1], 0, SFmode),
3892 GEN_INT (0x7fffffff), target, 0, OPTAB_WIDEN);
3893 gcc_assert (result);
3895 if (result != target)
3896 emit_move_insn (result, target);
3898 /* Make a place for REG_EQUAL. */
3899 emit_move_insn (operands[0], operands[0]);
3904 (define_expand "absdf2"
3905 [(set (match_operand:DF 0 "nonimmediate_operand" "")
3906 (abs:DF (match_operand:DF 1 "general_operand" "")))]
3909 if (!TARGET_HARD_FLOAT)
3916 target = operand_subword (operands[0], 0, 1, DFmode);
3917 result = expand_binop (SImode, and_optab,
3918 operand_subword_force (operands[1], 0, DFmode),
3919 GEN_INT (0x7fffffff), target, 0, OPTAB_WIDEN);
3920 gcc_assert (result);
3922 if (result != target)
3923 emit_move_insn (result, target);
3925 emit_move_insn (operand_subword (operands[0], 1, 1, DFmode),
3926 operand_subword_force (operands[1], 1, DFmode));
3928 insns = get_insns ();
3931 emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
3936 (define_expand "absxf2"
3937 [(set (match_operand:XF 0 "nonimmediate_operand" "")
3938 (abs:XF (match_operand:XF 1 "nonimmediate_operand" "")))]
3948 target = operand_subword (operands[0], 0, 1, XFmode);
3949 result = expand_binop (SImode, and_optab,
3950 operand_subword_force (operands[1], 0, XFmode),
3951 GEN_INT (0x7fffffff), target, 0, OPTAB_WIDEN);
3952 gcc_assert (result);
3954 if (result != target)
3955 emit_move_insn (result, target);
3957 emit_move_insn (operand_subword (operands[0], 1, 1, XFmode),
3958 operand_subword_force (operands[1], 1, XFmode));
3959 emit_move_insn (operand_subword (operands[0], 2, 1, XFmode),
3960 operand_subword_force (operands[1], 2, XFmode));
3962 insns = get_insns ();
3965 emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
3970 (define_insn "abs<mode>2_68881"
3971 [(set (match_operand:FP 0 "nonimmediate_operand" "=f,d")
3972 (abs:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m<FP:const>,0")))]
3975 if (DATA_REG_P (operands[0]))
3977 operands[1] = GEN_INT (31);
3978 return "bclr %1,%0";
3980 if (FP_REG_P (operands[1]))
3981 return "f<FP:round>abs%.x %1,%0";
3982 return "f<FP:round>abs%.<FP:prec> %f1,%0";
3985 (define_insn "abs<mode>2_cf"
3986 [(set (match_operand:FP 0 "nonimmediate_operand" "=f,d")
3987 (abs:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U,0")))]
3988 "TARGET_COLDFIRE_FPU"
3990 if (DATA_REG_P (operands[0]))
3992 operands[1] = GEN_INT (31);
3993 return "bclr %1,%0";
3995 if (FP_REG_P (operands[1]))
3996 return "f<FP:prec>abs%.d %1,%0";
3997 return "f<FP:prec>abs%.<FP:prec> %1,%0";
4000 ;; bit indexing instructions
4002 ;; ColdFire ff1 instruction implements clz.
4003 (define_insn "clzsi2"
4004 [(set (match_operand:SI 0 "register_operand" "=d")
4005 (clz:SI (match_operand:SI 1 "register_operand" "0")))]
4006 "TARGET_ISAAPLUS || TARGET_ISAC"
4009 ;; one complement instructions
4011 ;; "one_cmpldi2" is mainly here to help combine().
4012 (define_insn "one_cmpldi2"
4013 [(set (match_operand:DI 0 "nonimmediate_operand" "=dm")
4014 (not:DI (match_operand:DI 1 "general_operand" "0")))]
4018 if (GET_CODE (operands[0]) == REG)
4019 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4020 else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC
4021 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
4022 operands[1] = operands[0];
4024 operands[1] = adjust_address (operands[0], SImode, 4);
4025 return "not%.l %1\;not%.l %0";
4028 (define_expand "one_cmplsi2"
4029 [(set (match_operand:SI 0 "nonimmediate_operand" "")
4030 (not:SI (match_operand:SI 1 "general_operand" "")))]
4033 if (TARGET_COLDFIRE)
4034 emit_insn (gen_one_cmplsi2_5200 (operands[0], operands[1]));
4036 emit_insn (gen_one_cmplsi2_internal (operands[0], operands[1]));
4040 (define_insn "one_cmplsi2_internal"
4041 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
4042 (not:SI (match_operand:SI 1 "general_operand" "0")))]
4046 (define_insn "one_cmplsi2_5200"
4047 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
4048 (not:SI (match_operand:SI 1 "general_operand" "0")))]
4052 (define_insn "one_cmplhi2"
4053 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
4054 (not:HI (match_operand:HI 1 "general_operand" "0")))]
4059 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
4060 (not:HI (match_dup 0)))]
4064 (define_insn "one_cmplqi2"
4065 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
4066 (not:QI (match_operand:QI 1 "general_operand" "0")))]
4071 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
4072 (not:QI (match_dup 0)))]
4076 ;; arithmetic shift instructions
4077 ;; We don't need the shift memory by 1 bit instruction
4079 (define_insn "ashldi_extsi"
4080 [(set (match_operand:DI 0 "nonimmediate_operand" "=ro")
4082 (match_operator:DI 2 "extend_operator"
4083 [(match_operand:SI 1 "general_operand" "rm")])
4088 if (GET_CODE (operands[0]) == REG)
4089 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4091 operands[2] = adjust_address (operands[0], SImode, 4);
4092 if (ADDRESS_REG_P (operands[0]))
4093 return "move%.l %1,%0\;sub%.l %2,%2";
4095 return "move%.l %1,%0\;clr%.l %2";
4098 (define_insn "ashldi_sexthi"
4099 [(set (match_operand:DI 0 "nonimmediate_operand" "=m,a*d")
4100 (ashift:DI (sign_extend:DI (match_operand:HI 1 "general_operand" "rm,rm"))
4102 (clobber (match_scratch:SI 2 "=a,X"))]
4106 if (GET_CODE (operands[0]) == MEM)
4108 if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
4109 return "clr%.l %0\;move%.w %1,%2\;move%.l %2,%0";
4110 else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
4111 return "move%.w %1,%2\;move%.l %2,%0\;clr%.l %0";
4114 operands[3] = adjust_address (operands[0], SImode, 4);
4115 return "move%.w %1,%2\;move%.l %2,%0\;clr%.l %3";
4118 else if (DATA_REG_P (operands[0]))
4119 return "move%.w %1,%0\;ext%.l %0\;clr%.l %R0";
4121 return "move%.w %1,%0\;sub%.l %R0,%R0";
4124 (define_insn "*ashldi3_const1"
4125 [(set (match_operand:DI 0 "register_operand" "=d")
4126 (ashift:DI (match_operand:DI 1 "register_operand" "0")
4129 "add%.l %R0,%R0\;addx%.l %0,%0")
4132 [(set (match_operand:DI 0 "register_operand" "")
4133 (ashift:DI (match_operand:DI 1 "register_operand" "")
4135 "reload_completed && !TARGET_COLDFIRE"
4137 (ashift:DI (match_dup 1) (const_int 1)))
4139 (ashift:DI (match_dup 0) (const_int 1)))]
4143 [(set (match_operand:DI 0 "register_operand" "")
4144 (ashift:DI (match_operand:DI 1 "register_operand" "")
4146 "reload_completed && !TARGET_COLDFIRE"
4148 (ashift:DI (match_dup 1) (const_int 2)))
4150 (ashift:DI (match_dup 0) (const_int 1)))]
4154 [(set (match_operand:DI 0 "register_operand" "")
4155 (ashift:DI (match_operand:DI 1 "register_operand" "")
4157 "reload_completed && !TARGET_COLDFIRE"
4159 (rotate:SI (match_dup 2) (const_int 8)))
4161 (rotate:SI (match_dup 3) (const_int 8)))
4162 (set (strict_low_part (subreg:QI (match_dup 0) 3))
4163 (subreg:QI (match_dup 0) 7))
4164 (set (strict_low_part (subreg:QI (match_dup 0) 7))
4167 operands[2] = gen_highpart (SImode, operands[0]);
4168 operands[3] = gen_lowpart (SImode, operands[0]);
4172 [(set (match_operand:DI 0 "register_operand" "")
4173 (ashift:DI (match_operand:DI 1 "register_operand" "")
4175 "reload_completed && !TARGET_COLDFIRE"
4177 (rotate:SI (match_dup 2) (const_int 16)))
4179 (rotate:SI (match_dup 3) (const_int 16)))
4180 (set (strict_low_part (subreg:HI (match_dup 0) 2))
4181 (subreg:HI (match_dup 0) 6))
4182 (set (strict_low_part (subreg:HI (match_dup 0) 6))
4185 operands[2] = gen_highpart (SImode, operands[0]);
4186 operands[3] = gen_lowpart (SImode, operands[0]);
4190 [(set (match_operand:DI 0 "pre_dec_operand" "")
4191 (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "")
4194 [(set (match_dup 0) (const_int 0))
4195 (set (match_dup 0) (match_dup 1))]
4197 operands[0] = adjust_address(operands[0], SImode, 0);
4198 operands[1] = gen_lowpart(SImode, operands[1]);
4202 [(set (match_operand:DI 0 "post_inc_operand" "")
4203 (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "")
4206 [(set (match_dup 0) (match_dup 1))
4207 (set (match_dup 0) (const_int 0))]
4209 operands[0] = adjust_address(operands[0], SImode, 0);
4210 operands[1] = gen_lowpart(SImode, operands[1]);
4213 (define_insn_and_split "*ashldi3_const32"
4214 [(set (match_operand:DI 0 "nonimmediate_operand" "=ro<>")
4215 (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "ro")
4219 "&& reload_completed"
4220 [(set (match_dup 4) (match_dup 3))
4221 (set (match_dup 2) (const_int 0))]
4222 "split_di(operands, 2, operands + 2, operands + 4);")
4225 [(set (match_operand:DI 0 "register_operand" "")
4226 (ashift:DI (match_operand:DI 1 "register_operand" "")
4227 (match_operand 2 "const_int_operand" "")))]
4228 "reload_completed && !TARGET_COLDFIRE
4229 && INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 40"
4230 [(set (match_dup 4) (ashift:SI (match_dup 4) (match_dup 2)))
4231 (set (match_dup 3) (match_dup 4))
4232 (set (match_dup 4) (const_int 0))]
4234 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
4235 operands[3] = gen_highpart (SImode, operands[0]);
4236 operands[4] = gen_lowpart (SImode, operands[0]);
4240 [(set (match_operand:DI 0 "register_operand" "")
4241 (ashift:DI (match_operand:DI 1 "register_operand" "")
4243 "reload_completed && !TARGET_COLDFIRE"
4244 [(set (match_dup 2) (match_dup 3))
4246 (rotate:SI (match_dup 2) (const_int 16)))
4247 (set (match_dup 3) (const_int 0))
4248 (set (strict_low_part (subreg:HI (match_dup 0) 2))
4251 operands[2] = gen_highpart (SImode, operands[0]);
4252 operands[3] = gen_lowpart (SImode, operands[0]);
4256 [(set (match_operand:DI 0 "register_operand" "")
4257 (ashift:DI (match_operand:DI 1 "register_operand" "")
4258 (match_operand 2 "const_int_operand" "")))]
4259 "reload_completed && !TARGET_COLDFIRE
4260 && INTVAL (operands[2]) > 40 && INTVAL (operands[2]) <= 63"
4261 [(set (match_dup 3) (match_dup 2))
4262 (set (match_dup 4) (ashift:SI (match_dup 4) (match_dup 3)))
4263 (set (match_dup 3) (match_dup 4))
4264 (set (match_dup 4) (const_int 0))]
4266 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
4267 operands[3] = gen_highpart (SImode, operands[0]);
4268 operands[4] = gen_lowpart (SImode, operands[0]);
4271 (define_insn "*ashldi3"
4272 [(set (match_operand:DI 0 "register_operand" "=d")
4273 (ashift:DI (match_operand:DI 1 "register_operand" "0")
4274 (match_operand 2 "const_int_operand" "n")))]
4276 && ((INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3)
4277 || INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16
4278 || (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63))"
4281 (define_expand "ashldi3"
4282 [(set (match_operand:DI 0 "register_operand" "")
4283 (ashift:DI (match_operand:DI 1 "register_operand" "")
4284 (match_operand 2 "const_int_operand" "")))]
4287 /* ??? This is a named pattern like this is not allowed to FAIL based
4289 if (GET_CODE (operands[2]) != CONST_INT
4290 || ((INTVAL (operands[2]) < 1 || INTVAL (operands[2]) > 3)
4291 && INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16
4292 && (INTVAL (operands[2]) < 32 || INTVAL (operands[2]) > 63)))
4296 ;; On most 68k models, this makes faster code in a special case.
4298 (define_insn "ashlsi_16"
4299 [(set (match_operand:SI 0 "register_operand" "=d")
4300 (ashift:SI (match_operand:SI 1 "register_operand" "0")
4305 return "swap %0\;clr%.w %0";
4308 ;; ashift patterns : use lsl instead of asl, because lsl always clears the
4309 ;; overflow bit, so we must not set CC_NO_OVERFLOW.
4311 ;; On the 68000, this makes faster code in a special case.
4313 (define_insn "ashlsi_17_24"
4314 [(set (match_operand:SI 0 "register_operand" "=d")
4315 (ashift:SI (match_operand:SI 1 "register_operand" "0")
4316 (match_operand:SI 2 "const_int_operand" "n")))]
4318 && INTVAL (operands[2]) > 16
4319 && INTVAL (operands[2]) <= 24"
4323 operands[2] = GEN_INT (INTVAL (operands[2]) - 16);
4324 return "lsl%.w %2,%0\;swap %0\;clr%.w %0";
4327 (define_insn "ashlsi3"
4328 [(set (match_operand:SI 0 "register_operand" "=d")
4329 (ashift:SI (match_operand:SI 1 "register_operand" "0")
4330 (match_operand:SI 2 "general_operand" "dI")))]
4333 if (operands[2] == const1_rtx)
4335 cc_status.flags = CC_NO_OVERFLOW;
4336 return "add%.l %0,%0";
4338 return "lsl%.l %2,%0";
4341 (define_insn "ashlhi3"
4342 [(set (match_operand:HI 0 "register_operand" "=d")
4343 (ashift:HI (match_operand:HI 1 "register_operand" "0")
4344 (match_operand:HI 2 "general_operand" "dI")))]
4349 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
4350 (ashift:HI (match_dup 0)
4351 (match_operand:HI 1 "general_operand" "dI")))]
4355 (define_insn "ashlqi3"
4356 [(set (match_operand:QI 0 "register_operand" "=d")
4357 (ashift:QI (match_operand:QI 1 "register_operand" "0")
4358 (match_operand:QI 2 "general_operand" "dI")))]
4363 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
4364 (ashift:QI (match_dup 0)
4365 (match_operand:QI 1 "general_operand" "dI")))]
4369 ;; On most 68k models, this makes faster code in a special case.
4371 (define_insn "ashrsi_16"
4372 [(set (match_operand:SI 0 "register_operand" "=d")
4373 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4376 "swap %0\;ext%.l %0")
4378 ;; On the 68000, this makes faster code in a special case.
4381 [(set (match_operand:SI 0 "register_operand" "=d")
4382 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4383 (match_operand:SI 2 "const_int_operand" "n")))]
4385 && INTVAL (operands[2]) > 16
4386 && INTVAL (operands[2]) <= 24"
4388 operands[2] = GEN_INT (INTVAL (operands[2]) - 16);
4389 return "swap %0\;asr%.w %2,%0\;ext%.l %0";
4392 (define_insn "subreghi1ashrdi_const32"
4393 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
4394 (subreg:HI (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro")
4395 (const_int 32)) 6))]
4398 if (GET_CODE (operands[1]) != REG)
4399 operands[1] = adjust_address (operands[1], HImode, 2);
4400 return "move%.w %1,%0";
4403 (define_insn "subregsi1ashrdi_const32"
4404 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
4405 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro")
4406 (const_int 32)) 4))]
4409 return "move%.l %1,%0";
4412 (define_insn "*ashrdi3_const1"
4413 [(set (match_operand:DI 0 "register_operand" "=d")
4414 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
4418 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4419 return "asr%.l #1,%0\;roxr%.l #1,%1";
4423 [(set (match_operand:DI 0 "register_operand" "")
4424 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4426 "reload_completed && !TARGET_COLDFIRE"
4428 (ashiftrt:DI (match_dup 1) (const_int 1)))
4430 (ashiftrt:DI (match_dup 0) (const_int 1)))]
4434 [(set (match_operand:DI 0 "register_operand" "")
4435 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4437 "reload_completed && !TARGET_COLDFIRE"
4439 (ashiftrt:DI (match_dup 1) (const_int 2)))
4441 (ashiftrt:DI (match_dup 0) (const_int 1)))]
4445 [(set (match_operand:DI 0 "register_operand" "")
4446 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4448 "reload_completed && !TARGET_COLDFIRE"
4449 [(set (strict_low_part (subreg:QI (match_dup 0) 7))
4450 (subreg:QI (match_dup 0) 3))
4452 (ashiftrt:SI (match_dup 2) (const_int 8)))
4454 (rotatert:SI (match_dup 3) (const_int 8)))]
4456 operands[2] = gen_highpart (SImode, operands[0]);
4457 operands[3] = gen_lowpart (SImode, operands[0]);
4461 [(set (match_operand:DI 0 "register_operand" "")
4462 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4464 "reload_completed && !TARGET_COLDFIRE"
4465 [(set (strict_low_part (subreg:HI (match_dup 0) 6))
4466 (subreg:HI (match_dup 0) 2))
4468 (rotate:SI (match_dup 2) (const_int 16)))
4470 (rotate:SI (match_dup 3) (const_int 16)))
4472 (sign_extend:SI (subreg:HI (match_dup 2) 2)))]
4474 operands[2] = gen_highpart (SImode, operands[0]);
4475 operands[3] = gen_lowpart (SImode, operands[0]);
4478 (define_insn "*ashrdi_const32"
4479 [(set (match_operand:DI 0 "register_operand" "=d")
4480 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_src_operand" "ro")
4486 return "move%.l %1,%R0\;smi %0\;extb%.l %0";
4488 return "move%.l %1,%R0\;smi %0\;ext%.w %0\;ext%.l %0";
4491 (define_insn "*ashrdi_const32_mem"
4492 [(set (match_operand:DI 0 "memory_operand" "=o,<")
4493 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_src_operand" "ro,ro")
4495 (clobber (match_scratch:SI 2 "=d,d"))]
4499 operands[3] = adjust_address (operands[0], SImode,
4500 which_alternative == 0 ? 4 : 0);
4501 operands[0] = adjust_address (operands[0], SImode, 0);
4502 if (TARGET_68020 || TARGET_COLDFIRE)
4503 return "move%.l %1,%3\;smi %2\;extb%.l %2\;move%.l %2,%0";
4505 return "move%.l %1,%3\;smi %2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0";
4509 [(set (match_operand:DI 0 "register_operand" "")
4510 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4512 "reload_completed && !TARGET_COLDFIRE"
4514 (ashiftrt:SI (match_dup 3) (const_int 31)))
4517 "split_di(operands, 1, operands + 2, operands + 3);")
4519 ;; The predicate below must be general_operand, because ashrdi3 allows that
4520 (define_insn "ashrdi_const"
4521 [(set (match_operand:DI 0 "register_operand" "=d")
4522 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
4523 (match_operand 2 "const_int_operand" "n")))]
4525 && ((INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3)
4526 || INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16
4527 || INTVAL (operands[2]) == 31
4528 || (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63))"
4530 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4532 if (INTVAL (operands[2]) == 48)
4533 return "swap %0\;ext%.l %0\;move%.l %0,%1\;smi %0\;ext%.w %0";
4534 if (INTVAL (operands[2]) == 31)
4535 return "add%.l %1,%1\;addx%.l %0,%0\;move%.l %0,%1\;subx%.l %0,%0";
4536 if (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63)
4538 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
4539 output_asm_insn (INTVAL (operands[2]) <= 8 ? "asr%.l %2,%0" :
4540 "moveq %2,%1\;asr%.l %1,%0", operands);
4541 output_asm_insn ("mov%.l %0,%1\;smi %0", operands);
4542 return INTVAL (operands[2]) >= 15 ? "ext%.w %d0" :
4543 TARGET_68020 ? "extb%.l %0" : "ext%.w %0\;ext%.l %0";
4548 (define_expand "ashrdi3"
4549 [(set (match_operand:DI 0 "register_operand" "")
4550 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4551 (match_operand 2 "const_int_operand" "")))]
4554 /* ??? This is a named pattern like this is not allowed to FAIL based
4556 if (GET_CODE (operands[2]) != CONST_INT
4557 || ((INTVAL (operands[2]) < 1 || INTVAL (operands[2]) > 3)
4558 && INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16
4559 && (INTVAL (operands[2]) < 31 || INTVAL (operands[2]) > 63)))
4563 ;; On all 68k models, this makes faster code in a special case.
4565 (define_insn "ashrsi_31"
4566 [(set (match_operand:SI 0 "register_operand" "=d")
4567 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4571 return "add%.l %0,%0\;subx%.l %0,%0";
4574 (define_insn "ashrsi3"
4575 [(set (match_operand:SI 0 "register_operand" "=d")
4576 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4577 (match_operand:SI 2 "general_operand" "dI")))]
4581 (define_insn "ashrhi3"
4582 [(set (match_operand:HI 0 "register_operand" "=d")
4583 (ashiftrt:HI (match_operand:HI 1 "register_operand" "0")
4584 (match_operand:HI 2 "general_operand" "dI")))]
4589 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
4590 (ashiftrt:HI (match_dup 0)
4591 (match_operand:HI 1 "general_operand" "dI")))]
4595 (define_insn "ashrqi3"
4596 [(set (match_operand:QI 0 "register_operand" "=d")
4597 (ashiftrt:QI (match_operand:QI 1 "register_operand" "0")
4598 (match_operand:QI 2 "general_operand" "dI")))]
4603 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
4604 (ashiftrt:QI (match_dup 0)
4605 (match_operand:QI 1 "general_operand" "dI")))]
4609 ;; logical shift instructions
4611 ;; commented out because of reload problems in 950612-1.c
4614 ;; (subreg:SI (lshiftrt:DI (match_operand:DI 0 "general_operand" "ro")
4615 ;; (const_int 32)) 4))
4616 ;; (set (match_operand:SI 1 "nonimmediate_operand" "=dm")
4617 ;; (subreg:SI (lshiftrt:DI (match_dup 0)
4618 ;; (const_int 32)) 4))]
4621 ;; return "move%.l %0,%1";
4626 ;; (subreg:SI (lshiftrt:DI (match_operand:DI 0 "general_operand" "ro")
4627 ;; (const_int 32)) 0))
4628 ;; (set (match_operand:DI 1 "nonimmediate_operand" "=do")
4629 ;; (lshiftrt:DI (match_dup 0)
4630 ;; (const_int 32)))]
4633 ;; if (GET_CODE (operands[1]) == REG)
4634 ;; operands[2] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
4636 ;; operands[2] = adjust_address (operands[1], SImode, 4);
4637 ;; return "move%.l %0,%2\;clr%.l %1";
4640 (define_insn "subreg1lshrdi_const32"
4641 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
4642 (subreg:SI (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro")
4643 (const_int 32)) 4))]
4646 return "move%.l %1,%0";
4649 (define_insn "*lshrdi3_const1"
4650 [(set (match_operand:DI 0 "register_operand" "=d")
4651 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
4654 "lsr%.l #1,%0\;roxr%.l #1,%R0")
4657 [(set (match_operand:DI 0 "register_operand" "")
4658 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
4660 "reload_completed && !TARGET_COLDFIRE"
4662 (lshiftrt:DI (match_dup 1) (const_int 1)))
4664 (lshiftrt:DI (match_dup 0) (const_int 1)))]
4668 [(set (match_operand:DI 0 "register_operand" "")
4669 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
4671 "reload_completed && !TARGET_COLDFIRE"
4673 (lshiftrt:DI (match_dup 1) (const_int 2)))
4675 (lshiftrt:DI (match_dup 0) (const_int 1)))]
4679 [(set (match_operand:DI 0 "register_operand" "")
4680 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
4682 "reload_completed && !TARGET_COLDFIRE"
4683 [(set (strict_low_part (subreg:QI (match_dup 0) 7))
4684 (subreg:QI (match_dup 0) 3))
4686 (lshiftrt:SI (match_dup 2) (const_int 8)))
4688 (rotatert:SI (match_dup 3) (const_int 8)))]
4690 operands[2] = gen_highpart (SImode, operands[0]);
4691 operands[3] = gen_lowpart (SImode, operands[0]);
4695 [(set (match_operand:DI 0 "register_operand" "")
4696 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
4698 "reload_completed && !TARGET_COLDFIRE"
4699 [(set (strict_low_part (subreg:HI (match_dup 0) 6))
4700 (subreg:HI (match_dup 0) 2))
4701 (set (strict_low_part (subreg:HI (match_dup 0) 2))
4704 (rotate:SI (match_dup 3) (const_int 16)))
4706 (rotate:SI (match_dup 2) (const_int 16)))]
4708 operands[2] = gen_highpart (SImode, operands[0]);
4709 operands[3] = gen_lowpart (SImode, operands[0]);
4713 [(set (match_operand:DI 0 "pre_dec_operand" "")
4714 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "")
4717 [(set (match_dup 0) (match_dup 1))
4718 (set (match_dup 0) (const_int 0))]
4720 operands[0] = adjust_address(operands[0], SImode, 0);
4721 operands[1] = gen_highpart(SImode, operands[1]);
4725 [(set (match_operand:DI 0 "post_inc_operand" "")
4726 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "")
4729 [(set (match_dup 0) (const_int 0))
4730 (set (match_dup 0) (match_dup 1))]
4732 operands[0] = adjust_address(operands[0], SImode, 0);
4733 operands[1] = gen_highpart(SImode, operands[1]);
4737 [(set (match_operand:DI 0 "nonimmediate_operand" "")
4738 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "")
4741 [(set (match_dup 2) (match_dup 5))
4742 (set (match_dup 4) (const_int 0))]
4743 "split_di(operands, 2, operands + 2, operands + 4);")
4745 (define_insn "*lshrdi_const32"
4746 [(set (match_operand:DI 0 "nonimmediate_operand" "=ro<>")
4747 (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro")
4753 [(set (match_operand:DI 0 "register_operand" "")
4754 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
4755 (match_operand 2 "const_int_operand" "")))]
4756 "reload_completed && !TARGET_COLDFIRE
4757 && INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 40"
4758 [(set (match_dup 3) (lshiftrt:SI (match_dup 3) (match_dup 2)))
4759 (set (match_dup 4) (match_dup 3))
4760 (set (match_dup 3) (const_int 0))]
4762 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
4763 operands[3] = gen_highpart (SImode, operands[0]);
4764 operands[4] = gen_lowpart (SImode, operands[0]);
4768 [(set (match_operand:DI 0 "register_operand" "")
4769 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
4772 [(set (match_dup 3) (match_dup 2))
4773 (set (strict_low_part (subreg:HI (match_dup 0) 6))
4775 (set (match_dup 2) (const_int 0))
4777 (rotate:SI (match_dup 3) (const_int 16)))]
4779 operands[2] = gen_highpart (SImode, operands[0]);
4780 operands[3] = gen_lowpart (SImode, operands[0]);
4784 [(set (match_operand:DI 0 "register_operand" "")
4785 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
4786 (match_operand 2 "const_int_operand" "")))]
4787 "reload_completed && !TARGET_COLDFIRE
4788 && INTVAL (operands[2]) > 40 && INTVAL (operands[2]) <= 62"
4789 [(set (match_dup 4) (match_dup 2))
4790 (set (match_dup 3) (lshiftrt:SI (match_dup 3) (match_dup 4)))
4791 (set (match_dup 4) (match_dup 3))
4792 (set (match_dup 3) (const_int 0))]
4794 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
4795 operands[3] = gen_highpart (SImode, operands[0]);
4796 operands[4] = gen_lowpart (SImode, operands[0]);
4799 (define_insn "*lshrdi_const63"
4800 [(set (match_operand:DI 0 "register_operand" "=d")
4801 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
4804 "add%.l %0,%0\;clr%.l %0\;clr%.l %R1\;addx%.l %R1,%R1")
4806 (define_insn "*lshrdi3_const"
4807 [(set (match_operand:DI 0 "register_operand" "=d")
4808 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
4809 (match_operand 2 "const_int_operand" "n")))]
4811 && ((INTVAL (operands[2]) >= 2 && INTVAL (operands[2]) <= 3)
4812 || INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16
4813 || (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63)))"
4816 (define_expand "lshrdi3"
4817 [(set (match_operand:DI 0 "register_operand" "")
4818 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
4819 (match_operand 2 "const_int_operand" "")))]
4822 /* ??? This is a named pattern like this is not allowed to FAIL based
4824 if (GET_CODE (operands[2]) != CONST_INT
4825 || ((INTVAL (operands[2]) < 1 || INTVAL (operands[2]) > 3)
4826 && INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16
4827 && (INTVAL (operands[2]) < 32 || INTVAL (operands[2]) > 63)))
4831 ;; On all 68k models, this makes faster code in a special case.
4833 (define_insn "lshrsi_31"
4834 [(set (match_operand:SI 0 "register_operand" "=d")
4835 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
4839 return "add%.l %0,%0\;subx%.l %0,%0\;neg%.l %0";
4842 ;; On most 68k models, this makes faster code in a special case.
4844 (define_insn "lshrsi_16"
4845 [(set (match_operand:SI 0 "register_operand" "=d")
4846 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
4851 return "clr%.w %0\;swap %0";
4854 ;; On the 68000, this makes faster code in a special case.
4856 (define_insn "lshrsi_17_24"
4857 [(set (match_operand:SI 0 "register_operand" "=d")
4858 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
4859 (match_operand:SI 2 "const_int_operand" "n")))]
4861 && INTVAL (operands[2]) > 16
4862 && INTVAL (operands[2]) <= 24"
4864 /* I think lsr%.w sets the CC properly. */
4865 operands[2] = GEN_INT (INTVAL (operands[2]) - 16);
4866 return "clr%.w %0\;swap %0\;lsr%.w %2,%0";
4869 (define_insn "lshrsi3"
4870 [(set (match_operand:SI 0 "register_operand" "=d")
4871 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
4872 (match_operand:SI 2 "general_operand" "dI")))]
4876 (define_insn "lshrhi3"
4877 [(set (match_operand:HI 0 "register_operand" "=d")
4878 (lshiftrt:HI (match_operand:HI 1 "register_operand" "0")
4879 (match_operand:HI 2 "general_operand" "dI")))]
4884 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
4885 (lshiftrt:HI (match_dup 0)
4886 (match_operand:HI 1 "general_operand" "dI")))]
4890 (define_insn "lshrqi3"
4891 [(set (match_operand:QI 0 "register_operand" "=d")
4892 (lshiftrt:QI (match_operand:QI 1 "register_operand" "0")
4893 (match_operand:QI 2 "general_operand" "dI")))]
4898 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
4899 (lshiftrt:QI (match_dup 0)
4900 (match_operand:QI 1 "general_operand" "dI")))]
4904 ;; rotate instructions
4906 (define_insn "rotlsi3"
4907 [(set (match_operand:SI 0 "register_operand" "=d")
4908 (rotate:SI (match_operand:SI 1 "register_operand" "0")
4909 (match_operand:SI 2 "general_operand" "dINO")))]
4912 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 16)
4914 else if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 16)
4916 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
4917 return "ror%.l %2,%0";
4920 return "rol%.l %2,%0";
4923 (define_insn "rotlhi3"
4924 [(set (match_operand:HI 0 "register_operand" "=d")
4925 (rotate:HI (match_operand:HI 1 "register_operand" "0")
4926 (match_operand:HI 2 "general_operand" "dIP")))]
4929 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 8)
4931 operands[2] = GEN_INT (16 - INTVAL (operands[2]));
4932 return "ror%.w %2,%0";
4935 return "rol%.w %2,%0";
4939 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
4940 (rotate:HI (match_dup 0)
4941 (match_operand:HI 1 "general_operand" "dIP")))]
4944 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 8)
4946 operands[2] = GEN_INT (16 - INTVAL (operands[2]));
4947 return "ror%.w %2,%0";
4950 return "rol%.w %2,%0";
4953 (define_insn "rotlqi3"
4954 [(set (match_operand:QI 0 "register_operand" "=d")
4955 (rotate:QI (match_operand:QI 1 "register_operand" "0")
4956 (match_operand:QI 2 "general_operand" "dI")))]
4959 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 4)
4961 operands[2] = GEN_INT (8 - INTVAL (operands[2]));
4962 return "ror%.b %2,%0";
4965 return "rol%.b %2,%0";
4969 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
4970 (rotate:QI (match_dup 0)
4971 (match_operand:QI 1 "general_operand" "dI")))]
4974 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 4)
4976 operands[2] = GEN_INT (8 - INTVAL (operands[2]));
4977 return "ror%.b %2,%0";
4980 return "rol%.b %2,%0";
4983 (define_insn "rotrsi3"
4984 [(set (match_operand:SI 0 "register_operand" "=d")
4985 (rotatert:SI (match_operand:SI 1 "register_operand" "0")
4986 (match_operand:SI 2 "general_operand" "dI")))]
4990 (define_insn "rotrhi3"
4991 [(set (match_operand:HI 0 "register_operand" "=d")
4992 (rotatert:HI (match_operand:HI 1 "register_operand" "0")
4993 (match_operand:HI 2 "general_operand" "dI")))]
4998 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
4999 (rotatert:HI (match_dup 0)
5000 (match_operand:HI 1 "general_operand" "dI")))]
5004 (define_insn "rotrqi3"
5005 [(set (match_operand:QI 0 "register_operand" "=d")
5006 (rotatert:QI (match_operand:QI 1 "register_operand" "0")
5007 (match_operand:QI 2 "general_operand" "dI")))]
5012 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
5013 (rotatert:QI (match_dup 0)
5014 (match_operand:QI 1 "general_operand" "dI")))]
5019 ;; Bit set/clear in memory byte.
5021 ;; set bit, bit number is int
5022 (define_insn "bsetmemqi"
5023 [(set (match_operand:QI 0 "memory_operand" "+m")
5024 (ior:QI (subreg:QI (ashift:SI (const_int 1)
5025 (match_operand:SI 1 "general_operand" "d")) 3)
5030 return "bset %1,%0";
5033 ;; set bit, bit number is (sign/zero)_extended from HImode/QImode
5035 [(set (match_operand:QI 0 "memory_operand" "+m")
5036 (ior:QI (subreg:QI (ashift:SI (const_int 1)
5037 (match_operator:SI 2 "extend_operator"
5038 [(match_operand 1 "general_operand" "d")])) 3)
5043 return "bset %1,%0";
5046 ;; clear bit, bit number is int
5047 (define_insn "bclrmemqi"
5048 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+m")
5050 (minus:SI (const_int 7)
5051 (match_operand:SI 1 "general_operand" "d")))
5056 return "bclr %1,%0";
5059 ;; clear bit, bit number is (sign/zero)_extended from HImode/QImode
5061 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+m")
5063 (minus:SI (const_int 7)
5064 (match_operator:SI 2 "extend_operator"
5065 [(match_operand 1 "general_operand" "d")])))
5070 return "bclr %1,%0";
5073 ;; Special cases of bit-field insns which we should
5074 ;; recognize in preference to the general case.
5075 ;; These handle aligned 8-bit and 16-bit fields,
5076 ;; which can usually be done with move instructions.
5079 ; Special case for 32-bit field in memory. This only occurs when 32-bit
5080 ; alignment of structure members is specified.
5082 ; The move is allowed to be odd byte aligned, because that's still faster
5083 ; than an odd byte aligned bit-field instruction.
5086 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5088 (match_operand:SI 1 "const_int_operand" "n"))
5089 (match_operand:SI 2 "general_src_operand" "rmSi"))]
5090 "TARGET_68020 && TARGET_BITFIELD
5091 && (INTVAL (operands[1]) % 8) == 0
5092 && ! mode_dependent_address_p (XEXP (operands[0], 0))"
5095 = adjust_address (operands[0], SImode, INTVAL (operands[1]) / 8);
5097 return "move%.l %2,%0";
5101 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+do")
5102 (match_operand:SI 1 "const_int_operand" "n")
5103 (match_operand:SI 2 "const_int_operand" "n"))
5104 (match_operand:SI 3 "register_operand" "d"))]
5105 "TARGET_68020 && TARGET_BITFIELD
5106 && (INTVAL (operands[1]) == 8 || INTVAL (operands[1]) == 16)
5107 && INTVAL (operands[2]) % INTVAL (operands[1]) == 0
5108 && (GET_CODE (operands[0]) == REG
5109 || ! mode_dependent_address_p (XEXP (operands[0], 0)))"
5111 if (REG_P (operands[0]))
5113 if (INTVAL (operands[1]) + INTVAL (operands[2]) != 32)
5114 return "bfins %3,%0{%b2:%b1}";
5117 operands[0] = adjust_address (operands[0],
5118 INTVAL (operands[1]) == 8 ? QImode : HImode,
5119 INTVAL (operands[2]) / 8);
5121 if (GET_CODE (operands[3]) == MEM)
5122 operands[3] = adjust_address (operands[3],
5123 INTVAL (operands[1]) == 8 ? QImode : HImode,
5124 (32 - INTVAL (operands[1])) / 8);
5126 if (INTVAL (operands[1]) == 8)
5127 return "move%.b %3,%0";
5128 return "move%.w %3,%0";
5133 ; Special case for 32-bit field in memory. This only occurs when 32-bit
5134 ; alignment of structure members is specified.
5136 ; The move is allowed to be odd byte aligned, because that's still faster
5137 ; than an odd byte aligned bit-field instruction.
5140 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
5141 (zero_extract:SI (match_operand:QI 1 "memory_src_operand" "oS")
5143 (match_operand:SI 2 "const_int_operand" "n")))]
5144 "TARGET_68020 && TARGET_BITFIELD
5145 && (INTVAL (operands[2]) % 8) == 0
5146 && ! mode_dependent_address_p (XEXP (operands[1], 0))"
5149 = adjust_address (operands[1], SImode, INTVAL (operands[2]) / 8);
5151 return "move%.l %1,%0";
5155 [(set (match_operand:SI 0 "nonimmediate_operand" "=&d")
5156 (zero_extract:SI (match_operand:SI 1 "register_operand" "do")
5157 (match_operand:SI 2 "const_int_operand" "n")
5158 (match_operand:SI 3 "const_int_operand" "n")))]
5159 "TARGET_68020 && TARGET_BITFIELD
5160 && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
5161 && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
5162 && (GET_CODE (operands[1]) == REG
5163 || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
5165 cc_status.flags |= CC_NOT_NEGATIVE;
5166 if (REG_P (operands[1]))
5168 if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
5169 return "bfextu %1{%b3:%b2},%0";
5173 = adjust_address (operands[1], SImode, INTVAL (operands[3]) / 8);
5175 output_asm_insn ("clr%.l %0", operands);
5176 if (GET_CODE (operands[0]) == MEM)
5177 operands[0] = adjust_address (operands[0],
5178 INTVAL (operands[2]) == 8 ? QImode : HImode,
5179 (32 - INTVAL (operands[1])) / 8);
5181 if (INTVAL (operands[2]) == 8)
5182 return "move%.b %1,%0";
5183 return "move%.w %1,%0";
5187 ; Special case for 32-bit field in memory. This only occurs when 32-bit
5188 ; alignment of structure members is specified.
5190 ; The move is allowed to be odd byte aligned, because that's still faster
5191 ; than an odd byte aligned bit-field instruction.
5194 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
5195 (sign_extract:SI (match_operand:QI 1 "memory_src_operand" "oS")
5197 (match_operand:SI 2 "const_int_operand" "n")))]
5198 "TARGET_68020 && TARGET_BITFIELD
5199 && (INTVAL (operands[2]) % 8) == 0
5200 && ! mode_dependent_address_p (XEXP (operands[1], 0))"
5203 = adjust_address (operands[1], SImode, INTVAL (operands[2]) / 8);
5205 return "move%.l %1,%0";
5209 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
5210 (sign_extract:SI (match_operand:SI 1 "register_operand" "do")
5211 (match_operand:SI 2 "const_int_operand" "n")
5212 (match_operand:SI 3 "const_int_operand" "n")))]
5213 "TARGET_68020 && TARGET_BITFIELD
5214 && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
5215 && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
5216 && (GET_CODE (operands[1]) == REG
5217 || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
5219 if (REG_P (operands[1]))
5221 if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
5222 return "bfexts %1{%b3:%b2},%0";
5226 = adjust_address (operands[1],
5227 INTVAL (operands[2]) == 8 ? QImode : HImode,
5228 INTVAL (operands[3]) / 8);
5230 if (INTVAL (operands[2]) == 8)
5231 return "move%.b %1,%0\;extb%.l %0";
5232 return "move%.w %1,%0\;ext%.l %0";
5235 ;; Bit-field instructions, general cases.
5236 ;; "o,d" constraint causes a nonoffsettable memref to match the "o"
5237 ;; so that its address is reloaded.
5239 (define_expand "extv"
5240 [(set (match_operand:SI 0 "register_operand" "")
5241 (sign_extract:SI (match_operand:SI 1 "general_operand" "")
5242 (match_operand:SI 2 "const_int_operand" "")
5243 (match_operand:SI 3 "const_int_operand" "")))]
5244 "TARGET_68020 && TARGET_BITFIELD"
5248 [(set (match_operand:SI 0 "register_operand" "=d")
5249 (sign_extract:SI (match_operand:QI 1 "memory_operand" "o")
5250 (match_operand:SI 2 "nonmemory_operand" "dn")
5251 (match_operand:SI 3 "nonmemory_operand" "dn")))]
5252 "TARGET_68020 && TARGET_BITFIELD"
5253 "bfexts %1{%b3:%b2},%0")
5255 (define_expand "extzv"
5256 [(set (match_operand:SI 0 "register_operand" "")
5257 (zero_extract:SI (match_operand:SI 1 "general_operand" "")
5258 (match_operand:SI 2 "const_int_operand" "")
5259 (match_operand:SI 3 "const_int_operand" "")))]
5260 "TARGET_68020 && TARGET_BITFIELD"
5264 [(set (match_operand:SI 0 "register_operand" "=d")
5265 (zero_extract:SI (match_operand:QI 1 "memory_operand" "o")
5266 (match_operand:SI 2 "nonmemory_operand" "dn")
5267 (match_operand:SI 3 "nonmemory_operand" "dn")))]
5268 "TARGET_68020 && TARGET_BITFIELD"
5270 if (GET_CODE (operands[2]) == CONST_INT)
5272 if (INTVAL (operands[2]) != 32)
5273 cc_status.flags |= CC_NOT_NEGATIVE;
5279 return "bfextu %1{%b3:%b2},%0";
5283 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5284 (match_operand:SI 1 "nonmemory_operand" "dn")
5285 (match_operand:SI 2 "nonmemory_operand" "dn"))
5286 (xor:SI (zero_extract:SI (match_dup 0) (match_dup 1) (match_dup 2))
5287 (match_operand 3 "const_int_operand" "n")))]
5288 "TARGET_68020 && TARGET_BITFIELD
5289 && (INTVAL (operands[3]) == -1
5290 || (GET_CODE (operands[1]) == CONST_INT
5291 && (~ INTVAL (operands[3]) & ((1 << INTVAL (operands[1]))- 1)) == 0))"
5294 return "bfchg %0{%b2:%b1}";
5298 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5299 (match_operand:SI 1 "nonmemory_operand" "dn")
5300 (match_operand:SI 2 "nonmemory_operand" "dn"))
5302 "TARGET_68020 && TARGET_BITFIELD"
5305 return "bfclr %0{%b2:%b1}";
5309 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5310 (match_operand:SI 1 "general_operand" "dn")
5311 (match_operand:SI 2 "general_operand" "dn"))
5313 "TARGET_68020 && TARGET_BITFIELD"
5316 return "bfset %0{%b2:%b1}";
5319 (define_expand "insv"
5320 [(set (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "")
5321 (match_operand:SI 1 "const_int_operand" "")
5322 (match_operand:SI 2 "const_int_operand" ""))
5323 (match_operand:SI 3 "register_operand" ""))]
5324 "TARGET_68020 && TARGET_BITFIELD"
5328 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5329 (match_operand:SI 1 "nonmemory_operand" "dn")
5330 (match_operand:SI 2 "nonmemory_operand" "dn"))
5331 (match_operand:SI 3 "register_operand" "d"))]
5332 "TARGET_68020 && TARGET_BITFIELD"
5333 "bfins %3,%0{%b2:%b1}")
5335 ;; Now recognize bit-field insns that operate on registers
5336 ;; (or at least were intended to do so).
5339 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
5340 (sign_extract:SI (match_operand:SI 1 "register_operand" "d")
5341 (match_operand:SI 2 "const_int_operand" "n")
5342 (match_operand:SI 3 "const_int_operand" "n")))]
5343 "TARGET_68020 && TARGET_BITFIELD"
5344 "bfexts %1{%b3:%b2},%0")
5347 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
5348 (zero_extract:SI (match_operand:SI 1 "register_operand" "d")
5349 (match_operand:SI 2 "const_int_operand" "n")
5350 (match_operand:SI 3 "const_int_operand" "n")))]
5351 "TARGET_68020 && TARGET_BITFIELD"
5353 if (GET_CODE (operands[2]) == CONST_INT)
5355 if (INTVAL (operands[2]) != 32)
5356 cc_status.flags |= CC_NOT_NEGATIVE;
5362 return "bfextu %1{%b3:%b2},%0";
5366 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
5367 (match_operand:SI 1 "const_int_operand" "n")
5368 (match_operand:SI 2 "const_int_operand" "n"))
5370 "TARGET_68020 && TARGET_BITFIELD"
5373 return "bfclr %0{%b2:%b1}";
5377 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
5378 (match_operand:SI 1 "const_int_operand" "n")
5379 (match_operand:SI 2 "const_int_operand" "n"))
5381 "TARGET_68020 && TARGET_BITFIELD"
5384 return "bfset %0{%b2:%b1}";
5388 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
5389 (match_operand:SI 1 "const_int_operand" "n")
5390 (match_operand:SI 2 "const_int_operand" "n"))
5391 (match_operand:SI 3 "register_operand" "d"))]
5392 "TARGET_68020 && TARGET_BITFIELD"
5395 /* These special cases are now recognized by a specific pattern. */
5396 if (GET_CODE (operands[1]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT
5397 && INTVAL (operands[1]) == 16 && INTVAL (operands[2]) == 16)
5398 return "move%.w %3,%0";
5399 if (GET_CODE (operands[1]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT
5400 && INTVAL (operands[1]) == 24 && INTVAL (operands[2]) == 8)
5401 return "move%.b %3,%0";
5403 return "bfins %3,%0{%b2:%b1}";
5406 ;; Special patterns for optimizing bit-field instructions.
5410 (zero_extract:SI (match_operand:QI 0 "memory_operand" "o")
5411 (match_operand:SI 1 "const_int_operand" "n")
5412 (match_operand:SI 2 "general_operand" "dn")))]
5413 "TARGET_68020 && TARGET_BITFIELD"
5415 if (operands[1] == const1_rtx
5416 && GET_CODE (operands[2]) == CONST_INT)
5418 int width = GET_CODE (operands[0]) == REG ? 31 : 7;
5419 return output_btst (operands,
5420 GEN_INT (width - INTVAL (operands[2])),
5421 operands[0], insn, 1000);
5422 /* Pass 1000 as SIGNPOS argument so that btst will
5423 not think we are testing the sign bit for an `and'
5424 and assume that nonzero implies a negative result. */
5426 if (INTVAL (operands[1]) != 32)
5427 cc_status.flags = CC_NOT_NEGATIVE;
5428 return "bftst %0{%b2:%b1}";
5432 ;;; now handle the register cases
5435 (zero_extract:SI (match_operand:SI 0 "register_operand" "d")
5436 (match_operand:SI 1 "const_int_operand" "n")
5437 (match_operand:SI 2 "general_operand" "dn")))]
5438 "TARGET_68020 && TARGET_BITFIELD"
5440 if (operands[1] == const1_rtx
5441 && GET_CODE (operands[2]) == CONST_INT)
5443 int width = GET_CODE (operands[0]) == REG ? 31 : 7;
5444 return output_btst (operands, GEN_INT (width - INTVAL (operands[2])),
5445 operands[0], insn, 1000);
5446 /* Pass 1000 as SIGNPOS argument so that btst will
5447 not think we are testing the sign bit for an `and'
5448 and assume that nonzero implies a negative result. */
5450 if (INTVAL (operands[1]) != 32)
5451 cc_status.flags = CC_NOT_NEGATIVE;
5452 return "bftst %0{%b2:%b1}";
5455 (define_insn "scc0_di"
5456 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
5457 (match_operator 1 "valid_dbcc_comparison_p"
5458 [(match_operand:DI 2 "general_operand" "ro") (const_int 0)]))]
5461 return output_scc_di (operands[1], operands[2], const0_rtx, operands[0]);
5464 (define_insn "scc0_di_5200"
5465 [(set (match_operand:QI 0 "nonimmediate_operand" "=d")
5466 (match_operator 1 "valid_dbcc_comparison_p"
5467 [(match_operand:DI 2 "general_operand" "ro") (const_int 0)]))]
5470 return output_scc_di (operands[1], operands[2], const0_rtx, operands[0]);
5473 (define_insn "scc_di"
5474 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,dm")
5475 (match_operator 1 "valid_dbcc_comparison_p"
5476 [(match_operand:DI 2 "general_operand" "ro,r")
5477 (match_operand:DI 3 "general_operand" "r,ro")]))]
5480 return output_scc_di (operands[1], operands[2], operands[3], operands[0]);
5483 (define_insn "scc_di_5200"
5484 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d")
5485 (match_operator 1 "valid_dbcc_comparison_p"
5486 [(match_operand:DI 2 "general_operand" "ro,r")
5487 (match_operand:DI 3 "general_operand" "r,ro")]))]
5490 return output_scc_di (operands[1], operands[2], operands[3], operands[0]);
5493 ;; Note that operand 0 of an SCC insn is supported in the hardware as
5494 ;; memory, but we cannot allow it to be in memory in case the address
5495 ;; needs to be reloaded.
5497 (define_expand "seq"
5498 [(set (match_operand:QI 0 "register_operand" "")
5499 (eq:QI (cc0) (const_int 0)))]
5502 if ((TUNE_68060 || TARGET_COLDFIRE_FPU)
5503 && m68k_last_compare_had_fp_operands)
5505 m68k_last_compare_had_fp_operands = 0;
5511 [(set (match_operand:QI 0 "register_operand" "=d")
5512 (eq:QI (cc0) (const_int 0)))]
5515 cc_status = cc_prev_status;
5516 OUTPUT_JUMP ("seq %0", "fseq %0", "seq %0");
5519 (define_expand "sne"
5520 [(set (match_operand:QI 0 "register_operand" "")
5521 (ne:QI (cc0) (const_int 0)))]
5524 if ((TUNE_68060 || TARGET_COLDFIRE_FPU)
5525 && m68k_last_compare_had_fp_operands)
5527 m68k_last_compare_had_fp_operands = 0;
5533 [(set (match_operand:QI 0 "register_operand" "=d")
5534 (ne:QI (cc0) (const_int 0)))]
5537 cc_status = cc_prev_status;
5538 OUTPUT_JUMP ("sne %0", "fsne %0", "sne %0");
5541 (define_expand "sgt"
5542 [(set (match_operand:QI 0 "register_operand" "")
5543 (gt:QI (cc0) (const_int 0)))]
5546 if ((TUNE_68060 || TARGET_COLDFIRE_FPU)
5547 && m68k_last_compare_had_fp_operands)
5549 m68k_last_compare_had_fp_operands = 0;
5555 [(set (match_operand:QI 0 "register_operand" "=d")
5556 (gt:QI (cc0) (const_int 0)))]
5559 cc_status = cc_prev_status;
5560 OUTPUT_JUMP ("sgt %0", "fsgt %0", 0);
5563 (define_expand "sgtu"
5564 [(set (match_operand:QI 0 "register_operand" "")
5565 (gtu:QI (cc0) (const_int 0)))]
5570 [(set (match_operand:QI 0 "register_operand" "=d")
5571 (gtu:QI (cc0) (const_int 0)))]
5574 cc_status = cc_prev_status;
5578 (define_expand "slt"
5579 [(set (match_operand:QI 0 "register_operand" "")
5580 (lt:QI (cc0) (const_int 0)))]
5583 if ((TUNE_68060 || TARGET_COLDFIRE_FPU)
5584 && m68k_last_compare_had_fp_operands)
5586 m68k_last_compare_had_fp_operands = 0;
5592 [(set (match_operand:QI 0 "register_operand" "=d")
5593 (lt:QI (cc0) (const_int 0)))]
5596 cc_status = cc_prev_status;
5597 OUTPUT_JUMP ("slt %0", "fslt %0", "smi %0");
5600 (define_expand "sltu"
5601 [(set (match_operand:QI 0 "register_operand" "")
5602 (ltu:QI (cc0) (const_int 0)))]
5607 [(set (match_operand:QI 0 "register_operand" "=d")
5608 (ltu:QI (cc0) (const_int 0)))]
5611 cc_status = cc_prev_status;
5615 (define_expand "sge"
5616 [(set (match_operand:QI 0 "register_operand" "")
5617 (ge:QI (cc0) (const_int 0)))]
5620 if ((TUNE_68060 || TARGET_COLDFIRE_FPU)
5621 && m68k_last_compare_had_fp_operands)
5623 m68k_last_compare_had_fp_operands = 0;
5629 [(set (match_operand:QI 0 "register_operand" "=d")
5630 (ge:QI (cc0) (const_int 0)))]
5633 cc_status = cc_prev_status;
5634 OUTPUT_JUMP ("sge %0", "fsge %0", "spl %0");
5637 (define_expand "sgeu"
5638 [(set (match_operand:QI 0 "register_operand" "")
5639 (geu:QI (cc0) (const_int 0)))]
5644 [(set (match_operand:QI 0 "register_operand" "=d")
5645 (geu:QI (cc0) (const_int 0)))]
5648 cc_status = cc_prev_status;
5652 (define_expand "sle"
5653 [(set (match_operand:QI 0 "register_operand" "")
5654 (le:QI (cc0) (const_int 0)))]
5657 if ((TUNE_68060 || TARGET_COLDFIRE_FPU)
5658 && m68k_last_compare_had_fp_operands)
5660 m68k_last_compare_had_fp_operands = 0;
5666 [(set (match_operand:QI 0 "register_operand" "=d")
5667 (le:QI (cc0) (const_int 0)))]
5670 cc_status = cc_prev_status;
5671 OUTPUT_JUMP ("sle %0", "fsle %0", 0);
5674 (define_expand "sleu"
5675 [(set (match_operand:QI 0 "register_operand" "")
5676 (leu:QI (cc0) (const_int 0)))]
5681 [(set (match_operand:QI 0 "register_operand" "=d")
5682 (leu:QI (cc0) (const_int 0)))]
5685 cc_status = cc_prev_status;
5689 (define_expand "sordered"
5690 [(set (match_operand:QI 0 "register_operand" "")
5691 (ordered:QI (cc0) (const_int 0)))]
5692 "TARGET_68881 && !TUNE_68060"
5694 gcc_assert (m68k_last_compare_had_fp_operands);
5695 m68k_last_compare_had_fp_operands = 0;
5698 (define_insn "*sordered_1"
5699 [(set (match_operand:QI 0 "register_operand" "=d")
5700 (ordered:QI (cc0) (const_int 0)))]
5701 "TARGET_68881 && !TUNE_68060"
5703 cc_status = cc_prev_status;
5707 (define_expand "sunordered"
5708 [(set (match_operand:QI 0 "register_operand" "")
5709 (unordered:QI (cc0) (const_int 0)))]
5710 "TARGET_68881 && !TUNE_68060"
5712 gcc_assert (m68k_last_compare_had_fp_operands);
5713 m68k_last_compare_had_fp_operands = 0;
5716 (define_insn "*sunordered_1"
5717 [(set (match_operand:QI 0 "register_operand" "=d")
5718 (unordered:QI (cc0) (const_int 0)))]
5719 "TARGET_68881 && !TUNE_68060"
5721 cc_status = cc_prev_status;
5725 (define_expand "suneq"
5726 [(set (match_operand:QI 0 "register_operand" "")
5727 (uneq:QI (cc0) (const_int 0)))]
5728 "TARGET_68881 && !TUNE_68060"
5730 gcc_assert (m68k_last_compare_had_fp_operands);
5731 m68k_last_compare_had_fp_operands = 0;
5734 (define_insn "*suneq_1"
5735 [(set (match_operand:QI 0 "register_operand" "=d")
5736 (uneq:QI (cc0) (const_int 0)))]
5737 "TARGET_68881 && !TUNE_68060"
5739 cc_status = cc_prev_status;
5743 (define_expand "sunge"
5744 [(set (match_operand:QI 0 "register_operand" "")
5745 (unge:QI (cc0) (const_int 0)))]
5746 "TARGET_68881 && !TUNE_68060"
5748 gcc_assert (m68k_last_compare_had_fp_operands);
5749 m68k_last_compare_had_fp_operands = 0;
5752 (define_insn "*sunge_1"
5753 [(set (match_operand:QI 0 "register_operand" "=d")
5754 (unge:QI (cc0) (const_int 0)))]
5755 "TARGET_68881 && !TUNE_68060"
5757 cc_status = cc_prev_status;
5761 (define_expand "sungt"
5762 [(set (match_operand:QI 0 "register_operand" "")
5763 (ungt:QI (cc0) (const_int 0)))]
5764 "TARGET_68881 && !TUNE_68060"
5766 gcc_assert (m68k_last_compare_had_fp_operands);
5767 m68k_last_compare_had_fp_operands = 0;
5770 (define_insn "*sungt_1"
5771 [(set (match_operand:QI 0 "register_operand" "=d")
5772 (ungt:QI (cc0) (const_int 0)))]
5773 "TARGET_68881 && !TUNE_68060"
5775 cc_status = cc_prev_status;
5779 (define_expand "sunle"
5780 [(set (match_operand:QI 0 "register_operand" "")
5781 (unle:QI (cc0) (const_int 0)))]
5782 "TARGET_68881 && !TUNE_68060"
5784 gcc_assert (m68k_last_compare_had_fp_operands);
5785 m68k_last_compare_had_fp_operands = 0;
5788 (define_insn "*sunle_1"
5789 [(set (match_operand:QI 0 "register_operand" "=d")
5790 (unle:QI (cc0) (const_int 0)))]
5791 "TARGET_68881 && !TUNE_68060"
5793 cc_status = cc_prev_status;
5797 (define_expand "sunlt"
5798 [(set (match_operand:QI 0 "register_operand" "")
5799 (unlt:QI (cc0) (const_int 0)))]
5800 "TARGET_68881 && !TUNE_68060"
5802 gcc_assert (m68k_last_compare_had_fp_operands);
5803 m68k_last_compare_had_fp_operands = 0;
5806 (define_insn "*sunlt_1"
5807 [(set (match_operand:QI 0 "register_operand" "=d")
5808 (unlt:QI (cc0) (const_int 0)))]
5809 "TARGET_68881 && !TUNE_68060"
5811 cc_status = cc_prev_status;
5815 (define_expand "sltgt"
5816 [(set (match_operand:QI 0 "register_operand" "")
5817 (ltgt:QI (cc0) (const_int 0)))]
5818 "TARGET_68881 && !TUNE_68060"
5820 gcc_assert (m68k_last_compare_had_fp_operands);
5821 m68k_last_compare_had_fp_operands = 0;
5824 (define_insn "*sltgt_1"
5825 [(set (match_operand:QI 0 "register_operand" "=d")
5826 (ltgt:QI (cc0) (const_int 0)))]
5827 "TARGET_68881 && !TUNE_68060"
5829 cc_status = cc_prev_status;
5833 (define_insn "*fsogt_1"
5834 [(set (match_operand:QI 0 "register_operand" "=d")
5835 (not:QI (unle:QI (cc0) (const_int 0))))]
5836 "TARGET_68881 && !TUNE_68060"
5838 cc_status = cc_prev_status;
5842 (define_insn "*fsoge_1"
5843 [(set (match_operand:QI 0 "register_operand" "=d")
5844 (not:QI (unlt:QI (cc0) (const_int 0))))]
5845 "TARGET_68881 && !TUNE_68060"
5847 cc_status = cc_prev_status;
5851 (define_insn "*fsolt_1"
5852 [(set (match_operand:QI 0 "register_operand" "=d")
5853 (not:QI (unge:QI (cc0) (const_int 0))))]
5854 "TARGET_68881 && !TUNE_68060"
5856 cc_status = cc_prev_status;
5860 (define_insn "*fsole_1"
5861 [(set (match_operand:QI 0 "register_operand" "=d")
5862 (not:QI (ungt:QI (cc0) (const_int 0))))]
5863 "TARGET_68881 && !TUNE_68060"
5865 cc_status = cc_prev_status;
5869 ;; Basic conditional jump instructions.
5871 (define_insn "beq0_di"
5873 (if_then_else (eq (match_operand:DI 0 "general_operand" "d*ao,<>")
5875 (label_ref (match_operand 1 "" ","))
5877 (clobber (match_scratch:SI 2 "=d,d"))]
5881 if (which_alternative == 1)
5884 return "move%.l %0,%2\;or%.l %0,%2\;jbeq %l1";
5886 return "move%.l %0,%2\;or%.l %0,%2\;jeq %l1";
5888 if ((cc_prev_status.value1
5889 && rtx_equal_p (cc_prev_status.value1, operands[0]))
5890 || (cc_prev_status.value2
5891 && rtx_equal_p (cc_prev_status.value2, operands[0])))
5893 cc_status = cc_prev_status;
5894 return MOTOROLA ? "jbeq %l1" : "jeq %l1";
5896 if (GET_CODE (operands[0]) == REG)
5897 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
5899 operands[3] = adjust_address (operands[0], SImode, 4);
5900 if (! ADDRESS_REG_P (operands[0]))
5902 if (reg_overlap_mentioned_p (operands[2], operands[0]))
5904 if (reg_overlap_mentioned_p (operands[2], operands[3]))
5907 return "or%.l %0,%2\;jbeq %l1";
5909 return "or%.l %0,%2\;jeq %l1";
5914 return "or%.l %3,%2\;jbeq %l1";
5916 return "or%.l %3,%2\;jeq %l1";
5920 return "move%.l %0,%2\;or%.l %3,%2\;jbeq %l1";
5922 return "move%.l %0,%2\;or%.l %3,%2\;jeq %l1";
5924 operands[4] = gen_label_rtx();
5925 if (TARGET_68020 || TARGET_COLDFIRE)
5928 output_asm_insn ("tst%.l %0\;jbne %l4\;tst%.l %3\;jbeq %l1", operands);
5930 output_asm_insn ("tst%.l %0\;jne %l4\;tst%.l %3\;jeq %l1", operands);
5935 output_asm_insn ("cmp%.w #0,%0\;jbne %l4\;cmp%.w #0,%3\;jbeq %l1", operands);
5937 output_asm_insn ("cmp%.w #0,%0\;jne %l4\;cmp%.w #0,%3\;jeq %l1", operands);
5939 (*targetm.asm_out.internal_label) (asm_out_file, "L",
5940 CODE_LABEL_NUMBER (operands[4]));
5944 (define_insn "bne0_di"
5946 (if_then_else (ne (match_operand:DI 0 "general_operand" "do,*a")
5948 (label_ref (match_operand 1 "" ","))
5950 (clobber (match_scratch:SI 2 "=d,X"))]
5953 if ((cc_prev_status.value1
5954 && rtx_equal_p (cc_prev_status.value1, operands[0]))
5955 || (cc_prev_status.value2
5956 && rtx_equal_p (cc_prev_status.value2, operands[0])))
5958 cc_status = cc_prev_status;
5959 return MOTOROLA ? "jbne %l1" : "jne %l1";
5962 if (GET_CODE (operands[0]) == REG)
5963 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
5965 operands[3] = adjust_address (operands[0], SImode, 4);
5966 if (!ADDRESS_REG_P (operands[0]))
5968 if (reg_overlap_mentioned_p (operands[2], operands[0]))
5970 if (reg_overlap_mentioned_p (operands[2], operands[3]))
5973 return "or%.l %0,%2\;jbne %l1";
5975 return "or%.l %0,%2\;jne %l1";
5980 return "or%.l %3,%2\;jbne %l1";
5982 return "or%.l %3,%2\;jne %l1";
5986 return "move%.l %0,%2\;or%.l %3,%2\;jbne %l1";
5988 return "move%.l %0,%2\;or%.l %3,%2\;jne %l1";
5990 if (TARGET_68020 || TARGET_COLDFIRE)
5993 return "tst%.l %0\;jbne %l1\;tst%.l %3\;jbne %l1";
5995 return "tst%.l %0\;jne %l1\;tst%.l %3\;jne %l1";
6000 return "cmp%.w #0,%0\;jbne %l1\;cmp%.w #0,%3\;jbne %l1";
6002 return "cmp%.w #0,%0\;jne %l1\;cmp%.w #0,%3\;jne %l1";
6006 (define_insn "bge0_di"
6008 (if_then_else (ge (match_operand:DI 0 "general_operand" "ro")
6010 (label_ref (match_operand 1 "" ""))
6014 if ((cc_prev_status.value1
6015 && rtx_equal_p (cc_prev_status.value1, operands[0]))
6016 || (cc_prev_status.value2
6017 && rtx_equal_p (cc_prev_status.value2, operands[0])))
6019 cc_status = cc_prev_status;
6020 if (cc_status.flags & CC_REVERSED)
6022 return MOTOROLA ? "jble %l1" : "jle %l1";
6026 return MOTOROLA ? "jbpl %l1" : "jpl %l1";
6030 if (TARGET_68020 || TARGET_COLDFIRE || ! ADDRESS_REG_P (operands[0]))
6031 output_asm_insn("tst%.l %0", operands);
6034 /* On an address reg, cmpw may replace cmpl. */
6035 output_asm_insn("cmp%.w #0,%0", operands);
6037 return MOTOROLA ? "jbpl %l1" : "jpl %l1";
6040 (define_insn "blt0_di"
6042 (if_then_else (lt (match_operand:DI 0 "general_operand" "ro")
6044 (label_ref (match_operand 1 "" ""))
6048 if ((cc_prev_status.value1
6049 && rtx_equal_p (cc_prev_status.value1, operands[0]))
6050 || (cc_prev_status.value2
6051 && rtx_equal_p (cc_prev_status.value2, operands[0])))
6053 cc_status = cc_prev_status;
6054 if (cc_status.flags & CC_REVERSED)
6056 return MOTOROLA ? "jbgt %l1" : "jgt %l1";
6060 return MOTOROLA ? "jbmi %l1" : "jmi %l1";
6064 if (TARGET_68020 || TARGET_COLDFIRE || ! ADDRESS_REG_P (operands[0]))
6065 output_asm_insn("tst%.l %0", operands);
6068 /* On an address reg, cmpw may replace cmpl. */
6069 output_asm_insn("cmp%.w #0,%0", operands);
6072 return MOTOROLA ? "jbmi %l1" : "jmi %l1";
6077 (if_then_else (eq (cc0)
6079 (label_ref (match_operand 0 "" ""))
6084 OUTPUT_JUMP ("jbeq %l0", "fbeq %l0", "jbeq %l0");
6086 OUTPUT_JUMP ("jeq %l0", "fjeq %l0", "jeq %l0");
6091 (if_then_else (ne (cc0)
6093 (label_ref (match_operand 0 "" ""))
6098 OUTPUT_JUMP ("jbne %l0", "fbne %l0", "jbne %l0");
6100 OUTPUT_JUMP ("jne %l0", "fjne %l0", "jne %l0");
6105 (if_then_else (gt (cc0)
6107 (label_ref (match_operand 0 "" ""))
6112 OUTPUT_JUMP ("jbgt %l0", "fbgt %l0", 0);
6114 OUTPUT_JUMP ("jgt %l0", "fjgt %l0", 0);
6119 (if_then_else (gtu (cc0)
6121 (label_ref (match_operand 0 "" ""))
6125 return MOTOROLA ? "jbhi %l0" : "jhi %l0";
6130 (if_then_else (lt (cc0)
6132 (label_ref (match_operand 0 "" ""))
6137 OUTPUT_JUMP ("jblt %l0", "fblt %l0", "jbmi %l0");
6139 OUTPUT_JUMP ("jlt %l0", "fjlt %l0", "jmi %l0");
6144 (if_then_else (ltu (cc0)
6146 (label_ref (match_operand 0 "" ""))
6150 return MOTOROLA ? "jbcs %l0" : "jcs %l0";
6155 (if_then_else (ge (cc0)
6157 (label_ref (match_operand 0 "" ""))
6162 OUTPUT_JUMP ("jbge %l0", "fbge %l0", "jbpl %l0");
6164 OUTPUT_JUMP ("jge %l0", "fjge %l0", "jpl %l0");
6169 (if_then_else (geu (cc0)
6171 (label_ref (match_operand 0 "" ""))
6175 return MOTOROLA ? "jbcc %l0" : "jcc %l0";
6180 (if_then_else (le (cc0)
6182 (label_ref (match_operand 0 "" ""))
6187 OUTPUT_JUMP ("jble %l0", "fble %l0", 0);
6189 OUTPUT_JUMP ("jle %l0", "fjle %l0", 0);
6194 (if_then_else (leu (cc0)
6196 (label_ref (match_operand 0 "" ""))
6200 return MOTOROLA ? "jbls %l0" : "jls %l0";
6203 (define_insn "bordered"
6205 (if_then_else (ordered (cc0) (const_int 0))
6206 (label_ref (match_operand 0 "" ""))
6210 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6211 return MOTOROLA ? "fbor %l0" : "fjor %l0";
6214 (define_insn "bunordered"
6216 (if_then_else (unordered (cc0) (const_int 0))
6217 (label_ref (match_operand 0 "" ""))
6221 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6222 return MOTOROLA ? "fbun %l0" : "fjun %l0";
6225 (define_insn "buneq"
6227 (if_then_else (uneq (cc0) (const_int 0))
6228 (label_ref (match_operand 0 "" ""))
6232 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6233 return MOTOROLA ? "fbueq %l0" : "fjueq %l0";
6236 (define_insn "bunge"
6238 (if_then_else (unge (cc0) (const_int 0))
6239 (label_ref (match_operand 0 "" ""))
6243 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6244 return MOTOROLA ? "fbuge %l0" : "fjuge %l0";
6247 (define_insn "bungt"
6249 (if_then_else (ungt (cc0) (const_int 0))
6250 (label_ref (match_operand 0 "" ""))
6254 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6255 return MOTOROLA ? "fbugt %l0" : "fjugt %l0";
6258 (define_insn "bunle"
6260 (if_then_else (unle (cc0) (const_int 0))
6261 (label_ref (match_operand 0 "" ""))
6265 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6266 return MOTOROLA ? "fbule %l0" : "fjule %l0";
6269 (define_insn "bunlt"
6271 (if_then_else (unlt (cc0) (const_int 0))
6272 (label_ref (match_operand 0 "" ""))
6276 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6277 return MOTOROLA ? "fbult %l0" : "fjult %l0";
6280 (define_insn "bltgt"
6282 (if_then_else (ltgt (cc0) (const_int 0))
6283 (label_ref (match_operand 0 "" ""))
6287 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6288 return MOTOROLA ? "fbogl %l0" : "fjogl %l0";
6291 ;; Negated conditional jump instructions.
6295 (if_then_else (eq (cc0)
6298 (label_ref (match_operand 0 "" ""))))]
6302 OUTPUT_JUMP ("jbne %l0", "fbne %l0", "jbne %l0");
6304 OUTPUT_JUMP ("jne %l0", "fjne %l0", "jne %l0");
6309 (if_then_else (ne (cc0)
6312 (label_ref (match_operand 0 "" ""))))]
6316 OUTPUT_JUMP ("jbeq %l0", "fbeq %l0", "jbeq %l0");
6318 OUTPUT_JUMP ("jeq %l0", "fjeq %l0", "jeq %l0");
6323 (if_then_else (gt (cc0)
6326 (label_ref (match_operand 0 "" ""))))]
6330 OUTPUT_JUMP ("jble %l0", "fbngt %l0", 0);
6332 OUTPUT_JUMP ("jle %l0", "fjngt %l0", 0);
6337 (if_then_else (gtu (cc0)
6340 (label_ref (match_operand 0 "" ""))))]
6343 return MOTOROLA ? "jbls %l0" : "jls %l0";
6348 (if_then_else (lt (cc0)
6351 (label_ref (match_operand 0 "" ""))))]
6355 OUTPUT_JUMP ("jbge %l0", "fbnlt %l0", "jbpl %l0");
6357 OUTPUT_JUMP ("jge %l0", "fjnlt %l0", "jpl %l0");
6362 (if_then_else (ltu (cc0)
6365 (label_ref (match_operand 0 "" ""))))]
6368 return MOTOROLA ? "jbcc %l0" : "jcc %l0";
6373 (if_then_else (ge (cc0)
6376 (label_ref (match_operand 0 "" ""))))]
6380 OUTPUT_JUMP ("jblt %l0", "fbnge %l0", "jbmi %l0");
6382 OUTPUT_JUMP ("jlt %l0", "fjnge %l0", "jmi %l0");
6387 (if_then_else (geu (cc0)
6390 (label_ref (match_operand 0 "" ""))))]
6393 return MOTOROLA ? "jbcs %l0" : "jcs %l0";
6398 (if_then_else (le (cc0)
6401 (label_ref (match_operand 0 "" ""))))]
6405 OUTPUT_JUMP ("jbgt %l0", "fbnle %l0", 0);
6407 OUTPUT_JUMP ("jgt %l0", "fjnle %l0", 0);
6412 (if_then_else (leu (cc0)
6415 (label_ref (match_operand 0 "" ""))))]
6418 return MOTOROLA ? "jbhi %l0" : "jhi %l0";
6421 (define_insn "*bordered_rev"
6423 (if_then_else (ordered (cc0) (const_int 0))
6425 (label_ref (match_operand 0 "" ""))))]
6428 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6429 return MOTOROLA ? "fbun %l0" : "fjun %l0";
6432 (define_insn "*bunordered_rev"
6434 (if_then_else (unordered (cc0) (const_int 0))
6436 (label_ref (match_operand 0 "" ""))))]
6439 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6440 return MOTOROLA ? "fbor %l0" : "fjor %l0";
6443 (define_insn "*buneq_rev"
6445 (if_then_else (uneq (cc0) (const_int 0))
6447 (label_ref (match_operand 0 "" ""))))]
6450 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6451 return MOTOROLA ? "fbogl %l0" : "fjogl %l0";
6454 (define_insn "*bunge_rev"
6456 (if_then_else (unge (cc0) (const_int 0))
6458 (label_ref (match_operand 0 "" ""))))]
6461 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6462 return MOTOROLA ? "fbolt %l0" : "fjolt %l0";
6465 (define_insn "*bungt_rev"
6467 (if_then_else (ungt (cc0) (const_int 0))
6469 (label_ref (match_operand 0 "" ""))))]
6472 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6473 return MOTOROLA ? "fbole %l0" : "fjole %l0";
6476 (define_insn "*bunle_rev"
6478 (if_then_else (unle (cc0) (const_int 0))
6480 (label_ref (match_operand 0 "" ""))))]
6483 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6484 return MOTOROLA ? "fbogt %l0" : "fjogt %l0";
6487 (define_insn "*bunlt_rev"
6489 (if_then_else (unlt (cc0) (const_int 0))
6491 (label_ref (match_operand 0 "" ""))))]
6494 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6495 return MOTOROLA ? "fboge %l0" : "fjoge %l0";
6498 (define_insn "*bltgt_rev"
6500 (if_then_else (ltgt (cc0) (const_int 0))
6502 (label_ref (match_operand 0 "" ""))))]
6505 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6506 return MOTOROLA ? "fbueq %l0" : "fjueq %l0";
6509 ;; Unconditional and other jump instructions
6512 (label_ref (match_operand 0 "" "")))]
6515 return MOTOROLA ? "jbra %l0" : "jra %l0";
6518 (define_expand "tablejump"
6519 [(parallel [(set (pc) (match_operand 0 "" ""))
6520 (use (label_ref (match_operand 1 "" "")))])]
6523 #ifdef CASE_VECTOR_PC_RELATIVE
6524 operands[0] = gen_rtx_PLUS (SImode, pc_rtx,
6525 gen_rtx_SIGN_EXTEND (SImode, operands[0]));
6529 ;; Jump to variable address from dispatch table of absolute addresses.
6531 [(set (pc) (match_operand:SI 0 "register_operand" "a"))
6532 (use (label_ref (match_operand 1 "" "")))]
6535 return MOTOROLA ? "jmp (%0)" : "jmp %0@";
6538 ;; Jump to variable address from dispatch table of relative addresses.
6542 (sign_extend:SI (match_operand:HI 0 "register_operand" "r"))))
6543 (use (label_ref (match_operand 1 "" "")))]
6546 #ifdef ASM_RETURN_CASE_JUMP
6547 ASM_RETURN_CASE_JUMP;
6549 if (TARGET_COLDFIRE)
6551 if (ADDRESS_REG_P (operands[0]))
6552 return MOTOROLA ? "jmp (2,pc,%0.l)" : "jmp pc@(2,%0:l)";
6554 return "ext%.l %0\;jmp (2,pc,%0.l)";
6556 return "extl %0\;jmp pc@(2,%0:l)";
6559 return MOTOROLA ? "jmp (2,pc,%0.w)" : "jmp pc@(2,%0:w)";
6563 ;; Decrement-and-branch insns.
6567 (ne (match_operand:HI 0 "nonimmediate_operand" "+d*g")
6569 (label_ref (match_operand 1 "" ""))
6572 (plus:HI (match_dup 0)
6577 if (DATA_REG_P (operands[0]))
6578 return "dbra %0,%l1";
6579 if (GET_CODE (operands[0]) == MEM)
6581 "subq%.w #1,%0\;jbcc %l1" :
6582 "subqw #1,%0\;jcc %l1";
6584 "subq%.w #1,%0\;cmp%.w #-1,%0\;jbne %l1" :
6585 "subqw #1,%0\;cmpw #-1,%0\;jne %l1";
6591 (ne (match_operand:SI 0 "nonimmediate_operand" "+d*g")
6593 (label_ref (match_operand 1 "" ""))
6596 (plus:SI (match_dup 0)
6601 if (DATA_REG_P (operands[0]))
6603 "dbra %0,%l1\;clr%.w %0\;subq%.l #1,%0\;jbcc %l1" :
6604 "dbra %0,%l1\;clr%.w %0\;subq%.l #1,%0\;jcc %l1";
6605 if (GET_CODE (operands[0]) == MEM)
6607 "subq%.l #1,%0\;jbcc %l1" :
6608 "subq%.l #1,%0\;jcc %l1";
6610 "subq.l #1,%0\;cmp.l #-1,%0\;jbne %l1" :
6611 "subql #1,%0\;cmpl #-1,%0\;jne %l1";
6614 ;; Two dbra patterns that use REG_NOTES info generated by strength_reduce.
6619 (ge (plus:HI (match_operand:HI 0 "nonimmediate_operand" "+d*am")
6622 (label_ref (match_operand 1 "" ""))
6625 (plus:HI (match_dup 0)
6627 "!TARGET_COLDFIRE && find_reg_note (insn, REG_NONNEG, 0)"
6630 if (DATA_REG_P (operands[0]))
6631 return "dbra %0,%l1";
6632 if (GET_CODE (operands[0]) == MEM)
6634 "subq%.w #1,%0\;jbcc %l1" :
6635 "subq%.w #1,%0\;jcc %l1";
6637 "subq.w #1,%0\;cmp.w #-1,%0\;jbne %l1" :
6638 "subqw #1,%0\;cmpw #-1,%0\;jne %l1";
6641 (define_expand "decrement_and_branch_until_zero"
6642 [(parallel [(set (pc)
6644 (ge (plus:SI (match_operand:SI 0 "nonimmediate_operand" "")
6647 (label_ref (match_operand 1 "" ""))
6650 (plus:SI (match_dup 0)
6658 (ge (plus:SI (match_operand:SI 0 "nonimmediate_operand" "+d*am")
6661 (label_ref (match_operand 1 "" ""))
6664 (plus:SI (match_dup 0)
6666 "!TARGET_COLDFIRE && find_reg_note (insn, REG_NONNEG, 0)"
6669 if (DATA_REG_P (operands[0]))
6671 "dbra %0,%l1\;clr%.w %0\;subq%.l #1,%0\;jbcc %l1" :
6672 "dbra %0,%l1\;clr%.w %0\;subql #1,%0\;jcc %l1";
6673 if (GET_CODE (operands[0]) == MEM)
6675 "subq%.l #1,%0\;jbcc %l1" :
6676 "subql #1,%0\;jcc %l1";
6678 "subq.l #1,%0\;cmp.l #-1,%0\;jbne %l1" :
6679 "subql #1,%0\;cmpl #-1,%0\;jne %l1";
6682 ;; Call subroutine with no return value.
6683 (define_expand "call"
6684 [(call (match_operand:QI 0 "memory_operand" "")
6685 (match_operand:SI 1 "general_operand" ""))]
6686 ;; Operand 1 not really used on the m68000.
6689 operands[0] = m68k_legitimize_call_address (operands[0]);
6692 (define_insn "*call"
6693 [(call (mem:QI (match_operand:SI 0 "call_operand" "a,W"))
6694 (match_operand:SI 1 "general_operand" "g,g"))]
6695 ;; Operand 1 not really used on the m68000.
6698 return output_call (operands[0]);
6701 ;; Call subroutine, returning value in operand 0
6702 ;; (which must be a hard register).
6703 (define_expand "call_value"
6704 [(set (match_operand 0 "" "")
6705 (call (match_operand:QI 1 "memory_operand" "")
6706 (match_operand:SI 2 "general_operand" "")))]
6707 ;; Operand 2 not really used on the m68000.
6710 operands[1] = m68k_legitimize_call_address (operands[1]);
6713 (define_insn "*call_value"
6714 [(set (match_operand 0 "" "=rf,rf")
6715 (call (mem:QI (match_operand:SI 1 "call_operand" "a,W"))
6716 (match_operand:SI 2 "general_operand" "g,g")))]
6717 ;; Operand 2 not really used on the m68000.
6720 operands[0] = operands[1];
6721 return output_call (operands[0]);
6724 ;; Call subroutine returning any type.
6726 (define_expand "untyped_call"
6727 [(parallel [(call (match_operand 0 "" "")
6729 (match_operand 1 "" "")
6730 (match_operand 2 "" "")])]
6731 "NEEDS_UNTYPED_CALL"
6735 emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
6737 for (i = 0; i < XVECLEN (operands[2], 0); i++)
6739 rtx set = XVECEXP (operands[2], 0, i);
6740 emit_move_insn (SET_DEST (set), SET_SRC (set));
6743 /* The optimizer does not know that the call sets the function value
6744 registers we stored in the result block. We avoid problems by
6745 claiming that all hard registers are used and clobbered at this
6747 emit_insn (gen_blockage ());
6752 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
6753 ;; all of memory. This blocks insns from being moved across this point.
6755 (define_insn "blockage"
6756 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
6765 (define_expand "prologue"
6769 m68k_expand_prologue ();
6773 (define_expand "epilogue"
6777 m68k_expand_epilogue ();
6781 ;; Used for frameless functions which save no regs and allocate no locals.
6782 (define_expand "return"
6784 "m68k_use_return_insn ()"
6787 (define_insn "*return"
6791 if (m68k_interrupt_function_p (current_function_decl))
6793 else if (current_function_pops_args)
6795 operands[0] = GEN_INT (current_function_pops_args);
6802 (define_insn "*m68k_store_multiple"
6803 [(match_parallel 0 "" [(match_operand 1 "")])]
6804 "m68k_movem_pattern_p (operands[0], NULL, 0, true)"
6806 return m68k_output_movem (operands, operands[0], 0, true);
6809 (define_insn "*m68k_store_multiple_automod"
6810 [(match_parallel 0 ""
6811 [(set (match_operand:SI 1 "register_operand" "=a")
6812 (plus:SI (match_operand:SI 2 "register_operand" "1")
6813 (match_operand:SI 3 "const_int_operand")))])]
6814 "m68k_movem_pattern_p (operands[0], operands[1], INTVAL (operands[3]), true)"
6816 return m68k_output_movem (operands, operands[0], INTVAL (operands[3]), true);
6819 (define_insn "*m68k_load_multiple"
6820 [(match_parallel 0 "" [(match_operand 1 "")])]
6821 "m68k_movem_pattern_p (operands[0], NULL, 0, false)"
6823 return m68k_output_movem (operands, operands[0], 0, false);
6826 (define_insn "*m68k_load_multiple_automod"
6827 [(match_parallel 0 ""
6828 [(set (match_operand:SI 1 "register_operand" "=a")
6829 (plus:SI (match_operand:SI 2 "register_operand" "1")
6830 (match_operand:SI 3 "const_int_operand")))])]
6831 "m68k_movem_pattern_p (operands[0], operands[1],
6832 INTVAL (operands[3]), false)"
6834 return m68k_output_movem (operands, operands[0],
6835 INTVAL (operands[3]), false);
6838 (define_expand "link"
6840 [(set (match_operand:SI 0 "register_operand")
6841 (plus:SI (reg:SI SP_REG) (const_int -4)))
6844 (set (reg:SI SP_REG)
6845 (plus:SI (reg:SI SP_REG)
6846 (match_operand:SI 1 "const_int_operand")))])]
6847 "TARGET_68020 || INTVAL (operands[1]) >= -0x8004"
6849 operands[2] = gen_frame_mem (SImode, plus_constant (stack_pointer_rtx, -4));
6852 (define_insn "*link"
6853 [(set (match_operand:SI 0 "register_operand" "+r")
6854 (plus:SI (reg:SI SP_REG) (const_int -4)))
6855 (set (mem:SI (plus:SI (reg:SI SP_REG) (const_int -4)))
6857 (set (reg:SI SP_REG)
6858 (plus:SI (reg:SI SP_REG)
6859 (match_operand:SI 1 "const_int_operand")))]
6860 "TARGET_68020 || INTVAL (operands[1]) >= -0x8004"
6862 operands[1] = GEN_INT (INTVAL (operands[1]) + 4);
6864 return "link %0,%1";
6865 else if (INTVAL (operands[1]) >= -0x8000)
6866 return "link.w %0,%1";
6868 return "link.l %0,%1";
6871 (define_expand "unlink"
6873 [(set (match_operand:SI 0 "register_operand")
6875 (set (reg:SI SP_REG)
6876 (plus:SI (match_dup 0)
6880 operands[1] = gen_frame_mem (SImode, copy_rtx (operands[0]));
6883 (define_insn "*unlink"
6884 [(set (match_operand:SI 0 "register_operand" "+r")
6885 (mem:SI (match_dup 0)))
6886 (set (reg:SI SP_REG)
6887 (plus:SI (match_dup 0)
6892 (define_insn "load_got"
6893 [(set (match_operand:SI 0 "register_operand" "=a")
6894 (unspec:SI [(const_int 0)] UNSPEC_GOT))]
6897 if (TARGET_ID_SHARED_LIBRARY)
6899 operands[1] = gen_rtx_REG (Pmode, PIC_REG);
6900 return MOTOROLA ? "move.l %?(%1),%0" : "movel %1@(%?), %0";
6904 if (TARGET_COLDFIRE)
6905 /* Load the full 32-bit PC-relative offset of
6906 _GLOBAL_OFFSET_TABLE_ into the PIC register, then use it to
6907 calculate the absolute value. The offset and "lea"
6908 operation word together occupy 6 bytes. */
6909 return ("move.l #_GLOBAL_OFFSET_TABLE_@GOTPC, %0\n\t"
6910 "lea (-6, %%pc, %0), %0");
6912 return "lea (%%pc, _GLOBAL_OFFSET_TABLE_@GOTPC), %0";
6915 return ("movel #_GLOBAL_OFFSET_TABLE_, %0\n\t"
6916 "lea %%pc@(0,%0:l),%0");
6919 (define_insn "indirect_jump"
6920 [(set (pc) (match_operand:SI 0 "address_operand" "p"))]
6924 ;; This should not be used unless the add/sub insns can't be.
6927 [(set (match_operand:SI 0 "nonimmediate_operand" "=a")
6928 (match_operand:QI 1 "address_operand" "p"))]
6931 /* Recognize an insn that refers to a table of offsets. Such an insn will
6932 need to refer to a label on the insn. So output one. Use the
6933 label-number of the table of offsets to generate this label. This code,
6934 and similar code above, assumes that there will be at most one reference
6936 if (GET_CODE (operands[1]) == PLUS
6937 && GET_CODE (XEXP (operands[1], 1)) == LABEL_REF
6938 && GET_CODE (XEXP (operands[1], 0)) != PLUS)
6940 rtx labelref = XEXP (operands[1], 1);
6942 asm_fprintf (asm_out_file, "\\t.set %LLI%d,.+2\\n",
6943 CODE_LABEL_NUMBER (XEXP (labelref, 0)));
6945 (*targetm.asm_out.internal_label) (asm_out_file, "LI",
6946 CODE_LABEL_NUMBER (XEXP (labelref, 0)));
6948 return "lea %a1,%0";
6951 ;; This is the first machine-dependent peephole optimization.
6952 ;; It is useful when a floating value is returned from a function call
6953 ;; and then is moved into an FP register.
6954 ;; But it is mainly intended to test the support for these optimizations.
6957 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))
6958 (set (match_operand:DF 0 "register_operand" "=f")
6959 (match_operand:DF 1 "register_operand" "ad"))]
6960 "FP_REG_P (operands[0]) && ! FP_REG_P (operands[1])"
6963 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
6964 output_asm_insn ("move%.l %1,%@", xoperands);
6965 output_asm_insn ("move%.l %1,%-", operands);
6966 return "fmove%.d %+,%0";
6969 ;; Optimize a stack-adjust followed by a push of an argument.
6970 ;; This is said to happen frequently with -msoft-float
6971 ;; when there are consecutive library calls.
6974 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
6975 (match_operand:SI 0 "const_int_operand" "n")))
6976 (set (match_operand:SF 1 "push_operand" "=m")
6977 (match_operand:SF 2 "general_operand" "rmfF"))]
6978 "INTVAL (operands[0]) >= 4
6979 && ! reg_mentioned_p (stack_pointer_rtx, operands[2])"
6981 if (INTVAL (operands[0]) > 4)
6984 xoperands[0] = stack_pointer_rtx;
6985 xoperands[1] = GEN_INT (INTVAL (operands[0]) - 4);
6986 if (INTVAL (xoperands[1]) <= 8)
6988 if (!TARGET_COLDFIRE)
6989 output_asm_insn ("addq%.w %1,%0", xoperands);
6991 output_asm_insn ("addq%.l %1,%0", xoperands);
6993 else if (TUNE_CPU32 && INTVAL (xoperands[1]) <= 16)
6995 xoperands[1] = GEN_INT (INTVAL (xoperands[1]) - 8);
6996 output_asm_insn ("addq%.w #8,%0\;addq%.w %1,%0", xoperands);
6998 else if (INTVAL (xoperands[1]) <= 0x7FFF)
7001 output_asm_insn ("add%.w %1,%0", xoperands);
7003 output_asm_insn ("lea (%c1,%0),%0", xoperands);
7005 output_asm_insn ("lea %0@(%c1),%0", xoperands);
7008 output_asm_insn ("add%.l %1,%0", xoperands);
7010 if (FP_REG_P (operands[2]))
7011 return "fmove%.s %2,%@";
7012 return "move%.l %2,%@";
7015 ;; Speed up stack adjust followed by a fullword fixedpoint push.
7018 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
7019 (match_operand:SI 0 "const_int_operand" "n")))
7020 (set (match_operand:SI 1 "push_operand" "=m")
7021 (match_operand:SI 2 "general_operand" "g"))]
7022 "INTVAL (operands[0]) >= 4
7023 && ! reg_mentioned_p (stack_pointer_rtx, operands[2])"
7025 if (INTVAL (operands[0]) > 4)
7028 xoperands[0] = stack_pointer_rtx;
7029 xoperands[1] = GEN_INT (INTVAL (operands[0]) - 4);
7030 if (INTVAL (xoperands[1]) <= 8)
7032 if (!TARGET_COLDFIRE)
7033 output_asm_insn ("addq%.w %1,%0", xoperands);
7035 output_asm_insn ("addq%.l %1,%0", xoperands);
7037 else if (TUNE_CPU32 && INTVAL (xoperands[1]) <= 16)
7039 xoperands[1] = GEN_INT (INTVAL (xoperands[1]) - 8);
7040 output_asm_insn ("addq%.w #8,%0\;addq%.w %1,%0", xoperands);
7042 else if (INTVAL (xoperands[1]) <= 0x7FFF)
7045 output_asm_insn ("add%.w %1,%0", xoperands);
7047 output_asm_insn ("lea (%c1,%0),%0", xoperands);
7049 output_asm_insn ("lea %0@(%c1),%0", xoperands);
7052 output_asm_insn ("add%.l %1,%0", xoperands);
7054 if (operands[2] == const0_rtx)
7056 return "move%.l %2,%@";
7059 ;; Speed up pushing a single byte but leaving four bytes of space.
7062 [(set (mem:QI (pre_dec:SI (reg:SI SP_REG)))
7063 (match_operand:QI 1 "general_operand" "dami"))
7064 (set (reg:SI SP_REG) (minus:SI (reg:SI SP_REG) (const_int 2)))]
7065 "! reg_mentioned_p (stack_pointer_rtx, operands[1])"
7069 if (GET_CODE (operands[1]) == REG)
7070 return "move%.l %1,%-";
7072 xoperands[1] = operands[1];
7074 = gen_rtx_MEM (QImode, plus_constant (stack_pointer_rtx, 3));
7075 xoperands[3] = stack_pointer_rtx;
7076 if (!TARGET_COLDFIRE)
7077 output_asm_insn ("subq%.w #4,%3\;move%.b %1,%2", xoperands);
7079 output_asm_insn ("subq%.l #4,%3\;move%.b %1,%2", xoperands);
7084 [(set (match_operand:SI 0 "register_operand" "=d")
7086 (set (strict_low_part (subreg:HI (match_dup 0) 2))
7087 (match_operand:HI 1 "general_operand" "rmn"))]
7088 "strict_low_part_peephole_ok (HImode, prev_nonnote_insn (insn), operands[0])"
7090 if (GET_CODE (operands[1]) == CONST_INT)
7092 if (operands[1] == const0_rtx
7093 && (DATA_REG_P (operands[0])
7094 || GET_CODE (operands[0]) == MEM)
7095 /* clr insns on 68000 read before writing. */
7096 && ((TARGET_68010 || TARGET_COLDFIRE)
7097 || !(GET_CODE (operands[0]) == MEM
7098 && MEM_VOLATILE_P (operands[0]))))
7101 return "move%.w %1,%0";
7109 ;; jCC label ; abnormal loop termination
7110 ;; dbra dN, loop ; normal loop termination
7118 ;; Which moves the jCC condition outside the inner loop for free.
7122 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
7123 [(cc0) (const_int 0)])
7124 (label_ref (match_operand 2 "" ""))
7129 (ne (match_operand:HI 0 "register_operand" "")
7131 (label_ref (match_operand 1 "" ""))
7134 (plus:HI (match_dup 0)
7136 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
7139 output_dbcc_and_branch (operands);
7144 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
7145 [(cc0) (const_int 0)])
7146 (label_ref (match_operand 2 "" ""))
7151 (ne (match_operand:SI 0 "register_operand" "")
7153 (label_ref (match_operand 1 "" ""))
7156 (plus:SI (match_dup 0)
7158 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
7161 output_dbcc_and_branch (operands);
7166 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
7167 [(cc0) (const_int 0)])
7168 (label_ref (match_operand 2 "" ""))
7173 (ge (plus:HI (match_operand:HI 0 "register_operand" "")
7176 (label_ref (match_operand 1 "" ""))
7179 (plus:HI (match_dup 0)
7181 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
7184 output_dbcc_and_branch (operands);
7189 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
7190 [(cc0) (const_int 0)])
7191 (label_ref (match_operand 2 "" ""))
7196 (ge (plus:SI (match_operand:SI 0 "register_operand" "")
7199 (label_ref (match_operand 1 "" ""))
7202 (plus:SI (match_dup 0)
7204 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
7207 output_dbcc_and_branch (operands);
7212 (define_insn "extendsfxf2"
7213 [(set (match_operand:XF 0 "nonimmediate_operand" "=fm,f")
7214 (float_extend:XF (match_operand:SF 1 "general_operand" "f,rmF")))]
7217 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
7219 if (REGNO (operands[0]) == REGNO (operands[1]))
7221 /* Extending float to double in an fp-reg is a no-op.
7222 NOTICE_UPDATE_CC has already assumed that the
7223 cc will be set. So cancel what it did. */
7224 cc_status = cc_prev_status;
7227 return "f%$move%.x %1,%0";
7229 if (FP_REG_P (operands[0]))
7231 if (FP_REG_P (operands[1]))
7232 return "f%$move%.x %1,%0";
7233 else if (ADDRESS_REG_P (operands[1]))
7234 return "move%.l %1,%-\;f%$move%.s %+,%0";
7235 else if (GET_CODE (operands[1]) == CONST_DOUBLE)
7236 return output_move_const_single (operands);
7237 return "f%$move%.s %f1,%0";
7239 return "fmove%.x %f1,%0";
7243 (define_insn "extenddfxf2"
7244 [(set (match_operand:XF 0 "nonimmediate_operand" "=fm,f")
7246 (match_operand:DF 1 "general_operand" "f,rmE")))]
7249 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
7251 if (REGNO (operands[0]) == REGNO (operands[1]))
7253 /* Extending float to double in an fp-reg is a no-op.
7254 NOTICE_UPDATE_CC has already assumed that the
7255 cc will be set. So cancel what it did. */
7256 cc_status = cc_prev_status;
7259 return "fmove%.x %1,%0";
7261 if (FP_REG_P (operands[0]))
7263 if (REG_P (operands[1]))
7266 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
7267 output_asm_insn ("move%.l %1,%-", xoperands);
7268 output_asm_insn ("move%.l %1,%-", operands);
7269 return "f%&move%.d %+,%0";
7271 if (GET_CODE (operands[1]) == CONST_DOUBLE)
7272 return output_move_const_double (operands);
7273 return "f%&move%.d %f1,%0";
7275 return "fmove%.x %f1,%0";
7278 (define_insn "truncxfdf2"
7279 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,!r")
7281 (match_operand:XF 1 "general_operand" "f,f")))]
7284 if (REG_P (operands[0]))
7286 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
7287 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
7288 return "move%.l %+,%0";
7290 return "fmove%.d %f1,%0";
7293 (define_insn "truncxfsf2"
7294 [(set (match_operand:SF 0 "nonimmediate_operand" "=dm")
7296 (match_operand:XF 1 "general_operand" "f")))]
7300 (define_insn "sin<mode>2"
7301 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
7303 [(match_operand:FP 1 "general_operand" "f<FP:dreg>m")] UNSPEC_SIN))]
7304 "TARGET_68881 && flag_unsafe_math_optimizations"
7306 if (FP_REG_P (operands[1]))
7307 return "fsin%.x %1,%0";
7309 return "fsin%.<FP:prec> %1,%0";
7312 (define_insn "cos<mode>2"
7313 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
7315 [(match_operand:FP 1 "general_operand" "f<FP:dreg>m")] UNSPEC_COS))]
7316 "TARGET_68881 && flag_unsafe_math_optimizations"
7318 if (FP_REG_P (operands[1]))
7319 return "fcos%.x %1,%0";
7321 return "fcos%.<FP:prec> %1,%0";
7325 [(trap_if (const_int -1) (const_int 7))]
7329 (define_insn "conditional_trap"
7330 [(trap_if (match_operator 0 "valid_dbcc_comparison_p"
7331 [(cc0) (const_int 0)])
7332 (match_operand:SI 1 "const_int_operand" "I"))]
7333 "TARGET_68020 && ! flags_in_68881 ()"
7335 switch (GET_CODE (operands[0]))
7337 case EQ: return "trapeq";
7338 case NE: return "trapne";
7339 case GT: return "trapgt";
7340 case GTU: return "traphi";
7341 case LT: return "traplt";
7342 case LTU: return "trapcs";
7343 case GE: return "trapge";
7344 case GEU: return "trapcc";
7345 case LE: return "traple";
7346 case LEU: return "trapls";
7347 default: gcc_unreachable ();