1 ;; Machine description for Sunplus S+CORE
3 ;; Free Software Foundation, Inc.
4 ;; Contributed by Sunnorth.
6 ;; This file is part of GCC.
8 ;; GCC is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; GCC is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GCC; see the file COPYING. If not, write to
20 ;; the Free Software Foundation, 51 Franklin Street, Fifth Floor,
21 ;; Boston, MA 02110-1301, USA.
23 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
25 ; branch conditional branch
26 ; jump unconditional jump
27 ; call unconditional call
28 ; load load instruction(s)
29 ; store store instruction(s)
31 ; arith integer arithmetic instruction
32 ; move data movement within same register set
35 ; mul integer multiply
37 ; cndmv conditional moves
38 ; fce transfer from hi/lo registers
39 ; tce transfer to hi/lo registers
40 ; fsr transfer from special registers
41 ; tsr transfer to special registers
42 ; pseudo pseudo instruction
77 "unknown,branch,jump,call,load,store,cmp,arith,move,const,nop,mul,div,cndmv,fce,tce,fsr,tsr,fcr,tcr,pseudo"
78 (const_string "unknown"))
80 (define_attr "mode" "unknown,none,QI,HI,SI,DI"
81 (const_string "unknown"))
83 (define_attr "up_c" "yes,no"
87 (include "predicates.md")
92 [(set (match_operand:QI 0 "nonimmediate_operand" "=d,d,d,m,d,*x,d,*a")
93 (match_operand:QI 1 "general_operand" "i,d,m,d,*x,d,*a,d"))]
96 switch (which_alternative)
98 case 0: return mdp_limm (operands);
99 case 1: return mdp_move (operands);
100 case 2: return mdp_linsn (operands, MDA_BYTE, false);
101 case 3: return mdp_sinsn (operands, MDA_BYTE);
102 case 4: return TARGET_MAC ? \"mf%1%S0 %0\" : \"mf%1 %0\";
103 case 5: return TARGET_MAC ? \"mt%0%S1 %1\" : \"mt%0 %1\";
104 case 6: return \"mfsr %0, %1\";
105 case 7: return \"mtsr %1, %0\";
106 default: gcc_unreachable ();
109 [(set_attr "type" "arith,move,load,store,fce,tce,fsr,tsr")
110 (set_attr "mode" "QI")])
113 [(set (match_operand:HI 0 "nonimmediate_operand" "=d,d,d,m,d,*x,d,*a")
114 (match_operand:HI 1 "general_operand" "i,d,m,d,*x,d,*a,d"))]
117 switch (which_alternative)
119 case 0: return mdp_limm (operands);
120 case 1: return mdp_move (operands);
121 case 2: return mdp_linsn (operands, MDA_HWORD, false);
122 case 3: return mdp_sinsn (operands, MDA_HWORD);
123 case 4: return TARGET_MAC ? \"mf%1%S0 %0\" : \"mf%1 %0\";
124 case 5: return TARGET_MAC ? \"mt%0%S1 %1\" : \"mt%0 %1\";
125 case 6: return \"mfsr %0, %1\";
126 case 7: return \"mtsr %1, %0\";
127 default: gcc_unreachable ();
130 [(set_attr "type" "arith,move,load,store,fce,tce,fsr,tsr")
131 (set_attr "mode" "HI")])
134 [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,m,d,*x,d,*a,d,c")
135 (match_operand:SI 1 "general_operand" "i,d,m,d,*x,d,*a,d,c,d"))]
138 switch (which_alternative)
141 if (GET_CODE (operands[1]) != CONST_INT)
142 return \"la %0, %1\";
144 return mdp_limm (operands);
145 case 1: return mdp_move (operands);
146 case 2: return mdp_linsn (operands, MDA_WORD, false);
147 case 3: return mdp_sinsn (operands, MDA_WORD);
148 case 4: return TARGET_MAC ? \"mf%1%S0 %0\" : \"mf%1 %0\";
149 case 5: return TARGET_MAC ? \"mt%0%S1 %1\" : \"mt%0 %1\";
150 case 6: return \"mfsr %0, %1\";
151 case 7: return \"mtsr %1, %0\";
152 case 8: return \"mfcr %0, %1\";
153 case 9: return \"mtcr %1, %0\";
154 default: gcc_unreachable ();
157 [(set_attr "type" "arith,move,load,store,fce,tce,fsr,tsr,fcr,tcr")
158 (set_attr "mode" "SI")])
160 (define_insn_and_split "movdi"
161 [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,m,d,*x")
162 (match_operand:DI 1 "general_operand" "i,d,m,d,*x,d"))]
168 mds_movdi (operands);
172 (define_insn "addsi3"
173 [(set (match_operand:SI 0 "register_operand" "=d,d,d")
174 (plus:SI (match_operand:SI 1 "register_operand" "0,d,%d")
175 (match_operand:SI 2 "arith_operand" "L,N,d")))]
181 [(set_attr "type" "arith")
182 (set_attr "mode" "SI")])
184 (define_insn "*addsi3_cmp"
185 [(set (reg:CC_NZ CC_REGNUM)
186 (compare:CC_NZ (plus:SI (match_operand:SI 0 "register_operand" "d,d,d")
187 (match_operand:SI 1 "arith_operand" "N,L,d"))
191 %[ addri.c r1, %0, %c1 %]
192 %[ m%V0 r1, %0\;addi.c r1, %2 %]
193 %[ add.c r1, %0, %1 %]"
194 [(set_attr "type" "arith")
195 (set_attr "up_c" "yes")
196 (set_attr "mode" "SI")])
198 (define_insn "addsi3_ucc"
199 [(set (reg:CC_NZ CC_REGNUM)
200 (compare:CC_NZ (plus:SI (match_operand:SI 1 "register_operand" "0,d,d")
201 (match_operand:SI 2 "arith_operand" "L,N,d"))
203 (set (match_operand:SI 0 "register_operand" "=d,d,d")
204 (plus:SI (match_dup 1) (match_dup 2)))]
207 switch (which_alternative)
209 case 0: return mdp_add_imm_ucc (operands);
210 case 1: return \"addri.c %0, %1, %c2\";
211 case 2: return mdp_select (operands, "add", true, "");
212 default: gcc_unreachable ();
215 [(set_attr "type" "arith")
216 (set_attr "up_c" "yes")
217 (set_attr "mode" "SI")])
219 (define_insn "adddi3"
220 [(set (match_operand:DI 0 "register_operand" "=*e,d")
221 (plus:DI (match_operand:DI 1 "register_operand" "*0,d")
222 (match_operand:DI 2 "register_operand" "*e,d")))
223 (clobber (reg:CC CC_REGNUM))]
226 add! %L0, %L2\;addc! %H0, %H2
227 add.c %L0, %L1, %L2\;addc %H0, %H1, %H2"
228 [(set_attr "type" "arith")
229 (set_attr "mode" "DI")])
231 (define_insn "subsi3"
232 [(set (match_operand:SI 0 "register_operand" "=d")
233 (minus:SI (match_operand:SI 1 "register_operand" "d")
234 (match_operand:SI 2 "register_operand" "d")))]
237 [(set_attr "type" "arith")
238 (set_attr "mode" "SI")])
240 (define_insn "*subsi3_cmp"
241 [(set (reg:CC_NZ CC_REGNUM)
242 (compare:CC_NZ (minus:SI (match_operand:SI 0 "register_operand" "d")
243 (match_operand:SI 1 "register_operand" "d"))
246 "%[ sub.c r1, %0, %1 %]"
247 [(set_attr "type" "arith")
248 (set_attr "up_c" "yes")
249 (set_attr "mode" "SI")])
252 [(set (match_operand:SI 0 "g32reg_operand" "")
253 (minus:SI (match_operand:SI 1 "g32reg_operand" "")
254 (match_operand:SI 2 "g32reg_operand" "")))
255 (set (reg:CC CC_REGNUM)
256 (compare:CC (match_dup 1) (match_dup 2)))]
259 [(set (reg:CC CC_REGNUM)
260 (compare:CC (match_dup 1) (match_dup 2)))
262 (minus:SI (match_dup 1) (match_dup 2)))])])
264 (define_insn "subsi3_ucc_pcmp"
266 [(set (reg:CC CC_REGNUM)
267 (compare:CC (match_operand:SI 1 "register_operand" "d")
268 (match_operand:SI 2 "register_operand" "d")))
269 (set (match_operand:SI 0 "register_operand" "=d")
270 (minus:SI (match_dup 1) (match_dup 2)))])]
273 return mdp_select (operands, "sub", false, "");
275 [(set_attr "type" "arith")
276 (set_attr "up_c" "yes")
277 (set_attr "mode" "SI")])
279 (define_insn "subsi3_ucc"
280 [(set (reg:CC_NZ CC_REGNUM)
281 (compare:CC_NZ (minus:SI (match_operand:SI 1 "register_operand" "d")
282 (match_operand:SI 2 "register_operand" "d"))
284 (set (match_operand:SI 0 "register_operand" "=d")
285 (minus:SI (match_dup 1) (match_dup 2)))]
288 return mdp_select (operands, "sub", false, "");
290 [(set_attr "type" "arith")
291 (set_attr "up_c" "yes")
292 (set_attr "mode" "SI")])
294 (define_insn "subdi3"
295 [(set (match_operand:DI 0 "register_operand" "=*e,d")
296 (minus:DI (match_operand:DI 1 "register_operand" "*0,d")
297 (match_operand:DI 2 "register_operand" "*e,d")))
298 (clobber (reg:CC CC_REGNUM))]
301 sub! %L0, %L2\;subc %H0, %H1, %H2
302 sub.c %L0, %L1, %L2\;subc %H0, %H1, %H2"
303 [(set_attr "type" "arith")
304 (set_attr "mode" "DI")])
306 (define_insn "andsi3"
307 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
308 (and:SI (match_operand:SI 1 "register_operand" "0,0,d,d")
309 (match_operand:SI 2 "arith_operand" "K,Q,M,d")))]
316 [(set_attr "type" "arith")
317 (set_attr "mode" "SI")])
319 (define_insn "andsi3_cmp"
320 [(set (reg:CC_NZ CC_REGNUM)
321 (compare:CC_NZ (and:SI (match_operand:SI 0 "register_operand" "d,d,d,d")
322 (match_operand:SI 1 "arith_operand" "M,K,Q,d"))
326 %[ andri.c r1, %0, %c1 %]
327 %[ m%V0 r1, %0\;andi.c r1, %c1 %]
328 %[ m%V0 r1, %0\;andis.c r1, %U1 %]
329 %[ and.c r1, %0, %1 %]"
330 [(set_attr "type" "arith")
331 (set_attr "up_c" "yes")
332 (set_attr "mode" "SI")])
334 (define_insn "andsi3_ucc"
335 [(set (reg:CC_NZ CC_REGNUM)
336 (compare:CC_NZ (and:SI
337 (match_operand:SI 1 "register_operand" "0,0,d,d")
338 (match_operand:SI 2 "arith_operand" "K,Q,M,d"))
340 (set (match_operand:SI 0 "register_operand" "=d,d,d,d")
341 (and:SI (match_dup 1) (match_dup 2)))]
344 switch (which_alternative)
346 case 0: return \"andi.c %0, %c2\";
347 case 1: return \"andis.c %0, %U2\";
348 case 2: return \"andri.c %0, %1, %c2\";
349 case 3: return mdp_select (operands, "and", true, "");
350 default: gcc_unreachable ();
353 [(set_attr "type" "arith")
354 (set_attr "up_c" "yes")
355 (set_attr "mode" "SI")])
357 (define_insn_and_split "*zero_extract_andi"
358 [(set (reg:CC_NZ CC_REGNUM)
359 (compare:CC_NZ (zero_extract:SI
360 (match_operand:SI 0 "register_operand" "d")
361 (match_operand:SI 1 "const_bi_operand" "")
362 (match_operand:SI 2 "const_bi_operand" ""))
369 mds_zero_extract_andi (operands);
373 (define_insn "iorsi3"
374 [(set (match_operand:SI 0 "register_operand" "=d,d,d,d")
375 (ior:SI (match_operand:SI 1 "register_operand" "0,0,d,d")
376 (match_operand:SI 2 "arith_operand" "K,Q,M,d")))]
383 [(set_attr "type" "arith")
384 (set_attr "mode" "SI")])
386 (define_insn "iorsi3_ucc"
387 [(set (reg:CC_NZ CC_REGNUM)
388 (compare:CC_NZ (ior:SI (match_operand:SI 1 "register_operand" "d")
389 (match_operand:SI 2 "register_operand" "d"))
391 (set (match_operand:SI 0 "register_operand" "=d")
392 (ior:SI (match_dup 1) (match_dup 2)))]
395 return mdp_select (operands, "or", true, "");
397 [(set_attr "type" "arith")
398 (set_attr "up_c" "yes")
399 (set_attr "mode" "SI")])
401 (define_insn "iorsi3_cmp"
402 [(set (reg:CC_NZ CC_REGNUM)
403 (compare:CC_NZ (ior:SI (match_operand:SI 0 "register_operand" "d")
404 (match_operand:SI 1 "register_operand" "d"))
407 "%[ or.c r1, %0, %1 %]"
408 [(set_attr "type" "arith")
409 (set_attr "up_c" "yes")
410 (set_attr "mode" "SI")])
412 (define_insn "xorsi3"
413 [(set (match_operand:SI 0 "register_operand" "=d")
414 (xor:SI (match_operand:SI 1 "register_operand" "d")
415 (match_operand:SI 2 "register_operand" "d")))]
418 [(set_attr "type" "arith")
419 (set_attr "mode" "SI")])
421 (define_insn "xorsi3_ucc"
422 [(set (reg:CC_NZ CC_REGNUM)
423 (compare:CC_NZ (xor:SI (match_operand:SI 1 "register_operand" "d")
424 (match_operand:SI 2 "register_operand" "d"))
426 (set (match_operand:SI 0 "register_operand" "=d")
427 (xor:SI (match_dup 1) (match_dup 2)))]
430 return mdp_select (operands, "xor", true, "");
432 [(set_attr "type" "arith")
433 (set_attr "up_c" "yes")
434 (set_attr "mode" "SI")])
436 (define_insn "xorsi3_cmp"
437 [(set (reg:CC_NZ CC_REGNUM)
438 (compare:CC_NZ (xor:SI (match_operand:SI 0 "register_operand" "d")
439 (match_operand:SI 1 "register_operand" "d"))
442 "%[ xor.c r1, %0, %1 %]"
443 [(set_attr "type" "arith")
444 (set_attr "up_c" "yes")
445 (set_attr "mode" "SI")])
447 (define_insn "extendqisi2"
448 [(set (match_operand:SI 0 "register_operand" "=d,d")
449 (sign_extend:SI (match_operand:QI 1 "nonimmediate_operand" "d,m")))]
452 switch (which_alternative)
454 case 0: return \"extsb %0, %1\";
455 case 1: return mdp_linsn (operands, MDA_BYTE, true);
456 default: gcc_unreachable ();
459 [(set_attr "type" "arith,load")
460 (set_attr "mode" "SI")])
462 (define_insn "extendqisi2_cmp"
463 [(set (reg:CC_N CC_REGNUM)
464 (compare:CC_N (ashiftrt:SI
465 (ashift:SI (match_operand:SI 0 "register_operand" "d")
470 "%[ extsb.c r1, %0 %]"
471 [(set_attr "type" "arith")
472 (set_attr "up_c" "yes")
473 (set_attr "mode" "SI")])
475 (define_insn "extendqisi2_ucc"
476 [(set (reg:CC_N CC_REGNUM)
477 (compare:CC_N (ashiftrt:SI
478 (ashift:SI (match_operand:SI 1 "register_operand" "d")
482 (set (match_operand:SI 0 "register_operand" "=d")
483 (sign_extend:SI (match_operand:QI 2 "register_operand" "0")))]
486 [(set_attr "type" "arith")
487 (set_attr "up_c" "yes")
488 (set_attr "mode" "SI")])
490 (define_insn "zero_extendqisi2"
491 [(set (match_operand:SI 0 "register_operand""=d,d")
492 (zero_extend:SI (match_operand:QI 1 "register_operand" "d,m")))]
495 switch (which_alternative)
497 case 0: return \"extzb %0, %1\";
498 case 1: return mdp_linsn (operands, MDA_BYTE, false);
499 default: gcc_unreachable ();
502 [(set_attr "type" "arith, load")
503 (set_attr "mode" "SI")])
505 (define_insn "extendhisi2"
506 [(set (match_operand:SI 0 "register_operand" "=d,d")
507 (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "d,m")))]
510 switch (which_alternative)
512 case 0: return \"extsh %0, %1\";
513 case 1: return mdp_linsn (operands, MDA_HWORD, true);
514 default: gcc_unreachable ();
517 [(set_attr "type" "arith, load")
518 (set_attr "mode" "SI")])
520 (define_insn "extendhisi2_cmp"
521 [(set (reg:CC_N CC_REGNUM)
522 (compare:CC_N (ashiftrt:SI
523 (ashift:SI (match_operand:SI 0 "register_operand" "d")
528 "%[ extsh.c r1, %0 %]"
529 [(set_attr "type" "arith")
530 (set_attr "up_c" "yes")
531 (set_attr "mode" "SI")])
533 (define_insn "extendhisi2_ucc"
534 [(set (reg:CC_N CC_REGNUM)
535 (compare:CC_N (ashiftrt:SI
536 (ashift:SI (match_operand:SI 1 "register_operand" "d")
540 (set (match_operand:SI 0 "register_operand" "=d")
541 (sign_extend:SI (match_operand:HI 2 "register_operand" "0")))]
544 [(set_attr "type" "arith")
545 (set_attr "up_c" "yes")
546 (set_attr "mode" "SI")])
548 (define_insn "zero_extendhisi2"
549 [(set (match_operand:SI 0 "register_operand" "=d,d")
550 (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "d,m")))]
553 switch (which_alternative)
555 case 0: return \"extzh %0, %1\";
556 case 1: return mdp_linsn (operands, MDA_HWORD, false);
557 default: gcc_unreachable ();
560 [(set_attr "type" "arith, load")
561 (set_attr "mode" "SI")])
563 (define_insn "mulsi3"
564 [(set (match_operand:SI 0 "register_operand" "=l")
565 (mult:SI (match_operand:SI 1 "register_operand" "d")
566 (match_operand:SI 2 "register_operand" "d")))
567 (clobber (reg:SI HI_REGNUM))]
570 [(set_attr "type" "mul")
571 (set_attr "mode" "SI")])
573 (define_insn "mulsidi3"
574 [(set (match_operand:DI 0 "register_operand" "=x")
575 (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))
577 (match_operand:SI 2 "register_operand" "d"))))]
580 [(set_attr "type" "mul")
581 (set_attr "mode" "DI")])
583 (define_insn "umulsidi3"
584 [(set (match_operand:DI 0 "register_operand" "=x")
585 (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "d"))
587 (match_operand:SI 2 "register_operand" "d"))))]
590 [(set_attr "type" "mul")
591 (set_attr "mode" "DI")])
593 (define_insn "divmodsi4"
594 [(set (match_operand:SI 0 "register_operand" "=l")
595 (div:SI (match_operand:SI 1 "register_operand" "d")
596 (match_operand:SI 2 "register_operand" "d")))
597 (set (match_operand:SI 3 "register_operand" "=h")
598 (mod:SI (match_dup 1) (match_dup 2)))]
601 [(set_attr "type" "div")
602 (set_attr "mode" "SI")])
604 (define_insn "udivmodsi4"
605 [(set (match_operand:SI 0 "register_operand" "=l")
606 (udiv:SI (match_operand:SI 1 "register_operand" "d")
607 (match_operand:SI 2 "register_operand" "d")))
608 (set (match_operand:SI 3 "register_operand" "=h")
609 (umod:SI (match_dup 1) (match_dup 2)))]
612 [(set_attr "type" "div")
613 (set_attr "mode" "SI")])
615 (define_insn "ashlsi3"
616 [(set (match_operand:SI 0 "register_operand" "=d,d")
617 (ashift:SI (match_operand:SI 1 "register_operand" "d,d")
618 (match_operand:SI 2 "arith_operand" "J,d")))]
623 [(set_attr "type" "arith")
624 (set_attr "mode" "SI")])
626 (define_insn "ashlsi3_ucc"
627 [(set (reg:CC_NZ CC_REGNUM)
628 (compare:CC_NZ (ashift:SI
629 (match_operand:SI 1 "register_operand" "d,d")
630 (match_operand:SI 2 "arith_operand" "J,d"))
632 (set (match_operand:SI 0 "register_operand" "=d,d")
633 (ashift:SI (match_dup 1) (match_dup 2)))]
636 switch (which_alternative)
638 case 0: return mdp_select (operands, "slli", false, "c");
639 case 1: return mdp_select (operands, "sll", false, "");
640 default: gcc_unreachable ();
643 [(set_attr "type" "arith")
644 (set_attr "up_c" "yes")
645 (set_attr "mode" "SI")])
647 (define_insn "ashlsi3_cmp"
648 [(set (reg:CC_NZ CC_REGNUM)
649 (compare:CC_NZ (ashift:SI
650 (match_operand:SI 0 "register_operand" "d,d")
651 (match_operand:SI 1 "arith_operand" "J,d"))
655 %[ slli.c r1, %0, %c1 %]
656 %[ sll.c r1, %0, %1 %]"
657 [(set_attr "type" "arith")
658 (set_attr "up_c" "yes")
659 (set_attr "mode" "SI")])
661 (define_insn "ashrsi3"
662 [(set (match_operand:SI 0 "register_operand" "=d,d")
663 (ashiftrt:SI (match_operand:SI 1 "register_operand" "d,d")
664 (match_operand:SI 2 "arith_operand" "J,d")))]
669 [(set_attr "type" "arith")
670 (set_attr "mode" "SI")])
672 (define_insn "ashrsi3_ucc"
673 [(set (reg:CC_NZ CC_REGNUM)
674 (compare:CC_NZ (ashiftrt:SI
675 (match_operand:SI 1 "register_operand" "d,d")
676 (match_operand:SI 2 "arith_operand" "J,d"))
678 (set (match_operand:SI 0 "register_operand" "=d,d")
679 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
682 switch (which_alternative)
684 case 0: return \"srai.c %0, %1, %c2\";
685 case 1: return mdp_select (operands, "sra", false, "");
686 default: gcc_unreachable ();
689 [(set_attr "type" "arith")
690 (set_attr "up_c" "yes")
691 (set_attr "mode" "SI")])
693 (define_insn "ashrsi3_cmp"
694 [(set (reg:CC_NZ CC_REGNUM)
695 (compare:CC_NZ (ashiftrt:SI
696 (match_operand:SI 0 "register_operand" "d,d")
697 (match_operand:SI 1 "arith_operand" "J,d"))
701 %[ srai.c r1, %0, %c1 %]
702 %[ sra.c r1, %0, %1 %]"
703 [(set_attr "type" "arith")
704 (set_attr "up_c" "yes")
705 (set_attr "mode" "SI")])
707 (define_insn "ashrsi3_ucc_n"
708 [(set (reg:CC_N CC_REGNUM)
709 (compare:CC_N (ashiftrt:SI
710 (match_operand:SI 1 "register_operand" "d,d")
711 (match_operand:SI 2 "arith_operand" "J,d"))
713 (set (match_operand:SI 0 "register_operand" "=d,d")
714 (ashiftrt:SI (match_dup 1) (match_dup 2)))]
717 switch (which_alternative)
719 case 0: return \"srai.c %0, %1, %c2\";
720 case 1: return mdp_select (operands, "sra", false, "");
721 default: gcc_unreachable ();
724 [(set_attr "type" "arith")
725 (set_attr "up_c" "yes")
726 (set_attr "mode" "SI")])
728 (define_insn "ashrsi3_cmp_n"
729 [(set (reg:CC_N CC_REGNUM)
730 (compare:CC_N (ashiftrt:SI
731 (match_operand:SI 0 "register_operand" "d,d")
732 (match_operand:SI 1 "arith_operand" "J,d"))
736 %[ srai.c r1, %0, %c1 %]
737 %[ sra.c r1, %0, %1 %]"
738 [(set_attr "type" "arith")
739 (set_attr "up_c" "yes")
740 (set_attr "mode" "SI")])
742 (define_insn "lshrsi3"
743 [(set (match_operand:SI 0 "register_operand" "=d,d")
744 (lshiftrt:SI (match_operand:SI 1 "register_operand" "d,d")
745 (match_operand:SI 2 "arith_operand" "J,d")))]
750 [(set_attr "type" "arith")
751 (set_attr "mode" "SI")])
753 (define_insn "lshrsi3_ucc"
754 [(set (reg:CC_NZ CC_REGNUM)
755 (compare:CC_NZ (lshiftrt:SI
756 (match_operand:SI 1 "register_operand" "d,d")
757 (match_operand:SI 2 "arith_operand" "J,d"))
759 (set (match_operand:SI 0 "register_operand" "=d,d")
760 (lshiftrt:SI (match_dup 1) (match_dup 2)))]
763 switch (which_alternative)
765 case 0: return mdp_select (operands, "srli", false, "c");
766 case 1: return mdp_select (operands, "srl", false, "");
767 default: gcc_unreachable ();
770 [(set_attr "type" "arith")
771 (set_attr "up_c" "yes")
772 (set_attr "mode" "SI")])
774 (define_insn "lshrsi3_cmp"
775 [(set (reg:CC_NZ CC_REGNUM)
776 (compare:CC_NZ (lshiftrt:SI
777 (match_operand:SI 0 "register_operand" "d,d")
778 (match_operand:SI 1 "arith_operand" "J,d"))
782 %[ srli.c r1, %0, %c1 %]
783 %[ srl.c r1, %0, %1 %]"
784 [(set_attr "type" "arith")
785 (set_attr "up_c" "yes")
786 (set_attr "mode" "SI")])
788 (define_insn "negsi2"
789 [(set (match_operand:SI 0 "register_operand" "=d")
790 (neg:SI (match_operand:SI 1 "register_operand" "d")))]
793 [(set_attr "type" "arith")
794 (set_attr "mode" "SI")])
796 (define_insn "negsi2_ucc"
797 [(set (reg:CC CC_REGNUM)
798 (compare:CC (neg:SI (match_operand:SI 1 "register_operand" "*e,d"))
800 (set (match_operand:SI 0 "register_operand" "=*e,d")
801 (neg:SI (match_dup 1)))]
806 [(set_attr "type" "arith")
807 (set_attr "up_c" "yes")
808 (set_attr "mode" "SI")])
810 (define_insn "one_cmplsi2"
811 [(set (match_operand:SI 0 "register_operand" "=d")
812 (not:SI (match_operand:SI 1 "register_operand" "d")))]
815 [(set_attr "type" "arith")
816 (set_attr "mode" "SI")])
818 (define_insn "one_cmplsi2_ucc"
819 [(set (reg:CC_NZ CC_REGNUM)
820 (compare:CC_NZ (not:SI (match_operand:SI 1 "register_operand" "*e,d"))
822 (set (match_operand:SI 0 "register_operand" "=*e,d")
823 (not:SI (match_dup 1)))]
828 [(set_attr "type" "arith")
829 (set_attr "up_c" "yes")
830 (set_attr "mode" "SI")])
832 (define_insn "one_cmplsi2_cmp"
833 [(set (reg:CC_NZ CC_REGNUM)
834 (compare:CC_NZ (not:SI (match_operand:SI 0 "register_operand" "*e,d"))
840 [(set_attr "type" "arith")
841 (set_attr "up_c" "yes")
842 (set_attr "mode" "SI")])
844 (define_insn "rotlsi3"
845 [(set (match_operand:SI 0 "register_operand" "=d,d")
846 (rotate:SI (match_operand:SI 1 "register_operand" "d,d")
847 (match_operand:SI 2 "arith_operand" "J,d")))
848 (clobber (reg:CC CC_REGNUM))]
853 [(set_attr "type" "arith")
854 (set_attr "mode" "SI")])
856 (define_insn "rotrsi3"
857 [(set (match_operand:SI 0 "register_operand" "=d,d")
858 (rotatert:SI (match_operand:SI 1 "register_operand" "d,d")
859 (match_operand:SI 2 "arith_operand" "J,d")))
860 (clobber (reg:CC CC_REGNUM))]
865 [(set_attr "type" "arith")
866 (set_attr "mode" "SI")])
868 (define_expand "cmpsi"
869 [(match_operand:SI 0 "register_operand" "")
870 (match_operand:SI 1 "arith_operand" "")]
873 cmp_op0 = operands[0];
874 cmp_op1 = operands[1];
878 (define_insn "cmpsi_nz"
879 [(set (reg:CC_NZ CC_REGNUM)
880 (compare:CC_NZ (match_operand:SI 0 "register_operand" "d,*e,d")
881 (match_operand:SI 1 "arith_operand" "L,*e,d")))]
887 [(set_attr "type" "cmp")
888 (set_attr "up_c" "yes")
889 (set_attr "mode" "SI")])
891 (define_insn "cmpsi_n"
892 [(set (reg:CC_N CC_REGNUM)
893 (compare:CC_N (match_operand:SI 0 "register_operand" "d,*e,d")
894 (match_operand:SI 1 "arith_operand" "L,*e,d")))]
900 [(set_attr "type" "cmp")
901 (set_attr "up_c" "yes")
902 (set_attr "mode" "SI")])
904 (define_insn "cmpsi_cc"
905 [(set (reg:CC CC_REGNUM)
906 (compare:CC (match_operand:SI 0 "register_operand" "d,*e,d")
907 (match_operand:SI 1 "arith_operand" "L,*e,d")))]
913 [(set_attr "type" "cmp")
914 (set_attr "up_c" "yes")
915 (set_attr "mode" "SI")])
919 (if_then_else (eq (reg:CC CC_REGNUM) (const_int 0))
920 (label_ref (match_operand 0 "" ""))
924 mda_gen_cmp (CCmode);
929 (if_then_else (ne (reg:CC CC_REGNUM) (const_int 0))
930 (label_ref (match_operand 0 "" ""))
934 mda_gen_cmp (CCmode);
939 (if_then_else (gt (reg:CC CC_REGNUM) (const_int 0))
940 (label_ref (match_operand 0 "" ""))
944 mda_gen_cmp (CCmode);
949 (if_then_else (le (reg:CC CC_REGNUM) (const_int 0))
950 (label_ref (match_operand 0 "" ""))
954 mda_gen_cmp (CCmode);
959 (if_then_else (ge (reg:CC CC_REGNUM) (const_int 0))
960 (label_ref (match_operand 0 "" ""))
964 mda_gen_cmp (CCmode);
969 (if_then_else (lt (reg:CC CC_REGNUM) (const_int 0))
970 (label_ref (match_operand 0 "" ""))
974 mda_gen_cmp (CCmode);
977 (define_expand "bgtu"
979 (if_then_else (gtu (reg:CC CC_REGNUM) (const_int 0))
980 (label_ref (match_operand 0 "" ""))
984 mda_gen_cmp (CCmode);
987 (define_expand "bleu"
989 (if_then_else (leu (reg:CC CC_REGNUM) (const_int 0))
990 (label_ref (match_operand 0 "" ""))
994 mda_gen_cmp (CCmode);
997 (define_expand "bgeu"
999 (if_then_else (geu (reg:CC CC_REGNUM) (const_int 0))
1000 (label_ref (match_operand 0 "" ""))
1004 mda_gen_cmp (CCmode);
1007 (define_expand "bltu"
1009 (if_then_else (ltu (reg:CC CC_REGNUM) (const_int 0))
1010 (label_ref (match_operand 0 "" ""))
1014 mda_gen_cmp (CCmode);
1017 (define_insn "branch_n"
1020 (match_operator 0 "branch_n_operator"
1021 [(reg:CC_N CC_REGNUM)
1023 (label_ref (match_operand 1 "" ""))
1027 [(set_attr "type" "branch")])
1029 (define_insn "branch_nz"
1032 (match_operator 0 "branch_nz_operator"
1033 [(reg:CC_NZ CC_REGNUM)
1035 (label_ref (match_operand 1 "" ""))
1039 [(set_attr "type" "branch")])
1041 (define_insn "branch_cc"
1044 (match_operator 0 "comparison_operator"
1047 (label_ref (match_operand 1 "" ""))
1051 [(set_attr "type" "branch")])
1055 (label_ref (match_operand 0 "" "")))]
1063 [(set_attr "type" "jump")])
1065 (define_expand "sibcall"
1066 [(parallel [(call (match_operand 0 "" "")
1067 (match_operand 1 "" ""))
1068 (use (match_operand 2 "" ""))])]
1071 mdx_call (operands, true);
1075 (define_insn "sibcall_internal"
1076 [(call (mem:SI (match_operand:SI 0 "call_insn_operand" "t,Z"))
1077 (match_operand 1 "" ""))
1078 (clobber (reg:SI RT_REGNUM))]
1079 "SIBLING_CALL_P (insn)"
1082 switch (which_alternative)
1084 case 0: return \"br%S0 %0\";
1085 case 1: return \"j %0\";
1086 default: gcc_unreachable ();
1089 switch (which_alternative)
1091 case 0: return \"mv r29, %0\;.cpadd r29\;br r29\";
1092 case 1: return \"la r29, %0\;br r29\";
1093 default: gcc_unreachable ();
1096 [(set_attr "type" "call")])
1098 (define_expand "sibcall_value"
1099 [(parallel [(set (match_operand 0 "" "")
1100 (call (match_operand 1 "" "") (match_operand 2 "" "")))
1101 (use (match_operand 3 "" ""))])]
1104 mdx_call_value (operands, true);
1108 (define_insn "sibcall_value_internal"
1109 [(set (match_operand 0 "register_operand" "=d,d")
1110 (call (mem:SI (match_operand:SI 1 "call_insn_operand" "t,Z"))
1111 (match_operand 2 "" "")))
1112 (clobber (reg:SI RT_REGNUM))]
1113 "SIBLING_CALL_P (insn)"
1116 switch (which_alternative)
1118 case 0: return \"br%S1 %1\";
1119 case 1: return \"j %1\";
1120 default: gcc_unreachable ();
1123 switch (which_alternative)
1125 case 0: return \"mv r29, %1\;.cpadd r29\;br r29\";
1126 case 1: return \"la r29, %1\;br r29\";
1127 default: gcc_unreachable ();
1130 [(set_attr "type" "call")])
1132 (define_expand "call"
1133 [(parallel [(call (match_operand 0 "" "") (match_operand 1 "" ""))
1134 (use (match_operand 2 "" ""))])]
1137 mdx_call (operands, false);
1141 (define_insn "call_internal"
1142 [(call (mem:SI (match_operand:SI 0 "call_insn_operand" "d,Z"))
1143 (match_operand 1 "" ""))
1144 (clobber (reg:SI RA_REGNUM))]
1148 switch (which_alternative)
1150 case 0: return \"brl%S0 %0\";
1151 case 1: return \"jl %0\";
1152 default: gcc_unreachable ();
1155 switch (which_alternative)
1157 case 0: return \"mv r29, %0\;.cpadd r29\;brl r29\";
1158 case 1: return \"la r29, %0\;brl r29\";
1159 default: gcc_unreachable ();
1162 [(set_attr "type" "call")])
1164 (define_expand "call_value"
1165 [(parallel [(set (match_operand 0 "" "")
1166 (call (match_operand 1 "" "") (match_operand 2 "" "")))
1167 (use (match_operand 3 "" ""))])]
1170 mdx_call_value (operands, false);
1174 (define_insn "call_value_internal"
1175 [(set (match_operand 0 "register_operand" "=d,d")
1176 (call (mem:SI (match_operand:SI 1 "call_insn_operand" "d,Z"))
1177 (match_operand 2 "" "")))
1178 (clobber (reg:SI RA_REGNUM))]
1182 switch (which_alternative)
1184 case 0: return \"brl%S1 %1\";
1185 case 1: return \"jl %1\";
1186 default: gcc_unreachable ();
1189 switch (which_alternative)
1191 case 0: return \"mv r29, %1\;.cpadd r29\;brl r29\";
1192 case 1: return \"la r29, %1\;brl r29\";
1193 default: gcc_unreachable ();
1196 [(set_attr "type" "call")])
1198 (define_expand "indirect_jump"
1199 [(set (pc) (match_operand 0 "register_operand" "d"))]
1204 if (GET_CODE (dest) != REG
1205 || GET_MODE (dest) != Pmode)
1206 operands[0] = copy_to_mode_reg (Pmode, dest);
1208 emit_jump_insn (gen_indirect_jump_internal1 (operands[0]));
1212 (define_insn "indirect_jump_internal1"
1213 [(set (pc) (match_operand:SI 0 "register_operand" "d"))]
1216 [(set_attr "type" "jump")])
1218 (define_expand "tablejump"
1220 (match_operand 0 "register_operand" "d"))
1221 (use (label_ref (match_operand 1 "" "")))]
1224 if (GET_MODE (operands[0]) != ptr_mode)
1226 emit_jump_insn (gen_tablejump_internal1 (operands[0], operands[1]));
1230 (define_insn "tablejump_internal1"
1232 (match_operand:SI 0 "register_operand" "d"))
1233 (use (label_ref (match_operand 1 "" "")))]
1237 return \"mv r29, %0\;.cpadd r29\;br r29\";
1239 return \"br%S0 %0\";
1241 [(set_attr "type" "jump")])
1243 (define_expand "prologue"
1251 (define_expand "epilogue"
1255 mdx_epilogue (false);
1259 (define_expand "sibcall_epilogue"
1263 mdx_epilogue (true);
1267 (define_insn "return_internal"
1269 (use (match_operand 0 "pmode_register_operand" "d"))]
1279 (define_insn "cpload"
1280 [(unspec:SI [(const_int 1)] 1)]
1285 (define_insn "cprestore"
1286 [(unspec:SI [(match_operand:SI 0 "" "")] 2)]