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
120 ;; UNSPEC_VOLATILE usage:
123 [(UNSPECV_BLOCKAGE 0)
126 ;; Registers by name.
137 (include "predicates.md")
138 (include "constraints.md")
140 ;; ::::::::::::::::::::
144 ;; ::::::::::::::::::::
147 (define_attr "cpu" "cfv1, cfv2, cfv3, unknown"
148 (const (symbol_ref "m68k_sched_cpu")))
151 (define_attr "mac" "no, cf_mac, cf_emac"
152 (const (symbol_ref "m68k_sched_mac")))
155 ;; Basically, an asm pattern.
157 "add_l, addq_l, asr_l, bcc, bclr, bra, bset, bsr,
158 clr_b, clr_w, clr_l, cmp_l,
159 ext_w, extb_l, ext_l,
160 fadd, fcmp, fdiv, ff1, fintrz, fmove, fmul, fsqrt, fsub, ftst, jmp, jsr,
163 move_b, move_w, move_l, moveq_l, mov3q_l, mvs_b, mvs_w, mvz_b, mvz_w,
164 muls_w, muls_l, mulu_w, mulu_l,
168 trap, tst_b, tst_l, tst_w,
170 (const_string "unknown"))
172 ;; Instruction type for use in scheduling description.
173 ;; _l and _w suffixes indicate size of the operands of instruction.
174 ;; alu - usual arithmetic or logic instruction.
175 ;; alu_reg1 - arithmetic or logic instruction with one operand that is
177 ;; alu_regx - arithmetic or logic instruction which has a register for its
179 ;; aluq - arithmetic or logic instruction which has a quick immediate (the one
180 ;; that is encoded in the instruction word) for its Y operand.
181 ;; <all other values> - corresponding asm instructions.
183 "alu_l, alu_reg1, alu_regx, aluq_l, bcc, bra, bsr, clr, cmp_l, jmp, jsr, lea,
184 mov3q_l, move, move_l, moveq_l, mul_l, mul_w, pea, rts, tst, tst_l, unlk,
186 (cond [(eq_attr "type" "add_l,sub_l") (const_string "alu_l")
187 (eq_attr "type" "ext_w,extb_l,ext_l,neg_l,not_l")
188 (const_string "alu_reg1")
189 (eq_attr "type" "asr_l,lsr_l") (const_string "alu_regx")
190 (eq_attr "type" "addq_l,subq_l") (const_string "aluq_l")
191 (eq_attr "type" "bcc") (const_string "bcc")
192 (eq_attr "type" "bra") (const_string "bra")
193 (eq_attr "type" "bsr") (const_string "bsr")
194 (eq_attr "type" "clr_b,clr_l,clr_w") (const_string "clr")
195 (eq_attr "type" "cmp_l") (const_string "cmp_l")
196 (eq_attr "type" "jmp") (const_string "jmp")
197 (eq_attr "type" "jsr") (const_string "jsr")
198 (eq_attr "type" "lea") (const_string "lea")
199 (eq_attr "type" "mov3q_l") (const_string "mov3q_l")
200 (eq_attr "type" "move_b,move_w") (const_string "move")
201 (eq_attr "type" "move_l") (const_string "move_l")
202 (eq_attr "type" "moveq_l") (const_string "moveq_l")
203 (eq_attr "type" "muls_l,mulu_l") (const_string "mul_l")
204 (eq_attr "type" "muls_w,mulu_w") (const_string "mul_w")
205 (eq_attr "type" "pea") (const_string "pea")
206 (eq_attr "type" "rts") (const_string "rts")
207 (eq_attr "type" "tst_b,tst_w") (const_string "tst")
208 (eq_attr "type" "tst_l") (const_string "tst_l")
209 (eq_attr "type" "unlk") (const_string "unlk")]
210 (const_string "unknown")))
212 ;; Index of the X or Y operand in recog_data.operand[].
213 ;; Should be used only within opx_type and opy_type.
214 (define_attr "opx" "" (const_int 0))
215 (define_attr "opy" "" (const_int 1))
217 ;; Type of the X operand.
218 ;; See m68k.c: enum attr_op_type.
219 (define_attr "opx_type"
220 "none, reg, mem1, mem234, mem5, mem6, mem7, imm_q, imm_w, imm_l"
221 (cond [(eq_attr "type1" "rts,unlk") (const_string "none")
222 (eq_attr "type1" "alu_reg1,alu_regx,lea,moveq_l,mul_l,mul_w")
224 (eq_attr "type1" "pea") (const_string "mem1")
225 (eq_attr "type1" "bcc") (const_string "imm_q")
226 (eq_attr "type1" "bra,bsr") (const_string "imm_w")
227 (eq_attr "type1" "jmp,jsr")
228 (symbol_ref "m68k_sched_attr_opx_type (insn, 1)")]
229 (symbol_ref "m68k_sched_attr_opx_type (insn, 0)")))
231 ;; Type of the Y operand.
232 ;; See m68k.c: enum attr_op_type.
233 (define_attr "opy_type"
234 "none, reg, mem1, mem234, mem5, mem6, mem7, imm_q, imm_w, imm_l"
235 (cond [(eq_attr "type1" "alu_reg1,bcc,bra,bsr,clr,jmp,jsr,rts,tst,tst_l,
236 unlk") (const_string "none")
237 (eq_attr "type1" "mov3q_l,moveq_l,aluq_l") (const_string "imm_q")
238 (eq_attr "type1" "lea,pea")
239 (symbol_ref "m68k_sched_attr_opy_type (insn, 1)")]
240 (symbol_ref "m68k_sched_attr_opy_type (insn, 0)")))
242 ;; Instruction size in words.
243 (define_attr "size" ""
244 (cond [(eq_attr "type1" "alu_reg1,moveq_l,rts,unlk") (const_int 1)]
245 (symbol_ref "m68k_sched_attr_size (insn)")))
247 ;; Access to the X operand: none, read, write, read/write, unknown.
248 ;; Access to the Y operand is either none (if opy_type is none)
249 ;; or read otherwise.
250 (define_attr "opx_access" "none, r, w, rw, unknown"
251 (cond [(eq_attr "type1" "rts,unlk") (const_string "none")
252 (eq_attr "type1" "bcc,bra,bsr,cmp_l,jmp,jsr,tst,tst_l")
254 (eq_attr "type1" "clr,lea,mov3q_l,move,move_l,moveq_l,pea")
256 (eq_attr "type1" "alu_l,alu_reg1,alu_regx,aluq_l")
258 (const_string "unknown")))
260 ;; Memory relation of operands:
261 ;; r - register or immediate operand
262 ;; m - non-indexed memory location
263 ;; i - indexed memory location
265 (define_attr "opx_mem" "r, m, i, unknown"
266 (cond [(eq_attr "opx_type" "none,reg,imm_q,imm_w,imm_l") (const_string "r")
267 (eq_attr "opx_type" "mem1,mem234,mem5,mem7") (const_string "m")
268 (eq_attr "opx_type" "mem6") (const_string "i")]
269 (const_string "unknown")))
271 (define_attr "opy_mem" "r, m, i, unknown"
272 (cond [(eq_attr "opy_type" "none,reg,imm_q,imm_w,imm_l") (const_string "r")
273 (eq_attr "opy_type" "mem1,mem234,mem5,mem7") (const_string "m")
274 (eq_attr "opy_type" "mem6") (const_string "i")]
275 (const_string "unknown")))
277 ;; Memory accesses of the insn.
278 ;; 00 - no memory references
279 ;; 10 - memory is read
280 ;; i10 - indexed memory is read
281 ;; 01 - memory is written
282 ;; 0i1 - indexed memory is written
283 ;; 11 - memory is read, memory is written
284 ;; i11 - indexed memory is read, memory is written
285 ;; 1i1 - memory is read, indexed memory is written
287 ;; unknown - should now occur on normal insn.
288 ;; ??? This attribute is implemented in C to spare genattrtab from
289 ;; ??? optimizing it.
290 (define_attr "op_mem" "00, 10, i0, 01, 0i, 11, i1, 1i, unknown"
291 ; (cond [(and (eq_attr "opy_mem" "r") (eq_attr "opx_mem" "r"))
292 ; (const_string "00")
294 ; (and (eq_attr "opy_mem" "r") (eq_attr "opx_mem" "m"))
295 ; (cond [(eq_attr "opx_access" "r") (const_string "10")
296 ; (eq_attr "opx_access" "w") (const_string "01")
297 ; (eq_attr "opx_access" "rw") (const_string "11")]
298 ; (const_string "unknown"))
300 ; (and (eq_attr "opy_mem" "r") (eq_attr "opx_mem" "i"))
301 ; (cond [(eq_attr "opx_access" "r") (const_string "i0")
302 ; (eq_attr "opx_access" "w") (const_string "0i")
303 ; (eq_attr "opx_access" "rw") (const_string "i1")]
304 ; (const_string "unknown"))
306 ; (and (eq_attr "opy_mem" "m") (eq_attr "opx_mem" "r"))
307 ; (const_string "10")
309 ; (and (eq_attr "opy_mem" "m") (eq_attr "opx_mem" "m"))
310 ; (cond [(eq_attr "opx_access" "w") (const_string "11")]
311 ; (const_string "unknown"))
313 ; (and (eq_attr "opy_mem" "m") (eq_attr "opx_mem" "i"))
314 ; (cond [(eq_attr "opx_access" "w") (const_string "1i")]
315 ; (const_string "unknown"))
317 ; (and (eq_attr "opy_mem" "i") (eq_attr "opx_mem" "r"))
318 ; (const_string "i0")
320 ; (and (eq_attr "opy_mem" "i") (eq_attr "opx_mem" "m"))
321 ; (cond [(eq_attr "opx_access" "w") (const_string "i1")]
322 ; (const_string "unknown"))]
323 ; (const_string "unknown"))
324 (symbol_ref "m68k_sched_attr_op_mem (insn)"))
326 ;; Attribute to support partial automata description.
327 ;; This attribute has value 'yes' for instructions that are not
328 ;; fully handled yet.
329 (define_attr "guess" "yes, no"
330 (cond [(ior (eq (symbol_ref "reload_completed") (const_int 0))
331 (eq_attr "type1" "unknown"))
332 (const_string "yes")]
333 (const_string "no")))
335 ;; Attribute to support statistics gathering.
336 ;; Todo means that insn lacks something to get pipeline description.
337 ;; Done means that insn was transformed to suit pipeline description.
338 ;; Nothing means that insn was originally good enough for scheduling.
339 (define_attr "split" "todo, done, nothing"
340 (if_then_else (eq_attr "type" "unknown")
341 (const_string "todo")
342 (const_string "nothing")))
344 ;; Mode macros for floating point operations.
345 ;; Valid floating point modes
346 (define_mode_iterator FP [SF DF (XF "TARGET_68881")])
347 ;; Mnemonic infix to round result
348 (define_mode_attr round [(SF "%$") (DF "%&") (XF "")])
349 ;; Mnemonic infix to round result for mul or div instruction
350 (define_mode_attr round_mul [(SF "sgl") (DF "%&") (XF "")])
351 ;; Suffix specifying source operand format
352 (define_mode_attr prec [(SF "s") (DF "d") (XF "x")])
353 ;; Allowable D registers
354 (define_mode_attr dreg [(SF "d") (DF "") (XF "")])
355 ;; Allowable 68881 constant constraints
356 (define_mode_attr const [(SF "F") (DF "G") (XF "")])
359 (define_insn_and_split "*movdf_internal"
360 [(set (match_operand:DF 0 "push_operand" "=m, m")
361 (match_operand:DF 1 "general_operand" "f, ro<>E"))]
366 "&& reload_completed && (extract_constrain_insn_cached (insn), which_alternative == 1)"
369 m68k_emit_move_double (operands);
372 [(set_attr "type" "fmove,*")
373 (set_attr "split" "done,*")])
375 (define_insn_and_split "pushdi"
376 [(set (match_operand:DI 0 "push_operand" "=m")
377 (match_operand:DI 1 "general_operand" "ro<>Fi"))]
380 "&& reload_completed"
383 m68k_emit_move_double (operands);
387 ;; We don't want to allow a constant operand for test insns because
388 ;; (set (cc0) (const_int foo)) has no mode information. Such insns will
389 ;; be folded while optimizing anyway.
391 (define_expand "tstdi"
392 [(parallel [(set (cc0)
393 (match_operand:DI 0 "nonimmediate_operand" ""))
394 (clobber (match_scratch:SI 1 ""))
395 (clobber (match_scratch:DI 2 ""))])]
397 "m68k_last_compare_had_fp_operands = 0;")
401 (match_operand:DI 0 "nonimmediate_operand" "am,d"))
402 (clobber (match_scratch:SI 1 "=X,d"))
403 (clobber (match_scratch:DI 2 "=d,X"))]
406 if (which_alternative == 0)
410 xoperands[0] = operands[2];
411 xoperands[1] = operands[0];
412 output_move_double (xoperands);
413 cc_status.flags |= CC_REVERSED; /*|*/
414 return "neg%.l %R2\;negx%.l %2";
416 if (find_reg_note (insn, REG_DEAD, operands[0]))
418 cc_status.flags |= CC_REVERSED; /*|*/
419 return "neg%.l %R0\;negx%.l %0";
423 'sub' clears %1, and also clears the X cc bit
424 'tst' sets the Z cc bit according to the low part of the DImode operand
425 'subx %1' (i.e. subx #0) acts as a (non-existent) tstx on the high part.
427 return "sub%.l %1,%1\;tst%.l %R0\;subx%.l %1,%0";
430 (define_expand "tstsi"
432 (match_operand:SI 0 "nonimmediate_operand" ""))]
434 "m68k_last_compare_had_fp_operands = 0;")
436 ;; If you think that the 68020 does not support tstl a0,
437 ;; reread page B-167 of the 68020 manual more carefully.
438 (define_insn "*tstsi_internal_68020_cf"
440 (match_operand:SI 0 "nonimmediate_operand" "rm"))]
441 "TARGET_68020 || TARGET_COLDFIRE"
443 [(set_attr "type" "tst_l")])
445 ;; On an address reg, cmpw may replace cmpl.
446 (define_insn "*tstsi_internal"
448 (match_operand:SI 0 "nonimmediate_operand" "dm,r"))]
449 "!(TARGET_68020 || TARGET_COLDFIRE)"
453 [(set_attr "type" "tst_l,*")])
455 ;; This can't use an address register, because comparisons
456 ;; with address registers as second operand always test the whole word.
457 (define_expand "tsthi"
459 (match_operand:HI 0 "nonimmediate_operand" ""))]
461 "m68k_last_compare_had_fp_operands = 0;")
463 (define_insn "*tsthi_internal"
465 (match_operand:HI 0 "nonimmediate_operand" "dm"))]
468 [(set_attr "type" "tst_w")])
470 (define_expand "tstqi"
472 (match_operand:QI 0 "nonimmediate_operand" ""))]
474 "m68k_last_compare_had_fp_operands = 0;")
476 (define_insn "*tstqi_internal"
478 (match_operand:QI 0 "nonimmediate_operand" "dm"))]
481 [(set_attr "type" "tst_b")])
483 (define_expand "tst<mode>"
485 (match_operand:FP 0 "general_operand" ""))]
488 m68k_last_compare_had_fp_operands = 1;
491 (define_insn "tst<mode>_68881"
493 (match_operand:FP 0 "general_operand" "f<FP:dreg>m"))]
496 cc_status.flags = CC_IN_68881;
497 if (FP_REG_P (operands[0]))
499 return "ftst%.<FP:prec> %0";
502 (define_insn "tst<mode>_cf"
504 (match_operand:FP 0 "general_operand" "f<FP:dreg><Q>U"))]
505 "TARGET_COLDFIRE_FPU"
507 cc_status.flags = CC_IN_68881;
508 if (FP_REG_P (operands[0]))
510 return "ftst%.<FP:prec> %0";
512 [(set_attr "type" "ftst")])
515 ;; compare instructions.
517 (define_expand "cmpdi"
520 (compare (match_operand:DI 0 "nonimmediate_operand" "")
521 (match_operand:DI 1 "general_operand" "")))
522 (clobber (match_dup 2))])]
524 "m68k_last_compare_had_fp_operands = 0; operands[2] = gen_reg_rtx (DImode);")
528 (compare (match_operand:DI 1 "nonimmediate_operand" "0,d")
529 (match_operand:DI 2 "general_operand" "d,0")))
530 (clobber (match_operand:DI 0 "register_operand" "=d,d"))]
533 if (rtx_equal_p (operands[0], operands[1]))
534 return "sub%.l %R2,%R0\;subx%.l %2,%0";
537 cc_status.flags |= CC_REVERSED; /*|*/
538 return "sub%.l %R1,%R0\;subx%.l %1,%0";
542 (define_expand "cmpsi"
544 (compare (match_operand:SI 0 "nonimmediate_operand" "")
545 (match_operand:SI 1 "general_operand" "")))]
548 m68k_last_compare_had_fp_operands = 0;
551 ;; A composite of the cmp, cmpa, cmpi & cmpm m68000 op codes.
554 (compare (match_operand:SI 0 "nonimmediate_operand" "rKT,rKs,mSr,mSa,>")
555 (match_operand:SI 1 "general_src_operand" "mSr,mSa,KTr,Ksr,>")))]
558 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
559 return "cmpm%.l %1,%0";
560 if (REG_P (operands[1])
561 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
563 cc_status.flags |= CC_REVERSED; /*|*/
564 return "cmp%.l %d0,%d1";
566 if (ADDRESS_REG_P (operands[0])
567 && GET_CODE (operands[1]) == CONST_INT
568 && INTVAL (operands[1]) < 0x8000
569 && INTVAL (operands[1]) >= -0x8000)
570 return "cmp%.w %1,%0";
571 return "cmp%.l %d1,%d0";
574 (define_insn "*cmpsi_cf"
576 (compare (match_operand:SI 0 "nonimmediate_operand" "mrKs,r")
577 (match_operand:SI 1 "general_operand" "r,mrKs")))]
580 if (REG_P (operands[1])
581 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
583 cc_status.flags |= CC_REVERSED; /*|*/
584 return "cmp%.l %d0,%d1";
586 return "cmp%.l %d1,%d0";
588 [(set_attr "type" "cmp_l")])
590 (define_expand "cmphi"
592 (compare (match_operand:HI 0 "nonimmediate_src_operand" "")
593 (match_operand:HI 1 "general_src_operand" "")))]
595 "m68k_last_compare_had_fp_operands = 0;")
599 (compare (match_operand:HI 0 "nonimmediate_src_operand" "rnmS,d,n,mS,>")
600 (match_operand:HI 1 "general_src_operand" "d,rnmS,mS,n,>")))]
603 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
604 return "cmpm%.w %1,%0";
605 if ((REG_P (operands[1]) && !ADDRESS_REG_P (operands[1]))
606 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
608 cc_status.flags |= CC_REVERSED;
609 return "cmp%.w %d0,%d1";
611 return "cmp%.w %d1,%d0";
614 (define_expand "cmpqi"
616 (compare (match_operand:QI 0 "nonimmediate_src_operand" "")
617 (match_operand:QI 1 "general_src_operand" "")))]
619 "m68k_last_compare_had_fp_operands = 0;")
623 (compare (match_operand:QI 0 "nonimmediate_src_operand" "dn,dmS,>")
624 (match_operand:QI 1 "general_src_operand" "dmS,nd,>")))]
627 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
628 return "cmpm%.b %1,%0";
629 if (REG_P (operands[1])
630 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
632 cc_status.flags |= CC_REVERSED; /*|*/
633 return "cmp%.b %d0,%d1";
635 return "cmp%.b %d1,%d0";
638 (define_expand "cmp<mode>"
640 (compare (match_operand:FP 0 "register_operand" "")
641 (match_operand:FP 1 "fp_src_operand" "")))]
643 "m68k_last_compare_had_fp_operands = 1;")
645 (define_insn "*cmp<mode>_68881"
647 (compare (match_operand:FP 0 "fp_src_operand" "f,f,<FP:dreg>mF")
648 (match_operand:FP 1 "fp_src_operand" "f,<FP:dreg>mF,f")))]
650 && (register_operand (operands[0], <MODE>mode)
651 || register_operand (operands[1], <MODE>mode))"
654 fcmp%.<FP:prec> %f1,%0
655 fcmp%.<FP:prec> %0,%f1"
656 [(set_attr "type" "fcmp")])
658 (define_insn "*cmp<mode>_cf"
660 (compare (match_operand:FP 0 "fp_src_operand" "f,f,<FP:dreg><Q>U")
661 (match_operand:FP 1 "fp_src_operand" "f,<FP:dreg><Q>U,f")))]
663 && (register_operand (operands[0], <MODE>mode)
664 || register_operand (operands[1], <MODE>mode))"
667 fcmp%.<FP:prec> %f1,%0
668 fcmp%.<FP:prec> %0,%f1"
669 [(set_attr "type" "fcmp")])
671 ;; Recognizers for btst instructions.
673 ;; ColdFire/5200 only allows "<Q>" type addresses when the bit position is
674 ;; specified as a constant, so we must disable all patterns that may extract
675 ;; from a MEM at a constant bit position if we can't use this as a constraint.
678 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_src_operand" "oS")
680 (minus:SI (const_int 7)
681 (match_operand:SI 1 "general_operand" "di"))))]
684 return output_btst (operands, operands[1], operands[0], insn, 7);
687 ;; This is the same as the above pattern except for the constraints. The 'i'
691 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "o")
693 (minus:SI (const_int 7)
694 (match_operand:SI 1 "general_operand" "d"))))]
697 return output_btst (operands, operands[1], operands[0], insn, 7);
701 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "d")
703 (minus:SI (const_int 31)
704 (match_operand:SI 1 "general_operand" "di"))))]
707 return output_btst (operands, operands[1], operands[0], insn, 31);
710 ;; The following two patterns are like the previous two
711 ;; except that they use the fact that bit-number operands
712 ;; are automatically masked to 3 or 5 bits.
715 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "o")
717 (minus:SI (const_int 7)
719 (match_operand:SI 1 "register_operand" "d")
723 return output_btst (operands, operands[1], operands[0], insn, 7);
727 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "d")
729 (minus:SI (const_int 31)
731 (match_operand:SI 1 "register_operand" "d")
735 return output_btst (operands, operands[1], operands[0], insn, 31);
738 ;; Nonoffsettable mem refs are ok in this one pattern
739 ;; since we don't try to adjust them.
741 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "m")
743 (match_operand:SI 1 "const_int_operand" "n")))]
744 "(unsigned) INTVAL (operands[1]) < 8 && !TARGET_COLDFIRE"
746 operands[1] = GEN_INT (7 - INTVAL (operands[1]));
747 return output_btst (operands, operands[1], operands[0], insn, 7);
751 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "do")
753 (match_operand:SI 1 "const_int_operand" "n")))]
756 if (GET_CODE (operands[0]) == MEM)
758 operands[0] = adjust_address (operands[0], QImode,
759 INTVAL (operands[1]) / 8);
760 operands[1] = GEN_INT (7 - INTVAL (operands[1]) % 8);
761 return output_btst (operands, operands[1], operands[0], insn, 7);
763 operands[1] = GEN_INT (31 - INTVAL (operands[1]));
764 return output_btst (operands, operands[1], operands[0], insn, 31);
767 ;; This is the same as the above pattern except for the constraints.
768 ;; The 'o' has been replaced with 'Q'.
771 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "dQ")
773 (match_operand:SI 1 "const_int_operand" "n")))]
776 if (GET_CODE (operands[0]) == MEM)
778 operands[0] = adjust_address (operands[0], QImode,
779 INTVAL (operands[1]) / 8);
780 operands[1] = GEN_INT (7 - INTVAL (operands[1]) % 8);
781 return output_btst (operands, operands[1], operands[0], insn, 7);
783 operands[1] = GEN_INT (31 - INTVAL (operands[1]));
784 return output_btst (operands, operands[1], operands[0], insn, 31);
790 ;; A special case in which it is not desirable
791 ;; to reload the constant into a data register.
792 (define_insn "pushexthisi_const"
793 [(set (match_operand:SI 0 "push_operand" "=m,m,m")
794 (match_operand:SI 1 "const_int_operand" "C0,R,J"))]
795 "INTVAL (operands[1]) >= -0x8000 && INTVAL (operands[1]) < 0x8000"
800 [(set_attr "type" "clr_l,mov3q_l,pea")
801 (set_attr "split" "done")])
804 ;(define_insn "swapsi"
805 ; [(set (match_operand:SI 0 "nonimmediate_operand" "+r")
806 ; (match_operand:SI 1 "general_operand" "+r"))
807 ; (set (match_dup 1) (match_dup 0))]
811 ;; Special case of fullword move when source is zero for 68000_10.
812 ;; moveq is faster on the 68000.
813 (define_insn "*movsi_const0_68000_10"
814 [(set (match_operand:SI 0 "movsi_const0_operand" "=d,a,g")
821 [(set_attr "type" "moveq_l,sub_l,clr_l")
822 (set_attr "opy_type" "imm_q,reg,*")
823 (set_attr "split" "done")])
825 ;; Special case of fullword move when source is zero for 68040_60.
826 ;; On the '040, 'subl an,an' takes 2 clocks while lea takes only 1
827 (define_insn "*movsi_const0_68040_60"
828 [(set (match_operand:SI 0 "movsi_const0_operand" "=a,g")
832 if (which_alternative == 0)
833 return MOTOROLA ? "lea 0.w,%0" : "lea 0:w,%0";
834 else if (which_alternative == 1)
842 [(set_attr "type" "lea,clr_l")
843 (set_attr "opy_type" "imm_w,*")
844 (set_attr "split" "done")])
846 ;; Special case of fullword move when source is zero.
847 (define_insn "*movsi_const0"
848 [(set (match_operand:SI 0 "movsi_const0_operand" "=a,g")
850 "!(TUNE_68000_10 || TUNE_68040_60)"
854 [(set_attr "type" "sub_l,clr_l")
855 (set_attr "opy_type" "reg,*")
856 (set_attr "split" "done")])
858 ;; General case of fullword move.
860 ;; This is the main "hook" for PIC code. When generating
861 ;; PIC, movsi is responsible for determining when the source address
862 ;; needs PIC relocation and appropriately calling legitimize_pic_address
863 ;; to perform the actual relocation.
865 ;; In both the PIC and non-PIC cases the patterns generated will
866 ;; matched by the next define_insn.
867 (define_expand "movsi"
868 [(set (match_operand:SI 0 "" "")
869 (match_operand:SI 1 "" ""))]
872 rtx tmp, base, offset;
874 if (flag_pic && !TARGET_PCREL && symbolic_operand (operands[1], SImode))
876 /* The source is an address which requires PIC relocation.
877 Call legitimize_pic_address with the source, mode, and a relocation
878 register (a new pseudo, or the final destination if reload_in_progress
879 is set). Then fall through normally */
880 rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
881 operands[1] = legitimize_pic_address (operands[1], SImode, temp);
883 else if (flag_pic && TARGET_PCREL && ! reload_in_progress)
885 /* Don't allow writes to memory except via a register;
886 the m68k doesn't consider PC-relative addresses to be writable. */
887 if (symbolic_operand (operands[0], SImode))
888 operands[0] = force_reg (SImode, XEXP (operands[0], 0));
889 else if (GET_CODE (operands[0]) == MEM
890 && symbolic_operand (XEXP (operands[0], 0), SImode))
891 operands[0] = gen_rtx_MEM (SImode,
892 force_reg (SImode, XEXP (operands[0], 0)));
894 if (M68K_OFFSETS_MUST_BE_WITHIN_SECTIONS_P)
896 split_const (operands[1], &base, &offset);
897 if (GET_CODE (base) == SYMBOL_REF
898 && !offset_within_block_p (base, INTVAL (offset)))
900 tmp = !can_create_pseudo_p () ? operands[0] : gen_reg_rtx (SImode);
901 emit_move_insn (tmp, base);
902 emit_insn (gen_addsi3 (operands[0], tmp, offset));
908 ;; General case of fullword move.
909 (define_insn "*movsi_m68k"
910 ;; Notes: make sure no alternative allows g vs g.
911 ;; We don't allow f-regs since fixed point cannot go in them.
912 [(set (match_operand:SI 0 "nonimmediate_operand" "=g,d,a<")
913 (match_operand:SI 1 "general_src_operand" "damSnT,n,i"))]
914 "!TARGET_COLDFIRE && reload_completed"
916 return output_move_simode (operands);
919 ;; Before reload is completed the register constraints
920 ;; force integer constants in range for a moveq to be reloaded
921 ;; if they are headed for memory.
922 (define_insn "*movsi_m68k2"
923 [(set (match_operand:SI 0 "nonimmediate_operand" "=g,d,a<")
924 (match_operand:SI 1 "general_src_operand" "damSKT,n,i"))]
928 return output_move_simode (operands);
931 ;; ColdFire move instructions can have at most one operand of mode >= 6.
932 (define_insn "*movsi_cf"
933 [(set (match_operand:SI 0 "nonimmediate_operand" "=g,d, d, d, d, d, a,Ap, a, r<Q>,g, U")
934 (match_operand:SI 1 "general_operand" " R,CQ,CW,CZ,CS,Ci,J,J Cs,Cs, g, Rr<Q>,U"))]
937 switch (which_alternative)
940 return "mov3q%.l %1,%0";
943 return "moveq %1,%0";
947 unsigned u = INTVAL (operands[1]);
949 operands[1] = GEN_INT ((u << 16) | (u >> 16)); /*|*/
950 return "moveq %1,%0\n\tswap %0";
954 return "mvz%.w %1,%0";
957 return "mvs%.w %1,%0";
960 return "move%.l %1,%0";
963 return "move%.w %1,%0";
974 return "move%.l %1,%0";
981 [(set_attr "type" "mov3q_l, moveq_l,*, mvz_w, mvs_w, move_l, move_w, pea, lea, move_l, move_l, move_l")
983 (if_then_else (eq_attr "alternative" "2")
985 (const_string "done")))])
987 ;; Special case of fullword move, where we need to get a non-GOT PIC
988 ;; reference into an address register.
990 [(set (match_operand:SI 0 "nonimmediate_operand" "=a<")
991 (match_operand:SI 1 "pcrel_address" ""))]
994 if (push_operand (operands[0], SImode))
999 (define_expand "movhi"
1000 [(set (match_operand:HI 0 "nonimmediate_operand" "")
1001 (match_operand:HI 1 "general_operand" ""))]
1006 [(set (match_operand:HI 0 "nonimmediate_operand" "=g")
1007 (match_operand:HI 1 "general_src_operand" "gS"))]
1009 "* return output_move_himode (operands);")
1012 [(set (match_operand:HI 0 "nonimmediate_operand" "=r<Q>,g,U")
1013 (match_operand:HI 1 "general_operand" "g,r<Q>,U"))]
1015 "* return output_move_himode (operands);")
1017 (define_expand "movstricthi"
1018 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" ""))
1019 (match_operand:HI 1 "general_src_operand" ""))]
1024 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
1025 (match_operand:HI 1 "general_src_operand" "rmSn"))]
1027 "* return output_move_stricthi (operands);")
1030 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+d,m"))
1031 (match_operand:HI 1 "general_src_operand" "rmn,r"))]
1033 "* return output_move_stricthi (operands);")
1035 (define_expand "movqi"
1036 [(set (match_operand:QI 0 "nonimmediate_operand" "")
1037 (match_operand:QI 1 "general_src_operand" ""))]
1042 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,*a,m")
1043 (match_operand:QI 1 "general_src_operand" "dmSi*a,di*a,dmSi"))]
1045 "* return output_move_qimode (operands);")
1048 [(set (match_operand:QI 0 "nonimmediate_operand" "=d<Q>,dm,U,d*a")
1049 (match_operand:QI 1 "general_src_operand" "dmi,d<Q>,U,di*a"))]
1051 "* return output_move_qimode (operands);")
1053 (define_expand "movstrictqi"
1054 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" ""))
1055 (match_operand:QI 1 "general_src_operand" ""))]
1060 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
1061 (match_operand:QI 1 "general_src_operand" "dmSn"))]
1063 "* return output_move_strictqi (operands);")
1065 (define_insn "*movstrictqi_cf"
1066 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+d, Ac, d,m"))
1067 (match_operand:QI 1 "general_src_operand" "C0,C0, dmn,d"))]
1074 [(set_attr "type" "clr_b,clr_b,move_b,move_b")
1075 (set_attr "split" "done")])
1077 (define_expand "pushqi1"
1078 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -2)))
1079 (set (mem:QI (plus:SI (reg:SI SP_REG) (const_int 1)))
1080 (match_operand:QI 0 "general_operand" ""))]
1084 (define_expand "reload_insf"
1085 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
1086 (match_operand:SF 1 "general_operand" "mf"))
1087 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
1088 "TARGET_COLDFIRE_FPU"
1090 if (emit_move_sequence (operands, SFmode, operands[2]))
1093 /* We don't want the clobber emitted, so handle this ourselves. */
1094 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
1098 (define_expand "reload_outsf"
1099 [(set (match_operand:SF 0 "general_operand" "")
1100 (match_operand:SF 1 "register_operand" "f"))
1101 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
1102 "TARGET_COLDFIRE_FPU"
1104 if (emit_move_sequence (operands, SFmode, operands[2]))
1107 /* We don't want the clobber emitted, so handle this ourselves. */
1108 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
1112 (define_expand "movsf"
1113 [(set (match_operand:SF 0 "nonimmediate_operand" "")
1114 (match_operand:SF 1 "general_operand" ""))]
1119 [(set (match_operand:SF 0 "nonimmediate_operand" "=rmf")
1120 (match_operand:SF 1 "general_operand" "rmfF"))]
1123 if (FP_REG_P (operands[0]))
1125 if (FP_REG_P (operands[1]))
1126 return "f%$move%.x %1,%0";
1127 else if (ADDRESS_REG_P (operands[1]))
1128 return "move%.l %1,%-\;f%$move%.s %+,%0";
1129 else if (GET_CODE (operands[1]) == CONST_DOUBLE)
1130 return output_move_const_single (operands);
1131 return "f%$move%.s %f1,%0";
1133 if (FP_REG_P (operands[1]))
1135 if (ADDRESS_REG_P (operands[0]))
1136 return "fmove%.s %1,%-\;move%.l %+,%0";
1137 return "fmove%.s %f1,%0";
1139 if (operands[1] == CONST0_RTX (SFmode)
1140 /* clr insns on 68000 read before writing. */
1141 && ((TARGET_68010 || TARGET_COLDFIRE)
1142 || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0]))))
1144 if (ADDRESS_REG_P (operands[0]))
1146 /* On the '040, 'subl an,an' takes 2 clocks while lea takes only 1 */
1148 return MOTOROLA ? "lea 0.w,%0" : "lea 0:w,%0";
1150 return "sub%.l %0,%0";
1152 /* moveq is faster on the 68000. */
1153 if (DATA_REG_P (operands[0]) && TUNE_68000_10)
1154 return "moveq #0,%0";
1157 return "move%.l %1,%0";
1160 (define_insn "movsf_cf_soft"
1161 [(set (match_operand:SF 0 "nonimmediate_operand" "=r<Q>,g,U")
1162 (match_operand:SF 1 "general_operand" "g,r<Q>,U"))]
1163 "TARGET_COLDFIRE && !TARGET_COLDFIRE_FPU"
1165 [(set_attr "type" "move_l")])
1167 ;; SFmode MEMs are restricted to modes 2-4 if TARGET_COLDFIRE_FPU.
1168 ;; The move instructions can handle all combinations.
1169 (define_insn "movsf_cf_hard"
1170 [(set (match_operand:SF 0 "nonimmediate_operand" "=r<Q>U, f, f,mr,f,r<Q>,f
1172 (match_operand:SF 1 "general_operand" " f, r<Q>U,f,rm,F,F, m
1174 "TARGET_COLDFIRE_FPU"
1176 if (which_alternative == 4 || which_alternative == 5) {
1180 REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
1181 REAL_VALUE_TO_TARGET_SINGLE (r, l);
1182 xoperands[0] = operands[0];
1183 xoperands[1] = GEN_INT (l);
1184 if (which_alternative == 5) {
1186 if (ADDRESS_REG_P (xoperands[0]))
1187 output_asm_insn ("sub%.l %0,%0", xoperands);
1189 output_asm_insn ("clr%.l %0", xoperands);
1191 if (GET_CODE (operands[0]) == MEM
1192 && symbolic_operand (XEXP (operands[0], 0), SImode))
1193 output_asm_insn ("move%.l %1,%-;move%.l %+,%0", xoperands);
1195 output_asm_insn ("move%.l %1,%0", xoperands);
1199 output_asm_insn ("move%.l %1,%-;fsmove%.s %+,%0", xoperands);
1201 output_asm_insn ("clr%.l %-;fsmove%.s %+,%0", xoperands);
1204 if (FP_REG_P (operands[0]))
1206 if (ADDRESS_REG_P (operands[1]))
1207 return "move%.l %1,%-;fsmove%.s %+,%0";
1208 if (FP_REG_P (operands[1]))
1209 return "fsmove%.d %1,%0";
1210 return "fsmove%.s %f1,%0";
1212 if (FP_REG_P (operands[1]))
1214 if (ADDRESS_REG_P (operands[0]))
1215 return "fmove%.s %1,%-;move%.l %+,%0";
1216 return "fmove%.s %f1,%0";
1218 if (operands[1] == CONST0_RTX (SFmode))
1220 if (ADDRESS_REG_P (operands[0]))
1221 return "sub%.l %0,%0";
1224 return "move%.l %1,%0";
1227 (define_expand "reload_indf"
1228 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
1229 (match_operand:DF 1 "general_operand" "mf"))
1230 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
1231 "TARGET_COLDFIRE_FPU"
1233 if (emit_move_sequence (operands, DFmode, operands[2]))
1236 /* We don't want the clobber emitted, so handle this ourselves. */
1237 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
1241 (define_expand "reload_outdf"
1242 [(set (match_operand:DF 0 "general_operand" "")
1243 (match_operand:DF 1 "register_operand" "f"))
1244 (clobber (match_operand:SI 2 "register_operand" "=&a"))]
1245 "TARGET_COLDFIRE_FPU"
1247 if (emit_move_sequence (operands, DFmode, operands[2]))
1250 /* We don't want the clobber emitted, so handle this ourselves. */
1251 emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
1255 (define_expand "movdf"
1256 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1257 (match_operand:DF 1 "general_operand" ""))]
1260 if (TARGET_COLDFIRE_FPU)
1261 if (emit_move_sequence (operands, DFmode, 0))
1266 [(set (match_operand:DF 0 "nonimmediate_operand" "=rm,rf,rf,&rof<>")
1267 (match_operand:DF 1 "general_operand" "*rf,m,0,*rofE<>"))]
1268 ; [(set (match_operand:DF 0 "nonimmediate_operand" "=rm,&rf,&rof<>")
1269 ; (match_operand:DF 1 "general_operand" "rf,m,rofF<>"))]
1272 if (FP_REG_P (operands[0]))
1274 if (FP_REG_P (operands[1]))
1275 return "f%&move%.x %1,%0";
1276 if (REG_P (operands[1]))
1279 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1280 output_asm_insn ("move%.l %1,%-", xoperands);
1281 output_asm_insn ("move%.l %1,%-", operands);
1282 return "f%&move%.d %+,%0";
1284 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1285 return output_move_const_double (operands);
1286 return "f%&move%.d %f1,%0";
1288 else if (FP_REG_P (operands[1]))
1290 if (REG_P (operands[0]))
1292 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
1293 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1294 return "move%.l %+,%0";
1297 return "fmove%.d %f1,%0";
1299 return output_move_double (operands);
1302 (define_insn_and_split "movdf_cf_soft"
1303 [(set (match_operand:DF 0 "nonimmediate_operand" "=r,g")
1304 (match_operand:DF 1 "general_operand" "g,r"))]
1305 "TARGET_COLDFIRE && !TARGET_COLDFIRE_FPU"
1307 "&& reload_completed"
1310 m68k_emit_move_double (operands);
1314 (define_insn "movdf_cf_hard"
1315 [(set (match_operand:DF 0 "nonimmediate_operand" "=f, <Q>U,r,f,r,r,m,f")
1316 (match_operand:DF 1 "general_operand" " f<Q>U,f, f,r,r,m,r,E"))]
1317 "TARGET_COLDFIRE_FPU"
1323 switch (which_alternative)
1326 return "fdmove%.d %1,%0";
1328 return "fmove%.d %1,%0";
1330 return "fmove%.d %1,%-;move%.l %+,%0;move%.l %+,%R0";
1332 return "move%.l %R1,%-;move%.l %1,%-;fdmove%.d %+,%0";
1333 case 4: case 5: case 6:
1334 return output_move_double (operands);
1336 REAL_VALUE_FROM_CONST_DOUBLE (r, operands[1]);
1337 REAL_VALUE_TO_TARGET_DOUBLE (r, l);
1338 xoperands[0] = operands[0];
1339 xoperands[1] = GEN_INT (l[0]);
1340 xoperands[2] = GEN_INT (l[1]);
1341 if (operands[1] == CONST0_RTX (DFmode))
1342 output_asm_insn ("clr%.l %-;clr%.l %-;fdmove%.d %+,%0",
1346 output_asm_insn ("clr%.l %-;move%.l %1,%-;fdmove%.d %+,%0",
1349 output_asm_insn ("move%.l %2,%-;move%.l %1,%-;fdmove%.d %+,%0",
1355 ;; ??? The XFmode patterns are schizophrenic about whether constants are
1356 ;; allowed. Most but not all have predicates and constraint that disallow
1357 ;; constants. Most but not all have output templates that handle constants.
1358 ;; See also LEGITIMATE_CONSTANT_P.
1360 (define_expand "movxf"
1361 [(set (match_operand:XF 0 "nonimmediate_operand" "")
1362 (match_operand:XF 1 "general_operand" ""))]
1365 /* We can't rewrite operands during reload. */
1366 if (! reload_in_progress)
1368 if (CONSTANT_P (operands[1]))
1370 operands[1] = force_const_mem (XFmode, operands[1]);
1371 if (! memory_address_p (XFmode, XEXP (operands[1], 0)))
1372 operands[1] = adjust_address (operands[1], XFmode, 0);
1374 if (flag_pic && TARGET_PCREL)
1376 /* Don't allow writes to memory except via a register; the
1377 m68k doesn't consider PC-relative addresses to be writable. */
1378 if (GET_CODE (operands[0]) == MEM
1379 && symbolic_operand (XEXP (operands[0], 0), SImode))
1380 operands[0] = gen_rtx_MEM (XFmode,
1381 force_reg (SImode, XEXP (operands[0], 0)));
1387 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,!r,!f,!r,m,!r")
1388 (match_operand:XF 1 "nonimmediate_operand" "m,f,f,f,r,!r,!r,m"))]
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]) + 2);
1399 output_asm_insn ("move%.l %1,%-", xoperands);
1400 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1401 output_asm_insn ("move%.l %1,%-", xoperands);
1402 output_asm_insn ("move%.l %1,%-", operands);
1403 return "fmove%.x %+,%0";
1405 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1406 return "fmove%.x %1,%0";
1407 return "fmove%.x %f1,%0";
1409 if (FP_REG_P (operands[1]))
1411 if (REG_P (operands[0]))
1413 output_asm_insn ("fmove%.x %f1,%-\;move%.l %+,%0", operands);
1414 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1415 output_asm_insn ("move%.l %+,%0", operands);
1416 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1417 return "move%.l %+,%0";
1419 /* Must be memory destination. */
1420 return "fmove%.x %f1,%0";
1422 return output_move_double (operands);
1426 [(set (match_operand:XF 0 "nonimmediate_operand" "=rm,rf,&rof<>")
1427 (match_operand:XF 1 "nonimmediate_operand" "rf,m,rof<>"))]
1428 "! TARGET_68881 && ! TARGET_COLDFIRE"
1430 if (FP_REG_P (operands[0]))
1432 if (FP_REG_P (operands[1]))
1433 return "fmove%.x %1,%0";
1434 if (REG_P (operands[1]))
1437 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 2);
1438 output_asm_insn ("move%.l %1,%-", xoperands);
1439 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1440 output_asm_insn ("move%.l %1,%-", xoperands);
1441 output_asm_insn ("move%.l %1,%-", operands);
1442 return "fmove%.x %+,%0";
1444 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1445 return "fmove%.x %1,%0";
1446 return "fmove%.x %f1,%0";
1448 if (FP_REG_P (operands[1]))
1450 if (REG_P (operands[0]))
1452 output_asm_insn ("fmove%.x %f1,%-\;move%.l %+,%0", operands);
1453 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1454 output_asm_insn ("move%.l %+,%0", operands);
1455 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1456 return "move%.l %+,%0";
1459 return "fmove%.x %f1,%0";
1461 return output_move_double (operands);
1465 [(set (match_operand:XF 0 "nonimmediate_operand" "=r,g")
1466 (match_operand:XF 1 "nonimmediate_operand" "g,r"))]
1467 "! TARGET_68881 && TARGET_COLDFIRE"
1468 "* return output_move_double (operands);")
1470 (define_expand "movdi"
1471 ;; Let's see if it really still needs to handle fp regs, and, if so, why.
1472 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1473 (match_operand:DI 1 "general_operand" ""))]
1477 ;; movdi can apply to fp regs in some cases
1479 ;; Let's see if it really still needs to handle fp regs, and, if so, why.
1480 [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,r,&ro<>")
1481 (match_operand:DI 1 "general_operand" "rF,m,roi<>F"))]
1482 ; [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,&r,&ro<>,!&rm,!&f")
1483 ; (match_operand:DI 1 "general_operand" "r,m,roi<>,fF"))]
1484 ; [(set (match_operand:DI 0 "nonimmediate_operand" "=rm,&rf,&ro<>,!&rm,!&f")
1485 ; (match_operand:DI 1 "general_operand" "r,m,roi<>,fF,rfF"))]
1488 if (FP_REG_P (operands[0]))
1490 if (FP_REG_P (operands[1]))
1491 return "fmove%.x %1,%0";
1492 if (REG_P (operands[1]))
1495 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
1496 output_asm_insn ("move%.l %1,%-", xoperands);
1497 output_asm_insn ("move%.l %1,%-", operands);
1498 return "fmove%.d %+,%0";
1500 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1501 return output_move_const_double (operands);
1502 return "fmove%.d %f1,%0";
1504 else if (FP_REG_P (operands[1]))
1506 if (REG_P (operands[0]))
1508 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
1509 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1510 return "move%.l %+,%0";
1513 return "fmove%.d %f1,%0";
1515 return output_move_double (operands);
1519 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,g")
1520 (match_operand:DI 1 "general_operand" "g,r"))]
1522 "* return output_move_double (operands);")
1524 ;; Thus goes after the move instructions
1525 ;; because the move instructions are better (require no spilling)
1526 ;; when they can apply. It goes before the add/sub insns
1527 ;; so we will prefer it to them.
1529 (define_insn "pushasi"
1530 [(set (match_operand:SI 0 "push_operand" "=m")
1531 (match_operand:SI 1 "address_operand" "p"))]
1534 [(set_attr "type" "pea")])
1536 ;; truncation instructions
1537 (define_insn "truncsiqi2"
1538 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,d")
1540 (match_operand:SI 1 "general_src_operand" "doJS,i")))]
1543 if (GET_CODE (operands[0]) == REG)
1545 /* Must clear condition codes, since the move.l bases them on
1546 the entire 32 bits, not just the desired 8 bits. */
1548 return "move%.l %1,%0";
1550 if (GET_CODE (operands[1]) == MEM)
1551 operands[1] = adjust_address (operands[1], QImode, 3);
1552 return "move%.b %1,%0";
1555 (define_insn "trunchiqi2"
1556 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,d")
1558 (match_operand:HI 1 "general_src_operand" "doJS,i")))]
1561 if (GET_CODE (operands[0]) == REG
1562 && (GET_CODE (operands[1]) == MEM
1563 || GET_CODE (operands[1]) == CONST_INT))
1565 /* Must clear condition codes, since the move.w bases them on
1566 the entire 16 bits, not just the desired 8 bits. */
1568 return "move%.w %1,%0";
1570 if (GET_CODE (operands[0]) == REG)
1572 /* Must clear condition codes, since the move.l bases them on
1573 the entire 32 bits, not just the desired 8 bits. */
1575 return "move%.l %1,%0";
1577 if (GET_CODE (operands[1]) == MEM)
1578 operands[1] = adjust_address (operands[1], QImode, 1);
1579 return "move%.b %1,%0";
1582 (define_insn "truncsihi2"
1583 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm,d")
1585 (match_operand:SI 1 "general_src_operand" "roJS,i")))]
1588 if (GET_CODE (operands[0]) == REG)
1590 /* Must clear condition codes, since the move.l bases them on
1591 the entire 32 bits, not just the desired 8 bits. */
1593 return "move%.l %1,%0";
1595 if (GET_CODE (operands[1]) == MEM)
1596 operands[1] = adjust_address (operands[1], QImode, 2);
1597 return "move%.w %1,%0";
1600 ;; zero extension instructions
1602 ;; two special patterns to match various post_inc/pre_dec patterns
1603 (define_insn_and_split "*zero_extend_inc"
1604 [(set (match_operand 0 "post_inc_operand" "")
1605 (zero_extend (match_operand 1 "register_operand" "")))]
1606 "GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT &&
1607 GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT &&
1608 GET_MODE_SIZE (GET_MODE (operands[0])) == GET_MODE_SIZE (GET_MODE (operands[1])) * 2"
1616 operands[0] = adjust_address (operands[0], GET_MODE (operands[1]), 0);
1619 (define_insn_and_split "*zero_extend_dec"
1620 [(set (match_operand 0 "pre_dec_operand" "")
1621 (zero_extend (match_operand 1 "register_operand" "")))]
1622 "(GET_MODE (operands[0]) != HImode || XEXP (XEXP (operands[0], 0), 0) != stack_pointer_rtx) &&
1623 GET_MODE_CLASS (GET_MODE (operands[0])) == MODE_INT &&
1624 GET_MODE_CLASS (GET_MODE (operands[1])) == MODE_INT &&
1625 GET_MODE_SIZE (GET_MODE (operands[0])) == GET_MODE_SIZE (GET_MODE (operands[1])) * 2"
1633 operands[0] = adjust_address (operands[0], GET_MODE (operands[1]), 0);
1636 (define_insn_and_split "zero_extendqidi2"
1637 [(set (match_operand:DI 0 "register_operand" "")
1638 (zero_extend:DI (match_operand:QI 1 "nonimmediate_src_operand" "")))]
1643 (zero_extend:SI (match_dup 1)))
1647 operands[2] = gen_lowpart (SImode, operands[0]);
1648 operands[3] = gen_highpart (SImode, operands[0]);
1651 (define_insn_and_split "zero_extendhidi2"
1652 [(set (match_operand:DI 0 "register_operand" "")
1653 (zero_extend:DI (match_operand:HI 1 "nonimmediate_src_operand" "")))]
1658 (zero_extend:SI (match_dup 1)))
1662 operands[2] = gen_lowpart (SImode, operands[0]);
1663 operands[3] = gen_highpart (SImode, operands[0]);
1666 (define_expand "zero_extendsidi2"
1667 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1668 (zero_extend:DI (match_operand:SI 1 "nonimmediate_src_operand" "")))]
1671 if (GET_CODE (operands[0]) == MEM
1672 && GET_CODE (operands[1]) == MEM)
1673 operands[1] = force_reg (SImode, operands[1]);
1676 (define_insn_and_split "*zero_extendsidi2"
1677 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1678 (zero_extend:DI (match_operand:SI 1 "nonimmediate_src_operand" "")))]
1679 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
1687 operands[2] = gen_lowpart (SImode, operands[0]);
1688 operands[3] = gen_highpart (SImode, operands[0]);
1691 (define_insn "*zero_extendhisi2_cf"
1692 [(set (match_operand:SI 0 "register_operand" "=d")
1693 (zero_extend:SI (match_operand:HI 1 "nonimmediate_src_operand" "rmS")))]
1696 [(set_attr "type" "mvz_w")])
1698 (define_insn "zero_extendhisi2"
1699 [(set (match_operand:SI 0 "register_operand" "=d")
1700 (zero_extend:SI (match_operand:HI 1 "nonimmediate_src_operand" "rmS")))]
1704 (define_expand "zero_extendqihi2"
1705 [(set (match_operand:HI 0 "register_operand" "")
1706 (zero_extend:HI (match_operand:QI 1 "nonimmediate_src_operand" "")))]
1710 (define_insn "*zero_extendqihi2"
1711 [(set (match_operand:HI 0 "register_operand" "=d")
1712 (zero_extend:HI (match_operand:QI 1 "nonimmediate_src_operand" "dmS")))]
1716 (define_insn "*zero_extendqisi2_cfv4"
1717 [(set (match_operand:SI 0 "register_operand" "=d")
1718 (zero_extend:SI (match_operand:QI 1 "nonimmediate_src_operand" "dmS")))]
1721 [(set_attr "type" "mvz_b")])
1723 (define_insn "zero_extendqisi2"
1724 [(set (match_operand:SI 0 "register_operand" "=d")
1725 (zero_extend:SI (match_operand:QI 1 "nonimmediate_src_operand" "dmS")))]
1729 ;; these two pattern split everything else which isn't matched by
1730 ;; something else above
1732 [(set (match_operand 0 "register_operand" "")
1733 (zero_extend (match_operand 1 "nonimmediate_src_operand" "")))]
1736 && reg_mentioned_p (operands[0], operands[1])"
1737 [(set (strict_low_part (match_dup 2))
1740 (match_op_dup 4 [(match_dup 0) (match_dup 3)]))]
1742 operands[2] = gen_lowpart (GET_MODE (operands[1]), operands[0]);
1743 operands[3] = GEN_INT (GET_MODE_MASK (GET_MODE (operands[1])));
1744 operands[4] = gen_rtx_AND (GET_MODE (operands[0]), operands[0], operands[3]);
1748 [(set (match_operand 0 "register_operand" "")
1749 (zero_extend (match_operand 1 "nonimmediate_src_operand" "")))]
1750 "!ISA_HAS_MVS_MVZ && reload_completed"
1753 (set (strict_low_part (match_dup 2))
1756 operands[2] = gen_lowpart (GET_MODE (operands[1]), operands[0]);
1759 ;; sign extension instructions
1761 (define_insn "extendqidi2"
1762 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
1763 (sign_extend:DI (match_operand:QI 1 "general_src_operand" "rmS")))]
1767 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1768 if (ISA_HAS_MVS_MVZ)
1769 return "mvs%.b %1,%2\;smi %0\;extb%.l %0";
1770 if (TARGET_68020 || TARGET_COLDFIRE)
1772 if (ADDRESS_REG_P (operands[1]))
1773 return "move%.w %1,%2\;extb%.l %2\;smi %0\;extb%.l %0";
1775 return "move%.b %1,%2\;extb%.l %2\;smi %0\;extb%.l %0";
1779 if (ADDRESS_REG_P (operands[1]))
1780 return "move%.w %1,%2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0\;smi %0";
1782 return "move%.b %1,%2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0\;smi %0";
1786 (define_insn "extendhidi2"
1787 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
1789 (match_operand:HI 1 "general_src_operand" "rmS")))]
1793 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1794 if (ISA_HAS_MVS_MVZ)
1795 return "mvs%.w %1,%2\;smi %0\;extb%.l %0";
1796 if (TARGET_68020 || TARGET_COLDFIRE)
1797 return "move%.w %1,%2\;ext%.l %2\;smi %0\;extb%.l %0";
1799 return "move%.w %1,%2\;ext%.l %2\;smi %0\;ext%.w %0\;ext%.l %0";
1802 (define_insn "extendsidi2"
1803 [(set (match_operand:DI 0 "register_operand" "=d")
1804 (sign_extend:DI (match_operand:SI 1 "nonimmediate_src_operand" "rm")))]
1808 if (TARGET_68020 || TARGET_COLDFIRE)
1809 return "move%.l %1,%R0\;smi %0\;extb%.l %0";
1811 return "move%.l %1,%R0\;smi %0\;ext%.w %0\;ext%.l %0";
1814 (define_insn "*extendsidi2_mem"
1815 [(set (match_operand:DI 0 "memory_operand" "=o,<")
1816 (sign_extend:DI (match_operand:SI 1 "nonimmediate_src_operand" "rm,rm")))
1817 (clobber (match_scratch:SI 2 "=d,d"))]
1821 operands[3] = adjust_address (operands[0], SImode,
1822 which_alternative == 0 ? 4 : 0);
1823 operands[0] = adjust_address (operands[0], SImode, 0);
1824 if (TARGET_68020 || TARGET_COLDFIRE)
1825 return "move%.l %1,%3\;smi %2\;extb%.l %2\;move%.l %2,%0";
1827 return "move%.l %1,%3\;smi %2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0";
1830 ;; Special case when one can avoid register clobbering, copy and test
1831 ;; Maybe there is a way to make that the general case, by forcing the
1832 ;; result of the SI tree to be in the lower register of the DI target
1834 (define_insn "extendplussidi"
1835 [(set (match_operand:DI 0 "register_operand" "=d")
1836 (sign_extend:DI (plus:SI (match_operand:SI 1 "general_operand" "%rmn")
1837 (match_operand:SI 2 "general_operand" "rmn"))))]
1841 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1842 if (GET_CODE (operands[1]) == CONST_INT
1843 && (unsigned) INTVAL (operands[1]) > 8)
1845 rtx tmp = operands[1];
1847 operands[1] = operands[2];
1850 if (GET_CODE (operands[1]) == REG
1851 && REGNO (operands[1]) == REGNO (operands[3]))
1852 output_asm_insn ("add%.l %2,%3", operands);
1854 output_asm_insn ("move%.l %2,%3\;add%.l %1,%3", operands);
1855 if (TARGET_68020 || TARGET_COLDFIRE)
1856 return "smi %0\;extb%.l %0";
1858 return "smi %0\;ext%.w %0\;ext%.l %0";
1861 (define_expand "extendhisi2"
1862 [(set (match_operand:SI 0 "nonimmediate_operand" "")
1864 (match_operand:HI 1 "nonimmediate_src_operand" "")))]
1868 (define_insn "*cfv4_extendhisi2"
1869 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
1871 (match_operand:HI 1 "nonimmediate_src_operand" "rmS")))]
1874 [(set_attr "type" "mvs_w")])
1876 (define_insn "*68k_extendhisi2"
1877 [(set (match_operand:SI 0 "nonimmediate_operand" "=*d,a")
1879 (match_operand:HI 1 "nonimmediate_src_operand" "0,rmS")))]
1884 [(set_attr "type" "ext_l,move_w")])
1886 (define_insn "extendqihi2"
1887 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
1888 (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0")))]
1891 [(set_attr "type" "ext_w")])
1893 (define_expand "extendqisi2"
1894 [(set (match_operand:SI 0 "nonimmediate_operand" "")
1895 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "")))]
1896 "TARGET_68020 || TARGET_COLDFIRE"
1899 (define_insn "*cfv4_extendqisi2"
1900 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
1901 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "rms")))]
1904 [(set_attr "type" "mvs_b")])
1906 (define_insn "*68k_extendqisi2"
1907 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
1908 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "0")))]
1909 "TARGET_68020 || (TARGET_COLDFIRE && !ISA_HAS_MVS_MVZ)"
1911 [(set_attr "type" "extb_l")])
1913 ;; Conversions between float and double.
1915 (define_expand "extendsfdf2"
1916 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1918 (match_operand:SF 1 "general_operand" "")))]
1923 [(set (match_operand:DF 0 "nonimmediate_operand" "=*fdm,f")
1925 (match_operand:SF 1 "general_operand" "f,dmF")))]
1928 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
1930 if (REGNO (operands[0]) == REGNO (operands[1]))
1932 /* Extending float to double in an fp-reg is a no-op.
1933 NOTICE_UPDATE_CC has already assumed that the
1934 cc will be set. So cancel what it did. */
1935 cc_status = cc_prev_status;
1938 return "f%&move%.x %1,%0";
1940 if (FP_REG_P (operands[0]))
1941 return "f%&move%.s %f1,%0";
1942 if (DATA_REG_P (operands[0]) && FP_REG_P (operands[1]))
1944 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
1945 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
1946 return "move%.l %+,%0";
1948 return "fmove%.d %f1,%0";
1951 (define_insn "extendsfdf2_cf"
1952 [(set (match_operand:DF 0 "nonimmediate_operand" "=f,f")
1954 (match_operand:SF 1 "general_operand" "f,<Q>U")))]
1955 "TARGET_COLDFIRE_FPU"
1957 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
1959 if (REGNO (operands[0]) == REGNO (operands[1]))
1961 /* Extending float to double in an fp-reg is a no-op.
1962 NOTICE_UPDATE_CC has already assumed that the
1963 cc will be set. So cancel what it did. */
1964 cc_status = cc_prev_status;
1967 return "fdmove%.d %1,%0";
1969 return "fdmove%.s %f1,%0";
1972 ;; This cannot output into an f-reg because there is no way to be
1973 ;; sure of truncating in that case.
1974 (define_expand "truncdfsf2"
1975 [(set (match_operand:SF 0 "nonimmediate_operand" "")
1977 (match_operand:DF 1 "general_operand" "")))]
1981 ;; On the '040 we can truncate in a register accurately and easily.
1983 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
1985 (match_operand:DF 1 "general_operand" "fmG")))]
1986 "TARGET_68881 && TARGET_68040"
1988 if (FP_REG_P (operands[1]))
1989 return "f%$move%.x %1,%0";
1990 return "f%$move%.d %f1,%0";
1993 (define_insn "truncdfsf2_cf"
1994 [(set (match_operand:SF 0 "nonimmediate_operand" "=f,d<Q>U")
1996 (match_operand:DF 1 "general_operand" "<Q>U,f")))]
1997 "TARGET_COLDFIRE_FPU"
2001 [(set_attr "type" "fmove")])
2003 (define_insn "*truncdfsf2_68881"
2004 [(set (match_operand:SF 0 "nonimmediate_operand" "=dm")
2006 (match_operand:DF 1 "general_operand" "f")))]
2009 [(set_attr "type" "fmove")])
2011 ;; Conversion between fixed point and floating point.
2012 ;; Note that among the fix-to-float insns
2013 ;; the ones that start with SImode come first.
2014 ;; That is so that an operand that is a CONST_INT
2015 ;; (and therefore lacks a specific machine mode).
2016 ;; will be recognized as SImode (which is always valid)
2017 ;; rather than as QImode or HImode.
2019 (define_expand "floatsi<mode>2"
2020 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2021 (float:FP (match_operand:SI 1 "general_operand" "")))]
2025 (define_insn "floatsi<mode>2_68881"
2026 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2027 (float:FP (match_operand:SI 1 "general_operand" "dmi")))]
2029 "f<FP:round>move%.l %1,%0")
2031 (define_insn "floatsi<mode>2_cf"
2032 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2033 (float:FP (match_operand:SI 1 "general_operand" "d<Q>U")))]
2034 "TARGET_COLDFIRE_FPU"
2035 "f<FP:prec>move%.l %1,%0"
2036 [(set_attr "type" "fmove")])
2039 (define_expand "floathi<mode>2"
2040 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2041 (float:FP (match_operand:HI 1 "general_operand" "")))]
2045 (define_insn "floathi<mode>2_68881"
2046 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2047 (float:FP (match_operand:HI 1 "general_operand" "dmn")))]
2050 [(set_attr "type" "fmove")])
2052 (define_insn "floathi<mode>2_cf"
2053 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2054 (float:FP (match_operand:HI 1 "general_operand" "d<Q>U")))]
2055 "TARGET_COLDFIRE_FPU"
2057 [(set_attr "type" "fmove")])
2060 (define_expand "floatqi<mode>2"
2061 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2062 (float:FP (match_operand:QI 1 "general_operand" "")))]
2066 (define_insn "floatqi<mode>2_68881"
2067 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2068 (float:FP (match_operand:QI 1 "general_operand" "dmn")))]
2071 [(set_attr "type" "fmove")])
2073 (define_insn "floatqi<mode>2_cf"
2074 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2075 (float:FP (match_operand:QI 1 "general_operand" "d<Q>U")))]
2076 "TARGET_COLDFIRE_FPU"
2078 [(set_attr "type" "fmove")])
2081 ;; New routines to convert floating-point values to integers
2082 ;; to be used on the '040. These should be faster than trapping
2083 ;; into the kernel to emulate fintrz. They should also be faster
2084 ;; than calling the subroutines fixsfsi or fixdfsi.
2086 (define_insn "fix_truncdfsi2"
2087 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
2088 (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
2089 (clobber (match_scratch:SI 2 "=d"))
2090 (clobber (match_scratch:SI 3 "=d"))]
2091 "TARGET_68881 && TUNE_68040"
2094 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,%!";
2097 (define_insn "fix_truncdfhi2"
2098 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
2099 (fix:HI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
2100 (clobber (match_scratch:SI 2 "=d"))
2101 (clobber (match_scratch:SI 3 "=d"))]
2102 "TARGET_68881 && TUNE_68040"
2105 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,%!";
2108 (define_insn "fix_truncdfqi2"
2109 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
2110 (fix:QI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
2111 (clobber (match_scratch:SI 2 "=d"))
2112 (clobber (match_scratch:SI 3 "=d"))]
2113 "TARGET_68881 && TUNE_68040"
2116 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,%!";
2119 ;; Convert a float to a float whose value is an integer.
2120 ;; This is the first stage of converting it to an integer type.
2122 (define_expand "ftrunc<mode>2"
2123 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2124 (fix:FP (match_operand:FP 1 "general_operand" "")))]
2125 "TARGET_HARD_FLOAT && !TUNE_68040"
2128 (define_insn "ftrunc<mode>2_68881"
2129 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2130 (fix:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m")))]
2131 "TARGET_68881 && !TUNE_68040"
2133 if (FP_REG_P (operands[1]))
2134 return "fintrz%.x %f1,%0";
2135 return "fintrz%.<FP:prec> %f1,%0";
2138 (define_insn "ftrunc<mode>2_cf"
2139 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2140 (fix:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U")))]
2141 "TARGET_COLDFIRE_FPU"
2143 if (FP_REG_P (operands[1]))
2144 return "fintrz%.d %f1,%0";
2145 return "fintrz%.<FP:prec> %f1,%0";
2147 [(set_attr "type" "fintrz")])
2149 ;; Convert a float whose value is an integer
2150 ;; to an actual integer. Second stage of converting float to integer type.
2151 (define_expand "fix<mode>qi2"
2152 [(set (match_operand:QI 0 "nonimmediate_operand" "")
2153 (fix:QI (match_operand:FP 1 "general_operand" "")))]
2157 (define_insn "fix<mode>qi2_68881"
2158 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
2159 (fix:QI (match_operand:FP 1 "general_operand" "f")))]
2163 (define_insn "fix<mode>qi2_cf"
2164 [(set (match_operand:QI 0 "nonimmediate_operand" "=d<Q>U")
2165 (fix:QI (match_operand:FP 1 "general_operand" "f")))]
2166 "TARGET_COLDFIRE_FPU"
2168 [(set_attr "type" "fmove")])
2170 (define_expand "fix<mode>hi2"
2171 [(set (match_operand:HI 0 "nonimmediate_operand" "")
2172 (fix:HI (match_operand:FP 1 "general_operand" "")))]
2176 (define_insn "fix<mode>hi2_68881"
2177 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
2178 (fix:HI (match_operand:FP 1 "general_operand" "f")))]
2182 (define_insn "fix<mode>hi2_cf"
2183 [(set (match_operand:HI 0 "nonimmediate_operand" "=d<Q>U")
2184 (fix:HI (match_operand:FP 1 "general_operand" "f")))]
2185 "TARGET_COLDFIRE_FPU"
2187 [(set_attr "type" "fmove")])
2189 (define_expand "fix<mode>si2"
2190 [(set (match_operand:SI 0 "nonimmediate_operand" "")
2191 (fix:SI (match_operand:FP 1 "general_operand" "")))]
2195 (define_insn "fix<mode>si2_68881"
2196 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
2197 (fix:SI (match_operand:FP 1 "general_operand" "f")))]
2201 (define_insn "fix<mode>si2_cf"
2202 [(set (match_operand:SI 0 "nonimmediate_operand" "=d<Q>U")
2203 (fix:SI (match_operand:FP 1 "general_operand" "f")))]
2204 "TARGET_COLDFIRE_FPU"
2206 [(set_attr "type" "fmove")])
2211 (define_insn "adddi_lshrdi_63"
2212 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
2213 (plus:DI (lshiftrt:DI (match_operand:DI 1 "general_operand" "rm")
2216 (clobber (match_scratch:SI 2 "=d"))]
2219 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
2220 if (REG_P (operands[1]) && REGNO (operands[1]) == REGNO (operands[0]))
2222 "move%.l %1,%2\;add%.l %2,%2\;subx%.l %2,%2\;sub%.l %2,%3\;subx%.l %2,%0";
2223 if (GET_CODE (operands[1]) == REG)
2224 operands[4] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
2225 else if (GET_CODE (XEXP (operands[1], 0)) == POST_INC
2226 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
2227 operands[4] = operands[1];
2229 operands[4] = adjust_address (operands[1], SImode, 4);
2230 if (GET_CODE (operands[1]) == MEM
2231 && GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
2232 output_asm_insn ("move%.l %4,%3", operands);
2233 output_asm_insn ("move%.l %1,%0\;smi %2", operands);
2234 if (TARGET_68020 || TARGET_COLDFIRE)
2235 output_asm_insn ("extb%.l %2", operands);
2237 output_asm_insn ("ext%.w %2\;ext%.l %2", operands);
2238 if (GET_CODE (operands[1]) != MEM
2239 || GET_CODE (XEXP (operands[1], 0)) != PRE_DEC)
2240 output_asm_insn ("move%.l %4,%3", operands);
2241 return "sub%.l %2,%3\;subx%.l %2,%0";
2244 (define_insn "adddi_sexthishl32"
2245 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,a,*d,*d")
2246 (plus:DI (ashift:DI (sign_extend:DI
2247 (match_operand:HI 1 "general_operand" "rm,rm,rm,rm"))
2249 (match_operand:DI 2 "general_operand" "0,0,0,0")))
2250 (clobber (match_scratch:SI 3 "=&d,X,a,?d"))]
2254 if (ADDRESS_REG_P (operands[0]))
2255 return "add%.w %1,%0";
2256 else if (ADDRESS_REG_P (operands[3]))
2257 return "move%.w %1,%3\;add%.l %3,%0";
2259 return "move%.w %1,%3\;ext%.l %3\;add%.l %3,%0";
2262 (define_insn "*adddi_dilshr32"
2263 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,o")
2264 (plus:DI (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro,d")
2266 (match_operand:DI 2 "general_operand" "0,0")))]
2270 if (GET_CODE (operands[0]) == REG)
2271 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
2273 operands[2] = adjust_address (operands[0], SImode, 4);
2274 return "add%.l %1,%2\;negx%.l %0\;neg%.l %0";
2277 (define_insn "*adddi_dilshr32_cf"
2278 [(set (match_operand:DI 0 "register_operand" "=d")
2279 (plus:DI (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "ro")
2281 (match_operand:DI 2 "register_operand" "0")))]
2285 return "add%.l %1,%R0\;negx%.l %0\;neg%.l %0";
2288 (define_insn "adddi_dishl32"
2289 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,o")
2290 ;; (plus:DI (match_operand:DI 2 "general_operand" "%0")
2291 ;; (ashift:DI (match_operand:DI 1 "general_operand" "ro")
2292 ;; (const_int 32))))]
2293 (plus:DI (ashift:DI (match_operand:DI 1 "general_operand" "ro,d")
2295 (match_operand:DI 2 "general_operand" "0,0")))]
2299 if (GET_CODE (operands[1]) == REG)
2300 operands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
2302 operands[1] = adjust_address (operands[1], SImode, 4);
2303 return "add%.l %1,%0";
2305 [(set_attr "type" "add_l")])
2307 (define_insn "adddi3"
2308 [(set (match_operand:DI 0 "nonimmediate_operand" "=o<>,d,d,d")
2309 (plus:DI (match_operand:DI 1 "general_operand" "%0,0,0,0")
2310 (match_operand:DI 2 "general_operand" "d,no>,d,a")))
2311 (clobber (match_scratch:SI 3 "=&d,&d,X,&d"))]
2314 if (DATA_REG_P (operands[0]))
2316 if (DATA_REG_P (operands[2]))
2317 return "add%.l %R2,%R0\;addx%.l %2,%0";
2318 else if (GET_CODE (operands[2]) == MEM
2319 && GET_CODE (XEXP (operands[2], 0)) == POST_INC)
2320 return "move%.l %2,%3\;add%.l %2,%R0\;addx%.l %3,%0";
2326 if (GET_CODE (operands[2]) == REG)
2328 low = gen_rtx_REG (SImode, REGNO (operands[2]) + 1);
2331 else if (CONSTANT_P (operands[2]))
2332 split_double (operands[2], &high, &low);
2335 low = adjust_address (operands[2], SImode, 4);
2339 operands[1] = low, operands[2] = high;
2340 xoperands[0] = operands[3];
2341 if (GET_CODE (operands[1]) == CONST_INT
2342 && INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
2343 xoperands[1] = GEN_INT (-INTVAL (operands[2]) - 1);
2345 xoperands[1] = operands[2];
2347 output_asm_insn (output_move_simode (xoperands), xoperands);
2348 if (GET_CODE (operands[1]) == CONST_INT)
2350 if (INTVAL (operands[1]) > 0 && INTVAL (operands[1]) <= 8)
2351 return "addq%.l %1,%R0\;addx%.l %3,%0";
2352 else if (INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
2354 operands[1] = GEN_INT (-INTVAL (operands[1]));
2355 return "subq%.l %1,%R0\;subx%.l %3,%0";
2358 return "add%.l %1,%R0\;addx%.l %3,%0";
2363 gcc_assert (GET_CODE (operands[0]) == MEM);
2365 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
2367 operands[1] = gen_rtx_MEM (SImode,
2368 plus_constant (XEXP(operands[0], 0), -8));
2369 return "move%.l %0,%3\;add%.l %R2,%0\;addx%.l %2,%3\;move%.l %3,%1";
2371 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
2373 operands[1] = XEXP(operands[0], 0);
2374 return "add%.l %R2,%0\;move%.l %0,%3\;addx%.l %2,%3\;move%.l %3,%1";
2378 operands[1] = adjust_address (operands[0], SImode, 4);
2379 return "add%.l %R2,%1\;move%.l %0,%3\;addx%.l %2,%3\;move%.l %3,%0";
2384 (define_insn "addsi_lshrsi_31"
2385 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
2386 (plus:SI (lshiftrt:SI (match_operand:SI 1 "general_operand" "rm")
2391 operands[2] = operands[0];
2392 operands[3] = gen_label_rtx();
2393 if (GET_CODE (operands[0]) == MEM)
2395 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
2396 operands[0] = gen_rtx_MEM (SImode, XEXP (XEXP (operands[0], 0), 0));
2397 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
2398 operands[2] = gen_rtx_MEM (SImode, XEXP (XEXP (operands[0], 0), 0));
2400 output_asm_insn ("move%.l %1,%0", operands);
2401 output_asm_insn ("jpl %l3", operands);
2402 output_asm_insn ("addq%.l #1,%2", operands);
2403 (*targetm.asm_out.internal_label) (asm_out_file, "L",
2404 CODE_LABEL_NUMBER (operands[3]));
2408 (define_expand "addsi3"
2409 [(set (match_operand:SI 0 "nonimmediate_operand" "")
2410 (plus:SI (match_operand:SI 1 "general_operand" "")
2411 (match_operand:SI 2 "general_src_operand" "")))]
2415 ;; Note that the middle two alternatives are near-duplicates
2416 ;; in order to handle insns generated by reload.
2417 ;; This is needed since they are not themselves reloaded,
2418 ;; so commutativity won't apply to them.
2419 (define_insn "*addsi3_internal"
2420 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,?a,?a,d,a")
2421 (plus:SI (match_operand:SI 1 "general_operand" "%0,a,rJK,0,0")
2422 (match_operand:SI 2 "general_src_operand" "dIKLT,rJK,a,mSrIKLT,mSrIKLs")))]
2426 "* return output_addsi3 (operands);")
2428 (define_insn_and_split "*addsi3_5200"
2429 [(set (match_operand:SI 0 "nonimmediate_operand" "=mr,mr,m,r, ?a,?a,?a,?a")
2430 (plus:SI (match_operand:SI 1 "general_operand" "%0, 0, 0,0, a, a, r, a")
2431 (match_operand:SI 2 "general_src_operand" " I, L, d,mrKi,Cj,r, a, J")))]
2434 switch (which_alternative)
2437 return "addq%.l %2,%0";
2440 operands[2] = GEN_INT (- INTVAL (operands[2]));
2441 return "subq%.l %2,%0";
2445 return "add%.l %2,%0";
2448 /* move%.l %2,%0\n\tadd%.l %1,%0 */
2452 return MOTOROLA ? "lea (%1,%2.l),%0" : "lea %1@(0,%2:l),%0";
2455 return MOTOROLA ? "lea (%2,%1.l),%0" : "lea %2@(0,%1:l),%0";
2458 return MOTOROLA ? "lea (%c2,%1),%0" : "lea %1@(%c2),%0";
2465 "&& reload_completed && (extract_constrain_insn_cached (insn), which_alternative == 4) && !operands_match_p (operands[0], operands[1])"
2469 (plus:SI (match_dup 0)
2472 [(set_attr "type" "addq_l,subq_l,add_l,add_l,*,lea,lea,lea")
2473 (set_attr "opy" "2,2,2,2,*,*,*,*")
2474 (set_attr "opy_type" "*,*,*,*,*,mem6,mem6,mem5")
2475 (set_attr "split" "done,done,done,done,*,done,done,done")])
2478 [(set (match_operand:SI 0 "nonimmediate_operand" "=a")
2479 (plus:SI (match_operand:SI 1 "general_operand" "0")
2481 (match_operand:HI 2 "nonimmediate_src_operand" "rmS"))))]
2485 (define_insn "addhi3"
2486 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,r")
2487 (plus:HI (match_operand:HI 1 "general_operand" "%0,0")
2488 (match_operand:HI 2 "general_src_operand" "dn,rmSn")))]
2491 if (GET_CODE (operands[2]) == CONST_INT)
2493 /* If the constant would be a negative number when interpreted as
2494 HImode, make it negative. This is usually, but not always, done
2495 elsewhere in the compiler. First check for constants out of range,
2496 which could confuse us. */
2498 if (INTVAL (operands[2]) >= 32768)
2499 operands[2] = GEN_INT (INTVAL (operands[2]) - 65536);
2501 if (INTVAL (operands[2]) > 0
2502 && INTVAL (operands[2]) <= 8)
2503 return "addq%.w %2,%0";
2504 if (INTVAL (operands[2]) < 0
2505 && INTVAL (operands[2]) >= -8)
2507 operands[2] = GEN_INT (- INTVAL (operands[2]));
2508 return "subq%.w %2,%0";
2510 /* On the CPU32 it is faster to use two addqw instructions to
2511 add a small integer (8 < N <= 16) to a register.
2512 Likewise for subqw. */
2513 if (TUNE_CPU32 && REG_P (operands[0]))
2515 if (INTVAL (operands[2]) > 8
2516 && INTVAL (operands[2]) <= 16)
2518 operands[2] = GEN_INT (INTVAL (operands[2]) - 8);
2519 return "addq%.w #8,%0\;addq%.w %2,%0";
2521 if (INTVAL (operands[2]) < -8
2522 && INTVAL (operands[2]) >= -16)
2524 operands[2] = GEN_INT (- INTVAL (operands[2]) - 8);
2525 return "subq%.w #8,%0\;subq%.w %2,%0";
2528 if (ADDRESS_REG_P (operands[0]) && !TUNE_68040)
2529 return MOTOROLA ? "lea (%c2,%0),%0" : "lea %0@(%c2),%0";
2531 return "add%.w %2,%0";
2534 ;; These insns must use MATCH_DUP instead of the more expected
2535 ;; use of a matching constraint because the "output" here is also
2536 ;; an input, so you can't use the matching constraint. That also means
2537 ;; that you can't use the "%", so you need patterns with the matched
2538 ;; operand in both positions.
2541 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
2542 (plus:HI (match_dup 0)
2543 (match_operand:HI 1 "general_src_operand" "dn,rmSn")))]
2546 if (GET_CODE (operands[1]) == CONST_INT)
2548 /* If the constant would be a negative number when interpreted as
2549 HImode, make it negative. This is usually, but not always, done
2550 elsewhere in the compiler. First check for constants out of range,
2551 which could confuse us. */
2553 if (INTVAL (operands[1]) >= 32768)
2554 operands[1] = GEN_INT (INTVAL (operands[1]) - 65536);
2556 if (INTVAL (operands[1]) > 0
2557 && INTVAL (operands[1]) <= 8)
2558 return "addq%.w %1,%0";
2559 if (INTVAL (operands[1]) < 0
2560 && INTVAL (operands[1]) >= -8)
2562 operands[1] = GEN_INT (- INTVAL (operands[1]));
2563 return "subq%.w %1,%0";
2565 /* On the CPU32 it is faster to use two addqw instructions to
2566 add a small integer (8 < N <= 16) to a register.
2567 Likewise for subqw. */
2568 if (TUNE_CPU32 && REG_P (operands[0]))
2570 if (INTVAL (operands[1]) > 8
2571 && INTVAL (operands[1]) <= 16)
2573 operands[1] = GEN_INT (INTVAL (operands[1]) - 8);
2574 return "addq%.w #8,%0\;addq%.w %1,%0";
2576 if (INTVAL (operands[1]) < -8
2577 && INTVAL (operands[1]) >= -16)
2579 operands[1] = GEN_INT (- INTVAL (operands[1]) - 8);
2580 return "subq%.w #8,%0\;subq%.w %1,%0";
2583 if (ADDRESS_REG_P (operands[0]) && !TUNE_68040)
2584 return MOTOROLA ? "lea (%c1,%0),%0" : "lea %0@(%c1),%0";
2586 return "add%.w %1,%0";
2590 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
2591 (plus:HI (match_operand:HI 1 "general_src_operand" "dn,rmSn")
2595 if (GET_CODE (operands[1]) == CONST_INT)
2597 /* If the constant would be a negative number when interpreted as
2598 HImode, make it negative. This is usually, but not always, done
2599 elsewhere in the compiler. First check for constants out of range,
2600 which could confuse us. */
2602 if (INTVAL (operands[1]) >= 32768)
2603 operands[1] = GEN_INT (INTVAL (operands[1]) - 65536);
2605 if (INTVAL (operands[1]) > 0
2606 && INTVAL (operands[1]) <= 8)
2607 return "addq%.w %1,%0";
2608 if (INTVAL (operands[1]) < 0
2609 && INTVAL (operands[1]) >= -8)
2611 operands[1] = GEN_INT (- INTVAL (operands[1]));
2612 return "subq%.w %1,%0";
2614 /* On the CPU32 it is faster to use two addqw instructions to
2615 add a small integer (8 < N <= 16) to a register.
2616 Likewise for subqw. */
2617 if (TUNE_CPU32 && REG_P (operands[0]))
2619 if (INTVAL (operands[1]) > 8
2620 && INTVAL (operands[1]) <= 16)
2622 operands[1] = GEN_INT (INTVAL (operands[1]) - 8);
2623 return "addq%.w #8,%0\;addq%.w %1,%0";
2625 if (INTVAL (operands[1]) < -8
2626 && INTVAL (operands[1]) >= -16)
2628 operands[1] = GEN_INT (- INTVAL (operands[1]) - 8);
2629 return "subq%.w #8,%0\;subq%.w %1,%0";
2632 if (ADDRESS_REG_P (operands[0]) && !TUNE_68040)
2633 return MOTOROLA ? "lea (%c1,%0),%0" : "lea %0@(%c1),%0";
2635 return "add%.w %1,%0";
2638 (define_insn "addqi3"
2639 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
2640 (plus:QI (match_operand:QI 1 "general_operand" "%0,0")
2641 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
2644 if (GET_CODE (operands[2]) == CONST_INT)
2646 if (INTVAL (operands[2]) >= 128)
2647 operands[2] = GEN_INT (INTVAL (operands[2]) - 256);
2649 if (INTVAL (operands[2]) > 0
2650 && INTVAL (operands[2]) <= 8)
2651 return "addq%.b %2,%0";
2652 if (INTVAL (operands[2]) < 0 && INTVAL (operands[2]) >= -8)
2654 operands[2] = GEN_INT (- INTVAL (operands[2]));
2655 return "subq%.b %2,%0";
2658 return "add%.b %2,%0";
2662 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
2663 (plus:QI (match_dup 0)
2664 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
2667 if (GET_CODE (operands[1]) == CONST_INT)
2669 if (INTVAL (operands[1]) >= 128)
2670 operands[1] = GEN_INT (INTVAL (operands[1]) - 256);
2672 if (INTVAL (operands[1]) > 0
2673 && INTVAL (operands[1]) <= 8)
2674 return "addq%.b %1,%0";
2675 if (INTVAL (operands[1]) < 0 && INTVAL (operands[1]) >= -8)
2677 operands[1] = GEN_INT (- INTVAL (operands[1]));
2678 return "subq%.b %1,%0";
2681 return "add%.b %1,%0";
2685 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
2686 (plus:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn")
2690 if (GET_CODE (operands[1]) == CONST_INT)
2692 if (INTVAL (operands[1]) >= 128)
2693 operands[1] = GEN_INT (INTVAL (operands[1]) - 256);
2695 if (INTVAL (operands[1]) > 0
2696 && INTVAL (operands[1]) <= 8)
2697 return "addq%.b %1,%0";
2698 if (INTVAL (operands[1]) < 0 && INTVAL (operands[1]) >= -8)
2700 operands[1] = GEN_INT (- INTVAL (operands[1]));
2701 return "subq%.b %1,%0";
2704 return "add%.b %1,%0";
2707 (define_expand "add<mode>3"
2708 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2709 (plus:FP (match_operand:FP 1 "general_operand" "")
2710 (match_operand:FP 2 "general_operand" "")))]
2714 (define_insn "add<mode>3_floatsi_68881"
2715 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2716 (plus:FP (float:FP (match_operand:SI 2 "general_operand" "dmi"))
2717 (match_operand:FP 1 "general_operand" "0")))]
2719 "f<FP:round>add%.l %2,%0")
2721 (define_insn "add<mode>3_floathi_68881"
2722 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2723 (plus:FP (float:FP (match_operand:HI 2 "general_operand" "dmn"))
2724 (match_operand:FP 1 "general_operand" "0")))]
2726 "f<FP:round>add%.w %2,%0")
2728 (define_insn "add<mode>3_floatqi_68881"
2729 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2730 (plus:FP (float:FP (match_operand:QI 2 "general_operand" "dmn"))
2731 (match_operand:FP 1 "general_operand" "0")))]
2733 "f<FP:round>add%.b %2,%0")
2735 (define_insn "add<mode>3_68881"
2736 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2737 (plus:FP (match_operand:FP 1 "general_operand" "%0")
2738 (match_operand:FP 2 "general_operand" "f<FP:dreg>m<FP:const>")))]
2741 if (FP_REG_P (operands[2]))
2742 return "f<FP:round>add%.x %2,%0";
2743 return "f<FP:round>add%.<FP:prec> %f2,%0";
2746 (define_insn "add<mode>3_cf"
2747 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2748 (plus:FP (match_operand:FP 1 "general_operand" "%0")
2749 (match_operand:FP 2 "general_operand" "f<FP:dreg><Q>U")))]
2750 "TARGET_COLDFIRE_FPU"
2752 if (FP_REG_P (operands[2]))
2753 return "f<FP:prec>add%.d %2,%0";
2754 return "f<FP:prec>add%.<FP:prec> %2,%0";
2756 [(set_attr "type" "fadd")])
2758 ;; subtract instructions
2760 (define_insn "subdi_sexthishl32"
2761 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,a,*d,*d")
2762 (minus:DI (match_operand:DI 1 "general_operand" "0,0,0,0")
2763 (ashift:DI (sign_extend:DI (match_operand:HI 2 "general_operand" "rm,rm,rm,rm"))
2765 (clobber (match_scratch:SI 3 "=&d,X,a,?d"))]
2769 if (ADDRESS_REG_P (operands[0]))
2770 return "sub%.w %2,%0";
2771 else if (ADDRESS_REG_P (operands[3]))
2772 return "move%.w %2,%3\;sub%.l %3,%0";
2774 return "move%.w %2,%3\;ext%.l %3\;sub%.l %3,%0";
2777 (define_insn "subdi_dishl32"
2778 [(set (match_operand:DI 0 "nonimmediate_operand" "+ro")
2779 (minus:DI (match_dup 0)
2780 (ashift:DI (match_operand:DI 1 "general_operand" "ro")
2785 if (GET_CODE (operands[1]) == REG)
2786 operands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
2788 operands[1] = adjust_address (operands[1], SImode, 4);
2789 return "sub%.l %1,%0";
2791 [(set_attr "type" "sub_l")])
2793 (define_insn "subdi3"
2794 [(set (match_operand:DI 0 "nonimmediate_operand" "=o<>,d,d,d")
2795 (minus:DI (match_operand:DI 1 "general_operand" "0,0,0,0")
2796 (match_operand:DI 2 "general_operand" "d,no>,d,a")))
2797 (clobber (match_scratch:SI 3 "=&d,&d,X,&d"))]
2800 if (DATA_REG_P (operands[0]))
2802 if (DATA_REG_P (operands[2]))
2803 return "sub%.l %R2,%R0\;subx%.l %2,%0";
2804 else if (GET_CODE (operands[2]) == MEM
2805 && GET_CODE (XEXP (operands[2], 0)) == POST_INC)
2807 return "move%.l %2,%3\;sub%.l %2,%R0\;subx%.l %3,%0";
2814 if (GET_CODE (operands[2]) == REG)
2816 low = gen_rtx_REG (SImode, REGNO (operands[2]) + 1);
2819 else if (CONSTANT_P (operands[2]))
2820 split_double (operands[2], &high, &low);
2823 low = adjust_address (operands[2], SImode, 4);
2827 operands[1] = low, operands[2] = high;
2828 xoperands[0] = operands[3];
2829 if (GET_CODE (operands[1]) == CONST_INT
2830 && INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
2831 xoperands[1] = GEN_INT (-INTVAL (operands[2]) - 1);
2833 xoperands[1] = operands[2];
2835 output_asm_insn (output_move_simode (xoperands), xoperands);
2836 if (GET_CODE (operands[1]) == CONST_INT)
2838 if (INTVAL (operands[1]) > 0 && INTVAL (operands[1]) <= 8)
2839 return "subq%.l %1,%R0\;subx%.l %3,%0";
2840 else if (INTVAL (operands[1]) >= -8 && INTVAL (operands[1]) < 0)
2842 operands[1] = GEN_INT (-INTVAL (operands[1]));
2843 return "addq%.l %1,%R0\;addx%.l %3,%0";
2846 return "sub%.l %1,%R0\;subx%.l %3,%0";
2851 gcc_assert (GET_CODE (operands[0]) == MEM);
2853 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
2856 = gen_rtx_MEM (SImode, plus_constant (XEXP (operands[0], 0), -8));
2857 return "move%.l %0,%3\;sub%.l %R2,%0\;subx%.l %2,%3\;move%.l %3,%1";
2859 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
2861 operands[1] = XEXP(operands[0], 0);
2862 return "sub%.l %R2,%0\;move%.l %0,%3\;subx%.l %2,%3\;move%.l %3,%1";
2866 operands[1] = adjust_address (operands[0], SImode, 4);
2867 return "sub%.l %R2,%1\;move%.l %0,%3\;subx%.l %2,%3\;move%.l %3,%0";
2872 (define_insn "subsi3"
2873 [(set (match_operand:SI 0 "nonimmediate_operand" "=mda,m,d,a")
2874 (minus:SI (match_operand:SI 1 "general_operand" "0,0,0,0")
2875 (match_operand:SI 2 "general_src_operand" "I,dT,mSrT,mSrs")))]
2882 [(set_attr "type" "subq_l,sub_l,sub_l,sub_l")
2883 (set_attr "opy" "2")])
2886 [(set (match_operand:SI 0 "nonimmediate_operand" "=a")
2887 (minus:SI (match_operand:SI 1 "general_operand" "0")
2889 (match_operand:HI 2 "nonimmediate_src_operand" "rmS"))))]
2893 (define_insn "subhi3"
2894 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,r")
2895 (minus:HI (match_operand:HI 1 "general_operand" "0,0")
2896 (match_operand:HI 2 "general_src_operand" "dn,rmSn")))]
2901 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
2902 (minus:HI (match_dup 0)
2903 (match_operand:HI 1 "general_src_operand" "dn,rmSn")))]
2907 (define_insn "subqi3"
2908 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
2909 (minus:QI (match_operand:QI 1 "general_operand" "0,0")
2910 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
2915 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
2916 (minus:QI (match_dup 0)
2917 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
2921 (define_expand "sub<mode>3"
2922 [(set (match_operand:FP 0 "nonimmediate_operand" "")
2923 (minus:FP (match_operand:FP 1 "general_operand" "")
2924 (match_operand:FP 2 "general_operand" "")))]
2928 (define_insn "sub<mode>3_floatsi_68881"
2929 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2930 (minus:FP (match_operand:FP 1 "general_operand" "0")
2931 (float:FP (match_operand:SI 2 "general_operand" "dmi"))))]
2933 "f<FP:round>sub%.l %2,%0")
2935 (define_insn "sub<mode>3_floathi_68881"
2936 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2937 (minus:FP (match_operand:FP 1 "general_operand" "0")
2938 (float:FP (match_operand:HI 2 "general_operand" "dmn"))))]
2940 "f<FP:round>sub%.w %2,%0")
2942 (define_insn "sub<mode>3_floatqi_68881"
2943 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2944 (minus:FP (match_operand:FP 1 "general_operand" "0")
2945 (float:FP (match_operand:QI 2 "general_operand" "dmn"))))]
2947 "f<FP:round>sub%.b %2,%0")
2949 (define_insn "sub<mode>3_68881"
2950 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2951 (minus:FP (match_operand:FP 1 "general_operand" "0")
2952 (match_operand:FP 2 "general_operand" "f<FP:dreg>m<FP:const>")))]
2955 if (FP_REG_P (operands[2]))
2956 return "f<FP:round>sub%.x %2,%0";
2957 return "f<FP:round>sub%.<FP:prec> %f2,%0";
2960 (define_insn "sub<mode>3_cf"
2961 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
2962 (minus:FP (match_operand:FP 1 "general_operand" "0")
2963 (match_operand:FP 2 "general_operand" "f<FP:dreg><Q>U")))]
2964 "TARGET_COLDFIRE_FPU"
2966 if (FP_REG_P (operands[2]))
2967 return "f<FP:prec>sub%.d %2,%0";
2968 return "f<FP:prec>sub%.<FP:prec> %2,%0";
2970 [(set_attr "type" "fsub")])
2972 ;; multiply instructions
2974 (define_insn "mulhi3"
2975 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
2976 (mult:HI (match_operand:HI 1 "general_operand" "%0")
2977 (match_operand:HI 2 "general_src_operand" "dmSn")))]
2980 return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0";
2982 [(set_attr "type" "muls_w")
2983 (set_attr "opy" "2")])
2985 (define_insn "mulhisi3"
2986 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
2987 (mult:SI (sign_extend:SI
2988 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2990 (match_operand:HI 2 "nonimmediate_src_operand" "dmS"))))]
2993 return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0";
2995 [(set_attr "type" "muls_w")
2996 (set_attr "opy" "2")])
2998 (define_insn "*mulhisisi3_s"
2999 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3000 (mult:SI (sign_extend:SI
3001 (match_operand:HI 1 "nonimmediate_operand" "%0"))
3002 (match_operand:SI 2 "const_int_operand" "n")))]
3003 "INTVAL (operands[2]) >= -0x8000 && INTVAL (operands[2]) <= 0x7fff"
3005 return MOTOROLA ? "muls%.w %2,%0" : "muls %2,%0";
3007 [(set_attr "type" "muls_w")
3008 (set_attr "opy" "2")])
3010 (define_expand "mulsi3"
3011 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3012 (mult:SI (match_operand:SI 1 "general_operand" "")
3013 (match_operand:SI 2 "general_operand" "")))]
3014 "TARGET_68020 || TARGET_COLDFIRE"
3017 (define_insn "*mulsi3_68020"
3018 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3019 (mult:SI (match_operand:SI 1 "general_operand" "%0")
3020 (match_operand:SI 2 "general_src_operand" "dmSTK")))]
3024 [(set_attr "type" "muls_l")
3025 (set_attr "opy" "2")])
3027 (define_insn "*mulsi3_cf"
3028 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3029 (mult:SI (match_operand:SI 1 "general_operand" "%0")
3030 (match_operand:SI 2 "general_operand" "d<Q>")))]
3033 [(set_attr "type" "muls_l")
3034 (set_attr "opy" "2")])
3036 (define_insn "umulhisi3"
3037 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3038 (mult:SI (zero_extend:SI
3039 (match_operand:HI 1 "nonimmediate_operand" "%0"))
3041 (match_operand:HI 2 "nonimmediate_src_operand" "dmS"))))]
3044 return MOTOROLA ? "mulu%.w %2,%0" : "mulu %2,%0";
3046 [(set_attr "type" "mulu_w")
3047 (set_attr "opy" "2")])
3049 (define_insn "*mulhisisi3_z"
3050 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3051 (mult:SI (zero_extend:SI
3052 (match_operand:HI 1 "nonimmediate_operand" "%0"))
3053 (match_operand:SI 2 "const_int_operand" "n")))]
3054 "INTVAL (operands[2]) >= 0 && INTVAL (operands[2]) <= 0xffff"
3056 return MOTOROLA ? "mulu%.w %2,%0" : "mulu %2,%0";
3058 [(set_attr "type" "mulu_w")
3059 (set_attr "opy" "2")])
3061 ;; We need a separate DEFINE_EXPAND for u?mulsidi3 to be able to use the
3062 ;; proper matching constraint. This is because the matching is between
3063 ;; the high-numbered word of the DImode operand[0] and operand[1].
3064 (define_expand "umulsidi3"
3066 [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 4)
3067 (mult:SI (match_operand:SI 1 "register_operand" "")
3068 (match_operand:SI 2 "register_operand" "")))
3069 (set (subreg:SI (match_dup 0) 0)
3070 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
3071 (zero_extend:DI (match_dup 2)))
3072 (const_int 32))))])]
3073 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3077 [(set (match_operand:SI 0 "register_operand" "=d")
3078 (mult:SI (match_operand:SI 1 "register_operand" "%0")
3079 (match_operand:SI 2 "nonimmediate_operand" "dm")))
3080 (set (match_operand:SI 3 "register_operand" "=d")
3081 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
3082 (zero_extend:DI (match_dup 2)))
3084 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3087 ; Match immediate case. For 2.4 only match things < 2^31.
3088 ; It's tricky with larger values in these patterns since we need to match
3089 ; values between the two parallel multiplies, between a CONST_DOUBLE and
3092 [(set (match_operand:SI 0 "register_operand" "=d")
3093 (mult:SI (match_operand:SI 1 "register_operand" "%0")
3094 (match_operand:SI 2 "const_int_operand" "n")))
3095 (set (match_operand:SI 3 "register_operand" "=d")
3096 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
3099 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE
3100 && (unsigned) INTVAL (operands[2]) <= 0x7fffffff"
3103 (define_expand "mulsidi3"
3105 [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 4)
3106 (mult:SI (match_operand:SI 1 "register_operand" "")
3107 (match_operand:SI 2 "register_operand" "")))
3108 (set (subreg:SI (match_dup 0) 0)
3109 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
3110 (sign_extend:DI (match_dup 2)))
3111 (const_int 32))))])]
3112 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3116 [(set (match_operand:SI 0 "register_operand" "=d")
3117 (mult:SI (match_operand:SI 1 "register_operand" "%0")
3118 (match_operand:SI 2 "nonimmediate_operand" "dm")))
3119 (set (match_operand:SI 3 "register_operand" "=d")
3120 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
3121 (sign_extend:DI (match_dup 2)))
3123 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3127 [(set (match_operand:SI 0 "register_operand" "=d")
3128 (mult:SI (match_operand:SI 1 "register_operand" "%0")
3129 (match_operand:SI 2 "const_int_operand" "n")))
3130 (set (match_operand:SI 3 "register_operand" "=d")
3131 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
3134 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3137 (define_expand "umulsi3_highpart"
3139 [(set (match_operand:SI 0 "register_operand" "")
3142 (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" ""))
3143 (zero_extend:DI (match_operand:SI 2 "general_operand" "")))
3145 (clobber (match_dup 3))])]
3146 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3148 operands[3] = gen_reg_rtx (SImode);
3150 if (GET_CODE (operands[2]) == CONST_INT)
3152 operands[2] = immed_double_const (INTVAL (operands[2]) & 0xffffffff,
3155 /* We have to adjust the operand order for the matching constraints. */
3156 emit_insn (gen_const_umulsi3_highpart (operands[0], operands[3],
3157 operands[1], operands[2]));
3163 [(set (match_operand:SI 0 "register_operand" "=d")
3166 (mult:DI (zero_extend:DI (match_operand:SI 2 "register_operand" "%1"))
3167 (zero_extend:DI (match_operand:SI 3 "nonimmediate_operand" "dm")))
3169 (clobber (match_operand:SI 1 "register_operand" "=d"))]
3170 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3173 (define_insn "const_umulsi3_highpart"
3174 [(set (match_operand:SI 0 "register_operand" "=d")
3177 (mult:DI (zero_extend:DI (match_operand:SI 2 "register_operand" "1"))
3178 (match_operand:DI 3 "const_uint32_operand" "n"))
3180 (clobber (match_operand:SI 1 "register_operand" "=d"))]
3181 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3184 (define_expand "smulsi3_highpart"
3186 [(set (match_operand:SI 0 "register_operand" "")
3189 (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" ""))
3190 (sign_extend:DI (match_operand:SI 2 "general_operand" "")))
3192 (clobber (match_dup 3))])]
3193 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3195 operands[3] = gen_reg_rtx (SImode);
3196 if (GET_CODE (operands[2]) == CONST_INT)
3198 /* We have to adjust the operand order for the matching constraints. */
3199 emit_insn (gen_const_smulsi3_highpart (operands[0], operands[3],
3200 operands[1], operands[2]));
3206 [(set (match_operand:SI 0 "register_operand" "=d")
3209 (mult:DI (sign_extend:DI (match_operand:SI 2 "register_operand" "%1"))
3210 (sign_extend:DI (match_operand:SI 3 "nonimmediate_operand" "dm")))
3212 (clobber (match_operand:SI 1 "register_operand" "=d"))]
3213 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3216 (define_insn "const_smulsi3_highpart"
3217 [(set (match_operand:SI 0 "register_operand" "=d")
3220 (mult:DI (sign_extend:DI (match_operand:SI 2 "register_operand" "1"))
3221 (match_operand:DI 3 "const_sint32_operand" "n"))
3223 (clobber (match_operand:SI 1 "register_operand" "=d"))]
3224 "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
3227 (define_expand "mul<mode>3"
3228 [(set (match_operand:FP 0 "nonimmediate_operand" "")
3229 (mult:FP (match_operand:FP 1 "general_operand" "")
3230 (match_operand:FP 2 "general_operand" "")))]
3234 (define_insn "mul<mode>3_floatsi_68881"
3235 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3236 (mult:FP (float:FP (match_operand:SI 2 "general_operand" "dmi"))
3237 (match_operand:FP 1 "general_operand" "0")))]
3241 ? "f<FP:round>mul%.l %2,%0"
3242 : "f<FP:round_mul>mul%.l %2,%0";
3245 (define_insn "mul<mode>3_floathi_68881"
3246 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3247 (mult:FP (float:FP (match_operand:HI 2 "general_operand" "dmn"))
3248 (match_operand:FP 1 "general_operand" "0")))]
3252 ? "f<FP:round>mul%.w %2,%0"
3253 : "f<FP:round_mul>mul%.w %2,%0";
3256 (define_insn "mul<mode>3_floatqi_68881"
3257 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3258 (mult:FP (float:FP (match_operand:QI 2 "general_operand" "dmn"))
3259 (match_operand:FP 1 "general_operand" "0")))]
3263 ? "f<FP:round>mul%.b %2,%0"
3264 : "f<FP:round_mul>mul%.b %2,%0";
3267 (define_insn "muldf_68881"
3268 [(set (match_operand:DF 0 "nonimmediate_operand" "=f")
3269 (mult:DF (match_operand:DF 1 "general_operand" "%0")
3270 (match_operand:DF 2 "general_operand" "fmG")))]
3273 if (GET_CODE (operands[2]) == CONST_DOUBLE
3274 && floating_exact_log2 (operands[2]) && !TUNE_68040_60)
3276 int i = floating_exact_log2 (operands[2]);
3277 operands[2] = GEN_INT (i);
3278 return "fscale%.l %2,%0";
3280 if (REG_P (operands[2]))
3281 return "f%&mul%.x %2,%0";
3282 return "f%&mul%.d %f2,%0";
3285 (define_insn "mulsf_68881"
3286 [(set (match_operand:SF 0 "nonimmediate_operand" "=f")
3287 (mult:SF (match_operand:SF 1 "general_operand" "%0")
3288 (match_operand:SF 2 "general_operand" "fdmF")))]
3291 if (FP_REG_P (operands[2]))
3292 return (TARGET_68040
3294 : "fsglmul%.x %2,%0");
3295 return (TARGET_68040
3297 : "fsglmul%.s %f2,%0");
3300 (define_insn "mulxf3_68881"
3301 [(set (match_operand:XF 0 "nonimmediate_operand" "=f")
3302 (mult:XF (match_operand:XF 1 "nonimmediate_operand" "%0")
3303 (match_operand:XF 2 "nonimmediate_operand" "fm")))]
3306 return "fmul%.x %f2,%0";
3309 (define_insn "fmul<mode>3_cf"
3310 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3311 (mult:FP (match_operand:FP 1 "general_operand" "%0")
3312 (match_operand:FP 2 "general_operand" "f<Q>U<FP:dreg>")))]
3313 "TARGET_COLDFIRE_FPU"
3315 if (FP_REG_P (operands[2]))
3316 return "f<FP:prec>mul%.d %2,%0";
3317 return "f<FP:prec>mul%.<FP:prec> %2,%0";
3319 [(set_attr "type" "fmul")])
3321 ;; divide instructions
3323 (define_expand "div<mode>3"
3324 [(set (match_operand:FP 0 "nonimmediate_operand" "")
3325 (div:FP (match_operand:FP 1 "general_operand" "")
3326 (match_operand:FP 2 "general_operand" "")))]
3330 (define_insn "div<mode>3_floatsi_68881"
3331 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3332 (div:FP (match_operand:FP 1 "general_operand" "0")
3333 (float:FP (match_operand:SI 2 "general_operand" "dmi"))))]
3337 ? "f<FP:round>div%.l %2,%0"
3338 : "f<FP:round_mul>div%.l %2,%0";
3341 (define_insn "div<mode>3_floathi_68881"
3342 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3343 (div:FP (match_operand:FP 1 "general_operand" "0")
3344 (float:FP (match_operand:HI 2 "general_operand" "dmn"))))]
3348 ? "f<FP:round>div%.w %2,%0"
3349 : "f<FP:round_mul>div%.w %2,%0";
3352 (define_insn "div<mode>3_floatqi_68881"
3353 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3354 (div:FP (match_operand:FP 1 "general_operand" "0")
3355 (float:FP (match_operand:QI 2 "general_operand" "dmn"))))]
3359 ? "f<FP:round>div%.b %2,%0"
3360 : "f<FP:round_mul>div%.b %2,%0";
3363 (define_insn "div<mode>3_68881"
3364 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3365 (div:FP (match_operand:FP 1 "general_operand" "0")
3366 (match_operand:FP 2 "general_operand" "f<FP:dreg>m<FP:const>")))]
3369 if (FP_REG_P (operands[2]))
3370 return (TARGET_68040
3371 ? "f<FP:round>div%.x %2,%0"
3372 : "f<FP:round_mul>div%.x %2,%0");
3373 return (TARGET_68040
3374 ? "f<FP:round>div%.<FP:prec> %f2,%0"
3375 : "f<FP:round_mul>div%.<FP:prec> %f2,%0");
3378 (define_insn "div<mode>3_cf"
3379 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
3380 (div:FP (match_operand:FP 1 "general_operand" "0")
3381 (match_operand:FP 2 "general_operand" "f<Q>U<FP:dreg>")))]
3382 "TARGET_COLDFIRE_FPU"
3384 if (FP_REG_P (operands[2]))
3385 return "f<FP:prec>div%.d %2,%0";
3386 return "f<FP:prec>div%.<FP:prec> %2,%0";
3388 [(set_attr "type" "fdiv")])
3390 ;; Remainder instructions.
3392 (define_expand "divmodsi4"
3394 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3395 (div:SI (match_operand:SI 1 "general_operand" "")
3396 (match_operand:SI 2 "general_src_operand" "")))
3397 (set (match_operand:SI 3 "nonimmediate_operand" "")
3398 (mod:SI (match_dup 1) (match_dup 2)))])]
3399 "TARGET_68020 || TARGET_CF_HWDIV"
3403 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3404 (div:SI (match_operand:SI 1 "general_operand" "0")
3405 (match_operand:SI 2 "general_src_operand" "d<Q>U")))
3406 (set (match_operand:SI 3 "nonimmediate_operand" "=&d")
3407 (mod:SI (match_dup 1) (match_dup 2)))]
3410 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3411 return "divs%.l %2,%0";
3412 else if (find_reg_note (insn, REG_UNUSED, operands[0]))
3413 return "rems%.l %2,%3:%0";
3415 return "rems%.l %2,%3:%0\;divs%.l %2,%0";
3419 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3420 (div:SI (match_operand:SI 1 "general_operand" "0")
3421 (match_operand:SI 2 "general_src_operand" "dmSTK")))
3422 (set (match_operand:SI 3 "nonimmediate_operand" "=d")
3423 (mod:SI (match_dup 1) (match_dup 2)))]
3426 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3427 return "divs%.l %2,%0";
3429 return "divsl%.l %2,%3:%0";
3432 (define_expand "udivmodsi4"
3434 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3435 (udiv:SI (match_operand:SI 1 "general_operand" "0")
3436 (match_operand:SI 2 "general_src_operand" "dmSTK")))
3437 (set (match_operand:SI 3 "nonimmediate_operand" "=d")
3438 (umod:SI (match_dup 1) (match_dup 2)))])]
3439 "TARGET_68020 || TARGET_CF_HWDIV"
3443 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3444 (udiv:SI (match_operand:SI 1 "general_operand" "0")
3445 (match_operand:SI 2 "general_src_operand" "d<Q>U")))
3446 (set (match_operand:SI 3 "nonimmediate_operand" "=&d")
3447 (umod:SI (match_dup 1) (match_dup 2)))]
3450 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3451 return "divu%.l %2,%0";
3452 else if (find_reg_note (insn, REG_UNUSED, operands[0]))
3453 return "remu%.l %2,%3:%0";
3455 return "remu%.l %2,%3:%0\;divu%.l %2,%0";
3459 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
3460 (udiv:SI (match_operand:SI 1 "general_operand" "0")
3461 (match_operand:SI 2 "general_src_operand" "dmSTK")))
3462 (set (match_operand:SI 3 "nonimmediate_operand" "=d")
3463 (umod:SI (match_dup 1) (match_dup 2)))]
3464 "TARGET_68020 && !TARGET_COLDFIRE"
3466 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3467 return "divu%.l %2,%0";
3469 return "divul%.l %2,%3:%0";
3472 (define_insn "divmodhi4"
3473 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
3474 (div:HI (match_operand:HI 1 "general_operand" "0")
3475 (match_operand:HI 2 "general_src_operand" "dmSKT")))
3476 (set (match_operand:HI 3 "nonimmediate_operand" "=d")
3477 (mod:HI (match_dup 1) (match_dup 2)))]
3478 "!TARGET_COLDFIRE || TARGET_CF_HWDIV"
3480 output_asm_insn (MOTOROLA ?
3481 "ext%.l %0\;divs%.w %2,%0" :
3482 "extl %0\;divs %2,%0",
3484 if (!find_reg_note(insn, REG_UNUSED, operands[3]))
3487 return "move%.l %0,%3\;swap %3";
3493 (define_insn "udivmodhi4"
3494 [(set (match_operand:HI 0 "nonimmediate_operand" "=d")
3495 (udiv:HI (match_operand:HI 1 "general_operand" "0")
3496 (match_operand:HI 2 "general_src_operand" "dmSKT")))
3497 (set (match_operand:HI 3 "nonimmediate_operand" "=d")
3498 (umod:HI (match_dup 1) (match_dup 2)))]
3499 "!TARGET_COLDFIRE || TARGET_CF_HWDIV"
3501 if (ISA_HAS_MVS_MVZ)
3502 output_asm_insn (MOTOROLA ?
3503 "mvz%.w %0,%0\;divu%.w %2,%0" :
3504 "mvz%.w %0,%0\;divu %2,%0",
3507 output_asm_insn (MOTOROLA ?
3508 "and%.l #0xFFFF,%0\;divu%.w %2,%0" :
3509 "and%.l #0xFFFF,%0\;divu %2,%0",
3512 if (!find_reg_note(insn, REG_UNUSED, operands[3]))
3515 return "move%.l %0,%3\;swap %3";
3521 ;; logical-and instructions
3523 ;; "anddi3" is mainly here to help combine().
3524 (define_insn "anddi3"
3525 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,d")
3526 (and:DI (match_operand:DI 1 "general_operand" "%0,0")
3527 (match_operand:DI 2 "general_operand" "dn,don")))]
3531 /* We can get CONST_DOUBLE, but also const1_rtx etc. */
3532 if (CONSTANT_P (operands[2]))
3536 split_double (operands[2], &hi, &lo);
3538 switch (INTVAL (hi))
3541 output_asm_insn ("clr%.l %0", operands);
3549 xoperands[0] = operands[0];
3551 output_asm_insn (output_andsi3 (xoperands), xoperands);
3554 if (GET_CODE (operands[0]) == REG)
3555 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3557 operands[0] = adjust_address (operands[0], SImode, 4);
3558 switch (INTVAL (lo))
3561 output_asm_insn ("clr%.l %0", operands);
3569 xoperands[0] = operands[0];
3571 output_asm_insn (output_andsi3 (xoperands), xoperands);
3576 if (GET_CODE (operands[0]) != REG)
3578 operands[1] = adjust_address (operands[0], SImode, 4);
3579 return "and%.l %2,%0\;and%.l %R2,%1";
3581 if (GET_CODE (operands[2]) != REG)
3583 operands[1] = adjust_address (operands[2], SImode, 4);
3584 return "and%.l %2,%0\;and%.l %1,%R0";
3586 return "and%.l %2,%0\;and%.l %R2,%R0";
3589 ;; Prevent AND from being made with sp. This doesn't exist in the machine
3590 ;; and reload will cause inefficient code. Since sp is a FIXED_REG, we
3591 ;; can't allocate pseudos into it.
3593 (define_expand "andsi3"
3594 [(set (match_operand:SI 0 "not_sp_operand" "")
3595 (and:SI (match_operand:SI 1 "general_operand" "")
3596 (match_operand:SI 2 "general_src_operand" "")))]
3600 ;; produced by split operations after reload finished
3601 (define_insn "*andsi3_split"
3602 [(set (match_operand:SI 0 "register_operand" "=d")
3603 (and:SI (match_operand:SI 1 "register_operand" "0")
3604 (match_operand:SI 2 "const_int_operand" "i")))]
3605 "reload_completed && !TARGET_COLDFIRE"
3607 return output_andsi3 (operands);
3610 (define_insn "andsi3_internal"
3611 [(set (match_operand:SI 0 "not_sp_operand" "=m,d")
3612 (and:SI (match_operand:SI 1 "general_operand" "%0,0")
3613 (match_operand:SI 2 "general_src_operand" "dKT,dmSM")))]
3616 return output_andsi3 (operands);
3619 (define_insn "andsi3_5200"
3620 [(set (match_operand:SI 0 "not_sp_operand" "=m,d")
3621 (and:SI (match_operand:SI 1 "general_operand" "%0,0")
3622 (match_operand:SI 2 "general_src_operand" "d,dmsK")))]
3626 && DATA_REG_P (operands[0])
3627 && GET_CODE (operands[2]) == CONST_INT)
3629 if (INTVAL (operands[2]) == 0x000000ff)
3630 return "mvz%.b %0,%0";
3631 else if (INTVAL (operands[2]) == 0x0000ffff)
3632 return "mvz%.w %0,%0";
3634 return output_andsi3 (operands);
3637 (define_insn "andhi3"
3638 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,d")
3639 (and:HI (match_operand:HI 1 "general_operand" "%0,0")
3640 (match_operand:HI 2 "general_src_operand" "dn,dmSn")))]
3645 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3646 (and:HI (match_dup 0)
3647 (match_operand:HI 1 "general_src_operand" "dn,dmSn")))]
3652 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3653 (and:HI (match_operand:HI 1 "general_src_operand" "dn,dmSn")
3658 (define_insn "andqi3"
3659 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
3660 (and:QI (match_operand:QI 1 "general_operand" "%0,0")
3661 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
3666 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3667 (and:QI (match_dup 0)
3668 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
3673 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3674 (and:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn")
3679 ;; inclusive-or instructions
3681 (define_insn "iordi_zext"
3682 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,d")
3683 (ior:DI (zero_extend:DI (match_operand 1 "general_operand" "dn,dmn"))
3684 (match_operand:DI 2 "general_operand" "0,0")))]
3690 if (GET_CODE (operands[0]) == REG)
3691 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3693 operands[0] = adjust_address (operands[0], SImode, 4);
3694 if (GET_MODE (operands[1]) == SImode)
3695 return "or%.l %1,%0";
3696 byte_mode = (GET_MODE (operands[1]) == QImode);
3697 if (GET_CODE (operands[0]) == MEM)
3698 operands[0] = adjust_address (operands[0], byte_mode ? QImode : HImode,
3701 return "or%.b %1,%0";
3703 return "or%.w %1,%0";
3706 ;; "iordi3" is mainly here to help combine().
3707 (define_insn "iordi3"
3708 [(set (match_operand:DI 0 "nonimmediate_operand" "=o,d")
3709 (ior:DI (match_operand:DI 1 "general_operand" "%0,0")
3710 (match_operand:DI 2 "general_operand" "dn,don")))]
3714 /* We can get CONST_DOUBLE, but also const1_rtx etc. */
3715 if (CONSTANT_P (operands[2]))
3719 split_double (operands[2], &hi, &lo);
3721 switch (INTVAL (hi))
3726 /* FIXME : a scratch register would be welcome here if operand[0]
3727 is not a register */
3728 output_asm_insn ("move%.l #-1,%0", operands);
3734 xoperands[0] = operands[0];
3736 output_asm_insn (output_iorsi3 (xoperands), xoperands);
3739 if (GET_CODE (operands[0]) == REG)
3740 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3742 operands[0] = adjust_address (operands[0], SImode, 4);
3743 switch (INTVAL (lo))
3748 /* FIXME : a scratch register would be welcome here if operand[0]
3749 is not a register */
3750 output_asm_insn ("move%.l #-1,%0", operands);
3756 xoperands[0] = operands[0];
3758 output_asm_insn (output_iorsi3 (xoperands), xoperands);
3763 if (GET_CODE (operands[0]) != REG)
3765 operands[1] = adjust_address (operands[0], SImode, 4);
3766 return "or%.l %2,%0\;or%.l %R2,%1";
3768 if (GET_CODE (operands[2]) != REG)
3770 operands[1] = adjust_address (operands[2], SImode, 4);
3771 return "or%.l %2,%0\;or%.l %1,%R0";
3773 return "or%.l %2,%0\;or%.l %R2,%R0";
3776 (define_expand "iorsi3"
3777 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3778 (ior:SI (match_operand:SI 1 "general_operand" "")
3779 (match_operand:SI 2 "general_src_operand" "")))]
3783 (define_insn "iorsi3_internal"
3784 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,d")
3785 (ior:SI (match_operand:SI 1 "general_operand" "%0,0")
3786 (match_operand:SI 2 "general_src_operand" "dKT,dmSMT")))]
3789 return output_iorsi3 (operands);
3792 (define_insn "iorsi3_5200"
3793 [(set (match_operand:SI 0 "nonimmediate_operand" "=m,d")
3794 (ior:SI (match_operand:SI 1 "general_operand" "%0,0")
3795 (match_operand:SI 2 "general_src_operand" "d,dmsK")))]
3798 return output_iorsi3 (operands);
3801 (define_insn "iorhi3"
3802 [(set (match_operand:HI 0 "nonimmediate_operand" "=m,d")
3803 (ior:HI (match_operand:HI 1 "general_operand" "%0,0")
3804 (match_operand:HI 2 "general_src_operand" "dn,dmSn")))]
3809 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3810 (ior:HI (match_dup 0)
3811 (match_operand:HI 1 "general_src_operand" "dn,dmSn")))]
3816 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+m,d"))
3817 (ior:HI (match_operand:HI 1 "general_src_operand" "dn,dmSn")
3822 (define_insn "iorqi3"
3823 [(set (match_operand:QI 0 "nonimmediate_operand" "=m,d")
3824 (ior:QI (match_operand:QI 1 "general_operand" "%0,0")
3825 (match_operand:QI 2 "general_src_operand" "dn,dmSn")))]
3830 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3831 (ior:QI (match_dup 0)
3832 (match_operand:QI 1 "general_src_operand" "dn,dmSn")))]
3837 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+m,d"))
3838 (ior:QI (match_operand:QI 1 "general_src_operand" "dn,dmSn")
3843 ;; On all 68k models, this makes faster code in a special case.
3844 ;; See also ashlsi_16, ashrsi_16 and lshrsi_16.
3846 (define_insn "iorsi_zexthi_ashl16"
3847 [(set (match_operand:SI 0 "nonimmediate_operand" "=&d")
3848 (ior:SI (zero_extend:SI (match_operand:HI 1 "general_operand" "rmn"))
3849 (ashift:SI (match_operand:SI 2 "general_operand" "or")
3854 if (GET_CODE (operands[2]) != REG)
3855 operands[2] = adjust_address (operands[2], HImode, 2);
3856 if (GET_CODE (operands[2]) != REG
3857 || REGNO (operands[2]) != REGNO (operands[0]))
3858 output_asm_insn ("move%.w %2,%0", operands);
3859 return "swap %0\;mov%.w %1,%0";
3862 (define_insn "iorsi_zext"
3863 [(set (match_operand:SI 0 "nonimmediate_operand" "=o,d")
3864 (ior:SI (zero_extend:SI (match_operand 1 "general_operand" "dn,dmn"))
3865 (match_operand:SI 2 "general_operand" "0,0")))]
3871 byte_mode = (GET_MODE (operands[1]) == QImode);
3872 if (GET_CODE (operands[0]) == MEM)
3873 operands[0] = adjust_address (operands[0], byte_mode ? QImode : HImode,
3876 return "or%.b %1,%0";
3878 return "or%.w %1,%0";
3883 ;; "xordi3" is mainly here to help combine().
3884 (define_insn "xordi3"
3885 [(set (match_operand:DI 0 "nonimmediate_operand" "=od")
3886 (xor:DI (match_operand:DI 1 "general_operand" "%0")
3887 (match_operand:DI 2 "general_operand" "dn")))]
3891 /* We can get CONST_DOUBLE, but also const1_rtx etc. */
3893 if (CONSTANT_P (operands[2]))
3897 split_double (operands[2], &hi, &lo);
3899 switch (INTVAL (hi))
3904 output_asm_insn ("not%.l %0", operands);
3907 /* FIXME : a scratch register would be welcome here if
3908 -128 <= INTVAL (hi) < -1 */
3912 xoperands[0] = operands[0];
3914 output_asm_insn (output_xorsi3 (xoperands), xoperands);
3917 if (GET_CODE (operands[0]) == REG)
3918 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
3920 operands[0] = adjust_address (operands[0], SImode, 4);
3921 switch (INTVAL (lo))
3926 output_asm_insn ("not%.l %0", operands);
3929 /* FIXME : a scratch register would be welcome here if
3930 -128 <= INTVAL (lo) < -1 */
3932 /* FIXME : this should be merged with xorsi3 */
3936 xoperands[0] = operands[0];
3938 output_asm_insn (output_xorsi3 (xoperands), xoperands);
3943 if (GET_CODE (operands[0]) != REG)
3945 operands[1] = adjust_address (operands[0], SImode, 4);
3946 return "eor%.l %2,%0\;eor%.l %R2,%1";
3948 if (GET_CODE (operands[2]) != REG)
3950 operands[1] = adjust_address (operands[2], SImode, 4);
3951 return "eor%.l %2,%0\;eor%.l %1,%R0";
3953 return "eor%.l %2,%0\;eor%.l %R2,%R0";
3956 (define_expand "xorsi3"
3957 [(set (match_operand:SI 0 "nonimmediate_operand" "")
3958 (xor:SI (match_operand:SI 1 "general_operand" "")
3959 (match_operand:SI 2 "general_operand" "")))]
3963 (define_insn "xorsi3_internal"
3964 [(set (match_operand:SI 0 "nonimmediate_operand" "=do,m")
3965 (xor:SI (match_operand:SI 1 "general_operand" "%0,0")
3966 (match_operand:SI 2 "general_operand" "di,dKT")))]
3970 return output_xorsi3 (operands);
3973 (define_insn "xorsi3_5200"
3974 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm,d")
3975 (xor:SI (match_operand:SI 1 "general_operand" "%0,0")
3976 (match_operand:SI 2 "general_operand" "d,Ks")))]
3979 return output_xorsi3 (operands);
3982 (define_insn "xorhi3"
3983 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
3984 (xor:HI (match_operand:HI 1 "general_operand" "%0")
3985 (match_operand:HI 2 "general_operand" "dn")))]
3990 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
3991 (xor:HI (match_dup 0)
3992 (match_operand:HI 1 "general_operand" "dn")))]
3997 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
3998 (xor:HI (match_operand:HI 1 "general_operand" "dn")
4003 (define_insn "xorqi3"
4004 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
4005 (xor:QI (match_operand:QI 1 "general_operand" "%0")
4006 (match_operand:QI 2 "general_operand" "dn")))]
4011 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
4012 (xor:QI (match_dup 0)
4013 (match_operand:QI 1 "general_operand" "dn")))]
4018 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
4019 (xor:QI (match_operand:QI 1 "general_operand" "dn")
4024 ;; negation instructions
4026 (define_expand "negdi2"
4027 [(set (match_operand:DI 0 "nonimmediate_operand" "")
4028 (neg:DI (match_operand:DI 1 "general_operand" "")))]
4031 if (TARGET_COLDFIRE)
4032 emit_insn (gen_negdi2_5200 (operands[0], operands[1]));
4034 emit_insn (gen_negdi2_internal (operands[0], operands[1]));
4038 (define_insn "negdi2_internal"
4039 [(set (match_operand:DI 0 "nonimmediate_operand" "=<,do,!*a")
4040 (neg:DI (match_operand:DI 1 "general_operand" "0,0,0")))]
4043 if (which_alternative == 0)
4044 return "neg%.l %0\;negx%.l %0";
4045 if (GET_CODE (operands[0]) == REG)
4046 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4048 operands[1] = adjust_address (operands[0], SImode, 4);
4049 if (ADDRESS_REG_P (operands[0]))
4050 return "exg %/d0,%1\;neg%.l %/d0\;exg %/d0,%1\;exg %/d0,%0\;negx%.l %/d0\;exg %/d0,%0";
4052 return "neg%.l %1\;negx%.l %0";
4055 (define_insn "negdi2_5200"
4056 [(set (match_operand:DI 0 "nonimmediate_operand" "=d")
4057 (neg:DI (match_operand:DI 1 "general_operand" "0")))]
4060 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4061 return "neg%.l %1\;negx%.l %0";
4064 (define_expand "negsi2"
4065 [(set (match_operand:SI 0 "nonimmediate_operand" "")
4066 (neg:SI (match_operand:SI 1 "general_operand" "")))]
4069 if (TARGET_COLDFIRE)
4070 emit_insn (gen_negsi2_5200 (operands[0], operands[1]));
4072 emit_insn (gen_negsi2_internal (operands[0], operands[1]));
4076 (define_insn "negsi2_internal"
4077 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
4078 (neg:SI (match_operand:SI 1 "general_operand" "0")))]
4081 [(set_attr "type" "neg_l")])
4083 (define_insn "negsi2_5200"
4084 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
4085 (neg:SI (match_operand:SI 1 "general_operand" "0")))]
4088 [(set_attr "type" "neg_l")])
4090 (define_insn "neghi2"
4091 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
4092 (neg:HI (match_operand:HI 1 "general_operand" "0")))]
4097 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
4098 (neg:HI (match_dup 0)))]
4102 (define_insn "negqi2"
4103 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
4104 (neg:QI (match_operand:QI 1 "general_operand" "0")))]
4109 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
4110 (neg:QI (match_dup 0)))]
4114 ;; If using software floating point, just flip the sign bit.
4116 (define_expand "negsf2"
4117 [(set (match_operand:SF 0 "nonimmediate_operand" "")
4118 (neg:SF (match_operand:SF 1 "general_operand" "")))]
4121 if (!TARGET_HARD_FLOAT)
4126 target = operand_subword_force (operands[0], 0, SFmode);
4127 result = expand_binop (SImode, xor_optab,
4128 operand_subword_force (operands[1], 0, SFmode),
4129 GEN_INT (-2147483647 - 1), target, 0, OPTAB_WIDEN);
4130 gcc_assert (result);
4132 if (result != target)
4133 emit_move_insn (result, target);
4135 /* Make a place for REG_EQUAL. */
4136 emit_move_insn (operands[0], operands[0]);
4141 (define_expand "negdf2"
4142 [(set (match_operand:DF 0 "nonimmediate_operand" "")
4143 (neg:DF (match_operand:DF 1 "general_operand" "")))]
4146 if (!TARGET_HARD_FLOAT)
4153 target = operand_subword (operands[0], 0, 1, DFmode);
4154 result = expand_binop (SImode, xor_optab,
4155 operand_subword_force (operands[1], 0, DFmode),
4156 GEN_INT (-2147483647 - 1), target, 0, OPTAB_WIDEN);
4157 gcc_assert (result);
4159 if (result != target)
4160 emit_move_insn (result, target);
4162 emit_move_insn (operand_subword (operands[0], 1, 1, DFmode),
4163 operand_subword_force (operands[1], 1, DFmode));
4165 insns = get_insns ();
4168 emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
4173 (define_expand "negxf2"
4174 [(set (match_operand:XF 0 "nonimmediate_operand" "")
4175 (neg:XF (match_operand:XF 1 "nonimmediate_operand" "")))]
4185 target = operand_subword (operands[0], 0, 1, XFmode);
4186 result = expand_binop (SImode, xor_optab,
4187 operand_subword_force (operands[1], 0, XFmode),
4188 GEN_INT (-2147483647 - 1), target, 0, OPTAB_WIDEN);
4189 gcc_assert (result);
4191 if (result != target)
4192 emit_move_insn (result, target);
4194 emit_move_insn (operand_subword (operands[0], 1, 1, XFmode),
4195 operand_subword_force (operands[1], 1, XFmode));
4196 emit_move_insn (operand_subword (operands[0], 2, 1, XFmode),
4197 operand_subword_force (operands[1], 2, XFmode));
4199 insns = get_insns ();
4202 emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
4207 (define_insn "neg<mode>2_68881"
4208 [(set (match_operand:FP 0 "nonimmediate_operand" "=f,d")
4209 (neg:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m<FP:const>,0")))]
4212 if (DATA_REG_P (operands[0]))
4214 operands[1] = GEN_INT (31);
4215 return "bchg %1,%0";
4217 if (FP_REG_P (operands[1]))
4218 return "f<FP:round>neg%.x %1,%0";
4219 return "f<FP:round>neg%.<FP:prec> %f1,%0";
4222 (define_insn "neg<mode>2_cf"
4223 [(set (match_operand:FP 0 "nonimmediate_operand" "=f,d")
4224 (neg:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U,0")))]
4225 "TARGET_COLDFIRE_FPU"
4227 if (DATA_REG_P (operands[0]))
4229 operands[1] = GEN_INT (31);
4230 return "bchg %1,%0";
4232 if (FP_REG_P (operands[1]))
4233 return "f<FP:prec>neg%.d %1,%0";
4234 return "f<FP:prec>neg%.<FP:prec> %1,%0";
4237 ;; Sqrt instruction for the 68881
4239 (define_expand "sqrt<mode>2"
4240 [(set (match_operand:FP 0 "nonimmediate_operand" "")
4241 (sqrt:FP (match_operand:FP 1 "general_operand" "")))]
4245 (define_insn "sqrt<mode>2_68881"
4246 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
4247 (sqrt:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m")))]
4250 if (FP_REG_P (operands[1]))
4251 return "f<FP:round>sqrt%.x %1,%0";
4252 return "f<FP:round>sqrt%.<FP:prec> %1,%0";
4254 [(set_attr "type" "fsqrt")])
4256 (define_insn "sqrt<mode>2_cf"
4257 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
4258 (sqrt:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U")))]
4259 "TARGET_COLDFIRE_FPU"
4261 if (FP_REG_P (operands[1]))
4262 return "f<FP:prec>sqrt%.d %1,%0";
4263 return "f<FP:prec>sqrt%.<FP:prec> %1,%0";
4265 ;; Absolute value instructions
4266 ;; If using software floating point, just zero the sign bit.
4268 (define_expand "abssf2"
4269 [(set (match_operand:SF 0 "nonimmediate_operand" "")
4270 (abs:SF (match_operand:SF 1 "general_operand" "")))]
4273 if (!TARGET_HARD_FLOAT)
4278 target = operand_subword_force (operands[0], 0, SFmode);
4279 result = expand_binop (SImode, and_optab,
4280 operand_subword_force (operands[1], 0, SFmode),
4281 GEN_INT (0x7fffffff), target, 0, OPTAB_WIDEN);
4282 gcc_assert (result);
4284 if (result != target)
4285 emit_move_insn (result, target);
4287 /* Make a place for REG_EQUAL. */
4288 emit_move_insn (operands[0], operands[0]);
4293 (define_expand "absdf2"
4294 [(set (match_operand:DF 0 "nonimmediate_operand" "")
4295 (abs:DF (match_operand:DF 1 "general_operand" "")))]
4298 if (!TARGET_HARD_FLOAT)
4305 target = operand_subword (operands[0], 0, 1, DFmode);
4306 result = expand_binop (SImode, and_optab,
4307 operand_subword_force (operands[1], 0, DFmode),
4308 GEN_INT (0x7fffffff), target, 0, OPTAB_WIDEN);
4309 gcc_assert (result);
4311 if (result != target)
4312 emit_move_insn (result, target);
4314 emit_move_insn (operand_subword (operands[0], 1, 1, DFmode),
4315 operand_subword_force (operands[1], 1, DFmode));
4317 insns = get_insns ();
4320 emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
4325 (define_expand "absxf2"
4326 [(set (match_operand:XF 0 "nonimmediate_operand" "")
4327 (abs:XF (match_operand:XF 1 "nonimmediate_operand" "")))]
4337 target = operand_subword (operands[0], 0, 1, XFmode);
4338 result = expand_binop (SImode, and_optab,
4339 operand_subword_force (operands[1], 0, XFmode),
4340 GEN_INT (0x7fffffff), target, 0, OPTAB_WIDEN);
4341 gcc_assert (result);
4343 if (result != target)
4344 emit_move_insn (result, target);
4346 emit_move_insn (operand_subword (operands[0], 1, 1, XFmode),
4347 operand_subword_force (operands[1], 1, XFmode));
4348 emit_move_insn (operand_subword (operands[0], 2, 1, XFmode),
4349 operand_subword_force (operands[1], 2, XFmode));
4351 insns = get_insns ();
4354 emit_no_conflict_block (insns, operands[0], operands[1], 0, 0);
4359 (define_insn "abs<mode>2_68881"
4360 [(set (match_operand:FP 0 "nonimmediate_operand" "=f,d")
4361 (abs:FP (match_operand:FP 1 "general_operand" "f<FP:dreg>m<FP:const>,0")))]
4364 if (DATA_REG_P (operands[0]))
4366 operands[1] = GEN_INT (31);
4367 return "bclr %1,%0";
4369 if (FP_REG_P (operands[1]))
4370 return "f<FP:round>abs%.x %1,%0";
4371 return "f<FP:round>abs%.<FP:prec> %f1,%0";
4374 (define_insn "abs<mode>2_cf"
4375 [(set (match_operand:FP 0 "nonimmediate_operand" "=f,d")
4376 (abs:FP (match_operand:FP 1 "general_operand" "f<FP:dreg><Q>U,0")))]
4377 "TARGET_COLDFIRE_FPU"
4379 if (DATA_REG_P (operands[0]))
4381 operands[1] = GEN_INT (31);
4382 return "bclr %1,%0";
4384 if (FP_REG_P (operands[1]))
4385 return "f<FP:prec>abs%.d %1,%0";
4386 return "f<FP:prec>abs%.<FP:prec> %1,%0";
4389 ;; bit indexing instructions
4391 ;; ColdFire ff1 instruction implements clz.
4392 (define_insn "clzsi2"
4393 [(set (match_operand:SI 0 "register_operand" "=d")
4394 (clz:SI (match_operand:SI 1 "register_operand" "0")))]
4397 [(set_attr "type" "ff1")])
4399 ;; one complement instructions
4401 ;; "one_cmpldi2" is mainly here to help combine().
4402 (define_insn "one_cmpldi2"
4403 [(set (match_operand:DI 0 "nonimmediate_operand" "=dm")
4404 (not:DI (match_operand:DI 1 "general_operand" "0")))]
4408 if (GET_CODE (operands[0]) == REG)
4409 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4410 else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC
4411 || GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
4412 operands[1] = operands[0];
4414 operands[1] = adjust_address (operands[0], SImode, 4);
4415 return "not%.l %1\;not%.l %0";
4418 (define_expand "one_cmplsi2"
4419 [(set (match_operand:SI 0 "nonimmediate_operand" "")
4420 (not:SI (match_operand:SI 1 "general_operand" "")))]
4423 if (TARGET_COLDFIRE)
4424 emit_insn (gen_one_cmplsi2_5200 (operands[0], operands[1]));
4426 emit_insn (gen_one_cmplsi2_internal (operands[0], operands[1]));
4430 (define_insn "one_cmplsi2_internal"
4431 [(set (match_operand:SI 0 "nonimmediate_operand" "=dm")
4432 (not:SI (match_operand:SI 1 "general_operand" "0")))]
4436 (define_insn "one_cmplsi2_5200"
4437 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
4438 (not:SI (match_operand:SI 1 "general_operand" "0")))]
4441 [(set_attr "type" "not_l")])
4443 (define_insn "one_cmplhi2"
4444 [(set (match_operand:HI 0 "nonimmediate_operand" "=dm")
4445 (not:HI (match_operand:HI 1 "general_operand" "0")))]
4450 [(set (strict_low_part (match_operand:HI 0 "nonimmediate_operand" "+dm"))
4451 (not:HI (match_dup 0)))]
4455 (define_insn "one_cmplqi2"
4456 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
4457 (not:QI (match_operand:QI 1 "general_operand" "0")))]
4462 [(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+dm"))
4463 (not:QI (match_dup 0)))]
4467 ;; arithmetic shift instructions
4468 ;; We don't need the shift memory by 1 bit instruction
4470 (define_insn "ashldi_extsi"
4471 [(set (match_operand:DI 0 "nonimmediate_operand" "=ro")
4473 (match_operator:DI 2 "extend_operator"
4474 [(match_operand:SI 1 "general_operand" "rm")])
4479 if (GET_CODE (operands[0]) == REG)
4480 operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4482 operands[2] = adjust_address (operands[0], SImode, 4);
4483 if (ADDRESS_REG_P (operands[0]))
4484 return "move%.l %1,%0\;sub%.l %2,%2";
4486 return "move%.l %1,%0\;clr%.l %2";
4489 (define_insn "ashldi_sexthi"
4490 [(set (match_operand:DI 0 "nonimmediate_operand" "=m,a*d")
4491 (ashift:DI (sign_extend:DI (match_operand:HI 1 "general_operand" "rm,rm"))
4493 (clobber (match_scratch:SI 2 "=a,X"))]
4497 if (GET_CODE (operands[0]) == MEM)
4499 if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
4500 return "clr%.l %0\;move%.w %1,%2\;move%.l %2,%0";
4501 else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
4502 return "move%.w %1,%2\;move%.l %2,%0\;clr%.l %0";
4505 operands[3] = adjust_address (operands[0], SImode, 4);
4506 return "move%.w %1,%2\;move%.l %2,%0\;clr%.l %3";
4509 else if (DATA_REG_P (operands[0]))
4510 return "move%.w %1,%0\;ext%.l %0\;clr%.l %R0";
4512 return "move%.w %1,%0\;sub%.l %R0,%R0";
4515 (define_insn "*ashldi3_const1"
4516 [(set (match_operand:DI 0 "register_operand" "=d")
4517 (ashift:DI (match_operand:DI 1 "register_operand" "0")
4520 "add%.l %R0,%R0\;addx%.l %0,%0")
4523 [(set (match_operand:DI 0 "register_operand" "")
4524 (ashift:DI (match_operand:DI 1 "register_operand" "")
4526 "reload_completed && !TARGET_COLDFIRE"
4528 (ashift:DI (match_dup 1) (const_int 1)))
4530 (ashift:DI (match_dup 0) (const_int 1)))]
4534 [(set (match_operand:DI 0 "register_operand" "")
4535 (ashift:DI (match_operand:DI 1 "register_operand" "")
4537 "reload_completed && !TARGET_COLDFIRE"
4539 (ashift:DI (match_dup 1) (const_int 2)))
4541 (ashift:DI (match_dup 0) (const_int 1)))]
4545 [(set (match_operand:DI 0 "register_operand" "")
4546 (ashift:DI (match_operand:DI 1 "register_operand" "")
4548 "reload_completed && !TARGET_COLDFIRE"
4550 (rotate:SI (match_dup 2) (const_int 8)))
4552 (rotate:SI (match_dup 3) (const_int 8)))
4553 (set (strict_low_part (subreg:QI (match_dup 0) 3))
4554 (subreg:QI (match_dup 0) 7))
4555 (set (strict_low_part (subreg:QI (match_dup 0) 7))
4558 operands[2] = gen_highpart (SImode, operands[0]);
4559 operands[3] = gen_lowpart (SImode, operands[0]);
4563 [(set (match_operand:DI 0 "register_operand" "")
4564 (ashift:DI (match_operand:DI 1 "register_operand" "")
4566 "reload_completed && !TARGET_COLDFIRE"
4568 (rotate:SI (match_dup 2) (const_int 16)))
4570 (rotate:SI (match_dup 3) (const_int 16)))
4571 (set (strict_low_part (subreg:HI (match_dup 0) 2))
4572 (subreg:HI (match_dup 0) 6))
4573 (set (strict_low_part (subreg:HI (match_dup 0) 6))
4576 operands[2] = gen_highpart (SImode, operands[0]);
4577 operands[3] = gen_lowpart (SImode, operands[0]);
4581 [(set (match_operand:DI 0 "pre_dec_operand" "")
4582 (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "")
4585 [(set (match_dup 0) (const_int 0))
4586 (set (match_dup 0) (match_dup 1))]
4588 operands[0] = adjust_address(operands[0], SImode, 0);
4589 operands[1] = gen_lowpart(SImode, operands[1]);
4593 [(set (match_operand:DI 0 "post_inc_operand" "")
4594 (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "")
4597 [(set (match_dup 0) (match_dup 1))
4598 (set (match_dup 0) (const_int 0))]
4600 operands[0] = adjust_address(operands[0], SImode, 0);
4601 operands[1] = gen_lowpart(SImode, operands[1]);
4604 (define_insn_and_split "*ashldi3_const32"
4605 [(set (match_operand:DI 0 "nonimmediate_operand" "=ro<>")
4606 (ashift:DI (match_operand:DI 1 "nonimmediate_operand" "ro")
4610 "&& reload_completed"
4611 [(set (match_dup 4) (match_dup 3))
4612 (set (match_dup 2) (const_int 0))]
4613 "split_di(operands, 2, operands + 2, operands + 4);")
4616 [(set (match_operand:DI 0 "register_operand" "")
4617 (ashift:DI (match_operand:DI 1 "register_operand" "")
4618 (match_operand 2 "const_int_operand" "")))]
4619 "reload_completed && !TARGET_COLDFIRE
4620 && INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 40"
4621 [(set (match_dup 4) (ashift:SI (match_dup 4) (match_dup 2)))
4622 (set (match_dup 3) (match_dup 4))
4623 (set (match_dup 4) (const_int 0))]
4625 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
4626 operands[3] = gen_highpart (SImode, operands[0]);
4627 operands[4] = gen_lowpart (SImode, operands[0]);
4631 [(set (match_operand:DI 0 "register_operand" "")
4632 (ashift:DI (match_operand:DI 1 "register_operand" "")
4634 "reload_completed && !TARGET_COLDFIRE"
4635 [(set (match_dup 2) (match_dup 3))
4637 (rotate:SI (match_dup 2) (const_int 16)))
4638 (set (match_dup 3) (const_int 0))
4639 (set (strict_low_part (subreg:HI (match_dup 0) 2))
4642 operands[2] = gen_highpart (SImode, operands[0]);
4643 operands[3] = gen_lowpart (SImode, operands[0]);
4647 [(set (match_operand:DI 0 "register_operand" "")
4648 (ashift:DI (match_operand:DI 1 "register_operand" "")
4649 (match_operand 2 "const_int_operand" "")))]
4650 "reload_completed && !TARGET_COLDFIRE
4651 && INTVAL (operands[2]) > 40 && INTVAL (operands[2]) <= 63"
4652 [(set (match_dup 3) (match_dup 2))
4653 (set (match_dup 4) (ashift:SI (match_dup 4) (match_dup 3)))
4654 (set (match_dup 3) (match_dup 4))
4655 (set (match_dup 4) (const_int 0))]
4657 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
4658 operands[3] = gen_highpart (SImode, operands[0]);
4659 operands[4] = gen_lowpart (SImode, operands[0]);
4662 (define_insn "*ashldi3"
4663 [(set (match_operand:DI 0 "register_operand" "=d")
4664 (ashift:DI (match_operand:DI 1 "register_operand" "0")
4665 (match_operand 2 "const_int_operand" "n")))]
4667 && ((INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3)
4668 || INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16
4669 || (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63))"
4672 (define_expand "ashldi3"
4673 [(set (match_operand:DI 0 "register_operand" "")
4674 (ashift:DI (match_operand:DI 1 "register_operand" "")
4675 (match_operand 2 "const_int_operand" "")))]
4678 /* ??? This is a named pattern like this is not allowed to FAIL based
4680 if (GET_CODE (operands[2]) != CONST_INT
4681 || ((INTVAL (operands[2]) < 1 || INTVAL (operands[2]) > 3)
4682 && INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16
4683 && (INTVAL (operands[2]) < 32 || INTVAL (operands[2]) > 63)))
4687 ;; On most 68k models, this makes faster code in a special case.
4689 (define_insn "ashlsi_16"
4690 [(set (match_operand:SI 0 "register_operand" "=d")
4691 (ashift:SI (match_operand:SI 1 "register_operand" "0")
4696 return "swap %0\;clr%.w %0";
4699 ;; ashift patterns : use lsl instead of asl, because lsl always clears the
4700 ;; overflow bit, so we must not set CC_NO_OVERFLOW.
4702 ;; On the 68000, this makes faster code in a special case.
4704 (define_insn "ashlsi_17_24"
4705 [(set (match_operand:SI 0 "register_operand" "=d")
4706 (ashift:SI (match_operand:SI 1 "register_operand" "0")
4707 (match_operand:SI 2 "const_int_operand" "n")))]
4709 && INTVAL (operands[2]) > 16
4710 && INTVAL (operands[2]) <= 24"
4714 operands[2] = GEN_INT (INTVAL (operands[2]) - 16);
4715 return "lsl%.w %2,%0\;swap %0\;clr%.w %0";
4718 (define_insn "ashlsi3"
4719 [(set (match_operand:SI 0 "register_operand" "=d")
4720 (ashift:SI (match_operand:SI 1 "register_operand" "0")
4721 (match_operand:SI 2 "general_operand" "dI")))]
4724 if (operands[2] == const1_rtx)
4726 cc_status.flags = CC_NO_OVERFLOW;
4727 return "add%.l %0,%0";
4729 return "lsl%.l %2,%0";
4732 (define_insn "ashlhi3"
4733 [(set (match_operand:HI 0 "register_operand" "=d")
4734 (ashift:HI (match_operand:HI 1 "register_operand" "0")
4735 (match_operand:HI 2 "general_operand" "dI")))]
4740 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
4741 (ashift:HI (match_dup 0)
4742 (match_operand:HI 1 "general_operand" "dI")))]
4746 (define_insn "ashlqi3"
4747 [(set (match_operand:QI 0 "register_operand" "=d")
4748 (ashift:QI (match_operand:QI 1 "register_operand" "0")
4749 (match_operand:QI 2 "general_operand" "dI")))]
4754 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
4755 (ashift:QI (match_dup 0)
4756 (match_operand:QI 1 "general_operand" "dI")))]
4760 ;; On most 68k models, this makes faster code in a special case.
4762 (define_insn "ashrsi_16"
4763 [(set (match_operand:SI 0 "register_operand" "=d")
4764 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4767 "swap %0\;ext%.l %0")
4769 ;; On the 68000, this makes faster code in a special case.
4772 [(set (match_operand:SI 0 "register_operand" "=d")
4773 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4774 (match_operand:SI 2 "const_int_operand" "n")))]
4776 && INTVAL (operands[2]) > 16
4777 && INTVAL (operands[2]) <= 24"
4779 operands[2] = GEN_INT (INTVAL (operands[2]) - 16);
4780 return "swap %0\;asr%.w %2,%0\;ext%.l %0";
4783 (define_insn "subreghi1ashrdi_const32"
4784 [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
4785 (subreg:HI (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro")
4786 (const_int 32)) 6))]
4789 if (GET_CODE (operands[1]) != REG)
4790 operands[1] = adjust_address (operands[1], HImode, 2);
4791 return "move%.w %1,%0";
4793 [(set_attr "type" "move_w")])
4795 (define_insn "subregsi1ashrdi_const32"
4796 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
4797 (subreg:SI (ashiftrt:DI (match_operand:DI 1 "general_operand" "ro")
4798 (const_int 32)) 4))]
4801 return "move%.l %1,%0";
4803 [(set_attr "type" "move_l")])
4805 (define_insn "*ashrdi3_const1"
4806 [(set (match_operand:DI 0 "register_operand" "=d")
4807 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
4811 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4812 return "asr%.l #1,%0\;roxr%.l #1,%1";
4816 [(set (match_operand:DI 0 "register_operand" "")
4817 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4819 "reload_completed && !TARGET_COLDFIRE"
4821 (ashiftrt:DI (match_dup 1) (const_int 1)))
4823 (ashiftrt:DI (match_dup 0) (const_int 1)))]
4827 [(set (match_operand:DI 0 "register_operand" "")
4828 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4830 "reload_completed && !TARGET_COLDFIRE"
4832 (ashiftrt:DI (match_dup 1) (const_int 2)))
4834 (ashiftrt:DI (match_dup 0) (const_int 1)))]
4838 [(set (match_operand:DI 0 "register_operand" "")
4839 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4841 "reload_completed && !TARGET_COLDFIRE"
4842 [(set (strict_low_part (subreg:QI (match_dup 0) 7))
4843 (subreg:QI (match_dup 0) 3))
4845 (ashiftrt:SI (match_dup 2) (const_int 8)))
4847 (rotatert:SI (match_dup 3) (const_int 8)))]
4849 operands[2] = gen_highpart (SImode, operands[0]);
4850 operands[3] = gen_lowpart (SImode, operands[0]);
4854 [(set (match_operand:DI 0 "register_operand" "")
4855 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4857 "reload_completed && !TARGET_COLDFIRE"
4858 [(set (strict_low_part (subreg:HI (match_dup 0) 6))
4859 (subreg:HI (match_dup 0) 2))
4861 (rotate:SI (match_dup 2) (const_int 16)))
4863 (rotate:SI (match_dup 3) (const_int 16)))
4865 (sign_extend:SI (subreg:HI (match_dup 2) 2)))]
4867 operands[2] = gen_highpart (SImode, operands[0]);
4868 operands[3] = gen_lowpart (SImode, operands[0]);
4871 (define_insn "*ashrdi_const32"
4872 [(set (match_operand:DI 0 "register_operand" "=d")
4873 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_src_operand" "ro")
4879 return "move%.l %1,%R0\;smi %0\;extb%.l %0";
4881 return "move%.l %1,%R0\;smi %0\;ext%.w %0\;ext%.l %0";
4884 (define_insn "*ashrdi_const32_mem"
4885 [(set (match_operand:DI 0 "memory_operand" "=o,<")
4886 (ashiftrt:DI (match_operand:DI 1 "nonimmediate_src_operand" "ro,ro")
4888 (clobber (match_scratch:SI 2 "=d,d"))]
4892 operands[3] = adjust_address (operands[0], SImode,
4893 which_alternative == 0 ? 4 : 0);
4894 operands[0] = adjust_address (operands[0], SImode, 0);
4895 if (TARGET_68020 || TARGET_COLDFIRE)
4896 return "move%.l %1,%3\;smi %2\;extb%.l %2\;move%.l %2,%0";
4898 return "move%.l %1,%3\;smi %2\;ext%.w %2\;ext%.l %2\;move%.l %2,%0";
4902 [(set (match_operand:DI 0 "register_operand" "")
4903 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4905 "reload_completed && !TARGET_COLDFIRE"
4907 (ashiftrt:SI (match_dup 3) (const_int 31)))
4910 "split_di(operands, 1, operands + 2, operands + 3);")
4912 ;; The predicate below must be general_operand, because ashrdi3 allows that
4913 (define_insn "ashrdi_const"
4914 [(set (match_operand:DI 0 "register_operand" "=d")
4915 (ashiftrt:DI (match_operand:DI 1 "register_operand" "0")
4916 (match_operand 2 "const_int_operand" "n")))]
4918 && ((INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) <= 3)
4919 || INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16
4920 || INTVAL (operands[2]) == 31
4921 || (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63))"
4923 operands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
4925 if (INTVAL (operands[2]) == 48)
4926 return "swap %0\;ext%.l %0\;move%.l %0,%1\;smi %0\;ext%.w %0";
4927 if (INTVAL (operands[2]) == 31)
4928 return "add%.l %1,%1\;addx%.l %0,%0\;move%.l %0,%1\;subx%.l %0,%0";
4929 if (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63)
4931 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
4932 output_asm_insn (INTVAL (operands[2]) <= 8 ? "asr%.l %2,%0" :
4933 "moveq %2,%1\;asr%.l %1,%0", operands);
4934 output_asm_insn ("mov%.l %0,%1\;smi %0", operands);
4935 return INTVAL (operands[2]) >= 15 ? "ext%.w %d0" :
4936 TARGET_68020 ? "extb%.l %0" : "ext%.w %0\;ext%.l %0";
4941 (define_expand "ashrdi3"
4942 [(set (match_operand:DI 0 "register_operand" "")
4943 (ashiftrt:DI (match_operand:DI 1 "register_operand" "")
4944 (match_operand 2 "const_int_operand" "")))]
4947 /* ??? This is a named pattern like this is not allowed to FAIL based
4949 if (GET_CODE (operands[2]) != CONST_INT
4950 || ((INTVAL (operands[2]) < 1 || INTVAL (operands[2]) > 3)
4951 && INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16
4952 && (INTVAL (operands[2]) < 31 || INTVAL (operands[2]) > 63)))
4956 ;; On all 68k models, this makes faster code in a special case.
4958 (define_insn "ashrsi_31"
4959 [(set (match_operand:SI 0 "register_operand" "=d")
4960 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4964 return "add%.l %0,%0\;subx%.l %0,%0";
4967 (define_insn "ashrsi3"
4968 [(set (match_operand:SI 0 "register_operand" "=d")
4969 (ashiftrt:SI (match_operand:SI 1 "register_operand" "0")
4970 (match_operand:SI 2 "general_operand" "dI")))]
4973 [(set_attr "type" "asr_l")
4974 (set_attr "opy" "2")])
4976 (define_insn "ashrhi3"
4977 [(set (match_operand:HI 0 "register_operand" "=d")
4978 (ashiftrt:HI (match_operand:HI 1 "register_operand" "0")
4979 (match_operand:HI 2 "general_operand" "dI")))]
4984 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
4985 (ashiftrt:HI (match_dup 0)
4986 (match_operand:HI 1 "general_operand" "dI")))]
4990 (define_insn "ashrqi3"
4991 [(set (match_operand:QI 0 "register_operand" "=d")
4992 (ashiftrt:QI (match_operand:QI 1 "register_operand" "0")
4993 (match_operand:QI 2 "general_operand" "dI")))]
4998 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
4999 (ashiftrt:QI (match_dup 0)
5000 (match_operand:QI 1 "general_operand" "dI")))]
5004 ;; logical shift instructions
5006 ;; commented out because of reload problems in 950612-1.c
5009 ;; (subreg:SI (lshiftrt:DI (match_operand:DI 0 "general_operand" "ro")
5010 ;; (const_int 32)) 4))
5011 ;; (set (match_operand:SI 1 "nonimmediate_operand" "=dm")
5012 ;; (subreg:SI (lshiftrt:DI (match_dup 0)
5013 ;; (const_int 32)) 4))]
5016 ;; return "move%.l %0,%1";
5021 ;; (subreg:SI (lshiftrt:DI (match_operand:DI 0 "general_operand" "ro")
5022 ;; (const_int 32)) 0))
5023 ;; (set (match_operand:DI 1 "nonimmediate_operand" "=do")
5024 ;; (lshiftrt:DI (match_dup 0)
5025 ;; (const_int 32)))]
5028 ;; if (GET_CODE (operands[1]) == REG)
5029 ;; operands[2] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
5031 ;; operands[2] = adjust_address (operands[1], SImode, 4);
5032 ;; return "move%.l %0,%2\;clr%.l %1";
5035 (define_insn "subreg1lshrdi_const32"
5036 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
5037 (subreg:SI (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro")
5038 (const_int 32)) 4))]
5041 [(set_attr "type" "move_l")])
5043 (define_insn "*lshrdi3_const1"
5044 [(set (match_operand:DI 0 "register_operand" "=d")
5045 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
5048 "lsr%.l #1,%0\;roxr%.l #1,%R0")
5051 [(set (match_operand:DI 0 "register_operand" "")
5052 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
5054 "reload_completed && !TARGET_COLDFIRE"
5056 (lshiftrt:DI (match_dup 1) (const_int 1)))
5058 (lshiftrt:DI (match_dup 0) (const_int 1)))]
5062 [(set (match_operand:DI 0 "register_operand" "")
5063 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
5065 "reload_completed && !TARGET_COLDFIRE"
5067 (lshiftrt:DI (match_dup 1) (const_int 2)))
5069 (lshiftrt:DI (match_dup 0) (const_int 1)))]
5073 [(set (match_operand:DI 0 "register_operand" "")
5074 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
5076 "reload_completed && !TARGET_COLDFIRE"
5077 [(set (strict_low_part (subreg:QI (match_dup 0) 7))
5078 (subreg:QI (match_dup 0) 3))
5080 (lshiftrt:SI (match_dup 2) (const_int 8)))
5082 (rotatert:SI (match_dup 3) (const_int 8)))]
5084 operands[2] = gen_highpart (SImode, operands[0]);
5085 operands[3] = gen_lowpart (SImode, operands[0]);
5089 [(set (match_operand:DI 0 "register_operand" "")
5090 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
5092 "reload_completed && !TARGET_COLDFIRE"
5093 [(set (strict_low_part (subreg:HI (match_dup 0) 6))
5094 (subreg:HI (match_dup 0) 2))
5095 (set (strict_low_part (subreg:HI (match_dup 0) 2))
5098 (rotate:SI (match_dup 3) (const_int 16)))
5100 (rotate:SI (match_dup 2) (const_int 16)))]
5102 operands[2] = gen_highpart (SImode, operands[0]);
5103 operands[3] = gen_lowpart (SImode, operands[0]);
5107 [(set (match_operand:DI 0 "pre_dec_operand" "")
5108 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "")
5111 [(set (match_dup 0) (match_dup 1))
5112 (set (match_dup 0) (const_int 0))]
5114 operands[0] = adjust_address(operands[0], SImode, 0);
5115 operands[1] = gen_highpart(SImode, operands[1]);
5119 [(set (match_operand:DI 0 "post_inc_operand" "")
5120 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "")
5123 [(set (match_dup 0) (const_int 0))
5124 (set (match_dup 0) (match_dup 1))]
5126 operands[0] = adjust_address(operands[0], SImode, 0);
5127 operands[1] = gen_highpart(SImode, operands[1]);
5131 [(set (match_operand:DI 0 "nonimmediate_operand" "")
5132 (lshiftrt:DI (match_operand:DI 1 "nonimmediate_operand" "")
5135 [(set (match_dup 2) (match_dup 5))
5136 (set (match_dup 4) (const_int 0))]
5137 "split_di(operands, 2, operands + 2, operands + 4);")
5139 (define_insn "*lshrdi_const32"
5140 [(set (match_operand:DI 0 "nonimmediate_operand" "=ro<>")
5141 (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro")
5147 [(set (match_operand:DI 0 "register_operand" "")
5148 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
5149 (match_operand 2 "const_int_operand" "")))]
5150 "reload_completed && !TARGET_COLDFIRE
5151 && INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 40"
5152 [(set (match_dup 3) (lshiftrt:SI (match_dup 3) (match_dup 2)))
5153 (set (match_dup 4) (match_dup 3))
5154 (set (match_dup 3) (const_int 0))]
5156 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
5157 operands[3] = gen_highpart (SImode, operands[0]);
5158 operands[4] = gen_lowpart (SImode, operands[0]);
5162 [(set (match_operand:DI 0 "register_operand" "")
5163 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
5166 [(set (match_dup 3) (match_dup 2))
5167 (set (strict_low_part (subreg:HI (match_dup 0) 6))
5169 (set (match_dup 2) (const_int 0))
5171 (rotate:SI (match_dup 3) (const_int 16)))]
5173 operands[2] = gen_highpart (SImode, operands[0]);
5174 operands[3] = gen_lowpart (SImode, operands[0]);
5178 [(set (match_operand:DI 0 "register_operand" "")
5179 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
5180 (match_operand 2 "const_int_operand" "")))]
5181 "reload_completed && !TARGET_COLDFIRE
5182 && INTVAL (operands[2]) > 40 && INTVAL (operands[2]) <= 62"
5183 [(set (match_dup 4) (match_dup 2))
5184 (set (match_dup 3) (lshiftrt:SI (match_dup 3) (match_dup 4)))
5185 (set (match_dup 4) (match_dup 3))
5186 (set (match_dup 3) (const_int 0))]
5188 operands[2] = GEN_INT (INTVAL (operands[2]) - 32);
5189 operands[3] = gen_highpart (SImode, operands[0]);
5190 operands[4] = gen_lowpart (SImode, operands[0]);
5193 (define_insn "*lshrdi_const63"
5194 [(set (match_operand:DI 0 "register_operand" "=d")
5195 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
5198 "add%.l %0,%0\;clr%.l %0\;clr%.l %R1\;addx%.l %R1,%R1")
5200 (define_insn "*lshrdi3_const"
5201 [(set (match_operand:DI 0 "register_operand" "=d")
5202 (lshiftrt:DI (match_operand:DI 1 "register_operand" "0")
5203 (match_operand 2 "const_int_operand" "n")))]
5205 && ((INTVAL (operands[2]) >= 2 && INTVAL (operands[2]) <= 3)
5206 || INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16
5207 || (INTVAL (operands[2]) > 32 && INTVAL (operands[2]) <= 63)))"
5210 (define_expand "lshrdi3"
5211 [(set (match_operand:DI 0 "register_operand" "")
5212 (lshiftrt:DI (match_operand:DI 1 "register_operand" "")
5213 (match_operand 2 "const_int_operand" "")))]
5216 /* ??? This is a named pattern like this is not allowed to FAIL based
5218 if (GET_CODE (operands[2]) != CONST_INT
5219 || ((INTVAL (operands[2]) < 1 || INTVAL (operands[2]) > 3)
5220 && INTVAL (operands[2]) != 8 && INTVAL (operands[2]) != 16
5221 && (INTVAL (operands[2]) < 32 || INTVAL (operands[2]) > 63)))
5225 ;; On all 68k models, this makes faster code in a special case.
5227 (define_insn "lshrsi_31"
5228 [(set (match_operand:SI 0 "register_operand" "=d")
5229 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
5233 return "add%.l %0,%0\;subx%.l %0,%0\;neg%.l %0";
5236 ;; On most 68k models, this makes faster code in a special case.
5238 (define_insn "lshrsi_16"
5239 [(set (match_operand:SI 0 "register_operand" "=d")
5240 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
5245 return "clr%.w %0\;swap %0";
5248 ;; On the 68000, this makes faster code in a special case.
5250 (define_insn "lshrsi_17_24"
5251 [(set (match_operand:SI 0 "register_operand" "=d")
5252 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
5253 (match_operand:SI 2 "const_int_operand" "n")))]
5255 && INTVAL (operands[2]) > 16
5256 && INTVAL (operands[2]) <= 24"
5258 /* I think lsr%.w sets the CC properly. */
5259 operands[2] = GEN_INT (INTVAL (operands[2]) - 16);
5260 return "clr%.w %0\;swap %0\;lsr%.w %2,%0";
5263 (define_insn "lshrsi3"
5264 [(set (match_operand:SI 0 "register_operand" "=d")
5265 (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
5266 (match_operand:SI 2 "general_operand" "dI")))]
5269 [(set_attr "type" "lsr_l")
5270 (set_attr "opy" "2")])
5272 (define_insn "lshrhi3"
5273 [(set (match_operand:HI 0 "register_operand" "=d")
5274 (lshiftrt:HI (match_operand:HI 1 "register_operand" "0")
5275 (match_operand:HI 2 "general_operand" "dI")))]
5280 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
5281 (lshiftrt:HI (match_dup 0)
5282 (match_operand:HI 1 "general_operand" "dI")))]
5286 (define_insn "lshrqi3"
5287 [(set (match_operand:QI 0 "register_operand" "=d")
5288 (lshiftrt:QI (match_operand:QI 1 "register_operand" "0")
5289 (match_operand:QI 2 "general_operand" "dI")))]
5294 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
5295 (lshiftrt:QI (match_dup 0)
5296 (match_operand:QI 1 "general_operand" "dI")))]
5300 ;; rotate instructions
5302 (define_insn "rotlsi3"
5303 [(set (match_operand:SI 0 "register_operand" "=d")
5304 (rotate:SI (match_operand:SI 1 "register_operand" "0")
5305 (match_operand:SI 2 "general_operand" "dINO")))]
5308 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) == 16)
5310 else if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 16)
5312 operands[2] = GEN_INT (32 - INTVAL (operands[2]));
5313 return "ror%.l %2,%0";
5316 return "rol%.l %2,%0";
5319 (define_insn "rotlhi3"
5320 [(set (match_operand:HI 0 "register_operand" "=d")
5321 (rotate:HI (match_operand:HI 1 "register_operand" "0")
5322 (match_operand:HI 2 "general_operand" "dIP")))]
5325 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 8)
5327 operands[2] = GEN_INT (16 - INTVAL (operands[2]));
5328 return "ror%.w %2,%0";
5331 return "rol%.w %2,%0";
5335 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
5336 (rotate:HI (match_dup 0)
5337 (match_operand:HI 1 "general_operand" "dIP")))]
5340 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 8)
5342 operands[2] = GEN_INT (16 - INTVAL (operands[2]));
5343 return "ror%.w %2,%0";
5346 return "rol%.w %2,%0";
5349 (define_insn "rotlqi3"
5350 [(set (match_operand:QI 0 "register_operand" "=d")
5351 (rotate:QI (match_operand:QI 1 "register_operand" "0")
5352 (match_operand:QI 2 "general_operand" "dI")))]
5355 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 4)
5357 operands[2] = GEN_INT (8 - INTVAL (operands[2]));
5358 return "ror%.b %2,%0";
5361 return "rol%.b %2,%0";
5365 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
5366 (rotate:QI (match_dup 0)
5367 (match_operand:QI 1 "general_operand" "dI")))]
5370 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) >= 4)
5372 operands[2] = GEN_INT (8 - INTVAL (operands[2]));
5373 return "ror%.b %2,%0";
5376 return "rol%.b %2,%0";
5379 (define_insn "rotrsi3"
5380 [(set (match_operand:SI 0 "register_operand" "=d")
5381 (rotatert:SI (match_operand:SI 1 "register_operand" "0")
5382 (match_operand:SI 2 "general_operand" "dI")))]
5386 (define_insn "rotrhi3"
5387 [(set (match_operand:HI 0 "register_operand" "=d")
5388 (rotatert:HI (match_operand:HI 1 "register_operand" "0")
5389 (match_operand:HI 2 "general_operand" "dI")))]
5394 [(set (strict_low_part (match_operand:HI 0 "register_operand" "+d"))
5395 (rotatert:HI (match_dup 0)
5396 (match_operand:HI 1 "general_operand" "dI")))]
5400 (define_insn "rotrqi3"
5401 [(set (match_operand:QI 0 "register_operand" "=d")
5402 (rotatert:QI (match_operand:QI 1 "register_operand" "0")
5403 (match_operand:QI 2 "general_operand" "dI")))]
5408 [(set (strict_low_part (match_operand:QI 0 "register_operand" "+d"))
5409 (rotatert:QI (match_dup 0)
5410 (match_operand:QI 1 "general_operand" "dI")))]
5415 ;; Bit set/clear in memory byte.
5417 ;; set bit, bit number is int
5418 (define_insn "bsetmemqi"
5419 [(set (match_operand:QI 0 "memory_operand" "+m")
5420 (ior:QI (subreg:QI (ashift:SI (const_int 1)
5421 (match_operand:SI 1 "general_operand" "d")) 3)
5426 return "bset %1,%0";
5428 [(set_attr "type" "bset")])
5430 ;; set bit, bit number is (sign/zero)_extended from HImode/QImode
5431 (define_insn "*bsetmemqi_ext"
5432 [(set (match_operand:QI 0 "memory_operand" "+m")
5433 (ior:QI (subreg:QI (ashift:SI (const_int 1)
5434 (match_operator:SI 2 "extend_operator"
5435 [(match_operand 1 "general_operand" "d")])) 3)
5440 return "bset %1,%0";
5442 [(set_attr "type" "bset")])
5444 ;; clear bit, bit number is int
5445 (define_insn "bclrmemqi"
5446 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+m")
5448 (minus:SI (const_int 7)
5449 (match_operand:SI 1 "general_operand" "d")))
5454 return "bclr %1,%0";
5456 [(set_attr "type" "bclr")])
5458 ;; clear bit, bit number is (sign/zero)_extended from HImode/QImode
5459 (define_insn "*bclrmemqi_ext"
5460 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+m")
5462 (minus:SI (const_int 7)
5463 (match_operator:SI 2 "extend_operator"
5464 [(match_operand 1 "general_operand" "d")])))
5469 return "bclr %1,%0";
5471 [(set_attr "type" "bclr")])
5473 ;; Special cases of bit-field insns which we should
5474 ;; recognize in preference to the general case.
5475 ;; These handle aligned 8-bit and 16-bit fields,
5476 ;; which can usually be done with move instructions.
5479 ; Special case for 32-bit field in memory. This only occurs when 32-bit
5480 ; alignment of structure members is specified.
5482 ; The move is allowed to be odd byte aligned, because that's still faster
5483 ; than an odd byte aligned bit-field instruction.
5486 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5488 (match_operand:SI 1 "const_int_operand" "n"))
5489 (match_operand:SI 2 "general_src_operand" "rmSi"))]
5490 "TARGET_68020 && TARGET_BITFIELD
5491 && (INTVAL (operands[1]) % 8) == 0
5492 && ! mode_dependent_address_p (XEXP (operands[0], 0))"
5495 = adjust_address (operands[0], SImode, INTVAL (operands[1]) / 8);
5497 return "move%.l %2,%0";
5501 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+do")
5502 (match_operand:SI 1 "const_int_operand" "n")
5503 (match_operand:SI 2 "const_int_operand" "n"))
5504 (match_operand:SI 3 "register_operand" "d"))]
5505 "TARGET_68020 && TARGET_BITFIELD
5506 && (INTVAL (operands[1]) == 8 || INTVAL (operands[1]) == 16)
5507 && INTVAL (operands[2]) % INTVAL (operands[1]) == 0
5508 && (GET_CODE (operands[0]) == REG
5509 || ! mode_dependent_address_p (XEXP (operands[0], 0)))"
5511 if (REG_P (operands[0]))
5513 if (INTVAL (operands[1]) + INTVAL (operands[2]) != 32)
5514 return "bfins %3,%0{%b2:%b1}";
5517 operands[0] = adjust_address (operands[0],
5518 INTVAL (operands[1]) == 8 ? QImode : HImode,
5519 INTVAL (operands[2]) / 8);
5521 if (GET_CODE (operands[3]) == MEM)
5522 operands[3] = adjust_address (operands[3],
5523 INTVAL (operands[1]) == 8 ? QImode : HImode,
5524 (32 - INTVAL (operands[1])) / 8);
5526 if (INTVAL (operands[1]) == 8)
5527 return "move%.b %3,%0";
5528 return "move%.w %3,%0";
5533 ; Special case for 32-bit field in memory. This only occurs when 32-bit
5534 ; alignment of structure members is specified.
5536 ; The move is allowed to be odd byte aligned, because that's still faster
5537 ; than an odd byte aligned bit-field instruction.
5540 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
5541 (zero_extract:SI (match_operand:QI 1 "memory_src_operand" "oS")
5543 (match_operand:SI 2 "const_int_operand" "n")))]
5544 "TARGET_68020 && TARGET_BITFIELD
5545 && (INTVAL (operands[2]) % 8) == 0
5546 && ! mode_dependent_address_p (XEXP (operands[1], 0))"
5549 = adjust_address (operands[1], SImode, INTVAL (operands[2]) / 8);
5551 return "move%.l %1,%0";
5555 [(set (match_operand:SI 0 "nonimmediate_operand" "=&d")
5556 (zero_extract:SI (match_operand:SI 1 "register_operand" "do")
5557 (match_operand:SI 2 "const_int_operand" "n")
5558 (match_operand:SI 3 "const_int_operand" "n")))]
5559 "TARGET_68020 && TARGET_BITFIELD
5560 && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
5561 && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
5562 && (GET_CODE (operands[1]) == REG
5563 || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
5565 cc_status.flags |= CC_NOT_NEGATIVE;
5566 if (REG_P (operands[1]))
5568 if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
5569 return "bfextu %1{%b3:%b2},%0";
5573 = adjust_address (operands[1], SImode, INTVAL (operands[3]) / 8);
5575 output_asm_insn ("clr%.l %0", operands);
5576 if (GET_CODE (operands[0]) == MEM)
5577 operands[0] = adjust_address (operands[0],
5578 INTVAL (operands[2]) == 8 ? QImode : HImode,
5579 (32 - INTVAL (operands[1])) / 8);
5581 if (INTVAL (operands[2]) == 8)
5582 return "move%.b %1,%0";
5583 return "move%.w %1,%0";
5587 ; Special case for 32-bit field in memory. This only occurs when 32-bit
5588 ; alignment of structure members is specified.
5590 ; The move is allowed to be odd byte aligned, because that's still faster
5591 ; than an odd byte aligned bit-field instruction.
5594 [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
5595 (sign_extract:SI (match_operand:QI 1 "memory_src_operand" "oS")
5597 (match_operand:SI 2 "const_int_operand" "n")))]
5598 "TARGET_68020 && TARGET_BITFIELD
5599 && (INTVAL (operands[2]) % 8) == 0
5600 && ! mode_dependent_address_p (XEXP (operands[1], 0))"
5603 = adjust_address (operands[1], SImode, INTVAL (operands[2]) / 8);
5605 return "move%.l %1,%0";
5609 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
5610 (sign_extract:SI (match_operand:SI 1 "register_operand" "do")
5611 (match_operand:SI 2 "const_int_operand" "n")
5612 (match_operand:SI 3 "const_int_operand" "n")))]
5613 "TARGET_68020 && TARGET_BITFIELD
5614 && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
5615 && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
5616 && (GET_CODE (operands[1]) == REG
5617 || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
5619 if (REG_P (operands[1]))
5621 if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
5622 return "bfexts %1{%b3:%b2},%0";
5626 = adjust_address (operands[1],
5627 INTVAL (operands[2]) == 8 ? QImode : HImode,
5628 INTVAL (operands[3]) / 8);
5630 if (INTVAL (operands[2]) == 8)
5631 return "move%.b %1,%0\;extb%.l %0";
5632 return "move%.w %1,%0\;ext%.l %0";
5635 ;; Bit-field instructions, general cases.
5636 ;; "o,d" constraint causes a nonoffsettable memref to match the "o"
5637 ;; so that its address is reloaded.
5639 (define_expand "extv"
5640 [(set (match_operand:SI 0 "register_operand" "")
5641 (sign_extract:SI (match_operand:SI 1 "general_operand" "")
5642 (match_operand:SI 2 "const_int_operand" "")
5643 (match_operand:SI 3 "const_int_operand" "")))]
5644 "TARGET_68020 && TARGET_BITFIELD"
5648 [(set (match_operand:SI 0 "register_operand" "=d")
5649 (sign_extract:SI (match_operand:QI 1 "memory_operand" "o")
5650 (match_operand:SI 2 "nonmemory_operand" "dn")
5651 (match_operand:SI 3 "nonmemory_operand" "dn")))]
5652 "TARGET_68020 && TARGET_BITFIELD"
5653 "bfexts %1{%b3:%b2},%0")
5655 (define_expand "extzv"
5656 [(set (match_operand:SI 0 "register_operand" "")
5657 (zero_extract:SI (match_operand:SI 1 "general_operand" "")
5658 (match_operand:SI 2 "const_int_operand" "")
5659 (match_operand:SI 3 "const_int_operand" "")))]
5660 "TARGET_68020 && TARGET_BITFIELD"
5664 [(set (match_operand:SI 0 "register_operand" "=d")
5665 (zero_extract:SI (match_operand:QI 1 "memory_operand" "o")
5666 (match_operand:SI 2 "nonmemory_operand" "dn")
5667 (match_operand:SI 3 "nonmemory_operand" "dn")))]
5668 "TARGET_68020 && TARGET_BITFIELD"
5670 if (GET_CODE (operands[2]) == CONST_INT)
5672 if (INTVAL (operands[2]) != 32)
5673 cc_status.flags |= CC_NOT_NEGATIVE;
5679 return "bfextu %1{%b3:%b2},%0";
5683 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5684 (match_operand:SI 1 "nonmemory_operand" "dn")
5685 (match_operand:SI 2 "nonmemory_operand" "dn"))
5686 (xor:SI (zero_extract:SI (match_dup 0) (match_dup 1) (match_dup 2))
5687 (match_operand 3 "const_int_operand" "n")))]
5688 "TARGET_68020 && TARGET_BITFIELD
5689 && (INTVAL (operands[3]) == -1
5690 || (GET_CODE (operands[1]) == CONST_INT
5691 && (~ INTVAL (operands[3]) & ((1 << INTVAL (operands[1]))- 1)) == 0))"
5694 return "bfchg %0{%b2:%b1}";
5698 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5699 (match_operand:SI 1 "nonmemory_operand" "dn")
5700 (match_operand:SI 2 "nonmemory_operand" "dn"))
5702 "TARGET_68020 && TARGET_BITFIELD"
5705 return "bfclr %0{%b2:%b1}";
5709 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5710 (match_operand:SI 1 "general_operand" "dn")
5711 (match_operand:SI 2 "general_operand" "dn"))
5713 "TARGET_68020 && TARGET_BITFIELD"
5716 return "bfset %0{%b2:%b1}";
5719 (define_expand "insv"
5720 [(set (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "")
5721 (match_operand:SI 1 "const_int_operand" "")
5722 (match_operand:SI 2 "const_int_operand" ""))
5723 (match_operand:SI 3 "register_operand" ""))]
5724 "TARGET_68020 && TARGET_BITFIELD"
5728 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
5729 (match_operand:SI 1 "nonmemory_operand" "dn")
5730 (match_operand:SI 2 "nonmemory_operand" "dn"))
5731 (match_operand:SI 3 "register_operand" "d"))]
5732 "TARGET_68020 && TARGET_BITFIELD"
5733 "bfins %3,%0{%b2:%b1}")
5735 ;; Now recognize bit-field insns that operate on registers
5736 ;; (or at least were intended to do so).
5739 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
5740 (sign_extract:SI (match_operand:SI 1 "register_operand" "d")
5741 (match_operand:SI 2 "const_int_operand" "n")
5742 (match_operand:SI 3 "const_int_operand" "n")))]
5743 "TARGET_68020 && TARGET_BITFIELD"
5744 "bfexts %1{%b3:%b2},%0")
5747 [(set (match_operand:SI 0 "nonimmediate_operand" "=d")
5748 (zero_extract:SI (match_operand:SI 1 "register_operand" "d")
5749 (match_operand:SI 2 "const_int_operand" "n")
5750 (match_operand:SI 3 "const_int_operand" "n")))]
5751 "TARGET_68020 && TARGET_BITFIELD"
5753 if (GET_CODE (operands[2]) == CONST_INT)
5755 if (INTVAL (operands[2]) != 32)
5756 cc_status.flags |= CC_NOT_NEGATIVE;
5762 return "bfextu %1{%b3:%b2},%0";
5766 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
5767 (match_operand:SI 1 "const_int_operand" "n")
5768 (match_operand:SI 2 "const_int_operand" "n"))
5770 "TARGET_68020 && TARGET_BITFIELD"
5773 return "bfclr %0{%b2:%b1}";
5777 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
5778 (match_operand:SI 1 "const_int_operand" "n")
5779 (match_operand:SI 2 "const_int_operand" "n"))
5781 "TARGET_68020 && TARGET_BITFIELD"
5784 return "bfset %0{%b2:%b1}";
5788 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
5789 (match_operand:SI 1 "const_int_operand" "n")
5790 (match_operand:SI 2 "const_int_operand" "n"))
5791 (match_operand:SI 3 "register_operand" "d"))]
5792 "TARGET_68020 && TARGET_BITFIELD"
5795 /* These special cases are now recognized by a specific pattern. */
5796 if (GET_CODE (operands[1]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT
5797 && INTVAL (operands[1]) == 16 && INTVAL (operands[2]) == 16)
5798 return "move%.w %3,%0";
5799 if (GET_CODE (operands[1]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT
5800 && INTVAL (operands[1]) == 24 && INTVAL (operands[2]) == 8)
5801 return "move%.b %3,%0";
5803 return "bfins %3,%0{%b2:%b1}";
5806 ;; Special patterns for optimizing bit-field instructions.
5810 (zero_extract:SI (match_operand:QI 0 "memory_operand" "o")
5811 (match_operand:SI 1 "const_int_operand" "n")
5812 (match_operand:SI 2 "general_operand" "dn")))]
5813 "TARGET_68020 && TARGET_BITFIELD"
5815 if (operands[1] == const1_rtx
5816 && GET_CODE (operands[2]) == CONST_INT)
5818 int width = GET_CODE (operands[0]) == REG ? 31 : 7;
5819 return output_btst (operands,
5820 GEN_INT (width - INTVAL (operands[2])),
5821 operands[0], insn, 1000);
5822 /* Pass 1000 as SIGNPOS argument so that btst will
5823 not think we are testing the sign bit for an `and'
5824 and assume that nonzero implies a negative result. */
5826 if (INTVAL (operands[1]) != 32)
5827 cc_status.flags = CC_NOT_NEGATIVE;
5828 return "bftst %0{%b2:%b1}";
5832 ;;; now handle the register cases
5835 (zero_extract:SI (match_operand:SI 0 "register_operand" "d")
5836 (match_operand:SI 1 "const_int_operand" "n")
5837 (match_operand:SI 2 "general_operand" "dn")))]
5838 "TARGET_68020 && TARGET_BITFIELD"
5840 if (operands[1] == const1_rtx
5841 && GET_CODE (operands[2]) == CONST_INT)
5843 int width = GET_CODE (operands[0]) == REG ? 31 : 7;
5844 return output_btst (operands, GEN_INT (width - INTVAL (operands[2])),
5845 operands[0], insn, 1000);
5846 /* Pass 1000 as SIGNPOS argument so that btst will
5847 not think we are testing the sign bit for an `and'
5848 and assume that nonzero implies a negative result. */
5850 if (INTVAL (operands[1]) != 32)
5851 cc_status.flags = CC_NOT_NEGATIVE;
5852 return "bftst %0{%b2:%b1}";
5855 (define_insn "scc0_di"
5856 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm")
5857 (match_operator 1 "valid_dbcc_comparison_p"
5858 [(match_operand:DI 2 "general_operand" "ro") (const_int 0)]))]
5861 return output_scc_di (operands[1], operands[2], const0_rtx, operands[0]);
5864 (define_insn "scc0_di_5200"
5865 [(set (match_operand:QI 0 "nonimmediate_operand" "=d")
5866 (match_operator 1 "valid_dbcc_comparison_p"
5867 [(match_operand:DI 2 "general_operand" "ro") (const_int 0)]))]
5870 return output_scc_di (operands[1], operands[2], const0_rtx, operands[0]);
5873 (define_insn "scc_di"
5874 [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,dm")
5875 (match_operator 1 "valid_dbcc_comparison_p"
5876 [(match_operand:DI 2 "general_operand" "ro,r")
5877 (match_operand:DI 3 "general_operand" "r,ro")]))]
5880 return output_scc_di (operands[1], operands[2], operands[3], operands[0]);
5883 (define_insn "scc_di_5200"
5884 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d")
5885 (match_operator 1 "valid_dbcc_comparison_p"
5886 [(match_operand:DI 2 "general_operand" "ro,r")
5887 (match_operand:DI 3 "general_operand" "r,ro")]))]
5890 return output_scc_di (operands[1], operands[2], operands[3], operands[0]);
5893 ;; Note that operand 0 of an SCC insn is supported in the hardware as
5894 ;; memory, but we cannot allow it to be in memory in case the address
5895 ;; needs to be reloaded.
5897 (define_expand "seq"
5898 [(set (match_operand:QI 0 "register_operand" "")
5899 (eq:QI (cc0) (const_int 0)))]
5902 if ((TUNE_68060 || TARGET_COLDFIRE_FPU)
5903 && m68k_last_compare_had_fp_operands)
5905 m68k_last_compare_had_fp_operands = 0;
5911 [(set (match_operand:QI 0 "register_operand" "=d")
5912 (eq:QI (cc0) (const_int 0)))]
5915 cc_status = cc_prev_status;
5916 OUTPUT_JUMP ("seq %0", "fseq %0", "seq %0");
5919 (define_expand "sne"
5920 [(set (match_operand:QI 0 "register_operand" "")
5921 (ne:QI (cc0) (const_int 0)))]
5924 if ((TUNE_68060 || TARGET_COLDFIRE_FPU)
5925 && m68k_last_compare_had_fp_operands)
5927 m68k_last_compare_had_fp_operands = 0;
5933 [(set (match_operand:QI 0 "register_operand" "=d")
5934 (ne:QI (cc0) (const_int 0)))]
5937 cc_status = cc_prev_status;
5938 OUTPUT_JUMP ("sne %0", "fsne %0", "sne %0");
5941 (define_expand "sgt"
5942 [(set (match_operand:QI 0 "register_operand" "")
5943 (gt:QI (cc0) (const_int 0)))]
5946 if ((TUNE_68060 || TARGET_COLDFIRE_FPU)
5947 && m68k_last_compare_had_fp_operands)
5949 m68k_last_compare_had_fp_operands = 0;
5955 [(set (match_operand:QI 0 "register_operand" "=d")
5956 (gt:QI (cc0) (const_int 0)))]
5959 cc_status = cc_prev_status;
5960 OUTPUT_JUMP ("sgt %0", "fsgt %0", 0);
5963 (define_expand "sgtu"
5964 [(set (match_operand:QI 0 "register_operand" "")
5965 (gtu:QI (cc0) (const_int 0)))]
5970 [(set (match_operand:QI 0 "register_operand" "=d")
5971 (gtu:QI (cc0) (const_int 0)))]
5974 cc_status = cc_prev_status;
5978 (define_expand "slt"
5979 [(set (match_operand:QI 0 "register_operand" "")
5980 (lt:QI (cc0) (const_int 0)))]
5983 if ((TUNE_68060 || TARGET_COLDFIRE_FPU)
5984 && m68k_last_compare_had_fp_operands)
5986 m68k_last_compare_had_fp_operands = 0;
5992 [(set (match_operand:QI 0 "register_operand" "=d")
5993 (lt:QI (cc0) (const_int 0)))]
5996 cc_status = cc_prev_status;
5997 OUTPUT_JUMP ("slt %0", "fslt %0", "smi %0");
6000 (define_expand "sltu"
6001 [(set (match_operand:QI 0 "register_operand" "")
6002 (ltu:QI (cc0) (const_int 0)))]
6007 [(set (match_operand:QI 0 "register_operand" "=d")
6008 (ltu:QI (cc0) (const_int 0)))]
6011 cc_status = cc_prev_status;
6015 (define_expand "sge"
6016 [(set (match_operand:QI 0 "register_operand" "")
6017 (ge:QI (cc0) (const_int 0)))]
6020 if ((TUNE_68060 || TARGET_COLDFIRE_FPU)
6021 && m68k_last_compare_had_fp_operands)
6023 m68k_last_compare_had_fp_operands = 0;
6029 [(set (match_operand:QI 0 "register_operand" "=d")
6030 (ge:QI (cc0) (const_int 0)))]
6033 cc_status = cc_prev_status;
6034 OUTPUT_JUMP ("sge %0", "fsge %0", "spl %0");
6037 (define_expand "sgeu"
6038 [(set (match_operand:QI 0 "register_operand" "")
6039 (geu:QI (cc0) (const_int 0)))]
6044 [(set (match_operand:QI 0 "register_operand" "=d")
6045 (geu:QI (cc0) (const_int 0)))]
6048 cc_status = cc_prev_status;
6051 [(set_attr "type" "scc")])
6053 (define_expand "sle"
6054 [(set (match_operand:QI 0 "register_operand" "")
6055 (le:QI (cc0) (const_int 0)))]
6058 if ((TUNE_68060 || TARGET_COLDFIRE_FPU)
6059 && m68k_last_compare_had_fp_operands)
6061 m68k_last_compare_had_fp_operands = 0;
6067 [(set (match_operand:QI 0 "register_operand" "=d")
6068 (le:QI (cc0) (const_int 0)))]
6071 cc_status = cc_prev_status;
6072 OUTPUT_JUMP ("sle %0", "fsle %0", 0);
6075 (define_expand "sleu"
6076 [(set (match_operand:QI 0 "register_operand" "")
6077 (leu:QI (cc0) (const_int 0)))]
6082 [(set (match_operand:QI 0 "register_operand" "=d")
6083 (leu:QI (cc0) (const_int 0)))]
6086 cc_status = cc_prev_status;
6089 [(set_attr "type" "scc")])
6091 (define_expand "sordered"
6092 [(set (match_operand:QI 0 "register_operand" "")
6093 (ordered:QI (cc0) (const_int 0)))]
6094 "TARGET_68881 && !TUNE_68060"
6096 gcc_assert (m68k_last_compare_had_fp_operands);
6097 m68k_last_compare_had_fp_operands = 0;
6100 (define_insn "*sordered_1"
6101 [(set (match_operand:QI 0 "register_operand" "=d")
6102 (ordered:QI (cc0) (const_int 0)))]
6103 "TARGET_68881 && !TUNE_68060"
6105 cc_status = cc_prev_status;
6109 (define_expand "sunordered"
6110 [(set (match_operand:QI 0 "register_operand" "")
6111 (unordered:QI (cc0) (const_int 0)))]
6112 "TARGET_68881 && !TUNE_68060"
6114 gcc_assert (m68k_last_compare_had_fp_operands);
6115 m68k_last_compare_had_fp_operands = 0;
6118 (define_insn "*sunordered_1"
6119 [(set (match_operand:QI 0 "register_operand" "=d")
6120 (unordered:QI (cc0) (const_int 0)))]
6121 "TARGET_68881 && !TUNE_68060"
6123 cc_status = cc_prev_status;
6127 (define_expand "suneq"
6128 [(set (match_operand:QI 0 "register_operand" "")
6129 (uneq:QI (cc0) (const_int 0)))]
6130 "TARGET_68881 && !TUNE_68060"
6132 gcc_assert (m68k_last_compare_had_fp_operands);
6133 m68k_last_compare_had_fp_operands = 0;
6136 (define_insn "*suneq_1"
6137 [(set (match_operand:QI 0 "register_operand" "=d")
6138 (uneq:QI (cc0) (const_int 0)))]
6139 "TARGET_68881 && !TUNE_68060"
6141 cc_status = cc_prev_status;
6145 (define_expand "sunge"
6146 [(set (match_operand:QI 0 "register_operand" "")
6147 (unge:QI (cc0) (const_int 0)))]
6148 "TARGET_68881 && !TUNE_68060"
6150 gcc_assert (m68k_last_compare_had_fp_operands);
6151 m68k_last_compare_had_fp_operands = 0;
6154 (define_insn "*sunge_1"
6155 [(set (match_operand:QI 0 "register_operand" "=d")
6156 (unge:QI (cc0) (const_int 0)))]
6157 "TARGET_68881 && !TUNE_68060"
6159 cc_status = cc_prev_status;
6163 (define_expand "sungt"
6164 [(set (match_operand:QI 0 "register_operand" "")
6165 (ungt:QI (cc0) (const_int 0)))]
6166 "TARGET_68881 && !TUNE_68060"
6168 gcc_assert (m68k_last_compare_had_fp_operands);
6169 m68k_last_compare_had_fp_operands = 0;
6172 (define_insn "*sungt_1"
6173 [(set (match_operand:QI 0 "register_operand" "=d")
6174 (ungt:QI (cc0) (const_int 0)))]
6175 "TARGET_68881 && !TUNE_68060"
6177 cc_status = cc_prev_status;
6181 (define_expand "sunle"
6182 [(set (match_operand:QI 0 "register_operand" "")
6183 (unle:QI (cc0) (const_int 0)))]
6184 "TARGET_68881 && !TUNE_68060"
6186 gcc_assert (m68k_last_compare_had_fp_operands);
6187 m68k_last_compare_had_fp_operands = 0;
6190 (define_insn "*sunle_1"
6191 [(set (match_operand:QI 0 "register_operand" "=d")
6192 (unle:QI (cc0) (const_int 0)))]
6193 "TARGET_68881 && !TUNE_68060"
6195 cc_status = cc_prev_status;
6199 (define_expand "sunlt"
6200 [(set (match_operand:QI 0 "register_operand" "")
6201 (unlt:QI (cc0) (const_int 0)))]
6202 "TARGET_68881 && !TUNE_68060"
6204 gcc_assert (m68k_last_compare_had_fp_operands);
6205 m68k_last_compare_had_fp_operands = 0;
6208 (define_insn "*sunlt_1"
6209 [(set (match_operand:QI 0 "register_operand" "=d")
6210 (unlt:QI (cc0) (const_int 0)))]
6211 "TARGET_68881 && !TUNE_68060"
6213 cc_status = cc_prev_status;
6217 (define_expand "sltgt"
6218 [(set (match_operand:QI 0 "register_operand" "")
6219 (ltgt:QI (cc0) (const_int 0)))]
6220 "TARGET_68881 && !TUNE_68060"
6222 gcc_assert (m68k_last_compare_had_fp_operands);
6223 m68k_last_compare_had_fp_operands = 0;
6226 (define_insn "*sltgt_1"
6227 [(set (match_operand:QI 0 "register_operand" "=d")
6228 (ltgt:QI (cc0) (const_int 0)))]
6229 "TARGET_68881 && !TUNE_68060"
6231 cc_status = cc_prev_status;
6235 (define_insn "*fsogt_1"
6236 [(set (match_operand:QI 0 "register_operand" "=d")
6237 (not:QI (unle:QI (cc0) (const_int 0))))]
6238 "TARGET_68881 && !TUNE_68060"
6240 cc_status = cc_prev_status;
6244 (define_insn "*fsoge_1"
6245 [(set (match_operand:QI 0 "register_operand" "=d")
6246 (not:QI (unlt:QI (cc0) (const_int 0))))]
6247 "TARGET_68881 && !TUNE_68060"
6249 cc_status = cc_prev_status;
6253 (define_insn "*fsolt_1"
6254 [(set (match_operand:QI 0 "register_operand" "=d")
6255 (not:QI (unge:QI (cc0) (const_int 0))))]
6256 "TARGET_68881 && !TUNE_68060"
6258 cc_status = cc_prev_status;
6262 (define_insn "*fsole_1"
6263 [(set (match_operand:QI 0 "register_operand" "=d")
6264 (not:QI (ungt:QI (cc0) (const_int 0))))]
6265 "TARGET_68881 && !TUNE_68060"
6267 cc_status = cc_prev_status;
6271 ;; Basic conditional jump instructions.
6273 (define_insn "beq0_di"
6275 (if_then_else (eq (match_operand:DI 0 "general_operand" "d*ao,<>")
6277 (label_ref (match_operand 1 "" ","))
6279 (clobber (match_scratch:SI 2 "=d,d"))]
6283 if (which_alternative == 1)
6284 return "move%.l %0,%2\;or%.l %0,%2\;jeq %l1";
6285 if ((cc_prev_status.value1
6286 && rtx_equal_p (cc_prev_status.value1, operands[0]))
6287 || (cc_prev_status.value2
6288 && rtx_equal_p (cc_prev_status.value2, operands[0])))
6290 cc_status = cc_prev_status;
6293 if (GET_CODE (operands[0]) == REG)
6294 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
6296 operands[3] = adjust_address (operands[0], SImode, 4);
6297 if (! ADDRESS_REG_P (operands[0]))
6299 if (reg_overlap_mentioned_p (operands[2], operands[0]))
6301 if (reg_overlap_mentioned_p (operands[2], operands[3]))
6302 return "or%.l %0,%2\;jeq %l1";
6304 return "or%.l %3,%2\;jeq %l1";
6306 return "move%.l %0,%2\;or%.l %3,%2\;jeq %l1";
6308 operands[4] = gen_label_rtx();
6309 if (TARGET_68020 || TARGET_COLDFIRE)
6310 output_asm_insn ("tst%.l %0\;jne %l4\;tst%.l %3\;jeq %l1", operands);
6312 output_asm_insn ("cmp%.w #0,%0\;jne %l4\;cmp%.w #0,%3\;jeq %l1", operands);
6313 (*targetm.asm_out.internal_label) (asm_out_file, "L",
6314 CODE_LABEL_NUMBER (operands[4]));
6318 (define_insn "bne0_di"
6320 (if_then_else (ne (match_operand:DI 0 "general_operand" "do,*a")
6322 (label_ref (match_operand 1 "" ","))
6324 (clobber (match_scratch:SI 2 "=d,X"))]
6327 if ((cc_prev_status.value1
6328 && rtx_equal_p (cc_prev_status.value1, operands[0]))
6329 || (cc_prev_status.value2
6330 && rtx_equal_p (cc_prev_status.value2, operands[0])))
6332 cc_status = cc_prev_status;
6336 if (GET_CODE (operands[0]) == REG)
6337 operands[3] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
6339 operands[3] = adjust_address (operands[0], SImode, 4);
6340 if (!ADDRESS_REG_P (operands[0]))
6342 if (reg_overlap_mentioned_p (operands[2], operands[0]))
6344 if (reg_overlap_mentioned_p (operands[2], operands[3]))
6345 return "or%.l %0,%2\;jne %l1";
6347 return "or%.l %3,%2\;jne %l1";
6349 return "move%.l %0,%2\;or%.l %3,%2\;jne %l1";
6351 if (TARGET_68020 || TARGET_COLDFIRE)
6352 return "tst%.l %0\;jne %l1\;tst%.l %3\;jne %l1";
6354 return "cmp%.w #0,%0\;jne %l1\;cmp%.w #0,%3\;jne %l1";
6357 (define_insn "bge0_di"
6359 (if_then_else (ge (match_operand:DI 0 "general_operand" "ro")
6361 (label_ref (match_operand 1 "" ""))
6365 if ((cc_prev_status.value1
6366 && rtx_equal_p (cc_prev_status.value1, operands[0]))
6367 || (cc_prev_status.value2
6368 && rtx_equal_p (cc_prev_status.value2, operands[0])))
6370 cc_status = cc_prev_status;
6371 return cc_status.flags & CC_REVERSED ? "jle %l1" : "jpl %l1";
6374 if (TARGET_68020 || TARGET_COLDFIRE || ! ADDRESS_REG_P (operands[0]))
6375 output_asm_insn("tst%.l %0", operands);
6378 /* On an address reg, cmpw may replace cmpl. */
6379 output_asm_insn("cmp%.w #0,%0", operands);
6384 (define_insn "blt0_di"
6386 (if_then_else (lt (match_operand:DI 0 "general_operand" "ro")
6388 (label_ref (match_operand 1 "" ""))
6392 if ((cc_prev_status.value1
6393 && rtx_equal_p (cc_prev_status.value1, operands[0]))
6394 || (cc_prev_status.value2
6395 && rtx_equal_p (cc_prev_status.value2, operands[0])))
6397 cc_status = cc_prev_status;
6398 return cc_status.flags & CC_REVERSED ? "jgt %l1" : "jmi %l1";
6401 if (TARGET_68020 || TARGET_COLDFIRE || ! ADDRESS_REG_P (operands[0]))
6402 output_asm_insn("tst%.l %0", operands);
6405 /* On an address reg, cmpw may replace cmpl. */
6406 output_asm_insn("cmp%.w #0,%0", operands);
6413 (if_then_else (eq (cc0)
6415 (label_ref (match_operand 0 "" ""))
6419 OUTPUT_JUMP ("jeq %l0", "fjeq %l0", "jeq %l0");
6421 [(set (attr "type") (symbol_ref "m68k_sched_branch_type (insn)"))
6422 (set_attr "split" "done")])
6426 (if_then_else (ne (cc0)
6428 (label_ref (match_operand 0 "" ""))
6432 OUTPUT_JUMP ("jne %l0", "fjne %l0", "jne %l0");
6434 [(set (attr "type") (symbol_ref "m68k_sched_branch_type (insn)"))
6435 (set_attr "split" "done")])
6439 (if_then_else (gt (cc0)
6441 (label_ref (match_operand 0 "" ""))
6445 OUTPUT_JUMP ("jgt %l0", "fjgt %l0", 0);
6447 [(set (attr "type") (symbol_ref "m68k_sched_branch_type (insn)"))
6448 (set_attr "split" "done")])
6452 (if_then_else (gtu (cc0)
6454 (label_ref (match_operand 0 "" ""))
6458 [(set_attr "type" "bcc")])
6462 (if_then_else (lt (cc0)
6464 (label_ref (match_operand 0 "" ""))
6468 OUTPUT_JUMP ("jlt %l0", "fjlt %l0", "jmi %l0");
6470 [(set (attr "type") (symbol_ref "m68k_sched_branch_type (insn)"))
6471 (set_attr "split" "done")])
6475 (if_then_else (ltu (cc0)
6477 (label_ref (match_operand 0 "" ""))
6481 [(set_attr "type" "bcc")])
6485 (if_then_else (ge (cc0)
6487 (label_ref (match_operand 0 "" ""))
6491 OUTPUT_JUMP ("jge %l0", "fjge %l0", "jpl %l0");
6496 (if_then_else (geu (cc0)
6498 (label_ref (match_operand 0 "" ""))
6502 [(set_attr "type" "bcc")])
6506 (if_then_else (le (cc0)
6508 (label_ref (match_operand 0 "" ""))
6512 OUTPUT_JUMP ("jle %l0", "fjle %l0", 0);
6514 [(set_attr "type" "bcc")])
6518 (if_then_else (leu (cc0)
6520 (label_ref (match_operand 0 "" ""))
6524 [(set_attr "type" "bcc")])
6526 (define_insn "bordered"
6528 (if_then_else (ordered (cc0) (const_int 0))
6529 (label_ref (match_operand 0 "" ""))
6533 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6537 (define_insn "bunordered"
6539 (if_then_else (unordered (cc0) (const_int 0))
6540 (label_ref (match_operand 0 "" ""))
6544 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6548 (define_insn "buneq"
6550 (if_then_else (uneq (cc0) (const_int 0))
6551 (label_ref (match_operand 0 "" ""))
6555 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6559 (define_insn "bunge"
6561 (if_then_else (unge (cc0) (const_int 0))
6562 (label_ref (match_operand 0 "" ""))
6566 gcc_assert (cc_prev_status.flags & CC_IN_68881);
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);
6581 (define_insn "bunle"
6583 (if_then_else (unle (cc0) (const_int 0))
6584 (label_ref (match_operand 0 "" ""))
6588 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6592 (define_insn "bunlt"
6594 (if_then_else (unlt (cc0) (const_int 0))
6595 (label_ref (match_operand 0 "" ""))
6599 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6603 (define_insn "bltgt"
6605 (if_then_else (ltgt (cc0) (const_int 0))
6606 (label_ref (match_operand 0 "" ""))
6610 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6614 ;; Negated conditional jump instructions.
6616 (define_insn "*beq_rev"
6618 (if_then_else (eq (cc0)
6621 (label_ref (match_operand 0 "" ""))))]
6624 OUTPUT_JUMP ("jne %l0", "fjne %l0", "jne %l0");
6626 [(set_attr "type" "bcc")])
6628 (define_insn "*bne_rev"
6630 (if_then_else (ne (cc0)
6633 (label_ref (match_operand 0 "" ""))))]
6636 OUTPUT_JUMP ("jeq %l0", "fjeq %l0", "jeq %l0");
6638 [(set_attr "type" "bcc")])
6640 (define_insn "*bgt_rev"
6642 (if_then_else (gt (cc0)
6645 (label_ref (match_operand 0 "" ""))))]
6648 OUTPUT_JUMP ("jle %l0", "fjngt %l0", 0);
6650 [(set_attr "type" "bcc")])
6652 (define_insn "*bgtu_rev"
6654 (if_then_else (gtu (cc0)
6657 (label_ref (match_operand 0 "" ""))))]
6660 [(set_attr "type" "bcc")])
6662 (define_insn "*blt_rev"
6664 (if_then_else (lt (cc0)
6667 (label_ref (match_operand 0 "" ""))))]
6670 OUTPUT_JUMP ("jge %l0", "fjnlt %l0", "jpl %l0");
6672 [(set_attr "type" "bcc")])
6674 (define_insn "*bltu_rev"
6676 (if_then_else (ltu (cc0)
6679 (label_ref (match_operand 0 "" ""))))]
6682 [(set_attr "type" "bcc")])
6684 (define_insn "*bge_rev"
6686 (if_then_else (ge (cc0)
6689 (label_ref (match_operand 0 "" ""))))]
6692 OUTPUT_JUMP ("jlt %l0", "fjnge %l0", "jmi %l0");
6694 [(set_attr "type" "bcc")])
6696 (define_insn "*bgeu_rev"
6698 (if_then_else (geu (cc0)
6701 (label_ref (match_operand 0 "" ""))))]
6704 [(set_attr "type" "bcc")])
6706 (define_insn "*ble_rev"
6708 (if_then_else (le (cc0)
6711 (label_ref (match_operand 0 "" ""))))]
6714 OUTPUT_JUMP ("jgt %l0", "fjnle %l0", 0);
6716 [(set_attr "type" "bcc")])
6718 (define_insn "*bleu_rev"
6720 (if_then_else (leu (cc0)
6723 (label_ref (match_operand 0 "" ""))))]
6726 [(set_attr "type" "bcc")])
6728 (define_insn "*bordered_rev"
6730 (if_then_else (ordered (cc0) (const_int 0))
6732 (label_ref (match_operand 0 "" ""))))]
6735 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6739 (define_insn "*bunordered_rev"
6741 (if_then_else (unordered (cc0) (const_int 0))
6743 (label_ref (match_operand 0 "" ""))))]
6746 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6750 (define_insn "*buneq_rev"
6752 (if_then_else (uneq (cc0) (const_int 0))
6754 (label_ref (match_operand 0 "" ""))))]
6757 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6761 (define_insn "*bunge_rev"
6763 (if_then_else (unge (cc0) (const_int 0))
6765 (label_ref (match_operand 0 "" ""))))]
6768 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6772 (define_insn "*bungt_rev"
6774 (if_then_else (ungt (cc0) (const_int 0))
6776 (label_ref (match_operand 0 "" ""))))]
6779 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6783 (define_insn "*bunle_rev"
6785 (if_then_else (unle (cc0) (const_int 0))
6787 (label_ref (match_operand 0 "" ""))))]
6790 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6794 (define_insn "*bunlt_rev"
6796 (if_then_else (unlt (cc0) (const_int 0))
6798 (label_ref (match_operand 0 "" ""))))]
6801 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6805 (define_insn "*bltgt_rev"
6807 (if_then_else (ltgt (cc0) (const_int 0))
6809 (label_ref (match_operand 0 "" ""))))]
6812 gcc_assert (cc_prev_status.flags & CC_IN_68881);
6816 ;; Unconditional and other jump instructions
6819 (label_ref (match_operand 0 "" "")))]
6822 [(set_attr "type" "bra")])
6824 (define_expand "tablejump"
6825 [(parallel [(set (pc) (match_operand 0 "" ""))
6826 (use (label_ref (match_operand 1 "" "")))])]
6829 #ifdef CASE_VECTOR_PC_RELATIVE
6830 operands[0] = gen_rtx_PLUS (SImode, pc_rtx,
6831 gen_rtx_SIGN_EXTEND (SImode, operands[0]));
6835 ;; Jump to variable address from dispatch table of absolute addresses.
6836 (define_insn "*tablejump_internal"
6837 [(set (pc) (match_operand:SI 0 "register_operand" "a"))
6838 (use (label_ref (match_operand 1 "" "")))]
6841 return MOTOROLA ? "jmp (%0)" : "jmp %0@";
6843 [(set_attr "type" "bra")])
6845 ;; Jump to variable address from dispatch table of relative addresses.
6849 (sign_extend:SI (match_operand:HI 0 "register_operand" "r"))))
6850 (use (label_ref (match_operand 1 "" "")))]
6853 #ifdef ASM_RETURN_CASE_JUMP
6854 ASM_RETURN_CASE_JUMP;
6856 if (TARGET_COLDFIRE)
6858 if (ADDRESS_REG_P (operands[0]))
6859 return MOTOROLA ? "jmp (2,pc,%0.l)" : "jmp pc@(2,%0:l)";
6861 return "ext%.l %0\;jmp (2,pc,%0.l)";
6863 return "extl %0\;jmp pc@(2,%0:l)";
6866 return MOTOROLA ? "jmp (2,pc,%0.w)" : "jmp pc@(2,%0:w)";
6870 ;; Decrement-and-branch insns.
6871 (define_insn "*dbne_hi"
6874 (ne (match_operand:HI 0 "nonimmediate_operand" "+d*g")
6876 (label_ref (match_operand 1 "" ""))
6879 (plus:HI (match_dup 0)
6884 if (DATA_REG_P (operands[0]))
6885 return "dbra %0,%l1";
6886 if (GET_CODE (operands[0]) == MEM)
6887 return "subq%.w #1,%0\;jcc %l1";
6888 return "subq%.w #1,%0\;cmp%.w #-1,%0\;jne %l1";
6891 (define_insn "*dbne_si"
6894 (ne (match_operand:SI 0 "nonimmediate_operand" "+d*g")
6896 (label_ref (match_operand 1 "" ""))
6899 (plus:SI (match_dup 0)
6904 if (DATA_REG_P (operands[0]))
6905 return "dbra %0,%l1\;clr%.w %0\;subq%.l #1,%0\;jcc %l1";
6906 if (GET_CODE (operands[0]) == MEM)
6907 return "subq%.l #1,%0\;jcc %l1";
6908 return "subq%.l #1,%0\;cmp%.l #-1,%0\;jne %l1";
6911 ;; Two dbra patterns that use REG_NOTES info generated by strength_reduce.
6913 (define_insn "*dbge_hi"
6916 (ge (plus:HI (match_operand:HI 0 "nonimmediate_operand" "+d*am")
6919 (label_ref (match_operand 1 "" ""))
6922 (plus:HI (match_dup 0)
6924 "!TARGET_COLDFIRE && find_reg_note (insn, REG_NONNEG, 0)"
6927 if (DATA_REG_P (operands[0]))
6928 return "dbra %0,%l1";
6929 if (GET_CODE (operands[0]) == MEM)
6930 return "subq%.w #1,%0\;jcc %l1";
6931 return "subq%.w #1,%0\;cmp%.w #-1,%0\;jne %l1";
6934 (define_expand "decrement_and_branch_until_zero"
6935 [(parallel [(set (pc)
6937 (ge (plus:SI (match_operand:SI 0 "nonimmediate_operand" "")
6940 (label_ref (match_operand 1 "" ""))
6943 (plus:SI (match_dup 0)
6948 (define_insn "*dbge_si"
6951 (ge (plus:SI (match_operand:SI 0 "nonimmediate_operand" "+d*am")
6954 (label_ref (match_operand 1 "" ""))
6957 (plus:SI (match_dup 0)
6959 "!TARGET_COLDFIRE && find_reg_note (insn, REG_NONNEG, 0)"
6962 if (DATA_REG_P (operands[0]))
6963 return "dbra %0,%l1\;clr%.w %0\;subq%.l #1,%0\;jcc %l1";
6964 if (GET_CODE (operands[0]) == MEM)
6965 return "subq%.l #1,%0\;jcc %l1";
6966 return "subq%.l #1,%0\;cmp%.l #-1,%0\;jne %l1";
6969 (define_expand "sibcall"
6970 [(call (match_operand:QI 0 "memory_operand" "")
6971 (match_operand:SI 1 "general_operand" ""))]
6974 operands[0] = m68k_legitimize_sibcall_address (operands[0]);
6977 (define_insn "*sibcall"
6978 [(call (mem:QI (match_operand:SI 0 "sibcall_operand" ""))
6979 (match_operand:SI 1 "general_operand" ""))]
6980 "SIBLING_CALL_P (insn)"
6982 return output_sibcall (operands[0]);
6985 (define_expand "sibcall_value"
6986 [(set (match_operand 0 "" "")
6987 (call (match_operand:QI 1 "memory_operand" "")
6988 (match_operand:SI 2 "general_operand" "")))]
6991 operands[1] = m68k_legitimize_sibcall_address (operands[1]);
6994 (define_insn "*sibcall_value"
6995 [(set (match_operand 0 "" "=rf,rf")
6996 (call (mem:QI (match_operand:SI 1 "sibcall_operand" ""))
6997 (match_operand:SI 2 "general_operand" "")))]
6998 "SIBLING_CALL_P (insn)"
7000 operands[0] = operands[1];
7001 return output_sibcall (operands[0]);
7004 ;; Call subroutine with no return value.
7005 (define_expand "call"
7006 [(call (match_operand:QI 0 "memory_operand" "")
7007 (match_operand:SI 1 "general_operand" ""))]
7008 ;; Operand 1 not really used on the m68000.
7011 operands[0] = m68k_legitimize_call_address (operands[0]);
7014 (define_insn "*call"
7015 [(call (mem:QI (match_operand:SI 0 "call_operand" "a,W"))
7016 (match_operand:SI 1 "general_operand" "g,g"))]
7017 ;; Operand 1 not really used on the m68000.
7018 "!SIBLING_CALL_P (insn)"
7020 return output_call (operands[0]);
7023 ;; Call subroutine, returning value in operand 0
7024 ;; (which must be a hard register).
7025 (define_expand "call_value"
7026 [(set (match_operand 0 "" "")
7027 (call (match_operand:QI 1 "memory_operand" "")
7028 (match_operand:SI 2 "general_operand" "")))]
7029 ;; Operand 2 not really used on the m68000.
7032 operands[1] = m68k_legitimize_call_address (operands[1]);
7035 (define_insn "*non_symbolic_call_value"
7036 [(set (match_operand 0 "" "=rf,rf")
7037 (call (mem:QI (match_operand:SI 1 "non_symbolic_call_operand" "a,W"))
7038 (match_operand:SI 2 "general_operand" "g,g")))]
7039 ;; Operand 2 not really used on the m68000.
7040 "!SIBLING_CALL_P (insn)"
7042 [(set_attr "type" "jsr")
7043 (set_attr "split" "done")
7044 (set_attr "opx" "1")])
7046 (define_insn "*symbolic_call_value_jsr"
7047 [(set (match_operand 0 "" "=rf,rf")
7048 (call (mem:QI (match_operand:SI 1 "symbolic_operand" "a,W"))
7049 (match_operand:SI 2 "general_operand" "g,g")))]
7050 ;; Operand 2 not really used on the m68000.
7051 "!SIBLING_CALL_P (insn) && m68k_symbolic_call_var == M68K_SYMBOLIC_CALL_JSR"
7053 operands[0] = operands[1];
7054 return m68k_symbolic_call;
7056 [(set_attr "type" "jsr")
7057 (set_attr "split" "done")
7058 (set_attr "opx" "1")])
7060 (define_insn "*symbolic_call_value_bsr"
7061 [(set (match_operand 0 "" "=rf,rf")
7062 (call (mem:QI (match_operand:SI 1 "symbolic_operand" "a,W"))
7063 (match_operand:SI 2 "general_operand" "g,g")))]
7064 ;; Operand 2 not really used on the m68000.
7065 "!SIBLING_CALL_P (insn)
7066 && (m68k_symbolic_call_var == M68K_SYMBOLIC_CALL_BSR_C
7067 || m68k_symbolic_call_var == M68K_SYMBOLIC_CALL_BSR_P)"
7069 operands[0] = operands[1];
7070 return m68k_symbolic_call;
7072 [(set_attr "type" "bsr")
7073 (set_attr "split" "done")
7074 (set_attr "opx" "1")])
7076 ;; Call subroutine returning any type.
7078 (define_expand "untyped_call"
7079 [(parallel [(call (match_operand 0 "" "")
7081 (match_operand 1 "" "")
7082 (match_operand 2 "" "")])]
7083 "NEEDS_UNTYPED_CALL"
7087 emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
7089 for (i = 0; i < XVECLEN (operands[2], 0); i++)
7091 rtx set = XVECEXP (operands[2], 0, i);
7092 emit_move_insn (SET_DEST (set), SET_SRC (set));
7095 /* The optimizer does not know that the call sets the function value
7096 registers we stored in the result block. We avoid problems by
7097 claiming that all hard registers are used and clobbered at this
7099 emit_insn (gen_blockage ());
7104 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
7105 ;; all of memory. This blocks insns from being moved across this point.
7107 (define_insn "blockage"
7108 [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)]
7116 [(set_attr "type" "nop")])
7118 (define_expand "prologue"
7122 m68k_expand_prologue ();
7126 (define_expand "epilogue"
7130 m68k_expand_epilogue (false);
7134 (define_expand "sibcall_epilogue"
7138 m68k_expand_epilogue (true);
7142 ;; Used for frameless functions which save no regs and allocate no locals.
7143 (define_expand "return"
7145 "m68k_use_return_insn ()"
7148 (define_insn "*return"
7152 switch (m68k_get_function_kind (current_function_decl))
7154 case m68k_fk_interrupt_handler:
7157 case m68k_fk_interrupt_thread:
7161 if (crtl->args.pops_args)
7163 operands[0] = GEN_INT (crtl->args.pops_args);
7170 [(set_attr "type" "rts")])
7172 (define_insn "*m68k_store_multiple"
7173 [(match_parallel 0 "" [(match_operand 1 "")])]
7174 "m68k_movem_pattern_p (operands[0], NULL, 0, true)"
7176 return m68k_output_movem (operands, operands[0], 0, true);
7179 (define_insn "*m68k_store_multiple_automod"
7180 [(match_parallel 0 ""
7181 [(set (match_operand:SI 1 "register_operand" "=a")
7182 (plus:SI (match_operand:SI 2 "register_operand" "1")
7183 (match_operand:SI 3 "const_int_operand")))])]
7184 "m68k_movem_pattern_p (operands[0], operands[1], INTVAL (operands[3]), true)"
7186 return m68k_output_movem (operands, operands[0], INTVAL (operands[3]), true);
7189 (define_insn "*m68k_load_multiple"
7190 [(match_parallel 0 "" [(match_operand 1 "")])]
7191 "m68k_movem_pattern_p (operands[0], NULL, 0, false)"
7193 return m68k_output_movem (operands, operands[0], 0, false);
7196 (define_insn "*m68k_load_multiple_automod"
7197 [(match_parallel 0 ""
7198 [(set (match_operand:SI 1 "register_operand" "=a")
7199 (plus:SI (match_operand:SI 2 "register_operand" "1")
7200 (match_operand:SI 3 "const_int_operand")))])]
7201 "m68k_movem_pattern_p (operands[0], operands[1],
7202 INTVAL (operands[3]), false)"
7204 return m68k_output_movem (operands, operands[0],
7205 INTVAL (operands[3]), false);
7208 (define_expand "link"
7210 [(set (match_operand:SI 0 "register_operand")
7211 (plus:SI (reg:SI SP_REG) (const_int -4)))
7214 (set (reg:SI SP_REG)
7215 (plus:SI (reg:SI SP_REG)
7216 (match_operand:SI 1 "const_int_operand")))])]
7217 "TARGET_68020 || INTVAL (operands[1]) >= -0x8004"
7219 operands[2] = gen_frame_mem (SImode, plus_constant (stack_pointer_rtx, -4));
7222 (define_insn "*link"
7223 [(set (match_operand:SI 0 "register_operand" "+r")
7224 (plus:SI (reg:SI SP_REG) (const_int -4)))
7225 (set (mem:SI (plus:SI (reg:SI SP_REG) (const_int -4)))
7227 (set (reg:SI SP_REG)
7228 (plus:SI (reg:SI SP_REG)
7229 (match_operand:SI 1 "const_int_operand")))]
7230 "TARGET_68020 || INTVAL (operands[1]) >= -0x8004"
7232 operands[1] = GEN_INT (INTVAL (operands[1]) + 4);
7234 return "link %0,%1";
7235 else if (INTVAL (operands[1]) >= -0x8000)
7236 return "link.w %0,%1";
7238 return "link.l %0,%1";
7241 (define_expand "unlink"
7243 [(set (match_operand:SI 0 "register_operand")
7245 (set (reg:SI SP_REG)
7246 (plus:SI (match_dup 0)
7250 operands[1] = gen_frame_mem (SImode, copy_rtx (operands[0]));
7253 (define_insn "*unlink"
7254 [(set (match_operand:SI 0 "register_operand" "+r")
7255 (mem:SI (match_dup 0)))
7256 (set (reg:SI SP_REG)
7257 (plus:SI (match_dup 0)
7261 [(set_attr "type" "unlk")])
7263 (define_insn "load_got"
7264 [(set (match_operand:SI 0 "register_operand" "=a")
7265 (unspec:SI [(const_int 0)] UNSPEC_GOT))]
7268 if (TARGET_ID_SHARED_LIBRARY)
7270 operands[1] = gen_rtx_REG (Pmode, PIC_REG);
7271 return MOTOROLA ? "move.l %?(%1),%0" : "movel %1@(%?), %0";
7275 if (TARGET_COLDFIRE)
7276 /* Load the full 32-bit PC-relative offset of
7277 _GLOBAL_OFFSET_TABLE_ into the PIC register, then use it to
7278 calculate the absolute value. The offset and "lea"
7279 operation word together occupy 6 bytes. */
7280 return ("move.l #_GLOBAL_OFFSET_TABLE_@GOTPC, %0\n\t"
7281 "lea (-6, %%pc, %0), %0");
7283 return "lea (%%pc, _GLOBAL_OFFSET_TABLE_@GOTPC), %0";
7286 return ("movel #_GLOBAL_OFFSET_TABLE_, %0\n\t"
7287 "lea %%pc@(0,%0:l),%0");
7290 (define_insn "indirect_jump"
7291 [(set (pc) (match_operand:SI 0 "address_operand" "p"))]
7294 [(set_attr "type" "jmp")])
7296 ;; This should not be used unless the add/sub insns can't be.
7299 [(set (match_operand:SI 0 "nonimmediate_operand" "=a")
7300 (match_operand:QI 1 "address_operand" "p"))]
7304 ;; This is the first machine-dependent peephole optimization.
7305 ;; It is useful when a floating value is returned from a function call
7306 ;; and then is moved into an FP register.
7307 ;; But it is mainly intended to test the support for these optimizations.
7310 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))
7311 (set (match_operand:DF 0 "register_operand" "")
7312 (match_operand:DF 1 "register_operand" ""))]
7313 "FP_REG_P (operands[0]) && !FP_REG_P (operands[1])"
7314 [(set (mem:SI (reg:SI SP_REG)) (match_dup 1))
7315 (set (mem:SI (pre_dec:SI (reg:SI SP_REG))) (match_dup 2))
7316 (set (match_dup 0) (mem:DF (post_inc:SI (reg:SI SP_REG))))]
7317 "split_di(operands + 1, 1, operands + 1, operands + 2);")
7319 ;; Optimize a stack-adjust followed by a push of an argument.
7320 ;; This is said to happen frequently with -msoft-float
7321 ;; when there are consecutive library calls.
7324 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))
7325 (set (match_operand:SF 0 "push_operand" "")
7326 (match_operand:SF 1 "general_operand" ""))]
7327 "!reg_mentioned_p (stack_pointer_rtx, operands[0])"
7328 [(set (match_dup 0) (match_dup 1))]
7329 "operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx);")
7332 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
7333 (match_operand:SI 0 "const_int_operand" "")))
7334 (set (match_operand:SF 1 "push_operand" "")
7335 (match_operand:SF 2 "general_operand" ""))]
7336 "INTVAL (operands[0]) > 4
7337 && !reg_mentioned_p (stack_pointer_rtx, operands[2])"
7338 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (match_dup 0)))
7339 (set (match_dup 1) (match_dup 2))]
7341 operands[0] = GEN_INT (INTVAL (operands[0]) - 4);
7342 operands[1] = replace_equiv_address (operands[1], stack_pointer_rtx);
7345 ;; Speed up stack adjust followed by a fullword fixedpoint push.
7346 ;; Constant operands need special care, as replacing a "pea X.w" with
7347 ;; "move.l #X,(%sp)" is often not a win.
7349 ;; Already done by the previous csa pass, left as reference.
7351 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 4)))
7352 (set (match_operand:SI 0 "push_operand" "")
7353 (match_operand:SI 1 "general_operand" ""))]
7354 "!reg_mentioned_p (stack_pointer_rtx, operands[1])"
7355 [(set (match_dup 0) (match_dup 1))]
7356 "operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx);")
7358 ;; Try to use moveq, after stack push has been changed into a simple move.
7360 [(match_scratch:SI 2 "d")
7361 (set (match_operand:SI 0 "memory_operand" "")
7362 (match_operand:SI 1 "const_int_operand" ""))]
7363 "GET_CODE (XEXP (operands[0], 0)) != PRE_DEC
7364 && INTVAL (operands[1]) != 0
7365 && IN_RANGE (INTVAL (operands[1]), -0x80, 0x7f)
7366 && !valid_mov3q_const (INTVAL (operands[1]))"
7367 [(set (match_dup 2) (match_dup 1))
7368 (set (match_dup 0) (match_dup 2))])
7370 ;; This sequence adds an instruction, but is two bytes shorter.
7372 [(match_scratch:SI 2 "d")
7373 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 12)))
7374 (set (match_operand:SI 0 "push_operand" "")
7375 (match_operand:SI 1 "const_int_operand" ""))]
7376 "INTVAL (operands[1]) != 0
7377 && IN_RANGE (INTVAL (operands[1]), -0x80, 0x7f)
7378 && !valid_mov3q_const (INTVAL (operands[1]))"
7379 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int 8)))
7380 (set (match_dup 2) (match_dup 1))
7381 (set (match_dup 0) (match_dup 2))]
7382 "operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx);")
7384 ;; Changing pea X.w into a move.l is no real win here.
7386 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG)
7387 (match_operand:SI 0 "const_int_operand" "")))
7388 (set (match_operand:SI 1 "push_operand" "")
7389 (match_operand:SI 2 "general_operand" ""))]
7390 "INTVAL (operands[0]) > 4
7391 && !reg_mentioned_p (stack_pointer_rtx, operands[2])
7392 && !(CONST_INT_P (operands[2]) && INTVAL (operands[2]) != 0
7393 && IN_RANGE (INTVAL (operands[2]), -0x8000, 0x7fff)
7394 && !valid_mov3q_const (INTVAL (operands[2])))"
7395 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (match_dup 0)))
7396 (set (match_dup 1) (match_dup 2))]
7398 operands[0] = GEN_INT (INTVAL (operands[0]) - 4);
7399 operands[1] = replace_equiv_address (operands[1], stack_pointer_rtx);
7402 ;; Speed up pushing a single byte/two bytes but leaving four bytes of space
7403 ;; (which differs slightly between m680x0 and ColdFire).
7406 [(set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -4)))
7407 (set (match_operand:QI 0 "memory_operand" "")
7408 (match_operand:QI 1 "register_operand" ""))]
7409 "!reg_mentioned_p (stack_pointer_rtx, operands[1])
7410 && GET_CODE (XEXP (operands[0], 0)) == PLUS
7411 && rtx_equal_p (XEXP (XEXP (operands[0], 0), 0), stack_pointer_rtx)
7412 && CONST_INT_P (XEXP (XEXP (operands[0], 0), 1))
7413 && INTVAL (XEXP (XEXP (operands[0], 0), 1)) == 3"
7414 [(set (match_dup 0) (match_dup 1))]
7416 rtx addr = gen_rtx_PRE_DEC (Pmode, stack_pointer_rtx);
7417 operands[0] = adjust_automodify_address (operands[0], SImode, addr, -3);
7418 operands[1] = simplify_gen_subreg (SImode, operands[1], QImode, 0);
7422 [(set (match_operand:QI 0 "push_operand" "")
7423 (match_operand:QI 1 "register_operand" ""))
7424 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -3)))]
7425 "!reg_mentioned_p (stack_pointer_rtx, operands[1])"
7426 [(set (match_dup 0) (match_dup 1))]
7428 operands[0] = adjust_automodify_address (operands[0], SImode,
7429 XEXP (operands[0], 0), -3);
7430 operands[1] = simplify_gen_subreg (SImode, operands[1], QImode, 0);
7434 [(set (match_operand:HI 0 "push_operand" "")
7435 (match_operand:HI 1 "register_operand" ""))
7436 (set (reg:SI SP_REG) (plus:SI (reg:SI SP_REG) (const_int -2)))]
7437 "!reg_mentioned_p (stack_pointer_rtx, operands[1])"
7438 [(set (match_dup 0) (match_dup 1))]
7440 operands[0] = adjust_automodify_address (operands[0], SImode,
7441 XEXP (operands[0], 0), -2);
7442 operands[1] = simplify_gen_subreg (SImode, operands[1], HImode, 0);
7445 ;; Optimize a series of strict_low_part assignments
7448 [(set (match_operand:SI 0 "register_operand" "")
7450 (set (strict_low_part (match_operand:HI 1 "register_operand" ""))
7451 (match_operand:HI 2 "general_operand" ""))]
7452 "REGNO (operands[0]) == REGNO (operands[1])
7453 && strict_low_part_peephole_ok (HImode, insn, operands[0])"
7454 [(set (strict_low_part (match_dup 1)) (match_dup 2))]
7458 [(set (match_operand:SI 0 "register_operand" "")
7460 (set (strict_low_part (match_operand:QI 1 "register_operand" ""))
7461 (match_operand:QI 2 "general_operand" ""))]
7462 "REGNO (operands[0]) == REGNO (operands[1])
7463 && strict_low_part_peephole_ok (QImode, insn, operands[0])"
7464 [(set (strict_low_part (match_dup 1)) (match_dup 2))]
7472 ;; jCC label ; abnormal loop termination
7473 ;; dbra dN, loop ; normal loop termination
7481 ;; Which moves the jCC condition outside the inner loop for free.
7485 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
7486 [(cc0) (const_int 0)])
7487 (label_ref (match_operand 2 "" ""))
7492 (ne (match_operand:HI 0 "register_operand" "")
7494 (label_ref (match_operand 1 "" ""))
7497 (plus:HI (match_dup 0)
7499 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
7502 output_dbcc_and_branch (operands);
7507 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
7508 [(cc0) (const_int 0)])
7509 (label_ref (match_operand 2 "" ""))
7514 (ne (match_operand:SI 0 "register_operand" "")
7516 (label_ref (match_operand 1 "" ""))
7519 (plus:SI (match_dup 0)
7521 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
7524 output_dbcc_and_branch (operands);
7529 [(set (pc) (if_then_else (match_operator 3 "valid_dbcc_comparison_p"
7530 [(cc0) (const_int 0)])
7531 (label_ref (match_operand 2 "" ""))
7536 (ge (plus:HI (match_operand:HI 0 "register_operand" "")
7539 (label_ref (match_operand 1 "" ""))
7542 (plus:HI (match_dup 0)
7544 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
7547 output_dbcc_and_branch (operands);
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 (ge (plus:SI (match_operand:SI 0 "register_operand" "")
7562 (label_ref (match_operand 1 "" ""))
7565 (plus:SI (match_dup 0)
7567 "!TARGET_COLDFIRE && DATA_REG_P (operands[0]) && ! flags_in_68881 ()"
7570 output_dbcc_and_branch (operands);
7575 (define_insn "extendsfxf2"
7576 [(set (match_operand:XF 0 "nonimmediate_operand" "=fm,f")
7577 (float_extend:XF (match_operand:SF 1 "general_operand" "f,rmF")))]
7580 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
7582 if (REGNO (operands[0]) == REGNO (operands[1]))
7584 /* Extending float to double in an fp-reg is a no-op.
7585 NOTICE_UPDATE_CC has already assumed that the
7586 cc will be set. So cancel what it did. */
7587 cc_status = cc_prev_status;
7590 return "f%$move%.x %1,%0";
7592 if (FP_REG_P (operands[0]))
7594 if (FP_REG_P (operands[1]))
7595 return "f%$move%.x %1,%0";
7596 else if (ADDRESS_REG_P (operands[1]))
7597 return "move%.l %1,%-\;f%$move%.s %+,%0";
7598 else if (GET_CODE (operands[1]) == CONST_DOUBLE)
7599 return output_move_const_single (operands);
7600 return "f%$move%.s %f1,%0";
7602 return "fmove%.x %f1,%0";
7606 (define_insn "extenddfxf2"
7607 [(set (match_operand:XF 0 "nonimmediate_operand" "=fm,f")
7609 (match_operand:DF 1 "general_operand" "f,rmE")))]
7612 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
7614 if (REGNO (operands[0]) == REGNO (operands[1]))
7616 /* Extending float to double in an fp-reg is a no-op.
7617 NOTICE_UPDATE_CC has already assumed that the
7618 cc will be set. So cancel what it did. */
7619 cc_status = cc_prev_status;
7622 return "fmove%.x %1,%0";
7624 if (FP_REG_P (operands[0]))
7626 if (REG_P (operands[1]))
7629 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
7630 output_asm_insn ("move%.l %1,%-", xoperands);
7631 output_asm_insn ("move%.l %1,%-", operands);
7632 return "f%&move%.d %+,%0";
7634 if (GET_CODE (operands[1]) == CONST_DOUBLE)
7635 return output_move_const_double (operands);
7636 return "f%&move%.d %f1,%0";
7638 return "fmove%.x %f1,%0";
7641 (define_insn "truncxfdf2"
7642 [(set (match_operand:DF 0 "nonimmediate_operand" "=m,!r")
7644 (match_operand:XF 1 "general_operand" "f,f")))]
7647 if (REG_P (operands[0]))
7649 output_asm_insn ("fmove%.d %f1,%-\;move%.l %+,%0", operands);
7650 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
7651 return "move%.l %+,%0";
7653 return "fmove%.d %f1,%0";
7656 (define_insn "truncxfsf2"
7657 [(set (match_operand:SF 0 "nonimmediate_operand" "=dm")
7659 (match_operand:XF 1 "general_operand" "f")))]
7663 (define_insn "sin<mode>2"
7664 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
7666 [(match_operand:FP 1 "general_operand" "f<FP:dreg>m")] UNSPEC_SIN))]
7667 "TARGET_68881 && flag_unsafe_math_optimizations"
7669 if (FP_REG_P (operands[1]))
7670 return "fsin%.x %1,%0";
7672 return "fsin%.<FP:prec> %1,%0";
7675 (define_insn "cos<mode>2"
7676 [(set (match_operand:FP 0 "nonimmediate_operand" "=f")
7678 [(match_operand:FP 1 "general_operand" "f<FP:dreg>m")] UNSPEC_COS))]
7679 "TARGET_68881 && flag_unsafe_math_optimizations"
7681 if (FP_REG_P (operands[1]))
7682 return "fcos%.x %1,%0";
7684 return "fcos%.<FP:prec> %1,%0";
7687 ;; Unconditional traps are assumed to have (const_int 1) for the condition.
7689 [(trap_if (const_int 1) (const_int 7))]
7692 [(set_attr "type" "trap")])
7694 (define_expand "conditional_trap"
7695 [(trap_if (match_operator 0 "valid_dbcc_comparison_p"
7696 [(cc0) (const_int 0)])
7697 (match_operand:SI 1 "const_int_operand" "I"))]
7700 if (m68k_last_compare_had_fp_operands)
7702 m68k_last_compare_had_fp_operands = 0;
7707 (define_insn "*conditional_trap"
7708 [(trap_if (match_operator 0 "valid_dbcc_comparison_p"
7709 [(cc0) (const_int 0)])
7710 (match_operand:SI 1 "const_int_operand" "I"))]
7711 "TARGET_68020 && ! flags_in_68881 ()"
7713 switch (GET_CODE (operands[0]))
7715 case EQ: return "trapeq";
7716 case NE: return "trapne";
7717 case GT: return "trapgt";
7718 case GTU: return "traphi";
7719 case LT: return "traplt";
7720 case LTU: return "trapcs";
7721 case GE: return "trapge";
7722 case GEU: return "trapcc";
7723 case LE: return "traple";
7724 case LEU: return "trapls";
7725 default: gcc_unreachable ();
7729 ;; Instruction that subscribes one word in ColdFire instruction buffer.
7730 ;; This instruction is used within scheduler only and should not appear
7731 ;; in the instruction stream.
7733 [(unspec [(const_int 0)] UNSPEC_IB)]
7736 [(set_attr "type" "ib")])