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
119 ;; UNSPEC_VOLATILE usage:
122 [(UNSPECV_BLOCKAGE 0)
125 ;; Registers by name.
131 (include "predicates.md")
133 ;; Mode macros for floating point operations.
134 ;; Valid floating point modes
135 (define_mode_macro FP [SF DF (XF "TARGET_68881")])
136 ;; Mnemonic infix to round result
137 (define_mode_attr round [(SF "%$") (DF "%&") (XF "")])
138 ;; Mnemonic infix to round result for mul or div instruction
139 (define_mode_attr round_mul [(SF "sgl") (DF "%&") (XF "")])
140 ;; Suffix specifying source operand format
141 (define_mode_attr prec [(SF "s") (DF "d") (XF "x")])
142 ;; Allowable D registers
143 (define_mode_attr dreg [(SF "d") (DF "") (XF "")])
144 ;; Allowable 68881 constant constraints
145 (define_mode_attr const [(SF "F") (DF "G") (XF "")])
148 [(set (match_operand:DF 0 "push_operand" "=m")
149 (match_operand:DF 1 "general_operand" "ro<>fyE"))]
152 if (FP_REG_P (operands[1]))
153 return "fmove%.d %f1,%0";
154 return output_move_double (operands);
157 (define_insn "pushdi"
158 [(set (match_operand:DI 0 "push_operand" "=m")
159 (match_operand:DI 1 "general_operand" "ro<>Fyi"))]
162 return output_move_double (operands);
165 ;; We don't want to allow a constant operand for test insns because
166 ;; (set (cc0) (const_int foo)) has no mode information. Such insns will
167 ;; be folded while optimizing anyway.
169 (define_expand "tstdi"
170 [(parallel [(set (cc0)
171 (match_operand:DI 0 "nonimmediate_operand" ""))
172 (clobber (match_scratch:SI 1 ""))
173 (clobber (match_scratch:DI 2 ""))])]
175 "m68k_last_compare_had_fp_operands = 0;")
179 (match_operand:DI 0 "nonimmediate_operand" "am,d"))
180 (clobber (match_scratch:SI 1 "=X,d"))
181 (clobber (match_scratch:DI 2 "=d,X"))]
184 if (which_alternative == 0)
188 xoperands[0] = operands[2];
189 xoperands[1] = operands[0];
190 output_move_double (xoperands);
191 cc_status.flags |= CC_REVERSED;
192 return "neg%.l %R2\;negx%.l %2";
194 if (find_reg_note (insn, REG_DEAD, operands[0]))
196 cc_status.flags |= CC_REVERSED;
197 return "neg%.l %R0\;negx%.l %0";
201 'sub' clears %1, and also clears the X cc bit
202 'tst' sets the Z cc bit according to the low part of the DImode operand
203 'subx %1' (i.e. subx #0) acts as a (non-existent) tstx on the high part.
205 return "sub%.l %1,%1\;tst%.l %R0\;subx%.l %1,%0";
208 (define_expand "tstsi"
210 (match_operand:SI 0 "nonimmediate_operand" ""))]
212 "m68k_last_compare_had_fp_operands = 0;")
216 (match_operand:SI 0 "nonimmediate_operand" "rm"))]
219 if (TARGET_68020 || TARGET_COLDFIRE || ! ADDRESS_REG_P (operands[0]))
221 /* If you think that the 68020 does not support tstl a0,
222 reread page B-167 of the 68020 manual more carefully. */
223 /* On an address reg, cmpw may replace cmpl. */
224 return "cmp%.w #0,%0";
227 ;; This can't use an address register, because comparisons
228 ;; with address registers as second operand always test the whole word.
229 (define_expand "tsthi"
231 (match_operand:HI 0 "nonimmediate_operand" ""))]
233 "m68k_last_compare_had_fp_operands = 0;")
237 (match_operand:HI 0 "nonimmediate_operand" "dm"))]
241 (define_expand "tstqi"
243 (match_operand:QI 0 "nonimmediate_operand" ""))]
245 "m68k_last_compare_had_fp_operands = 0;")
249 (match_operand:QI 0 "nonimmediate_operand" "dm"))]
253 (define_expand "tst<mode>"
255 (match_operand:FP 0 "general_operand" ""))]
258 m68k_last_compare_had_fp_operands = 1;
261 (define_insn "tst<mode>_68881"
263 (match_operand:FP 0 "general_operand" "f<FP:dreg>m"))]
266 cc_status.flags = CC_IN_68881;
267 if (FP_REG_P (operands[0]))
269 return "ftst%.<FP:prec> %0";
272 (define_insn "tst<mode>_cf"
274 (match_operand:FP 0 "general_operand" "f<FP:dreg><Q>U"))]
275 "TARGET_COLDFIRE_FPU"
277 cc_status.flags = CC_IN_68881;
278 if (FP_REG_P (operands[0]))
280 return "ftst%.<FP:prec> %0";
284 ;; compare instructions.
286 (define_expand "cmpdi"
289 (compare (match_operand:DI 0 "nonimmediate_operand" "")
290 (match_operand:DI 1 "general_operand" "")))
291 (clobber (match_dup 2))])]
293 "m68k_last_compare_had_fp_operands = 0; operands[2] = gen_reg_rtx (DImode);")
297 (compare (match_operand:DI 1 "nonimmediate_operand" "0,d")
298 (match_operand:DI 2 "general_operand" "d,0")))
299 (clobber (match_operand:DI 0 "register_operand" "=d,d"))]
302 if (rtx_equal_p (operands[0], operands[1]))
303 return "sub%.l %R2,%R0\;subx%.l %2,%0";
306 cc_status.flags |= CC_REVERSED;
307 return "sub%.l %R1,%R0\;subx%.l %1,%0";
311 (define_expand "cmpsi"
313 (compare (match_operand:SI 0 "nonimmediate_operand" "")
314 (match_operand:SI 1 "general_operand" "")))]
317 m68k_last_compare_had_fp_operands = 0;
320 ;; A composite of the cmp, cmpa, cmpi & cmpm m68000 op codes.
323 (compare (match_operand:SI 0 "nonimmediate_operand" "rKT,rKs,mSr,mSa,>")
324 (match_operand:SI 1 "general_src_operand" "mSr,mSa,KTr,Ksr,>")))]
327 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
328 return "cmpm%.l %1,%0";
329 if (REG_P (operands[1])
330 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
332 cc_status.flags |= CC_REVERSED;
333 return "cmp%.l %d0,%d1";
335 if (ADDRESS_REG_P (operands[0])
336 && GET_CODE (operands[1]) == CONST_INT
337 && INTVAL (operands[1]) < 0x8000
338 && INTVAL (operands[1]) >= -0x8000)
339 return "cmp%.w %1,%0";
340 return "cmp%.l %d1,%d0";
345 (compare (match_operand:SI 0 "nonimmediate_operand" "mrKs,r")
346 (match_operand:SI 1 "general_operand" "r,mrKs")))]
349 if (REG_P (operands[1])
350 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
352 cc_status.flags |= CC_REVERSED;
353 return "cmp%.l %d0,%d1";
355 return "cmp%.l %d1,%d0";
358 (define_expand "cmphi"
360 (compare (match_operand:HI 0 "nonimmediate_src_operand" "")
361 (match_operand:HI 1 "general_src_operand" "")))]
363 "m68k_last_compare_had_fp_operands = 0;")
367 (compare (match_operand:HI 0 "nonimmediate_src_operand" "rnmS,d,n,mS,>")
368 (match_operand:HI 1 "general_src_operand" "d,rnmS,mS,n,>")))]
371 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
372 return "cmpm%.w %1,%0";
373 if ((REG_P (operands[1]) && !ADDRESS_REG_P (operands[1]))
374 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
376 cc_status.flags |= CC_REVERSED;
377 return "cmp%.w %d0,%d1";
379 return "cmp%.w %d1,%d0";
382 (define_expand "cmpqi"
384 (compare (match_operand:QI 0 "nonimmediate_src_operand" "")
385 (match_operand:QI 1 "general_src_operand" "")))]
387 "m68k_last_compare_had_fp_operands = 0;")
391 (compare (match_operand:QI 0 "nonimmediate_src_operand" "dn,dmS,>")
392 (match_operand:QI 1 "general_src_operand" "dmS,nd,>")))]
395 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
396 return "cmpm%.b %1,%0";
397 if (REG_P (operands[1])
398 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
400 cc_status.flags |= CC_REVERSED;
401 return "cmp%.b %d0,%d1";
403 return "cmp%.b %d1,%d0";
406 (define_expand "cmp<mode>"
408 (compare (match_operand:FP 0 "general_operand" "")
409 (match_operand:FP 1 "general_operand" "")))]
412 m68k_last_compare_had_fp_operands = 1;
413 if (TARGET_COLDFIRE && !reload_completed)
414 operands[1] = force_reg (<MODE>mode, operands[1]);
417 (define_insn "cmp<mode>_68881"
419 (compare (match_operand:FP 0 "general_operand" "f,m<FP:const>")
420 (match_operand:FP 1 "general_operand" "f<FP:dreg>m<FP:const>,f")))]
423 cc_status.flags = CC_IN_68881;
424 if (FP_REG_P (operands[0]))
426 if (FP_REG_P (operands[1]))
427 return "fcmp%.x %1,%0";
429 return "fcmp%.<FP:prec> %f1,%0";
431 cc_status.flags |= CC_REVERSED;
432 return "fcmp%.<FP:prec> %f0,%1";
435 (define_insn "cmp<mode>_cf"
437 (compare (match_operand:FP 0 "general_operand" "f,<FP:dreg><Q>U")
438 (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U,f")))]
439 "TARGET_COLDFIRE_FPU"
441 cc_status.flags = CC_IN_68881;
442 if (FP_REG_P (operands[0]))
444 if (FP_REG_P (operands[1]))
445 return "fcmp%.d %1,%0";
447 return "fcmp%.<FP:prec> %f1,%0";
449 cc_status.flags |= CC_REVERSED;
450 return "fcmp%.<FP:prec> %f0,%1";
453 ;; Recognizers for btst instructions.
455 ;; ColdFire/5200 only allows "<Q>" type addresses when the bit position is
456 ;; specified as a constant, so we must disable all patterns that may extract
457 ;; from a MEM at a constant bit position if we can't use this as a constraint.
460 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_src_operand" "oS")
462 (minus:SI (const_int 7)
463 (match_operand:SI 1 "general_operand" "di"))))]
466 return output_btst (operands, operands[1], operands[0], insn, 7);
469 ;; This is the same as the above pattern except for the constraints. The 'i'
473 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "o")
475 (minus:SI (const_int 7)
476 (match_operand:SI 1 "general_operand" "d"))))]
479 return output_btst (operands, operands[1], operands[0], insn, 7);
483 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "d")
485 (minus:SI (const_int 31)
486 (match_operand:SI 1 "general_operand" "di"))))]
489 return output_btst (operands, operands[1], operands[0], insn, 31);
492 ;; The following two patterns are like the previous two
493 ;; except that they use the fact that bit-number operands
494 ;; are automatically masked to 3 or 5 bits.
497 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "o")
499 (minus:SI (const_int 7)
501 (match_operand:SI 1 "register_operand" "d")
505 return output_btst (operands, operands[1], operands[0], insn, 7);
509 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "d")
511 (minus:SI (const_int 31)
513 (match_operand:SI 1 "register_operand" "d")
517 return output_btst (operands, operands[1], operands[0], insn, 31);
520 ;; Nonoffsettable mem refs are ok in this one pattern
521 ;; since we don't try to adjust them.
523 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "m")
525 (match_operand:SI 1 "const_int_operand" "n")))]
526 "(unsigned) INTVAL (operands[1]) < 8 && !TARGET_COLDFIRE"
528 operands[1] = GEN_INT (7 - INTVAL (operands[1]));
529 return output_btst (operands, operands[1], operands[0], insn, 7);
533 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "do")
535 (match_operand:SI 1 "const_int_operand" "n")))]
538 if (GET_CODE (operands[0]) == MEM)
540 operands[0] = adjust_address (operands[0], QImode,
541 INTVAL (operands[1]) / 8);
542 operands[1] = GEN_INT (7 - INTVAL (operands[1]) % 8);
543 return output_btst (operands, operands[1], operands[0], insn, 7);
545 operands[1] = GEN_INT (31 - INTVAL (operands[1]));
546 return output_btst (operands, operands[1], operands[0], insn, 31);
549 ;; This is the same as the above pattern except for the constraints.
550 ;; The 'o' has been replaced with 'Q'.
553 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "dQ")
555 (match_operand:SI 1 "const_int_operand" "n")))]
558 if (GET_CODE (operands[0]) == MEM)
560 operands[0] = adjust_address (operands[0], QImode,
561 INTVAL (operands[1]) / 8);
562 operands[1] = GEN_INT (7 - INTVAL (operands[1]) % 8);
563 return output_btst (operands, operands[1], operands[0], insn, 7);
565 operands[1] = GEN_INT (31 - INTVAL (operands[1]));
566 return output_btst (operands, operands[1], operands[0], insn, 31);
572 ;; A special case in which it is not desirable
573 ;; to reload the constant into a data register.
574 (define_insn "pushexthisi_const"
575 [(set (match_operand:SI 0 "push_operand" "=m")
576 (match_operand:SI 1 "const_int_operand" "J"))]
577 "INTVAL (operands[1]) >= -0x8000 && INTVAL (operands[1]) < 0x8000"
579 if (operands[1] == const0_rtx)
581 if (valid_mov3q_const(operands[1]))
582 return "mov3q%.l %1,%-";
587 ;(define_insn "swapsi"
588 ; [(set (match_operand:SI 0 "nonimmediate_operand" "+r")
589 ; (match_operand:SI 1 "general_operand" "+r"))
590 ; (set (match_dup 1) (match_dup 0))]
594 ;; Special case of fullword move when source is zero.
595 ;; The reason this is special is to avoid loading a zero
596 ;; into a data reg with moveq in order to store it elsewhere.
598 (define_insn "movsi_const0"
599 [(set (match_operand:SI 0 "nonimmediate_operand" "=g")
601 ;; clr insns on 68000 read before writing.
602 "((TARGET_68010 || TARGET_COLDFIRE)
603 || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0])))"
605 if (ADDRESS_REG_P (operands[0]))
607 /* On the '040, 'subl an,an' takes 2 clocks while lea takes only 1 */
609 return MOTOROLA ? "lea 0.w,%0" : "lea 0:w,%0";
611 return "sub%.l %0,%0";
613 /* moveq is faster on the 68000. */
614 if (DATA_REG_P (operands[0]) && TUNE_68000_10)
615 return "moveq #0,%0";
619 ;; General case of fullword move.
621 ;; This is the main "hook" for PIC code. When generating
622 ;; PIC, movsi is responsible for determining when the source address
623 ;; needs PIC relocation and appropriately calling legitimize_pic_address
624 ;; to perform the actual relocation.
626 ;; In both the PIC and non-PIC cases the patterns generated will
627 ;; matched by the next define_insn.
628 (define_expand "movsi"
629 [(set (match_operand:SI 0 "nonimmediate_operand" "")
630 (match_operand:SI 1 "general_operand" ""))]
633 if (flag_pic && !TARGET_PCREL && symbolic_operand (operands[1], SImode))
635 /* The source is an address which requires PIC relocation.
636 Call legitimize_pic_address with the source, mode, and a relocation
637 register (a new pseudo, or the final destination if reload_in_progress
638 is set). Then fall through normally */
639 rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
640 operands[1] = legitimize_pic_address (operands[1], SImode, temp);
642 else if (flag_pic && TARGET_PCREL && ! reload_in_progress)
644 /* Don't allow writes to memory except via a register;
645 the m68k doesn't consider PC-relative addresses to be writable. */
646 if (symbolic_operand (operands[0], SImode))
647 operands[0] = force_reg (SImode, XEXP (operands[0], 0));
648 else if (GET_CODE (operands[0]) == MEM
649 && symbolic_operand (XEXP (operands[0], 0), SImode))
650 operands[0] = gen_rtx_MEM (SImode,
651 force_reg (SImode, XEXP (operands[0], 0)));
655 ;; General case of fullword move. The register constraints
656 ;; force integer constants in range for a moveq to be reloaded
657 ;; if they are headed for memory.
659 ;; Notes: make sure no alternative allows g vs g.
660 ;; We don't allow f-regs since fixed point cannot go in them.
661 [(set (match_operand:SI 0 "nonimmediate_operand" "=g,d,a<")
662 (match_operand:SI 1 "general_src_operand" "daymSKT,n,i"))]
666 return output_move_simode (operands);
669 (define_insn "*movsi_cf"
670 [(set (match_operand:SI 0 "nonimmediate_operand" "=r<Q>,g,U")
671 (match_operand:SI 1 "general_operand" "g,r<Q>,U"))]
672 "TARGET_COLDFIRE && !TARGET_ISAB"
673 "* return output_move_simode (operands);")
675 (define_insn "*movsi_cfv4"
676 [(set (match_operand:SI 0 "nonimmediate_operand" "=r<Q>,g,U")
677 (match_operand:SI 1 "general_operand" "Rg,Rr<Q>,U"))]
679 "* return output_move_simode (operands);")
681 ;; Special case of fullword move, where we need to get a non-GOT PIC
682 ;; reference into an address register.
684 [(set (match_operand:SI 0 "nonimmediate_operand" "=a<")
685 (match_operand:SI 1 "pcrel_address" ""))]
688 if (push_operand (operands[0], SImode))
693 (define_expand "movhi"
694 [(set (match_operand:HI 0 "nonimmediate_operand" "")
695 (match_operand:HI 1 "general_operand" ""))]
700 [(set (match_operand:HI 0 "nonimmediate_operand" "=g")
701 (match_operand:HI 1 "general_src_operand" "gS"))]
703 "* return output_move_himode (operands);")
706 [(set (match_operand:HI 0 "nonimmediate_operand" "=r<Q>,g,U")
707 (match_operand:HI 1 "general_operand" "g,r<Q>,U"))]
709 "* return output_move_himode (operands);")
711 (define_expand "movstricthi"
712 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" ""))
713 (match_operand:HI 1 "general_src_operand" ""))]
718 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
719 (match_operand:HI 1 "general_src_operand" "rmSn"))]
721 "* return output_move_stricthi (operands);")
724 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+d,m"))
725 (match_operand:HI 1 "general_src_operand" "rmn,r"))]
727 "* return output_move_stricthi (operands);")
729 (define_expand "movqi"
730 [(set (match_operand:QI 0 "nonimmediate_operand" "")
731 (match_operand:QI 1 "general_src_operand" ""))]
736 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,*a,m")
737 (match_operand:QI 1 "general_src_operand" "dmSi*a,di*a,dmSi"))]
739 "* return output_move_qimode (operands);")
742 [(set (match_operand:QI 0 "nonimmediate_operand" "=d<Q>,dm,U,d*a")
743 (match_operand:QI 1 "general_src_operand" "dmi,d<Q>,U,di*a"))]
745 "* return output_move_qimode (operands);")
747 (define_expand "movstrictqi"
748 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" ""))
749 (match_operand:QI 1 "general_src_operand" ""))]
754 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
755 (match_operand:QI 1 "general_src_operand" "dmSn"))]
757 "* return output_move_strictqi (operands);")
760 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+d,m"))
761 (match_operand:QI 1 "general_src_operand" "dmn,d"))]
763 "* return output_move_strictqi (operands);")
765 (define_expand "pushqi1"
766 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -2)))
767 (set (mem:QI (plus:SI (reg:SI SP_REG) (const_int 1)))
768 (match_operand:QI 0 "general_operand" ""))]
772 (define_expand "reload_insf"
773 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
774 (match_operand:SF 1 "general_operand" "mf"))
775 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
776 "TARGET_COLDFIRE_FPU"
778 if (emit_move_sequence (operands, SFmode, operands[2]))
781 /* We don't want the clobber emitted, so handle this ourselves. */
782 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
786 (define_expand "reload_outsf"
787 [(set (match_operand:SF 0 "general_operand" "")
788 (match_operand:SF 1 "register_operand" "f"))
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 "movsf"
801 [(set (match_operand:SF 0 "nonimmediate_operand" "")
802 (match_operand:SF 1 "general_operand" ""))]
807 [(set (match_operand:SF 0 "nonimmediate_operand" "=rmf")
808 (match_operand:SF 1 "general_operand" "rmfF"))]
811 if (FP_REG_P (operands[0]))
813 if (FP_REG_P (operands[1]))
814 return "f%$move%.x %1,%0";
815 else if (ADDRESS_REG_P (operands[1]))
816 return "move%.l %1,%-\;f%$move%.s %+,%0";
817 else if (GET_CODE (operands[1]) == CONST_DOUBLE)
818 return output_move_const_single (operands);
819 return "f%$move%.s %f1,%0";
821 if (FP_REG_P (operands[1]))
823 if (ADDRESS_REG_P (operands[0]))
824 return "fmove%.s %1,%-\;move%.l %+,%0";
825 return "fmove%.s %f1,%0";
827 if (operands[1] == CONST0_RTX (SFmode)
828 /* clr insns on 68000 read before writing. */
829 && ((TARGET_68010 || TARGET_COLDFIRE)
830 || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0]))))
832 if (ADDRESS_REG_P (operands[0]))
834 /* On the '040, 'subl an,an' takes 2 clocks while lea takes only 1 */
836 return MOTOROLA ? "lea 0.w,%0" : "lea 0:w,%0";
838 return "sub%.l %0,%0";
840 /* moveq is faster on the 68000. */
841 if (DATA_REG_P (operands[0]) && TUNE_68000_10)
842 return "moveq #0,%0";
845 return "move%.l %1,%0";
848 (define_insn "movsf_cf_soft"
849 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,g")
850 (match_operand:SF 1 "general_operand" "g,r"))]
851 "TARGET_COLDFIRE && !TARGET_COLDFIRE_FPU"
853 return "move%.l %1,%0";
856 (define_insn "movsf_cf_hard"
857 [(set (match_operand:SF 0 "nonimmediate_operand" "=r<Q>U, f, f,mr,f,r<Q>,f
859 (match_operand:SF 1 "general_operand" " f, r<Q>U,f,rm,F,F, m
861 "TARGET_COLDFIRE_FPU"
863 if (which_alternative == 4 || which_alternative == 5) {
867 REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
868 REAL_VALUE_TO_TARGET_SINGLE (r, l);
869 xoperands[0] = operands[0];
870 xoperands[1] = GEN_INT (l);
871 if (which_alternative == 5) {
873 if (ADDRESS_REG_P (xoperands[0]))
874 output_asm_insn ("sub%.l %0,%0", xoperands);
876 output_asm_insn ("clr%.l %0", xoperands);
878 if (GET_CODE (operands[0]) == MEM
879 && symbolic_operand (XEXP (operands[0], 0), SImode))
880 output_asm_insn ("move%.l %1,%-;move%.l %+,%0", xoperands);
882 output_asm_insn ("move%.l %1,%0", xoperands);
886 output_asm_insn ("move%.l %1,%-;fsmove%.s %+,%0", xoperands);
888 output_asm_insn ("clr%.l %-;fsmove%.s %+,%0", xoperands);
891 if (FP_REG_P (operands[0]))
893 if (ADDRESS_REG_P (operands[1]))
894 return "move%.l %1,%-;f%$smove%.s %+,%0";
895 if (FP_REG_P (operands[1]))
896 return "f%$move%.d %1,%0";
897 if (GET_CODE (operands[1]) == CONST_DOUBLE)
898 return output_move_const_single (operands);
899 return "f%$move%.s %f1,%0";
901 if (FP_REG_P (operands[1]))
903 if (ADDRESS_REG_P (operands[0]))
904 return "fmove%.s %1,%-;move%.l %+,%0";
905 return "fmove%.s %f1,%0";
907 if (operands[1] == CONST0_RTX (SFmode))
909 if (ADDRESS_REG_P (operands[0]))
910 return "sub%.l %0,%0";
913 return "move%.l %1,%0";
916 (define_expand "reload_indf"
917 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
918 (match_operand:DF 1 "general_operand" "mf"))
919 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
920 "TARGET_COLDFIRE_FPU"
922 if (emit_move_sequence (operands, DFmode, operands[2]))
925 /* We don't want the clobber emitted, so handle this ourselves. */
926 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
930 (define_expand "reload_outdf"
931 [(set (match_operand:DF 0 "general_operand" "")
932 (match_operand:DF 1 "register_operand" "f"))
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 "movdf"
945 [(set (match_operand:DF 0 "nonimmediate_operand" "")
946 (match_operand:DF 1 "general_operand" ""))]
949 if (TARGET_COLDFIRE_FPU)
950 if (emit_move_sequence (operands, DFmode, 0))
955 [(set (match_operand:DF 0 "nonimmediate_operand" "=rm,rf,rf,&rof<>")
956 (match_operand:DF 1 "general_operand" "*rf,m,0,*rofE<>"))]
957 ; [(set (match_operand:DF 0 "nonimmediate_operand" "=rm,&rf,&rof<>")
958 ; (match_operand:DF 1 "general_operand" "rf,m,rofF<>"))]
961 if (FP_REG_P (operands[0]))
963 if (FP_REG_P (operands[1]))
964 return "f%&move%.x %1,%0";
965 if (REG_P (operands[1]))
968 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
969 output_asm_insn ("move%.l %1,%-", xoperands);
970 output_asm_insn ("move%.l %1,%-", operands);
971 return "f%&move%.d %+,%0";
973 if (GET_CODE (operands[1]) == CONST_DOUBLE)
974 return output_move_const_double (operands);
975 return "f%&move%.d %f1,%0";
977 else if (FP_REG_P (operands[1]))
979 if (REG_P (operands[0]))
981 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
982 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
983 return "move%.l %+,%0";
986 return "fmove%.d %f1,%0";
988 return output_move_double (operands);
991 (define_insn "movdf_cf_soft"
992 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,g")
993 (match_operand:DF 1 "general_operand" "g,r"))]
994 "TARGET_COLDFIRE && !TARGET_COLDFIRE_FPU"
996 return output_move_double (operands);
999 (define_insn "movdf_cf_hard"
1000 [(set (match_operand:DF 0 "nonimmediate_operand" "=f, <Q>U,r,f,r,r,m,f")
1001 (match_operand:DF 1 "general_operand" " f<Q>U,f, f,r,r,m,r,E"))]
1002 "TARGET_COLDFIRE_FPU"
1008 switch (which_alternative)
1011 return "fmove%.d %1,%0";
1013 return "fmove%.d %1,%-;move%.l %+,%0;move%.l %+,%R0";
1015 return "move%.l %R1,%-;move%.l %1,%-;f%&move%.d %+,%0";
1017 return "move%.l %1,%0;move%.l %R1,%R0";
1019 return output_move_double (operands);
1021 REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
1022 REAL_VALUE_TO_TARGET_DOUBLE (r, l);
1023 xoperands[0] = operands[0];
1024 xoperands[1] = GEN_INT (l[0]);
1025 xoperands[2] = GEN_INT (l[1]);
1026 if (operands[1] == CONST0_RTX (DFmode))
1027 output_asm_insn ("clr%.l %-;clr%.l %-;fdmove%.d %+,%0",
1031 output_asm_insn ("clr%.l %-;move%.l %1,%-;fdmove%.d %+,%0",
1034 output_asm_insn ("move%.l %2,%-;move%.l %1,%-;fdmove%.d %+,%0",
1040 ;; ??? The XFmode patterns are schizophrenic about whether constants are
1041 ;; allowed. Most but not all have predicates and constraint that disallow
1042 ;; constants. Most but not all have output templates that handle constants.
1043 ;; See also LEGITIMATE_CONSTANT_P.
1045 (define_expand "movxf"
1046 [(set (match_operand:XF 0 "nonimmediate_operand" "")
1047 (match_operand:XF 1 "general_operand" ""))]
1050 /* We can't rewrite operands during reload. */
1051 if (! reload_in_progress)
1053 if (CONSTANT_P (operands[1]))
1055 operands[1] = force_const_mem (XFmode, operands[1]);
1056 if (! memory_address_p (XFmode, XEXP (operands[1], 0)))
1057 operands[1] = adjust_address (operands[1], XFmode, 0);
1059 if (flag_pic && TARGET_PCREL)
1061 /* Don't allow writes to memory except via a register; the
1062 m68k doesn't consider PC-relative addresses to be writable. */
1063 if (GET_CODE (operands[0]) == MEM
1064 && symbolic_operand (XEXP (operands[0], 0), SImode))
1065 operands[0] = gen_rtx_MEM (XFmode,
1066 force_reg (SImode, XEXP (operands[0], 0)));
1072 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,!r,!f,!r,m,!r")
1073 (match_operand:XF 1 "nonimmediate_operand" "m,f,f,f,r,!r,!r,m"))]
1076 if (FP_REG_P (operands[0]))
1078 if (FP_REG_P (operands[1]))
1079 return "fmove%.x %1,%0";
1080 if (REG_P (operands[1]))
1083 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 2);
1084 output_asm_insn ("move%.l %1,%-", xoperands);
1085 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1086 output_asm_insn ("move%.l %1,%-", xoperands);
1087 output_asm_insn ("move%.l %1,%-", operands);
1088 return "fmove%.x %+,%0";
1090 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1091 return "fmove%.x %1,%0";
1092 return "fmove%.x %f1,%0";
1094 if (FP_REG_P (operands[1]))
1096 if (REG_P (operands[0]))
1098 output_asm_insn ("fmove%.x %f1,%-\;move%.l %+,%0", operands);
1099 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1100 output_asm_insn ("move%.l %+,%0", operands);
1101 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1102 return "move%.l %+,%0";
1104 /* Must be memory destination. */
1105 return "fmove%.x %f1,%0";
1107 return output_move_double (operands);
1111 [(set (match_operand:XF 0 "nonimmediate_operand" "=rm,rf,&rof<>")
1112 (match_operand:XF 1 "nonimmediate_operand" "rf,m,rof<>"))]
1113 "! TARGET_68881 && ! TARGET_COLDFIRE"
1115 if (FP_REG_P (operands[0]))
1117 if (FP_REG_P (operands[1]))
1118 return "fmove%.x %1,%0";
1119 if (REG_P (operands[1]))
1122 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 2);
1123 output_asm_insn ("move%.l %1,%-", xoperands);
1124 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1125 output_asm_insn ("move%.l %1,%-", xoperands);
1126 output_asm_insn ("move%.l %1,%-", operands);
1127 return "fmove%.x %+,%0";
1129 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1130 return "fmove%.x %1,%0";
1131 return "fmove%.x %f1,%0";
1133 if (FP_REG_P (operands[1]))
1135 if (REG_P (operands[0]))
1137 output_asm_insn ("fmove%.x %f1,%-\;move%.l %+,%0", operands);
1138 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1139 output_asm_insn ("move%.l %+,%0", operands);
1140 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1141 return "move%.l %+,%0";
1144 return "fmove%.x %f1,%0";
1146 return output_move_double (operands);
1150 [(set (match_operand:XF 0 "nonimmediate_operand" "=r,g")
1151 (match_operand:XF 1 "nonimmediate_operand" "g,r"))]
1152 "! TARGET_68881 && TARGET_COLDFIRE"
1153 "* return output_move_double (operands);")
1155 (define_expand "movdi"
1156 ;; Let's see if it really still needs to handle fp regs, and, if so, why.
1157 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1158 (match_operand:DI 1 "general_operand" ""))]
1162 ;; movdi can apply to fp regs in some cases
1164 ;; Let's see if it really still needs to handle fp regs, and, if so, why.
1165 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r,&ro<>")
1166 (match_operand:DI 1 "general_operand" "rF,m,roi<>F"))]
1167 ; [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,&r,&ro<>,!&rm,!&f")
1168 ; (match_operand:DI 1 "general_operand" "r,m,roi<>,fF"))]
1169 ; [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,&rf,&ro<>,!&rm,!&f")
1170 ; (match_operand:DI 1 "general_operand" "r,m,roi<>,fF,rfF"))]
1173 if (FP_REG_P (operands[0]))
1175 if (FP_REG_P (operands[1]))
1176 return "fmove%.x %1,%0";
1177 if (REG_P (operands[1]))
1180 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1181 output_asm_insn ("move%.l %1,%-", xoperands);
1182 output_asm_insn ("move%.l %1,%-", operands);
1183 return "fmove%.d %+,%0";
1185 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1186 return output_move_const_double (operands);
1187 return "fmove%.d %f1,%0";
1189 else if (FP_REG_P (operands[1]))
1191 if (REG_P (operands[0]))
1193 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
1194 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1195 return "move%.l %+,%0";
1198 return "fmove%.d %f1,%0";
1200 return output_move_double (operands);
1204 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,g")
1205 (match_operand:DI 1 "general_operand" "g,r"))]
1207 "* return output_move_double (operands);")
1209 ;; Thus goes after the move instructions
1210 ;; because the move instructions are better (require no spilling)
1211 ;; when they can apply. It goes before the add/sub insns
1212 ;; so we will prefer it to them.
1214 (define_insn "pushasi"
1215 [(set (match_operand:SI 0 "push_operand" "=m")
1216 (match_operand:SI 1 "address_operand" "p"))]
1220 ;; truncation instructions
1221 (define_insn "truncsiqi2"
1222 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,d")
1224 (match_operand:SI 1 "general_src_operand" "doJS,i")))]
1227 if (GET_CODE (operands[0]) == REG)
1229 /* Must clear condition codes, since the move.l bases them on
1230 the entire 32 bits, not just the desired 8 bits. */
1232 return "move%.l %1,%0";
1234 if (GET_CODE (operands[1]) == MEM)
1235 operands[1] = adjust_address (operands[1], QImode, 3);
1236 return "move%.b %1,%0";
1239 (define_insn "trunchiqi2"
1240 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,d")
1242 (match_operand:HI 1 "general_src_operand" "doJS,i")))]
1245 if (GET_CODE (operands[0]) == REG
1246 && (GET_CODE (operands[1]) == MEM
1247 || GET_CODE (operands[1]) == CONST_INT))
1249 /* Must clear condition codes, since the move.w bases them on
1250 the entire 16 bits, not just the desired 8 bits. */
1252 return "move%.w %1,%0";
1254 if (GET_CODE (operands[0]) == REG)
1256 /* Must clear condition codes, since the move.l bases them on
1257 the entire 32 bits, not just the desired 8 bits. */
1259 return "move%.l %1,%0";
1261 if (GET_CODE (operands[1]) == MEM)
1262 operands[1] = adjust_address (operands[1], QImode, 1);
1263 return "move%.b %1,%0";
1266 (define_insn "truncsihi2"
1267 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm,d")
1269 (match_operand:SI 1 "general_src_operand" "roJS,i")))]
1272 if (GET_CODE (operands[0]) == REG)
1274 /* Must clear condition codes, since the move.l bases them on
1275 the entire 32 bits, not just the desired 8 bits. */
1277 return "move%.l %1,%0";
1279 if (GET_CODE (operands[1]) == MEM)
1280 operands[1] = adjust_address (operands[1], QImode, 2);
1281 return "move%.w %1,%0";
1284 ;; zero extension instructions
1286 ;; two special patterns to match various post_inc/pre_dec patterns
1287 (define_insn_and_split "*zero_extend_inc"
1288 [(set (match_operand 0 "post_inc_operand" "")
1289 (zero_extend (match_operand 1 "register_operand" "")))]
1290 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT &&
1291 GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT &&
1292 GET_MODE_SIZE (GET_MODE (operands[0])) == GET_MODE_SIZE (GET_MODE (operands[1])) * 2"
1300 operands[0] = adjust_address (operands[0], GET_MODE (operands[1]), 0);
1303 (define_insn_and_split "*zero_extend_dec"
1304 [(set (match_operand 0 "pre_dec_operand" "")
1305 (zero_extend (match_operand 1 "register_operand" "")))]
1306 "(GET_MODE (operands[0]) != HImode || XEXP (XEXP (operands[0], 0), 0) != stack_pointer_rtx) &&
1307 GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT &&
1308 GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT &&
1309 GET_MODE_SIZE (GET_MODE (operands[0])) == GET_MODE_SIZE (GET_MODE (operands[1])) * 2"
1317 operands[0] = adjust_address (operands[0], GET_MODE (operands[1]), 0);
1320 (define_insn_and_split "zero_extendqidi2"
1321 [(set (match_operand:DI 0 "register_operand" "")
1322 (zero_extend:DI (match_operand:QI 1 "nonimmediate_src_operand" "")))]
1327 (zero_extend:SI (match_dup 1)))
1331 operands[2] = gen_lowpart (SImode, operands[0]);
1332 operands[3] = gen_highpart (SImode, operands[0]);
1335 (define_insn_and_split "zero_extendhidi2"
1336 [(set (match_operand:DI 0 "register_operand" "")
1337 (zero_extend:DI (match_operand:HI 1 "nonimmediate_src_operand" "")))]
1342 (zero_extend:SI (match_dup 1)))
1346 operands[2] = gen_lowpart (SImode, operands[0]);
1347 operands[3] = gen_highpart (SImode, operands[0]);
1350 (define_expand "zero_extendsidi2"
1351 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1352 (zero_extend:DI (match_operand:SI 1 "nonimmediate_src_operand" "")))]
1355 if (GET_CODE (operands[0]) == MEM
1356 && GET_CODE (operands[1]) == MEM)
1357 operands[1] = force_reg (SImode, operands[1]);
1360 (define_insn_and_split "*zero_extendsidi2"
1361 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1362 (zero_extend:DI (match_operand:SI 1 "nonimmediate_src_operand" "")))]
1363 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
1371 operands[2] = gen_lowpart (SImode, operands[0]);
1372 operands[3] = gen_highpart (SImode, operands[0]);
1375 (define_insn "*zero_extendhisi2_cf"
1376 [(set (match_operand:SI 0 "register_operand" "=d")
1377 (zero_extend:SI (match_operand:HI 1 "nonimmediate_src_operand" "rmS")))]
1381 (define_insn "zero_extendhisi2"
1382 [(set (match_operand:SI 0 "register_operand" "=d")
1383 (zero_extend:SI (match_operand:HI 1 "nonimmediate_src_operand" "rmS")))]
1387 (define_expand "zero_extendqihi2"
1388 [(set (match_operand:HI 0 "register_operand" "")
1389 (zero_extend:HI (match_operand:QI 1 "nonimmediate_src_operand" "")))]
1393 (define_insn "*zero_extendqihi2"
1394 [(set (match_operand:HI 0 "register_operand" "=d")
1395 (zero_extend:HI (match_operand:QI 1 "nonimmediate_src_operand" "dmS")))]
1399 (define_insn "*zero_extendqisi2_cfv4"
1400 [(set (match_operand:SI 0 "register_operand" "=d")
1401 (zero_extend:SI (match_operand:QI 1 "nonimmediate_src_operand" "dmS")))]
1405 (define_insn "zero_extendqisi2"
1406 [(set (match_operand:SI 0 "register_operand" "=d")
1407 (zero_extend:SI (match_operand:QI 1 "nonimmediate_src_operand" "dmS")))]
1411 ;; these two pattern split everything else which isn't matched by
1412 ;; something else above
1414 [(set (match_operand 0 "register_operand" "")
1415 (zero_extend (match_operand 1 "nonimmediate_src_operand" "")))]
1418 && reg_mentioned_p (operands[0], operands[1])"
1419 [(set (strict_low_part (match_dup 2))
1422 (match_op_dup 4 [(match_dup 0) (match_dup 3)]))]
1424 operands[2] = gen_lowpart (GET_MODE (operands[1]), operands[0]);
1425 operands[3] = GEN_INT (GET_MODE_MASK (GET_MODE (operands[1])));
1426 operands[4] = gen_rtx_AND (GET_MODE (operands[0]), operands[0], operands[3]);
1430 [(set (match_operand 0 "register_operand" "")
1431 (zero_extend (match_operand 1 "nonimmediate_src_operand" "")))]
1432 "!TARGET_ISAB && reload_completed"
1435 (set (strict_low_part (match_dup 2))
1438 operands[2] = gen_lowpart (GET_MODE (operands[1]), operands[0]);
1441 ;; sign extension instructions
1443 (define_insn "extendqidi2"
1444 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
1445 (sign_extend:DI (match_operand:QI 1 "general_src_operand" "rmS")))]
1449 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1451 return "mvs%.b %1,%2\;smi %0\;extb%.l %0";
1452 if (TARGET_68020 || TARGET_COLDFIRE)
1454 if (ADDRESS_REG_P (operands[1]))
1455 return "move%.w %1,%2\;extb%.l %2\;smi %0\;extb%.l %0";
1457 return "move%.b %1,%2\;extb%.l %2\;smi %0\;extb%.l %0";
1461 if (ADDRESS_REG_P (operands[1]))
1462 return "move%.w %1,%2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0\;smi %0";
1464 return "move%.b %1,%2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0\;smi %0";
1468 (define_insn "extendhidi2"
1469 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
1471 (match_operand:HI 1 "general_src_operand" "rmS")))]
1475 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1477 return "mvs%.w %1,%2\;smi %0\;extb%.l %0";
1478 if (TARGET_68020 || TARGET_COLDFIRE)
1479 return "move%.w %1,%2\;ext%.l %2\;smi %0\;extb%.l %0";
1481 return "move%.w %1,%2\;ext%.l %2\;smi %0\;ext%.w %0\;ext%.l %0";
1484 (define_insn "extendsidi2"
1485 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
1487 (match_operand:SI 1 "general_operand" "rm")))]
1491 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1492 if (TARGET_68020 || TARGET_COLDFIRE)
1493 return "move%.l %1,%2\;smi %0\;extb%.l %0";
1495 return "move%.l %1,%2\;smi %0\;ext%.w %0\;ext%.l %0";
1498 ;; Special case when one can avoid register clobbering, copy and test
1499 ;; Maybe there is a way to make that the general case, by forcing the
1500 ;; result of the SI tree to be in the lower register of the DI target
1502 (define_insn "extendplussidi"
1503 [(set (match_operand:DI 0 "register_operand" "=d")
1504 (sign_extend:DI (plus:SI (match_operand:SI 1 "general_operand" "%rmn")
1505 (match_operand:SI 2 "general_operand" "rmn"))))]
1509 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1510 if (GET_CODE (operands[1]) == CONST_INT
1511 && (unsigned) INTVAL (operands[1]) > 8)
1513 rtx tmp = operands[1];
1515 operands[1] = operands[2];
1518 if (GET_CODE (operands[1]) == REG
1519 && REGNO (operands[1]) == REGNO (operands[3]))
1520 output_asm_insn ("add%.l %2,%3", operands);
1522 output_asm_insn ("move%.l %2,%3\;add%.l %1,%3", operands);
1523 if (TARGET_68020 || TARGET_COLDFIRE)
1524 return "smi %0\;extb%.l %0";
1526 return "smi %0\;ext%.w %0\;ext%.l %0";
1529 (define_expand "extendhisi2"
1530 [(set (match_operand:SI 0 "nonimmediate_operand" "")
1532 (match_operand:HI 1 "nonimmediate_src_operand" "")))]
1536 (define_insn "*cfv4_extendhisi2"
1537 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
1539 (match_operand:HI 1 "nonimmediate_src_operand" "rmS")))]
1543 (define_insn "*68k_extendhisi2"
1544 [(set (match_operand:SI 0 "nonimmediate_operand" "=*d,a")
1546 (match_operand:HI 1 "nonimmediate_src_operand" "0,rmS")))]
1549 if (ADDRESS_REG_P (operands[0]))
1550 return "move%.w %1,%0";
1554 (define_insn "extendqihi2"
1555 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
1556 (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0")))]
1560 (define_expand "extendqisi2"
1561 [(set (match_operand:SI 0 "nonimmediate_operand" "")
1562 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
1563 "TARGET_68020 || TARGET_COLDFIRE"
1566 (define_insn "*cfv4_extendqisi2"
1567 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
1568 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "rms")))]
1572 (define_insn "*68k_extendqisi2"
1573 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
1574 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "0")))]
1575 "TARGET_68020 || (TARGET_COLDFIRE && !TARGET_ISAB)"
1578 ;; Conversions between float and double.
1580 (define_expand "extendsfdf2"
1581 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1583 (match_operand:SF 1 "general_operand" "")))]
1588 [(set (match_operand:DF 0 "nonimmediate_operand" "=*fdm,f")
1590 (match_operand:SF 1 "general_operand" "f,dmF")))]
1593 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
1595 if (REGNO (operands[0]) == REGNO (operands[1]))
1597 /* Extending float to double in an fp-reg is a no-op.
1598 NOTICE_UPDATE_CC has already assumed that the
1599 cc will be set. So cancel what it did. */
1600 cc_status = cc_prev_status;
1603 return "f%&move%.x %1,%0";
1605 if (FP_REG_P (operands[0]))
1606 return "f%&move%.s %f1,%0";
1607 if (DATA_REG_P (operands[0]) && FP_REG_P (operands[1]))
1609 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
1610 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1611 return "move%.l %+,%0";
1613 return "fmove%.d %f1,%0";
1616 (define_insn "extendsfdf2_cf"
1617 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f")
1619 (match_operand:SF 1 "general_operand" "f,<Q>U")))]
1620 "TARGET_COLDFIRE_FPU"
1622 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
1624 if (REGNO (operands[0]) == REGNO (operands[1]))
1626 /* Extending float to double in an fp-reg is a no-op.
1627 NOTICE_UPDATE_CC has already assumed that the
1628 cc will be set. So cancel what it did. */
1629 cc_status = cc_prev_status;
1632 return "f%&move%.d %1,%0";
1634 return "f%&move%.s %f1,%0";
1637 ;; This cannot output into an f-reg because there is no way to be
1638 ;; sure of truncating in that case.
1639 (define_expand "truncdfsf2"
1640 [(set (match_operand:SF 0 "nonimmediate_operand" "")
1642 (match_operand:DF 1 "general_operand" "")))]
1646 ;; On the '040 we can truncate in a register accurately and easily.
1648 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
1650 (match_operand:DF 1 "general_operand" "fmG")))]
1651 "TARGET_68881 && TARGET_68040"
1653 if (FP_REG_P (operands[1]))
1654 return "f%$move%.x %1,%0";
1655 return "f%$move%.d %f1,%0";
1658 (define_insn "truncdfsf2_cf"
1659 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,d<Q>U")
1661 (match_operand:DF 1 "general_operand" "<Q>U,f")))]
1662 "TARGET_COLDFIRE_FPU"
1668 [(set (match_operand:SF 0 "nonimmediate_operand" "=dm")
1670 (match_operand:DF 1 "general_operand" "f")))]
1674 ;; Conversion between fixed point and floating point.
1675 ;; Note that among the fix-to-float insns
1676 ;; the ones that start with SImode come first.
1677 ;; That is so that an operand that is a CONST_INT
1678 ;; (and therefore lacks a specific machine mode).
1679 ;; will be recognized as SImode (which is always valid)
1680 ;; rather than as QImode or HImode.
1682 (define_expand "floatsi<mode>2"
1683 [(set (match_operand:FP 0 "nonimmediate_operand" "")
1684 (float:FP (match_operand:SI 1 "general_operand" "")))]
1688 (define_insn "floatsi<mode>2_68881"
1689 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1690 (float:FP (match_operand:SI 1 "general_operand" "dmi")))]
1692 "f<FP:round>move%.l %1,%0")
1694 (define_insn "floatsi<mode>2_cf"
1695 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1696 (float:FP (match_operand:SI 1 "general_operand" "d<Q>U")))]
1697 "TARGET_COLDFIRE_FPU"
1698 "f<FP:prec>move%.l %1,%0")
1701 (define_expand "floathi<mode>2"
1702 [(set (match_operand:FP 0 "nonimmediate_operand" "")
1703 (float:FP (match_operand:HI 1 "general_operand" "")))]
1707 (define_insn "floathi<mode>2_68881"
1708 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1709 (float:FP (match_operand:HI 1 "general_operand" "dmn")))]
1713 (define_insn "floathi<mode>2_cf"
1714 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1715 (float:FP (match_operand:HI 1 "general_operand" "d<Q>U")))]
1716 "TARGET_COLDFIRE_FPU"
1720 (define_expand "floatqi<mode>2"
1721 [(set (match_operand:FP 0 "nonimmediate_operand" "")
1722 (float:FP (match_operand:QI 1 "general_operand" "")))]
1726 (define_insn "floatqi<mode>2_68881"
1727 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1728 (float:FP (match_operand:QI 1 "general_operand" "dmn")))]
1732 (define_insn "floatqi<mode>2_cf"
1733 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1734 (float:FP (match_operand:QI 1 "general_operand" "d<Q>U")))]
1735 "TARGET_COLDFIRE_FPU"
1739 ;; New routines to convert floating-point values to integers
1740 ;; to be used on the '040. These should be faster than trapping
1741 ;; into the kernel to emulate fintrz. They should also be faster
1742 ;; than calling the subroutines fixsfsi or fixdfsi.
1744 (define_insn "fix_truncdfsi2"
1745 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
1746 (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
1747 (clobber (match_scratch:SI 2 "=d"))
1748 (clobber (match_scratch:SI 3 "=d"))]
1749 "TARGET_68881 && TUNE_68040"
1752 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,%!";
1755 (define_insn "fix_truncdfhi2"
1756 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
1757 (fix:HI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
1758 (clobber (match_scratch:SI 2 "=d"))
1759 (clobber (match_scratch:SI 3 "=d"))]
1760 "TARGET_68881 && TUNE_68040"
1763 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,%!";
1766 (define_insn "fix_truncdfqi2"
1767 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
1768 (fix:QI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
1769 (clobber (match_scratch:SI 2 "=d"))
1770 (clobber (match_scratch:SI 3 "=d"))]
1771 "TARGET_68881 && TUNE_68040"
1774 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,%!";
1777 ;; Convert a float to a float whose value is an integer.
1778 ;; This is the first stage of converting it to an integer type.
1780 (define_expand "ftrunc<mode>2"
1781 [(set (match_operand:FP 0 "nonimmediate_operand" "")
1782 (fix:FP (match_operand:FP 1 "general_operand" "")))]
1783 "TARGET_HARD_FLOAT && !TUNE_68040"
1786 (define_insn "ftrunc<mode>2_68881"
1787 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1788 (fix:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m")))]
1789 "TARGET_68881 && !TUNE_68040"
1791 if (FP_REG_P (operands[1]))
1792 return "fintrz%.x %f1,%0";
1793 return "fintrz%.<FP:prec> %f1,%0";
1796 (define_insn "ftrunc<mode>2_cf"
1797 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1798 (fix:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U")))]
1799 "TARGET_COLDFIRE_FPU"
1801 if (FP_REG_P (operands[1]))
1802 return "fintrz%.d %f1,%0";
1803 return "fintrz%.<FP:prec> %f1,%0";
1806 ;; Convert a float whose value is an integer
1807 ;; to an actual integer. Second stage of converting float to integer type.
1808 (define_expand "fix<mode>qi2"
1809 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1810 (fix:QI (match_operand:FP 1 "general_operand" "")))]
1814 (define_insn "fix<mode>qi2_68881"
1815 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
1816 (fix:QI (match_operand:FP 1 "general_operand" "f")))]
1820 (define_insn "fix<mode>qi2_cf"
1821 [(set (match_operand:QI 0 "nonimmediate_operand" "=d<Q>U")
1822 (fix:QI (match_operand:FP 1 "general_operand" "f")))]
1823 "TARGET_COLDFIRE_FPU"
1826 (define_expand "fix<mode>hi2"
1827 [(set (match_operand:HI 0 "nonimmediate_operand" "")
1828 (fix:HI (match_operand:FP 1 "general_operand" "")))]
1832 (define_insn "fix<mode>hi2_68881"
1833 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
1834 (fix:HI (match_operand:FP 1 "general_operand" "f")))]
1838 (define_insn "fix<mode>hi2_cf"
1839 [(set (match_operand:HI 0 "nonimmediate_operand" "=d<Q>U")
1840 (fix:HI (match_operand:FP 1 "general_operand" "f")))]
1841 "TARGET_COLDFIRE_FPU"
1844 (define_expand "fix<mode>si2"
1845 [(set (match_operand:SI 0 "nonimmediate_operand" "")
1846 (fix:SI (match_operand:FP 1 "general_operand" "")))]
1850 (define_insn "fix<mode>si2_68881"
1851 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
1852 (fix:SI (match_operand:FP 1 "general_operand" "f")))]
1856 (define_insn "fix<mode>si2_cf"
1857 [(set (match_operand:SI 0 "nonimmediate_operand" "=d<Q>U")
1858 (fix:SI (match_operand:FP 1 "general_operand" "f")))]
1859 "TARGET_COLDFIRE_FPU"
1865 (define_insn "adddi_lshrdi_63"
1866 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
1867 (plus:DI (lshiftrt:DI (match_operand:DI 1 "general_operand" "rm")
1870 (clobber (match_scratch:SI 2 "=d"))]
1873 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1874 if (REG_P (operands[1]) && REGNO (operands[1]) == REGNO (operands[0]))
1876 "move%.l %1,%2\;add%.l %2,%2\;subx%.l %2,%2\;sub%.l %2,%3\;subx%.l %2,%0";
1877 if (GET_CODE (operands[1]) == REG)
1878 operands[4] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1879 else if (GET_CODE (XEXP (operands[1], 0)) == POST_INC
1880 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
1881 operands[4] = operands[1];
1883 operands[4] = adjust_address (operands[1], SImode, 4);
1884 if (GET_CODE (operands[1]) == MEM
1885 && GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
1886 output_asm_insn ("move%.l %4,%3", operands);
1887 output_asm_insn ("move%.l %1,%0\;smi %2", operands);
1888 if (TARGET_68020 || TARGET_COLDFIRE)
1889 output_asm_insn ("extb%.l %2", operands);
1891 output_asm_insn ("ext%.w %2\;ext%.l %2", operands);
1892 if (GET_CODE (operands[1]) != MEM
1893 || GET_CODE (XEXP (operands[1], 0)) != PRE_DEC)
1894 output_asm_insn ("move%.l %4,%3", operands);
1895 return "sub%.l %2,%3\;subx%.l %2,%0";
1898 (define_insn "adddi_sexthishl32"
1899 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,a,*d,*d")
1900 (plus:DI (ashift:DI (sign_extend:DI
1901 (match_operand:HI 1 "general_operand" "rm,rm,rm,rm"))
1903 (match_operand:DI 2 "general_operand" "0,0,0,0")))
1904 (clobber (match_scratch:SI 3 "=&d,X,a,?d"))]
1908 if (ADDRESS_REG_P (operands[0]))
1909 return "add%.w %1,%0";
1910 else if (ADDRESS_REG_P (operands[3]))
1911 return "move%.w %1,%3\;add%.l %3,%0";
1913 return "move%.w %1,%3\;ext%.l %3\;add%.l %3,%0";
1916 (define_insn "adddi_dilshr32"
1917 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,o")
1918 ;; (plus:DI (match_operand:DI 2 "general_operand" "%0")
1919 ;; (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro")
1920 ;; (const_int 32))))]
1921 (plus:DI (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro,d")
1923 (match_operand:DI 2 "general_operand" "0,0")))]
1927 if (GET_CODE (operands[0]) == REG)
1928 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1930 operands[2] = adjust_address (operands[0], SImode, 4);
1931 return "add%.l %1,%2\;negx%.l %0\;neg%.l %0";
1934 (define_insn "adddi_dishl32"
1935 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o")
1936 ;; (plus:DI (match_operand:DI 2 "general_operand" "%0")
1937 ;; (ashift:DI (match_operand:DI 1 "general_operand" "ro")
1938 ;; (const_int 32))))]
1939 (plus:DI (ashift:DI (match_operand:DI 1 "general_operand" "ro,d")
1941 (match_operand:DI 2 "general_operand" "0,0")))]
1945 if (GET_CODE (operands[1]) == REG)
1946 operands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1948 operands[1] = adjust_address (operands[1], SImode, 4);
1949 return "add%.l %1,%0";
1952 (define_insn "adddi3"
1953 [(set (match_operand:DI 0 "nonimmediate_operand" "=<,o<>,d,d,d")
1954 (plus:DI (match_operand:DI 1 "general_operand" "%0,0,0,0,0")
1955 (match_operand:DI 2 "general_operand" "<,d,no>,d,a")))
1956 (clobber (match_scratch:SI 3 "=X,&d,&d,X,&d"))]
1959 if (DATA_REG_P (operands[0]))
1961 if (DATA_REG_P (operands[2]))
1962 return "add%.l %R2,%R0\;addx%.l %2,%0";
1963 else if (GET_CODE (operands[2]) == MEM
1964 && GET_CODE (XEXP (operands[2], 0)) == POST_INC)
1965 return "move%.l %2,%3\;add%.l %2,%R0\;addx%.l %3,%0";
1971 if (GET_CODE (operands[2]) == REG)
1973 low = gen_rtx_REG (SImode, REGNO (operands[2]) + 1);
1976 else if (CONSTANT_P (operands[2]))
1977 split_double (operands[2], &high, &low);
1980 low = adjust_address (operands[2], SImode, 4);
1984 operands[1] = low, operands[2] = high;
1985 xoperands[0] = operands[3];
1986 if (GET_CODE (operands[1]) == CONST_INT
1987 && INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
1988 xoperands[1] = GEN_INT (-INTVAL (operands[2]) - 1);
1990 xoperands[1] = operands[2];
1992 output_asm_insn (output_move_simode (xoperands), xoperands);
1993 if (GET_CODE (operands[1]) == CONST_INT)
1995 if (INTVAL (operands[1]) > 0 && INTVAL (operands[1]) <= 8)
1996 return "addq%.l %1,%R0\;addx%.l %3,%0";
1997 else if (INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
1999 operands[1] = GEN_INT (-INTVAL (operands[1]));
2000 return "subq%.l %1,%R0\;subx%.l %3,%0";
2003 return "add%.l %1,%R0\;addx%.l %3,%0";
2008 gcc_assert (GET_CODE (operands[0]) == MEM);
2009 if (GET_CODE (operands[2]) == MEM
2010 && GET_CODE (XEXP (operands[2], 0)) == PRE_DEC)
2011 return "add%.l %2,%0\;addx%.l %2,%0";
2013 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
2015 operands[1] = gen_rtx_MEM (SImode,
2016 plus_constant (XEXP(operands[0], 0), -8));
2017 return "move%.l %0,%3\;add%.l %R2,%0\;addx%.l %2,%3\;move%.l %3,%1";
2019 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
2021 operands[1] = XEXP(operands[0], 0);
2022 return "add%.l %R2,%0\;move%.l %0,%3\;addx%.l %2,%3\;move%.l %3,%1";
2026 operands[1] = adjust_address (operands[0], SImode, 4);
2027 return "add%.l %R2,%1\;move%.l %0,%3\;addx%.l %2,%3\;move%.l %3,%0";
2032 (define_insn "addsi_lshrsi_31"
2033 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
2034 (plus:SI (lshiftrt:SI (match_operand:SI 1 "general_operand" "rm")
2039 operands[2] = operands[0];
2040 operands[3] = gen_label_rtx();
2041 if (GET_CODE (operands[0]) == MEM)
2043 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
2044 operands[0] = gen_rtx_MEM (SImode, XEXP (XEXP (operands[0], 0), 0));
2045 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
2046 operands[2] = gen_rtx_MEM (SImode, XEXP (XEXP (operands[0], 0), 0));
2048 output_asm_insn ("move%.l %1,%0", operands);
2049 output_asm_insn (MOTOROLA ? "jbpl %l3" : "jpl %l3", operands);
2050 output_asm_insn ("addq%.l #1,%2", operands);
2051 (*targetm.asm_out.internal_label) (asm_out_file, "L",
2052 CODE_LABEL_NUMBER (operands[3]));
2056 (define_expand "addsi3"
2057 [(set (match_operand:SI 0 "nonimmediate_operand" "")
2058 (plus:SI (match_operand:SI 1 "general_operand" "")
2059 (match_operand:SI 2 "general_src_operand" "")))]
2063 ;; Note that the middle two alternatives are near-duplicates
2064 ;; in order to handle insns generated by reload.
2065 ;; This is needed since they are not themselves reloaded,
2066 ;; so commutativity won't apply to them.
2067 (define_insn "*addsi3_internal"
2068 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,?a,?a,d,a")
2069 (plus:SI (match_operand:SI 1 "general_operand" "%0,a,rJK,0,0")
2070 (match_operand:SI 2 "general_src_operand" "dIKLT,rJK,a,mSrIKLT,mSrIKLs")))]
2074 "* return output_addsi3 (operands);")
2076 (define_insn "*addsi3_5200"
2077 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,?a,?a,r")
2078 (plus:SI (match_operand:SI 1 "general_operand" "%0,a,rJK,0")
2079 (match_operand:SI 2 "general_src_operand" "dIL,rJK,a,mrIKLi")))]
2081 "* return output_addsi3 (operands);")
2084 [(set (match_operand:SI 0 "nonimmediate_operand" "=a")
2085 (plus:SI (match_operand:SI 1 "general_operand" "0")
2087 (match_operand:HI 2 "nonimmediate_src_operand" "rmS"))))]
2091 (define_insn "addhi3"
2092 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,r")
2093 (plus:HI (match_operand:HI 1 "general_operand" "%0,0")
2094 (match_operand:HI 2 "general_src_operand" "dn,rmSn")))]
2097 if (GET_CODE (operands[2]) == CONST_INT)
2099 /* If the constant would be a negative number when interpreted as
2100 HImode, make it negative. This is usually, but not always, done
2101 elsewhere in the compiler. First check for constants out of range,
2102 which could confuse us. */
2104 if (INTVAL (operands[2]) >= 32768)
2105 operands[2] = GEN_INT (INTVAL (operands[2]) - 65536);
2107 if (INTVAL (operands[2]) > 0
2108 && INTVAL (operands[2]) <= 8)
2109 return "addq%.w %2,%0";
2110 if (INTVAL (operands[2]) < 0
2111 && INTVAL (operands[2]) >= -8)
2113 operands[2] = GEN_INT (- INTVAL (operands[2]));
2114 return "subq%.w %2,%0";
2116 /* On the CPU32 it is faster to use two addqw instructions to
2117 add a small integer (8 < N <= 16) to a register.
2118 Likewise for subqw. */
2119 if (TUNE_CPU32 && REG_P (operands[0]))
2121 if (INTVAL (operands[2]) > 8
2122 && INTVAL (operands[2]) <= 16)
2124 operands[2] = GEN_INT (INTVAL (operands[2]) - 8);
2125 return "addq%.w #8,%0\;addq%.w %2,%0";
2127 if (INTVAL (operands[2]) < -8
2128 && INTVAL (operands[2]) >= -16)
2130 operands[2] = GEN_INT (- INTVAL (operands[2]) - 8);
2131 return "subq%.w #8,%0\;subq%.w %2,%0";
2134 if (ADDRESS_REG_P (operands[0]) && !TUNE_68040)
2135 return MOTOROLA ? "lea (%c2,%0),%0" : "lea %0@(%c2),%0";
2137 return "add%.w %2,%0";
2140 ;; These insns must use MATCH_DUP instead of the more expected
2141 ;; use of a matching constraint because the "output" here is also
2142 ;; an input, so you can't use the matching constraint. That also means
2143 ;; that you can't use the "%", so you need patterns with the matched
2144 ;; operand in both positions.
2147 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
2148 (plus:HI (match_dup 0)
2149 (match_operand:HI 1 "general_src_operand" "dn,rmSn")))]
2152 if (GET_CODE (operands[1]) == CONST_INT)
2154 /* If the constant would be a negative number when interpreted as
2155 HImode, make it negative. This is usually, but not always, done
2156 elsewhere in the compiler. First check for constants out of range,
2157 which could confuse us. */
2159 if (INTVAL (operands[1]) >= 32768)
2160 operands[1] = GEN_INT (INTVAL (operands[1]) - 65536);
2162 if (INTVAL (operands[1]) > 0
2163 && INTVAL (operands[1]) <= 8)
2164 return "addq%.w %1,%0";
2165 if (INTVAL (operands[1]) < 0
2166 && INTVAL (operands[1]) >= -8)
2168 operands[1] = GEN_INT (- INTVAL (operands[1]));
2169 return "subq%.w %1,%0";
2171 /* On the CPU32 it is faster to use two addqw instructions to
2172 add a small integer (8 < N <= 16) to a register.
2173 Likewise for subqw. */
2174 if (TUNE_CPU32 && REG_P (operands[0]))
2176 if (INTVAL (operands[1]) > 8
2177 && INTVAL (operands[1]) <= 16)
2179 operands[1] = GEN_INT (INTVAL (operands[1]) - 8);
2180 return "addq%.w #8,%0\;addq%.w %1,%0";
2182 if (INTVAL (operands[1]) < -8
2183 && INTVAL (operands[1]) >= -16)
2185 operands[1] = GEN_INT (- INTVAL (operands[1]) - 8);
2186 return "subq%.w #8,%0\;subq%.w %1,%0";
2189 if (ADDRESS_REG_P (operands[0]) && !TUNE_68040)
2190 return MOTOROLA ? "lea (%c1,%0),%0" : "lea %0@(%c1),%0";
2192 return "add%.w %1,%0";
2196 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
2197 (plus:HI (match_operand:HI 1 "general_src_operand" "dn,rmSn")
2201 if (GET_CODE (operands[1]) == CONST_INT)
2203 /* If the constant would be a negative number when interpreted as
2204 HImode, make it negative. This is usually, but not always, done
2205 elsewhere in the compiler. First check for constants out of range,
2206 which could confuse us. */
2208 if (INTVAL (operands[1]) >= 32768)
2209 operands[1] = GEN_INT (INTVAL (operands[1]) - 65536);
2211 if (INTVAL (operands[1]) > 0
2212 && INTVAL (operands[1]) <= 8)
2213 return "addq%.w %1,%0";
2214 if (INTVAL (operands[1]) < 0
2215 && INTVAL (operands[1]) >= -8)
2217 operands[1] = GEN_INT (- INTVAL (operands[1]));
2218 return "subq%.w %1,%0";
2220 /* On the CPU32 it is faster to use two addqw instructions to
2221 add a small integer (8 < N <= 16) to a register.
2222 Likewise for subqw. */
2223 if (TUNE_CPU32 && REG_P (operands[0]))
2225 if (INTVAL (operands[1]) > 8
2226 && INTVAL (operands[1]) <= 16)
2228 operands[1] = GEN_INT (INTVAL (operands[1]) - 8);
2229 return "addq%.w #8,%0\;addq%.w %1,%0";
2231 if (INTVAL (operands[1]) < -8
2232 && INTVAL (operands[1]) >= -16)
2234 operands[1] = GEN_INT (- INTVAL (operands[1]) - 8);
2235 return "subq%.w #8,%0\;subq%.w %1,%0";
2238 if (ADDRESS_REG_P (operands[0]) && !TUNE_68040)
2239 return MOTOROLA ? "lea (%c1,%0),%0" : "lea %0@(%c1),%0";
2241 return "add%.w %1,%0";
2244 (define_insn "addqi3"
2245 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
2246 (plus:QI (match_operand:QI 1 "general_operand" "%0,0")
2247 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
2250 if (GET_CODE (operands[2]) == CONST_INT)
2252 if (INTVAL (operands[2]) >= 128)
2253 operands[2] = GEN_INT (INTVAL (operands[2]) - 256);
2255 if (INTVAL (operands[2]) > 0
2256 && INTVAL (operands[2]) <= 8)
2257 return "addq%.b %2,%0";
2258 if (INTVAL (operands[2]) < 0 && INTVAL (operands[2]) >= -8)
2260 operands[2] = GEN_INT (- INTVAL (operands[2]));
2261 return "subq%.b %2,%0";
2264 return "add%.b %2,%0";
2268 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
2269 (plus:QI (match_dup 0)
2270 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
2273 if (GET_CODE (operands[1]) == CONST_INT)
2275 if (INTVAL (operands[1]) >= 128)
2276 operands[1] = GEN_INT (INTVAL (operands[1]) - 256);
2278 if (INTVAL (operands[1]) > 0
2279 && INTVAL (operands[1]) <= 8)
2280 return "addq%.b %1,%0";
2281 if (INTVAL (operands[1]) < 0 && INTVAL (operands[1]) >= -8)
2283 operands[1] = GEN_INT (- INTVAL (operands[1]));
2284 return "subq%.b %1,%0";
2287 return "add%.b %1,%0";
2291 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
2292 (plus:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn")
2296 if (GET_CODE (operands[1]) == CONST_INT)
2298 if (INTVAL (operands[1]) >= 128)
2299 operands[1] = GEN_INT (INTVAL (operands[1]) - 256);
2301 if (INTVAL (operands[1]) > 0
2302 && INTVAL (operands[1]) <= 8)
2303 return "addq%.b %1,%0";
2304 if (INTVAL (operands[1]) < 0 && INTVAL (operands[1]) >= -8)
2306 operands[1] = GEN_INT (- INTVAL (operands[1]));
2307 return "subq%.b %1,%0";
2310 return "add%.b %1,%0";
2313 (define_expand "add<mode>3"
2314 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2315 (plus:FP (match_operand:FP 1 "general_operand" "")
2316 (match_operand:FP 2 "general_operand" "")))]
2320 (define_insn "add<mode>3_floatsi_68881"
2321 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2322 (plus:FP (float:FP (match_operand:SI 2 "general_operand" "dmi"))
2323 (match_operand:FP 1 "general_operand" "0")))]
2325 "f<FP:round>add%.l %2,%0")
2327 (define_insn "add<mode>3_floathi_68881"
2328 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2329 (plus:FP (float:FP (match_operand:HI 2 "general_operand" "dmn"))
2330 (match_operand:FP 1 "general_operand" "0")))]
2332 "f<FP:round>add%.w %2,%0")
2334 (define_insn "add<mode>3_floatqi_68881"
2335 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2336 (plus:FP (float:FP (match_operand:QI 2 "general_operand" "dmn"))
2337 (match_operand:FP 1 "general_operand" "0")))]
2339 "f<FP:round>add%.b %2,%0")
2341 (define_insn "add<mode>3_68881"
2342 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2343 (plus:FP (match_operand:FP 1 "general_operand" "%0")
2344 (match_operand:FP 2 "general_operand" "f<FP:dreg>m<FP:const>")))]
2347 if (FP_REG_P (operands[2]))
2348 return "f<FP:round>add%.x %2,%0";
2349 return "f<FP:round>add%.<FP:prec> %f2,%0";
2352 (define_insn "add<mode>3_cf"
2353 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2354 (plus:FP (match_operand:FP 1 "general_operand" "%0")
2355 (match_operand:FP 2 "general_operand" "f<FP:dreg><Q>U")))]
2356 "TARGET_COLDFIRE_FPU"
2358 if (FP_REG_P (operands[2]))
2359 return "f<FP:round>add%.d %2,%0";
2360 return "f<FP:round>add%.<FP:prec> %2,%0";
2363 ;; subtract instructions
2365 (define_insn "subdi_sexthishl32"
2366 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,a,*d,*d")
2367 (minus:DI (match_operand:DI 1 "general_operand" "0,0,0,0")
2368 (ashift:DI (sign_extend:DI (match_operand:HI 2 "general_operand" "rm,rm,rm,rm"))
2370 (clobber (match_scratch:SI 3 "=&d,X,a,?d"))]
2374 if (ADDRESS_REG_P (operands[0]))
2375 return "sub%.w %2,%0";
2376 else if (ADDRESS_REG_P (operands[3]))
2377 return "move%.w %2,%3\;sub%.l %3,%0";
2379 return "move%.w %2,%3\;ext%.l %3\;sub%.l %3,%0";
2382 (define_insn "subdi_dishl32"
2383 [(set (match_operand:DI 0 "nonimmediate_operand" "+ro")
2384 (minus:DI (match_dup 0)
2385 (ashift:DI (match_operand:DI 1 "general_operand" "ro")
2390 if (GET_CODE (operands[1]) == REG)
2391 operands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
2393 operands[1] = adjust_address (operands[1], SImode, 4);
2394 return "sub%.l %1,%0";
2397 (define_insn "subdi3"
2398 [(set (match_operand:DI 0 "nonimmediate_operand" "=<,o<>,d,d,d")
2399 (minus:DI (match_operand:DI 1 "general_operand" "0,0,0,0,0")
2400 (match_operand:DI 2 "general_operand" "<,d,no>,d,a")))
2401 (clobber (match_scratch:SI 3 "=X,&d,&d,X,&d"))]
2404 if (DATA_REG_P (operands[0]))
2406 if (DATA_REG_P (operands[2]))
2407 return "sub%.l %R2,%R0\;subx%.l %2,%0";
2408 else if (GET_CODE (operands[2]) == MEM
2409 && GET_CODE (XEXP (operands[2], 0)) == POST_INC)
2411 return "move%.l %2,%3\;sub%.l %2,%R0\;subx%.l %3,%0";
2418 if (GET_CODE (operands[2]) == REG)
2420 low = gen_rtx_REG (SImode, REGNO (operands[2]) + 1);
2423 else if (CONSTANT_P (operands[2]))
2424 split_double (operands[2], &high, &low);
2427 low = adjust_address (operands[2], SImode, 4);
2431 operands[1] = low, operands[2] = high;
2432 xoperands[0] = operands[3];
2433 if (GET_CODE (operands[1]) == CONST_INT
2434 && INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
2435 xoperands[1] = GEN_INT (-INTVAL (operands[2]) - 1);
2437 xoperands[1] = operands[2];
2439 output_asm_insn (output_move_simode (xoperands), xoperands);
2440 if (GET_CODE (operands[1]) == CONST_INT)
2442 if (INTVAL (operands[1]) > 0 && INTVAL (operands[1]) <= 8)
2443 return "subq%.l %1,%R0\;subx%.l %3,%0";
2444 else if (INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
2446 operands[1] = GEN_INT (-INTVAL (operands[1]));
2447 return "addq%.l %1,%R0\;addx%.l %3,%0";
2450 return "sub%.l %1,%R0\;subx%.l %3,%0";
2455 gcc_assert (GET_CODE (operands[0]) == MEM);
2456 if (GET_CODE (operands[2]) == MEM
2457 && GET_CODE (XEXP (operands[2], 0)) == PRE_DEC)
2458 return "sub%.l %2,%0\;subx%.l %2,%0";
2460 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
2463 = gen_rtx_MEM (SImode, plus_constant (XEXP (operands[0], 0), -8));
2464 return "move%.l %0,%3\;sub%.l %R2,%0\;subx%.l %2,%3\;move%.l %3,%1";
2466 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
2468 operands[1] = XEXP(operands[0], 0);
2469 return "sub%.l %R2,%0\;move%.l %0,%3\;subx%.l %2,%3\;move%.l %3,%1";
2473 operands[1] = adjust_address (operands[0], SImode, 4);
2474 return "sub%.l %R2,%1\;move%.l %0,%3\;subx%.l %2,%3\;move%.l %3,%0";
2479 (define_insn "subsi3"
2480 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,d,a")
2481 (minus:SI (match_operand:SI 1 "general_operand" "0,0,0")
2482 (match_operand:SI 2 "general_src_operand" "dT,mSrT,mSrs")))]
2487 [(set (match_operand:SI 0 "nonimmediate_operand" "=a")
2488 (minus:SI (match_operand:SI 1 "general_operand" "0")
2490 (match_operand:HI 2 "nonimmediate_src_operand" "rmS"))))]
2494 (define_insn "subhi3"
2495 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,r")
2496 (minus:HI (match_operand:HI 1 "general_operand" "0,0")
2497 (match_operand:HI 2 "general_src_operand" "dn,rmSn")))]
2502 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
2503 (minus:HI (match_dup 0)
2504 (match_operand:HI 1 "general_src_operand" "dn,rmSn")))]
2508 (define_insn "subqi3"
2509 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
2510 (minus:QI (match_operand:QI 1 "general_operand" "0,0")
2511 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
2516 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
2517 (minus:QI (match_dup 0)
2518 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
2522 (define_expand "sub<mode>3"
2523 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2524 (minus:FP (match_operand:FP 1 "general_operand" "")
2525 (match_operand:FP 2 "general_operand" "")))]
2529 (define_insn "sub<mode>3_floatsi_68881"
2530 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2531 (minus:FP (match_operand:FP 1 "general_operand" "0")
2532 (float:FP (match_operand:SI 2 "general_operand" "dmi"))))]
2534 "f<FP:round>sub%.l %2,%0")
2536 (define_insn "sub<mode>3_floathi_68881"
2537 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2538 (minus:FP (match_operand:FP 1 "general_operand" "0")
2539 (float:FP (match_operand:HI 2 "general_operand" "dmn"))))]
2541 "f<FP:round>sub%.w %2,%0")
2543 (define_insn "sub<mode>3_floatqi_68881"
2544 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2545 (minus:FP (match_operand:FP 1 "general_operand" "0")
2546 (float:FP (match_operand:QI 2 "general_operand" "dmn"))))]
2548 "f<FP:round>sub%.b %2,%0")
2550 (define_insn "sub<mode>3_68881"
2551 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2552 (minus:FP (match_operand:FP 1 "general_operand" "0")
2553 (match_operand:FP 2 "general_operand" "f<FP:dreg>m<FP:const>")))]
2556 if (FP_REG_P (operands[2]))
2557 return "f<FP:round>sub%.x %2,%0";
2558 return "f<FP:round>sub%.<FP:prec> %f2,%0";
2561 (define_insn "sub<mode>3_cf"
2562 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2563 (minus:FP (match_operand:FP 1 "general_operand" "0")
2564 (match_operand:FP 2 "general_operand" "f<FP:dreg><Q>U")))]
2565 "TARGET_COLDFIRE_FPU"
2567 if (FP_REG_P (operands[2]))
2568 return "f<FP:round>sub%.d %2,%0";
2569 return "f<FP:round>sub%.<FP:prec> %2,%0";
2572 ;; multiply instructions
2574 (define_insn "mulhi3"
2575 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
2576 (mult:HI (match_operand:HI 1 "general_operand" "%0")
2577 (match_operand:HI 2 "general_src_operand" "dmSn")))]
2580 return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0";
2583 (define_insn "mulhisi3"
2584 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2585 (mult:SI (sign_extend:SI
2586 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2588 (match_operand:HI 2 "nonimmediate_src_operand" "dmS"))))]
2591 return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0";
2595 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2596 (mult:SI (sign_extend:SI
2597 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2598 (match_operand:SI 2 "const_int_operand" "n")))]
2599 "INTVAL (operands[2]) >= -0x8000 && INTVAL (operands[2]) <= 0x7fff"
2601 return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0";
2604 (define_expand "mulsi3"
2605 [(set (match_operand:SI 0 "nonimmediate_operand" "")
2606 (mult:SI (match_operand:SI 1 "general_operand" "")
2607 (match_operand:SI 2 "general_operand" "")))]
2608 "TARGET_68020 || TARGET_COLDFIRE"
2612 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2613 (mult:SI (match_operand:SI 1 "general_operand" "%0")
2614 (match_operand:SI 2 "general_src_operand" "dmSTK")))]
2620 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2621 (mult:SI (match_operand:SI 1 "general_operand" "%0")
2622 (match_operand:SI 2 "general_operand" "d<Q>")))]
2626 (define_insn "umulhisi3"
2627 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2628 (mult:SI (zero_extend:SI
2629 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2631 (match_operand:HI 2 "nonimmediate_src_operand" "dmS"))))]
2634 return MOTOROLA ? "mulu%.w %2,%0" : "mulu %2,%0";
2638 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2639 (mult:SI (zero_extend:SI
2640 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2641 (match_operand:SI 2 "const_int_operand" "n")))]
2642 "INTVAL (operands[2]) >= 0 && INTVAL (operands[2]) <= 0xffff"
2644 return MOTOROLA ? "mulu%.w %2,%0" : "mulu %2,%0";
2647 ;; We need a separate DEFINE_EXPAND for u?mulsidi3 to be able to use the
2648 ;; proper matching constraint. This is because the matching is between
2649 ;; the high-numbered word of the DImode operand[0] and operand[1].
2650 (define_expand "umulsidi3"
2652 [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 4)
2653 (mult:SI (match_operand:SI 1 "register_operand" "")
2654 (match_operand:SI 2 "register_operand" "")))
2655 (set (subreg:SI (match_dup 0) 0)
2656 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
2657 (zero_extend:DI (match_dup 2)))
2658 (const_int 32))))])]
2659 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2663 [(set (match_operand:SI 0 "register_operand" "=d")
2664 (mult:SI (match_operand:SI 1 "register_operand" "%0")
2665 (match_operand:SI 2 "nonimmediate_operand" "dm")))
2666 (set (match_operand:SI 3 "register_operand" "=d")
2667 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
2668 (zero_extend:DI (match_dup 2)))
2670 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2673 ; Match immediate case. For 2.4 only match things < 2^31.
2674 ; It's tricky with larger values in these patterns since we need to match
2675 ; values between the two parallel multiplies, between a CONST_DOUBLE and
2678 [(set (match_operand:SI 0 "register_operand" "=d")
2679 (mult:SI (match_operand:SI 1 "register_operand" "%0")
2680 (match_operand:SI 2 "const_int_operand" "n")))
2681 (set (match_operand:SI 3 "register_operand" "=d")
2682 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
2685 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE
2686 && (unsigned) INTVAL (operands[2]) <= 0x7fffffff"
2689 (define_expand "mulsidi3"
2691 [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 4)
2692 (mult:SI (match_operand:SI 1 "register_operand" "")
2693 (match_operand:SI 2 "register_operand" "")))
2694 (set (subreg:SI (match_dup 0) 0)
2695 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
2696 (sign_extend:DI (match_dup 2)))
2697 (const_int 32))))])]
2698 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2702 [(set (match_operand:SI 0 "register_operand" "=d")
2703 (mult:SI (match_operand:SI 1 "register_operand" "%0")
2704 (match_operand:SI 2 "nonimmediate_operand" "dm")))
2705 (set (match_operand:SI 3 "register_operand" "=d")
2706 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
2707 (sign_extend:DI (match_dup 2)))
2709 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2713 [(set (match_operand:SI 0 "register_operand" "=d")
2714 (mult:SI (match_operand:SI 1 "register_operand" "%0")
2715 (match_operand:SI 2 "const_int_operand" "n")))
2716 (set (match_operand:SI 3 "register_operand" "=d")
2717 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
2720 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2723 (define_expand "umulsi3_highpart"
2725 [(set (match_operand:SI 0 "register_operand" "")
2728 (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" ""))
2729 (zero_extend:DI (match_operand:SI 2 "general_operand" "")))
2731 (clobber (match_dup 3))])]
2732 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2734 operands[3] = gen_reg_rtx (SImode);
2736 if (GET_CODE (operands[2]) == CONST_INT)
2738 operands[2] = immed_double_const (INTVAL (operands[2]) & 0xffffffff,
2741 /* We have to adjust the operand order for the matching constraints. */
2742 emit_insn (gen_const_umulsi3_highpart (operands[0], operands[3],
2743 operands[1], operands[2]));
2749 [(set (match_operand:SI 0 "register_operand" "=d")
2752 (mult:DI (zero_extend:DI (match_operand:SI 2 "register_operand" "%1"))
2753 (zero_extend:DI (match_operand:SI 3 "nonimmediate_operand" "dm")))
2755 (clobber (match_operand:SI 1 "register_operand" "=d"))]
2756 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2759 (define_insn "const_umulsi3_highpart"
2760 [(set (match_operand:SI 0 "register_operand" "=d")
2763 (mult:DI (zero_extend:DI (match_operand:SI 2 "register_operand" "1"))
2764 (match_operand:DI 3 "const_uint32_operand" "n"))
2766 (clobber (match_operand:SI 1 "register_operand" "=d"))]
2767 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2770 (define_expand "smulsi3_highpart"
2772 [(set (match_operand:SI 0 "register_operand" "")
2775 (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" ""))
2776 (sign_extend:DI (match_operand:SI 2 "general_operand" "")))
2778 (clobber (match_dup 3))])]
2779 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2781 operands[3] = gen_reg_rtx (SImode);
2782 if (GET_CODE (operands[2]) == CONST_INT)
2784 /* We have to adjust the operand order for the matching constraints. */
2785 emit_insn (gen_const_smulsi3_highpart (operands[0], operands[3],
2786 operands[1], operands[2]));
2792 [(set (match_operand:SI 0 "register_operand" "=d")
2795 (mult:DI (sign_extend:DI (match_operand:SI 2 "register_operand" "%1"))
2796 (sign_extend:DI (match_operand:SI 3 "nonimmediate_operand" "dm")))
2798 (clobber (match_operand:SI 1 "register_operand" "=d"))]
2799 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2802 (define_insn "const_smulsi3_highpart"
2803 [(set (match_operand:SI 0 "register_operand" "=d")
2806 (mult:DI (sign_extend:DI (match_operand:SI 2 "register_operand" "1"))
2807 (match_operand:DI 3 "const_sint32_operand" "n"))
2809 (clobber (match_operand:SI 1 "register_operand" "=d"))]
2810 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
2813 (define_expand "mul<mode>3"
2814 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2815 (mult:FP (match_operand:FP 1 "general_operand" "")
2816 (match_operand:FP 2 "general_operand" "")))]
2820 (define_insn "mul<mode>3_floatsi_68881"
2821 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2822 (mult:FP (float:FP (match_operand:SI 2 "general_operand" "dmi"))
2823 (match_operand:FP 1 "general_operand" "0")))]
2827 ? "f<FP:round>mul%.l %2,%0"
2828 : "f<FP:round_mul>mul%.l %2,%0";
2831 (define_insn "mul<mode>3_floathi_68881"
2832 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2833 (mult:FP (float:FP (match_operand:HI 2 "general_operand" "dmn"))
2834 (match_operand:FP 1 "general_operand" "0")))]
2838 ? "f<FP:round>mul%.w %2,%0"
2839 : "f<FP:round_mul>mul%.w %2,%0";
2842 (define_insn "mul<mode>3_floatqi_68881"
2843 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2844 (mult:FP (float:FP (match_operand:QI 2 "general_operand" "dmn"))
2845 (match_operand:FP 1 "general_operand" "0")))]
2849 ? "f<FP:round>mul%.b %2,%0"
2850 : "f<FP:round_mul>mul%.b %2,%0";
2853 (define_insn "muldf_68881"
2854 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
2855 (mult:DF (match_operand:DF 1 "general_operand" "%0")
2856 (match_operand:DF 2 "general_operand" "fmG")))]
2859 if (GET_CODE (operands[2]) == CONST_DOUBLE
2860 && floating_exact_log2 (operands[2]) && !TUNE_68040_60)
2862 int i = floating_exact_log2 (operands[2]);
2863 operands[2] = GEN_INT (i);
2864 return "fscale%.l %2,%0";
2866 if (REG_P (operands[2]))
2867 return "f%&mul%.x %2,%0";
2868 return "f%&mul%.d %f2,%0";
2871 (define_insn "mulsf_68881"
2872 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
2873 (mult:SF (match_operand:SF 1 "general_operand" "%0")
2874 (match_operand:SF 2 "general_operand" "fdmF")))]
2877 if (FP_REG_P (operands[2]))
2878 return (TARGET_68040
2880 : "fsglmul%.x %2,%0");
2881 return (TARGET_68040
2883 : "fsglmul%.s %f2,%0");
2886 (define_insn "mulxf3_68881"
2887 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
2888 (mult:XF (match_operand:XF 1 "nonimmediate_operand" "%0")
2889 (match_operand:XF 2 "nonimmediate_operand" "fm")))]
2892 return "fmul%.x %f2,%0";
2895 (define_insn "fmul<mode>3_cf"
2896 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2897 (mult:FP (match_operand:FP 1 "general_operand" "%0")
2898 (match_operand:FP 2 "general_operand" "f<Q>U<FP:dreg>")))]
2899 "TARGET_COLDFIRE_FPU"
2901 if (FP_REG_P (operands[2]))
2902 return "f<FP:prec>mul%.d %2,%0";
2903 return "f<FP:prec>mul%.<FP:prec> %2,%0";
2906 ;; divide instructions
2908 (define_expand "div<mode>3"
2909 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2910 (div:FP (match_operand:FP 1 "general_operand" "")
2911 (match_operand:FP 2 "general_operand" "")))]
2915 (define_insn "div<mode>3_floatsi_68881"
2916 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2917 (div:FP (match_operand:FP 1 "general_operand" "0")
2918 (float:FP (match_operand:SI 2 "general_operand" "dmi"))))]
2922 ? "f<FP:round>div%.l %2,%0"
2923 : "f<FP:round_mul>div%.l %2,%0";
2926 (define_insn "div<mode>3_floathi_68881"
2927 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2928 (div:FP (match_operand:FP 1 "general_operand" "0")
2929 (float:FP (match_operand:HI 2 "general_operand" "dmn"))))]
2933 ? "f<FP:round>div%.w %2,%0"
2934 : "f<FP:round_mul>div%.w %2,%0";
2937 (define_insn "div<mode>3_floatqi_68881"
2938 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2939 (div:FP (match_operand:FP 1 "general_operand" "0")
2940 (float:FP (match_operand:QI 2 "general_operand" "dmn"))))]
2944 ? "f<FP:round>div%.b %2,%0"
2945 : "f<FP:round_mul>div%.b %2,%0";
2948 (define_insn "div<mode>3_68881"
2949 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2950 (div:FP (match_operand:FP 1 "general_operand" "0")
2951 (match_operand:FP 2 "general_operand" "f<FP:dreg>m<FP:const>")))]
2954 if (FP_REG_P (operands[2]))
2955 return (TARGET_68040
2956 ? "f<FP:round>div%.x %2,%0"
2957 : "f<FP:round_mul>div%.x %2,%0");
2958 return (TARGET_68040
2959 ? "f<FP:round>div%.<FP:prec> %f2,%0"
2960 : "f<FP:round_mul>div%.<FP:prec> %f2,%0");
2963 (define_insn "div<mode>3_cf"
2964 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2965 (div:FP (match_operand:FP 1 "general_operand" "0")
2966 (match_operand:FP 2 "general_operand" "f<Q>U<FP:dreg>")))]
2967 "TARGET_COLDFIRE_FPU"
2969 if (FP_REG_P (operands[2]))
2970 return "f<FP:prec>div%.d %2,%0";
2971 return "f<FP:prec>div%.<FP:prec> %2,%0";
2974 ;; Remainder instructions.
2976 (define_expand "divmodsi4"
2978 [(set (match_operand:SI 0 "nonimmediate_operand" "")
2979 (div:SI (match_operand:SI 1 "general_operand" "")
2980 (match_operand:SI 2 "general_src_operand" "")))
2981 (set (match_operand:SI 3 "nonimmediate_operand" "")
2982 (mod:SI (match_dup 1) (match_dup 2)))])]
2983 "TARGET_68020 || TARGET_CF_HWDIV"
2987 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2988 (div:SI (match_operand:SI 1 "general_operand" "0")
2989 (match_operand:SI 2 "general_src_operand" "d<Q>U")))
2990 (set (match_operand:SI 3 "nonimmediate_operand" "=&d")
2991 (mod:SI (match_dup 1) (match_dup 2)))]
2994 if (find_reg_note (insn, REG_UNUSED, operands[3]))
2995 return "divs%.l %2,%0";
2996 else if (find_reg_note (insn, REG_UNUSED, operands[0]))
2997 return "rems%.l %2,%3:%0";
2999 return "rems%.l %2,%3:%0\;divs%.l %2,%0";
3003 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3004 (div:SI (match_operand:SI 1 "general_operand" "0")
3005 (match_operand:SI 2 "general_src_operand" "dmSTK")))
3006 (set (match_operand:SI 3 "nonimmediate_operand" "=d")
3007 (mod:SI (match_dup 1) (match_dup 2)))]
3010 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3011 return "divs%.l %2,%0";
3013 return "divsl%.l %2,%3:%0";
3016 (define_expand "udivmodsi4"
3018 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3019 (udiv:SI (match_operand:SI 1 "general_operand" "0")
3020 (match_operand:SI 2 "general_src_operand" "dmSTK")))
3021 (set (match_operand:SI 3 "nonimmediate_operand" "=d")
3022 (umod:SI (match_dup 1) (match_dup 2)))])]
3023 "TARGET_68020 || TARGET_CF_HWDIV"
3027 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3028 (udiv:SI (match_operand:SI 1 "general_operand" "0")
3029 (match_operand:SI 2 "general_src_operand" "d<Q>U")))
3030 (set (match_operand:SI 3 "nonimmediate_operand" "=&d")
3031 (umod:SI (match_dup 1) (match_dup 2)))]
3034 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3035 return "divu%.l %2,%0";
3036 else if (find_reg_note (insn, REG_UNUSED, operands[0]))
3037 return "remu%.l %2,%3:%0";
3039 return "remu%.l %2,%3:%0\;divu%.l %2,%0";
3043 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3044 (udiv:SI (match_operand:SI 1 "general_operand" "0")
3045 (match_operand:SI 2 "general_src_operand" "dmSTK")))
3046 (set (match_operand:SI 3 "nonimmediate_operand" "=d")
3047 (umod:SI (match_dup 1) (match_dup 2)))]
3048 "TARGET_68020 && !TARGET_COLDFIRE"
3050 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3051 return "divu%.l %2,%0";
3053 return "divul%.l %2,%3:%0";
3056 (define_insn "divmodhi4"
3057 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
3058 (div:HI (match_operand:HI 1 "general_operand" "0")
3059 (match_operand:HI 2 "general_src_operand" "dmSKT")))
3060 (set (match_operand:HI 3 "nonimmediate_operand" "=d")
3061 (mod:HI (match_dup 1) (match_dup 2)))]
3062 "!TARGET_COLDFIRE || TARGET_CF_HWDIV"
3064 output_asm_insn (MOTOROLA ?
3065 "ext%.l %0\;divs%.w %2,%0" :
3066 "extl %0\;divs %2,%0",
3068 if (!find_reg_note(insn, REG_UNUSED, operands[3]))
3071 return "move%.l %0,%3\;swap %3";
3077 (define_insn "udivmodhi4"
3078 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
3079 (udiv:HI (match_operand:HI 1 "general_operand" "0")
3080 (match_operand:HI 2 "general_src_operand" "dmSKT")))
3081 (set (match_operand:HI 3 "nonimmediate_operand" "=d")
3082 (umod:HI (match_dup 1) (match_dup 2)))]
3083 "!TARGET_COLDFIRE || TARGET_CF_HWDIV"
3086 output_asm_insn (MOTOROLA ?
3087 "mvz%.w %0,%0\;divu%.w %2,%0" :
3088 "mvz%.w %0,%0\;divu %2,%0",
3091 output_asm_insn (MOTOROLA ?
3092 "and%.l #0xFFFF,%0\;divu%.w %2,%0" :
3093 "and%.l #0xFFFF,%0\;divu %2,%0",
3096 if (!find_reg_note(insn, REG_UNUSED, operands[3]))
3099 return "move%.l %0,%3\;swap %3";
3105 ;; logical-and instructions
3107 ;; "anddi3" is mainly here to help combine().
3108 (define_insn "anddi3"
3109 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,d")
3110 (and:DI (match_operand:DI 1 "general_operand" "%0,0")
3111 (match_operand:DI 2 "general_operand" "dn,don")))]
3115 /* We can get CONST_DOUBLE, but also const1_rtx etc. */
3116 if (CONSTANT_P (operands[2]))
3120 split_double (operands[2], &hi, &lo);
3122 switch (INTVAL (hi))
3125 output_asm_insn ("clr%.l %0", operands);
3133 xoperands[0] = operands[0];
3135 output_asm_insn (output_andsi3 (xoperands), xoperands);
3138 if (GET_CODE (operands[0]) == REG)
3139 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3141 operands[0] = adjust_address (operands[0], SImode, 4);
3142 switch (INTVAL (lo))
3145 output_asm_insn ("clr%.l %0", operands);
3153 xoperands[0] = operands[0];
3155 output_asm_insn (output_andsi3 (xoperands), xoperands);
3160 if (GET_CODE (operands[0]) != REG)
3162 operands[1] = adjust_address (operands[0], SImode, 4);
3163 return "and%.l %2,%0\;and%.l %R2,%1";
3165 if (GET_CODE (operands[2]) != REG)
3167 operands[1] = adjust_address (operands[2], SImode, 4);
3168 return "and%.l %2,%0\;and%.l %1,%R0";
3170 return "and%.l %2,%0\;and%.l %R2,%R0";
3173 ;; Prevent AND from being made with sp. This doesn't exist in the machine
3174 ;; and reload will cause inefficient code. Since sp is a FIXED_REG, we
3175 ;; can't allocate pseudos into it.
3177 (define_expand "andsi3"
3178 [(set (match_operand:SI 0 "not_sp_operand" "")
3179 (and:SI (match_operand:SI 1 "general_operand" "")
3180 (match_operand:SI 2 "general_src_operand" "")))]
3184 ;; produced by split operations after reload finished
3185 (define_insn "*andsi3_split"
3186 [(set (match_operand:SI 0 "register_operand" "=d")
3187 (and:SI (match_operand:SI 1 "register_operand" "0")
3188 (match_operand:SI 2 "const_int_operand" "i")))]
3189 "reload_completed && !TARGET_COLDFIRE"
3191 return output_andsi3 (operands);
3194 (define_insn "andsi3_internal"
3195 [(set (match_operand:SI 0 "not_sp_operand" "=m,d")
3196 (and:SI (match_operand:SI 1 "general_operand" "%0,0")
3197 (match_operand:SI 2 "general_src_operand" "dKT,dmSM")))]
3200 return output_andsi3 (operands);
3203 (define_insn "andsi3_5200"
3204 [(set (match_operand:SI 0 "not_sp_operand" "=m,d")
3205 (and:SI (match_operand:SI 1 "general_operand" "%0,0")
3206 (match_operand:SI 2 "general_src_operand" "d,dmsK")))]
3210 && DATA_REG_P (operands[0])
3211 && GET_CODE (operands[2]) == CONST_INT)
3213 if (INTVAL (operands[2]) == 0x000000ff)
3214 return "mvz%.b %0,%0";
3215 else if (INTVAL (operands[2]) == 0x0000ffff)
3216 return "mvz%.w %0,%0";
3218 return output_andsi3 (operands);
3221 (define_insn "andhi3"
3222 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,d")
3223 (and:HI (match_operand:HI 1 "general_operand" "%0,0")
3224 (match_operand:HI 2 "general_src_operand" "dn,dmSn")))]
3229 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3230 (and:HI (match_dup 0)
3231 (match_operand:HI 1 "general_src_operand" "dn,dmSn")))]
3236 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3237 (and:HI (match_operand:HI 1 "general_src_operand" "dn,dmSn")
3242 (define_insn "andqi3"
3243 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
3244 (and:QI (match_operand:QI 1 "general_operand" "%0,0")
3245 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
3250 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3251 (and:QI (match_dup 0)
3252 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
3257 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3258 (and:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn")
3263 ;; inclusive-or instructions
3265 (define_insn "iordi_zext"
3266 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,d")
3267 (ior:DI (zero_extend:DI (match_operand 1 "general_operand" "dn,dmn"))
3268 (match_operand:DI 2 "general_operand" "0,0")))]
3274 if (GET_CODE (operands[0]) == REG)
3275 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3277 operands[0] = adjust_address (operands[0], SImode, 4);
3278 if (GET_MODE (operands[1]) == SImode)
3279 return "or%.l %1,%0";
3280 byte_mode = (GET_MODE (operands[1]) == QImode);
3281 if (GET_CODE (operands[0]) == MEM)
3282 operands[0] = adjust_address (operands[0], byte_mode ? QImode : HImode,
3285 return "or%.b %1,%0";
3287 return "or%.w %1,%0";
3290 ;; "iordi3" is mainly here to help combine().
3291 (define_insn "iordi3"
3292 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,d")
3293 (ior:DI (match_operand:DI 1 "general_operand" "%0,0")
3294 (match_operand:DI 2 "general_operand" "dn,don")))]
3298 /* We can get CONST_DOUBLE, but also const1_rtx etc. */
3299 if (CONSTANT_P (operands[2]))
3303 split_double (operands[2], &hi, &lo);
3305 switch (INTVAL (hi))
3310 /* FIXME : a scratch register would be welcome here if operand[0]
3311 is not a register */
3312 output_asm_insn ("move%.l #-1,%0", operands);
3318 xoperands[0] = operands[0];
3320 output_asm_insn (output_iorsi3 (xoperands), xoperands);
3323 if (GET_CODE (operands[0]) == REG)
3324 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3326 operands[0] = adjust_address (operands[0], SImode, 4);
3327 switch (INTVAL (lo))
3332 /* FIXME : a scratch register would be welcome here if operand[0]
3333 is not a register */
3334 output_asm_insn ("move%.l #-1,%0", operands);
3340 xoperands[0] = operands[0];
3342 output_asm_insn (output_iorsi3 (xoperands), xoperands);
3347 if (GET_CODE (operands[0]) != REG)
3349 operands[1] = adjust_address (operands[0], SImode, 4);
3350 return "or%.l %2,%0\;or%.l %R2,%1";
3352 if (GET_CODE (operands[2]) != REG)
3354 operands[1] = adjust_address (operands[2], SImode, 4);
3355 return "or%.l %2,%0\;or%.l %1,%R0";
3357 return "or%.l %2,%0\;or%.l %R2,%R0";
3360 (define_expand "iorsi3"
3361 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3362 (ior:SI (match_operand:SI 1 "general_operand" "")
3363 (match_operand:SI 2 "general_src_operand" "")))]
3367 (define_insn "iorsi3_internal"
3368 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,d")
3369 (ior:SI (match_operand:SI 1 "general_operand" "%0,0")
3370 (match_operand:SI 2 "general_src_operand" "dKT,dmSMT")))]
3373 return output_iorsi3 (operands);
3376 (define_insn "iorsi3_5200"
3377 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,d")
3378 (ior:SI (match_operand:SI 1 "general_operand" "%0,0")
3379 (match_operand:SI 2 "general_src_operand" "d,dmsK")))]
3382 return output_iorsi3 (operands);
3385 (define_insn "iorhi3"
3386 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,d")
3387 (ior:HI (match_operand:HI 1 "general_operand" "%0,0")
3388 (match_operand:HI 2 "general_src_operand" "dn,dmSn")))]
3393 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3394 (ior:HI (match_dup 0)
3395 (match_operand:HI 1 "general_src_operand" "dn,dmSn")))]
3400 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3401 (ior:HI (match_operand:HI 1 "general_src_operand" "dn,dmSn")
3406 (define_insn "iorqi3"
3407 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
3408 (ior:QI (match_operand:QI 1 "general_operand" "%0,0")
3409 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
3414 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3415 (ior:QI (match_dup 0)
3416 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
3421 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3422 (ior:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn")
3427 ;; On all 68k models, this makes faster code in a special case.
3428 ;; See also ashlsi_16, ashrsi_16 and lshrsi_16.
3430 (define_insn "iorsi_zexthi_ashl16"
3431 [(set (match_operand:SI 0 "nonimmediate_operand" "=&d")
3432 (ior:SI (zero_extend:SI (match_operand:HI 1 "general_operand" "rmn"))
3433 (ashift:SI (match_operand:SI 2 "general_operand" "or")
3438 if (GET_CODE (operands[2]) != REG)
3439 operands[2] = adjust_address (operands[2], HImode, 2);
3440 if (GET_CODE (operands[2]) != REG
3441 || REGNO (operands[2]) != REGNO (operands[0]))
3442 output_asm_insn ("move%.w %2,%0", operands);
3443 return "swap %0\;mov%.w %1,%0";
3446 (define_insn "iorsi_zext"
3447 [(set (match_operand:SI 0 "nonimmediate_operand" "=o,d")
3448 (ior:SI (zero_extend:SI (match_operand 1 "general_operand" "dn,dmn"))
3449 (match_operand:SI 2 "general_operand" "0,0")))]