1 ;;- Machine description for GNU compiler -- System/370 version.
2 ;; Copyright (C) 1989, 93, 94, 95, 1997 Free Software Foundation, Inc.
3 ;; Contributed by Jan Stein (jan@cd.chalmers.se).
4 ;; Modified for MVS C/370 by Dave Pitts (dpitts@nyx.cs.du.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.
23 ;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
24 ;;- updates for most instructions.
27 ;; Special constraints for 370 machine description:
29 ;; a -- Any address register from 1 to 15.
30 ;; d -- Any register from 0 to 15.
31 ;; I -- An 8-bit constant (0..255).
32 ;; J -- A 12-bit constant (0..4095).
33 ;; K -- A 16-bit constant (-32768..32767).
35 ;; Special formats used for outputting 370 instructions.
37 ;; %B -- Print a constant byte integer.
38 ;; %H -- Print a signed 16-bit constant.
39 ;; %L -- Print least significant word of a CONST_DOUBLE.
40 ;; %M -- Print most significant word of a CONST_DOUBLE.
41 ;; %N -- Print next register (second word of a DImode reg).
42 ;; %O -- Print the offset of a memory reference (PLUS (REG) (CONST_INT)).
43 ;; %R -- Print the register of a memory reference (PLUS (REG) (CONST_INT)).
44 ;; %X -- Print a constant byte integer in hex.
46 ;; We have a special constraint for pattern matching.
48 ;; s_operand -- Matches a valid S operand in a RS, SI or SS type instruction.
50 ;; r_or_s_operand -- Matches a register or a valid S operand in a RS, SI
51 ;; or SS type instruction or a register
53 ;; For MVS C/370 we use the following stack locations for:
55 ;; 136 - internal function result buffer
56 ;; 140 - numeric conversion buffer
57 ;; 144 - pointer to internal function result buffer
58 ;; 148 - start of automatic variables and function arguments
60 ;; To support programs larger than a page, 4096 bytes, PAGE_REGISTER points
61 ;; to a page origin table, all internal labels are generated to reload the
62 ;; BASE_REGISTER knowing what page it is on and all branch instructions go
63 ;; directly to the target if it is known that the target is on the current
64 ;; page (essentially backward references). All forward references and off
65 ;; page references are handled by loading the address of target into a
66 ;; register and branching indirectly.
68 ;; Some *di patterns have been commented out per advice from RMS, as gcc
69 ;; will generate the right things to do.
73 ;;- Test instructions.
77 ; tstdi instruction pattern(s).
82 (match_operand:DI 0 "register_operand" "d"))]
87 mvs_check_page (0, 4, 0);
92 ; tstsi instruction pattern(s).
97 (match_operand:SI 0 "register_operand" "d"))]
102 mvs_check_page (0, 2, 0);
103 return \"LTR %0,%0\";
107 ; tsthi instruction pattern(s).
112 (match_operand:HI 0 "register_operand" "d"))]
117 mvs_check_page (0, 4, 2);
118 return \"CH %0,=H'0'\";
122 ; tstqi instruction pattern(s).
127 (match_operand:QI 0 "r_or_s_operand" "dm"))]
128 "unsigned_jump_follows_p (insn)"
132 if (REG_P (operands[0]))
134 mvs_check_page (0, 4, 4);
135 return \"N %0,=X'000000FF'\";
137 mvs_check_page (0, 4, 0);
143 (match_operand:QI 0 "register_operand" "d"))]
148 if (unsigned_jump_follows_p (insn))
150 mvs_check_page (0, 4, 4);
151 return \"N %0,=X'000000FF'\";
153 mvs_check_page (0, 8, 0);
154 return \"SLL %0,24\;SRA %0,24\";
158 ; tstdf instruction pattern(s).
163 (match_operand:DF 0 "general_operand" "f"))]
168 mvs_check_page (0, 2, 0);
169 return \"LTDR %0,%0\";
173 ; tstsf instruction pattern(s).
178 (match_operand:SF 0 "general_operand" "f"))]
183 mvs_check_page (0, 2, 0);
184 return \"LTER %0,%0\";
188 ;;- Compare instructions.
192 ; cmpdi instruction pattern(s).
195 ;(define_insn "cmpdi"
197 ; (compare (match_operand:DI 0 "register_operand" "d")
198 ; (match_operand:DI 1 "general_operand" "")))]
202 ; check_label_emit ();
203 ; if (REG_P (operands[1]))
205 ; mvs_check_page (0, 8, 0);
206 ; if (unsigned_jump_follows_p (insn))
207 ; return \"CLR %0,%1\;BNE *+6\;CLR %N0,%N1\";
208 ; return \"CR %0,%1\;BNE *+6\;CLR %N0,%N1\";
210 ; mvs_check_page (0, 12, 0);
211 ; if (unsigned_jump_follows_p (insn))
212 ; return \"CL %0,%M1\;BNE *+8\;CL %N0,%L1\";
213 ; return \"C %0,%M1\;BNE *+8\;CL %N0,%L1\";
217 ; cmpsi instruction pattern(s).
222 (compare (match_operand:SI 0 "register_operand" "d")
223 (match_operand:SI 1 "general_operand" "md")))]
228 if (REG_P (operands[1]))
230 mvs_check_page (0, 2, 0);
231 if (unsigned_jump_follows_p (insn))
232 return \"CLR %0,%1\";
235 if (GET_CODE (operands[1]) == CONST_INT)
237 mvs_check_page (0, 4, 4);
238 if (unsigned_jump_follows_p (insn))
239 return \"CL %0,=F'%c1'\";
240 return \"C %0,=F'%c1'\";
242 mvs_check_page (0, 4, 0);
243 if (unsigned_jump_follows_p (insn))
249 ; cmphi instruction pattern(s).
254 (compare (match_operand:HI 0 "register_operand" "d")
255 (match_operand:HI 1 "general_operand" "")))]
260 if (REG_P (operands[1]))
262 mvs_check_page (0, 8, 0);
263 if (unsigned_jump_follows_p (insn))
264 return \"STH %1,140(,13)\;CLM %0,3,140(13)\";
265 return \"STH %1,140(,13)\;CH %0,140(,13)\";
267 if (GET_CODE (operands[1]) == CONST_INT)
269 mvs_check_page (0, 4, 0);
270 return \"CH %0,%H1\";
272 mvs_check_page (0, 4, 0);
277 ; cmpqi instruction pattern(s).
282 (compare (match_operand:QI 0 "r_or_s_operand" "g")
283 (match_operand:QI 1 "r_or_s_operand" "g")))]
284 "unsigned_jump_follows_p (insn)"
288 if (REG_P (operands[0]))
290 if (REG_P (operands[1]))
292 mvs_check_page (0, 8, 0);
293 return \"STC %1,140(,13)\;CLM %0,1,140(13)\";
295 if (GET_CODE (operands[1]) == CONST_INT)
297 mvs_check_page (0, 4, 1);
298 return \"CLM %0,1,=FL1'%B1'\";
300 mvs_check_page (0, 4, 0);
301 return \"CLM %0,1,%1\";
303 else if (GET_CODE (operands[0]) == CONST_INT)
305 cc_status.flags |= CC_REVERSED;
306 if (REG_P (operands[1]))
308 mvs_check_page (0, 4, 1);
309 return \"CLM %1,1,=FL1'%B0'\";
311 mvs_check_page (0, 4, 0);
312 return \"CLI %1,%B0\";
314 if (GET_CODE (operands[1]) == CONST_INT)
316 mvs_check_page (0, 4, 0);
317 return \"CLI %0,%B1\";
319 if (GET_CODE (operands[1]) == MEM)
321 mvs_check_page (0, 6, 0);
322 return \"CLC %O0(1,%R0),%1\";
324 cc_status.flags |= CC_REVERSED;
325 mvs_check_page (0, 4, 0);
326 return \"CLM %1,1,%0\";
331 (compare (match_operand:QI 0 "register_operand" "d")
332 (match_operand:QI 1 "general_operand" "di")))]
337 if (unsigned_jump_follows_p (insn))
339 if (REG_P (operands[1]))
341 mvs_check_page (0, 4, 0);
342 return \"CLM %0,1,%1\";
344 if (GET_CODE (operands[1]) == CONST_INT)
346 mvs_check_page (0, 4, 1);
347 return \"CLM %0,1,=FL1'%B1'\";
349 mvs_check_page (0, 8, 0);
350 return \"STC %1,140(,13)\;CLM %0,1,140(13)\";
352 if (REG_P (operands[1]))
354 mvs_check_page (0, 18, 0);
355 return \"SLL %0,24\;SRA %0,24\;SLL %1,24\;SRA %1,24\;CR %0,%1\";
357 mvs_check_page (0, 12, 0);
358 return \"SLL %0,24\;SRA %0,24\;C %0,%1\";
362 ; cmpdf instruction pattern(s).
367 (compare (match_operand:DF 0 "general_operand" "f,mF")
368 (match_operand:DF 1 "general_operand" "fmF,f")))]
373 if (FP_REG_P (operands[0]))
375 if (FP_REG_P (operands[1]))
377 mvs_check_page (0, 2, 0);
378 return \"CDR %0,%1\";
380 mvs_check_page (0, 4, 0);
383 cc_status.flags |= CC_REVERSED;
384 mvs_check_page (0, 4, 0);
389 ; cmpsf instruction pattern(s).
394 (compare (match_operand:SF 0 "general_operand" "f,mF")
395 (match_operand:SF 1 "general_operand" "fmF,f")))]
400 if (FP_REG_P (operands[0]))
402 if (FP_REG_P (operands[1]))
404 mvs_check_page (0, 2, 0);
405 return \"CER %0,%1\";
407 mvs_check_page (0, 4, 0);
410 cc_status.flags |= CC_REVERSED;
411 mvs_check_page (0, 4, 0);
416 ; cmpstrsi instruction pattern(s).
419 (define_expand "cmpstrsi"
420 [(set (match_operand:SI 0 "general_operand" "")
421 (compare (match_operand:BLK 1 "general_operand" "")
422 (match_operand:BLK 2 "general_operand" "")))
423 (use (match_operand:SI 3 "general_operand" ""))
424 (use (match_operand:SI 4 "" ""))]
430 op1 = XEXP (operands[1], 0);
431 if (GET_CODE (op1) == REG
432 || (GET_CODE (op1) == PLUS && GET_CODE (XEXP (op1, 0)) == REG
433 && GET_CODE (XEXP (op1, 1)) == CONST_INT
434 && (unsigned) INTVAL (XEXP (op1, 1)) < 4096))
440 op1 = gen_rtx (MEM, BLKmode, copy_to_mode_reg (SImode, op1));
443 op2 = XEXP (operands[2], 0);
444 if (GET_CODE (op2) == REG
445 || (GET_CODE (op2) == PLUS && GET_CODE (XEXP (op2, 0)) == REG
446 && GET_CODE (XEXP (op2, 1)) == CONST_INT
447 && (unsigned) INTVAL (XEXP (op2, 1)) < 4096))
453 op2 = gen_rtx (MEM, BLKmode, copy_to_mode_reg (SImode, op2));
456 if (GET_CODE (operands[3]) == CONST_INT && INTVAL (operands[3]) < 256)
458 emit_insn (gen_rtx (PARALLEL, VOIDmode, gen_rtvec (2,
459 gen_rtx (SET, VOIDmode, operands[0],
460 gen_rtx (COMPARE, VOIDmode, op1, op2)),
461 gen_rtx (USE, VOIDmode, operands[3]))));
465 rtx reg1 = gen_reg_rtx (DImode);
466 rtx reg2 = gen_reg_rtx (DImode);
467 rtx subreg = gen_rtx (SUBREG, SImode, reg1, 1);
469 emit_insn (gen_rtx (SET, VOIDmode, subreg, operands[3]));
470 emit_insn (gen_rtx (SET, VOIDmode, gen_rtx (SUBREG, SImode, reg2, 1),
472 emit_insn (gen_rtx (PARALLEL, VOIDmode, gen_rtvec (5,
473 gen_rtx (SET, VOIDmode, operands[0],
474 gen_rtx (COMPARE, VOIDmode, op1, op2)),
475 gen_rtx (USE, VOIDmode, reg1),
476 gen_rtx (USE, VOIDmode, reg2),
477 gen_rtx (CLOBBER, VOIDmode, reg1),
478 gen_rtx (CLOBBER, VOIDmode, reg2))));
483 ; Compare a block that is less than 256 bytes in length.
486 [(set (match_operand:SI 0 "register_operand" "d")
487 (compare (match_operand:BLK 1 "s_operand" "m")
488 (match_operand:BLK 2 "s_operand" "m")))
489 (use (match_operand:QI 3 "immediate_operand" "I"))]
490 "((unsigned) INTVAL (operands[3]) < 256)"
494 mvs_check_page (0, 22, 0);
495 return \"LA %0,1\;CLC %O1(%c3,%R1),%2\;BH *+12\;BL *+6\;SLR %0,%0\;LNR %0,%0\";
498 ; Compare a block that is larger than 255 bytes in length.
501 [(set (match_operand:SI 0 "register_operand" "d")
502 (compare (match_operand:BLK 1 "general_operand" "m")
503 (match_operand:BLK 2 "general_operand" "m")))
504 (use (match_operand:DI 3 "register_operand" "d"))
505 (use (match_operand:DI 4 "register_operand" "d"))
506 (clobber (match_dup 3))
507 (clobber (match_dup 4))]
512 mvs_check_page (0, 26, 0);
513 return \"LA %3,%1\;LA %4,%2\;LA %0,1\;CLCL %3,%4\;BH *+12\;BL *+6\;SLR %0,%0\;LNR %0,%0\";
517 ;;- Move instructions.
521 ; movdi instruction pattern(s).
525 [(set (match_operand:DI 0 "r_or_s_operand" "=dm")
526 (match_operand:DI 1 "r_or_s_operand" "dim*fF"))]
527 "TARGET_CHAR_INSTRUCTIONS"
531 if (REG_P (operands[0]))
533 if (FP_REG_P (operands[1]))
535 mvs_check_page (0, 8, 0);
536 return \"STD %1,140(,13)\;LM %0,%N0,140(13)\";
538 if (REG_P (operands[1]))
540 mvs_check_page (0, 4, 0);
541 return \"LR %0,%1\;LR %N0,%N1\";
543 if (operands[1] == const0_rtx)
546 mvs_check_page (0, 4, 0);
547 return \"SLR %0,%0\;SLR %N0,%N0\";
549 if (GET_CODE (operands[1]) == CONST_INT
550 && (unsigned) INTVAL (operands[1]) < 4096)
553 mvs_check_page (0, 6, 0);
554 return \"SLR %0,%0\;LA %N0,%c1\";
556 if (GET_CODE (operands[1]) == CONST_INT)
558 CC_STATUS_SET (operands[0], operands[1]);
559 mvs_check_page (0, 8, 0);
560 return \"L %0,%1\;SRDA %0,32\";
562 mvs_check_page (0, 4, 0);
563 return \"LM %0,%N0,%1\";
565 else if (FP_REG_P (operands[1]))
567 mvs_check_page (0, 4, 0);
568 return \"STD %1,%0\";
570 else if (REG_P (operands[1]))
572 mvs_check_page (0, 4, 0);
573 return \"STM %1,%N1,%0\";
575 mvs_check_page (0, 6, 0);
576 return \"MVC %O0(8,%R0),%1\";
580 [(set (match_operand:DI 0 "general_operand" "=dm")
581 (match_operand:DI 1 "general_operand" "dim*fF"))]
586 if (REG_P (operands[0]))
588 if (FP_REG_P (operands[1]))
590 mvs_check_page (0, 8, 0);
591 return \"STD %1,140(,13)\;LM %0,%N0,140(13)\";
593 if (REG_P (operands[1]))
595 mvs_check_page (0, 4, 0);
596 return \"LR %0,%1\;LR %N0,%N1\";
598 if (operands[1] == const0_rtx)
601 mvs_check_page (0, 4, 0);
602 return \"SLR %0,%0\;SLR %N0,%N0\";
604 if (GET_CODE (operands[1]) == CONST_INT
605 && (unsigned) INTVAL (operands[1]) < 4096)
608 mvs_check_page (0, 6, 0);
609 return \"SLR %0,%0\;LA %N0,%c1\";
611 if (GET_CODE (operands[1]) == CONST_INT)
613 CC_STATUS_SET (operands[0], operands[1]);
614 mvs_check_page (0, 8, 0);
615 return \"L %0,%1\;SRDA %0,32\";
617 mvs_check_page (0, 4, 0);
618 return \"LM %0,%N0,%1\";
620 else if (FP_REG_P (operands[1]))
622 mvs_check_page (0, 4, 0);
623 return \"STD %1,%0\";
625 mvs_check_page (0, 4, 0);
626 return \"STM %1,%N1,%0\";
630 ; movsi instruction pattern(s).
634 [(set (match_operand:SI 0 "r_or_s_operand" "=dm,dm")
635 (match_operand:SI 1 "r_or_s_operand" "dim,*fF"))]
636 "TARGET_CHAR_INSTRUCTIONS"
640 if (REG_P (operands[0]))
642 if (FP_REG_P (operands[1]))
644 mvs_check_page (0, 8, 0);
645 return \"STE %1,140(,13)\;L %0,140(,13)\";
647 if (REG_P (operands[1]))
649 mvs_check_page (0, 2, 0);
652 if (operands[1] == const0_rtx)
655 mvs_check_page (0, 2, 0);
656 return \"SLR %0,%0\";
658 if (GET_CODE (operands[1]) == CONST_INT
659 && (unsigned) INTVAL (operands[1]) < 4096)
661 mvs_check_page (0, 4, 0);
662 return \"LA %0,%c1\";
664 mvs_check_page (0, 4, 0);
667 else if (FP_REG_P (operands[1]))
669 mvs_check_page (0, 4, 0);
670 return \"STE %1,%0\";
672 else if (REG_P (operands[1]))
674 mvs_check_page (0, 4, 0);
677 mvs_check_page (0, 6, 0);
678 return \"MVC %O0(4,%R0),%1\";
682 [(set (match_operand:SI 0 "general_operand" "=d,dm")
683 (match_operand:SI 1 "general_operand" "dimF,*fd"))]
688 if (REG_P (operands[0]))
690 if (FP_REG_P (operands[1]))
692 mvs_check_page (0, 8, 0);
693 return \"STE %1,140(,13)\;L %0,140(,13)\";
695 if (REG_P (operands[1]))
697 mvs_check_page (0, 2, 0);
700 if (operands[1] == const0_rtx)
703 mvs_check_page (0, 2, 0);
704 return \"SLR %0,%0\";
706 if (GET_CODE (operands[1]) == CONST_INT
707 && (unsigned) INTVAL (operands[1]) < 4096)
709 mvs_check_page (0, 4, 0);
710 return \"LA %0,%c1\";
712 mvs_check_page (0, 4, 0);
715 else if (FP_REG_P (operands[1]))
717 mvs_check_page (0, 4, 0);
718 return \"STE %1,%0\";
720 mvs_check_page (0, 4, 0);
724 ;(define_expand "movsi"
725 ; [(set (match_operand:SI 0 "general_operand" "=d,dm")
726 ; (match_operand:SI 1 "general_operand" "dimF,*fd"))]
733 ; if (GET_CODE (op0) == CONST
734 ; && GET_CODE (XEXP (XEXP (op0, 0), 0)) == SYMBOL_REF
735 ; && SYMBOL_REF_FLAG (XEXP (XEXP (op0, 0), 0)))
737 ; op0 = gen_rtx (MEM, SImode, copy_to_mode_reg (SImode, XEXP (op0, 0)));
741 ; if (GET_CODE (op1) == CONST
742 ; && GET_CODE (XEXP (XEXP (op1, 0), 0)) == SYMBOL_REF
743 ; && SYMBOL_REF_FLAG (XEXP (XEXP (op1, 0), 0)))
745 ; op1 = gen_rtx (MEM, SImode, copy_to_mode_reg (SImode, XEXP (op1, 0)));
748 ; emit_insn (gen_rtx (SET, VOIDmode, op0, op1));
753 ; movhi instruction pattern(s).
757 [(set (match_operand:HI 0 "r_or_s_operand" "=g")
758 (match_operand:HI 1 "r_or_s_operand" "g"))]
759 "TARGET_CHAR_INSTRUCTIONS"
763 if (REG_P (operands[0]))
765 if (REG_P (operands[1]))
767 mvs_check_page (0, 2, 0);
770 if (operands[1] == const0_rtx)
773 mvs_check_page (0, 2, 0);
774 return \"SLR %0,%0\";
776 if (GET_CODE (operands[1]) == CONST_INT
777 && (unsigned) INTVAL (operands[1]) < 4096)
779 mvs_check_page (0, 4, 0);
780 return \"LA %0,%c1\";
782 if (GET_CODE (operands[1]) == CONST_INT)
784 mvs_check_page (0, 4, 0);
785 return \"LH %0,%H1\";
787 mvs_check_page (0, 4, 0);
790 else if (REG_P (operands[1]))
792 mvs_check_page (0, 4, 0);
793 return \"STH %1,%0\";
795 if (GET_CODE (operands[1]) == CONST_INT)
797 mvs_check_page (0, 6, 0);
798 return \"MVC %O0(2,%R0),%H1\";
800 mvs_check_page (0, 6, 0);
801 return \"MVC %O0(2,%R0),%1\";
805 [(set (match_operand:HI 0 "general_operand" "=d,m")
806 (match_operand:HI 1 "general_operand" "g,d"))]
811 if (REG_P (operands[0]))
813 if (REG_P (operands[1]))
815 mvs_check_page (0, 2, 0);
818 if (operands[1] == const0_rtx)
821 mvs_check_page (0, 2, 0);
822 return \"SLR %0,%0\";
824 if (GET_CODE (operands[1]) == CONST_INT
825 && (unsigned) INTVAL (operands[1]) < 4096)
827 mvs_check_page (0, 4, 0);
828 return \"LA %0,%c1\";
830 if (GET_CODE (operands[1]) == CONST_INT)
832 mvs_check_page (0, 4, 0);
833 return \"LH %0,%H1\";
835 mvs_check_page (0, 4, 0);
838 mvs_check_page (0, 4, 0);
839 return \"STH %1,%0\";
843 ; movqi instruction pattern(s).
847 [(set (match_operand:QI 0 "r_or_s_operand" "=g")
848 (match_operand:QI 1 "r_or_s_operand" "g"))]
849 "TARGET_CHAR_INSTRUCTIONS"
853 if (REG_P (operands[0]))
855 if (REG_P (operands[1]))
857 mvs_check_page (0, 2, 0);
860 if (operands[1] == const0_rtx)
863 mvs_check_page (0, 2, 0);
864 return \"SLR %0,%0\";
866 if (GET_CODE (operands[1]) == CONST_INT)
868 if (INTVAL (operands[1]) >= 0)
870 mvs_check_page (0, 4, 0);
871 return \"LA %0,%c1\";
873 mvs_check_page (0, 4, 0);
874 return \"L %0,=F'%c1'\";
876 mvs_check_page (0, 4, 0);
879 else if (REG_P (operands[1]))
881 mvs_check_page (0, 4, 0);
882 return \"STC %1,%0\";
884 else if (GET_CODE (operands[1]) == CONST_INT)
886 mvs_check_page (0, 4, 0);
887 return \"MVI %0,%B1\";
889 mvs_check_page (0, 6, 0);
890 return \"MVC %O0(1,%R0),%1\";
894 [(set (match_operand:QI 0 "general_operand" "=d,m")
895 (match_operand:QI 1 "general_operand" "g,d"))]
900 if (REG_P (operands[0]))
902 if (REG_P (operands[1]))
904 mvs_check_page (0, 2, 0);
907 if (operands[1] == const0_rtx)
910 mvs_check_page (0, 2, 0);
911 return \"SLR %0,%0\";
913 if (GET_CODE (operands[1]) == CONST_INT)
915 if (INTVAL (operands[1]) >= 0)
917 mvs_check_page (0, 4, 0);
918 return \"LA %0,%c1\";
920 mvs_check_page (0, 4, 0);
921 return \"L %0,=F'%c1'\";
923 mvs_check_page (0, 4, 0);
926 mvs_check_page (0, 4, 0);
927 return \"STC %1,%0\";
931 ; movestrictqi instruction pattern(s).
934 (define_insn "movestrictqi"
935 [(set (strict_low_part (match_operand:QI 0 "general_operand" "=d"))
936 (match_operand:QI 1 "general_operand" "g"))]
941 if (REG_P (operands[1]))
943 mvs_check_page (0, 8, 0);
944 return \"STC %1,140(,13)\;IC %0,140(,13)\";
946 mvs_check_page (0, 4, 0);
951 ; movstricthi instruction pattern(s).
955 [(set (strict_low_part (match_operand:HI 0 "register_operand" "=d"))
956 (match_operand:HI 1 "r_or_s_operand" "g"))]
961 if (REG_P (operands[1]))
963 mvs_check_page (0, 8, 0);
964 return \"STH %1,140(,13)\;ICM %0,3,140(13)\";
966 else if (GET_CODE (operands[1]) == CONST_INT)
968 mvs_check_page (0, 4, 0);
969 return \"ICM %0,3,%H1\";
971 mvs_check_page (0, 4, 0);
972 return \"ICM %0,3,%1\";
975 (define_insn "movestricthi"
976 [(set (strict_low_part (match_operand:HI 0 "general_operand" "=dm"))
977 (match_operand:HI 1 "general_operand" "d"))]
982 if (REG_P (operands[0]))
984 mvs_check_page (0, 8, 0);
985 return \"STH %1,140(,13)\;ICM %0,3,140(13)\";
987 mvs_check_page (0, 4, 0);
988 return \"STH %1,%0\";
992 ; movdf instruction pattern(s).
996 [(set (match_operand:DF 0 "r_or_s_operand" "=fm,fm,*dm")
997 (match_operand:DF 1 "r_or_s_operand" "fmF,*dm,fmF"))]
998 "TARGET_CHAR_INSTRUCTIONS"
1001 check_label_emit ();
1002 if (FP_REG_P (operands[0]))
1004 if (FP_REG_P (operands[1]))
1006 mvs_check_page (0, 2, 0);
1007 return \"LDR %0,%1\";
1009 if (REG_P (operands[1]))
1011 mvs_check_page (0, 8, 0);
1012 return \"STM %1,%N1,140(13)\;LD %0,140(,13)\";
1014 if (operands[1] == const0_rtx)
1016 CC_STATUS_SET (operands[0], operands[1]);
1017 mvs_check_page (0, 2, 0);
1018 return \"SDR %0,%0\";
1020 mvs_check_page (0, 4, 0);
1021 return \"LD %0,%1\";
1023 if (REG_P (operands[0]))
1025 if (FP_REG_P (operands[1]))
1027 mvs_check_page (0, 12, 0);
1028 return \"STD %1,140(,13)\;LM %0,%N0,140(13)\";
1030 mvs_check_page (0, 4, 0);
1031 return \"LM %0,%N0,%1\";
1033 else if (FP_REG_P (operands[1]))
1035 mvs_check_page (0, 4, 0);
1036 return \"STD %1,%0\";
1038 else if (REG_P (operands[1]))
1040 mvs_check_page (0, 4, 0);
1041 return \"STM %1,%N1,%0\";
1043 mvs_check_page (0, 6, 0);
1044 return \"MVC %O0(8,%R0),%1\";
1047 (define_insn "movdf"
1048 [(set (match_operand:DF 0 "general_operand" "=f,fm,m,*d")
1049 (match_operand:DF 1 "general_operand" "fmF,*d,f,fmF"))]
1053 check_label_emit ();
1054 if (FP_REG_P (operands[0]))
1056 if (FP_REG_P (operands[1]))
1058 mvs_check_page (0, 2, 0);
1059 return \"LDR %0,%1\";
1061 if (REG_P (operands[1]))
1063 mvs_check_page (0, 8, 0);
1064 return \"STM %1,%N1,140(13)\;LD %0,140(,13)\";
1066 if (operands[1] == const0_rtx)
1068 CC_STATUS_SET (operands[0], operands[1]);
1069 mvs_check_page (0, 2, 0);
1070 return \"SDR %0,%0\";
1072 mvs_check_page (0, 4, 0);
1073 return \"LD %0,%1\";
1075 else if (REG_P (operands[0]))
1077 if (FP_REG_P (operands[1]))
1079 mvs_check_page (0, 12, 0);
1080 return \"STD %1,140(,13)\;LM %0,%N0,140(13)\";
1082 mvs_check_page (0, 4, 0);
1083 return \"LM %0,%N0,%1\";
1085 else if (FP_REG_P (operands[1]))
1087 mvs_check_page (0, 4, 0);
1088 return \"STD %1,%0\";
1090 mvs_check_page (0, 4, 0);
1091 return \"STM %1,%N1,%0\";
1095 ; movsf instruction pattern(s).
1099 [(set (match_operand:SF 0 "r_or_s_operand" "=fm,fm,*dm")
1100 (match_operand:SF 1 "r_or_s_operand" "fmF,*dm,fmF"))]
1101 "TARGET_CHAR_INSTRUCTIONS"
1104 check_label_emit ();
1105 if (FP_REG_P (operands[0]))
1107 if (FP_REG_P (operands[1]))
1109 mvs_check_page (0, 2, 0);
1110 return \"LER %0,%1\";
1112 if (REG_P (operands[1]))
1114 mvs_check_page (0, 8, 0);
1115 return \"ST %1,140(,13)\;LE %0,140(,13)\";
1117 if (operands[1] == const0_rtx)
1119 CC_STATUS_SET (operands[0], operands[1]);
1120 mvs_check_page (0, 2, 0);
1121 return \"SER %0,%0\";
1123 mvs_check_page (0, 4, 0);
1124 return \"LE %0,%1\";
1126 else if (REG_P (operands[0]))
1128 if (FP_REG_P (operands[1]))
1130 mvs_check_page (0, 8, 0);
1131 return \"STE %1,140(,13)\;L %0,140(,13)\";
1133 mvs_check_page (0, 4, 0);
1136 else if (FP_REG_P (operands[1]))
1138 mvs_check_page (0, 4, 0);
1139 return \"STE %1,%0\";
1141 else if (REG_P (operands[1]))
1143 mvs_check_page (0, 4, 0);
1144 return \"ST %1,%0\";
1146 mvs_check_page (0, 6, 0);
1147 return \"MVC %O0(4,%R0),%1\";
1150 (define_insn "movsf"
1151 [(set (match_operand:SF 0 "general_operand" "=f,fm,m,*d")
1152 (match_operand:SF 1 "general_operand" "fmF,*d,f,fmF"))]
1156 check_label_emit ();
1157 if (FP_REG_P (operands[0]))
1159 if (FP_REG_P (operands[1]))
1161 mvs_check_page (0, 2, 0);
1162 return \"LER %0,%1\";
1164 if (REG_P (operands[1]))
1166 mvs_check_page (0, 8, 0);
1167 return \"ST %1,140(,13)\;LE %0,140(,13)\";
1169 if (operands[1] == const0_rtx)
1171 CC_STATUS_SET (operands[0], operands[1]);
1172 mvs_check_page (0, 2, 0);
1173 return \"SER %0,%0\";
1175 mvs_check_page (0, 4, 0);
1176 return \"LE %0,%1\";
1178 else if (REG_P (operands[0]))
1180 if (FP_REG_P (operands[1]))
1182 mvs_check_page (0, 8, 0);
1183 return \"STE %1,140(,13)\;L %0,140(,13)\";
1185 mvs_check_page (0, 4, 0);
1188 else if (FP_REG_P (operands[1]))
1190 mvs_check_page (0, 4, 0);
1191 return \"STE %1,%0\";
1193 mvs_check_page (0, 4, 0);
1194 return \"ST %1,%0\";
1198 ; movstrsi instruction pattern(s).
1201 (define_expand "movstrsi"
1202 [(set (match_operand:BLK 0 "general_operand" "")
1203 (match_operand:BLK 1 "general_operand" ""))
1204 (use (match_operand:SI 2 "general_operand" ""))
1205 (match_operand 3 "" "")]
1211 op0 = XEXP (operands[0], 0);
1212 if (GET_CODE (op0) == REG
1213 || (GET_CODE (op0) == PLUS && GET_CODE (XEXP (op0, 0)) == REG
1214 && GET_CODE (XEXP (op0, 1)) == CONST_INT
1215 && (unsigned) INTVAL (XEXP (op0, 1)) < 4096))
1218 op0 = change_address (operands[0], VOIDmode,
1219 copy_to_mode_reg (SImode, op0));
1221 op1 = XEXP (operands[1], 0);
1222 if (GET_CODE (op1) == REG
1223 || (GET_CODE (op1) == PLUS && GET_CODE (XEXP (op1, 0)) == REG
1224 && GET_CODE (XEXP (op1, 1)) == CONST_INT
1225 && (unsigned) INTVAL (XEXP (op1, 1)) < 4096))
1228 op1 = change_address (operands[1], VOIDmode,
1229 copy_to_mode_reg (SImode, op1));
1231 if (GET_CODE (operands[2]) == CONST_INT && INTVAL (operands[2]) < 256)
1232 emit_insn (gen_rtx (PARALLEL, VOIDmode,
1234 gen_rtx (SET, VOIDmode, op0, op1),
1235 gen_rtx (USE, VOIDmode, operands[2]))));
1239 rtx reg1 = gen_reg_rtx (DImode);
1240 rtx reg2 = gen_reg_rtx (DImode);
1241 rtx subreg = gen_rtx (SUBREG, SImode, reg1, 1);
1243 emit_insn (gen_rtx (SET, VOIDmode, subreg, operands[2]));
1244 emit_insn (gen_rtx (SET, VOIDmode, gen_rtx (SUBREG, SImode, reg2, 1),
1246 emit_insn (gen_rtx (PARALLEL, VOIDmode,
1248 gen_rtx (SET, VOIDmode, op0, op1),
1249 gen_rtx (USE, VOIDmode, reg1),
1250 gen_rtx (USE, VOIDmode, reg2),
1251 gen_rtx (CLOBBER, VOIDmode, reg1),
1252 gen_rtx (CLOBBER, VOIDmode, reg2))));
1257 ; Move a block that is less than 256 bytes in length.
1260 [(set (match_operand:BLK 0 "s_operand" "=m")
1261 (match_operand:BLK 1 "s_operand" "m"))
1262 (use (match_operand 2 "immediate_operand" "I"))]
1263 "((unsigned) INTVAL (operands[2]) < 256)"
1266 check_label_emit ();
1267 mvs_check_page (0, 6, 0);
1268 return \"MVC %O0(%c2,%R0),%1\";
1271 ; Move a block that is larger than 255 bytes in length.
1274 [(set (match_operand:BLK 0 "general_operand" "=m")
1275 (match_operand:BLK 1 "general_operand" "m"))
1276 (use (match_operand:DI 2 "register_operand" "d"))
1277 (use (match_operand:DI 3 "register_operand" "d"))
1278 (clobber (match_dup 2))
1279 (clobber (match_dup 3))]
1283 check_label_emit ();
1284 mvs_check_page (0, 10, 0);
1285 return \"LA %2,%0\;LA %3,%1\;MVCL %2,%3\";
1289 ;;- Conversion instructions.
1293 ; extendsidi2 instruction pattern(s).
1296 (define_expand "extendsidi2"
1297 [(set (match_operand:DI 0 "general_operand" "")
1298 (sign_extend:DI (match_operand:SI 1 "general_operand" "")))]
1302 if (GET_CODE (operands[1]) != CONST_INT)
1304 emit_insn (gen_rtx (SET, VOIDmode,
1305 operand_subword (operands[0], 0, 1, DImode), operands[1]));
1306 emit_insn (gen_rtx (SET, VOIDmode, operands[0],
1307 gen_rtx (ASHIFTRT, DImode, operands[0],
1312 if (INTVAL (operands[1]) < 0)
1314 emit_insn (gen_rtx (SET, VOIDmode,
1315 operand_subword (operands[0], 0, 1, DImode),
1320 emit_insn (gen_rtx (SET, VOIDmode,
1321 operand_subword (operands[0], 0, 1, DImode),
1324 emit_insn (gen_rtx (SET, VOIDmode, gen_lowpart (SImode, operands[0]),
1331 ; extendhisi2 instruction pattern(s).
1334 (define_insn "extendhisi2"
1335 [(set (match_operand:SI 0 "general_operand" "=d,m")
1336 (sign_extend:SI (match_operand:HI 1 "general_operand" "g,d")))]
1340 check_label_emit ();
1341 if (REG_P (operands[0]))
1343 if (REG_P (operands[1]))
1344 if (REGNO (operands[0]) != REGNO (operands[1]))
1346 mvs_check_page (0, 2, 0);
1347 return \"LR %0,%1\;SLL %0,16\;SRA %0,16\";
1350 return \"\"; /* Should be empty. 16-bits regs are always 32-bits. */
1351 if (operands[1] == const0_rtx)
1354 mvs_check_page (0, 2, 0);
1355 return \"SLR %0,%0\";
1357 if (GET_CODE (operands[1]) == CONST_INT
1358 && (unsigned) INTVAL (operands[1]) < 4096)
1360 mvs_check_page (0, 4, 0);
1361 return \"LA %0,%c1\";
1363 if (GET_CODE (operands[1]) == CONST_INT)
1365 mvs_check_page (0, 4, 0);
1366 return \"LH %0,%H1\";
1368 mvs_check_page (0, 4, 0);
1369 return \"LH %0,%1\";
1371 mvs_check_page (0, 4, 0);
1372 return \"SLL %1,16\;SRA %1,16\;ST %1,%0\";
1376 ; extendqisi2 instruction pattern(s).
1379 (define_insn "extendqisi2"
1380 [(set (match_operand:SI 0 "general_operand" "=d")
1381 (sign_extend:SI (match_operand:QI 1 "general_operand" "0mi")))]
1385 check_label_emit ();
1386 CC_STATUS_SET (operands[0], operands[1]);
1387 if (REG_P (operands[1]))
1389 mvs_check_page (0, 8, 0);
1390 return \"SLL %0,24\;SRA %0,24\";
1392 if (s_operand (operands[1]))
1394 mvs_check_page (0, 8, 0);
1395 return \"ICM %0,8,%1\;SRA %0,24\";
1397 mvs_check_page (0, 12, 0);
1398 return \"IC %0,%1\;SLL %0,24\;SRA %0,24\";
1402 ; extendqihi2 instruction pattern(s).
1405 (define_insn "extendqihi2"
1406 [(set (match_operand:HI 0 "general_operand" "=d")
1407 (sign_extend:HI (match_operand:QI 1 "general_operand" "0m")))]
1411 check_label_emit ();
1412 CC_STATUS_SET (operands[0], operands[1]);
1413 if (REG_P (operands[1]))
1415 mvs_check_page (0, 8, 0);
1416 return \"SLL %0,24\;SRA %0,24\";
1418 if (s_operand (operands[1]))
1420 mvs_check_page (0, 8, 0);
1421 return \"ICM %0,8,%1\;SRA %0,24\";
1423 mvs_check_page (0, 12, 0);
1424 return \"IC %0,%1\;SLL %0,24\;SRA %0,24\";
1428 ; zero_extendsidi2 instruction pattern(s).
1431 (define_expand "zero_extendsidi2"
1432 [(set (match_operand:DI 0 "general_operand" "")
1433 (zero_extend:DI (match_operand:SI 1 "general_operand" "")))]
1437 emit_insn (gen_rtx (SET, VOIDmode,
1438 operand_subword (operands[0], 0, 1, DImode), operands[1]));
1439 emit_insn (gen_rtx (SET, VOIDmode, operands[0],
1440 gen_rtx (LSHIFTRT, DImode, operands[0],
1446 ; zero_extendhisi2 instruction pattern(s).
1449 (define_insn "zero_extendhisi2"
1450 [(set (match_operand:SI 0 "general_operand" "=d")
1451 (zero_extend:SI (match_operand:HI 1 "general_operand" "0")))]
1455 check_label_emit ();
1456 CC_STATUS_SET (operands[0], operands[1]);
1457 mvs_check_page (0, 4, 4);
1458 return \"N %1,=X'0000FFFF'\";
1462 ; zero_extendqisi2 instruction pattern(s).
1465 (define_insn "zero_extendqisi2"
1466 [(set (match_operand:SI 0 "general_operand" "=d,&d")
1467 (zero_extend:SI (match_operand:QI 1 "general_operand" "0i,m")))]
1471 check_label_emit ();
1472 if (REG_P (operands[1]))
1474 CC_STATUS_SET (operands[0], operands[1]);
1475 mvs_check_page (0, 4, 4);
1476 return \"N %0,=X'000000FF'\";
1478 if (GET_CODE (operands[1]) == CONST_INT)
1480 mvs_check_page (0, 4, 0);
1481 return \"LA %0,%c1\";
1484 mvs_check_page (0, 8, 0);
1485 return \"SLR %0,%0\;IC %0,%1\";
1489 ; zero_extendqihi2 instruction pattern(s).
1492 (define_insn "zero_extendqihi2"
1493 [(set (match_operand:HI 0 "general_operand" "=d,&d")
1494 (zero_extend:HI (match_operand:QI 1 "general_operand" "0i,m")))]
1498 check_label_emit ();
1499 if (REG_P (operands[1]))
1501 CC_STATUS_SET (operands[0], operands[1]);
1502 mvs_check_page (0, 4, 4);
1503 return \"N %0,=X'000000FF'\";
1505 if (GET_CODE (operands[1]) == CONST_INT)
1507 mvs_check_page (0, 4, 0);
1508 return \"LA %0,%c1\";
1511 mvs_check_page (0, 8, 0);
1512 return \"SLR %0,%0\;IC %0,%1\";
1516 ; truncsihi2 instruction pattern(s).
1519 (define_insn "truncsihi2"
1520 [(set (match_operand:HI 0 "general_operand" "=d,m")
1521 (truncate:HI (match_operand:SI 1 "general_operand" "0,d")))]
1525 check_label_emit ();
1526 if (REG_P (operands[0]))
1528 CC_STATUS_SET (operands[0], operands[1]);
1529 mvs_check_page (0, 8, 0);
1530 return \"SLL %0,16\;SRA %0,16\";
1532 mvs_check_page (0, 4, 0);
1533 return \"STH %1,%0\";
1537 ; fix_truncdfsi2 instruction pattern(s).
1540 (define_insn "fix_truncdfsi2"
1541 [(set (match_operand:SI 0 "general_operand" "=d")
1542 (fix:SI (truncate:DF (match_operand:DF 1 "general_operand" "f"))))
1543 (clobber (reg:DF 16))]
1547 check_label_emit ();
1549 if (REGNO (operands[1]) == 16)
1551 mvs_check_page (0, 12, 8);
1552 return \"AD 0,=XL8'4F08000000000000'\;STD 0,140(,13)\;L %0,144(,13)\";
1554 mvs_check_page (0, 14, 8);
1555 return \"LDR 0,%1\;AD 0,=XL8'4F08000000000000'\;STD 0,140(,13)\;L %0,144(,13)\";
1559 ; floatsidf2 instruction pattern(s).
1561 ; Uses the float field of the TCA.
1564 (define_insn "floatsidf2"
1565 [(set (match_operand:DF 0 "general_operand" "=f")
1566 (float:DF (match_operand:SI 1 "general_operand" "d")))]
1570 check_label_emit ();
1572 mvs_check_page (0, 16, 8);
1573 return \"ST %1,508(,12)\;XI 508(12),128\;LD %0,504(,12)\;SD %0,=XL8'4E00000080000000'\";
1577 ; truncdfsf2 instruction pattern(s).
1580 (define_insn "truncdfsf2"
1581 [(set (match_operand:SF 0 "general_operand" "=f")
1582 (float_truncate:SF (match_operand:DF 1 "general_operand" "f")))]
1586 check_label_emit ();
1587 mvs_check_page (0, 2, 0);
1588 return \"LRER %0,%1\";
1592 ; extendsfdf2 instruction pattern(s).
1595 (define_insn "extendsfdf2"
1596 [(set (match_operand:DF 0 "general_operand" "=f")
1597 (float_extend:DF (match_operand:SF 1 "general_operand" "fmF")))]
1601 check_label_emit ();
1602 CC_STATUS_SET (0, const0_rtx);
1603 if (FP_REG_P (operands[1]))
1605 if (REGNO (operands[0]) == REGNO (operands[1]))
1607 mvs_check_page (0, 10, 0);
1608 return \"STE %1,140(,13)\;SDR %0,%0\;LE %0,140(,13)\";
1610 mvs_check_page (0, 4, 0);
1611 return \"SDR %0,%0\;LER %0,%1\";
1613 mvs_check_page (0, 6, 0);
1614 return \"SDR %0,%0\;LE %0,%1\";
1618 ;;- Add instructions.
1622 ; adddi3 instruction pattern(s).
1625 (define_expand "adddi3"
1626 [(set (match_operand:DI 0 "general_operand" "")
1627 (plus:DI (match_operand:DI 1 "general_operand" "")
1628 (match_operand:DI 2 "general_operand" "")))]
1632 rtx label = gen_label_rtx ();
1633 rtx op0_high = operand_subword (operands[0], 0, 1, DImode);
1634 rtx op0_low = gen_lowpart (SImode, operands[0]);
1636 emit_insn (gen_rtx (SET, VOIDmode, op0_high,
1637 gen_rtx (PLUS, SImode,
1638 operand_subword (operands[1], 0, 1, DImode),
1639 operand_subword (operands[2], 0, 1, DImode))));
1640 emit_jump_insn (gen_rtx (PARALLEL, VOIDmode, gen_rtvec (2,
1641 gen_rtx (SET, VOIDmode, op0_low,
1642 gen_rtx (PLUS, SImode, gen_lowpart (SImode, operands[1]),
1643 gen_lowpart (SImode, operands[2]))),
1644 gen_rtx (USE, VOIDmode, gen_rtx (LABEL_REF, VOIDmode, label)))));
1645 emit_insn (gen_rtx (SET, VOIDmode, op0_high,
1646 gen_rtx (PLUS, SImode, op0_high,
1653 [(set (match_operand:SI 0 "general_operand" "=d")
1654 (plus:SI (match_operand:SI 1 "general_operand" "%0")
1655 (match_operand:SI 2 "general_operand" "g")))
1656 (use (label_ref (match_operand 3 "" "")))]
1662 check_label_emit ();
1663 onpage = mvs_check_label (CODE_LABEL_NUMBER (operands[3]));
1664 if (REG_P (operands[2]))
1668 mvs_check_page (0, 8, 4);
1669 return \"ALR %0,%2\;L 14,=A(%l3)\;BCR 12,14\";
1671 if (mvs_check_page (0, 6, 0))
1673 mvs_check_page (0, 2, 4);
1674 return \"ALR %0,%2\;L 14,=A(%l3)\;BCR 12,14\";
1676 return \"ALR %0,%2\;BC 12,%l3\";
1680 mvs_check_page (0, 10, 4);
1681 return \"AL %0,%2\;L 14,=A(%l3)\;BCR 12,14\";
1683 if (mvs_check_page (0, 8 ,0))
1685 mvs_check_page (0, 2, 4);
1686 return \"AL %0,%2\;L 14,=A(%l3)\;BCR 12,14\";
1688 return \"AL %0,%2\;BC 12,%l3\";
1692 ; addsi3 instruction pattern(s).
1694 ; The following insn is used when it is known that operand one is an address,
1695 ; frame, stack or argument pointer, and operand two is a constant that is
1696 ; small enough to fit in the displacement field.
1697 ; Notice that we can't allow the frame pointer to used as a normal register
1698 ; because of this insn.
1702 [(set (match_operand:SI 0 "register_operand" "=d")
1703 (plus:SI (match_operand:SI 1 "general_operand" "%a")
1704 (match_operand:SI 2 "immediate_operand" "J")))]
1705 "((REGNO (operands[1]) == FRAME_POINTER_REGNUM || REGNO (operands[1]) == ARG_POINTER_REGNUM || REGNO (operands[1]) == STACK_POINTER_REGNUM) && (unsigned) INTVAL (operands[2]) < 4096)"
1708 check_label_emit ();
1710 mvs_check_page (0, 4, 0);
1711 return \"LA %0,%c2(,%1)\";
1714 ; This insn handles additions that are relative to the frame pointer.
1717 [(set (match_operand:SI 0 "register_operand" "=d")
1718 (plus:SI (match_operand:SI 1 "register_operand" "%a")
1719 (match_operand:SI 2 "immediate_operand" "i")))]
1720 "REGNO (operands[1]) == FRAME_POINTER_REGNUM"
1723 check_label_emit ();
1724 if ((unsigned) INTVAL (operands[2]) < 4096)
1726 mvs_check_page (0, 4, 0);
1727 return \"LA %0,%c2(,%1)\";
1729 if (REGNO (operands[1]) == REGNO (operands[0]))
1731 mvs_check_page (0, 4, 0);
1734 mvs_check_page (0, 6, 0);
1735 return \"L %0,%2\;AR %0,%1\";
1738 (define_insn "addsi3"
1739 [(set (match_operand:SI 0 "general_operand" "=d")
1740 (plus:SI (match_operand:SI 1 "general_operand" "%0")
1741 (match_operand:SI 2 "general_operand" "g")))]
1745 check_label_emit ();
1746 if (REG_P (operands[2]))
1748 mvs_check_page (0, 2, 0);
1749 return \"AR %0,%2\";
1751 if (GET_CODE (operands[2]) == CONST_INT)
1753 if (INTVAL (operands[2]) == -1)
1756 mvs_check_page (0, 2, 0);
1757 return \"BCTR %0,0\";
1760 mvs_check_page (0, 4, 0);
1765 ; addhi3 instruction pattern(s).
1768 (define_insn "addhi3"
1769 [(set (match_operand:HI 0 "general_operand" "=d")
1770 (plus:HI (match_operand:HI 1 "general_operand" "%0")
1771 (match_operand:HI 2 "general_operand" "dmi")))]
1775 check_label_emit ();
1776 if (REG_P (operands[2]))
1778 mvs_check_page (0, 8, 0);
1779 return \"STH %2,140(,13)\;AH %0,140(,13)\";
1781 if (GET_CODE (operands[2]) == CONST_INT)
1783 if (INTVAL (operands[2]) == -1)
1786 mvs_check_page (0, 2, 0);
1787 return \"BCTR %0,0\";
1789 mvs_check_page (0, 4, 0);
1790 return \"AH %0,%H2\";
1792 mvs_check_page (0, 4, 0);
1793 return \"AH %0,%2\";
1797 ; addqi3 instruction pattern(s).
1800 (define_insn "addqi3"
1801 [(set (match_operand:QI 0 "general_operand" "=d")
1802 (plus:QI (match_operand:QI 1 "general_operand" "%a")
1803 (match_operand:QI 2 "general_operand" "ai")))]
1807 check_label_emit ();
1809 mvs_check_page (0, 4, 0);
1810 if (REG_P (operands[2]))
1811 return \"LA %0,0(%1,%2)\";
1812 return \"LA %0,%B2(,%1)\";
1816 ; adddf3 instruction pattern(s).
1819 (define_insn "adddf3"
1820 [(set (match_operand:DF 0 "general_operand" "=f")
1821 (plus:DF (match_operand:DF 1 "general_operand" "%0")
1822 (match_operand:DF 2 "general_operand" "fmF")))]
1826 check_label_emit ();
1827 if (FP_REG_P (operands[2]))
1829 mvs_check_page (0, 2, 0);
1830 return \"ADR %0,%2\";
1832 mvs_check_page (0, 4, 0);
1833 return \"AD %0,%2\";
1837 ; addsf3 instruction pattern(s).
1840 (define_insn "addsf3"
1841 [(set (match_operand:SF 0 "general_operand" "=f")
1842 (plus:SF (match_operand:SF 1 "general_operand" "%0")
1843 (match_operand:SF 2 "general_operand" "fmF")))]
1847 check_label_emit ();
1848 if (FP_REG_P (operands[2]))
1850 mvs_check_page (0, 2, 0);
1851 return \"AER %0,%2\";
1853 mvs_check_page (0, 4, 0);
1854 return \"AE %0,%2\";
1858 ;;- Subtract instructions.
1862 ; subdi3 instruction pattern(s).
1865 (define_expand "subdi3"
1866 [(set (match_operand:DI 0 "general_operand" "")
1867 (minus:DI (match_operand:DI 1 "general_operand" "")
1868 (match_operand:DI 2 "general_operand" "")))]
1872 rtx label = gen_label_rtx ();
1873 rtx op0_high = operand_subword (operands[0], 0, 1, DImode);
1874 rtx op0_low = gen_lowpart (SImode, operands[0]);
1876 emit_insn (gen_rtx (SET, VOIDmode, op0_high,
1877 gen_rtx (MINUS, SImode,
1878 operand_subword (operands[1], 0, 1, DImode),
1879 operand_subword (operands[2], 0, 1, DImode))));
1880 emit_jump_insn (gen_rtx (PARALLEL, VOIDmode, gen_rtvec (2,
1881 gen_rtx (SET, VOIDmode, op0_low,
1882 gen_rtx (MINUS, SImode,
1883 gen_lowpart (SImode, operands[1]),
1884 gen_lowpart (SImode, operands[2]))),
1885 gen_rtx (USE, VOIDmode,
1886 gen_rtx (LABEL_REF, VOIDmode, label)))));
1887 emit_insn (gen_rtx (SET, VOIDmode, op0_high,
1888 gen_rtx (MINUS, SImode, op0_high,
1895 [(set (match_operand:SI 0 "general_operand" "=d")
1896 (minus:SI (match_operand:SI 1 "general_operand" "0")
1897 (match_operand:SI 2 "general_operand" "g")))
1898 (use (label_ref (match_operand 3 "" "")))]
1904 check_label_emit ();
1906 onpage = mvs_check_label (CODE_LABEL_NUMBER (operands[3]));
1907 if (REG_P (operands[2]))
1911 mvs_check_page (0, 8, 4);
1912 return \"SLR %0,%2\;L 14,=A(%l3)\;BCR 12,14\";
1914 if (mvs_check_page (0, 6, 0))
1916 mvs_check_page (0, 2, 4);
1917 return \"SLR %0,%2\;L 14,=A(%l3)\;BCR 12,14\";
1919 return \"SLR %0,%2\;BC 12,%l3\";
1923 mvs_check_page (0, 10, 4);
1924 return \"SL %0,%2\;L 14,=A(%l3)\;BCR 12,14\";
1926 if (mvs_check_page (0, 8, 0))
1928 mvs_check_page (0, 2, 4);
1929 return \"SL %0,%2\;L 14,=A(%l3)\;BCR 12,14\";
1931 return \"SL %0,%2\;BC 12,%l3\";
1935 ; subsi3 instruction pattern(s).
1938 (define_insn "subsi3"
1939 [(set (match_operand:SI 0 "general_operand" "=d")
1940 (minus:SI (match_operand:SI 1 "general_operand" "0")
1941 (match_operand:SI 2 "general_operand" "g")))]
1945 check_label_emit ();
1946 if (REG_P (operands[2]))
1948 mvs_check_page (0, 2, 0);
1949 return \"SR %0,%2\";
1951 if (operands[2] == const1_rtx)
1954 mvs_check_page (0, 2, 0);
1955 return \"BCTR %0,0\";
1957 mvs_check_page (0, 4, 0);
1962 ; subhi3 instruction pattern(s).
1965 (define_insn "subhi3"
1966 [(set (match_operand:HI 0 "general_operand" "=d")
1967 (minus:HI (match_operand:HI 1 "general_operand" "0")
1968 (match_operand:HI 2 "general_operand" "g")))]
1972 check_label_emit ();
1973 if (REG_P (operands[2]))
1975 mvs_check_page (0, 8, 0);
1976 return \"STH %2,140(,13)\;SH %0,140(,13)\";
1978 if (operands[2] == const1_rtx)
1981 mvs_check_page (0, 2, 0);
1982 return \"BCTR %0,0\";
1984 if (GET_CODE (operands[2]) == CONST_INT)
1986 mvs_check_page (0, 4, 0);
1987 return \"SH %0,%H2\";
1989 mvs_check_page (0, 4, 0);
1990 return \"SH %0,%2\";
1994 ; subqi3 instruction pattern(s).
1997 (define_expand "subqi3"
1998 [(set (match_operand:QI 0 "general_operand" "=d")
1999 (minus:QI (match_operand:QI 1 "general_operand" "0")
2000 (match_operand:QI 2 "general_operand" "di")))]
2004 if (REG_P (operands[2]))
2006 emit_insn (gen_rtx (SET, VOIDmode, operands[0],
2007 gen_rtx (MINUS, QImode, operands[1], operands[2])));
2011 emit_insn (gen_rtx (SET, VOIDmode, operands[0],
2012 gen_rtx (PLUS, QImode, operands[1],
2013 negate_rtx (QImode, operands[2]))));
2019 [(set (match_operand:QI 0 "register_operand" "=d")
2020 (minus:QI (match_operand:QI 1 "register_operand" "0")
2021 (match_operand:QI 2 "register_operand" "d")))]
2025 check_label_emit ();
2027 mvs_check_page (0, 2, 0);
2028 return \"SR %0,%2\";
2032 ; subdf3 instruction pattern(s).
2035 (define_insn "subdf3"
2036 [(set (match_operand:DF 0 "general_operand" "=f")
2037 (minus:DF (match_operand:DF 1 "general_operand" "0")
2038 (match_operand:DF 2 "general_operand" "fmF")))]
2042 check_label_emit ();
2043 if (FP_REG_P (operands[2]))
2045 mvs_check_page (0, 2, 0);
2046 return \"SDR %0,%2\";
2048 mvs_check_page (0, 4, 0);
2049 return \"SD %0,%2\";
2053 ; subsf3 instruction pattern(s).
2056 (define_insn "subsf3"
2057 [(set (match_operand:SF 0 "general_operand" "=f")
2058 (minus:SF (match_operand:SF 1 "general_operand" "0")
2059 (match_operand:SF 2 "general_operand" "fmF")))]
2063 check_label_emit ();
2064 if (FP_REG_P (operands[2]))
2066 mvs_check_page (0, 2, 0);
2067 return \"SER %0,%2\";
2069 mvs_check_page (0, 4, 0);
2070 return \"SE %0,%2\";
2074 ;;- Multiply instructions.
2078 ; mulsi3 instruction pattern(s).
2081 (define_expand "mulsi3"
2082 [(set (match_operand:SI 0 "general_operand" "")
2083 (mult:SI (match_operand:SI 1 "general_operand" "")
2084 (match_operand:SI 2 "general_operand" "")))]
2088 if (GET_CODE (operands[1]) == CONST_INT
2089 && CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'K'))
2091 emit_insn (gen_rtx (SET, VOIDmode, operands[0],
2092 gen_rtx (MULT, SImode, operands[2], operands[1])));
2094 else if (GET_CODE (operands[2]) == CONST_INT
2095 && CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), 'K'))
2097 emit_insn (gen_rtx (SET, VOIDmode, operands[0],
2098 gen_rtx (MULT, SImode, operands[1], operands[2])));
2102 rtx r = gen_reg_rtx (DImode);
2104 emit_insn (gen_rtx (SET, VOIDmode,
2105 gen_rtx (SUBREG, SImode, r, 1), operands[1]));
2106 emit_insn (gen_rtx (SET, VOIDmode, r,
2107 gen_rtx (MULT, SImode, r, operands[2])));
2108 emit_insn (gen_rtx (SET, VOIDmode, operands[0],
2109 gen_rtx (SUBREG, SImode, r, 1)));
2115 [(set (match_operand:SI 0 "register_operand" "=d")
2116 (mult:SI (match_operand:SI 1 "general_operand" "%0")
2117 (match_operand:SI 2 "immediate_operand" "K")))]
2121 check_label_emit ();
2122 mvs_check_page (0, 4, 0);
2123 return \"MH %0,%H2\";
2127 [(set (match_operand:DI 0 "register_operand" "=d")
2128 (mult:SI (match_operand:DI 1 "general_operand" "%0")
2129 (match_operand:SI 2 "general_operand" "g")))]
2133 check_label_emit ();
2134 if (REG_P (operands[2]))
2136 mvs_check_page (0, 2, 0);
2137 return \"MR %0,%2\";
2139 mvs_check_page (0, 4, 0);
2144 ; muldf3 instruction pattern(s).
2147 (define_insn "muldf3"
2148 [(set (match_operand:DF 0 "general_operand" "=f")
2149 (mult:DF (match_operand:DF 1 "general_operand" "%0")
2150 (match_operand:DF 2 "general_operand" "fmF")))]
2154 check_label_emit ();
2155 if (FP_REG_P (operands[2]))
2157 mvs_check_page (0, 2, 0);
2158 return \"MDR %0,%2\";
2160 mvs_check_page (0, 4, 0);
2161 return \"MD %0,%2\";
2165 ; mulsf3 instruction pattern(s).
2168 (define_insn "mulsf3"
2169 [(set (match_operand:SF 0 "general_operand" "=f")
2170 (mult:SF (match_operand:SF 1 "general_operand" "%0")
2171 (match_operand:SF 2 "general_operand" "fmF")))]
2175 check_label_emit ();
2176 if (FP_REG_P (operands[2]))
2178 mvs_check_page (0, 2, 0);
2179 return \"MER %0,%2\";
2181 mvs_check_page (0, 4, 0);
2182 return \"ME %0,%2\";
2186 ;;- Divide instructions.
2190 ; divsi3 instruction pattern(s).
2193 (define_expand "divsi3"
2194 [(set (match_operand:SI 0 "general_operand" "")
2195 (div:SI (match_operand:SI 1 "general_operand" "")
2196 (match_operand:SI 2 "general_operand" "")))]
2200 rtx r = gen_reg_rtx (DImode);
2202 emit_insn (gen_extendsidi2 (r, operands[1]));
2203 emit_insn (gen_rtx (SET, VOIDmode, r,
2204 gen_rtx (DIV, SImode, r, operands[2])));
2205 emit_insn (gen_rtx (SET, VOIDmode, operands[0],
2206 gen_rtx (SUBREG, SImode, r, 1)));
2212 ; udivsi3 instruction pattern(s).
2215 (define_expand "udivsi3"
2216 [(set (match_operand:SI 0 "general_operand" "")
2217 (udiv:SI (match_operand:SI 1 "general_operand" "")
2218 (match_operand:SI 2 "general_operand" "")))]
2222 rtx dr = gen_reg_rtx (DImode);
2223 rtx dr_0 = gen_rtx (SUBREG, SImode, dr, 0);
2224 rtx dr_1 = gen_rtx (SUBREG, SImode, dr, 1);
2227 if (GET_CODE (operands[2]) == CONST_INT)
2229 if (INTVAL (operands[2]) > 0)
2231 emit_insn (gen_zero_extendsidi2 (dr, operands[1]));
2232 emit_insn (gen_rtx (SET, VOIDmode, dr,
2233 gen_rtx (DIV, SImode, dr, operands[2])));
2237 rtx label1 = gen_label_rtx ();
2239 emit_insn (gen_rtx (SET, VOIDmode, dr_0, operands[1]));
2240 emit_insn (gen_rtx (SET, VOIDmode, dr_1, const0_rtx));
2241 emit_insn (gen_cmpsi (dr_0, operands[2]));
2242 emit_jump_insn (gen_bltu (label1));
2243 emit_insn (gen_rtx (SET, VOIDmode, dr_1, const1_rtx));
2244 emit_label (label1);
2249 rtx label1 = gen_label_rtx ();
2250 rtx label2 = gen_label_rtx ();
2251 rtx label3 = gen_label_rtx ();
2252 rtx sr = gen_reg_rtx (SImode);
2254 emit_insn (gen_rtx (SET, VOIDmode, dr_0, operands[1]));
2255 emit_insn (gen_rtx (SET, VOIDmode, sr, operands[2]));
2256 emit_insn (gen_rtx (SET, VOIDmode, dr_1, const0_rtx));
2257 emit_insn (gen_cmpsi (sr, dr_0));
2258 emit_jump_insn (gen_bgtu (label3));
2259 emit_insn (gen_cmpsi (sr, const1_rtx));
2260 emit_jump_insn (gen_blt (label2));
2261 emit_jump_insn (gen_beq (label1));
2262 emit_insn (gen_rtx (SET, VOIDmode, dr,
2263 gen_rtx (LSHIFTRT, DImode, dr,
2265 emit_insn (gen_rtx (SET, VOIDmode, dr,
2266 gen_rtx (DIV, SImode, dr, sr)));
2267 emit_jump_insn (gen_jump (label3));
2268 emit_label (label1);
2269 emit_insn (gen_rtx (SET, VOIDmode, dr_1, dr_0));
2270 emit_jump_insn (gen_jump (label3));
2271 emit_label (label2);
2272 emit_insn (gen_rtx (SET, VOIDmode, dr_1, const1_rtx));
2273 emit_label (label3);
2275 emit_insn (gen_rtx (SET, VOIDmode, operands[0], dr_1));
2280 ; This is used by divsi3 & udivsi3.
2283 [(set (match_operand:DI 0 "register_operand" "=d")
2284 (div:SI (match_operand:DI 1 "register_operand" "0")
2285 (match_operand:SI 2 "general_operand" "")))]
2289 check_label_emit ();
2290 if (REG_P (operands[2]))
2292 mvs_check_page (0, 2, 0);
2293 return \"DR %0,%2\";
2295 mvs_check_page (0, 4, 0);
2300 ; divdf3 instruction pattern(s).
2303 (define_insn "divdf3"
2304 [(set (match_operand:DF 0 "general_operand" "=f")
2305 (div:DF (match_operand:DF 1 "general_operand" "0")
2306 (match_operand:DF 2 "general_operand" "fmF")))]
2310 check_label_emit ();
2311 if (FP_REG_P (operands[2]))
2313 mvs_check_page (0, 2, 0);
2314 return \"DDR %0,%2\";
2316 mvs_check_page (0, 4, 0);
2317 return \"DD %0,%2\";
2321 ; divsf3 instruction pattern(s).
2324 (define_insn "divsf3"
2325 [(set (match_operand:SF 0 "general_operand" "=f")
2326 (div:SF (match_operand:SF 1 "general_operand" "0")
2327 (match_operand:SF 2 "general_operand" "fmF")))]
2331 check_label_emit ();
2332 if (FP_REG_P (operands[2]))
2334 mvs_check_page (0, 2, 0);
2335 return \"DER %0,%2\";
2337 mvs_check_page (0, 4, 0);
2338 return \"DE %0,%2\";
2342 ;;- Modulo instructions.
2346 ; modsi3 instruction pattern(s).
2349 (define_expand "modsi3"
2350 [(set (match_operand:SI 0 "general_operand" "")
2351 (mod:SI (match_operand:SI 1 "general_operand" "")
2352 (match_operand:SI 2 "general_operand" "")))]
2356 rtx r = gen_reg_rtx (DImode);
2358 emit_insn (gen_extendsidi2 (r, operands[1]));
2359 emit_insn (gen_rtx (SET, VOIDmode, r,
2360 gen_rtx (MOD, SImode, r, operands[2])));
2361 emit_insn (gen_rtx (SET, VOIDmode, operands[0],
2362 gen_rtx (SUBREG, SImode, r, 0)));
2367 ; umodsi3 instruction pattern(s).
2370 (define_expand "umodsi3"
2371 [(set (match_operand:SI 0 "general_operand" "")
2372 (umod:SI (match_operand:SI 1 "general_operand" "")
2373 (match_operand:SI 2 "general_operand" "")))]
2377 rtx dr = gen_reg_rtx (DImode);
2378 rtx dr_0 = gen_rtx (SUBREG, SImode, dr, 0);
2379 rtx dr_1 = gen_rtx (SUBREG, SImode, dr, 1);
2381 emit_insn (gen_rtx (SET, VOIDmode, dr_0, operands[1]));
2383 if (GET_CODE (operands[2]) == CONST_INT)
2385 if (INTVAL (operands[2]) > 0)
2387 emit_insn (gen_rtx (SET, VOIDmode, dr,
2388 gen_rtx (LSHIFTRT, DImode, dr,
2390 emit_insn (gen_rtx (SET, VOIDmode, dr,
2391 gen_rtx (MOD, SImode, dr, operands[2])));
2395 rtx label1 = gen_label_rtx ();
2396 rtx sr = gen_reg_rtx (SImode);
2398 emit_insn (gen_rtx (SET, VOIDmode, sr, operands[2]));
2399 emit_insn (gen_cmpsi (dr_0, sr));
2400 emit_jump_insn (gen_bltu (label1));
2401 emit_insn (gen_rtx (SET, VOIDmode, sr, gen_rtx (ABS, SImode, sr)));
2402 emit_insn (gen_rtx (SET, VOIDmode, dr_0,
2403 gen_rtx (PLUS, SImode, dr_0, sr)));
2404 emit_label (label1);
2409 rtx label1 = gen_label_rtx ();
2410 rtx label2 = gen_label_rtx ();
2411 rtx label3 = gen_label_rtx ();
2412 rtx sr = gen_reg_rtx (SImode);
2414 emit_insn (gen_rtx (SET, VOIDmode, dr_0, operands[1]));
2415 emit_insn (gen_rtx (SET, VOIDmode, sr, operands[2]));
2416 emit_insn (gen_cmpsi (sr, dr_0));
2417 emit_jump_insn (gen_bgtu (label3));
2418 emit_insn (gen_cmpsi (sr, const1_rtx));
2419 emit_jump_insn (gen_blt (label2));
2420 emit_jump_insn (gen_beq (label1));
2421 emit_insn (gen_rtx (SET, VOIDmode, dr,
2422 gen_rtx (LSHIFTRT, DImode, dr,
2424 emit_insn (gen_rtx (SET, VOIDmode, dr, gen_rtx (MOD, SImode, dr, sr)));
2425 emit_jump_insn (gen_jump (label3));
2426 emit_label (label1);
2427 emit_insn (gen_rtx (SET, VOIDmode, dr_0, const0_rtx));
2428 emit_jump_insn (gen_jump (label3));
2429 emit_label (label2);
2430 emit_insn (gen_rtx (SET, VOIDmode, dr_0,
2431 gen_rtx (MINUS, SImode, dr_0, sr)));
2432 emit_label (label3);
2435 emit_insn (gen_rtx (SET, VOIDmode, operands[0], dr_0));
2440 ; This is used by modsi3 & umodsi3.
2443 [(set (match_operand:DI 0 "register_operand" "=d")
2444 (mod:SI (match_operand:DI 1 "register_operand" "0")
2445 (match_operand:SI 2 "general_operand" "")))]
2449 check_label_emit ();
2450 if (REG_P (operands[2]))
2452 mvs_check_page (0, 2, 0);
2453 return \"DR %0,%2\";
2455 mvs_check_page (0, 4, 0);
2460 ;;- And instructions.
2464 ; anddi3 instruction pattern(s).
2467 ;(define_expand "anddi3"
2468 ; [(set (match_operand:DI 0 "general_operand" "")
2469 ; (and:DI (match_operand:DI 1 "general_operand" "")
2470 ; (match_operand:DI 2 "general_operand" "")))]
2476 ; emit_insn (gen_andsi3 (operand_subword (operands[0], 0, 1, DImode),
2477 ; operand_subword (operands[1], 0, 1, DImode),
2478 ; operand_subword (operands[2], 0, 1, DImode)));
2479 ; emit_insn (gen_andsi3 (gen_lowpart (SImode, operands[0]),
2480 ; gen_lowpart (SImode, operands[1]),
2481 ; gen_lowpart (SImode, operands[2])));
2486 ; andsi3 instruction pattern(s).
2490 [(set (match_operand:SI 0 "r_or_s_operand" "=d,m")
2491 (and:SI (match_operand:SI 1 "r_or_s_operand" "%0,0")
2492 (match_operand:SI 2 "r_or_s_operand" "g,mi")))]
2493 "TARGET_CHAR_INSTRUCTIONS"
2496 check_label_emit ();
2497 if (REG_P (operands[2]))
2499 mvs_check_page (0, 2, 0);
2500 return \"NR %0,%2\";
2502 if (REG_P (operands[0]))
2504 mvs_check_page (0, 4, 0);
2508 mvs_check_page (0, 6, 0);
2509 return \"NC %O0(4,%R0),%2\";
2512 (define_insn "andsi3"
2513 [(set (match_operand:SI 0 "general_operand" "=d")
2514 (and:SI (match_operand:SI 1 "general_operand" "%0")
2515 (match_operand:SI 2 "general_operand" "g")))]
2519 check_label_emit ();
2520 if (REG_P (operands[2]))
2522 mvs_check_page (0, 2, 0);
2523 return \"NR %0,%2\";
2525 mvs_check_page (0, 4, 0);
2530 ; andhi3 instruction pattern(s).
2534 [(set (match_operand:HI 0 "r_or_s_operand" "=d,m")
2535 (and:HI (match_operand:HI 1 "r_or_s_operand" "%0,0")
2536 (match_operand:HI 2 "r_or_s_operand" "di,mi")))]
2537 "TARGET_CHAR_INSTRUCTIONS"
2540 check_label_emit ();
2541 if (REG_P (operands[2]))
2543 mvs_check_page (0, 2, 0);
2544 return \"NR %0,%2\";
2546 if (REG_P (operands[0]))
2548 mvs_check_page (0, 4, 0);
2552 if (GET_CODE (operands[2]) == CONST_INT)
2554 mvs_check_page (0, 6, 0);
2555 return \"NC %O0(2,%R0),%H2\";
2557 mvs_check_page (0, 6, 0);
2558 return \"NC %O0(2,%R0),%2\";
2561 (define_insn "andhi3"
2562 [(set (match_operand:HI 0 "general_operand" "=d")
2563 (and:HI (match_operand:HI 1 "general_operand" "%0")
2564 (match_operand:HI 2 "general_operand" "di")))]
2568 check_label_emit ();
2569 if (GET_CODE (operands[2]) == CONST_INT)
2571 mvs_check_page (0, 4, 0);
2574 mvs_check_page (0, 2, 0);
2575 return \"NR %0,%2\";
2579 ; andqi3 instruction pattern(s).
2583 [(set (match_operand:QI 0 "r_or_s_operand" "=d,m")
2584 (and:QI (match_operand:QI 1 "r_or_s_operand" "%0,0")
2585 (match_operand:QI 2 "r_or_s_operand" "di,mi")))]
2586 "TARGET_CHAR_INSTRUCTIONS"
2589 check_label_emit ();
2591 if (REG_P (operands[2]))
2593 mvs_check_page (0, 2, 0);
2594 return \"NR %0,%2\";
2596 if (REG_P (operands[0]))
2598 mvs_check_page (0, 4, 0);
2601 if (GET_CODE (operands[2]) == CONST_INT)
2603 mvs_check_page (0, 4, 0);
2604 return \"NI %0,%B2\";
2606 mvs_check_page (0, 6, 0);
2607 return \"NC %O0(1,%R0),%2\";
2610 (define_insn "andqi3"
2611 [(set (match_operand:QI 0 "general_operand" "=d")
2612 (and:QI (match_operand:QI 1 "general_operand" "%0")
2613 (match_operand:QI 2 "general_operand" "di")))]
2617 check_label_emit ();
2619 if (GET_CODE (operands[2]) == CONST_INT)
2621 mvs_check_page (0, 4, 0);
2624 mvs_check_page (0, 2, 0);
2625 return \"NR %0,%2\";
2629 ;;- Bit set (inclusive or) instructions.
2633 ; iordi3 instruction pattern(s).
2636 ;(define_expand "iordi3"
2637 ; [(set (match_operand:DI 0 "general_operand" "")
2638 ; (ior:DI (match_operand:DI 1 "general_operand" "")
2639 ; (match_operand:DI 2 "general_operand" "")))]
2645 ; emit_insn (gen_iorsi3 (operand_subword (operands[0], 0, 1, DImode),
2646 ; operand_subword (operands[1], 0, 1, DImode),
2647 ; operand_subword (operands[2], 0, 1, DImode)));
2648 ; emit_insn (gen_iorsi3 (gen_lowpart (SImode, operands[0]),
2649 ; gen_lowpart (SImode, operands[1]),
2650 ; gen_lowpart (SImode, operands[2])));
2655 ; iorsi3 instruction pattern(s).
2659 [(set (match_operand:SI 0 "r_or_s_operand" "=d,m")
2660 (ior:SI (match_operand:SI 1 "r_or_s_operand" "%0,0")
2661 (match_operand:SI 2 "r_or_s_operand" "g,mi")))]
2662 "TARGET_CHAR_INSTRUCTIONS"
2665 check_label_emit ();
2666 if (REG_P (operands[2]))
2668 mvs_check_page (0, 2, 0);
2669 return \"OR %0,%2\";
2671 if (REG_P (operands[0]))
2673 mvs_check_page (0, 4, 0);
2677 mvs_check_page (0, 6, 0);
2678 return \"OC %O0(4,%R0),%2\";
2681 (define_insn "iorsi3"
2682 [(set (match_operand:SI 0 "general_operand" "=d")
2683 (ior:SI (match_operand:SI 1 "general_operand" "%0")
2684 (match_operand:SI 2 "general_operand" "g")))]
2688 check_label_emit ();
2689 if (REG_P (operands[2]))
2691 mvs_check_page (0, 2, 0);
2692 return \"OR %0,%2\";
2694 mvs_check_page (0, 4, 0);
2699 ; iorhi3 instruction pattern(s).
2703 [(set (match_operand:HI 0 "r_or_s_operand" "=d,m")
2704 (ior:HI (match_operand:HI 1 "r_or_s_operand" "%0,0")
2705 (match_operand:HI 2 "r_or_s_operand" "di,mi")))]
2706 "TARGET_CHAR_INSTRUCTIONS"
2709 check_label_emit ();
2710 if (REG_P (operands[2]))
2712 mvs_check_page (0, 2, 0);
2713 return \"OR %0,%2\";
2715 if (REG_P (operands[0]))
2717 mvs_check_page (0, 4, 0);
2721 if (GET_CODE (operands[2]) == CONST_INT)
2723 mvs_check_page (0, 6, 0);
2724 return \"OC %O0(2,%R0),%H2\";
2726 mvs_check_page (0, 6, 0);
2727 return \"OC %O0(2,%R0),%2\";
2730 (define_insn "iorhi3"
2731 [(set (match_operand:HI 0 "general_operand" "=d")
2732 (ior:HI (match_operand:HI 1 "general_operand" "%0")
2733 (match_operand:HI 2 "general_operand" "di")))]
2737 check_label_emit ();
2738 if (GET_CODE (operands[2]) == CONST_INT)
2740 mvs_check_page (0, 4, 0);
2743 mvs_check_page (0, 2, 0);
2744 return \"OR %0,%2\";
2748 ; iorqi3 instruction pattern(s).
2752 [(set (match_operand:QI 0 "r_or_s_operand" "=d,m")
2753 (ior:QI (match_operand:QI 1 "r_or_s_operand" "%0,0")
2754 (match_operand:QI 2 "r_or_s_operand" "di,mi")))]
2755 "TARGET_CHAR_INSTRUCTIONS"
2758 check_label_emit ();
2760 if (REG_P (operands[2]))
2762 mvs_check_page (0, 2, 0);
2763 return \"OR %0,%2\";
2765 if (REG_P (operands[0]))
2767 mvs_check_page (0, 4, 0);
2771 if (GET_CODE (operands[2]) == CONST_INT)
2773 mvs_check_page (0, 4, 0);
2774 return \"OI %0,%B2\";
2776 mvs_check_page (0, 6, 0);
2777 return \"OC %O0(1,%R0),%2\";
2780 (define_insn "iorqi3"
2781 [(set (match_operand:QI 0 "general_operand" "=d")
2782 (ior:QI (match_operand:QI 1 "general_operand" "%0")
2783 (match_operand:QI 2 "general_operand" "di")))]
2787 check_label_emit ();
2789 if (GET_CODE (operands[2]) == CONST_INT)
2791 mvs_check_page (0, 4, 0);
2794 mvs_check_page (0, 2, 0);
2795 return \"OR %0,%2\";
2799 ;;- Xor instructions.
2803 ; xordi3 instruction pattern(s).
2806 ;(define_expand "xordi3"
2807 ; [(set (match_operand:DI 0 "general_operand" "")
2808 ; (xor:DI (match_operand:DI 1 "general_operand" "")
2809 ; (match_operand:DI 2 "general_operand" "")))]
2815 ; emit_insn (gen_xorsi3 (operand_subword (operands[0], 0, 1, DImode),
2816 ; operand_subword (operands[1], 0, 1, DImode),
2817 ; operand_subword (operands[2], 0, 1, DImode)));
2818 ; emit_insn (gen_xorsi3 (gen_lowpart (SImode, operands[0]),
2819 ; gen_lowpart (SImode, operands[1]),
2820 ; gen_lowpart (SImode, operands[2])));
2825 ; xorsi3 instruction pattern(s).
2829 [(set (match_operand:SI 0 "r_or_s_operand" "=d,m")
2830 (xor:SI (match_operand:SI 1 "r_or_s_operand" "%0,0")
2831 (match_operand:SI 2 "r_or_s_operand" "g,mi")))]
2832 "TARGET_CHAR_INSTRUCTIONS"
2835 check_label_emit ();
2836 if (REG_P (operands[2]))
2838 mvs_check_page (0, 2, 0);
2839 return \"XR %0,%2\";
2841 if (REG_P (operands[0]))
2843 mvs_check_page (0, 4, 0);
2847 mvs_check_page (0, 6, 0);
2848 return \"XC %O0(4,%R0),%2\";
2851 (define_insn "xorsi3"
2852 [(set (match_operand:SI 0 "general_operand" "=d")
2853 (xor:SI (match_operand:SI 1 "general_operand" "%0")
2854 (match_operand:SI 2 "general_operand" "g")))]
2858 check_label_emit ();
2859 if (REG_P (operands[2]))
2861 mvs_check_page (0, 2, 0);
2862 return \"XR %0,%2\";
2864 mvs_check_page (0, 4, 0);
2869 ; xorhi3 instruction pattern(s).
2873 [(set (match_operand:HI 0 "r_or_s_operand" "=d,m")
2874 (xor:HI (match_operand:HI 1 "r_or_s_operand" "%0,0")
2875 (match_operand:HI 2 "r_or_s_operand" "di,mi")))]
2876 "TARGET_CHAR_INSTRUCTIONS"
2879 check_label_emit ();
2880 if (REG_P (operands[2]))
2882 mvs_check_page (0, 2, 0);
2883 return \"XR %0,%2\";
2885 if (REG_P (operands[0]))
2887 mvs_check_page (0, 4, 0);
2891 if (GET_CODE (operands[2]) == CONST_INT)
2893 mvs_check_page (0, 6, 0);
2894 return \"XC %O0(2,%R0),%H2\";
2896 mvs_check_page (0, 6, 0);
2897 return \"XC %O0(2,%R0),%2\";
2900 (define_insn "xorhi3"
2901 [(set (match_operand:HI 0 "general_operand" "=d")
2902 (xor:HI (match_operand:HI 1 "general_operand" "%0")
2903 (match_operand:HI 2 "general_operand" "di")))]
2907 check_label_emit ();
2908 if (GET_CODE (operands[2]) == CONST_INT)
2910 mvs_check_page (0, 4, 0);
2913 mvs_check_page (0, 2, 0);
2914 return \"XR %0,%2\";
2918 ; xorqi3 instruction pattern(s).
2922 [(set (match_operand:QI 0 "r_or_s_operand" "=d,m")
2923 (xor:QI (match_operand:QI 1 "r_or_s_operand" "%0,0")
2924 (match_operand:QI 2 "r_or_s_operand" "di,mi")))]
2925 "TARGET_CHAR_INSTRUCTIONS"
2928 check_label_emit ();
2930 if (REG_P (operands[2]))
2932 mvs_check_page (0, 2, 0);
2933 return \"XR %0,%2\";
2935 if (REG_P (operands[0]))
2937 mvs_check_page (0, 4, 0);
2940 if (GET_CODE (operands[2]) == CONST_INT)
2942 mvs_check_page (0, 4, 0);
2943 return \"XI %0,%B2\";
2945 mvs_check_page (0, 6, 0);
2946 return \"XC %O0(1,%R0),%2\";
2949 (define_insn "xorqi3"
2950 [(set (match_operand:QI 0 "general_operand" "=d")
2951 (xor:QI (match_operand:QI 1 "general_operand" "%0")
2952 (match_operand:QI 2 "general_operand" "di")))]
2956 check_label_emit ();
2958 if (GET_CODE (operands[2]) == CONST_INT)
2960 mvs_check_page (0, 4, 0);
2963 mvs_check_page (0, 2, 0);
2964 return \"XR %0,%2\";
2968 ;;- Negate instructions.
2972 ; negsi2 instruction pattern(s).
2975 (define_insn "negsi2"
2976 [(set (match_operand:SI 0 "general_operand" "=d")
2977 (neg:SI (match_operand:SI 1 "general_operand" "d")))]
2981 check_label_emit ();
2982 mvs_check_page (0, 2, 0);
2983 return \"LCR %0,%1\";
2987 ; neghi2 instruction pattern(s).
2990 (define_insn "neghi2"
2991 [(set (match_operand:HI 0 "general_operand" "=d")
2992 (neg:HI (match_operand:HI 1 "general_operand" "d")))]
2996 check_label_emit ();
2997 mvs_check_page (0, 10, 0);
2998 return \"SLL %1,16\;SRA %1,16\;LCR %0,%1\";
3002 ; negdf2 instruction pattern(s).
3005 (define_insn "negdf2"
3006 [(set (match_operand:DF 0 "general_operand" "=f")
3007 (neg:DF (match_operand:DF 1 "general_operand" "f")))]
3011 check_label_emit ();
3012 mvs_check_page (0, 2, 0);
3013 return \"LCDR %0,%1\";
3017 ; negsf2 instruction pattern(s).
3020 (define_insn "negsf2"
3021 [(set (match_operand:SF 0 "general_operand" "=f")
3022 (neg:SF (match_operand:SF 1 "general_operand" "f")))]
3026 check_label_emit ();
3027 mvs_check_page (0, 2, 0);
3028 return \"LCER %0,%1\";
3032 ;;- Absolute value instructions.
3036 ; abssi2 instruction pattern(s).
3039 (define_insn "abssi2"
3040 [(set (match_operand:SI 0 "general_operand" "=d")
3041 (abs:SI (match_operand:SI 1 "general_operand" "d")))]
3045 check_label_emit ();
3046 mvs_check_page (0, 2, 0);
3047 return \"LPR %0,%1\";
3051 ; abshi2 instruction pattern(s).
3054 (define_insn "abshi2"
3055 [(set (match_operand:HI 0 "general_operand" "=d")
3056 (abs:HI (match_operand:HI 1 "general_operand" "d")))]
3060 check_label_emit ();
3061 mvs_check_page (0, 10, 0);
3062 return \"SLL %1,16\;SRA %1,16\;LPR %0,%1\";
3066 ; absdf2 instruction pattern(s).
3069 (define_insn "absdf2"
3070 [(set (match_operand:DF 0 "general_operand" "=f")
3071 (abs:DF (match_operand:DF 1 "general_operand" "f")))]
3075 check_label_emit ();
3076 mvs_check_page (0, 2, 0);
3077 return \"LPDR %0,%1\";
3081 ; abssf2 instruction pattern(s).
3084 (define_insn "abssf2"
3085 [(set (match_operand:SF 0 "general_operand" "=f")
3086 (abs:SF (match_operand:SF 1 "general_operand" "f")))]
3090 check_label_emit ();
3091 mvs_check_page (0, 2, 0);
3092 return \"LPER %0,%1\";
3096 ;;- One complement instructions.
3100 ; one_cmpldi2 instruction pattern(s).
3103 ;(define_expand "one_cmpldi2"
3104 ; [(set (match_operand:DI 0 "general_operand" "")
3105 ; (not:DI (match_operand:DI 1 "general_operand" "")))]
3109 ; rtx gen_one_cmplsi2();
3111 ; emit_insn (gen_one_cmplsi2 (operand_subword (operands[0], 0, 1, DImode),
3112 ; operand_subword (operands[1], 0, 1, DImode)));
3113 ; emit_insn (gen_one_cmplsi2 (gen_lowpart (SImode, operands[0]),
3114 ; gen_lowpart (SImode, operands[1])));
3119 ; one_cmplsi2 instruction pattern(s).
3123 [(set (match_operand:SI 0 "r_or_s_operand" "=dm")
3124 (not:SI (match_operand:SI 1 "r_or_s_operand" "0")))]
3125 "TARGET_CHAR_INSTRUCTIONS"
3128 check_label_emit ();
3129 if (REG_P (operands[0]))
3131 mvs_check_page (0, 4, 4);
3132 return \"X %0,=F'-1'\";
3135 mvs_check_page (0, 6, 4);
3136 return \"XC %O0(4,%R0),=F'-1'\";
3139 (define_insn "one_cmplsi2"
3140 [(set (match_operand:SI 0 "general_operand" "=d")
3141 (not:SI (match_operand:SI 1 "general_operand" "0")))]
3145 check_label_emit ();
3146 mvs_check_page (0, 4, 4);
3147 return \"X %0,=F'-1'\";
3151 ; one_cmplhi2 instruction pattern(s).
3155 [(set (match_operand:HI 0 "r_or_s_operand" "=dm")
3156 (not:HI (match_operand:HI 1 "r_or_s_operand" "0")))]
3157 "TARGET_CHAR_INSTRUCTIONS"
3160 check_label_emit ();
3161 if (REG_P (operands[0]))
3163 mvs_check_page (0, 4, 4);
3164 return \"X %0,=F'-1'\";
3167 mvs_check_page (0, 6, 4);
3168 return \"XC %O0(2,%R0),=X'FFFF'\";
3171 (define_insn "one_cmplhi2"
3172 [(set (match_operand:HI 0 "general_operand" "=d")
3173 (not:HI (match_operand:HI 1 "general_operand" "0")))]
3177 check_label_emit ();
3178 mvs_check_page (0, 4, 4);
3179 return \"X %0,=F'-1'\";
3183 ; one_cmplqi2 instruction pattern(s).
3187 [(set (match_operand:QI 0 "r_or_s_operand" "=dm")
3188 (not:QI (match_operand:QI 1 "r_or_s_operand" "0")))]
3189 "TARGET_CHAR_INSTRUCTIONS"
3192 check_label_emit ();
3194 if (REG_P (operands[0]))
3196 mvs_check_page (0, 4, 4);
3197 return \"X %0,=F'-1'\";
3199 mvs_check_page (0, 4, 0);
3200 return \"XI %0,255\";
3203 (define_insn "one_cmplqi2"
3204 [(set (match_operand:QI 0 "general_operand" "=d")
3205 (not:QI (match_operand:QI 1 "general_operand" "0")))]
3209 check_label_emit ();
3211 mvs_check_page (0, 4, 4);
3212 return \"X %0,=F'-1'\";
3216 ;;- Arithmetic shift instructions.
3220 ; ashldi3 instruction pattern(s).
3223 (define_insn "ashldi3"
3224 [(set (match_operand:DI 0 "general_operand" "=d")
3225 (ashift:DI (match_operand:DI 1 "general_operand" "0")
3226 (match_operand:SI 2 "general_operand" "Ja")))]
3230 check_label_emit ();
3232 mvs_check_page (0, 4, 0);
3233 if (REG_P (operands[2]))
3234 return \"SLDA %0,0(%2)\";
3235 return \"SLDA %0,%c2\";
3239 ; ashrdi3 instruction pattern(s).
3242 (define_insn "ashrdi3"
3243 [(set (match_operand:DI 0 "register_operand" "=d")
3244 (ashiftrt:DI (match_operand:DI 1 "general_operand" "0")
3245 (match_operand:SI 2 "general_operand" "Ja")))]
3249 check_label_emit ();
3250 mvs_check_page (0, 4, 0);
3251 if (REG_P (operands[2]))
3252 return \"SRDA %0,0(%2)\";
3253 return \"SRDA %0,%c2\";
3257 ; ashlsi3 instruction pattern(s).
3260 (define_insn "ashlsi3"
3261 [(set (match_operand:SI 0 "general_operand" "=d")
3262 (ashift:SI (match_operand:SI 1 "general_operand" "0")
3263 (match_operand:SI 2 "general_operand" "Ja")))]
3267 check_label_emit ();
3269 mvs_check_page (0, 4, 0);
3270 if (REG_P (operands[2]))
3271 return \"SLL %0,0(%2)\";
3272 return \"SLL %0,%c2\";
3276 ; ashrsi3 instruction pattern(s).
3279 (define_insn "ashrsi3"
3280 [(set (match_operand:SI 0 "general_operand" "=d")
3281 (ashiftrt:SI (match_operand:SI 1 "general_operand" "0")
3282 (match_operand:SI 2 "general_operand" "Ja")))]
3286 check_label_emit ();
3287 mvs_check_page (0, 4, 0);
3288 if (REG_P (operands[2]))
3289 return \"SRA %0,0(%2)\";
3290 return \"SRA %0,%c2\";
3294 ; ashlhi3 instruction pattern(s).
3297 (define_insn "ashlhi3"
3298 [(set (match_operand:HI 0 "general_operand" "=d")
3299 (ashift:HI (match_operand:HI 1 "general_operand" "0")
3300 (match_operand:SI 2 "general_operand" "Ja")))]
3304 check_label_emit ();
3305 mvs_check_page (0, 8, 0);
3306 if (REG_P (operands[2]))
3307 return \"SLL %0,16(%2)\;SRA %0,16\";
3308 return \"SLL %0,16+%c2\;SRA %0,16\";
3312 ; ashrhi3 instruction pattern(s).
3315 (define_insn "ashrhi3"
3316 [(set (match_operand:HI 0 "general_operand" "=d")
3317 (ashiftrt:HI (match_operand:HI 1 "general_operand" "0")
3318 (match_operand:SI 2 "general_operand" "Ja")))]
3322 check_label_emit ();
3323 mvs_check_page (0, 4, 0);
3324 if (REG_P (operands[2]))
3325 return \"SLL %0,16\;SRA %0,16(%2)\";
3326 return \"SLL %0,16\;SRA %0,16+%c2\";
3330 ; ashlqi3 instruction pattern(s).
3333 (define_insn "ashlqi3"
3334 [(set (match_operand:QI 0 "general_operand" "=d")
3335 (ashift:QI (match_operand:QI 1 "general_operand" "0")
3336 (match_operand:SI 2 "general_operand" "Ja")))]
3340 check_label_emit ();
3342 mvs_check_page (0, 4, 0);
3343 if (REG_P (operands[2]))
3344 return \"SLL %0,0(%2)\";
3345 return \"SLL %0,%c2\";
3349 ; ashrqi3 instruction pattern(s).
3352 (define_insn "ashrqi3"
3353 [(set (match_operand:QI 0 "general_operand" "=d")
3354 (ashiftrt:QI (match_operand:QI 1 "general_operand" "0")
3355 (match_operand:SI 2 "general_operand" "Ja")))]
3359 check_label_emit ();
3360 mvs_check_page (0, 8, 0);
3361 if (REG_P (operands[2]))
3362 return \"SLL %0,24\;SRA %0,24(%2)\";
3363 return \"SLL %0,24\;SRA %0,24+%c2\";
3367 ;;- Logical shift instructions.
3371 ; lshrdi3 instruction pattern(s).
3374 (define_insn "lshrdi3"
3375 [(set (match_operand:DI 0 "general_operand" "=d")
3376 (lshiftrt:DI (match_operand:DI 1 "general_operand" "0")
3377 (match_operand:SI 2 "general_operand" "Ja")))]
3381 check_label_emit ();
3382 mvs_check_page (0, 4, 0);
3383 if (REG_P (operands[2]))
3384 return \"SRDL %0,0(%2)\";
3385 return \"SRDL %0,%c2\";
3390 ; lshrsi3 instruction pattern(s).
3393 (define_insn "lshrsi3"
3394 [(set (match_operand:SI 0 "general_operand" "=d")
3395 (lshiftrt:SI (match_operand:SI 1 "general_operand" "0")
3396 (match_operand:SI 2 "general_operand" "Ja")))]
3400 check_label_emit ();
3401 mvs_check_page (0, 4, 0);
3402 if (REG_P (operands[2]))
3403 return \"SRL %0,0(%2)\";
3404 return \"SRL %0,%c2\";
3408 ; lshrhi3 instruction pattern(s).
3411 (define_insn "lshrhi3"
3412 [(set (match_operand:HI 0 "general_operand" "=d")
3413 (lshiftrt:HI (match_operand:HI 1 "general_operand" "0")
3414 (match_operand:SI 2 "general_operand" "Ja")))]
3418 check_label_emit ();
3420 if (REG_P (operands[2]))
3422 mvs_check_page (0, 8, 4);
3423 return \"N %0,=X'0000FFFF'\;SRL %0,0(%2)\";
3425 mvs_check_page (0, 8, 4);
3426 return \"N %0,=X'0000FFFF'\;SRL %0,%c2\";
3430 ; lshrqi3 instruction pattern(s).
3433 (define_insn "lshrqi3"
3434 [(set (match_operand:QI 0 "general_operand" "=d")
3435 (lshiftrt:QI (match_operand:QI 1 "general_operand" "0")
3436 (match_operand:SI 2 "general_operand" "Ja")))]
3440 check_label_emit ();
3442 mvs_check_page (0, 8, 4);
3443 if (REG_P (operands[2]))
3444 return \"N %0,=X'000000FF'\;SRL %0,0(%2)\";
3445 return \"N %0,=X'000000FF'\;SRL %0,%c2\";
3449 ;;- Conditional jump instructions.
3453 ; beq instruction pattern(s).
3458 (if_then_else (eq (cc0)
3460 (label_ref (match_operand 0 "" ""))
3465 check_label_emit ();
3466 if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
3468 mvs_check_page (0, 6, 4);
3469 return \"L 14,=A(%l0)\;BER 14\";
3471 if (mvs_check_page (0, 4, 0))
3473 mvs_check_page (0, 2, 4);
3474 return \"L 14,=A(%l0)\;BER 14\";
3480 ; bne instruction pattern(s).
3485 (if_then_else (ne (cc0)
3487 (label_ref (match_operand 0 "" ""))
3492 check_label_emit ();
3493 if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
3495 mvs_check_page (0, 6, 4);
3496 return \"L 14,=A(%l0)\;BNER 14\";
3498 if (mvs_check_page (0, 4, 0))
3500 mvs_check_page (0, 2, 4);
3501 return \"L 14,=A(%l0)\;BNER 14\";
3507 ; bgt instruction pattern(s).
3512 (if_then_else (gt (cc0)
3514 (label_ref (match_operand 0 "" ""))
3519 check_label_emit ();
3520 if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
3522 mvs_check_page (0, 6, 4);
3523 return \"L 14,=A(%l0)\;BHR 14\";
3525 if (mvs_check_page (0, 4, 0))
3527 mvs_check_page (0, 2, 4);
3528 return \"L 14,=A(%l0)\;BHR 14\";
3534 ; bgtu instruction pattern(s).
3539 (if_then_else (gtu (cc0)
3541 (label_ref (match_operand 0 "" ""))
3546 check_label_emit ();
3547 if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
3549 mvs_check_page (0, 6, 4);
3550 return \"L 14,=A(%l0)\;BHR 14\";
3552 if (mvs_check_page (0, 4, 0))
3554 mvs_check_page (0, 2, 4);
3555 return \"L 14,=A(%l0)\;BHR 14\";
3561 ; blt instruction pattern(s).
3566 (if_then_else (lt (cc0)
3568 (label_ref (match_operand 0 "" ""))
3573 check_label_emit ();
3574 if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
3576 mvs_check_page (0, 6, 4);
3577 return \"L 14,=A(%l0)\;BLR 14\";
3579 if (mvs_check_page (0, 4, 0))
3581 mvs_check_page (0, 2, 4);
3582 return \"L 14,=A(%l0)\;BLR 14\";
3588 ; bltu instruction pattern(s).
3593 (if_then_else (ltu (cc0)
3595 (label_ref (match_operand 0 "" ""))
3600 check_label_emit ();
3601 if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
3603 mvs_check_page (0, 6, 4);
3604 return \"L 14,=A(%l0)\;BLR 14\";
3606 if (mvs_check_page (0, 4, 0))
3608 mvs_check_page (0, 2, 4);
3609 return \"L 14,=A(%l0)\;BLR 14\";
3615 ; bge instruction pattern(s).
3620 (if_then_else (ge (cc0)
3622 (label_ref (match_operand 0 "" ""))
3627 check_label_emit ();
3628 if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
3630 mvs_check_page (0, 6, 4);
3631 return \"L 14,=A(%l0)\;BNLR 14\";
3633 if (mvs_check_page (0, 4, 0))
3635 mvs_check_page (0, 2, 4);
3636 return \"L 14,=A(%l0)\;BNLR 14\";
3642 ; bgeu instruction pattern(s).
3647 (if_then_else (geu (cc0)
3649 (label_ref (match_operand 0 "" ""))
3654 check_label_emit ();
3655 if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
3657 mvs_check_page (0, 6, 4);
3658 return \"L 14,=A(%l0)\;BNLR 14\";
3660 if (mvs_check_page (0, 4, 0))
3662 mvs_check_page (0, 2, 4);
3663 return \"L 14,=A(%l0)\;BNLR 14\";
3669 ; ble instruction pattern(s).
3674 (if_then_else (le (cc0)
3676 (label_ref (match_operand 0 "" ""))
3681 check_label_emit ();
3682 if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
3684 mvs_check_page (0, 6, 4);
3685 return \"L 14,=A(%l0)\;BNHR 14\";
3687 if (mvs_check_page (0, 4, 0))
3689 mvs_check_page (0, 2, 4);
3690 return \"L 14,=A(%l0)\;BNHR 14\";
3696 ; bleu instruction pattern(s).
3701 (if_then_else (leu (cc0)
3703 (label_ref (match_operand 0 "" ""))
3708 check_label_emit ();
3709 if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
3711 mvs_check_page (0, 6, 4);
3712 return \"L 14,=A(%l0)\;BNHR 14\";
3714 if (mvs_check_page (0, 4, 0))
3716 mvs_check_page (0, 2, 4);
3717 return \"L 14,=A(%l0)\;BNHR 14\";
3723 ;;- Negated conditional jump instructions.
3728 (if_then_else (eq (cc0)
3731 (label_ref (match_operand 0 "" ""))))]
3735 check_label_emit ();
3736 if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
3738 mvs_check_page (0, 6, 4);
3739 return \"L 14,=A(%l0)\;BNER 14\";
3741 if (mvs_check_page (0, 4, 0))
3743 mvs_check_page (0, 2, 4);
3744 return \"L 14,=A(%l0)\;BNER 14\";
3751 (if_then_else (ne (cc0)
3754 (label_ref (match_operand 0 "" ""))))]
3758 check_label_emit ();
3759 if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
3761 mvs_check_page (0, 6, 4);
3762 return \"L 14,=A(%l0)\;BER 14\";
3764 if (mvs_check_page (0, 4, 0))
3766 mvs_check_page (0, 2, 4);
3767 return \"L 14,=A(%l0)\;BER 14\";
3774 (if_then_else (gt (cc0)
3777 (label_ref (match_operand 0 "" ""))))]
3781 check_label_emit ();
3782 if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
3784 mvs_check_page (0, 6, 4);
3785 return \"L 14,=A(%l0)\;BNHR 14\";
3787 if (mvs_check_page (0, 4, 0))
3789 mvs_check_page (0, 2, 4);
3790 return \"L 14,=A(%l0)\;BNHR 14\";
3797 (if_then_else (gtu (cc0)
3800 (label_ref (match_operand 0 "" ""))))]
3804 check_label_emit ();
3805 if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
3807 mvs_check_page (0, 6, 4);
3808 return \"L 14,=A(%l0)\;BNHR 14\";
3810 if (mvs_check_page (0, 4, 0))
3812 mvs_check_page (0, 2, 4);
3813 return \"L 14,=A(%l0)\;BNHR 14\";
3820 (if_then_else (lt (cc0)
3823 (label_ref (match_operand 0 "" ""))))]
3827 check_label_emit ();
3828 if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
3830 mvs_check_page (0, 6, 4);
3831 return \"L 14,=A(%l0)\;BNLR 14\";
3833 if (mvs_check_page (0, 4, 0))
3835 mvs_check_page (0, 2, 4);
3836 return \"L 14,=A(%l0)\;BNLR 14\";
3843 (if_then_else (ltu (cc0)
3846 (label_ref (match_operand 0 "" ""))))]
3850 check_label_emit ();
3851 if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
3853 mvs_check_page (0, 6, 4);
3854 return \"L 14,=A(%l0)\;BNLR 14\";
3856 if (mvs_check_page (0, 4, 0))
3858 mvs_check_page (0, 2, 4);
3859 return \"L 14,=A(%l0)\;BNLR 14\";
3866 (if_then_else (ge (cc0)
3869 (label_ref (match_operand 0 "" ""))))]
3873 check_label_emit ();
3874 if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
3876 mvs_check_page (0, 6, 4);
3877 return \"L 14,=A(%l0)\;BLR 14\";
3879 if (mvs_check_page (0, 4, 0))
3881 mvs_check_page (0, 2, 4);
3882 return \"L 14,=A(%l0)\;BLR 14\";
3889 (if_then_else (geu (cc0)
3892 (label_ref (match_operand 0 "" ""))))]
3896 check_label_emit ();
3897 if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
3899 mvs_check_page (0, 6, 4);
3900 return \"L 14,=A(%l0)\;BLR 14\";
3902 if (mvs_check_page (0, 4, 0))
3904 mvs_check_page (0, 2, 4);
3905 return \"L 14,=A(%l0)\;BLR 14\";
3912 (if_then_else (le (cc0)
3915 (label_ref (match_operand 0 "" ""))))]
3919 check_label_emit ();
3920 if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
3922 mvs_check_page (0, 6, 4);
3923 return \"L 14,=A(%l0)\;BHR 14\";
3925 if (mvs_check_page (0, 4, 0))
3927 mvs_check_page (0, 2, 4);
3928 return \"L 14,=A(%l0)\;BHR 14\";
3935 (if_then_else (leu (cc0)
3938 (label_ref (match_operand 0 "" ""))))]
3942 check_label_emit ();
3943 if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
3945 mvs_check_page (0, 6, 4);
3946 return \"L 14,=A(%l0)\;BHR 14\";
3948 if (mvs_check_page (0, 4, 0))
3950 mvs_check_page (0, 2, 4);
3951 return \"L 14,=A(%l0)\;BHR 14\";
3957 ;;- Subtract one and jump if not zero.
3963 (ne (plus:SI (match_operand:SI 0 "register_operand" "+d")
3966 (label_ref (match_operand 1 "" ""))
3969 (plus:SI (match_dup 0)
3974 check_label_emit ();
3975 if (!mvs_check_label (CODE_LABEL_NUMBER (operands[1])))
3977 mvs_check_page (0, 6, 4);
3978 return \"L 14,=A(%l1)\;BCTR %0,14\";
3980 if (mvs_check_page (0, 4, 0))
3982 mvs_check_page (0, 2, 4);
3983 return \"L 14,=A(%l1)\;BCTR %0,14\";
3985 return \"BCT %0,%l1\";
3991 (eq (plus:SI (match_operand:SI 0 "register_operand" "+d")
3995 (label_ref (match_operand 1 "" ""))))
3997 (plus:SI (match_dup 0)
4002 check_label_emit ();
4003 if (!mvs_check_label (CODE_LABEL_NUMBER (operands[1])))
4005 mvs_check_page (0, 6, 4);
4006 return \"L 14,=A(%l1)\;BCTR %0,14\";
4008 if (mvs_check_page (0, 4, 0))
4010 mvs_check_page (0, 2, 4);
4011 return \"L 14,=A(%l1)\;BCTR %0,14\";
4013 return \"BCT %0,%l1\";
4017 ;;- Unconditional jump instructions.
4021 ; jump instruction pattern(s).
4026 (label_ref (match_operand 0 "" "")))]
4030 check_label_emit ();
4031 if (!mvs_check_label (CODE_LABEL_NUMBER (operands[0])))
4033 mvs_check_page (0, 6, 4);
4034 return \"L 14,=A(%l0)\;BR 14\";
4036 if (mvs_check_page (0, 4, 0))
4038 mvs_check_page (0, 2, 4);
4039 return \"L 14,=A(%l0)\;BR 14\";
4045 ; indirect-jump instruction pattern(s).
4048 (define_insn "indirect_jump"
4049 [(set (pc) (match_operand:SI 0 "general_operand" "r"))]
4050 "(GET_CODE (operands[0]) != MEM )"
4053 check_label_emit ();
4054 mvs_check_page (0, 2, 0);
4059 ; tablejump instruction pattern(s).
4062 (define_insn "tablejump"
4064 (match_operand:SI 0 "general_operand" "am"))
4065 (use (label_ref (match_operand 1 "" "")))]
4069 check_label_emit ();
4070 if (REG_P (operands[0]))
4072 mvs_check_page (0, 6, 0);
4073 return \"BR %0\;DS 0F\";
4075 mvs_check_page (0, 10, 0);
4076 return \"L 14,%0\;BR 14\;DS 0F\";
4080 ;;- Jump to subroutine.
4082 ;; For the C/370 environment the internal functions, ie. sqrt, are called with
4083 ;; a non-standard form. So, we must fix it here. There's no BM like IBM.
4087 ; call instruction pattern(s).
4091 [(call (match_operand:QI 0 "memory_operand" "m")
4092 (match_operand:SI 1 "immediate_operand" "i"))]
4096 static char temp[128];
4097 int i = STACK_POINTER_OFFSET;
4099 check_label_emit ();
4100 if (mvs_function_check (XSTR (operands[0], 0)))
4102 mvs_check_page (0, 22, 4);
4103 sprintf ( temp, \"LA 1,136(,13)\;ST 1,%d(,13)\;LA 1,%d(,13)\;L 15,%%0\;BALR 14,15\;LD 0,136(,13)\",
4108 mvs_check_page (0, 10, 4);
4109 sprintf ( temp, \"LA 1,%d(,13)\;L 15,%%0\;BALR 14,15\", i );
4115 ; call_value instruction pattern(s).
4118 (define_insn "call_value"
4119 [(set (match_operand 0 "" "rf")
4120 (call (match_operand:QI 1 "memory_operand" "m")
4121 (match_operand:SI 2 "general_operand" "i")))]
4125 static char temp[128];
4126 int i = STACK_POINTER_OFFSET;
4128 check_label_emit ();
4129 if (mvs_function_check (XSTR (operands[1], 0)))
4131 mvs_check_page (0, 22, 4);
4132 sprintf ( temp, \"LA 1,136(,13)\;ST 1,%d(,13)\;LA 1,%d(,13)\;L 15,%%1\;BALR 14,15\;LD 0,136(,13)\",
4137 mvs_check_page (0, 10, 4);
4138 sprintf ( temp, \"LA 1,%d(,13)\;L 15,%%1\;BALR 14,15\", i );
4144 [(call (mem:QI (match_operand:SI 0 "" "i"))
4145 (match_operand:SI 1 "general_operand" "g"))]
4146 "GET_CODE (operands[0]) == SYMBOL_REF"
4149 static char temp[128];
4150 int i = STACK_POINTER_OFFSET;
4152 check_label_emit ();
4153 if (mvs_function_check (XSTR (operands[0], 0)))
4155 mvs_check_page (0, 22, 4);
4156 sprintf ( temp, \"LA 1,136(,13)\;ST 1,%d(,13)\;LA 1,%d(,13)\;L 15,%%0\;BALR 14,15\;LD 0,136(,13)\",
4161 mvs_check_page (0, 10, 4);
4162 sprintf ( temp, \"LA 1,%d(,13)\;L 15,%%0\;BALR 14,15\", i );
4168 [(set (match_operand 0 "" "rf")
4169 (call (mem:QI (match_operand:SI 1 "" "i"))
4170 (match_operand:SI 2 "general_operand" "g")))]
4171 "GET_CODE (operands[1]) == SYMBOL_REF"
4174 static char temp[128];
4175 int i = STACK_POINTER_OFFSET;
4177 check_label_emit ();
4178 if (mvs_function_check (XSTR (operands[1], 0)))
4180 mvs_check_page (0, 22, 4);
4181 sprintf ( temp, \"LA 1,136(,13)\;ST 1,%d(,13)\;LA 1,%d(,13)\;L 15,%%1\;BALR 14,15\;LD 0,136(,13)\",
4186 mvs_check_page (0, 10, 4);
4187 sprintf ( temp, \"LA 1,%d(,13)\;L 15,%%1\;BALR 14,15\", i );
4194 ;;- Miscellaneous instructions.
4198 ; nop instruction pattern(s).
4206 check_label_emit ();
4207 mvs_check_page (0, 2, 0);