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, 2007, 2008
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 3, 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 COPYING3. If not see
20 ;; <http://www.gnu.org/licenses/>.
22 ;;- Information about MCF5200 port.
24 ;;- The MCF5200 "ColdFire" architecture is a reduced version of the
25 ;;- 68k ISA. Differences include reduced support for byte and word
26 ;;- operands and the removal of BCD, bitfield, rotate, and integer
27 ;;- divide instructions. The TARGET_COLDFIRE flag turns the use of the
28 ;;- removed opcodes and addressing modes off.
32 ;;- instruction definitions
34 ;;- @@The original PO technology requires these to be ordered by speed,
35 ;;- @@ so that assigner will pick the fastest.
37 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
39 ;;- When naming insn's (operand 0 of define_insn) be careful about using
40 ;;- names from other targets machine descriptions.
42 ;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
43 ;;- updates for most instructions.
45 ;;- Operand classes for the register allocator:
46 ;;- 'a' one of the address registers can be used.
47 ;;- 'd' one of the data registers can be used.
48 ;;- 'f' one of the m68881/fpu registers can be used
49 ;;- 'r' either a data or an address register can be used.
51 ;;- Immediate Floating point operator constraints
52 ;;- 'G' a floating point constant that is *NOT* one of the standard
53 ;; 68881 constant values (to force calling output_move_const_double
54 ;; to get it from rom if it is a 68881 constant).
56 ;; See the functions standard_XXX_constant_p in output-m68k.c for more
59 ;;- Immediate integer operand constraints:
61 ;;- 'J' -32768 .. 32767
62 ;;- 'K' all integers EXCEPT -128 .. 127
64 ;;- 'M' all integers EXCEPT -256 .. 255
70 ;;- "%." size separator ("." or "") move%.l d0,d1
71 ;;- "%-" push operand "sp@-" move%.l d0,%-
72 ;;- "%+" pop operand "sp@+" move%.l d0,%+
73 ;;- "%@" top of stack "sp@" move%.l d0,%@
74 ;;- "%!" fpcr register
75 ;;- "%$" single-precision fp specifier ("s" or "") f%$add.x fp0,fp1
76 ;;- "%&" double-precision fp specifier ("d" or "") f%&add.x fp0,fp1
78 ;;- Information about 68040 port.
80 ;;- The 68040 executes all 68030 and 68881/2 instructions, but some must
81 ;;- be emulated in software by the OS. It is faster to avoid these
82 ;;- instructions and issue a library call rather than trapping into
83 ;;- the kernel. The affected instructions are fintrz and fscale. The
84 ;;- TUNE_68040 flag turns the use of the opcodes off.
86 ;;- The '040 also implements a set of new floating-point instructions
87 ;;- which specify the rounding precision in the opcode. This finally
88 ;;- permit the 68k series to be truly IEEE compliant, and solves all
89 ;;- issues of excess precision accumulating in the extended registers.
90 ;;- By default, GCC does not use these instructions, since such code will
91 ;;- not run on an '030. To use these instructions, use the -m68040-only
94 ;;- These new instructions aren't directly in the md. They are brought
95 ;;- into play by defining "%$" and "%&" to expand to "s" and "d" rather
98 ;;- Information about 68060 port.
100 ;;- The 68060 executes all 68030 and 68881/2 instructions, but some must
101 ;;- be emulated in software by the OS. It is faster to avoid these
102 ;;- instructions and issue a library call rather than trapping into
103 ;;- the kernel. The affected instructions are: divs.l <ea>,Dr:Dq;
104 ;;- divu.l <ea>,Dr:Dq; muls.l <ea>,Dr:Dq; mulu.l <ea>,Dr:Dq; and
105 ;;- fscale. The TUNE_68060 flag turns the use of the opcodes off.
107 ;;- Some of these insn's are composites of several m68000 op codes.
108 ;;- The assembler (or final @@??) insures that the appropriate one is
122 ;; UNSPEC_VOLATILE usage:
125 [(UNSPECV_BLOCKAGE 0)
128 ;; Registers by name.
139 (include "predicates.md")
140 (include "constraints.md")
142 ;; ::::::::::::::::::::
146 ;; ::::::::::::::::::::
149 (define_attr "cpu" "cfv1, cfv2, cfv3, cfv4, unknown"
150 (const (symbol_ref "m68k_sched_cpu")))
153 (define_attr "mac" "no, cf_mac, cf_emac"
154 (const (symbol_ref "m68k_sched_mac")))
156 ;; Instruction type for use in scheduling description.
157 ;; _l and _w suffixes indicate size of the operands of instruction.
158 ;; alu - usual arithmetic or logic instruction.
159 ;; aluq - arithmetic or logic instruction which has a quick immediate (the one
160 ;; that is encoded in the instruction word) for its Y operand.
161 ;; alux - Arithmetic instruction that uses carry bit (e.g., addx and subx).
162 ;; bcc - conditional branch.
163 ;; bitr - bit operation that only updates flags.
164 ;; bitrw - bit operation that updates flags and output operand.
165 ;; bra, bsr, clr, cmp, div, ext - corresponding instruction.
166 ;; falu, fbcc, fcmp, fdiv, fmove, fmul, fneg, fsqrt, ftst - corresponding
168 ;; ib - fake instruction to subscribe slots in ColdFire V1,V2,V3 instruction
170 ;; ignore - fake instruction.
171 ;; jmp, jsr, lea, link, mov3q, move, moveq, mul - corresponding instruction.
172 ;; mvsz - mvs or mvz instruction.
173 ;; neg, nop, pea, rts, scc - corresponding instruction.
174 ;; shift - arithmetic or logical shift instruction.
175 ;; trap, tst, unlk - corresponding instruction.
177 "alu_l,aluq_l,alux_l,bcc,bitr,bitrw,bra,bsr,clr,clr_l,cmp,cmp_l,
179 falu,fbcc,fcmp,fdiv,fmove,fmul,fneg,fsqrt,ftst,
181 jmp,jsr,lea,link,mov3q_l,move,move_l,moveq_l,mul_w,mul_l,mvsz,neg_l,nop,
185 (const_string "unknown"))
187 ;; Index of the X or Y operand in recog_data.operand[].
188 ;; Should be used only within opx_type and opy_type.
189 (define_attr "opx" "" (const_int 0))
190 (define_attr "opy" "" (const_int 1))
192 ;; Type of the Y operand.
193 ;; See m68k.c: enum attr_op_type.
194 (define_attr "opy_type"
195 "none,Rn,FPn,mem1,mem234,mem5,mem6,mem7,imm_q,imm_w,imm_l"
196 (cond [(eq_attr "type" "ext,fbcc,ftst,neg_l,bcc,bra,bsr,clr,clr_l,ib,ignore,
197 jmp,jsr,nop,rts,scc,trap,tst,tst_l,
198 unlk,unknown") (const_string "none")
199 (eq_attr "type" "lea,pea")
200 (symbol_ref "m68k_sched_attr_opy_type (insn, 1)")]
201 (symbol_ref "m68k_sched_attr_opy_type (insn, 0)")))
203 ;; Type of the X operand.
204 ;; See m68k.c: enum attr_op_type.
205 (define_attr "opx_type"
206 "none,Rn,FPn,mem1,mem234,mem5,mem6,mem7,imm_q,imm_w,imm_l"
207 (cond [(eq_attr "type" "ib,ignore,nop,rts,trap,unlk,
208 unknown") (const_string "none")
209 (eq_attr "type" "pea") (const_string "mem1")
210 (eq_attr "type" "jmp,jsr")
211 (symbol_ref "m68k_sched_attr_opx_type (insn, 1)")]
212 (symbol_ref "m68k_sched_attr_opx_type (insn, 0)")))
214 ;; Access to the X operand: none, read, write, read/write, unknown.
215 ;; Access to the Y operand is either none (if opy_type is none)
216 ;; or read otherwise.
217 (define_attr "opx_access" "none, r, w, rw"
218 (cond [(eq_attr "type" "ib,ignore,nop,rts,trap,unlk,
219 unknown") (const_string "none")
220 (eq_attr "type" "bcc,bra,bsr,bitr,cmp,cmp_l,fbcc,fcmp,ftst,
221 jmp,jsr,tst,tst_l") (const_string "r")
222 (eq_attr "type" "clr,clr_l,fneg,fmove,lea,
223 mov3q_l,move,move_l,moveq_l,mvsz,
224 pea,scc") (const_string "w")
225 (eq_attr "type" "alu_l,aluq_l,alux_l,bitrw,div_w,div_l,ext,
226 falu,fdiv,fmul,fsqrt,link,mul_w,mul_l,
227 neg_l,shift") (const_string "rw")]
228 ;; Should never be used.
229 (symbol_ref "(gcc_unreachable (), OPX_ACCESS_NONE)")))
231 ;; Memory accesses of the insn.
232 ;; 00 - no memory references
233 ;; 10 - memory is read
234 ;; i0 - indexed memory is read
235 ;; 01 - memory is written
236 ;; 0i - indexed memory is written
237 ;; 11 - memory is read, memory is written
238 ;; i1 - indexed memory is read, memory is written
239 ;; 1i - memory is read, indexed memory is written
240 (define_attr "op_mem" "00, 10, i0, 01, 0i, 11, i1, 1i"
241 (symbol_ref "m68k_sched_attr_op_mem (insn)"))
243 ;; Instruction size in words.
244 (define_attr "size" "1,2,3"
245 (symbol_ref "m68k_sched_attr_size (insn)"))
247 ;; Alternative is OK for ColdFire.
248 (define_attr "ok_for_coldfire" "yes,no" (const_string "yes"))
250 ;; Define 'enabled' attribute.
251 (define_attr "enabled" ""
252 (cond [(and (ne (symbol_ref "TARGET_COLDFIRE") (const_int 0))
253 (eq_attr "ok_for_coldfire" "no"))
257 ;; Mode macros for floating point operations.
258 ;; Valid floating point modes
259 (define_mode_iterator FP [SF DF (XF "TARGET_68881")])
260 ;; Mnemonic infix to round result
261 (define_mode_attr round [(SF "%$") (DF "%&") (XF "")])
262 ;; Mnemonic infix to round result for mul or div instruction
263 (define_mode_attr round_mul [(SF "sgl") (DF "%&") (XF "")])
264 ;; Suffix specifying source operand format
265 (define_mode_attr prec [(SF "s") (DF "d") (XF "x")])
266 ;; Allowable D registers
267 (define_mode_attr dreg [(SF "d") (DF "") (XF "")])
268 ;; Allowable 68881 constant constraints
269 (define_mode_attr const [(SF "F") (DF "G") (XF "")])
272 (define_insn_and_split "*movdf_internal"
273 [(set (match_operand:DF 0 "push_operand" "=m, m")
274 (match_operand:DF 1 "general_operand" "f, ro<>E"))]
279 "&& reload_completed && (extract_constrain_insn_cached (insn), which_alternative == 1)"
282 m68k_emit_move_double (operands);
285 [(set_attr "type" "fmove,*")])
287 (define_insn_and_split "pushdi"
288 [(set (match_operand:DI 0 "push_operand" "=m")
289 (match_operand:DI 1 "general_operand" "ro<>Fi"))]
292 "&& reload_completed"
295 m68k_emit_move_double (operands);
299 ;; We don't want to allow a constant operand for test insns because
300 ;; (set (cc0) (const_int foo)) has no mode information. Such insns will
301 ;; be folded while optimizing anyway.
305 (compare (match_operand:DI 0 "nonimmediate_operand" "am,d")
307 (clobber (match_scratch:SI 1 "=X,d"))
308 (clobber (match_scratch:DI 2 "=d,X"))]
311 if (which_alternative == 0)
315 xoperands[0] = operands[2];
316 xoperands[1] = operands[0];
317 output_move_double (xoperands);
318 cc_status.flags |= CC_REVERSED; /*|*/
319 return "neg%.l %R2\;negx%.l %2";
321 if (find_reg_note (insn, REG_DEAD, operands[0]))
323 cc_status.flags |= CC_REVERSED; /*|*/
324 return "neg%.l %R0\;negx%.l %0";
328 'sub' clears %1, and also clears the X cc bit
329 'tst' sets the Z cc bit according to the low part of the DImode operand
330 'subx %1' (i.e. subx #0) acts as a (non-existent) tstx on the high part.
332 return "sub%.l %1,%1\;tst%.l %R0\;subx%.l %1,%0";
335 ;; If you think that the 68020 does not support tstl a0,
336 ;; reread page B-167 of the 68020 manual more carefully.
337 (define_insn "*tstsi_internal_68020_cf"
339 (compare (match_operand:SI 0 "nonimmediate_operand" "rm")
341 "TARGET_68020 || TARGET_COLDFIRE"
343 [(set_attr "type" "tst_l")])
345 ;; On an address reg, cmpw may replace cmpl.
346 (define_insn "*tstsi_internal"
348 (compare (match_operand:SI 0 "nonimmediate_operand" "dm,r")
350 "!(TARGET_68020 || TARGET_COLDFIRE)"
354 [(set_attr "type" "tst_l,cmp")])
356 ;; This can't use an address register, because comparisons
357 ;; with address registers as second operand always test the whole word.
358 (define_insn "*tsthi_internal"
360 (compare (match_operand:HI 0 "nonimmediate_operand" "dm")
364 [(set_attr "type" "tst")])
366 (define_insn "*tstqi_internal"
368 (compare (match_operand:QI 0 "nonimmediate_operand" "dm")
372 [(set_attr "type" "tst")])
374 (define_insn "tst<mode>_68881"
376 (compare (match_operand:FP 0 "general_operand" "f<FP:dreg>m")
377 (match_operand:FP 1 "const0_operand" "H")))]
380 cc_status.flags = CC_IN_68881;
381 if (FP_REG_P (operands[0]))
383 return "ftst%.<FP:prec> %0";
385 [(set_attr "type" "ftst")])
387 (define_insn "tst<mode>_cf"
389 (compare (match_operand:FP 0 "general_operand" "f<FP:dreg><Q>U")
390 (match_operand:FP 1 "const0_operand" "H")))]
391 "TARGET_COLDFIRE_FPU"
393 cc_status.flags = CC_IN_68881;
394 if (FP_REG_P (operands[0]))
396 return "ftst%.<FP:prec> %0";
398 [(set_attr "type" "ftst")])
401 ;; compare instructions.
403 (define_insn "*cmpdi_internal"
405 (compare (match_operand:DI 1 "nonimmediate_operand" "0,d")
406 (match_operand:DI 2 "general_operand" "d,0")))
407 (clobber (match_scratch:DI 0 "=d,d"))]
410 if (rtx_equal_p (operands[0], operands[1]))
411 return "sub%.l %R2,%R0\;subx%.l %2,%0";
414 cc_status.flags |= CC_REVERSED; /*|*/
415 return "sub%.l %R1,%R0\;subx%.l %1,%0";
421 (compare (match_operand:DI 0 "nonimmediate_operand")
422 (match_operand:DI 1 "general_operand")))
423 (clobber (match_scratch:DI 2))]
428 (define_expand "cbranchdi4"
430 (if_then_else (match_operator 0 "ordered_comparison_operator"
431 [(match_operand:DI 1 "nonimmediate_operand")
432 (match_operand:DI 2 "general_operand")])
433 (label_ref (match_operand 3 ""))
437 if (operands[2] == const0_rtx)
438 emit_insn (gen_tstdi (operands[1]));
440 emit_insn (gen_cmpdi (operands[1], operands[2]));
441 operands[1] = cc0_rtx;
442 operands[2] = const0_rtx;
445 (define_expand "cstoredi4"
446 [(set (match_operand:QI 0 "register_operand")
447 (match_operator:QI 1 "ordered_comparison_operator"
448 [(match_operand:DI 2 "nonimmediate_operand")
449 (match_operand:DI 3 "general_operand")]))]
452 if (operands[3] == const0_rtx)
453 emit_insn (gen_tstdi (operands[2]));
455 emit_insn (gen_cmpdi (operands[2], operands[3]));
456 operands[2] = cc0_rtx;
457 operands[3] = const0_rtx;
461 (define_expand "cbranchsi4"
463 (compare (match_operand:SI 1 "nonimmediate_operand" "")
464 (match_operand:SI 2 "general_operand" "")))
466 (if_then_else (match_operator 0 "ordered_comparison_operator"
467 [(cc0) (const_int 0)])
468 (label_ref (match_operand 3 ""))
473 (define_expand "cstoresi4"
475 (compare (match_operand:SI 2 "nonimmediate_operand" "")
476 (match_operand:SI 3 "general_operand" "")))
477 (set (match_operand:QI 0 "register_operand")
478 (match_operator:QI 1 "ordered_comparison_operator"
479 [(cc0) (const_int 0)]))]
484 ;; A composite of the cmp, cmpa, cmpi & cmpm m68000 op codes.
487 (compare (match_operand:SI 0 "nonimmediate_operand" "rKT,rKs,mSr,mSa,>")
488 (match_operand:SI 1 "general_src_operand" "mSr,mSa,KTr,Ksr,>")))]
491 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
492 return "cmpm%.l %1,%0";
493 if (REG_P (operands[1])
494 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
496 cc_status.flags |= CC_REVERSED; /*|*/
497 return "cmp%.l %d0,%d1";
499 if (ADDRESS_REG_P (operands[0])
500 && GET_CODE (operands[1]) == CONST_INT
501 && INTVAL (operands[1]) < 0x8000
502 && INTVAL (operands[1]) >= -0x8000)
503 return "cmp%.w %1,%0";
504 return "cmp%.l %d1,%d0";
507 (define_insn "*cmpsi_cf"
509 (compare (match_operand:SI 0 "nonimmediate_operand" "mrKs,r")
510 (match_operand:SI 1 "general_operand" "r,mrKs")))]
513 if (REG_P (operands[1])
514 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
516 cc_status.flags |= CC_REVERSED; /*|*/
517 return "cmp%.l %d0,%d1";
519 return "cmp%.l %d1,%d0";
521 [(set_attr "type" "cmp_l")])
523 (define_expand "cbranchhi4"
525 (compare (match_operand:HI 1 "nonimmediate_src_operand" "")
526 (match_operand:HI 2 "m68k_subword_comparison_operand" "")))
528 (if_then_else (match_operator 0 "ordered_comparison_operator"
529 [(cc0) (const_int 0)])
530 (label_ref (match_operand 3 ""))
535 (define_expand "cstorehi4"
537 (compare (match_operand:HI 2 "nonimmediate_operand" "")
538 (match_operand:HI 3 "m68k_subword_comparison_operand" "")))
539 (set (match_operand:QI 0 "register_operand")
540 (match_operator:QI 1 "ordered_comparison_operator"
541 [(cc0) (const_int 0)]))]
547 (compare (match_operand:HI 0 "nonimmediate_src_operand" "rnmS,d,n,mS,>")
548 (match_operand:HI 1 "general_src_operand" "d,rnmS,mS,n,>")))]
551 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
552 return "cmpm%.w %1,%0";
553 if ((REG_P (operands[1]) && !ADDRESS_REG_P (operands[1]))
554 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
556 cc_status.flags |= CC_REVERSED; /*|*/
557 return "cmp%.w %d0,%d1";
559 return "cmp%.w %d1,%d0";
562 (define_expand "cbranchqi4"
564 (compare (match_operand:QI 1 "nonimmediate_src_operand" "")
565 (match_operand:QI 2 "m68k_subword_comparison_operand" "")))
567 (if_then_else (match_operator 0 "ordered_comparison_operator"
568 [(cc0) (const_int 0)])
569 (label_ref (match_operand 3 ""))
574 (define_expand "cstoreqi4"
576 (compare (match_operand:QI 2 "nonimmediate_src_operand" "")
577 (match_operand:QI 3 "m68k_subword_comparison_operand" "")))
578 (set (match_operand:QI 0 "register_operand")
579 (match_operator:QI 1 "ordered_comparison_operator"
580 [(cc0) (const_int 0)]))]
586 (compare (match_operand:QI 0 "nonimmediate_src_operand" "dn,dmS,>")
587 (match_operand:QI 1 "general_src_operand" "dmS,nd,>")))]
590 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
591 return "cmpm%.b %1,%0";
592 if (REG_P (operands[1])
593 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
595 cc_status.flags |= CC_REVERSED; /*|*/
596 return "cmp%.b %d0,%d1";
598 return "cmp%.b %d1,%d0";
601 (define_expand "cbranch<mode>4"
603 (compare (match_operand:FP 1 "register_operand" "")
604 (match_operand:FP 2 "fp_src_operand" "")))
606 (if_then_else (match_operator 0 "comparison_operator"
607 [(cc0) (const_int 0)])
608 (label_ref (match_operand 3 ""))
613 (define_expand "cstore<mode>4"
615 (compare (match_operand:FP 2 "register_operand" "")
616 (match_operand:FP 3 "fp_src_operand" "")))
617 (set (match_operand:QI 0 "register_operand")
618 (match_operator:QI 1 "m68k_cstore_comparison_operator"
619 [(cc0) (const_int 0)]))]
620 "TARGET_HARD_FLOAT && !(TUNE_68060 || TARGET_COLDFIRE_FPU)"
621 "if (TARGET_COLDFIRE && operands[2] != const0_rtx)
624 (define_insn "*cmp<mode>_68881"
626 (compare (match_operand:FP 0 "fp_src_operand" "f,f,<FP:dreg>mF")
627 (match_operand:FP 1 "fp_src_operand" "f,<FP:dreg>mF,f")))]
629 && (register_operand (operands[0], <MODE>mode)
630 || register_operand (operands[1], <MODE>mode))"
633 fcmp%.<FP:prec> %f1,%0
634 fcmp%.<FP:prec> %0,%f1"
635 [(set_attr "type" "fcmp")])
637 (define_insn "*cmp<mode>_cf"
639 (compare (match_operand:FP 0 "fp_src_operand" "f,f,<FP:dreg><Q>U")
640 (match_operand:FP 1 "fp_src_operand" "f,<FP:dreg><Q>U,f")))]
642 && (register_operand (operands[0], <MODE>mode)
643 || register_operand (operands[1], <MODE>mode))"
646 fcmp%.<FP:prec> %f1,%0
647 fcmp%.<FP:prec> %0,%f1"
648 [(set_attr "type" "fcmp")])
650 ;; Recognizers for btst instructions.
652 ;; ColdFire/5200 only allows "<Q>" type addresses when the bit position is
653 ;; specified as a constant, so we must disable all patterns that may extract
654 ;; from a MEM at a constant bit position if we can't use this as a constraint.
659 (compare (zero_extract:SI (match_operand:QI 0 "memory_src_operand" "oS")
661 (minus:SI (const_int 7)
662 (match_operand:SI 1 "general_operand" "di")))
666 return output_btst (operands, operands[1], operands[0], insn, 7);
669 ;; This is the same as the above pattern except for the constraints. The 'i'
675 (compare (zero_extract:SI (match_operand:QI 0 "memory_operand" "o")
677 (minus:SI (const_int 7)
678 (match_operand:SI 1 "general_operand" "d")))
682 return output_btst (operands, operands[1], operands[0], insn, 7);
688 (compare (zero_extract:SI (match_operand:SI 0 "register_operand" "d")
690 (minus:SI (const_int 31)
691 (match_operand:SI 1 "general_operand" "di")))
695 return output_btst (operands, operands[1], operands[0], insn, 31);
698 ;; The following two patterns are like the previous two
699 ;; except that they use the fact that bit-number operands
700 ;; are automatically masked to 3 or 5 bits.
705 (compare (zero_extract:SI (match_operand:QI 0 "memory_operand" "o")
707 (minus:SI (const_int 7)
709 (match_operand:SI 1 "register_operand" "d")
714 return output_btst (operands, operands[1], operands[0], insn, 7);
720 (compare (zero_extract:SI (match_operand:SI 0 "register_operand" "d")
722 (minus:SI (const_int 31)
724 (match_operand:SI 1 "register_operand" "d")
729 return output_btst (operands, operands[1], operands[0], insn, 31);
732 ;; Nonoffsettable mem refs are ok in this one pattern
733 ;; since we don't try to adjust them.
737 (compare (zero_extract:SI (match_operand:QI 0 "memory_operand" "m")
739 (match_operand:SI 1 "const_int_operand" "n"))
741 "(unsigned) INTVAL (operands[1]) < 8 && !TARGET_COLDFIRE"
743 operands[1] = GEN_INT (7 - INTVAL (operands[1]));
744 return output_btst (operands, operands[1], operands[0], insn, 7);
750 (compare (zero_extract:SI (match_operand:SI 0 "register_operand" "do")
752 (match_operand:SI 1 "const_int_operand" "n"))
756 if (GET_CODE (operands[0]) == MEM)
758 operands[0] = adjust_address (operands[0], QImode,
759 INTVAL (operands[1]) / 8);
760 operands[1] = GEN_INT (7 - INTVAL (operands[1]) % 8);
761 return output_btst (operands, operands[1], operands[0], insn, 7);
763 operands[1] = GEN_INT (31 - INTVAL (operands[1]));
764 return output_btst (operands, operands[1], operands[0], insn, 31);
767 ;; This is the same as the above pattern except for the constraints.
768 ;; The 'o' has been replaced with 'Q'.
773 (compare (zero_extract:SI (match_operand:SI 0 "register_operand" "dQ")
775 (match_operand:SI 1 "const_int_operand" "n"))
779 if (GET_CODE (operands[0]) == MEM)
781 operands[0] = adjust_address (operands[0], QImode,
782 INTVAL (operands[1]) / 8);
783 operands[1] = GEN_INT (7 - INTVAL (operands[1]) % 8);
784 return output_btst (operands, operands[1], operands[0], insn, 7);
786 operands[1] = GEN_INT (31 - INTVAL (operands[1]));
787 return output_btst (operands, operands[1], operands[0], insn, 31);
793 ;; A special case in which it is not desirable
794 ;; to reload the constant into a data register.
795 (define_insn "pushexthisi_const"
796 [(set (match_operand:SI 0 "push_operand" "=m,m,m")
797 (match_operand:SI 1 "const_int_operand" "C0,R,J"))]
798 "INTVAL (operands[1]) >= -0x8000 && INTVAL (operands[1]) < 0x8000"
803 [(set_attr "type" "clr_l,mov3q_l,pea")])
806 ;(define_insn "swapsi"
807 ; [(set (match_operand:SI 0 "nonimmediate_operand" "+r")
808 ; (match_operand:SI 1 "general_operand" "+r"))
809 ; (set (match_dup 1) (match_dup 0))]
813 ;; Special case of fullword move when source is zero for 68000_10.
814 ;; moveq is faster on the 68000.
815 (define_insn "*movsi_const0_68000_10"
816 [(set (match_operand:SI 0 "movsi_const0_operand" "=d,a,g")
823 [(set_attr "type" "moveq_l,alu_l,clr_l")
824 (set_attr "opy" "*,0,*")])
826 ;; Special case of fullword move when source is zero for 68040_60.
827 ;; On the '040, 'subl an,an' takes 2 clocks while lea takes only 1
828 (define_insn "*movsi_const0_68040_60"
829 [(set (match_operand:SI 0 "movsi_const0_operand" "=a,g")
833 if (which_alternative == 0)
834 return MOTOROLA ? "lea 0.w,%0" : "lea 0:w,%0";
835 else if (which_alternative == 1)
843 [(set_attr "type" "lea,clr_l")])
845 ;; Special case of fullword move when source is zero.
846 (define_insn "*movsi_const0"
847 [(set (match_operand:SI 0 "movsi_const0_operand" "=a,g")
849 "!(TUNE_68000_10 || TUNE_68040_60)"
853 [(set_attr "type" "alu_l,clr_l")
854 (set_attr "opy" "0,*")])
856 ;; General case of fullword move.
858 ;; This is the main "hook" for PIC code. When generating
859 ;; PIC, movsi is responsible for determining when the source address
860 ;; needs PIC relocation and appropriately calling legitimize_pic_address
861 ;; to perform the actual relocation.
863 ;; In both the PIC and non-PIC cases the patterns generated will
864 ;; matched by the next define_insn.
865 (define_expand "movsi"
866 [(set (match_operand:SI 0 "" "")
867 (match_operand:SI 1 "" ""))]
870 rtx tmp, base, offset;
872 if (flag_pic && !TARGET_PCREL && symbolic_operand (operands[1], SImode))
874 /* The source is an address which requires PIC relocation.
875 Call legitimize_pic_address with the source, mode, and a relocation
876 register (a new pseudo, or the final destination if reload_in_progress
877 is set). Then fall through normally */
878 rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
879 operands[1] = legitimize_pic_address (operands[1], SImode, temp);
881 else if (flag_pic && TARGET_PCREL && ! reload_in_progress)
883 /* Don't allow writes to memory except via a register;
884 the m68k doesn't consider PC-relative addresses to be writable. */
885 if (symbolic_operand (operands[0], SImode))
886 operands[0] = force_reg (SImode, XEXP (operands[0], 0));
887 else if (GET_CODE (operands[0]) == MEM
888 && symbolic_operand (XEXP (operands[0], 0), SImode))
889 operands[0] = gen_rtx_MEM (SImode,
890 force_reg (SImode, XEXP (operands[0], 0)));
892 if (M68K_OFFSETS_MUST_BE_WITHIN_SECTIONS_P)
894 split_const (operands[1], &base, &offset);
895 if (GET_CODE (base) == SYMBOL_REF
896 && !offset_within_block_p (base, INTVAL (offset)))
898 tmp = !can_create_pseudo_p () ? operands[0] : gen_reg_rtx (SImode);
899 emit_move_insn (tmp, base);
900 emit_insn (gen_addsi3 (operands[0], tmp, offset));
906 ;; General case of fullword move.
907 (define_insn "*movsi_m68k"
908 ;; Notes: make sure no alternative allows g vs g.
909 ;; We don't allow f-regs since fixed point cannot go in them.
910 [(set (match_operand:SI 0 "nonimmediate_operand" "=g,d,a<")
911 (match_operand:SI 1 "general_src_operand" "damSnT,n,i"))]
912 "!TARGET_COLDFIRE && reload_completed"
914 return output_move_simode (operands);
917 ;; Before reload is completed the register constraints
918 ;; force integer constants in range for a moveq to be reloaded
919 ;; if they are headed for memory.
920 (define_insn "*movsi_m68k2"
921 [(set (match_operand:SI 0 "nonimmediate_operand" "=g,d,a<")
922 (match_operand:SI 1 "general_src_operand" "damSKT,n,i"))]
926 return output_move_simode (operands);
929 ;; ColdFire move instructions can have at most one operand of mode >= 6.
930 (define_insn "*movsi_cf"
931 [(set (match_operand:SI 0 "nonimmediate_operand" "=g,d, d, d, d, d, a,Ap, a, r<Q>,g, U")
932 (match_operand:SI 1 "general_operand" " R,CQ,CW,CZ,CS,Ci,J,J Cs,Cs, g, Rr<Q>,U"))]
935 switch (which_alternative)
938 return "mov3q%.l %1,%0";
941 return "moveq %1,%0";
945 unsigned u = INTVAL (operands[1]);
947 operands[1] = GEN_INT ((u << 16) | (u >> 16)); /*|*/
948 return "moveq %1,%0\n\tswap %0";
952 return "mvz%.w %1,%0";
955 return "mvs%.w %1,%0";
958 return "move%.l %1,%0";
961 return "move%.w %1,%0";
972 return "move%.l %1,%0";
979 [(set_attr "type" "mov3q_l,moveq_l,*,mvsz,mvsz,move_l,move,pea,lea,move_l,move_l,move_l")])
981 ;; Special case of fullword move, where we need to get a non-GOT PIC
982 ;; reference into an address register.
984 [(set (match_operand:SI 0 "nonimmediate_operand" "=a<")
985 (match_operand:SI 1 "pcrel_address" ""))]
988 if (push_operand (operands[0], SImode))
993 (define_expand "movhi"
994 [(set (match_operand:HI 0 "nonimmediate_operand" "")
995 (match_operand:HI 1 "general_operand" ""))]
1000 [(set (match_operand:HI 0 "nonimmediate_operand" "=g")
1001 (match_operand:HI 1 "general_src_operand" "gS"))]
1003 "* return output_move_himode (operands);")
1006 [(set (match_operand:HI 0 "nonimmediate_operand" "=r<Q>,g,U")
1007 (match_operand:HI 1 "general_operand" "g,r<Q>,U"))]
1009 "* return output_move_himode (operands);")
1011 (define_expand "movstricthi"
1012 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" ""))
1013 (match_operand:HI 1 "general_src_operand" ""))]
1018 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
1019 (match_operand:HI 1 "general_src_operand" "rmSn"))]
1021 "* return output_move_stricthi (operands);")
1024 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+d,m"))
1025 (match_operand:HI 1 "general_src_operand" "rmn,r"))]
1027 "* return output_move_stricthi (operands);")
1029 (define_expand "movqi"
1030 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1031 (match_operand:QI 1 "general_src_operand" ""))]
1036 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,*a,m")
1037 (match_operand:QI 1 "general_src_operand" "dmSi*a,di*a,dmSi"))]
1039 "* return output_move_qimode (operands);")
1042 [(set (match_operand:QI 0 "nonimmediate_operand" "=d<Q>,dm,U,d*a")
1043 (match_operand:QI 1 "general_src_operand" "dmi,d<Q>,U,di*a"))]
1045 "* return output_move_qimode (operands);")
1047 (define_expand "movstrictqi"
1048 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" ""))
1049 (match_operand:QI 1 "general_src_operand" ""))]
1054 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
1055 (match_operand:QI 1 "general_src_operand" "dmSn"))]
1057 "* return output_move_strictqi (operands);")
1059 (define_insn "*movstrictqi_cf"
1060 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+d, Ac, d,m"))
1061 (match_operand:QI 1 "general_src_operand" "C0,C0, dmn,d"))]
1068 [(set_attr "type" "clr,clr,move,move")])
1070 (define_expand "pushqi1"
1071 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -2)))
1072 (set (mem:QI (plus:SI (reg:SI SP_REG) (const_int 1)))
1073 (match_operand:QI 0 "general_operand" ""))]
1077 (define_expand "reload_insf"
1078 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
1079 (match_operand:SF 1 "general_operand" "mf"))
1080 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
1081 "TARGET_COLDFIRE_FPU"
1083 if (emit_move_sequence (operands, SFmode, operands[2]))
1086 /* We don't want the clobber emitted, so handle this ourselves. */
1087 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
1091 (define_expand "reload_outsf"
1092 [(set (match_operand:SF 0 "general_operand" "")
1093 (match_operand:SF 1 "register_operand" "f"))
1094 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
1095 "TARGET_COLDFIRE_FPU"
1097 if (emit_move_sequence (operands, SFmode, operands[2]))
1100 /* We don't want the clobber emitted, so handle this ourselves. */
1101 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
1105 (define_expand "movsf"
1106 [(set (match_operand:SF 0 "nonimmediate_operand" "")
1107 (match_operand:SF 1 "general_operand" ""))]
1112 [(set (match_operand:SF 0 "nonimmediate_operand" "=rmf")
1113 (match_operand:SF 1 "general_operand" "rmfF"))]
1116 if (FP_REG_P (operands[0]))
1118 if (FP_REG_P (operands[1]))
1119 return "f%$move%.x %1,%0";
1120 else if (ADDRESS_REG_P (operands[1]))
1121 return "move%.l %1,%-\;f%$move%.s %+,%0";
1122 else if (GET_CODE (operands[1]) == CONST_DOUBLE)
1123 return output_move_const_single (operands);
1124 return "f%$move%.s %f1,%0";
1126 if (FP_REG_P (operands[1]))
1128 if (ADDRESS_REG_P (operands[0]))
1129 return "fmove%.s %1,%-\;move%.l %+,%0";
1130 return "fmove%.s %f1,%0";
1132 if (operands[1] == CONST0_RTX (SFmode)
1133 /* clr insns on 68000 read before writing. */
1134 && ((TARGET_68010 || TARGET_COLDFIRE)
1135 || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0]))))
1137 if (ADDRESS_REG_P (operands[0]))
1139 /* On the '040, 'subl an,an' takes 2 clocks while lea takes only 1 */
1141 return MOTOROLA ? "lea 0.w,%0" : "lea 0:w,%0";
1143 return "sub%.l %0,%0";
1145 /* moveq is faster on the 68000. */
1146 if (DATA_REG_P (operands[0]) && TUNE_68000_10)
1147 return "moveq #0,%0";
1150 return "move%.l %1,%0";
1153 (define_insn "movsf_cf_soft"
1154 [(set (match_operand:SF 0 "nonimmediate_operand" "=r<Q>,g,U")
1155 (match_operand:SF 1 "general_operand" "g,r<Q>,U"))]
1156 "TARGET_COLDFIRE && !TARGET_COLDFIRE_FPU"
1158 [(set_attr "type" "move_l")])
1160 ;; SFmode MEMs are restricted to modes 2-4 if TARGET_COLDFIRE_FPU.
1161 ;; The move instructions can handle all combinations.
1162 (define_insn "movsf_cf_hard"
1163 [(set (match_operand:SF 0 "nonimmediate_operand" "=r<Q>U, f, f,mr,f,r<Q>,f
1165 (match_operand:SF 1 "general_operand" " f, r<Q>U,f,rm,F,F, m
1167 "TARGET_COLDFIRE_FPU"
1169 if (which_alternative == 4 || which_alternative == 5) {
1173 REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
1174 REAL_VALUE_TO_TARGET_SINGLE (r, l);
1175 xoperands[0] = operands[0];
1176 xoperands[1] = GEN_INT (l);
1177 if (which_alternative == 5) {
1179 if (ADDRESS_REG_P (xoperands[0]))
1180 output_asm_insn ("sub%.l %0,%0", xoperands);
1182 output_asm_insn ("clr%.l %0", xoperands);
1184 if (GET_CODE (operands[0]) == MEM
1185 && symbolic_operand (XEXP (operands[0], 0), SImode))
1186 output_asm_insn ("move%.l %1,%-;move%.l %+,%0", xoperands);
1188 output_asm_insn ("move%.l %1,%0", xoperands);
1192 output_asm_insn ("move%.l %1,%-;fsmove%.s %+,%0", xoperands);
1194 output_asm_insn ("clr%.l %-;fsmove%.s %+,%0", xoperands);
1197 if (FP_REG_P (operands[0]))
1199 if (ADDRESS_REG_P (operands[1]))
1200 return "move%.l %1,%-;fsmove%.s %+,%0";
1201 if (FP_REG_P (operands[1]))
1202 return "fsmove%.d %1,%0";
1203 return "fsmove%.s %f1,%0";
1205 if (FP_REG_P (operands[1]))
1207 if (ADDRESS_REG_P (operands[0]))
1208 return "fmove%.s %1,%-;move%.l %+,%0";
1209 return "fmove%.s %f1,%0";
1211 if (operands[1] == CONST0_RTX (SFmode))
1213 if (ADDRESS_REG_P (operands[0]))
1214 return "sub%.l %0,%0";
1217 return "move%.l %1,%0";
1220 (define_expand "reload_indf"
1221 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
1222 (match_operand:DF 1 "general_operand" "mf"))
1223 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
1224 "TARGET_COLDFIRE_FPU"
1226 if (emit_move_sequence (operands, DFmode, operands[2]))
1229 /* We don't want the clobber emitted, so handle this ourselves. */
1230 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
1234 (define_expand "reload_outdf"
1235 [(set (match_operand:DF 0 "general_operand" "")
1236 (match_operand:DF 1 "register_operand" "f"))
1237 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
1238 "TARGET_COLDFIRE_FPU"
1240 if (emit_move_sequence (operands, DFmode, operands[2]))
1243 /* We don't want the clobber emitted, so handle this ourselves. */
1244 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
1248 (define_expand "movdf"
1249 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1250 (match_operand:DF 1 "general_operand" ""))]
1253 if (TARGET_COLDFIRE_FPU)
1254 if (emit_move_sequence (operands, DFmode, 0))
1259 [(set (match_operand:DF 0 "nonimmediate_operand" "=rm,rf,rf,&rof<>")
1260 (match_operand:DF 1 "general_operand" "*rf,m,0,*rofE<>"))]
1261 ; [(set (match_operand:DF 0 "nonimmediate_operand" "=rm,&rf,&rof<>")
1262 ; (match_operand:DF 1 "general_operand" "rf,m,rofF<>"))]
1265 if (FP_REG_P (operands[0]))
1267 if (FP_REG_P (operands[1]))
1268 return "f%&move%.x %1,%0";
1269 if (REG_P (operands[1]))
1272 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1273 output_asm_insn ("move%.l %1,%-", xoperands);
1274 output_asm_insn ("move%.l %1,%-", operands);
1275 return "f%&move%.d %+,%0";
1277 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1278 return output_move_const_double (operands);
1279 return "f%&move%.d %f1,%0";
1281 else if (FP_REG_P (operands[1]))
1283 if (REG_P (operands[0]))
1285 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
1286 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1287 return "move%.l %+,%0";
1290 return "fmove%.d %f1,%0";
1292 return output_move_double (operands);
1295 (define_insn_and_split "movdf_cf_soft"
1296 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,g")
1297 (match_operand:DF 1 "general_operand" "g,r"))]
1298 "TARGET_COLDFIRE && !TARGET_COLDFIRE_FPU"
1300 "&& reload_completed"
1303 m68k_emit_move_double (operands);
1307 (define_insn "movdf_cf_hard"
1308 [(set (match_operand:DF 0 "nonimmediate_operand" "=f, <Q>U,r,f,r,r,m,f")
1309 (match_operand:DF 1 "general_operand" " f<Q>U,f, f,r,r,m,r,E"))]
1310 "TARGET_COLDFIRE_FPU"
1316 switch (which_alternative)
1319 return "fdmove%.d %1,%0";
1321 return "fmove%.d %1,%0";
1323 return "fmove%.d %1,%-;move%.l %+,%0;move%.l %+,%R0";
1325 return "move%.l %R1,%-;move%.l %1,%-;fdmove%.d %+,%0";
1326 case 4: case 5: case 6:
1327 return output_move_double (operands);
1329 REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
1330 REAL_VALUE_TO_TARGET_DOUBLE (r, l);
1331 xoperands[0] = operands[0];
1332 xoperands[1] = GEN_INT (l[0]);
1333 xoperands[2] = GEN_INT (l[1]);
1334 if (operands[1] == CONST0_RTX (DFmode))
1335 output_asm_insn ("clr%.l %-;clr%.l %-;fdmove%.d %+,%0",
1339 output_asm_insn ("clr%.l %-;move%.l %1,%-;fdmove%.d %+,%0",
1342 output_asm_insn ("move%.l %2,%-;move%.l %1,%-;fdmove%.d %+,%0",
1348 ;; ??? The XFmode patterns are schizophrenic about whether constants are
1349 ;; allowed. Most but not all have predicates and constraint that disallow
1350 ;; constants. Most but not all have output templates that handle constants.
1351 ;; See also LEGITIMATE_CONSTANT_P.
1353 (define_expand "movxf"
1354 [(set (match_operand:XF 0 "nonimmediate_operand" "")
1355 (match_operand:XF 1 "general_operand" ""))]
1358 /* We can't rewrite operands during reload. */
1359 if (! reload_in_progress)
1361 if (CONSTANT_P (operands[1]))
1363 operands[1] = force_const_mem (XFmode, operands[1]);
1364 if (! memory_address_p (XFmode, XEXP (operands[1], 0)))
1365 operands[1] = adjust_address (operands[1], XFmode, 0);
1367 if (flag_pic && TARGET_PCREL)
1369 /* Don't allow writes to memory except via a register; the
1370 m68k doesn't consider PC-relative addresses to be writable. */
1371 if (GET_CODE (operands[0]) == MEM
1372 && symbolic_operand (XEXP (operands[0], 0), SImode))
1373 operands[0] = gen_rtx_MEM (XFmode,
1374 force_reg (SImode, XEXP (operands[0], 0)));
1380 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,!r,!f,!r,m,!r")
1381 (match_operand:XF 1 "nonimmediate_operand" "m,f,f,f,r,!r,!r,m"))]
1384 if (FP_REG_P (operands[0]))
1386 if (FP_REG_P (operands[1]))
1387 return "fmove%.x %1,%0";
1388 if (REG_P (operands[1]))
1391 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 2);
1392 output_asm_insn ("move%.l %1,%-", xoperands);
1393 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1394 output_asm_insn ("move%.l %1,%-", xoperands);
1395 output_asm_insn ("move%.l %1,%-", operands);
1396 return "fmove%.x %+,%0";
1398 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1399 return "fmove%.x %1,%0";
1400 return "fmove%.x %f1,%0";
1402 if (FP_REG_P (operands[1]))
1404 if (REG_P (operands[0]))
1406 output_asm_insn ("fmove%.x %f1,%-\;move%.l %+,%0", operands);
1407 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1408 output_asm_insn ("move%.l %+,%0", operands);
1409 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1410 return "move%.l %+,%0";
1412 /* Must be memory destination. */
1413 return "fmove%.x %f1,%0";
1415 return output_move_double (operands);
1419 [(set (match_operand:XF 0 "nonimmediate_operand" "=rm,rf,&rof<>")
1420 (match_operand:XF 1 "nonimmediate_operand" "rf,m,rof<>"))]
1421 "! TARGET_68881 && ! TARGET_COLDFIRE"
1423 if (FP_REG_P (operands[0]))
1425 if (FP_REG_P (operands[1]))
1426 return "fmove%.x %1,%0";
1427 if (REG_P (operands[1]))
1430 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 2);
1431 output_asm_insn ("move%.l %1,%-", xoperands);
1432 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1433 output_asm_insn ("move%.l %1,%-", xoperands);
1434 output_asm_insn ("move%.l %1,%-", operands);
1435 return "fmove%.x %+,%0";
1437 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1438 return "fmove%.x %1,%0";
1439 return "fmove%.x %f1,%0";
1441 if (FP_REG_P (operands[1]))
1443 if (REG_P (operands[0]))
1445 output_asm_insn ("fmove%.x %f1,%-\;move%.l %+,%0", operands);
1446 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1447 output_asm_insn ("move%.l %+,%0", operands);
1448 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1449 return "move%.l %+,%0";
1452 return "fmove%.x %f1,%0";
1454 return output_move_double (operands);
1458 [(set (match_operand:XF 0 "nonimmediate_operand" "=r,g")
1459 (match_operand:XF 1 "nonimmediate_operand" "g,r"))]
1460 "! TARGET_68881 && TARGET_COLDFIRE"
1461 "* return output_move_double (operands);")
1463 (define_expand "movdi"
1464 ;; Let's see if it really still needs to handle fp regs, and, if so, why.
1465 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1466 (match_operand:DI 1 "general_operand" ""))]
1470 ;; movdi can apply to fp regs in some cases
1472 ;; Let's see if it really still needs to handle fp regs, and, if so, why.
1473 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r,&ro<>")
1474 (match_operand:DI 1 "general_operand" "rF,m,roi<>F"))]
1475 ; [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,&r,&ro<>,!&rm,!&f")
1476 ; (match_operand:DI 1 "general_operand" "r,m,roi<>,fF"))]
1477 ; [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,&rf,&ro<>,!&rm,!&f")
1478 ; (match_operand:DI 1 "general_operand" "r,m,roi<>,fF,rfF"))]
1481 if (FP_REG_P (operands[0]))
1483 if (FP_REG_P (operands[1]))
1484 return "fmove%.x %1,%0";
1485 if (REG_P (operands[1]))
1488 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1489 output_asm_insn ("move%.l %1,%-", xoperands);
1490 output_asm_insn ("move%.l %1,%-", operands);
1491 return "fmove%.d %+,%0";
1493 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1494 return output_move_const_double (operands);
1495 return "fmove%.d %f1,%0";
1497 else if (FP_REG_P (operands[1]))
1499 if (REG_P (operands[0]))
1501 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
1502 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1503 return "move%.l %+,%0";
1506 return "fmove%.d %f1,%0";
1508 return output_move_double (operands);
1512 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,g")
1513 (match_operand:DI 1 "general_operand" "g,r"))]
1515 "* return output_move_double (operands);")
1517 ;; Thus goes after the move instructions
1518 ;; because the move instructions are better (require no spilling)
1519 ;; when they can apply. It goes before the add/sub insns
1520 ;; so we will prefer it to them.
1522 (define_insn "pushasi"
1523 [(set (match_operand:SI 0 "push_operand" "=m")
1524 (match_operand:SI 1 "address_operand" "p"))]
1527 [(set_attr "type" "pea")])
1529 ;; truncation instructions
1530 (define_insn "truncsiqi2"
1531 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,d")
1533 (match_operand:SI 1 "general_src_operand" "doJS,i")))]
1536 if (GET_CODE (operands[0]) == REG)
1538 /* Must clear condition codes, since the move.l bases them on
1539 the entire 32 bits, not just the desired 8 bits. */
1541 return "move%.l %1,%0";
1543 if (GET_CODE (operands[1]) == MEM)
1544 operands[1] = adjust_address (operands[1], QImode, 3);
1545 return "move%.b %1,%0";
1548 (define_insn "trunchiqi2"
1549 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,d")
1551 (match_operand:HI 1 "general_src_operand" "doJS,i")))]
1554 if (GET_CODE (operands[0]) == REG
1555 && (GET_CODE (operands[1]) == MEM
1556 || GET_CODE (operands[1]) == CONST_INT))
1558 /* Must clear condition codes, since the move.w bases them on
1559 the entire 16 bits, not just the desired 8 bits. */
1561 return "move%.w %1,%0";
1563 if (GET_CODE (operands[0]) == REG)
1565 /* Must clear condition codes, since the move.l bases them on
1566 the entire 32 bits, not just the desired 8 bits. */
1568 return "move%.l %1,%0";
1570 if (GET_CODE (operands[1]) == MEM)
1571 operands[1] = adjust_address (operands[1], QImode, 1);
1572 return "move%.b %1,%0";
1575 (define_insn "truncsihi2"
1576 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm,d")
1578 (match_operand:SI 1 "general_src_operand" "roJS,i")))]
1581 if (GET_CODE (operands[0]) == REG)
1583 /* Must clear condition codes, since the move.l bases them on
1584 the entire 32 bits, not just the desired 8 bits. */
1586 return "move%.l %1,%0";
1588 if (GET_CODE (operands[1]) == MEM)
1589 operands[1] = adjust_address (operands[1], QImode, 2);
1590 return "move%.w %1,%0";
1593 ;; zero extension instructions
1595 ;; two special patterns to match various post_inc/pre_dec patterns
1596 (define_insn_and_split "*zero_extend_inc"
1597 [(set (match_operand 0 "post_inc_operand" "")
1598 (zero_extend (match_operand 1 "register_operand" "")))]
1599 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT &&
1600 GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT &&
1601 GET_MODE_SIZE (GET_MODE (operands[0])) == GET_MODE_SIZE (GET_MODE (operands[1])) * 2"
1609 operands[0] = adjust_address (operands[0], GET_MODE (operands[1]), 0);
1612 (define_insn_and_split "*zero_extend_dec"
1613 [(set (match_operand 0 "pre_dec_operand" "")
1614 (zero_extend (match_operand 1 "register_operand" "")))]
1615 "(GET_MODE (operands[0]) != HImode || XEXP (XEXP (operands[0], 0), 0) != stack_pointer_rtx) &&
1616 GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT &&
1617 GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT &&
1618 GET_MODE_SIZE (GET_MODE (operands[0])) == GET_MODE_SIZE (GET_MODE (operands[1])) * 2"
1626 operands[0] = adjust_address (operands[0], GET_MODE (operands[1]), 0);
1629 (define_insn_and_split "zero_extendqidi2"
1630 [(set (match_operand:DI 0 "register_operand" "")
1631 (zero_extend:DI (match_operand:QI 1 "nonimmediate_src_operand" "")))]
1636 (zero_extend:SI (match_dup 1)))
1640 operands[2] = gen_lowpart (SImode, operands[0]);
1641 operands[3] = gen_highpart (SImode, operands[0]);
1644 (define_insn_and_split "zero_extendhidi2"
1645 [(set (match_operand:DI 0 "register_operand" "")
1646 (zero_extend:DI (match_operand:HI 1 "nonimmediate_src_operand" "")))]
1651 (zero_extend:SI (match_dup 1)))
1655 operands[2] = gen_lowpart (SImode, operands[0]);
1656 operands[3] = gen_highpart (SImode, operands[0]);
1659 (define_expand "zero_extendsidi2"
1660 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1661 (zero_extend:DI (match_operand:SI 1 "nonimmediate_src_operand" "")))]
1664 if (GET_CODE (operands[0]) == MEM
1665 && GET_CODE (operands[1]) == MEM)
1666 operands[1] = force_reg (SImode, operands[1]);
1669 (define_insn_and_split "*zero_extendsidi2"
1670 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1671 (zero_extend:DI (match_operand:SI 1 "nonimmediate_src_operand" "")))]
1672 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
1680 operands[2] = gen_lowpart (SImode, operands[0]);
1681 operands[3] = gen_highpart (SImode, operands[0]);
1684 (define_insn "*zero_extendhisi2_cf"
1685 [(set (match_operand:SI 0 "register_operand" "=d")
1686 (zero_extend:SI (match_operand:HI 1 "nonimmediate_src_operand" "rmS")))]
1689 [(set_attr "type" "mvsz")])
1691 (define_insn "zero_extendhisi2"
1692 [(set (match_operand:SI 0 "register_operand" "=d")
1693 (zero_extend:SI (match_operand:HI 1 "nonimmediate_src_operand" "rmS")))]
1697 (define_expand "zero_extendqihi2"
1698 [(set (match_operand:HI 0 "register_operand" "")
1699 (zero_extend:HI (match_operand:QI 1 "nonimmediate_src_operand" "")))]
1703 (define_insn "*zero_extendqihi2"
1704 [(set (match_operand:HI 0 "register_operand" "=d")
1705 (zero_extend:HI (match_operand:QI 1 "nonimmediate_src_operand" "dmS")))]
1709 (define_insn "*zero_extendqisi2_cfv4"
1710 [(set (match_operand:SI 0 "register_operand" "=d")
1711 (zero_extend:SI (match_operand:QI 1 "nonimmediate_src_operand" "dmS")))]
1714 [(set_attr "type" "mvsz")])
1716 (define_insn "zero_extendqisi2"
1717 [(set (match_operand:SI 0 "register_operand" "=d")
1718 (zero_extend:SI (match_operand:QI 1 "nonimmediate_src_operand" "dmS")))]
1722 ;; these two pattern split everything else which isn't matched by
1723 ;; something else above
1725 [(set (match_operand 0 "register_operand" "")
1726 (zero_extend (match_operand 1 "nonimmediate_src_operand" "")))]
1729 && reg_mentioned_p (operands[0], operands[1])"
1730 [(set (strict_low_part (match_dup 2))
1733 (match_op_dup 4 [(match_dup 0) (match_dup 3)]))]
1735 operands[2] = gen_lowpart (GET_MODE (operands[1]), operands[0]);
1736 operands[3] = GEN_INT (GET_MODE_MASK (GET_MODE (operands[1])));
1737 operands[4] = gen_rtx_AND (GET_MODE (operands[0]), operands[0], operands[3]);
1741 [(set (match_operand 0 "register_operand" "")
1742 (zero_extend (match_operand 1 "nonimmediate_src_operand" "")))]
1743 "!ISA_HAS_MVS_MVZ && reload_completed"
1746 (set (strict_low_part (match_dup 2))
1749 operands[2] = gen_lowpart (GET_MODE (operands[1]), operands[0]);
1752 ;; sign extension instructions
1754 (define_insn "extendqidi2"
1755 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
1756 (sign_extend:DI (match_operand:QI 1 "general_src_operand" "rmS")))]
1760 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1761 if (ISA_HAS_MVS_MVZ)
1762 return "mvs%.b %1,%2\;smi %0\;extb%.l %0";
1763 if (TARGET_68020 || TARGET_COLDFIRE)
1765 if (ADDRESS_REG_P (operands[1]))
1766 return "move%.w %1,%2\;extb%.l %2\;smi %0\;extb%.l %0";
1768 return "move%.b %1,%2\;extb%.l %2\;smi %0\;extb%.l %0";
1772 if (ADDRESS_REG_P (operands[1]))
1773 return "move%.w %1,%2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0\;smi %0";
1775 return "move%.b %1,%2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0\;smi %0";
1779 (define_insn "extendhidi2"
1780 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
1782 (match_operand:HI 1 "general_src_operand" "rmS")))]
1786 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1787 if (ISA_HAS_MVS_MVZ)
1788 return "mvs%.w %1,%2\;smi %0\;extb%.l %0";
1789 if (TARGET_68020 || TARGET_COLDFIRE)
1790 return "move%.w %1,%2\;ext%.l %2\;smi %0\;extb%.l %0";
1792 return "move%.w %1,%2\;ext%.l %2\;smi %0\;ext%.w %0\;ext%.l %0";
1795 (define_insn "extendsidi2"
1796 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,o,o,<")
1798 (match_operand:SI 1 "nonimmediate_src_operand" "rm,rm,r<Q>,rm")))
1799 (clobber (match_scratch:SI 2 "=X,d,d,d"))]
1804 if (which_alternative == 0)
1805 /* Handle alternative 0. */
1807 if (TARGET_68020 || TARGET_COLDFIRE)
1808 return "move%.l %1,%R0\;smi %0\;extb%.l %0";
1810 return "move%.l %1,%R0\;smi %0\;ext%.w %0\;ext%.l %0";
1813 /* Handle alternatives 1, 2 and 3. We don't need to adjust address by 4
1814 in alternative 3 because autodecrement will do that for us. */
1815 operands[3] = adjust_address (operands[0], SImode,
1816 which_alternative == 3 ? 0 : 4);
1817 operands[0] = adjust_address (operands[0], SImode, 0);
1819 if (TARGET_68020 || TARGET_COLDFIRE)
1820 return "move%.l %1,%3\;smi %2\;extb%.l %2\;move%.l %2,%0";
1822 return "move%.l %1,%3\;smi %2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0";
1824 [(set_attr "ok_for_coldfire" "yes,no,yes,yes")])
1826 ;; Special case when one can avoid register clobbering, copy and test
1827 ;; Maybe there is a way to make that the general case, by forcing the
1828 ;; result of the SI tree to be in the lower register of the DI target
1830 (define_insn "extendplussidi"
1831 [(set (match_operand:DI 0 "register_operand" "=d")
1832 (sign_extend:DI (plus:SI (match_operand:SI 1 "general_operand" "%rmn")
1833 (match_operand:SI 2 "general_operand" "rmn"))))]
1837 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1838 if (GET_CODE (operands[1]) == CONST_INT
1839 && (unsigned) INTVAL (operands[1]) > 8)
1841 rtx tmp = operands[1];
1843 operands[1] = operands[2];
1846 if (GET_CODE (operands[1]) == REG
1847 && REGNO (operands[1]) == REGNO (operands[3]))
1848 output_asm_insn ("add%.l %2,%3", operands);
1850 output_asm_insn ("move%.l %2,%3\;add%.l %1,%3", operands);
1851 if (TARGET_68020 || TARGET_COLDFIRE)
1852 return "smi %0\;extb%.l %0";
1854 return "smi %0\;ext%.w %0\;ext%.l %0";
1857 (define_expand "extendhisi2"
1858 [(set (match_operand:SI 0 "nonimmediate_operand" "")
1860 (match_operand:HI 1 "nonimmediate_src_operand" "")))]
1864 (define_insn "*cfv4_extendhisi2"
1865 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
1867 (match_operand:HI 1 "nonimmediate_src_operand" "rmS")))]
1870 [(set_attr "type" "mvsz")])
1872 (define_insn "*68k_extendhisi2"
1873 [(set (match_operand:SI 0 "nonimmediate_operand" "=*d,a")
1875 (match_operand:HI 1 "nonimmediate_src_operand" "0,rmS")))]
1880 [(set_attr "type" "ext,move")])
1882 (define_insn "extendqihi2"
1883 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
1884 (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0")))]
1887 [(set_attr "type" "ext")])
1889 (define_expand "extendqisi2"
1890 [(set (match_operand:SI 0 "nonimmediate_operand" "")
1891 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
1892 "TARGET_68020 || TARGET_COLDFIRE"
1895 (define_insn "*cfv4_extendqisi2"
1896 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
1897 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "rms")))]
1900 [(set_attr "type" "mvsz")])
1902 (define_insn "*68k_extendqisi2"
1903 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
1904 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "0")))]
1905 "TARGET_68020 || (TARGET_COLDFIRE && !ISA_HAS_MVS_MVZ)"
1907 [(set_attr "type" "ext")])
1909 ;; Conversions between float and double.
1911 (define_expand "extendsfdf2"
1912 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1914 (match_operand:SF 1 "general_operand" "")))]
1919 [(set (match_operand:DF 0 "nonimmediate_operand" "=*fdm,f")
1921 (match_operand:SF 1 "general_operand" "f,dmF")))]
1924 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
1926 if (REGNO (operands[0]) == REGNO (operands[1]))
1928 /* Extending float to double in an fp-reg is a no-op.
1929 NOTICE_UPDATE_CC has already assumed that the
1930 cc will be set. So cancel what it did. */
1931 cc_status = cc_prev_status;
1934 return "f%&move%.x %1,%0";
1936 if (FP_REG_P (operands[0]))
1937 return "f%&move%.s %f1,%0";
1938 if (DATA_REG_P (operands[0]) && FP_REG_P (operands[1]))
1940 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
1941 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1942 return "move%.l %+,%0";
1944 return "fmove%.d %f1,%0";
1947 (define_insn "extendsfdf2_cf"
1948 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f")
1950 (match_operand:SF 1 "general_operand" "f,<Q>U")))]
1951 "TARGET_COLDFIRE_FPU"
1953 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
1955 if (REGNO (operands[0]) == REGNO (operands[1]))
1957 /* Extending float to double in an fp-reg is a no-op.
1958 NOTICE_UPDATE_CC has already assumed that the
1959 cc will be set. So cancel what it did. */
1960 cc_status = cc_prev_status;
1963 return "fdmove%.d %1,%0";
1965 return "fdmove%.s %f1,%0";
1968 ;; This cannot output into an f-reg because there is no way to be
1969 ;; sure of truncating in that case.
1970 (define_expand "truncdfsf2"
1971 [(set (match_operand:SF 0 "nonimmediate_operand" "")
1973 (match_operand:DF 1 "general_operand" "")))]
1977 ;; On the '040 we can truncate in a register accurately and easily.
1979 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
1981 (match_operand:DF 1 "general_operand" "fmG")))]
1982 "TARGET_68881 && TARGET_68040"
1984 if (FP_REG_P (operands[1]))
1985 return "f%$move%.x %1,%0";
1986 return "f%$move%.d %f1,%0";
1989 (define_insn "truncdfsf2_cf"
1990 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,d<Q>U")
1992 (match_operand:DF 1 "general_operand" "<Q>U,f")))]
1993 "TARGET_COLDFIRE_FPU"
1997 [(set_attr "type" "fmove")])
1999 (define_insn "*truncdfsf2_68881"
2000 [(set (match_operand:SF 0 "nonimmediate_operand" "=dm")
2002 (match_operand:DF 1 "general_operand" "f")))]
2005 [(set_attr "type" "fmove")])
2007 ;; Conversion between fixed point and floating point.
2008 ;; Note that among the fix-to-float insns
2009 ;; the ones that start with SImode come first.
2010 ;; That is so that an operand that is a CONST_INT
2011 ;; (and therefore lacks a specific machine mode).
2012 ;; will be recognized as SImode (which is always valid)
2013 ;; rather than as QImode or HImode.
2015 (define_expand "floatsi<mode>2"
2016 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2017 (float:FP (match_operand:SI 1 "general_operand" "")))]
2021 (define_insn "floatsi<mode>2_68881"
2022 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2023 (float:FP (match_operand:SI 1 "general_operand" "dmi")))]
2025 "f<FP:round>move%.l %1,%0"
2026 [(set_attr "type" "fmove")])
2028 (define_insn "floatsi<mode>2_cf"
2029 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2030 (float:FP (match_operand:SI 1 "general_operand" "d<Q>U")))]
2031 "TARGET_COLDFIRE_FPU"
2032 "f<FP:prec>move%.l %1,%0"
2033 [(set_attr "type" "fmove")])
2036 (define_expand "floathi<mode>2"
2037 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2038 (float:FP (match_operand:HI 1 "general_operand" "")))]
2042 (define_insn "floathi<mode>2_68881"
2043 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2044 (float:FP (match_operand:HI 1 "general_operand" "dmn")))]
2047 [(set_attr "type" "fmove")])
2049 (define_insn "floathi<mode>2_cf"
2050 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2051 (float:FP (match_operand:HI 1 "general_operand" "d<Q>U")))]
2052 "TARGET_COLDFIRE_FPU"
2054 [(set_attr "type" "fmove")])
2057 (define_expand "floatqi<mode>2"
2058 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2059 (float:FP (match_operand:QI 1 "general_operand" "")))]
2063 (define_insn "floatqi<mode>2_68881"
2064 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2065 (float:FP (match_operand:QI 1 "general_operand" "dmn")))]
2068 [(set_attr "type" "fmove")])
2070 (define_insn "floatqi<mode>2_cf"
2071 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2072 (float:FP (match_operand:QI 1 "general_operand" "d<Q>U")))]
2073 "TARGET_COLDFIRE_FPU"
2075 [(set_attr "type" "fmove")])
2078 ;; New routines to convert floating-point values to integers
2079 ;; to be used on the '040. These should be faster than trapping
2080 ;; into the kernel to emulate fintrz. They should also be faster
2081 ;; than calling the subroutines fixsfsi or fixdfsi.
2083 (define_insn "fix_truncdfsi2"
2084 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
2085 (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
2086 (clobber (match_scratch:SI 2 "=d"))
2087 (clobber (match_scratch:SI 3 "=d"))]
2088 "TARGET_68881 && TUNE_68040"
2091 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,%!";
2094 (define_insn "fix_truncdfhi2"
2095 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
2096 (fix:HI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
2097 (clobber (match_scratch:SI 2 "=d"))
2098 (clobber (match_scratch:SI 3 "=d"))]
2099 "TARGET_68881 && TUNE_68040"
2102 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,%!";
2105 (define_insn "fix_truncdfqi2"
2106 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
2107 (fix:QI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
2108 (clobber (match_scratch:SI 2 "=d"))
2109 (clobber (match_scratch:SI 3 "=d"))]
2110 "TARGET_68881 && TUNE_68040"
2113 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,%!";
2116 ;; Convert a float to a float whose value is an integer.
2117 ;; This is the first stage of converting it to an integer type.
2119 (define_expand "ftrunc<mode>2"
2120 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2121 (fix:FP (match_operand:FP 1 "general_operand" "")))]
2122 "TARGET_HARD_FLOAT && !TUNE_68040"
2125 (define_insn "ftrunc<mode>2_68881"
2126 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2127 (fix:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m")))]
2128 "TARGET_68881 && !TUNE_68040"
2130 if (FP_REG_P (operands[1]))
2131 return "fintrz%.x %f1,%0";
2132 return "fintrz%.<FP:prec> %f1,%0";
2134 [(set_attr "type" "falu")])
2136 (define_insn "ftrunc<mode>2_cf"
2137 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2138 (fix:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U")))]
2139 "TARGET_COLDFIRE_FPU"
2141 if (FP_REG_P (operands[1]))
2142 return "fintrz%.d %f1,%0";
2143 return "fintrz%.<FP:prec> %f1,%0";
2145 [(set_attr "type" "falu")])
2147 ;; Convert a float whose value is an integer
2148 ;; to an actual integer. Second stage of converting float to integer type.
2149 (define_expand "fix<mode>qi2"
2150 [(set (match_operand:QI 0 "nonimmediate_operand" "")
2151 (fix:QI (match_operand:FP 1 "general_operand" "")))]
2155 (define_insn "fix<mode>qi2_68881"
2156 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
2157 (fix:QI (match_operand:FP 1 "general_operand" "f")))]
2160 [(set_attr "type" "fmove")])
2162 (define_insn "fix<mode>qi2_cf"
2163 [(set (match_operand:QI 0 "nonimmediate_operand" "=d<Q>U")
2164 (fix:QI (match_operand:FP 1 "general_operand" "f")))]
2165 "TARGET_COLDFIRE_FPU"
2167 [(set_attr "type" "fmove")])
2169 (define_expand "fix<mode>hi2"
2170 [(set (match_operand:HI 0 "nonimmediate_operand" "")
2171 (fix:HI (match_operand:FP 1 "general_operand" "")))]
2175 (define_insn "fix<mode>hi2_68881"
2176 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
2177 (fix:HI (match_operand:FP 1 "general_operand" "f")))]
2180 [(set_attr "type" "fmove")])
2182 (define_insn "fix<mode>hi2_cf"
2183 [(set (match_operand:HI 0 "nonimmediate_operand" "=d<Q>U")
2184 (fix:HI (match_operand:FP 1 "general_operand" "f")))]
2185 "TARGET_COLDFIRE_FPU"
2187 [(set_attr "type" "fmove")])
2189 (define_expand "fix<mode>si2"
2190 [(set (match_operand:SI 0 "nonimmediate_operand" "")
2191 (fix:SI (match_operand:FP 1 "general_operand" "")))]
2195 (define_insn "fix<mode>si2_68881"
2196 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
2197 (fix:SI (match_operand:FP 1 "general_operand" "f")))]
2200 [(set_attr "type" "fmove")])
2202 (define_insn "fix<mode>si2_cf"
2203 [(set (match_operand:SI 0 "nonimmediate_operand" "=d<Q>U")
2204 (fix:SI (match_operand:FP 1 "general_operand" "f")))]
2205 "TARGET_COLDFIRE_FPU"
2207 [(set_attr "type" "fmove")])
2212 (define_insn "adddi_lshrdi_63"
2213 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
2214 (plus:DI (lshiftrt:DI (match_operand:DI 1 "general_operand" "rm")
2217 (clobber (match_scratch:SI 2 "=d"))]
2220 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
2221 if (REG_P (operands[1]) && REGNO (operands[1]) == REGNO (operands[0]))
2223 "move%.l %1,%2\;add%.l %2,%2\;subx%.l %2,%2\;sub%.l %2,%3\;subx%.l %2,%0";
2224 if (GET_CODE (operands[1]) == REG)
2225 operands[4] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
2226 else if (GET_CODE (XEXP (operands[1], 0)) == POST_INC
2227 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
2228 operands[4] = operands[1];
2230 operands[4] = adjust_address (operands[1], SImode, 4);
2231 if (GET_CODE (operands[1]) == MEM
2232 && GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
2233 output_asm_insn ("move%.l %4,%3", operands);
2234 output_asm_insn ("move%.l %1,%0\;smi %2", operands);
2235 if (TARGET_68020 || TARGET_COLDFIRE)
2236 output_asm_insn ("extb%.l %2", operands);
2238 output_asm_insn ("ext%.w %2\;ext%.l %2", operands);
2239 if (GET_CODE (operands[1]) != MEM
2240 || GET_CODE (XEXP (operands[1], 0)) != PRE_DEC)
2241 output_asm_insn ("move%.l %4,%3", operands);
2242 return "sub%.l %2,%3\;subx%.l %2,%0";
2245 (define_insn "adddi_sexthishl32"
2246 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,a,*d,*d")
2247 (plus:DI (ashift:DI (sign_extend:DI
2248 (match_operand:HI 1 "general_operand" "rm,rm,rm,rm"))
2250 (match_operand:DI 2 "general_operand" "0,0,0,0")))
2251 (clobber (match_scratch:SI 3 "=&d,X,a,?d"))]
2255 if (ADDRESS_REG_P (operands[0]))
2256 return "add%.w %1,%0";
2257 else if (ADDRESS_REG_P (operands[3]))
2258 return "move%.w %1,%3\;add%.l %3,%0";
2260 return "move%.w %1,%3\;ext%.l %3\;add%.l %3,%0";
2263 (define_insn "*adddi_dilshr32"
2264 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,o")
2265 (plus:DI (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro,d")
2267 (match_operand:DI 2 "general_operand" "0,0")))]
2271 if (GET_CODE (operands[0]) == REG)
2272 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
2274 operands[2] = adjust_address (operands[0], SImode, 4);
2275 return "add%.l %1,%2\;negx%.l %0\;neg%.l %0";
2278 (define_insn "*adddi_dilshr32_cf"
2279 [(set (match_operand:DI 0 "register_operand" "=d")
2280 (plus:DI (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "ro")
2282 (match_operand:DI 2 "register_operand" "0")))]
2286 return "add%.l %1,%R0\;negx%.l %0\;neg%.l %0";
2289 (define_insn "adddi_dishl32"
2290 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o")
2291 ;; (plus:DI (match_operand:DI 2 "general_operand" "%0")
2292 ;; (ashift:DI (match_operand:DI 1 "general_operand" "ro")
2293 ;; (const_int 32))))]
2294 (plus:DI (ashift:DI (match_operand:DI 1 "general_operand" "ro,d")
2296 (match_operand:DI 2 "general_operand" "0,0")))]
2300 if (GET_CODE (operands[1]) == REG)
2301 operands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
2303 operands[1] = adjust_address (operands[1], SImode, 4);
2304 return "add%.l %1,%0";
2306 [(set_attr "type" "alu_l")])
2308 (define_insn "adddi3"
2309 [(set (match_operand:DI 0 "nonimmediate_operand" "=o<>,d,d,d")
2310 (plus:DI (match_operand:DI 1 "general_operand" "%0,0,0,0")
2311 (match_operand:DI 2 "general_operand" "d,no>,d,a")))
2312 (clobber (match_scratch:SI 3 "=&d,&d,X,&d"))]
2315 if (DATA_REG_P (operands[0]))
2317 if (DATA_REG_P (operands[2]))
2318 return "add%.l %R2,%R0\;addx%.l %2,%0";
2319 else if (GET_CODE (operands[2]) == MEM
2320 && GET_CODE (XEXP (operands[2], 0)) == POST_INC)
2321 return "move%.l %2,%3\;add%.l %2,%R0\;addx%.l %3,%0";
2327 if (GET_CODE (operands[2]) == REG)
2329 low = gen_rtx_REG (SImode, REGNO (operands[2]) + 1);
2332 else if (CONSTANT_P (operands[2]))
2333 split_double (operands[2], &high, &low);
2336 low = adjust_address (operands[2], SImode, 4);
2340 operands[1] = low, operands[2] = high;
2341 xoperands[0] = operands[3];
2342 if (GET_CODE (operands[1]) == CONST_INT
2343 && INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
2344 xoperands[1] = GEN_INT (-INTVAL (operands[2]) - 1);
2346 xoperands[1] = operands[2];
2348 output_asm_insn (output_move_simode (xoperands), xoperands);
2349 if (GET_CODE (operands[1]) == CONST_INT)
2351 if (INTVAL (operands[1]) > 0 && INTVAL (operands[1]) <= 8)
2352 return "addq%.l %1,%R0\;addx%.l %3,%0";
2353 else if (INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
2355 operands[1] = GEN_INT (-INTVAL (operands[1]));
2356 return "subq%.l %1,%R0\;subx%.l %3,%0";
2359 return "add%.l %1,%R0\;addx%.l %3,%0";
2364 gcc_assert (GET_CODE (operands[0]) == MEM);
2366 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
2368 operands[1] = gen_rtx_MEM (SImode,
2369 plus_constant (XEXP(operands[0], 0), -8));
2370 return "move%.l %0,%3\;add%.l %R2,%0\;addx%.l %2,%3\;move%.l %3,%1";
2372 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
2374 operands[1] = XEXP(operands[0], 0);
2375 return "add%.l %R2,%0\;move%.l %0,%3\;addx%.l %2,%3\;move%.l %3,%1";
2379 operands[1] = adjust_address (operands[0], SImode, 4);
2380 return "add%.l %R2,%1\;move%.l %0,%3\;addx%.l %2,%3\;move%.l %3,%0";
2385 (define_insn "addsi_lshrsi_31"
2386 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm,dm,d<Q>")
2387 (plus:SI (lshiftrt:SI (match_operand:SI 1 "general_operand" "rm,r<Q>,rm")
2392 operands[2] = operands[0];
2393 operands[3] = gen_label_rtx();
2394 if (GET_CODE (operands[0]) == MEM)
2396 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
2397 operands[0] = gen_rtx_MEM (SImode, XEXP (XEXP (operands[0], 0), 0));
2398 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
2399 operands[2] = gen_rtx_MEM (SImode, XEXP (XEXP (operands[0], 0), 0));
2401 output_asm_insn ("move%.l %1,%0", operands);
2402 output_asm_insn ("jpl %l3", operands);
2403 output_asm_insn ("addq%.l #1,%2", operands);
2404 (*targetm.asm_out.internal_label) (asm_out_file, "L",
2405 CODE_LABEL_NUMBER (operands[3]));
2408 [(set_attr "ok_for_coldfire" "no,yes,yes")])
2410 (define_expand "addsi3"
2411 [(set (match_operand:SI 0 "nonimmediate_operand" "")
2412 (plus:SI (match_operand:SI 1 "general_operand" "")
2413 (match_operand:SI 2 "general_src_operand" "")))]
2417 ;; Note that the middle two alternatives are near-duplicates
2418 ;; in order to handle insns generated by reload.
2419 ;; This is needed since they are not themselves reloaded,
2420 ;; so commutativity won't apply to them.
2421 (define_insn "*addsi3_internal"
2422 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,?a,?a,d,a")
2423 (plus:SI (match_operand:SI 1 "general_operand" "%0,a,rJK,0,0")
2424 (match_operand:SI 2 "general_src_operand" "dIKLT,rJK,a,mSrIKLT,mSrIKLs")))]
2428 "* return output_addsi3 (operands);")
2430 (define_insn_and_split "*addsi3_5200"
2431 [(set (match_operand:SI 0 "nonimmediate_operand" "=mr,mr,a,m,r, ?a, ?a,?a,?a")
2432 (plus:SI (match_operand:SI 1 "general_operand" "%0, 0, 0,0,0, a, a, r, a")
2433 (match_operand:SI 2 "general_src_operand" " I, L, J,d,mrKi,Cj, r, a, J")))]
2436 switch (which_alternative)
2439 return "addq%.l %2,%0";
2442 operands[2] = GEN_INT (- INTVAL (operands[2]));
2443 return "subq%.l %2,%0";
2447 return "add%.l %2,%0";
2450 /* move%.l %2,%0\n\tadd%.l %1,%0 */
2454 return MOTOROLA ? "lea (%1,%2.l),%0" : "lea %1@(0,%2:l),%0";
2457 return MOTOROLA ? "lea (%2,%1.l),%0" : "lea %2@(0,%1:l),%0";
2461 return MOTOROLA ? "lea (%c2,%1),%0" : "lea %1@(%c2),%0";
2468 "&& reload_completed && (extract_constrain_insn_cached (insn), which_alternative == 5) && !operands_match_p (operands[0], operands[1])"
2472 (plus:SI (match_dup 0)
2475 [(set_attr "type" "aluq_l,aluq_l,lea,alu_l,alu_l,*,lea,lea,lea")
2476 (set_attr "opy" "2,2,*,2,2,*,*,*,*")
2477 (set_attr "opy_type" "*,*,mem5,*,*,*,mem6,mem6,mem5")])
2480 [(set (match_operand:SI 0 "nonimmediate_operand" "=a")
2481 (plus:SI (match_operand:SI 1 "general_operand" "0")
2483 (match_operand:HI 2 "nonimmediate_src_operand" "rmS"))))]
2487 (define_insn "addhi3"
2488 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,r")
2489 (plus:HI (match_operand:HI 1 "general_operand" "%0,0")
2490 (match_operand:HI 2 "general_src_operand" "dn,rmSn")))]
2493 if (GET_CODE (operands[2]) == CONST_INT)
2495 /* If the constant would be a negative number when interpreted as
2496 HImode, make it negative. This is usually, but not always, done
2497 elsewhere in the compiler. First check for constants out of range,
2498 which could confuse us. */
2500 if (INTVAL (operands[2]) >= 32768)
2501 operands[2] = GEN_INT (INTVAL (operands[2]) - 65536);
2503 if (INTVAL (operands[2]) > 0
2504 && INTVAL (operands[2]) <= 8)
2505 return "addq%.w %2,%0";
2506 if (INTVAL (operands[2]) < 0
2507 && INTVAL (operands[2]) >= -8)
2509 operands[2] = GEN_INT (- INTVAL (operands[2]));
2510 return "subq%.w %2,%0";
2512 /* On the CPU32 it is faster to use two addqw instructions to
2513 add a small integer (8 < N <= 16) to a register.
2514 Likewise for subqw. */
2515 if (TUNE_CPU32 && REG_P (operands[0]))
2517 if (INTVAL (operands[2]) > 8
2518 && INTVAL (operands[2]) <= 16)
2520 operands[2] = GEN_INT (INTVAL (operands[2]) - 8);
2521 return "addq%.w #8,%0\;addq%.w %2,%0";
2523 if (INTVAL (operands[2]) < -8
2524 && INTVAL (operands[2]) >= -16)
2526 operands[2] = GEN_INT (- INTVAL (operands[2]) - 8);
2527 return "subq%.w #8,%0\;subq%.w %2,%0";
2530 if (ADDRESS_REG_P (operands[0]) && !TUNE_68040)
2531 return MOTOROLA ? "lea (%c2,%0),%0" : "lea %0@(%c2),%0";
2533 return "add%.w %2,%0";
2536 ;; These insns must use MATCH_DUP instead of the more expected
2537 ;; use of a matching constraint because the "output" here is also
2538 ;; an input, so you can't use the matching constraint. That also means
2539 ;; that you can't use the "%", so you need patterns with the matched
2540 ;; operand in both positions.
2543 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
2544 (plus:HI (match_dup 0)
2545 (match_operand:HI 1 "general_src_operand" "dn,rmSn")))]
2548 if (GET_CODE (operands[1]) == CONST_INT)
2550 /* If the constant would be a negative number when interpreted as
2551 HImode, make it negative. This is usually, but not always, done
2552 elsewhere in the compiler. First check for constants out of range,
2553 which could confuse us. */
2555 if (INTVAL (operands[1]) >= 32768)
2556 operands[1] = GEN_INT (INTVAL (operands[1]) - 65536);
2558 if (INTVAL (operands[1]) > 0
2559 && INTVAL (operands[1]) <= 8)
2560 return "addq%.w %1,%0";
2561 if (INTVAL (operands[1]) < 0
2562 && INTVAL (operands[1]) >= -8)
2564 operands[1] = GEN_INT (- INTVAL (operands[1]));
2565 return "subq%.w %1,%0";
2567 /* On the CPU32 it is faster to use two addqw instructions to
2568 add a small integer (8 < N <= 16) to a register.
2569 Likewise for subqw. */
2570 if (TUNE_CPU32 && REG_P (operands[0]))
2572 if (INTVAL (operands[1]) > 8
2573 && INTVAL (operands[1]) <= 16)
2575 operands[1] = GEN_INT (INTVAL (operands[1]) - 8);
2576 return "addq%.w #8,%0\;addq%.w %1,%0";
2578 if (INTVAL (operands[1]) < -8
2579 && INTVAL (operands[1]) >= -16)
2581 operands[1] = GEN_INT (- INTVAL (operands[1]) - 8);
2582 return "subq%.w #8,%0\;subq%.w %1,%0";
2585 if (ADDRESS_REG_P (operands[0]) && !TUNE_68040)
2586 return MOTOROLA ? "lea (%c1,%0),%0" : "lea %0@(%c1),%0";
2588 return "add%.w %1,%0";
2592 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
2593 (plus:HI (match_operand:HI 1 "general_src_operand" "dn,rmSn")
2597 if (GET_CODE (operands[1]) == CONST_INT)
2599 /* If the constant would be a negative number when interpreted as
2600 HImode, make it negative. This is usually, but not always, done
2601 elsewhere in the compiler. First check for constants out of range,
2602 which could confuse us. */
2604 if (INTVAL (operands[1]) >= 32768)
2605 operands[1] = GEN_INT (INTVAL (operands[1]) - 65536);
2607 if (INTVAL (operands[1]) > 0
2608 && INTVAL (operands[1]) <= 8)
2609 return "addq%.w %1,%0";
2610 if (INTVAL (operands[1]) < 0
2611 && INTVAL (operands[1]) >= -8)
2613 operands[1] = GEN_INT (- INTVAL (operands[1]));
2614 return "subq%.w %1,%0";
2616 /* On the CPU32 it is faster to use two addqw instructions to
2617 add a small integer (8 < N <= 16) to a register.
2618 Likewise for subqw. */
2619 if (TUNE_CPU32 && REG_P (operands[0]))
2621 if (INTVAL (operands[1]) > 8
2622 && INTVAL (operands[1]) <= 16)
2624 operands[1] = GEN_INT (INTVAL (operands[1]) - 8);
2625 return "addq%.w #8,%0\;addq%.w %1,%0";
2627 if (INTVAL (operands[1]) < -8
2628 && INTVAL (operands[1]) >= -16)
2630 operands[1] = GEN_INT (- INTVAL (operands[1]) - 8);
2631 return "subq%.w #8,%0\;subq%.w %1,%0";
2634 if (ADDRESS_REG_P (operands[0]) && !TUNE_68040)
2635 return MOTOROLA ? "lea (%c1,%0),%0" : "lea %0@(%c1),%0";
2637 return "add%.w %1,%0";
2640 (define_insn "addqi3"
2641 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
2642 (plus:QI (match_operand:QI 1 "general_operand" "%0,0")
2643 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
2646 if (GET_CODE (operands[2]) == CONST_INT)
2648 if (INTVAL (operands[2]) >= 128)
2649 operands[2] = GEN_INT (INTVAL (operands[2]) - 256);
2651 if (INTVAL (operands[2]) > 0
2652 && INTVAL (operands[2]) <= 8)
2653 return "addq%.b %2,%0";
2654 if (INTVAL (operands[2]) < 0 && INTVAL (operands[2]) >= -8)
2656 operands[2] = GEN_INT (- INTVAL (operands[2]));
2657 return "subq%.b %2,%0";
2660 return "add%.b %2,%0";
2664 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
2665 (plus:QI (match_dup 0)
2666 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
2669 if (GET_CODE (operands[1]) == CONST_INT)
2671 if (INTVAL (operands[1]) >= 128)
2672 operands[1] = GEN_INT (INTVAL (operands[1]) - 256);
2674 if (INTVAL (operands[1]) > 0
2675 && INTVAL (operands[1]) <= 8)
2676 return "addq%.b %1,%0";
2677 if (INTVAL (operands[1]) < 0 && INTVAL (operands[1]) >= -8)
2679 operands[1] = GEN_INT (- INTVAL (operands[1]));
2680 return "subq%.b %1,%0";
2683 return "add%.b %1,%0";
2687 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
2688 (plus:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn")
2692 if (GET_CODE (operands[1]) == CONST_INT)
2694 if (INTVAL (operands[1]) >= 128)
2695 operands[1] = GEN_INT (INTVAL (operands[1]) - 256);
2697 if (INTVAL (operands[1]) > 0
2698 && INTVAL (operands[1]) <= 8)
2699 return "addq%.b %1,%0";
2700 if (INTVAL (operands[1]) < 0 && INTVAL (operands[1]) >= -8)
2702 operands[1] = GEN_INT (- INTVAL (operands[1]));
2703 return "subq%.b %1,%0";
2706 return "add%.b %1,%0";
2709 (define_expand "add<mode>3"
2710 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2711 (plus:FP (match_operand:FP 1 "general_operand" "")
2712 (match_operand:FP 2 "general_operand" "")))]
2716 (define_insn "add<mode>3_floatsi_68881"
2717 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2718 (plus:FP (float:FP (match_operand:SI 2 "general_operand" "dmi"))
2719 (match_operand:FP 1 "general_operand" "0")))]
2721 "f<FP:round>add%.l %2,%0"
2722 [(set_attr "type" "falu")
2723 (set_attr "opy" "2")])
2725 (define_insn "add<mode>3_floathi_68881"
2726 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2727 (plus:FP (float:FP (match_operand:HI 2 "general_operand" "dmn"))
2728 (match_operand:FP 1 "general_operand" "0")))]
2730 "f<FP:round>add%.w %2,%0"
2731 [(set_attr "type" "falu")
2732 (set_attr "opy" "2")])
2734 (define_insn "add<mode>3_floatqi_68881"
2735 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2736 (plus:FP (float:FP (match_operand:QI 2 "general_operand" "dmn"))
2737 (match_operand:FP 1 "general_operand" "0")))]
2739 "f<FP:round>add%.b %2,%0"
2740 [(set_attr "type" "falu")
2741 (set_attr "opy" "2")])
2743 (define_insn "add<mode>3_68881"
2744 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2745 (plus:FP (match_operand:FP 1 "general_operand" "%0")
2746 (match_operand:FP 2 "general_operand" "f<FP:dreg>m<FP:const>")))]
2749 if (FP_REG_P (operands[2]))
2750 return "f<FP:round>add%.x %2,%0";
2751 return "f<FP:round>add%.<FP:prec> %f2,%0";
2753 [(set_attr "type" "falu")
2754 (set_attr "opy" "2")])
2756 (define_insn "add<mode>3_cf"
2757 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2758 (plus:FP (match_operand:FP 1 "general_operand" "%0")
2759 (match_operand:FP 2 "general_operand" "f<FP:dreg><Q>U")))]
2760 "TARGET_COLDFIRE_FPU"
2762 if (FP_REG_P (operands[2]))
2763 return "f<FP:prec>add%.d %2,%0";
2764 return "f<FP:prec>add%.<FP:prec> %2,%0";
2766 [(set_attr "type" "falu")
2767 (set_attr "opy" "2")])
2769 ;; subtract instructions
2771 (define_insn "subdi_sexthishl32"
2772 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,a,*d,*d")
2773 (minus:DI (match_operand:DI 1 "general_operand" "0,0,0,0")
2774 (ashift:DI (sign_extend:DI (match_operand:HI 2 "general_operand" "rm,rm,rm,rm"))
2776 (clobber (match_scratch:SI 3 "=&d,X,a,?d"))]
2780 if (ADDRESS_REG_P (operands[0]))
2781 return "sub%.w %2,%0";
2782 else if (ADDRESS_REG_P (operands[3]))
2783 return "move%.w %2,%3\;sub%.l %3,%0";
2785 return "move%.w %2,%3\;ext%.l %3\;sub%.l %3,%0";
2788 (define_insn "subdi_dishl32"
2789 [(set (match_operand:DI 0 "nonimmediate_operand" "+ro")
2790 (minus:DI (match_dup 0)
2791 (ashift:DI (match_operand:DI 1 "general_operand" "ro")
2796 if (GET_CODE (operands[1]) == REG)
2797 operands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
2799 operands[1] = adjust_address (operands[1], SImode, 4);
2800 return "sub%.l %1,%0";
2802 [(set_attr "type" "alu_l")])
2804 (define_insn "subdi3"
2805 [(set (match_operand:DI 0 "nonimmediate_operand" "=o<>,d,d,d")
2806 (minus:DI (match_operand:DI 1 "general_operand" "0,0,0,0")
2807 (match_operand:DI 2 "general_operand" "d,no>,d,a")))
2808 (clobber (match_scratch:SI 3 "=&d,&d,X,&d"))]
2811 if (DATA_REG_P (operands[0]))
2813 if (DATA_REG_P (operands[2]))
2814 return "sub%.l %R2,%R0\;subx%.l %2,%0";
2815 else if (GET_CODE (operands[2]) == MEM
2816 && GET_CODE (XEXP (operands[2], 0)) == POST_INC)
2818 return "move%.l %2,%3\;sub%.l %2,%R0\;subx%.l %3,%0";
2825 if (GET_CODE (operands[2]) == REG)
2827 low = gen_rtx_REG (SImode, REGNO (operands[2]) + 1);
2830 else if (CONSTANT_P (operands[2]))
2831 split_double (operands[2], &high, &low);
2834 low = adjust_address (operands[2], SImode, 4);
2838 operands[1] = low, operands[2] = high;
2839 xoperands[0] = operands[3];
2840 if (GET_CODE (operands[1]) == CONST_INT
2841 && INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
2842 xoperands[1] = GEN_INT (-INTVAL (operands[2]) - 1);
2844 xoperands[1] = operands[2];
2846 output_asm_insn (output_move_simode (xoperands), xoperands);
2847 if (GET_CODE (operands[1]) == CONST_INT)
2849 if (INTVAL (operands[1]) > 0 && INTVAL (operands[1]) <= 8)
2850 return "subq%.l %1,%R0\;subx%.l %3,%0";
2851 else if (INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
2853 operands[1] = GEN_INT (-INTVAL (operands[1]));
2854 return "addq%.l %1,%R0\;addx%.l %3,%0";
2857 return "sub%.l %1,%R0\;subx%.l %3,%0";
2862 gcc_assert (GET_CODE (operands[0]) == MEM);
2864 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
2867 = gen_rtx_MEM (SImode, plus_constant (XEXP (operands[0], 0), -8));
2868 return "move%.l %0,%3\;sub%.l %R2,%0\;subx%.l %2,%3\;move%.l %3,%1";
2870 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
2872 operands[1] = XEXP(operands[0], 0);
2873 return "sub%.l %R2,%0\;move%.l %0,%3\;subx%.l %2,%3\;move%.l %3,%1";
2877 operands[1] = adjust_address (operands[0], SImode, 4);
2878 return "sub%.l %R2,%1\;move%.l %0,%3\;subx%.l %2,%3\;move%.l %3,%0";
2883 (define_insn "subsi3"
2884 [(set (match_operand:SI 0 "nonimmediate_operand" "=mda,m,d,a")
2885 (minus:SI (match_operand:SI 1 "general_operand" "0,0,0,0")
2886 (match_operand:SI 2 "general_src_operand" "I,dT,mSrT,mSrs")))]
2893 [(set_attr "type" "aluq_l,alu_l,alu_l,alu_l")
2894 (set_attr "opy" "2")])
2897 [(set (match_operand:SI 0 "nonimmediate_operand" "=a")
2898 (minus:SI (match_operand:SI 1 "general_operand" "0")
2900 (match_operand:HI 2 "nonimmediate_src_operand" "rmS"))))]
2904 (define_insn "subhi3"
2905 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,r")
2906 (minus:HI (match_operand:HI 1 "general_operand" "0,0")
2907 (match_operand:HI 2 "general_src_operand" "dn,rmSn")))]
2912 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
2913 (minus:HI (match_dup 0)
2914 (match_operand:HI 1 "general_src_operand" "dn,rmSn")))]
2918 (define_insn "subqi3"
2919 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
2920 (minus:QI (match_operand:QI 1 "general_operand" "0,0")
2921 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
2926 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
2927 (minus:QI (match_dup 0)
2928 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
2932 (define_expand "sub<mode>3"
2933 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2934 (minus:FP (match_operand:FP 1 "general_operand" "")
2935 (match_operand:FP 2 "general_operand" "")))]
2939 (define_insn "sub<mode>3_floatsi_68881"
2940 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2941 (minus:FP (match_operand:FP 1 "general_operand" "0")
2942 (float:FP (match_operand:SI 2 "general_operand" "dmi"))))]
2944 "f<FP:round>sub%.l %2,%0"
2945 [(set_attr "type" "falu")
2946 (set_attr "opy" "2")])
2948 (define_insn "sub<mode>3_floathi_68881"
2949 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2950 (minus:FP (match_operand:FP 1 "general_operand" "0")
2951 (float:FP (match_operand:HI 2 "general_operand" "dmn"))))]
2953 "f<FP:round>sub%.w %2,%0"
2954 [(set_attr "type" "falu")
2955 (set_attr "opy" "2")])
2957 (define_insn "sub<mode>3_floatqi_68881"
2958 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2959 (minus:FP (match_operand:FP 1 "general_operand" "0")
2960 (float:FP (match_operand:QI 2 "general_operand" "dmn"))))]
2962 "f<FP:round>sub%.b %2,%0"
2963 [(set_attr "type" "falu")
2964 (set_attr "opy" "2")])
2966 (define_insn "sub<mode>3_68881"
2967 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2968 (minus:FP (match_operand:FP 1 "general_operand" "0")
2969 (match_operand:FP 2 "general_operand" "f<FP:dreg>m<FP:const>")))]
2972 if (FP_REG_P (operands[2]))
2973 return "f<FP:round>sub%.x %2,%0";
2974 return "f<FP:round>sub%.<FP:prec> %f2,%0";
2976 [(set_attr "type" "falu")
2977 (set_attr "opy" "2")])
2979 (define_insn "sub<mode>3_cf"
2980 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2981 (minus:FP (match_operand:FP 1 "general_operand" "0")
2982 (match_operand:FP 2 "general_operand" "f<FP:dreg><Q>U")))]
2983 "TARGET_COLDFIRE_FPU"
2985 if (FP_REG_P (operands[2]))
2986 return "f<FP:prec>sub%.d %2,%0";
2987 return "f<FP:prec>sub%.<FP:prec> %2,%0";
2989 [(set_attr "type" "falu")
2990 (set_attr "opy" "2")])
2992 ;; multiply instructions
2994 (define_insn "mulhi3"
2995 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
2996 (mult:HI (match_operand:HI 1 "general_operand" "%0")
2997 (match_operand:HI 2 "general_src_operand" "dmSn")))]
3000 return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0";
3002 [(set_attr "type" "mul_w")
3003 (set_attr "opy" "2")])
3005 (define_insn "mulhisi3"
3006 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3007 (mult:SI (sign_extend:SI
3008 (match_operand:HI 1 "nonimmediate_operand" "%0"))
3010 (match_operand:HI 2 "nonimmediate_src_operand" "dmS"))))]
3013 return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0";
3015 [(set_attr "type" "mul_w")
3016 (set_attr "opy" "2")])
3018 (define_insn "*mulhisisi3_s"
3019 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3020 (mult:SI (sign_extend:SI
3021 (match_operand:HI 1 "nonimmediate_operand" "%0"))
3022 (match_operand:SI 2 "const_int_operand" "n")))]
3023 "INTVAL (operands[2]) >= -0x8000 && INTVAL (operands[2]) <= 0x7fff"
3025 return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0";
3027 [(set_attr "type" "mul_w")
3028 (set_attr "opy" "2")])
3030 (define_expand "mulsi3"
3031 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3032 (mult:SI (match_operand:SI 1 "general_operand" "")
3033 (match_operand:SI 2 "general_operand" "")))]
3034 "TARGET_68020 || TARGET_COLDFIRE"
3037 (define_insn "*mulsi3_68020"
3038 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3039 (mult:SI (match_operand:SI 1 "general_operand" "%0")
3040 (match_operand:SI 2 "general_src_operand" "dmSTK")))]
3044 [(set_attr "type" "mul_l")
3045 (set_attr "opy" "2")])
3047 (define_insn "*mulsi3_cf"
3048 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3049 (mult:SI (match_operand:SI 1 "general_operand" "%0")
3050 (match_operand:SI 2 "general_operand" "d<Q>")))]
3053 [(set_attr "type" "mul_l")
3054 (set_attr "opy" "2")])
3056 (define_insn "umulhisi3"
3057 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3058 (mult:SI (zero_extend:SI
3059 (match_operand:HI 1 "nonimmediate_operand" "%0"))
3061 (match_operand:HI 2 "nonimmediate_src_operand" "dmS"))))]
3064 return MOTOROLA ? "mulu%.w %2,%0" : "mulu %2,%0";
3066 [(set_attr "type" "mul_w")
3067 (set_attr "opy" "2")])
3069 (define_insn "*mulhisisi3_z"
3070 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3071 (mult:SI (zero_extend:SI
3072 (match_operand:HI 1 "nonimmediate_operand" "%0"))
3073 (match_operand:SI 2 "const_int_operand" "n")))]
3074 "INTVAL (operands[2]) >= 0 && INTVAL (operands[2]) <= 0xffff"
3076 return MOTOROLA ? "mulu%.w %2,%0" : "mulu %2,%0";
3078 [(set_attr "type" "mul_w")
3079 (set_attr "opy" "2")])
3081 ;; We need a separate DEFINE_EXPAND for u?mulsidi3 to be able to use the
3082 ;; proper matching constraint. This is because the matching is between
3083 ;; the high-numbered word of the DImode operand[0] and operand[1].
3084 (define_expand "umulsidi3"
3086 [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 4)
3087 (mult:SI (match_operand:SI 1 "register_operand" "")
3088 (match_operand:SI 2 "register_operand" "")))
3089 (set (subreg:SI (match_dup 0) 0)
3090 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
3091 (zero_extend:DI (match_dup 2)))
3092 (const_int 32))))])]
3093 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3097 [(set (match_operand:SI 0 "register_operand" "=d")
3098 (mult:SI (match_operand:SI 1 "register_operand" "%0")
3099 (match_operand:SI 2 "nonimmediate_operand" "dm")))
3100 (set (match_operand:SI 3 "register_operand" "=d")
3101 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
3102 (zero_extend:DI (match_dup 2)))
3104 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3107 ; Match immediate case. For 2.4 only match things < 2^31.
3108 ; It's tricky with larger values in these patterns since we need to match
3109 ; values between the two parallel multiplies, between a CONST_DOUBLE and
3112 [(set (match_operand:SI 0 "register_operand" "=d")
3113 (mult:SI (match_operand:SI 1 "register_operand" "%0")
3114 (match_operand:SI 2 "const_int_operand" "n")))
3115 (set (match_operand:SI 3 "register_operand" "=d")
3116 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
3119 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE
3120 && (unsigned) INTVAL (operands[2]) <= 0x7fffffff"
3123 (define_expand "mulsidi3"
3125 [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 4)
3126 (mult:SI (match_operand:SI 1 "register_operand" "")
3127 (match_operand:SI 2 "register_operand" "")))
3128 (set (subreg:SI (match_dup 0) 0)
3129 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
3130 (sign_extend:DI (match_dup 2)))
3131 (const_int 32))))])]
3132 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3136 [(set (match_operand:SI 0 "register_operand" "=d")
3137 (mult:SI (match_operand:SI 1 "register_operand" "%0")
3138 (match_operand:SI 2 "nonimmediate_operand" "dm")))
3139 (set (match_operand:SI 3 "register_operand" "=d")
3140 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
3141 (sign_extend:DI (match_dup 2)))
3143 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3147 [(set (match_operand:SI 0 "register_operand" "=d")
3148 (mult:SI (match_operand:SI 1 "register_operand" "%0")
3149 (match_operand:SI 2 "const_int_operand" "n")))
3150 (set (match_operand:SI 3 "register_operand" "=d")
3151 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
3154 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3157 (define_expand "umulsi3_highpart"
3159 [(set (match_operand:SI 0 "register_operand" "")
3162 (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" ""))
3163 (zero_extend:DI (match_operand:SI 2 "general_operand" "")))
3165 (clobber (match_dup 3))])]
3166 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3168 operands[3] = gen_reg_rtx (SImode);
3170 if (GET_CODE (operands[2]) == CONST_INT)
3172 operands[2] = immed_double_const (INTVAL (operands[2]) & 0xffffffff,
3175 /* We have to adjust the operand order for the matching constraints. */
3176 emit_insn (gen_const_umulsi3_highpart (operands[0], operands[3],
3177 operands[1], operands[2]));
3183 [(set (match_operand:SI 0 "register_operand" "=d")
3186 (mult:DI (zero_extend:DI (match_operand:SI 2 "register_operand" "%1"))
3187 (zero_extend:DI (match_operand:SI 3 "nonimmediate_operand" "dm")))
3189 (clobber (match_operand:SI 1 "register_operand" "=d"))]
3190 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3193 (define_insn "const_umulsi3_highpart"
3194 [(set (match_operand:SI 0 "register_operand" "=d")
3197 (mult:DI (zero_extend:DI (match_operand:SI 2 "register_operand" "1"))
3198 (match_operand:DI 3 "const_uint32_operand" "n"))
3200 (clobber (match_operand:SI 1 "register_operand" "=d"))]
3201 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3204 (define_expand "smulsi3_highpart"
3206 [(set (match_operand:SI 0 "register_operand" "")
3209 (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" ""))
3210 (sign_extend:DI (match_operand:SI 2 "general_operand" "")))
3212 (clobber (match_dup 3))])]
3213 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3215 operands[3] = gen_reg_rtx (SImode);
3216 if (GET_CODE (operands[2]) == CONST_INT)
3218 /* We have to adjust the operand order for the matching constraints. */
3219 emit_insn (gen_const_smulsi3_highpart (operands[0], operands[3],
3220 operands[1], operands[2]));
3226 [(set (match_operand:SI 0 "register_operand" "=d")
3229 (mult:DI (sign_extend:DI (match_operand:SI 2 "register_operand" "%1"))
3230 (sign_extend:DI (match_operand:SI 3 "nonimmediate_operand" "dm")))
3232 (clobber (match_operand:SI 1 "register_operand" "=d"))]
3233 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3236 (define_insn "const_smulsi3_highpart"
3237 [(set (match_operand:SI 0 "register_operand" "=d")
3240 (mult:DI (sign_extend:DI (match_operand:SI 2 "register_operand" "1"))
3241 (match_operand:DI 3 "const_sint32_operand" "n"))
3243 (clobber (match_operand:SI 1 "register_operand" "=d"))]
3244 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3247 (define_expand "mul<mode>3"
3248 [(set (match_operand:FP 0 "nonimmediate_operand" "")
3249 (mult:FP (match_operand:FP 1 "general_operand" "")
3250 (match_operand:FP 2 "general_operand" "")))]
3254 (define_insn "mul<mode>3_floatsi_68881"
3255 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3256 (mult:FP (float:FP (match_operand:SI 2 "general_operand" "dmi"))
3257 (match_operand:FP 1 "general_operand" "0")))]
3261 ? "f<FP:round>mul%.l %2,%0"
3262 : "f<FP:round_mul>mul%.l %2,%0";
3264 [(set_attr "type" "fmul")
3265 (set_attr "opy" "2")])
3267 (define_insn "mul<mode>3_floathi_68881"
3268 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3269 (mult:FP (float:FP (match_operand:HI 2 "general_operand" "dmn"))
3270 (match_operand:FP 1 "general_operand" "0")))]
3274 ? "f<FP:round>mul%.w %2,%0"
3275 : "f<FP:round_mul>mul%.w %2,%0";
3277 [(set_attr "type" "fmul")
3278 (set_attr "opy" "2")])
3280 (define_insn "mul<mode>3_floatqi_68881"
3281 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3282 (mult:FP (float:FP (match_operand:QI 2 "general_operand" "dmn"))
3283 (match_operand:FP 1 "general_operand" "0")))]
3287 ? "f<FP:round>mul%.b %2,%0"
3288 : "f<FP:round_mul>mul%.b %2,%0";
3290 [(set_attr "type" "fmul")
3291 (set_attr "opy" "2")])
3293 (define_insn "muldf_68881"
3294 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
3295 (mult:DF (match_operand:DF 1 "general_operand" "%0")
3296 (match_operand:DF 2 "general_operand" "fmG")))]
3299 if (GET_CODE (operands[2]) == CONST_DOUBLE
3300 && floating_exact_log2 (operands[2]) && !TUNE_68040_60)
3302 int i = floating_exact_log2 (operands[2]);
3303 operands[2] = GEN_INT (i);
3304 return "fscale%.l %2,%0";
3306 if (REG_P (operands[2]))
3307 return "f%&mul%.x %2,%0";
3308 return "f%&mul%.d %f2,%0";
3311 (define_insn "mulsf_68881"
3312 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
3313 (mult:SF (match_operand:SF 1 "general_operand" "%0")
3314 (match_operand:SF 2 "general_operand" "fdmF")))]
3317 if (FP_REG_P (operands[2]))
3318 return (TARGET_68040
3320 : "fsglmul%.x %2,%0");
3321 return (TARGET_68040
3323 : "fsglmul%.s %f2,%0");
3326 (define_insn "mulxf3_68881"
3327 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
3328 (mult:XF (match_operand:XF 1 "nonimmediate_operand" "%0")
3329 (match_operand:XF 2 "nonimmediate_operand" "fm")))]
3332 return "fmul%.x %f2,%0";
3335 (define_insn "fmul<mode>3_cf"
3336 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3337 (mult:FP (match_operand:FP 1 "general_operand" "%0")
3338 (match_operand:FP 2 "general_operand" "f<Q>U<FP:dreg>")))]
3339 "TARGET_COLDFIRE_FPU"
3341 if (FP_REG_P (operands[2]))
3342 return "f<FP:prec>mul%.d %2,%0";
3343 return "f<FP:prec>mul%.<FP:prec> %2,%0";
3345 [(set_attr "type" "fmul")
3346 (set_attr "opy" "2")])
3348 ;; divide instructions
3350 (define_expand "div<mode>3"
3351 [(set (match_operand:FP 0 "nonimmediate_operand" "")
3352 (div:FP (match_operand:FP 1 "general_operand" "")
3353 (match_operand:FP 2 "general_operand" "")))]
3357 (define_insn "div<mode>3_floatsi_68881"
3358 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3359 (div:FP (match_operand:FP 1 "general_operand" "0")
3360 (float:FP (match_operand:SI 2 "general_operand" "dmi"))))]
3364 ? "f<FP:round>div%.l %2,%0"
3365 : "f<FP:round_mul>div%.l %2,%0";
3368 (define_insn "div<mode>3_floathi_68881"
3369 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3370 (div:FP (match_operand:FP 1 "general_operand" "0")
3371 (float:FP (match_operand:HI 2 "general_operand" "dmn"))))]
3375 ? "f<FP:round>div%.w %2,%0"
3376 : "f<FP:round_mul>div%.w %2,%0";
3379 (define_insn "div<mode>3_floatqi_68881"
3380 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3381 (div:FP (match_operand:FP 1 "general_operand" "0")
3382 (float:FP (match_operand:QI 2 "general_operand" "dmn"))))]
3386 ? "f<FP:round>div%.b %2,%0"
3387 : "f<FP:round_mul>div%.b %2,%0";
3390 (define_insn "div<mode>3_68881"
3391 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3392 (div:FP (match_operand:FP 1 "general_operand" "0")
3393 (match_operand:FP 2 "general_operand" "f<FP:dreg>m<FP:const>")))]
3396 if (FP_REG_P (operands[2]))
3397 return (TARGET_68040
3398 ? "f<FP:round>div%.x %2,%0"
3399 : "f<FP:round_mul>div%.x %2,%0");
3400 return (TARGET_68040
3401 ? "f<FP:round>div%.<FP:prec> %f2,%0"
3402 : "f<FP:round_mul>div%.<FP:prec> %f2,%0");
3405 (define_insn "div<mode>3_cf"
3406 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3407 (div:FP (match_operand:FP 1 "general_operand" "0")
3408 (match_operand:FP 2 "general_operand" "f<Q>U<FP:dreg>")))]
3409 "TARGET_COLDFIRE_FPU"
3411 if (FP_REG_P (operands[2]))
3412 return "f<FP:prec>div%.d %2,%0";
3413 return "f<FP:prec>div%.<FP:prec> %2,%0";
3415 [(set_attr "type" "fdiv")
3416 (set_attr "opy" "2")])
3418 ;; Remainder instructions.
3420 (define_expand "divmodsi4"
3422 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3423 (div:SI (match_operand:SI 1 "general_operand" "")
3424 (match_operand:SI 2 "general_src_operand" "")))
3425 (set (match_operand:SI 3 "nonimmediate_operand" "")
3426 (mod:SI (match_dup 1) (match_dup 2)))])]
3427 "TARGET_68020 || TARGET_CF_HWDIV"
3431 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3432 (div:SI (match_operand:SI 1 "general_operand" "0")
3433 (match_operand:SI 2 "general_src_operand" "d<Q>U")))
3434 (set (match_operand:SI 3 "nonimmediate_operand" "=&d")
3435 (mod:SI (match_dup 1) (match_dup 2)))]
3438 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3439 return "divs%.l %2,%0";
3440 else if (find_reg_note (insn, REG_UNUSED, operands[0]))
3441 return "rems%.l %2,%3:%0";
3443 return "rems%.l %2,%3:%0\;divs%.l %2,%0";
3445 [(set_attr "type" "div_l")
3446 (set_attr "opy" "2")])
3449 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3450 (div:SI (match_operand:SI 1 "general_operand" "0")
3451 (match_operand:SI 2 "general_src_operand" "dmSTK")))
3452 (set (match_operand:SI 3 "nonimmediate_operand" "=d")
3453 (mod:SI (match_dup 1) (match_dup 2)))]
3456 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3457 return "divs%.l %2,%0";
3459 return "divsl%.l %2,%3:%0";
3462 (define_expand "udivmodsi4"
3464 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3465 (udiv:SI (match_operand:SI 1 "general_operand" "0")
3466 (match_operand:SI 2 "general_src_operand" "dmSTK")))
3467 (set (match_operand:SI 3 "nonimmediate_operand" "=d")
3468 (umod:SI (match_dup 1) (match_dup 2)))])]
3469 "TARGET_68020 || TARGET_CF_HWDIV"
3473 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3474 (udiv:SI (match_operand:SI 1 "general_operand" "0")
3475 (match_operand:SI 2 "general_src_operand" "d<Q>U")))
3476 (set (match_operand:SI 3 "nonimmediate_operand" "=&d")
3477 (umod:SI (match_dup 1) (match_dup 2)))]
3480 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3481 return "divu%.l %2,%0";
3482 else if (find_reg_note (insn, REG_UNUSED, operands[0]))
3483 return "remu%.l %2,%3:%0";
3485 return "remu%.l %2,%3:%0\;divu%.l %2,%0";
3487 [(set_attr "type" "div_l")
3488 (set_attr "opy" "2")])
3491 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3492 (udiv:SI (match_operand:SI 1 "general_operand" "0")
3493 (match_operand:SI 2 "general_src_operand" "dmSTK")))
3494 (set (match_operand:SI 3 "nonimmediate_operand" "=d")
3495 (umod:SI (match_dup 1) (match_dup 2)))]
3496 "TARGET_68020 && !TARGET_COLDFIRE"
3498 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3499 return "divu%.l %2,%0";
3501 return "divul%.l %2,%3:%0";
3504 (define_insn "divmodhi4"
3505 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
3506 (div:HI (match_operand:HI 1 "general_operand" "0")
3507 (match_operand:HI 2 "general_src_operand" "dmSKT")))
3508 (set (match_operand:HI 3 "nonimmediate_operand" "=d")
3509 (mod:HI (match_dup 1) (match_dup 2)))]
3510 "!TARGET_COLDFIRE || TARGET_CF_HWDIV"
3512 output_asm_insn (MOTOROLA ?
3513 "ext%.l %0\;divs%.w %2,%0" :
3514 "extl %0\;divs %2,%0",
3516 if (!find_reg_note(insn, REG_UNUSED, operands[3]))
3519 return "move%.l %0,%3\;swap %3";
3525 (define_insn "udivmodhi4"
3526 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
3527 (udiv:HI (match_operand:HI 1 "general_operand" "0")
3528 (match_operand:HI 2 "general_src_operand" "dmSKT")))
3529 (set (match_operand:HI 3 "nonimmediate_operand" "=d")
3530 (umod:HI (match_dup 1) (match_dup 2)))]
3531 "!TARGET_COLDFIRE || TARGET_CF_HWDIV"
3533 if (ISA_HAS_MVS_MVZ)
3534 output_asm_insn (MOTOROLA ?
3535 "mvz%.w %0,%0\;divu%.w %2,%0" :
3536 "mvz%.w %0,%0\;divu %2,%0",
3539 output_asm_insn (MOTOROLA ?
3540 "and%.l #0xFFFF,%0\;divu%.w %2,%0" :
3541 "and%.l #0xFFFF,%0\;divu %2,%0",
3544 if (!find_reg_note(insn, REG_UNUSED, operands[3]))
3547 return "move%.l %0,%3\;swap %3";
3553 ;; logical-and instructions
3555 ;; "anddi3" is mainly here to help combine().
3556 (define_insn "anddi3"
3557 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,d")
3558 (and:DI (match_operand:DI 1 "general_operand" "%0,0")
3559 (match_operand:DI 2 "general_operand" "dn,don")))]
3563 /* We can get CONST_DOUBLE, but also const1_rtx etc. */
3564 if (CONSTANT_P (operands[2]))
3568 split_double (operands[2], &hi, &lo);
3570 switch (INTVAL (hi))
3573 output_asm_insn ("clr%.l %0", operands);
3581 xoperands[0] = operands[0];
3583 output_asm_insn (output_andsi3 (xoperands), xoperands);
3586 if (GET_CODE (operands[0]) == REG)
3587 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3589 operands[0] = adjust_address (operands[0], SImode, 4);
3590 switch (INTVAL (lo))
3593 output_asm_insn ("clr%.l %0", operands);
3601 xoperands[0] = operands[0];
3603 output_asm_insn (output_andsi3 (xoperands), xoperands);
3608 if (GET_CODE (operands[0]) != REG)
3610 operands[1] = adjust_address (operands[0], SImode, 4);
3611 return "and%.l %2,%0\;and%.l %R2,%1";
3613 if (GET_CODE (operands[2]) != REG)
3615 operands[1] = adjust_address (operands[2], SImode, 4);
3616 return "and%.l %2,%0\;and%.l %1,%R0";
3618 return "and%.l %2,%0\;and%.l %R2,%R0";
3621 ;; Prevent AND from being made with sp. This doesn't exist in the machine
3622 ;; and reload will cause inefficient code. Since sp is a FIXED_REG, we
3623 ;; can't allocate pseudos into it.
3625 (define_expand "andsi3"
3626 [(set (match_operand:SI 0 "not_sp_operand" "")
3627 (and:SI (match_operand:SI 1 "general_operand" "")
3628 (match_operand:SI 2 "general_src_operand" "")))]
3632 ;; produced by split operations after reload finished
3633 (define_insn "*andsi3_split"
3634 [(set (match_operand:SI 0 "register_operand" "=d")
3635 (and:SI (match_operand:SI 1 "register_operand" "0")
3636 (match_operand:SI 2 "const_int_operand" "i")))]
3637 "reload_completed && !TARGET_COLDFIRE"
3639 return output_andsi3 (operands);
3642 (define_insn "andsi3_internal"
3643 [(set (match_operand:SI 0 "not_sp_operand" "=m,d")
3644 (and:SI (match_operand:SI 1 "general_operand" "%0,0")
3645 (match_operand:SI 2 "general_src_operand" "dKT,dmSM")))]
3648 return output_andsi3 (operands);
3651 (define_insn "andsi3_5200"
3652 [(set (match_operand:SI 0 "not_sp_operand" "=m,d")
3653 (and:SI (match_operand:SI 1 "general_operand" "%0,0")
3654 (match_operand:SI 2 "general_src_operand" "d,dmsK")))]
3658 && DATA_REG_P (operands[0])
3659 && GET_CODE (operands[2]) == CONST_INT)
3661 if (INTVAL (operands[2]) == 0x000000ff)
3662 return "mvz%.b %0,%0";
3663 else if (INTVAL (operands[2]) == 0x0000ffff)
3664 return "mvz%.w %0,%0";
3666 return output_andsi3 (operands);
3669 (define_insn "andhi3"
3670 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,d")
3671 (and:HI (match_operand:HI 1 "general_operand" "%0,0")
3672 (match_operand:HI 2 "general_src_operand" "dn,dmSn")))]
3677 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3678 (and:HI (match_dup 0)
3679 (match_operand:HI 1 "general_src_operand" "dn,dmSn")))]
3684 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3685 (and:HI (match_operand:HI 1 "general_src_operand" "dn,dmSn")
3690 (define_insn "andqi3"
3691 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
3692 (and:QI (match_operand:QI 1 "general_operand" "%0,0")
3693 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
3698 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3699 (and:QI (match_dup 0)
3700 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
3705 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3706 (and:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn")
3711 ;; inclusive-or instructions
3713 (define_insn "iordi_zext"
3714 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,d")
3715 (ior:DI (zero_extend:DI (match_operand 1 "general_operand" "dn,dmn"))
3716 (match_operand:DI 2 "general_operand" "0,0")))]
3722 if (GET_CODE (operands[0]) == REG)
3723 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3725 operands[0] = adjust_address (operands[0], SImode, 4);
3726 if (GET_MODE (operands[1]) == SImode)
3727 return "or%.l %1,%0";
3728 byte_mode = (GET_MODE (operands[1]) == QImode);
3729 if (GET_CODE (operands[0]) == MEM)
3730 operands[0] = adjust_address (operands[0], byte_mode ? QImode : HImode,
3733 return "or%.b %1,%0";
3735 return "or%.w %1,%0";
3738 ;; "iordi3" is mainly here to help combine().
3739 (define_insn "iordi3"
3740 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,d")
3741 (ior:DI (match_operand:DI 1 "general_operand" "%0,0")
3742 (match_operand:DI 2 "general_operand" "dn,don")))]
3746 /* We can get CONST_DOUBLE, but also const1_rtx etc. */
3747 if (CONSTANT_P (operands[2]))
3751 split_double (operands[2], &hi, &lo);
3753 switch (INTVAL (hi))
3758 /* FIXME : a scratch register would be welcome here if operand[0]
3759 is not a register */
3760 output_asm_insn ("move%.l #-1,%0", operands);
3766 xoperands[0] = operands[0];
3768 output_asm_insn (output_iorsi3 (xoperands), xoperands);
3771 if (GET_CODE (operands[0]) == REG)
3772 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3774 operands[0] = adjust_address (operands[0], SImode, 4);
3775 switch (INTVAL (lo))
3780 /* FIXME : a scratch register would be welcome here if operand[0]
3781 is not a register */
3782 output_asm_insn ("move%.l #-1,%0", operands);
3788 xoperands[0] = operands[0];
3790 output_asm_insn (output_iorsi3 (xoperands), xoperands);
3795 if (GET_CODE (operands[0]) != REG)
3797 operands[1] = adjust_address (operands[0], SImode, 4);
3798 return "or%.l %2,%0\;or%.l %R2,%1";
3800 if (GET_CODE (operands[2]) != REG)
3802 operands[1] = adjust_address (operands[2], SImode, 4);
3803 return "or%.l %2,%0\;or%.l %1,%R0";
3805 return "or%.l %2,%0\;or%.l %R2,%R0";
3808 (define_expand "iorsi3"
3809 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3810 (ior:SI (match_operand:SI 1 "general_operand" "")
3811 (match_operand:SI 2 "general_src_operand" "")))]
3815 (define_insn "iorsi3_internal"
3816 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,d")
3817 (ior:SI (match_operand:SI 1 "general_operand" "%0,0")
3818 (match_operand:SI 2 "general_src_operand" "dKT,dmSMT")))]
3821 return output_iorsi3 (operands);
3824 (define_insn "iorsi3_5200"
3825 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,d")
3826 (ior:SI (match_operand:SI 1 "general_operand" "%0,0")
3827 (match_operand:SI 2 "general_src_operand" "d,dmsK")))]
3830 return output_iorsi3 (operands);
3833 (define_insn "iorhi3"
3834 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,d")
3835 (ior:HI (match_operand:HI 1 "general_operand" "%0,0")
3836 (match_operand:HI 2 "general_src_operand" "dn,dmSn")))]
3841 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3842 (ior:HI (match_dup 0)
3843 (match_operand:HI 1 "general_src_operand" "dn,dmSn")))]
3848 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3849 (ior:HI (match_operand:HI 1 "general_src_operand" "dn,dmSn")
3854 (define_insn "iorqi3"
3855 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
3856 (ior:QI (match_operand:QI 1 "general_operand" "%0,0")
3857 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
3862 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3863 (ior:QI (match_dup 0)
3864 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
3869 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3870 (ior:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn")
3875 ;; On all 68k models, this makes faster code in a special case.
3876 ;; See also ashlsi_16, ashrsi_16 and lshrsi_16.
3878 (define_insn "iorsi_zexthi_ashl16"
3879 [(set (match_operand:SI 0 "nonimmediate_operand" "=&d")
3880 (ior:SI (zero_extend:SI (match_operand:HI 1 "general_operand" "rmn"))
3881 (ashift:SI (match_operand:SI 2 "general_operand" "or")
3886 if (GET_CODE (operands[2]) != REG)
3887 operands[2] = adjust_address (operands[2], HImode, 2);
3888 if (GET_CODE (operands[2]) != REG
3889 || REGNO (operands[2]) != REGNO (operands[0]))
3890 output_asm_insn ("move%.w %2,%0", operands);
3891 return "swap %0\;mov%.w %1,%0";
3894 (define_insn "iorsi_zext"
3895 [(set (match_operand:SI 0 "nonimmediate_operand" "=o,d")
3896 (ior:SI (zero_extend:SI (match_operand 1 "general_operand" "dn,dmn"))
3897 (match_operand:SI 2 "general_operand" "0,0")))]
3903 byte_mode = (GET_MODE (operands[1]) == QImode);
3904 if (GET_CODE (operands[0]) == MEM)
3905 operands[0] = adjust_address (operands[0], byte_mode ? QImode : HImode,
3908 return "or%.b %1,%0";
3910 return "or%.w %1,%0";
3915 ;; "xordi3" is mainly here to help combine().
3916 (define_insn "xordi3"
3917 [(set (match_operand:DI 0 "nonimmediate_operand" "=od")
3918 (xor:DI (match_operand:DI 1 "general_operand" "%0")
3919 (match_operand:DI 2 "general_operand" "dn")))]
3923 /* We can get CONST_DOUBLE, but also const1_rtx etc. */
3925 if (CONSTANT_P (operands[2]))
3929 split_double (operands[2], &hi, &lo);
3931 switch (INTVAL (hi))
3936 output_asm_insn ("not%.l %0", operands);
3939 /* FIXME : a scratch register would be welcome here if
3940 -128 <= INTVAL (hi) < -1 */
3944 xoperands[0] = operands[0];
3946 output_asm_insn (output_xorsi3 (xoperands), xoperands);
3949 if (GET_CODE (operands[0]) == REG)
3950 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3952 operands[0] = adjust_address (operands[0], SImode, 4);
3953 switch (INTVAL (lo))
3958 output_asm_insn ("not%.l %0", operands);
3961 /* FIXME : a scratch register would be welcome here if
3962 -128 <= INTVAL (lo) < -1 */
3964 /* FIXME : this should be merged with xorsi3 */
3968 xoperands[0] = operands[0];
3970 output_asm_insn (output_xorsi3 (xoperands), xoperands);
3975 if (GET_CODE (operands[0]) != REG)
3977 operands[1] = adjust_address (operands[0], SImode, 4);
3978 return "eor%.l %2,%0\;eor%.l %R2,%1";
3980 if (GET_CODE (operands[2]) != REG)
3982 operands[1] = adjust_address (operands[2], SImode, 4);
3983 return "eor%.l %2,%0\;eor%.l %1,%R0";
3985 return "eor%.l %2,%0\;eor%.l %R2,%R0";
3988 (define_expand "xorsi3"
3989 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3990 (xor:SI (match_operand:SI 1 "general_operand" "")
3991 (match_operand:SI 2 "general_operand" "")))]
3995 (define_insn "xorsi3_internal"
3996 [(set (match_operand:SI 0 "nonimmediate_operand" "=do,m")
3997 (xor:SI (match_operand:SI 1 "general_operand" "%0,0")
3998 (match_operand:SI 2 "general_operand" "di,dKT")))]
4002 return output_xorsi3 (operands);
4005 (define_insn "xorsi3_5200"
4006 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm,d")
4007 (xor:SI (match_operand:SI 1 "general_operand" "%0,0")
4008 (match_operand:SI 2 "general_operand" "d,Ks")))]
4011 return output_xorsi3 (operands);
4014 (define_insn "xorhi3"
4015 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
4016 (xor:HI (match_operand:HI 1 "general_operand" "%0")
4017 (match_operand:HI 2 "general_operand" "dn")))]
4022 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
4023 (xor:HI (match_dup 0)
4024 (match_operand:HI 1 "general_operand" "dn")))]
4029 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
4030 (xor:HI (match_operand:HI 1 "general_operand" "dn")
4035 (define_insn "xorqi3"
4036 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
4037 (xor:QI (match_operand:QI 1 "general_operand" "%0")
4038 (match_operand:QI 2 "general_operand" "dn")))]
4043 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
4044 (xor:QI (match_dup 0)
4045 (match_operand:QI 1 "general_operand" "dn")))]
4050 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
4051 (xor:QI (match_operand:QI 1 "general_operand" "dn")
4056 ;; negation instructions
4058 (define_expand "negdi2"
4059 [(set (match_operand:DI 0 "nonimmediate_operand" "")
4060 (neg:DI (match_operand:DI 1 "general_operand" "")))]
4063 if (TARGET_COLDFIRE)
4064 emit_insn (gen_negdi2_5200 (operands[0], operands[1]));
4066 emit_insn (gen_negdi2_internal (operands[0], operands[1]));
4070 (define_insn "negdi2_internal"
4071 [(set (match_operand:DI 0 "nonimmediate_operand" "=<,do,!*a")
4072 (neg:DI (match_operand:DI 1 "general_operand" "0,0,0")))]
4075 if (which_alternative == 0)
4076 return "neg%.l %0\;negx%.l %0";
4077 if (GET_CODE (operands[0]) == REG)
4078 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4080 operands[1] = adjust_address (operands[0], SImode, 4);
4081 if (ADDRESS_REG_P (operands[0]))
4082 return "exg %/d0,%1\;neg%.l %/d0\;exg %/d0,%1\;exg %/d0,%0\;negx%.l %/d0\;exg %/d0,%0";
4084 return "neg%.l %1\;negx%.l %0";
4087 (define_insn "negdi2_5200"
4088 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
4089 (neg:DI (match_operand:DI 1 "general_operand" "0")))]
4092 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4093 return "neg%.l %1\;negx%.l %0";
4096 (define_expand "negsi2"
4097 [(set (match_operand:SI 0 "nonimmediate_operand" "")
4098 (neg:SI (match_operand:SI 1 "general_operand" "")))]
4101 if (TARGET_COLDFIRE)
4102 emit_insn (gen_negsi2_5200 (operands[0], operands[1]));
4104 emit_insn (gen_negsi2_internal (operands[0], operands[1]));
4108 (define_insn "negsi2_internal"
4109 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
4110 (neg:SI (match_operand:SI 1 "general_operand" "0")))]
4113 [(set_attr "type" "neg_l")])
4115 (define_insn "negsi2_5200"
4116 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
4117 (neg:SI (match_operand:SI 1 "general_operand" "0")))]
4120 [(set_attr "type" "neg_l")])
4122 (define_insn "neghi2"
4123 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
4124 (neg:HI (match_operand:HI 1 "general_operand" "0")))]
4129 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
4130 (neg:HI (match_dup 0)))]
4134 (define_insn "negqi2"
4135 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
4136 (neg:QI (match_operand:QI 1 "general_operand" "0")))]
4141 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
4142 (neg:QI (match_dup 0)))]
4146 ;; If using software floating point, just flip the sign bit.
4148 (define_expand "negsf2"
4149 [(set (match_operand:SF 0 "nonimmediate_operand" "")
4150 (neg:SF (match_operand:SF 1 "general_operand" "")))]
4153 if (!TARGET_HARD_FLOAT)
4158 target = operand_subword_force (operands[0], 0, SFmode);
4159 result = expand_binop (SImode, xor_optab,
4160 operand_subword_force (operands[1], 0, SFmode),
4161 GEN_INT (-2147483647 - 1), target, 0, OPTAB_WIDEN);
4162 gcc_assert (result);
4164 if (result != target)
4165 emit_move_insn (result, target);
4167 /* Make a place for REG_EQUAL. */
4168 emit_move_insn (operands[0], operands[0]);
4173 (define_expand "negdf2"
4174 [(set (match_operand:DF 0 "nonimmediate_operand" "")
4175 (neg:DF (match_operand:DF 1 "general_operand" "")))]
4178 if (!TARGET_HARD_FLOAT)
4185 target = operand_subword (operands[0], 0, 1, DFmode);
4186 result = expand_binop (SImode, xor_optab,
4187 operand_subword_force (operands[1], 0, DFmode),
4188 GEN_INT (-2147483647 - 1), target, 0, OPTAB_WIDEN);
4189 gcc_assert (result);
4191 if (result != target)
4192 emit_move_insn (result, target);
4194 emit_move_insn (operand_subword (operands[0], 1, 1, DFmode),
4195 operand_subword_force (operands[1], 1, DFmode));
4197 insns = get_insns ();
4205 (define_expand "negxf2"
4206 [(set (match_operand:XF 0 "nonimmediate_operand" "")
4207 (neg:XF (match_operand:XF 1 "nonimmediate_operand" "")))]
4217 target = operand_subword (operands[0], 0, 1, XFmode);
4218 result = expand_binop (SImode, xor_optab,
4219 operand_subword_force (operands[1], 0, XFmode),
4220 GEN_INT (-2147483647 - 1), target, 0, OPTAB_WIDEN);
4221 gcc_assert (result);
4223 if (result != target)
4224 emit_move_insn (result, target);
4226 emit_move_insn (operand_subword (operands[0], 1, 1, XFmode),
4227 operand_subword_force (operands[1], 1, XFmode));
4228 emit_move_insn (operand_subword (operands[0], 2, 1, XFmode),
4229 operand_subword_force (operands[1], 2, XFmode));
4231 insns = get_insns ();
4239 (define_insn "neg<mode>2_68881"
4240 [(set (match_operand:FP 0 "nonimmediate_operand" "=f,d")
4241 (neg:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m<FP:const>,0")))]
4244 if (DATA_REG_P (operands[0]))
4246 operands[1] = GEN_INT (31);
4247 return "bchg %1,%0";
4249 if (FP_REG_P (operands[1]))
4250 return "f<FP:round>neg%.x %1,%0";
4251 return "f<FP:round>neg%.<FP:prec> %f1,%0";
4254 (define_insn "neg<mode>2_cf"
4255 [(set (match_operand:FP 0 "nonimmediate_operand" "=f,d")
4256 (neg:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U,0")))]
4257 "TARGET_COLDFIRE_FPU"
4259 if (DATA_REG_P (operands[0]))
4261 operands[1] = GEN_INT (31);
4262 return "bchg %1,%0";
4264 if (FP_REG_P (operands[1]))
4265 return "f<FP:prec>neg%.d %1,%0";
4266 return "f<FP:prec>neg%.<FP:prec> %1,%0";
4269 ;; Sqrt instruction for the 68881
4271 (define_expand "sqrt<mode>2"
4272 [(set (match_operand:FP 0 "nonimmediate_operand" "")
4273 (sqrt:FP (match_operand:FP 1 "general_operand" "")))]
4277 (define_insn "sqrt<mode>2_68881"
4278 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
4279 (sqrt:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m")))]
4282 if (FP_REG_P (operands[1]))
4283 return "f<FP:round>sqrt%.x %1,%0";
4284 return "f<FP:round>sqrt%.<FP:prec> %1,%0";
4286 [(set_attr "type" "fsqrt")])
4288 (define_insn "sqrt<mode>2_cf"
4289 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
4290 (sqrt:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U")))]
4291 "TARGET_COLDFIRE_FPU"
4293 if (FP_REG_P (operands[1]))
4294 return "f<FP:prec>sqrt%.d %1,%0";
4295 return "f<FP:prec>sqrt%.<FP:prec> %1,%0";
4297 [(set_attr "type" "fsqrt")])
4298 ;; Absolute value instructions
4299 ;; If using software floating point, just zero the sign bit.
4301 (define_expand "abssf2"
4302 [(set (match_operand:SF 0 "nonimmediate_operand" "")
4303 (abs:SF (match_operand:SF 1 "general_operand" "")))]
4306 if (!TARGET_HARD_FLOAT)
4311 target = operand_subword_force (operands[0], 0, SFmode);
4312 result = expand_binop (SImode, and_optab,
4313 operand_subword_force (operands[1], 0, SFmode),
4314 GEN_INT (0x7fffffff), target, 0, OPTAB_WIDEN);
4315 gcc_assert (result);
4317 if (result != target)
4318 emit_move_insn (result, target);
4320 /* Make a place for REG_EQUAL. */
4321 emit_move_insn (operands[0], operands[0]);
4326 (define_expand "absdf2"
4327 [(set (match_operand:DF 0 "nonimmediate_operand" "")
4328 (abs:DF (match_operand:DF 1 "general_operand" "")))]
4331 if (!TARGET_HARD_FLOAT)
4338 target = operand_subword (operands[0], 0, 1, DFmode);
4339 result = expand_binop (SImode, and_optab,
4340 operand_subword_force (operands[1], 0, DFmode),
4341 GEN_INT (0x7fffffff), target, 0, OPTAB_WIDEN);
4342 gcc_assert (result);
4344 if (result != target)
4345 emit_move_insn (result, target);
4347 emit_move_insn (operand_subword (operands[0], 1, 1, DFmode),
4348 operand_subword_force (operands[1], 1, DFmode));
4350 insns = get_insns ();
4358 (define_expand "absxf2"
4359 [(set (match_operand:XF 0 "nonimmediate_operand" "")
4360 (abs:XF (match_operand:XF 1 "nonimmediate_operand" "")))]
4370 target = operand_subword (operands[0], 0, 1, XFmode);
4371 result = expand_binop (SImode, and_optab,
4372 operand_subword_force (operands[1], 0, XFmode),
4373 GEN_INT (0x7fffffff), target, 0, OPTAB_WIDEN);
4374 gcc_assert (result);
4376 if (result != target)
4377 emit_move_insn (result, target);
4379 emit_move_insn (operand_subword (operands[0], 1, 1, XFmode),
4380 operand_subword_force (operands[1], 1, XFmode));
4381 emit_move_insn (operand_subword (operands[0], 2, 1, XFmode),
4382 operand_subword_force (operands[1], 2, XFmode));
4384 insns = get_insns ();
4392 (define_insn "abs<mode>2_68881"
4393 [(set (match_operand:FP 0 "nonimmediate_operand" "=f,d")
4394 (abs:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m<FP:const>,0")))]
4397 if (DATA_REG_P (operands[0]))
4399 operands[1] = GEN_INT (31);
4400 return "bclr %1,%0";
4402 if (FP_REG_P (operands[1]))
4403 return "f<FP:round>abs%.x %1,%0";
4404 return "f<FP:round>abs%.<FP:prec> %f1,%0";
4407 (define_insn "abs<mode>2_cf"
4408 [(set (match_operand:FP 0 "nonimmediate_operand" "=f,d")
4409 (abs:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U,0")))]
4410 "TARGET_COLDFIRE_FPU"
4412 if (DATA_REG_P (operands[0]))
4414 operands[1] = GEN_INT (31);
4415 return "bclr %1,%0";
4417 if (FP_REG_P (operands[1]))
4418 return "f<FP:prec>abs%.d %1,%0";
4419 return "f<FP:prec>abs%.<FP:prec> %1,%0";
4421 [(set_attr "type" "bitrw,fneg")])
4423 ;; bit indexing instructions
4425 ;; ColdFire ff1 instruction implements clz.
4426 (define_insn "clzsi2"
4427 [(set (match_operand:SI 0 "register_operand" "=d")
4428 (clz:SI (match_operand:SI 1 "register_operand" "0")))]
4431 [(set_attr "type" "ext")])
4433 ;; one complement instructions
4435 ;; "one_cmpldi2" is mainly here to help combine().
4436 (define_insn "one_cmpldi2"
4437 [(set (match_operand:DI 0 "nonimmediate_operand" "=dm")
4438 (not:DI (match_operand:DI 1 "general_operand" "0")))]
4442 if (GET_CODE (operands[0]) == REG)
4443 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4444 else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC
4445 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
4446 operands[1] = operands[0];
4448 operands[1] = adjust_address (operands[0], SImode, 4);
4449 return "not%.l %1\;not%.l %0";
4452 (define_expand "one_cmplsi2"
4453 [(set (match_operand:SI 0 "nonimmediate_operand" "")
4454 (not:SI (match_operand:SI 1 "general_operand" "")))]
4457 if (TARGET_COLDFIRE)
4458 emit_insn (gen_one_cmplsi2_5200 (operands[0], operands[1]));
4460 emit_insn (gen_one_cmplsi2_internal (operands[0], operands[1]));
4464 (define_insn "one_cmplsi2_internal"
4465 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
4466 (not:SI (match_operand:SI 1 "general_operand" "0")))]
4470 (define_insn "one_cmplsi2_5200"
4471 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
4472 (not:SI (match_operand:SI 1 "general_operand" "0")))]
4475 [(set_attr "type" "neg_l")])
4477 (define_insn "one_cmplhi2"
4478 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
4479 (not:HI (match_operand:HI 1 "general_operand" "0")))]
4484 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
4485 (not:HI (match_dup 0)))]
4489 (define_insn "one_cmplqi2"
4490 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
4491 (not:QI (match_operand:QI 1 "general_operand" "0")))]
4496 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
4497 (not:QI (match_dup 0)))]
4501 ;; arithmetic shift instructions
4502 ;; We don't need the shift memory by 1 bit instruction
4504 (define_insn "ashldi_extsi"
4505 [(set (match_operand:DI 0 "nonimmediate_operand" "=ro")
4507 (match_operator:DI 2 "extend_operator"
4508 [(match_operand:SI 1 "general_operand" "rm")])
4513 if (GET_CODE (operands[0]) == REG)
4514 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4516 operands[2] = adjust_address (operands[0], SImode, 4);
4517 if (ADDRESS_REG_P (operands[0]))
4518 return "move%.l %1,%0\;sub%.l %2,%2";
4520 return "move%.l %1,%0\;clr%.l %2";
4523 (define_insn "ashldi_sexthi"
4524 [(set (match_operand:DI 0 "nonimmediate_operand" "=m,a*d")
4525 (ashift:DI (sign_extend:DI (match_operand:HI 1 "general_operand" "rm,rm"))
4527 (clobber (match_scratch:SI 2 "=a,X"))]
4531 if (GET_CODE (operands[0]) == MEM)
4533 if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
4534 return "clr%.l %0\;move%.w %1,%2\;move%.l %2,%0";
4535 else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
4536 return "move%.w %1,%2\;move%.l %2,%0\;clr%.l %0";
4539 operands[3] = adjust_address (operands[0], SImode, 4);
4540 return "move%.w %1,%2\;move%.l %2,%0\;clr%.l %3";
4543 else if (DATA_REG_P (operands[0]))
4544 return "move%.w %1,%0\;ext%.l %0\;clr%.l %R0";
4546 return "move%.w %1,%0\;sub%.l %R0,%R0";
4549 (define_insn "*ashldi3_const1"
4550 [(set (match_operand:DI 0 "register_operand" "=d")
4551 (ashift:DI (match_operand:DI 1 "register_operand" "0")
4554 "add%.l %R0,%R0\;addx%.l %0,%0")
4557 [(set (match_operand:DI 0 "register_operand" "")
4558 (ashift:DI (match_operand:DI 1 "register_operand" "")
4560 "reload_completed && !TARGET_COLDFIRE"
4562 (ashift:DI (match_dup 1) (const_int 1)))
4564 (ashift:DI (match_dup 0) (const_int 1)))]
4568 [(set (match_operand:DI 0 "register_operand" "")
4569 (ashift:DI (match_operand:DI 1 "register_operand" "")
4571 "reload_completed && !TARGET_COLDFIRE"
4573 (ashift:DI (match_dup 1) (const_int 2)))
4575 (ashift:DI (match_dup 0) (const_int 1)))]
4579 [(set (match_operand:DI 0 "register_operand" "")
4580 (ashift:DI (match_operand:DI 1 "register_operand" "")
4582 "reload_completed && !TARGET_COLDFIRE"
4584 (rotate:SI (match_dup 2) (const_int 8)))
4586 (rotate:SI (match_dup 3) (const_int 8)))
4587 (set (strict_low_part (subreg:QI (match_dup 0) 3))
4588 (subreg:QI (match_dup 0) 7))
4589 (set (strict_low_part (subreg:QI (match_dup 0) 7))
4592 operands[2] = gen_highpart (SImode, operands[0]);
4593 operands[3] = gen_lowpart (SImode, operands[0]);
4597 [(set (match_operand:DI 0 "register_operand" "")
4598 (ashift:DI (match_operand:DI 1 "register_operand" "")
4600 "reload_completed && !TARGET_COLDFIRE"
4602 (rotate:SI (match_dup 2) (const_int 16)))
4604 (rotate:SI (match_dup 3) (const_int 16)))
4605 (set (strict_low_part (subreg:HI (match_dup 0) 2))
4606 (subreg:HI (match_dup 0) 6))
4607 (set (strict_low_part (subreg:HI (match_dup 0) 6))
4610 operands[2] = gen_highpart (SImode, operands[0]);
4611 operands[3] = gen_lowpart (SImode, operands[0]);
4615 [(set (match_operand:DI 0 "pre_dec_operand" "")
4616 (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "")
4619 [(set (match_dup 0) (const_int 0))
4620 (set (match_dup 0) (match_dup 1))]
4622 operands[0] = adjust_address(operands[0], SImode, 0);
4623 operands[1] = gen_lowpart(SImode, operands[1]);
4627 [(set (match_operand:DI 0 "post_inc_operand" "")
4628 (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "")
4631 [(set (match_dup 0) (match_dup 1))
4632 (set (match_dup 0) (const_int 0))]
4634 operands[0] = adjust_address(operands[0], SImode, 0);
4635 operands[1] = gen_lowpart(SImode, operands[1]);
4638 (define_insn_and_split "*ashldi3_const32"
4639 [(set (match_operand:DI 0 "nonimmediate_operand" "=ro<>")
4640 (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "ro")
4644 "&& reload_completed"
4645 [(set (match_dup 4) (match_dup 3))
4646 (set (match_dup 2) (const_int 0))]
4647 "split_di(operands, 2, operands + 2, operands + 4);")
4650 [(set (match_operand:DI 0 "register_operand" "")
4651 (ashift:DI (match_operand:DI 1 "register_operand" "")
4652 (match_operand 2 "const_int_operand" "")))]
4653 "reload_completed && !TARGET_COLDFIRE
4654 && INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 40"
4655 [(set (match_dup 4) (ashift:SI (match_dup 4) (match_dup 2)))
4656 (set (match_dup 3) (match_dup 4))
4657 (set (match_dup 4) (const_int 0))]
4659 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
4660 operands[3] = gen_highpart (SImode, operands[0]);
4661 operands[4] = gen_lowpart (SImode, operands[0]);
4665 [(set (match_operand:DI 0 "register_operand" "")
4666 (ashift:DI (match_operand:DI 1 "register_operand" "")
4668 "reload_completed && !TARGET_COLDFIRE"
4669 [(set (match_dup 2) (match_dup 3))
4671 (rotate:SI (match_dup 2) (const_int 16)))
4672 (set (match_dup 3) (const_int 0))
4673 (set (strict_low_part (subreg:HI (match_dup 0) 2))
4676 operands[2] = gen_highpart (SImode, operands[0]);
4677 operands[3] = gen_lowpart (SImode, operands[0]);
4681 [(set (match_operand:DI 0 "register_operand" "")
4682 (ashift:DI (match_operand:DI 1 "register_operand" "")
4683 (match_operand 2 "const_int_operand" "")))]
4684 "reload_completed && !TARGET_COLDFIRE
4685 && INTVAL (operands[2]) > 40 && INTVAL (operands[2]) <= 63"
4686 [(set (match_dup 3) (match_dup 2))
4687 (set (match_dup 4) (ashift:SI (match_dup 4) (match_dup 3)))
4688 (set (match_dup 3) (match_dup 4))
4689 (set (match_dup 4) (const_int 0))]
4691 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
4692 operands[3] = gen_highpart (SImode, operands[0]);
4693 operands[4] = gen_lowpart (SImode, operands[0]);
4696 (define_insn "*ashldi3"
4697 [(set (match_operand:DI 0 "register_operand" "=d")
4698 (ashift:DI (match_operand:DI 1 "register_operand" "0")
4699 (match_operand 2 "const_int_operand" "n")))]
4701 && ((INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3)
4702 || INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16
4703 || (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63))"
4706 (define_expand "ashldi3"
4707 [(set (match_operand:DI 0 "register_operand" "")
4708 (ashift:DI (match_operand:DI 1 "register_operand" "")
4709 (match_operand 2 "const_int_operand" "")))]
4712 /* ??? This is a named pattern like this is not allowed to FAIL based
4714 if (GET_CODE (operands[2]) != CONST_INT
4715 || ((INTVAL (operands[2]) < 1 || INTVAL (operands[2]) > 3)
4716 && INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16
4717 && (INTVAL (operands[2]) < 32 || INTVAL (operands[2]) > 63)))
4721 ;; On most 68k models, this makes faster code in a special case.
4723 (define_insn "ashlsi_16"
4724 [(set (match_operand:SI 0 "register_operand" "=d")
4725 (ashift:SI (match_operand:SI 1 "register_operand" "0")
4730 return "swap %0\;clr%.w %0";
4733 ;; ashift patterns : use lsl instead of asl, because lsl always clears the
4734 ;; overflow bit, so we must not set CC_NO_OVERFLOW.
4736 ;; On the 68000, this makes faster code in a special case.
4738 (define_insn "ashlsi_17_24"
4739 [(set (match_operand:SI 0 "register_operand" "=d")
4740 (ashift:SI (match_operand:SI 1 "register_operand" "0")
4741 (match_operand:SI 2 "const_int_operand" "n")))]
4743 && INTVAL (operands[2]) > 16
4744 && INTVAL (operands[2]) <= 24"
4748 operands[2] = GEN_INT (INTVAL (operands[2]) - 16);
4749 return "lsl%.w %2,%0\;swap %0\;clr%.w %0";
4752 (define_insn "ashlsi3"
4753 [(set (match_operand:SI 0 "register_operand" "=d")
4754 (ashift:SI (match_operand:SI 1 "register_operand" "0")
4755 (match_operand:SI 2 "general_operand" "dI")))]
4758 if (operands[2] == const1_rtx)
4760 cc_status.flags = CC_NO_OVERFLOW;
4761 return "add%.l %0,%0";
4763 return "lsl%.l %2,%0";
4766 (define_insn "ashlhi3"
4767 [(set (match_operand:HI 0 "register_operand" "=d")
4768 (ashift:HI (match_operand:HI 1 "register_operand" "0")
4769 (match_operand:HI 2 "general_operand" "dI")))]
4774 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
4775 (ashift:HI (match_dup 0)
4776 (match_operand:HI 1 "general_operand" "dI")))]
4780 (define_insn "ashlqi3"
4781 [(set (match_operand:QI 0 "register_operand" "=d")
4782 (ashift:QI (match_operand:QI 1 "register_operand" "0")
4783 (match_operand:QI 2 "general_operand" "dI")))]
4788 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
4789 (ashift:QI (match_dup 0)
4790 (match_operand:QI 1 "general_operand" "dI")))]
4794 ;; On most 68k models, this makes faster code in a special case.
4796 (define_insn "ashrsi_16"
4797 [(set (match_operand:SI 0 "register_operand" "=d")
4798 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4801 "swap %0\;ext%.l %0")
4803 ;; On the 68000, this makes faster code in a special case.
4806 [(set (match_operand:SI 0 "register_operand" "=d")
4807 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4808 (match_operand:SI 2 "const_int_operand" "n")))]
4810 && INTVAL (operands[2]) > 16
4811 && INTVAL (operands[2]) <= 24"
4813 operands[2] = GEN_INT (INTVAL (operands[2]) - 16);
4814 return "swap %0\;asr%.w %2,%0\;ext%.l %0";
4817 (define_insn "subreghi1ashrdi_const32"
4818 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
4819 (subreg:HI (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro")
4820 (const_int 32)) 6))]
4823 if (GET_CODE (operands[1]) != REG)
4824 operands[1] = adjust_address (operands[1], HImode, 2);
4825 return "move%.w %1,%0";
4827 [(set_attr "type" "move")])
4829 (define_insn "subregsi1ashrdi_const32"
4830 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
4831 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro")
4832 (const_int 32)) 4))]
4835 return "move%.l %1,%0";
4837 [(set_attr "type" "move_l")])
4839 (define_insn "*ashrdi3_const1"
4840 [(set (match_operand:DI 0 "register_operand" "=d")
4841 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
4845 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4846 return "asr%.l #1,%0\;roxr%.l #1,%1";
4850 [(set (match_operand:DI 0 "register_operand" "")
4851 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4853 "reload_completed && !TARGET_COLDFIRE"
4855 (ashiftrt:DI (match_dup 1) (const_int 1)))
4857 (ashiftrt:DI (match_dup 0) (const_int 1)))]
4861 [(set (match_operand:DI 0 "register_operand" "")
4862 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4864 "reload_completed && !TARGET_COLDFIRE"
4866 (ashiftrt:DI (match_dup 1) (const_int 2)))
4868 (ashiftrt:DI (match_dup 0) (const_int 1)))]
4872 [(set (match_operand:DI 0 "register_operand" "")
4873 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4875 "reload_completed && !TARGET_COLDFIRE"
4876 [(set (strict_low_part (subreg:QI (match_dup 0) 7))
4877 (subreg:QI (match_dup 0) 3))
4879 (ashiftrt:SI (match_dup 2) (const_int 8)))
4881 (rotatert:SI (match_dup 3) (const_int 8)))]
4883 operands[2] = gen_highpart (SImode, operands[0]);
4884 operands[3] = gen_lowpart (SImode, operands[0]);
4888 [(set (match_operand:DI 0 "register_operand" "")
4889 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4891 "reload_completed && !TARGET_COLDFIRE"
4892 [(set (strict_low_part (subreg:HI (match_dup 0) 6))
4893 (subreg:HI (match_dup 0) 2))
4895 (rotate:SI (match_dup 2) (const_int 16)))
4897 (rotate:SI (match_dup 3) (const_int 16)))
4899 (sign_extend:SI (subreg:HI (match_dup 2) 2)))]
4901 operands[2] = gen_highpart (SImode, operands[0]);
4902 operands[3] = gen_lowpart (SImode, operands[0]);
4905 (define_insn "*ashrdi_const32"
4906 [(set (match_operand:DI 0 "register_operand" "=d")
4907 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_src_operand" "ro")
4913 return "move%.l %1,%R0\;smi %0\;extb%.l %0";
4915 return "move%.l %1,%R0\;smi %0\;ext%.w %0\;ext%.l %0";
4918 (define_insn "*ashrdi_const32_mem"
4919 [(set (match_operand:DI 0 "memory_operand" "=o,<")
4920 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_src_operand" "ro,ro")
4922 (clobber (match_scratch:SI 2 "=d,d"))]
4926 operands[3] = adjust_address (operands[0], SImode,
4927 which_alternative == 0 ? 4 : 0);
4928 operands[0] = adjust_address (operands[0], SImode, 0);
4929 if (TARGET_68020 || TARGET_COLDFIRE)
4930 return "move%.l %1,%3\;smi %2\;extb%.l %2\;move%.l %2,%0";
4932 return "move%.l %1,%3\;smi %2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0";
4936 [(set (match_operand:DI 0 "register_operand" "")
4937 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4939 "reload_completed && !TARGET_COLDFIRE"
4941 (ashiftrt:SI (match_dup 3) (const_int 31)))
4944 "split_di(operands, 1, operands + 2, operands + 3);")
4946 ;; The predicate below must be general_operand, because ashrdi3 allows that
4947 (define_insn "ashrdi_const"
4948 [(set (match_operand:DI 0 "register_operand" "=d")
4949 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
4950 (match_operand 2 "const_int_operand" "n")))]
4952 && ((INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3)
4953 || INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16
4954 || INTVAL (operands[2]) == 31
4955 || (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63))"
4957 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4959 if (INTVAL (operands[2]) == 48)
4960 return "swap %0\;ext%.l %0\;move%.l %0,%1\;smi %0\;ext%.w %0";
4961 if (INTVAL (operands[2]) == 31)
4962 return "add%.l %1,%1\;addx%.l %0,%0\;move%.l %0,%1\;subx%.l %0,%0";
4963 if (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63)
4965 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
4966 output_asm_insn (INTVAL (operands[2]) <= 8 ? "asr%.l %2,%0" :
4967 "moveq %2,%1\;asr%.l %1,%0", operands);
4968 output_asm_insn ("mov%.l %0,%1\;smi %0", operands);
4969 return INTVAL (operands[2]) >= 15 ? "ext%.w %d0" :
4970 TARGET_68020 ? "extb%.l %0" : "ext%.w %0\;ext%.l %0";
4975 (define_expand "ashrdi3"
4976 [(set (match_operand:DI 0 "register_operand" "")
4977 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4978 (match_operand 2 "const_int_operand" "")))]
4981 /* ??? This is a named pattern like this is not allowed to FAIL based
4983 if (GET_CODE (operands[2]) != CONST_INT
4984 || ((INTVAL (operands[2]) < 1 || INTVAL (operands[2]) > 3)
4985 && INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16
4986 && (INTVAL (operands[2]) < 31 || INTVAL (operands[2]) > 63)))
4990 ;; On all 68k models, this makes faster code in a special case.
4992 (define_insn "ashrsi_31"
4993 [(set (match_operand:SI 0 "register_operand" "=d")
4994 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4998 return "add%.l %0,%0\;subx%.l %0,%0";
5001 (define_insn "ashrsi3"
5002 [(set (match_operand:SI 0 "register_operand" "=d")
5003 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
5004 (match_operand:SI 2 "general_operand" "dI")))]
5007 [(set_attr "type" "shift")
5008 (set_attr "opy" "2")])
5010 (define_insn "ashrhi3"
5011 [(set (match_operand:HI 0 "register_operand" "=d")
5012 (ashiftrt:HI (match_operand:HI 1 "register_operand" "0")
5013 (match_operand:HI 2 "general_operand" "dI")))]
5018 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
5019 (ashiftrt:HI (match_dup 0)
5020 (match_operand:HI 1 "general_operand" "dI")))]
5024 (define_insn "ashrqi3"
5025 [(set (match_operand:QI 0 "register_operand" "=d")
5026 (ashiftrt:QI (match_operand:QI 1 "register_operand" "0")
5027 (match_operand:QI 2 "general_operand" "dI")))]
5032 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
5033 (ashiftrt:QI (match_dup 0)
5034 (match_operand:QI 1 "general_operand" "dI")))]
5038 ;; logical shift instructions
5040 ;; commented out because of reload problems in 950612-1.c
5043 ;; (subreg:SI (lshiftrt:DI (match_operand:DI 0 "general_operand" "ro")
5044 ;; (const_int 32)) 4))
5045 ;; (set (match_operand:SI 1 "nonimmediate_operand" "=dm")
5046 ;; (subreg:SI (lshiftrt:DI (match_dup 0)
5047 ;; (const_int 32)) 4))]
5050 ;; return "move%.l %0,%1";
5055 ;; (subreg:SI (lshiftrt:DI (match_operand:DI 0 "general_operand" "ro")
5056 ;; (const_int 32)) 0))
5057 ;; (set (match_operand:DI 1 "nonimmediate_operand" "=do")
5058 ;; (lshiftrt:DI (match_dup 0)
5059 ;; (const_int 32)))]
5062 ;; if (GET_CODE (operands[1]) == REG)
5063 ;; operands[2] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
5065 ;; operands[2] = adjust_address (operands[1], SImode, 4);
5066 ;; return "move%.l %0,%2\;clr%.l %1";
5069 (define_insn "subreg1lshrdi_const32"
5070 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
5071 (subreg:SI (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro")
5072 (const_int 32)) 4))]
5075 [(set_attr "type" "move_l")])
5077 (define_insn "*lshrdi3_const1"
5078 [(set (match_operand:DI 0 "register_operand" "=d")
5079 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
5082 "lsr%.l #1,%0\;roxr%.l #1,%R0")
5085 [(set (match_operand:DI 0 "register_operand" "")
5086 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
5088 "reload_completed && !TARGET_COLDFIRE"
5090 (lshiftrt:DI (match_dup 1) (const_int 1)))
5092 (lshiftrt:DI (match_dup 0) (const_int 1)))]
5096 [(set (match_operand:DI 0 "register_operand" "")
5097 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
5099 "reload_completed && !TARGET_COLDFIRE"
5101 (lshiftrt:DI (match_dup 1) (const_int 2)))
5103 (lshiftrt:DI (match_dup 0) (const_int 1)))]
5107 [(set (match_operand:DI 0 "register_operand" "")
5108 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
5110 "reload_completed && !TARGET_COLDFIRE"
5111 [(set (strict_low_part (subreg:QI (match_dup 0) 7))
5112 (subreg:QI (match_dup 0) 3))
5114 (lshiftrt:SI (match_dup 2) (const_int 8)))
5116 (rotatert:SI (match_dup 3) (const_int 8)))]
5118 operands[2] = gen_highpart (SImode, operands[0]);
5119 operands[3] = gen_lowpart (SImode, operands[0]);
5123 [(set (match_operand:DI 0 "register_operand" "")
5124 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
5126 "reload_completed && !TARGET_COLDFIRE"
5127 [(set (strict_low_part (subreg:HI (match_dup 0) 6))
5128 (subreg:HI (match_dup 0) 2))
5129 (set (strict_low_part (subreg:HI (match_dup 0) 2))
5132 (rotate:SI (match_dup 3) (const_int 16)))
5134 (rotate:SI (match_dup 2) (const_int 16)))]
5136 operands[2] = gen_highpart (SImode, operands[0]);
5137 operands[3] = gen_lowpart (SImode, operands[0]);
5141 [(set (match_operand:DI 0 "pre_dec_operand" "")
5142 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "")
5145 [(set (match_dup 0) (match_dup 1))
5146 (set (match_dup 0) (const_int 0))]
5148 operands[0] = adjust_address(operands[0], SImode, 0);
5149 operands[1] = gen_highpart(SImode, operands[1]);
5153 [(set (match_operand:DI 0 "post_inc_operand" "")
5154 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "")
5157 [(set (match_dup 0) (const_int 0))
5158 (set (match_dup 0) (match_dup 1))]
5160 operands[0] = adjust_address(operands[0], SImode, 0);
5161 operands[1] = gen_highpart(SImode, operands[1]);
5165 [(set (match_operand:DI 0 "nonimmediate_operand" "")
5166 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "")
5169 [(set (match_dup 2) (match_dup 5))
5170 (set (match_dup 4) (const_int 0))]
5171 "split_di(operands, 2, operands + 2, operands + 4);")
5173 (define_insn "*lshrdi_const32"
5174 [(set (match_operand:DI 0 "nonimmediate_operand" "=ro<>")
5175 (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro")
5181 [(set (match_operand:DI 0 "register_operand" "")
5182 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
5183 (match_operand 2 "const_int_operand" "")))]
5184 "reload_completed && !TARGET_COLDFIRE
5185 && INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 40"
5186 [(set (match_dup 3) (lshiftrt:SI (match_dup 3) (match_dup 2)))
5187 (set (match_dup 4) (match_dup 3))
5188 (set (match_dup 3) (const_int 0))]
5190 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
5191 operands[3] = gen_highpart (SImode, operands[0]);
5192 operands[4] = gen_lowpart (SImode, operands[0]);
5196 [(set (match_operand:DI 0 "register_operand" "")
5197 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
5200 [(set (match_dup 3) (match_dup 2))
5201 (set (strict_low_part (subreg:HI (match_dup 0) 6))
5203 (set (match_dup 2) (const_int 0))
5205 (rotate:SI (match_dup 3) (const_int 16)))]
5207 operands[2] = gen_highpart (SImode, operands[0]);
5208 operands[3] = gen_lowpart (SImode, operands[0]);
5212 [(set (match_operand:DI 0 "register_operand" "")
5213 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
5214 (match_operand 2 "const_int_operand" "")))]
5215 "reload_completed && !TARGET_COLDFIRE
5216 && INTVAL (operands[2]) > 40 && INTVAL (operands[2]) <= 62"
5217 [(set (match_dup 4) (match_dup 2))
5218 (set (match_dup 3) (lshiftrt:SI (match_dup 3) (match_dup 4)))
5219 (set (match_dup 4) (match_dup 3))
5220 (set (match_dup 3) (const_int 0))]
5222 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
5223 operands[3] = gen_highpart (SImode, operands[0]);
5224 operands[4] = gen_lowpart (SImode, operands[0]);
5227 (define_insn "*lshrdi_const63"
5228 [(set (match_operand:DI 0 "register_operand" "=d")
5229 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
5232 "add%.l %0,%0\;clr%.l %0\;clr%.l %R1\;addx%.l %R1,%R1")
5234 (define_insn "*lshrdi3_const"
5235 [(set (match_operand:DI 0 "register_operand" "=d")
5236 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
5237 (match_operand 2 "const_int_operand" "n")))]
5239 && ((INTVAL (operands[2]) >= 2 && INTVAL (operands[2]) <= 3)
5240 || INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16
5241 || (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63)))"
5244 (define_expand "lshrdi3"
5245 [(set (match_operand:DI 0 "register_operand" "")
5246 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
5247 (match_operand 2 "const_int_operand" "")))]
5250 /* ??? This is a named pattern like this is not allowed to FAIL based
5252 if (GET_CODE (operands[2]) != CONST_INT
5253 || ((INTVAL (operands[2]) < 1 || INTVAL (operands[2]) > 3)
5254 && INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16
5255 && (INTVAL (operands[2]) < 32 || INTVAL (operands[2]) > 63)))
5259 ;; On all 68k models, this makes faster code in a special case.
5261 (define_insn "lshrsi_31"
5262 [(set (match_operand:SI 0 "register_operand" "=d")
5263 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
5267 return "add%.l %0,%0\;subx%.l %0,%0\;neg%.l %0";
5270 ;; On most 68k models, this makes faster code in a special case.
5272 (define_insn "lshrsi_16"
5273 [(set (match_operand:SI 0 "register_operand" "=d")
5274 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
5279 return "clr%.w %0\;swap %0";
5282 ;; On the 68000, this makes faster code in a special case.
5284 (define_insn "lshrsi_17_24"
5285 [(set (match_operand:SI 0 "register_operand" "=d")
5286 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
5287 (match_operand:SI 2 "const_int_operand" "n")))]
5289 && INTVAL (operands[2]) > 16
5290 && INTVAL (operands[2]) <= 24"
5292 /* I think lsr%.w sets the CC properly. */
5293 operands[2] = GEN_INT (INTVAL (operands[2]) - 16);
5294 return "clr%.w %0\;swap %0\;lsr%.w %2,%0";
5297 (define_insn "lshrsi3"
5298 [(set (match_operand:SI 0 "register_operand" "=d")
5299 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
5300 (match_operand:SI 2 "general_operand" "dI")))]
5303 [(set_attr "type" "shift")
5304 (set_attr "opy" "2")])
5306 (define_insn "lshrhi3"
5307 [(set (match_operand:HI 0 "register_operand" "=d")
5308 (lshiftrt:HI (match_operand:HI 1 "register_operand" "0")
5309 (match_operand:HI 2 "general_operand" "dI")))]
5314 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
5315 (lshiftrt:HI (match_dup 0)
5316 (match_operand:HI 1 "general_operand" "dI")))]
5320 (define_insn "lshrqi3"
5321 [(set (match_operand:QI 0 "register_operand" "=d")
5322 (lshiftrt:QI (match_operand:QI 1 "register_operand" "0")
5323 (match_operand:QI 2 "general_operand" "dI")))]
5328 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
5329 (lshiftrt:QI (match_dup 0)
5330 (match_operand:QI 1 "general_operand" "dI")))]
5334 ;; rotate instructions
5336 (define_insn "rotlsi3"
5337 [(set (match_operand:SI 0 "register_operand" "=d")
5338 (rotate:SI (match_operand:SI 1 "register_operand" "0")
5339 (match_operand:SI 2 "general_operand" "dINO")))]
5342 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 16)
5344 else if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 16)
5346 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
5347 return "ror%.l %2,%0";
5350 return "rol%.l %2,%0";
5353 (define_insn "rotlhi3"
5354 [(set (match_operand:HI 0 "register_operand" "=d")
5355 (rotate:HI (match_operand:HI 1 "register_operand" "0")
5356 (match_operand:HI 2 "general_operand" "dIP")))]
5359 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 8)
5361 operands[2] = GEN_INT (16 - INTVAL (operands[2]));
5362 return "ror%.w %2,%0";
5365 return "rol%.w %2,%0";
5369 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
5370 (rotate:HI (match_dup 0)
5371 (match_operand:HI 1 "general_operand" "dIP")))]
5374 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 8)
5376 operands[2] = GEN_INT (16 - INTVAL (operands[2]));
5377 return "ror%.w %2,%0";
5380 return "rol%.w %2,%0";
5383 (define_insn "rotlqi3"
5384 [(set (match_operand:QI 0 "register_operand" "=d")
5385 (rotate:QI (match_operand:QI 1 "register_operand" "0")
5386 (match_operand:QI 2 "general_operand" "dI")))]
5389 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 4)
5391 operands[2] = GEN_INT (8 - INTVAL (operands[2]));
5392 return "ror%.b %2,%0";
5395 return "rol%.b %2,%0";
5399 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
5400 (rotate:QI (match_dup 0)
5401 (match_operand:QI 1 "general_operand" "dI")))]
5404 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 4)
5406 operands[2] = GEN_INT (8 - INTVAL (operands[2]));
5407 return "ror%.b %2,%0";
5410 return "rol%.b %2,%0";
5413 (define_insn "rotrsi3"
5414 [(set (match_operand:SI 0 "register_operand" "=d")
5415 (rotatert:SI (match_operand:SI 1 "register_operand" "0")
5416 (match_operand:SI 2 "general_operand" "dI")))]
5420 (define_insn "rotrhi3"
5421 [(set (match_operand:HI 0 "register_operand" "=d")
5422 (rotatert:HI (match_operand:HI 1 "register_operand" "0")
5423 (match_operand:HI 2 "general_operand" "dI")))]
5428 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
5429 (rotatert:HI (match_dup 0)
5430 (match_operand:HI 1 "general_operand" "dI")))]
5434 (define_insn "rotrqi3"
5435 [(set (match_operand:QI 0 "register_operand" "=d")
5436 (rotatert:QI (match_operand:QI 1 "register_operand" "0")
5437 (match_operand:QI 2 "general_operand" "dI")))]
5442 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
5443 (rotatert:QI (match_dup 0)
5444 (match_operand:QI 1 "general_operand" "dI")))]
5449 ;; Bit set/clear in memory byte.
5451 ;; set bit, bit number is int
5452 (define_insn "bsetmemqi"
5453 [(set (match_operand:QI 0 "memory_operand" "+m")
5454 (ior:QI (subreg:QI (ashift:SI (const_int 1)
5455 (match_operand:SI 1 "general_operand" "d")) 3)
5460 return "bset %1,%0";
5462 [(set_attr "type" "bitrw")])
5464 ;; set bit, bit number is (sign/zero)_extended from HImode/QImode
5465 (define_insn "*bsetmemqi_ext"
5466 [(set (match_operand:QI 0 "memory_operand" "+m")
5467 (ior:QI (subreg:QI (ashift:SI (const_int 1)
5468 (match_operator:SI 2 "extend_operator"
5469 [(match_operand 1 "general_operand" "d")])) 3)
5474 return "bset %1,%0";
5476 [(set_attr "type" "bitrw")])
5478 ;; clear bit, bit number is int
5479 (define_insn "bclrmemqi"
5480 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+m")
5482 (minus:SI (const_int 7)
5483 (match_operand:SI 1 "general_operand" "d")))
5488 return "bclr %1,%0";
5490 [(set_attr "type" "bitrw")])
5492 ;; clear bit, bit number is (sign/zero)_extended from HImode/QImode
5493 (define_insn "*bclrmemqi_ext"
5494 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+m")
5496 (minus:SI (const_int 7)
5497 (match_operator:SI 2 "extend_operator"
5498 [(match_operand 1 "general_operand" "d")])))
5503 return "bclr %1,%0";
5505 [(set_attr "type" "bitrw")])
5507 ;; Special cases of bit-field insns which we should
5508 ;; recognize in preference to the general case.
5509 ;; These handle aligned 8-bit and 16-bit fields,
5510 ;; which can usually be done with move instructions.
5513 ; Special case for 32-bit field in memory. This only occurs when 32-bit
5514 ; alignment of structure members is specified.
5516 ; The move is allowed to be odd byte aligned, because that's still faster
5517 ; than an odd byte aligned bit-field instruction.
5520 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5522 (match_operand:SI 1 "const_int_operand" "n"))
5523 (match_operand:SI 2 "general_src_operand" "rmSi"))]
5524 "TARGET_68020 && TARGET_BITFIELD
5525 && (INTVAL (operands[1]) % 8) == 0
5526 && ! mode_dependent_address_p (XEXP (operands[0], 0))"
5529 = adjust_address (operands[0], SImode, INTVAL (operands[1]) / 8);
5531 return "move%.l %2,%0";
5535 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+do")
5536 (match_operand:SI 1 "const_int_operand" "n")
5537 (match_operand:SI 2 "const_int_operand" "n"))
5538 (match_operand:SI 3 "register_operand" "d"))]
5539 "TARGET_68020 && TARGET_BITFIELD
5540 && (INTVAL (operands[1]) == 8 || INTVAL (operands[1]) == 16)
5541 && INTVAL (operands[2]) % INTVAL (operands[1]) == 0
5542 && (GET_CODE (operands[0]) == REG
5543 || ! mode_dependent_address_p (XEXP (operands[0], 0)))"
5545 if (REG_P (operands[0]))
5547 if (INTVAL (operands[1]) + INTVAL (operands[2]) != 32)
5548 return "bfins %3,%0{%b2:%b1}";
5551 operands[0] = adjust_address (operands[0],
5552 INTVAL (operands[1]) == 8 ? QImode : HImode,
5553 INTVAL (operands[2]) / 8);
5555 if (GET_CODE (operands[3]) == MEM)
5556 operands[3] = adjust_address (operands[3],
5557 INTVAL (operands[1]) == 8 ? QImode : HImode,
5558 (32 - INTVAL (operands[1])) / 8);
5560 if (INTVAL (operands[1]) == 8)
5561 return "move%.b %3,%0";
5562 return "move%.w %3,%0";
5567 ; Special case for 32-bit field in memory. This only occurs when 32-bit
5568 ; alignment of structure members is specified.
5570 ; The move is allowed to be odd byte aligned, because that's still faster
5571 ; than an odd byte aligned bit-field instruction.
5574 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
5575 (zero_extract:SI (match_operand:QI 1 "memory_src_operand" "oS")
5577 (match_operand:SI 2 "const_int_operand" "n")))]
5578 "TARGET_68020 && TARGET_BITFIELD
5579 && (INTVAL (operands[2]) % 8) == 0
5580 && ! mode_dependent_address_p (XEXP (operands[1], 0))"
5583 = adjust_address (operands[1], SImode, INTVAL (operands[2]) / 8);
5585 return "move%.l %1,%0";
5589 [(set (match_operand:SI 0 "nonimmediate_operand" "=&d")
5590 (zero_extract:SI (match_operand:SI 1 "register_operand" "do")
5591 (match_operand:SI 2 "const_int_operand" "n")
5592 (match_operand:SI 3 "const_int_operand" "n")))]
5593 "TARGET_68020 && TARGET_BITFIELD
5594 && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
5595 && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
5596 && (GET_CODE (operands[1]) == REG
5597 || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
5599 cc_status.flags |= CC_NOT_NEGATIVE;
5600 if (REG_P (operands[1]))
5602 if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
5603 return "bfextu %1{%b3:%b2},%0";
5607 = adjust_address (operands[1], SImode, INTVAL (operands[3]) / 8);
5609 output_asm_insn ("clr%.l %0", operands);
5610 if (GET_CODE (operands[0]) == MEM)
5611 operands[0] = adjust_address (operands[0],
5612 INTVAL (operands[2]) == 8 ? QImode : HImode,
5613 (32 - INTVAL (operands[1])) / 8);
5615 if (INTVAL (operands[2]) == 8)
5616 return "move%.b %1,%0";
5617 return "move%.w %1,%0";
5621 ; Special case for 32-bit field in memory. This only occurs when 32-bit
5622 ; alignment of structure members is specified.
5624 ; The move is allowed to be odd byte aligned, because that's still faster
5625 ; than an odd byte aligned bit-field instruction.
5628 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
5629 (sign_extract:SI (match_operand:QI 1 "memory_src_operand" "oS")
5631 (match_operand:SI 2 "const_int_operand" "n")))]
5632 "TARGET_68020 && TARGET_BITFIELD
5633 && (INTVAL (operands[2]) % 8) == 0
5634 && ! mode_dependent_address_p (XEXP (operands[1], 0))"
5637 = adjust_address (operands[1], SImode, INTVAL (operands[2]) / 8);
5639 return "move%.l %1,%0";
5643 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
5644 (sign_extract:SI (match_operand:SI 1 "register_operand" "do")
5645 (match_operand:SI 2 "const_int_operand" "n")
5646 (match_operand:SI 3 "const_int_operand" "n")))]
5647 "TARGET_68020 && TARGET_BITFIELD
5648 && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
5649 && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
5650 && (GET_CODE (operands[1]) == REG
5651 || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
5653 if (REG_P (operands[1]))
5655 if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
5656 return "bfexts %1{%b3:%b2},%0";
5660 = adjust_address (operands[1],
5661 INTVAL (operands[2]) == 8 ? QImode : HImode,
5662 INTVAL (operands[3]) / 8);
5664 if (INTVAL (operands[2]) == 8)
5665 return "move%.b %1,%0\;extb%.l %0";
5666 return "move%.w %1,%0\;ext%.l %0";
5669 ;; Bit-field instructions, general cases.
5670 ;; "o,d" constraint causes a nonoffsettable memref to match the "o"
5671 ;; so that its address is reloaded.
5673 (define_expand "extv"
5674 [(set (match_operand:SI 0 "register_operand" "")
5675 (sign_extract:SI (match_operand:SI 1 "general_operand" "")
5676 (match_operand:SI 2 "const_int_operand" "")
5677 (match_operand:SI 3 "const_int_operand" "")))]
5678 "TARGET_68020 && TARGET_BITFIELD"
5682 [(set (match_operand:SI 0 "register_operand" "=d")
5683 (sign_extract:SI (match_operand:QI 1 "memory_operand" "o")
5684 (match_operand:SI 2 "nonmemory_operand" "dn")
5685 (match_operand:SI 3 "nonmemory_operand" "dn")))]
5686 "TARGET_68020 && TARGET_BITFIELD"
5687 "bfexts %1{%b3:%b2},%0")
5689 (define_expand "extzv"
5690 [(set (match_operand:SI 0 "register_operand" "")
5691 (zero_extract:SI (match_operand:SI 1 "general_operand" "")
5692 (match_operand:SI 2 "const_int_operand" "")
5693 (match_operand:SI 3 "const_int_operand" "")))]
5694 "TARGET_68020 && TARGET_BITFIELD"
5698 [(set (match_operand:SI 0 "register_operand" "=d")
5699 (zero_extract:SI (match_operand:QI 1 "memory_operand" "o")
5700 (match_operand:SI 2 "nonmemory_operand" "dn")
5701 (match_operand:SI 3 "nonmemory_operand" "dn")))]
5702 "TARGET_68020 && TARGET_BITFIELD"
5704 if (GET_CODE (operands[2]) == CONST_INT)
5706 if (INTVAL (operands[2]) != 32)
5707 cc_status.flags |= CC_NOT_NEGATIVE;
5713 return "bfextu %1{%b3:%b2},%0";
5717 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5718 (match_operand:SI 1 "nonmemory_operand" "dn")
5719 (match_operand:SI 2 "nonmemory_operand" "dn"))
5720 (xor:SI (zero_extract:SI (match_dup 0) (match_dup 1) (match_dup 2))
5721 (match_operand 3 "const_int_operand" "n")))]
5722 "TARGET_68020 && TARGET_BITFIELD
5723 && (INTVAL (operands[3]) == -1
5724 || (GET_CODE (operands[1]) == CONST_INT
5725 && (~ INTVAL (operands[3]) & ((1 << INTVAL (operands[1]))- 1)) == 0))"
5728 return "bfchg %0{%b2:%b1}";
5732 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5733 (match_operand:SI 1 "nonmemory_operand" "dn")
5734 (match_operand:SI 2 "nonmemory_operand" "dn"))
5736 "TARGET_68020 && TARGET_BITFIELD"
5739 return "bfclr %0{%b2:%b1}";
5743 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5744 (match_operand:SI 1 "general_operand" "dn")
5745 (match_operand:SI 2 "general_operand" "dn"))
5747 "TARGET_68020 && TARGET_BITFIELD"
5750 return "bfset %0{%b2:%b1}";
5753 (define_expand "insv"
5754 [(set (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "")
5755 (match_operand:SI 1 "const_int_operand" "")
5756 (match_operand:SI 2 "const_int_operand" ""))
5757 (match_operand:SI 3 "register_operand" ""))]
5758 "TARGET_68020 && TARGET_BITFIELD"
5762 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5763 (match_operand:SI 1 "nonmemory_operand" "dn")
5764 (match_operand:SI 2 "nonmemory_operand" "dn"))
5765 (match_operand:SI 3 "register_operand" "d"))]
5766 "TARGET_68020 && TARGET_BITFIELD"
5767 "bfins %3,%0{%b2:%b1}")
5769 ;; Now recognize bit-field insns that operate on registers
5770 ;; (or at least were intended to do so).
5773 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
5774 (sign_extract:SI (match_operand:SI 1 "register_operand" "d")
5775 (match_operand:SI 2 "const_int_operand" "n")
5776 (match_operand:SI 3 "const_int_operand" "n")))]
5777 "TARGET_68020 && TARGET_BITFIELD"
5778 "bfexts %1{%b3:%b2},%0")
5781 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
5782 (zero_extract:SI (match_operand:SI 1 "register_operand" "d")
5783 (match_operand:SI 2 "const_int_operand" "n")
5784 (match_operand:SI 3 "const_int_operand" "n")))]
5785 "TARGET_68020 && TARGET_BITFIELD"
5787 if (GET_CODE (operands[2]) == CONST_INT)
5789 if (INTVAL (operands[2]) != 32)
5790 cc_status.flags |= CC_NOT_NEGATIVE;
5796 return "bfextu %1{%b3:%b2},%0";
5800 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
5801 (match_operand:SI 1 "const_int_operand" "n")
5802 (match_operand:SI 2 "const_int_operand" "n"))
5804 "TARGET_68020 && TARGET_BITFIELD"
5807 return "bfclr %0{%b2:%b1}";
5811 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
5812 (match_operand:SI 1 "const_int_operand" "n")
5813 (match_operand:SI 2 "const_int_operand" "n"))
5815 "TARGET_68020 && TARGET_BITFIELD"
5818 return "bfset %0{%b2:%b1}";
5822 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
5823 (match_operand:SI 1 "const_int_operand" "n")
5824 (match_operand:SI 2 "const_int_operand" "n"))
5825 (match_operand:SI 3 "register_operand" "d"))]
5826 "TARGET_68020 && TARGET_BITFIELD"
5829 /* These special cases are now recognized by a specific pattern. */
5830 if (GET_CODE (operands[1]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT
5831 && INTVAL (operands[1]) == 16 && INTVAL (operands[2]) == 16)
5832 return "move%.w %3,%0";
5833 if (GET_CODE (operands[1]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT
5834 && INTVAL (operands[1]) == 24 && INTVAL (operands[2]) == 8)
5835 return "move%.b %3,%0";
5837 return "bfins %3,%0{%b2:%b1}";
5840 ;; Special patterns for optimizing bit-field instructions.
5844 (compare (zero_extract:SI (match_operand:QI 0 "memory_operand" "o")
5845 (match_operand:SI 1 "const_int_operand" "n")
5846 (match_operand:SI 2 "general_operand" "dn"))
5848 "TARGET_68020 && TARGET_BITFIELD"
5850 if (operands[1] == const1_rtx
5851 && GET_CODE (operands[2]) == CONST_INT)
5853 int width = GET_CODE (operands[0]) == REG ? 31 : 7;
5854 return output_btst (operands,
5855 GEN_INT (width - INTVAL (operands[2])),
5856 operands[0], insn, 1000);
5857 /* Pass 1000 as SIGNPOS argument so that btst will
5858 not think we are testing the sign bit for an `and'
5859 and assume that nonzero implies a negative result. */
5861 if (INTVAL (operands[1]) != 32)
5862 cc_status.flags = CC_NOT_NEGATIVE;
5863 return "bftst %0{%b2:%b1}";
5867 ;;; now handle the register cases
5870 (compare (zero_extract:SI (match_operand:SI 0 "register_operand" "d")
5871 (match_operand:SI 1 "const_int_operand" "n")
5872 (match_operand:SI 2 "general_operand" "dn"))
5874 "TARGET_68020 && TARGET_BITFIELD"
5876 if (operands[1] == const1_rtx
5877 && GET_CODE (operands[2]) == CONST_INT)
5879 int width = GET_CODE (operands[0]) == REG ? 31 : 7;
5880 return output_btst (operands, GEN_INT (width - INTVAL (operands[2])),
5881 operands[0], insn, 1000);
5882 /* Pass 1000 as SIGNPOS argument so that btst will
5883 not think we are testing the sign bit for an `and'
5884 and assume that nonzero implies a negative result. */
5886 if (INTVAL (operands[1]) != 32)
5887 cc_status.flags = CC_NOT_NEGATIVE;
5888 return "bftst %0{%b2:%b1}";
5891 (define_insn "scc0_di"
5892 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
5893 (match_operator 1 "ordered_comparison_operator"
5894 [(match_operand:DI 2 "general_operand" "ro") (const_int 0)]))]
5897 return output_scc_di (operands[1], operands[2], const0_rtx, operands[0]);
5900 (define_insn "scc0_di_5200"
5901 [(set (match_operand:QI 0 "nonimmediate_operand" "=d")
5902 (match_operator 1 "ordered_comparison_operator"
5903 [(match_operand:DI 2 "general_operand" "ro") (const_int 0)]))]
5906 return output_scc_di (operands[1], operands[2], const0_rtx, operands[0]);
5909 (define_insn "scc_di"
5910 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,dm")
5911 (match_operator 1 "ordered_comparison_operator"
5912 [(match_operand:DI 2 "general_operand" "ro,r")
5913 (match_operand:DI 3 "general_operand" "r,ro")]))]
5916 return output_scc_di (operands[1], operands[2], operands[3], operands[0]);
5919 (define_insn "scc_di_5200"
5920 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d")
5921 (match_operator 1 "ordered_comparison_operator"
5922 [(match_operand:DI 2 "general_operand" "ro,r")
5923 (match_operand:DI 3 "general_operand" "r,ro")]))]
5926 return output_scc_di (operands[1], operands[2], operands[3], operands[0]);
5929 ;; Note that operand 0 of an SCC insn is supported in the hardware as
5930 ;; memory, but we cannot allow it to be in memory in case the address
5931 ;; needs to be reloaded.
5934 [(set (match_operand:QI 0 "register_operand" "=d")
5935 (eq:QI (cc0) (const_int 0)))]
5938 cc_status = cc_prev_status;
5939 OUTPUT_JUMP ("seq %0", "fseq %0", "seq %0");
5943 [(set (match_operand:QI 0 "register_operand" "=d")
5944 (ne:QI (cc0) (const_int 0)))]
5947 cc_status = cc_prev_status;
5948 OUTPUT_JUMP ("sne %0", "fsne %0", "sne %0");
5952 [(set (match_operand:QI 0 "register_operand" "=d")
5953 (gt:QI (cc0) (const_int 0)))]
5956 cc_status = cc_prev_status;
5957 OUTPUT_JUMP ("sgt %0", "fsgt %0", 0);
5961 [(set (match_operand:QI 0 "register_operand" "=d")
5962 (gtu:QI (cc0) (const_int 0)))]
5965 cc_status = cc_prev_status;
5970 [(set (match_operand:QI 0 "register_operand" "=d")
5971 (lt:QI (cc0) (const_int 0)))]
5974 cc_status = cc_prev_status;
5975 OUTPUT_JUMP ("slt %0", "fslt %0", "smi %0");
5979 [(set (match_operand:QI 0 "register_operand" "=d")
5980 (ltu:QI (cc0) (const_int 0)))]
5983 cc_status = cc_prev_status;
5988 [(set (match_operand:QI 0 "register_operand" "=d")
5989 (ge:QI (cc0) (const_int 0)))]
5992 cc_status = cc_prev_status;
5993 OUTPUT_JUMP ("sge %0", "fsge %0", "spl %0");
5997 [(set (match_operand:QI 0 "register_operand" "=d")
5998 (geu:QI (cc0) (const_int 0)))]
6001 cc_status = cc_prev_status;
6004 [(set_attr "type" "scc")])
6007 [(set (match_operand:QI 0 "register_operand" "=d")
6008 (le:QI (cc0) (const_int 0)))]
6011 cc_status = cc_prev_status;
6012 OUTPUT_JUMP ("sle %0", "fsle %0", 0);
6016 [(set (match_operand:QI 0 "register_operand" "=d")
6017 (leu:QI (cc0) (const_int 0)))]
6020 cc_status = cc_prev_status;
6023 [(set_attr "type" "scc")])
6025 (define_insn "*sordered_1"
6026 [(set (match_operand:QI 0 "register_operand" "=d")
6027 (ordered:QI (cc0) (const_int 0)))]
6028 "TARGET_68881 && !TUNE_68060"
6030 cc_status = cc_prev_status;
6034 (define_insn "*sunordered_1"
6035 [(set (match_operand:QI 0 "register_operand" "=d")
6036 (unordered:QI (cc0) (const_int 0)))]
6037 "TARGET_68881 && !TUNE_68060"
6039 cc_status = cc_prev_status;
6043 (define_insn "*suneq_1"
6044 [(set (match_operand:QI 0 "register_operand" "=d")
6045 (uneq:QI (cc0) (const_int 0)))]
6046 "TARGET_68881 && !TUNE_68060"
6048 cc_status = cc_prev_status;
6052 (define_insn "*sunge_1"
6053 [(set (match_operand:QI 0 "register_operand" "=d")
6054 (unge:QI (cc0) (const_int 0)))]
6055 "TARGET_68881 && !TUNE_68060"
6057 cc_status = cc_prev_status;
6061 (define_insn "*sungt_1"
6062 [(set (match_operand:QI 0 "register_operand" "=d")
6063 (ungt:QI (cc0) (const_int 0)))]
6064 "TARGET_68881 && !TUNE_68060"
6066 cc_status = cc_prev_status;
6070 (define_insn "*sunle_1"
6071 [(set (match_operand:QI 0 "register_operand" "=d")
6072 (unle:QI (cc0) (const_int 0)))]
6073 "TARGET_68881 && !TUNE_68060"
6075 cc_status = cc_prev_status;
6079 (define_insn "*sunlt_1"
6080 [(set (match_operand:QI 0 "register_operand" "=d")
6081 (unlt:QI (cc0) (const_int 0)))]
6082 "TARGET_68881 && !TUNE_68060"
6084 cc_status = cc_prev_status;
6088 (define_insn "*sltgt_1"
6089 [(set (match_operand:QI 0 "register_operand" "=d")
6090 (ltgt:QI (cc0) (const_int 0)))]
6091 "TARGET_68881 && !TUNE_68060"
6093 cc_status = cc_prev_status;
6097 (define_insn "*fsogt_1"
6098 [(set (match_operand:QI 0 "register_operand" "=d")
6099 (not:QI (unle:QI (cc0) (const_int 0))))]
6100 "TARGET_68881 && !TUNE_68060"
6102 cc_status = cc_prev_status;
6106 (define_insn "*fsoge_1"
6107 [(set (match_operand:QI 0 "register_operand" "=d")
6108 (not:QI (unlt:QI (cc0) (const_int 0))))]
6109 "TARGET_68881 && !TUNE_68060"
6111 cc_status = cc_prev_status;
6115 (define_insn "*fsolt_1"
6116 [(set (match_operand:QI 0 "register_operand" "=d")
6117 (not:QI (unge:QI (cc0) (const_int 0))))]
6118 "TARGET_68881 && !TUNE_68060"
6120 cc_status = cc_prev_status;
6124 (define_insn "*fsole_1"
6125 [(set (match_operand:QI 0 "register_operand" "=d")
6126 (not:QI (ungt:QI (cc0) (const_int 0))))]
6127 "TARGET_68881 && !TUNE_68060"
6129 cc_status = cc_prev_status;
6133 ;; Basic conditional jump instructions.
6135 (define_insn "beq0_di"
6137 (if_then_else (eq (match_operand:DI 0 "general_operand" "d*ao,<>")
6139 (label_ref (match_operand 1 "" ","))
6141 (clobber (match_scratch:SI 2 "=d,d"))]
6145 if (which_alternative == 1)
6146 return "move%.l %0,%2\;or%.l %0,%2\;jeq %l1";
6147 if ((cc_prev_status.value1
6148 && rtx_equal_p (cc_prev_status.value1, operands[0]))
6149 || (cc_prev_status.value2
6150 && rtx_equal_p (cc_prev_status.value2, operands[0])))
6152 cc_status = cc_prev_status;
6155 if (GET_CODE (operands[0]) == REG)
6156 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
6158 operands[3] = adjust_address (operands[0], SImode, 4);
6159 if (! ADDRESS_REG_P (operands[0]))
6161 if (reg_overlap_mentioned_p (operands[2], operands[0]))
6163 if (reg_overlap_mentioned_p (operands[2], operands[3]))
6164 return "or%.l %0,%2\;jeq %l1";
6166 return "or%.l %3,%2\;jeq %l1";
6168 return "move%.l %0,%2\;or%.l %3,%2\;jeq %l1";
6170 operands[4] = gen_label_rtx();
6171 if (TARGET_68020 || TARGET_COLDFIRE)
6172 output_asm_insn ("tst%.l %0\;jne %l4\;tst%.l %3\;jeq %l1", operands);
6174 output_asm_insn ("cmp%.w #0,%0\;jne %l4\;cmp%.w #0,%3\;jeq %l1", operands);
6175 (*targetm.asm_out.internal_label) (asm_out_file, "L",
6176 CODE_LABEL_NUMBER (operands[4]));
6180 (define_insn "bne0_di"
6182 (if_then_else (ne (match_operand:DI 0 "general_operand" "do,*a")
6184 (label_ref (match_operand 1 "" ","))
6186 (clobber (match_scratch:SI 2 "=d,X"))]
6189 if ((cc_prev_status.value1
6190 && rtx_equal_p (cc_prev_status.value1, operands[0]))
6191 || (cc_prev_status.value2
6192 && rtx_equal_p (cc_prev_status.value2, operands[0])))
6194 cc_status = cc_prev_status;
6198 if (GET_CODE (operands[0]) == REG)
6199 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
6201 operands[3] = adjust_address (operands[0], SImode, 4);
6202 if (!ADDRESS_REG_P (operands[0]))
6204 if (reg_overlap_mentioned_p (operands[2], operands[0]))
6206 if (reg_overlap_mentioned_p (operands[2], operands[3]))
6207 return "or%.l %0,%2\;jne %l1";
6209 return "or%.l %3,%2\;jne %l1";
6211 return "move%.l %0,%2\;or%.l %3,%2\;jne %l1";
6213 if (TARGET_68020 || TARGET_COLDFIRE)
6214 return "tst%.l %0\;jne %l1\;tst%.l %3\;jne %l1";
6216 return "cmp%.w #0,%0\;jne %l1\;cmp%.w #0,%3\;jne %l1";
6219 (define_insn "bge0_di"
6221 (if_then_else (ge (match_operand:DI 0 "general_operand" "ro")
6223 (label_ref (match_operand 1 "" ""))
6227 if ((cc_prev_status.value1
6228 && rtx_equal_p (cc_prev_status.value1, operands[0]))
6229 || (cc_prev_status.value2
6230 && rtx_equal_p (cc_prev_status.value2, operands[0])))
6232 cc_status = cc_prev_status;
6233 return cc_status.flags & CC_REVERSED ? "jle %l1" : "jpl %l1";
6236 if (TARGET_68020 || TARGET_COLDFIRE || ! ADDRESS_REG_P (operands[0]))
6237 output_asm_insn("tst%.l %0", operands);
6240 /* On an address reg, cmpw may replace cmpl. */
6241 output_asm_insn("cmp%.w #0,%0", operands);
6246 (define_insn "blt0_di"
6248 (if_then_else (lt (match_operand:DI 0 "general_operand" "ro")
6250 (label_ref (match_operand 1 "" ""))
6254 if ((cc_prev_status.value1
6255 && rtx_equal_p (cc_prev_status.value1, operands[0]))
6256 || (cc_prev_status.value2
6257 && rtx_equal_p (cc_prev_status.value2, operands[0])))
6259 cc_status = cc_prev_status;
6260 return cc_status.flags & CC_REVERSED ? "jgt %l1" : "jmi %l1";
6263 if (TARGET_68020 || TARGET_COLDFIRE || ! ADDRESS_REG_P (operands[0]))
6264 output_asm_insn("tst%.l %0", operands);
6267 /* On an address reg, cmpw may replace cmpl. */
6268 output_asm_insn("cmp%.w #0,%0", operands);
6275 (if_then_else (eq (cc0)
6277 (label_ref (match_operand 0 "" ""))
6281 OUTPUT_JUMP ("jeq %l0", "fjeq %l0", "jeq %l0");
6283 [(set (attr "type") (symbol_ref "m68k_sched_branch_type (insn)"))])
6287 (if_then_else (ne (cc0)
6289 (label_ref (match_operand 0 "" ""))
6293 OUTPUT_JUMP ("jne %l0", "fjne %l0", "jne %l0");
6295 [(set (attr "type") (symbol_ref "m68k_sched_branch_type (insn)"))])
6299 (if_then_else (gt (cc0)
6301 (label_ref (match_operand 0 "" ""))
6305 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6307 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6311 OUTPUT_JUMP ("jgt %l0", "fjgt %l0", 0);
6313 [(set (attr "type") (symbol_ref "m68k_sched_branch_type (insn)"))])
6317 (if_then_else (gtu (cc0)
6319 (label_ref (match_operand 0 "" ""))
6323 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6325 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6331 [(set_attr "type" "bcc")])
6335 (if_then_else (lt (cc0)
6337 (label_ref (match_operand 0 "" ""))
6341 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6343 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6347 OUTPUT_JUMP ("jlt %l0", "fjlt %l0", "jmi %l0");
6349 [(set (attr "type") (symbol_ref "m68k_sched_branch_type (insn)"))])
6353 (if_then_else (ltu (cc0)
6355 (label_ref (match_operand 0 "" ""))
6359 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6361 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6367 [(set_attr "type" "bcc")])
6371 (if_then_else (ge (cc0)
6373 (label_ref (match_operand 0 "" ""))
6377 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6379 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6383 OUTPUT_JUMP ("jge %l0", "fjge %l0", "jpl %l0");
6388 (if_then_else (geu (cc0)
6390 (label_ref (match_operand 0 "" ""))
6394 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6396 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6402 [(set_attr "type" "bcc")])
6406 (if_then_else (le (cc0)
6408 (label_ref (match_operand 0 "" ""))
6412 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6414 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6418 OUTPUT_JUMP ("jle %l0", "fjle %l0", 0);
6420 [(set_attr "type" "bcc")])
6424 (if_then_else (leu (cc0)
6426 (label_ref (match_operand 0 "" ""))
6430 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6432 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6438 [(set_attr "type" "bcc")])
6440 (define_insn "bordered"
6442 (if_then_else (ordered (cc0) (const_int 0))
6443 (label_ref (match_operand 0 "" ""))
6447 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6450 [(set_attr "type" "fbcc")])
6452 (define_insn "bunordered"
6454 (if_then_else (unordered (cc0) (const_int 0))
6455 (label_ref (match_operand 0 "" ""))
6459 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6462 [(set_attr "type" "fbcc")])
6464 (define_insn "buneq"
6466 (if_then_else (uneq (cc0) (const_int 0))
6467 (label_ref (match_operand 0 "" ""))
6471 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6474 [(set_attr "type" "fbcc")])
6476 (define_insn "bunge"
6478 (if_then_else (unge (cc0) (const_int 0))
6479 (label_ref (match_operand 0 "" ""))
6483 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6486 [(set_attr "type" "fbcc")])
6488 (define_insn "bungt"
6490 (if_then_else (ungt (cc0) (const_int 0))
6491 (label_ref (match_operand 0 "" ""))
6495 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6498 [(set_attr "type" "fbcc")])
6500 (define_insn "bunle"
6502 (if_then_else (unle (cc0) (const_int 0))
6503 (label_ref (match_operand 0 "" ""))
6507 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6510 [(set_attr "type" "fbcc")])
6512 (define_insn "bunlt"
6514 (if_then_else (unlt (cc0) (const_int 0))
6515 (label_ref (match_operand 0 "" ""))
6519 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6522 [(set_attr "type" "fbcc")])
6524 (define_insn "bltgt"
6526 (if_then_else (ltgt (cc0) (const_int 0))
6527 (label_ref (match_operand 0 "" ""))
6531 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6534 [(set_attr "type" "fbcc")])
6536 ;; Negated conditional jump instructions.
6538 (define_insn "*beq_rev"
6540 (if_then_else (eq (cc0)
6543 (label_ref (match_operand 0 "" ""))))]
6546 OUTPUT_JUMP ("jne %l0", "fjne %l0", "jne %l0");
6548 [(set_attr "type" "bcc")])
6550 (define_insn "*bne_rev"
6552 (if_then_else (ne (cc0)
6555 (label_ref (match_operand 0 "" ""))))]
6558 OUTPUT_JUMP ("jeq %l0", "fjeq %l0", "jeq %l0");
6560 [(set_attr "type" "bcc")])
6562 (define_insn "*bgt_rev"
6564 (if_then_else (gt (cc0)
6567 (label_ref (match_operand 0 "" ""))))]
6570 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6572 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6576 OUTPUT_JUMP ("jle %l0", "fjngt %l0", 0);
6578 [(set_attr "type" "bcc")])
6580 (define_insn "*bgtu_rev"
6582 (if_then_else (gtu (cc0)
6585 (label_ref (match_operand 0 "" ""))))]
6588 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6590 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6596 [(set_attr "type" "bcc")])
6598 (define_insn "*blt_rev"
6600 (if_then_else (lt (cc0)
6603 (label_ref (match_operand 0 "" ""))))]
6606 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6608 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6612 OUTPUT_JUMP ("jge %l0", "fjnlt %l0", "jpl %l0");
6614 [(set_attr "type" "bcc")])
6616 (define_insn "*bltu_rev"
6618 (if_then_else (ltu (cc0)
6621 (label_ref (match_operand 0 "" ""))))]
6624 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6626 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6632 [(set_attr "type" "bcc")])
6634 (define_insn "*bge_rev"
6636 (if_then_else (ge (cc0)
6639 (label_ref (match_operand 0 "" ""))))]
6642 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6644 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6648 OUTPUT_JUMP ("jlt %l0", "fjnge %l0", "jmi %l0");
6650 [(set_attr "type" "bcc")])
6652 (define_insn "*bgeu_rev"
6654 (if_then_else (geu (cc0)
6657 (label_ref (match_operand 0 "" ""))))]
6660 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6662 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6668 [(set_attr "type" "bcc")])
6670 (define_insn "*ble_rev"
6672 (if_then_else (le (cc0)
6675 (label_ref (match_operand 0 "" ""))))]
6678 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6680 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6684 OUTPUT_JUMP ("jgt %l0", "fjnle %l0", 0);
6686 [(set_attr "type" "bcc")])
6688 (define_insn "*bleu_rev"
6690 (if_then_else (leu (cc0)
6693 (label_ref (match_operand 0 "" ""))))]
6696 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6698 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6704 [(set_attr "type" "bcc")])
6706 (define_insn "*bordered_rev"
6708 (if_then_else (ordered (cc0) (const_int 0))
6710 (label_ref (match_operand 0 "" ""))))]
6713 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6716 [(set_attr "type" "fbcc")])
6718 (define_insn "*bunordered_rev"
6720 (if_then_else (unordered (cc0) (const_int 0))
6722 (label_ref (match_operand 0 "" ""))))]
6725 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6728 [(set_attr "type" "fbcc")])
6730 (define_insn "*buneq_rev"
6732 (if_then_else (uneq (cc0) (const_int 0))
6734 (label_ref (match_operand 0 "" ""))))]
6737 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6740 [(set_attr "type" "fbcc")])
6742 (define_insn "*bunge_rev"
6744 (if_then_else (unge (cc0) (const_int 0))
6746 (label_ref (match_operand 0 "" ""))))]
6749 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6752 [(set_attr "type" "fbcc")])
6754 (define_insn "*bungt_rev"
6756 (if_then_else (ungt (cc0) (const_int 0))
6758 (label_ref (match_operand 0 "" ""))))]
6761 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6764 [(set_attr "type" "fbcc")])
6766 (define_insn "*bunle_rev"
6768 (if_then_else (unle (cc0) (const_int 0))
6770 (label_ref (match_operand 0 "" ""))))]
6773 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6776 [(set_attr "type" "fbcc")])
6778 (define_insn "*bunlt_rev"
6780 (if_then_else (unlt (cc0) (const_int 0))
6782 (label_ref (match_operand 0 "" ""))))]
6785 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6788 [(set_attr "type" "fbcc")])
6790 (define_insn "*bltgt_rev"
6792 (if_then_else (ltgt (cc0) (const_int 0))
6794 (label_ref (match_operand 0 "" ""))))]
6797 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6800 [(set_attr "type" "fbcc")])
6802 ;; Unconditional and other jump instructions
6805 (label_ref (match_operand 0 "" "")))]
6808 [(set_attr "type" "bra")])
6810 (define_expand "tablejump"
6811 [(parallel [(set (pc) (match_operand 0 "" ""))
6812 (use (label_ref (match_operand 1 "" "")))])]
6815 #ifdef CASE_VECTOR_PC_RELATIVE
6816 operands[0] = gen_rtx_PLUS (SImode, pc_rtx,
6817 gen_rtx_SIGN_EXTEND (SImode, operands[0]));
6821 ;; Jump to variable address from dispatch table of absolute addresses.
6822 (define_insn "*tablejump_internal"
6823 [(set (pc) (match_operand:SI 0 "register_operand" "a"))
6824 (use (label_ref (match_operand 1 "" "")))]
6827 return MOTOROLA ? "jmp (%0)" : "jmp %0@";
6829 [(set_attr "type" "jmp")])
6831 ;; Jump to variable address from dispatch table of relative addresses.
6835 (sign_extend:SI (match_operand:HI 0 "register_operand" "r"))))
6836 (use (label_ref (match_operand 1 "" "")))]
6839 #ifdef ASM_RETURN_CASE_JUMP
6840 ASM_RETURN_CASE_JUMP;
6842 if (TARGET_COLDFIRE)
6844 if (ADDRESS_REG_P (operands[0]))
6845 return MOTOROLA ? "jmp (2,pc,%0.l)" : "jmp pc@(2,%0:l)";
6847 return "ext%.l %0\;jmp (2,pc,%0.l)";
6849 return "extl %0\;jmp pc@(2,%0:l)";
6852 return MOTOROLA ? "jmp (2,pc,%0.w)" : "jmp pc@(2,%0:w)";
6856 ;; Decrement-and-branch insns.
6857 (define_insn "*dbne_hi"
6860 (ne (match_operand:HI 0 "nonimmediate_operand" "+d*g")
6862 (label_ref (match_operand 1 "" ""))
6865 (plus:HI (match_dup 0)
6870 if (DATA_REG_P (operands[0]))
6871 return "dbra %0,%l1";
6872 if (GET_CODE (operands[0]) == MEM)
6873 return "subq%.w #1,%0\;jcc %l1";
6874 return "subq%.w #1,%0\;cmp%.w #-1,%0\;jne %l1";
6877 (define_insn "*dbne_si"
6880 (ne (match_operand:SI 0 "nonimmediate_operand" "+d*g")
6882 (label_ref (match_operand 1 "" ""))
6885 (plus:SI (match_dup 0)
6890 if (DATA_REG_P (operands[0]))
6891 return "dbra %0,%l1\;clr%.w %0\;subq%.l #1,%0\;jcc %l1";
6892 if (GET_CODE (operands[0]) == MEM)
6893 return "subq%.l #1,%0\;jcc %l1";
6894 return "subq%.l #1,%0\;cmp%.l #-1,%0\;jne %l1";
6897 ;; Two dbra patterns that use REG_NOTES info generated by strength_reduce.
6899 (define_insn "*dbge_hi"
6902 (ge (plus:HI (match_operand:HI 0 "nonimmediate_operand" "+d*am")
6905 (label_ref (match_operand 1 "" ""))
6908 (plus:HI (match_dup 0)
6910 "!TARGET_COLDFIRE && find_reg_note (insn, REG_NONNEG, 0)"
6913 if (DATA_REG_P (operands[0]))
6914 return "dbra %0,%l1";
6915 if (GET_CODE (operands[0]) == MEM)
6916 return "subq%.w #1,%0\;jcc %l1";
6917 return "subq%.w #1,%0\;cmp%.w #-1,%0\;jne %l1";
6920 (define_expand "decrement_and_branch_until_zero"
6921 [(parallel [(set (pc)
6923 (ge (plus:SI (match_operand:SI 0 "nonimmediate_operand" "")
6926 (label_ref (match_operand 1 "" ""))
6929 (plus:SI (match_dup 0)
6934 (define_insn "*dbge_si"
6937 (ge (plus:SI (match_operand:SI 0 "nonimmediate_operand" "+d*am")
6940 (label_ref (match_operand 1 "" ""))
6943 (plus:SI (match_dup 0)
6945 "!TARGET_COLDFIRE && find_reg_note (insn, REG_NONNEG, 0)"
6948 if (DATA_REG_P (operands[0]))
6949 return "dbra %0,%l1\;clr%.w %0\;subq%.l #1,%0\;jcc %l1";
6950 if (GET_CODE (operands[0]) == MEM)
6951 return "subq%.l #1,%0\;jcc %l1";
6952 return "subq%.l #1,%0\;cmp%.l #-1,%0\;jne %l1";
6955 (define_expand "sibcall"
6956 [(call (match_operand:QI 0 "memory_operand" "")
6957 (match_operand:SI 1 "general_operand" ""))]
6960 operands[0] = m68k_legitimize_sibcall_address (operands[0]);
6963 (define_insn "*sibcall"
6964 [(call (mem:QI (match_operand:SI 0 "sibcall_operand" ""))
6965 (match_operand:SI 1 "general_operand" ""))]
6966 "SIBLING_CALL_P (insn)"
6968 return output_sibcall (operands[0]);
6971 (define_expand "sibcall_value"
6972 [(set (match_operand 0 "" "")
6973 (call (match_operand:QI 1 "memory_operand" "")
6974 (match_operand:SI 2 "general_operand" "")))]
6977 operands[1] = m68k_legitimize_sibcall_address (operands[1]);
6980 (define_insn "*sibcall_value"
6981 [(set (match_operand 0 "" "=rf,rf")
6982 (call (mem:QI (match_operand:SI 1 "sibcall_operand" ""))
6983 (match_operand:SI 2 "general_operand" "")))]
6984 "SIBLING_CALL_P (insn)"
6986 operands[0] = operands[1];
6987 return output_sibcall (operands[0]);
6990 ;; Call subroutine with no return value.
6991 (define_expand "call"
6992 [(call (match_operand:QI 0 "memory_operand" "")
6993 (match_operand:SI 1 "general_operand" ""))]
6994 ;; Operand 1 not really used on the m68000.
6997 operands[0] = m68k_legitimize_call_address (operands[0]);
7000 (define_insn "*call"
7001 [(call (mem:QI (match_operand:SI 0 "call_operand" "a,W"))
7002 (match_operand:SI 1 "general_operand" "g,g"))]
7003 ;; Operand 1 not really used on the m68000.
7004 "!SIBLING_CALL_P (insn)"
7006 return output_call (operands[0]);
7008 [(set_attr "type" "jsr")])
7010 ;; Call subroutine, returning value in operand 0
7011 ;; (which must be a hard register).
7012 (define_expand "call_value"
7013 [(set (match_operand 0 "" "")
7014 (call (match_operand:QI 1 "memory_operand" "")
7015 (match_operand:SI 2 "general_operand" "")))]
7016 ;; Operand 2 not really used on the m68000.
7019 operands[1] = m68k_legitimize_call_address (operands[1]);
7022 (define_insn "*non_symbolic_call_value"
7023 [(set (match_operand 0 "" "=rf,rf")
7024 (call (mem:QI (match_operand:SI 1 "non_symbolic_call_operand" "a,W"))
7025 (match_operand:SI 2 "general_operand" "g,g")))]
7026 ;; Operand 2 not really used on the m68000.
7027 "!SIBLING_CALL_P (insn)"
7029 [(set_attr "type" "jsr")
7030 (set_attr "opx" "1")])
7032 (define_insn "*symbolic_call_value_jsr"
7033 [(set (match_operand 0 "" "=rf,rf")
7034 (call (mem:QI (match_operand:SI 1 "symbolic_operand" "a,W"))
7035 (match_operand:SI 2 "general_operand" "g,g")))]
7036 ;; Operand 2 not really used on the m68000.
7037 "!SIBLING_CALL_P (insn) && m68k_symbolic_call_var == M68K_SYMBOLIC_CALL_JSR"
7039 operands[0] = operands[1];
7040 return m68k_symbolic_call;
7042 [(set_attr "type" "jsr")
7043 (set_attr "opx" "1")])
7045 (define_insn "*symbolic_call_value_bsr"
7046 [(set (match_operand 0 "" "=rf,rf")
7047 (call (mem:QI (match_operand:SI 1 "symbolic_operand" "a,W"))
7048 (match_operand:SI 2 "general_operand" "g,g")))]
7049 ;; Operand 2 not really used on the m68000.
7050 "!SIBLING_CALL_P (insn)
7051 && (m68k_symbolic_call_var == M68K_SYMBOLIC_CALL_BSR_C
7052 || m68k_symbolic_call_var == M68K_SYMBOLIC_CALL_BSR_P)"
7054 operands[0] = operands[1];
7055 return m68k_symbolic_call;
7057 [(set_attr "type" "bsr")
7058 (set_attr "opx" "1")])
7060 ;; Call subroutine returning any type.
7062 (define_expand "untyped_call"
7063 [(parallel [(call (match_operand 0 "" "")
7065 (match_operand 1 "" "")
7066 (match_operand 2 "" "")])]
7067 "NEEDS_UNTYPED_CALL"
7071 emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
7073 for (i = 0; i < XVECLEN (operands[2], 0); i++)
7075 rtx set = XVECEXP (operands[2], 0, i);
7076 emit_move_insn (SET_DEST (set), SET_SRC (set));
7079 /* The optimizer does not know that the call sets the function value
7080 registers we stored in the result block. We avoid problems by
7081 claiming that all hard registers are used and clobbered at this
7083 emit_insn (gen_blockage ());
7088 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
7089 ;; all of memory. This blocks insns from being moved across this point.
7091 (define_insn "blockage"
7092 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
7100 [(set_attr "type" "nop")])
7102 (define_expand "prologue"
7106 m68k_expand_prologue ();
7110 (define_expand "epilogue"
7114 m68k_expand_epilogue (false);
7118 (define_expand "sibcall_epilogue"
7122 m68k_expand_epilogue (true);
7126 ;; Used for frameless functions which save no regs and allocate no locals.
7127 (define_expand "return"
7129 "m68k_use_return_insn ()"
7132 (define_insn "*return"
7136 switch (m68k_get_function_kind (current_function_decl))
7138 case m68k_fk_interrupt_handler:
7141 case m68k_fk_interrupt_thread:
7145 if (crtl->args.pops_args)
7147 operands[0] = GEN_INT (crtl->args.pops_args);
7154 [(set_attr "type" "rts")])
7156 (define_insn "*m68k_store_multiple"
7157 [(match_parallel 0 "" [(match_operand 1 "")])]
7158 "m68k_movem_pattern_p (operands[0], NULL, 0, true)"
7160 return m68k_output_movem (operands, operands[0], 0, true);
7163 (define_insn "*m68k_store_multiple_automod"
7164 [(match_parallel 0 ""
7165 [(set (match_operand:SI 1 "register_operand" "=a")
7166 (plus:SI (match_operand:SI 2 "register_operand" "1")
7167 (match_operand:SI 3 "const_int_operand")))])]
7168 "m68k_movem_pattern_p (operands[0], operands[1], INTVAL (operands[3]), true)"
7170 return m68k_output_movem (operands, operands[0], INTVAL (operands[3]), true);
7173 (define_insn "*m68k_load_multiple"
7174 [(match_parallel 0 "" [(match_operand 1 "")])]
7175 "m68k_movem_pattern_p (operands[0], NULL, 0, false)"
7177 return m68k_output_movem (operands, operands[0], 0, false);
7180 (define_insn "*m68k_load_multiple_automod"
7181 [(match_parallel 0 ""
7182 [(set (match_operand:SI 1 "register_operand" "=a")
7183 (plus:SI (match_operand:SI 2 "register_operand" "1")
7184 (match_operand:SI 3 "const_int_operand")))])]
7185 "m68k_movem_pattern_p (operands[0], operands[1],
7186 INTVAL (operands[3]), false)"
7188 return m68k_output_movem (operands, operands[0],
7189 INTVAL (operands[3]), false);
7192 (define_expand "link"
7194 [(set (match_operand:SI 0 "register_operand")
7195 (plus:SI (reg:SI SP_REG) (const_int -4)))
7198 (set (reg:SI SP_REG)
7199 (plus:SI (reg:SI SP_REG)
7200 (match_operand:SI 1 "const_int_operand")))])]
7201 "TARGET_68020 || INTVAL (operands[1]) >= -0x8004"
7203 operands[2] = gen_frame_mem (SImode, plus_constant (stack_pointer_rtx, -4));
7206 (define_insn "*link"
7207 [(set (match_operand:SI 0 "register_operand" "+r")
7208 (plus:SI (reg:SI SP_REG) (const_int -4)))
7209 (set (mem:SI (plus:SI (reg:SI SP_REG) (const_int -4)))
7211 (set (reg:SI SP_REG)
7212 (plus:SI (reg:SI SP_REG)
7213 (match_operand:SI 1 "const_int_operand")))]
7214 "TARGET_68020 || INTVAL (operands[1]) >= -0x8004"
7216 operands[1] = GEN_INT (INTVAL (operands[1]) + 4);
7218 return "link %0,%1";
7219 else if (INTVAL (operands[1]) >= -0x8000)
7220 return "link.w %0,%1";
7222 return "link.l %0,%1";
7224 [(set_attr "type" "link")])
7226 (define_expand "unlink"
7228 [(set (match_operand:SI 0 "register_operand")
7230 (set (reg:SI SP_REG)
7231 (plus:SI (match_dup 0)
7235 operands[1] = gen_frame_mem (SImode, copy_rtx (operands[0]));
7238 (define_insn "*unlink"
7239 [(set (match_operand:SI 0 "register_operand" "+r")
7240 (mem:SI (match_dup 0)))
7241 (set (reg:SI SP_REG)
7242 (plus:SI (match_dup 0)
7246 [(set_attr "type" "unlk")])
7248 (define_insn "load_got"
7249 [(set (match_operand:SI 0 "register_operand" "=a")
7250 (unspec:SI [(const_int 0)] UNSPEC_GOT))]
7253 if (TARGET_ID_SHARED_LIBRARY)
7255 operands[1] = gen_rtx_REG (Pmode, PIC_REG);
7256 return MOTOROLA ? "move.l %?(%1),%0" : "movel %1@(%?), %0";
7260 if (TARGET_COLDFIRE)
7261 /* Load the full 32-bit PC-relative offset of
7262 _GLOBAL_OFFSET_TABLE_ into the PIC register, then use it to
7263 calculate the absolute value. The offset and "lea"
7264 operation word together occupy 6 bytes. */
7265 return ("move.l #_GLOBAL_OFFSET_TABLE_@GOTPC, %0\n\t"
7266 "lea (-6, %%pc, %0), %0");
7268 return "lea (%%pc, _GLOBAL_OFFSET_TABLE_@GOTPC), %0";
7271 return ("movel #_GLOBAL_OFFSET_TABLE_, %0\n\t"
7272 "lea %%pc@(0,%0:l),%0");
7275 (define_insn "indirect_jump"
7276 [(set (pc) (match_operand:SI 0 "address_operand" "p"))]
7279 [(set_attr "type" "jmp")])
7281 ;; This should not be used unless the add/sub insns can't be.
7284 [(set (match_operand:SI 0 "nonimmediate_operand" "=a")
7285 (match_operand:QI 1 "address_operand" "p"))]
7289 ;; This is the first machine-dependent peephole optimization.
7290 ;; It is useful when a floating value is returned from a function call
7291 ;; and then is moved into an FP register.
7292 ;; But it is mainly intended to test the support for these optimizations.
7295 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))
7296 (set (match_operand:DF 0 "register_operand" "")
7297 (match_operand:DF 1 "register_operand" ""))]
7298 "FP_REG_P (operands[0]) && !FP_REG_P (operands[1])"
7299 [(set (mem:SI (reg:SI SP_REG)) (match_dup 1))
7300 (set (mem:SI (pre_dec:SI (reg:SI SP_REG))) (match_dup 2))
7301 (set (match_dup 0) (mem:DF (post_inc:SI (reg:SI SP_REG))))]
7302 "split_di(operands + 1, 1, operands + 1, operands + 2);")
7304 ;; Optimize a stack-adjust followed by a push of an argument.
7305 ;; This is said to happen frequently with -msoft-float
7306 ;; when there are consecutive library calls.
7309 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))
7310 (set (match_operand:SF 0 "push_operand" "")
7311 (match_operand:SF 1 "general_operand" ""))]
7312 "!reg_mentioned_p (stack_pointer_rtx, operands[0])"
7313 [(set (match_dup 0) (match_dup 1))]
7314 "operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx);")
7317 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
7318 (match_operand:SI 0 "const_int_operand" "")))
7319 (set (match_operand:SF 1 "push_operand" "")
7320 (match_operand:SF 2 "general_operand" ""))]
7321 "INTVAL (operands[0]) > 4
7322 && !reg_mentioned_p (stack_pointer_rtx, operands[2])"
7323 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (match_dup 0)))
7324 (set (match_dup 1) (match_dup 2))]
7326 operands[0] = GEN_INT (INTVAL (operands[0]) - 4);
7327 operands[1] = replace_equiv_address (operands[1], stack_pointer_rtx);
7330 ;; Speed up stack adjust followed by a fullword fixedpoint push.
7331 ;; Constant operands need special care, as replacing a "pea X.w" with
7332 ;; "move.l #X,(%sp)" is often not a win.
7334 ;; Already done by the previous csa pass, left as reference.
7336 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))
7337 (set (match_operand:SI 0 "push_operand" "")
7338 (match_operand:SI 1 "general_operand" ""))]
7339 "!reg_mentioned_p (stack_pointer_rtx, operands[1])"
7340 [(set (match_dup 0) (match_dup 1))]
7341 "operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx);")
7343 ;; Try to use moveq, after stack push has been changed into a simple move.
7345 [(match_scratch:SI 2 "d")
7346 (set (match_operand:SI 0 "memory_operand" "")
7347 (match_operand:SI 1 "const_int_operand" ""))]
7348 "GET_CODE (XEXP (operands[0], 0)) != PRE_DEC
7349 && INTVAL (operands[1]) != 0
7350 && IN_RANGE (INTVAL (operands[1]), -0x80, 0x7f)
7351 && !valid_mov3q_const (INTVAL (operands[1]))"
7352 [(set (match_dup 2) (match_dup 1))
7353 (set (match_dup 0) (match_dup 2))])
7355 ;; This sequence adds an instruction, but is two bytes shorter.
7357 [(match_scratch:SI 2 "d")
7358 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 12)))
7359 (set (match_operand:SI 0 "push_operand" "")
7360 (match_operand:SI 1 "const_int_operand" ""))]
7361 "INTVAL (operands[1]) != 0
7362 && IN_RANGE (INTVAL (operands[1]), -0x80, 0x7f)
7363 && !valid_mov3q_const (INTVAL (operands[1]))"
7364 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 8)))
7365 (set (match_dup 2) (match_dup 1))
7366 (set (match_dup 0) (match_dup 2))]
7367 "operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx);")
7369 ;; Changing pea X.w into a move.l is no real win here.
7371 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
7372 (match_operand:SI 0 "const_int_operand" "")))
7373 (set (match_operand:SI 1 "push_operand" "")
7374 (match_operand:SI 2 "general_operand" ""))]
7375 "INTVAL (operands[0]) > 4
7376 && !reg_mentioned_p (stack_pointer_rtx, operands[2])
7377 && !(CONST_INT_P (operands[2]) && INTVAL (operands[2]) != 0
7378 && IN_RANGE (INTVAL (operands[2]), -0x8000, 0x7fff)
7379 && !valid_mov3q_const (INTVAL (operands[2])))"
7380 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (match_dup 0)))
7381 (set (match_dup 1) (match_dup 2))]
7383 operands[0] = GEN_INT (INTVAL (operands[0]) - 4);
7384 operands[1] = replace_equiv_address (operands[1], stack_pointer_rtx);
7387 ;; Speed up pushing a single byte/two bytes but leaving four bytes of space
7388 ;; (which differs slightly between m680x0 and ColdFire).
7391 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -4)))
7392 (set (match_operand:QI 0 "memory_operand" "")
7393 (match_operand:QI 1 "register_operand" ""))]
7394 "!reg_mentioned_p (stack_pointer_rtx, operands[1])
7395 && GET_CODE (XEXP (operands[0], 0)) == PLUS
7396 && rtx_equal_p (XEXP (XEXP (operands[0], 0), 0), stack_pointer_rtx)
7397 && CONST_INT_P (XEXP (XEXP (operands[0], 0), 1))
7398 && INTVAL (XEXP (XEXP (operands[0], 0), 1)) == 3"
7399 [(set (match_dup 0) (match_dup 1))]
7401 rtx addr = gen_rtx_PRE_DEC (Pmode, stack_pointer_rtx);
7402 operands[0] = adjust_automodify_address (operands[0], SImode, addr, -3);
7403 operands[1] = simplify_gen_subreg (SImode, operands[1], QImode, 0);
7407 [(set (match_operand:QI 0 "push_operand" "")
7408 (match_operand:QI 1 "register_operand" ""))
7409 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -3)))]
7410 "!reg_mentioned_p (stack_pointer_rtx, operands[1])"
7411 [(set (match_dup 0) (match_dup 1))]
7413 operands[0] = adjust_automodify_address (operands[0], SImode,
7414 XEXP (operands[0], 0), -3);
7415 operands[1] = simplify_gen_subreg (SImode, operands[1], QImode, 0);
7419 [(set (match_operand:HI 0 "push_operand" "")
7420 (match_operand:HI 1 "register_operand" ""))
7421 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -2)))]
7422 "!reg_mentioned_p (stack_pointer_rtx, operands[1])"
7423 [(set (match_dup 0) (match_dup 1))]
7425 operands[0] = adjust_automodify_address (operands[0], SImode,
7426 XEXP (operands[0], 0), -2);
7427 operands[1] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
7430 ;; Optimize a series of strict_low_part assignments
7433 [(set (match_operand:SI 0 "register_operand" "")
7435 (set (strict_low_part (match_operand:HI 1 "register_operand" ""))
7436 (match_operand:HI 2 "general_operand" ""))]
7437 "REGNO (operands[0]) == REGNO (operands[1])
7438 && strict_low_part_peephole_ok (HImode, insn, operands[0])"
7439 [(set (strict_low_part (match_dup 1)) (match_dup 2))]
7443 [(set (match_operand:SI 0 "register_operand" "")
7445 (set (strict_low_part (match_operand:QI 1 "register_operand" ""))
7446 (match_operand:QI 2 "general_operand" ""))]
7447 "REGNO (operands[0]) == REGNO (operands[1])
7448 && strict_low_part_peephole_ok (QImode, insn, operands[0])"
7449 [(set (strict_low_part (match_dup 1)) (match_dup 2))]
7457 ;; jCC label ; abnormal loop termination
7458 ;; dbra dN, loop ; normal loop termination
7466 ;; Which moves the jCC condition outside the inner loop for free.
7470 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
7471 [(cc0) (const_int 0)])
7472 (label_ref (match_operand 2 "" ""))
7477 (ne (match_operand:HI 0 "register_operand" "")
7479 (label_ref (match_operand 1 "" ""))
7482 (plus:HI (match_dup 0)
7484 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
7487 output_dbcc_and_branch (operands);
7492 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
7493 [(cc0) (const_int 0)])
7494 (label_ref (match_operand 2 "" ""))
7499 (ne (match_operand:SI 0 "register_operand" "")
7501 (label_ref (match_operand 1 "" ""))
7504 (plus:SI (match_dup 0)
7506 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
7509 output_dbcc_and_branch (operands);
7514 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
7515 [(cc0) (const_int 0)])
7516 (label_ref (match_operand 2 "" ""))
7521 (ge (plus:HI (match_operand:HI 0 "register_operand" "")
7524 (label_ref (match_operand 1 "" ""))
7527 (plus:HI (match_dup 0)
7529 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
7532 output_dbcc_and_branch (operands);
7537 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
7538 [(cc0) (const_int 0)])
7539 (label_ref (match_operand 2 "" ""))
7544 (ge (plus:SI (match_operand:SI 0 "register_operand" "")
7547 (label_ref (match_operand 1 "" ""))
7550 (plus:SI (match_dup 0)
7552 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
7555 output_dbcc_and_branch (operands);
7560 (define_insn "extendsfxf2"
7561 [(set (match_operand:XF 0 "nonimmediate_operand" "=fm,f")
7562 (float_extend:XF (match_operand:SF 1 "general_operand" "f,rmF")))]
7565 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
7567 if (REGNO (operands[0]) == REGNO (operands[1]))
7569 /* Extending float to double in an fp-reg is a no-op.
7570 NOTICE_UPDATE_CC has already assumed that the
7571 cc will be set. So cancel what it did. */
7572 cc_status = cc_prev_status;
7575 return "f%$move%.x %1,%0";
7577 if (FP_REG_P (operands[0]))
7579 if (FP_REG_P (operands[1]))
7580 return "f%$move%.x %1,%0";
7581 else if (ADDRESS_REG_P (operands[1]))
7582 return "move%.l %1,%-\;f%$move%.s %+,%0";
7583 else if (GET_CODE (operands[1]) == CONST_DOUBLE)
7584 return output_move_const_single (operands);
7585 return "f%$move%.s %f1,%0";
7587 return "fmove%.x %f1,%0";
7591 (define_insn "extenddfxf2"
7592 [(set (match_operand:XF 0 "nonimmediate_operand" "=fm,f")
7594 (match_operand:DF 1 "general_operand" "f,rmE")))]
7597 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
7599 if (REGNO (operands[0]) == REGNO (operands[1]))
7601 /* Extending float to double in an fp-reg is a no-op.
7602 NOTICE_UPDATE_CC has already assumed that the
7603 cc will be set. So cancel what it did. */
7604 cc_status = cc_prev_status;
7607 return "fmove%.x %1,%0";
7609 if (FP_REG_P (operands[0]))
7611 if (REG_P (operands[1]))
7614 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
7615 output_asm_insn ("move%.l %1,%-", xoperands);
7616 output_asm_insn ("move%.l %1,%-", operands);
7617 return "f%&move%.d %+,%0";
7619 if (GET_CODE (operands[1]) == CONST_DOUBLE)
7620 return output_move_const_double (operands);
7621 return "f%&move%.d %f1,%0";
7623 return "fmove%.x %f1,%0";
7626 (define_insn "truncxfdf2"
7627 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,!r")
7629 (match_operand:XF 1 "general_operand" "f,f")))]
7632 if (REG_P (operands[0]))
7634 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
7635 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
7636 return "move%.l %+,%0";
7638 return "fmove%.d %f1,%0";
7641 (define_insn "truncxfsf2"
7642 [(set (match_operand:SF 0 "nonimmediate_operand" "=dm")
7644 (match_operand:XF 1 "general_operand" "f")))]
7648 (define_insn "sin<mode>2"
7649 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
7651 [(match_operand:FP 1 "general_operand" "f<FP:dreg>m")] UNSPEC_SIN))]
7652 "TARGET_68881 && flag_unsafe_math_optimizations"
7654 if (FP_REG_P (operands[1]))
7655 return "fsin%.x %1,%0";
7657 return "fsin%.<FP:prec> %1,%0";
7660 (define_insn "cos<mode>2"
7661 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
7663 [(match_operand:FP 1 "general_operand" "f<FP:dreg>m")] UNSPEC_COS))]
7664 "TARGET_68881 && flag_unsafe_math_optimizations"
7666 if (FP_REG_P (operands[1]))
7667 return "fcos%.x %1,%0";
7669 return "fcos%.<FP:prec> %1,%0";
7672 ;; Unconditional traps are assumed to have (const_int 1) for the condition.
7674 [(trap_if (const_int 1) (const_int 7))]
7677 [(set_attr "type" "trap")])
7679 (define_expand "ctrapdi4"
7680 [(trap_if (match_operator 0 "ordered_comparison_operator"
7681 [(cc0) (const_int 0)])
7682 (match_operand:SI 3 "const1_operand" ""))]
7685 if (operands[2] == const0_rtx)
7686 emit_insn (gen_tstdi (operands[1]));
7688 emit_insn (gen_cmpdi (operands[1], operands[2]));
7689 operands[1] = cc0_rtx;
7690 operands[2] = const0_rtx;
7693 (define_expand "ctrapsi4"
7695 (compare (match_operand:SI 1 "nonimmediate_operand" "")
7696 (match_operand:SI 2 "general_operand" "")))
7697 (trap_if (match_operator 0 "ordered_comparison_operator"
7698 [(cc0) (const_int 0)])
7699 (match_operand:SI 3 "const1_operand" ""))]
7703 (define_expand "ctraphi4"
7705 (compare (match_operand:HI 1 "nonimmediate_src_operand" "")
7706 (match_operand:HI 2 "general_src_operand" "")))
7707 (trap_if (match_operator 0 "ordered_comparison_operator"
7708 [(cc0) (const_int 0)])
7709 (match_operand:SI 3 "const1_operand" ""))]
7713 (define_expand "ctrapqi4"
7715 (compare (match_operand:QI 1 "nonimmediate_src_operand" "")
7716 (match_operand:QI 2 "general_src_operand" "")))
7717 (trap_if (match_operator 0 "ordered_comparison_operator"
7718 [(cc0) (const_int 0)])
7719 (match_operand:SI 3 "const1_operand" ""))]
7723 (define_insn "*conditional_trap"
7724 [(trap_if (match_operator 0 "ordered_comparison_operator"
7725 [(cc0) (const_int 0)])
7726 (match_operand:SI 1 "const1_operand" "I"))]
7727 "TARGET_68020 && ! flags_in_68881 ()"
7729 switch (GET_CODE (operands[0]))
7731 case EQ: return "trapeq";
7732 case NE: return "trapne";
7733 case GT: return "trapgt";
7734 case GTU: return "traphi";
7735 case LT: return "traplt";
7736 case LTU: return "trapcs";
7737 case GE: return "trapge";
7738 case GEU: return "trapcc";
7739 case LE: return "traple";
7740 case LEU: return "trapls";
7741 default: gcc_unreachable ();
7745 ;; These are to prevent the scheduler from moving stores to the frame
7746 ;; before the stack adjustment.
7747 (define_insn "stack_tie"
7748 [(set (mem:BLK (scratch))
7749 (unspec:BLK [(match_operand:SI 0 "register_operand" "r")
7750 (match_operand:SI 1 "register_operand" "r")]
7754 [(set_attr "type" "ignore")])
7756 ;; Instruction that subscribes one word in ColdFire instruction buffer.
7757 ;; This instruction is used within scheduler only and should not appear
7758 ;; in the instruction stream.
7760 [(unspec [(const_int 0)] UNSPEC_IB)]
7763 [(set_attr "type" "ib")])