1 ;;- Machine description for SPUR chip for GNU C compiler
2 ;; Copyright (C) 1988 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.
22 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
24 ;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
25 ;;- updates for most instructions.
27 ;;- Operand classes for the register allocator:
29 ;; Compare instructions.
30 ;; This pattern is used for generating an "insn"
31 ;; which does just a compare and sets a (fictitious) condition code.
33 ;; The actual SPUR insns are compare-and-conditional-jump.
34 ;; The define_peephole's below recognize the combinations of
35 ;; compares and jumps, and output each pair as a single assembler insn.
37 ;; This controls RTL generation and register allocation.
40 (compare (match_operand:SI 0 "register_operand" "rK")
41 (match_operand:SI 1 "nonmemory_operand" "rK")))]
45 cc_status.value1 = operands[0], cc_status.value2 = operands[1];
49 ;; We have to have this because cse can optimize the previous pattern
54 (match_operand:SI 0 "register_operand" "r"))]
58 cc_status.value1 = operands[0], cc_status.value2 = const0_rtx;
63 ;; These control RTL generation for conditional jump insns
64 ;; and match them for register allocation.
68 (if_then_else (eq (cc0)
70 (label_ref (match_operand 0 "" ""))
73 "* return output_compare (operands, \"eq\", \"eq\", \"ne\", \"ne\"); ")
77 (if_then_else (ne (cc0)
79 (label_ref (match_operand 0 "" ""))
82 "* return output_compare (operands, \"ne\", \"ne\", \"eq\", \"eq\"); ")
86 (if_then_else (gt (cc0)
88 (label_ref (match_operand 0 "" ""))
91 "* return output_compare (operands, \"gt\", \"lt\", \"le\", \"ge\"); ")
95 (if_then_else (gtu (cc0)
97 (label_ref (match_operand 0 "" ""))
100 "* return output_compare (operands, \"ugt\", \"ult\", \"ule\", \"uge\"); ")
104 (if_then_else (lt (cc0)
106 (label_ref (match_operand 0 "" ""))
109 "* return output_compare (operands, \"lt\", \"gt\", \"ge\", \"le\"); ")
113 (if_then_else (ltu (cc0)
115 (label_ref (match_operand 0 "" ""))
118 "* return output_compare (operands, \"ult\", \"ugt\", \"uge\", \"ule\"); ")
122 (if_then_else (ge (cc0)
124 (label_ref (match_operand 0 "" ""))
127 "* return output_compare (operands, \"ge\", \"le\", \"lt\", \"gt\"); ")
131 (if_then_else (geu (cc0)
133 (label_ref (match_operand 0 "" ""))
136 "* return output_compare (operands, \"uge\", \"ule\", \"ult\", \"ugt\"); ")
140 (if_then_else (le (cc0)
142 (label_ref (match_operand 0 "" ""))
145 "* return output_compare (operands, \"le\", \"ge\", \"gt\", \"lt\"); ")
149 (if_then_else (leu (cc0)
151 (label_ref (match_operand 0 "" ""))
154 "* return output_compare (operands, \"ule\", \"uge\", \"ugt\", \"ult\"); ")
156 ;; These match inverted jump insns for register allocation.
160 (if_then_else (eq (cc0)
163 (label_ref (match_operand 0 "" ""))))]
165 "* return output_compare (operands, \"ne\", \"ne\", \"eq\", \"eq\"); ")
169 (if_then_else (ne (cc0)
172 (label_ref (match_operand 0 "" ""))))]
174 "* return output_compare (operands, \"eq\", \"eq\", \"ne\", \"ne\"); ")
178 (if_then_else (gt (cc0)
181 (label_ref (match_operand 0 "" ""))))]
183 "* return output_compare (operands, \"le\", \"ge\", \"gt\", \"lt\"); ")
187 (if_then_else (gtu (cc0)
190 (label_ref (match_operand 0 "" ""))))]
192 "* return output_compare (operands, \"ule\", \"uge\", \"ugt\", \"ult\"); ")
196 (if_then_else (lt (cc0)
199 (label_ref (match_operand 0 "" ""))))]
201 "* return output_compare (operands, \"ge\", \"le\", \"lt\", \"gt\"); ")
205 (if_then_else (ltu (cc0)
208 (label_ref (match_operand 0 "" ""))))]
210 "* return output_compare (operands, \"uge\", \"ule\", \"ult\", \"ugt\"); ")
214 (if_then_else (ge (cc0)
217 (label_ref (match_operand 0 "" ""))))]
219 "* return output_compare (operands, \"lt\", \"gt\", \"ge\", \"le\"); ")
223 (if_then_else (geu (cc0)
226 (label_ref (match_operand 0 "" ""))))]
228 "* return output_compare (operands, \"ult\", \"ugt\", \"uge\", \"ule\"); ")
232 (if_then_else (le (cc0)
235 (label_ref (match_operand 0 "" ""))))]
237 "* return output_compare (operands, \"gt\", \"lt\", \"le\", \"ge\"); ")
241 (if_then_else (leu (cc0)
244 (label_ref (match_operand 0 "" ""))))]
246 "* return output_compare (operands, \"ugt\", \"ult\", \"ule\", \"uge\"); ")
251 [(set (match_operand:SI 0 "general_operand" "=r,m")
252 (match_operand:SI 1 "general_operand" "rmi,rJ"))]
256 if (GET_CODE (operands[0]) == MEM)
257 return \"st_32 %r1,%0\";
258 if (GET_CODE (operands[1]) == MEM)
259 return \"ld_32 %0,%1\;nop\";
260 if (GET_CODE (operands[1]) == REG)
261 return \"add_nt %0,%1,$0\";
262 if (GET_CODE (operands[1]) == SYMBOL_REF && operands[1]->unchanging)
263 return \"add_nt %0,r24,$(%1-0b)\";
264 return \"add_nt %0,r0,%1\";
268 [(set (match_operand:SI 0 "register_operand" "=r")
269 (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "r")
270 (match_operand:SI 2 "register_operand" "r"))))]
272 "ld_32 %0,%1,%2\;nop")
274 ;; Generate insns for moving single bytes.
276 (define_expand "movqi"
277 [(set (match_operand:QI 0 "general_operand" "")
278 (match_operand:QI 1 "general_operand" ""))]
282 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
283 operands[1] = copy_to_reg (operands[1]);
285 if (GET_CODE (operands[1]) == MEM)
287 rtx tem = gen_reg_rtx (SImode);
288 rtx addr = force_reg (SImode, XEXP (operands[1], 0));
291 emit_move_insn (tem, gen_rtx (MEM, SImode, addr));
292 if (GET_CODE (operands[0]) == SUBREG)
293 subreg = gen_rtx (SUBREG, SImode, SUBREG_REG (operands[0]),
294 SUBREG_WORD (operands[0]));
296 subreg = gen_rtx (SUBREG, SImode, operands[0], 0);
298 emit_insn (gen_rtx (SET, VOIDmode, subreg,
299 gen_rtx (ZERO_EXTRACT, SImode, tem,
303 else if (GET_CODE (operands[0]) == MEM)
305 rtx tem = gen_reg_rtx (SImode);
306 rtx addr = force_reg (SImode, XEXP (operands[0], 0));
309 emit_move_insn (tem, gen_rtx (MEM, SImode, addr));
310 if (! CONSTANT_ADDRESS_P (operands[1]))
312 if (GET_CODE (operands[1]) == SUBREG)
313 subreg = gen_rtx (SUBREG, SImode, SUBREG_REG (operands[1]),
314 SUBREG_WORD (operands[1]));
316 subreg = gen_rtx (SUBREG, SImode, operands[1], 0);
319 emit_insn (gen_rtx (SET, VOIDmode,
320 gen_rtx (ZERO_EXTRACT, SImode, tem,
324 emit_move_insn (gen_rtx (MEM, SImode, addr), tem);
328 emit_insn (gen_rtx (SET, VOIDmode, operands[0], operands[1]));
333 ;; Recognize insns generated for moving single bytes.
336 [(set (match_operand:QI 0 "general_operand" "=r,m")
337 (match_operand:QI 1 "general_operand" "rmi,r"))]
341 if (GET_CODE (operands[0]) == MEM)
342 return \"st_32 %1,%0\";
343 if (GET_CODE (operands[1]) == MEM)
344 return \"ld_32 %0,%1\;nop\";
345 if (GET_CODE (operands[1]) == REG)
346 return \"add_nt %0,%1,$0\";
347 return \"add_nt %0,r0,%1\";
351 [(set (match_operand:SI 0 "register_operand" "=r")
352 (zero_extract:SI (match_operand:SI 1 "register_operand" "r")
354 (match_operand:SI 2 "nonmemory_operand" "rI")))]
359 [(set (zero_extract:SI (match_operand:SI 0 "register_operand" "+r")
361 (match_operand:SI 1 "nonmemory_operand" "rI"))
362 (match_operand:SI 2 "nonmemory_operand" "ri"))]
364 "wr_insert %1\;insert %0,%0,%2")
366 ;; Constant propagation can optimize the previous pattern into this pattern.
367 ;[Not any more. It could when the position-operand contains a MULT.]
370 ; [(set (zero_extract:QI (match_operand:SI 0 "register_operand" "+r")
372 ; (match_operand:SI 1 "immediate_operand" "I"))
373 ; (match_operand:QI 2 "register_operand" "r"))]
374 ; "GET_CODE (operands[1]) == CONST_INT
375 ; && INTVAL (operands[1]) % 8 == 0
376 ; && (unsigned) INTVAL (operands[1]) < 32"
379 ; operands[1] = GEN_INT (INTVAL (operands[1]) / 8);
380 ; return \"wr_insert 0,0,%1\;insert %0,%0,%2\";
383 ;; The three define_expand patterns on this page
384 ;; serve as subroutines of "movhi".
386 ;; Generate code to fetch an aligned halfword from memory.
387 ;; Operand 0 is the destination register (HImode).
388 ;; Operand 1 is the memory address (SImode).
389 ;; Operand 2 is a temporary (SImode).
390 ;; Operand 3 is a temporary (SImode).
391 ;; Operand 4 is a temporary (QImode).
393 ;; Operand 5 is an internal temporary (HImode).
395 (define_expand "loadhi"
396 [(set (match_operand:SI 2 "register_operand" "")
397 (mem:SI (match_operand:SI 1 "register_operand" "")))
398 ;; Extract the low byte.
399 (set (subreg:SI (match_dup 5) 0)
400 (zero_extract:SI (match_dup 2) (const_int 8) (match_dup 1)))
401 ;; Form address of high byte.
402 (set (match_operand:SI 3 "register_operand" "")
403 (plus:SI (match_dup 1) (const_int 1)))
404 ;; Extract the high byte.
405 (set (subreg:SI (match_operand:QI 4 "register_operand" "") 0)
406 (zero_extract:SI (match_dup 2) (const_int 8) (match_dup 3)))
407 ;; Put the high byte in with the low one.
408 (set (zero_extract:SI (match_dup 5) (const_int 8) (const_int 1))
409 (subreg:SI (match_dup 4) 0))
410 (set (match_operand:HI 0 "register_operand" "") (match_dup 5))]
412 "operands[5] = gen_reg_rtx (HImode);")
414 ;; Generate code to store an aligned halfword into memory.
415 ;; Operand 0 is the destination address (SImode).
416 ;; Operand 1 is the source register (HImode, not constant).
417 ;; Operand 2 is a temporary (SImode).
418 ;; Operand 3 is a temporary (SImode).
419 ;; Operand 4 is a temporary (QImode).
421 ;; Operand 5 is an internal variable made from operand 1.
423 (define_expand "storehi"
424 [(set (match_operand:SI 2 "register_operand" "")
425 (mem:SI (match_operand:SI 0 "register_operand" "")))
426 ;; Insert the low byte.
427 (set (zero_extract:SI (match_dup 2) (const_int 8) (match_dup 0))
429 ;; Form address of high byte.
430 (set (match_operand:SI 3 "register_operand" "")
431 (plus:SI (match_dup 0) (const_int 1)))
432 ;; Extract the high byte from the source.
433 (set (subreg:SI (match_operand:QI 4 "register_operand" "") 0)
434 (zero_extract:SI (match_operand:HI 1 "register_operand" "")
435 (const_int 8) (const_int 1)))
436 ;; Store high byte into the memory word
437 (set (zero_extract:SI (match_dup 2) (const_int 8) (match_dup 3))
438 (subreg:SI (match_dup 4) 0))
439 ;; Put memory word back into memory.
440 (set (mem:SI (match_dup 0))
445 if (GET_CODE (operands[1]) == SUBREG)
446 operands[5] = gen_rtx (SUBREG, SImode, SUBREG_REG (operands[1]),
447 SUBREG_WORD (operands[1]));
449 operands[5] = gen_rtx (SUBREG, SImode, operands[1], 0);
452 ;; Like storehi but operands[1] is a CONST_INT.
454 (define_expand "storeinthi"
455 [(set (match_operand:SI 2 "register_operand" "")
456 (mem:SI (match_operand:SI 0 "register_operand" "")))
457 ;; Insert the low byte.
458 (set (zero_extract:SI (match_dup 2) (const_int 8) (match_dup 0))
460 ;; Form address of high byte.
461 (set (match_operand:SI 3 "register_operand" "")
462 (plus:SI (match_dup 0) (const_int 1)))
463 ;; Store high byte into the memory word
464 (set (zero_extract:SI (match_dup 2) (const_int 8) (match_dup 3))
466 ;; Put memory word back into memory.
467 (set (mem:SI (match_dup 0))
470 " operands[5] = GEN_INT (INTVAL (operands[1]) & 255);
471 operands[6] = GEN_INT ((INTVAL (operands[1]) >> 8) & 255);
474 ;; Main entry for generating insns to move halfwords.
476 (define_expand "movhi"
477 [(set (match_operand:HI 0 "general_operand" "")
478 (match_operand:HI 1 "general_operand" ""))]
482 if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
483 operands[1] = copy_to_reg (operands[1]);
485 if (GET_CODE (operands[1]) == MEM)
488 emit_insn (gen_loadhi (operands[0],
489 force_reg (SImode, XEXP (operands[1], 0)),
490 gen_reg_rtx (SImode), gen_reg_rtx (SImode),
491 gen_reg_rtx (QImode)));
492 /* Tell cse what value the loadhi produces, so it detect duplicates. */
493 REG_NOTES (insn) = gen_rtx (EXPR_LIST, REG_EQUAL, operands[1],
496 else if (GET_CODE (operands[0]) == MEM)
498 if (GET_CODE (operands[1]) == CONST_INT)
499 emit_insn (gen_storeinthi (force_reg (SImode, XEXP (operands[0], 0)),
501 gen_reg_rtx (SImode), gen_reg_rtx (SImode),
502 gen_reg_rtx (QImode)));
505 if (CONSTANT_P (operands[1]))
506 operands[1] = force_reg (HImode, operands[1]);
507 emit_insn (gen_storehi (force_reg (SImode, XEXP (operands[0], 0)),
509 gen_reg_rtx (SImode), gen_reg_rtx (SImode),
510 gen_reg_rtx (QImode)));
514 emit_insn (gen_rtx (SET, VOIDmode, operands[0], operands[1]));
518 ;; Recognize insns generated for moving halfwords.
519 ;; (Note that the extract and insert patterns for single-byte moves
520 ;; are also involved in recognizing some of the insns used for this purpose.)
523 [(set (match_operand:HI 0 "general_operand" "=r,m")
524 (match_operand:HI 1 "general_operand" "rmi,r"))]
528 if (GET_CODE (operands[0]) == MEM)
529 return \"st_32 %1,%0\";
530 if (GET_CODE (operands[1]) == MEM)
531 return \"ld_32 %0,%1\;nop\";
532 if (GET_CODE (operands[1]) == REG)
533 return \"add_nt %0,%1,$0\";
534 return \"add_nt %0,r0,%1\";
538 [(set (match_operand:SI 0 "register_operand" "=r")
539 (zero_extract:SI (match_operand:HI 1 "register_operand" "r")
541 (match_operand:SI 2 "nonmemory_operand" "rI")))]
546 [(set (zero_extract:SI (match_operand:HI 0 "register_operand" "+r")
548 (match_operand:SI 1 "nonmemory_operand" "rI"))
549 (match_operand:SI 2 "nonmemory_operand" "ri"))]
551 "wr_insert %1\;insert %0,%0,%2")
553 ;; Constant propagation can optimize the previous pattern into this pattern.
556 ; [(set (zero_extract:QI (match_operand:HI 0 "register_operand" "+r")
558 ; (match_operand:SI 1 "immediate_operand" "I"))
559 ; (match_operand:QI 2 "register_operand" "r"))]
560 ; "GET_CODE (operands[1]) == CONST_INT
561 ; && INTVAL (operands[1]) % 8 == 0
562 ; && (unsigned) INTVAL (operands[1]) < 32"
565 ; operands[1] = GEN_INT (INTVAL (operands[1]) / 8);
566 ; return \"wr_insert 0,0,%1\;insert %0,%0,%2\";
569 ;; This pattern forces (set (reg:DF ...) (const_double ...))
570 ;; to be reloaded by putting the constant into memory.
571 ;; It must come before the more general movdf pattern.
573 [(set (match_operand:DF 0 "general_operand" "=&r,f,&o")
574 (match_operand:DF 1 "" "mG,m,G"))]
575 "GET_CODE (operands[1]) == CONST_DOUBLE"
578 if (FP_REG_P (operands[0]))
579 return output_fp_move_double (operands);
580 if (operands[1] == CONST0_RTX (DFmode) && GET_CODE (operands[0]) == REG)
582 operands[1] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
583 return \"add_nt %0,r0,$0\;add_nt %1,r0,$0\";
585 if (operands[1] == CONST0_RTX (DFmode) && GET_CODE (operands[0]) == MEM)
587 operands[1] = adj_offsettable_operand (operands[0], 4);
588 return \"st_32 r0,%0\;st_32 r0,%1\";
590 return output_move_double (operands);
595 [(set (match_operand:DF 0 "general_operand" "=r,&r,m,?f,?rm")
596 (match_operand:DF 1 "general_operand" "r,m,r,rfm,f"))]
600 if (FP_REG_P (operands[0]) || FP_REG_P (operands[1]))
601 return output_fp_move_double (operands);
602 return output_move_double (operands);
607 [(set (match_operand:DI 0 "general_operand" "=r,&r,m,?f,?rm")
608 (match_operand:DI 1 "general_operand" "r,m,r,rfm,f"))]
612 if (FP_REG_P (operands[0]) || FP_REG_P (operands[1]))
613 return output_fp_move_double (operands);
614 return output_move_double (operands);
619 [(set (match_operand:SF 0 "general_operand" "=rf,m")
620 (match_operand:SF 1 "general_operand" "rfm,rf"))]
624 if (FP_REG_P (operands[0]))
626 if (FP_REG_P (operands[1]))
627 return \"fmov %0,%1\";
628 if (GET_CODE (operands[1]) == REG)
631 int offset = - get_frame_size () - 8;
632 xoperands[1] = operands[1];
633 xoperands[0] = GEN_INT (offset);
634 output_asm_insn (\"st_32 %1,r25,%0\", xoperands);
635 xoperands[1] = operands[0];
636 output_asm_insn (\"ld_sgl %1,r25,%0\;nop\", xoperands);
639 return \"ld_sgl %0,%1\;nop\";
641 if (FP_REG_P (operands[1]))
643 if (GET_CODE (operands[0]) == REG)
646 int offset = - get_frame_size () - 8;
647 xoperands[0] = GEN_INT (offset);
648 xoperands[1] = operands[1];
649 output_asm_insn (\"st_sgl %1,r25,%0\", xoperands);
650 xoperands[1] = operands[0];
651 output_asm_insn (\"ld_32 %1,r25,%0\;nop\", xoperands);
654 return \"st_sgl %1,%0\";
656 if (GET_CODE (operands[0]) == MEM)
657 return \"st_32 %r1,%0\";
658 if (GET_CODE (operands[1]) == MEM)
659 return \"ld_32 %0,%1\;nop\";
660 if (GET_CODE (operands[1]) == REG)
661 return \"add_nt %0,%1,$0\";
662 return \"add_nt %0,r0,%1\";
665 ;;- truncation instructions
666 (define_insn "truncsiqi2"
667 [(set (match_operand:QI 0 "register_operand" "=r")
669 (match_operand:SI 1 "register_operand" "r")))]
673 (define_insn "trunchiqi2"
674 [(set (match_operand:QI 0 "register_operand" "=r")
676 (match_operand:HI 1 "register_operand" "r")))]
680 (define_insn "truncsihi2"
681 [(set (match_operand:HI 0 "register_operand" "=r")
683 (match_operand:SI 1 "register_operand" "r")))]
687 ;;- zero extension instructions
689 ;; Note that the one starting from HImode comes before those for QImode
690 ;; so that a constant operand will match HImode, not QImode.
691 (define_expand "zero_extendhisi2"
692 [(set (match_operand:SI 0 "register_operand" "")
693 (and:SI (match_operand:HI 1 "register_operand" "") ;Changed to SI below
694 ;; This constant is invalid, but reloading will handle it.
695 ;; It's useless to generate here the insns to construct it
696 ;; because constant propagation would simplify them anyway.
701 if (GET_CODE (operands[1]) == SUBREG)
702 operands[1] = gen_rtx (SUBREG, SImode, SUBREG_REG (operands[1]),
703 SUBREG_WORD (operands[1]));
705 operands[1] = gen_rtx (SUBREG, SImode, operands[1], 0);
707 operands[2] = force_reg (SImode, GEN_INT (65535));
710 (define_insn "zero_extendqihi2"
711 [(set (match_operand:HI 0 "register_operand" "=r")
713 (match_operand:QI 1 "register_operand" "r")))]
717 (define_insn "zero_extendqisi2"
718 [(set (match_operand:SI 0 "register_operand" "=r")
720 (match_operand:QI 1 "register_operand" "r")))]
724 ;;- sign extension instructions
725 ;; Note that the one starting from HImode comes before those for QImode
726 ;; so that a constant operand will match HImode, not QImode.
728 (define_expand "extendhisi2"
730 (and:SI (match_operand:HI 1 "register_operand" "") ;Changed to SI below
732 (set (match_dup 3) (plus:SI (match_dup 2) (match_dup 5)))
733 (set (match_operand:SI 0 "register_operand" "")
734 (xor:SI (match_dup 3) (match_dup 5)))]
738 if (GET_CODE (operands[1]) == SUBREG)
739 operands[1] = gen_rtx (SUBREG, SImode, SUBREG_REG (operands[1]),
740 SUBREG_WORD (operands[1]));
742 operands[1] = gen_rtx (SUBREG, SImode, operands[1], 0);
744 operands[2] = gen_reg_rtx (SImode);
745 operands[3] = gen_reg_rtx (SImode);
746 operands[4] = force_reg (SImode, GEN_INT (65535));
747 operands[5] = force_reg (SImode, GEN_INT (-32768));
750 (define_expand "extendqihi2"
752 (and:HI (match_operand:QI 1 "register_operand" "") ;Changed to SI below
755 (plus:SI (match_dup 2) (const_int -128)))
756 (set (match_operand:HI 0 "register_operand" "")
757 (xor:SI (match_dup 3) (const_int -128)))]
761 if (GET_CODE (operands[1]) == SUBREG)
762 operands[1] = gen_rtx (SUBREG, HImode, SUBREG_REG (operands[1]),
763 SUBREG_WORD (operands[1]));
765 operands[1] = gen_rtx (SUBREG, HImode, operands[1], 0);
767 operands[2] = gen_reg_rtx (HImode);
768 operands[3] = gen_reg_rtx (HImode);
771 (define_expand "extendqisi2"
773 (and:SI (match_operand:QI 1 "register_operand" "") ;Changed to SI below
775 (set (match_dup 3) (plus:SI (match_dup 2) (const_int -128)))
776 (set (match_operand:SI 0 "register_operand" "")
777 (xor:SI (match_dup 3) (const_int -128)))]
781 if (GET_CODE (operands[1]) == SUBREG)
782 operands[1] = gen_rtx (SUBREG, SImode, SUBREG_REG (operands[1]),
783 SUBREG_WORD (operands[1]));
785 operands[1] = gen_rtx (SUBREG, SImode, operands[1], 0);
787 operands[2] = gen_reg_rtx (SImode);
788 operands[3] = gen_reg_rtx (SImode);
791 ;;- arithmetic instructions
793 (define_insn "addsi3"
794 [(set (match_operand:SI 0 "register_operand" "=r")
795 (plus:SI (match_operand:SI 1 "nonmemory_operand" "%r")
796 (match_operand:SI 2 "nonmemory_operand" "rI")))]
801 [(set (match_operand:SI 0 "register_operand" "=r")
802 (plus:SI (match_operand:SI 1 "nonmemory_operand" "%r")
803 (match_operand:SI 2 "big_immediate_operand" "g")))]
804 "GET_CODE (operands[2]) == CONST_INT
805 && (unsigned) (INTVAL (operands[2]) + 0x8000000) < 0x10000000"
809 output_add_large_offset (operands[0], operands[1], INTVAL (operands[2]));
812 (define_insn "subsi3"
813 [(set (match_operand:SI 0 "register_operand" "=r")
814 (minus:SI (match_operand:SI 1 "register_operand" "r")
815 (match_operand:SI 2 "nonmemory_operand" "rI")))]
819 (define_insn "andsi3"
820 [(set (match_operand:SI 0 "register_operand" "=r")
821 (and:SI (match_operand:SI 1 "nonmemory_operand" "%r")
822 (match_operand:SI 2 "nonmemory_operand" "rI")))]
826 (define_insn "iorsi3"
827 [(set (match_operand:SI 0 "register_operand" "=r")
828 (ior:SI (match_operand:SI 1 "nonmemory_operand" "%r")
829 (match_operand:SI 2 "nonmemory_operand" "rI")))]
833 (define_insn "xorsi3"
834 [(set (match_operand:SI 0 "register_operand" "=r")
835 (xor:SI (match_operand:SI 1 "nonmemory_operand" "%r")
836 (match_operand:SI 2 "nonmemory_operand" "rI")))]
840 (define_insn "negsi2"
841 [(set (match_operand:SI 0 "register_operand" "=r")
842 (neg:SI (match_operand:SI 1 "nonmemory_operand" "rI")))]
846 (define_insn "one_cmplsi2"
847 [(set (match_operand:SI 0 "register_operand" "=r")
848 (not:SI (match_operand:SI 1 "register_operand" "r")))]
852 ;; Floating point arithmetic instructions.
854 (define_insn "adddf3"
855 [(set (match_operand:DF 0 "register_operand" "=f")
856 (plus:DF (match_operand:DF 1 "register_operand" "f")
857 (match_operand:DF 2 "register_operand" "f")))]
861 (define_insn "addsf3"
862 [(set (match_operand:SF 0 "register_operand" "=f")
863 (plus:SF (match_operand:SF 1 "register_operand" "f")
864 (match_operand:SF 2 "register_operand" "f")))]
868 (define_insn "subdf3"
869 [(set (match_operand:DF 0 "register_operand" "=f")
870 (minus:DF (match_operand:DF 1 "register_operand" "f")
871 (match_operand:DF 2 "register_operand" "f")))]
875 (define_insn "subsf3"
876 [(set (match_operand:SF 0 "register_operand" "=f")
877 (minus:SF (match_operand:SF 1 "register_operand" "f")
878 (match_operand:SF 2 "register_operand" "f")))]
882 (define_insn "muldf3"
883 [(set (match_operand:DF 0 "register_operand" "=f")
884 (mult:DF (match_operand:DF 1 "register_operand" "f")
885 (match_operand:DF 2 "register_operand" "f")))]
889 (define_insn "mulsf3"
890 [(set (match_operand:SF 0 "register_operand" "=f")
891 (mult:SF (match_operand:SF 1 "register_operand" "f")
892 (match_operand:SF 2 "register_operand" "f")))]
896 (define_insn "divdf3"
897 [(set (match_operand:DF 0 "register_operand" "=f")
898 (div:DF (match_operand:DF 1 "register_operand" "f")
899 (match_operand:DF 2 "register_operand" "f")))]
903 (define_insn "divsf3"
904 [(set (match_operand:SF 0 "register_operand" "=f")
905 (div:SF (match_operand:SF 1 "register_operand" "f")
906 (match_operand:SF 2 "register_operand" "f")))]
910 (define_insn "negdf2"
911 [(set (match_operand:DF 0 "register_operand" "=f")
912 (neg:DF (match_operand:DF 1 "nonmemory_operand" "f")))]
916 (define_insn "negsf2"
917 [(set (match_operand:SF 0 "register_operand" "=f")
918 (neg:SF (match_operand:SF 1 "nonmemory_operand" "f")))]
922 (define_insn "absdf2"
923 [(set (match_operand:DF 0 "register_operand" "=f")
924 (abs:DF (match_operand:DF 1 "nonmemory_operand" "f")))]
928 (define_insn "abssf2"
929 [(set (match_operand:SF 0 "register_operand" "=f")
930 (abs:SF (match_operand:SF 1 "nonmemory_operand" "f")))]
934 ;; Shift instructions
937 [(set (match_operand:SI 0 "register_operand" "=r")
938 (ashift:SI (match_operand:SI 1 "register_operand" "r")
939 (match_operand:SI 2 "immediate_operand" "I")))]
940 "GET_CODE (operands[2]) == CONST_INT"
943 unsigned int amount = INTVAL (operands[2]);
948 return \"add_nt %0,%1,$0\";
950 return \"sll %0,%1,$1\";
952 return \"sll %0,%1,$2\";
954 output_asm_insn (\"sll %0,%1,$3\", operands);
956 for (amount -= 3; amount >= 3; amount -= 3)
957 output_asm_insn (\"sll %0,%0,$3\", operands);
960 output_asm_insn (amount == 1 ? \"sll %0,%0,$1\" : \"sll %0,%0,$2\",
967 [(set (match_operand:SI 0 "register_operand" "=r")
968 (ashiftrt:SI (match_operand:SI 1 "register_operand" "r")
969 (match_operand:SI 2 "immediate_operand" "I")))]
970 "GET_CODE (operands[2]) == CONST_INT"
973 unsigned int amount = INTVAL (operands[2]);
976 return \"add_nt %0,%1,$0\";
978 output_asm_insn (\"sra %0,%1,$1\", operands);
980 for (amount -= 1; amount > 0; amount -= 1)
981 output_asm_insn (\"sra %0,%0,$1\", operands);
987 [(set (match_operand:SI 0 "register_operand" "=r")
988 (lshiftrt:SI (match_operand:SI 1 "register_operand" "r")
989 (match_operand:SI 2 "immediate_operand" "I")))]
990 "GET_CODE (operands[2]) == CONST_INT"
993 unsigned int amount = INTVAL (operands[2]);
996 return \"add_nt %0,%1,$0\";
998 output_asm_insn (\"srl %0,%1,$1\", operands);
1000 for (amount -= 1; amount > 0; amount -= 1)
1001 output_asm_insn (\"srl %0,%0,$1\", operands);
1006 (define_expand "ashlsi3"
1007 [(set (match_operand:SI 0 "register_operand" "")
1008 (ashift:SI (match_operand:SI 1 "register_operand" "")
1009 (match_operand:SI 2 "nonmemory_operand" "")))]
1013 if (GET_CODE (operands[2]) != CONST_INT
1014 || (! TARGET_EXPAND_SHIFTS && (unsigned) INTVAL (operands[2]) > 3))
1018 (define_expand "ashrsi3"
1019 [(set (match_operand:SI 0 "register_operand" "")
1020 (ashiftrt:SI (match_operand:SI 1 "register_operand" "")
1021 (match_operand:SI 2 "nonmemory_operand" "")))]
1025 if (GET_CODE (operands[2]) != CONST_INT
1026 || (! TARGET_EXPAND_SHIFTS && (unsigned) INTVAL (operands[2]) > 1))
1030 (define_expand "lshrsi3"
1031 [(set (match_operand:SI 0 "register_operand" "")
1032 (lshiftrt:SI (match_operand:SI 1 "register_operand" "")
1033 (match_operand:SI 2 "nonmemory_operand" "")))]
1037 if (GET_CODE (operands[2]) != CONST_INT
1038 || (! TARGET_EXPAND_SHIFTS && (unsigned) INTVAL (operands[2]) > 1))
1042 ;; Unconditional and other jump instructions
1045 (label_ref (match_operand 0 "" "")))]
1049 (define_insn "tablejump"
1050 [(set (pc) (match_operand:SI 0 "register_operand" "r"))
1051 (use (label_ref (match_operand 1 "" "")))]
1053 "jump_reg r0,%0\;nop")
1055 ;;- jump to subroutine
1057 [(call (match_operand:SI 0 "memory_operand" "m")
1058 (match_operand:SI 1 "general_operand" "g"))]
1059 ;;- Don't use operand 1 for most machines.
1061 "add_nt r2,%0\;call .+8\;jump_reg r0,r2\;nop")
1063 (define_insn "call_value"
1064 [(set (match_operand 0 "" "=g")
1065 (call (match_operand:SI 1 "memory_operand" "m")
1066 (match_operand:SI 2 "general_operand" "g")))]
1067 ;;- Don't use operand 1 for most machines.
1069 "add_nt r2,%1\;call .+8\;jump_reg r0,r2\;nop")
1071 ;; A memory ref with constant address is not normally valid.
1072 ;; But it is valid in a call insns. This pattern allows the
1073 ;; loading of the address to combine with the call.
1075 [(call (mem:SI (match_operand:SI 0 "" "i"))
1076 (match_operand:SI 1 "general_operand" "g"))]
1077 ;;- Don't use operand 1 for most machines.
1078 "GET_CODE (operands[0]) == SYMBOL_REF"
1082 [(set (match_operand 0 "" "=g")
1083 (call (mem:SI (match_operand:SI 1 "" "i"))
1084 (match_operand:SI 2 "general_operand" "g")))]
1085 ;;- Don't use operand 1 for most machines.
1086 "GET_CODE (operands[1]) == SYMBOL_REF"