1 ;;- Machine description for GNU compiler, Motorola 68000 Version
2 ;; Copyright (C) 1987, 88, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
4 ;; This file is part of GNU CC.
6 ;; GNU CC is free software; you can redistribute it and/or modify
7 ;; it under the terms of the GNU General Public License as published by
8 ;; the Free Software Foundation; either version 2, or (at your option)
11 ;; GNU CC is distributed in the hope that it will be useful,
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;; GNU General Public License for more details.
16 ;; You should have received a copy of the GNU General Public License
17 ;; along with GNU CC; see the file COPYING. If not, write to
18 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
19 ;; Boston, MA 02111-1307, USA.
21 ;;- Information about MCF5200 port.
23 ;;- The MCF5200 "ColdFire" architecture is a reduced version of the
24 ;;- 68k ISA. Differences include reduced support for byte and word
25 ;;- operands and the removal of BCD, bitfield, rotate, and integer
26 ;;- divide instructions. The TARGET_5200 flag turns the use of the
27 ;;- removed opcodes and addressing modes off.
31 ;;- instruction definitions
33 ;;- @@The original PO technology requires these to be ordered by speed,
34 ;;- @@ so that assigner will pick the fastest.
36 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
38 ;;- When naming insn's (operand 0 of define_insn) be careful about using
39 ;;- names from other targets machine descriptions.
41 ;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
42 ;;- updates for most instructions.
44 ;;- Operand classes for the register allocator:
45 ;;- 'a' one of the address registers can be used.
46 ;;- 'd' one of the data registers can be used.
47 ;;- 'f' one of the m68881 registers can be used
48 ;;- 'r' either a data or an address register can be used.
49 ;;- 'x' if one of the Sun FPA registers
50 ;;- 'y' if one of the Low Sun FPA registers (fpa0-fpa15).
52 ;;- Immediate Floating point operator constraints
53 ;;- 'G' a floating point constant that is *NOT* one of the standard
54 ;; 68881 constant values (to force calling output_move_const_double
55 ;; to get it from rom if it is a 68881 constant).
56 ;;- 'H' one of the standard FPA constant values
58 ;; See the functions standard_XXX_constant_p in output-m68k.c for more
61 ;;- Immediate integer operand constraints:
63 ;;- 'J' -32768 .. 32767
64 ;;- 'K' all integers EXCEPT -128 .. 127
66 ;;- 'M' all integers EXCEPT -256 .. 255
72 ;;- "%." size separator ("." or "") move%.l d0,d1
73 ;;- "%#" immediate separator ("#" or "") move%.l %#0,d0
74 ;;- "%-" push operand "sp@-" move%.l d0,%-
75 ;;- "%+" pop operand "sp@+" move%.l d0,%+
76 ;;- "%@" top of stack "sp@" move%.l d0,%@
77 ;;- "%!" fpcr register
78 ;;- "%$" single-precision fp specifier ("s" or "") f%$add.x fp0,fp1
79 ;;- "%&" double-precision fp specifier ("d" or "") f%&add.x fp0,fp1
82 ;; 1 This is a `sin' operation. The mode of the UNSPEC is MODE_FLOAT.
83 ;; operand 1 is the argument for `sin'.
84 ;; 2 This is a `cos' operation. The mode of the UNSPEC is MODE_FLOAT.
85 ;; operand 1 is the argument for `cos'.
87 ;;- Information about 68040 port.
89 ;;- The 68040 executes all 68030 and 68881/2 instructions, but some must
90 ;;- be emulated in software by the OS. It is faster to avoid these
91 ;;- instructions and issue a library call rather than trapping into
92 ;;- the kernel. The affected instructions are fintrz and fscale. The
93 ;;- TARGET_68040 flag turns the use of the opcodes off.
95 ;;- The '040 also implements a set of new floating-point instructions
96 ;;- which specify the rounding precision in the opcode. This finally
97 ;;- permit the 68k series to be truly IEEE compliant, and solves all
98 ;;- issues of excess precision accumulating in the extended registers.
99 ;;- By default, GCC does not use these instructions, since such code will
100 ;;- not run on an '030. To use these instructions, use the -m68040-only
101 ;;- switch. By changing TARGET_DEFAULT to include TARGET_68040_ONLY,
102 ;;- you can make these instructions the default.
104 ;;- These new instructions aren't directly in the md. They are brought
105 ;;- into play by defining "%$" and "%&" to expand to "s" and "d" rather
108 ;;- Information about 68060 port.
110 ;;- The 68060 executes all 68030 and 68881/2 instructions, but some must
111 ;;- be emulated in software by the OS. It is faster to avoid these
112 ;;- instructions and issue a library call rather than trapping into
113 ;;- the kernel. The affected instructions are: divs.l <ea>,Dr:Dq;
114 ;;- divu.l <ea>,Dr:Dq; muls.l <ea>,Dr:Dq; mulu.l <ea>,Dr:Dq; and
115 ;;- fscale. The TARGET_68060 flag turns the use of the opcodes off.
117 ;;- FPA port explanation:
119 ;;- Usage of the Sun FPA and the 68881 together
121 ;;- The current port of gcc to the sun fpa disallows use of the m68881
122 ;;- instructions completely if code is targeted for the fpa. This is
123 ;;- for the following reasons:
125 ;;- 1) Expressing the preference hierarchy (ie. use the fpa if you
126 ;;- can, the 68881 otherwise, and data registers only if you are
127 ;;- forced to it) is a bitch with the current constraint scheme,
128 ;;- especially since it would have to work for any combination of
131 ;;- 2) There are no instructions to move between the two types of
132 ;;- registers; the stack must be used as an intermediary.
134 ;;- It could indeed be done; I think the best way would be to have
135 ;;- separate patterns for TARGET_FPA (which implies a 68881),
136 ;;- TARGET_68881, and no floating point co-processor. Use
137 ;;- define_expands for all of the named instruction patterns, and
138 ;;- include code in the FPA instruction to deal with the 68881 with
139 ;;- preferences specifically set to favor the fpa. Some of this has
140 ;;- already been done:
142 ;;- 1) Separation of most of the patterns out into a TARGET_FPA
143 ;;- case and a TARGET_68881 case (the exceptions are the patterns
144 ;;- which would need one define_expand and three define_insn's under
145 ;;- it (with a lot of duplicate code between them) to replace the
146 ;;- current single define_insn. These are mov{[ds]f,[ds]i} and the
147 ;;- first two patterns in the md.
149 ;;- Some would still have to be done:
151 ;;- 1) Add code to the fpa patterns which correspond to 68881
152 ;;- patterns to deal with the 68881 case (including preferences!).
153 ;;- What you might actually do here is combine the fpa and 68881 code
154 ;;- back together into one pattern for those instructions where it's
155 ;;- absolutely necessary and save yourself some duplicate code. I'm
156 ;;- not completely sure as to whether you could get away with doing
157 ;;- this only for the mov* insns, or if you'd have to do it for all
159 ;;- 2) Add code to the mov{[ds]f,[ds]i} instructions to handle
160 ;;- moving between fpa regs and 68881 regs.
162 ;;- Since the fpa is more powerful than the 68881 and also has more
163 ;;- registers, and since I think the resultant md would be medium ugly
164 ;;- (lot's of duplicate code, ugly constraint strings), I elected not
165 ;;- to do this change.
167 ;;- Another reason why someone *might* want to do the change is to
168 ;;- control which register classes are accessed in a slightly cleaner
169 ;;- way than I have. See the blurb on CONDITIONAL_REGISTER_USAGE in
170 ;;- the internals manual.
172 ;;- Yet another reason why someone might want to do this change is to
173 ;;- allow use of some of the 68881 insns which have no equivalent on
174 ;;- the fpa. The sqrt instruction comes fairly quickly to mind.
176 ;;- If this is ever done, don't forget to change sun3.h so that
177 ;;- it *will* define __HAVE_68881__ when the FPA is in use.
179 ;;- Condition code hack
181 ;;- When a floating point compare is done in the fpa, the resulting
182 ;;- condition codes are left in the fpastatus register. The values in
183 ;;- this register must be moved into the 68000 cc register before any
184 ;;- jump is executed. Once this has been done, regular jump
185 ;;- instructions are fine (ie. floating point jumps are not necessary.
186 ;;- They are only done if the cc is in the 68881).
188 ;;- The instructions that move the fpastatus register to the 68000
189 ;;- register clobber a data register (the move cannot be done direct).
190 ;;- These instructions might be bundled either with the compare
191 ;;- instruction, or the branch instruction. If we were using both the
192 ;;- fpa and the 68881 together, we would wish to only mark the
193 ;;- register clobbered if we were doing the compare in the fpa, but I
194 ;;- think that that decision (whether to clobber the register or not)
195 ;;- must be done before register allocation (makes sense) and hence we
196 ;;- can't know if the floating point compare will be done in the fpa
197 ;;- or the fp. So whenever we are asked for code that uses the fpa,
198 ;;- we will mark a data register as clobbered. This is reasonable, as
199 ;;- almost all floating point compare operations done with fpa code
200 ;;- enabled will be done in the fpa. It's even more reasonable since
201 ;;- we decided to make the 68881 and the fpa mutually exclusive.
203 ;;- We place to code to move the fpastatus register inside of a
204 ;;- define_expand so that we can do it conditionally based on whether
205 ;;- we are targeting an fpa or not.
207 ;;- This still leaves us with the question of where we wish to put the
208 ;;- code to move the fpastatus reg. If we put it in the compare
209 ;;- instruction, we can restrict the clobbering of the register to
210 ;;- floating point compares, but we can't take advantage of floating
211 ;;- point subtracts & etc. that alter the fpastatus register. If we
212 ;;- put it in the branch instruction, all branches compiled with fpa
213 ;;- code enabled will clobber a data register, but we will be able to
214 ;;- take advantage of fpa subtracts. This balance favors putting the
215 ;;- code in with the compare instruction.
217 ;;- Note that if some enterprising hacker should decide to switch
218 ;;- this, he'll need to modify the code in NOTICE_UPDATE_CC.
220 ;;- Usage of the top 16 fpa registers
222 ;;- The only locations which we may transfer fpa registers 16-31 from
223 ;;- or to are the fpa registers 0-15. (68000 registers and memory
224 ;;- locations are impossible). This causes problems in gcc, which
225 ;;- assumes that mov?? instructions require no additional registers
226 ;;- (see section 11.7) and since floating point moves *must* be
227 ;;- supported into general registers (see section 12.3 under
228 ;;- HARD_REGNO_OK_FOR_MODE_P) from anywhere.
230 ;;- My solution was to reserve fpa0 for moves into or out of these top
231 ;;- 16 registers and to disparage the choice to reload into or out of
232 ;;- these registers as much as I could. That alternative is always
233 ;;- last in the list, so it will not be used unless all else fails. I
234 ;;- will note that according to my current information, sun's compiler
235 ;;- doesn't use these top 16 registers at all.
237 ;;- There is another possible way to do it. I *believe* that if you
238 ;;- make absolutely sure that the code will not be executed in the
239 ;;- reload pass, you can support the mov?? names with define_expands
240 ;;- which require new registers. This may be possible by the
241 ;;- appropriate juggling of constraints. I may come back to this later.
243 ;;- Usage of constant RAM
245 ;;- This has been handled correctly (I believe) but the way I've done
246 ;;- it could use a little explanation. The constant RAM can only be
247 ;;- accessed when the instruction is in "command register" mode.
248 ;;- "command register" mode means that no accessing of memory or the
249 ;;- 68000 registers is being done. This can be expressed easily in
250 ;;- constraints, so generally the mode of the instruction is
251 ;;- determined by a branch off of which_alternative. In outputting
252 ;;- instructions, a 'w' means to output an access to the constant ram
253 ;;- (if the arg is CONST_DOUBLE and is one of the available
254 ;;- constants), and 'x' means to output a register pair (if the arg is
255 ;;- a 68000 register) and a 'y' is the combination of the above two
256 ;;- processes. You use a 'y' in two operand DF instructions where you
257 ;;- *know* the other operand is an fpa register, you use an 'x' in DF
258 ;;- instructions where the arg might be a 68000 register and the
259 ;;- instruction is *not* in "command register" mode, and you use a 'w'
260 ;;- in two situations: 1) The instruction *is* in command register
261 ;;- mode (and hence won't be accessing 68000 registers), or 2) The
262 ;;- instruction is a two operand SF instruction where you know the
263 ;;- other operand is an fpa register.
265 ;;- Optimization issues
267 ;;- I actually think that I've included all of the fpa instructions
268 ;;- that should be included. Note that if someone is interested in
269 ;;- doing serious floating point work on the sun fpa, I would advise
270 ;;- the use of the "asm" instruction in gcc to allow you to use the
271 ;;- sin, cos, and exponential functions on the fpa board.
273 ;;- END FPA Explanation Section.
276 ;;- Some of these insn's are composites of several m68000 op codes.
277 ;;- The assembler (or final @@??) insures that the appropriate one is
281 [(set (match_operand:DF 0 "push_operand" "=m")
282 (match_operand:DF 1 "general_operand" "ro<>fyE"))]
286 if (FP_REG_P (operands[1]))
287 return \"fmove%.d %f1,%0\";
288 if (FPA_REG_P (operands[1]))
289 return \"fpmove%.d %1, %x0\";
290 return output_move_double (operands);
293 (define_insn "pushdi"
294 [(set (match_operand:DI 0 "push_operand" "=m")
295 (match_operand:DI 1 "general_operand" "ro<>Fyi"))]
299 return output_move_double (operands);
302 ;; We don't want to allow a constant operand for test insns because
303 ;; (set (cc0) (const_int foo)) has no mode information. Such insns will
304 ;; be folded while optimizing anyway.
306 (define_expand "tstdi"
307 [(parallel [(set (cc0)
308 (match_operand:DI 0 "nonimmediate_operand" ""))
309 (clobber (match_scratch:SI 1 ""))
310 (clobber (match_scratch:DI 2 ""))])]
312 "m68k_last_compare_had_fp_operands = 0;")
316 (match_operand:DI 0 "nonimmediate_operand" "am,d"))
317 (clobber (match_scratch:SI 1 "=X,d"))
318 (clobber (match_scratch:DI 2 "=d,X"))]
322 if (which_alternative == 0)
326 xoperands[0] = operands[2];
327 xoperands[1] = operands[0];
328 output_move_double (xoperands);
329 cc_status.flags |= CC_REVERSED;
330 return \"neg%.l %R2\;negx%.l %2\";
332 if (find_reg_note (insn, REG_DEAD, operands[0]))
334 cc_status.flags |= CC_REVERSED;
335 return \"neg%.l %R0\;negx%.l %0\";
339 ** 'sub' clears %1, and also clears the X cc bit
340 ** 'tst' sets the Z cc bit according to the low part of the DImode operand
341 ** 'subx %1' (i.e. subx #0) acts as a (non-existent) tstx on the high part
343 return \"sub%.l %1,%1\;tst%.l %R0\;subx%.l %1,%0\";
346 (define_expand "tstsi"
348 (match_operand:SI 0 "nonimmediate_operand" ""))]
350 "m68k_last_compare_had_fp_operands = 0;")
354 (match_operand:SI 0 "nonimmediate_operand" "rm"))]
359 /* ISI's assembler fails to handle tstl a0. */
360 if (! ADDRESS_REG_P (operands[0]))
362 if (TARGET_68020 || TARGET_5200 || ! ADDRESS_REG_P (operands[0]))
364 return \"tst%.l %0\";
365 /* If you think that the 68020 does not support tstl a0,
366 reread page B-167 of the 68020 manual more carefully. */
367 /* On an address reg, cmpw may replace cmpl. */
369 return \"cmp%.w %0,%#0\";
371 return \"cmp%.w %#0,%0\";
375 ;; This can't use an address register, because comparisons
376 ;; with address registers as second operand always test the whole word.
377 (define_expand "tsthi"
379 (match_operand:HI 0 "nonimmediate_operand" ""))]
381 "m68k_last_compare_had_fp_operands = 0;")
385 (match_operand:HI 0 "nonimmediate_operand" "dm"))]
389 (define_expand "tstqi"
391 (match_operand:QI 0 "nonimmediate_operand" ""))]
393 "m68k_last_compare_had_fp_operands = 0;")
397 (match_operand:QI 0 "nonimmediate_operand" "dm"))]
401 (define_expand "tstsf"
403 (match_operand:SF 0 "general_operand" ""))]
404 "TARGET_68881 || TARGET_FPA"
407 m68k_last_compare_had_fp_operands = 1;
410 emit_insn (gen_tstsf_fpa (operands[0]));
415 (define_insn "tstsf_fpa"
417 (match_operand:SF 0 "general_operand" "xmdF"))
418 (clobber (match_scratch:SI 1 "=d"))]
420 "fptst%.s %x0\;fpmove fpastatus,%1\;movw %1,cc")
424 (match_operand:SF 0 "general_operand" "fdm"))]
428 cc_status.flags = CC_IN_68881;
429 if (FP_REG_P (operands[0]))
430 return \"ftst%.x %0\";
431 return \"ftst%.s %0\";
434 (define_expand "tstdf"
436 (match_operand:DF 0 "general_operand" ""))]
437 "TARGET_68881 || TARGET_FPA"
440 m68k_last_compare_had_fp_operands = 1;
443 emit_insn (gen_tstsf_fpa (operands[0]));
448 (define_insn "tstdf_fpa"
450 (match_operand:DF 0 "general_operand" "xrmF"))
451 (clobber (match_scratch:SI 1 "=d"))]
453 "fptst%.d %x0\;fpmove fpastatus,%1\;movw %1,cc")
457 (match_operand:DF 0 "general_operand" "fm"))]
461 cc_status.flags = CC_IN_68881;
462 if (FP_REG_P (operands[0]))
463 return \"ftst%.x %0\";
464 return \"ftst%.d %0\";
467 ;; compare instructions.
469 (define_expand "cmpdi"
472 (compare (match_operand:DI 0 "nonimmediate_operand" "")
473 (match_operand:DI 1 "general_operand" "")))
474 (clobber (match_dup 2))])]
476 "m68k_last_compare_had_fp_operands = 0; operands[2] = gen_reg_rtx (DImode);")
480 (compare (match_operand:DI 1 "nonimmediate_operand" "0,d")
481 (match_operand:DI 2 "general_operand" "d,0")))
482 (clobber (match_operand:DI 0 "register_operand" "=d,d"))]
486 if (rtx_equal_p (operands[0], operands[1]))
487 return \"sub%.l %R2,%R0\;subx%.l %2,%0\";
490 cc_status.flags |= CC_REVERSED;
491 return \"sub%.l %R1,%R0\;subx%.l %1,%0\";
495 ;; This is the second "hook" for PIC code (in addition to movsi). See
496 ;; comment of movsi for a description of PIC handling.
497 (define_expand "cmpsi"
499 (compare (match_operand:SI 0 "nonimmediate_operand" "")
500 (match_operand:SI 1 "general_operand" "")))]
504 m68k_last_compare_had_fp_operands = 0;
505 if (flag_pic && symbolic_operand (operands[1], SImode))
507 /* The source is an address which requires PIC relocation.
508 Call legitimize_pic_address with the source, mode, and a relocation
509 register (a new pseudo, or the final destination if reload_in_progress
510 is set). Then fall through normally */
511 extern rtx legitimize_pic_address();
512 rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
513 operands[1] = legitimize_pic_address (operands[1], SImode, temp);
517 ;; A composite of the cmp, cmpa, cmpi & cmpm m68000 op codes.
520 (compare (match_operand:SI 0 "nonimmediate_operand" "rKs,mr,>")
521 (match_operand:SI 1 "general_operand" "mr,rKs,>")))]
525 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
527 return \"cmpm%.l %0,%1\";
529 return \"cmpm%.l %1,%0\";
531 if (REG_P (operands[1])
532 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
533 { cc_status.flags |= CC_REVERSED;
535 return \"cmp%.l %d1,%d0\";
537 return \"cmp%.l %d0,%d1\";
541 return \"cmp%.l %d0,%d1\";
543 return \"cmp%.l %d1,%d0\";
549 (compare (match_operand:SI 0 "nonimmediate_operand" "mrKs,r")
550 (match_operand:SI 1 "general_operand" "r,mrKs")))]
554 if (REG_P (operands[1])
555 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
556 { cc_status.flags |= CC_REVERSED;
558 return \"cmp%.l %d1,%d0\";
560 return \"cmp%.l %d0,%d1\";
564 return \"cmp%.l %d0,%d1\";
566 return \"cmp%.l %d1,%d0\";
570 (define_expand "cmphi"
572 (compare (match_operand:HI 0 "nonimmediate_operand" "")
573 (match_operand:HI 1 "general_operand" "")))]
575 "m68k_last_compare_had_fp_operands = 0;")
579 (compare (match_operand:HI 0 "nonimmediate_operand" "rnm,d,n,m,>")
580 (match_operand:HI 1 "general_operand" "d,rnm,m,n,>")))]
584 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
586 return \"cmpm%.w %0,%1\";
588 return \"cmpm%.w %1,%0\";
590 if ((REG_P (operands[1]) && !ADDRESS_REG_P (operands[1]))
591 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
592 { cc_status.flags |= CC_REVERSED;
594 return \"cmp%.w %d1,%d0\";
596 return \"cmp%.w %d0,%d1\";
600 return \"cmp%.w %d0,%d1\";
602 return \"cmp%.w %d1,%d0\";
606 (define_expand "cmpqi"
608 (compare (match_operand:QI 0 "nonimmediate_operand" "")
609 (match_operand:QI 1 "general_operand" "")))]
611 "m68k_last_compare_had_fp_operands = 0;")
615 (compare (match_operand:QI 0 "nonimmediate_operand" "dn,md,>")
616 (match_operand:QI 1 "general_operand" "dm,nd,>")))]
620 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
622 return \"cmpm%.b %0,%1\";
624 return \"cmpm%.b %1,%0\";
626 if (REG_P (operands[1])
627 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
628 { cc_status.flags |= CC_REVERSED;
630 return \"cmp%.b %d1,%d0\";
632 return \"cmp%.b %d0,%d1\";
636 return \"cmp%.b %d0,%d1\";
638 return \"cmp%.b %d1,%d0\";
642 (define_expand "cmpdf"
644 (compare (match_operand:DF 0 "general_operand" "")
645 (match_operand:DF 1 "general_operand" "")))]
646 "TARGET_68881 || TARGET_FPA"
649 m68k_last_compare_had_fp_operands = 1;
652 emit_insn (gen_cmpdf_fpa (operands[0], operands[1]));
657 (define_insn "cmpdf_fpa"
659 (compare (match_operand:DF 0 "general_operand" "x,y")
660 (match_operand:DF 1 "general_operand" "xH,rmF")))
661 (clobber (match_scratch:SI 2 "=d,d"))]
663 "fpcmp%.d %y1,%0\;fpmove fpastatus,%2\;movw %2,cc")
667 (compare (match_operand:DF 0 "general_operand" "f,mG")
668 (match_operand:DF 1 "general_operand" "fmG,f")))]
672 cc_status.flags = CC_IN_68881;
674 if (REG_P (operands[0]))
676 if (REG_P (operands[1]))
677 return \"fcmp%.x %0,%1\";
679 return \"fcmp%.d %0,%f1\";
681 cc_status.flags |= CC_REVERSED;
682 return \"fcmp%.d %1,%f0\";
684 if (REG_P (operands[0]))
686 if (REG_P (operands[1]))
687 return \"fcmp%.x %1,%0\";
689 return \"fcmp%.d %f1,%0\";
691 cc_status.flags |= CC_REVERSED;
692 return \"fcmp%.d %f0,%1\";
696 (define_expand "cmpsf"
698 (compare (match_operand:SF 0 "general_operand" "")
699 (match_operand:SF 1 "general_operand" "")))]
700 "TARGET_68881 || TARGET_FPA"
703 m68k_last_compare_had_fp_operands = 1;
706 emit_insn (gen_cmpsf_fpa (operands[0], operands[1]));
711 (define_insn "cmpsf_fpa"
713 (compare (match_operand:SF 0 "general_operand" "x,y")
714 (match_operand:SF 1 "general_operand" "xH,rmF")))
715 (clobber (match_scratch:SI 2 "=d,d"))]
717 "fpcmp%.s %w1,%x0\;fpmove fpastatus,%2\;movw %2,cc")
721 (compare (match_operand:SF 0 "general_operand" "f,mdG")
722 (match_operand:SF 1 "general_operand" "fmdG,f")))]
726 cc_status.flags = CC_IN_68881;
728 if (FP_REG_P (operands[0]))
730 if (FP_REG_P (operands[1]))
731 return \"fcmp%.x %0,%1\";
733 return \"fcmp%.s %0,%f1\";
735 cc_status.flags |= CC_REVERSED;
736 return \"fcmp%.s %1,%f0\";
738 if (FP_REG_P (operands[0]))
740 if (FP_REG_P (operands[1]))
741 return \"fcmp%.x %1,%0\";
743 return \"fcmp%.s %f1,%0\";
745 cc_status.flags |= CC_REVERSED;
746 return \"fcmp%.s %f0,%1\";
750 ;; Recognizers for btst instructions.
753 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "o")
755 (minus:SI (const_int 7)
756 (match_operand:SI 1 "general_operand" "di"))))]
758 "* { return output_btst (operands, operands[1], operands[0], insn, 7); }")
761 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "d")
763 (minus:SI (const_int 31)
764 (match_operand:SI 1 "general_operand" "di"))))]
766 "* { return output_btst (operands, operands[1], operands[0], insn, 31); }")
768 ;; The following two patterns are like the previous two
769 ;; except that they use the fact that bit-number operands
770 ;; are automatically masked to 3 or 5 bits.
773 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "o")
775 (minus:SI (const_int 7)
777 (match_operand:SI 1 "register_operand" "d")
780 "* { return output_btst (operands, operands[1], operands[0], insn, 7); }")
783 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "d")
785 (minus:SI (const_int 31)
787 (match_operand:SI 1 "register_operand" "d")
790 "* { return output_btst (operands, operands[1], operands[0], insn, 31); }")
792 ;; Nonoffsettable mem refs are ok in this one pattern
793 ;; since we don't try to adjust them.
795 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "m")
797 (match_operand:SI 1 "const_int_operand" "n")))]
798 "(unsigned) INTVAL (operands[1]) < 8"
801 operands[1] = gen_rtx (CONST_INT, VOIDmode, 7 - INTVAL (operands[1]));
802 return output_btst (operands, operands[1], operands[0], insn, 7);
806 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "do")
808 (match_operand:SI 1 "const_int_operand" "n")))]
812 if (GET_CODE (operands[0]) == MEM)
814 operands[0] = adj_offsettable_operand (operands[0],
815 INTVAL (operands[1]) / 8);
816 operands[1] = gen_rtx (CONST_INT, VOIDmode,
817 7 - INTVAL (operands[1]) % 8);
818 return output_btst (operands, operands[1], operands[0], insn, 7);
820 operands[1] = gen_rtx (CONST_INT, VOIDmode,
821 31 - INTVAL (operands[1]));
822 return output_btst (operands, operands[1], operands[0], insn, 31);
828 ;; A special case in which it is not desirable
829 ;; to reload the constant into a data register.
830 (define_insn "pushexthisi_const"
831 [(set (match_operand:SI 0 "push_operand" "=m")
832 (match_operand:SI 1 "const_int_operand" "J"))]
833 "INTVAL (operands[1]) >= -0x8000 && INTVAL (operands[1]) < 0x8000"
836 if (operands[1] == const0_rtx)
837 return \"clr%.l %0\";
842 ;(define_insn "swapsi"
843 ; [(set (match_operand:SI 0 "general_operand" "+r")
844 ; (match_operand:SI 1 "general_operand" "+r"))
845 ; (set (match_dup 1) (match_dup 0))]
849 ;; Special case of fullword move when source is zero.
850 ;; The reason this is special is to avoid loading a zero
851 ;; into a data reg with moveq in order to store it elsewhere.
853 (define_insn "movsi_const0"
854 [(set (match_operand:SI 0 "general_operand" "=g")
856 ;; clr insns on 68000 read before writing.
857 ;; This isn't so on the 68010, but we have no TARGET_68010.
858 "((TARGET_68020 || TARGET_5200)
859 || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0])))"
862 if (ADDRESS_REG_P (operands[0]))
864 /* On the '040, 'subl an,an' takes 2 clocks while lea takes only 1 */
865 if (!TARGET_68040 && !TARGET_68060)
866 return \"sub%.l %0,%0\";
871 /* Many SGS assemblers croak on size specifiers for constants. */
874 return \"lea 0.w,%0\";
877 return \"lea 0:w,%0\";
881 /* moveq is faster on the 68000. */
882 if (DATA_REG_P (operands[0]) && (!TARGET_68020 && !TARGET_5200))
883 #if defined(MOTOROLA) && !defined(CRDS)
884 return \"moveq%.l %#0,%0\";
886 return \"moveq %#0,%0\";
888 return \"clr%.l %0\";
891 ;; General case of fullword move.
893 ;; This is the main "hook" for PIC code. When generating
894 ;; PIC, movsi is responsible for determining when the source address
895 ;; needs PIC relocation and appropriately calling legitimize_pic_address
896 ;; to perform the actual relocation.
898 ;; In both the PIC and non-PIC cases the patterns generated will
899 ;; matched by the next define_insn.
900 (define_expand "movsi"
901 [(set (match_operand:SI 0 "general_operand" "")
902 (match_operand:SI 1 "general_operand" ""))]
906 if (flag_pic && symbolic_operand (operands[1], SImode))
908 /* The source is an address which requires PIC relocation.
909 Call legitimize_pic_address with the source, mode, and a relocation
910 register (a new pseudo, or the final destination if reload_in_progress
911 is set). Then fall through normally */
912 extern rtx legitimize_pic_address();
913 rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
914 operands[1] = legitimize_pic_address (operands[1], SImode, temp);
918 ;; General case of fullword move. The register constraints
919 ;; force integer constants in range for a moveq to be reloaded
920 ;; if they are headed for memory.
922 ;; Notes: make sure no alternative allows g vs g.
923 ;; We don't allow f-regs since fixed point cannot go in them.
924 ;; We do allow y and x regs since fixed point is allowed in them.
925 [(set (match_operand:SI 0 "general_operand" "=g,da,y,!*x*r*m")
926 (match_operand:SI 1 "general_operand" "daymKs,i,g,*x*r*m"))]
930 if (which_alternative == 3)
931 return \"fpmove%.l %x1,fpa0\;fpmove%.l fpa0,%x0\";
932 if (FPA_REG_P (operands[1]) || FPA_REG_P (operands[0]))
933 return \"fpmove%.l %x1,%x0\";
934 return output_move_simode (operands);
938 [(set (match_operand:SI 0 "general_operand" "=r<>,g")
939 (match_operand:SI 1 "general_operand" "g,r<>"))]
941 "* return output_move_simode (operands);")
943 (define_expand "movhi"
944 [(set (match_operand:HI 0 "general_operand" "")
945 (match_operand:HI 1 "general_operand" ""))]
950 [(set (match_operand:HI 0 "general_operand" "=g")
951 (match_operand:HI 1 "general_operand" "g"))]
953 "* return output_move_himode (operands);")
956 [(set (match_operand:HI 0 "general_operand" "=r<>,g")
957 (match_operand:HI 1 "general_operand" "g,r<>"))]
959 "* return output_move_himode (operands);")
961 (define_insn "movstricthi"
962 [(set (strict_low_part (match_operand:HI 0 "general_operand" "+dm"))
963 (match_operand:HI 1 "general_operand" "rmn"))]
967 if (operands[1] == const0_rtx
968 /* clr insns on 68000 read before writing.
969 This isn't so on the 68010, but we have no TARGET_68010. */
970 && ((TARGET_68020 || TARGET_5200)
971 || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0]))))
972 return \"clr%.w %0\";
973 return \"move%.w %1,%0\";
976 (define_expand "movqi"
977 [(set (match_operand:QI 0 "general_operand" "")
978 (match_operand:QI 1 "general_operand" ""))]
983 [(set (match_operand:QI 0 "general_operand" "=d,*a,m")
984 (match_operand:QI 1 "general_operand" "dmi*a,di*a,dmi"))]
986 "* return output_move_qimode (operands);")
989 [(set (match_operand:QI 0 "general_operand" "=d*a<>,d*am")
990 (match_operand:QI 1 "general_operand" "d*ami,d*a<>"))]
992 "* return output_move_qimode (operands);")
994 (define_insn "movstrictqi"
995 [(set (strict_low_part (match_operand:QI 0 "general_operand" "+dm"))
996 (match_operand:QI 1 "general_operand" "dmn"))]
1000 if (operands[1] == const0_rtx
1001 /* clr insns on 68000 read before writing.
1002 This isn't so on the 68010, but we have no TARGET_68010. */
1003 && ((TARGET_68020 || TARGET_5200)
1004 || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0]))))
1005 return \"clr%.b %0\";
1006 return \"move%.b %1,%0\";
1009 (define_expand "movsf"
1010 [(set (match_operand:SF 0 "general_operand" "")
1011 (match_operand:SF 1 "general_operand" ""))]
1016 [(set (match_operand:SF 0 "general_operand" "=rmf,x,y,rm,!x,!rm")
1017 (match_operand:SF 1 "general_operand" "rmfF,xH,rmF,y,rm,x"))]
1018 ; [(set (match_operand:SF 0 "general_operand" "=rmf")
1019 ; (match_operand:SF 1 "general_operand" "rmfF"))]
1023 if (which_alternative >= 4)
1024 return \"fpmove%.s %1,fpa0\;fpmove%.s fpa0,%0\";
1025 if (FPA_REG_P (operands[0]))
1027 if (FPA_REG_P (operands[1]))
1028 return \"fpmove%.s %x1,%x0\";
1029 else if (GET_CODE (operands[1]) == CONST_DOUBLE)
1030 return output_move_const_single (operands);
1031 else if (FP_REG_P (operands[1]))
1032 return \"fmove%.s %1,sp@-\;fpmove%.d sp@+, %0\";
1033 return \"fpmove%.s %x1,%x0\";
1035 if (FPA_REG_P (operands[1]))
1037 if (FP_REG_P (operands[0]))
1038 return \"fpmove%.s %x1,sp@-\;fmove%.s sp@+,%0\";
1040 return \"fpmove%.s %x1,%x0\";
1042 if (FP_REG_P (operands[0]))
1044 if (FP_REG_P (operands[1]))
1045 return \"f%$move%.x %1,%0\";
1046 else if (ADDRESS_REG_P (operands[1]))
1047 return \"move%.l %1,%-\;f%$move%.s %+,%0\";
1048 else if (GET_CODE (operands[1]) == CONST_DOUBLE)
1049 return output_move_const_single (operands);
1050 return \"f%$move%.s %f1,%0\";
1052 if (FP_REG_P (operands[1]))
1054 if (ADDRESS_REG_P (operands[0]))
1055 return \"fmove%.s %1,%-\;move%.l %+,%0\";
1056 return \"fmove%.s %f1,%0\";
1058 return \"move%.l %1,%0\";
1062 [(set (match_operand:SF 0 "general_operand" "=r,g")
1063 (match_operand:SF 1 "general_operand" "g,r"))]
1065 "* return \"move%.l %1,%0\";")
1067 (define_expand "movdf"
1068 [(set (match_operand:DF 0 "general_operand" "")
1069 (match_operand:DF 1 "general_operand" ""))]
1074 [(set (match_operand:DF 0 "general_operand" "=rm,rf,rf,&rof<>,y,rm,x,!x,!rm")
1075 (match_operand:DF 1 "general_operand" "rf,m,0,rofE<>,rmE,y,xH,rm,x"))]
1076 ; [(set (match_operand:DF 0 "general_operand" "=rm,&rf,&rof<>")
1077 ; (match_operand:DF 1 "general_operand" "rf,m,rofF<>"))]
1081 if (which_alternative == 7)
1082 return \"fpmove%.d %x1,fpa0\;fpmove%.d fpa0,%x0\";
1083 if (FPA_REG_P (operands[0]))
1085 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1086 return output_move_const_double (operands);
1087 if (FP_REG_P (operands[1]))
1088 return \"fmove%.d %1,sp@-\;fpmove%.d sp@+,%x0\";
1089 return \"fpmove%.d %x1,%x0\";
1091 else if (FPA_REG_P (operands[1]))
1093 if (FP_REG_P(operands[0]))
1094 return \"fpmove%.d %x1,sp@-\;fmoved sp@+,%0\";
1096 return \"fpmove%.d %x1,%x0\";
1098 if (FP_REG_P (operands[0]))
1100 if (FP_REG_P (operands[1]))
1101 return \"f%&move%.x %1,%0\";
1102 if (REG_P (operands[1]))
1105 xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
1106 output_asm_insn (\"move%.l %1,%-\", xoperands);
1107 output_asm_insn (\"move%.l %1,%-\", operands);
1108 return \"f%&move%.d %+,%0\";
1110 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1111 return output_move_const_double (operands);
1112 return \"f%&move%.d %f1,%0\";
1114 else if (FP_REG_P (operands[1]))
1116 if (REG_P (operands[0]))
1118 output_asm_insn (\"fmove%.d %f1,%-\;move%.l %+,%0\", operands);
1119 operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
1120 return \"move%.l %+,%0\";
1123 return \"fmove%.d %f1,%0\";
1125 return output_move_double (operands);
1129 [(set (match_operand:DF 0 "general_operand" "=r,g")
1130 (match_operand:DF 1 "general_operand" "g,r"))]
1132 "* return output_move_double (operands);")
1134 (define_expand "movxf"
1135 [(set (match_operand:XF 0 "nonimmediate_operand" "")
1136 (match_operand:XF 1 "general_operand" ""))]
1140 if (CONSTANT_P (operands[1]))
1142 operands[1] = force_const_mem (XFmode, operands[1]);
1143 if (! memory_address_p (XFmode, XEXP (operands[1], 0))
1144 && ! reload_in_progress)
1145 operands[1] = change_address (operands[1], XFmode,
1146 XEXP (operands[1], 0));
1151 [(set (match_operand:XF 0 "nonimmediate_operand" "=f,m,f,!r,!f")
1152 (match_operand:XF 1 "nonimmediate_operand" "m,f,f,f,r"))]
1156 if (FP_REG_P (operands[0]))
1158 if (FP_REG_P (operands[1]))
1159 return \"fmove%.x %1,%0\";
1160 if (REG_P (operands[1]))
1163 xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 2);
1164 output_asm_insn (\"move%.l %1,%-\", xoperands);
1165 xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
1166 output_asm_insn (\"move%.l %1,%-\", xoperands);
1167 output_asm_insn (\"move%.l %1,%-\", operands);
1168 return \"fmove%.x %+,%0\";
1170 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1171 return \"fmove%.x %1,%0\";
1172 return \"fmove%.x %f1,%0\";
1174 if (REG_P (operands[0]))
1176 output_asm_insn (\"fmove%.x %f1,%-\;move%.l %+,%0\", operands);
1177 operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
1178 output_asm_insn (\"move%.l %+,%0\", operands);
1179 operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
1180 return \"move%.l %+,%0\";
1182 return \"fmove%.x %f1,%0\";
1187 [(set (match_operand:XF 0 "nonimmediate_operand" "=rm,rf,&rof<>")
1188 (match_operand:XF 1 "nonimmediate_operand" "rf,m,rof<>"))]
1189 "! TARGET_68881 && ! TARGET_5200"
1192 if (FP_REG_P (operands[0]))
1194 if (FP_REG_P (operands[1]))
1195 return \"fmove%.x %1,%0\";
1196 if (REG_P (operands[1]))
1199 xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 2);
1200 output_asm_insn (\"move%.l %1,%-\", xoperands);
1201 xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
1202 output_asm_insn (\"move%.l %1,%-\", xoperands);
1203 output_asm_insn (\"move%.l %1,%-\", operands);
1204 return \"fmove%.x %+,%0\";
1206 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1207 return \"fmove%.x %1,%0\";
1208 return \"fmove%.x %f1,%0\";
1210 if (FP_REG_P (operands[1]))
1212 if (REG_P (operands[0]))
1214 output_asm_insn (\"fmove%.x %f1,%-\;move%.l %+,%0\", operands);
1215 operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
1216 output_asm_insn (\"move%.l %+,%0\", operands);
1217 operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
1218 return \"move%.l %+,%0\";
1221 return \"fmove%.x %f1,%0\";
1223 return output_move_double (operands);
1228 [(set (match_operand:XF 0 "nonimmediate_operand" "=r,g")
1229 (match_operand:XF 1 "nonimmediate_operand" "g,r"))]
1230 "! TARGET_68881 && TARGET_5200"
1231 "* return output_move_double (operands);")
1233 (define_expand "movdi"
1234 ;; Let's see if it really still needs to handle fp regs, and, if so, why.
1235 [(set (match_operand:DI 0 "general_operand" "")
1236 (match_operand:DI 1 "general_operand" ""))]
1240 ;; movdi can apply to fp regs in some cases
1242 ;; Let's see if it really still needs to handle fp regs, and, if so, why.
1243 [(set (match_operand:DI 0 "general_operand" "=rm,r,&ro<>,y,rm,!*x,!rm")
1244 (match_operand:DI 1 "general_operand" "rF,m,roi<>F,rmiF,y,rmF,*x"))]
1245 ; [(set (match_operand:DI 0 "general_operand" "=rm,&r,&ro<>,!&rm,!&f,y,rm,x,!x,!rm")
1246 ; (match_operand:DI 1 "general_operand" "r,m,roi<>,fF,rfmF,rmi,y,rm,x"))]
1247 ; [(set (match_operand:DI 0 "general_operand" "=rm,&rf,&ro<>,!&rm,!&f")
1248 ; (match_operand:DI 1 "general_operand" "r,m,roi<>,fF,rfF"))]
1252 if (which_alternative == 8)
1253 return \"fpmove%.d %x1,fpa0\;fpmove%.d fpa0,%x0\";
1254 if (FPA_REG_P (operands[0]) || FPA_REG_P (operands[1]))
1255 return \"fpmove%.d %x1,%x0\";
1256 if (FP_REG_P (operands[0]))
1258 if (FP_REG_P (operands[1]))
1259 return \"fmove%.x %1,%0\";
1260 if (REG_P (operands[1]))
1263 xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
1264 output_asm_insn (\"move%.l %1,%-\", xoperands);
1265 output_asm_insn (\"move%.l %1,%-\", operands);
1266 return \"fmove%.d %+,%0\";
1268 if (GET_CODE (operands[1]) == CONST_DOUBLE)
1269 return output_move_const_double (operands);
1270 return \"fmove%.d %f1,%0\";
1272 else if (FP_REG_P (operands[1]))
1274 if (REG_P (operands[0]))
1276 output_asm_insn (\"fmove%.d %f1,%-\;move%.l %+,%0\", operands);
1277 operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
1278 return \"move%.l %+,%0\";
1281 return \"fmove%.d %f1,%0\";
1283 return output_move_double (operands);
1287 [(set (match_operand:DI 0 "general_operand" "=r,g")
1288 (match_operand:DI 1 "general_operand" "g,r"))]
1290 "* return output_move_double (operands);")
1292 ;; Thus goes after the move instructions
1293 ;; because the move instructions are better (require no spilling)
1294 ;; when they can apply. It goes before the add/sub insns
1295 ;; so we will prefer it to them.
1297 (define_insn "pushasi"
1298 [(set (match_operand:SI 0 "push_operand" "=m")
1299 (match_operand:SI 1 "address_operand" "p"))]
1303 ;; truncation instructions
1304 (define_insn "truncsiqi2"
1305 [(set (match_operand:QI 0 "general_operand" "=dm,d")
1307 (match_operand:SI 1 "general_operand" "doJ,i")))]
1311 if (GET_CODE (operands[0]) == REG)
1313 /* Must clear condition codes, since the move.l bases them on
1314 the entire 32 bits, not just the desired 8 bits. */
1316 return \"move%.l %1,%0\";
1318 if (GET_CODE (operands[1]) == MEM)
1319 operands[1] = adj_offsettable_operand (operands[1], 3);
1320 return \"move%.b %1,%0\";
1323 (define_insn "trunchiqi2"
1324 [(set (match_operand:QI 0 "general_operand" "=dm,d")
1326 (match_operand:HI 1 "general_operand" "doJ,i")))]
1330 if (GET_CODE (operands[0]) == REG
1331 && (GET_CODE (operands[1]) == MEM
1332 || GET_CODE (operands[1]) == CONST_INT))
1334 /* Must clear condition codes, since the move.w bases them on
1335 the entire 16 bits, not just the desired 8 bits. */
1337 return \"move%.w %1,%0\";
1339 if (GET_CODE (operands[0]) == REG)
1341 /* Must clear condition codes, since the move.l bases them on
1342 the entire 32 bits, not just the desired 8 bits. */
1344 return \"move%.l %1,%0\";
1346 if (GET_CODE (operands[1]) == MEM)
1347 operands[1] = adj_offsettable_operand (operands[1], 1);
1348 return \"move%.b %1,%0\";
1351 (define_insn "truncsihi2"
1352 [(set (match_operand:HI 0 "general_operand" "=dm,d")
1354 (match_operand:SI 1 "general_operand" "roJ,i")))]
1358 if (GET_CODE (operands[0]) == REG)
1360 /* Must clear condition codes, since the move.l bases them on
1361 the entire 32 bits, not just the desired 8 bits. */
1363 return \"move%.l %1,%0\";
1365 if (GET_CODE (operands[1]) == MEM)
1366 operands[1] = adj_offsettable_operand (operands[1], 2);
1367 return \"move%.w %1,%0\";
1370 ;; zero extension instructions
1372 ;; this is the canonical form for (lshiftrt:DI x 32)
1373 (define_insn "zero_extendsidi2"
1374 [(set (match_operand:DI 0 "general_operand" "rm")
1375 (zero_extend:DI (match_operand:SI 1 "general_operand" "rm")))]
1380 if (GET_CODE (operands[0]) == REG)
1381 operands[2] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
1382 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
1383 return \"move%.l %1,%0\;clr%.l %0\";
1384 else if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
1385 return \"clr%.l %0\;move%.l %1,%0\";
1387 operands[2] = adj_offsettable_operand (operands[0], 4);
1388 if (ADDRESS_REG_P (operands[0]))
1389 return \"move%.l %1,%2\;sub%.l %0,%0\";
1391 return \"move%.l %1,%2\;clr%.l %0\";
1394 (define_expand "zero_extendhisi2"
1395 [(set (match_operand:SI 0 "register_operand" "")
1397 (set (strict_low_part (match_dup 2))
1398 (match_operand:HI 1 "general_operand" ""))]
1402 operands[1] = make_safe_from (operands[1], operands[0]);
1403 if (GET_CODE (operands[0]) == SUBREG)
1404 operands[2] = gen_rtx (SUBREG, HImode, SUBREG_REG (operands[0]),
1405 SUBREG_WORD (operands[0]));
1407 operands[2] = gen_rtx (SUBREG, HImode, operands[0], 0);
1410 (define_expand "zero_extendqihi2"
1411 [(set (match_operand:HI 0 "register_operand" "")
1413 (set (strict_low_part (match_dup 2))
1414 (match_operand:QI 1 "general_operand" ""))]
1418 operands[1] = make_safe_from (operands[1], operands[0]);
1419 if (GET_CODE (operands[0]) == SUBREG)
1420 operands[2] = gen_rtx (SUBREG, QImode, SUBREG_REG (operands[0]),
1421 SUBREG_WORD (operands[0]));
1423 operands[2] = gen_rtx (SUBREG, QImode, operands[0], 0);
1426 (define_expand "zero_extendqisi2"
1427 [(set (match_operand:SI 0 "register_operand" "")
1429 (set (strict_low_part (match_dup 2))
1430 (match_operand:QI 1 "general_operand" ""))]
1434 operands[1] = make_safe_from (operands[1], operands[0]);
1435 if (GET_CODE (operands[0]) == SUBREG)
1436 operands[2] = gen_rtx (SUBREG, QImode, SUBREG_REG (operands[0]),
1437 SUBREG_WORD (operands[0]));
1439 operands[2] = gen_rtx (SUBREG, QImode, operands[0], 0);
1442 ;; Patterns to recognize zero-extend insns produced by the combiner.
1443 ;; We don't allow both operands in memory, because of aliasing problems.
1444 ;; Explicitly disallow two memory operands via the condition since reloading
1445 ;; of this case will result in worse code than the uncombined patterns.
1448 [(set (match_operand:SI 0 "general_operand" "=do<>,d<")
1449 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r,m")))]
1450 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
1453 if (DATA_REG_P (operands[0]))
1455 if (GET_CODE (operands[1]) == REG
1456 && REGNO (operands[0]) == REGNO (operands[1]))
1457 return \"and%.l %#0xFFFF,%0\";
1458 if (reg_mentioned_p (operands[0], operands[1]))
1459 return \"move%.w %1,%0\;and%.l %#0xFFFF,%0\";
1460 return \"clr%.l %0\;move%.w %1,%0\";
1462 else if (GET_CODE (operands[0]) == MEM
1463 && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
1464 return \"move%.w %1,%0\;clr%.w %0\";
1465 else if (GET_CODE (operands[0]) == MEM
1466 && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
1467 return \"clr%.w %0\;move%.w %1,%0\";
1470 output_asm_insn (\"clr%.w %0\", operands);
1471 operands[0] = adj_offsettable_operand (operands[0], 2);
1472 return \"move%.w %1,%0\";
1477 [(set (match_operand:HI 0 "general_operand" "=do<>,d")
1478 (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "d,m")))]
1479 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
1482 if (DATA_REG_P (operands[0]))
1484 if (GET_CODE (operands[1]) == REG
1485 && REGNO (operands[0]) == REGNO (operands[1]))
1486 return \"and%.w %#0xFF,%0\";
1487 if (reg_mentioned_p (operands[0], operands[1]))
1488 return \"move%.b %1,%0\;and%.w %#0xFF,%0\";
1489 return \"clr%.w %0\;move%.b %1,%0\";
1491 else if (GET_CODE (operands[0]) == MEM
1492 && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
1494 if (REGNO (XEXP (XEXP (operands[0], 0), 0))
1495 == STACK_POINTER_REGNUM)
1497 output_asm_insn (\"clr%.w %-\", operands);
1498 operands[0] = gen_rtx (MEM, GET_MODE (operands[0]),
1499 plus_constant (stack_pointer_rtx, 1));
1500 return \"move%.b %1,%0\";
1503 return \"move%.b %1,%0\;clr%.b %0\";
1505 else if (GET_CODE (operands[0]) == MEM
1506 && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
1507 return \"clr%.b %0\;move%.b %1,%0\";
1510 output_asm_insn (\"clr%.b %0\", operands);
1511 operands[0] = adj_offsettable_operand (operands[0], 1);
1512 return \"move%.b %1,%0\";
1517 [(set (match_operand:SI 0 "general_operand" "=do<>,d")
1518 (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "d,m")))]
1519 "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
1522 if (DATA_REG_P (operands[0]))
1524 if (GET_CODE (operands[1]) == REG
1525 && REGNO (operands[0]) == REGNO (operands[1]))
1526 return \"and%.l %#0xFF,%0\";
1527 if (reg_mentioned_p (operands[0], operands[1]))
1528 return \"move%.b %1,%0\;and%.l %#0xFF,%0\";
1529 return \"clr%.l %0\;move%.b %1,%0\";
1531 else if (GET_CODE (operands[0]) == MEM
1532 && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
1534 operands[0] = XEXP (XEXP (operands[0], 0), 0);
1537 return \"clr%.l -(%0)\;move%.b %1,3(%0)\";
1539 return \"clr%.l -(%0)\;move%.b %1,(3,%0)\";
1542 return \"clrl %0@-\;moveb %1,%0@(3)\";
1545 else if (GET_CODE (operands[0]) == MEM
1546 && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
1548 operands[0] = XEXP (XEXP (operands[0], 0), 0);
1551 return \"clr%.l (%0)+\;move%.b %1,-1(%0)\";
1553 return \"clr%.l (%0)+\;move%.b %1,(-1,%0)\";
1556 return \"clrl %0@+\;moveb %1,%0@(-1)\";
1561 output_asm_insn (\"clr%.l %0\", operands);
1562 operands[0] = adj_offsettable_operand (operands[0], 3);
1563 return \"move%.b %1,%0\";
1567 ;; sign extension instructions
1569 (define_insn "extendqidi2"
1570 [(set (match_operand:DI 0 "general_operand" "=d")
1572 (match_operand:QI 1 "general_operand" "rm")))]
1577 operands[2] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
1578 if (TARGET_68020 || TARGET_5200)
1579 return \"move%.b %1,%2\;extb%.l %2\;smi %0\;extb%.l %0\";
1581 return \"move%.b %1,%2\;ext%.w %0\;ext%.l %2\;move%.l %2,%0\;smi %0\";
1584 (define_insn "extendhidi2"
1585 [(set (match_operand:DI 0 "general_operand" "=d")
1587 (match_operand:HI 1 "general_operand" "rm")))]
1592 operands[2] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
1593 if (TARGET_68020 || TARGET_5200)
1594 return \"move%.w %1,%2\;ext%.l %2\;smi %0\;extb%.l %0\";
1596 return \"move%.w %1,%2\;ext%.l %2\;smi %0\;ext%.w %0\;ext%.l %0\";
1599 (define_insn "extendsidi2"
1600 [(set (match_operand:DI 0 "general_operand" "=d")
1602 (match_operand:SI 1 "general_operand" "rm")))]
1607 operands[2] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
1608 if (TARGET_68020 || TARGET_5200)
1609 return \"move%.l %1,%2\;smi %0\;extb%.l %0\";
1611 return \"move%.l %1,%2\;smi %0\;ext%.w %0\;ext%.l %0\";
1614 ;; Special case when one can avoid register clobbering, copy and test
1615 ;; Maybe there is a way to make that the general case, by forcing the
1616 ;; result of the SI tree to be in the lower register of the DI target
1618 (define_insn "extendplussidi"
1619 [(set (match_operand:DI 0 "register_operand" "=d")
1620 (sign_extend:DI (plus:SI (match_operand:SI 1 "general_operand" "%rmn")
1621 (match_operand:SI 2 "general_operand" "rmn"))))]
1626 operands[3] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
1627 if (GET_CODE (operands[1]) == CONST_INT
1628 && (unsigned) INTVAL (operands[1]) > 8)
1630 rtx tmp = operands[1];
1632 operands[1] = operands[2];
1635 if (GET_CODE (operands[1]) == REG
1636 && REGNO (operands[1]) == REGNO (operands[3]))
1637 output_asm_insn (\"add%.l %2,%3\", operands);
1639 output_asm_insn (\"move%.l %2,%3\;add%.l %1,%3\", operands);
1640 if (TARGET_68020 || TARGET_5200)
1641 return \"smi %0\;extb%.l %0\";
1643 return \"smi %0\;ext%.w %0\;ext%.l %0\";
1646 (define_insn "extendhisi2"
1647 [(set (match_operand:SI 0 "general_operand" "=*d,a")
1649 (match_operand:HI 1 "nonimmediate_operand" "0,rm")))]
1653 if (ADDRESS_REG_P (operands[0]))
1654 return \"move%.w %1,%0\";
1655 return \"ext%.l %0\";
1658 (define_insn "extendqihi2"
1659 [(set (match_operand:HI 0 "general_operand" "=d")
1660 (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0")))]
1664 (define_insn "extendqisi2"
1665 [(set (match_operand:SI 0 "general_operand" "=d")
1666 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "0")))]
1667 "TARGET_68020 || TARGET_5200"
1670 ;; Conversions between float and double.
1672 (define_expand "extendsfdf2"
1673 [(set (match_operand:DF 0 "general_operand" "")
1675 (match_operand:SF 1 "general_operand" "")))]
1676 "TARGET_68881 || TARGET_FPA"
1680 [(set (match_operand:DF 0 "general_operand" "=x,y")
1682 (match_operand:SF 1 "general_operand" "xH,rmF")))]
1687 [(set (match_operand:DF 0 "general_operand" "=*fdm,f")
1689 (match_operand:SF 1 "general_operand" "f,dmF")))]
1693 if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
1695 if (REGNO (operands[0]) == REGNO (operands[1]))
1697 /* Extending float to double in an fp-reg is a no-op.
1698 NOTICE_UPDATE_CC has already assumed that the
1699 cc will be set. So cancel what it did. */
1700 cc_status = cc_prev_status;
1703 return \"f%&move%.x %1,%0\";
1705 if (FP_REG_P (operands[0]))
1706 return \"f%&move%.s %f1,%0\";
1707 if (DATA_REG_P (operands[0]) && FP_REG_P (operands[1]))
1709 output_asm_insn (\"fmove%.d %f1,%-\;move%.l %+,%0\", operands);
1710 operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
1711 return \"move%.l %+,%0\";
1713 return \"fmove%.d %f1,%0\";
1716 ;; This cannot output into an f-reg because there is no way to be
1717 ;; sure of truncating in that case.
1718 ;; But on the Sun FPA, we can be sure.
1719 (define_expand "truncdfsf2"
1720 [(set (match_operand:SF 0 "general_operand" "")
1722 (match_operand:DF 1 "general_operand" "")))]
1723 "TARGET_68881 || TARGET_FPA"
1727 [(set (match_operand:SF 0 "general_operand" "=x,y")
1729 (match_operand:DF 1 "general_operand" "xH,rmF")))]
1733 ;; On the '040 we can truncate in a register accurately and easily.
1735 [(set (match_operand:SF 0 "general_operand" "=f")
1737 (match_operand:DF 1 "general_operand" "fmG")))]
1741 if (FP_REG_P (operands[1]))
1742 return \"f%$move%.x %1,%0\";
1743 return \"f%$move%.d %f1,%0\";
1747 [(set (match_operand:SF 0 "general_operand" "=dm")
1749 (match_operand:DF 1 "general_operand" "f")))]
1753 ;; Conversion between fixed point and floating point.
1754 ;; Note that among the fix-to-float insns
1755 ;; the ones that start with SImode come first.
1756 ;; That is so that an operand that is a CONST_INT
1757 ;; (and therefore lacks a specific machine mode).
1758 ;; will be recognized as SImode (which is always valid)
1759 ;; rather than as QImode or HImode.
1761 (define_expand "floatsisf2"
1762 [(set (match_operand:SF 0 "general_operand" "")
1763 (float:SF (match_operand:SI 1 "general_operand" "")))]
1764 "TARGET_68881 || TARGET_FPA"
1768 [(set (match_operand:SF 0 "general_operand" "=y,x")
1769 (float:SF (match_operand:SI 1 "general_operand" "rmi,x")))]
1774 [(set (match_operand:SF 0 "general_operand" "=f")
1775 (float:SF (match_operand:SI 1 "general_operand" "dmi")))]
1779 (define_expand "floatsidf2"
1780 [(set (match_operand:DF 0 "general_operand" "")
1781 (float:DF (match_operand:SI 1 "general_operand" "")))]
1782 "TARGET_68881 || TARGET_FPA"
1786 [(set (match_operand:DF 0 "general_operand" "=y,x")
1787 (float:DF (match_operand:SI 1 "general_operand" "rmi,x")))]
1792 [(set (match_operand:DF 0 "general_operand" "=f")
1793 (float:DF (match_operand:SI 1 "general_operand" "dmi")))]
1797 (define_insn "floathisf2"
1798 [(set (match_operand:SF 0 "general_operand" "=f")
1799 (float:SF (match_operand:HI 1 "general_operand" "dmn")))]
1803 (define_insn "floathidf2"
1804 [(set (match_operand:DF 0 "general_operand" "=f")
1805 (float:DF (match_operand:HI 1 "general_operand" "dmn")))]
1809 (define_insn "floatqisf2"
1810 [(set (match_operand:SF 0 "general_operand" "=f")
1811 (float:SF (match_operand:QI 1 "general_operand" "dmn")))]
1815 (define_insn "floatqidf2"
1816 [(set (match_operand:DF 0 "general_operand" "=f")
1817 (float:DF (match_operand:QI 1 "general_operand" "dmn")))]
1821 ;; New routines to convert floating-point values to integers
1822 ;; to be used on the '040. These should be faster than trapping
1823 ;; into the kernel to emulate fintrz. They should also be faster
1824 ;; than calling the subroutines fixsfsi or fixdfsi.
1826 (define_insn "fix_truncdfsi2"
1827 [(set (match_operand:SI 0 "general_operand" "=dm")
1828 (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
1829 (clobber (match_scratch:SI 2 "=d"))
1830 (clobber (match_scratch:SI 3 "=d"))]
1831 "TARGET_68881 && TARGET_68040"
1835 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,%!\";
1838 (define_insn "fix_truncdfhi2"
1839 [(set (match_operand:HI 0 "general_operand" "=dm")
1840 (fix:HI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
1841 (clobber (match_scratch:SI 2 "=d"))
1842 (clobber (match_scratch:SI 3 "=d"))]
1843 "TARGET_68881 && TARGET_68040"
1847 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,%!\";
1850 (define_insn "fix_truncdfqi2"
1851 [(set (match_operand:QI 0 "general_operand" "=dm")
1852 (fix:QI (fix:DF (match_operand:DF 1 "register_operand" "f"))))
1853 (clobber (match_scratch:SI 2 "=d"))
1854 (clobber (match_scratch:SI 3 "=d"))]
1855 "TARGET_68881 && TARGET_68040"
1859 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,%!\";
1862 ;; Convert a float to a float whose value is an integer.
1863 ;; This is the first stage of converting it to an integer type.
1865 (define_insn "ftruncdf2"
1866 [(set (match_operand:DF 0 "general_operand" "=f")
1867 (fix:DF (match_operand:DF 1 "general_operand" "fFm")))]
1868 "TARGET_68881 && !TARGET_68040"
1871 if (FP_REG_P (operands[1]))
1872 return \"fintrz%.x %f1,%0\";
1873 return \"fintrz%.d %f1,%0\";
1876 (define_insn "ftruncsf2"
1877 [(set (match_operand:SF 0 "general_operand" "=f")
1878 (fix:SF (match_operand:SF 1 "general_operand" "dfFm")))]
1879 "TARGET_68881 && !TARGET_68040"
1882 if (FP_REG_P (operands[1]))
1883 return \"fintrz%.x %f1,%0\";
1884 return \"fintrz%.s %f1,%0\";
1887 ;; Convert a float whose value is an integer
1888 ;; to an actual integer. Second stage of converting float to integer type.
1889 (define_insn "fixsfqi2"
1890 [(set (match_operand:QI 0 "general_operand" "=dm")
1891 (fix:QI (match_operand:SF 1 "general_operand" "f")))]
1895 (define_insn "fixsfhi2"
1896 [(set (match_operand:HI 0 "general_operand" "=dm")
1897 (fix:HI (match_operand:SF 1 "general_operand" "f")))]
1901 (define_insn "fixsfsi2"
1902 [(set (match_operand:SI 0 "general_operand" "=dm")
1903 (fix:SI (match_operand:SF 1 "general_operand" "f")))]
1907 (define_insn "fixdfqi2"
1908 [(set (match_operand:QI 0 "general_operand" "=dm")
1909 (fix:QI (match_operand:DF 1 "general_operand" "f")))]
1913 (define_insn "fixdfhi2"
1914 [(set (match_operand:HI 0 "general_operand" "=dm")
1915 (fix:HI (match_operand:DF 1 "general_operand" "f")))]
1919 (define_insn "fixdfsi2"
1920 [(set (match_operand:SI 0 "general_operand" "=dm")
1921 (fix:SI (match_operand:DF 1 "general_operand" "f")))]
1925 ;; Convert a float to an integer.
1926 ;; On the Sun FPA, this is done in one step.
1929 [(set (match_operand:SI 0 "general_operand" "=x,y")
1930 (fix:SI (fix:SF (match_operand:SF 1 "general_operand" "xH,rmF"))))]
1935 [(set (match_operand:SI 0 "general_operand" "=x,y")
1936 (fix:SI (fix:DF (match_operand:DF 1 "general_operand" "xH,rmF"))))]
1942 (define_insn "adddi_lshrdi_63"
1943 [(set (match_operand:DI 0 "general_operand" "=d")
1944 (plus:DI (lshiftrt:DI (match_operand:DI 1 "general_operand" "rm")
1947 (clobber (match_scratch:SI 2 "=d"))]
1951 operands[3] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
1952 if (REG_P (operands[1]) && REGNO (operands[1]) == REGNO (operands[0]))
1954 \"move%.l %1,%2\;add%.l %2,%2\;subx%.l %2,%2\;sub%.l %2,%3\;subx%.l %2,%0\";
1955 if (GET_CODE (operands[1]) == REG)
1956 operands[4] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
1957 else if (GET_CODE (XEXP (operands[1], 0)) == POST_INC
1958 || GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
1959 operands[4] = operands[1];
1961 operands[4] = adj_offsettable_operand (operands[1], 4);
1962 if (GET_CODE (operands[1]) == MEM
1963 && GET_CODE (XEXP (operands[1], 0)) == PRE_DEC)
1964 output_asm_insn (\"move%.l %4,%3\", operands);
1965 output_asm_insn (\"move%.l %1,%0\;smi %2\", operands);
1966 if (TARGET_68020 || TARGET_5200)
1967 output_asm_insn (\"extb%.l %2\", operands);
1969 output_asm_insn (\"ext%.w %2\;ext%.l %2\", operands);
1970 if (GET_CODE (operands[1]) != MEM
1971 || GET_CODE (XEXP (operands[1], 0)) != PRE_DEC)
1972 output_asm_insn (\"move%.l %4,%3\", operands);
1973 return \"sub%.l %2,%3\;subx%.l %2,%0\";
1976 (define_insn "adddi_sexthishl32"
1977 [(set (match_operand:DI 0 "general_operand" "=o,a,*d,*d")
1978 (plus:DI (ashift:DI (sign_extend:DI
1979 (match_operand:HI 1 "general_operand" "rm,rm,rm,rm"))
1981 (match_operand:DI 2 "general_operand" "0,0,0,0")))
1982 (clobber (match_scratch:SI 3 "=&d,X,a,?d"))]
1987 if (ADDRESS_REG_P (operands[0]))
1988 return \"add%.w %1,%0\";
1989 else if (ADDRESS_REG_P (operands[3]))
1990 return \"move%.w %1,%3\;add%.l %3,%0\";
1992 return \"move%.w %1,%3\;ext%.l %3\;add%.l %3,%0\";
1995 (define_insn "adddi_dilshr32"
1996 [(set (match_operand:DI 0 "general_operand" "=do")
1997 ;; (plus:DI (match_operand:DI 2 "general_operand" "%0")
1998 ;; (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro")
1999 ;; (const_int 32))))]
2000 (plus:DI (lshiftrt:DI (match_operand:DI 1 "general_operand" "ro")
2002 (match_operand:DI 2 "general_operand" "0")))]
2007 if (GET_CODE (operands[0]) == REG)
2008 operands[2] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
2010 operands[2] = adj_offsettable_operand (operands[0], 4);
2011 return \"add%.l %1,%2\;negx%.l %0\;neg%.l %0\";
2014 (define_insn "adddi_dishl32"
2015 [(set (match_operand:DI 0 "general_operand" "=ro")
2016 ;; (plus:DI (match_operand:DI 2 "general_operand" "%0")
2017 ;; (ashift:DI (match_operand:DI 1 "general_operand" "ro")
2018 ;; (const_int 32))))]
2019 (plus:DI (ashift:DI (match_operand:DI 1 "general_operand" "ro")
2021 (match_operand:DI 2 "general_operand" "0")))]
2026 if (GET_CODE (operands[1]) == REG)
2027 operands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
2029 operands[1] = adj_offsettable_operand (operands[1], 4);
2030 return \"add%.l %1,%0\";
2033 (define_insn "adddi3"
2034 [(set (match_operand:DI 0 "general_operand" "=<,o<>,d,d,d")
2035 (plus:DI (match_operand:DI 1 "general_operand" "%0,0,0,0,0")
2036 (match_operand:DI 2 "general_operand" "<,d,o>,d,a")))
2037 (clobber (match_scratch:SI 3 "=X,&d,&d,X,&d"))]
2041 if (DATA_REG_P (operands[0]))
2043 if (DATA_REG_P (operands[2]))
2044 return \"add%.l %R2,%R0\;addx%.l %2,%0\";
2045 else if (GET_CODE (operands[2]) == MEM
2046 && GET_CODE (XEXP (operands[2], 0)) == POST_INC)
2048 return \"move%.l %2,%3\;add%.l %2,%R0\;addx%.l %3,%0\";
2052 /* TODO : this should work also for CONST operands[2] */
2053 if (GET_CODE (operands[2]) == REG)
2054 operands[1] = gen_rtx (REG, SImode, REGNO (operands[2]) + 1);
2056 operands[1] = adj_offsettable_operand (operands[2], 4);
2057 return \"move%.l %2,%3\;add%.l %1,%R0\;addx%.l %3,%0\";
2060 else if (GET_CODE (operands[0]) == MEM)
2062 if (GET_CODE (operands[2]) == MEM
2063 && GET_CODE (XEXP (operands[2], 0)) == PRE_DEC)
2064 return \"add%.l %2,%0\;addx%.l %2,%0\";
2066 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
2068 operands[1] = gen_rtx (MEM, SImode,
2069 gen_rtx (PLUS, VOIDmode, XEXP(operands[0], 0),
2070 gen_rtx (CONST_INT, VOIDmode, -8)));
2071 return \"move%.l %0,%3\;add%.l %R2,%0\;addx%.l %2,%3\;move%.l %3,%1\";
2073 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
2075 operands[1] = XEXP(operands[0], 0);
2076 return \"add%.l %R2,%0\;move%.l %0,%3\;addx%.l %2,%3\;move%.l %3,%1\";
2080 operands[1] = adj_offsettable_operand (operands[0], 4);
2081 return \"add%.l %R2,%1\;move%.l %0,%3\;addx%.l %2,%3\;move%.l %3,%0\";
2086 (define_insn "addsi_lshrsi_31"
2087 [(set (match_operand:SI 0 "general_operand" "=dm")
2088 (plus:SI (lshiftrt:SI (match_operand:SI 1 "general_operand" "rm")
2094 operands[2] = operands[0];
2095 operands[3] = gen_label_rtx();
2096 if (GET_CODE (operands[0]) == MEM)
2098 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
2099 operands[0] = gen_rtx (MEM, SImode, XEXP (XEXP (operands[0], 0), 0));
2100 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
2101 operands[2] = gen_rtx (MEM, SImode, XEXP (XEXP (operands[0], 0), 0));
2103 output_asm_insn (\"move%.l %1,%0\", operands);
2105 output_asm_insn (\"jbpl %l3\", operands);
2107 output_asm_insn (\"jpl %l3\", operands);
2110 output_asm_insn (\"addq%.l %#1,%2\", operands);
2112 output_asm_insn (\"add%.l %#1,%2\", operands);
2114 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"L\",
2115 CODE_LABEL_NUMBER (operands[3]));
2119 (define_expand "addsi3"
2120 [(set (match_operand:SI 0 "general_operand" "")
2121 (plus:SI (match_operand:SI 1 "general_operand" "")
2122 (match_operand:SI 2 "general_operand" "")))]
2126 ;; Note that the middle two alternatives are near-duplicates
2127 ;; in order to handle insns generated by reload.
2128 ;; This is needed since they are not themselves reloaded,
2129 ;; so commutativity won't apply to them.
2130 (define_insn "*addsi3_internal"
2131 [(set (match_operand:SI 0 "general_operand" "=m,?a,?a,r")
2132 (plus:SI (match_operand:SI 1 "general_operand" "%0,a,rJK,0")
2133 (match_operand:SI 2 "general_operand" "dIKLs,rJK,a,mrIKLs")))]
2135 "* return output_addsi3 (operands);")
2137 (define_insn "*addsi3_5200"
2138 [(set (match_operand:SI 0 "general_operand" "=m,?a,?a,r")
2139 (plus:SI (match_operand:SI 1 "general_operand" "%0,a,rJK,0")
2140 (match_operand:SI 2 "general_operand" "d,rJK,a,mrIKLs")))]
2142 "* return output_addsi3 (operands);")
2145 [(set (match_operand:SI 0 "general_operand" "=a")
2146 (plus:SI (match_operand:SI 1 "general_operand" "0")
2148 (match_operand:HI 2 "nonimmediate_operand" "rm"))))]
2152 (define_insn "addhi3"
2153 [(set (match_operand:HI 0 "general_operand" "=m,r")
2154 (plus:HI (match_operand:HI 1 "general_operand" "%0,0")
2155 (match_operand:HI 2 "general_operand" "dn,rmn")))]
2159 if (GET_CODE (operands[2]) == CONST_INT)
2162 /* If the constant would be a negative number when interpreted as
2163 HImode, make it negative. This is usually, but not always, done
2164 elsewhere in the compiler. First check for constants out of range,
2165 which could confuse us. */
2167 if (INTVAL (operands[2]) >= 32768)
2168 operands[2] = gen_rtx (CONST_INT, VOIDmode,
2169 INTVAL (operands[2]) - 65536);
2171 if (INTVAL (operands[2]) > 0
2172 && INTVAL (operands[2]) <= 8)
2173 return \"addq%.w %2,%0\";
2174 if (INTVAL (operands[2]) < 0
2175 && INTVAL (operands[2]) >= -8)
2177 operands[2] = gen_rtx (CONST_INT, VOIDmode,
2178 - INTVAL (operands[2]));
2179 return \"subq%.w %2,%0\";
2181 /* On the CPU32 it is faster to use two addqw instructions to
2182 add a small integer (8 < N <= 16) to a register.
2183 Likewise for subqw. */
2184 if (TARGET_CPU32 && REG_P (operands[0]))
2186 if (INTVAL (operands[2]) > 8
2187 && INTVAL (operands[2]) <= 16)
2189 operands[2] = gen_rtx (CONST_INT, VOIDmode,
2190 INTVAL (operands[2]) - 8);
2191 return \"addq%.w %#8,%0\;addq%.w %2,%0\";
2193 if (INTVAL (operands[2]) < -8
2194 && INTVAL (operands[2]) >= -16)
2196 operands[2] = gen_rtx (CONST_INT, VOIDmode,
2197 - INTVAL (operands[2]) - 8);
2198 return \"subq%.w %#8,%0\;subq%.w %2,%0\";
2202 if (ADDRESS_REG_P (operands[0]) && !TARGET_68040)
2204 return \"lea (%c2,%0),%0\";
2206 return \"lea %0@(%c2),%0\";
2209 return \"add%.w %2,%0\";
2212 ;; These insns must use MATCH_DUP instead of the more expected
2213 ;; use of a matching constraint because the "output" here is also
2214 ;; an input, so you can't use the matching constraint. That also means
2215 ;; that you can't use the "%", so you need patterns with the matched
2216 ;; operand in both positions.
2219 [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
2220 (plus:HI (match_dup 0)
2221 (match_operand:HI 1 "general_operand" "dn,rmn")))]
2225 if (GET_CODE (operands[1]) == CONST_INT)
2228 /* If the constant would be a negative number when interpreted as
2229 HImode, make it negative. This is usually, but not always, done
2230 elsewhere in the compiler. First check for constants out of range,
2231 which could confuse us. */
2233 if (INTVAL (operands[1]) >= 32768)
2234 operands[1] = gen_rtx (CONST_INT, VOIDmode,
2235 INTVAL (operands[1]) - 65536);
2237 if (INTVAL (operands[1]) > 0
2238 && INTVAL (operands[1]) <= 8)
2239 return \"addq%.w %1,%0\";
2240 if (INTVAL (operands[1]) < 0
2241 && INTVAL (operands[1]) >= -8)
2243 operands[1] = gen_rtx (CONST_INT, VOIDmode,
2244 - INTVAL (operands[1]));
2245 return \"subq%.w %1,%0\";
2247 /* On the CPU32 it is faster to use two addqw instructions to
2248 add a small integer (8 < N <= 16) to a register.
2249 Likewise for subqw. */
2250 if (TARGET_CPU32 && REG_P (operands[0]))
2252 if (INTVAL (operands[1]) > 8
2253 && INTVAL (operands[1]) <= 16)
2255 operands[1] = gen_rtx (CONST_INT, VOIDmode,
2256 INTVAL (operands[1]) - 8);
2257 return \"addq%.w %#8,%0\;addq%.w %1,%0\";
2259 if (INTVAL (operands[1]) < -8
2260 && INTVAL (operands[1]) >= -16)
2262 operands[1] = gen_rtx (CONST_INT, VOIDmode,
2263 - INTVAL (operands[1]) - 8);
2264 return \"subq%.w %#8,%0\;subq%.w %1,%0\";
2268 if (ADDRESS_REG_P (operands[0]) && !TARGET_68040)
2270 return \"lea (%c1,%0),%0\";
2272 return \"lea %0@(%c1),%0\";
2275 return \"add%.w %1,%0\";
2279 [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
2280 (plus:HI (match_operand:HI 1 "general_operand" "dn,rmn")
2285 if (GET_CODE (operands[1]) == CONST_INT)
2288 /* If the constant would be a negative number when interpreted as
2289 HImode, make it negative. This is usually, but not always, done
2290 elsewhere in the compiler. First check for constants out of range,
2291 which could confuse us. */
2293 if (INTVAL (operands[1]) >= 32768)
2294 operands[1] = gen_rtx (CONST_INT, VOIDmode,
2295 INTVAL (operands[1]) - 65536);
2297 if (INTVAL (operands[1]) > 0
2298 && INTVAL (operands[1]) <= 8)
2299 return \"addq%.w %1,%0\";
2300 if (INTVAL (operands[1]) < 0
2301 && INTVAL (operands[1]) >= -8)
2303 operands[1] = gen_rtx (CONST_INT, VOIDmode,
2304 - INTVAL (operands[1]));
2305 return \"subq%.w %1,%0\";
2307 /* On the CPU32 it is faster to use two addqw instructions to
2308 add a small integer (8 < N <= 16) to a register.
2309 Likewise for subqw. */
2310 if (TARGET_CPU32 && REG_P (operands[0]))
2312 if (INTVAL (operands[1]) > 8
2313 && INTVAL (operands[1]) <= 16)
2315 operands[1] = gen_rtx (CONST_INT, VOIDmode,
2316 INTVAL (operands[1]) - 8);
2317 return \"addq%.w %#8,%0\;addq%.w %1,%0\";
2319 if (INTVAL (operands[1]) < -8
2320 && INTVAL (operands[1]) >= -16)
2322 operands[1] = gen_rtx (CONST_INT, VOIDmode,
2323 - INTVAL (operands[1]) - 8);
2324 return \"subq%.w %#8,%0\;subq%.w %1,%0\";
2328 if (ADDRESS_REG_P (operands[0]) && !TARGET_68040)
2330 return \"lea (%c1,%0),%0\";
2332 return \"lea %0@(%c1),%0\";
2335 return \"add%.w %1,%0\";
2338 (define_insn "addqi3"
2339 [(set (match_operand:QI 0 "general_operand" "=m,d")
2340 (plus:QI (match_operand:QI 1 "general_operand" "%0,0")
2341 (match_operand:QI 2 "general_operand" "dn,dmn")))]
2346 if (GET_CODE (operands[2]) == CONST_INT)
2348 if (INTVAL (operands[2]) >= 128)
2349 operands[2] = gen_rtx (CONST_INT, VOIDmode,
2350 INTVAL (operands[2]) - 256);
2352 if (INTVAL (operands[2]) > 0
2353 && INTVAL (operands[2]) <= 8)
2354 return \"addq%.b %2,%0\";
2355 if (INTVAL (operands[2]) < 0 && INTVAL (operands[2]) >= -8)
2357 operands[2] = gen_rtx (CONST_INT, VOIDmode, - INTVAL (operands[2]));
2358 return \"subq%.b %2,%0\";
2362 return \"add%.b %2,%0\";
2366 [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
2367 (plus:QI (match_dup 0)
2368 (match_operand:QI 1 "general_operand" "dn,dmn")))]
2373 if (GET_CODE (operands[1]) == CONST_INT)
2375 if (INTVAL (operands[1]) >= 128)
2376 operands[1] = gen_rtx (CONST_INT, VOIDmode,
2377 INTVAL (operands[1]) - 256);
2379 if (INTVAL (operands[1]) > 0
2380 && INTVAL (operands[1]) <= 8)
2381 return \"addq%.b %1,%0\";
2382 if (INTVAL (operands[1]) < 0 && INTVAL (operands[1]) >= -8)
2384 operands[1] = gen_rtx (CONST_INT, VOIDmode, - INTVAL (operands[1]));
2385 return \"subq%.b %1,%0\";
2389 return \"add%.b %1,%0\";
2393 [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
2394 (plus:QI (match_operand:QI 1 "general_operand" "dn,dmn")
2400 if (GET_CODE (operands[1]) == CONST_INT)
2402 if (INTVAL (operands[1]) >= 128)
2403 operands[1] = gen_rtx (CONST_INT, VOIDmode,
2404 INTVAL (operands[1]) - 256);
2406 if (INTVAL (operands[1]) > 0
2407 && INTVAL (operands[1]) <= 8)
2408 return \"addq%.b %1,%0\";
2409 if (INTVAL (operands[1]) < 0 && INTVAL (operands[1]) >= -8)
2411 operands[1] = gen_rtx (CONST_INT, VOIDmode, - INTVAL (operands[1]));
2412 return \"subq%.b %1,%0\";
2416 return \"add%.b %1,%0\";
2419 (define_expand "adddf3"
2420 [(set (match_operand:DF 0 "general_operand" "")
2421 (plus:DF (match_operand:DF 1 "general_operand" "")
2422 (match_operand:DF 2 "general_operand" "")))]
2423 "TARGET_68881 || TARGET_FPA"
2427 [(set (match_operand:DF 0 "general_operand" "=x,y")
2428 (plus:DF (match_operand:DF 1 "general_operand" "%xH,y")
2429 (match_operand:DF 2 "general_operand" "xH,dmF")))]
2433 if (rtx_equal_p (operands[0], operands[1]))
2434 return \"fpadd%.d %y2,%0\";
2435 if (rtx_equal_p (operands[0], operands[2]))
2436 return \"fpadd%.d %y1,%0\";
2437 if (which_alternative == 0)
2438 return \"fpadd3%.d %w2,%w1,%0\";
2439 return \"fpadd3%.d %x2,%x1,%0\";
2443 [(set (match_operand:DF 0 "general_operand" "=f")
2444 (plus:DF (float:DF (match_operand:SI 2 "general_operand" "dmi"))
2445 (match_operand:DF 1 "general_operand" "0")))]
2450 [(set (match_operand:DF 0 "general_operand" "=f")
2451 (plus:DF (float:DF (match_operand:HI 2 "general_operand" "dmn"))
2452 (match_operand:DF 1 "general_operand" "0")))]
2457 [(set (match_operand:DF 0 "general_operand" "=f")
2458 (plus:DF (float:DF (match_operand:QI 2 "general_operand" "dmn"))
2459 (match_operand:DF 1 "general_operand" "0")))]
2464 [(set (match_operand:DF 0 "general_operand" "=f")
2465 (plus:DF (match_operand:DF 1 "general_operand" "%0")
2466 (match_operand:DF 2 "general_operand" "fmG")))]
2470 if (REG_P (operands[2]))
2471 return \"f%&add%.x %2,%0\";
2472 return \"f%&add%.d %f2,%0\";
2475 (define_expand "addsf3"
2476 [(set (match_operand:SF 0 "general_operand" "")
2477 (plus:SF (match_operand:SF 1 "general_operand" "")
2478 (match_operand:SF 2 "general_operand" "")))]
2479 "TARGET_68881 || TARGET_FPA"
2483 [(set (match_operand:SF 0 "general_operand" "=x,y")
2484 (plus:SF (match_operand:SF 1 "general_operand" "%xH,y")
2485 (match_operand:SF 2 "general_operand" "xH,rmF")))]
2489 if (rtx_equal_p (operands[0], operands[1]))
2490 return \"fpadd%.s %w2,%0\";
2491 if (rtx_equal_p (operands[0], operands[2]))
2492 return \"fpadd%.s %w1,%0\";
2493 if (which_alternative == 0)
2494 return \"fpadd3%.s %w2,%w1,%0\";
2495 return \"fpadd3%.s %2,%1,%0\";
2499 [(set (match_operand:SF 0 "general_operand" "=f")
2500 (plus:SF (float:SF (match_operand:SI 2 "general_operand" "dmi"))
2501 (match_operand:SF 1 "general_operand" "0")))]
2506 [(set (match_operand:SF 0 "general_operand" "=f")
2507 (plus:SF (float:SF (match_operand:HI 2 "general_operand" "dmn"))
2508 (match_operand:SF 1 "general_operand" "0")))]
2513 [(set (match_operand:SF 0 "general_operand" "=f")
2514 (plus:SF (float:SF (match_operand:QI 2 "general_operand" "dmn"))
2515 (match_operand:SF 1 "general_operand" "0")))]
2520 [(set (match_operand:SF 0 "general_operand" "=f")
2521 (plus:SF (match_operand:SF 1 "general_operand" "%0")
2522 (match_operand:SF 2 "general_operand" "fdmF")))]
2526 if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
2527 return \"f%$add%.x %2,%0\";
2528 return \"f%$add%.s %f2,%0\";
2531 ;; subtract instructions
2533 (define_insn "subdi_sexthishl32"
2534 [(set (match_operand:DI 0 "general_operand" "=o,a,*d,*d")
2535 (minus:DI (match_operand:DI 1 "general_operand" "0,0,0,0")
2536 (ashift:DI (sign_extend:DI (match_operand:HI 2 "general_operand" "rm,rm,rm,rm"))
2538 (clobber (match_scratch:SI 3 "=&d,X,a,?d"))]
2543 if (ADDRESS_REG_P (operands[0]))
2544 return \"sub%.w %2,%0\";
2545 else if (ADDRESS_REG_P (operands[3]))
2546 return \"move%.w %2,%3\;sub%.l %3,%0\";
2548 return \"move%.w %2,%3\;ext%.l %3\;sub%.l %3,%0\";
2551 (define_insn "subdi_dishl32"
2552 [(set (match_operand:DI 0 "general_operand" "+ro")
2553 (minus:DI (match_dup 0)
2554 (ashift:DI (match_operand:DI 1 "general_operand" "ro")
2560 if (GET_CODE (operands[1]) == REG)
2561 operands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
2563 operands[1] = adj_offsettable_operand (operands[1], 4);
2564 return \"sub%.l %1,%0\";
2567 (define_insn "subdi3"
2568 [(set (match_operand:DI 0 "general_operand" "=<,o<>,d,d,d")
2569 (minus:DI (match_operand:DI 1 "general_operand" "0,0,0,0,0")
2570 (match_operand:DI 2 "general_operand" "<,d,o>,d,a")))
2571 (clobber (match_scratch:SI 3 "=X,&d,&d,X,&d"))]
2575 if (DATA_REG_P (operands[0]))
2577 if (DATA_REG_P (operands[2]))
2578 return \"sub%.l %R2,%R0\;subx%.l %2,%0\";
2579 else if (GET_CODE (operands[2]) == MEM
2580 && GET_CODE (XEXP (operands[2], 0)) == POST_INC)
2582 return \"move%.l %2,%3\;sub%.l %2,%R0\;subx%.l %3,%0\";
2586 /* TODO : this should work also for CONST operands[2] */
2587 if (GET_CODE (operands[2]) == REG)
2588 operands[1] = gen_rtx (REG, SImode, REGNO (operands[2]) + 1);
2590 operands[1] = adj_offsettable_operand (operands[2], 4);
2591 return \"move%.l %2,%3\;sub%.l %1,%R0\;subx%.l %3,%0\";
2594 else if (GET_CODE (operands[0]) == MEM)
2596 if (GET_CODE (operands[2]) == MEM
2597 && GET_CODE (XEXP (operands[2], 0)) == PRE_DEC)
2598 return \"sub%.l %2,%0\;subx%.l %2,%0\";
2600 if (GET_CODE (XEXP (operands[0], 0)) == POST_INC)
2602 operands[1] = gen_rtx (MEM, SImode,
2603 gen_rtx (PLUS, VOIDmode, XEXP(operands[0], 0),
2604 gen_rtx (CONST_INT, VOIDmode, -8)));
2605 return \"move%.l %0,%3\;sub%.l %R2,%0\;subx%.l %2,%3\;move%.l %3,%1\";
2607 else if (GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
2609 operands[1] = XEXP(operands[0], 0);
2610 return \"sub%.l %R2,%0\;move%.l %0,%3\;subx%.l %2,%3\;move%.l %3,%1\";
2614 operands[1] = adj_offsettable_operand (operands[0], 4);
2615 return \"sub%.l %R2,%1\;move%.l %0,%3\;subx%.l %2,%3\;move%.l %3,%0\";
2620 (define_insn "subsi3"
2621 [(set (match_operand:SI 0 "general_operand" "=m,r")
2622 (minus:SI (match_operand:SI 1 "general_operand" "0,0")
2623 (match_operand:SI 2 "general_operand" "ds,mrs")))]
2628 [(set (match_operand:SI 0 "general_operand" "=a")
2629 (minus:SI (match_operand:SI 1 "general_operand" "0")
2631 (match_operand:HI 2 "nonimmediate_operand" "rm"))))]
2635 (define_insn "subhi3"
2636 [(set (match_operand:HI 0 "general_operand" "=m,r")
2637 (minus:HI (match_operand:HI 1 "general_operand" "0,0")
2638 (match_operand:HI 2 "general_operand" "dn,rmn")))]
2643 [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
2644 (minus:HI (match_dup 0)
2645 (match_operand:HI 1 "general_operand" "dn,rmn")))]
2649 (define_insn "subqi3"
2650 [(set (match_operand:QI 0 "general_operand" "=m,d")
2651 (minus:QI (match_operand:QI 1 "general_operand" "0,0")
2652 (match_operand:QI 2 "general_operand" "dn,dmn")))]
2657 [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
2658 (minus:QI (match_dup 0)
2659 (match_operand:QI 1 "general_operand" "dn,dmn")))]
2663 (define_expand "subdf3"
2664 [(set (match_operand:DF 0 "general_operand" "")
2665 (minus:DF (match_operand:DF 1 "general_operand" "")
2666 (match_operand:DF 2 "general_operand" "")))]
2667 "TARGET_68881 || TARGET_FPA"
2671 [(set (match_operand:DF 0 "general_operand" "=x,y,y")
2672 (minus:DF (match_operand:DF 1 "general_operand" "xH,y,dmF")
2673 (match_operand:DF 2 "general_operand" "xH,dmF,0")))]
2677 if (rtx_equal_p (operands[0], operands[2]))
2678 return \"fprsub%.d %y1,%0\";
2679 if (rtx_equal_p (operands[0], operands[1]))
2680 return \"fpsub%.d %y2,%0\";
2681 if (which_alternative == 0)
2682 return \"fpsub3%.d %w2,%w1,%0\";
2683 return \"fpsub3%.d %x2,%x1,%0\";
2687 [(set (match_operand:DF 0 "general_operand" "=f")
2688 (minus:DF (match_operand:DF 1 "general_operand" "0")
2689 (float:DF (match_operand:SI 2 "general_operand" "dmi"))))]
2694 [(set (match_operand:DF 0 "general_operand" "=f")
2695 (minus:DF (match_operand:DF 1 "general_operand" "0")
2696 (float:DF (match_operand:HI 2 "general_operand" "dmn"))))]
2701 [(set (match_operand:DF 0 "general_operand" "=f")
2702 (minus:DF (match_operand:DF 1 "general_operand" "0")
2703 (float:DF (match_operand:QI 2 "general_operand" "dmn"))))]
2708 [(set (match_operand:DF 0 "general_operand" "=f")
2709 (minus:DF (match_operand:DF 1 "general_operand" "0")
2710 (match_operand:DF 2 "general_operand" "fmG")))]
2714 if (REG_P (operands[2]))
2715 return \"f%&sub%.x %2,%0\";
2716 return \"f%&sub%.d %f2,%0\";
2719 (define_expand "subsf3"
2720 [(set (match_operand:SF 0 "general_operand" "")
2721 (minus:SF (match_operand:SF 1 "general_operand" "")
2722 (match_operand:SF 2 "general_operand" "")))]
2723 "TARGET_68881 || TARGET_FPA"
2727 [(set (match_operand:SF 0 "general_operand" "=x,y,y")
2728 (minus:SF (match_operand:SF 1 "general_operand" "xH,y,rmF")
2729 (match_operand:SF 2 "general_operand" "xH,rmF,0")))]
2733 if (rtx_equal_p (operands[0], operands[2]))
2734 return \"fprsub%.s %w1,%0\";
2735 if (rtx_equal_p (operands[0], operands[1]))
2736 return \"fpsub%.s %w2,%0\";
2737 if (which_alternative == 0)
2738 return \"fpsub3%.s %w2,%w1,%0\";
2739 return \"fpsub3%.s %2,%1,%0\";
2743 [(set (match_operand:SF 0 "general_operand" "=f")
2744 (minus:SF (match_operand:SF 1 "general_operand" "0")
2745 (float:SF (match_operand:SI 2 "general_operand" "dmi"))))]
2750 [(set (match_operand:SF 0 "general_operand" "=f")
2751 (minus:SF (match_operand:SF 1 "general_operand" "0")
2752 (float:SF (match_operand:HI 2 "general_operand" "dmn"))))]
2757 [(set (match_operand:SF 0 "general_operand" "=f")
2758 (minus:SF (match_operand:SF 1 "general_operand" "0")
2759 (float:SF (match_operand:QI 2 "general_operand" "dmn"))))]
2764 [(set (match_operand:SF 0 "general_operand" "=f")
2765 (minus:SF (match_operand:SF 1 "general_operand" "0")
2766 (match_operand:SF 2 "general_operand" "fdmF")))]
2770 if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
2771 return \"f%$sub%.x %2,%0\";
2772 return \"f%$sub%.s %f2,%0\";
2775 ;; multiply instructions
2777 (define_insn "mulhi3"
2778 [(set (match_operand:HI 0 "general_operand" "=d")
2779 (mult:HI (match_operand:HI 1 "general_operand" "%0")
2780 (match_operand:HI 2 "general_operand" "dmn")))]
2784 #if defined(MOTOROLA) && !defined(CRDS)
2785 return \"muls%.w %2,%0\";
2787 return \"muls %2,%0\";
2791 (define_insn "mulhisi3"
2792 [(set (match_operand:SI 0 "general_operand" "=d")
2793 (mult:SI (sign_extend:SI
2794 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2796 (match_operand:HI 2 "nonimmediate_operand" "dm"))))]
2800 #if defined(MOTOROLA) && !defined(CRDS)
2801 return \"muls%.w %2,%0\";
2803 return \"muls %2,%0\";
2808 [(set (match_operand:SI 0 "general_operand" "=d")
2809 (mult:SI (sign_extend:SI
2810 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2811 (match_operand:SI 2 "const_int_operand" "n")))]
2812 "INTVAL (operands[2]) >= -0x8000 && INTVAL (operands[2]) <= 0x7fff"
2815 #if defined(MOTOROLA) && !defined(CRDS)
2816 return \"muls%.w %2,%0\";
2818 return \"muls %2,%0\";
2822 (define_expand "mulsi3"
2823 [(set (match_operand:SI 0 "general_operand" "")
2824 (mult:SI (match_operand:SI 1 "general_operand" "")
2825 (match_operand:SI 2 "general_operand" "")))]
2826 "TARGET_68020 || TARGET_5200"
2830 [(set (match_operand:SI 0 "general_operand" "=d")
2831 (mult:SI (match_operand:SI 1 "general_operand" "%0")
2832 (match_operand:SI 2 "general_operand" "dmsK")))]
2837 [(set (match_operand:SI 0 "general_operand" "=d")
2838 (mult:SI (match_operand:SI 1 "general_operand" "%0")
2839 (match_operand:SI 2 "general_operand" "d<>")))]
2843 (define_insn "umulhisi3"
2844 [(set (match_operand:SI 0 "general_operand" "=d")
2845 (mult:SI (zero_extend:SI
2846 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2848 (match_operand:HI 2 "nonimmediate_operand" "dm"))))]
2852 #if defined(MOTOROLA) && !defined(CRDS)
2853 return \"mulu%.w %2,%0\";
2855 return \"mulu %2,%0\";
2860 [(set (match_operand:SI 0 "general_operand" "=d")
2861 (mult:SI (zero_extend:SI
2862 (match_operand:HI 1 "nonimmediate_operand" "%0"))
2863 (match_operand:SI 2 "const_int_operand" "n")))]
2864 "INTVAL (operands[2]) >= 0 && INTVAL (operands[2]) <= 0xffff"
2867 #if defined(MOTOROLA) && !defined(CRDS)
2868 return \"mulu%.w %2,%0\";
2870 return \"mulu %2,%0\";
2874 ;; We need a separate DEFINE_EXPAND for u?mulsidi3 to be able to use the
2875 ;; proper matching constraint. This is because the matching is between
2876 ;; the high-numbered word of the DImode operand[0] and operand[1].
2877 (define_expand "umulsidi3"
2879 [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 1)
2880 (mult:SI (match_operand:SI 1 "register_operand" "")
2881 (match_operand:SI 2 "nonimmediate_operand" "")))
2882 (set (subreg:SI (match_dup 0) 0)
2883 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
2884 (zero_extend:DI (match_dup 2)))
2885 (const_int 32))))])]
2886 "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
2890 [(set (match_operand:SI 0 "register_operand" "=d")
2891 (mult:SI (match_operand:SI 1 "register_operand" "%0")
2892 (match_operand:SI 2 "nonimmediate_operand" "dm")))
2893 (set (match_operand:SI 3 "register_operand" "=d")
2894 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
2895 (zero_extend:DI (match_dup 2)))
2897 "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
2900 ; Match immediate case. For 2.4 only match things < 2^31.
2901 ; It's tricky with larger values in these patterns since we need to match
2902 ; values between the two parallel multiplies, between a CONST_DOUBLE and
2905 [(set (match_operand:SI 0 "register_operand" "=d")
2906 (mult:SI (match_operand:SI 1 "register_operand" "%0")
2907 (match_operand:SI 2 "const_int_operand" "n")))
2908 (set (match_operand:SI 3 "register_operand" "=d")
2909 (truncate:SI (lshiftrt:DI (mult:DI (zero_extend:DI (match_dup 1))
2912 "TARGET_68020 && !TARGET_68060 && !TARGET_5200
2913 && (unsigned) INTVAL (operands[2]) <= 0x7fffffff"
2916 (define_expand "mulsidi3"
2918 [(set (subreg:SI (match_operand:DI 0 "register_operand" "") 1)
2919 (mult:SI (match_operand:SI 1 "register_operand" "")
2920 (match_operand:SI 2 "nonimmediate_operand" "")))
2921 (set (subreg:SI (match_dup 0) 0)
2922 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
2923 (sign_extend:DI (match_dup 2)))
2924 (const_int 32))))])]
2925 "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
2929 [(set (match_operand:SI 0 "register_operand" "=d")
2930 (mult:SI (match_operand:SI 1 "register_operand" "%0")
2931 (match_operand:SI 2 "nonimmediate_operand" "dm")))
2932 (set (match_operand:SI 3 "register_operand" "=d")
2933 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
2934 (sign_extend:DI (match_dup 2)))
2936 "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
2940 [(set (match_operand:SI 0 "register_operand" "=d")
2941 (mult:SI (match_operand:SI 1 "register_operand" "%0")
2942 (match_operand:SI 2 "const_sint32_operand" "")))
2943 (set (match_operand:SI 3 "register_operand" "=d")
2944 (truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
2947 "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
2950 (define_expand "umulsi3_highpart"
2952 [(set (match_operand:SI 0 "register_operand" "")
2955 (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" ""))
2956 (zero_extend:DI (match_operand:SI 2 "general_operand" "")))
2958 (clobber (match_dup 3))])]
2959 "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
2962 operands[3] = gen_reg_rtx (SImode);
2963 if (GET_CODE (operands[2]) == CONST_INT
2964 || GET_CODE (operands[2]) == CONST_DOUBLE)
2966 if (! const_uint32_operand (operands[2], VOIDmode))
2968 /* We have to adjust the operand order for the matching constraints. */
2969 emit_insn (gen_const_umulsi3_highpart (operands[0], operands[3],
2970 operands[1], operands[2]));
2976 [(set (match_operand:SI 0 "register_operand" "=d")
2979 (mult:DI (zero_extend:DI (match_operand:SI 2 "register_operand" "%1"))
2980 (zero_extend:DI (match_operand:SI 3 "nonimmediate_operand" "dm")))
2982 (clobber (match_operand:SI 1 "register_operand" "=d"))]
2983 "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
2986 (define_insn "const_umulsi3_highpart"
2987 [(set (match_operand:SI 0 "register_operand" "=d")
2990 (mult:DI (zero_extend:DI (match_operand:SI 2 "register_operand" "1"))
2991 (match_operand 3 "const_uint32_operand" ""))
2993 (clobber (match_operand:SI 1 "register_operand" "=d"))]
2994 "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
2997 (define_expand "smulsi3_highpart"
2999 [(set (match_operand:SI 0 "register_operand" "")
3002 (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" ""))
3003 (sign_extend:DI (match_operand:SI 2 "general_operand" "")))
3005 (clobber (match_dup 3))])]
3006 "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
3009 operands[3] = gen_reg_rtx (SImode);
3010 if (GET_CODE (operands[2]) == CONST_INT
3011 || GET_CODE (operands[2]) == CONST_DOUBLE)
3013 if (! const_sint32_operand (operands[2], VOIDmode))
3015 /* We have to adjust the operand order for the matching constraints. */
3016 emit_insn (gen_const_smulsi3_highpart (operands[0], operands[3],
3017 operands[1], operands[2]));
3023 [(set (match_operand:SI 0 "register_operand" "=d")
3026 (mult:DI (sign_extend:DI (match_operand:SI 2 "register_operand" "%1"))
3027 (sign_extend:DI (match_operand:SI 3 "nonimmediate_operand" "dm")))
3029 (clobber (match_operand:SI 1 "register_operand" "=d"))]
3030 "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
3033 (define_insn "const_smulsi3_highpart"
3034 [(set (match_operand:SI 0 "register_operand" "=d")
3037 (mult:DI (sign_extend:DI (match_operand:SI 2 "register_operand" "1"))
3038 (match_operand 3 "const_sint32_operand" ""))
3040 (clobber (match_operand:SI 1 "register_operand" "=d"))]
3041 "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
3044 (define_expand "muldf3"
3045 [(set (match_operand:DF 0 "general_operand" "")
3046 (mult:DF (match_operand:DF 1 "general_operand" "")
3047 (match_operand:DF 2 "general_operand" "")))]
3048 "TARGET_68881 || TARGET_FPA"
3052 [(set (match_operand:DF 0 "general_operand" "=x,y")
3053 (mult:DF (match_operand:DF 1 "general_operand" "%xH,y")
3054 (match_operand:DF 2 "general_operand" "xH,rmF")))]
3058 if (rtx_equal_p (operands[1], operands[2]))
3059 return \"fpsqr%.d %y1,%0\";
3060 if (rtx_equal_p (operands[0], operands[1]))
3061 return \"fpmul%.d %y2,%0\";
3062 if (rtx_equal_p (operands[0], operands[2]))
3063 return \"fpmul%.d %y1,%0\";
3064 if (which_alternative == 0)
3065 return \"fpmul3%.d %w2,%w1,%0\";
3066 return \"fpmul3%.d %x2,%x1,%0\";
3070 [(set (match_operand:DF 0 "general_operand" "=f")
3071 (mult:DF (float:DF (match_operand:SI 2 "general_operand" "dmi"))
3072 (match_operand:DF 1 "general_operand" "0")))]
3077 [(set (match_operand:DF 0 "general_operand" "=f")
3078 (mult:DF (float:DF (match_operand:HI 2 "general_operand" "dmn"))
3079 (match_operand:DF 1 "general_operand" "0")))]
3084 [(set (match_operand:DF 0 "general_operand" "=f")
3085 (mult:DF (float:DF (match_operand:QI 2 "general_operand" "dmn"))
3086 (match_operand:DF 1 "general_operand" "0")))]
3091 [(set (match_operand:DF 0 "general_operand" "=f")
3092 (mult:DF (match_operand:DF 1 "general_operand" "%0")
3093 (match_operand:DF 2 "general_operand" "fmG")))]
3097 if (GET_CODE (operands[2]) == CONST_DOUBLE
3098 && floating_exact_log2 (operands[2]) && !TARGET_68040 && !TARGET_68060)
3100 int i = floating_exact_log2 (operands[2]);
3101 operands[2] = gen_rtx (CONST_INT, VOIDmode, i);
3102 return \"fscale%.l %2,%0\";
3104 if (REG_P (operands[2]))
3105 return \"f%&mul%.x %2,%0\";
3106 return \"f%&mul%.d %f2,%0\";
3109 (define_expand "mulsf3"
3110 [(set (match_operand:SF 0 "general_operand" "")
3111 (mult:SF (match_operand:SF 1 "general_operand" "")
3112 (match_operand:SF 2 "general_operand" "")))]
3113 "TARGET_68881 || TARGET_FPA"
3117 [(set (match_operand:SF 0 "general_operand" "=x,y")
3118 (mult:SF (match_operand:SF 1 "general_operand" "%xH,y")
3119 (match_operand:SF 2 "general_operand" "xH,rmF")))]
3123 if (rtx_equal_p (operands[1], operands[2]))
3124 return \"fpsqr%.s %w1,%0\";
3125 if (rtx_equal_p (operands[0], operands[1]))
3126 return \"fpmul%.s %w2,%0\";
3127 if (rtx_equal_p (operands[0], operands[2]))
3128 return \"fpmul%.s %w1,%0\";
3129 if (which_alternative == 0)
3130 return \"fpmul3%.s %w2,%w1,%0\";
3131 return \"fpmul3%.s %2,%1,%0\";
3135 [(set (match_operand:SF 0 "general_operand" "=f")
3136 (mult:SF (float:SF (match_operand:SI 2 "general_operand" "dmi"))
3137 (match_operand:SF 1 "general_operand" "0")))]
3141 return (TARGET_68040_ONLY
3142 ? \"fsmul%.l %2,%0\"
3143 : \"fsglmul%.l %2,%0\");
3147 [(set (match_operand:SF 0 "general_operand" "=f")
3148 (mult:SF (float:SF (match_operand:HI 2 "general_operand" "dmn"))
3149 (match_operand:SF 1 "general_operand" "0")))]
3153 return (TARGET_68040_ONLY
3154 ? \"fsmul%.w %2,%0\"
3155 : \"fsglmul%.w %2,%0\");
3159 [(set (match_operand:SF 0 "general_operand" "=f")
3160 (mult:SF (float:SF (match_operand:QI 2 "general_operand" "dmn"))
3161 (match_operand:SF 1 "general_operand" "0")))]
3165 return (TARGET_68040_ONLY
3166 ? \"fsmul%.b %2,%0\"
3167 : \"fsglmul%.b %2,%0\");
3171 [(set (match_operand:SF 0 "general_operand" "=f")
3172 (mult:SF (match_operand:SF 1 "general_operand" "%0")
3173 (match_operand:SF 2 "general_operand" "fdmF")))]
3177 #ifdef FSGLMUL_USE_S
3178 if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
3179 return (TARGET_68040_ONLY
3180 ? \"fsmul%.s %2,%0\"
3181 : \"fsglmul%.s %2,%0\");
3183 if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
3184 return (TARGET_68040_ONLY
3185 ? \"fsmul%.x %2,%0\"
3186 : \"fsglmul%.x %2,%0\");
3188 return (TARGET_68040_ONLY
3189 ? \"fsmul%.s %f2,%0\"
3190 : \"fsglmul%.s %f2,%0\");
3193 ;; divide instructions
3195 (define_expand "divdf3"
3196 [(set (match_operand:DF 0 "general_operand" "")
3197 (div:DF (match_operand:DF 1 "general_operand" "")
3198 (match_operand:DF 2 "general_operand" "")))]
3199 "TARGET_68881 || TARGET_FPA"
3203 [(set (match_operand:DF 0 "general_operand" "=x,y,y")
3204 (div:DF (match_operand:DF 1 "general_operand" "xH,y,rmF")
3205 (match_operand:DF 2 "general_operand" "xH,rmF,0")))]
3209 if (rtx_equal_p (operands[0], operands[2]))
3210 return \"fprdiv%.d %y1,%0\";
3211 if (rtx_equal_p (operands[0], operands[1]))
3212 return \"fpdiv%.d %y2,%0\";
3213 if (which_alternative == 0)
3214 return \"fpdiv3%.d %w2,%w1,%0\";
3215 return \"fpdiv3%.d %x2,%x1,%x0\";
3219 [(set (match_operand:DF 0 "general_operand" "=f")
3220 (div:DF (match_operand:DF 1 "general_operand" "0")
3221 (float:DF (match_operand:SI 2 "general_operand" "dmi"))))]
3226 [(set (match_operand:DF 0 "general_operand" "=f")
3227 (div:DF (match_operand:DF 1 "general_operand" "0")
3228 (float:DF (match_operand:HI 2 "general_operand" "dmn"))))]
3233 [(set (match_operand:DF 0 "general_operand" "=f")
3234 (div:DF (match_operand:DF 1 "general_operand" "0")
3235 (float:DF (match_operand:QI 2 "general_operand" "dmn"))))]
3240 [(set (match_operand:DF 0 "general_operand" "=f")
3241 (div:DF (match_operand:DF 1 "general_operand" "0")
3242 (match_operand:DF 2 "general_operand" "fmG")))]
3246 if (REG_P (operands[2]))
3247 return \"f%&div%.x %2,%0\";
3248 return \"f%&div%.d %f2,%0\";
3251 (define_expand "divsf3"
3252 [(set (match_operand:SF 0 "general_operand" "")
3253 (div:SF (match_operand:SF 1 "general_operand" "")
3254 (match_operand:SF 2 "general_operand" "")))]
3255 "TARGET_68881 || TARGET_FPA"
3259 [(set (match_operand:SF 0 "general_operand" "=x,y,y")
3260 (div:SF (match_operand:SF 1 "general_operand" "xH,y,rmF")
3261 (match_operand:SF 2 "general_operand" "xH,rmF,0")))]
3265 if (rtx_equal_p (operands[0], operands[1]))
3266 return \"fpdiv%.s %w2,%0\";
3267 if (rtx_equal_p (operands[0], operands[2]))
3268 return \"fprdiv%.s %w1,%0\";
3269 if (which_alternative == 0)
3270 return \"fpdiv3%.s %w2,%w1,%0\";
3271 return \"fpdiv3%.s %2,%1,%0\";
3275 [(set (match_operand:SF 0 "general_operand" "=f")
3276 (div:SF (match_operand:SF 1 "general_operand" "0")
3277 (float:SF (match_operand:SI 2 "general_operand" "dmi"))))]
3281 return (TARGET_68040_ONLY
3282 ? \"fsdiv%.l %2,%0\"
3283 : \"fsgldiv%.l %2,%0\");
3287 [(set (match_operand:SF 0 "general_operand" "=f")
3288 (div:SF (match_operand:SF 1 "general_operand" "0")
3289 (float:SF (match_operand:HI 2 "general_operand" "dmn"))))]
3293 return (TARGET_68040_ONLY
3294 ? \"fsdiv%.w %2,%0\"
3295 : \"fsgldiv%.w %2,%0\");
3299 [(set (match_operand:SF 0 "general_operand" "=f")
3300 (div:SF (match_operand:SF 1 "general_operand" "0")
3301 (float:SF (match_operand:QI 2 "general_operand" "dmn"))))]
3305 return (TARGET_68040_ONLY
3306 ? \"fsdiv%.b %2,%0\"
3307 : \"fsgldiv%.b %2,%0\");
3311 [(set (match_operand:SF 0 "general_operand" "=f")
3312 (div:SF (match_operand:SF 1 "general_operand" "0")
3313 (match_operand:SF 2 "general_operand" "fdmF")))]
3317 #ifdef FSGLDIV_USE_S
3318 if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
3319 return (TARGET_68040_ONLY
3320 ? \"fsdiv%.s %2,%0\"
3321 : \"fsgldiv%.s %2,%0\");
3323 if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
3324 return (TARGET_68040_ONLY
3325 ? \"fsdiv%.x %2,%0\"
3326 : \"fsgldiv%.x %2,%0\");
3328 return (TARGET_68040_ONLY
3329 ? \"fsdiv%.s %f2,%0\"
3330 : \"fsgldiv%.s %f2,%0\");
3333 ;; Remainder instructions.
3335 (define_insn "divmodsi4"
3336 [(set (match_operand:SI 0 "general_operand" "=d")
3337 (div:SI (match_operand:SI 1 "general_operand" "0")
3338 (match_operand:SI 2 "general_operand" "dmsK")))
3339 (set (match_operand:SI 3 "general_operand" "=d")
3340 (mod:SI (match_dup 1) (match_dup 2)))]
3341 "TARGET_68020 && !TARGET_5200"
3344 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3345 return \"divs%.l %2,%0\";
3347 return \"divsl%.l %2,%3:%0\";
3350 (define_insn "udivmodsi4"
3351 [(set (match_operand:SI 0 "general_operand" "=d")
3352 (udiv:SI (match_operand:SI 1 "general_operand" "0")
3353 (match_operand:SI 2 "general_operand" "dmsK")))
3354 (set (match_operand:SI 3 "general_operand" "=d")
3355 (umod:SI (match_dup 1) (match_dup 2)))]
3356 "TARGET_68020 && !TARGET_5200"
3359 if (find_reg_note (insn, REG_UNUSED, operands[3]))
3360 return \"divu%.l %2,%0\";
3362 return \"divul%.l %2,%3:%0\";
3365 (define_insn "divmodhi4"
3366 [(set (match_operand:HI 0 "general_operand" "=d")
3367 (div:HI (match_operand:HI 1 "general_operand" "0")
3368 (match_operand:HI 2 "general_operand" "dmsK")))
3369 (set (match_operand:HI 3 "general_operand" "=d")
3370 (mod:HI (match_dup 1) (match_dup 2)))]
3375 output_asm_insn(\"ext%.l %0\;divs%.w %2,%0\", operands);
3377 output_asm_insn(\"extl %0\;divs %2,%0\", operands);
3379 if (!find_reg_note(insn, REG_UNUSED, operands[3]))
3382 return \"move%.l %0,%3\;swap %3\";
3388 (define_insn "udivmodhi4"
3389 [(set (match_operand:HI 0 "general_operand" "=d")
3390 (udiv:HI (match_operand:HI 1 "general_operand" "0")
3391 (match_operand:HI 2 "general_operand" "dmsK")))
3392 (set (match_operand:HI 3 "general_operand" "=d")
3393 (umod:HI (match_dup 1) (match_dup 2)))]
3398 output_asm_insn(\"and%.l %#0xFFFF,%0\;divu%.w %2,%0\", operands);
3400 output_asm_insn(\"and%.l %#0xFFFF,%0\;divu %2,%0\", operands);
3402 if (!find_reg_note(insn, REG_UNUSED, operands[3]))
3405 return \"move%.l %0,%3\;swap %3\";
3411 ;; logical-and instructions
3413 ;; Prevent AND from being made with sp. This doesn't exist in the machine
3414 ;; and reload will cause inefficient code. Since sp is a FIXED_REG, we
3415 ;; can't allocate pseudos into it.
3417 (define_expand "andsi3"
3418 [(set (match_operand:SI 0 "not_sp_operand" "=m,d")
3419 (and:SI (match_operand:SI 1 "general_operand" "%0,0")
3420 (match_operand:SI 2 "general_operand" "dKs,dmMs")))]
3424 (define_insn "andsi3_internal"
3425 [(set (match_operand:SI 0 "not_sp_operand" "=m,d")
3426 (and:SI (match_operand:SI 1 "general_operand" "%0,0")
3427 (match_operand:SI 2 "general_operand" "dKs,dmMs")))]
3432 if (GET_CODE (operands[2]) == CONST_INT
3433 && (INTVAL (operands[2]) | 0xffff) == 0xffffffff
3434 && (DATA_REG_P (operands[0])
3435 || offsettable_memref_p (operands[0])))
3437 if (GET_CODE (operands[0]) != REG)
3438 operands[0] = adj_offsettable_operand (operands[0], 2);
3439 operands[2] = gen_rtx (CONST_INT, VOIDmode,
3440 INTVAL (operands[2]) & 0xffff);
3441 /* Do not delete a following tstl %0 insn; that would be incorrect. */
3443 if (operands[2] == const0_rtx)
3444 return \"clr%.w %0\";
3445 return \"and%.w %2,%0\";
3447 if (GET_CODE (operands[2]) == CONST_INT
3448 && (logval = exact_log2 (~ INTVAL (operands[2]))) >= 0
3449 && (DATA_REG_P (operands[0])
3450 || offsettable_memref_p (operands[0])))
3452 if (DATA_REG_P (operands[0]))
3454 operands[1] = gen_rtx (CONST_INT, VOIDmode, logval);
3458 operands[0] = adj_offsettable_operand (operands[0], 3 - (logval / 8));
3459 operands[1] = gen_rtx (CONST_INT, VOIDmode, logval % 8);
3461 /* This does not set condition codes in a standard way. */
3463 return \"bclr %1,%0\";
3465 return \"and%.l %2,%0\";