1 ;;- Machine description for GNU C compiler for Alliant FX systems
2 ;; Copyright (C) 1989, 1994, 1996, 1998 Free Software Foundation, Inc.
3 ;; Adapted from m68k.md by Paul Petersen (petersen@uicsrd.csrd.uiuc.edu)
4 ;; and Joe Weening (weening@gang-of-four.stanford.edu).
6 ;; This file is part of GNU CC.
8 ;; GNU CC is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; GNU CC is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GNU CC; see the file COPYING. If not, write to
20 ;; the Free Software Foundation, 59 Temple Place - Suite 330,
21 ;; Boston, MA 02111-1307, USA.
24 ;;- instruction definitions
26 ;;- @@The original PO technology requires these to be ordered by speed,
27 ;;- @@ so that assigner will pick the fastest.
29 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
31 ;;- When naming insn's (operand 0 of define_insn) be careful about using
32 ;;- names from other targets machine descriptions.
34 ;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
35 ;;- updates for most instructions.
37 ;;- Operand classes for the register allocator:
38 ;;- 'a' one of the address registers can be used.
39 ;;- 'd' one of the data registers can be used.
40 ;;- 'f' one of the CE floating point registers can be used
41 ;;- 'r' either a data or an address register can be used.
43 ;;- Immediate integer operand constraints:
45 ;;- 'J' -32768 .. 32767
49 ;;- Some remnants of constraint codes for the m68k ('x','y','G','H')
50 ;;- may remain in the insn definitions.
52 ;;- Some of these insn's are composites of several Alliant op codes.
53 ;;- The assembler (or final @@??) insures that the appropriate one is
56 ;; We don't want to allow a constant operand for test insns because
57 ;; (set (cc0) (const_int foo)) has no mode information. Such insns will
58 ;; be folded while optimizing anyway.
62 (match_operand:SI 0 "nonimmediate_operand" "rm"))]
66 if (TARGET_68020 || ! ADDRESS_REG_P (operands[0]))
68 /* If you think that the 68020 does not support tstl a0,
69 reread page B-167 of the 68020 manual more carefully. */
70 /* On an address reg, cmpw may replace cmpl. */
71 return \"cmp%.w %#0,%0\";
76 (match_operand:HI 0 "nonimmediate_operand" "rm"))]
80 if (TARGET_68020 || ! ADDRESS_REG_P (operands[0]))
82 return \"cmp%.w %#0,%0\";
87 (match_operand:QI 0 "nonimmediate_operand" "dm"))]
93 (match_operand:SF 0 "nonimmediate_operand" "fm"))]
97 cc_status.flags = CC_IN_FP;
98 return \"ftest%.s %0\";
103 (match_operand:DF 0 "nonimmediate_operand" "fm"))]
107 cc_status.flags = CC_IN_FP;
108 return \"ftest%.d %0\";
111 ;; compare instructions.
113 ;; A composite of the cmp, cmpa, & cmpi m68000 op codes.
116 (compare (match_operand:SI 0 "nonimmediate_operand" "rKs,mr,>")
117 (match_operand:SI 1 "general_operand" "mr,Ksr,>")))]
121 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
122 return \"cmpm%.l %1,%0\";
123 if (REG_P (operands[1])
124 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
126 cc_status.flags |= CC_REVERSED;
127 return \"cmp%.l %d0,%d1\";
129 return \"cmp%.l %d1,%d0\";
134 (compare (match_operand:HI 0 "nonimmediate_operand" "rnm,d,n,m")
135 (match_operand:HI 1 "general_operand" "d,rnm,m,n")))]
139 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
140 return \"cmpm%.w %1,%0\";
141 if ((REG_P (operands[1]) && !ADDRESS_REG_P (operands[1]))
142 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
143 { cc_status.flags |= CC_REVERSED;
144 return \"cmp%.w %d0,%d1\";
146 return \"cmp%.w %d1,%d0\";
151 (compare (match_operand:QI 0 "nonimmediate_operand" "dn,md,>")
152 (match_operand:QI 1 "general_operand" "dm,nd,>")))]
156 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
157 return \"cmpm%.b %1,%0\";
158 if (REG_P (operands[1])
159 || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
161 cc_status.flags |= CC_REVERSED;
162 return \"cmp%.b %d0,%d1\";
164 return \"cmp%.b %d1,%d0\";
169 (compare (match_operand:DF 0 "nonimmediate_operand" "f,m")
170 (match_operand:DF 1 "nonimmediate_operand" "fm,f")))]
174 cc_status.flags = CC_IN_FP;
175 if (FP_REG_P (operands[0]))
176 return \"fcmp%.d %1,%0\";
177 cc_status.flags |= CC_REVERSED;
178 return \"fcmp%.d %0,%1\";
183 (compare (match_operand:SF 0 "nonimmediate_operand" "f,m")
184 (match_operand:SF 1 "nonimmediate_operand" "fm,f")))]
188 cc_status.flags = CC_IN_FP;
189 if (FP_REG_P (operands[0]))
190 return \"fcmp%.s %1,%0\";
191 cc_status.flags |= CC_REVERSED;
192 return \"fcmp%.s %0,%1\";
195 ;; Recognizers for btst instructions.
198 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "o")
200 (minus:SI (const_int 7)
201 (match_operand:SI 1 "general_operand" "di"))))]
203 "* { return output_btst (operands, operands[1], operands[0], insn, 7); }")
206 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "d")
208 (minus:SI (const_int 31)
209 (match_operand:SI 1 "general_operand" "di"))))]
211 "* { return output_btst (operands, operands[1], operands[0], insn, 31); }")
213 ;; The following two patterns are like the previous two
214 ;; except that they use the fact that bit-number operands
215 ;; are automatically masked to 3 or 5 bits.
218 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "o")
220 (minus:SI (const_int 7)
222 (match_operand:SI 1 "general_operand" "d")
225 "* { return output_btst (operands, operands[1], operands[0], insn, 7); }")
228 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "d")
230 (minus:SI (const_int 31)
232 (match_operand:SI 1 "general_operand" "d")
235 "* { return output_btst (operands, operands[1], operands[0], insn, 31); }")
237 ;; Nonoffsettable mem refs are ok in this one pattern
238 ;; since we don't try to adjust them.
240 [(set (cc0) (zero_extract (match_operand:QI 0 "memory_operand" "m")
242 (match_operand:SI 1 "general_operand" "i")))]
243 "GET_CODE (operands[1]) == CONST_INT
244 && (unsigned) INTVAL (operands[1]) < 8"
247 operands[1] = GEN_INT (7 - INTVAL (operands[1]));
248 return output_btst (operands, operands[1], operands[0], insn, 7);
253 [(set (cc0) (zero_extract (match_operand:SI 0 "register_operand" "do")
255 (match_operand:SI 1 "general_operand" "i")))]
256 "GET_CODE (operands[1]) == CONST_INT"
259 if (GET_CODE (operands[0]) == MEM)
261 operands[0] = adj_offsettable_operand (operands[0],
262 INTVAL (operands[1]) / 8);
263 operands[1] = GEN_INT (7 - INTVAL (operands[1]) % 8);
264 return output_btst (operands, operands[1], operands[0], insn, 7);
266 operands[1] = GEN_INT (31 - INTVAL (operands[1]));
267 return output_btst (operands, operands[1], operands[0], insn, 31);
273 ;; A special case in which it is not desirable
274 ;; to reload the constant into a data register.
276 [(set (match_operand:SI 0 "push_operand" "=m")
277 (match_operand:SI 1 "general_operand" "J"))]
278 "GET_CODE (operands[1]) == CONST_INT
279 && INTVAL (operands[1]) >= -0x8000
280 && INTVAL (operands[1]) < 0x8000"
283 if (operands[1] == const0_rtx)
284 return \"clr%.l %0\";
289 ;(define_insn "swapsi"
290 ; [(set (match_operand:SI 0 "general_operand" "r")
291 ; (match_operand:SI 1 "general_operand" "r"))
292 ; (set (match_dup 1) (match_dup 0))]
296 ;; Special case of fullword move when source is zero.
297 ;; The reason this is special is to avoid loading a zero
298 ;; into a data reg with moveq in order to store it elsewhere.
301 [(set (match_operand:SI 0 "general_operand" "=a,g")
308 ;; General case of fullword move. The register constraints
309 ;; force integer constants in range for a moveq to be reloaded
310 ;; if they are headed for memory.
312 ;; Notes: make sure no alternative allows g vs g.
313 ;; We don't allow f-regs since fixed point cannot go in them.
314 ;; We do allow y and x regs since fixed point is allowed in them.
315 [(set (match_operand:SI 0 "general_operand" "=g,da,y,!*x*r*m")
316 (match_operand:SI 1 "general_operand" "daymKs,i,g,*x*r*m"))]
320 if (GET_CODE (operands[1]) == CONST_INT)
322 if (operands[1] == const0_rtx
323 && (DATA_REG_P (operands[0])
324 || GET_CODE (operands[0]) == MEM))
325 return \"clr%.l %0\";
326 else if (DATA_REG_P (operands[0])
327 && INTVAL (operands[1]) < 128
328 && INTVAL (operands[1]) >= -128)
329 return \"moveq %1,%0\";
330 else if (ADDRESS_REG_P (operands[0])
331 && INTVAL (operands[1]) < 0x8000
332 && INTVAL (operands[1]) >= -0x8000)
333 return \"mov%.w %1,%0\";
334 else if (push_operand (operands[0], SImode)
335 && INTVAL (operands[1]) < 0x8000
336 && INTVAL (operands[1]) >= -0x8000)
339 else if ((GET_CODE (operands[1]) == SYMBOL_REF
340 || GET_CODE (operands[1]) == CONST)
341 && push_operand (operands[0], SImode))
343 else if ((GET_CODE (operands[1]) == SYMBOL_REF
344 || GET_CODE (operands[1]) == CONST)
345 && ADDRESS_REG_P (operands[0]))
346 return \"lea %a1,%0\";
347 return \"mov%.l %1,%0\";
351 [(set (match_operand:HI 0 "general_operand" "=g")
352 (match_operand:HI 1 "general_operand" "g"))]
356 if (GET_CODE (operands[1]) == CONST_INT)
358 if (operands[1] == const0_rtx
359 && (DATA_REG_P (operands[0])
360 || GET_CODE (operands[0]) == MEM))
361 return \"clr%.w %0\";
362 else if (DATA_REG_P (operands[0])
363 && INTVAL (operands[1]) < 128
364 && INTVAL (operands[1]) >= -128)
366 return \"moveq %1,%0\";
368 else if (INTVAL (operands[1]) < 0x8000
369 && INTVAL (operands[1]) >= -0x8000)
370 return \"mov%.w %1,%0\";
372 else if (CONSTANT_P (operands[1]))
373 return \"mov%.l %1,%0\";
374 /* Recognize the insn before a tablejump, one that refers
375 to a table of offsets. Such an insn will need to refer
376 to a label on the insn. So output one. Use the label-number
377 of the table of offsets to generate this label. */
378 if (GET_CODE (operands[1]) == MEM
379 && GET_CODE (XEXP (operands[1], 0)) == PLUS
380 && (GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == LABEL_REF
381 || GET_CODE (XEXP (XEXP (operands[1], 0), 1)) == LABEL_REF)
382 && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) != PLUS
383 && GET_CODE (XEXP (XEXP (operands[1], 0), 1)) != PLUS)
386 if (GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == LABEL_REF)
387 labelref = XEXP (XEXP (operands[1], 0), 0);
389 labelref = XEXP (XEXP (operands[1], 0), 1);
390 ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, \"LI\",
391 CODE_LABEL_NUMBER (XEXP (labelref, 0)));
393 return \"mov%.w %1,%0\";
396 (define_insn "movstricthi"
397 [(set (strict_low_part (match_operand:HI 0 "general_operand" "+dm"))
398 (match_operand:HI 1 "general_operand" "rmn"))]
402 if (operands[1] == const0_rtx)
403 return \"clr%.w %0\";
404 return \"mov%.w %1,%0\";
408 [(set (match_operand:QI 0 "general_operand" "=d,*a,m,m,?*a")
409 (match_operand:QI 1 "general_operand" "dmi*a,d*a,dmi,?*a,m"))]
414 if (ADDRESS_REG_P (operands[0]) && GET_CODE (operands[1]) == MEM)
416 xoperands[1] = operands[1];
418 = gen_rtx_MEM (QImode, plus_constant (stack_pointer_rtx, 1));
419 xoperands[3] = stack_pointer_rtx;
420 /* Just pushing a byte puts it in the high byte of the halfword. */
421 /* We must put it in the low half, the second byte. */
422 output_asm_insn (\"subq%.w %#2,%3\;mov%.b %1,%2\", xoperands);
423 return \"mov%.w %+,%0\";
425 if (ADDRESS_REG_P (operands[1]) && GET_CODE (operands[0]) == MEM)
427 xoperands[0] = operands[0];
428 xoperands[1] = operands[1];
430 = gen_rtx_MEM (QImode, plus_constant (stack_pointer_rtx, 1));
431 xoperands[3] = stack_pointer_rtx;
432 output_asm_insn (\"mov%.w %1,%-\;mov%.b %2,%0\;addq%.w %#2,%3\", xoperands);
435 if (operands[1] == const0_rtx)
436 return \"clr%.b %0\";
437 if (GET_CODE (operands[1]) == CONST_INT
438 && INTVAL (operands[1]) == -1)
440 if (GET_CODE (operands[1]) != CONST_INT && CONSTANT_P (operands[1]))
441 return \"mov%.l %1,%0\";
442 if (ADDRESS_REG_P (operands[0]) || ADDRESS_REG_P (operands[1]))
443 return \"mov%.w %1,%0\";
444 return \"mov%.b %1,%0\";
447 (define_insn "movstrictqi"
448 [(set (strict_low_part (match_operand:QI 0 "general_operand" "+dm"))
449 (match_operand:QI 1 "general_operand" "dmn"))]
453 if (operands[1] == const0_rtx)
454 return \"clr%.b %0\";
455 return \"mov%.b %1,%0\";
458 ;; Floating-point moves on a CE are faster using an FP register than
459 ;; with movl instructions. (Especially for double floats, but also
460 ;; for single floats, even though it takes an extra instruction.) But
461 ;; on an IP, the FP registers are simulated and so should be avoided.
462 ;; We do this by using define_expand for movsf and movdf, and using
463 ;; different constraints for each target type. The constraints for
464 ;; TARGET_CE allow general registers because they sometimes need to
465 ;; hold floats, but they are not preferable.
467 (define_expand "movsf"
468 [(set (match_operand:SF 0 "general_operand" "")
469 (match_operand:SF 1 "nonimmediate_operand" ""))]
474 [(set (match_operand:SF 0 "general_operand" "=f,m,!*r,!f*m")
475 (match_operand:SF 1 "nonimmediate_operand" "fm,f,f*r*m,*r"))]
479 if (FP_REG_P (operands[0]))
481 if (FP_REG_P (operands[1]))
482 return \"fmove%.s %1,%0\";
483 if (REG_P (operands[1]))
484 return \"mov%.l %1,%-\;fmove%.s %+,%0\";
485 return \"fmove%.s %1,%0\";
487 if (FP_REG_P (operands[1]))
489 if (REG_P (operands[0]))
490 return \"fmove%.s %1,%-\;mov%.l %+,%0\";
491 return \"fmove%.s %1,%0\";
493 return \"mov%.l %1,%0\";
497 [(set (match_operand:SF 0 "general_operand" "=frm")
498 (match_operand:SF 1 "nonimmediate_operand" "frm"))]
502 if (FP_REG_P (operands[0]))
504 if (FP_REG_P (operands[1]))
505 return \"fmove%.s %1,%0\";
506 if (REG_P (operands[1]))
507 return \"mov%.l %1,%-\;fmove%.s %+,%0\";
508 return \"fmove%.s %1,%0\";
510 if (FP_REG_P (operands[1]))
512 if (REG_P (operands[0]))
513 return \"fmove%.s %1,%-\;mov%.l %+,%0\";
514 return \"fmove%.s %1,%0\";
516 return \"mov%.l %1,%0\";
519 (define_expand "movdf"
520 [(set (match_operand:DF 0 "general_operand" "")
521 (match_operand:DF 1 "nonimmediate_operand" ""))]
526 [(set (match_operand:DF 0 "general_operand" "=f,m,!*r,!f*m")
527 (match_operand:DF 1 "nonimmediate_operand" "fm,f,f*r*m,*r"))]
531 if (FP_REG_P (operands[0]))
533 if (FP_REG_P (operands[1]))
534 return \"fmove%.d %1,%0\";
535 if (REG_P (operands[1]))
538 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
539 output_asm_insn (\"mov%.l %1,%-\", xoperands);
540 output_asm_insn (\"mov%.l %1,%-\", operands);
541 return \"fmove%.d %+,%0\";
543 return \"fmove%.d %1,%0\";
545 else if (FP_REG_P (operands[1]))
547 if (REG_P (operands[0]))
549 output_asm_insn (\"fmove%.d %1,%-\;mov%.l %+,%0\", operands);
550 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
551 return \"mov%.l %+,%0\";
553 return \"fmove%.d %1,%0\";
555 return output_move_double (operands);
559 [(set (match_operand:DF 0 "general_operand" "=frm")
560 (match_operand:DF 1 "nonimmediate_operand" "frm"))]
564 if (FP_REG_P (operands[0]))
566 if (FP_REG_P (operands[1]))
567 return \"fmove%.d %1,%0\";
568 if (REG_P (operands[1]))
571 xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
572 output_asm_insn (\"mov%.l %1,%-\", xoperands);
573 output_asm_insn (\"mov%.l %1,%-\", operands);
574 return \"fmove%.d %+,%0\";
576 return \"fmove%.d %1,%0\";
578 else if (FP_REG_P (operands[1]))
580 if (REG_P (operands[0]))
582 output_asm_insn (\"fmove%.d %1,%-\;mov%.l %+,%0\", operands);
583 operands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
584 return \"mov%.l %+,%0\";
586 return \"fmove%.d %1,%0\";
588 return output_move_double (operands);
592 [(set (match_operand:DI 0 "general_operand" "=rm,&r,&ro<>")
593 (match_operand:DI 1 "general_operand" "r,m,roi<>"))]
597 return output_move_double (operands);
601 ;; This goes after the move instructions
602 ;; because the move instructions are better (require no spilling)
603 ;; when they can apply. It goes before the add/sub insns
604 ;; so we will prefer it to them.
606 (define_insn "pushasi"
607 [(set (match_operand:SI 0 "push_operand" "=m")
608 (match_operand:SI 1 "address_operand" "p"))]
612 ;; truncation instructions
613 (define_insn "truncsiqi2"
614 [(set (match_operand:QI 0 "general_operand" "=dm,d")
616 (match_operand:SI 1 "general_operand" "doJ,i")))]
620 if (GET_CODE (operands[0]) == REG)
621 return \"mov%.l %1,%0\";
622 if (GET_CODE (operands[1]) == MEM)
623 operands[1] = adj_offsettable_operand (operands[1], 3);
624 return \"mov%.b %1,%0\";
627 (define_insn "trunchiqi2"
628 [(set (match_operand:QI 0 "general_operand" "=dm,d")
630 (match_operand:HI 1 "general_operand" "doJ,i")))]
634 if (GET_CODE (operands[0]) == REG
635 && (GET_CODE (operands[1]) == MEM
636 || GET_CODE (operands[1]) == CONST_INT))
637 return \"mov%.w %1,%0\";
638 if (GET_CODE (operands[0]) == REG)
639 return \"mov%.l %1,%0\";
640 if (GET_CODE (operands[1]) == MEM)
641 operands[1] = adj_offsettable_operand (operands[1], 1);
642 return \"mov%.b %1,%0\";
645 (define_insn "truncsihi2"
646 [(set (match_operand:HI 0 "general_operand" "=dm,d")
648 (match_operand:SI 1 "general_operand" "roJ,i")))]
652 if (GET_CODE (operands[0]) == REG)
653 return \"mov%.l %1,%0\";
654 if (GET_CODE (operands[1]) == MEM)
655 operands[1] = adj_offsettable_operand (operands[1], 2);
656 return \"mov%.w %1,%0\";
659 ;; zero extension instructions
661 (define_expand "zero_extendhisi2"
662 [(set (match_operand:SI 0 "register_operand" "")
664 (set (strict_low_part (subreg:HI (match_dup 0) 0))
665 (match_operand:HI 1 "general_operand" ""))]
667 "operands[1] = make_safe_from (operands[1], operands[0]);")
669 (define_expand "zero_extendqihi2"
670 [(set (match_operand:HI 0 "register_operand" "")
672 (set (strict_low_part (subreg:QI (match_dup 0) 0))
673 (match_operand:QI 1 "general_operand" ""))]
675 "operands[1] = make_safe_from (operands[1], operands[0]);")
677 (define_expand "zero_extendqisi2"
678 [(set (match_operand:SI 0 "register_operand" "")
680 (set (strict_low_part (subreg:QI (match_dup 0) 0))
681 (match_operand:QI 1 "general_operand" ""))]
683 " operands[1] = make_safe_from (operands[1], operands[0]); ")
685 ;; Patterns to recognize zero-extend insns produced by the combiner.
687 [(set (match_operand:SI 0 "general_operand" "=do<>")
689 (match_operand:HI 1 "nonimmediate_operand" "rm")))]
693 if (DATA_REG_P (operands[0]))
695 if (GET_CODE (operands[1]) == REG
696 && REGNO (operands[0]) == REGNO (operands[1]))
697 return \"and%.l %#0xFFFF,%0\";
698 if (reg_mentioned_p (operands[0], operands[1]))
699 return \"mov%.w %1,%0\;and%.l %#0xFFFF,%0\";
700 return \"clr%.l %0\;mov%.w %1,%0\";
702 else if (GET_CODE (operands[0]) == MEM
703 && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
704 return \"mov%.w %1,%0\;clr%.w %0\";
705 else if (GET_CODE (operands[0]) == MEM
706 && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
707 return \"clr%.w %0\;mov%.w %1,%0\";
710 output_asm_insn (\"clr%.w %0\", operands);
711 operands[0] = adj_offsettable_operand (operands[0], 2);
712 return \"mov%.w %1,%0\";
717 [(set (match_operand:HI 0 "general_operand" "=do<>")
719 (match_operand:QI 1 "nonimmediate_operand" "dm")))]
723 if (DATA_REG_P (operands[0]))
725 if (GET_CODE (operands[1]) == REG
726 && REGNO (operands[0]) == REGNO (operands[1]))
727 return \"and%.w %#0xFF,%0\";
728 if (reg_mentioned_p (operands[0], operands[1]))
729 return \"mov%.b %1,%0\;and%.w %#0xFF,%0\";
730 return \"clr%.w %0\;mov%.b %1,%0\";
732 else if (GET_CODE (operands[0]) == MEM
733 && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
735 if (REGNO (XEXP (XEXP (operands[0], 0), 0))
736 == STACK_POINTER_REGNUM)
737 return \"clr%.w %-\;mov%.b %1,%0\";
739 return \"mov%.b %1,%0\;clr%.b %0\";
741 else if (GET_CODE (operands[0]) == MEM
742 && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
743 return \"clr%.b %0\;mov%.b %1,%0\";
746 output_asm_insn (\"clr%.b %0\", operands);
747 operands[0] = adj_offsettable_operand (operands[0], 1);
748 return \"mov%.b %1,%0\";
753 [(set (match_operand:SI 0 "general_operand" "=do<>")
755 (match_operand:QI 1 "nonimmediate_operand" "dm")))]
759 if (DATA_REG_P (operands[0]))
761 if (GET_CODE (operands[1]) == REG
762 && REGNO (operands[0]) == REGNO (operands[1]))
763 return \"and%.l %#0xFF,%0\";
764 if (reg_mentioned_p (operands[0], operands[1]))
765 return \"mov%.b %1,%0\;and%.l %#0xFF,%0\";
766 return \"clr%.l %0\;mov%.b %1,%0\";
768 else if (GET_CODE (operands[0]) == MEM
769 && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
771 operands[0] = XEXP (XEXP (operands[0], 0), 0);
772 return \"clr%.l %0@-\;mov%.b %1,%0@(3)\";
774 else if (GET_CODE (operands[0]) == MEM
775 && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
777 operands[0] = XEXP (XEXP (operands[0], 0), 0);
778 return \"clr%.l %0@+\;mov%.b %1,%0@(-1)\";
782 output_asm_insn (\"clr%.l %0\", operands);
783 operands[0] = adj_offsettable_operand (operands[0], 3);
784 return \"mov%.b %1,%0\";
788 ;; sign extension instructions
790 (define_insn "extendhisi2"
791 [(set (match_operand:SI 0 "general_operand" "=*d,a")
793 (match_operand:HI 1 "nonimmediate_operand" "0,rmn")))]
799 (define_insn "extendqihi2"
800 [(set (match_operand:HI 0 "general_operand" "=d")
802 (match_operand:QI 1 "nonimmediate_operand" "0")))]
806 (define_insn "extendqisi2"
807 [(set (match_operand:SI 0 "general_operand" "=d")
809 (match_operand:QI 1 "nonimmediate_operand" "0")))]
813 ;; Conversions between float and double.
815 (define_insn "extendsfdf2"
816 [(set (match_operand:DF 0 "general_operand" "=f,m")
818 (match_operand:SF 1 "nonimmediate_operand" "fm,f")))]
822 (define_insn "truncdfsf2"
823 [(set (match_operand:SF 0 "general_operand" "=f,m")
825 (match_operand:DF 1 "nonimmediate_operand" "fm,f")))]
829 ;; Conversion between fixed point and floating point.
830 ;; Note that among the fix-to-float insns
831 ;; the ones that start with SImode come first.
832 ;; That is so that an operand that is a CONST_INT
833 ;; (and therefore lacks a specific machine mode).
834 ;; will be recognized as SImode (which is always valid)
835 ;; rather than as QImode or HImode.
837 (define_insn "floatsisf2"
838 [(set (match_operand:SF 0 "register_operand" "=f")
839 (float:SF (match_operand:SI 1 "nonimmediate_operand" "dm")))]
843 (define_insn "floatsidf2"
844 [(set (match_operand:DF 0 "register_operand" "=f")
845 (float:DF (match_operand:SI 1 "nonimmediate_operand" "dm")))]
849 (define_insn "floathisf2"
850 [(set (match_operand:SF 0 "register_operand" "=f")
851 (float:SF (match_operand:HI 1 "nonimmediate_operand" "dm")))]
855 (define_insn "floathidf2"
856 [(set (match_operand:DF 0 "register_operand" "=f")
857 (float:DF (match_operand:HI 1 "nonimmediate_operand" "dm")))]
861 (define_insn "floatqisf2"
862 [(set (match_operand:SF 0 "register_operand" "=f")
863 (float:SF (match_operand:QI 1 "nonimmediate_operand" "dm")))]
867 (define_insn "floatqidf2"
868 [(set (match_operand:DF 0 "register_operand" "=f")
869 (float:DF (match_operand:QI 1 "nonimmediate_operand" "dm")))]
873 ;; Float-to-fix conversion insns.
875 (define_insn "fix_truncsfqi2"
876 [(set (match_operand:QI 0 "general_operand" "=dm")
877 (fix:QI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
881 (define_insn "fix_truncsfhi2"
882 [(set (match_operand:HI 0 "general_operand" "=dm")
883 (fix:HI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
887 (define_insn "fix_truncsfsi2"
888 [(set (match_operand:SI 0 "general_operand" "=dm")
889 (fix:SI (fix:SF (match_operand:SF 1 "register_operand" "f"))))]
893 (define_insn "fix_truncdfqi2"
894 [(set (match_operand:QI 0 "general_operand" "=dm")
895 (fix:QI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
899 (define_insn "fix_truncdfhi2"
900 [(set (match_operand:HI 0 "general_operand" "=dm")
901 (fix:HI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
905 (define_insn "fix_truncdfsi2"
906 [(set (match_operand:SI 0 "general_operand" "=dm")
907 (fix:SI (fix:DF (match_operand:DF 1 "register_operand" "f"))))]
913 (define_insn "addsi3"
914 [(set (match_operand:SI 0 "general_operand" "=m,r,!a,!a")
915 (plus:SI (match_operand:SI 1 "general_operand" "%0,0,a,rJK")
916 (match_operand:SI 2 "general_operand" "dIKLs,mrIKLs,rJK,a")))]
920 if (! operands_match_p (operands[0], operands[1]))
922 if (!ADDRESS_REG_P (operands[1]))
924 rtx tmp = operands[1];
926 operands[1] = operands[2];
930 /* These insns can result from reloads to access
931 stack slots over 64k from the frame pointer. */
932 if (GET_CODE (operands[2]) == CONST_INT
933 && INTVAL (operands[2]) + 0x8000 >= (unsigned) 0x10000)
934 return \"mov%.l %2,%0\;add%.l %1,%0\";
935 if (GET_CODE (operands[2]) == REG)
936 return \"lea %1@[%2:L:B],%0\";
938 return \"lea %1@(%c2),%0\";
940 if (GET_CODE (operands[2]) == CONST_INT)
942 if (INTVAL (operands[2]) > 0
943 && INTVAL (operands[2]) <= 8)
944 return (ADDRESS_REG_P (operands[0])
946 : \"addq%.l %2,%0\");
947 if (INTVAL (operands[2]) < 0
948 && INTVAL (operands[2]) >= -8)
950 operands[2] = GEN_INT (- INTVAL (operands[2]));
951 return (ADDRESS_REG_P (operands[0])
953 : \"subq%.l %2,%0\");
955 if (ADDRESS_REG_P (operands[0])
956 && INTVAL (operands[2]) >= -0x8000
957 && INTVAL (operands[2]) < 0x8000)
958 return \"add%.w %2,%0\";
960 return \"add%.l %2,%0\";
964 [(set (match_operand:SI 0 "general_operand" "=a")
965 (plus:SI (match_operand:SI 1 "general_operand" "0")
966 (sign_extend:SI (match_operand:HI 2 "nonimmediate_operand" "rmn"))))]
970 (define_insn "addhi3"
971 [(set (match_operand:HI 0 "general_operand" "=mr,mr,m,r")
972 (plus:HI (match_operand:HI 1 "general_operand" "%0,0,0,0")
973 (match_operand:HI 2 "general_operand" "I,L,dn,rmn")))]
982 [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
983 (plus:HI (match_dup 0)
984 (match_operand:HI 1 "general_operand" "dn,rmn")))]
988 (define_insn "addqi3"
989 [(set (match_operand:QI 0 "general_operand" "=md,mr,m,d")
990 (plus:QI (match_operand:QI 1 "general_operand" "%0,0,0,0")
991 (match_operand:QI 2 "general_operand" "I,L,dn,dmn")))]
1000 [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
1001 (plus:QI (match_dup 0)
1002 (match_operand:QI 1 "general_operand" "dn,dmn")))]
1006 (define_insn "adddf3"
1007 [(set (match_operand:DF 0 "register_operand" "=f")
1008 (plus:DF (match_operand:DF 1 "nonimmediate_operand" "%f")
1009 (match_operand:DF 2 "nonimmediate_operand" "fm")))]
1013 (define_insn "addsf3"
1014 [(set (match_operand:SF 0 "register_operand" "=f")
1015 (plus:SF (match_operand:SF 1 "nonimmediate_operand" "%f")
1016 (match_operand:SF 2 "nonimmediate_operand" "fm")))]
1020 ;; subtract instructions
1022 (define_insn "subsi3"
1023 [(set (match_operand:SI 0 "general_operand" "=m,r,!a,?d")
1024 (minus:SI (match_operand:SI 1 "general_operand" "0,0,a,mrIKs")
1025 (match_operand:SI 2 "general_operand" "dIKs,mrIKs,J,0")))]
1029 if (! operands_match_p (operands[0], operands[1]))
1031 if (operands_match_p (operands[0], operands[2]))
1033 if (GET_CODE (operands[1]) == CONST_INT)
1035 if (INTVAL (operands[1]) > 0
1036 && INTVAL (operands[1]) <= 8)
1037 return \"subq%.l %1,%0\;neg%.l %0\";
1039 return \"sub%.l %1,%0\;neg%.l %0\";
1041 /* This case is matched by J, but negating -0x8000
1042 in an lea would give an invalid displacement.
1043 So do this specially. */
1044 if (INTVAL (operands[2]) == -0x8000)
1045 return \"mov%.l %1,%0\;sub%.l %2,%0\";
1046 return \"lea %1@(%n2),%0\";
1048 if (GET_CODE (operands[2]) == CONST_INT)
1050 if (INTVAL (operands[2]) > 0
1051 && INTVAL (operands[2]) <= 8)
1052 return \"subq%.l %2,%0\";
1053 if (ADDRESS_REG_P (operands[0])
1054 && INTVAL (operands[2]) >= -0x8000
1055 && INTVAL (operands[2]) < 0x8000)
1056 return \"sub%.w %2,%0\";
1058 return \"sub%.l %2,%0\";
1062 [(set (match_operand:SI 0 "general_operand" "=a")
1063 (minus:SI (match_operand:SI 1 "general_operand" "0")
1064 (sign_extend:SI (match_operand:HI 2 "nonimmediate_operand" "rmn"))))]
1068 (define_insn "subhi3"
1069 [(set (match_operand:HI 0 "general_operand" "=m,r")
1070 (minus:HI (match_operand:HI 1 "general_operand" "0,0")
1071 (match_operand:HI 2 "general_operand" "dn,rmn")))]
1076 [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
1077 (minus:HI (match_dup 0)
1078 (match_operand:HI 1 "general_operand" "dn,rmn")))]
1082 (define_insn "subqi3"
1083 [(set (match_operand:QI 0 "general_operand" "=m,d")
1084 (minus:QI (match_operand:QI 1 "general_operand" "0,0")
1085 (match_operand:QI 2 "general_operand" "dn,dmn")))]
1090 [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
1091 (minus:QI (match_dup 0)
1092 (match_operand:QI 1 "general_operand" "dn,dmn")))]
1096 (define_insn "subdf3"
1097 [(set (match_operand:DF 0 "register_operand" "=f,f,f")
1098 (minus:DF (match_operand:DF 1 "nonimmediate_operand" "f,f,m")
1099 (match_operand:DF 2 "nonimmediate_operand" "f,m,f")))]
1106 (define_insn "subsf3"
1107 [(set (match_operand:SF 0 "register_operand" "=f,f,f")
1108 (minus:SF (match_operand:SF 1 "nonimmediate_operand" "f,f,m")
1109 (match_operand:SF 2 "nonimmediate_operand" "f,m,f")))]
1116 ;; multiply instructions
1118 (define_insn "mulhi3"
1119 [(set (match_operand:HI 0 "general_operand" "=d")
1120 (mult:HI (match_operand:HI 1 "general_operand" "%0")
1121 (match_operand:HI 2 "general_operand" "dmn")))]
1125 (define_insn "mulhisi3"
1126 [(set (match_operand:SI 0 "general_operand" "=d")
1127 (mult:SI (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "%0"))
1128 (sign_extend:SI (match_operand:HI 2 "nonimmediate_operand" "dm"))))]
1133 [(set (match_operand:SI 0 "general_operand" "=d")
1134 (mult:SI (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "%0"))
1135 (match_operand:SI 2 "const_int_operand" "n")))]
1139 (define_insn "mulsi3"
1140 [(set (match_operand:SI 0 "general_operand" "=d")
1141 (mult:SI (match_operand:SI 1 "general_operand" "%0")
1142 (match_operand:SI 2 "general_operand" "dmsK")))]
1146 (define_insn "umulhisi3"
1147 [(set (match_operand:SI 0 "general_operand" "=d")
1148 (mult:SI (zero_extend:SI
1149 (match_operand:HI 1 "nonimmediate_operand" "%0"))
1151 (match_operand:HI 2 "nonimmediate_operand" "dm"))))]
1156 [(set (match_operand:SI 0 "general_operand" "=d")
1157 (mult:SI (zero_extend:SI
1158 (match_operand:HI 1 "nonimmediate_operand" "%0"))
1159 (match_operand:SI 2 "const_int_operand" "n")))]
1163 (define_insn "muldf3"
1164 [(set (match_operand:DF 0 "register_operand" "=f")
1165 (mult:DF (match_operand:DF 1 "nonimmediate_operand" "%f")
1166 (match_operand:DF 2 "nonimmediate_operand" "fm")))]
1170 (define_insn "mulsf3"
1171 [(set (match_operand:SF 0 "register_operand" "=f")
1172 (mult:SF (match_operand:SF 1 "nonimmediate_operand" "%f")
1173 (match_operand:SF 2 "nonimmediate_operand" "fm")))]
1177 ;; divide instructions
1179 (define_insn "divhi3"
1180 [(set (match_operand:HI 0 "general_operand" "=d")
1181 (div:HI (match_operand:HI 1 "general_operand" "0")
1182 (match_operand:HI 2 "general_operand" "dmn")))]
1184 "extl %0\;divs %2,%0")
1186 (define_insn "divhisi3"
1187 [(set (match_operand:HI 0 "general_operand" "=d")
1190 (match_operand:SI 1 "general_operand" "0")
1191 (sign_extend:SI (match_operand:HI 2 "nonimmediate_operand" "dm")))))]
1196 [(set (match_operand:HI 0 "general_operand" "=d")
1197 (truncate:HI (div:SI (match_operand:SI 1 "general_operand" "0")
1198 (match_operand:SI 2 "const_int_operand" "n"))))]
1202 (define_insn "divsi3"
1203 [(set (match_operand:SI 0 "general_operand" "=d")
1204 (div:SI (match_operand:SI 1 "general_operand" "0")
1205 (match_operand:SI 2 "general_operand" "dmsK")))]
1209 (define_insn "udivhi3"
1210 [(set (match_operand:HI 0 "general_operand" "=d")
1211 (udiv:HI (match_operand:HI 1 "general_operand" "0")
1212 (match_operand:HI 2 "general_operand" "dmn")))]
1214 "and%.l %#0xFFFF,%0\;divu %2,%0")
1216 (define_insn "udivhisi3"
1217 [(set (match_operand:HI 0 "general_operand" "=d")
1220 (match_operand:SI 1 "general_operand" "0")
1221 (zero_extend:SI (match_operand:HI 2 "nonimmediate_operand" "dm")))))]
1226 [(set (match_operand:HI 0 "general_operand" "=d")
1227 (truncate:HI (udiv:SI (match_operand:SI 1 "nonimmediate_operand" "0")
1228 (match_operand:HI 2 "const_int_operand" "n"))))]
1232 (define_insn "udivsi3"
1233 [(set (match_operand:SI 0 "general_operand" "=d")
1234 (udiv:SI (match_operand:SI 1 "general_operand" "0")
1235 (match_operand:SI 2 "general_operand" "dmsK")))]
1239 (define_insn "divdf3"
1240 [(set (match_operand:DF 0 "register_operand" "=f,f,f")
1241 (div:DF (match_operand:DF 1 "nonimmediate_operand" "f,f,m")
1242 (match_operand:DF 2 "nonimmediate_operand" "f,m,f")))]
1249 (define_insn "divsf3"
1250 [(set (match_operand:SF 0 "register_operand" "=f,f,f")
1251 (div:SF (match_operand:SF 1 "nonimmediate_operand" "f,f,m")
1252 (match_operand:SF 2 "nonimmediate_operand" "f,m,f")))]
1259 ;; Remainder instructions.
1261 (define_insn "modhi3"
1262 [(set (match_operand:HI 0 "general_operand" "=d")
1263 (mod:HI (match_operand:HI 1 "general_operand" "0")
1264 (match_operand:HI 2 "general_operand" "dmn")))]
1266 "extl %0\;divs %2,%0\;swap %0")
1268 (define_insn "modhisi3"
1269 [(set (match_operand:HI 0 "general_operand" "=d")
1272 (match_operand:SI 1 "general_operand" "0")
1273 (sign_extend:SI (match_operand:HI 2 "nonimmediate_operand" "dm")))))]
1275 "divs %2,%0\;swap %0")
1278 [(set (match_operand:HI 0 "general_operand" "=d")
1279 (truncate:HI (mod:SI (match_operand:SI 1 "general_operand" "0")
1280 (match_operand:SI 2 "const_int_operand" "n"))))]
1282 "divs %2,%0\;swap %0")
1284 (define_insn "umodhi3"
1285 [(set (match_operand:HI 0 "general_operand" "=d")
1286 (umod:HI (match_operand:HI 1 "general_operand" "0")
1287 (match_operand:HI 2 "general_operand" "dmn")))]
1289 "and%.l %#0xFFFF,%0\;divu %2,%0\;swap %0")
1291 (define_insn "umodhisi3"
1292 [(set (match_operand:HI 0 "general_operand" "=d")
1295 (match_operand:SI 1 "general_operand" "0")
1296 (zero_extend:SI (match_operand:HI 2 "nonimmediate_operand" "dm")))))]
1298 "divu %2,%0\;swap %0")
1301 [(set (match_operand:HI 0 "general_operand" "=d")
1302 (truncate:HI (umod:SI (match_operand:SI 1 "general_operand" "0")
1303 (match_operand:SI 2 "const_int_operand" "n"))))]
1305 "divu %2,%0\;swap %0")
1307 (define_insn "divmodsi4"
1308 [(set (match_operand:SI 0 "general_operand" "=d")
1309 (div:SI (match_operand:SI 1 "general_operand" "0")
1310 (match_operand:SI 2 "general_operand" "dmsK")))
1311 (set (match_operand:SI 3 "general_operand" "=d")
1312 (mod:SI (match_dup 1) (match_dup 2)))]
1316 (define_insn "udivmodsi4"
1317 [(set (match_operand:SI 0 "general_operand" "=d")
1318 (udiv:SI (match_operand:SI 1 "general_operand" "0")
1319 (match_operand:SI 2 "general_operand" "dmsK")))
1320 (set (match_operand:SI 3 "general_operand" "=d")
1321 (umod:SI (match_dup 1) (match_dup 2)))]
1325 ;; logical-and instructions
1327 (define_insn "andsi3"
1328 [(set (match_operand:SI 0 "general_operand" "=m,d")
1329 (and:SI (match_operand:SI 1 "general_operand" "%0,0")
1330 (match_operand:SI 2 "general_operand" "dKs,dmKs")))]
1334 if (GET_CODE (operands[2]) == CONST_INT
1335 && (INTVAL (operands[2]) | 0xffff) == 0xffffffff
1336 && (DATA_REG_P (operands[0])
1337 || offsettable_memref_p (operands[0])))
1339 if (GET_CODE (operands[0]) != REG)
1340 operands[0] = adj_offsettable_operand (operands[0], 2);
1341 operands[2] = GEN_INT (INTVAL (operands[2]) & 0xffff);
1342 /* Do not delete a following tstl %0 insn; that would be incorrect. */
1344 if (operands[2] == const0_rtx)
1345 return \"clr%.w %0\";
1346 return \"and%.w %2,%0\";
1348 return \"and%.l %2,%0\";
1351 (define_insn "andhi3"
1352 [(set (match_operand:HI 0 "general_operand" "=m,d")
1353 (and:HI (match_operand:HI 1 "general_operand" "%0,0")
1354 (match_operand:HI 2 "general_operand" "dn,dmn")))]
1358 (define_insn "andqi3"
1359 [(set (match_operand:QI 0 "general_operand" "=m,d")
1360 (and:QI (match_operand:QI 1 "general_operand" "%0,0")
1361 (match_operand:QI 2 "general_operand" "dn,dmn")))]
1366 ;; inclusive-or instructions
1368 (define_insn "iorsi3"
1369 [(set (match_operand:SI 0 "general_operand" "=m,d")
1370 (ior:SI (match_operand:SI 1 "general_operand" "%0,0")
1371 (match_operand:SI 2 "general_operand" "dKs,dmKs")))]
1375 register int logval;
1376 if (GET_CODE (operands[2]) == CONST_INT
1377 && INTVAL (operands[2]) >> 16 == 0
1378 && (DATA_REG_P (operands[0])
1379 || offsettable_memref_p (operands[0])))
1381 if (GET_CODE (operands[0]) != REG)
1382 operands[0] = adj_offsettable_operand (operands[0], 2);
1383 /* Do not delete a following tstl %0 insn; that would be incorrect. */
1385 return \"or%.w %2,%0\";
1387 if (GET_CODE (operands[2]) == CONST_INT
1388 && (logval = exact_log2 (INTVAL (operands[2]))) >= 0
1389 && (DATA_REG_P (operands[0])
1390 || offsettable_memref_p (operands[0])))
1392 if (DATA_REG_P (operands[0]))
1393 operands[1] = GEN_INT (logval);
1397 = adj_offsettable_operand (operands[0], 3 - (logval / 8));
1398 operands[1] = GEN_INT (logval % 8);
1400 return \"bset %1,%0\";
1402 return \"or%.l %2,%0\";
1405 (define_insn "iorhi3"
1406 [(set (match_operand:HI 0 "general_operand" "=m,d")
1407 (ior:HI (match_operand:HI 1 "general_operand" "%0,0")
1408 (match_operand:HI 2 "general_operand" "dn,dmn")))]
1412 (define_insn "iorqi3"
1413 [(set (match_operand:QI 0 "general_operand" "=m,d")
1414 (ior:QI (match_operand:QI 1 "general_operand" "%0,0")
1415 (match_operand:QI 2 "general_operand" "dn,dmn")))]
1421 (define_insn "xorsi3"
1422 [(set (match_operand:SI 0 "general_operand" "=do,m")
1423 (xor:SI (match_operand:SI 1 "general_operand" "%0,0")
1424 (match_operand:SI 2 "general_operand" "di,dKs")))]
1428 if (GET_CODE (operands[2]) == CONST_INT
1429 && INTVAL (operands[2]) >> 16 == 0
1430 && (offsettable_memref_p (operands[0]) || DATA_REG_P (operands[0])))
1432 if (! DATA_REG_P (operands[0]))
1433 operands[0] = adj_offsettable_operand (operands[0], 2);
1434 /* Do not delete a following tstl %0 insn; that would be incorrect. */
1436 return \"eor%.w %2,%0\";
1438 return \"eor%.l %2,%0\";
1441 (define_insn "xorhi3"
1442 [(set (match_operand:HI 0 "general_operand" "=dm")
1443 (xor:HI (match_operand:HI 1 "general_operand" "%0")
1444 (match_operand:HI 2 "general_operand" "dn")))]
1448 (define_insn "xorqi3"
1449 [(set (match_operand:QI 0 "general_operand" "=dm")
1450 (xor:QI (match_operand:QI 1 "general_operand" "%0")
1451 (match_operand:QI 2 "general_operand" "dn")))]
1455 ;; negation instructions
1457 (define_insn "negsi2"
1458 [(set (match_operand:SI 0 "general_operand" "=dm")
1459 (neg:SI (match_operand:SI 1 "general_operand" "0")))]
1463 (define_insn "neghi2"
1464 [(set (match_operand:HI 0 "general_operand" "=dm")
1465 (neg:HI (match_operand:HI 1 "general_operand" "0")))]
1469 (define_insn "negqi2"
1470 [(set (match_operand:QI 0 "general_operand" "=dm")
1471 (neg:QI (match_operand:QI 1 "general_operand" "0")))]
1475 (define_insn "negsf2"
1476 [(set (match_operand:SF 0 "register_operand" "=f")
1477 (neg:SF (match_operand:SF 1 "nonimmediate_operand" "fm")))]
1481 (define_insn "negdf2"
1482 [(set (match_operand:DF 0 "register_operand" "=f")
1483 (neg:DF (match_operand:DF 1 "nonimmediate_operand" "fm")))]
1487 ;; Absolute value instructions
1489 (define_insn "abssf2"
1490 [(set (match_operand:SF 0 "register_operand" "=f")
1491 (abs:SF (match_operand:SF 1 "nonimmediate_operand" "fm")))]
1495 (define_insn "absdf2"
1496 [(set (match_operand:DF 0 "register_operand" "=f")
1497 (abs:DF (match_operand:DF 1 "nonimmediate_operand" "fm")))]
1501 ;; Square root instructions
1503 (define_insn "sqrtsf2"
1504 [(set (match_operand:SF 0 "register_operand" "=f")
1505 (sqrt:SF (match_operand:SF 1 "nonimmediate_operand" "fm")))]
1509 (define_insn "sqrtdf2"
1510 [(set (match_operand:DF 0 "register_operand" "=f")
1511 (sqrt:DF (match_operand:DF 1 "nonimmediate_operand" "fm")))]
1515 ;; one complement instructions
1517 (define_insn "one_cmplsi2"
1518 [(set (match_operand:SI 0 "general_operand" "=dm")
1519 (not:SI (match_operand:SI 1 "general_operand" "0")))]
1523 (define_insn "one_cmplhi2"
1524 [(set (match_operand:HI 0 "general_operand" "=dm")
1525 (not:HI (match_operand:HI 1 "general_operand" "0")))]
1529 (define_insn "one_cmplqi2"
1530 [(set (match_operand:QI 0 "general_operand" "=dm")
1531 (not:QI (match_operand:QI 1 "general_operand" "0")))]
1536 ;; arithmetic shift instructions
1537 ;; We don't need the shift memory by 1 bit instruction
1539 (define_insn "ashlsi3"
1540 [(set (match_operand:SI 0 "general_operand" "=d")
1541 (ashift:SI (match_operand:SI 1 "general_operand" "0")
1542 (match_operand:SI 2 "general_operand" "dI")))]
1546 (define_insn "ashlhi3"
1547 [(set (match_operand:HI 0 "general_operand" "=d")
1548 (ashift:HI (match_operand:HI 1 "general_operand" "0")
1549 (match_operand:HI 2 "general_operand" "dI")))]
1553 (define_insn "ashlqi3"
1554 [(set (match_operand:QI 0 "general_operand" "=d")
1555 (ashift:QI (match_operand:QI 1 "general_operand" "0")
1556 (match_operand:QI 2 "general_operand" "dI")))]
1560 (define_insn "ashrsi3"
1561 [(set (match_operand:SI 0 "general_operand" "=d")
1562 (ashiftrt:SI (match_operand:SI 1 "general_operand" "0")
1563 (match_operand:SI 2 "general_operand" "dI")))]
1567 (define_insn "ashrhi3"
1568 [(set (match_operand:HI 0 "general_operand" "=d")
1569 (ashiftrt:HI (match_operand:HI 1 "general_operand" "0")
1570 (match_operand:HI 2 "general_operand" "dI")))]
1574 (define_insn "ashrqi3"
1575 [(set (match_operand:QI 0 "general_operand" "=d")
1576 (ashiftrt:QI (match_operand:QI 1 "general_operand" "0")
1577 (match_operand:QI 2 "general_operand" "dI")))]
1581 ;; logical shift instructions
1583 (define_insn "lshrsi3"
1584 [(set (match_operand:SI 0 "general_operand" "=d")
1585 (lshiftrt:SI (match_operand:SI 1 "general_operand" "0")
1586 (match_operand:SI 2 "general_operand" "dI")))]
1590 (define_insn "lshrhi3"
1591 [(set (match_operand:HI 0 "general_operand" "=d")
1592 (lshiftrt:HI (match_operand:HI 1 "general_operand" "0")
1593 (match_operand:HI 2 "general_operand" "dI")))]
1597 (define_insn "lshrqi3"
1598 [(set (match_operand:QI 0 "general_operand" "=d")
1599 (lshiftrt:QI (match_operand:QI 1 "general_operand" "0")
1600 (match_operand:QI 2 "general_operand" "dI")))]
1604 ;; rotate instructions
1606 (define_insn "rotlsi3"
1607 [(set (match_operand:SI 0 "general_operand" "=d")
1608 (rotate:SI (match_operand:SI 1 "general_operand" "0")
1609 (match_operand:SI 2 "general_operand" "dI")))]
1613 (define_insn "rotlhi3"
1614 [(set (match_operand:HI 0 "general_operand" "=d")
1615 (rotate:HI (match_operand:HI 1 "general_operand" "0")
1616 (match_operand:HI 2 "general_operand" "dI")))]
1620 (define_insn "rotlqi3"
1621 [(set (match_operand:QI 0 "general_operand" "=d")
1622 (rotate:QI (match_operand:QI 1 "general_operand" "0")
1623 (match_operand:QI 2 "general_operand" "dI")))]
1627 (define_insn "rotrsi3"
1628 [(set (match_operand:SI 0 "general_operand" "=d")
1629 (rotatert:SI (match_operand:SI 1 "general_operand" "0")
1630 (match_operand:SI 2 "general_operand" "dI")))]
1634 (define_insn "rotrhi3"
1635 [(set (match_operand:HI 0 "general_operand" "=d")
1636 (rotatert:HI (match_operand:HI 1 "general_operand" "0")
1637 (match_operand:HI 2 "general_operand" "dI")))]
1641 (define_insn "rotrqi3"
1642 [(set (match_operand:QI 0 "general_operand" "=d")
1643 (rotatert:QI (match_operand:QI 1 "general_operand" "0")
1644 (match_operand:QI 2 "general_operand" "dI")))]
1648 ;; Special cases of bit-field insns which we should
1649 ;; recognize in preference to the general case.
1650 ;; These handle aligned 8-bit and 16-bit fields,
1651 ;; which can usually be done with move instructions.
1654 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+do")
1655 (match_operand:SI 1 "const_int_operand" "i")
1656 (match_operand:SI 2 "const_int_operand" "i"))
1657 (match_operand:SI 3 "general_operand" "d"))]
1658 "TARGET_68020 && TARGET_BITFIELD
1659 && (INTVAL (operands[1]) == 8 || INTVAL (operands[1]) == 16)
1660 && INTVAL (operands[2]) % INTVAL (operands[1]) == 0
1661 && (GET_CODE (operands[0]) == REG
1662 || ! mode_dependent_address_p (XEXP (operands[0], 0)))"
1665 if (REG_P (operands[0]))
1667 if (INTVAL (operands[1]) + INTVAL (operands[2]) != 32)
1668 return \"bfins %3,[%c2,%c1]%0\";
1672 = adj_offsettable_operand (operands[0], INTVAL (operands[2]) / 8);
1674 if (GET_CODE (operands[3]) == MEM)
1675 operands[3] = adj_offsettable_operand (operands[3],
1676 (32 - INTVAL (operands[1])) / 8);
1677 if (INTVAL (operands[1]) == 8)
1678 return \"mov%.b %3,%0\";
1679 return \"mov%.w %3,%0\";
1683 [(set (match_operand:SI 0 "general_operand" "=&d")
1684 (zero_extract:SI (match_operand:SI 1 "register_operand" "do")
1685 (match_operand:SI 2 "const_int_operand" "i")
1686 (match_operand:SI 3 "const_int_operand" "i")))]
1687 "TARGET_68020 && TARGET_BITFIELD
1688 && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
1689 && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
1690 && (GET_CODE (operands[1]) == REG
1691 || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
1694 if (REG_P (operands[1]))
1696 if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
1697 return \"bfextu [%c3,%c2]%1,%0\";
1701 = adj_offsettable_operand (operands[1], INTVAL (operands[3]) / 8);
1703 output_asm_insn (\"clrl %0\", operands);
1704 if (GET_CODE (operands[0]) == MEM)
1705 operands[0] = adj_offsettable_operand (operands[0],
1706 (32 - INTVAL (operands[1])) / 8);
1707 if (INTVAL (operands[2]) == 8)
1708 return \"mov%.b %1,%0\";
1709 return \"mov%.w %1,%0\";
1713 [(set (match_operand:SI 0 "general_operand" "=d")
1714 (sign_extract:SI (match_operand:SI 1 "register_operand" "do")
1715 (match_operand:SI 2 "const_int_operand" "i")
1716 (match_operand:SI 3 "const_int_operand" "i")))]
1717 "TARGET_68020 && TARGET_BITFIELD
1718 && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
1719 && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
1720 && (GET_CODE (operands[1]) == REG
1721 || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
1724 if (REG_P (operands[1]))
1726 if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
1727 return \"bfexts [%c3,%c2]%1,%0\";
1731 = adj_offsettable_operand (operands[1], INTVAL (operands[3]) / 8);
1733 if (INTVAL (operands[2]) == 8)
1734 return \"mov%.b %1,%0\;extb%.l %0\";
1735 return \"mov%.w %1,%0\;ext%.l %0\";
1738 ;; Bit field instructions, general cases.
1739 ;; "o,d" constraint causes a nonoffsettable memref to match the "o"
1740 ;; so that its address is reloaded.
1742 (define_expand "extv"
1743 [(set (match_operand:SI 0 "general_operand" "")
1744 (sign_extract:SI (match_operand:SI 1 "general_operand" "")
1745 (match_operand:SI 2 "general_operand" "")
1746 (match_operand:SI 3 "general_operand" "")))]
1747 "TARGET_68020 && TARGET_BITFIELD"
1751 [(set (match_operand:SI 0 "general_operand" "=d")
1752 (sign_extract:SI (match_operand:QI 1 "memory_operand" "o")
1753 (match_operand:SI 2 "general_operand" "di")
1754 (match_operand:SI 3 "general_operand" "di")))]
1755 "TARGET_68020 && TARGET_BITFIELD"
1756 "bfexts [%c3,%c2]%1,%0")
1758 (define_expand "extzv"
1759 [(set (match_operand:SI 0 "general_operand" "")
1760 (zero_extract:SI (match_operand:SI 1 "general_operand" "")
1761 (match_operand:SI 2 "general_operand" "")
1762 (match_operand:SI 3 "general_operand" "")))]
1763 "TARGET_68020 && TARGET_BITFIELD"
1767 [(set (match_operand:SI 0 "general_operand" "=d")
1768 (zero_extract:SI (match_operand:QI 1 "memory_operand" "o")
1769 (match_operand:SI 2 "general_operand" "di")
1770 (match_operand:SI 3 "general_operand" "di")))]
1771 "TARGET_68020 && TARGET_BITFIELD"
1772 "bfextu [%c3,%c2]%1,%0")
1775 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
1776 (match_operand:SI 1 "general_operand" "di")
1777 (match_operand:SI 2 "general_operand" "di"))
1778 (xor:SI (zero_extract:SI (match_dup 0) (match_dup 1) (match_dup 2))
1779 (match_operand:SI 3 "const_int_operand" "i,i")))]
1780 "TARGET_68020 && TARGET_BITFIELD
1781 && (INTVAL (operands[3]) == -1
1782 || (GET_CODE (operands[1]) == CONST_INT
1783 && (~ INTVAL (operands[3]) & ((1 << INTVAL (operands[1]))- 1)) == 0))"
1787 return \"bfchg [%c2,%c1]%0\";
1791 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
1792 (match_operand:SI 1 "general_operand" "di")
1793 (match_operand:SI 2 "general_operand" "di"))
1795 "TARGET_68020 && TARGET_BITFIELD"
1799 return \"bfclr [%c2,%c1]%0\";
1803 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
1804 (match_operand:SI 1 "general_operand" "di")
1805 (match_operand:SI 2 "general_operand" "di"))
1807 "TARGET_68020 && TARGET_BITFIELD"
1811 return \"bfset [%c2,%c1]%0\";
1814 (define_expand "insv"
1815 [(set (zero_extract:SI (match_operand:SI 0 "general_operand" "")
1816 (match_operand:SI 1 "general_operand" "")
1817 (match_operand:SI 2 "general_operand" ""))
1818 (match_operand:SI 3 "general_operand" ""))]
1819 "TARGET_68020 && TARGET_BITFIELD"
1823 [(set (zero_extract:SI (match_operand:QI 0 "memory_operand" "+o")
1824 (match_operand:SI 1 "general_operand" "di")
1825 (match_operand:SI 2 "general_operand" "di"))
1826 (match_operand:SI 3 "general_operand" "d"))]
1827 "TARGET_68020 && TARGET_BITFIELD"
1828 "bfins %3,[%c2,%c1]%0")
1830 ;; Now recognize bit field insns that operate on registers
1831 ;; (or at least were intended to do so).
1834 [(set (match_operand:SI 0 "general_operand" "=d")
1835 (sign_extract:SI (match_operand:SI 1 "register_operand" "d")
1836 (match_operand:SI 2 "general_operand" "di")
1837 (match_operand:SI 3 "general_operand" "di")))]
1838 "TARGET_68020 && TARGET_BITFIELD"
1839 "bfexts [%c3,%c2]%1,%0")
1842 [(set (match_operand:SI 0 "general_operand" "=d")
1843 (zero_extract:SI (match_operand:SI 1 "register_operand" "d")
1844 (match_operand:SI 2 "general_operand" "di")
1845 (match_operand:SI 3 "general_operand" "di")))]
1846 "TARGET_68020 && TARGET_BITFIELD"
1847 "bfextu [%c3,%c2]%1,%0")
1850 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
1851 (match_operand:SI 1 "general_operand" "di")
1852 (match_operand:SI 2 "general_operand" "di"))
1854 "TARGET_68020 && TARGET_BITFIELD"
1858 return \"bfclr [%c2,%c1]%0\";
1862 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
1863 (match_operand:SI 1 "general_operand" "di")
1864 (match_operand:SI 2 "general_operand" "di"))
1866 "TARGET_68020 && TARGET_BITFIELD"
1870 return \"bfset [%c2,%c1]%0\";
1874 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+d")
1875 (match_operand:SI 1 "general_operand" "di")
1876 (match_operand:SI 2 "general_operand" "di"))
1877 (match_operand:SI 3 "general_operand" "d"))]
1878 "TARGET_68020 && TARGET_BITFIELD"
1881 return \"bfins %3,[%c2,%c1]%0\";
1884 ;; Special patterns for optimizing bit-field instructions.
1888 (zero_extract:SI (match_operand:QI 0 "memory_operand" "o")
1889 (match_operand:SI 1 "const_int_operand" "i")
1890 (match_operand:SI 2 "general_operand" "di")))]
1891 "TARGET_68020 && TARGET_BITFIELD"
1894 if (operands[1] == const1_rtx
1895 && GET_CODE (operands[2]) == CONST_INT)
1897 int width = GET_CODE (operands[0]) == REG ? 31 : 7;
1898 return output_btst (operands, GEN_INT (width - INTVAL (operands[2])),
1899 operands[0], insn, 1000);
1900 /* Pass 1000 as SIGNPOS argument so that btst will
1901 not think we are testing the sign bit for an `and'
1902 and assume that nonzero implies a negative result. */
1904 if (INTVAL (operands[1]) != 32)
1905 cc_status.flags = CC_NOT_NEGATIVE;
1906 return \"bftst [%c2,%c1]%0\";
1909 ;;; now handle the register cases
1912 (zero_extract:SI (match_operand:SI 0 "register_operand" "d")
1913 (match_operand:SI 1 "const_int_operand" "i")
1914 (match_operand:SI 2 "general_operand" "di")))]
1915 "TARGET_68020 && TARGET_BITFIELD"
1918 if (operands[1] == const1_rtx
1919 && GET_CODE (operands[2]) == CONST_INT)
1921 int width = GET_CODE (operands[0]) == REG ? 31 : 7;
1922 return output_btst (operands, GEN_INT (width - INTVAL (operands[2])),
1923 operands[0], insn, 1000);
1924 /* Pass 1000 as SIGNPOS argument so that btst will
1925 not think we are testing the sign bit for an `and'
1926 and assume that nonzero implies a negative result. */
1928 if (INTVAL (operands[1]) != 32)
1929 cc_status.flags = CC_NOT_NEGATIVE;
1930 return \"bftst [%c2,%c1]%0\";
1935 [(set (match_operand:QI 0 "general_operand" "=d")
1936 (eq:QI (cc0) (const_int 0)))]
1939 cc_status = cc_prev_status;
1940 OUTPUT_JUMP (\"seq %0\", \"fseq %0\", \"seq %0\");
1944 [(set (match_operand:QI 0 "general_operand" "=d")
1945 (ne:QI (cc0) (const_int 0)))]
1948 cc_status = cc_prev_status;
1949 OUTPUT_JUMP (\"sne %0\", \"fsneq %0\", \"sne %0\");
1953 [(set (match_operand:QI 0 "general_operand" "=d")
1954 (gt:QI (cc0) (const_int 0)))]
1957 cc_status = cc_prev_status;
1958 OUTPUT_JUMP (\"sgt %0\", \"fsgt %0\", \"and%.b %#0xc,%!\;sgt %0\");
1962 [(set (match_operand:QI 0 "general_operand" "=d")
1963 (gtu:QI (cc0) (const_int 0)))]
1965 "* cc_status = cc_prev_status;
1966 return \"shi %0\"; ")
1969 [(set (match_operand:QI 0 "general_operand" "=d")
1970 (lt:QI (cc0) (const_int 0)))]
1972 "* cc_status = cc_prev_status;
1973 OUTPUT_JUMP (\"slt %0\", \"fslt %0\", \"smi %0\"); ")
1976 [(set (match_operand:QI 0 "general_operand" "=d")
1977 (ltu:QI (cc0) (const_int 0)))]
1979 "* cc_status = cc_prev_status;
1980 return \"scs %0\"; ")
1983 [(set (match_operand:QI 0 "general_operand" "=d")
1984 (ge:QI (cc0) (const_int 0)))]
1986 "* cc_status = cc_prev_status;
1987 OUTPUT_JUMP (\"sge %0\", \"fsge %0\", \"spl %0\"); ")
1990 [(set (match_operand:QI 0 "general_operand" "=d")
1991 (geu:QI (cc0) (const_int 0)))]
1993 "* cc_status = cc_prev_status;
1994 return \"scc %0\"; ")
1997 [(set (match_operand:QI 0 "general_operand" "=d")
1998 (le:QI (cc0) (const_int 0)))]
2001 cc_status = cc_prev_status;
2002 OUTPUT_JUMP (\"sle %0\", \"fsle %0\", \"and%.b %#0xc,%!\;sle %0\");
2006 [(set (match_operand:QI 0 "general_operand" "=d")
2007 (leu:QI (cc0) (const_int 0)))]
2009 "* cc_status = cc_prev_status;
2010 return \"sls %0\"; ")
2012 ;; Basic conditional jump instructions.
2016 (if_then_else (eq (cc0)
2018 (label_ref (match_operand 0 "" ""))
2023 OUTPUT_JUMP (\"jeq %l0\", \"fbeq %l0\", \"jeq %l0\");
2028 (if_then_else (ne (cc0)
2030 (label_ref (match_operand 0 "" ""))
2035 OUTPUT_JUMP (\"jne %l0\", \"fbneq %l0\", \"jne %l0\");
2040 (if_then_else (gt (cc0)
2042 (label_ref (match_operand 0 "" ""))
2046 OUTPUT_JUMP (\"jgt %l0\", \"fbgt %l0\", \"and%.b %#0xc,%!\;jgt %l0\");
2051 (if_then_else (gtu (cc0)
2053 (label_ref (match_operand 0 "" ""))
2062 (if_then_else (lt (cc0)
2064 (label_ref (match_operand 0 "" ""))
2068 OUTPUT_JUMP (\"jlt %l0\", \"fblt %l0\", \"jmi %l0\");
2073 (if_then_else (ltu (cc0)
2075 (label_ref (match_operand 0 "" ""))
2084 (if_then_else (ge (cc0)
2086 (label_ref (match_operand 0 "" ""))
2090 OUTPUT_JUMP (\"jge %l0\", \"fbge %l0\", \"jpl %l0\");
2095 (if_then_else (geu (cc0)
2097 (label_ref (match_operand 0 "" ""))
2106 (if_then_else (le (cc0)
2108 (label_ref (match_operand 0 "" ""))
2112 OUTPUT_JUMP (\"jle %l0\", \"fble %l0\", \"and%.b %#0xc,%!\;jle %l0\");
2117 (if_then_else (leu (cc0)
2119 (label_ref (match_operand 0 "" ""))
2126 ;; Negated conditional jump instructions.
2130 (if_then_else (eq (cc0)
2133 (label_ref (match_operand 0 "" ""))))]
2137 OUTPUT_JUMP (\"jne %l0\", \"fbneq %l0\", \"jne %l0\");
2142 (if_then_else (ne (cc0)
2145 (label_ref (match_operand 0 "" ""))))]
2149 OUTPUT_JUMP (\"jeq %l0\", \"fbeq %l0\", \"jeq %l0\");
2154 (if_then_else (gt (cc0)
2157 (label_ref (match_operand 0 "" ""))))]
2160 OUTPUT_JUMP (\"jle %l0\", \"fbngt %l0\", \"and%.b %#0xc,%!\;jle %l0\");
2165 (if_then_else (gtu (cc0)
2168 (label_ref (match_operand 0 "" ""))))]
2176 (if_then_else (lt (cc0)
2179 (label_ref (match_operand 0 "" ""))))]
2182 OUTPUT_JUMP (\"jge %l0\", \"fbnlt %l0\", \"jpl %l0\");
2187 (if_then_else (ltu (cc0)
2190 (label_ref (match_operand 0 "" ""))))]
2198 (if_then_else (ge (cc0)
2201 (label_ref (match_operand 0 "" ""))))]
2204 OUTPUT_JUMP (\"jlt %l0\", \"fbnge %l0\", \"jmi %l0\");
2209 (if_then_else (geu (cc0)
2212 (label_ref (match_operand 0 "" ""))))]
2220 (if_then_else (le (cc0)
2223 (label_ref (match_operand 0 "" ""))))]
2226 OUTPUT_JUMP (\"jgt %l0\", \"fbnle %l0\", \"and%.b %#0xc,%!\;jgt %l0\");
2231 (if_then_else (leu (cc0)
2234 (label_ref (match_operand 0 "" ""))))]
2240 ;; Subroutines of "casesi".
2242 (define_expand "casesi_1"
2243 [(set (match_operand:SI 3 "general_operand" "")
2244 (plus:SI (match_operand:SI 0 "general_operand" "")
2245 ;; Note operand 1 has been negated!
2246 (match_operand:SI 1 "immediate_operand" "")))
2247 (set (cc0) (compare (match_operand:SI 2 "nonimmediate_operand" "")
2249 (set (pc) (if_then_else (ltu (cc0) (const_int 0))
2250 (label_ref (match_operand 4 "" "")) (pc)))]
2254 (define_expand "casesi_2"
2255 [(set (match_operand:HI 0 "" "") (mem:HI (match_operand:SI 1 "" "")))
2256 ;; The USE here is so that at least one jump-insn will refer to the label,
2257 ;; to keep it alive in jump_optimize.
2258 (parallel [(set (pc)
2259 (plus:SI (pc) (sign_extend:SI (match_dup 0))))
2260 (use (label_ref (match_operand 2 "" "")))])]
2264 ;; Operand 0 is index (in bytes); operand 1 is minimum, operand 2 the maximum;
2265 ;; operand 3 is CODE_LABEL for the table;
2266 ;; operand 4 is the CODE_LABEL to go to if index out of range.
2267 (define_expand "casesi"
2268 ;; We don't use these for generating the RTL, but we must describe
2269 ;; the operands here.
2270 [(match_operand:HI 0 "general_operand" "")
2271 (match_operand:SI 1 "immediate_operand" "")
2272 (match_operand:SI 2 "general_operand" "")
2273 (match_operand 3 "" "")
2274 (match_operand 4 "" "")]
2281 operands[1] = negate_rtx (SImode, operands[1]);
2282 index_diff = gen_reg_rtx (SImode);
2283 /* Emit the first few insns. */
2284 emit_insn (gen_casesi_1 (operands[0], operands[1], operands[2],
2285 index_diff, operands[4]));
2286 /* Construct a memory address. This may emit some insns. */
2288 = memory_address_noforce
2290 gen_rtx_PLUS (Pmode,
2291 gen_rtx_MULT (Pmode, index_diff, GEN_INT (2)),
2292 gen_rtx_LABEL_REF (Pmode, operands[3])));
2293 /* Emit the last few insns. */
2294 emit_insn (gen_casesi_2 (gen_reg_rtx (HImode), table_elt_addr, operands[3]));
2298 ;; Recognize one of the insns resulting from casesi_2.
2302 (sign_extend:SI (match_operand:HI 0 "general_operand" "r"))))
2303 (use (label_ref (match_operand 1 "" "")))]
2306 return \"jmp pc@(2:B)[%0:W:B]\";
2309 ;; Unconditional and other jump instructions
2312 (label_ref (match_operand 0 "" "")))]
2321 (ne (match_operand:HI 0 "general_operand" "d,m,g")
2323 (label_ref (match_operand 1 "" ""))
2326 (plus:HI (match_dup 0)
2331 subq%.w %#1,%0\;jcc %l1
2332 subq%.w %#1,%0\;cmp%.w %#-1,%0\;jne %l1")
2337 (ne (match_operand:SI 0 "general_operand" "d,m,g")
2339 (label_ref (match_operand 1 "" ""))
2342 (plus:SI (match_dup 0)
2346 dbra %0,%l1\;clr%.w %0\;subq%.l %#1,%0\;jcc %l1
2347 subq%.l %#1,%0\;jcc %l1
2348 subq%.l %#1,%0\;cmp%.l %#-1,%0\;jne %l1")
2350 ;; dbra patterns that use REG_NOTES info generated by strength_reduce.
2352 (define_expand "decrement_and_branch_until_zero"
2353 [(parallel [(set (pc)
2355 (ge (match_operand:SI 0 "general_operand" "")
2357 (label_ref (match_operand 1 "" ""))
2360 (plus:SI (match_dup 0)
2368 (ge (match_operand:SI 0 "general_operand" "d,m,g")
2370 (label_ref (match_operand 1 "" ""))
2373 (plus:SI (match_dup 0)
2375 "find_reg_note (insn, REG_NONNEG, 0)"
2377 dbra %0,%l1\;clrw %0\;subql %#1,%0\;jcc %l1
2378 subq%.l %#1,%0\;jcc %l1
2379 subq%.l %#1,%0\;cmp%.l %#-1,%0\;jne %l1")
2381 ;; Call subroutine with no return value.
2383 [(call (match_operand:QI 0 "memory_operand" "o")
2384 (match_operand:SI 1 "general_operand" "g"))]
2389 int size = XINT(operands[1],0);
2392 output_asm_insn (\"sub%.l a0,a0\;jbsr %0\", operands);
2395 xoperands[1] = GEN_INT (size/4);
2396 output_asm_insn (\"mov%.l sp,a0\;pea %a1\", xoperands);
2397 output_asm_insn (\"jbsr %0\", operands);
2399 xoperands[1] = GEN_INT (size);
2401 output_asm_insn (\"addq%.l %1,sp\", xoperands);
2402 else if (size < 0x8000)
2403 output_asm_insn (\"add%.w %1,sp\", xoperands);
2405 output_asm_insn (\"add%.l %1,sp\", xoperands);
2407 return \"mov%.l a6@(-4),a0\";
2410 ;; Call subroutine, returning value in operand 0
2411 ;; (which must be a hard register).
2412 (define_insn "call_value"
2413 [(set (match_operand 0 "" "=rf")
2414 (call (match_operand:QI 1 "memory_operand" "o")
2415 (match_operand:SI 2 "general_operand" "g")))]
2420 int size = XINT(operands[2],0);
2423 output_asm_insn(\"sub%.l a0,a0\;jbsr %1\", operands);
2426 xoperands[2] = GEN_INT (size/4);
2427 output_asm_insn (\"mov%.l sp,a0\;pea %a2\", xoperands);
2428 output_asm_insn (\"jbsr %1\", operands);
2430 xoperands[2] = GEN_INT (size);
2432 output_asm_insn (\"addq%.l %2,sp\", xoperands);
2433 else if (size < 0x8000)
2434 output_asm_insn (\"add%.w %2,sp\", xoperands);
2436 output_asm_insn (\"add%.l %2,sp\", xoperands);
2438 return \"mov%.l a6@(-4),a0\";
2441 ;; Call subroutine returning any type.
2443 (define_expand "untyped_call"
2444 [(parallel [(call (match_operand 0 "" "")
2446 (match_operand 1 "" "")
2447 (match_operand 2 "" "")])]
2453 emit_call_insn (gen_call (operands[0], const0_rtx, NULL, const0_rtx));
2455 for (i = 0; i < XVECLEN (operands[2], 0); i++)
2457 rtx set = XVECEXP (operands[2], 0, i);
2458 emit_move_insn (SET_DEST (set), SET_SRC (set));
2461 /* The optimizer does not know that the call sets the function value
2462 registers we stored in the result block. We avoid problems by
2463 claiming that all hard registers are used and clobbered at this
2465 emit_insn (gen_blockage ());
2470 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
2471 ;; all of memory. This blocks insns from being moved across this point.
2473 (define_insn "blockage"
2474 [(unspec_volatile [(const_int 0)] 0)]
2483 ;; This should not be used unless the add/sub insns can't be.
2486 [(set (match_operand:SI 0 "general_operand" "=a")
2487 (match_operand:QI 1 "address_operand" "p"))]
2491 ;; This is the first machine-dependent peephole optimization.
2492 ;; It is useful when a floating value is returned from a function call
2493 ;; and then is moved into an FP register.
2494 ;; But it is mainly intended to test the support for these optimizations.
2496 ;Not applicable to Alliant -- floating results are returned in fp0
2498 ; [(set (reg:SI 15) (plus:SI (reg:SI 15) (const_int 4)))
2499 ; (set (match_operand:DF 0 "register_operand" "f")
2500 ; (match_operand:DF 1 "register_operand" "ad"))]
2501 ; "FP_REG_P (operands[0]) && ! FP_REG_P (operands[1])"
2505 ; xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
2506 ; output_asm_insn (\"mov%.l %1,%@\", xoperands);
2507 ; output_asm_insn (\"mov%.l %1,%-\", operands);
2508 ; return \"fmove%.d %+,%0\";