OSDN Git Service

2001-07-26 Andrew Haley <aph@redhat.com>
[pf3gnuchains/gcc-fork.git] / gcc / config / clipper / clipper.md
1 ;;- Machine description for GNU compiler, Clipper Version
2 ;;  Copyright (C) 1987, 1988, 1991, 1993, 1994, 1997, 1998, 1999, 2001
3 ;;  Free Software Foundation, Inc.
4 ;; Contributed by Holger Teutsch (holger@hotbso.rhein-main.de)
5
6 ;; This file is part of GNU CC.
7
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)
11 ;; any later version.
12
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.
17
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.
22
23
24 ;;- Instruction patterns.  When multiple patterns apply,
25 ;;- the first one in the file is chosen.
26 ;;-
27 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
28 ;;-
29 ;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
30 ;;- updates for most instructions.
31
32 ;;
33 ;; define attributes
34 ;;
35 ;; instruction type
36 ;;
37 ;; unknown is temporary in order to generate 'cc clobber' until attribute
38 ;; assignment is consistent
39 ;;
40 (define_attr "type" "load,store,arith,fp,branch,unknown"
41  (const_string "unknown"))
42
43 ;; condition code setting
44 ;;
45 ;; clobber      destroyed
46 ;; unchanged
47 ;; set1         set cc_status.value1, e.g. sub r0,r1
48 ;; set2         set value1 and value2, e.g. mov r0,r1
49 ;; change0      may be side effect, i.e. load mem,r0
50 ;;
51 ;; note: loadi and loadq are 'arith' instructions that set the condition codes
52 ;;       mul,div,mod do NOT set the condition codes
53 ;;
54 (define_attr "cc" "clobber,unchanged,set1,set2,change0"
55  (cond [(eq_attr "type" "load") (const_string "change0")
56         (eq_attr "type" "store,branch") (const_string "unchanged")
57         (eq_attr "type" "arith") (if_then_else (match_operand:SI 0 "" "")
58                                   (const_string "set1")
59                                   (const_string "clobber"))
60         ]
61   (const_string "clobber")))
62
63 ;;
64 ;; clipper seems to be a traditional risc processor
65 ;; we define a functional unit 'memory'
66 ;;
67 (define_function_unit "memory" 1 1 (eq_attr "type" "load") 4 0)     
68
69 \f
70 ;; We don't want to allow a constant operand for test insns because
71 ;; (set (cc0) (const_int foo)) has no mode information.  Such insns will
72 ;; be folded while optimizing anyway.
73
74 (define_insn "tstsi"
75   [(set (cc0)
76         (match_operand:SI 0 "int_reg_operand" "r"))]
77   ""
78   "cmpq   $0,%0")
79
80 (define_insn "cmpsi"
81   [(set (cc0)
82         (compare (match_operand:SI 0 "nonimmediate_operand" "r,r,n")
83                  (match_operand:SI 1 "nonmemory_operand" "r,n,r")))]
84   ""
85   "*
86 {
87   int val;
88
89   if (which_alternative == 0)
90     return \"cmpw   %1,%0\";
91
92   if (which_alternative == 1)
93     {
94       val = INTVAL (operands[1]);
95       if (0 <= val && val < 16)
96         return \"cmpq   %1,%0\";
97       return \"cmpi   %1,%0\";
98     }
99
100   cc_status.flags |= CC_REVERSED;       /* immediate must be first */
101
102   val = INTVAL (operands[0]);
103
104   if (0 <= val && val < 16)
105     return \"cmpq   %0,%1\";
106
107   return \"cmpi   %0,%1\";
108 }")
109
110 (define_insn "cmpdf"
111   [(set (cc0)
112         (compare (match_operand:DF 0 "fp_reg_operand" "f")
113                  (match_operand:DF 1 "fp_reg_operand" "f")))]
114   ""
115   "cmpd   %1,%0")
116
117 (define_insn "cmpsf"
118   [(set (cc0)
119         (compare (match_operand:SF 0 "fp_reg_operand" "f")
120                  (match_operand:SF 1 "fp_reg_operand" "f")))]
121   ""
122   "cmps   %1,%0")
123
124 \f
125 ;;
126 ;; double and single float move
127 ;;
128 (define_expand "movdf"
129   [(set (match_operand:DF 0 "general_operand" "")
130         (match_operand:DF 1 "general_operand" ""))]
131   ""
132   "
133 {
134   if (GET_CODE (operands[0]) == MEM)
135     {
136       if (GET_CODE (operands[1]) == CONST_DOUBLE)
137         operands[1] = force_reg (DFmode,
138                                  force_const_mem (DFmode, operands[1]));
139       else if (GET_CODE (operands[1]) != REG)
140         operands[1] = force_reg (DFmode, operands[1]);
141     }
142
143   else if (GET_CODE (operands[1]) == CONST_DOUBLE)
144     operands[1] = force_const_mem (DFmode, operands[1]);
145 }")
146
147 ;;
148 ;; provide two patterns with different predicates as we don't want combine
149 ;; to recombine a mem -> mem move
150 ;; 
151 (define_insn ""
152   [(set (match_operand:DF 0 "register_operand" "=*rf")
153         (match_operand:DF 1 "nonimmediate_operand" "*rfo"))]
154   ""
155   "*
156 {
157 #define FP_REG_P(X) (GET_CODE (X) == REG && REGNO (X) >= 16)
158
159   if (FP_REG_P (operands[0]))
160     {
161       if (FP_REG_P (operands[1]))       /* f -> f */
162         return \"movd   %1,%0\";
163
164       if (GET_CODE (operands[1]) == REG) /* r -> f */
165         return \"movld  %1,%0\";
166
167       return \"loadd  %1,%0\";          /* m -> f */
168     }
169
170   if (FP_REG_P (operands[1]))
171     {
172       if (GET_CODE (operands[0]) == REG) /* f -> r */
173         return \"movdl  %1,%0\";
174
175       abort ();
176     }
177
178   if (GET_CODE (operands[1]) == MEM)    /* m -> r */
179     {
180       rtx xops[4];
181       xops[0] = operands[0];
182       xops[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
183       xops[2] = operands[1];
184       xops[3] = adjust_address (operands[1], SImode, 4);
185       output_asm_insn (\"loadw  %2,%0\;loadw  %3,%1\", xops);
186       return \"\";
187     }
188
189   if (GET_CODE (operands[1]) == REG)    /* r -> r */
190     {
191       rtx xops[4];
192       xops[0] = operands[0];
193       xops[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
194       xops[2] = operands[1];
195       xops[3] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
196       output_asm_insn (\"movw   %2,%0\;movw   %3,%1\", xops);
197       return \"\";
198     }
199
200   abort ();
201 #undef FP_REG_P
202 }")
203
204
205 (define_insn ""
206   [(set (match_operand:DF 0 "memory_operand" "=o,m")
207         (match_operand:DF 1 "register_operand" "*rf,f"))]
208   ""
209   "*
210 {
211   rtx xops[4];
212
213   if (REGNO (operands[1]) >= 16)        /* f -> m */
214     return \"stord  %1,%0\";
215
216   xops[0] = operands[0];                /* r -> o */
217   xops[1] = adjust_address (operands[0], SImode, 4);
218   xops[2] = operands[1];
219   xops[3] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
220   output_asm_insn (\"storw  %2,%0\;storw  %3,%1\", xops);
221   return \"\";
222 }"
223 [(set_attr "type" "store,store")
224  (set_attr "cc" "clobber,unchanged")])
225
226
227 (define_expand "movsf"
228   [(set (match_operand:SF 0 "general_operand" "")
229         (match_operand:SF 1 "general_operand" ""))]
230   ""
231   "
232 {
233   if (GET_CODE (operands[0]) == MEM)
234     {
235       if (GET_CODE (operands[1]) == CONST_DOUBLE)
236         operands[1] = force_reg (SFmode,
237                                  force_const_mem (SFmode, operands[1]));
238       else if (GET_CODE (operands[1]) != REG)
239         operands[1] = force_reg (SFmode, operands[1]);
240     }
241
242   else if (GET_CODE (operands[1]) == CONST_DOUBLE)
243     operands[1] = force_const_mem (SFmode, operands[1]);
244 }")
245
246 ;;
247 ;; provide two patterns with different predicates as we don't want combine
248 ;; to recombine a mem -> mem move
249 ;; 
250 (define_insn ""
251   [(set (match_operand:SF 0 "register_operand" "=*rf")
252         (match_operand:SF 1 "nonimmediate_operand" "*rfm"))]
253   ""
254   "*
255 {
256 #define FP_REG_P(X) (GET_CODE (X) == REG && REGNO (X) >= 16)
257
258   if (FP_REG_P (operands[0]))
259     {
260       if (FP_REG_P (operands[1]))       /* f -> f */
261         return \"movs   %1,%0\";
262       if (GET_CODE (operands[1]) == REG) /* r -> f */
263         return
264           \"subq   $8,sp\;storw  %1,(sp)\;loads  (sp),%0\;addq   $8,sp\";
265       return \"loads  %1,%0\";          /* m -> f */
266     }
267
268   if (FP_REG_P (operands[1]))
269     {
270       if (GET_CODE (operands[0]) == REG) /* f -> r */
271         return
272           \"subq   $8,sp\;stors  %1,(sp)\;loadw  (sp),%0\;addq   $8,sp\";
273       abort ();
274     }
275
276   if (GET_CODE (operands[1]) == MEM)    /* m -> r */
277     return \"loadw   %1,%0\";
278
279   if (GET_CODE (operands[1]) == REG)    /* r -> r */
280     return \"movw    %1,%0\";
281
282   abort ();
283 #undef FP_REG_P
284 }")
285
286 (define_insn ""
287   [(set (match_operand:SF 0 "memory_operand" "=m")
288         (match_operand:SF 1 "register_operand" "*rf"))]
289   ""
290   "*
291 {
292   if (GET_CODE (operands[1]) == REG && REGNO (operands[1]) >= 16)
293     return \"stors  %1,%0\";            /* f-> m */
294
295   return \"storw   %1,%0\";             /* r -> m */
296 }"
297 [(set_attr "type" "store")])
298
299
300 (define_expand "movdi"
301   [(set (match_operand:DI 0 "general_operand" "")
302         (match_operand:DI 1 "general_operand" ""))]
303   ""
304   "
305 {
306   if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) != REG)
307     operands[1] = force_reg (DImode, operands[1]);
308 }")
309
310 ;; If an operand is a MEM but not offsettable, we can't load it into
311 ;; a register, so we must force the third alternative to be the one
312 ;; reloaded.  Hence we show the first as more expensive.
313 (define_insn ""
314   [(set (match_operand:DI 0 "register_operand" "=?r,r,r")
315         (match_operand:DI 1 "general_operand"   "r,n,o"))]
316   ""
317   "*
318 {
319   rtx xoperands[2],yoperands[2];
320
321   xoperands[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
322
323   if (which_alternative == 0)           /* r -> r */
324     {
325       output_asm_insn (\"movw   %1,%0\", operands);
326       xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
327       output_asm_insn (\"movw   %1,%0\", xoperands);
328       return \"\";
329     }
330
331   if (which_alternative == 1)           /* n -> r */
332     {
333       if (GET_CODE (operands[1]) == CONST_INT)
334         {
335           output_asm_insn (\"loadi   %1,%0\", operands);
336           output_asm_insn (\"loadq   $0,%0\", xoperands);
337           return \"\";
338         }
339
340       if (GET_CODE (operands[1]) != CONST_DOUBLE)
341         abort ();
342
343       yoperands[0] = operands[0];
344       yoperands[1] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
345       output_asm_insn (\"loadi  %1,%0\", yoperands);
346
347       xoperands[1] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
348       output_asm_insn (\"loadi  %1,%0\", xoperands);
349       return \"\";
350     }
351                                         /* m -> r */
352   output_asm_insn (\"loadw  %1,%0\", operands);
353   xoperands[1] = adjust_address (operands[1], SImode, 4);
354   output_asm_insn (\"loadw  %1,%0\", xoperands);
355   return \"\";
356 }" 
357 [(set_attr "type" "arith,arith,load")
358   (set_attr "cc" "clobber,clobber,clobber")])
359
360 (define_insn ""
361   [(set (match_operand:DI 0 "memory_operand" "=o")
362         (match_operand:DI 1 "register_operand" "r"))]
363   ""
364   "*
365 {
366   rtx xops[4];
367   xops[0] = operands[0];
368   xops[1] = adjust_address (operands[0], SImode, 4);
369   xops[2] = operands[1];
370   xops[3] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
371   output_asm_insn (\"storw  %2,%0\;storw  %3,%1\", xops);
372   return \"\";
373 }"
374 [(set_attr "type" "store")
375  (set_attr "cc" "clobber")])
376
377 (define_expand "movsi"
378   [(set (match_operand:SI 0 "general_operand" "")
379         (match_operand:SI 1 "general_operand" ""))]
380   ""
381   "
382 {
383   if (GET_CODE (operands[0]) == MEM &&
384       GET_CODE (operands[1]) != REG)
385     operands[1] = force_reg (SImode, operands[1]);
386 }")
387
388 ;; Reject both args with `general_operand' if not reloading because a
389 ;; mem -> mem move that was split by 'movsi' can be recombined to
390 ;; mem -> mem by the combiner.
391 ;;
392 ;; As a pseudo register can end up in a stack slot during reloading we must
393 ;; allow a r->m move for the next pattern. 
394 ;; The first predicate must be `general_operand' because a predicate must
395 ;; be true for each constraint.
396 ;;  
397 (define_insn ""
398   [(set (match_operand:SI 0 "general_operand" "=r,r,r,r,m")
399         (match_operand:SI 1 "general_operand"  "r,m,n,i,r"))]
400   "reload_in_progress || register_operand (operands[0], SImode)"
401   "*
402 {
403   int val;
404
405   if (which_alternative == 0)
406     return \"movw   %1,%0\";            /* reg -> reg */
407
408   if (which_alternative == 1)
409     return \"loadw  %1,%0\";            /* mem -> reg */
410
411   if (which_alternative == 2)
412     {
413       val = INTVAL (operands[1]);       /* known const ->reg */
414
415       if (val == -1)
416         return \"notq   $0,%0\";
417
418       if (val < 0 || val >= 16)
419         return \"loadi  %1,%0\";
420
421       return \"loadq  %1,%0\";
422     }
423
424   if (which_alternative == 3)           /* unknown const */
425     return \"loada  %a1,%0\";
426
427   return \"storw  %1,%0\";
428 }"
429 [(set_attr "type" "arith,load,arith,load,store")
430  (set_attr "cc" "set2,change0,set1,change0,unchanged")])
431
432
433 (define_insn ""
434   [(set (match_operand:SI 0 "memory_operand" "=m")
435         (match_operand:SI 1 "int_reg_operand" "r"))]
436   ""
437   "storw  %1,%0"
438 [(set_attr "type" "store")])
439
440 ;; movhi
441 ;;
442 ;; loadh  mem to reg
443 ;; storh  reg to mem
444 ;;
445 ;;
446 (define_expand "movhi"
447   [(set (match_operand:HI 0 "general_operand" "")
448         (match_operand:HI 1 "general_operand" ""))]
449   ""
450   "
451 {
452   if (GET_CODE (operands[0]) == MEM
453       && ! register_operand (operands[1], HImode))
454     operands[1] = force_reg (HImode, operands[1]);
455 }")
456
457
458 (define_insn ""
459   [(set (match_operand:HI 0 "register_operand" "=r,r,r")
460         (match_operand:HI 1 "general_operand"   "r,m,n"))]
461   ""
462   "@
463    movw   %1,%0
464    loadh  %1,%0
465    loadi  %1,%0"
466 [(set_attr "type" "arith,load,arith")])
467
468 (define_insn ""
469   [(set (match_operand:HI 0 "memory_operand"  "=m")
470         (match_operand:HI 1 "register_operand" "r"))]
471   ""
472   "storh  %1,%0"
473  [(set_attr "type" "store")])
474
475 ;; movqi
476 ;;
477 ;; loadb  mem to reg
478 ;; storb  reg to mem
479 ;;
480 (define_expand "movqi"
481   [(set (match_operand:QI 0 "general_operand" "")
482         (match_operand:QI 1 "general_operand" ""))]
483   ""
484   "
485 {
486   if (GET_CODE (operands[0]) == MEM && 
487       ! register_operand (operands[1], QImode))
488     operands[1] = force_reg (QImode, operands[1]);
489 }")
490
491
492 (define_insn ""
493   [(set (match_operand:QI 0 "register_operand" "=r,r,r")
494         (match_operand:QI 1 "general_operand"   "r,m,n"))]
495   ""
496   "@
497    movw   %1,%0
498    loadb  %1,%0
499    loadi  %1,%0"
500 [(set_attr "type" "arith,load,arith")])
501
502 (define_insn ""
503   [(set (match_operand:QI 0 "memory_operand" "=m")
504         (match_operand:QI 1 "register_operand" "r"))]
505   ""
506   "storb  %1,%0"
507 [(set_attr "type" "store")])
508
509 \f
510 ;;
511 ;; block move
512 ;;
513 (define_expand "movstrsi"
514   [(parallel
515     [(set (match_operand:BLK 0 "memory_operand" "")
516           (match_operand:BLK 1 "memory_operand" ""))
517      (use (match_operand:SI 2 "general_operand" ""))
518      (use (match_operand:SI 3 "const_int_operand" ""))
519      (clobber (match_scratch:SI 4 ""))
520      (clobber (match_scratch:SI 5 ""))
521      (clobber (match_dup 6))
522      (clobber (match_dup 7))])]
523   ""
524   "
525 {
526   rtx addr0, addr1;
527
528   addr0 = copy_to_mode_reg (Pmode, XEXP (operands[0], 0));
529   addr1 = copy_to_mode_reg (Pmode, XEXP (operands[1], 0));
530
531   operands[6] = addr0;
532   operands[7] = addr1;
533
534   operands[0] = replace_equiv_address (operands[0], addr0);
535   operands[1] = replace_equiv_address (operands[1], addr1);
536
537   if (GET_CODE (operands[2]) != CONST_INT)
538     operands[2] = force_reg (SImode, operands[2]);
539 }")
540
541 ;;
542 ;; there is a problem with this insn in gcc-2.2.3
543 ;; (clobber (match_dup 2)) does not prevent use of this operand later
544 ;; we always use a scratch register and leave operand 2 unchanged
545 ;;
546 (define_insn ""
547   [(set (mem:BLK (match_operand:SI 0 "register_operand" "r"))
548         (mem:BLK (match_operand:SI 1 "register_operand" "r")))
549    (use (match_operand:SI 2 "nonmemory_operand" "rn"))
550    (use (match_operand:SI 3 "const_int_operand" "n"))
551    (clobber (match_scratch:SI 4 "=r"))
552    (clobber (match_scratch:SI 5 "=r"))
553    (clobber (match_dup 0))
554    (clobber (match_dup 1))]
555   ""
556   "*
557 {
558   extern void clipper_movstr ();
559   clipper_movstr (operands);
560   return \"\";
561 }"
562 [(set_attr "cc" "clobber")])
563
564
565 \f
566 ;; Extension and truncation insns.
567 (define_insn "extendhisi2"
568   [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
569         (sign_extend:SI (match_operand:HI 1 "general_operand" "0,m")))]
570   ""
571   "@
572    andi   $65535,%0\;xori   $32768,%0\;subi   $32768,%0
573    loadh  %1,%0"
574 [(set_attr "type" "arith,load")])
575
576
577 (define_insn "extendqihi2"
578   [(set (match_operand:HI 0 "int_reg_operand" "=r,r")
579         (sign_extend:HI (match_operand:QI 1 "general_operand" "0,m")))]
580   ""
581   "@
582    andi   $255,%0\;xori   $128,%0\;subi   $128,%0
583    loadb  %1,%0"
584 [(set_attr "type" "arith,load")
585  (set_attr "cc" "set1,change0")])
586
587
588 (define_insn "extendqisi2"
589   [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
590         (sign_extend:SI (match_operand:QI 1 "general_operand" "0,m")))]
591   ""
592   "@
593    andi   $255,%0\;xori   $128,%0\;subi   $128,%0
594    loadb  %1,%0"
595 [(set_attr "type" "arith,load")])
596
597
598 (define_insn "extendsfdf2"
599   [(set (match_operand:DF 0 "fp_reg_operand" "=f")
600         (float_extend:DF (match_operand:SF 1 "fp_reg_operand" "f")))]
601   ""
602   "cnvsd  %1,%0")
603
604 (define_insn "truncdfsf2"
605   [(set (match_operand:SF 0 "fp_reg_operand" "=f")
606         (float_truncate:SF (match_operand:DF 1 "fp_reg_operand" "f")))]
607   ""
608   "cnvds  %1,%0")
609
610 (define_insn "zero_extendhisi2"
611   [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
612         (zero_extend:SI (match_operand:HI 1 "general_operand" "0,m")))]
613   ""
614   "@
615    andi   $65535,%0
616    loadhu %1,%0"
617 [(set_attr "type" "arith,load")])
618
619
620 (define_insn "zero_extendqihi2"
621   [(set (match_operand:HI 0 "int_reg_operand" "=r,r")
622         (zero_extend:HI (match_operand:QI 1 "general_operand" "0,m")))]
623   ""
624   "@
625    andi   $255,%0
626    loadbu %1,%0"
627 [(set_attr "type" "arith,load")
628  (set_attr "cc" "clobber,clobber")])
629
630
631 (define_insn "zero_extendqisi2"
632   [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
633         (zero_extend:SI (match_operand:QI 1 "general_operand" "0,m")))]
634   ""
635   "@
636    andi   $255,%0
637    loadbu %1,%0"
638 [(set_attr "type" "arith,load")])
639
640
641 \f
642 ;; Fix-to-float conversion insns.
643
644 (define_insn "floatsisf2"
645   [(set (match_operand:SF 0 "fp_reg_operand" "=f")
646         (float:SF (match_operand:SI 1 "int_reg_operand" "r")))]
647   ""
648   "cnvws  %1,%0")
649
650 (define_insn "floatsidf2"
651   [(set (match_operand:DF 0 "fp_reg_operand" "=f")
652         (float:DF (match_operand:SI 1 "int_reg_operand" "r")))]
653   ""
654   "cnvwd  %1,%0")
655
656
657 ;; Float-to-fix conversion insns.
658
659 (define_insn "fix_truncsfsi2"
660   [(set (match_operand:SI 0 "int_reg_operand" "=r")
661         (fix:SI (fix:SF (match_operand:SF 1 "fp_reg_operand" "f"))))]
662   ""
663   "cnvtsw %1,%0")
664
665 (define_insn "fix_truncdfsi2"
666   [(set (match_operand:SI 0 "int_reg_operand" "=r")
667         (fix:SI (fix:DF (match_operand:DF 1 "fp_reg_operand" "f"))))]
668   ""
669   "cnvtdw %1,%0")
670 \f
671 ;;- All kinds of add instructions.
672
673 (define_insn "adddf3"
674   [(set (match_operand:DF 0 "fp_reg_operand" "=f")
675         (plus:DF (match_operand:DF 1 "fp_reg_operand" "0")
676                  (match_operand:DF 2 "fp_reg_operand" "f")))]
677   ""
678   "addd   %2,%0"
679  [(set_attr "type" "fp")])
680
681
682 (define_insn "addsf3"
683   [(set (match_operand:SF 0 "fp_reg_operand" "=f")
684         (plus:SF (match_operand:SF 1 "fp_reg_operand" "0")
685                  (match_operand:SF 2 "fp_reg_operand" "f")))]
686   ""
687   "adds   %2,%0"
688  [(set_attr "type" "fp")])
689
690 (define_insn "adddi3"
691   [(set (match_operand:DI 0 "int_reg_operand" "=r")
692         (plus:DI (match_operand:DI 1 "int_reg_operand" "%0")
693                  (match_operand:DI 2 "int_reg_operand" "r")))]
694   ""
695   "*
696 {
697   rtx xoperands[4];
698
699   xoperands[0] = operands[0];
700   xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
701   xoperands[2] = operands[2];
702   xoperands[3] = gen_rtx_REG (SImode, REGNO (operands[2]) + 1);
703   output_asm_insn (\"addw   %2,%0\;addwc  %3,%1\", xoperands);
704   return \"\";
705 }"
706 [(set_attr "type" "arith")
707  (set_attr "cc" "clobber")])
708
709 (define_insn "addsi3"
710   [(set (match_operand:SI 0 "int_reg_operand" "=r,r,r")
711         (plus:SI (match_operand:SI 1 "int_reg_operand" "%0,r,r")
712                  (match_operand:SI 2 "nonmemory_operand" "rn,0,rn")))]
713   ""
714   "*
715 {
716   if (which_alternative == 2)           /* 3 address version */
717     {
718       if (GET_CODE (operands[2]) == CONST_INT)
719         return \"loada  %a2(%1),%0\";
720       return \"loada  [%2](%1),%0\";
721     }
722                                         /* 2 address version */
723   if (GET_CODE (operands[2]) == CONST_INT)
724     {
725       int val = INTVAL (operands[2]);
726
727       if (val >= 16 || val == 0x80000000)
728         return \"addi   %2,%0\";
729
730       if (val < 0)                      /* change to sub */
731         {
732           rtx xops[2];
733
734           val = -val;
735
736           xops[0] = operands[0];
737           xops[1] = GEN_INT (val);
738
739           if (val >= 16)
740             output_asm_insn (\"subi   %1,%0\", xops);
741           else
742             output_asm_insn (\"subq   %1,%0\", xops);
743
744           return \"\";
745         }
746
747       return \"addq   %2,%0\";
748     }
749
750   if (which_alternative == 0)
751     return \"addw   %2,%0\";
752
753   return \"addw   %1,%0\";
754 }"
755 [(set_attr "type" "arith,arith,arith")
756  (set_attr "cc" "set1,set1,change0")])
757
758 \f
759 ;;- All kinds of subtract instructions.
760
761 (define_insn "subdi3"
762   [(set (match_operand:DI 0 "int_reg_operand" "=r")
763         (minus:DI (match_operand:DI 1 "int_reg_operand" "0")
764                   (match_operand:DI 2 "int_reg_operand" "r")))]
765   ""
766   "*
767 {
768   rtx xoperands[4];
769
770   xoperands[0] = operands[0];
771   xoperands[1] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
772   xoperands[2] = operands[2];
773   xoperands[3] = gen_rtx_REG (SImode, REGNO (operands[2]) + 1);
774   output_asm_insn (\"subw   %2,%0\;subwc  %3,%1\", xoperands);
775   return \"\";
776 }"
777 [(set_attr "type" "arith")
778  (set_attr "cc" "clobber")])
779
780 (define_insn "subsi3"
781   [(set (match_operand:SI 0 "int_reg_operand" "=r")
782         (minus:SI (match_operand:SI 1 "int_reg_operand" "0")
783                   (match_operand:SI 2 "nonmemory_operand" "rn")))]
784   ""
785   "*
786 {
787   if (GET_CODE (operands[2]) == CONST_INT)
788     {
789       int val = INTVAL (operands[2]);
790
791       if (val < 0 || val >= 16)
792         return \"subi   %2,%0\";
793       else
794         return \"subq   %2,%0\";
795     }
796
797   return \"subw   %2,%0\";
798 }"
799 [(set_attr "type" "arith")])
800
801 (define_insn "subdf3"
802   [(set (match_operand:DF 0 "fp_reg_operand" "=f")
803         (minus:DF (match_operand:DF 1 "fp_reg_operand" "0")
804                   (match_operand:DF 2 "fp_reg_operand" "f")))]
805   ""
806   "subd   %2,%0"
807  [(set_attr "type" "fp")])
808
809 (define_insn "subsf3"
810   [(set (match_operand:SF 0 "fp_reg_operand" "=f")
811         (minus:SF (match_operand:SF 1 "fp_reg_operand" "0")
812                   (match_operand:SF 2 "fp_reg_operand" "f")))]
813   ""
814   "subs   %2,%0"
815  [(set_attr "type" "fp")])
816
817 \f
818 ;;- Multiply instructions.
819
820 (define_insn "muldf3"
821   [(set (match_operand:DF 0 "fp_reg_operand" "=f")
822         (mult:DF (match_operand:DF 1 "fp_reg_operand" "0")
823                  (match_operand:DF 2 "fp_reg_operand" "f")))]
824   ""
825   "muld   %2,%0"
826  [(set_attr "type" "fp")])
827
828 (define_insn "mulsf3"
829   [(set (match_operand:SF 0 "fp_reg_operand" "=f")
830         (mult:SF (match_operand:SF 1 "fp_reg_operand" "0")
831                  (match_operand:SF 2 "fp_reg_operand" "f")))]
832   ""
833   "muls   %2,%0"
834  [(set_attr "type" "fp")])
835
836 (define_insn "mulsidi3"
837   [(set (match_operand:DI 0 "int_reg_operand" "=r")
838         (mult:DI (sign_extend:DI (match_operand:SI 1 "int_reg_operand" "%0"))
839                  (sign_extend:DI (match_operand:SI 2 "int_reg_operand" "r"))))]
840   ""
841   "mulwx  %2,%0"
842 [(set_attr "type" "arith")
843  (set_attr "cc" "clobber")])
844
845 (define_insn "umulsidi3"
846   [(set (match_operand:DI 0 "int_reg_operand" "=r")
847         (mult:DI (zero_extend:DI (match_operand:SI 1 "int_reg_operand" "%0"))
848                  (zero_extend:DI (match_operand:SI 2 "int_reg_operand" "r"))))]
849   ""
850   "mulwux %2,%0"
851 [(set_attr "type" "arith")
852  (set_attr "cc" "clobber")])
853
854 (define_insn "mulsi3"
855   [(set (match_operand:SI 0 "int_reg_operand" "=r")
856         (mult:SI (match_operand:SI 1 "int_reg_operand" "%0")
857                  (match_operand:SI 2 "int_reg_operand" "r")))]
858   ""
859   "mulw   %2,%0"
860  [(set_attr "type" "arith")
861   (set_attr "cc" "clobber")])
862
863 \f
864 ;;- Divide and mod instructions.
865
866 (define_insn "divdf3"
867   [(set (match_operand:DF 0 "fp_reg_operand" "=f")
868         (div:DF (match_operand:DF 1 "fp_reg_operand" "0")
869                 (match_operand:DF 2 "fp_reg_operand" "f")))]
870   ""
871   "divd   %2,%0"
872  [(set_attr "type" "fp")])
873
874 (define_insn "divsf3"
875   [(set (match_operand:SF 0 "fp_reg_operand" "=f")
876         (div:SF (match_operand:SF 1 "fp_reg_operand" "0")
877                 (match_operand:SF 2 "fp_reg_operand" "f")))]
878   ""
879   "divs   %2,%0"
880  [(set_attr "type" "fp")])
881
882 (define_insn "divsi3"
883   [(set (match_operand:SI 0 "int_reg_operand" "=r")
884         (div:SI (match_operand:SI 1 "int_reg_operand" "0")
885                 (match_operand:SI 2 "int_reg_operand" "r")))]
886   ""
887   "divw   %2,%0"
888  [(set_attr "type" "arith")
889   (set_attr "cc" "clobber")])
890
891 (define_insn "udivsi3"
892   [(set (match_operand:SI 0 "int_reg_operand" "=r")
893         (udiv:SI (match_operand:SI 1 "int_reg_operand" "0")
894                  (match_operand:SI 2 "int_reg_operand" "r")))]
895   ""
896   "divwu  %2,%0"
897  [(set_attr "type" "arith")
898   (set_attr "cc" "clobber")])
899
900
901 (define_insn "modsi3"
902   [(set (match_operand:SI 0 "int_reg_operand" "=r")
903         (mod:SI (match_operand:SI 1 "int_reg_operand" "0")
904                 (match_operand:SI 2 "int_reg_operand" "r")))]
905   ""
906   "modw   %2,%0"
907  [(set_attr "type" "arith")
908   (set_attr "cc" "clobber")])
909
910 (define_insn "umodsi3"
911   [(set (match_operand:SI 0 "int_reg_operand" "=r")
912         (umod:SI (match_operand:SI 1 "int_reg_operand" "0")
913                  (match_operand:SI 2 "int_reg_operand" "r")))]
914   ""
915   "modwu  %2,%0"
916  [(set_attr "type" "arith")
917   (set_attr "cc" "clobber")])
918 \f
919 ;;
920 ;; bit and/or instructions
921 ;;
922 (define_insn "andsi3"
923   [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
924         (and:SI (match_operand:SI 1 "int_reg_operand" "%0,0")
925                 (match_operand:SI 2 "nonmemory_operand" "r,n")))]
926   ""
927   "@
928    andw   %2,%0
929    andi   %2,%0"
930  [(set_attr "type" "arith")])
931
932 (define_insn "iorsi3"
933   [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
934         (ior:SI (match_operand:SI 1 "int_reg_operand" "%0,0")
935                 (match_operand:SI 2 "nonmemory_operand" "r,n")))]
936   ""
937   "@
938    orw    %2,%0
939    ori    %2,%0"
940  [(set_attr "type" "arith")])
941
942 (define_insn "xorsi3"
943   [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
944         (xor:SI (match_operand:SI 1 "int_reg_operand" "%0,0")
945                 (match_operand:SI 2 "nonmemory_operand" "r,n")))]
946   ""
947   "@
948    xorw   %2,%0
949    xori   %2,%0"
950  [(set_attr "type" "arith")])
951 \f
952 (define_insn "negdf2"
953   [(set (match_operand:DF 0 "fp_reg_operand" "=f")
954         (neg:DF (match_operand:DF 1 "fp_reg_operand" "f")))]
955   ""
956   "negd   %1,%0"
957  [(set_attr "type" "fp")])
958
959 (define_insn "negsf2"
960   [(set (match_operand:SF 0 "fp_reg_operand" "=f")
961         (neg:SF (match_operand:SF 1 "fp_reg_operand" "f")))]
962   ""
963   "negs   %1,%0"
964  [(set_attr "type" "fp")])
965
966 (define_insn "negsi2"
967   [(set (match_operand:SI 0 "int_reg_operand" "=r")
968         (neg:SI (match_operand:SI 1 "int_reg_operand" "r")))]
969   ""
970   "negw   %1,%0"
971  [(set_attr "type" "arith")])
972
973 \f
974 (define_insn "one_cmplsi2"
975   [(set (match_operand:SI 0 "int_reg_operand" "=r")
976         (not:SI (match_operand:SI 1 "int_reg_operand" "r")))]
977   ""
978   "notw   %1,%0"
979  [(set_attr "type" "arith")])
980
981
982 \f
983 ;; Right shift on the clipper works by negating the shift count,
984 ;; then emitting a right shift with the shift count negated.  This means
985 ;; that all actual shift counts in the RTL will be positive.
986
987 (define_expand "ashrdi3"
988   [(set (match_operand:DI 0 "int_reg_operand" "")
989         (ashiftrt:DI (match_operand:DI 1 "int_reg_operand" "")
990                      (match_operand:SI 2 "nonmemory_operand" "")))]
991   ""
992   "
993 {
994   if (GET_CODE (operands[2]) != CONST_INT)
995     operands[2] = gen_rtx_NEG (SImode, negate_rtx (SImode, operands[2]));
996 }")
997
998 (define_insn ""
999   [(set (match_operand:DI 0 "int_reg_operand" "=r")
1000         (ashiftrt:DI (match_operand:DI 1 "int_reg_operand" "0")
1001                      (match_operand:SI 2 "const_int_operand" "n")))]
1002   ""
1003   "shali  $%n2,%0"
1004  [(set_attr "type" "arith")])
1005
1006 (define_insn ""
1007   [(set (match_operand:DI 0 "int_reg_operand" "=r")
1008         (ashiftrt:DI (match_operand:DI 1 "int_reg_operand" "0")
1009                      (neg:SI (match_operand:SI 2 "nonmemory_operand" "r"))))]
1010   ""
1011   "shal   %2,%0"
1012  [(set_attr "type" "arith")])
1013
1014 (define_expand "ashrsi3"
1015   [(set (match_operand:SI 0 "int_reg_operand" "")
1016         (ashiftrt:SI (match_operand:SI 1 "int_reg_operand" "")
1017                      (match_operand:SI 2 "nonmemory_operand" "")))]
1018   ""
1019   "
1020 {
1021   if (GET_CODE (operands[2]) != CONST_INT)
1022     operands[2] = gen_rtx_NEG (SImode, negate_rtx (SImode, operands[2]));
1023 }")
1024
1025 (define_insn ""
1026   [(set (match_operand:SI 0 "int_reg_operand" "=r")
1027         (ashiftrt:SI (match_operand:SI 1 "int_reg_operand" "0")
1028                      (match_operand:SI 2 "const_int_operand" "n")))]
1029   ""
1030   "shai   $%n2,%0"
1031  [(set_attr "type" "arith")])
1032
1033 (define_insn ""
1034   [(set (match_operand:SI 0 "int_reg_operand" "=r")
1035         (ashiftrt:SI (match_operand:SI 1 "int_reg_operand" "0")
1036                      (neg:SI (match_operand:SI 2 "nonmemory_operand" "r"))))]
1037   ""
1038   "shaw   %2,%0"
1039  [(set_attr "type" "arith")])
1040
1041 ;;
1042 ;; left shift
1043 ;;
1044
1045 (define_insn "ashldi3"
1046   [(set (match_operand:DI 0 "int_reg_operand" "=r,r")
1047         (ashift:DI (match_operand:DI 1 "int_reg_operand" "0,0")
1048                    (match_operand:SI 2 "nonmemory_operand" "r,n")))]
1049   ""
1050   "@
1051    shal   %2,%0
1052    shali  %2,%0"
1053  [(set_attr "type" "arith")])
1054
1055
1056 (define_insn "ashlsi3"
1057   [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
1058         (ashift:SI (match_operand:SI 1 "int_reg_operand" "0,0")
1059                    (match_operand:SI 2 "nonmemory_operand" "r,n")))]
1060   ""
1061   "*
1062 {
1063   int val;
1064
1065   if (which_alternative == 0)
1066    return \"shaw   %2,%0\";
1067
1068   val = INTVAL (operands[2]);
1069
1070   if (val == 2)
1071     return \"addw   %0,%0\;addw   %0,%0\";
1072
1073   if (val == 1)
1074     return \"addw   %0,%0\";
1075
1076   return \"shai   %2,%0\";
1077 }"
1078 [(set_attr "type" "arith")])
1079
1080 ;;
1081 ;; logical shift
1082 ;;
1083
1084 (define_expand "lshrdi3"
1085   [(set (match_operand:DI 0 "int_reg_operand" "")
1086         (lshiftrt:DI (match_operand:DI 1 "int_reg_operand" "")
1087                      (match_operand:SI 2 "nonmemory_operand" "")))]
1088   ""
1089   "
1090 {
1091   if (GET_CODE (operands[2]) != CONST_INT)
1092     operands[2] = gen_rtx_NEG (SImode, negate_rtx (SImode, operands[2]));
1093 }")
1094
1095 (define_insn ""
1096   [(set (match_operand:DI 0 "int_reg_operand" "=r")
1097         (lshiftrt:DI (match_operand:DI 1 "int_reg_operand" "0")
1098                      (match_operand:SI 2 "const_int_operand" "n")))]
1099   ""
1100   "shlli  $%n2,%0"
1101  [(set_attr "type" "arith")])
1102
1103 (define_insn ""
1104   [(set (match_operand:DI 0 "int_reg_operand" "=r")
1105         (lshiftrt:DI (match_operand:DI 1 "int_reg_operand" "0")
1106                      (neg:SI (match_operand:SI 2 "nonmemory_operand" "r"))))]
1107   ""
1108   "shll   %2,%0"
1109  [(set_attr "type" "arith")])
1110
1111 (define_expand "lshrsi3"
1112   [(set (match_operand:SI 0 "int_reg_operand" "")
1113         (lshiftrt:SI (match_operand:SI 1 "int_reg_operand" "")
1114                      (match_operand:SI 2 "nonmemory_operand" "")))]
1115   ""
1116   "
1117 {
1118   if (GET_CODE (operands[2]) != CONST_INT)
1119     operands[2] = gen_rtx_NEG (SImode, negate_rtx (SImode, operands[2]));
1120 }")
1121
1122 (define_insn ""
1123   [(set (match_operand:SI 0 "int_reg_operand" "=r")
1124         (lshiftrt:SI (match_operand:SI 1 "int_reg_operand" "0")
1125                      (match_operand:SI 2 "const_int_operand" "n")))]
1126   ""
1127   "shli   $%n2,%0"
1128  [(set_attr "type" "arith")])
1129
1130 (define_insn ""
1131   [(set (match_operand:SI 0 "int_reg_operand" "=r")
1132         (lshiftrt:SI (match_operand:SI 1 "int_reg_operand" "0")
1133                      (neg:SI (match_operand:SI 2 "nonmemory_operand" "r"))))]
1134   ""
1135   "shlw   %2,%0"
1136  [(set_attr "type" "arith")])
1137
1138
1139 ;;
1140 ;; rotate insn
1141 ;;
1142 (define_expand "rotrdi3"
1143   [(set (match_operand:DI 0 "int_reg_operand" "")
1144         (rotatert:DI (match_operand:DI 1 "int_reg_operand" "")
1145                      (match_operand:SI 2 "nonmemory_operand" "")))]
1146   ""
1147   "
1148 {
1149   if (GET_CODE (operands[2]) != CONST_INT)
1150     operands[2] = gen_rtx_NEG (SImode, negate_rtx (SImode, operands[2]));
1151 }")
1152
1153 (define_insn ""
1154   [(set (match_operand:DI 0 "int_reg_operand" "=r")
1155         (rotatert:DI (match_operand:DI 1 "int_reg_operand" "0")
1156                      (match_operand:SI 2 "const_int_operand" "n")))]
1157   ""
1158   "rotli  $%n2,%0"
1159  [(set_attr "type" "arith")])
1160
1161 (define_insn ""
1162   [(set (match_operand:DI 0 "int_reg_operand" "=r")
1163         (rotatert:DI (match_operand:DI 1 "int_reg_operand" "0")
1164                      (neg:SI (match_operand:SI 2 "nonmemory_operand" "r"))))]
1165   ""
1166   "rotl   %2,%0"
1167  [(set_attr "type" "arith")])
1168
1169 (define_expand "rotrsi3"
1170   [(set (match_operand:SI 0 "int_reg_operand" "")
1171         (rotatert:SI (match_operand:SI 1 "int_reg_operand" "")
1172                      (match_operand:SI 2 "nonmemory_operand" "")))]
1173   ""
1174   "
1175 {
1176   if (GET_CODE (operands[2]) != CONST_INT)
1177     operands[2] = gen_rtx_NEG (SImode, negate_rtx (SImode, operands[2]));
1178 }")
1179
1180 (define_insn ""
1181   [(set (match_operand:SI 0 "int_reg_operand" "=r")
1182         (rotatert:SI (match_operand:SI 1 "int_reg_operand" "0")
1183                      (match_operand:SI 2 "const_int_operand" "n")))]
1184   ""
1185   "roti   $%n2,%0"
1186  [(set_attr "type" "arith")])
1187
1188 (define_insn ""
1189   [(set (match_operand:SI 0 "int_reg_operand" "=r")
1190         (rotatert:SI (match_operand:SI 1 "int_reg_operand" "0")
1191                      (neg:SI (match_operand:SI 2 "nonmemory_operand" "r"))))]
1192   ""
1193   "rotw   %2,%0"
1194  [(set_attr "type" "arith")])
1195
1196 (define_insn "rotldi3"
1197   [(set (match_operand:DI 0 "int_reg_operand" "=r,r")
1198         (rotate:DI (match_operand:DI 1 "int_reg_operand" "0,0")
1199                    (match_operand:SI 2 "nonmemory_operand" "r,n")))]
1200   ""
1201   "@
1202    rotl   %2,%0
1203    rotli  %2,%0"
1204  [(set_attr "type" "arith")])
1205
1206 (define_insn "rotlsi3"
1207   [(set (match_operand:SI 0 "int_reg_operand" "=r,r")
1208         (rotate:SI (match_operand:SI 1 "int_reg_operand" "0,0")
1209                    (match_operand:SI 2 "nonmemory_operand" "r,n")))]
1210   ""
1211   "@
1212    rotw   %2,%0
1213    roti   %2,%0"
1214  [(set_attr "type" "arith")])
1215
1216 \f
1217 ;;
1218 ;; jump and branch insns
1219 ;;
1220 (define_insn "jump"
1221   [(set (pc)
1222         (label_ref (match_operand 0 "" "")))]
1223   ""
1224   "b      %l0"
1225  [(set_attr "type" "branch")])
1226
1227 (define_insn "tablejump"
1228   [(set (pc) (match_operand:SI 0 "register_operand" "r"))
1229    (use (label_ref (match_operand 1 "" "")))]
1230   ""
1231   "b      (%0)"
1232  [(set_attr "type" "branch")])
1233
1234 (define_insn "beq"
1235   [(set (pc)
1236         (if_then_else (eq (cc0)
1237                           (const_int 0))
1238                       (label_ref (match_operand 0 "" ""))
1239                       (pc)))]
1240   ""
1241   "breq   %l0"
1242  [(set_attr "type" "branch")])
1243
1244 (define_insn "bne"
1245   [(set (pc)
1246         (if_then_else (ne (cc0)
1247                           (const_int 0))
1248                       (label_ref (match_operand 0 "" ""))
1249                       (pc)))]
1250   ""
1251   "brne   %l0"
1252  [(set_attr "type" "branch")])
1253
1254 (define_insn "bgt"
1255   [(set (pc)
1256         (if_then_else (gt (cc0)
1257                           (const_int 0))
1258                       (label_ref (match_operand 0 "" ""))
1259                       (pc)))]
1260   ""
1261   "brgt   %l0"
1262  [(set_attr "type" "branch")])
1263
1264 (define_insn "bgtu"
1265   [(set (pc)
1266         (if_then_else (gtu (cc0)
1267                            (const_int 0))
1268                       (label_ref (match_operand 0 "" ""))
1269                       (pc)))]
1270   ""
1271   "brgtu  %l0"
1272  [(set_attr "type" "branch")])
1273
1274 (define_insn "blt"
1275   [(set (pc)
1276         (if_then_else (lt (cc0)
1277                           (const_int 0))
1278                       (label_ref (match_operand 0 "" ""))
1279                       (pc)))]
1280   ""
1281   "brlt   %l0"
1282  [(set_attr "type" "branch")])
1283
1284 (define_insn "bltu"
1285   [(set (pc)
1286         (if_then_else (ltu (cc0)
1287                            (const_int 0))
1288                       (label_ref (match_operand 0 "" ""))
1289                       (pc)))]
1290   ""
1291   "brltu  %l0"
1292  [(set_attr "type" "branch")])
1293
1294 (define_insn "bge"
1295   [(set (pc)
1296         (if_then_else (ge (cc0)
1297                           (const_int 0))
1298                       (label_ref (match_operand 0 "" ""))
1299                       (pc)))]
1300   ""
1301   "brge   %l0"
1302  [(set_attr "type" "branch")])
1303
1304 (define_insn "bgeu"
1305   [(set (pc)
1306         (if_then_else (geu (cc0)
1307                            (const_int 0))
1308                       (label_ref (match_operand 0 "" ""))
1309                       (pc)))]
1310   ""
1311   "brgeu  %l0"
1312  [(set_attr "type" "branch")])
1313
1314 (define_insn "ble"
1315   [(set (pc)
1316         (if_then_else (le (cc0)
1317                           (const_int 0))
1318                       (label_ref (match_operand 0 "" ""))
1319                       (pc)))]
1320  ""
1321  "brle   %l0"
1322  [(set_attr "type" "branch")])
1323
1324 (define_insn "bleu"
1325   [(set (pc)
1326         (if_then_else (leu (cc0)
1327                            (const_int 0))
1328                       (label_ref (match_operand 0 "" ""))
1329                       (pc)))]
1330  ""
1331  "brleu  %l0"
1332  [(set_attr "type" "branch")])
1333
1334 ;; Recognize reversed jumps.
1335 (define_insn ""
1336   [(set (pc)
1337         (if_then_else (match_operator 0 "comparison_operator"
1338                                       [(cc0)
1339                                        (const_int 0)])
1340                       (pc)
1341                       (label_ref (match_operand 1 "" ""))))]
1342  ""
1343  "br%C0    %l1" ; %C0 negates condition
1344  [(set_attr "type" "branch")])
1345 \f
1346 ;;
1347 ;; call instructions
1348 ;;
1349 (define_insn "call"
1350   [(call (match_operand:QI 0 "general_operand" "m")
1351          (match_operand:SI 1 "general_operand" ""))]
1352   ;; Operand 1 not used on the clipper.
1353   ""
1354   "call   sp,%0")
1355
1356 (define_insn "call_value"
1357   [(set (match_operand 0 "" "=rf")
1358         (call (match_operand:QI 1 "general_operand" "m")
1359               (match_operand:SI 2 "general_operand" "g")))]
1360   ;; Operand 2 not used on the clipper
1361   ""
1362   "call   sp,%1")
1363
1364 ;; Call subroutine returning any type.
1365
1366 (define_expand "untyped_call"
1367   [(parallel [(call (match_operand 0 "" "")
1368                     (const_int 0))
1369               (match_operand 1 "" "")
1370               (match_operand 2 "" "")])]
1371   ""
1372   "
1373 {
1374   int i;
1375
1376   emit_call_insn (GEN_CALL (operands[0], const0_rtx, NULL, const0_rtx));
1377
1378   for (i = 0; i < XVECLEN (operands[2], 0); i++)
1379     {
1380       rtx set = XVECEXP (operands[2], 0, i);
1381       emit_move_insn (SET_DEST (set), SET_SRC (set));
1382     }
1383
1384   /* The optimizer does not know that the call sets the function value
1385      registers we stored in the result block.  We avoid problems by
1386      claiming that all hard registers are used and clobbered at this
1387      point.  */
1388   emit_insn (gen_blockage ());
1389
1390   DONE;
1391 }")
1392
1393 ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and
1394 ;; all of memory.  This blocks insns from being moved across this point.
1395
1396 (define_insn "blockage"
1397   [(unspec_volatile [(const_int 0)] 0)]
1398   ""
1399   "")
1400
1401 (define_insn "indirect_jump"
1402   [(set (pc) (match_operand:SI 0 "register_operand" "r"))]
1403   ""
1404   "b      (%0)"
1405  [(set_attr "type" "branch")])
1406
1407
1408 (define_insn "nop"
1409   [(const_int 0)]
1410   ""
1411   "noop"
1412  [(set_attr "type" "arith")
1413   (set_attr "cc" "unchanged")])
1414
1415 \f
1416
1417 ;; while (--foo >= 0)
1418 ;;
1419 ;; Combiners for 'decrement test and branch' do not work for clipper.
1420 ;; These patters are jump_insns that do not allow output reloads and clipper
1421 ;; can only decrement and test registers.
1422 ;;