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
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.
303 (define_expand "tstdi"
304 [(parallel [(set (cc0)
305 (match_operand:DI 0 "nonimmediate_operand" ""))
306 (clobber (match_scratch:SI 1 ""))
307 (clobber (match_scratch:DI 2 ""))])]
309 "m68k_last_compare_had_fp_operands = 0;")
313 (match_operand:DI 0 "nonimmediate_operand" "am,d"))
314 (clobber (match_scratch:SI 1 "=X,d"))
315 (clobber (match_scratch:DI 2 "=d,X"))]
318 if (which_alternative == 0)
322 xoperands[0] = operands[2];
323 xoperands[1] = operands[0];
324 output_move_double (xoperands);
325 cc_status.flags |= CC_REVERSED; /*|*/
326 return "neg%.l %R2\;negx%.l %2";
328 if (find_reg_note (insn, REG_DEAD, operands[0]))
330 cc_status.flags |= CC_REVERSED; /*|*/
331 return "neg%.l %R0\;negx%.l %0";
335 'sub' clears %1, and also clears the X cc bit
336 'tst' sets the Z cc bit according to the low part of the DImode operand
337 'subx %1' (i.e. subx #0) acts as a (non-existent) tstx on the high part.
339 return "sub%.l %1,%1\;tst%.l %R0\;subx%.l %1,%0";
342 (define_expand "tstsi"
344 (match_operand:SI 0 "nonimmediate_operand" ""))]
346 "m68k_last_compare_had_fp_operands = 0;")
348 ;; If you think that the 68020 does not support tstl a0,
349 ;; reread page B-167 of the 68020 manual more carefully.
350 (define_insn "*tstsi_internal_68020_cf"
352 (match_operand:SI 0 "nonimmediate_operand" "rm"))]
353 "TARGET_68020 || TARGET_COLDFIRE"
355 [(set_attr "type" "tst_l")])
357 ;; On an address reg, cmpw may replace cmpl.
358 (define_insn "*tstsi_internal"
360 (match_operand:SI 0 "nonimmediate_operand" "dm,r"))]
361 "!(TARGET_68020 || TARGET_COLDFIRE)"
365 [(set_attr "type" "tst_l,cmp")])
367 ;; This can't use an address register, because comparisons
368 ;; with address registers as second operand always test the whole word.
369 (define_expand "tsthi"
371 (match_operand:HI 0 "nonimmediate_operand" ""))]
373 "m68k_last_compare_had_fp_operands = 0;")
375 (define_insn "*tsthi_internal"
377 (match_operand:HI 0 "nonimmediate_operand" "dm"))]
380 [(set_attr "type" "tst")])
382 (define_expand "tstqi"
384 (match_operand:QI 0 "nonimmediate_operand" ""))]
386 "m68k_last_compare_had_fp_operands = 0;")
388 (define_insn "*tstqi_internal"
390 (match_operand:QI 0 "nonimmediate_operand" "dm"))]
393 [(set_attr "type" "tst")])
395 (define_expand "tst<mode>"
397 (match_operand:FP 0 "general_operand" ""))]
400 m68k_last_compare_had_fp_operands = 1;
403 (define_insn "tst<mode>_68881"
405 (match_operand:FP 0 "general_operand" "f<FP:dreg>m"))]
408 cc_status.flags = CC_IN_68881;
409 if (FP_REG_P (operands[0]))
411 return "ftst%.<FP:prec> %0";
413 [(set_attr "type" "ftst")])
415 (define_insn "tst<mode>_cf"
417 (match_operand:FP 0 "general_operand" "f<FP:dreg><Q>U"))]
418 "TARGET_COLDFIRE_FPU"
420 cc_status.flags = CC_IN_68881;
421 if (FP_REG_P (operands[0]))
423 return "ftst%.<FP:prec> %0";
425 [(set_attr "type" "ftst")])
428 ;; compare instructions.
430 (define_expand "cmpdi"
433 (compare (match_operand:DI 0 "nonimmediate_operand" "")
434 (match_operand:DI 1 "general_operand" "")))
435 (clobber (match_scratch:DI 2 ""))])]
437 "m68k_last_compare_had_fp_operands = 0;")
441 (compare (match_operand:DI 1 "nonimmediate_operand" "0,d")
442 (match_operand:DI 2 "general_operand" "d,0")))
443 (clobber (match_scratch:DI 0 "=d,d"))]
446 if (rtx_equal_p (operands[0], operands[1]))
447 return "sub%.l %R2,%R0\;subx%.l %2,%0";
450 cc_status.flags |= CC_REVERSED; /*|*/
451 return "sub%.l %R1,%R0\;subx%.l %1,%0";
455 (define_expand "cmpsi"
457 (compare (match_operand:SI 0 "nonimmediate_operand" "")
458 (match_operand:SI 1 "general_operand" "")))]
461 m68k_last_compare_had_fp_operands = 0;
464 ;; A composite of the cmp, cmpa, cmpi & cmpm m68000 op codes.
467 (compare (match_operand:SI 0 "nonimmediate_operand" "rKT,rKs,mSr,mSa,>")
468 (match_operand:SI 1 "general_src_operand" "mSr,mSa,KTr,Ksr,>")))]
471 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
472 return "cmpm%.l %1,%0";
473 if (REG_P (operands[1])
474 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
476 cc_status.flags |= CC_REVERSED; /*|*/
477 return "cmp%.l %d0,%d1";
479 if (ADDRESS_REG_P (operands[0])
480 && GET_CODE (operands[1]) == CONST_INT
481 && INTVAL (operands[1]) < 0x8000
482 && INTVAL (operands[1]) >= -0x8000)
483 return "cmp%.w %1,%0";
484 return "cmp%.l %d1,%d0";
487 (define_insn "*cmpsi_cf"
489 (compare (match_operand:SI 0 "nonimmediate_operand" "mrKs,r")
490 (match_operand:SI 1 "general_operand" "r,mrKs")))]
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 return "cmp%.l %d1,%d0";
501 [(set_attr "type" "cmp_l")])
503 (define_expand "cmphi"
505 (compare (match_operand:HI 0 "nonimmediate_src_operand" "")
506 (match_operand:HI 1 "general_src_operand" "")))]
508 "m68k_last_compare_had_fp_operands = 0;")
512 (compare (match_operand:HI 0 "nonimmediate_src_operand" "rnmS,d,n,mS,>")
513 (match_operand:HI 1 "general_src_operand" "d,rnmS,mS,n,>")))]
516 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
517 return "cmpm%.w %1,%0";
518 if ((REG_P (operands[1]) && !ADDRESS_REG_P (operands[1]))
519 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
521 cc_status.flags |= CC_REVERSED; /*|*/
522 return "cmp%.w %d0,%d1";
524 return "cmp%.w %d1,%d0";
527 (define_expand "cmpqi"
529 (compare (match_operand:QI 0 "nonimmediate_src_operand" "")
530 (match_operand:QI 1 "general_src_operand" "")))]
532 "m68k_last_compare_had_fp_operands = 0;")
536 (compare (match_operand:QI 0 "nonimmediate_src_operand" "dn,dmS,>")
537 (match_operand:QI 1 "general_src_operand" "dmS,nd,>")))]
540 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
541 return "cmpm%.b %1,%0";
542 if (REG_P (operands[1])
543 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
545 cc_status.flags |= CC_REVERSED; /*|*/
546 return "cmp%.b %d0,%d1";
548 return "cmp%.b %d1,%d0";
551 (define_expand "cmp<mode>"
553 (compare (match_operand:FP 0 "register_operand" "")
554 (match_operand:FP 1 "fp_src_operand" "")))]
556 "m68k_last_compare_had_fp_operands = 1;")
558 (define_insn "*cmp<mode>_68881"
560 (compare (match_operand:FP 0 "fp_src_operand" "f,f,<FP:dreg>mF")
561 (match_operand:FP 1 "fp_src_operand" "f,<FP:dreg>mF,f")))]
563 && (register_operand (operands[0], <MODE>mode)
564 || register_operand (operands[1], <MODE>mode))"
567 fcmp%.<FP:prec> %f1,%0
568 fcmp%.<FP:prec> %0,%f1"
569 [(set_attr "type" "fcmp")])
571 (define_insn "*cmp<mode>_cf"
573 (compare (match_operand:FP 0 "fp_src_operand" "f,f,<FP:dreg><Q>U")
574 (match_operand:FP 1 "fp_src_operand" "f,<FP:dreg><Q>U,f")))]
576 && (register_operand (operands[0], <MODE>mode)
577 || register_operand (operands[1], <MODE>mode))"
580 fcmp%.<FP:prec> %f1,%0
581 fcmp%.<FP:prec> %0,%f1"
582 [(set_attr "type" "fcmp")])
584 ;; Recognizers for btst instructions.
586 ;; ColdFire/5200 only allows "<Q>" type addresses when the bit position is
587 ;; specified as a constant, so we must disable all patterns that may extract
588 ;; from a MEM at a constant bit position if we can't use this as a constraint.
591 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_src_operand" "oS")
593 (minus:SI (const_int 7)
594 (match_operand:SI 1 "general_operand" "di"))))]
597 return output_btst (operands, operands[1], operands[0], insn, 7);
600 ;; This is the same as the above pattern except for the constraints. The 'i'
604 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "o")
606 (minus:SI (const_int 7)
607 (match_operand:SI 1 "general_operand" "d"))))]
610 return output_btst (operands, operands[1], operands[0], insn, 7);
614 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "d")
616 (minus:SI (const_int 31)
617 (match_operand:SI 1 "general_operand" "di"))))]
620 return output_btst (operands, operands[1], operands[0], insn, 31);
623 ;; The following two patterns are like the previous two
624 ;; except that they use the fact that bit-number operands
625 ;; are automatically masked to 3 or 5 bits.
628 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "o")
630 (minus:SI (const_int 7)
632 (match_operand:SI 1 "register_operand" "d")
636 return output_btst (operands, operands[1], operands[0], insn, 7);
640 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "d")
642 (minus:SI (const_int 31)
644 (match_operand:SI 1 "register_operand" "d")
648 return output_btst (operands, operands[1], operands[0], insn, 31);
651 ;; Nonoffsettable mem refs are ok in this one pattern
652 ;; since we don't try to adjust them.
654 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "m")
656 (match_operand:SI 1 "const_int_operand" "n")))]
657 "(unsigned) INTVAL (operands[1]) < 8 && !TARGET_COLDFIRE"
659 operands[1] = GEN_INT (7 - INTVAL (operands[1]));
660 return output_btst (operands, operands[1], operands[0], insn, 7);
664 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "do")
666 (match_operand:SI 1 "const_int_operand" "n")))]
669 if (GET_CODE (operands[0]) == MEM)
671 operands[0] = adjust_address (operands[0], QImode,
672 INTVAL (operands[1]) / 8);
673 operands[1] = GEN_INT (7 - INTVAL (operands[1]) % 8);
674 return output_btst (operands, operands[1], operands[0], insn, 7);
676 operands[1] = GEN_INT (31 - INTVAL (operands[1]));
677 return output_btst (operands, operands[1], operands[0], insn, 31);
680 ;; This is the same as the above pattern except for the constraints.
681 ;; The 'o' has been replaced with 'Q'.
684 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "dQ")
686 (match_operand:SI 1 "const_int_operand" "n")))]
689 if (GET_CODE (operands[0]) == MEM)
691 operands[0] = adjust_address (operands[0], QImode,
692 INTVAL (operands[1]) / 8);
693 operands[1] = GEN_INT (7 - INTVAL (operands[1]) % 8);
694 return output_btst (operands, operands[1], operands[0], insn, 7);
696 operands[1] = GEN_INT (31 - INTVAL (operands[1]));
697 return output_btst (operands, operands[1], operands[0], insn, 31);
703 ;; A special case in which it is not desirable
704 ;; to reload the constant into a data register.
705 (define_insn "pushexthisi_const"
706 [(set (match_operand:SI 0 "push_operand" "=m,m,m")
707 (match_operand:SI 1 "const_int_operand" "C0,R,J"))]
708 "INTVAL (operands[1]) >= -0x8000 && INTVAL (operands[1]) < 0x8000"
713 [(set_attr "type" "clr_l,mov3q_l,pea")])
716 ;(define_insn "swapsi"
717 ; [(set (match_operand:SI 0 "nonimmediate_operand" "+r")
718 ; (match_operand:SI 1 "general_operand" "+r"))
719 ; (set (match_dup 1) (match_dup 0))]
723 ;; Special case of fullword move when source is zero for 68000_10.
724 ;; moveq is faster on the 68000.
725 (define_insn "*movsi_const0_68000_10"
726 [(set (match_operand:SI 0 "movsi_const0_operand" "=d,a,g")
733 [(set_attr "type" "moveq_l,alu_l,clr_l")
734 (set_attr "opy" "*,0,*")])
736 ;; Special case of fullword move when source is zero for 68040_60.
737 ;; On the '040, 'subl an,an' takes 2 clocks while lea takes only 1
738 (define_insn "*movsi_const0_68040_60"
739 [(set (match_operand:SI 0 "movsi_const0_operand" "=a,g")
743 if (which_alternative == 0)
744 return MOTOROLA ? "lea 0.w,%0" : "lea 0:w,%0";
745 else if (which_alternative == 1)
753 [(set_attr "type" "lea,clr_l")])
755 ;; Special case of fullword move when source is zero.
756 (define_insn "*movsi_const0"
757 [(set (match_operand:SI 0 "movsi_const0_operand" "=a,g")
759 "!(TUNE_68000_10 || TUNE_68040_60)"
763 [(set_attr "type" "alu_l,clr_l")
764 (set_attr "opy" "0,*")])
766 ;; General case of fullword move.
768 ;; This is the main "hook" for PIC code. When generating
769 ;; PIC, movsi is responsible for determining when the source address
770 ;; needs PIC relocation and appropriately calling legitimize_pic_address
771 ;; to perform the actual relocation.
773 ;; In both the PIC and non-PIC cases the patterns generated will
774 ;; matched by the next define_insn.
775 (define_expand "movsi"
776 [(set (match_operand:SI 0 "" "")
777 (match_operand:SI 1 "" ""))]
780 rtx tmp, base, offset;
782 if (flag_pic && !TARGET_PCREL && symbolic_operand (operands[1], SImode))
784 /* The source is an address which requires PIC relocation.
785 Call legitimize_pic_address with the source, mode, and a relocation
786 register (a new pseudo, or the final destination if reload_in_progress
787 is set). Then fall through normally */
788 rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
789 operands[1] = legitimize_pic_address (operands[1], SImode, temp);
791 else if (flag_pic && TARGET_PCREL && ! reload_in_progress)
793 /* Don't allow writes to memory except via a register;
794 the m68k doesn't consider PC-relative addresses to be writable. */
795 if (symbolic_operand (operands[0], SImode))
796 operands[0] = force_reg (SImode, XEXP (operands[0], 0));
797 else if (GET_CODE (operands[0]) == MEM
798 && symbolic_operand (XEXP (operands[0], 0), SImode))
799 operands[0] = gen_rtx_MEM (SImode,
800 force_reg (SImode, XEXP (operands[0], 0)));
802 if (M68K_OFFSETS_MUST_BE_WITHIN_SECTIONS_P)
804 split_const (operands[1], &base, &offset);
805 if (GET_CODE (base) == SYMBOL_REF
806 && !offset_within_block_p (base, INTVAL (offset)))
808 tmp = !can_create_pseudo_p () ? operands[0] : gen_reg_rtx (SImode);
809 emit_move_insn (tmp, base);
810 emit_insn (gen_addsi3 (operands[0], tmp, offset));
816 ;; General case of fullword move.
817 (define_insn "*movsi_m68k"
818 ;; Notes: make sure no alternative allows g vs g.
819 ;; We don't allow f-regs since fixed point cannot go in them.
820 [(set (match_operand:SI 0 "nonimmediate_operand" "=g,d,a<")
821 (match_operand:SI 1 "general_src_operand" "damSnT,n,i"))]
822 "!TARGET_COLDFIRE && reload_completed"
824 return output_move_simode (operands);
827 ;; Before reload is completed the register constraints
828 ;; force integer constants in range for a moveq to be reloaded
829 ;; if they are headed for memory.
830 (define_insn "*movsi_m68k2"
831 [(set (match_operand:SI 0 "nonimmediate_operand" "=g,d,a<")
832 (match_operand:SI 1 "general_src_operand" "damSKT,n,i"))]
836 return output_move_simode (operands);
839 ;; ColdFire move instructions can have at most one operand of mode >= 6.
840 (define_insn "*movsi_cf"
841 [(set (match_operand:SI 0 "nonimmediate_operand" "=g,d, d, d, d, d, a,Ap, a, r<Q>,g, U")
842 (match_operand:SI 1 "general_operand" " R,CQ,CW,CZ,CS,Ci,J,J Cs,Cs, g, Rr<Q>,U"))]
845 switch (which_alternative)
848 return "mov3q%.l %1,%0";
851 return "moveq %1,%0";
855 unsigned u = INTVAL (operands[1]);
857 operands[1] = GEN_INT ((u << 16) | (u >> 16)); /*|*/
858 return "moveq %1,%0\n\tswap %0";
862 return "mvz%.w %1,%0";
865 return "mvs%.w %1,%0";
868 return "move%.l %1,%0";
871 return "move%.w %1,%0";
882 return "move%.l %1,%0";
889 [(set_attr "type" "mov3q_l,moveq_l,*,mvsz,mvsz,move_l,move,pea,lea,move_l,move_l,move_l")])
891 ;; Special case of fullword move, where we need to get a non-GOT PIC
892 ;; reference into an address register.
894 [(set (match_operand:SI 0 "nonimmediate_operand" "=a<")
895 (match_operand:SI 1 "pcrel_address" ""))]
898 if (push_operand (operands[0], SImode))
903 (define_expand "movhi"
904 [(set (match_operand:HI 0 "nonimmediate_operand" "")
905 (match_operand:HI 1 "general_operand" ""))]
910 [(set (match_operand:HI 0 "nonimmediate_operand" "=g")
911 (match_operand:HI 1 "general_src_operand" "gS"))]
913 "* return output_move_himode (operands);")
916 [(set (match_operand:HI 0 "nonimmediate_operand" "=r<Q>,g,U")
917 (match_operand:HI 1 "general_operand" "g,r<Q>,U"))]
919 "* return output_move_himode (operands);")
921 (define_expand "movstricthi"
922 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" ""))
923 (match_operand:HI 1 "general_src_operand" ""))]
928 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
929 (match_operand:HI 1 "general_src_operand" "rmSn"))]
931 "* return output_move_stricthi (operands);")
934 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+d,m"))
935 (match_operand:HI 1 "general_src_operand" "rmn,r"))]
937 "* return output_move_stricthi (operands);")
939 (define_expand "movqi"
940 [(set (match_operand:QI 0 "nonimmediate_operand" "")
941 (match_operand:QI 1 "general_src_operand" ""))]
946 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,*a,m")
947 (match_operand:QI 1 "general_src_operand" "dmSi*a,di*a,dmSi"))]
949 "* return output_move_qimode (operands);")
952 [(set (match_operand:QI 0 "nonimmediate_operand" "=d<Q>,dm,U,d*a")
953 (match_operand:QI 1 "general_src_operand" "dmi,d<Q>,U,di*a"))]
955 "* return output_move_qimode (operands);")
957 (define_expand "movstrictqi"
958 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" ""))
959 (match_operand:QI 1 "general_src_operand" ""))]
964 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
965 (match_operand:QI 1 "general_src_operand" "dmSn"))]
967 "* return output_move_strictqi (operands);")
969 (define_insn "*movstrictqi_cf"
970 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+d, Ac, d,m"))
971 (match_operand:QI 1 "general_src_operand" "C0,C0, dmn,d"))]
978 [(set_attr "type" "clr,clr,move,move")])
980 (define_expand "pushqi1"
981 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -2)))
982 (set (mem:QI (plus:SI (reg:SI SP_REG) (const_int 1)))
983 (match_operand:QI 0 "general_operand" ""))]
987 (define_expand "reload_insf"
988 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
989 (match_operand:SF 1 "general_operand" "mf"))
990 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
991 "TARGET_COLDFIRE_FPU"
993 if (emit_move_sequence (operands, SFmode, operands[2]))
996 /* We don't want the clobber emitted, so handle this ourselves. */
997 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
1001 (define_expand "reload_outsf"
1002 [(set (match_operand:SF 0 "general_operand" "")
1003 (match_operand:SF 1 "register_operand" "f"))
1004 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
1005 "TARGET_COLDFIRE_FPU"
1007 if (emit_move_sequence (operands, SFmode, operands[2]))
1010 /* We don't want the clobber emitted, so handle this ourselves. */
1011 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
1015 (define_expand "movsf"
1016 [(set (match_operand:SF 0 "nonimmediate_operand" "")
1017 (match_operand:SF 1 "general_operand" ""))]
1022 [(set (match_operand:SF 0 "nonimmediate_operand" "=rmf")
1023 (match_operand:SF 1 "general_operand" "rmfF"))]
1026 if (FP_REG_P (operands[0]))
1028 if (FP_REG_P (operands[1]))
1029 return "f%$move%.x %1,%0";
1030 else if (ADDRESS_REG_P (operands[1]))
1031 return "move%.l %1,%-\;f%$move%.s %+,%0";
1032 else if (GET_CODE (operands[1]) == CONST_DOUBLE)
1033 return output_move_const_single (operands);
1034 return "f%$move%.s %f1,%0";
1036 if (FP_REG_P (operands[1]))
1038 if (ADDRESS_REG_P (operands[0]))
1039 return "fmove%.s %1,%-\;move%.l %+,%0";
1040 return "fmove%.s %f1,%0";
1042 if (operands[1] == CONST0_RTX (SFmode)
1043 /* clr insns on 68000 read before writing. */
1044 && ((TARGET_68010 || TARGET_COLDFIRE)
1045 || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0]))))
1047 if (ADDRESS_REG_P (operands[0]))
1049 /* On the '040, 'subl an,an' takes 2 clocks while lea takes only 1 */
1051 return MOTOROLA ? "lea 0.w,%0" : "lea 0:w,%0";
1053 return "sub%.l %0,%0";
1055 /* moveq is faster on the 68000. */
1056 if (DATA_REG_P (operands[0]) && TUNE_68000_10)
1057 return "moveq #0,%0";
1060 return "move%.l %1,%0";
1063 (define_insn "movsf_cf_soft"
1064 [(set (match_operand:SF 0 "nonimmediate_operand" "=r<Q>,g,U")
1065 (match_operand:SF 1 "general_operand" "g,r<Q>,U"))]
1066 "TARGET_COLDFIRE && !TARGET_COLDFIRE_FPU"
1068 [(set_attr "type" "move_l")])
1070 ;; SFmode MEMs are restricted to modes 2-4 if TARGET_COLDFIRE_FPU.
1071 ;; The move instructions can handle all combinations.
1072 (define_insn "movsf_cf_hard"
1073 [(set (match_operand:SF 0 "nonimmediate_operand" "=r<Q>U, f, f,mr,f,r<Q>,f
1075 (match_operand:SF 1 "general_operand" " f, r<Q>U,f,rm,F,F, m
1077 "TARGET_COLDFIRE_FPU"
1079 if (which_alternative == 4 || which_alternative == 5) {
1083 REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
1084 REAL_VALUE_TO_TARGET_SINGLE (r, l);
1085 xoperands[0] = operands[0];
1086 xoperands[1] = GEN_INT (l);
1087 if (which_alternative == 5) {
1089 if (ADDRESS_REG_P (xoperands[0]))
1090 output_asm_insn ("sub%.l %0,%0", xoperands);
1092 output_asm_insn ("clr%.l %0", xoperands);
1094 if (GET_CODE (operands[0]) == MEM
1095 && symbolic_operand (XEXP (operands[0], 0), SImode))
1096 output_asm_insn ("move%.l %1,%-;move%.l %+,%0", xoperands);
1098 output_asm_insn ("move%.l %1,%0", xoperands);
1102 output_asm_insn ("move%.l %1,%-;fsmove%.s %+,%0", xoperands);
1104 output_asm_insn ("clr%.l %-;fsmove%.s %+,%0", xoperands);
1107 if (FP_REG_P (operands[0]))
1109 if (ADDRESS_REG_P (operands[1]))
1110 return "move%.l %1,%-;fsmove%.s %+,%0";
1111 if (FP_REG_P (operands[1]))
1112 return "fsmove%.d %1,%0";
1113 return "fsmove%.s %f1,%0";
1115 if (FP_REG_P (operands[1]))
1117 if (ADDRESS_REG_P (operands[0]))
1118 return "fmove%.s %1,%-;move%.l %+,%0";
1119 return "fmove%.s %f1,%0";
1121 if (operands[1] == CONST0_RTX (SFmode))
1123 if (ADDRESS_REG_P (operands[0]))
1124 return "sub%.l %0,%0";
1127 return "move%.l %1,%0";
1130 (define_expand "reload_indf"
1131 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
1132 (match_operand:DF 1 "general_operand" "mf"))
1133 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
1134 "TARGET_COLDFIRE_FPU"
1136 if (emit_move_sequence (operands, DFmode, operands[2]))
1139 /* We don't want the clobber emitted, so handle this ourselves. */
1140 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
1144 (define_expand "reload_outdf"
1145 [(set (match_operand:DF 0 "general_operand" "")
1146 (match_operand:DF 1 "register_operand" "f"))
1147 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
1148 "TARGET_COLDFIRE_FPU"
1150 if (emit_move_sequence (operands, DFmode, operands[2]))
1153 /* We don't want the clobber emitted, so handle this ourselves. */
1154 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
1158 (define_expand "movdf"
1159 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1160 (match_operand:DF 1 "general_operand" ""))]
1163 if (TARGET_COLDFIRE_FPU)
1164 if (emit_move_sequence (operands, DFmode, 0))
1169 [(set (match_operand:DF 0 "nonimmediate_operand" "=rm,rf,rf,&rof<>")
1170 (match_operand:DF 1 "general_operand" "*rf,m,0,*rofE<>"))]
1171 ; [(set (match_operand:DF 0 "nonimmediate_operand" "=rm,&rf,&rof<>")
1172 ; (match_operand:DF 1 "general_operand" "rf,m,rofF<>"))]
1175 if (FP_REG_P (operands[0]))
1177 if (FP_REG_P (operands[1]))
1178 return "f%&move%.x %1,%0";
1179 if (REG_P (operands[1]))
1182 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1183 output_asm_insn ("move%.l %1,%-", xoperands);
1184 output_asm_insn ("move%.l %1,%-", operands);
1185 return "f%&move%.d %+,%0";
1187 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1188 return output_move_const_double (operands);
1189 return "f%&move%.d %f1,%0";
1191 else if (FP_REG_P (operands[1]))
1193 if (REG_P (operands[0]))
1195 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
1196 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1197 return "move%.l %+,%0";
1200 return "fmove%.d %f1,%0";
1202 return output_move_double (operands);
1205 (define_insn_and_split "movdf_cf_soft"
1206 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,g")
1207 (match_operand:DF 1 "general_operand" "g,r"))]
1208 "TARGET_COLDFIRE && !TARGET_COLDFIRE_FPU"
1210 "&& reload_completed"
1213 m68k_emit_move_double (operands);
1217 (define_insn "movdf_cf_hard"
1218 [(set (match_operand:DF 0 "nonimmediate_operand" "=f, <Q>U,r,f,r,r,m,f")
1219 (match_operand:DF 1 "general_operand" " f<Q>U,f, f,r,r,m,r,E"))]
1220 "TARGET_COLDFIRE_FPU"
1226 switch (which_alternative)
1229 return "fdmove%.d %1,%0";
1231 return "fmove%.d %1,%0";
1233 return "fmove%.d %1,%-;move%.l %+,%0;move%.l %+,%R0";
1235 return "move%.l %R1,%-;move%.l %1,%-;fdmove%.d %+,%0";
1236 case 4: case 5: case 6:
1237 return output_move_double (operands);
1239 REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
1240 REAL_VALUE_TO_TARGET_DOUBLE (r, l);
1241 xoperands[0] = operands[0];
1242 xoperands[1] = GEN_INT (l[0]);
1243 xoperands[2] = GEN_INT (l[1]);
1244 if (operands[1] == CONST0_RTX (DFmode))
1245 output_asm_insn ("clr%.l %-;clr%.l %-;fdmove%.d %+,%0",
1249 output_asm_insn ("clr%.l %-;move%.l %1,%-;fdmove%.d %+,%0",
1252 output_asm_insn ("move%.l %2,%-;move%.l %1,%-;fdmove%.d %+,%0",
1258 ;; ??? The XFmode patterns are schizophrenic about whether constants are
1259 ;; allowed. Most but not all have predicates and constraint that disallow
1260 ;; constants. Most but not all have output templates that handle constants.
1261 ;; See also LEGITIMATE_CONSTANT_P.
1263 (define_expand "movxf"
1264 [(set (match_operand:XF 0 "nonimmediate_operand" "")
1265 (match_operand:XF 1 "general_operand" ""))]
1268 /* We can't rewrite operands during reload. */
1269 if (! reload_in_progress)
1271 if (CONSTANT_P (operands[1]))
1273 operands[1] = force_const_mem (XFmode, operands[1]);
1274 if (! memory_address_p (XFmode, XEXP (operands[1], 0)))
1275 operands[1] = adjust_address (operands[1], XFmode, 0);
1277 if (flag_pic && TARGET_PCREL)
1279 /* Don't allow writes to memory except via a register; the
1280 m68k doesn't consider PC-relative addresses to be writable. */
1281 if (GET_CODE (operands[0]) == MEM
1282 && symbolic_operand (XEXP (operands[0], 0), SImode))
1283 operands[0] = gen_rtx_MEM (XFmode,
1284 force_reg (SImode, XEXP (operands[0], 0)));
1290 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,!r,!f,!r,m,!r")
1291 (match_operand:XF 1 "nonimmediate_operand" "m,f,f,f,r,!r,!r,m"))]
1294 if (FP_REG_P (operands[0]))
1296 if (FP_REG_P (operands[1]))
1297 return "fmove%.x %1,%0";
1298 if (REG_P (operands[1]))
1301 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 2);
1302 output_asm_insn ("move%.l %1,%-", xoperands);
1303 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1304 output_asm_insn ("move%.l %1,%-", xoperands);
1305 output_asm_insn ("move%.l %1,%-", operands);
1306 return "fmove%.x %+,%0";
1308 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1309 return "fmove%.x %1,%0";
1310 return "fmove%.x %f1,%0";
1312 if (FP_REG_P (operands[1]))
1314 if (REG_P (operands[0]))
1316 output_asm_insn ("fmove%.x %f1,%-\;move%.l %+,%0", operands);
1317 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1318 output_asm_insn ("move%.l %+,%0", operands);
1319 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1320 return "move%.l %+,%0";
1322 /* Must be memory destination. */
1323 return "fmove%.x %f1,%0";
1325 return output_move_double (operands);
1329 [(set (match_operand:XF 0 "nonimmediate_operand" "=rm,rf,&rof<>")
1330 (match_operand:XF 1 "nonimmediate_operand" "rf,m,rof<>"))]
1331 "! TARGET_68881 && ! TARGET_COLDFIRE"
1333 if (FP_REG_P (operands[0]))
1335 if (FP_REG_P (operands[1]))
1336 return "fmove%.x %1,%0";
1337 if (REG_P (operands[1]))
1340 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 2);
1341 output_asm_insn ("move%.l %1,%-", xoperands);
1342 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1343 output_asm_insn ("move%.l %1,%-", xoperands);
1344 output_asm_insn ("move%.l %1,%-", operands);
1345 return "fmove%.x %+,%0";
1347 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1348 return "fmove%.x %1,%0";
1349 return "fmove%.x %f1,%0";
1351 if (FP_REG_P (operands[1]))
1353 if (REG_P (operands[0]))
1355 output_asm_insn ("fmove%.x %f1,%-\;move%.l %+,%0", operands);
1356 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1357 output_asm_insn ("move%.l %+,%0", operands);
1358 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1359 return "move%.l %+,%0";
1362 return "fmove%.x %f1,%0";
1364 return output_move_double (operands);
1368 [(set (match_operand:XF 0 "nonimmediate_operand" "=r,g")
1369 (match_operand:XF 1 "nonimmediate_operand" "g,r"))]
1370 "! TARGET_68881 && TARGET_COLDFIRE"
1371 "* return output_move_double (operands);")
1373 (define_expand "movdi"
1374 ;; Let's see if it really still needs to handle fp regs, and, if so, why.
1375 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1376 (match_operand:DI 1 "general_operand" ""))]
1380 ;; movdi can apply to fp regs in some cases
1382 ;; Let's see if it really still needs to handle fp regs, and, if so, why.
1383 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r,&ro<>")
1384 (match_operand:DI 1 "general_operand" "rF,m,roi<>F"))]
1385 ; [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,&r,&ro<>,!&rm,!&f")
1386 ; (match_operand:DI 1 "general_operand" "r,m,roi<>,fF"))]
1387 ; [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,&rf,&ro<>,!&rm,!&f")
1388 ; (match_operand:DI 1 "general_operand" "r,m,roi<>,fF,rfF"))]
1391 if (FP_REG_P (operands[0]))
1393 if (FP_REG_P (operands[1]))
1394 return "fmove%.x %1,%0";
1395 if (REG_P (operands[1]))
1398 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1399 output_asm_insn ("move%.l %1,%-", xoperands);
1400 output_asm_insn ("move%.l %1,%-", operands);
1401 return "fmove%.d %+,%0";
1403 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1404 return output_move_const_double (operands);
1405 return "fmove%.d %f1,%0";
1407 else if (FP_REG_P (operands[1]))
1409 if (REG_P (operands[0]))
1411 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
1412 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1413 return "move%.l %+,%0";
1416 return "fmove%.d %f1,%0";
1418 return output_move_double (operands);
1422 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,g")
1423 (match_operand:DI 1 "general_operand" "g,r"))]
1425 "* return output_move_double (operands);")
1427 ;; Thus goes after the move instructions
1428 ;; because the move instructions are better (require no spilling)
1429 ;; when they can apply. It goes before the add/sub insns
1430 ;; so we will prefer it to them.
1432 (define_insn "pushasi"
1433 [(set (match_operand:SI 0 "push_operand" "=m")
1434 (match_operand:SI 1 "address_operand" "p"))]
1437 [(set_attr "type" "pea")])
1439 ;; truncation instructions
1440 (define_insn "truncsiqi2"
1441 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,d")
1443 (match_operand:SI 1 "general_src_operand" "doJS,i")))]
1446 if (GET_CODE (operands[0]) == REG)
1448 /* Must clear condition codes, since the move.l bases them on
1449 the entire 32 bits, not just the desired 8 bits. */
1451 return "move%.l %1,%0";
1453 if (GET_CODE (operands[1]) == MEM)
1454 operands[1] = adjust_address (operands[1], QImode, 3);
1455 return "move%.b %1,%0";
1458 (define_insn "trunchiqi2"
1459 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,d")
1461 (match_operand:HI 1 "general_src_operand" "doJS,i")))]
1464 if (GET_CODE (operands[0]) == REG
1465 && (GET_CODE (operands[1]) == MEM
1466 || GET_CODE (operands[1]) == CONST_INT))
1468 /* Must clear condition codes, since the move.w bases them on
1469 the entire 16 bits, not just the desired 8 bits. */
1471 return "move%.w %1,%0";
1473 if (GET_CODE (operands[0]) == REG)
1475 /* Must clear condition codes, since the move.l bases them on
1476 the entire 32 bits, not just the desired 8 bits. */
1478 return "move%.l %1,%0";
1480 if (GET_CODE (operands[1]) == MEM)
1481 operands[1] = adjust_address (operands[1], QImode, 1);
1482 return "move%.b %1,%0";
1485 (define_insn "truncsihi2"
1486 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm,d")
1488 (match_operand:SI 1 "general_src_operand" "roJS,i")))]
1491 if (GET_CODE (operands[0]) == REG)
1493 /* Must clear condition codes, since the move.l bases them on
1494 the entire 32 bits, not just the desired 8 bits. */
1496 return "move%.l %1,%0";
1498 if (GET_CODE (operands[1]) == MEM)
1499 operands[1] = adjust_address (operands[1], QImode, 2);
1500 return "move%.w %1,%0";
1503 ;; zero extension instructions
1505 ;; two special patterns to match various post_inc/pre_dec patterns
1506 (define_insn_and_split "*zero_extend_inc"
1507 [(set (match_operand 0 "post_inc_operand" "")
1508 (zero_extend (match_operand 1 "register_operand" "")))]
1509 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT &&
1510 GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT &&
1511 GET_MODE_SIZE (GET_MODE (operands[0])) == GET_MODE_SIZE (GET_MODE (operands[1])) * 2"
1519 operands[0] = adjust_address (operands[0], GET_MODE (operands[1]), 0);
1522 (define_insn_and_split "*zero_extend_dec"
1523 [(set (match_operand 0 "pre_dec_operand" "")
1524 (zero_extend (match_operand 1 "register_operand" "")))]
1525 "(GET_MODE (operands[0]) != HImode || XEXP (XEXP (operands[0], 0), 0) != stack_pointer_rtx) &&
1526 GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT &&
1527 GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT &&
1528 GET_MODE_SIZE (GET_MODE (operands[0])) == GET_MODE_SIZE (GET_MODE (operands[1])) * 2"
1536 operands[0] = adjust_address (operands[0], GET_MODE (operands[1]), 0);
1539 (define_insn_and_split "zero_extendqidi2"
1540 [(set (match_operand:DI 0 "register_operand" "")
1541 (zero_extend:DI (match_operand:QI 1 "nonimmediate_src_operand" "")))]
1546 (zero_extend:SI (match_dup 1)))
1550 operands[2] = gen_lowpart (SImode, operands[0]);
1551 operands[3] = gen_highpart (SImode, operands[0]);
1554 (define_insn_and_split "zero_extendhidi2"
1555 [(set (match_operand:DI 0 "register_operand" "")
1556 (zero_extend:DI (match_operand:HI 1 "nonimmediate_src_operand" "")))]
1561 (zero_extend:SI (match_dup 1)))
1565 operands[2] = gen_lowpart (SImode, operands[0]);
1566 operands[3] = gen_highpart (SImode, operands[0]);
1569 (define_expand "zero_extendsidi2"
1570 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1571 (zero_extend:DI (match_operand:SI 1 "nonimmediate_src_operand" "")))]
1574 if (GET_CODE (operands[0]) == MEM
1575 && GET_CODE (operands[1]) == MEM)
1576 operands[1] = force_reg (SImode, operands[1]);
1579 (define_insn_and_split "*zero_extendsidi2"
1580 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1581 (zero_extend:DI (match_operand:SI 1 "nonimmediate_src_operand" "")))]
1582 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
1590 operands[2] = gen_lowpart (SImode, operands[0]);
1591 operands[3] = gen_highpart (SImode, operands[0]);
1594 (define_insn "*zero_extendhisi2_cf"
1595 [(set (match_operand:SI 0 "register_operand" "=d")
1596 (zero_extend:SI (match_operand:HI 1 "nonimmediate_src_operand" "rmS")))]
1599 [(set_attr "type" "mvsz")])
1601 (define_insn "zero_extendhisi2"
1602 [(set (match_operand:SI 0 "register_operand" "=d")
1603 (zero_extend:SI (match_operand:HI 1 "nonimmediate_src_operand" "rmS")))]
1607 (define_expand "zero_extendqihi2"
1608 [(set (match_operand:HI 0 "register_operand" "")
1609 (zero_extend:HI (match_operand:QI 1 "nonimmediate_src_operand" "")))]
1613 (define_insn "*zero_extendqihi2"
1614 [(set (match_operand:HI 0 "register_operand" "=d")
1615 (zero_extend:HI (match_operand:QI 1 "nonimmediate_src_operand" "dmS")))]
1619 (define_insn "*zero_extendqisi2_cfv4"
1620 [(set (match_operand:SI 0 "register_operand" "=d")
1621 (zero_extend:SI (match_operand:QI 1 "nonimmediate_src_operand" "dmS")))]
1624 [(set_attr "type" "mvsz")])
1626 (define_insn "zero_extendqisi2"
1627 [(set (match_operand:SI 0 "register_operand" "=d")
1628 (zero_extend:SI (match_operand:QI 1 "nonimmediate_src_operand" "dmS")))]
1632 ;; these two pattern split everything else which isn't matched by
1633 ;; something else above
1635 [(set (match_operand 0 "register_operand" "")
1636 (zero_extend (match_operand 1 "nonimmediate_src_operand" "")))]
1639 && reg_mentioned_p (operands[0], operands[1])"
1640 [(set (strict_low_part (match_dup 2))
1643 (match_op_dup 4 [(match_dup 0) (match_dup 3)]))]
1645 operands[2] = gen_lowpart (GET_MODE (operands[1]), operands[0]);
1646 operands[3] = GEN_INT (GET_MODE_MASK (GET_MODE (operands[1])));
1647 operands[4] = gen_rtx_AND (GET_MODE (operands[0]), operands[0], operands[3]);
1651 [(set (match_operand 0 "register_operand" "")
1652 (zero_extend (match_operand 1 "nonimmediate_src_operand" "")))]
1653 "!ISA_HAS_MVS_MVZ && reload_completed"
1656 (set (strict_low_part (match_dup 2))
1659 operands[2] = gen_lowpart (GET_MODE (operands[1]), operands[0]);
1662 ;; sign extension instructions
1664 (define_insn "extendqidi2"
1665 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
1666 (sign_extend:DI (match_operand:QI 1 "general_src_operand" "rmS")))]
1670 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1671 if (ISA_HAS_MVS_MVZ)
1672 return "mvs%.b %1,%2\;smi %0\;extb%.l %0";
1673 if (TARGET_68020 || TARGET_COLDFIRE)
1675 if (ADDRESS_REG_P (operands[1]))
1676 return "move%.w %1,%2\;extb%.l %2\;smi %0\;extb%.l %0";
1678 return "move%.b %1,%2\;extb%.l %2\;smi %0\;extb%.l %0";
1682 if (ADDRESS_REG_P (operands[1]))
1683 return "move%.w %1,%2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0\;smi %0";
1685 return "move%.b %1,%2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0\;smi %0";
1689 (define_insn "extendhidi2"
1690 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
1692 (match_operand:HI 1 "general_src_operand" "rmS")))]
1696 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1697 if (ISA_HAS_MVS_MVZ)
1698 return "mvs%.w %1,%2\;smi %0\;extb%.l %0";
1699 if (TARGET_68020 || TARGET_COLDFIRE)
1700 return "move%.w %1,%2\;ext%.l %2\;smi %0\;extb%.l %0";
1702 return "move%.w %1,%2\;ext%.l %2\;smi %0\;ext%.w %0\;ext%.l %0";
1705 (define_insn "extendsidi2"
1706 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,o,o,<")
1708 (match_operand:SI 1 "nonimmediate_src_operand" "rm,rm,r<Q>,rm")))
1709 (clobber (match_scratch:SI 2 "=X,d,d,d"))]
1714 if (which_alternative == 0)
1715 /* Handle alternative 0. */
1717 if (TARGET_68020 || TARGET_COLDFIRE)
1718 return "move%.l %1,%R0\;smi %0\;extb%.l %0";
1720 return "move%.l %1,%R0\;smi %0\;ext%.w %0\;ext%.l %0";
1723 /* Handle alternatives 1, 2 and 3. We don't need to adjust address by 4
1724 in alternative 3 because autodecrement will do that for us. */
1725 operands[3] = adjust_address (operands[0], SImode,
1726 which_alternative == 3 ? 0 : 4);
1727 operands[0] = adjust_address (operands[0], SImode, 0);
1729 if (TARGET_68020 || TARGET_COLDFIRE)
1730 return "move%.l %1,%3\;smi %2\;extb%.l %2\;move%.l %2,%0";
1732 return "move%.l %1,%3\;smi %2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0";
1734 [(set_attr "ok_for_coldfire" "yes,no,yes,yes")])
1736 ;; Special case when one can avoid register clobbering, copy and test
1737 ;; Maybe there is a way to make that the general case, by forcing the
1738 ;; result of the SI tree to be in the lower register of the DI target
1740 (define_insn "extendplussidi"
1741 [(set (match_operand:DI 0 "register_operand" "=d")
1742 (sign_extend:DI (plus:SI (match_operand:SI 1 "general_operand" "%rmn")
1743 (match_operand:SI 2 "general_operand" "rmn"))))]
1747 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1748 if (GET_CODE (operands[1]) == CONST_INT
1749 && (unsigned) INTVAL (operands[1]) > 8)
1751 rtx tmp = operands[1];
1753 operands[1] = operands[2];
1756 if (GET_CODE (operands[1]) == REG
1757 && REGNO (operands[1]) == REGNO (operands[3]))
1758 output_asm_insn ("add%.l %2,%3", operands);
1760 output_asm_insn ("move%.l %2,%3\;add%.l %1,%3", operands);
1761 if (TARGET_68020 || TARGET_COLDFIRE)
1762 return "smi %0\;extb%.l %0";
1764 return "smi %0\;ext%.w %0\;ext%.l %0";
1767 (define_expand "extendhisi2"
1768 [(set (match_operand:SI 0 "nonimmediate_operand" "")
1770 (match_operand:HI 1 "nonimmediate_src_operand" "")))]
1774 (define_insn "*cfv4_extendhisi2"
1775 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
1777 (match_operand:HI 1 "nonimmediate_src_operand" "rmS")))]
1780 [(set_attr "type" "mvsz")])
1782 (define_insn "*68k_extendhisi2"
1783 [(set (match_operand:SI 0 "nonimmediate_operand" "=*d,a")
1785 (match_operand:HI 1 "nonimmediate_src_operand" "0,rmS")))]
1790 [(set_attr "type" "ext,move")])
1792 (define_insn "extendqihi2"
1793 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
1794 (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0")))]
1797 [(set_attr "type" "ext")])
1799 (define_expand "extendqisi2"
1800 [(set (match_operand:SI 0 "nonimmediate_operand" "")
1801 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
1802 "TARGET_68020 || TARGET_COLDFIRE"
1805 (define_insn "*cfv4_extendqisi2"
1806 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
1807 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "rms")))]
1810 [(set_attr "type" "mvsz")])
1812 (define_insn "*68k_extendqisi2"
1813 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
1814 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "0")))]
1815 "TARGET_68020 || (TARGET_COLDFIRE && !ISA_HAS_MVS_MVZ)"
1817 [(set_attr "type" "ext")])
1819 ;; Conversions between float and double.
1821 (define_expand "extendsfdf2"
1822 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1824 (match_operand:SF 1 "general_operand" "")))]
1829 [(set (match_operand:DF 0 "nonimmediate_operand" "=*fdm,f")
1831 (match_operand:SF 1 "general_operand" "f,dmF")))]
1834 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
1836 if (REGNO (operands[0]) == REGNO (operands[1]))
1838 /* Extending float to double in an fp-reg is a no-op.
1839 NOTICE_UPDATE_CC has already assumed that the
1840 cc will be set. So cancel what it did. */
1841 cc_status = cc_prev_status;
1844 return "f%&move%.x %1,%0";
1846 if (FP_REG_P (operands[0]))
1847 return "f%&move%.s %f1,%0";
1848 if (DATA_REG_P (operands[0]) && FP_REG_P (operands[1]))
1850 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
1851 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1852 return "move%.l %+,%0";
1854 return "fmove%.d %f1,%0";
1857 (define_insn "extendsfdf2_cf"
1858 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f")
1860 (match_operand:SF 1 "general_operand" "f,<Q>U")))]
1861 "TARGET_COLDFIRE_FPU"
1863 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
1865 if (REGNO (operands[0]) == REGNO (operands[1]))
1867 /* Extending float to double in an fp-reg is a no-op.
1868 NOTICE_UPDATE_CC has already assumed that the
1869 cc will be set. So cancel what it did. */
1870 cc_status = cc_prev_status;
1873 return "fdmove%.d %1,%0";
1875 return "fdmove%.s %f1,%0";
1878 ;; This cannot output into an f-reg because there is no way to be
1879 ;; sure of truncating in that case.
1880 (define_expand "truncdfsf2"
1881 [(set (match_operand:SF 0 "nonimmediate_operand" "")
1883 (match_operand:DF 1 "general_operand" "")))]
1887 ;; On the '040 we can truncate in a register accurately and easily.
1889 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
1891 (match_operand:DF 1 "general_operand" "fmG")))]
1892 "TARGET_68881 && TARGET_68040"
1894 if (FP_REG_P (operands[1]))
1895 return "f%$move%.x %1,%0";
1896 return "f%$move%.d %f1,%0";
1899 (define_insn "truncdfsf2_cf"
1900 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,d<Q>U")
1902 (match_operand:DF 1 "general_operand" "<Q>U,f")))]
1903 "TARGET_COLDFIRE_FPU"
1907 [(set_attr "type" "fmove")])
1909 (define_insn "*truncdfsf2_68881"
1910 [(set (match_operand:SF 0 "nonimmediate_operand" "=dm")
1912 (match_operand:DF 1 "general_operand" "f")))]
1915 [(set_attr "type" "fmove")])
1917 ;; Conversion between fixed point and floating point.
1918 ;; Note that among the fix-to-float insns
1919 ;; the ones that start with SImode come first.
1920 ;; That is so that an operand that is a CONST_INT
1921 ;; (and therefore lacks a specific machine mode).
1922 ;; will be recognized as SImode (which is always valid)
1923 ;; rather than as QImode or HImode.
1925 (define_expand "floatsi<mode>2"
1926 [(set (match_operand:FP 0 "nonimmediate_operand" "")
1927 (float:FP (match_operand:SI 1 "general_operand" "")))]
1931 (define_insn "floatsi<mode>2_68881"
1932 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1933 (float:FP (match_operand:SI 1 "general_operand" "dmi")))]
1935 "f<FP:round>move%.l %1,%0"
1936 [(set_attr "type" "fmove")])
1938 (define_insn "floatsi<mode>2_cf"
1939 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1940 (float:FP (match_operand:SI 1 "general_operand" "d<Q>U")))]
1941 "TARGET_COLDFIRE_FPU"
1942 "f<FP:prec>move%.l %1,%0"
1943 [(set_attr "type" "fmove")])
1946 (define_expand "floathi<mode>2"
1947 [(set (match_operand:FP 0 "nonimmediate_operand" "")
1948 (float:FP (match_operand:HI 1 "general_operand" "")))]
1952 (define_insn "floathi<mode>2_68881"
1953 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1954 (float:FP (match_operand:HI 1 "general_operand" "dmn")))]
1957 [(set_attr "type" "fmove")])
1959 (define_insn "floathi<mode>2_cf"
1960 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1961 (float:FP (match_operand:HI 1 "general_operand" "d<Q>U")))]
1962 "TARGET_COLDFIRE_FPU"
1964 [(set_attr "type" "fmove")])
1967 (define_expand "floatqi<mode>2"
1968 [(set (match_operand:FP 0 "nonimmediate_operand" "")
1969 (float:FP (match_operand:QI 1 "general_operand" "")))]
1973 (define_insn "floatqi<mode>2_68881"
1974 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1975 (float:FP (match_operand:QI 1 "general_operand" "dmn")))]
1978 [(set_attr "type" "fmove")])
1980 (define_insn "floatqi<mode>2_cf"
1981 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
1982 (float:FP (match_operand:QI 1 "general_operand" "d<Q>U")))]
1983 "TARGET_COLDFIRE_FPU"
1985 [(set_attr "type" "fmove")])
1988 ;; New routines to convert floating-point values to integers
1989 ;; to be used on the '040. These should be faster than trapping
1990 ;; into the kernel to emulate fintrz. They should also be faster
1991 ;; than calling the subroutines fixsfsi or fixdfsi.
1993 (define_insn "fix_truncdfsi2"
1994 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
1995 (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
1996 (clobber (match_scratch:SI 2 "=d"))
1997 (clobber (match_scratch:SI 3 "=d"))]
1998 "TARGET_68881 && TUNE_68040"
2001 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,%!";
2004 (define_insn "fix_truncdfhi2"
2005 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
2006 (fix:HI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
2007 (clobber (match_scratch:SI 2 "=d"))
2008 (clobber (match_scratch:SI 3 "=d"))]
2009 "TARGET_68881 && TUNE_68040"
2012 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,%!";
2015 (define_insn "fix_truncdfqi2"
2016 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
2017 (fix:QI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
2018 (clobber (match_scratch:SI 2 "=d"))
2019 (clobber (match_scratch:SI 3 "=d"))]
2020 "TARGET_68881 && TUNE_68040"
2023 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,%!";
2026 ;; Convert a float to a float whose value is an integer.
2027 ;; This is the first stage of converting it to an integer type.
2029 (define_expand "ftrunc<mode>2"
2030 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2031 (fix:FP (match_operand:FP 1 "general_operand" "")))]
2032 "TARGET_HARD_FLOAT && !TUNE_68040"
2035 (define_insn "ftrunc<mode>2_68881"
2036 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2037 (fix:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m")))]
2038 "TARGET_68881 && !TUNE_68040"
2040 if (FP_REG_P (operands[1]))
2041 return "fintrz%.x %f1,%0";
2042 return "fintrz%.<FP:prec> %f1,%0";
2044 [(set_attr "type" "falu")])
2046 (define_insn "ftrunc<mode>2_cf"
2047 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2048 (fix:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U")))]
2049 "TARGET_COLDFIRE_FPU"
2051 if (FP_REG_P (operands[1]))
2052 return "fintrz%.d %f1,%0";
2053 return "fintrz%.<FP:prec> %f1,%0";
2055 [(set_attr "type" "falu")])
2057 ;; Convert a float whose value is an integer
2058 ;; to an actual integer. Second stage of converting float to integer type.
2059 (define_expand "fix<mode>qi2"
2060 [(set (match_operand:QI 0 "nonimmediate_operand" "")
2061 (fix:QI (match_operand:FP 1 "general_operand" "")))]
2065 (define_insn "fix<mode>qi2_68881"
2066 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
2067 (fix:QI (match_operand:FP 1 "general_operand" "f")))]
2070 [(set_attr "type" "fmove")])
2072 (define_insn "fix<mode>qi2_cf"
2073 [(set (match_operand:QI 0 "nonimmediate_operand" "=d<Q>U")
2074 (fix:QI (match_operand:FP 1 "general_operand" "f")))]
2075 "TARGET_COLDFIRE_FPU"
2077 [(set_attr "type" "fmove")])
2079 (define_expand "fix<mode>hi2"
2080 [(set (match_operand:HI 0 "nonimmediate_operand" "")
2081 (fix:HI (match_operand:FP 1 "general_operand" "")))]
2085 (define_insn "fix<mode>hi2_68881"
2086 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
2087 (fix:HI (match_operand:FP 1 "general_operand" "f")))]
2090 [(set_attr "type" "fmove")])
2092 (define_insn "fix<mode>hi2_cf"
2093 [(set (match_operand:HI 0 "nonimmediate_operand" "=d<Q>U")
2094 (fix:HI (match_operand:FP 1 "general_operand" "f")))]
2095 "TARGET_COLDFIRE_FPU"
2097 [(set_attr "type" "fmove")])
2099 (define_expand "fix<mode>si2"
2100 [(set (match_operand:SI 0 "nonimmediate_operand" "")
2101 (fix:SI (match_operand:FP 1 "general_operand" "")))]
2105 (define_insn "fix<mode>si2_68881"
2106 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
2107 (fix:SI (match_operand:FP 1 "general_operand" "f")))]
2110 [(set_attr "type" "fmove")])
2112 (define_insn "fix<mode>si2_cf"
2113 [(set (match_operand:SI 0 "nonimmediate_operand" "=d<Q>U")
2114 (fix:SI (match_operand:FP 1 "general_operand" "f")))]
2115 "TARGET_COLDFIRE_FPU"
2117 [(set_attr "type" "fmove")])
2122 (define_insn "adddi_lshrdi_63"
2123 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
2124 (plus:DI (lshiftrt:DI (match_operand:DI 1 "general_operand" "rm")
2127 (clobber (match_scratch:SI 2 "=d"))]
2130 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
2131 if (REG_P (operands[1]) && REGNO (operands[1]) == REGNO (operands[0]))
2133 "move%.l %1,%2\;add%.l %2,%2\;subx%.l %2,%2\;sub%.l %2,%3\;subx%.l %2,%0";
2134 if (GET_CODE (operands[1]) == REG)
2135 operands[4] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
2136 else if (GET_CODE (XEXP (operands[1], 0)) == POST_INC
2137 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
2138 operands[4] = operands[1];
2140 operands[4] = adjust_address (operands[1], SImode, 4);
2141 if (GET_CODE (operands[1]) == MEM
2142 && GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
2143 output_asm_insn ("move%.l %4,%3", operands);
2144 output_asm_insn ("move%.l %1,%0\;smi %2", operands);
2145 if (TARGET_68020 || TARGET_COLDFIRE)
2146 output_asm_insn ("extb%.l %2", operands);
2148 output_asm_insn ("ext%.w %2\;ext%.l %2", operands);
2149 if (GET_CODE (operands[1]) != MEM
2150 || GET_CODE (XEXP (operands[1], 0)) != PRE_DEC)
2151 output_asm_insn ("move%.l %4,%3", operands);
2152 return "sub%.l %2,%3\;subx%.l %2,%0";
2155 (define_insn "adddi_sexthishl32"
2156 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,a,*d,*d")
2157 (plus:DI (ashift:DI (sign_extend:DI
2158 (match_operand:HI 1 "general_operand" "rm,rm,rm,rm"))
2160 (match_operand:DI 2 "general_operand" "0,0,0,0")))
2161 (clobber (match_scratch:SI 3 "=&d,X,a,?d"))]
2165 if (ADDRESS_REG_P (operands[0]))
2166 return "add%.w %1,%0";
2167 else if (ADDRESS_REG_P (operands[3]))
2168 return "move%.w %1,%3\;add%.l %3,%0";
2170 return "move%.w %1,%3\;ext%.l %3\;add%.l %3,%0";
2173 (define_insn "*adddi_dilshr32"
2174 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,o")
2175 (plus:DI (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro,d")
2177 (match_operand:DI 2 "general_operand" "0,0")))]
2181 if (GET_CODE (operands[0]) == REG)
2182 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
2184 operands[2] = adjust_address (operands[0], SImode, 4);
2185 return "add%.l %1,%2\;negx%.l %0\;neg%.l %0";
2188 (define_insn "*adddi_dilshr32_cf"
2189 [(set (match_operand:DI 0 "register_operand" "=d")
2190 (plus:DI (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "ro")
2192 (match_operand:DI 2 "register_operand" "0")))]
2196 return "add%.l %1,%R0\;negx%.l %0\;neg%.l %0";
2199 (define_insn "adddi_dishl32"
2200 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o")
2201 ;; (plus:DI (match_operand:DI 2 "general_operand" "%0")
2202 ;; (ashift:DI (match_operand:DI 1 "general_operand" "ro")
2203 ;; (const_int 32))))]
2204 (plus:DI (ashift:DI (match_operand:DI 1 "general_operand" "ro,d")
2206 (match_operand:DI 2 "general_operand" "0,0")))]
2210 if (GET_CODE (operands[1]) == REG)
2211 operands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
2213 operands[1] = adjust_address (operands[1], SImode, 4);
2214 return "add%.l %1,%0";
2216 [(set_attr "type" "alu_l")])
2218 (define_insn "adddi3"
2219 [(set (match_operand:DI 0 "nonimmediate_operand" "=o<>,d,d,d")
2220 (plus:DI (match_operand:DI 1 "general_operand" "%0,0,0,0")
2221 (match_operand:DI 2 "general_operand" "d,no>,d,a")))
2222 (clobber (match_scratch:SI 3 "=&d,&d,X,&d"))]
2225 if (DATA_REG_P (operands[0]))
2227 if (DATA_REG_P (operands[2]))
2228 return "add%.l %R2,%R0\;addx%.l %2,%0";
2229 else if (GET_CODE (operands[2]) == MEM
2230 && GET_CODE (XEXP (operands[2], 0)) == POST_INC)
2231 return "move%.l %2,%3\;add%.l %2,%R0\;addx%.l %3,%0";
2237 if (GET_CODE (operands[2]) == REG)
2239 low = gen_rtx_REG (SImode, REGNO (operands[2]) + 1);
2242 else if (CONSTANT_P (operands[2]))
2243 split_double (operands[2], &high, &low);
2246 low = adjust_address (operands[2], SImode, 4);
2250 operands[1] = low, operands[2] = high;
2251 xoperands[0] = operands[3];
2252 if (GET_CODE (operands[1]) == CONST_INT
2253 && INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
2254 xoperands[1] = GEN_INT (-INTVAL (operands[2]) - 1);
2256 xoperands[1] = operands[2];
2258 output_asm_insn (output_move_simode (xoperands), xoperands);
2259 if (GET_CODE (operands[1]) == CONST_INT)
2261 if (INTVAL (operands[1]) > 0 && INTVAL (operands[1]) <= 8)
2262 return "addq%.l %1,%R0\;addx%.l %3,%0";
2263 else if (INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
2265 operands[1] = GEN_INT (-INTVAL (operands[1]));
2266 return "subq%.l %1,%R0\;subx%.l %3,%0";
2269 return "add%.l %1,%R0\;addx%.l %3,%0";
2274 gcc_assert (GET_CODE (operands[0]) == MEM);
2276 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
2278 operands[1] = gen_rtx_MEM (SImode,
2279 plus_constant (XEXP(operands[0], 0), -8));
2280 return "move%.l %0,%3\;add%.l %R2,%0\;addx%.l %2,%3\;move%.l %3,%1";
2282 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
2284 operands[1] = XEXP(operands[0], 0);
2285 return "add%.l %R2,%0\;move%.l %0,%3\;addx%.l %2,%3\;move%.l %3,%1";
2289 operands[1] = adjust_address (operands[0], SImode, 4);
2290 return "add%.l %R2,%1\;move%.l %0,%3\;addx%.l %2,%3\;move%.l %3,%0";
2295 (define_insn "addsi_lshrsi_31"
2296 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm,dm,d<Q>")
2297 (plus:SI (lshiftrt:SI (match_operand:SI 1 "general_operand" "rm,r<Q>,rm")
2302 operands[2] = operands[0];
2303 operands[3] = gen_label_rtx();
2304 if (GET_CODE (operands[0]) == MEM)
2306 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
2307 operands[0] = gen_rtx_MEM (SImode, XEXP (XEXP (operands[0], 0), 0));
2308 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
2309 operands[2] = gen_rtx_MEM (SImode, XEXP (XEXP (operands[0], 0), 0));
2311 output_asm_insn ("move%.l %1,%0", operands);
2312 output_asm_insn ("jpl %l3", operands);
2313 output_asm_insn ("addq%.l #1,%2", operands);
2314 (*targetm.asm_out.internal_label) (asm_out_file, "L",
2315 CODE_LABEL_NUMBER (operands[3]));
2318 [(set_attr "ok_for_coldfire" "no,yes,yes")])
2320 (define_expand "addsi3"
2321 [(set (match_operand:SI 0 "nonimmediate_operand" "")
2322 (plus:SI (match_operand:SI 1 "general_operand" "")
2323 (match_operand:SI 2 "general_src_operand" "")))]
2327 ;; Note that the middle two alternatives are near-duplicates
2328 ;; in order to handle insns generated by reload.
2329 ;; This is needed since they are not themselves reloaded,
2330 ;; so commutativity won't apply to them.
2331 (define_insn "*addsi3_internal"
2332 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,?a,?a,d,a")
2333 (plus:SI (match_operand:SI 1 "general_operand" "%0,a,rJK,0,0")
2334 (match_operand:SI 2 "general_src_operand" "dIKLT,rJK,a,mSrIKLT,mSrIKLs")))]
2338 "* return output_addsi3 (operands);")
2340 (define_insn_and_split "*addsi3_5200"
2341 [(set (match_operand:SI 0 "nonimmediate_operand" "=mr,mr,a,m,r, ?a, ?a,?a,?a")
2342 (plus:SI (match_operand:SI 1 "general_operand" "%0, 0, 0,0,0, a, a, r, a")
2343 (match_operand:SI 2 "general_src_operand" " I, L, J,d,mrKi,Cj, r, a, J")))]
2346 switch (which_alternative)
2349 return "addq%.l %2,%0";
2352 operands[2] = GEN_INT (- INTVAL (operands[2]));
2353 return "subq%.l %2,%0";
2357 return "add%.l %2,%0";
2360 /* move%.l %2,%0\n\tadd%.l %1,%0 */
2364 return MOTOROLA ? "lea (%1,%2.l),%0" : "lea %1@(0,%2:l),%0";
2367 return MOTOROLA ? "lea (%2,%1.l),%0" : "lea %2@(0,%1:l),%0";
2371 return MOTOROLA ? "lea (%c2,%1),%0" : "lea %1@(%c2),%0";
2378 "&& reload_completed && (extract_constrain_insn_cached (insn), which_alternative == 5) && !operands_match_p (operands[0], operands[1])"
2382 (plus:SI (match_dup 0)
2385 [(set_attr "type" "aluq_l,aluq_l,lea,alu_l,alu_l,*,lea,lea,lea")
2386 (set_attr "opy" "2,2,*,2,2,*,*,*,*")
2387 (set_attr "opy_type" "*,*,mem5,*,*,*,mem6,mem6,mem5")])
2390 [(set (match_operand:SI 0 "nonimmediate_operand" "=a")
2391 (plus:SI (match_operand:SI 1 "general_operand" "0")
2393 (match_operand:HI 2 "nonimmediate_src_operand" "rmS"))))]
2397 (define_insn "addhi3"
2398 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,r")
2399 (plus:HI (match_operand:HI 1 "general_operand" "%0,0")
2400 (match_operand:HI 2 "general_src_operand" "dn,rmSn")))]
2403 if (GET_CODE (operands[2]) == CONST_INT)
2405 /* If the constant would be a negative number when interpreted as
2406 HImode, make it negative. This is usually, but not always, done
2407 elsewhere in the compiler. First check for constants out of range,
2408 which could confuse us. */
2410 if (INTVAL (operands[2]) >= 32768)
2411 operands[2] = GEN_INT (INTVAL (operands[2]) - 65536);
2413 if (INTVAL (operands[2]) > 0
2414 && INTVAL (operands[2]) <= 8)
2415 return "addq%.w %2,%0";
2416 if (INTVAL (operands[2]) < 0
2417 && INTVAL (operands[2]) >= -8)
2419 operands[2] = GEN_INT (- INTVAL (operands[2]));
2420 return "subq%.w %2,%0";
2422 /* On the CPU32 it is faster to use two addqw instructions to
2423 add a small integer (8 < N <= 16) to a register.
2424 Likewise for subqw. */
2425 if (TUNE_CPU32 && REG_P (operands[0]))
2427 if (INTVAL (operands[2]) > 8
2428 && INTVAL (operands[2]) <= 16)
2430 operands[2] = GEN_INT (INTVAL (operands[2]) - 8);
2431 return "addq%.w #8,%0\;addq%.w %2,%0";
2433 if (INTVAL (operands[2]) < -8
2434 && INTVAL (operands[2]) >= -16)
2436 operands[2] = GEN_INT (- INTVAL (operands[2]) - 8);
2437 return "subq%.w #8,%0\;subq%.w %2,%0";
2440 if (ADDRESS_REG_P (operands[0]) && !TUNE_68040)
2441 return MOTOROLA ? "lea (%c2,%0),%0" : "lea %0@(%c2),%0";
2443 return "add%.w %2,%0";
2446 ;; These insns must use MATCH_DUP instead of the more expected
2447 ;; use of a matching constraint because the "output" here is also
2448 ;; an input, so you can't use the matching constraint. That also means
2449 ;; that you can't use the "%", so you need patterns with the matched
2450 ;; operand in both positions.
2453 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
2454 (plus:HI (match_dup 0)
2455 (match_operand:HI 1 "general_src_operand" "dn,rmSn")))]
2458 if (GET_CODE (operands[1]) == CONST_INT)
2460 /* If the constant would be a negative number when interpreted as
2461 HImode, make it negative. This is usually, but not always, done
2462 elsewhere in the compiler. First check for constants out of range,
2463 which could confuse us. */
2465 if (INTVAL (operands[1]) >= 32768)
2466 operands[1] = GEN_INT (INTVAL (operands[1]) - 65536);
2468 if (INTVAL (operands[1]) > 0
2469 && INTVAL (operands[1]) <= 8)
2470 return "addq%.w %1,%0";
2471 if (INTVAL (operands[1]) < 0
2472 && INTVAL (operands[1]) >= -8)
2474 operands[1] = GEN_INT (- INTVAL (operands[1]));
2475 return "subq%.w %1,%0";
2477 /* On the CPU32 it is faster to use two addqw instructions to
2478 add a small integer (8 < N <= 16) to a register.
2479 Likewise for subqw. */
2480 if (TUNE_CPU32 && REG_P (operands[0]))
2482 if (INTVAL (operands[1]) > 8
2483 && INTVAL (operands[1]) <= 16)
2485 operands[1] = GEN_INT (INTVAL (operands[1]) - 8);
2486 return "addq%.w #8,%0\;addq%.w %1,%0";
2488 if (INTVAL (operands[1]) < -8
2489 && INTVAL (operands[1]) >= -16)
2491 operands[1] = GEN_INT (- INTVAL (operands[1]) - 8);
2492 return "subq%.w #8,%0\;subq%.w %1,%0";
2495 if (ADDRESS_REG_P (operands[0]) && !TUNE_68040)
2496 return MOTOROLA ? "lea (%c1,%0),%0" : "lea %0@(%c1),%0";
2498 return "add%.w %1,%0";
2502 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
2503 (plus:HI (match_operand:HI 1 "general_src_operand" "dn,rmSn")
2507 if (GET_CODE (operands[1]) == CONST_INT)
2509 /* If the constant would be a negative number when interpreted as
2510 HImode, make it negative. This is usually, but not always, done
2511 elsewhere in the compiler. First check for constants out of range,
2512 which could confuse us. */
2514 if (INTVAL (operands[1]) >= 32768)
2515 operands[1] = GEN_INT (INTVAL (operands[1]) - 65536);
2517 if (INTVAL (operands[1]) > 0
2518 && INTVAL (operands[1]) <= 8)
2519 return "addq%.w %1,%0";
2520 if (INTVAL (operands[1]) < 0
2521 && INTVAL (operands[1]) >= -8)
2523 operands[1] = GEN_INT (- INTVAL (operands[1]));
2524 return "subq%.w %1,%0";
2526 /* On the CPU32 it is faster to use two addqw instructions to
2527 add a small integer (8 < N <= 16) to a register.
2528 Likewise for subqw. */
2529 if (TUNE_CPU32 && REG_P (operands[0]))
2531 if (INTVAL (operands[1]) > 8
2532 && INTVAL (operands[1]) <= 16)
2534 operands[1] = GEN_INT (INTVAL (operands[1]) - 8);
2535 return "addq%.w #8,%0\;addq%.w %1,%0";
2537 if (INTVAL (operands[1]) < -8
2538 && INTVAL (operands[1]) >= -16)
2540 operands[1] = GEN_INT (- INTVAL (operands[1]) - 8);
2541 return "subq%.w #8,%0\;subq%.w %1,%0";
2544 if (ADDRESS_REG_P (operands[0]) && !TUNE_68040)
2545 return MOTOROLA ? "lea (%c1,%0),%0" : "lea %0@(%c1),%0";
2547 return "add%.w %1,%0";
2550 (define_insn "addqi3"
2551 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
2552 (plus:QI (match_operand:QI 1 "general_operand" "%0,0")
2553 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
2556 if (GET_CODE (operands[2]) == CONST_INT)
2558 if (INTVAL (operands[2]) >= 128)
2559 operands[2] = GEN_INT (INTVAL (operands[2]) - 256);
2561 if (INTVAL (operands[2]) > 0
2562 && INTVAL (operands[2]) <= 8)
2563 return "addq%.b %2,%0";
2564 if (INTVAL (operands[2]) < 0 && INTVAL (operands[2]) >= -8)
2566 operands[2] = GEN_INT (- INTVAL (operands[2]));
2567 return "subq%.b %2,%0";
2570 return "add%.b %2,%0";
2574 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
2575 (plus:QI (match_dup 0)
2576 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
2579 if (GET_CODE (operands[1]) == CONST_INT)
2581 if (INTVAL (operands[1]) >= 128)
2582 operands[1] = GEN_INT (INTVAL (operands[1]) - 256);
2584 if (INTVAL (operands[1]) > 0
2585 && INTVAL (operands[1]) <= 8)
2586 return "addq%.b %1,%0";
2587 if (INTVAL (operands[1]) < 0 && INTVAL (operands[1]) >= -8)
2589 operands[1] = GEN_INT (- INTVAL (operands[1]));
2590 return "subq%.b %1,%0";
2593 return "add%.b %1,%0";
2597 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
2598 (plus:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn")
2602 if (GET_CODE (operands[1]) == CONST_INT)
2604 if (INTVAL (operands[1]) >= 128)
2605 operands[1] = GEN_INT (INTVAL (operands[1]) - 256);
2607 if (INTVAL (operands[1]) > 0
2608 && INTVAL (operands[1]) <= 8)
2609 return "addq%.b %1,%0";
2610 if (INTVAL (operands[1]) < 0 && INTVAL (operands[1]) >= -8)
2612 operands[1] = GEN_INT (- INTVAL (operands[1]));
2613 return "subq%.b %1,%0";
2616 return "add%.b %1,%0";
2619 (define_expand "add<mode>3"
2620 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2621 (plus:FP (match_operand:FP 1 "general_operand" "")
2622 (match_operand:FP 2 "general_operand" "")))]
2626 (define_insn "add<mode>3_floatsi_68881"
2627 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2628 (plus:FP (float:FP (match_operand:SI 2 "general_operand" "dmi"))
2629 (match_operand:FP 1 "general_operand" "0")))]
2631 "f<FP:round>add%.l %2,%0"
2632 [(set_attr "type" "falu")
2633 (set_attr "opy" "2")])
2635 (define_insn "add<mode>3_floathi_68881"
2636 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2637 (plus:FP (float:FP (match_operand:HI 2 "general_operand" "dmn"))
2638 (match_operand:FP 1 "general_operand" "0")))]
2640 "f<FP:round>add%.w %2,%0"
2641 [(set_attr "type" "falu")
2642 (set_attr "opy" "2")])
2644 (define_insn "add<mode>3_floatqi_68881"
2645 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2646 (plus:FP (float:FP (match_operand:QI 2 "general_operand" "dmn"))
2647 (match_operand:FP 1 "general_operand" "0")))]
2649 "f<FP:round>add%.b %2,%0"
2650 [(set_attr "type" "falu")
2651 (set_attr "opy" "2")])
2653 (define_insn "add<mode>3_68881"
2654 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2655 (plus:FP (match_operand:FP 1 "general_operand" "%0")
2656 (match_operand:FP 2 "general_operand" "f<FP:dreg>m<FP:const>")))]
2659 if (FP_REG_P (operands[2]))
2660 return "f<FP:round>add%.x %2,%0";
2661 return "f<FP:round>add%.<FP:prec> %f2,%0";
2663 [(set_attr "type" "falu")
2664 (set_attr "opy" "2")])
2666 (define_insn "add<mode>3_cf"
2667 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2668 (plus:FP (match_operand:FP 1 "general_operand" "%0")
2669 (match_operand:FP 2 "general_operand" "f<FP:dreg><Q>U")))]
2670 "TARGET_COLDFIRE_FPU"
2672 if (FP_REG_P (operands[2]))
2673 return "f<FP:prec>add%.d %2,%0";
2674 return "f<FP:prec>add%.<FP:prec> %2,%0";
2676 [(set_attr "type" "falu")
2677 (set_attr "opy" "2")])
2679 ;; subtract instructions
2681 (define_insn "subdi_sexthishl32"
2682 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,a,*d,*d")
2683 (minus:DI (match_operand:DI 1 "general_operand" "0,0,0,0")
2684 (ashift:DI (sign_extend:DI (match_operand:HI 2 "general_operand" "rm,rm,rm,rm"))
2686 (clobber (match_scratch:SI 3 "=&d,X,a,?d"))]
2690 if (ADDRESS_REG_P (operands[0]))
2691 return "sub%.w %2,%0";
2692 else if (ADDRESS_REG_P (operands[3]))
2693 return "move%.w %2,%3\;sub%.l %3,%0";
2695 return "move%.w %2,%3\;ext%.l %3\;sub%.l %3,%0";
2698 (define_insn "subdi_dishl32"
2699 [(set (match_operand:DI 0 "nonimmediate_operand" "+ro")
2700 (minus:DI (match_dup 0)
2701 (ashift:DI (match_operand:DI 1 "general_operand" "ro")
2706 if (GET_CODE (operands[1]) == REG)
2707 operands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
2709 operands[1] = adjust_address (operands[1], SImode, 4);
2710 return "sub%.l %1,%0";
2712 [(set_attr "type" "alu_l")])
2714 (define_insn "subdi3"
2715 [(set (match_operand:DI 0 "nonimmediate_operand" "=o<>,d,d,d")
2716 (minus:DI (match_operand:DI 1 "general_operand" "0,0,0,0")
2717 (match_operand:DI 2 "general_operand" "d,no>,d,a")))
2718 (clobber (match_scratch:SI 3 "=&d,&d,X,&d"))]
2721 if (DATA_REG_P (operands[0]))
2723 if (DATA_REG_P (operands[2]))
2724 return "sub%.l %R2,%R0\;subx%.l %2,%0";
2725 else if (GET_CODE (operands[2]) == MEM
2726 && GET_CODE (XEXP (operands[2], 0)) == POST_INC)
2728 return "move%.l %2,%3\;sub%.l %2,%R0\;subx%.l %3,%0";
2735 if (GET_CODE (operands[2]) == REG)
2737 low = gen_rtx_REG (SImode, REGNO (operands[2]) + 1);
2740 else if (CONSTANT_P (operands[2]))
2741 split_double (operands[2], &high, &low);
2744 low = adjust_address (operands[2], SImode, 4);
2748 operands[1] = low, operands[2] = high;
2749 xoperands[0] = operands[3];
2750 if (GET_CODE (operands[1]) == CONST_INT
2751 && INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
2752 xoperands[1] = GEN_INT (-INTVAL (operands[2]) - 1);
2754 xoperands[1] = operands[2];
2756 output_asm_insn (output_move_simode (xoperands), xoperands);
2757 if (GET_CODE (operands[1]) == CONST_INT)
2759 if (INTVAL (operands[1]) > 0 && INTVAL (operands[1]) <= 8)
2760 return "subq%.l %1,%R0\;subx%.l %3,%0";
2761 else if (INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
2763 operands[1] = GEN_INT (-INTVAL (operands[1]));
2764 return "addq%.l %1,%R0\;addx%.l %3,%0";
2767 return "sub%.l %1,%R0\;subx%.l %3,%0";
2772 gcc_assert (GET_CODE (operands[0]) == MEM);
2774 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
2777 = gen_rtx_MEM (SImode, plus_constant (XEXP (operands[0], 0), -8));
2778 return "move%.l %0,%3\;sub%.l %R2,%0\;subx%.l %2,%3\;move%.l %3,%1";
2780 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
2782 operands[1] = XEXP(operands[0], 0);
2783 return "sub%.l %R2,%0\;move%.l %0,%3\;subx%.l %2,%3\;move%.l %3,%1";
2787 operands[1] = adjust_address (operands[0], SImode, 4);
2788 return "sub%.l %R2,%1\;move%.l %0,%3\;subx%.l %2,%3\;move%.l %3,%0";
2793 (define_insn "subsi3"
2794 [(set (match_operand:SI 0 "nonimmediate_operand" "=mda,m,d,a")
2795 (minus:SI (match_operand:SI 1 "general_operand" "0,0,0,0")
2796 (match_operand:SI 2 "general_src_operand" "I,dT,mSrT,mSrs")))]
2803 [(set_attr "type" "aluq_l,alu_l,alu_l,alu_l")
2804 (set_attr "opy" "2")])
2807 [(set (match_operand:SI 0 "nonimmediate_operand" "=a")
2808 (minus:SI (match_operand:SI 1 "general_operand" "0")
2810 (match_operand:HI 2 "nonimmediate_src_operand" "rmS"))))]
2814 (define_insn "subhi3"
2815 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,r")
2816 (minus:HI (match_operand:HI 1 "general_operand" "0,0")
2817 (match_operand:HI 2 "general_src_operand" "dn,rmSn")))]
2822 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
2823 (minus:HI (match_dup 0)
2824 (match_operand:HI 1 "general_src_operand" "dn,rmSn")))]
2828 (define_insn "subqi3"
2829 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
2830 (minus:QI (match_operand:QI 1 "general_operand" "0,0")
2831 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
2836 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
2837 (minus:QI (match_dup 0)
2838 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
2842 (define_expand "sub<mode>3"
2843 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2844 (minus:FP (match_operand:FP 1 "general_operand" "")
2845 (match_operand:FP 2 "general_operand" "")))]
2849 (define_insn "sub<mode>3_floatsi_68881"
2850 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2851 (minus:FP (match_operand:FP 1 "general_operand" "0")
2852 (float:FP (match_operand:SI 2 "general_operand" "dmi"))))]
2854 "f<FP:round>sub%.l %2,%0"
2855 [(set_attr "type" "falu")
2856 (set_attr "opy" "2")])
2858 (define_insn "sub<mode>3_floathi_68881"
2859 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2860 (minus:FP (match_operand:FP 1 "general_operand" "0")
2861 (float:FP (match_operand:HI 2 "general_operand" "dmn"))))]
2863 "f<FP:round>sub%.w %2,%0"
2864 [(set_attr "type" "falu")
2865 (set_attr "opy" "2")])
2867 (define_insn "sub<mode>3_floatqi_68881"
2868 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2869 (minus:FP (match_operand:FP 1 "general_operand" "0")
2870 (float:FP (match_operand:QI 2 "general_operand" "dmn"))))]
2872 "f<FP:round>sub%.b %2,%0"
2873 [(set_attr "type" "falu")
2874 (set_attr "opy" "2")])
2876 (define_insn "sub<mode>3_68881"
2877 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2878 (minus:FP (match_operand:FP 1 "general_operand" "0")
2879 (match_operand:FP 2 "general_operand" "f<FP:dreg>m<FP:const>")))]
2882 if (FP_REG_P (operands[2]))
2883 return "f<FP:round>sub%.x %2,%0";
2884 return "f<FP:round>sub%.<FP:prec> %f2,%0";
2886 [(set_attr "type" "falu")
2887 (set_attr "opy" "2")])
2889 (define_insn "sub<mode>3_cf"
2890 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2891 (minus:FP (match_operand:FP 1 "general_operand" "0")
2892 (match_operand:FP 2 "general_operand" "f<FP:dreg><Q>U")))]
2893 "TARGET_COLDFIRE_FPU"
2895 if (FP_REG_P (operands[2]))
2896 return "f<FP:prec>sub%.d %2,%0";
2897 return "f<FP:prec>sub%.<FP:prec> %2,%0";
2899 [(set_attr "type" "falu")
2900 (set_attr "opy" "2")])
2902 ;; multiply instructions
2904 (define_insn "mulhi3"
2905 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
2906 (mult:HI (match_operand:HI 1 "general_operand" "%0")
2907 (match_operand:HI 2 "general_src_operand" "dmSn")))]
2910 return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0";
2912 [(set_attr "type" "mul_w")
2913 (set_attr "opy" "2")])
2915 (define_insn "mulhisi3"
2916 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2917 (mult:SI (sign_extend:SI
2918 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2920 (match_operand:HI 2 "nonimmediate_src_operand" "dmS"))))]
2923 return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0";
2925 [(set_attr "type" "mul_w")
2926 (set_attr "opy" "2")])
2928 (define_insn "*mulhisisi3_s"
2929 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2930 (mult:SI (sign_extend:SI
2931 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2932 (match_operand:SI 2 "const_int_operand" "n")))]
2933 "INTVAL (operands[2]) >= -0x8000 && INTVAL (operands[2]) <= 0x7fff"
2935 return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0";
2937 [(set_attr "type" "mul_w")
2938 (set_attr "opy" "2")])
2940 (define_expand "mulsi3"
2941 [(set (match_operand:SI 0 "nonimmediate_operand" "")
2942 (mult:SI (match_operand:SI 1 "general_operand" "")
2943 (match_operand:SI 2 "general_operand" "")))]
2944 "TARGET_68020 || TARGET_COLDFIRE"
2947 (define_insn "*mulsi3_68020"
2948 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2949 (mult:SI (match_operand:SI 1 "general_operand" "%0")
2950 (match_operand:SI 2 "general_src_operand" "dmSTK")))]
2954 [(set_attr "type" "mul_l")
2955 (set_attr "opy" "2")])
2957 (define_insn "*mulsi3_cf"
2958 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2959 (mult:SI (match_operand:SI 1 "general_operand" "%0")
2960 (match_operand:SI 2 "general_operand" "d<Q>")))]
2963 [(set_attr "type" "mul_l")
2964 (set_attr "opy" "2")])
2966 (define_insn "umulhisi3"
2967 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2968 (mult:SI (zero_extend:SI
2969 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2971 (match_operand:HI 2 "nonimmediate_src_operand" "dmS"))))]
2974 return MOTOROLA ? "mulu%.w %2,%0" : "mulu %2,%0";
2976 [(set_attr "type" "mul_w")
2977 (set_attr "opy" "2")])
2979 (define_insn "*mulhisisi3_z"
2980 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2981 (mult:SI (zero_extend:SI
2982 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2983 (match_operand:SI 2 "const_int_operand" "n")))]
2984 "INTVAL (operands[2]) >= 0 && INTVAL (operands[2]) <= 0xffff"
2986 return MOTOROLA ? "mulu%.w %2,%0" : "mulu %2,%0";
2988 [(set_attr "type" "mul_w")
2989 (set_attr "opy" "2")])
2991 ;; We need a separate DEFINE_EXPAND for u?mulsidi3 to be able to use the
2992 ;; proper matching constraint. This is because the matching is between
2993 ;; the high-numbered word of the DImode operand[0] and operand[1].
2994 (define_expand "umulsidi3"
2996 [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 4)
2997 (mult:SI (match_operand:SI 1 "register_operand" "")
2998 (match_operand:SI 2 "register_operand" "")))
2999 (set (subreg:SI (match_dup 0) 0)
3000 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
3001 (zero_extend:DI (match_dup 2)))
3002 (const_int 32))))])]
3003 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3007 [(set (match_operand:SI 0 "register_operand" "=d")
3008 (mult:SI (match_operand:SI 1 "register_operand" "%0")
3009 (match_operand:SI 2 "nonimmediate_operand" "dm")))
3010 (set (match_operand:SI 3 "register_operand" "=d")
3011 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
3012 (zero_extend:DI (match_dup 2)))
3014 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3017 ; Match immediate case. For 2.4 only match things < 2^31.
3018 ; It's tricky with larger values in these patterns since we need to match
3019 ; values between the two parallel multiplies, between a CONST_DOUBLE and
3022 [(set (match_operand:SI 0 "register_operand" "=d")
3023 (mult:SI (match_operand:SI 1 "register_operand" "%0")
3024 (match_operand:SI 2 "const_int_operand" "n")))
3025 (set (match_operand:SI 3 "register_operand" "=d")
3026 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
3029 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE
3030 && (unsigned) INTVAL (operands[2]) <= 0x7fffffff"
3033 (define_expand "mulsidi3"
3035 [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 4)
3036 (mult:SI (match_operand:SI 1 "register_operand" "")
3037 (match_operand:SI 2 "register_operand" "")))
3038 (set (subreg:SI (match_dup 0) 0)
3039 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
3040 (sign_extend:DI (match_dup 2)))
3041 (const_int 32))))])]
3042 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3046 [(set (match_operand:SI 0 "register_operand" "=d")
3047 (mult:SI (match_operand:SI 1 "register_operand" "%0")
3048 (match_operand:SI 2 "nonimmediate_operand" "dm")))
3049 (set (match_operand:SI 3 "register_operand" "=d")
3050 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
3051 (sign_extend:DI (match_dup 2)))
3053 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3057 [(set (match_operand:SI 0 "register_operand" "=d")
3058 (mult:SI (match_operand:SI 1 "register_operand" "%0")
3059 (match_operand:SI 2 "const_int_operand" "n")))
3060 (set (match_operand:SI 3 "register_operand" "=d")
3061 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
3064 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3067 (define_expand "umulsi3_highpart"
3069 [(set (match_operand:SI 0 "register_operand" "")
3072 (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" ""))
3073 (zero_extend:DI (match_operand:SI 2 "general_operand" "")))
3075 (clobber (match_dup 3))])]
3076 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3078 operands[3] = gen_reg_rtx (SImode);
3080 if (GET_CODE (operands[2]) == CONST_INT)
3082 operands[2] = immed_double_const (INTVAL (operands[2]) & 0xffffffff,
3085 /* We have to adjust the operand order for the matching constraints. */
3086 emit_insn (gen_const_umulsi3_highpart (operands[0], operands[3],
3087 operands[1], operands[2]));
3093 [(set (match_operand:SI 0 "register_operand" "=d")
3096 (mult:DI (zero_extend:DI (match_operand:SI 2 "register_operand" "%1"))
3097 (zero_extend:DI (match_operand:SI 3 "nonimmediate_operand" "dm")))
3099 (clobber (match_operand:SI 1 "register_operand" "=d"))]
3100 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3103 (define_insn "const_umulsi3_highpart"
3104 [(set (match_operand:SI 0 "register_operand" "=d")
3107 (mult:DI (zero_extend:DI (match_operand:SI 2 "register_operand" "1"))
3108 (match_operand:DI 3 "const_uint32_operand" "n"))
3110 (clobber (match_operand:SI 1 "register_operand" "=d"))]
3111 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3114 (define_expand "smulsi3_highpart"
3116 [(set (match_operand:SI 0 "register_operand" "")
3119 (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" ""))
3120 (sign_extend:DI (match_operand:SI 2 "general_operand" "")))
3122 (clobber (match_dup 3))])]
3123 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3125 operands[3] = gen_reg_rtx (SImode);
3126 if (GET_CODE (operands[2]) == CONST_INT)
3128 /* We have to adjust the operand order for the matching constraints. */
3129 emit_insn (gen_const_smulsi3_highpart (operands[0], operands[3],
3130 operands[1], operands[2]));
3136 [(set (match_operand:SI 0 "register_operand" "=d")
3139 (mult:DI (sign_extend:DI (match_operand:SI 2 "register_operand" "%1"))
3140 (sign_extend:DI (match_operand:SI 3 "nonimmediate_operand" "dm")))
3142 (clobber (match_operand:SI 1 "register_operand" "=d"))]
3143 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3146 (define_insn "const_smulsi3_highpart"
3147 [(set (match_operand:SI 0 "register_operand" "=d")
3150 (mult:DI (sign_extend:DI (match_operand:SI 2 "register_operand" "1"))
3151 (match_operand:DI 3 "const_sint32_operand" "n"))
3153 (clobber (match_operand:SI 1 "register_operand" "=d"))]
3154 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3157 (define_expand "mul<mode>3"
3158 [(set (match_operand:FP 0 "nonimmediate_operand" "")
3159 (mult:FP (match_operand:FP 1 "general_operand" "")
3160 (match_operand:FP 2 "general_operand" "")))]
3164 (define_insn "mul<mode>3_floatsi_68881"
3165 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3166 (mult:FP (float:FP (match_operand:SI 2 "general_operand" "dmi"))
3167 (match_operand:FP 1 "general_operand" "0")))]
3171 ? "f<FP:round>mul%.l %2,%0"
3172 : "f<FP:round_mul>mul%.l %2,%0";
3174 [(set_attr "type" "fmul")
3175 (set_attr "opy" "2")])
3177 (define_insn "mul<mode>3_floathi_68881"
3178 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3179 (mult:FP (float:FP (match_operand:HI 2 "general_operand" "dmn"))
3180 (match_operand:FP 1 "general_operand" "0")))]
3184 ? "f<FP:round>mul%.w %2,%0"
3185 : "f<FP:round_mul>mul%.w %2,%0";
3187 [(set_attr "type" "fmul")
3188 (set_attr "opy" "2")])
3190 (define_insn "mul<mode>3_floatqi_68881"
3191 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3192 (mult:FP (float:FP (match_operand:QI 2 "general_operand" "dmn"))
3193 (match_operand:FP 1 "general_operand" "0")))]
3197 ? "f<FP:round>mul%.b %2,%0"
3198 : "f<FP:round_mul>mul%.b %2,%0";
3200 [(set_attr "type" "fmul")
3201 (set_attr "opy" "2")])
3203 (define_insn "muldf_68881"
3204 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
3205 (mult:DF (match_operand:DF 1 "general_operand" "%0")
3206 (match_operand:DF 2 "general_operand" "fmG")))]
3209 if (GET_CODE (operands[2]) == CONST_DOUBLE
3210 && floating_exact_log2 (operands[2]) && !TUNE_68040_60)
3212 int i = floating_exact_log2 (operands[2]);
3213 operands[2] = GEN_INT (i);
3214 return "fscale%.l %2,%0";
3216 if (REG_P (operands[2]))
3217 return "f%&mul%.x %2,%0";
3218 return "f%&mul%.d %f2,%0";
3221 (define_insn "mulsf_68881"
3222 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
3223 (mult:SF (match_operand:SF 1 "general_operand" "%0")
3224 (match_operand:SF 2 "general_operand" "fdmF")))]
3227 if (FP_REG_P (operands[2]))
3228 return (TARGET_68040
3230 : "fsglmul%.x %2,%0");
3231 return (TARGET_68040
3233 : "fsglmul%.s %f2,%0");
3236 (define_insn "mulxf3_68881"
3237 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
3238 (mult:XF (match_operand:XF 1 "nonimmediate_operand" "%0")
3239 (match_operand:XF 2 "nonimmediate_operand" "fm")))]
3242 return "fmul%.x %f2,%0";
3245 (define_insn "fmul<mode>3_cf"
3246 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3247 (mult:FP (match_operand:FP 1 "general_operand" "%0")
3248 (match_operand:FP 2 "general_operand" "f<Q>U<FP:dreg>")))]
3249 "TARGET_COLDFIRE_FPU"
3251 if (FP_REG_P (operands[2]))
3252 return "f<FP:prec>mul%.d %2,%0";
3253 return "f<FP:prec>mul%.<FP:prec> %2,%0";
3255 [(set_attr "type" "fmul")
3256 (set_attr "opy" "2")])
3258 ;; divide instructions
3260 (define_expand "div<mode>3"
3261 [(set (match_operand:FP 0 "nonimmediate_operand" "")
3262 (div:FP (match_operand:FP 1 "general_operand" "")
3263 (match_operand:FP 2 "general_operand" "")))]
3267 (define_insn "div<mode>3_floatsi_68881"
3268 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3269 (div:FP (match_operand:FP 1 "general_operand" "0")
3270 (float:FP (match_operand:SI 2 "general_operand" "dmi"))))]
3274 ? "f<FP:round>div%.l %2,%0"
3275 : "f<FP:round_mul>div%.l %2,%0";
3278 (define_insn "div<mode>3_floathi_68881"
3279 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3280 (div:FP (match_operand:FP 1 "general_operand" "0")
3281 (float:FP (match_operand:HI 2 "general_operand" "dmn"))))]
3285 ? "f<FP:round>div%.w %2,%0"
3286 : "f<FP:round_mul>div%.w %2,%0";
3289 (define_insn "div<mode>3_floatqi_68881"
3290 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3291 (div:FP (match_operand:FP 1 "general_operand" "0")
3292 (float:FP (match_operand:QI 2 "general_operand" "dmn"))))]
3296 ? "f<FP:round>div%.b %2,%0"
3297 : "f<FP:round_mul>div%.b %2,%0";
3300 (define_insn "div<mode>3_68881"
3301 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3302 (div:FP (match_operand:FP 1 "general_operand" "0")
3303 (match_operand:FP 2 "general_operand" "f<FP:dreg>m<FP:const>")))]
3306 if (FP_REG_P (operands[2]))
3307 return (TARGET_68040
3308 ? "f<FP:round>div%.x %2,%0"
3309 : "f<FP:round_mul>div%.x %2,%0");
3310 return (TARGET_68040
3311 ? "f<FP:round>div%.<FP:prec> %f2,%0"
3312 : "f<FP:round_mul>div%.<FP:prec> %f2,%0");
3315 (define_insn "div<mode>3_cf"
3316 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3317 (div:FP (match_operand:FP 1 "general_operand" "0")
3318 (match_operand:FP 2 "general_operand" "f<Q>U<FP:dreg>")))]
3319 "TARGET_COLDFIRE_FPU"
3321 if (FP_REG_P (operands[2]))
3322 return "f<FP:prec>div%.d %2,%0";
3323 return "f<FP:prec>div%.<FP:prec> %2,%0";
3325 [(set_attr "type" "fdiv")
3326 (set_attr "opy" "2")])
3328 ;; Remainder instructions.
3330 (define_expand "divmodsi4"
3332 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3333 (div:SI (match_operand:SI 1 "general_operand" "")
3334 (match_operand:SI 2 "general_src_operand" "")))
3335 (set (match_operand:SI 3 "nonimmediate_operand" "")
3336 (mod:SI (match_dup 1) (match_dup 2)))])]
3337 "TARGET_68020 || TARGET_CF_HWDIV"
3341 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3342 (div:SI (match_operand:SI 1 "general_operand" "0")
3343 (match_operand:SI 2 "general_src_operand" "d<Q>U")))
3344 (set (match_operand:SI 3 "nonimmediate_operand" "=&d")
3345 (mod:SI (match_dup 1) (match_dup 2)))]
3348 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3349 return "divs%.l %2,%0";
3350 else if (find_reg_note (insn, REG_UNUSED, operands[0]))
3351 return "rems%.l %2,%3:%0";
3353 return "rems%.l %2,%3:%0\;divs%.l %2,%0";
3355 [(set_attr "type" "div_l")
3356 (set_attr "opy" "2")])
3359 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3360 (div:SI (match_operand:SI 1 "general_operand" "0")
3361 (match_operand:SI 2 "general_src_operand" "dmSTK")))
3362 (set (match_operand:SI 3 "nonimmediate_operand" "=d")
3363 (mod:SI (match_dup 1) (match_dup 2)))]
3366 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3367 return "divs%.l %2,%0";
3369 return "divsl%.l %2,%3:%0";
3372 (define_expand "udivmodsi4"
3374 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3375 (udiv:SI (match_operand:SI 1 "general_operand" "0")
3376 (match_operand:SI 2 "general_src_operand" "dmSTK")))
3377 (set (match_operand:SI 3 "nonimmediate_operand" "=d")
3378 (umod:SI (match_dup 1) (match_dup 2)))])]
3379 "TARGET_68020 || TARGET_CF_HWDIV"
3383 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3384 (udiv:SI (match_operand:SI 1 "general_operand" "0")
3385 (match_operand:SI 2 "general_src_operand" "d<Q>U")))
3386 (set (match_operand:SI 3 "nonimmediate_operand" "=&d")
3387 (umod:SI (match_dup 1) (match_dup 2)))]
3390 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3391 return "divu%.l %2,%0";
3392 else if (find_reg_note (insn, REG_UNUSED, operands[0]))
3393 return "remu%.l %2,%3:%0";
3395 return "remu%.l %2,%3:%0\;divu%.l %2,%0";
3397 [(set_attr "type" "div_l")
3398 (set_attr "opy" "2")])
3401 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3402 (udiv:SI (match_operand:SI 1 "general_operand" "0")
3403 (match_operand:SI 2 "general_src_operand" "dmSTK")))
3404 (set (match_operand:SI 3 "nonimmediate_operand" "=d")
3405 (umod:SI (match_dup 1) (match_dup 2)))]
3406 "TARGET_68020 && !TARGET_COLDFIRE"
3408 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3409 return "divu%.l %2,%0";
3411 return "divul%.l %2,%3:%0";
3414 (define_insn "divmodhi4"
3415 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
3416 (div:HI (match_operand:HI 1 "general_operand" "0")
3417 (match_operand:HI 2 "general_src_operand" "dmSKT")))
3418 (set (match_operand:HI 3 "nonimmediate_operand" "=d")
3419 (mod:HI (match_dup 1) (match_dup 2)))]
3420 "!TARGET_COLDFIRE || TARGET_CF_HWDIV"
3422 output_asm_insn (MOTOROLA ?
3423 "ext%.l %0\;divs%.w %2,%0" :
3424 "extl %0\;divs %2,%0",
3426 if (!find_reg_note(insn, REG_UNUSED, operands[3]))
3429 return "move%.l %0,%3\;swap %3";
3435 (define_insn "udivmodhi4"
3436 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
3437 (udiv:HI (match_operand:HI 1 "general_operand" "0")
3438 (match_operand:HI 2 "general_src_operand" "dmSKT")))
3439 (set (match_operand:HI 3 "nonimmediate_operand" "=d")
3440 (umod:HI (match_dup 1) (match_dup 2)))]
3441 "!TARGET_COLDFIRE || TARGET_CF_HWDIV"
3443 if (ISA_HAS_MVS_MVZ)
3444 output_asm_insn (MOTOROLA ?
3445 "mvz%.w %0,%0\;divu%.w %2,%0" :
3446 "mvz%.w %0,%0\;divu %2,%0",
3449 output_asm_insn (MOTOROLA ?
3450 "and%.l #0xFFFF,%0\;divu%.w %2,%0" :
3451 "and%.l #0xFFFF,%0\;divu %2,%0",
3454 if (!find_reg_note(insn, REG_UNUSED, operands[3]))
3457 return "move%.l %0,%3\;swap %3";
3463 ;; logical-and instructions
3465 ;; "anddi3" is mainly here to help combine().
3466 (define_insn "anddi3"
3467 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,d")
3468 (and:DI (match_operand:DI 1 "general_operand" "%0,0")
3469 (match_operand:DI 2 "general_operand" "dn,don")))]
3473 /* We can get CONST_DOUBLE, but also const1_rtx etc. */
3474 if (CONSTANT_P (operands[2]))
3478 split_double (operands[2], &hi, &lo);
3480 switch (INTVAL (hi))
3483 output_asm_insn ("clr%.l %0", operands);
3491 xoperands[0] = operands[0];
3493 output_asm_insn (output_andsi3 (xoperands), xoperands);
3496 if (GET_CODE (operands[0]) == REG)
3497 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3499 operands[0] = adjust_address (operands[0], SImode, 4);
3500 switch (INTVAL (lo))
3503 output_asm_insn ("clr%.l %0", operands);
3511 xoperands[0] = operands[0];
3513 output_asm_insn (output_andsi3 (xoperands), xoperands);
3518 if (GET_CODE (operands[0]) != REG)
3520 operands[1] = adjust_address (operands[0], SImode, 4);
3521 return "and%.l %2,%0\;and%.l %R2,%1";
3523 if (GET_CODE (operands[2]) != REG)
3525 operands[1] = adjust_address (operands[2], SImode, 4);
3526 return "and%.l %2,%0\;and%.l %1,%R0";
3528 return "and%.l %2,%0\;and%.l %R2,%R0";
3531 ;; Prevent AND from being made with sp. This doesn't exist in the machine
3532 ;; and reload will cause inefficient code. Since sp is a FIXED_REG, we
3533 ;; can't allocate pseudos into it.
3535 (define_expand "andsi3"
3536 [(set (match_operand:SI 0 "not_sp_operand" "")
3537 (and:SI (match_operand:SI 1 "general_operand" "")
3538 (match_operand:SI 2 "general_src_operand" "")))]
3542 ;; produced by split operations after reload finished
3543 (define_insn "*andsi3_split"
3544 [(set (match_operand:SI 0 "register_operand" "=d")
3545 (and:SI (match_operand:SI 1 "register_operand" "0")
3546 (match_operand:SI 2 "const_int_operand" "i")))]
3547 "reload_completed && !TARGET_COLDFIRE"
3549 return output_andsi3 (operands);
3552 (define_insn "andsi3_internal"
3553 [(set (match_operand:SI 0 "not_sp_operand" "=m,d")
3554 (and:SI (match_operand:SI 1 "general_operand" "%0,0")
3555 (match_operand:SI 2 "general_src_operand" "dKT,dmSM")))]
3558 return output_andsi3 (operands);
3561 (define_insn "andsi3_5200"
3562 [(set (match_operand:SI 0 "not_sp_operand" "=m,d")
3563 (and:SI (match_operand:SI 1 "general_operand" "%0,0")
3564 (match_operand:SI 2 "general_src_operand" "d,dmsK")))]
3568 && DATA_REG_P (operands[0])
3569 && GET_CODE (operands[2]) == CONST_INT)
3571 if (INTVAL (operands[2]) == 0x000000ff)
3572 return "mvz%.b %0,%0";
3573 else if (INTVAL (operands[2]) == 0x0000ffff)
3574 return "mvz%.w %0,%0";
3576 return output_andsi3 (operands);
3579 (define_insn "andhi3"
3580 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,d")
3581 (and:HI (match_operand:HI 1 "general_operand" "%0,0")
3582 (match_operand:HI 2 "general_src_operand" "dn,dmSn")))]
3587 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3588 (and:HI (match_dup 0)
3589 (match_operand:HI 1 "general_src_operand" "dn,dmSn")))]
3594 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3595 (and:HI (match_operand:HI 1 "general_src_operand" "dn,dmSn")
3600 (define_insn "andqi3"
3601 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
3602 (and:QI (match_operand:QI 1 "general_operand" "%0,0")
3603 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
3608 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3609 (and:QI (match_dup 0)
3610 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
3615 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3616 (and:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn")
3621 ;; inclusive-or instructions
3623 (define_insn "iordi_zext"
3624 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,d")
3625 (ior:DI (zero_extend:DI (match_operand 1 "general_operand" "dn,dmn"))
3626 (match_operand:DI 2 "general_operand" "0,0")))]
3632 if (GET_CODE (operands[0]) == REG)
3633 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3635 operands[0] = adjust_address (operands[0], SImode, 4);
3636 if (GET_MODE (operands[1]) == SImode)
3637 return "or%.l %1,%0";
3638 byte_mode = (GET_MODE (operands[1]) == QImode);
3639 if (GET_CODE (operands[0]) == MEM)
3640 operands[0] = adjust_address (operands[0], byte_mode ? QImode : HImode,
3643 return "or%.b %1,%0";
3645 return "or%.w %1,%0";
3648 ;; "iordi3" is mainly here to help combine().
3649 (define_insn "iordi3"
3650 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,d")
3651 (ior:DI (match_operand:DI 1 "general_operand" "%0,0")
3652 (match_operand:DI 2 "general_operand" "dn,don")))]
3656 /* We can get CONST_DOUBLE, but also const1_rtx etc. */
3657 if (CONSTANT_P (operands[2]))
3661 split_double (operands[2], &hi, &lo);
3663 switch (INTVAL (hi))
3668 /* FIXME : a scratch register would be welcome here if operand[0]
3669 is not a register */
3670 output_asm_insn ("move%.l #-1,%0", operands);
3676 xoperands[0] = operands[0];
3678 output_asm_insn (output_iorsi3 (xoperands), xoperands);
3681 if (GET_CODE (operands[0]) == REG)
3682 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3684 operands[0] = adjust_address (operands[0], SImode, 4);
3685 switch (INTVAL (lo))
3690 /* FIXME : a scratch register would be welcome here if operand[0]
3691 is not a register */
3692 output_asm_insn ("move%.l #-1,%0", operands);
3698 xoperands[0] = operands[0];
3700 output_asm_insn (output_iorsi3 (xoperands), xoperands);
3705 if (GET_CODE (operands[0]) != REG)
3707 operands[1] = adjust_address (operands[0], SImode, 4);
3708 return "or%.l %2,%0\;or%.l %R2,%1";
3710 if (GET_CODE (operands[2]) != REG)
3712 operands[1] = adjust_address (operands[2], SImode, 4);
3713 return "or%.l %2,%0\;or%.l %1,%R0";
3715 return "or%.l %2,%0\;or%.l %R2,%R0";
3718 (define_expand "iorsi3"
3719 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3720 (ior:SI (match_operand:SI 1 "general_operand" "")
3721 (match_operand:SI 2 "general_src_operand" "")))]
3725 (define_insn "iorsi3_internal"
3726 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,d")
3727 (ior:SI (match_operand:SI 1 "general_operand" "%0,0")
3728 (match_operand:SI 2 "general_src_operand" "dKT,dmSMT")))]
3731 return output_iorsi3 (operands);
3734 (define_insn "iorsi3_5200"
3735 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,d")
3736 (ior:SI (match_operand:SI 1 "general_operand" "%0,0")
3737 (match_operand:SI 2 "general_src_operand" "d,dmsK")))]
3740 return output_iorsi3 (operands);
3743 (define_insn "iorhi3"
3744 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,d")
3745 (ior:HI (match_operand:HI 1 "general_operand" "%0,0")
3746 (match_operand:HI 2 "general_src_operand" "dn,dmSn")))]
3751 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3752 (ior:HI (match_dup 0)
3753 (match_operand:HI 1 "general_src_operand" "dn,dmSn")))]
3758 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3759 (ior:HI (match_operand:HI 1 "general_src_operand" "dn,dmSn")
3764 (define_insn "iorqi3"
3765 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
3766 (ior:QI (match_operand:QI 1 "general_operand" "%0,0")
3767 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
3772 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3773 (ior:QI (match_dup 0)
3774 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
3779 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3780 (ior:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn")
3785 ;; On all 68k models, this makes faster code in a special case.
3786 ;; See also ashlsi_16, ashrsi_16 and lshrsi_16.
3788 (define_insn "iorsi_zexthi_ashl16"
3789 [(set (match_operand:SI 0 "nonimmediate_operand" "=&d")
3790 (ior:SI (zero_extend:SI (match_operand:HI 1 "general_operand" "rmn"))
3791 (ashift:SI (match_operand:SI 2 "general_operand" "or")
3796 if (GET_CODE (operands[2]) != REG)
3797 operands[2] = adjust_address (operands[2], HImode, 2);
3798 if (GET_CODE (operands[2]) != REG
3799 || REGNO (operands[2]) != REGNO (operands[0]))
3800 output_asm_insn ("move%.w %2,%0", operands);
3801 return "swap %0\;mov%.w %1,%0";
3804 (define_insn "iorsi_zext"
3805 [(set (match_operand:SI 0 "nonimmediate_operand" "=o,d")
3806 (ior:SI (zero_extend:SI (match_operand 1 "general_operand" "dn,dmn"))
3807 (match_operand:SI 2 "general_operand" "0,0")))]
3813 byte_mode = (GET_MODE (operands[1]) == QImode);
3814 if (GET_CODE (operands[0]) == MEM)
3815 operands[0] = adjust_address (operands[0], byte_mode ? QImode : HImode,
3818 return "or%.b %1,%0";
3820 return "or%.w %1,%0";
3825 ;; "xordi3" is mainly here to help combine().
3826 (define_insn "xordi3"
3827 [(set (match_operand:DI 0 "nonimmediate_operand" "=od")
3828 (xor:DI (match_operand:DI 1 "general_operand" "%0")
3829 (match_operand:DI 2 "general_operand" "dn")))]
3833 /* We can get CONST_DOUBLE, but also const1_rtx etc. */
3835 if (CONSTANT_P (operands[2]))
3839 split_double (operands[2], &hi, &lo);
3841 switch (INTVAL (hi))
3846 output_asm_insn ("not%.l %0", operands);
3849 /* FIXME : a scratch register would be welcome here if
3850 -128 <= INTVAL (hi) < -1 */
3854 xoperands[0] = operands[0];
3856 output_asm_insn (output_xorsi3 (xoperands), xoperands);
3859 if (GET_CODE (operands[0]) == REG)
3860 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3862 operands[0] = adjust_address (operands[0], SImode, 4);
3863 switch (INTVAL (lo))
3868 output_asm_insn ("not%.l %0", operands);
3871 /* FIXME : a scratch register would be welcome here if
3872 -128 <= INTVAL (lo) < -1 */
3874 /* FIXME : this should be merged with xorsi3 */
3878 xoperands[0] = operands[0];
3880 output_asm_insn (output_xorsi3 (xoperands), xoperands);
3885 if (GET_CODE (operands[0]) != REG)
3887 operands[1] = adjust_address (operands[0], SImode, 4);
3888 return "eor%.l %2,%0\;eor%.l %R2,%1";
3890 if (GET_CODE (operands[2]) != REG)
3892 operands[1] = adjust_address (operands[2], SImode, 4);
3893 return "eor%.l %2,%0\;eor%.l %1,%R0";
3895 return "eor%.l %2,%0\;eor%.l %R2,%R0";
3898 (define_expand "xorsi3"
3899 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3900 (xor:SI (match_operand:SI 1 "general_operand" "")
3901 (match_operand:SI 2 "general_operand" "")))]
3905 (define_insn "xorsi3_internal"
3906 [(set (match_operand:SI 0 "nonimmediate_operand" "=do,m")
3907 (xor:SI (match_operand:SI 1 "general_operand" "%0,0")
3908 (match_operand:SI 2 "general_operand" "di,dKT")))]
3912 return output_xorsi3 (operands);
3915 (define_insn "xorsi3_5200"
3916 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm,d")
3917 (xor:SI (match_operand:SI 1 "general_operand" "%0,0")
3918 (match_operand:SI 2 "general_operand" "d,Ks")))]
3921 return output_xorsi3 (operands);
3924 (define_insn "xorhi3"
3925 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
3926 (xor:HI (match_operand:HI 1 "general_operand" "%0")
3927 (match_operand:HI 2 "general_operand" "dn")))]
3932 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
3933 (xor:HI (match_dup 0)
3934 (match_operand:HI 1 "general_operand" "dn")))]
3939 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
3940 (xor:HI (match_operand:HI 1 "general_operand" "dn")
3945 (define_insn "xorqi3"
3946 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
3947 (xor:QI (match_operand:QI 1 "general_operand" "%0")
3948 (match_operand:QI 2 "general_operand" "dn")))]
3953 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
3954 (xor:QI (match_dup 0)
3955 (match_operand:QI 1 "general_operand" "dn")))]
3960 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
3961 (xor:QI (match_operand:QI 1 "general_operand" "dn")
3966 ;; negation instructions
3968 (define_expand "negdi2"
3969 [(set (match_operand:DI 0 "nonimmediate_operand" "")
3970 (neg:DI (match_operand:DI 1 "general_operand" "")))]
3973 if (TARGET_COLDFIRE)
3974 emit_insn (gen_negdi2_5200 (operands[0], operands[1]));
3976 emit_insn (gen_negdi2_internal (operands[0], operands[1]));
3980 (define_insn "negdi2_internal"
3981 [(set (match_operand:DI 0 "nonimmediate_operand" "=<,do,!*a")
3982 (neg:DI (match_operand:DI 1 "general_operand" "0,0,0")))]
3985 if (which_alternative == 0)
3986 return "neg%.l %0\;negx%.l %0";
3987 if (GET_CODE (operands[0]) == REG)
3988 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3990 operands[1] = adjust_address (operands[0], SImode, 4);
3991 if (ADDRESS_REG_P (operands[0]))
3992 return "exg %/d0,%1\;neg%.l %/d0\;exg %/d0,%1\;exg %/d0,%0\;negx%.l %/d0\;exg %/d0,%0";
3994 return "neg%.l %1\;negx%.l %0";
3997 (define_insn "negdi2_5200"
3998 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
3999 (neg:DI (match_operand:DI 1 "general_operand" "0")))]
4002 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4003 return "neg%.l %1\;negx%.l %0";
4006 (define_expand "negsi2"
4007 [(set (match_operand:SI 0 "nonimmediate_operand" "")
4008 (neg:SI (match_operand:SI 1 "general_operand" "")))]
4011 if (TARGET_COLDFIRE)
4012 emit_insn (gen_negsi2_5200 (operands[0], operands[1]));
4014 emit_insn (gen_negsi2_internal (operands[0], operands[1]));
4018 (define_insn "negsi2_internal"
4019 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
4020 (neg:SI (match_operand:SI 1 "general_operand" "0")))]
4023 [(set_attr "type" "neg_l")])
4025 (define_insn "negsi2_5200"
4026 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
4027 (neg:SI (match_operand:SI 1 "general_operand" "0")))]
4030 [(set_attr "type" "neg_l")])
4032 (define_insn "neghi2"
4033 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
4034 (neg:HI (match_operand:HI 1 "general_operand" "0")))]
4039 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
4040 (neg:HI (match_dup 0)))]
4044 (define_insn "negqi2"
4045 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
4046 (neg:QI (match_operand:QI 1 "general_operand" "0")))]
4051 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
4052 (neg:QI (match_dup 0)))]
4056 ;; If using software floating point, just flip the sign bit.
4058 (define_expand "negsf2"
4059 [(set (match_operand:SF 0 "nonimmediate_operand" "")
4060 (neg:SF (match_operand:SF 1 "general_operand" "")))]
4063 if (!TARGET_HARD_FLOAT)
4068 target = operand_subword_force (operands[0], 0, SFmode);
4069 result = expand_binop (SImode, xor_optab,
4070 operand_subword_force (operands[1], 0, SFmode),
4071 GEN_INT (-2147483647 - 1), target, 0, OPTAB_WIDEN);
4072 gcc_assert (result);
4074 if (result != target)
4075 emit_move_insn (result, target);
4077 /* Make a place for REG_EQUAL. */
4078 emit_move_insn (operands[0], operands[0]);
4083 (define_expand "negdf2"
4084 [(set (match_operand:DF 0 "nonimmediate_operand" "")
4085 (neg:DF (match_operand:DF 1 "general_operand" "")))]
4088 if (!TARGET_HARD_FLOAT)
4095 target = operand_subword (operands[0], 0, 1, DFmode);
4096 result = expand_binop (SImode, xor_optab,
4097 operand_subword_force (operands[1], 0, DFmode),
4098 GEN_INT (-2147483647 - 1), target, 0, OPTAB_WIDEN);
4099 gcc_assert (result);
4101 if (result != target)
4102 emit_move_insn (result, target);
4104 emit_move_insn (operand_subword (operands[0], 1, 1, DFmode),
4105 operand_subword_force (operands[1], 1, DFmode));
4107 insns = get_insns ();
4115 (define_expand "negxf2"
4116 [(set (match_operand:XF 0 "nonimmediate_operand" "")
4117 (neg:XF (match_operand:XF 1 "nonimmediate_operand" "")))]
4127 target = operand_subword (operands[0], 0, 1, XFmode);
4128 result = expand_binop (SImode, xor_optab,
4129 operand_subword_force (operands[1], 0, XFmode),
4130 GEN_INT (-2147483647 - 1), target, 0, OPTAB_WIDEN);
4131 gcc_assert (result);
4133 if (result != target)
4134 emit_move_insn (result, target);
4136 emit_move_insn (operand_subword (operands[0], 1, 1, XFmode),
4137 operand_subword_force (operands[1], 1, XFmode));
4138 emit_move_insn (operand_subword (operands[0], 2, 1, XFmode),
4139 operand_subword_force (operands[1], 2, XFmode));
4141 insns = get_insns ();
4149 (define_insn "neg<mode>2_68881"
4150 [(set (match_operand:FP 0 "nonimmediate_operand" "=f,d")
4151 (neg:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m<FP:const>,0")))]
4154 if (DATA_REG_P (operands[0]))
4156 operands[1] = GEN_INT (31);
4157 return "bchg %1,%0";
4159 if (FP_REG_P (operands[1]))
4160 return "f<FP:round>neg%.x %1,%0";
4161 return "f<FP:round>neg%.<FP:prec> %f1,%0";
4164 (define_insn "neg<mode>2_cf"
4165 [(set (match_operand:FP 0 "nonimmediate_operand" "=f,d")
4166 (neg:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U,0")))]
4167 "TARGET_COLDFIRE_FPU"
4169 if (DATA_REG_P (operands[0]))
4171 operands[1] = GEN_INT (31);
4172 return "bchg %1,%0";
4174 if (FP_REG_P (operands[1]))
4175 return "f<FP:prec>neg%.d %1,%0";
4176 return "f<FP:prec>neg%.<FP:prec> %1,%0";
4179 ;; Sqrt instruction for the 68881
4181 (define_expand "sqrt<mode>2"
4182 [(set (match_operand:FP 0 "nonimmediate_operand" "")
4183 (sqrt:FP (match_operand:FP 1 "general_operand" "")))]
4187 (define_insn "sqrt<mode>2_68881"
4188 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
4189 (sqrt:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m")))]
4192 if (FP_REG_P (operands[1]))
4193 return "f<FP:round>sqrt%.x %1,%0";
4194 return "f<FP:round>sqrt%.<FP:prec> %1,%0";
4196 [(set_attr "type" "fsqrt")])
4198 (define_insn "sqrt<mode>2_cf"
4199 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
4200 (sqrt:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U")))]
4201 "TARGET_COLDFIRE_FPU"
4203 if (FP_REG_P (operands[1]))
4204 return "f<FP:prec>sqrt%.d %1,%0";
4205 return "f<FP:prec>sqrt%.<FP:prec> %1,%0";
4207 [(set_attr "type" "fsqrt")])
4208 ;; Absolute value instructions
4209 ;; If using software floating point, just zero the sign bit.
4211 (define_expand "abssf2"
4212 [(set (match_operand:SF 0 "nonimmediate_operand" "")
4213 (abs:SF (match_operand:SF 1 "general_operand" "")))]
4216 if (!TARGET_HARD_FLOAT)
4221 target = operand_subword_force (operands[0], 0, SFmode);
4222 result = expand_binop (SImode, and_optab,
4223 operand_subword_force (operands[1], 0, SFmode),
4224 GEN_INT (0x7fffffff), target, 0, OPTAB_WIDEN);
4225 gcc_assert (result);
4227 if (result != target)
4228 emit_move_insn (result, target);
4230 /* Make a place for REG_EQUAL. */
4231 emit_move_insn (operands[0], operands[0]);
4236 (define_expand "absdf2"
4237 [(set (match_operand:DF 0 "nonimmediate_operand" "")
4238 (abs:DF (match_operand:DF 1 "general_operand" "")))]
4241 if (!TARGET_HARD_FLOAT)
4248 target = operand_subword (operands[0], 0, 1, DFmode);
4249 result = expand_binop (SImode, and_optab,
4250 operand_subword_force (operands[1], 0, DFmode),
4251 GEN_INT (0x7fffffff), target, 0, OPTAB_WIDEN);
4252 gcc_assert (result);
4254 if (result != target)
4255 emit_move_insn (result, target);
4257 emit_move_insn (operand_subword (operands[0], 1, 1, DFmode),
4258 operand_subword_force (operands[1], 1, DFmode));
4260 insns = get_insns ();
4268 (define_expand "absxf2"
4269 [(set (match_operand:XF 0 "nonimmediate_operand" "")
4270 (abs:XF (match_operand:XF 1 "nonimmediate_operand" "")))]
4280 target = operand_subword (operands[0], 0, 1, XFmode);
4281 result = expand_binop (SImode, and_optab,
4282 operand_subword_force (operands[1], 0, XFmode),
4283 GEN_INT (0x7fffffff), target, 0, OPTAB_WIDEN);
4284 gcc_assert (result);
4286 if (result != target)
4287 emit_move_insn (result, target);
4289 emit_move_insn (operand_subword (operands[0], 1, 1, XFmode),
4290 operand_subword_force (operands[1], 1, XFmode));
4291 emit_move_insn (operand_subword (operands[0], 2, 1, XFmode),
4292 operand_subword_force (operands[1], 2, XFmode));
4294 insns = get_insns ();
4302 (define_insn "abs<mode>2_68881"
4303 [(set (match_operand:FP 0 "nonimmediate_operand" "=f,d")
4304 (abs:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m<FP:const>,0")))]
4307 if (DATA_REG_P (operands[0]))
4309 operands[1] = GEN_INT (31);
4310 return "bclr %1,%0";
4312 if (FP_REG_P (operands[1]))
4313 return "f<FP:round>abs%.x %1,%0";
4314 return "f<FP:round>abs%.<FP:prec> %f1,%0";
4317 (define_insn "abs<mode>2_cf"
4318 [(set (match_operand:FP 0 "nonimmediate_operand" "=f,d")
4319 (abs:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U,0")))]
4320 "TARGET_COLDFIRE_FPU"
4322 if (DATA_REG_P (operands[0]))
4324 operands[1] = GEN_INT (31);
4325 return "bclr %1,%0";
4327 if (FP_REG_P (operands[1]))
4328 return "f<FP:prec>abs%.d %1,%0";
4329 return "f<FP:prec>abs%.<FP:prec> %1,%0";
4331 [(set_attr "type" "bitrw,fneg")])
4333 ;; bit indexing instructions
4335 ;; ColdFire ff1 instruction implements clz.
4336 (define_insn "clzsi2"
4337 [(set (match_operand:SI 0 "register_operand" "=d")
4338 (clz:SI (match_operand:SI 1 "register_operand" "0")))]
4341 [(set_attr "type" "ext")])
4343 ;; one complement instructions
4345 ;; "one_cmpldi2" is mainly here to help combine().
4346 (define_insn "one_cmpldi2"
4347 [(set (match_operand:DI 0 "nonimmediate_operand" "=dm")
4348 (not:DI (match_operand:DI 1 "general_operand" "0")))]
4352 if (GET_CODE (operands[0]) == REG)
4353 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4354 else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC
4355 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
4356 operands[1] = operands[0];
4358 operands[1] = adjust_address (operands[0], SImode, 4);
4359 return "not%.l %1\;not%.l %0";
4362 (define_expand "one_cmplsi2"
4363 [(set (match_operand:SI 0 "nonimmediate_operand" "")
4364 (not:SI (match_operand:SI 1 "general_operand" "")))]
4367 if (TARGET_COLDFIRE)
4368 emit_insn (gen_one_cmplsi2_5200 (operands[0], operands[1]));
4370 emit_insn (gen_one_cmplsi2_internal (operands[0], operands[1]));
4374 (define_insn "one_cmplsi2_internal"
4375 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
4376 (not:SI (match_operand:SI 1 "general_operand" "0")))]
4380 (define_insn "one_cmplsi2_5200"
4381 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
4382 (not:SI (match_operand:SI 1 "general_operand" "0")))]
4385 [(set_attr "type" "neg_l")])
4387 (define_insn "one_cmplhi2"
4388 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
4389 (not:HI (match_operand:HI 1 "general_operand" "0")))]
4394 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
4395 (not:HI (match_dup 0)))]
4399 (define_insn "one_cmplqi2"
4400 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
4401 (not:QI (match_operand:QI 1 "general_operand" "0")))]
4406 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
4407 (not:QI (match_dup 0)))]
4411 ;; arithmetic shift instructions
4412 ;; We don't need the shift memory by 1 bit instruction
4414 (define_insn "ashldi_extsi"
4415 [(set (match_operand:DI 0 "nonimmediate_operand" "=ro")
4417 (match_operator:DI 2 "extend_operator"
4418 [(match_operand:SI 1 "general_operand" "rm")])
4423 if (GET_CODE (operands[0]) == REG)
4424 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4426 operands[2] = adjust_address (operands[0], SImode, 4);
4427 if (ADDRESS_REG_P (operands[0]))
4428 return "move%.l %1,%0\;sub%.l %2,%2";
4430 return "move%.l %1,%0\;clr%.l %2";
4433 (define_insn "ashldi_sexthi"
4434 [(set (match_operand:DI 0 "nonimmediate_operand" "=m,a*d")
4435 (ashift:DI (sign_extend:DI (match_operand:HI 1 "general_operand" "rm,rm"))
4437 (clobber (match_scratch:SI 2 "=a,X"))]
4441 if (GET_CODE (operands[0]) == MEM)
4443 if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
4444 return "clr%.l %0\;move%.w %1,%2\;move%.l %2,%0";
4445 else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
4446 return "move%.w %1,%2\;move%.l %2,%0\;clr%.l %0";
4449 operands[3] = adjust_address (operands[0], SImode, 4);
4450 return "move%.w %1,%2\;move%.l %2,%0\;clr%.l %3";
4453 else if (DATA_REG_P (operands[0]))
4454 return "move%.w %1,%0\;ext%.l %0\;clr%.l %R0";
4456 return "move%.w %1,%0\;sub%.l %R0,%R0";
4459 (define_insn "*ashldi3_const1"
4460 [(set (match_operand:DI 0 "register_operand" "=d")
4461 (ashift:DI (match_operand:DI 1 "register_operand" "0")
4464 "add%.l %R0,%R0\;addx%.l %0,%0")
4467 [(set (match_operand:DI 0 "register_operand" "")
4468 (ashift:DI (match_operand:DI 1 "register_operand" "")
4470 "reload_completed && !TARGET_COLDFIRE"
4472 (ashift:DI (match_dup 1) (const_int 1)))
4474 (ashift:DI (match_dup 0) (const_int 1)))]
4478 [(set (match_operand:DI 0 "register_operand" "")
4479 (ashift:DI (match_operand:DI 1 "register_operand" "")
4481 "reload_completed && !TARGET_COLDFIRE"
4483 (ashift:DI (match_dup 1) (const_int 2)))
4485 (ashift:DI (match_dup 0) (const_int 1)))]
4489 [(set (match_operand:DI 0 "register_operand" "")
4490 (ashift:DI (match_operand:DI 1 "register_operand" "")
4492 "reload_completed && !TARGET_COLDFIRE"
4494 (rotate:SI (match_dup 2) (const_int 8)))
4496 (rotate:SI (match_dup 3) (const_int 8)))
4497 (set (strict_low_part (subreg:QI (match_dup 0) 3))
4498 (subreg:QI (match_dup 0) 7))
4499 (set (strict_low_part (subreg:QI (match_dup 0) 7))
4502 operands[2] = gen_highpart (SImode, operands[0]);
4503 operands[3] = gen_lowpart (SImode, operands[0]);
4507 [(set (match_operand:DI 0 "register_operand" "")
4508 (ashift:DI (match_operand:DI 1 "register_operand" "")
4510 "reload_completed && !TARGET_COLDFIRE"
4512 (rotate:SI (match_dup 2) (const_int 16)))
4514 (rotate:SI (match_dup 3) (const_int 16)))
4515 (set (strict_low_part (subreg:HI (match_dup 0) 2))
4516 (subreg:HI (match_dup 0) 6))
4517 (set (strict_low_part (subreg:HI (match_dup 0) 6))
4520 operands[2] = gen_highpart (SImode, operands[0]);
4521 operands[3] = gen_lowpart (SImode, operands[0]);
4525 [(set (match_operand:DI 0 "pre_dec_operand" "")
4526 (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "")
4529 [(set (match_dup 0) (const_int 0))
4530 (set (match_dup 0) (match_dup 1))]
4532 operands[0] = adjust_address(operands[0], SImode, 0);
4533 operands[1] = gen_lowpart(SImode, operands[1]);
4537 [(set (match_operand:DI 0 "post_inc_operand" "")
4538 (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "")
4541 [(set (match_dup 0) (match_dup 1))
4542 (set (match_dup 0) (const_int 0))]
4544 operands[0] = adjust_address(operands[0], SImode, 0);
4545 operands[1] = gen_lowpart(SImode, operands[1]);
4548 (define_insn_and_split "*ashldi3_const32"
4549 [(set (match_operand:DI 0 "nonimmediate_operand" "=ro<>")
4550 (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "ro")
4554 "&& reload_completed"
4555 [(set (match_dup 4) (match_dup 3))
4556 (set (match_dup 2) (const_int 0))]
4557 "split_di(operands, 2, operands + 2, operands + 4);")
4560 [(set (match_operand:DI 0 "register_operand" "")
4561 (ashift:DI (match_operand:DI 1 "register_operand" "")
4562 (match_operand 2 "const_int_operand" "")))]
4563 "reload_completed && !TARGET_COLDFIRE
4564 && INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 40"
4565 [(set (match_dup 4) (ashift:SI (match_dup 4) (match_dup 2)))
4566 (set (match_dup 3) (match_dup 4))
4567 (set (match_dup 4) (const_int 0))]
4569 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
4570 operands[3] = gen_highpart (SImode, operands[0]);
4571 operands[4] = gen_lowpart (SImode, operands[0]);
4575 [(set (match_operand:DI 0 "register_operand" "")
4576 (ashift:DI (match_operand:DI 1 "register_operand" "")
4578 "reload_completed && !TARGET_COLDFIRE"
4579 [(set (match_dup 2) (match_dup 3))
4581 (rotate:SI (match_dup 2) (const_int 16)))
4582 (set (match_dup 3) (const_int 0))
4583 (set (strict_low_part (subreg:HI (match_dup 0) 2))
4586 operands[2] = gen_highpart (SImode, operands[0]);
4587 operands[3] = gen_lowpart (SImode, operands[0]);
4591 [(set (match_operand:DI 0 "register_operand" "")
4592 (ashift:DI (match_operand:DI 1 "register_operand" "")
4593 (match_operand 2 "const_int_operand" "")))]
4594 "reload_completed && !TARGET_COLDFIRE
4595 && INTVAL (operands[2]) > 40 && INTVAL (operands[2]) <= 63"
4596 [(set (match_dup 3) (match_dup 2))
4597 (set (match_dup 4) (ashift:SI (match_dup 4) (match_dup 3)))
4598 (set (match_dup 3) (match_dup 4))
4599 (set (match_dup 4) (const_int 0))]
4601 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
4602 operands[3] = gen_highpart (SImode, operands[0]);
4603 operands[4] = gen_lowpart (SImode, operands[0]);
4606 (define_insn "*ashldi3"
4607 [(set (match_operand:DI 0 "register_operand" "=d")
4608 (ashift:DI (match_operand:DI 1 "register_operand" "0")
4609 (match_operand 2 "const_int_operand" "n")))]
4611 && ((INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3)
4612 || INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16
4613 || (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63))"
4616 (define_expand "ashldi3"
4617 [(set (match_operand:DI 0 "register_operand" "")
4618 (ashift:DI (match_operand:DI 1 "register_operand" "")
4619 (match_operand 2 "const_int_operand" "")))]
4622 /* ??? This is a named pattern like this is not allowed to FAIL based
4624 if (GET_CODE (operands[2]) != CONST_INT
4625 || ((INTVAL (operands[2]) < 1 || INTVAL (operands[2]) > 3)
4626 && INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16
4627 && (INTVAL (operands[2]) < 32 || INTVAL (operands[2]) > 63)))
4631 ;; On most 68k models, this makes faster code in a special case.
4633 (define_insn "ashlsi_16"
4634 [(set (match_operand:SI 0 "register_operand" "=d")
4635 (ashift:SI (match_operand:SI 1 "register_operand" "0")
4640 return "swap %0\;clr%.w %0";
4643 ;; ashift patterns : use lsl instead of asl, because lsl always clears the
4644 ;; overflow bit, so we must not set CC_NO_OVERFLOW.
4646 ;; On the 68000, this makes faster code in a special case.
4648 (define_insn "ashlsi_17_24"
4649 [(set (match_operand:SI 0 "register_operand" "=d")
4650 (ashift:SI (match_operand:SI 1 "register_operand" "0")
4651 (match_operand:SI 2 "const_int_operand" "n")))]
4653 && INTVAL (operands[2]) > 16
4654 && INTVAL (operands[2]) <= 24"
4658 operands[2] = GEN_INT (INTVAL (operands[2]) - 16);
4659 return "lsl%.w %2,%0\;swap %0\;clr%.w %0";
4662 (define_insn "ashlsi3"
4663 [(set (match_operand:SI 0 "register_operand" "=d")
4664 (ashift:SI (match_operand:SI 1 "register_operand" "0")
4665 (match_operand:SI 2 "general_operand" "dI")))]
4668 if (operands[2] == const1_rtx)
4670 cc_status.flags = CC_NO_OVERFLOW;
4671 return "add%.l %0,%0";
4673 return "lsl%.l %2,%0";
4676 (define_insn "ashlhi3"
4677 [(set (match_operand:HI 0 "register_operand" "=d")
4678 (ashift:HI (match_operand:HI 1 "register_operand" "0")
4679 (match_operand:HI 2 "general_operand" "dI")))]
4684 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
4685 (ashift:HI (match_dup 0)
4686 (match_operand:HI 1 "general_operand" "dI")))]
4690 (define_insn "ashlqi3"
4691 [(set (match_operand:QI 0 "register_operand" "=d")
4692 (ashift:QI (match_operand:QI 1 "register_operand" "0")
4693 (match_operand:QI 2 "general_operand" "dI")))]
4698 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
4699 (ashift:QI (match_dup 0)
4700 (match_operand:QI 1 "general_operand" "dI")))]
4704 ;; On most 68k models, this makes faster code in a special case.
4706 (define_insn "ashrsi_16"
4707 [(set (match_operand:SI 0 "register_operand" "=d")
4708 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4711 "swap %0\;ext%.l %0")
4713 ;; On the 68000, this makes faster code in a special case.
4716 [(set (match_operand:SI 0 "register_operand" "=d")
4717 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4718 (match_operand:SI 2 "const_int_operand" "n")))]
4720 && INTVAL (operands[2]) > 16
4721 && INTVAL (operands[2]) <= 24"
4723 operands[2] = GEN_INT (INTVAL (operands[2]) - 16);
4724 return "swap %0\;asr%.w %2,%0\;ext%.l %0";
4727 (define_insn "subreghi1ashrdi_const32"
4728 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
4729 (subreg:HI (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro")
4730 (const_int 32)) 6))]
4733 if (GET_CODE (operands[1]) != REG)
4734 operands[1] = adjust_address (operands[1], HImode, 2);
4735 return "move%.w %1,%0";
4737 [(set_attr "type" "move")])
4739 (define_insn "subregsi1ashrdi_const32"
4740 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
4741 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro")
4742 (const_int 32)) 4))]
4745 return "move%.l %1,%0";
4747 [(set_attr "type" "move_l")])
4749 (define_insn "*ashrdi3_const1"
4750 [(set (match_operand:DI 0 "register_operand" "=d")
4751 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
4755 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4756 return "asr%.l #1,%0\;roxr%.l #1,%1";
4760 [(set (match_operand:DI 0 "register_operand" "")
4761 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4763 "reload_completed && !TARGET_COLDFIRE"
4765 (ashiftrt:DI (match_dup 1) (const_int 1)))
4767 (ashiftrt:DI (match_dup 0) (const_int 1)))]
4771 [(set (match_operand:DI 0 "register_operand" "")
4772 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4774 "reload_completed && !TARGET_COLDFIRE"
4776 (ashiftrt:DI (match_dup 1) (const_int 2)))
4778 (ashiftrt:DI (match_dup 0) (const_int 1)))]
4782 [(set (match_operand:DI 0 "register_operand" "")
4783 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4785 "reload_completed && !TARGET_COLDFIRE"
4786 [(set (strict_low_part (subreg:QI (match_dup 0) 7))
4787 (subreg:QI (match_dup 0) 3))
4789 (ashiftrt:SI (match_dup 2) (const_int 8)))
4791 (rotatert:SI (match_dup 3) (const_int 8)))]
4793 operands[2] = gen_highpart (SImode, operands[0]);
4794 operands[3] = gen_lowpart (SImode, operands[0]);
4798 [(set (match_operand:DI 0 "register_operand" "")
4799 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4801 "reload_completed && !TARGET_COLDFIRE"
4802 [(set (strict_low_part (subreg:HI (match_dup 0) 6))
4803 (subreg:HI (match_dup 0) 2))
4805 (rotate:SI (match_dup 2) (const_int 16)))
4807 (rotate:SI (match_dup 3) (const_int 16)))
4809 (sign_extend:SI (subreg:HI (match_dup 2) 2)))]
4811 operands[2] = gen_highpart (SImode, operands[0]);
4812 operands[3] = gen_lowpart (SImode, operands[0]);
4815 (define_insn "*ashrdi_const32"
4816 [(set (match_operand:DI 0 "register_operand" "=d")
4817 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_src_operand" "ro")
4823 return "move%.l %1,%R0\;smi %0\;extb%.l %0";
4825 return "move%.l %1,%R0\;smi %0\;ext%.w %0\;ext%.l %0";
4828 (define_insn "*ashrdi_const32_mem"
4829 [(set (match_operand:DI 0 "memory_operand" "=o,<")
4830 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_src_operand" "ro,ro")
4832 (clobber (match_scratch:SI 2 "=d,d"))]
4836 operands[3] = adjust_address (operands[0], SImode,
4837 which_alternative == 0 ? 4 : 0);
4838 operands[0] = adjust_address (operands[0], SImode, 0);
4839 if (TARGET_68020 || TARGET_COLDFIRE)
4840 return "move%.l %1,%3\;smi %2\;extb%.l %2\;move%.l %2,%0";
4842 return "move%.l %1,%3\;smi %2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0";
4846 [(set (match_operand:DI 0 "register_operand" "")
4847 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4849 "reload_completed && !TARGET_COLDFIRE"
4851 (ashiftrt:SI (match_dup 3) (const_int 31)))
4854 "split_di(operands, 1, operands + 2, operands + 3);")
4856 ;; The predicate below must be general_operand, because ashrdi3 allows that
4857 (define_insn "ashrdi_const"
4858 [(set (match_operand:DI 0 "register_operand" "=d")
4859 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
4860 (match_operand 2 "const_int_operand" "n")))]
4862 && ((INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3)
4863 || INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16
4864 || INTVAL (operands[2]) == 31
4865 || (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63))"
4867 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4869 if (INTVAL (operands[2]) == 48)
4870 return "swap %0\;ext%.l %0\;move%.l %0,%1\;smi %0\;ext%.w %0";
4871 if (INTVAL (operands[2]) == 31)
4872 return "add%.l %1,%1\;addx%.l %0,%0\;move%.l %0,%1\;subx%.l %0,%0";
4873 if (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63)
4875 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
4876 output_asm_insn (INTVAL (operands[2]) <= 8 ? "asr%.l %2,%0" :
4877 "moveq %2,%1\;asr%.l %1,%0", operands);
4878 output_asm_insn ("mov%.l %0,%1\;smi %0", operands);
4879 return INTVAL (operands[2]) >= 15 ? "ext%.w %d0" :
4880 TARGET_68020 ? "extb%.l %0" : "ext%.w %0\;ext%.l %0";
4885 (define_expand "ashrdi3"
4886 [(set (match_operand:DI 0 "register_operand" "")
4887 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4888 (match_operand 2 "const_int_operand" "")))]
4891 /* ??? This is a named pattern like this is not allowed to FAIL based
4893 if (GET_CODE (operands[2]) != CONST_INT
4894 || ((INTVAL (operands[2]) < 1 || INTVAL (operands[2]) > 3)
4895 && INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16
4896 && (INTVAL (operands[2]) < 31 || INTVAL (operands[2]) > 63)))
4900 ;; On all 68k models, this makes faster code in a special case.
4902 (define_insn "ashrsi_31"
4903 [(set (match_operand:SI 0 "register_operand" "=d")
4904 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4908 return "add%.l %0,%0\;subx%.l %0,%0";
4911 (define_insn "ashrsi3"
4912 [(set (match_operand:SI 0 "register_operand" "=d")
4913 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4914 (match_operand:SI 2 "general_operand" "dI")))]
4917 [(set_attr "type" "shift")
4918 (set_attr "opy" "2")])
4920 (define_insn "ashrhi3"
4921 [(set (match_operand:HI 0 "register_operand" "=d")
4922 (ashiftrt:HI (match_operand:HI 1 "register_operand" "0")
4923 (match_operand:HI 2 "general_operand" "dI")))]
4928 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
4929 (ashiftrt:HI (match_dup 0)
4930 (match_operand:HI 1 "general_operand" "dI")))]
4934 (define_insn "ashrqi3"
4935 [(set (match_operand:QI 0 "register_operand" "=d")
4936 (ashiftrt:QI (match_operand:QI 1 "register_operand" "0")
4937 (match_operand:QI 2 "general_operand" "dI")))]
4942 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
4943 (ashiftrt:QI (match_dup 0)
4944 (match_operand:QI 1 "general_operand" "dI")))]
4948 ;; logical shift instructions
4950 ;; commented out because of reload problems in 950612-1.c
4953 ;; (subreg:SI (lshiftrt:DI (match_operand:DI 0 "general_operand" "ro")
4954 ;; (const_int 32)) 4))
4955 ;; (set (match_operand:SI 1 "nonimmediate_operand" "=dm")
4956 ;; (subreg:SI (lshiftrt:DI (match_dup 0)
4957 ;; (const_int 32)) 4))]
4960 ;; return "move%.l %0,%1";
4965 ;; (subreg:SI (lshiftrt:DI (match_operand:DI 0 "general_operand" "ro")
4966 ;; (const_int 32)) 0))
4967 ;; (set (match_operand:DI 1 "nonimmediate_operand" "=do")
4968 ;; (lshiftrt:DI (match_dup 0)
4969 ;; (const_int 32)))]
4972 ;; if (GET_CODE (operands[1]) == REG)
4973 ;; operands[2] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
4975 ;; operands[2] = adjust_address (operands[1], SImode, 4);
4976 ;; return "move%.l %0,%2\;clr%.l %1";
4979 (define_insn "subreg1lshrdi_const32"
4980 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
4981 (subreg:SI (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro")
4982 (const_int 32)) 4))]
4985 [(set_attr "type" "move_l")])
4987 (define_insn "*lshrdi3_const1"
4988 [(set (match_operand:DI 0 "register_operand" "=d")
4989 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
4992 "lsr%.l #1,%0\;roxr%.l #1,%R0")
4995 [(set (match_operand:DI 0 "register_operand" "")
4996 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
4998 "reload_completed && !TARGET_COLDFIRE"
5000 (lshiftrt:DI (match_dup 1) (const_int 1)))
5002 (lshiftrt:DI (match_dup 0) (const_int 1)))]
5006 [(set (match_operand:DI 0 "register_operand" "")
5007 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
5009 "reload_completed && !TARGET_COLDFIRE"
5011 (lshiftrt:DI (match_dup 1) (const_int 2)))
5013 (lshiftrt:DI (match_dup 0) (const_int 1)))]
5017 [(set (match_operand:DI 0 "register_operand" "")
5018 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
5020 "reload_completed && !TARGET_COLDFIRE"
5021 [(set (strict_low_part (subreg:QI (match_dup 0) 7))
5022 (subreg:QI (match_dup 0) 3))
5024 (lshiftrt:SI (match_dup 2) (const_int 8)))
5026 (rotatert:SI (match_dup 3) (const_int 8)))]
5028 operands[2] = gen_highpart (SImode, operands[0]);
5029 operands[3] = gen_lowpart (SImode, operands[0]);
5033 [(set (match_operand:DI 0 "register_operand" "")
5034 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
5036 "reload_completed && !TARGET_COLDFIRE"
5037 [(set (strict_low_part (subreg:HI (match_dup 0) 6))
5038 (subreg:HI (match_dup 0) 2))
5039 (set (strict_low_part (subreg:HI (match_dup 0) 2))
5042 (rotate:SI (match_dup 3) (const_int 16)))
5044 (rotate:SI (match_dup 2) (const_int 16)))]
5046 operands[2] = gen_highpart (SImode, operands[0]);
5047 operands[3] = gen_lowpart (SImode, operands[0]);
5051 [(set (match_operand:DI 0 "pre_dec_operand" "")
5052 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "")
5055 [(set (match_dup 0) (match_dup 1))
5056 (set (match_dup 0) (const_int 0))]
5058 operands[0] = adjust_address(operands[0], SImode, 0);
5059 operands[1] = gen_highpart(SImode, operands[1]);
5063 [(set (match_operand:DI 0 "post_inc_operand" "")
5064 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "")
5067 [(set (match_dup 0) (const_int 0))
5068 (set (match_dup 0) (match_dup 1))]
5070 operands[0] = adjust_address(operands[0], SImode, 0);
5071 operands[1] = gen_highpart(SImode, operands[1]);
5075 [(set (match_operand:DI 0 "nonimmediate_operand" "")
5076 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "")
5079 [(set (match_dup 2) (match_dup 5))
5080 (set (match_dup 4) (const_int 0))]
5081 "split_di(operands, 2, operands + 2, operands + 4);")
5083 (define_insn "*lshrdi_const32"
5084 [(set (match_operand:DI 0 "nonimmediate_operand" "=ro<>")
5085 (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro")
5091 [(set (match_operand:DI 0 "register_operand" "")
5092 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
5093 (match_operand 2 "const_int_operand" "")))]
5094 "reload_completed && !TARGET_COLDFIRE
5095 && INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 40"
5096 [(set (match_dup 3) (lshiftrt:SI (match_dup 3) (match_dup 2)))
5097 (set (match_dup 4) (match_dup 3))
5098 (set (match_dup 3) (const_int 0))]
5100 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
5101 operands[3] = gen_highpart (SImode, operands[0]);
5102 operands[4] = gen_lowpart (SImode, operands[0]);
5106 [(set (match_operand:DI 0 "register_operand" "")
5107 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
5110 [(set (match_dup 3) (match_dup 2))
5111 (set (strict_low_part (subreg:HI (match_dup 0) 6))
5113 (set (match_dup 2) (const_int 0))
5115 (rotate:SI (match_dup 3) (const_int 16)))]
5117 operands[2] = gen_highpart (SImode, operands[0]);
5118 operands[3] = gen_lowpart (SImode, operands[0]);
5122 [(set (match_operand:DI 0 "register_operand" "")
5123 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
5124 (match_operand 2 "const_int_operand" "")))]
5125 "reload_completed && !TARGET_COLDFIRE
5126 && INTVAL (operands[2]) > 40 && INTVAL (operands[2]) <= 62"
5127 [(set (match_dup 4) (match_dup 2))
5128 (set (match_dup 3) (lshiftrt:SI (match_dup 3) (match_dup 4)))
5129 (set (match_dup 4) (match_dup 3))
5130 (set (match_dup 3) (const_int 0))]
5132 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
5133 operands[3] = gen_highpart (SImode, operands[0]);
5134 operands[4] = gen_lowpart (SImode, operands[0]);
5137 (define_insn "*lshrdi_const63"
5138 [(set (match_operand:DI 0 "register_operand" "=d")
5139 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
5142 "add%.l %0,%0\;clr%.l %0\;clr%.l %R1\;addx%.l %R1,%R1")
5144 (define_insn "*lshrdi3_const"
5145 [(set (match_operand:DI 0 "register_operand" "=d")
5146 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
5147 (match_operand 2 "const_int_operand" "n")))]
5149 && ((INTVAL (operands[2]) >= 2 && INTVAL (operands[2]) <= 3)
5150 || INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16
5151 || (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63)))"
5154 (define_expand "lshrdi3"
5155 [(set (match_operand:DI 0 "register_operand" "")
5156 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
5157 (match_operand 2 "const_int_operand" "")))]
5160 /* ??? This is a named pattern like this is not allowed to FAIL based
5162 if (GET_CODE (operands[2]) != CONST_INT
5163 || ((INTVAL (operands[2]) < 1 || INTVAL (operands[2]) > 3)
5164 && INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16
5165 && (INTVAL (operands[2]) < 32 || INTVAL (operands[2]) > 63)))
5169 ;; On all 68k models, this makes faster code in a special case.
5171 (define_insn "lshrsi_31"
5172 [(set (match_operand:SI 0 "register_operand" "=d")
5173 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
5177 return "add%.l %0,%0\;subx%.l %0,%0\;neg%.l %0";
5180 ;; On most 68k models, this makes faster code in a special case.
5182 (define_insn "lshrsi_16"
5183 [(set (match_operand:SI 0 "register_operand" "=d")
5184 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
5189 return "clr%.w %0\;swap %0";
5192 ;; On the 68000, this makes faster code in a special case.
5194 (define_insn "lshrsi_17_24"
5195 [(set (match_operand:SI 0 "register_operand" "=d")
5196 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
5197 (match_operand:SI 2 "const_int_operand" "n")))]
5199 && INTVAL (operands[2]) > 16
5200 && INTVAL (operands[2]) <= 24"
5202 /* I think lsr%.w sets the CC properly. */
5203 operands[2] = GEN_INT (INTVAL (operands[2]) - 16);
5204 return "clr%.w %0\;swap %0\;lsr%.w %2,%0";
5207 (define_insn "lshrsi3"
5208 [(set (match_operand:SI 0 "register_operand" "=d")
5209 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
5210 (match_operand:SI 2 "general_operand" "dI")))]
5213 [(set_attr "type" "shift")
5214 (set_attr "opy" "2")])
5216 (define_insn "lshrhi3"
5217 [(set (match_operand:HI 0 "register_operand" "=d")
5218 (lshiftrt:HI (match_operand:HI 1 "register_operand" "0")
5219 (match_operand:HI 2 "general_operand" "dI")))]
5224 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
5225 (lshiftrt:HI (match_dup 0)
5226 (match_operand:HI 1 "general_operand" "dI")))]
5230 (define_insn "lshrqi3"
5231 [(set (match_operand:QI 0 "register_operand" "=d")
5232 (lshiftrt:QI (match_operand:QI 1 "register_operand" "0")
5233 (match_operand:QI 2 "general_operand" "dI")))]
5238 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
5239 (lshiftrt:QI (match_dup 0)
5240 (match_operand:QI 1 "general_operand" "dI")))]
5244 ;; rotate instructions
5246 (define_insn "rotlsi3"
5247 [(set (match_operand:SI 0 "register_operand" "=d")
5248 (rotate:SI (match_operand:SI 1 "register_operand" "0")
5249 (match_operand:SI 2 "general_operand" "dINO")))]
5252 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 16)
5254 else if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 16)
5256 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
5257 return "ror%.l %2,%0";
5260 return "rol%.l %2,%0";
5263 (define_insn "rotlhi3"
5264 [(set (match_operand:HI 0 "register_operand" "=d")
5265 (rotate:HI (match_operand:HI 1 "register_operand" "0")
5266 (match_operand:HI 2 "general_operand" "dIP")))]
5269 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 8)
5271 operands[2] = GEN_INT (16 - INTVAL (operands[2]));
5272 return "ror%.w %2,%0";
5275 return "rol%.w %2,%0";
5279 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
5280 (rotate:HI (match_dup 0)
5281 (match_operand:HI 1 "general_operand" "dIP")))]
5284 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 8)
5286 operands[2] = GEN_INT (16 - INTVAL (operands[2]));
5287 return "ror%.w %2,%0";
5290 return "rol%.w %2,%0";
5293 (define_insn "rotlqi3"
5294 [(set (match_operand:QI 0 "register_operand" "=d")
5295 (rotate:QI (match_operand:QI 1 "register_operand" "0")
5296 (match_operand:QI 2 "general_operand" "dI")))]
5299 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 4)
5301 operands[2] = GEN_INT (8 - INTVAL (operands[2]));
5302 return "ror%.b %2,%0";
5305 return "rol%.b %2,%0";
5309 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
5310 (rotate:QI (match_dup 0)
5311 (match_operand:QI 1 "general_operand" "dI")))]
5314 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 4)
5316 operands[2] = GEN_INT (8 - INTVAL (operands[2]));
5317 return "ror%.b %2,%0";
5320 return "rol%.b %2,%0";
5323 (define_insn "rotrsi3"
5324 [(set (match_operand:SI 0 "register_operand" "=d")
5325 (rotatert:SI (match_operand:SI 1 "register_operand" "0")
5326 (match_operand:SI 2 "general_operand" "dI")))]
5330 (define_insn "rotrhi3"
5331 [(set (match_operand:HI 0 "register_operand" "=d")
5332 (rotatert:HI (match_operand:HI 1 "register_operand" "0")
5333 (match_operand:HI 2 "general_operand" "dI")))]
5338 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
5339 (rotatert:HI (match_dup 0)
5340 (match_operand:HI 1 "general_operand" "dI")))]
5344 (define_insn "rotrqi3"
5345 [(set (match_operand:QI 0 "register_operand" "=d")
5346 (rotatert:QI (match_operand:QI 1 "register_operand" "0")
5347 (match_operand:QI 2 "general_operand" "dI")))]
5352 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
5353 (rotatert:QI (match_dup 0)
5354 (match_operand:QI 1 "general_operand" "dI")))]
5359 ;; Bit set/clear in memory byte.
5361 ;; set bit, bit number is int
5362 (define_insn "bsetmemqi"
5363 [(set (match_operand:QI 0 "memory_operand" "+m")
5364 (ior:QI (subreg:QI (ashift:SI (const_int 1)
5365 (match_operand:SI 1 "general_operand" "d")) 3)
5370 return "bset %1,%0";
5372 [(set_attr "type" "bitrw")])
5374 ;; set bit, bit number is (sign/zero)_extended from HImode/QImode
5375 (define_insn "*bsetmemqi_ext"
5376 [(set (match_operand:QI 0 "memory_operand" "+m")
5377 (ior:QI (subreg:QI (ashift:SI (const_int 1)
5378 (match_operator:SI 2 "extend_operator"
5379 [(match_operand 1 "general_operand" "d")])) 3)
5384 return "bset %1,%0";
5386 [(set_attr "type" "bitrw")])
5388 ;; clear bit, bit number is int
5389 (define_insn "bclrmemqi"
5390 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+m")
5392 (minus:SI (const_int 7)
5393 (match_operand:SI 1 "general_operand" "d")))
5398 return "bclr %1,%0";
5400 [(set_attr "type" "bitrw")])
5402 ;; clear bit, bit number is (sign/zero)_extended from HImode/QImode
5403 (define_insn "*bclrmemqi_ext"
5404 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+m")
5406 (minus:SI (const_int 7)
5407 (match_operator:SI 2 "extend_operator"
5408 [(match_operand 1 "general_operand" "d")])))
5413 return "bclr %1,%0";
5415 [(set_attr "type" "bitrw")])
5417 ;; Special cases of bit-field insns which we should
5418 ;; recognize in preference to the general case.
5419 ;; These handle aligned 8-bit and 16-bit fields,
5420 ;; which can usually be done with move instructions.
5423 ; Special case for 32-bit field in memory. This only occurs when 32-bit
5424 ; alignment of structure members is specified.
5426 ; The move is allowed to be odd byte aligned, because that's still faster
5427 ; than an odd byte aligned bit-field instruction.
5430 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5432 (match_operand:SI 1 "const_int_operand" "n"))
5433 (match_operand:SI 2 "general_src_operand" "rmSi"))]
5434 "TARGET_68020 && TARGET_BITFIELD
5435 && (INTVAL (operands[1]) % 8) == 0
5436 && ! mode_dependent_address_p (XEXP (operands[0], 0))"
5439 = adjust_address (operands[0], SImode, INTVAL (operands[1]) / 8);
5441 return "move%.l %2,%0";
5445 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+do")
5446 (match_operand:SI 1 "const_int_operand" "n")
5447 (match_operand:SI 2 "const_int_operand" "n"))
5448 (match_operand:SI 3 "register_operand" "d"))]
5449 "TARGET_68020 && TARGET_BITFIELD
5450 && (INTVAL (operands[1]) == 8 || INTVAL (operands[1]) == 16)
5451 && INTVAL (operands[2]) % INTVAL (operands[1]) == 0
5452 && (GET_CODE (operands[0]) == REG
5453 || ! mode_dependent_address_p (XEXP (operands[0], 0)))"
5455 if (REG_P (operands[0]))
5457 if (INTVAL (operands[1]) + INTVAL (operands[2]) != 32)
5458 return "bfins %3,%0{%b2:%b1}";
5461 operands[0] = adjust_address (operands[0],
5462 INTVAL (operands[1]) == 8 ? QImode : HImode,
5463 INTVAL (operands[2]) / 8);
5465 if (GET_CODE (operands[3]) == MEM)
5466 operands[3] = adjust_address (operands[3],
5467 INTVAL (operands[1]) == 8 ? QImode : HImode,
5468 (32 - INTVAL (operands[1])) / 8);
5470 if (INTVAL (operands[1]) == 8)
5471 return "move%.b %3,%0";
5472 return "move%.w %3,%0";
5477 ; Special case for 32-bit field in memory. This only occurs when 32-bit
5478 ; alignment of structure members is specified.
5480 ; The move is allowed to be odd byte aligned, because that's still faster
5481 ; than an odd byte aligned bit-field instruction.
5484 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
5485 (zero_extract:SI (match_operand:QI 1 "memory_src_operand" "oS")
5487 (match_operand:SI 2 "const_int_operand" "n")))]
5488 "TARGET_68020 && TARGET_BITFIELD
5489 && (INTVAL (operands[2]) % 8) == 0
5490 && ! mode_dependent_address_p (XEXP (operands[1], 0))"
5493 = adjust_address (operands[1], SImode, INTVAL (operands[2]) / 8);
5495 return "move%.l %1,%0";
5499 [(set (match_operand:SI 0 "nonimmediate_operand" "=&d")
5500 (zero_extract:SI (match_operand:SI 1 "register_operand" "do")
5501 (match_operand:SI 2 "const_int_operand" "n")
5502 (match_operand:SI 3 "const_int_operand" "n")))]
5503 "TARGET_68020 && TARGET_BITFIELD
5504 && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
5505 && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
5506 && (GET_CODE (operands[1]) == REG
5507 || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
5509 cc_status.flags |= CC_NOT_NEGATIVE;
5510 if (REG_P (operands[1]))
5512 if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
5513 return "bfextu %1{%b3:%b2},%0";
5517 = adjust_address (operands[1], SImode, INTVAL (operands[3]) / 8);
5519 output_asm_insn ("clr%.l %0", operands);
5520 if (GET_CODE (operands[0]) == MEM)
5521 operands[0] = adjust_address (operands[0],
5522 INTVAL (operands[2]) == 8 ? QImode : HImode,
5523 (32 - INTVAL (operands[1])) / 8);
5525 if (INTVAL (operands[2]) == 8)
5526 return "move%.b %1,%0";
5527 return "move%.w %1,%0";
5531 ; Special case for 32-bit field in memory. This only occurs when 32-bit
5532 ; alignment of structure members is specified.
5534 ; The move is allowed to be odd byte aligned, because that's still faster
5535 ; than an odd byte aligned bit-field instruction.
5538 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
5539 (sign_extract:SI (match_operand:QI 1 "memory_src_operand" "oS")
5541 (match_operand:SI 2 "const_int_operand" "n")))]
5542 "TARGET_68020 && TARGET_BITFIELD
5543 && (INTVAL (operands[2]) % 8) == 0
5544 && ! mode_dependent_address_p (XEXP (operands[1], 0))"
5547 = adjust_address (operands[1], SImode, INTVAL (operands[2]) / 8);
5549 return "move%.l %1,%0";
5553 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
5554 (sign_extract:SI (match_operand:SI 1 "register_operand" "do")
5555 (match_operand:SI 2 "const_int_operand" "n")
5556 (match_operand:SI 3 "const_int_operand" "n")))]
5557 "TARGET_68020 && TARGET_BITFIELD
5558 && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
5559 && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
5560 && (GET_CODE (operands[1]) == REG
5561 || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
5563 if (REG_P (operands[1]))
5565 if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
5566 return "bfexts %1{%b3:%b2},%0";
5570 = adjust_address (operands[1],
5571 INTVAL (operands[2]) == 8 ? QImode : HImode,
5572 INTVAL (operands[3]) / 8);
5574 if (INTVAL (operands[2]) == 8)
5575 return "move%.b %1,%0\;extb%.l %0";
5576 return "move%.w %1,%0\;ext%.l %0";
5579 ;; Bit-field instructions, general cases.
5580 ;; "o,d" constraint causes a nonoffsettable memref to match the "o"
5581 ;; so that its address is reloaded.
5583 (define_expand "extv"
5584 [(set (match_operand:SI 0 "register_operand" "")
5585 (sign_extract:SI (match_operand:SI 1 "general_operand" "")
5586 (match_operand:SI 2 "const_int_operand" "")
5587 (match_operand:SI 3 "const_int_operand" "")))]
5588 "TARGET_68020 && TARGET_BITFIELD"
5592 [(set (match_operand:SI 0 "register_operand" "=d")
5593 (sign_extract:SI (match_operand:QI 1 "memory_operand" "o")
5594 (match_operand:SI 2 "nonmemory_operand" "dn")
5595 (match_operand:SI 3 "nonmemory_operand" "dn")))]
5596 "TARGET_68020 && TARGET_BITFIELD"
5597 "bfexts %1{%b3:%b2},%0")
5599 (define_expand "extzv"
5600 [(set (match_operand:SI 0 "register_operand" "")
5601 (zero_extract:SI (match_operand:SI 1 "general_operand" "")
5602 (match_operand:SI 2 "const_int_operand" "")
5603 (match_operand:SI 3 "const_int_operand" "")))]
5604 "TARGET_68020 && TARGET_BITFIELD"
5608 [(set (match_operand:SI 0 "register_operand" "=d")
5609 (zero_extract:SI (match_operand:QI 1 "memory_operand" "o")
5610 (match_operand:SI 2 "nonmemory_operand" "dn")
5611 (match_operand:SI 3 "nonmemory_operand" "dn")))]
5612 "TARGET_68020 && TARGET_BITFIELD"
5614 if (GET_CODE (operands[2]) == CONST_INT)
5616 if (INTVAL (operands[2]) != 32)
5617 cc_status.flags |= CC_NOT_NEGATIVE;
5623 return "bfextu %1{%b3:%b2},%0";
5627 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5628 (match_operand:SI 1 "nonmemory_operand" "dn")
5629 (match_operand:SI 2 "nonmemory_operand" "dn"))
5630 (xor:SI (zero_extract:SI (match_dup 0) (match_dup 1) (match_dup 2))
5631 (match_operand 3 "const_int_operand" "n")))]
5632 "TARGET_68020 && TARGET_BITFIELD
5633 && (INTVAL (operands[3]) == -1
5634 || (GET_CODE (operands[1]) == CONST_INT
5635 && (~ INTVAL (operands[3]) & ((1 << INTVAL (operands[1]))- 1)) == 0))"
5638 return "bfchg %0{%b2:%b1}";
5642 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5643 (match_operand:SI 1 "nonmemory_operand" "dn")
5644 (match_operand:SI 2 "nonmemory_operand" "dn"))
5646 "TARGET_68020 && TARGET_BITFIELD"
5649 return "bfclr %0{%b2:%b1}";
5653 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5654 (match_operand:SI 1 "general_operand" "dn")
5655 (match_operand:SI 2 "general_operand" "dn"))
5657 "TARGET_68020 && TARGET_BITFIELD"
5660 return "bfset %0{%b2:%b1}";
5663 (define_expand "insv"
5664 [(set (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "")
5665 (match_operand:SI 1 "const_int_operand" "")
5666 (match_operand:SI 2 "const_int_operand" ""))
5667 (match_operand:SI 3 "register_operand" ""))]
5668 "TARGET_68020 && TARGET_BITFIELD"
5672 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5673 (match_operand:SI 1 "nonmemory_operand" "dn")
5674 (match_operand:SI 2 "nonmemory_operand" "dn"))
5675 (match_operand:SI 3 "register_operand" "d"))]
5676 "TARGET_68020 && TARGET_BITFIELD"
5677 "bfins %3,%0{%b2:%b1}")
5679 ;; Now recognize bit-field insns that operate on registers
5680 ;; (or at least were intended to do so).
5683 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
5684 (sign_extract:SI (match_operand:SI 1 "register_operand" "d")
5685 (match_operand:SI 2 "const_int_operand" "n")
5686 (match_operand:SI 3 "const_int_operand" "n")))]
5687 "TARGET_68020 && TARGET_BITFIELD"
5688 "bfexts %1{%b3:%b2},%0")
5691 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
5692 (zero_extract:SI (match_operand:SI 1 "register_operand" "d")
5693 (match_operand:SI 2 "const_int_operand" "n")
5694 (match_operand:SI 3 "const_int_operand" "n")))]
5695 "TARGET_68020 && TARGET_BITFIELD"
5697 if (GET_CODE (operands[2]) == CONST_INT)
5699 if (INTVAL (operands[2]) != 32)
5700 cc_status.flags |= CC_NOT_NEGATIVE;
5706 return "bfextu %1{%b3:%b2},%0";
5710 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
5711 (match_operand:SI 1 "const_int_operand" "n")
5712 (match_operand:SI 2 "const_int_operand" "n"))
5714 "TARGET_68020 && TARGET_BITFIELD"
5717 return "bfclr %0{%b2:%b1}";
5721 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
5722 (match_operand:SI 1 "const_int_operand" "n")
5723 (match_operand:SI 2 "const_int_operand" "n"))
5725 "TARGET_68020 && TARGET_BITFIELD"
5728 return "bfset %0{%b2:%b1}";
5732 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
5733 (match_operand:SI 1 "const_int_operand" "n")
5734 (match_operand:SI 2 "const_int_operand" "n"))
5735 (match_operand:SI 3 "register_operand" "d"))]
5736 "TARGET_68020 && TARGET_BITFIELD"
5739 /* These special cases are now recognized by a specific pattern. */
5740 if (GET_CODE (operands[1]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT
5741 && INTVAL (operands[1]) == 16 && INTVAL (operands[2]) == 16)
5742 return "move%.w %3,%0";
5743 if (GET_CODE (operands[1]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT
5744 && INTVAL (operands[1]) == 24 && INTVAL (operands[2]) == 8)
5745 return "move%.b %3,%0";
5747 return "bfins %3,%0{%b2:%b1}";
5750 ;; Special patterns for optimizing bit-field instructions.
5754 (zero_extract:SI (match_operand:QI 0 "memory_operand" "o")
5755 (match_operand:SI 1 "const_int_operand" "n")
5756 (match_operand:SI 2 "general_operand" "dn")))]
5757 "TARGET_68020 && TARGET_BITFIELD"
5759 if (operands[1] == const1_rtx
5760 && GET_CODE (operands[2]) == CONST_INT)
5762 int width = GET_CODE (operands[0]) == REG ? 31 : 7;
5763 return output_btst (operands,
5764 GEN_INT (width - INTVAL (operands[2])),
5765 operands[0], insn, 1000);
5766 /* Pass 1000 as SIGNPOS argument so that btst will
5767 not think we are testing the sign bit for an `and'
5768 and assume that nonzero implies a negative result. */
5770 if (INTVAL (operands[1]) != 32)
5771 cc_status.flags = CC_NOT_NEGATIVE;
5772 return "bftst %0{%b2:%b1}";
5776 ;;; now handle the register cases
5779 (zero_extract:SI (match_operand:SI 0 "register_operand" "d")
5780 (match_operand:SI 1 "const_int_operand" "n")
5781 (match_operand:SI 2 "general_operand" "dn")))]
5782 "TARGET_68020 && TARGET_BITFIELD"
5784 if (operands[1] == const1_rtx
5785 && GET_CODE (operands[2]) == CONST_INT)
5787 int width = GET_CODE (operands[0]) == REG ? 31 : 7;
5788 return output_btst (operands, GEN_INT (width - INTVAL (operands[2])),
5789 operands[0], insn, 1000);
5790 /* Pass 1000 as SIGNPOS argument so that btst will
5791 not think we are testing the sign bit for an `and'
5792 and assume that nonzero implies a negative result. */
5794 if (INTVAL (operands[1]) != 32)
5795 cc_status.flags = CC_NOT_NEGATIVE;
5796 return "bftst %0{%b2:%b1}";
5799 (define_insn "scc0_di"
5800 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
5801 (match_operator 1 "valid_dbcc_comparison_p"
5802 [(match_operand:DI 2 "general_operand" "ro") (const_int 0)]))]
5805 return output_scc_di (operands[1], operands[2], const0_rtx, operands[0]);
5808 (define_insn "scc0_di_5200"
5809 [(set (match_operand:QI 0 "nonimmediate_operand" "=d")
5810 (match_operator 1 "valid_dbcc_comparison_p"
5811 [(match_operand:DI 2 "general_operand" "ro") (const_int 0)]))]
5814 return output_scc_di (operands[1], operands[2], const0_rtx, operands[0]);
5817 (define_insn "scc_di"
5818 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,dm")
5819 (match_operator 1 "valid_dbcc_comparison_p"
5820 [(match_operand:DI 2 "general_operand" "ro,r")
5821 (match_operand:DI 3 "general_operand" "r,ro")]))]
5824 return output_scc_di (operands[1], operands[2], operands[3], operands[0]);
5827 (define_insn "scc_di_5200"
5828 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d")
5829 (match_operator 1 "valid_dbcc_comparison_p"
5830 [(match_operand:DI 2 "general_operand" "ro,r")
5831 (match_operand:DI 3 "general_operand" "r,ro")]))]
5834 return output_scc_di (operands[1], operands[2], operands[3], operands[0]);
5837 ;; Note that operand 0 of an SCC insn is supported in the hardware as
5838 ;; memory, but we cannot allow it to be in memory in case the address
5839 ;; needs to be reloaded.
5841 (define_expand "seq"
5842 [(set (match_operand:QI 0 "register_operand" "")
5843 (eq:QI (cc0) (const_int 0)))]
5846 if ((TUNE_68060 || TARGET_COLDFIRE_FPU)
5847 && m68k_last_compare_had_fp_operands)
5849 m68k_last_compare_had_fp_operands = 0;
5855 [(set (match_operand:QI 0 "register_operand" "=d")
5856 (eq:QI (cc0) (const_int 0)))]
5859 cc_status = cc_prev_status;
5860 OUTPUT_JUMP ("seq %0", "fseq %0", "seq %0");
5863 (define_expand "sne"
5864 [(set (match_operand:QI 0 "register_operand" "")
5865 (ne:QI (cc0) (const_int 0)))]
5868 if ((TUNE_68060 || TARGET_COLDFIRE_FPU)
5869 && m68k_last_compare_had_fp_operands)
5871 m68k_last_compare_had_fp_operands = 0;
5877 [(set (match_operand:QI 0 "register_operand" "=d")
5878 (ne:QI (cc0) (const_int 0)))]
5881 cc_status = cc_prev_status;
5882 OUTPUT_JUMP ("sne %0", "fsne %0", "sne %0");
5885 (define_expand "sgt"
5886 [(set (match_operand:QI 0 "register_operand" "")
5887 (gt:QI (cc0) (const_int 0)))]
5890 if ((TUNE_68060 || TARGET_COLDFIRE_FPU)
5891 && m68k_last_compare_had_fp_operands)
5893 m68k_last_compare_had_fp_operands = 0;
5899 [(set (match_operand:QI 0 "register_operand" "=d")
5900 (gt:QI (cc0) (const_int 0)))]
5903 cc_status = cc_prev_status;
5904 OUTPUT_JUMP ("sgt %0", "fsgt %0", 0);
5907 (define_expand "sgtu"
5908 [(set (match_operand:QI 0 "register_operand" "")
5909 (gtu:QI (cc0) (const_int 0)))]
5914 [(set (match_operand:QI 0 "register_operand" "=d")
5915 (gtu:QI (cc0) (const_int 0)))]
5918 cc_status = cc_prev_status;
5922 (define_expand "slt"
5923 [(set (match_operand:QI 0 "register_operand" "")
5924 (lt:QI (cc0) (const_int 0)))]
5927 if ((TUNE_68060 || TARGET_COLDFIRE_FPU)
5928 && m68k_last_compare_had_fp_operands)
5930 m68k_last_compare_had_fp_operands = 0;
5936 [(set (match_operand:QI 0 "register_operand" "=d")
5937 (lt:QI (cc0) (const_int 0)))]
5940 cc_status = cc_prev_status;
5941 OUTPUT_JUMP ("slt %0", "fslt %0", "smi %0");
5944 (define_expand "sltu"
5945 [(set (match_operand:QI 0 "register_operand" "")
5946 (ltu:QI (cc0) (const_int 0)))]
5951 [(set (match_operand:QI 0 "register_operand" "=d")
5952 (ltu:QI (cc0) (const_int 0)))]
5955 cc_status = cc_prev_status;
5959 (define_expand "sge"
5960 [(set (match_operand:QI 0 "register_operand" "")
5961 (ge:QI (cc0) (const_int 0)))]
5964 if ((TUNE_68060 || TARGET_COLDFIRE_FPU)
5965 && m68k_last_compare_had_fp_operands)
5967 m68k_last_compare_had_fp_operands = 0;
5973 [(set (match_operand:QI 0 "register_operand" "=d")
5974 (ge:QI (cc0) (const_int 0)))]
5977 cc_status = cc_prev_status;
5978 OUTPUT_JUMP ("sge %0", "fsge %0", "spl %0");
5981 (define_expand "sgeu"
5982 [(set (match_operand:QI 0 "register_operand" "")
5983 (geu:QI (cc0) (const_int 0)))]
5988 [(set (match_operand:QI 0 "register_operand" "=d")
5989 (geu:QI (cc0) (const_int 0)))]
5992 cc_status = cc_prev_status;
5995 [(set_attr "type" "scc")])
5997 (define_expand "sle"
5998 [(set (match_operand:QI 0 "register_operand" "")
5999 (le:QI (cc0) (const_int 0)))]
6002 if ((TUNE_68060 || TARGET_COLDFIRE_FPU)
6003 && m68k_last_compare_had_fp_operands)
6005 m68k_last_compare_had_fp_operands = 0;
6011 [(set (match_operand:QI 0 "register_operand" "=d")
6012 (le:QI (cc0) (const_int 0)))]
6015 cc_status = cc_prev_status;
6016 OUTPUT_JUMP ("sle %0", "fsle %0", 0);
6019 (define_expand "sleu"
6020 [(set (match_operand:QI 0 "register_operand" "")
6021 (leu:QI (cc0) (const_int 0)))]
6026 [(set (match_operand:QI 0 "register_operand" "=d")
6027 (leu:QI (cc0) (const_int 0)))]
6030 cc_status = cc_prev_status;
6033 [(set_attr "type" "scc")])
6035 (define_expand "sordered"
6036 [(set (match_operand:QI 0 "register_operand" "")
6037 (ordered:QI (cc0) (const_int 0)))]
6038 "TARGET_68881 && !TUNE_68060"
6040 gcc_assert (m68k_last_compare_had_fp_operands);
6041 m68k_last_compare_had_fp_operands = 0;
6044 (define_insn "*sordered_1"
6045 [(set (match_operand:QI 0 "register_operand" "=d")
6046 (ordered:QI (cc0) (const_int 0)))]
6047 "TARGET_68881 && !TUNE_68060"
6049 cc_status = cc_prev_status;
6053 (define_expand "sunordered"
6054 [(set (match_operand:QI 0 "register_operand" "")
6055 (unordered:QI (cc0) (const_int 0)))]
6056 "TARGET_68881 && !TUNE_68060"
6058 gcc_assert (m68k_last_compare_had_fp_operands);
6059 m68k_last_compare_had_fp_operands = 0;
6062 (define_insn "*sunordered_1"
6063 [(set (match_operand:QI 0 "register_operand" "=d")
6064 (unordered:QI (cc0) (const_int 0)))]
6065 "TARGET_68881 && !TUNE_68060"
6067 cc_status = cc_prev_status;
6071 (define_expand "suneq"
6072 [(set (match_operand:QI 0 "register_operand" "")
6073 (uneq:QI (cc0) (const_int 0)))]
6074 "TARGET_68881 && !TUNE_68060"
6076 gcc_assert (m68k_last_compare_had_fp_operands);
6077 m68k_last_compare_had_fp_operands = 0;
6080 (define_insn "*suneq_1"
6081 [(set (match_operand:QI 0 "register_operand" "=d")
6082 (uneq:QI (cc0) (const_int 0)))]
6083 "TARGET_68881 && !TUNE_68060"
6085 cc_status = cc_prev_status;
6089 (define_expand "sunge"
6090 [(set (match_operand:QI 0 "register_operand" "")
6091 (unge:QI (cc0) (const_int 0)))]
6092 "TARGET_68881 && !TUNE_68060"
6094 gcc_assert (m68k_last_compare_had_fp_operands);
6095 m68k_last_compare_had_fp_operands = 0;
6098 (define_insn "*sunge_1"
6099 [(set (match_operand:QI 0 "register_operand" "=d")
6100 (unge:QI (cc0) (const_int 0)))]
6101 "TARGET_68881 && !TUNE_68060"
6103 cc_status = cc_prev_status;
6107 (define_expand "sungt"
6108 [(set (match_operand:QI 0 "register_operand" "")
6109 (ungt:QI (cc0) (const_int 0)))]
6110 "TARGET_68881 && !TUNE_68060"
6112 gcc_assert (m68k_last_compare_had_fp_operands);
6113 m68k_last_compare_had_fp_operands = 0;
6116 (define_insn "*sungt_1"
6117 [(set (match_operand:QI 0 "register_operand" "=d")
6118 (ungt:QI (cc0) (const_int 0)))]
6119 "TARGET_68881 && !TUNE_68060"
6121 cc_status = cc_prev_status;
6125 (define_expand "sunle"
6126 [(set (match_operand:QI 0 "register_operand" "")
6127 (unle:QI (cc0) (const_int 0)))]
6128 "TARGET_68881 && !TUNE_68060"
6130 gcc_assert (m68k_last_compare_had_fp_operands);
6131 m68k_last_compare_had_fp_operands = 0;
6134 (define_insn "*sunle_1"
6135 [(set (match_operand:QI 0 "register_operand" "=d")
6136 (unle:QI (cc0) (const_int 0)))]
6137 "TARGET_68881 && !TUNE_68060"
6139 cc_status = cc_prev_status;
6143 (define_expand "sunlt"
6144 [(set (match_operand:QI 0 "register_operand" "")
6145 (unlt:QI (cc0) (const_int 0)))]
6146 "TARGET_68881 && !TUNE_68060"
6148 gcc_assert (m68k_last_compare_had_fp_operands);
6149 m68k_last_compare_had_fp_operands = 0;
6152 (define_insn "*sunlt_1"
6153 [(set (match_operand:QI 0 "register_operand" "=d")
6154 (unlt:QI (cc0) (const_int 0)))]
6155 "TARGET_68881 && !TUNE_68060"
6157 cc_status = cc_prev_status;
6161 (define_expand "sltgt"
6162 [(set (match_operand:QI 0 "register_operand" "")
6163 (ltgt:QI (cc0) (const_int 0)))]
6164 "TARGET_68881 && !TUNE_68060"
6166 gcc_assert (m68k_last_compare_had_fp_operands);
6167 m68k_last_compare_had_fp_operands = 0;
6170 (define_insn "*sltgt_1"
6171 [(set (match_operand:QI 0 "register_operand" "=d")
6172 (ltgt:QI (cc0) (const_int 0)))]
6173 "TARGET_68881 && !TUNE_68060"
6175 cc_status = cc_prev_status;
6179 (define_insn "*fsogt_1"
6180 [(set (match_operand:QI 0 "register_operand" "=d")
6181 (not:QI (unle:QI (cc0) (const_int 0))))]
6182 "TARGET_68881 && !TUNE_68060"
6184 cc_status = cc_prev_status;
6188 (define_insn "*fsoge_1"
6189 [(set (match_operand:QI 0 "register_operand" "=d")
6190 (not:QI (unlt:QI (cc0) (const_int 0))))]
6191 "TARGET_68881 && !TUNE_68060"
6193 cc_status = cc_prev_status;
6197 (define_insn "*fsolt_1"
6198 [(set (match_operand:QI 0 "register_operand" "=d")
6199 (not:QI (unge:QI (cc0) (const_int 0))))]
6200 "TARGET_68881 && !TUNE_68060"
6202 cc_status = cc_prev_status;
6206 (define_insn "*fsole_1"
6207 [(set (match_operand:QI 0 "register_operand" "=d")
6208 (not:QI (ungt:QI (cc0) (const_int 0))))]
6209 "TARGET_68881 && !TUNE_68060"
6211 cc_status = cc_prev_status;
6215 ;; Basic conditional jump instructions.
6217 (define_insn "beq0_di"
6219 (if_then_else (eq (match_operand:DI 0 "general_operand" "d*ao,<>")
6221 (label_ref (match_operand 1 "" ","))
6223 (clobber (match_scratch:SI 2 "=d,d"))]
6227 if (which_alternative == 1)
6228 return "move%.l %0,%2\;or%.l %0,%2\;jeq %l1";
6229 if ((cc_prev_status.value1
6230 && rtx_equal_p (cc_prev_status.value1, operands[0]))
6231 || (cc_prev_status.value2
6232 && rtx_equal_p (cc_prev_status.value2, operands[0])))
6234 cc_status = cc_prev_status;
6237 if (GET_CODE (operands[0]) == REG)
6238 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
6240 operands[3] = adjust_address (operands[0], SImode, 4);
6241 if (! ADDRESS_REG_P (operands[0]))
6243 if (reg_overlap_mentioned_p (operands[2], operands[0]))
6245 if (reg_overlap_mentioned_p (operands[2], operands[3]))
6246 return "or%.l %0,%2\;jeq %l1";
6248 return "or%.l %3,%2\;jeq %l1";
6250 return "move%.l %0,%2\;or%.l %3,%2\;jeq %l1";
6252 operands[4] = gen_label_rtx();
6253 if (TARGET_68020 || TARGET_COLDFIRE)
6254 output_asm_insn ("tst%.l %0\;jne %l4\;tst%.l %3\;jeq %l1", operands);
6256 output_asm_insn ("cmp%.w #0,%0\;jne %l4\;cmp%.w #0,%3\;jeq %l1", operands);
6257 (*targetm.asm_out.internal_label) (asm_out_file, "L",
6258 CODE_LABEL_NUMBER (operands[4]));
6262 (define_insn "bne0_di"
6264 (if_then_else (ne (match_operand:DI 0 "general_operand" "do,*a")
6266 (label_ref (match_operand 1 "" ","))
6268 (clobber (match_scratch:SI 2 "=d,X"))]
6271 if ((cc_prev_status.value1
6272 && rtx_equal_p (cc_prev_status.value1, operands[0]))
6273 || (cc_prev_status.value2
6274 && rtx_equal_p (cc_prev_status.value2, operands[0])))
6276 cc_status = cc_prev_status;
6280 if (GET_CODE (operands[0]) == REG)
6281 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
6283 operands[3] = adjust_address (operands[0], SImode, 4);
6284 if (!ADDRESS_REG_P (operands[0]))
6286 if (reg_overlap_mentioned_p (operands[2], operands[0]))
6288 if (reg_overlap_mentioned_p (operands[2], operands[3]))
6289 return "or%.l %0,%2\;jne %l1";
6291 return "or%.l %3,%2\;jne %l1";
6293 return "move%.l %0,%2\;or%.l %3,%2\;jne %l1";
6295 if (TARGET_68020 || TARGET_COLDFIRE)
6296 return "tst%.l %0\;jne %l1\;tst%.l %3\;jne %l1";
6298 return "cmp%.w #0,%0\;jne %l1\;cmp%.w #0,%3\;jne %l1";
6301 (define_insn "bge0_di"
6303 (if_then_else (ge (match_operand:DI 0 "general_operand" "ro")
6305 (label_ref (match_operand 1 "" ""))
6309 if ((cc_prev_status.value1
6310 && rtx_equal_p (cc_prev_status.value1, operands[0]))
6311 || (cc_prev_status.value2
6312 && rtx_equal_p (cc_prev_status.value2, operands[0])))
6314 cc_status = cc_prev_status;
6315 return cc_status.flags & CC_REVERSED ? "jle %l1" : "jpl %l1";
6318 if (TARGET_68020 || TARGET_COLDFIRE || ! ADDRESS_REG_P (operands[0]))
6319 output_asm_insn("tst%.l %0", operands);
6322 /* On an address reg, cmpw may replace cmpl. */
6323 output_asm_insn("cmp%.w #0,%0", operands);
6328 (define_insn "blt0_di"
6330 (if_then_else (lt (match_operand:DI 0 "general_operand" "ro")
6332 (label_ref (match_operand 1 "" ""))
6336 if ((cc_prev_status.value1
6337 && rtx_equal_p (cc_prev_status.value1, operands[0]))
6338 || (cc_prev_status.value2
6339 && rtx_equal_p (cc_prev_status.value2, operands[0])))
6341 cc_status = cc_prev_status;
6342 return cc_status.flags & CC_REVERSED ? "jgt %l1" : "jmi %l1";
6345 if (TARGET_68020 || TARGET_COLDFIRE || ! ADDRESS_REG_P (operands[0]))
6346 output_asm_insn("tst%.l %0", operands);
6349 /* On an address reg, cmpw may replace cmpl. */
6350 output_asm_insn("cmp%.w #0,%0", operands);
6357 (if_then_else (eq (cc0)
6359 (label_ref (match_operand 0 "" ""))
6363 OUTPUT_JUMP ("jeq %l0", "fjeq %l0", "jeq %l0");
6365 [(set (attr "type") (symbol_ref "m68k_sched_branch_type (insn)"))])
6369 (if_then_else (ne (cc0)
6371 (label_ref (match_operand 0 "" ""))
6375 OUTPUT_JUMP ("jne %l0", "fjne %l0", "jne %l0");
6377 [(set (attr "type") (symbol_ref "m68k_sched_branch_type (insn)"))])
6381 (if_then_else (gt (cc0)
6383 (label_ref (match_operand 0 "" ""))
6387 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6389 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6393 OUTPUT_JUMP ("jgt %l0", "fjgt %l0", 0);
6395 [(set (attr "type") (symbol_ref "m68k_sched_branch_type (insn)"))])
6399 (if_then_else (gtu (cc0)
6401 (label_ref (match_operand 0 "" ""))
6405 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6407 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6413 [(set_attr "type" "bcc")])
6417 (if_then_else (lt (cc0)
6419 (label_ref (match_operand 0 "" ""))
6423 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6425 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6429 OUTPUT_JUMP ("jlt %l0", "fjlt %l0", "jmi %l0");
6431 [(set (attr "type") (symbol_ref "m68k_sched_branch_type (insn)"))])
6435 (if_then_else (ltu (cc0)
6437 (label_ref (match_operand 0 "" ""))
6441 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6443 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6449 [(set_attr "type" "bcc")])
6453 (if_then_else (ge (cc0)
6455 (label_ref (match_operand 0 "" ""))
6459 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6461 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6465 OUTPUT_JUMP ("jge %l0", "fjge %l0", "jpl %l0");
6470 (if_then_else (geu (cc0)
6472 (label_ref (match_operand 0 "" ""))
6476 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6478 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6484 [(set_attr "type" "bcc")])
6488 (if_then_else (le (cc0)
6490 (label_ref (match_operand 0 "" ""))
6494 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6496 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6500 OUTPUT_JUMP ("jle %l0", "fjle %l0", 0);
6502 [(set_attr "type" "bcc")])
6506 (if_then_else (leu (cc0)
6508 (label_ref (match_operand 0 "" ""))
6512 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6514 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6520 [(set_attr "type" "bcc")])
6522 (define_insn "bordered"
6524 (if_then_else (ordered (cc0) (const_int 0))
6525 (label_ref (match_operand 0 "" ""))
6529 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6532 [(set_attr "type" "fbcc")])
6534 (define_insn "bunordered"
6536 (if_then_else (unordered (cc0) (const_int 0))
6537 (label_ref (match_operand 0 "" ""))
6541 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6544 [(set_attr "type" "fbcc")])
6546 (define_insn "buneq"
6548 (if_then_else (uneq (cc0) (const_int 0))
6549 (label_ref (match_operand 0 "" ""))
6553 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6556 [(set_attr "type" "fbcc")])
6558 (define_insn "bunge"
6560 (if_then_else (unge (cc0) (const_int 0))
6561 (label_ref (match_operand 0 "" ""))
6565 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6568 [(set_attr "type" "fbcc")])
6570 (define_insn "bungt"
6572 (if_then_else (ungt (cc0) (const_int 0))
6573 (label_ref (match_operand 0 "" ""))
6577 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6580 [(set_attr "type" "fbcc")])
6582 (define_insn "bunle"
6584 (if_then_else (unle (cc0) (const_int 0))
6585 (label_ref (match_operand 0 "" ""))
6589 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6592 [(set_attr "type" "fbcc")])
6594 (define_insn "bunlt"
6596 (if_then_else (unlt (cc0) (const_int 0))
6597 (label_ref (match_operand 0 "" ""))
6601 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6604 [(set_attr "type" "fbcc")])
6606 (define_insn "bltgt"
6608 (if_then_else (ltgt (cc0) (const_int 0))
6609 (label_ref (match_operand 0 "" ""))
6613 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6616 [(set_attr "type" "fbcc")])
6618 ;; Negated conditional jump instructions.
6620 (define_insn "*beq_rev"
6622 (if_then_else (eq (cc0)
6625 (label_ref (match_operand 0 "" ""))))]
6628 OUTPUT_JUMP ("jne %l0", "fjne %l0", "jne %l0");
6630 [(set_attr "type" "bcc")])
6632 (define_insn "*bne_rev"
6634 (if_then_else (ne (cc0)
6637 (label_ref (match_operand 0 "" ""))))]
6640 OUTPUT_JUMP ("jeq %l0", "fjeq %l0", "jeq %l0");
6642 [(set_attr "type" "bcc")])
6644 (define_insn "*bgt_rev"
6646 (if_then_else (gt (cc0)
6649 (label_ref (match_operand 0 "" ""))))]
6652 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6654 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6658 OUTPUT_JUMP ("jle %l0", "fjngt %l0", 0);
6660 [(set_attr "type" "bcc")])
6662 (define_insn "*bgtu_rev"
6664 (if_then_else (gtu (cc0)
6667 (label_ref (match_operand 0 "" ""))))]
6670 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6672 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6678 [(set_attr "type" "bcc")])
6680 (define_insn "*blt_rev"
6682 (if_then_else (lt (cc0)
6685 (label_ref (match_operand 0 "" ""))))]
6688 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6690 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6694 OUTPUT_JUMP ("jge %l0", "fjnlt %l0", "jpl %l0");
6696 [(set_attr "type" "bcc")])
6698 (define_insn "*bltu_rev"
6700 (if_then_else (ltu (cc0)
6703 (label_ref (match_operand 0 "" ""))))]
6706 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6708 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6714 [(set_attr "type" "bcc")])
6716 (define_insn "*bge_rev"
6718 (if_then_else (ge (cc0)
6721 (label_ref (match_operand 0 "" ""))))]
6724 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6726 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6730 OUTPUT_JUMP ("jlt %l0", "fjnge %l0", "jmi %l0");
6732 [(set_attr "type" "bcc")])
6734 (define_insn "*bgeu_rev"
6736 (if_then_else (geu (cc0)
6739 (label_ref (match_operand 0 "" ""))))]
6742 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6744 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6750 [(set_attr "type" "bcc")])
6752 (define_insn "*ble_rev"
6754 (if_then_else (le (cc0)
6757 (label_ref (match_operand 0 "" ""))))]
6760 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6762 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6766 OUTPUT_JUMP ("jgt %l0", "fjnle %l0", 0);
6768 [(set_attr "type" "bcc")])
6770 (define_insn "*bleu_rev"
6772 (if_then_else (leu (cc0)
6775 (label_ref (match_operand 0 "" ""))))]
6778 if ((cc_status.flags & CC_OVERFLOW_UNUSABLE) != 0)
6780 cc_status.flags &= ~CC_OVERFLOW_UNUSABLE;
6786 [(set_attr "type" "bcc")])
6788 (define_insn "*bordered_rev"
6790 (if_then_else (ordered (cc0) (const_int 0))
6792 (label_ref (match_operand 0 "" ""))))]
6795 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6798 [(set_attr "type" "fbcc")])
6800 (define_insn "*bunordered_rev"
6802 (if_then_else (unordered (cc0) (const_int 0))
6804 (label_ref (match_operand 0 "" ""))))]
6807 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6810 [(set_attr "type" "fbcc")])
6812 (define_insn "*buneq_rev"
6814 (if_then_else (uneq (cc0) (const_int 0))
6816 (label_ref (match_operand 0 "" ""))))]
6819 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6822 [(set_attr "type" "fbcc")])
6824 (define_insn "*bunge_rev"
6826 (if_then_else (unge (cc0) (const_int 0))
6828 (label_ref (match_operand 0 "" ""))))]
6831 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6834 [(set_attr "type" "fbcc")])
6836 (define_insn "*bungt_rev"
6838 (if_then_else (ungt (cc0) (const_int 0))
6840 (label_ref (match_operand 0 "" ""))))]
6843 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6846 [(set_attr "type" "fbcc")])
6848 (define_insn "*bunle_rev"
6850 (if_then_else (unle (cc0) (const_int 0))
6852 (label_ref (match_operand 0 "" ""))))]
6855 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6858 [(set_attr "type" "fbcc")])
6860 (define_insn "*bunlt_rev"
6862 (if_then_else (unlt (cc0) (const_int 0))
6864 (label_ref (match_operand 0 "" ""))))]
6867 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6870 [(set_attr "type" "fbcc")])
6872 (define_insn "*bltgt_rev"
6874 (if_then_else (ltgt (cc0) (const_int 0))
6876 (label_ref (match_operand 0 "" ""))))]
6879 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6882 [(set_attr "type" "fbcc")])
6884 ;; Unconditional and other jump instructions
6887 (label_ref (match_operand 0 "" "")))]
6890 [(set_attr "type" "bra")])
6892 (define_expand "tablejump"
6893 [(parallel [(set (pc) (match_operand 0 "" ""))
6894 (use (label_ref (match_operand 1 "" "")))])]
6897 #ifdef CASE_VECTOR_PC_RELATIVE
6898 operands[0] = gen_rtx_PLUS (SImode, pc_rtx,
6899 gen_rtx_SIGN_EXTEND (SImode, operands[0]));
6903 ;; Jump to variable address from dispatch table of absolute addresses.
6904 (define_insn "*tablejump_internal"
6905 [(set (pc) (match_operand:SI 0 "register_operand" "a"))
6906 (use (label_ref (match_operand 1 "" "")))]
6909 return MOTOROLA ? "jmp (%0)" : "jmp %0@";
6911 [(set_attr "type" "jmp")])
6913 ;; Jump to variable address from dispatch table of relative addresses.
6917 (sign_extend:SI (match_operand:HI 0 "register_operand" "r"))))
6918 (use (label_ref (match_operand 1 "" "")))]
6921 #ifdef ASM_RETURN_CASE_JUMP
6922 ASM_RETURN_CASE_JUMP;
6924 if (TARGET_COLDFIRE)
6926 if (ADDRESS_REG_P (operands[0]))
6927 return MOTOROLA ? "jmp (2,pc,%0.l)" : "jmp pc@(2,%0:l)";
6929 return "ext%.l %0\;jmp (2,pc,%0.l)";
6931 return "extl %0\;jmp pc@(2,%0:l)";
6934 return MOTOROLA ? "jmp (2,pc,%0.w)" : "jmp pc@(2,%0:w)";
6938 ;; Decrement-and-branch insns.
6939 (define_insn "*dbne_hi"
6942 (ne (match_operand:HI 0 "nonimmediate_operand" "+d*g")
6944 (label_ref (match_operand 1 "" ""))
6947 (plus:HI (match_dup 0)
6952 if (DATA_REG_P (operands[0]))
6953 return "dbra %0,%l1";
6954 if (GET_CODE (operands[0]) == MEM)
6955 return "subq%.w #1,%0\;jcc %l1";
6956 return "subq%.w #1,%0\;cmp%.w #-1,%0\;jne %l1";
6959 (define_insn "*dbne_si"
6962 (ne (match_operand:SI 0 "nonimmediate_operand" "+d*g")
6964 (label_ref (match_operand 1 "" ""))
6967 (plus:SI (match_dup 0)
6972 if (DATA_REG_P (operands[0]))
6973 return "dbra %0,%l1\;clr%.w %0\;subq%.l #1,%0\;jcc %l1";
6974 if (GET_CODE (operands[0]) == MEM)
6975 return "subq%.l #1,%0\;jcc %l1";
6976 return "subq%.l #1,%0\;cmp%.l #-1,%0\;jne %l1";
6979 ;; Two dbra patterns that use REG_NOTES info generated by strength_reduce.
6981 (define_insn "*dbge_hi"
6984 (ge (plus:HI (match_operand:HI 0 "nonimmediate_operand" "+d*am")
6987 (label_ref (match_operand 1 "" ""))
6990 (plus:HI (match_dup 0)
6992 "!TARGET_COLDFIRE && find_reg_note (insn, REG_NONNEG, 0)"
6995 if (DATA_REG_P (operands[0]))
6996 return "dbra %0,%l1";
6997 if (GET_CODE (operands[0]) == MEM)
6998 return "subq%.w #1,%0\;jcc %l1";
6999 return "subq%.w #1,%0\;cmp%.w #-1,%0\;jne %l1";
7002 (define_expand "decrement_and_branch_until_zero"
7003 [(parallel [(set (pc)
7005 (ge (plus:SI (match_operand:SI 0 "nonimmediate_operand" "")
7008 (label_ref (match_operand 1 "" ""))
7011 (plus:SI (match_dup 0)
7016 (define_insn "*dbge_si"
7019 (ge (plus:SI (match_operand:SI 0 "nonimmediate_operand" "+d*am")
7022 (label_ref (match_operand 1 "" ""))
7025 (plus:SI (match_dup 0)
7027 "!TARGET_COLDFIRE && find_reg_note (insn, REG_NONNEG, 0)"
7030 if (DATA_REG_P (operands[0]))
7031 return "dbra %0,%l1\;clr%.w %0\;subq%.l #1,%0\;jcc %l1";
7032 if (GET_CODE (operands[0]) == MEM)
7033 return "subq%.l #1,%0\;jcc %l1";
7034 return "subq%.l #1,%0\;cmp%.l #-1,%0\;jne %l1";
7037 (define_expand "sibcall"
7038 [(call (match_operand:QI 0 "memory_operand" "")
7039 (match_operand:SI 1 "general_operand" ""))]
7042 operands[0] = m68k_legitimize_sibcall_address (operands[0]);
7045 (define_insn "*sibcall"
7046 [(call (mem:QI (match_operand:SI 0 "sibcall_operand" ""))
7047 (match_operand:SI 1 "general_operand" ""))]
7048 "SIBLING_CALL_P (insn)"
7050 return output_sibcall (operands[0]);
7053 (define_expand "sibcall_value"
7054 [(set (match_operand 0 "" "")
7055 (call (match_operand:QI 1 "memory_operand" "")
7056 (match_operand:SI 2 "general_operand" "")))]
7059 operands[1] = m68k_legitimize_sibcall_address (operands[1]);
7062 (define_insn "*sibcall_value"
7063 [(set (match_operand 0 "" "=rf,rf")
7064 (call (mem:QI (match_operand:SI 1 "sibcall_operand" ""))
7065 (match_operand:SI 2 "general_operand" "")))]
7066 "SIBLING_CALL_P (insn)"
7068 operands[0] = operands[1];
7069 return output_sibcall (operands[0]);
7072 ;; Call subroutine with no return value.
7073 (define_expand "call"
7074 [(call (match_operand:QI 0 "memory_operand" "")
7075 (match_operand:SI 1 "general_operand" ""))]
7076 ;; Operand 1 not really used on the m68000.
7079 operands[0] = m68k_legitimize_call_address (operands[0]);
7082 (define_insn "*call"
7083 [(call (mem:QI (match_operand:SI 0 "call_operand" "a,W"))
7084 (match_operand:SI 1 "general_operand" "g,g"))]
7085 ;; Operand 1 not really used on the m68000.
7086 "!SIBLING_CALL_P (insn)"
7088 return output_call (operands[0]);
7090 [(set_attr "type" "jsr")])
7092 ;; Call subroutine, returning value in operand 0
7093 ;; (which must be a hard register).
7094 (define_expand "call_value"
7095 [(set (match_operand 0 "" "")
7096 (call (match_operand:QI 1 "memory_operand" "")
7097 (match_operand:SI 2 "general_operand" "")))]
7098 ;; Operand 2 not really used on the m68000.
7101 operands[1] = m68k_legitimize_call_address (operands[1]);
7104 (define_insn "*non_symbolic_call_value"
7105 [(set (match_operand 0 "" "=rf,rf")
7106 (call (mem:QI (match_operand:SI 1 "non_symbolic_call_operand" "a,W"))
7107 (match_operand:SI 2 "general_operand" "g,g")))]
7108 ;; Operand 2 not really used on the m68000.
7109 "!SIBLING_CALL_P (insn)"
7111 [(set_attr "type" "jsr")
7112 (set_attr "opx" "1")])
7114 (define_insn "*symbolic_call_value_jsr"
7115 [(set (match_operand 0 "" "=rf,rf")
7116 (call (mem:QI (match_operand:SI 1 "symbolic_operand" "a,W"))
7117 (match_operand:SI 2 "general_operand" "g,g")))]
7118 ;; Operand 2 not really used on the m68000.
7119 "!SIBLING_CALL_P (insn) && m68k_symbolic_call_var == M68K_SYMBOLIC_CALL_JSR"
7121 operands[0] = operands[1];
7122 return m68k_symbolic_call;
7124 [(set_attr "type" "jsr")
7125 (set_attr "opx" "1")])
7127 (define_insn "*symbolic_call_value_bsr"
7128 [(set (match_operand 0 "" "=rf,rf")
7129 (call (mem:QI (match_operand:SI 1 "symbolic_operand" "a,W"))
7130 (match_operand:SI 2 "general_operand" "g,g")))]
7131 ;; Operand 2 not really used on the m68000.
7132 "!SIBLING_CALL_P (insn)
7133 && (m68k_symbolic_call_var == M68K_SYMBOLIC_CALL_BSR_C
7134 || m68k_symbolic_call_var == M68K_SYMBOLIC_CALL_BSR_P)"
7136 operands[0] = operands[1];
7137 return m68k_symbolic_call;
7139 [(set_attr "type" "bsr")
7140 (set_attr "opx" "1")])
7142 ;; Call subroutine returning any type.
7144 (define_expand "untyped_call"
7145 [(parallel [(call (match_operand 0 "" "")
7147 (match_operand 1 "" "")
7148 (match_operand 2 "" "")])]
7149 "NEEDS_UNTYPED_CALL"
7153 emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
7155 for (i = 0; i < XVECLEN (operands[2], 0); i++)
7157 rtx set = XVECEXP (operands[2], 0, i);
7158 emit_move_insn (SET_DEST (set), SET_SRC (set));
7161 /* The optimizer does not know that the call sets the function value
7162 registers we stored in the result block. We avoid problems by
7163 claiming that all hard registers are used and clobbered at this
7165 emit_insn (gen_blockage ());
7170 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
7171 ;; all of memory. This blocks insns from being moved across this point.
7173 (define_insn "blockage"
7174 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
7182 [(set_attr "type" "nop")])
7184 (define_expand "prologue"
7188 m68k_expand_prologue ();
7192 (define_expand "epilogue"
7196 m68k_expand_epilogue (false);
7200 (define_expand "sibcall_epilogue"
7204 m68k_expand_epilogue (true);
7208 ;; Used for frameless functions which save no regs and allocate no locals.
7209 (define_expand "return"
7211 "m68k_use_return_insn ()"
7214 (define_insn "*return"
7218 switch (m68k_get_function_kind (current_function_decl))
7220 case m68k_fk_interrupt_handler:
7223 case m68k_fk_interrupt_thread:
7227 if (crtl->args.pops_args)
7229 operands[0] = GEN_INT (crtl->args.pops_args);
7236 [(set_attr "type" "rts")])
7238 (define_insn "*m68k_store_multiple"
7239 [(match_parallel 0 "" [(match_operand 1 "")])]
7240 "m68k_movem_pattern_p (operands[0], NULL, 0, true)"
7242 return m68k_output_movem (operands, operands[0], 0, true);
7245 (define_insn "*m68k_store_multiple_automod"
7246 [(match_parallel 0 ""
7247 [(set (match_operand:SI 1 "register_operand" "=a")
7248 (plus:SI (match_operand:SI 2 "register_operand" "1")
7249 (match_operand:SI 3 "const_int_operand")))])]
7250 "m68k_movem_pattern_p (operands[0], operands[1], INTVAL (operands[3]), true)"
7252 return m68k_output_movem (operands, operands[0], INTVAL (operands[3]), true);
7255 (define_insn "*m68k_load_multiple"
7256 [(match_parallel 0 "" [(match_operand 1 "")])]
7257 "m68k_movem_pattern_p (operands[0], NULL, 0, false)"
7259 return m68k_output_movem (operands, operands[0], 0, false);
7262 (define_insn "*m68k_load_multiple_automod"
7263 [(match_parallel 0 ""
7264 [(set (match_operand:SI 1 "register_operand" "=a")
7265 (plus:SI (match_operand:SI 2 "register_operand" "1")
7266 (match_operand:SI 3 "const_int_operand")))])]
7267 "m68k_movem_pattern_p (operands[0], operands[1],
7268 INTVAL (operands[3]), false)"
7270 return m68k_output_movem (operands, operands[0],
7271 INTVAL (operands[3]), false);
7274 (define_expand "link"
7276 [(set (match_operand:SI 0 "register_operand")
7277 (plus:SI (reg:SI SP_REG) (const_int -4)))
7280 (set (reg:SI SP_REG)
7281 (plus:SI (reg:SI SP_REG)
7282 (match_operand:SI 1 "const_int_operand")))])]
7283 "TARGET_68020 || INTVAL (operands[1]) >= -0x8004"
7285 operands[2] = gen_frame_mem (SImode, plus_constant (stack_pointer_rtx, -4));
7288 (define_insn "*link"
7289 [(set (match_operand:SI 0 "register_operand" "+r")
7290 (plus:SI (reg:SI SP_REG) (const_int -4)))
7291 (set (mem:SI (plus:SI (reg:SI SP_REG) (const_int -4)))
7293 (set (reg:SI SP_REG)
7294 (plus:SI (reg:SI SP_REG)
7295 (match_operand:SI 1 "const_int_operand")))]
7296 "TARGET_68020 || INTVAL (operands[1]) >= -0x8004"
7298 operands[1] = GEN_INT (INTVAL (operands[1]) + 4);
7300 return "link %0,%1";
7301 else if (INTVAL (operands[1]) >= -0x8000)
7302 return "link.w %0,%1";
7304 return "link.l %0,%1";
7306 [(set_attr "type" "link")])
7308 (define_expand "unlink"
7310 [(set (match_operand:SI 0 "register_operand")
7312 (set (reg:SI SP_REG)
7313 (plus:SI (match_dup 0)
7317 operands[1] = gen_frame_mem (SImode, copy_rtx (operands[0]));
7320 (define_insn "*unlink"
7321 [(set (match_operand:SI 0 "register_operand" "+r")
7322 (mem:SI (match_dup 0)))
7323 (set (reg:SI SP_REG)
7324 (plus:SI (match_dup 0)
7328 [(set_attr "type" "unlk")])
7330 (define_insn "load_got"
7331 [(set (match_operand:SI 0 "register_operand" "=a")
7332 (unspec:SI [(const_int 0)] UNSPEC_GOT))]
7335 if (TARGET_ID_SHARED_LIBRARY)
7337 operands[1] = gen_rtx_REG (Pmode, PIC_REG);
7338 return MOTOROLA ? "move.l %?(%1),%0" : "movel %1@(%?), %0";
7342 if (TARGET_COLDFIRE)
7343 /* Load the full 32-bit PC-relative offset of
7344 _GLOBAL_OFFSET_TABLE_ into the PIC register, then use it to
7345 calculate the absolute value. The offset and "lea"
7346 operation word together occupy 6 bytes. */
7347 return ("move.l #_GLOBAL_OFFSET_TABLE_@GOTPC, %0\n\t"
7348 "lea (-6, %%pc, %0), %0");
7350 return "lea (%%pc, _GLOBAL_OFFSET_TABLE_@GOTPC), %0";
7353 return ("movel #_GLOBAL_OFFSET_TABLE_, %0\n\t"
7354 "lea %%pc@(0,%0:l),%0");
7357 (define_insn "indirect_jump"
7358 [(set (pc) (match_operand:SI 0 "address_operand" "p"))]
7361 [(set_attr "type" "jmp")])
7363 ;; This should not be used unless the add/sub insns can't be.
7366 [(set (match_operand:SI 0 "nonimmediate_operand" "=a")
7367 (match_operand:QI 1 "address_operand" "p"))]
7371 ;; This is the first machine-dependent peephole optimization.
7372 ;; It is useful when a floating value is returned from a function call
7373 ;; and then is moved into an FP register.
7374 ;; But it is mainly intended to test the support for these optimizations.
7377 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))
7378 (set (match_operand:DF 0 "register_operand" "")
7379 (match_operand:DF 1 "register_operand" ""))]
7380 "FP_REG_P (operands[0]) && !FP_REG_P (operands[1])"
7381 [(set (mem:SI (reg:SI SP_REG)) (match_dup 1))
7382 (set (mem:SI (pre_dec:SI (reg:SI SP_REG))) (match_dup 2))
7383 (set (match_dup 0) (mem:DF (post_inc:SI (reg:SI SP_REG))))]
7384 "split_di(operands + 1, 1, operands + 1, operands + 2);")
7386 ;; Optimize a stack-adjust followed by a push of an argument.
7387 ;; This is said to happen frequently with -msoft-float
7388 ;; when there are consecutive library calls.
7391 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))
7392 (set (match_operand:SF 0 "push_operand" "")
7393 (match_operand:SF 1 "general_operand" ""))]
7394 "!reg_mentioned_p (stack_pointer_rtx, operands[0])"
7395 [(set (match_dup 0) (match_dup 1))]
7396 "operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx);")
7399 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
7400 (match_operand:SI 0 "const_int_operand" "")))
7401 (set (match_operand:SF 1 "push_operand" "")
7402 (match_operand:SF 2 "general_operand" ""))]
7403 "INTVAL (operands[0]) > 4
7404 && !reg_mentioned_p (stack_pointer_rtx, operands[2])"
7405 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (match_dup 0)))
7406 (set (match_dup 1) (match_dup 2))]
7408 operands[0] = GEN_INT (INTVAL (operands[0]) - 4);
7409 operands[1] = replace_equiv_address (operands[1], stack_pointer_rtx);
7412 ;; Speed up stack adjust followed by a fullword fixedpoint push.
7413 ;; Constant operands need special care, as replacing a "pea X.w" with
7414 ;; "move.l #X,(%sp)" is often not a win.
7416 ;; Already done by the previous csa pass, left as reference.
7418 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))
7419 (set (match_operand:SI 0 "push_operand" "")
7420 (match_operand:SI 1 "general_operand" ""))]
7421 "!reg_mentioned_p (stack_pointer_rtx, operands[1])"
7422 [(set (match_dup 0) (match_dup 1))]
7423 "operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx);")
7425 ;; Try to use moveq, after stack push has been changed into a simple move.
7427 [(match_scratch:SI 2 "d")
7428 (set (match_operand:SI 0 "memory_operand" "")
7429 (match_operand:SI 1 "const_int_operand" ""))]
7430 "GET_CODE (XEXP (operands[0], 0)) != PRE_DEC
7431 && INTVAL (operands[1]) != 0
7432 && IN_RANGE (INTVAL (operands[1]), -0x80, 0x7f)
7433 && !valid_mov3q_const (INTVAL (operands[1]))"
7434 [(set (match_dup 2) (match_dup 1))
7435 (set (match_dup 0) (match_dup 2))])
7437 ;; This sequence adds an instruction, but is two bytes shorter.
7439 [(match_scratch:SI 2 "d")
7440 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 12)))
7441 (set (match_operand:SI 0 "push_operand" "")
7442 (match_operand:SI 1 "const_int_operand" ""))]
7443 "INTVAL (operands[1]) != 0
7444 && IN_RANGE (INTVAL (operands[1]), -0x80, 0x7f)
7445 && !valid_mov3q_const (INTVAL (operands[1]))"
7446 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 8)))
7447 (set (match_dup 2) (match_dup 1))
7448 (set (match_dup 0) (match_dup 2))]
7449 "operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx);")
7451 ;; Changing pea X.w into a move.l is no real win here.
7453 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
7454 (match_operand:SI 0 "const_int_operand" "")))
7455 (set (match_operand:SI 1 "push_operand" "")
7456 (match_operand:SI 2 "general_operand" ""))]
7457 "INTVAL (operands[0]) > 4
7458 && !reg_mentioned_p (stack_pointer_rtx, operands[2])
7459 && !(CONST_INT_P (operands[2]) && INTVAL (operands[2]) != 0
7460 && IN_RANGE (INTVAL (operands[2]), -0x8000, 0x7fff)
7461 && !valid_mov3q_const (INTVAL (operands[2])))"
7462 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (match_dup 0)))
7463 (set (match_dup 1) (match_dup 2))]
7465 operands[0] = GEN_INT (INTVAL (operands[0]) - 4);
7466 operands[1] = replace_equiv_address (operands[1], stack_pointer_rtx);
7469 ;; Speed up pushing a single byte/two bytes but leaving four bytes of space
7470 ;; (which differs slightly between m680x0 and ColdFire).
7473 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -4)))
7474 (set (match_operand:QI 0 "memory_operand" "")
7475 (match_operand:QI 1 "register_operand" ""))]
7476 "!reg_mentioned_p (stack_pointer_rtx, operands[1])
7477 && GET_CODE (XEXP (operands[0], 0)) == PLUS
7478 && rtx_equal_p (XEXP (XEXP (operands[0], 0), 0), stack_pointer_rtx)
7479 && CONST_INT_P (XEXP (XEXP (operands[0], 0), 1))
7480 && INTVAL (XEXP (XEXP (operands[0], 0), 1)) == 3"
7481 [(set (match_dup 0) (match_dup 1))]
7483 rtx addr = gen_rtx_PRE_DEC (Pmode, stack_pointer_rtx);
7484 operands[0] = adjust_automodify_address (operands[0], SImode, addr, -3);
7485 operands[1] = simplify_gen_subreg (SImode, operands[1], QImode, 0);
7489 [(set (match_operand:QI 0 "push_operand" "")
7490 (match_operand:QI 1 "register_operand" ""))
7491 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -3)))]
7492 "!reg_mentioned_p (stack_pointer_rtx, operands[1])"
7493 [(set (match_dup 0) (match_dup 1))]
7495 operands[0] = adjust_automodify_address (operands[0], SImode,
7496 XEXP (operands[0], 0), -3);
7497 operands[1] = simplify_gen_subreg (SImode, operands[1], QImode, 0);
7501 [(set (match_operand:HI 0 "push_operand" "")
7502 (match_operand:HI 1 "register_operand" ""))
7503 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -2)))]
7504 "!reg_mentioned_p (stack_pointer_rtx, operands[1])"
7505 [(set (match_dup 0) (match_dup 1))]
7507 operands[0] = adjust_automodify_address (operands[0], SImode,
7508 XEXP (operands[0], 0), -2);
7509 operands[1] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
7512 ;; Optimize a series of strict_low_part assignments
7515 [(set (match_operand:SI 0 "register_operand" "")
7517 (set (strict_low_part (match_operand:HI 1 "register_operand" ""))
7518 (match_operand:HI 2 "general_operand" ""))]
7519 "REGNO (operands[0]) == REGNO (operands[1])
7520 && strict_low_part_peephole_ok (HImode, insn, operands[0])"
7521 [(set (strict_low_part (match_dup 1)) (match_dup 2))]
7525 [(set (match_operand:SI 0 "register_operand" "")
7527 (set (strict_low_part (match_operand:QI 1 "register_operand" ""))
7528 (match_operand:QI 2 "general_operand" ""))]
7529 "REGNO (operands[0]) == REGNO (operands[1])
7530 && strict_low_part_peephole_ok (QImode, insn, operands[0])"
7531 [(set (strict_low_part (match_dup 1)) (match_dup 2))]
7539 ;; jCC label ; abnormal loop termination
7540 ;; dbra dN, loop ; normal loop termination
7548 ;; Which moves the jCC condition outside the inner loop for free.
7552 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
7553 [(cc0) (const_int 0)])
7554 (label_ref (match_operand 2 "" ""))
7559 (ne (match_operand:HI 0 "register_operand" "")
7561 (label_ref (match_operand 1 "" ""))
7564 (plus:HI (match_dup 0)
7566 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
7569 output_dbcc_and_branch (operands);
7574 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
7575 [(cc0) (const_int 0)])
7576 (label_ref (match_operand 2 "" ""))
7581 (ne (match_operand:SI 0 "register_operand" "")
7583 (label_ref (match_operand 1 "" ""))
7586 (plus:SI (match_dup 0)
7588 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
7591 output_dbcc_and_branch (operands);
7596 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
7597 [(cc0) (const_int 0)])
7598 (label_ref (match_operand 2 "" ""))
7603 (ge (plus:HI (match_operand:HI 0 "register_operand" "")
7606 (label_ref (match_operand 1 "" ""))
7609 (plus:HI (match_dup 0)
7611 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
7614 output_dbcc_and_branch (operands);
7619 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
7620 [(cc0) (const_int 0)])
7621 (label_ref (match_operand 2 "" ""))
7626 (ge (plus:SI (match_operand:SI 0 "register_operand" "")
7629 (label_ref (match_operand 1 "" ""))
7632 (plus:SI (match_dup 0)
7634 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
7637 output_dbcc_and_branch (operands);
7642 (define_insn "extendsfxf2"
7643 [(set (match_operand:XF 0 "nonimmediate_operand" "=fm,f")
7644 (float_extend:XF (match_operand:SF 1 "general_operand" "f,rmF")))]
7647 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
7649 if (REGNO (operands[0]) == REGNO (operands[1]))
7651 /* Extending float to double in an fp-reg is a no-op.
7652 NOTICE_UPDATE_CC has already assumed that the
7653 cc will be set. So cancel what it did. */
7654 cc_status = cc_prev_status;
7657 return "f%$move%.x %1,%0";
7659 if (FP_REG_P (operands[0]))
7661 if (FP_REG_P (operands[1]))
7662 return "f%$move%.x %1,%0";
7663 else if (ADDRESS_REG_P (operands[1]))
7664 return "move%.l %1,%-\;f%$move%.s %+,%0";
7665 else if (GET_CODE (operands[1]) == CONST_DOUBLE)
7666 return output_move_const_single (operands);
7667 return "f%$move%.s %f1,%0";
7669 return "fmove%.x %f1,%0";
7673 (define_insn "extenddfxf2"
7674 [(set (match_operand:XF 0 "nonimmediate_operand" "=fm,f")
7676 (match_operand:DF 1 "general_operand" "f,rmE")))]
7679 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
7681 if (REGNO (operands[0]) == REGNO (operands[1]))
7683 /* Extending float to double in an fp-reg is a no-op.
7684 NOTICE_UPDATE_CC has already assumed that the
7685 cc will be set. So cancel what it did. */
7686 cc_status = cc_prev_status;
7689 return "fmove%.x %1,%0";
7691 if (FP_REG_P (operands[0]))
7693 if (REG_P (operands[1]))
7696 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
7697 output_asm_insn ("move%.l %1,%-", xoperands);
7698 output_asm_insn ("move%.l %1,%-", operands);
7699 return "f%&move%.d %+,%0";
7701 if (GET_CODE (operands[1]) == CONST_DOUBLE)
7702 return output_move_const_double (operands);
7703 return "f%&move%.d %f1,%0";
7705 return "fmove%.x %f1,%0";
7708 (define_insn "truncxfdf2"
7709 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,!r")
7711 (match_operand:XF 1 "general_operand" "f,f")))]
7714 if (REG_P (operands[0]))
7716 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
7717 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
7718 return "move%.l %+,%0";
7720 return "fmove%.d %f1,%0";
7723 (define_insn "truncxfsf2"
7724 [(set (match_operand:SF 0 "nonimmediate_operand" "=dm")
7726 (match_operand:XF 1 "general_operand" "f")))]
7730 (define_insn "sin<mode>2"
7731 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
7733 [(match_operand:FP 1 "general_operand" "f<FP:dreg>m")] UNSPEC_SIN))]
7734 "TARGET_68881 && flag_unsafe_math_optimizations"
7736 if (FP_REG_P (operands[1]))
7737 return "fsin%.x %1,%0";
7739 return "fsin%.<FP:prec> %1,%0";
7742 (define_insn "cos<mode>2"
7743 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
7745 [(match_operand:FP 1 "general_operand" "f<FP:dreg>m")] UNSPEC_COS))]
7746 "TARGET_68881 && flag_unsafe_math_optimizations"
7748 if (FP_REG_P (operands[1]))
7749 return "fcos%.x %1,%0";
7751 return "fcos%.<FP:prec> %1,%0";
7754 ;; Unconditional traps are assumed to have (const_int 1) for the condition.
7756 [(trap_if (const_int 1) (const_int 7))]
7759 [(set_attr "type" "trap")])
7761 (define_expand "conditional_trap"
7762 [(trap_if (match_operator 0 "valid_dbcc_comparison_p"
7763 [(cc0) (const_int 0)])
7764 (match_operand:SI 1 "const_int_operand" "I"))]
7767 if (m68k_last_compare_had_fp_operands)
7769 m68k_last_compare_had_fp_operands = 0;
7774 (define_insn "*conditional_trap"
7775 [(trap_if (match_operator 0 "valid_dbcc_comparison_p"
7776 [(cc0) (const_int 0)])
7777 (match_operand:SI 1 "const_int_operand" "I"))]
7778 "TARGET_68020 && ! flags_in_68881 ()"
7780 switch (GET_CODE (operands[0]))
7782 case EQ: return "trapeq";
7783 case NE: return "trapne";
7784 case GT: return "trapgt";
7785 case GTU: return "traphi";
7786 case LT: return "traplt";
7787 case LTU: return "trapcs";
7788 case GE: return "trapge";
7789 case GEU: return "trapcc";
7790 case LE: return "traple";
7791 case LEU: return "trapls";
7792 default: gcc_unreachable ();
7796 ;; These are to prevent the scheduler from moving stores to the frame
7797 ;; before the stack adjustment.
7798 (define_insn "stack_tie"
7799 [(set (mem:BLK (scratch))
7800 (unspec:BLK [(match_operand:SI 0 "register_operand" "r")
7801 (match_operand:SI 1 "register_operand" "r")]
7805 [(set_attr "type" "ignore")])
7807 ;; Instruction that subscribes one word in ColdFire instruction buffer.
7808 ;; This instruction is used within scheduler only and should not appear
7809 ;; in the instruction stream.
7811 [(unspec [(const_int 0)] UNSPEC_IB)]
7814 [(set_attr "type" "ib")])