OSDN Git Service

* ada/gcc-interface/Make-lang.in, alias.c, attribs.c, auto-inc-dec.c,
[pf3gnuchains/gcc-fork.git] / gcc / config / rx / rx.md
1 ;;  Machine Description for Renesas RX processors
2 ;;  Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
3 ;;  Contributed by Red Hat.
4
5 ;; This file is part of GCC.
6
7 ;; GCC is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 3, or (at your option)
10 ;; any later version.
11
12 ;; GCC is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 ;; GNU General Public License for more details.
16
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GCC; see the file COPYING3.  If not see
19 ;; <http://www.gnu.org/licenses/>.
20 \f
21
22 ;; This code iterator allows all branch instructions to
23 ;; be generated from a single define_expand template.
24 (define_code_iterator most_cond [eq ne gt ge lt le gtu geu ltu leu
25                                  unordered ordered ])
26
27 ;; This code iterator is used for sign- and zero- extensions.
28 (define_mode_iterator small_int_modes [(HI "") (QI "")])
29
30 ;; We do not handle DFmode here because it is either
31 ;; the same as SFmode, or if -m64bit-doubles is active
32 ;; then all operations on doubles have to be handled by
33 ;; library functions.
34 (define_mode_iterator register_modes
35   [(SF "ALLOW_RX_FPU_INSNS") (SI "") (HI "") (QI "")])
36
37
38 ;; Used to map RX condition names to GCC
39 ;; condition names for builtin instructions.
40 (define_code_iterator gcc_conds [eq ne gt ge lt le gtu geu ltu leu
41                                 unge unlt uneq ltgt])
42 (define_code_attr rx_conds [(eq "eq") (ne "ne") (gt "gt") (ge "ge") (lt "lt")
43                             (le "le") (gtu "gtu") (geu "geu") (ltu "ltu")
44                             (leu "leu") (unge "pz") (unlt "n") (uneq "o")
45                             (ltgt "no")])
46
47 (define_constants
48   [
49    (SP_REG 0)
50
51    (UNSPEC_LOW_REG         0)
52    (UNSPEC_HIGH_REG        1)
53
54    (UNSPEC_RTE             10)
55    (UNSPEC_RTFI            11)
56    (UNSPEC_NAKED           12)
57    
58    (UNSPEC_MOVSTR          20)
59    (UNSPEC_MOVMEM          21)
60    (UNSPEC_SETMEM          22)
61    (UNSPEC_STRLEN          23)
62    (UNSPEC_CMPSTRN         24)
63
64    (UNSPEC_BUILTIN_BRK     30)
65    (UNSPEC_BUILTIN_CLRPSW  31)
66    (UNSPEC_BUILTIN_INT     32)
67    (UNSPEC_BUILTIN_MACHI   33)
68    (UNSPEC_BUILTIN_MACLO   34)
69    (UNSPEC_BUILTIN_MULHI   35)
70    (UNSPEC_BUILTIN_MULLO   36)
71    (UNSPEC_BUILTIN_MVFACHI 37)
72    (UNSPEC_BUILTIN_MVFACMI 38)
73    (UNSPEC_BUILTIN_MVFC    39)
74    (UNSPEC_BUILTIN_MVFCP   40)
75    (UNSPEC_BUILTIN_MVTACHI 41)
76    (UNSPEC_BUILTIN_MVTACLO 42)
77    (UNSPEC_BUILTIN_MVTC    43)
78    (UNSPEC_BUILTIN_MVTIPL  44)
79    (UNSPEC_BUILTIN_RACW    45)
80    (UNSPEC_BUILTIN_REVW    46)
81    (UNSPEC_BUILTIN_RMPA    47)
82    (UNSPEC_BUILTIN_ROUND   48)
83    (UNSPEC_BUILTIN_SAT     49)
84    (UNSPEC_BUILTIN_SETPSW  50)
85    (UNSPEC_BUILTIN_WAIT    51)
86   ]
87 )
88
89 ;; Condition code settings:
90 ;;   none     - insn does not affect the condition code bits
91 ;;   set_zs   - insn sets z,s to usable values;
92 ;;   set_zso  - insn sets z,s,o to usable values;
93 ;;   set_zsoc - insn sets z,s,o,c to usable values;
94 ;;   clobber  - value of cc0 is unknown
95 (define_attr "cc" "none,set_zs,set_zso,set_zsoc,clobber" (const_string "none"))
96
97 (define_attr "length" "" (const_int 8))
98
99 (include "predicates.md")
100 (include "constraints.md")
101
102 ;; Pipeline description.
103
104 ;; The RX only has a single pipeline.  It has five stages (fetch,
105 ;; decode, execute, memory access, writeback) each of which normally
106 ;; takes a single CPU clock cycle.
107
108 ;; The timings attribute consists of two numbers, the first is the
109 ;; throughput, which is the number of cycles the instruction takes
110 ;; to execute and generate a result.  The second is the latency
111 ;; which is the effective number of cycles the instruction takes to
112 ;; execute if its result is used by the following instruction.  The
113 ;; latency is always greater than or equal to the throughput.
114 ;; These values were taken from tables 2.13 and 2.14 in section 2.8
115 ;; of the RX610 Group Hardware Manual v0.11
116
117 ;; Note - it would be nice to use strings rather than integers for
118 ;; the possible values of this attribute, so that we can have the
119 ;; gcc build mechanism check for values that are not supported by
120 ;; the reservations below.  But this will not work because the code
121 ;; in rx_adjust_sched_cost() needs integers not strings.
122
123 (define_attr "timings" "" (const_int 11))
124
125 (define_automaton "pipelining")
126 (define_cpu_unit "throughput" "pipelining")
127
128 (define_insn_reservation "throughput__1_latency__1"  1
129   (eq_attr "timings" "11") "throughput")
130 (define_insn_reservation "throughput__1_latency__2"  2
131   (eq_attr "timings" "12") "throughput,nothing")
132 (define_insn_reservation "throughput__2_latency__2"  1
133   (eq_attr "timings" "22") "throughput*2")
134 (define_insn_reservation "throughput__3_latency__3"  1
135   (eq_attr "timings" "33") "throughput*3")
136 (define_insn_reservation "throughput__3_latency__4"  2
137   (eq_attr "timings" "34") "throughput*3,nothing")
138 (define_insn_reservation "throughput__4_latency__4"  1
139   (eq_attr "timings" "44") "throughput*4")
140 (define_insn_reservation "throughput__4_latency__5"  2
141   (eq_attr "timings" "45") "throughput*4,nothing")
142 (define_insn_reservation "throughput__5_latency__5"  1
143   (eq_attr "timings" "55") "throughput*5")
144 (define_insn_reservation "throughput__5_latency__6"  2
145   (eq_attr "timings" "56") "throughput*5,nothing")
146 (define_insn_reservation "throughput__6_latency__6"  1
147   (eq_attr "timings" "66") "throughput*6")
148 (define_insn_reservation "throughput_10_latency_10"  1
149   (eq_attr "timings" "1010") "throughput*10")
150 (define_insn_reservation "throughput_11_latency_11"  1
151   (eq_attr "timings" "1111") "throughput*11")
152 (define_insn_reservation "throughput_16_latency_16"  1
153   (eq_attr "timings" "1616") "throughput*16")
154 (define_insn_reservation "throughput_18_latency_18"  1
155   (eq_attr "timings" "1818") "throughput*18")
156
157 ;; Comparisons
158
159 (define_expand "cbranchsi4"
160   [(set (cc0) (compare:CC (match_operand:SI 1 "register_operand")
161                           (match_operand:SI 2 "rx_source_operand")))
162    (set (pc)
163         (if_then_else (match_operator:SI  0 "comparison_operator"
164                                           [(cc0) (const_int 0)])
165                       (label_ref (match_operand 3 ""))
166                       (pc)))]
167   ""
168   ""
169 )
170
171 (define_expand "cbranchsf4"
172   [(set (cc0) (compare:CC (match_operand:SF 1 "register_operand")
173                           (match_operand:SF 2 "rx_source_operand")))
174    (set (pc)
175         (if_then_else (match_operator:SI  0 "comparison_operator"
176                                           [(cc0) (const_int 0)])
177                       (label_ref (match_operand 3 ""))
178                       (pc)))]
179   "ALLOW_RX_FPU_INSNS && ! flag_non_call_exceptions"
180   ""
181 )
182
183 ;; The TST instruction is not used as it does not set the Carry flag,
184 ;; so for example, the LessThan comparison cannot be tested.
185 ;;
186 ;; (define_insn "tstsi"
187 ;;   [(set (cc0)
188 ;;         (match_operand:SI 0 "rx_source_operand"  "r,i,Q")))]
189 ;;   ""
190 ;;   {
191 ;;     rx_float_compare_mode = false;
192 ;;     return "tst\t%Q0";
193 ;;   }
194 ;;   [(set_attr "cc" "set_zs")
195 ;;    (set_attr "timings" "11,11,33")
196 ;;    (set_attr "length" "3,7,6")]
197 ;; )
198
199 (define_insn "cmpsi"
200   [(set (cc0) (compare:CC
201                (match_operand:SI 0 "register_operand"  "r,r,r,r,r,r,r")
202                (match_operand:SI 1 "rx_source_operand"
203                                  "r,Uint04,Int08,Sint16,Sint24,i,Q")))]
204   ""
205   {
206     rx_float_compare_mode = false;
207     return "cmp\t%Q1, %Q0";
208   }
209   [(set_attr "cc" "set_zsoc")
210    (set_attr "timings" "11,11,11,11,11,11,33")
211    (set_attr "length"  "2,2,3,4,5,6,5")]
212 )
213
214 ;; This pattern is disabled when -fnon-call-exceptions is active because
215 ;; it could generate a floating point exception, which would introduce an
216 ;; edge into the flow graph between this insn and the conditional branch
217 ;; insn to follow, thus breaking the cc0 relationship.  Run the g++ test
218 ;; g++.dg/eh/080514-1.C to see this happen.
219 (define_insn "cmpsf"
220   [(set (cc0)
221         (compare:CC (match_operand:SF 0 "register_operand"  "r,r,r")
222                     (match_operand:SF 1 "rx_source_operand" "r,i,Q")))]
223   "ALLOW_RX_FPU_INSNS && ! flag_non_call_exceptions"
224   {
225     rx_float_compare_mode = true;
226     return "fcmp\t%1, %0";
227   }
228   [(set_attr "cc" "set_zso")
229    (set_attr "timings" "11,11,33")
230    (set_attr "length" "3,7,5")]
231 )
232
233 ;; Flow Control Instructions:
234
235 (define_expand "b<code>"
236   [(set (pc)
237         (if_then_else (most_cond (cc0) (const_int 0))
238                       (label_ref (match_operand 0))
239                       (pc)))]
240   ""
241   ""
242 )
243
244 (define_insn "*conditional_branch"
245   [(set (pc)
246         (if_then_else (match_operator           1 "comparison_operator"
247                                                 [(cc0) (const_int 0)])
248                       (label_ref (match_operand 0 "" ""))
249                       (pc)))]
250   ""
251   {
252     return rx_gen_cond_branch_template (operands[1], false);
253   }
254   [(set_attr "length" "8")    ;; This length is wrong, but it is
255                               ;; too hard to compute statically.
256    (set_attr "timings" "33")  ;; The timing assumes that the branch is taken.
257    (set_attr "cc" "clobber")] ;; FIXME: This clobber is wrong.
258 )
259
260 (define_insn "*reveresed_conditional_branch"
261   [(set (pc)
262         (if_then_else (match_operator 1 "comparison_operator"
263                                       [(cc0) (const_int 0)])
264                       (pc)
265                       (label_ref (match_operand 0 "" ""))))]
266   ""
267   {
268     return rx_gen_cond_branch_template (operands[1], true);
269   }
270   [(set_attr "length" "8")    ;; This length is wrong, but it is
271                               ;; too hard to compute statically.
272    (set_attr "timings" "33")  ;; The timing assumes that the branch is taken.
273    (set_attr "cc" "clobber")] ;; FIXME: This clobber is wrong.
274 )
275
276 (define_insn "jump"
277   [(set (pc) (label_ref (match_operand 0 "" "")))]
278   ""
279   "bra\t%0"
280   [(set_attr "length" "4")
281    (set_attr "timings" "33")
282    (set_attr "cc" "clobber")] ;; FIXME: This clobber is wrong.
283 )
284
285 (define_insn "indirect_jump"
286   [(set (pc) (match_operand:SI 0 "register_operand" "r"))]
287   ""
288   "jmp\t%0"
289   [(set_attr "length" "2")
290    (set_attr "timings" "33")
291    (set_attr "cc" "clobber")] ;; FIXME: This clobber is wrong.
292 )
293
294 (define_insn "tablejump"
295   [(set (pc) (match_operand:SI     0 "register_operand" "r"))
296    (use (label_ref (match_operand  1 "" "")))]
297   ""
298   { return flag_pic ? (TARGET_AS100_SYNTAX ? "\n?:\tbra\t%0"
299                                            : "\n1:\tbra\t%0")
300                                            : "jmp\t%0";
301   }
302   [(set_attr "cc" "clobber") ;; FIXME: This clobber is wrong.
303    (set_attr "timings" "33")
304    (set_attr "length" "2")]
305 )
306
307 (define_insn "simple_return"
308   [(return)]
309   ""
310   "rts"
311   [(set_attr "length" "1")
312    (set_attr "timings" "55")]
313 )
314
315 (define_insn "deallocate_and_return"
316   [(set (reg:SI SP_REG)
317         (plus:SI (reg:SI SP_REG)
318                  (match_operand:SI 0 "immediate_operand" "i")))
319    (return)]
320   ""
321   "rtsd\t%0"
322   [(set_attr "length" "2")
323    (set_attr "timings" "55")]
324 )
325
326 (define_insn "pop_and_return"
327   [(match_parallel                    1 "rx_rtsd_vector"
328                    [(set:SI (reg:SI SP_REG)
329                             (plus:SI (reg:SI SP_REG)
330                                      (match_operand:SI
331                                       0 "const_int_operand" "n")))])]
332   "reload_completed"
333   {
334     rx_emit_stack_popm (operands, false);
335     return "";
336   }
337   [(set_attr "length" "3")
338    (set_attr "timings" "56")]
339 )
340
341 (define_insn "fast_interrupt_return"
342   [(unspec_volatile [(return)] UNSPEC_RTFI) ]
343   ""
344   "rtfi"
345   [(set_attr "length" "2")
346    (set_attr "timings" "33")]
347 )
348
349 (define_insn "exception_return"
350   [(unspec_volatile [(return)] UNSPEC_RTE) ]
351   ""
352   "rte"
353   [(set_attr "length" "2")
354    (set_attr "timings" "66")]
355 )
356
357 (define_insn "naked_return"
358   [(unspec_volatile [(return)] UNSPEC_NAKED) ]
359   ""
360   "; Naked function: epilogue provided by programmer."
361 )
362
363
364 ;; Note - the following set of patterns do not use the "memory_operand"
365 ;; predicate or an "m" constraint because we do not allow symbol_refs
366 ;; or label_refs as legitmate memory addresses.  This matches the
367 ;; behaviour of most of the RX instructions.  Only the call/branch
368 ;; instructions are allowed to refer to symbols/labels directly.
369 ;; The call operands are in QImode because that is the value of
370 ;; FUNCTION_MODE
371
372 (define_expand "call"
373   [(call (match_operand:QI 0 "general_operand")
374          (match_operand:SI 1 "general_operand"))]
375   ""
376   {
377     rtx dest = XEXP (operands[0], 0);
378
379     if (! rx_call_operand (dest, Pmode))
380       dest = force_reg (Pmode, dest);
381     emit_call_insn (gen_call_internal (dest, operands[1]));
382     DONE;
383   }
384 )
385
386 (define_insn "call_internal"
387   [(call (mem:QI (match_operand:SI 0 "rx_call_operand" "r,Symbol"))
388          (match_operand:SI         1 "general_operand" "g,g"))]
389   ""
390   "@
391   jsr\t%0
392   bsr\t%A0"
393   [(set_attr "length" "2,4")
394    (set_attr "timings" "33")]
395 )
396
397 (define_expand "call_value"
398   [(set (match_operand          0 "register_operand")
399         (call (match_operand:QI 1 "general_operand")
400               (match_operand:SI 2 "general_operand")))]
401   ""
402   {
403     rtx dest = XEXP (operands[1], 0);
404
405     if (! rx_call_operand (dest, Pmode))
406       dest = force_reg (Pmode, dest);
407     emit_call_insn (gen_call_value_internal (operands[0], dest, operands[2]));
408     DONE;
409   }
410 )
411
412 (define_insn "call_value_internal"
413   [(set (match_operand                  0 "register_operand" "=r,r")
414         (call (mem:QI (match_operand:SI 1 "rx_call_operand"   "r,Symbol"))
415               (match_operand:SI         2 "general_operand"   "g,g")))]
416   ""
417   "@
418   jsr\t%1
419   bsr\t%A1"
420   [(set_attr "length" "2,4")
421    (set_attr "timings" "33")]
422 )
423
424 ;; Note - we do not allow indirect sibcalls (with the address
425 ;; held in a register) because we cannot guarantee that the register
426 ;; chosen will be a call-used one.  If it is a call-saved register,
427 ;; then the epilogue code will corrupt it by popping the saved value
428 ;; off of the stack.
429 (define_expand "sibcall"
430   [(parallel
431     [(call (mem:QI (match_operand:SI 0 "rx_symbolic_call_operand"))
432            (match_operand:SI         1 "general_operand"))
433      (return)])]
434   ""
435   {
436     if (MEM_P (operands[0]))
437       operands[0] = XEXP (operands[0], 0);
438   }
439 )
440
441 (define_insn "sibcall_internal"
442   [(call (mem:QI (match_operand:SI 0 "rx_symbolic_call_operand" "Symbol"))
443          (match_operand:SI         1 "general_operand"          "g"))
444    (return)]
445   ""
446   "bra\t%A0"
447   [(set_attr "length"  "4")
448    (set_attr "timings" "33")]
449 )
450
451 (define_expand "sibcall_value"
452  [(parallel
453    [(set (match_operand                  0 "register_operand")
454          (call (mem:QI (match_operand:SI 1 "rx_symbolic_call_operand"))
455                (match_operand:SI         2 "general_operand")))
456     (return)])]
457   ""
458   {
459     if (MEM_P (operands[1]))
460       operands[1] = XEXP (operands[1], 0);
461   }
462 )
463
464 (define_insn "sibcall_value_internal"
465  [(set (match_operand                  0 "register_operand"         "=r")
466        (call (mem:QI (match_operand:SI 1 "rx_symbolic_call_operand" "Symbol"))
467              (match_operand:SI         2 "general_operand"          "g")))
468   (return)]
469   ""
470   "bra\t%A1"
471   [(set_attr "length"  "4")
472    (set_attr "timings" "33")]
473 )
474
475 ;; Function Prologue/Epilogue Instructions
476
477 (define_expand "prologue"
478   [(const_int 0)]
479   ""
480   "rx_expand_prologue (); DONE;"
481 )
482
483 (define_expand "epilogue"
484   [(return)]
485   ""
486   "rx_expand_epilogue (false); DONE;"
487 )
488
489 (define_expand "sibcall_epilogue"
490   [(return)]
491   ""
492   "rx_expand_epilogue (true); DONE;"
493 )
494
495 ;; Move Instructions
496
497 ;; Note - we do not allow memory to memory moves, even though the ISA
498 ;; supports them.  The reason is that the conditions on such moves are
499 ;; too restrictive, specifically the source addressing mode is limited
500 ;; by the destination addressing mode and vice versa.  (For example it
501 ;; is not possible to use indexed register indirect addressing for one
502 ;; of the operands if the other operand is anything other than a register,
503 ;; but it is possible to use register relative addressing when the other
504 ;; operand also uses register relative or register indirect addressing).
505 ;;
506 ;; GCC does not support computing legitimate addresses based on the
507 ;; nature of other operands involved in the instruction, and reload is
508 ;; not smart enough to cope with a whole variety of different memory
509 ;; addressing constraints, so it is simpler and safer to just refuse
510 ;; to support memory to memory moves.
511
512 (define_expand "mov<register_modes:mode>"
513   [(set (match_operand:register_modes 0 "general_operand")
514         (match_operand:register_modes 1 "general_operand"))]
515   ""
516   {
517     if (MEM_P (operand0) && MEM_P (operand1))
518       operands[1] = copy_to_mode_reg (<register_modes:MODE>mode, operand1);
519   }
520 )
521
522 (define_insn "*mov<register_modes:mode>_internal"
523   [(set (match_operand:register_modes
524          0 "nonimmediate_operand" "=r,r,r,r,r,r,m,Q,Q,Q,Q")
525         (match_operand:register_modes
526          1 "general_operand" "Int08,Sint16,Sint24,i,r,m,r,Int08,Sint16,Sint24,i"))]
527   ""
528   { return rx_gen_move_template (operands, false); }
529   [(set_attr "length" "3,4,5,6,2,4,6,5,6,7,8")
530    (set_attr "timings" "11,11,11,11,11,12,11,11,11,11,11")]
531 )
532
533 (define_insn "extend<small_int_modes:mode>si2"
534   [(set (match_operand:SI 0 "register_operand"    "=r,r")
535         (sign_extend:SI (match_operand:small_int_modes
536                           1 "nonimmediate_operand" "r,m")))]
537   ""
538   { return rx_gen_move_template (operands, false); }
539   [(set_attr "length" "2,6")
540    (set_attr "timings" "11,12")]
541 )
542
543 (define_insn "zero_extend<small_int_modes:mode>si2"
544   [(set (match_operand:SI 0 "register_operand"     "=r,r")
545         (zero_extend:SI (match_operand:small_int_modes
546                           1 "nonimmediate_operand"  "r,m")))]
547   ""
548   { return rx_gen_move_template (operands, true); }
549   [(set_attr "length" "2,4")
550    (set_attr "timings" "11,12")]
551 )
552
553 (define_insn "stack_push"
554   [(set:SI (reg:SI SP_REG)
555            (minus:SI (reg:SI SP_REG)
556                      (const_int 4)))
557    (set:SI (mem:SI (reg:SI SP_REG))
558            (match_operand:SI 0 "register_operand" "r"))]
559   ""
560   "push.l\t%0"
561   [(set_attr "length" "2")]
562 )
563
564 (define_insn "stack_pushm"
565   [(match_parallel                     1 "rx_store_multiple_vector"
566                    [(set:SI (reg:SI SP_REG)
567                             (minus:SI (reg:SI SP_REG)
568                                       (match_operand:SI
569                                        0 "const_int_operand" "n")))])]
570   "reload_completed"
571   {
572     rx_emit_stack_pushm (operands);
573     return "";
574   }
575   [(set_attr "length" "2")
576    (set_attr "timings" "44")] ;; The timing is a guesstimate average timing.
577 )
578
579 (define_insn "stack_pop"
580   [(set:SI (match_operand:SI 0 "register_operand" "=r")
581            (mem:SI (reg:SI SP_REG)))
582    (set:SI (reg:SI SP_REG)
583            (plus:SI (reg:SI SP_REG)
584                     (const_int 4)))]
585   ""
586   "pop\t%0"
587   [(set_attr "length" "2")
588    (set_attr "timings" "12")]
589 )
590
591 (define_insn "stack_popm"
592   [(match_parallel                     1 "rx_load_multiple_vector"
593                    [(set:SI (reg:SI SP_REG)
594                             (plus:SI (reg:SI SP_REG)
595                                      (match_operand:SI
596                                       0 "const_int_operand" "n")))])]
597   "reload_completed"
598   {
599     rx_emit_stack_popm (operands, true);
600     return "";
601   }
602   [(set_attr "length" "2")
603    (set_attr "timings" "45")] ;; The timing is a guesstimate average timing.
604 )
605
606 (define_insn "cstoresi4"
607   [(set (match_operand:SI  0 "register_operand" "=r,r,r,r,r,r,r")
608         (match_operator:SI
609          1 "comparison_operator"
610          [(match_operand:SI
611            2 "register_operand"  "r,r,r,r,r,r,r")
612           (match_operand:SI
613            3 "rx_source_operand" "r,Uint04,Int08,Sint16,Sint24,i,Q")]))]
614   ""
615   {
616     rx_float_compare_mode = false;
617     return "cmp\t%Q3, %Q2\n\tsc%B1.L\t%0";
618   }
619   [(set_attr "cc" "set_zsoc")
620    (set_attr "timings" "22,22,22,22,22,22,44")
621    (set_attr "length"  "5,5,6,7,8,9,8")]
622 )
623
624 (define_expand "movsicc"
625   [(set (match_operand:SI                   0 "register_operand")
626         (if_then_else:SI (match_operand:SI 1 "comparison_operator")
627                          (match_operand:SI  2 "nonmemory_operand")
628                          (match_operand:SI  3 "immediate_operand")))]
629   ""
630   {
631     if (GET_CODE (operands[1]) != EQ && GET_CODE (operands[1]) != NE)
632       FAIL;
633     if (! CONST_INT_P (operands[3]))
634       FAIL;
635   }
636 )
637
638 (define_insn "*movsieq"
639   [(set (match_operand:SI     0 "register_operand" "=r,r,r")
640         (if_then_else:SI (eq (match_operand:SI
641                               3 "register_operand"  "r,r,r")
642                              (match_operand:SI
643                               4 "rx_source_operand" "riQ,riQ,riQ"))
644                          (match_operand:SI
645                           1 "nonmemory_operand"     "0,i,r")
646                          (match_operand:SI
647                           2 "immediate_operand"     "i,i,i")))]
648   ""
649   "@
650   cmp\t%Q4, %Q3\n\tstnz\t%2, %0
651   cmp\t%Q4, %Q3\n\tmov.l\t%2, %0\n\tstz\t%1, %0
652   cmp\t%Q4, %Q3\n\tmov.l\t%1, %0\n\tstnz\t%2, %0"
653   [(set_attr "cc"      "set_zsoc")
654    (set_attr "length"  "13,19,15")
655    (set_attr "timings" "22,33,33")]
656 )
657
658 (define_insn "*movsine"
659   [(set (match_operand:SI                      0 "register_operand" "=r,r,r")
660         (if_then_else:SI (ne (match_operand:SI 3 "register_operand"  "r,r,r")
661                              (match_operand:SI 4 "rx_source_operand" "riQ,riQ,riQ"))
662                          (match_operand:SI     1 "nonmemory_operand" "0,i,r")
663                          (match_operand:SI     2 "immediate_operand" "i,i,i")))]
664   ""
665   "@
666   cmp\t%Q4, %Q3\n\tstz\t%2, %0
667   cmp\t%Q4, %Q3\n\tmov.l\t%2, %0\n\tstnz\t%1, %0
668   cmp\t%Q4, %Q3\n\tmov.l\t%1, %0\n\tstz\t%2, %0"
669   [(set_attr "cc"      "set_zsoc")
670    (set_attr "length"  "13,19,15")
671    (set_attr "timings" "22,33,33")]
672 )
673
674 ;; Arithmetic Instructions
675
676 (define_insn "abssi2"
677   [(set (match_operand:SI         0 "register_operand" "=r,r")
678         (abs:SI (match_operand:SI 1 "register_operand"  "0,r")))]
679   ""
680   "@
681   abs\t%0
682   abs\t%1, %0"
683   [(set_attr "cc" "set_zso")
684    (set_attr "length" "2,3")]
685 )
686
687 (define_insn "addsi3"
688   [(set (match_operand:SI 0 "register_operand"
689                           "=r,r,r,r,r,r,r,r,r,r,r,r")
690         (plus:SI (match_operand:SI
691                   1 "register_operand"
692                   "%0,0,0,0,0,0,r,r,r,r,r,0")
693                  (match_operand:SI
694                   2 "rx_source_operand"
695                   "r,Uint04,Sint08,Sint16,Sint24,i,r,Sint08,Sint16,Sint24,i,Q")))]
696   ""
697   "@
698   add\t%2, %0
699   add\t%2, %0
700   add\t%2, %0
701   add\t%2, %0
702   add\t%2, %0
703   add\t%2, %0
704   add\t%2, %1, %0
705   add\t%2, %1, %0
706   add\t%2, %1, %0
707   add\t%2, %1, %0
708   add\t%2, %1, %0
709   add\t%Q2, %0"
710   [(set_attr "cc" "set_zsoc")
711    (set_attr "timings" "11,11,11,11,11,11,11,11,11,11,11,33")
712    (set_attr "length" "2,2,3,4,5,6,3,3,4,5,6,5")]
713 )
714
715 (define_insn "adddi3"
716   [(set (match_operand:DI          0 "register_operand" "=r,r,r,r,r,r")
717         (plus:DI (match_operand:DI 1 "register_operand" "%0,0,0,0,0,0")
718                  (match_operand:DI 2 "rx_source_operand"
719                                    "r,Sint08,Sint16,Sint24,i,Q")))]
720   ""
721   "add\t%L2, %L0\n\tadc\t%H2, %H0"
722   [(set_attr "cc" "set_zsoc")
723    (set_attr "timings" "22,22,22,22,22,44")
724    (set_attr "length" "5,7,9,11,13,11")]
725 )
726
727 (define_insn "andsi3"
728   [(set (match_operand:SI         0 "register_operand"  "=r,r,r,r,r,r,r,r,r")
729         (and:SI (match_operand:SI 1 "register_operand"  "%0,0,0,0,0,0,r,0,Q")
730                 (match_operand:SI
731                  2 "rx_source_operand"
732                  "r,Uint04,Sint08,Sint16,Sint24,i,r,Q,0")))]
733   ""
734   "@
735   and\t%2, %0
736   and\t%2, %0
737   and\t%2, %0
738   and\t%2, %0
739   and\t%2, %0
740   and\t%2, %0
741   and\t%2, %1, %0
742   and\t%Q2, %0
743   and\t%Q1, %0"
744   [(set_attr "cc" "set_zs")
745    (set_attr "timings" "11,11,11,11,11,11,11,33,33")
746    (set_attr "length" "2,2,3,4,5,6,3,5,5")]
747 )
748
749 ;; Byte swap (single 32-bit value).
750 (define_insn "bswapsi2"
751   [(set (match_operand:SI           0 "register_operand" "+r")
752         (bswap:SI (match_operand:SI 1 "register_operand"  "r")))]
753   ""
754   "revl\t%1, %0"
755   [(set_attr "length" "3")]
756 )
757
758 ;; Byte swap (single 16-bit value).  Note - we ignore the swapping of the high 16-bits.
759 (define_insn "bswaphi2"
760   [(set (match_operand:HI           0 "register_operand" "+r")
761         (bswap:HI (match_operand:HI 1 "register_operand"  "r")))]
762   ""
763   "revw\t%1, %0"
764   [(set_attr "length" "3")]
765 )
766
767 (define_insn "divsi3"
768   [(set (match_operand:SI         0 "register_operand" "=r,r,r,r,r,r")
769         (div:SI (match_operand:SI 1 "register_operand"  "0,0,0,0,0,0")
770                 (match_operand:SI
771                  2 "rx_source_operand" "r,Sint08,Sint16,Sint24,i,Q")))]
772   ""
773   "div\t%Q2, %0"
774   [(set_attr "cc" "clobber")
775    (set_attr "timings" "1111") ;; Strictly speaking the timing should be
776                                ;; 2222, but that is a worst case sceanario.
777    (set_attr "length" "3,4,5,6,7,6")]
778 )
779
780 (define_insn "udivsi3"
781   [(set (match_operand:SI          0 "register_operand"  "=r,r,r,r,r,r")
782         (udiv:SI (match_operand:SI 1 "register_operand"   "0,0,0,0,0,0")
783                  (match_operand:SI
784                   2 "rx_source_operand"  "r,Sint08,Sint16,Sint24,i,Q")))]
785   ""
786   "divu\t%Q2, %0"
787   [(set_attr "cc" "clobber")
788    (set_attr "timings" "1010") ;; Strictly speaking the timing should be
789                                ;; 2020, but that is a worst case sceanario.
790    (set_attr "length" "3,4,5,6,7,6")]
791 )
792
793 ;; Note - these patterns are suppressed in big-endian mode because they
794 ;; generate a little endian result.  ie the most significant word of the
795 ;; result is placed in the higher numbered register of the destination
796 ;; register pair.
797
798 (define_insn "mulsidi3"
799   [(set (match_operand:DI          0 "register_operand"  "=r,r,r,r,r,r")
800         (mult:DI (sign_extend:DI (match_operand:SI
801                                   1 "register_operand"  "%0,0,0,0,0,0"))
802                  (sign_extend:DI (match_operand:SI
803                                   2 "rx_source_operand"
804                                   "r,Sint08,Sint16,Sint24,i,Q"))))]
805   "! TARGET_BIG_ENDIAN_DATA"
806   "@
807   emul\t%Q2, %0
808   emul\t%Q2, %0
809   emul\t%Q2, %0
810   emul\t%Q2, %0
811   emul\t%Q2, %0
812   emul\t%Q2, %0"
813   [(set_attr "length" "3,4,5,6,7,6")   
814    (set_attr "timings" "22,22,22,22,22,44")]
815 )
816
817 ;; See comment for mulsidi3.
818 ;; Note - the zero_extends are to distinguish this pattern from the
819 ;; mulsidi3 pattern.  Immediate mode addressing is not supported
820 ;; because gcc cannot handle the expression: (zero_extend (const_int)).
821 (define_insn "umulsidi3"
822   [(set (match_operand:DI                          0 "register_operand"
823                                                    "=r,r")
824         (mult:DI (zero_extend:DI (match_operand:SI 1 "register_operand"
825                                                    "%0,0"))
826                  (zero_extend:DI (match_operand:SI 2 "rx_compare_operand"
827                                                    "r,Q"))))]
828   "! TARGET_BIG_ENDIAN_DATA"
829   "@
830   emulu\t%Q2, %0
831   emulu\t%Q2, %0"
832   [(set_attr "length" "3,6")
833    (set_attr "timings" "22,44")]
834 )
835
836 (define_insn "smaxsi3"
837   [(set (match_operand:SI          0 "register_operand" "=r,r,r,r,r,r")
838         (smax:SI (match_operand:SI 1 "register_operand" "%0,0,0,0,0,0")
839                  (match_operand:SI 2 "rx_source_operand"
840                                    "r,Sint08,Sint16,Sint24,i,Q")))]
841   ""
842   "max\t%Q2, %0"
843   [(set_attr "length" "3,4,5,6,7,6")
844    (set_attr "timings" "11,11,11,11,11,33")]
845 )
846
847 (define_insn "sminsi3"
848   [(set (match_operand:SI          0 "register_operand" "=r,r,r,r,r,r")
849         (smin:SI (match_operand:SI 1 "register_operand" "%0,0,0,0,0,0")
850                  (match_operand:SI 2 "rx_source_operand"
851                                    "r,Sint08,Sint16,Sint24,i,Q")))]
852   ""
853   "@
854   min\t%Q2, %0
855   min\t%Q2, %0
856   min\t%Q2, %0
857   min\t%Q2, %0
858   min\t%Q2, %0
859   min\t%Q2, %0"
860   [(set_attr "length"  "3,4,5,6,7,6")
861    (set_attr "timings" "11,11,11,11,11,33")]
862 )
863
864 (define_insn "mulsi3"
865   [(set (match_operand:SI          0 "register_operand" "=r,r,r,r,r,r,r,r,r")
866         (mult:SI (match_operand:SI 1 "register_operand" "%0,0,0,0,0,0,0,Q,r")
867                  (match_operand:SI 2 "rx_source_operand"
868                                    "r,Uint04,Sint08,Sint16,Sint24,i,Q,0,r")))]
869   ""
870   "@
871   mul\t%Q2, %0
872   mul\t%Q2, %0
873   mul\t%Q2, %0
874   mul\t%Q2, %0
875   mul\t%Q2, %0
876   mul\t%Q2, %0
877   mul\t%Q2, %0
878   mul\t%Q1, %0
879   mul\t%Q2, %1, %0"
880   [(set_attr "length"  "2,2,3,4,5,6,5,5,3")
881    (set_attr "timings" "11,11,11,11,11,11,33,33,11")]
882 )
883
884 (define_insn "negsi2"
885   [(set (match_operand:SI         0 "register_operand" "=r,r")
886         (neg:SI (match_operand:SI 1 "register_operand"  "0,r")))]
887   ;; The NEG instruction does not comply with -fwrapv semantics.
888   ;; See gcc.c-torture/execute/pr22493-1.c for an example of this.
889   "! flag_wrapv"
890   "@
891   neg\t%0
892   neg\t%1, %0"
893   [(set_attr "length" "2,3")]
894 )
895
896 (define_insn "one_cmplsi2"
897   [(set (match_operand:SI         0 "register_operand" "=r,r")
898         (not:SI (match_operand:SI 1 "register_operand"  "0,r")))]
899   ""
900   "@
901   not\t%0
902   not\t%1, %0"
903   [(set_attr "cc" "set_zs")
904    (set_attr "length" "2,3")]
905 )
906
907 (define_insn "iorsi3"
908   [(set (match_operand:SI         0 "register_operand" "=r,r,r,r,r,r,r,r,r")
909         (ior:SI (match_operand:SI 1 "register_operand" "%0,0,0,0,0,0,r,0,Q")
910                 (match_operand:SI 2 "rx_source_operand"
911                                   "r,Uint04,Sint08,Sint16,Sint24,i,r,Q,0")))]
912   ""
913   "@
914   or\t%2, %0
915   or\t%2, %0
916   or\t%2, %0
917   or\t%2, %0
918   or\t%2, %0
919   or\t%2, %0
920   or\t%2, %1, %0
921   or\t%Q2, %0
922   or\t%Q1, %0"
923   [(set_attr "cc" "set_zs")
924    (set_attr "timings" "11,11,11,11,11,11,11,33,33")
925    (set_attr "length"  "2,2,3,4,5,6,3,5,5")]
926 )
927
928 (define_insn "rotlsi3"
929   [(set (match_operand:SI            0 "register_operand" "=r")
930         (rotate:SI (match_operand:SI 1 "register_operand"  "0")
931                    (match_operand:SI 2 "rx_shift_operand" "rn")))]
932   ""
933   "rotl\t%2, %0"
934   [(set_attr "cc" "set_zs")
935    (set_attr "length" "3")]
936 )
937
938 (define_insn "rotrsi3"
939   [(set (match_operand:SI              0 "register_operand" "=r")
940         (rotatert:SI (match_operand:SI 1 "register_operand"  "0")
941                      (match_operand:SI 2 "rx_shift_operand" "rn")))]
942   ""
943   "rotr\t%2, %0"
944   [(set_attr "cc" "set_zs")
945    (set_attr "length" "3")]
946 )
947
948 (define_insn "ashrsi3"
949   [(set (match_operand:SI              0 "register_operand" "=r,r,r")
950         (ashiftrt:SI (match_operand:SI 1 "register_operand"  "0,0,r")
951                      (match_operand:SI 2 "rx_shift_operand"  "r,n,n")))]
952   ""
953   "@
954   shar\t%2, %0
955   shar\t%2, %0
956   shar\t%2, %1, %0"
957   [(set_attr "cc" "set_zsoc")
958    (set_attr "length" "3,2,3")]
959 )
960
961 (define_insn "lshrsi3"
962   [(set (match_operand:SI              0 "register_operand" "=r,r,r")
963         (lshiftrt:SI (match_operand:SI 1 "register_operand"  "0,0,r")
964                      (match_operand:SI 2 "rx_shift_operand"  "r,n,n")))]
965   ""
966   "@
967   shlr\t%2, %0
968   shlr\t%2, %0
969   shlr\t%2, %1, %0"
970   [(set_attr "cc" "set_zsoc")
971    (set_attr "length" "3,2,3")]
972 )
973
974 (define_insn "ashlsi3"
975   [(set (match_operand:SI            0 "register_operand" "=r,r,r")
976         (ashift:SI (match_operand:SI 1 "register_operand"  "0,0,r")
977                    (match_operand:SI 2 "rx_shift_operand"  "r,n,n")))]
978   ""
979   "@
980   shll\t%2, %0
981   shll\t%2, %0
982   shll\t%2, %1, %0"
983   [(set_attr "cc" "set_zsoc")
984    (set_attr "length" "3,2,3")]
985 )
986
987 (define_insn "subsi3"
988   [(set (match_operand:SI           0 "register_operand" "=r,r,r,r,r")
989         (minus:SI (match_operand:SI 1 "register_operand"  "0,0,0,r,0")
990                   (match_operand:SI 2 "rx_source_operand" "r,Uint04,n,r,Q")))]
991   ""
992   "@
993   sub\t%2, %0
994   sub\t%2, %0
995   add\t%N2, %0
996   sub\t%2, %1, %0
997   sub\t%Q2, %0"
998   [(set_attr "cc" "set_zsoc")
999    (set_attr "timings" "11,11,11,11,33")
1000    (set_attr "length" "2,2,6,3,5")]
1001 )
1002
1003 (define_insn "subdi3"
1004   [(set (match_operand:DI           0 "register_operand" "=r,r")
1005         (minus:DI (match_operand:DI 1 "register_operand"  "0,0")
1006                   (match_operand:DI 2 "rx_source_operand" "r,Q")))]
1007   ""
1008   "sub\t%L2, %L0\n\tsbb\t%H2, %H0"
1009   [(set_attr "cc" "set_zsoc")
1010    (set_attr "timings" "22,44")
1011    (set_attr "length" "5,11")]
1012 )
1013
1014 (define_insn "xorsi3"
1015   [(set (match_operand:SI         0 "register_operand" "=r,r,r,r,r,r")
1016         (xor:SI (match_operand:SI 1 "register_operand" "%0,0,0,0,0,0")
1017                 (match_operand:SI 2 "rx_source_operand"
1018                                   "r,Sint08,Sint16,Sint24,i,Q")))]
1019   ""
1020   "@
1021   xor\t%Q2, %0
1022   xor\t%Q2, %0
1023   xor\t%Q2, %0
1024   xor\t%Q2, %0
1025   xor\t%Q2, %0
1026   xor\t%Q2, %0"
1027   [(set_attr "cc" "set_zs")
1028    (set_attr "timings" "11,11,11,11,11,33")
1029    (set_attr "length" "3,4,5,6,7,6")]
1030 )
1031 \f
1032 ;; Floating Point Instructions
1033
1034 (define_insn "addsf3"
1035   [(set (match_operand:SF          0 "register_operand"  "=r,r,r")
1036         (plus:SF (match_operand:SF 1 "register_operand"  "%0,0,0")
1037                  (match_operand:SF 2 "rx_source_operand"  "r,F,Q")))]
1038   "ALLOW_RX_FPU_INSNS"
1039   "@
1040   fadd\t%2, %0
1041   fadd\t%2, %0
1042   fadd\t%2, %0"
1043   [(set_attr "cc" "set_zs")
1044    (set_attr "timings" "44,44,66")
1045    (set_attr "length" "3,7,5")]
1046 )
1047
1048 (define_insn "divsf3"
1049   [(set (match_operand:SF         0 "register_operand" "=r,r,r")
1050         (div:SF (match_operand:SF 1 "register_operand"  "0,0,0")
1051                 (match_operand:SF 2 "rx_source_operand" "r,F,Q")))]
1052   "ALLOW_RX_FPU_INSNS"
1053   "fdiv\t%2, %0"
1054   [(set_attr "cc" "set_zs")
1055    (set_attr "timings" "1616,1616,1818")
1056    (set_attr "length" "3,7,5")]
1057 )
1058
1059 (define_insn "mulsf3"
1060   [(set (match_operand:SF          0 "register_operand" "=r,r,r")
1061         (mult:SF (match_operand:SF 1 "register_operand" "%0,0,0")
1062                 (match_operand:SF  2 "rx_source_operand" "r,F,Q")))]
1063   "ALLOW_RX_FPU_INSNS"
1064   "@
1065   fmul\t%2, %0
1066   fmul\t%2, %0
1067   fmul\t%2, %0"
1068   [(set_attr "cc" "set_zs")
1069    (set_attr "timings" "33,33,55")
1070    (set_attr "length"  "3,7,5")]
1071 )
1072
1073 (define_insn "subsf3"
1074   [(set (match_operand:SF           0 "register_operand" "=r,r,r")
1075         (minus:SF (match_operand:SF 1 "register_operand"  "0,0,0")
1076                   (match_operand:SF 2 "rx_source_operand" "r,F,Q")))]
1077   "ALLOW_RX_FPU_INSNS"
1078   "fsub\t%2, %0"
1079   [(set_attr "cc" "set_zs")
1080    (set_attr "timings" "44,44,66")
1081    (set_attr "length" "3,7,5")]
1082 )
1083
1084 (define_insn "fix_truncsfsi2"
1085   [(set (match_operand:SI         0 "register_operand"  "=r,r")
1086         (fix:SI (match_operand:SF 1 "rx_compare_operand" "r,Q")))]
1087   "ALLOW_RX_FPU_INSNS"
1088   "ftoi\t%1, %0"
1089   [(set_attr "cc" "set_zs")
1090    (set_attr "timings" "22,44")
1091    (set_attr "length" "3,5")]
1092 )
1093
1094 (define_insn "floatsisf2"
1095   [(set (match_operand:SF           0 "register_operand"  "=r,r")
1096         (float:SF (match_operand:SI 1 "rx_compare_operand" "r,Q")))]
1097   "ALLOW_RX_FPU_INSNS"
1098   "itof\t%1, %0"
1099   [(set_attr "cc" "set_zs")
1100    (set_attr "timings" "22,44")
1101    (set_attr "length" "3,6")]
1102 )
1103 \f
1104 ;; Bit manipulation instructions.
1105 ;; Note - there are two versions of each pattern because the memory
1106 ;; accessing versions use QImode whilst the register accessing
1107 ;; versions use SImode.
1108 ;; The peephole are here because the combiner only looks at a maximum
1109 ;; of three instructions at a time.
1110
1111 (define_insn "bitset"
1112   [(set:SI (match_operand:SI 0 "register_operand" "+r")
1113            (ior:SI (match_operand:SI 1 "register_operand" "0")
1114                    (ashift:SI (const_int 1)
1115                               (match_operand:SI 2 "nonmemory_operand" "ri"))))]
1116   ""
1117   "bset\t%2, %0"
1118   [(set_attr "length" "3")]
1119 )
1120
1121 (define_insn "bitset_in_memory"
1122   [(set:QI (match_operand:QI 0 "memory_operand" "+m")
1123            (ior:QI (match_operand:QI 1 "memory_operand" "0")
1124                    (ashift:QI (const_int 1)
1125                               (match_operand:QI 2 "nonmemory_operand" "ri"))))]
1126   ""
1127   "bset\t%2, %0.B"
1128   [(set_attr "length" "3")
1129    (set_attr "timings" "34")]
1130 )
1131
1132 ;; (set (reg A) (const_int 1))
1133 ;; (set (reg A) (ashift (reg A) (reg B)))
1134 ;; (set (reg C) (ior (reg A) (reg C)))
1135 (define_peephole2
1136   [(set:SI (match_operand:SI 0 "register_operand" "")
1137            (const_int 1))
1138    (set:SI (match_dup 0)
1139            (ashift:SI (match_dup 0)
1140                       (match_operand:SI 1 "register_operand" "")))
1141    (set:SI (match_operand:SI 2 "register_operand" "")
1142            (ior:SI (match_dup 0)
1143                    (match_dup 2)))]
1144   "dead_or_set_p (insn, operands[0])"
1145   [(set:SI (match_dup 2)
1146            (ior:SI (match_dup 2)
1147                    (ashift:SI (const_int 1)
1148                               (match_dup 1))))]
1149 )
1150   
1151 ;; (set (reg A) (const_int 1))
1152 ;; (set (reg A) (ashift (reg A) (reg B)))
1153 ;; (set (reg A) (ior (reg A) (reg C)))
1154 ;; (set (reg C) (reg A)
1155 (define_peephole2
1156   [(set:SI (match_operand:SI 0 "register_operand" "")
1157            (const_int 1))
1158    (set:SI (match_dup 0)
1159            (ashift:SI (match_dup 0)
1160                       (match_operand:SI 1 "register_operand" "")))
1161    (set:SI (match_dup 0)
1162            (ior:SI (match_dup 0)
1163                    (match_operand:SI 2 "register_operand" "")))
1164    (set:SI (match_dup 2) (match_dup 0))]
1165   "dead_or_set_p (insn, operands[0])"
1166   [(set:SI (match_dup 2)
1167            (ior:SI (match_dup 2)
1168                    (ashift:SI (const_int 1)
1169                               (match_dup 1))))]
1170 )
1171   
1172 (define_insn "bitinvert"
1173   [(set:SI (match_operand:SI 0 "register_operand" "+r")
1174            (xor:SI (match_operand:SI 1 "register_operand" "0")
1175                    (ashift:SI (const_int 1)
1176                               (match_operand:SI 2 "nonmemory_operand" "ri"))))]
1177   ""
1178   "bnot\t%2, %0"
1179   [(set_attr "length" "3")]
1180 )
1181
1182 (define_insn "bitinvert_in_memory"
1183   [(set:QI (match_operand:QI 0 "memory_operand" "+m")
1184            (xor:QI (match_operand:QI 1 "register_operand" "0")
1185                    (ashift:QI (const_int 1)
1186                               (match_operand:QI 2 "nonmemory_operand" "ri"))))]
1187   ""
1188   "bnot\t%2, %0.B"
1189   [(set_attr "length" "5")
1190    (set_attr "timings" "33")]
1191 )
1192
1193 ;; (set (reg A) (const_int 1))
1194 ;; (set (reg A) (ashift (reg A) (reg B)))
1195 ;; (set (reg C) (xor (reg A) (reg C)))
1196 (define_peephole2
1197   [(set:SI (match_operand:SI 0 "register_operand" "")
1198            (const_int 1))
1199    (set:SI (match_dup 0)
1200            (ashift:SI (match_dup 0)
1201                       (match_operand:SI 1 "register_operand" "")))
1202    (set:SI (match_operand:SI 2 "register_operand" "")
1203            (xor:SI (match_dup 0)
1204                    (match_dup 2)))]
1205   "dead_or_set_p (insn, operands[0])"
1206   [(set:SI (match_dup 2)
1207            (xor:SI (match_dup 2)
1208                    (ashift:SI (const_int 1)
1209                               (match_dup 1))))]
1210   ""
1211 )
1212   
1213 ;; (set (reg A) (const_int 1))
1214 ;; (set (reg A) (ashift (reg A) (reg B)))
1215 ;; (set (reg A) (xor (reg A) (reg C)))
1216 ;; (set (reg C) (reg A))
1217 (define_peephole2
1218   [(set:SI (match_operand:SI 0 "register_operand" "")
1219            (const_int 1))
1220    (set:SI (match_dup 0)
1221            (ashift:SI (match_dup 0)
1222                       (match_operand:SI 1 "register_operand" "")))
1223    (set:SI (match_dup 0)
1224            (xor:SI (match_dup 0)
1225                    (match_operand:SI 2 "register_operand" "")))
1226    (set:SI (match_dup 2) (match_dup 0))]
1227   "dead_or_set_p (insn, operands[0])"
1228   [(set:SI (match_dup 2)
1229            (xor:SI (match_dup 2)
1230                    (ashift:SI (const_int 1)
1231                               (match_dup 1))))]
1232   ""
1233 )
1234
1235 (define_insn "bitclr"
1236   [(set:SI (match_operand:SI 0 "register_operand" "+r")
1237            (and:SI (match_operand:SI 1 "register_operand" "0")
1238                    (not:SI (ashift:SI (const_int 1)
1239                                       (match_operand:SI 2 "nonmemory_operand" "ri")))))]
1240   ""
1241   "bclr\t%2, %0"
1242   [(set_attr "length" "3")]
1243 )
1244
1245 (define_insn "bitclr_in_memory"
1246   [(set:QI (match_operand:QI 0 "memory_operand" "+m")
1247            (and:QI (match_operand:QI 1 "memory_operand" "0")
1248                    (not:QI (ashift:QI (const_int 1)
1249                                       (match_operand:QI 2 "nonmemory_operand" "ri")))))]
1250   ""
1251   "bclr\t%2, %0.B"
1252   [(set_attr "length" "3")
1253    (set_attr "timings" "34")]
1254 )
1255
1256 ;; (set (reg A) (const_int -2))
1257 ;; (set (reg A) (rotate (reg A) (reg B)))
1258 ;; (set (reg C) (and (reg A) (reg C)))
1259 (define_peephole2
1260   [(set:SI (match_operand:SI 0 "register_operand" "")
1261            (const_int -2))
1262    (set:SI (match_dup 0)
1263            (rotate:SI (match_dup 0)
1264                       (match_operand:SI 1 "register_operand" "")))
1265    (set:SI (match_operand:SI 2 "register_operand" "")
1266            (and:SI (match_dup 0)
1267                    (match_dup 2)))]
1268   "dead_or_set_p (insn, operands[0])"
1269   [(set:SI (match_dup 2)
1270            (and:SI (match_dup 2)
1271                    (not:SI (ashift:SI (const_int 1)
1272                                       (match_dup 1)))))]
1273 )
1274   
1275 ;; (set (reg A) (const_int -2))
1276 ;; (set (reg A) (rotate (reg A) (reg B)))
1277 ;; (set (reg A) (and (reg A) (reg C)))
1278 ;; (set (reg C) (reg A)
1279 (define_peephole2
1280   [(set:SI (match_operand:SI 0 "register_operand" "")
1281            (const_int -2))
1282    (set:SI (match_dup 0)
1283            (rotate:SI (match_dup 0)
1284                       (match_operand:SI 1 "register_operand" "")))
1285    (set:SI (match_dup 0)
1286            (and:SI (match_dup 0)
1287                    (match_operand:SI 2 "register_operand" "")))
1288    (set:SI (match_dup 2) (match_dup 0))]
1289   "dead_or_set_p (insn, operands[0])"
1290   [(set:SI (match_dup 2)
1291            (and:SI (match_dup 2)
1292                    (not:SI (ashift:SI (const_int 1)
1293                                       (match_dup 1)))))]
1294 )
1295
1296 (define_expand "insv"
1297   [(set:SI (zero_extract:SI (match_operand:SI
1298                              0 "nonimmediate_operand") ;; Destination
1299                             (match_operand
1300                              1 "immediate_operand")    ;; # of bits to set
1301                             (match_operand
1302                              2 "immediate_operand"))   ;; Starting bit
1303            (match_operand
1304             3 "immediate_operand"))]  ;; Bits to insert
1305   ""
1306   {
1307     if (rx_expand_insv (operands))
1308       DONE;
1309     FAIL;
1310   }
1311 )   
1312 \f
1313 ;; Atomic exchange operation.
1314
1315 (define_insn "sync_lock_test_and_setsi"
1316   [(set:SI (match_operand:SI 0 "register_operand"   "=r,r")
1317            (match_operand:SI 1 "rx_compare_operand" "=r,Q"))
1318    (set:SI (match_dup 1)
1319            (match_operand:SI 2 "register_operand"    "0,0"))]
1320   ""
1321   "xchg\t%1, %0"
1322   [(set_attr "length" "3,6")
1323    (set_attr "timings" "22")]
1324 )
1325 \f
1326 ;; Block move functions.
1327
1328 (define_expand "movstr"
1329   [(set:SI (match_operand:BLK 1 "memory_operand")    ;; Dest
1330            (match_operand:BLK 2 "memory_operand"))   ;; Source
1331    (use (match_operand:SI     0 "register_operand")) ;; Updated Dest
1332   ]
1333   ""
1334   {
1335     rtx addr1 = gen_rtx_REG (SImode, 1);
1336     rtx addr2 = gen_rtx_REG (SImode, 2);
1337     rtx len   = gen_rtx_REG (SImode, 3);
1338     rtx dest_copy = gen_reg_rtx (SImode);
1339
1340     emit_move_insn (len, GEN_INT (-1));
1341     emit_move_insn (addr1, force_operand (XEXP (operands[1], 0), NULL_RTX));
1342     emit_move_insn (addr2, force_operand (XEXP (operands[2], 0), NULL_RTX));
1343     operands[1] = replace_equiv_address_nv (operands[1], addr1);
1344     operands[2] = replace_equiv_address_nv (operands[2], addr2);
1345     emit_move_insn (dest_copy, addr1);
1346     emit_insn (gen_rx_movstr ());
1347     emit_move_insn (len, GEN_INT (-1));
1348     emit_insn (gen_rx_strend (operands[0], dest_copy));
1349     DONE;
1350   }
1351 )
1352
1353 (define_insn "rx_movstr"
1354   [(set:SI (mem:BLK (reg:SI 1))
1355            (mem:BLK (reg:SI 2)))
1356    (unspec_volatile:BLK [(reg:SI 1) (reg:SI 2) (reg:SI 3)] UNSPEC_MOVSTR)
1357    (clobber (reg:SI 1))
1358    (clobber (reg:SI 2))
1359    (clobber (reg:SI 3))
1360   ]
1361   ""
1362   "smovu"
1363   [(set_attr "length" "2")
1364    (set_attr "timings" "1111")] ;; The timing is a guesstimate.
1365 )
1366
1367 (define_insn "rx_strend"
1368   [(set:SI (match_operand:SI                      0 "register_operand" "=r")
1369            (unspec_volatile:SI [(match_operand:SI 1 "register_operand"  "r")
1370                                 (reg:SI 3)] UNSPEC_STRLEN))
1371    (clobber (reg:SI 1))
1372    (clobber (reg:SI 2))
1373    (clobber (reg:SI 3))
1374   ]
1375   ""
1376   "mov\t%1, r1\n\tmov\t#0, r2\n\tsuntil.b\n\tmov\tr1, %0\n\tsub\t#1, %0"
1377   [(set_attr "length" "10")
1378    (set_attr "cc" "clobber")
1379    (set_attr "timings" "1111")] ;; The timing is a guesstimate.
1380 )
1381
1382 (define_expand "movmemsi"
1383   [(parallel
1384     [(set (match_operand:BLK 0 "memory_operand")    ;; Dest
1385           (match_operand:BLK 1 "memory_operand"))   ;; Source
1386      (use (match_operand:SI  2 "register_operand")) ;; Length in bytes
1387      (match_operand          3 "immediate_operand") ;; Align
1388      (unspec_volatile:BLK [(reg:SI 1) (reg:SI 2) (reg:SI 3)] UNSPEC_MOVMEM)]
1389     )]
1390   ""
1391   {
1392     rtx addr1 = gen_rtx_REG (SImode, 1);
1393     rtx addr2 = gen_rtx_REG (SImode, 2);
1394     rtx len   = gen_rtx_REG (SImode, 3);
1395
1396     if (REG_P (operands[0]) && (REGNO (operands[0]) == 2
1397                                       || REGNO (operands[0]) == 3))
1398       FAIL;
1399     if (REG_P (operands[1]) && (REGNO (operands[1]) == 1
1400                                       || REGNO (operands[1]) == 3))
1401       FAIL;
1402     if (REG_P (operands[2]) && (REGNO (operands[2]) == 1
1403                                       || REGNO (operands[2]) == 2))
1404       FAIL;
1405     emit_move_insn (addr1, force_operand (XEXP (operands[0], 0), NULL_RTX));
1406     emit_move_insn (addr2, force_operand (XEXP (operands[1], 0), NULL_RTX));
1407     emit_move_insn (len, force_operand (operands[2], NULL_RTX));
1408     operands[0] = replace_equiv_address_nv (operands[0], addr1);
1409     operands[1] = replace_equiv_address_nv (operands[1], addr2);
1410     emit_insn (gen_rx_movmem ());
1411     DONE;
1412   }
1413 )
1414
1415 (define_insn "rx_movmem"
1416   [(set (mem:BLK (reg:SI 1))
1417         (mem:BLK (reg:SI 2)))
1418    (use (reg:SI 3))
1419    (unspec_volatile:BLK [(reg:SI 1) (reg:SI 2) (reg:SI 3)] UNSPEC_MOVMEM)
1420    (clobber (reg:SI 1))
1421    (clobber (reg:SI 2))
1422    (clobber (reg:SI 3))]
1423   ""
1424   "smovf"
1425   [(set_attr "length" "2")
1426    (set_attr "timings" "1111")] ;; The timing is a guesstimate.
1427 )
1428
1429 (define_expand "setmemsi"
1430   [(set (match_operand:BLK 0 "memory_operand")     ;; Dest
1431         (match_operand:QI  2 "nonmemory_operand")) ;; Value
1432    (use (match_operand:SI  1 "nonmemory_operand")) ;; Length
1433    (match_operand          3 "immediate_operand")  ;; Align
1434    (unspec_volatile:BLK [(reg:SI 1) (reg:SI 2) (reg:SI 3)] UNSPEC_SETMEM)]
1435   ""
1436   {
1437     rtx addr = gen_rtx_REG (SImode, 1);
1438     rtx val  = gen_rtx_REG (QImode, 2);
1439     rtx len  = gen_rtx_REG (SImode, 3);
1440
1441     emit_move_insn (addr, force_operand (XEXP (operands[0], 0), NULL_RTX));
1442     emit_move_insn (len, force_operand (operands[1], NULL_RTX));
1443     emit_move_insn (val, operands[2]);
1444     emit_insn (gen_rx_setmem ());
1445     DONE;
1446   }
1447 )
1448
1449 (define_insn "rx_setmem"
1450   [(set:BLK (mem:BLK (reg:SI 1)) (reg 2))
1451    (unspec_volatile:BLK [(reg:SI 1) (reg:SI 2) (reg:SI 3)] UNSPEC_SETMEM)
1452    (clobber (reg:SI 1))
1453    (clobber (reg:SI 3))]
1454   ""
1455   "sstr.b"
1456   [(set_attr "length" "2")
1457    (set_attr "timings" "1111")] ;; The timing is a guesstimate.
1458 )
1459
1460 (define_expand "cmpstrnsi"
1461   [(set (match_operand:SI
1462          0 "register_operand") ;; Result
1463         (unspec_volatile:SI [(match_operand:BLK
1464                               1 "memory_operand") ;; String1
1465                              (match_operand:BLK
1466                               2 "memory_operand")] ;; String2
1467                             UNSPEC_CMPSTRN))
1468    (use (match_operand:SI
1469          3 "register_operand")) ;; Max Length
1470    (match_operand:SI
1471     4 "immediate_operand")] ;; Known Align
1472   ""
1473   {
1474     rtx str1 = gen_rtx_REG (SImode, 1);
1475     rtx str2 = gen_rtx_REG (SImode, 2);
1476     rtx len  = gen_rtx_REG (SImode, 3);
1477   
1478     emit_move_insn (str1, force_operand (XEXP (operands[1], 0), NULL_RTX));
1479     emit_move_insn (str2, force_operand (XEXP (operands[2], 0), NULL_RTX));
1480     emit_move_insn (len, force_operand (operands[3], NULL_RTX));
1481
1482     emit_insn (gen_rx_cmpstrn (operands[0], operands[1], operands[2]));
1483     DONE;
1484   }
1485 )
1486
1487 (define_expand "cmpstrsi"
1488   [(set (match_operand:SI
1489          0 "register_operand") ;; Result
1490         (unspec_volatile:SI [(match_operand:BLK
1491                               1 "memory_operand")  ;; String1
1492                              (match_operand:BLK
1493                               2 "memory_operand")] ;; String2
1494                             UNSPEC_CMPSTRN))
1495    (match_operand:SI
1496     3 "immediate_operand")] ;; Known Align
1497   ""
1498   {
1499     rtx str1 = gen_rtx_REG (SImode, 1);
1500     rtx str2 = gen_rtx_REG (SImode, 2);
1501     rtx len  = gen_rtx_REG (SImode, 3);
1502   
1503     emit_move_insn (str1, force_reg (SImode, XEXP (operands[1], 0)));
1504     emit_move_insn (str2, force_reg (SImode, XEXP (operands[2], 0)));
1505     emit_move_insn (len, GEN_INT (-1));
1506
1507     emit_insn (gen_rx_cmpstrn (operands[0], operands[1], operands[2]));
1508     DONE;
1509   }
1510 )
1511
1512 (define_insn "rx_cmpstrn"
1513   [(set:SI (match_operand:SI 0 "register_operand" "=r")
1514            (unspec_volatile:SI [(reg:SI 1) (reg:SI 2) (reg:SI 3)]
1515                                UNSPEC_CMPSTRN))
1516    (use (match_operand:BLK   1 "memory_operand" "m"))
1517    (use (match_operand:BLK   2 "memory_operand" "m"))
1518    (clobber (reg:SI 1))
1519    (clobber (reg:SI 2))
1520    (clobber (reg:SI 3))]
1521   ""
1522   "scmpu                ; Perform the string comparison
1523    mov     #-1, %0      ; Set up -1 result (which cannot be created
1524                         ; by the SC insn)
1525    bnc     ?+           ; If Carry is not set skip over
1526    scne.L  %0           ; Set result based on Z flag
1527 ?:                      
1528 "
1529   [(set_attr "length" "9")
1530    (set_attr "timings" "1111")] ;; The timing is a guesstimate.
1531 )
1532 \f
1533 ;;   Builtin Functions
1534 ;;
1535 ;; GCC does not have the ability to generate the following instructions
1536 ;; on its own so they are provided as builtins instead.  To use them from
1537 ;; a program for example invoke them as __builtin_rx_<insn_name>.  For
1538 ;; example:
1539 ;;
1540 ;;    int short_byte_swap (int arg) { return __builtin_rx_revw (arg); }
1541
1542 ;;---------- Accumulator Support ------------------------
1543
1544 ;; Multiply & Accumulate (high)
1545 (define_insn "machi"
1546   [(unspec:SI [(match_operand:SI 0 "register_operand" "r")
1547                (match_operand:SI 1 "register_operand" "r")]
1548               UNSPEC_BUILTIN_MACHI)]
1549   ""
1550   "machi\t%0, %1"
1551   [(set_attr "length" "3")]
1552 )
1553
1554 ;; Multiply & Accumulate (low)
1555 (define_insn "maclo"
1556   [(unspec:SI [(match_operand:SI 0 "register_operand" "r")
1557                (match_operand:SI 1 "register_operand" "r")]
1558               UNSPEC_BUILTIN_MACLO)]
1559   ""
1560   "maclo\t%0, %1"
1561   [(set_attr "length" "3")]
1562 )
1563
1564 ;; Multiply (high)
1565 (define_insn "mulhi"
1566   [(unspec:SI [(match_operand:SI 0 "register_operand" "r")
1567                (match_operand:SI 1 "register_operand" "r")]
1568               UNSPEC_BUILTIN_MULHI)]
1569   ""
1570   "mulhi\t%0, %1"
1571   [(set_attr "length" "3")]
1572 )
1573
1574 ;; Multiply (low)
1575 (define_insn "mullo"
1576   [(unspec:SI [(match_operand:SI 0 "register_operand" "r")
1577                (match_operand:SI 1 "register_operand" "r")]
1578               UNSPEC_BUILTIN_MULLO)]
1579   ""
1580   "mullo\t%0, %1"
1581   [(set_attr "length" "3")]
1582 )
1583
1584 ;; Move from Accumulator (high)
1585 (define_insn "mvfachi"
1586   [(set (match_operand:SI 0 "register_operand" "=r")
1587         (unspec:SI [(const_int 0)]
1588                    UNSPEC_BUILTIN_MVFACHI))]
1589   ""
1590   "mvfachi\t%0"
1591   [(set_attr "length" "3")]
1592 )
1593
1594 ;; Move from Accumulator (middle)
1595 (define_insn "mvfacmi"
1596   [(set (match_operand:SI 0 "register_operand" "=r")
1597         (unspec:SI [(const_int 0)]
1598                    UNSPEC_BUILTIN_MVFACMI))]
1599   ""
1600   "mvfacmi\t%0"
1601   [(set_attr "length" "3")]
1602 )
1603
1604 ;; Move to Accumulator (high)
1605 (define_insn "mvtachi"
1606   [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")]
1607                        UNSPEC_BUILTIN_MVTACHI)]
1608   ""
1609   "mvtachi\t%0"
1610   [(set_attr "length" "3")]
1611 )
1612
1613 ;; Move to Accumulator (low)
1614 (define_insn "mvtaclo"
1615   [(unspec_volatile:SI [(match_operand:SI 0 "register_operand" "r")]
1616                        UNSPEC_BUILTIN_MVTACLO)]
1617   ""
1618   "mvtaclo\t%0"
1619   [(set_attr "length" "3")]
1620 )
1621
1622 ;; Round Accumulator
1623 (define_insn "racw"
1624   [(unspec_volatile:SI [(match_operand:SI 0 "immediate_operand" "i")]
1625                        UNSPEC_BUILTIN_RACW)]
1626   ""
1627   "racw\t%0"
1628   [(set_attr "length" "3")]
1629 )
1630
1631 ;; Repeat multiply and accumulate
1632 (define_insn "rmpa"
1633   [(unspec:SI [(const_int 0) (reg:SI 1) (reg:SI 2) (reg:SI 3)
1634                (reg:SI 4) (reg:SI 5) (reg:SI 6)]
1635               UNSPEC_BUILTIN_RMPA)
1636   (clobber (reg:SI 1))
1637   (clobber (reg:SI 2))
1638   (clobber (reg:SI 3))]
1639   ""
1640   "rmpa"
1641   [(set_attr "length" "2")
1642    (set_attr "timings" "1010")]
1643 )
1644
1645 ;;---------- Arithmetic ------------------------
1646
1647 ;; Byte swap (two 16-bit values).
1648 (define_insn "revw"
1649   [(set (match_operand:SI             0 "register_operand" "+r")
1650         (unspec:SI [(match_operand:SI 1 "register_operand"  "r")]
1651                    UNSPEC_BUILTIN_REVW))]
1652   ""
1653   "revw\t%1, %0"
1654   [(set_attr "length" "3")]
1655 )
1656
1657 ;; Round to integer.
1658 (define_insn "lrintsf2"
1659   [(set (match_operand:SI             0 "register_operand"  "=r,r")
1660         (unspec:SI [(match_operand:SF 1 "rx_compare_operand" "r,Q")]
1661                    UNSPEC_BUILTIN_ROUND))]
1662   ""
1663   "round\t%1, %0"
1664   [(set_attr "cc" "set_zs")
1665    (set_attr "timings" "22,44")   
1666    (set_attr "length" "3,5")]
1667 )
1668
1669 ;; Saturate to 32-bits
1670 (define_insn "sat"
1671   [(set (match_operand:SI             0 "register_operand" "=r")
1672         (unspec:SI [(match_operand:SI 1 "register_operand"  "0")]
1673                    UNSPEC_BUILTIN_SAT))]
1674   ""
1675   "sat\t%0"
1676   [(set_attr "length" "2")]
1677 )
1678
1679 ;;---------- Control Registers ------------------------
1680
1681 ;; Clear Processor Status Word
1682 (define_insn "clrpsw"
1683   [(unspec:SI [(match_operand:SI 0 "immediate_operand" "i")]
1684               UNSPEC_BUILTIN_CLRPSW)
1685    (clobber (cc0))]
1686   ""
1687   "clrpsw\t%F0"
1688   [(set_attr "length" "2")
1689    (set_attr "cc" "clobber")]
1690 )
1691
1692 ;; Set Processor Status Word
1693 (define_insn "setpsw"
1694   [(unspec:SI [(match_operand:SI 0 "immediate_operand" "i")]
1695               UNSPEC_BUILTIN_SETPSW)
1696    (clobber (cc0))]
1697   ""
1698   "setpsw\t%F0"
1699   [(set_attr "length" "2")
1700    (set_attr "cc" "clobber")]
1701 )
1702
1703 ;; Move from control register
1704 (define_insn "mvfc"
1705   [(set (match_operand:SI             0 "register_operand" "=r")
1706         (unspec:SI [(match_operand:SI 1 "immediate_operand" "i")]
1707                    UNSPEC_BUILTIN_MVFC))]
1708   ""
1709   "mvfc\t%C1, %0"
1710   [(set_attr "length" "3")]
1711 )
1712
1713 ;; Move to control register
1714 (define_insn "mvtc"
1715   [(unspec:SI [(match_operand:SI 0 "immediate_operand" "i,i")
1716                (match_operand:SI 1 "nonmemory_operand" "r,i")]
1717               UNSPEC_BUILTIN_MVTC)]
1718   ""
1719   "mvtc\t%1, %C0"
1720   [(set_attr "length" "3,7")]
1721   ;; Ignore possible clobbering of the comparison flags in the
1722   ;; PSW register.  This is a cc0 target so any cc0 setting
1723   ;; instruction will always be paired with a cc0 user, without
1724   ;; the possibility of this instruction being placed in between
1725   ;; them.
1726 )
1727
1728 ;; Move to interrupt priority level
1729 (define_insn "mvtipl"
1730   [(unspec:SI [(match_operand:SI 0 "immediate_operand" "Uint04")]
1731               UNSPEC_BUILTIN_MVTIPL)]
1732   ""
1733   "mvtipl\t%0"
1734   [(set_attr "length" "3")]
1735 )
1736
1737 ;;---------- Interrupts ------------------------
1738
1739 ;; Break
1740 (define_insn "brk"
1741   [(unspec_volatile [(const_int 0)]
1742                     UNSPEC_BUILTIN_BRK)]
1743   ""
1744   "brk"
1745   [(set_attr "length" "1")
1746    (set_attr "timings" "66")]
1747 )
1748
1749 ;; Interrupt
1750 (define_insn "int"
1751   [(unspec_volatile:SI [(match_operand:SI 0 "immediate_operand" "i")]
1752                        UNSPEC_BUILTIN_INT)]
1753   ""
1754   "int\t%0"
1755   [(set_attr "length" "3")]
1756 )
1757
1758 ;; Wait
1759 (define_insn "wait"
1760   [(unspec_volatile [(const_int 0)]
1761                     UNSPEC_BUILTIN_WAIT)]
1762   ""
1763   "wait"
1764   [(set_attr "length" "2")]
1765 )
1766
1767 ;;---------- CoProcessor Support ------------------------
1768
1769 ;; FIXME: The instructions are currently commented out because
1770 ;; the bit patterns have not been finalized, so the assembler
1771 ;; does not support them.  Once they are decided and the assembler
1772 ;; supports them, enable the instructions here.
1773
1774 ;; Move from co-processor register
1775 (define_insn "mvfcp"
1776   [(set (match_operand:SI             0 "register_operand" "=r")
1777         (unspec:SI [(match_operand:SI 1 "immediate_operand" "i")
1778                     (match_operand:SI 2 "immediate_operand" "i")]
1779                    UNSPEC_BUILTIN_MVFCP))]
1780   ""
1781   "; mvfcp\t%1, %0, %2"
1782   [(set_attr "length" "5")]
1783 )
1784
1785 ;;---------- Misc ------------------------
1786
1787 ;; Required by cfglayout.c...
1788 (define_insn "nop"
1789   [(const_int 0)]
1790   ""
1791   "nop"
1792   [(set_attr "length" "1")]
1793 )