1 ;; Frv Machine Description
2 ;; Copyright (C) 1999-2015 Free Software Foundation, Inc.
3 ;; Contributed by Red Hat, Inc.
5 ;; This file is part of GCC.
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)
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.
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/>.
21 ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
24 ;; ::::::::::::::::::::
28 ;; ::::::::::::::::::::
30 ;; GOT constants must go 12/HI/LO for the splitter to work
36 (UNSPEC_PIC_PROLOGUE 3)
38 (UNSPEC_STACK_ADJUST 5)
39 (UNSPEC_EH_RETURN_EPILOGUE 6)
42 (UNSPEC_OPTIONAL_MEMBAR 9)
44 (UNSPEC_GETTLSOFF 200)
45 (UNSPEC_TLS_LOAD_GOTTLSOFF12 201)
46 (UNSPEC_TLS_INDIRECT_CALL 202)
47 (UNSPEC_TLS_TLSDESC_LDD 203)
48 (UNSPEC_TLS_TLSDESC_LDD_AUX 204)
49 (UNSPEC_TLS_TLSOFF_LD 205)
51 (UNSPEC_TLSOFF_HILO 207)
57 (R_FRV_FUNCDESC_GOT12 15)
58 (R_FRV_FUNCDESC_GOTHI 16)
59 (R_FRV_FUNCDESC_GOTLO 17)
60 (R_FRV_FUNCDESC_VALUE 18)
61 (R_FRV_FUNCDESC_GOTOFF12 19)
62 (R_FRV_FUNCDESC_GOTOFFHI 20)
63 (R_FRV_FUNCDESC_GOTOFFLO 21)
70 (R_FRV_GOTTLSOFF_HI 28)
71 (R_FRV_GOTTLSOFF_LO 29)
77 (R_FRV_GOTTLSDESCHI 35)
78 (R_FRV_GOTTLSDESCLO 36)
83 ;; LR_REG conflicts with definition in frv.h
88 (define_mode_iterator IMODE [QI HI SI DI])
89 (define_mode_attr IMODEsuffix [(QI "b") (HI "h") (SI "") (DI "d")])
90 (define_mode_attr BREADsuffix [(QI "ub") (HI "uh") (SI "") (DI "d")])
92 (define_attr "length" "" (const_int 4))
94 ;; Processor type -- this attribute must exactly match the processor_type
95 ;; enumeration in frv-protos.h.
97 (define_attr "cpu" "generic,fr550,fr500,fr450,fr405,fr400,fr300,simple,tomcat"
98 (const (symbol_ref "(enum attr_cpu) frv_cpu_type")))
100 ;; Attribute is "yes" for branches and jumps that span too great a distance
101 ;; to be implemented in the most natural way. Such instructions will use
102 ;; a call instruction in some way.
104 (define_attr "far_jump" "yes,no" (const_string "no"))
107 ;; "unknown" must come last.
109 "int,sethi,setlo,mul,div,gload,gstore,fload,fstore,movfg,movgf,macc,scan,cut,branch,jump,jumpl,call,spr,trap,fnop,fsconv,fsadd,fscmp,fsmul,fsmadd,fsdiv,sqrt_single,fdconv,fdadd,fdcmp,fdmul,fdmadd,fddiv,sqrt_double,mnop,mlogic,maveh,msath,maddh,mqaddh,mpackh,munpackh,mdpackh,mbhconv,mrot,mshift,mexpdhw,mexpdhd,mwcut,mmulh,mmulxh,mmach,mmrdh,mqmulh,mqmulxh,mqmach,mcpx,mqcpx,mcut,mclracc,mclracca,mdunpackh,mbhconve,mrdacc,mwtacc,maddacc,mdaddacc,mabsh,mdrot,mcpl,mdcut,mqsath,mqlimh,mqshift,mset,ccr,multi,load_or_call,unknown"
110 (const_string "unknown"))
112 (define_attr "acc_group" "none,even,odd"
113 (symbol_ref "(enum attr_acc_group) frv_acc_group (insn)"))
115 ;; Scheduling and Packing Overview
116 ;; -------------------------------
118 ;; FR-V instructions are divided into five groups: integer, floating-point,
119 ;; media, branch and control. Each group is associated with a separate set
120 ;; of processing units, the number and behavior of which depend on the target
121 ;; target processor. Integer units have names like I0 and I1, floating-point
122 ;; units have names like F0 and F1, and so on.
124 ;; Each member of the FR-V family has its own restrictions on which
125 ;; instructions can issue to which units. For example, some processors
126 ;; allow loads to issue to I0 or I1 while others only allow them to issue
127 ;; to I0. As well as these processor-specific restrictions, there is a
128 ;; general rule that an instruction can only issue to unit X + 1 if an
129 ;; instruction in the same packet issued to unit X.
131 ;; Sometimes the only way to honor these restrictions is by adding nops
132 ;; to a packet. For example, on the fr550, media instructions that access
133 ;; ACC4-7 can only issue to M1 or M3. It is therefore only possible to
134 ;; execute these instructions by packing them with something that issues
135 ;; to M0. When no useful M0 instruction exists, an "mnop" can be used
138 ;; Having decided which instructions should issue to which units, the packet
139 ;; should be ordered according to the following template:
141 ;; I0 F0/M0 I1 F1/M1 .... B0 B1 ...
143 ;; Note that VLIW packets execute strictly in parallel. Every instruction
144 ;; in the packet will stall until all input operands are ready. These
145 ;; operands are then read simultaneously before any registers are modified.
146 ;; This means that it's OK to have write-after-read hazards between
147 ;; instructions in the same packet, even if the write is listed earlier
150 ;; Three gcc passes are involved in generating VLIW packets:
152 ;; (1) The scheduler. This pass uses the standard scheduling code and
153 ;; behaves in much the same way as it would for a superscalar RISC
156 ;; (2) frv_reorg. This pass inserts nops into packets in order to meet
157 ;; the processor's issue requirements. It also has code to optimize
158 ;; the type of padding used to align labels.
160 ;; (3) frv_pack_insns. The final packing phase, which puts the
161 ;; instructions into assembly language order according to the
162 ;; "I0 F0/M0 ..." template above.
164 ;; In the ideal case, these three passes will agree on which instructions
165 ;; should be packed together, but this won't always happen. In particular:
167 ;; (a) (2) might not pack predicated instructions in the same way as (1).
168 ;; The scheduler tries to schedule predicated instructions for the
169 ;; worst case, assuming the predicate is true. However, if we have
170 ;; something like a predicated load, it isn't always possible to
171 ;; fill the load delay with useful instructions. (2) should then
172 ;; pack the user of the loaded value as aggressively as possible,
173 ;; in order to optimize the case when the predicate is false.
174 ;; See frv_pack_insn_p for more details.
176 ;; (b) The final shorten_branches pass runs between (2) and (3).
177 ;; Since (2) inserts nops, it is possible that some branches
178 ;; that were thought to be in range during (2) turned out to
179 ;; out-of-range in (3).
181 ;; All three passes use DFAs to model issue restrictions. The main
182 ;; question that the DFAs are supposed to answer is simply: can these
183 ;; instructions be packed together? The DFAs are not responsible for
184 ;; assigning instructions to execution units; that's the job of
185 ;; frv_sort_insn_group, see below for details.
187 ;; To get the best results, the DFAs should try to allow packets to
188 ;; be built in every possible order. This gives the scheduler more
189 ;; flexibility, removing the need for things like multipass lookahead.
190 ;; It also means we can take more advantage of inter-packet dependencies.
192 ;; For example, suppose we're compiling for the fr400 and we have:
195 ;; ldi @(gr6,gr0),gr4
197 ;; We can pack these instructions together by assigning the load to I0 and
198 ;; the addition to I1. However, because of the anti dependence between the
199 ;; two instructions, the scheduler must schedule the addition first.
200 ;; We should generally get better schedules if the DFA allows both
201 ;; (ldi, addi) and (addi, ldi), leaving the final packing pass to
202 ;; reorder the packet where appropriate.
204 ;; Almost all integer instructions can issue to any unit in the range I0
205 ;; to Ix, where the value of "x" depends on the type of instruction and
206 ;; on the target processor. The rules for other instruction groups are
209 ;; When the restrictions are as regular as this, we can get the desired
210 ;; behavior by claiming the DFA unit associated with the highest unused
211 ;; execution unit. For example, if an instruction can issue to I0 or I1,
212 ;; the DFA first tries to take the DFA unit associated with I1, and will
213 ;; only take I0's unit if I1 isn't free. (Note that, as mentioned above,
214 ;; the DFA does not assign instructions to units. An instruction that
215 ;; claims DFA unit I1 will not necessarily issue to I1 in the final packet.)
217 ;; There are some cases, such as the fr550 media restriction mentioned
218 ;; above, where the rule is not as simple as "any unit between 0 and X".
219 ;; Even so, allocating higher units first brings us close to the ideal.
221 ;; Having divided instructions into packets, passes (2) and (3) must
222 ;; assign instructions to specific execution units. They do this using
223 ;; the following algorithm:
225 ;; 1. Partition the instructions into groups (integer, float/media, etc.)
227 ;; 2. For each group of instructions:
229 ;; (a) Issue each instruction in the reset DFA state and use the
230 ;; DFA cpu_unit_query interface to find out which unit it picks
233 ;; (b) Sort the instructions into ascending order of picked units.
234 ;; Instructions that pick I1 first come after those that pick
235 ;; I0 first, and so on. Let S be the sorted sequence and S[i]
236 ;; be the ith element of it (counting from zero).
238 ;; (c) If this is the control or branch group, goto (i)
240 ;; (d) Find the largest L such that S[0]...S[L-1] can be issued
241 ;; consecutively from the reset state and such that the DFA
242 ;; claims unit X when S[X] is added. Let D be the DFA state
243 ;; after instructions S[0]...S[L-1] have been issued.
245 ;; (e) If L is the length of S, goto (i)
247 ;; (f) Let U be the number of units belonging to this group and #S be
248 ;; the length of S. Create a new sequence S' by concatenating
249 ;; S[L]...S[#S-1] and (U - #S) nops.
251 ;; (g) For each permutation S'' of S', try issuing S'' from last to
252 ;; first, starting with state D. See if the DFA claims unit
253 ;; X + L when each S''[X] is added. If so, set S to the
254 ;; concatenation of S[0]...S[L-1] and S'', then goto (i).
256 ;; (h) If (g) found no permutation, abort.
258 ;; (i) S is now the sorted sequence for this group, meaning that S[X]
259 ;; issues to unit X. Trim any unwanted nops from the end of S.
261 ;; The sequence calculated by (b) is trivially correct for control
262 ;; instructions since they can't be packed. It is also correct for branch
263 ;; instructions due to their simple issue requirements. For integer and
264 ;; floating-point/media instructions, the sequence calculated by (b) is
265 ;; often the correct answer; the rest of the algorithm is optimized for
266 ;; the case in which it is correct.
268 ;; If there were no irregularities in the issue restrictions then step
269 ;; (d) would not be needed. It is mainly there to cope with the fr550
270 ;; integer restrictions, where a store can issue to I1, but only if a store
271 ;; also issues to I0. (Note that if a packet has two stores, they will be
272 ;; at the beginning of the sequence calculated by (b).) It also copes
273 ;; with fr400 M-2 instructions, which must issue to M0, and which cannot
274 ;; be issued together with an mnop in M1.
276 ;; Step (g) is the main one for integer and float/media instructions.
277 ;; The first permutation it tries is S' itself (because, as noted above,
278 ;; the sequence calculated by (b) is often correct). If S' doesn't work,
279 ;; the implementation tries varying the beginning of the sequence first.
280 ;; Thus the nops towards the end of the sequence will only move to lower
281 ;; positions if absolutely necessary.
283 ;; The algorithm is theoretically exponential in the number of instructions
284 ;; in a group, although it's only O(n log(n)) if the sequence calculated by
285 ;; (b) is acceptable. In practice, the algorithm completes quickly even
286 ;; in the rare cases where (g) needs to try other permutations.
287 (define_automaton "integer, float_media, branch, control, idiv, div")
289 ;; The main issue units. Note that not all units are available on
291 (define_query_cpu_unit "i0,i1,i2,i3" "integer")
292 (define_query_cpu_unit "f0,f1,f2,f3" "float_media")
293 (define_query_cpu_unit "b0,b1" "branch")
294 (define_query_cpu_unit "c" "control")
297 (define_cpu_unit "idiv1,idiv2" "idiv")
298 (define_cpu_unit "div1,div2,root" "div")
300 ;; Control instructions cannot be packed with others.
301 (define_reservation "control" "i0+i1+i2+i3+f0+f1+f2+f3+b0+b1")
303 ;; Generic reservation for control insns
304 (define_insn_reservation "control" 1
305 (eq_attr "type" "trap,spr,unknown,multi")
308 ;; Reservation for relaxable calls to gettlsoff.
309 (define_insn_reservation "load_or_call" 3
310 (eq_attr "type" "load_or_call")
313 ;; ::::::::::::::::::::
315 ;; :: Generic/FR500 scheduler description
317 ;; ::::::::::::::::::::
320 ;; Synthetic units used to describe issue restrictions.
321 (define_automaton "fr500_integer")
322 (define_cpu_unit "fr500_load0,fr500_load1,fr500_store0" "fr500_integer")
323 (exclusion_set "fr500_load0,fr500_load1" "fr500_store0")
325 (define_bypass 0 "fr500_i1_sethi" "fr500_i1_setlo")
326 (define_insn_reservation "fr500_i1_sethi" 1
327 (and (eq_attr "cpu" "generic,fr500,tomcat")
328 (eq_attr "type" "sethi"))
331 (define_insn_reservation "fr500_i1_setlo" 1
332 (and (eq_attr "cpu" "generic,fr500,tomcat")
333 (eq_attr "type" "setlo"))
336 (define_insn_reservation "fr500_i1_int" 1
337 (and (eq_attr "cpu" "generic,fr500,tomcat")
338 (eq_attr "type" "int"))
341 (define_insn_reservation "fr500_i1_mul" 3
342 (and (eq_attr "cpu" "generic,fr500,tomcat")
343 (eq_attr "type" "mul"))
346 (define_insn_reservation "fr500_i1_div" 19
347 (and (eq_attr "cpu" "generic,fr500,tomcat")
348 (eq_attr "type" "div"))
349 "(i1|i0),(idiv1*18|idiv2*18)")
351 (define_insn_reservation "fr500_i2" 4
352 (and (eq_attr "cpu" "generic,fr500,tomcat")
353 (eq_attr "type" "gload,fload"))
354 "(i1|i0) + (fr500_load0|fr500_load1)")
356 (define_insn_reservation "fr500_i3" 0
357 (and (eq_attr "cpu" "generic,fr500,tomcat")
358 (eq_attr "type" "gstore,fstore"))
361 (define_insn_reservation "fr500_i4" 3
362 (and (eq_attr "cpu" "generic,fr500,tomcat")
363 (eq_attr "type" "movgf,movfg"))
366 (define_insn_reservation "fr500_i5" 0
367 (and (eq_attr "cpu" "generic,fr500,tomcat")
368 (eq_attr "type" "jumpl"))
372 ;; Branch-instructions
374 (define_insn_reservation "fr500_branch" 0
375 (and (eq_attr "cpu" "generic,fr500,tomcat")
376 (eq_attr "type" "jump,branch,ccr"))
379 (define_insn_reservation "fr500_call" 0
380 (and (eq_attr "cpu" "generic,fr500,tomcat")
381 (eq_attr "type" "call"))
384 ;; Floating point insns. The default latencies are for non-media
385 ;; instructions; media instructions incur an extra cycle.
387 (define_bypass 4 "fr500_farith" "fr500_m1,fr500_m2,fr500_m3,
388 fr500_m4,fr500_m5,fr500_m6")
389 (define_insn_reservation "fr500_farith" 3
390 (and (eq_attr "cpu" "generic,fr500,tomcat")
391 (eq_attr "type" "fnop,fsconv,fsadd,fsmul,fsmadd,fdconv,fdadd,fdmul,fdmadd"))
394 (define_insn_reservation "fr500_fcmp" 4
395 (and (eq_attr "cpu" "generic,fr500,tomcat")
396 (eq_attr "type" "fscmp,fdcmp"))
399 (define_bypass 11 "fr500_fdiv" "fr500_m1,fr500_m2,fr500_m3,
400 fr500_m4,fr500_m5,fr500_m6")
401 (define_insn_reservation "fr500_fdiv" 10
402 (and (eq_attr "cpu" "generic,fr500,tomcat")
403 (eq_attr "type" "fsdiv,fddiv"))
404 "(f1|f0),(div1*9 | div2*9)")
406 (define_bypass 16 "fr500_froot" "fr500_m1,fr500_m2,fr500_m3,
407 fr500_m4,fr500_m5,fr500_m6")
408 (define_insn_reservation "fr500_froot" 15
409 (and (eq_attr "cpu" "generic,fr500,tomcat")
410 (eq_attr "type" "sqrt_single,sqrt_double"))
413 ;; Media insns. Conflict table is as follows:
423 ;; where X indicates an invalid combination.
425 ;; Target registers are as follows:
434 ;; The default FPR latencies are for integer instructions.
435 ;; Floating-point instructions need one cycle more and media
436 ;; instructions need one cycle less.
437 (define_automaton "fr500_media")
438 (define_cpu_unit "fr500_m2_0,fr500_m2_1" "fr500_media")
439 (define_cpu_unit "fr500_m3_0,fr500_m3_1" "fr500_media")
440 (define_cpu_unit "fr500_m4_0,fr500_m4_1" "fr500_media")
441 (define_cpu_unit "fr500_m5" "fr500_media")
442 (define_cpu_unit "fr500_m6" "fr500_media")
444 (exclusion_set "fr500_m5,fr500_m6" "fr500_m2_0,fr500_m2_1,
445 fr500_m3_0,fr500_m3_1")
446 (exclusion_set "fr500_m6" "fr500_m4_0,fr500_m4_1,fr500_m5")
448 (define_bypass 2 "fr500_m1" "fr500_m1,fr500_m2,fr500_m3,
449 fr500_m4,fr500_m5,fr500_m6")
450 (define_bypass 4 "fr500_m1" "fr500_farith,fr500_fcmp,fr500_fdiv,fr500_froot")
451 (define_insn_reservation "fr500_m1" 3
452 (and (eq_attr "cpu" "generic,fr500,tomcat")
453 (eq_attr "type" "mnop,mlogic,maveh,msath,maddh,mqaddh"))
456 (define_bypass 2 "fr500_m2" "fr500_m1,fr500_m2,fr500_m3,
457 fr500_m4,fr500_m5,fr500_m6")
458 (define_bypass 4 "fr500_m2" "fr500_farith,fr500_fcmp,fr500_fdiv,fr500_froot")
459 (define_insn_reservation "fr500_m2" 3
460 (and (eq_attr "cpu" "generic,fr500,tomcat")
461 (eq_attr "type" "mrdacc,mpackh,munpackh,mbhconv,mrot,mshift,mexpdhw,mexpdhd,mwcut,mcut,mdunpackh,mbhconve"))
462 "(f1|f0) + (fr500_m2_0|fr500_m2_1)")
464 (define_bypass 1 "fr500_m3" "fr500_m4")
465 (define_insn_reservation "fr500_m3" 2
466 (and (eq_attr "cpu" "generic,fr500,tomcat")
467 (eq_attr "type" "mclracc,mwtacc"))
468 "(f1|f0) + (fr500_m3_0|fr500_m3_1)")
470 (define_bypass 1 "fr500_m4" "fr500_m4")
471 (define_insn_reservation "fr500_m4" 2
472 (and (eq_attr "cpu" "generic,fr500,tomcat")
473 (eq_attr "type" "mmulh,mmulxh,mmach,mmrdh,mqmulh,mqmulxh,mqmach,mcpx,mqcpx"))
474 "(f1|f0) + (fr500_m4_0|fr500_m4_1)")
476 (define_bypass 2 "fr500_m5" "fr500_m1,fr500_m2,fr500_m3,
477 fr500_m4,fr500_m5,fr500_m6")
478 (define_bypass 4 "fr500_m5" "fr500_farith,fr500_fcmp,fr500_fdiv,fr500_froot")
479 (define_insn_reservation "fr500_m5" 3
480 (and (eq_attr "cpu" "generic,fr500,tomcat")
481 (eq_attr "type" "mdpackh"))
482 "(f1|f0) + fr500_m5")
484 (define_bypass 1 "fr500_m6" "fr500_m4")
485 (define_insn_reservation "fr500_m6" 2
486 (and (eq_attr "cpu" "generic,fr500,tomcat")
487 (eq_attr "type" "mclracca"))
488 "(f1|f0) + fr500_m6")
490 ;; ::::::::::::::::::::
492 ;; :: FR400 scheduler description
494 ;; ::::::::::::::::::::
496 ;; Category 2 media instructions use both media units, but can be packed
497 ;; with non-media instructions. Use fr400_m1unit to claim the M1 unit
498 ;; without claiming a slot.
500 ;; Name Class Units Latency
501 ;; ==== ===== ===== =======
503 ;; sethi I1 I0/I1 0 -- does not interfere with setlo
508 ;; fload I2 I0 4 -- only 3 if read by a media insn
509 ;; gstore I3 I0 0 -- provides no result
510 ;; fstore I3 I0 0 -- provides no result
513 ;; jumpl I5 I0 0 -- provides no result
515 ;; (*) The results of these instructions can be read one cycle earlier
516 ;; than indicated. The penalty given is for instructions with write-after-
517 ;; write dependencies.
519 ;; The FR400 can only do loads and stores in I0, so we there's no danger
520 ;; of memory unit collision in the same packet. There's only one divide
523 (define_automaton "fr400_integer")
524 (define_cpu_unit "fr400_mul" "fr400_integer")
526 (define_insn_reservation "fr400_i1_int" 1
527 (and (eq_attr "cpu" "fr400,fr405,fr450")
528 (eq_attr "type" "int"))
531 (define_bypass 0 "fr400_i1_sethi" "fr400_i1_setlo")
532 (define_insn_reservation "fr400_i1_sethi" 1
533 (and (eq_attr "cpu" "fr400,fr405,fr450")
534 (eq_attr "type" "sethi"))
537 (define_insn_reservation "fr400_i1_setlo" 1
538 (and (eq_attr "cpu" "fr400,fr405,fr450")
539 (eq_attr "type" "setlo"))
542 ;; 3 is the worst case (write-after-write hazard).
543 (define_insn_reservation "fr400_i1_mul" 3
544 (and (eq_attr "cpu" "fr400,fr405")
545 (eq_attr "type" "mul"))
548 (define_insn_reservation "fr450_i1_mul" 2
549 (and (eq_attr "cpu" "fr450")
550 (eq_attr "type" "mul"))
553 (define_bypass 1 "fr400_i1_macc" "fr400_i1_macc")
554 (define_insn_reservation "fr400_i1_macc" 2
555 (and (eq_attr "cpu" "fr405,fr450")
556 (eq_attr "type" "macc"))
557 "(i0|i1) + fr400_mul")
559 (define_insn_reservation "fr400_i1_scan" 1
560 (and (eq_attr "cpu" "fr400,fr405,fr450")
561 (eq_attr "type" "scan"))
564 (define_insn_reservation "fr400_i1_cut" 2
565 (and (eq_attr "cpu" "fr405,fr450")
566 (eq_attr "type" "cut"))
569 ;; 20 is for a write-after-write hazard.
570 (define_insn_reservation "fr400_i1_div" 20
571 (and (eq_attr "cpu" "fr400,fr405")
572 (eq_attr "type" "div"))
575 (define_insn_reservation "fr450_i1_div" 19
576 (and (eq_attr "cpu" "fr450")
577 (eq_attr "type" "div"))
580 ;; 4 is for a write-after-write hazard.
581 (define_insn_reservation "fr400_i2" 4
582 (and (eq_attr "cpu" "fr400,fr405")
583 (eq_attr "type" "gload,fload"))
586 (define_insn_reservation "fr450_i2_gload" 3
587 (and (eq_attr "cpu" "fr450")
588 (eq_attr "type" "gload"))
591 ;; 4 is for a write-after-write hazard.
592 (define_insn_reservation "fr450_i2_fload" 4
593 (and (eq_attr "cpu" "fr450")
594 (eq_attr "type" "fload"))
597 (define_insn_reservation "fr400_i3" 0
598 (and (eq_attr "cpu" "fr400,fr405,fr450")
599 (eq_attr "type" "gstore,fstore"))
602 ;; 3 is for a write-after-write hazard.
603 (define_insn_reservation "fr400_i4" 3
604 (and (eq_attr "cpu" "fr400,fr405")
605 (eq_attr "type" "movfg,movgf"))
608 (define_insn_reservation "fr450_i4_movfg" 2
609 (and (eq_attr "cpu" "fr450")
610 (eq_attr "type" "movfg"))
613 ;; 3 is for a write-after-write hazard.
614 (define_insn_reservation "fr450_i4_movgf" 3
615 (and (eq_attr "cpu" "fr450")
616 (eq_attr "type" "movgf"))
619 (define_insn_reservation "fr400_i5" 0
620 (and (eq_attr "cpu" "fr400,fr405,fr450")
621 (eq_attr "type" "jumpl"))
624 ;; The bypass between FPR loads and media instructions, described above.
628 "fr400_m1_1,fr400_m1_2,\
629 fr400_m2_1,fr400_m2_2,\
630 fr400_m3_1,fr400_m3_2,\
631 fr400_m4_1,fr400_m4_2,\
634 ;; The branch instructions all use the B unit and produce no result.
636 (define_insn_reservation "fr400_b" 0
637 (and (eq_attr "cpu" "fr400,fr405,fr450")
638 (eq_attr "type" "jump,branch,ccr,call"))
641 ;; FP->FP moves are marked as "fsconv" instructions in the define_insns
642 ;; below, but are implemented on the FR400 using "mlogic" instructions.
643 ;; It's easier to class "fsconv" as a "m1:1" instruction than provide
644 ;; separate define_insns for the FR400.
646 ;; M1 instructions store their results in FPRs. Any instruction can read
647 ;; the result in the following cycle, so no penalty occurs.
649 (define_automaton "fr400_media")
650 (define_cpu_unit "fr400_m1a,fr400_m1b,fr400_m2a" "fr400_media")
651 (exclusion_set "fr400_m1a,fr400_m1b" "fr400_m2a")
653 (define_reservation "fr400_m1" "(f1|f0) + (fr400_m1a|fr400_m1b)")
654 (define_reservation "fr400_m2" "f0 + fr400_m2a")
656 (define_insn_reservation "fr400_m1_1" 1
657 (and (eq_attr "cpu" "fr400,fr405")
658 (eq_attr "type" "fsconv,mnop,mlogic,maveh,msath,maddh,mabsh,mset"))
661 (define_insn_reservation "fr400_m1_2" 1
662 (and (eq_attr "cpu" "fr400,fr405")
663 (eq_attr "type" "mqaddh,mqsath,mqlimh,mqshift"))
666 ;; M2 instructions store their results in accumulators, which are read
667 ;; by M2 or M4 media commands. M2 instructions can read the results in
668 ;; the following cycle, but M4 instructions must wait a cycle more.
671 "fr400_m2_1,fr400_m2_2"
672 "fr400_m2_1,fr400_m2_2")
674 (define_insn_reservation "fr400_m2_1" 2
675 (and (eq_attr "cpu" "fr400,fr405")
676 (eq_attr "type" "mmulh,mmulxh,mmach,mmrdh,mcpx,maddacc"))
679 (define_insn_reservation "fr400_m2_2" 2
680 (and (eq_attr "cpu" "fr400,fr405")
681 (eq_attr "type" "mqmulh,mqmulxh,mqmach,mqcpx,mdaddacc"))
684 ;; For our purposes, there seems to be little real difference between
685 ;; M1 and M3 instructions. Keep them separate anyway in case the distinction
688 (define_insn_reservation "fr400_m3_1" 1
689 (and (eq_attr "cpu" "fr400,fr405")
690 (eq_attr "type" "mpackh,mrot,mshift,mexpdhw"))
693 (define_insn_reservation "fr400_m3_2" 1
694 (and (eq_attr "cpu" "fr400,fr405")
695 (eq_attr "type" "munpackh,mdpackh,mbhconv,mexpdhd,mwcut,mdrot,mcpl"))
698 ;; M4 instructions write to accumulators or FPRs. MOVFG and STF
699 ;; instructions can read an FPR result in the following cycle, but
700 ;; M-unit instructions must wait a cycle more for either kind of result.
702 (define_bypass 1 "fr400_m4_1,fr400_m4_2" "fr400_i3,fr400_i4")
704 (define_insn_reservation "fr400_m4_1" 2
705 (and (eq_attr "cpu" "fr400,fr405")
706 (eq_attr "type" "mrdacc,mcut,mclracc"))
709 (define_insn_reservation "fr400_m4_2" 2
710 (and (eq_attr "cpu" "fr400,fr405")
711 (eq_attr "type" "mclracca,mdcut"))
714 ;; M5 instructions always incur a 1-cycle penalty.
716 (define_insn_reservation "fr400_m5" 2
717 (and (eq_attr "cpu" "fr400,fr405")
718 (eq_attr "type" "mwtacc"))
721 ;; ::::::::::::::::::::
723 ;; :: FR450 media scheduler description
725 ;; ::::::::::::::::::::
727 ;; The FR451 media restrictions are similar to the FR400's, but not as
728 ;; strict and not as regular. There are 6 categories with the following
732 ;; M-1 M-2 M-3 M-4 M-5 M-6
740 ;; where "x" indicates a conflict.
742 ;; There is no difference between M-1 and M-3 as far as issue
743 ;; restrictions are concerned, so they are combined as "m13".
745 ;; Units for odd-numbered categories. There can be two of these
747 (define_cpu_unit "fr450_m13a,fr450_m13b" "float_media")
748 (define_cpu_unit "fr450_m5a,fr450_m5b" "float_media")
750 ;; Units for even-numbered categories. There can only be one per packet.
751 (define_cpu_unit "fr450_m2a,fr450_m4a,fr450_m6a" "float_media")
753 ;; Enforce the restriction matrix above.
754 (exclusion_set "fr450_m2a,fr450_m4a,fr450_m6a" "fr450_m13a,fr450_m13b")
755 (exclusion_set "fr450_m2a,fr450_m6a" "fr450_m5a,fr450_m5b")
756 (exclusion_set "fr450_m4a,fr450_m6a" "fr450_m2a")
758 (define_reservation "fr450_m13" "(f1|f0) + (fr450_m13a|fr450_m13b)")
759 (define_reservation "fr450_m2" "f0 + fr450_m2a")
760 (define_reservation "fr450_m4" "f0 + fr450_m4a")
761 (define_reservation "fr450_m5" "(f1|f0) + (fr450_m5a|fr450_m5b)")
762 (define_reservation "fr450_m6" "(f0|f1) + fr450_m6a")
764 ;; MD-1, MD-3 and MD-8 instructions, which are the same as far
765 ;; as scheduling is concerned. The inputs and outputs are FPRs.
766 ;; Instructions that have 32-bit inputs and outputs belong to M-1 while
767 ;; the rest belong to M-2.
769 ;; ??? Arithmetic shifts (MD-6) have an extra cycle latency, but we don't
770 ;; make the distinction between them and logical shifts.
771 (define_insn_reservation "fr450_md138_1" 1
772 (and (eq_attr "cpu" "fr450")
773 (eq_attr "type" "fsconv,mnop,mlogic,maveh,msath,maddh,mabsh,mset,
774 mrot,mshift,mexpdhw,mpackh"))
777 (define_insn_reservation "fr450_md138_2" 1
778 (and (eq_attr "cpu" "fr450")
779 (eq_attr "type" "mqaddh,mqsath,mqlimh,
780 mdrot,mwcut,mqshift,mexpdhd,
781 munpackh,mdpackh,mbhconv,mcpl"))
784 ;; MD-2 instructions. These take FPR or ACC inputs and produce an ACC output.
785 ;; Instructions that write to double ACCs belong to M-3 while those that write
786 ;; to quad ACCs belong to M-4.
787 (define_insn_reservation "fr450_md2_3" 2
788 (and (eq_attr "cpu" "fr450")
789 (eq_attr "type" "mmulh,mmach,mcpx,mmulxh,mmrdh,maddacc"))
792 (define_insn_reservation "fr450_md2_4" 2
793 (and (eq_attr "cpu" "fr450")
794 (eq_attr "type" "mqmulh,mqmach,mqcpx,mqmulxh,mdaddacc"))
797 ;; Another MD-2 instruction can use the result on the following cycle.
798 (define_bypass 1 "fr450_md2_3,fr450_md2_4" "fr450_md2_3,fr450_md2_4")
800 ;; MD-4 instructions that write to ACCs.
801 (define_insn_reservation "fr450_md4_3" 2
802 (and (eq_attr "cpu" "fr450")
803 (eq_attr "type" "mclracc"))
806 (define_insn_reservation "fr450_md4_4" 3
807 (and (eq_attr "cpu" "fr450")
808 (eq_attr "type" "mclracca"))
811 ;; MD-4 instructions that write to FPRs.
812 (define_insn_reservation "fr450_md4_1" 2
813 (and (eq_attr "cpu" "fr450")
814 (eq_attr "type" "mcut"))
817 (define_insn_reservation "fr450_md4_5" 2
818 (and (eq_attr "cpu" "fr450")
819 (eq_attr "type" "mrdacc"))
822 (define_insn_reservation "fr450_md4_6" 2
823 (and (eq_attr "cpu" "fr450")
824 (eq_attr "type" "mdcut"))
827 ;; Integer instructions can read the FPR result of an MD-4 instruction on
828 ;; the following cycle.
829 (define_bypass 1 "fr450_md4_1,fr450_md4_5,fr450_md4_6"
830 "fr400_i3,fr450_i4_movfg")
832 ;; MD-5 instructions, which belong to M-3. They take FPR inputs and
834 (define_insn_reservation "fr450_md5_3" 2
835 (and (eq_attr "cpu" "fr450")
836 (eq_attr "type" "mwtacc"))
839 ;; ::::::::::::::::::::
841 ;; :: FR550 scheduler description
843 ;; ::::::::::::::::::::
845 ;; Prevent loads and stores from being issued in the same packet.
846 ;; These units must go into the generic "integer" reservation because
847 ;; of the constraints on fr550_store0 and fr550_store1.
848 (define_cpu_unit "fr550_load0,fr550_load1" "integer")
849 (define_cpu_unit "fr550_store0,fr550_store1" "integer")
850 (exclusion_set "fr550_load0,fr550_load1" "fr550_store0,fr550_store1")
852 ;; A store can only issue to I1 if one has also been issued to I0.
853 (presence_set "fr550_store1" "fr550_store0")
855 (define_bypass 0 "fr550_sethi" "fr550_setlo")
856 (define_insn_reservation "fr550_sethi" 1
857 (and (eq_attr "cpu" "fr550")
858 (eq_attr "type" "sethi"))
861 (define_insn_reservation "fr550_setlo" 1
862 (and (eq_attr "cpu" "fr550")
863 (eq_attr "type" "setlo"))
866 (define_insn_reservation "fr550_int" 1
867 (and (eq_attr "cpu" "fr550")
868 (eq_attr "type" "int"))
871 (define_insn_reservation "fr550_mul" 2
872 (and (eq_attr "cpu" "fr550")
873 (eq_attr "type" "mul"))
876 (define_insn_reservation "fr550_div" 19
877 (and (eq_attr "cpu" "fr550")
878 (eq_attr "type" "div"))
879 "(i1|i0),(idiv1*18 | idiv2*18)")
881 (define_insn_reservation "fr550_load" 3
882 (and (eq_attr "cpu" "fr550")
883 (eq_attr "type" "gload,fload"))
884 "(i1|i0)+(fr550_load0|fr550_load1)")
886 ;; We can only issue a store to I1 if one was also issued to I0.
887 ;; This means that, as far as frv_reorder_packet is concerned,
888 ;; the instruction has the same priority as an I0-only instruction.
889 (define_insn_reservation "fr550_store" 1
890 (and (eq_attr "cpu" "fr550")
891 (eq_attr "type" "gstore,fstore"))
892 "(i0+fr550_store0)|(i1+fr550_store1)")
894 (define_insn_reservation "fr550_transfer" 2
895 (and (eq_attr "cpu" "fr550")
896 (eq_attr "type" "movgf,movfg"))
899 (define_insn_reservation "fr550_jumpl" 0
900 (and (eq_attr "cpu" "fr550")
901 (eq_attr "type" "jumpl"))
904 (define_cpu_unit "fr550_ccr0,fr550_ccr1" "float_media")
906 (define_insn_reservation "fr550_branch" 0
907 (and (eq_attr "cpu" "fr550")
908 (eq_attr "type" "jump,branch"))
911 (define_insn_reservation "fr550_ccr" 0
912 (and (eq_attr "cpu" "fr550")
913 (eq_attr "type" "ccr"))
914 "(b1|b0) + (fr550_ccr1|fr550_ccr0)")
916 (define_insn_reservation "fr550_call" 0
917 (and (eq_attr "cpu" "fr550")
918 (eq_attr "type" "call"))
921 (define_automaton "fr550_float_media")
922 (define_cpu_unit "fr550_add0,fr550_add1" "fr550_float_media")
924 ;; There are three possible combinations of floating-point/media instructions:
926 ;; - one media and one float
927 ;; - up to four float, no media
928 ;; - up to four media, no float
929 (define_cpu_unit "fr550_f0,fr550_f1,fr550_f2,fr550_f3" "fr550_float_media")
930 (define_cpu_unit "fr550_m0,fr550_m1,fr550_m2,fr550_m3" "fr550_float_media")
931 (exclusion_set "fr550_f1,fr550_f2,fr550_f3" "fr550_m1,fr550_m2,fr550_m3")
932 (exclusion_set "fr550_m0" "fr550_f1,fr550_f2,fr550_f3")
933 ;; FIXME: This next exclusion set should be defined as well, so that we do
934 ;; not get a packet containing multiple media instructions plus a single
935 ;; floating point instruction. At the moment we can get away with not
936 ;; defining it because gcc does not seem to generate such packets.
938 ;; If we do enable the exclusion however the insertion of fnop insns into
939 ;; a packet containing media instructions will stop working, because the
940 ;; fnop insn counts as a floating point instruction. The correct solution
941 ;; is to fix the reservation for the fnop insn so that it does not have the
942 ;; same restrictions as ordinary floating point insns.
943 ;;(exclusion_set "fr550_f0" "fr550_m1,fr550_m2,fr550_m3")
945 (define_reservation "fr550_float" "fr550_f0|fr550_f1|fr550_f2|fr550_f3")
946 (define_reservation "fr550_media" "fr550_m0|fr550_m1|fr550_m2|fr550_m3")
948 (define_insn_reservation "fr550_f1" 0
949 (and (eq_attr "cpu" "fr550")
950 (eq_attr "type" "fnop"))
951 "(f3|f2|f1|f0) + fr550_float")
953 (define_insn_reservation "fr550_f2" 3
954 (and (eq_attr "cpu" "fr550")
955 (eq_attr "type" "fsconv,fsadd,fscmp"))
956 "(f3|f2|f1|f0) + (fr550_add0|fr550_add1) + fr550_float")
958 (define_insn_reservation "fr550_f3_mul" 3
959 (and (eq_attr "cpu" "fr550")
960 (eq_attr "type" "fsmul"))
961 "(f1|f0) + fr550_float")
963 (define_insn_reservation "fr550_f3_div" 10
964 (and (eq_attr "cpu" "fr550")
965 (eq_attr "type" "fsdiv"))
966 "(f1|f0) + fr550_float")
968 (define_insn_reservation "fr550_f3_sqrt" 15
969 (and (eq_attr "cpu" "fr550")
970 (eq_attr "type" "sqrt_single"))
971 "(f1|f0) + fr550_float")
973 ;; Synthetic units for enforcing media issue restrictions. Certain types
974 ;; of insn in M2 conflict with certain types in M0:
977 ;; MNOP MALU MSFT MMAC MSET
984 ;; where "x" indicates a conflict. The same restrictions apply to
987 ;; In addition -- and this is the awkward bit! -- instructions that
988 ;; access ACC0-3 can only issue to M0 or M2. Those that access ACC4-7
989 ;; can only issue to M1 or M3. We refer to such instructions as "even"
990 ;; and "odd" respectively.
991 (define_cpu_unit "fr550_malu0,fr550_malu1" "float_media")
992 (define_cpu_unit "fr550_malu2,fr550_malu3" "float_media")
993 (define_cpu_unit "fr550_msft0,fr550_msft1" "float_media")
994 (define_cpu_unit "fr550_mmac0,fr550_mmac1" "float_media")
995 (define_cpu_unit "fr550_mmac2,fr550_mmac3" "float_media")
996 (define_cpu_unit "fr550_mset0,fr550_mset1" "float_media")
997 (define_cpu_unit "fr550_mset2,fr550_mset3" "float_media")
999 (exclusion_set "fr550_malu0" "fr550_malu2")
1000 (exclusion_set "fr550_malu1" "fr550_malu3")
1002 (exclusion_set "fr550_msft0" "fr550_mset2")
1003 (exclusion_set "fr550_msft1" "fr550_mset3")
1005 (exclusion_set "fr550_mmac0" "fr550_mmac2")
1006 (exclusion_set "fr550_mmac1" "fr550_mmac3")
1008 ;; If an MSFT or MMAC instruction issues to a unit other than M0, we may
1009 ;; need to insert some nops. In the worst case, the packet will end up
1010 ;; having 4 integer instructions and 4 media instructions, leaving no
1011 ;; room for any branch instructions that the DFA might have accepted.
1013 ;; This doesn't matter for JUMP_INSNs and CALL_INSNs because they are
1014 ;; always the last instructions to be passed to the DFA, and could be
1015 ;; pushed out to a separate packet once the nops have been added.
1016 ;; However, it does cause problems for ccr instructions since they
1017 ;; can occur anywhere in the unordered packet.
1018 (exclusion_set "fr550_msft1,fr550_mmac1,fr550_mmac2,fr550_mmac3"
1019 "fr550_ccr0,fr550_ccr1")
1021 (define_reservation "fr550_malu"
1022 "(f3 + fr550_malu3) | (f2 + fr550_malu2)
1023 | (f1 + fr550_malu1) | (f0 + fr550_malu0)")
1025 (define_reservation "fr550_msft_even"
1028 (define_reservation "fr550_msft_odd"
1031 (define_reservation "fr550_msft_either"
1032 "(f1 + fr550_msft1) | (f0 + fr550_msft0)")
1034 (define_reservation "fr550_mmac_even"
1035 "(f2 + fr550_mmac2) | (f0 + fr550_mmac0)")
1037 (define_reservation "fr550_mmac_odd"
1038 "(f3 + fr550_mmac3) | (f1 + fr550_mmac1)")
1040 (define_reservation "fr550_mset"
1041 "(f3 + fr550_mset3) | (f2 + fr550_mset2)
1042 | (f1 + fr550_mset1) | (f0 + fr550_mset0)")
1044 (define_insn_reservation "fr550_mnop" 0
1045 (and (eq_attr "cpu" "fr550")
1046 (eq_attr "type" "mnop"))
1047 "fr550_media + (f3|f2|f1|f0)")
1049 (define_insn_reservation "fr550_malu" 2
1050 (and (eq_attr "cpu" "fr550")
1051 (eq_attr "type" "mlogic,maveh,msath,mabsh,maddh,mqaddh,mqsath"))
1052 "fr550_media + fr550_malu")
1054 ;; These insns only operate on FPRs and so don't need to be classified
1056 (define_insn_reservation "fr550_msft_1_either" 2
1057 (and (eq_attr "cpu" "fr550")
1058 (eq_attr "type" "mrot,mwcut,mshift,mexpdhw,mexpdhd,mpackh,
1059 munpackh,mdpackh,mbhconv,mdrot,mcpl"))
1060 "fr550_media + fr550_msft_either")
1062 ;; These insns read from ACC0-3.
1063 (define_insn_reservation "fr550_msft_1_even" 2
1064 (and (eq_attr "cpu" "fr550")
1065 (and (eq_attr "type" "mcut,mrdacc,mdcut")
1066 (eq_attr "acc_group" "even")))
1067 "fr550_media + fr550_msft_even")
1069 ;; These insns read from ACC4-7.
1070 (define_insn_reservation "fr550_msft_1_odd" 2
1071 (and (eq_attr "cpu" "fr550")
1072 (and (eq_attr "type" "mcut,mrdacc,mdcut")
1073 (eq_attr "acc_group" "odd")))
1074 "fr550_media + fr550_msft_odd")
1076 ;; MCLRACC with A=1 can issue to either M0 or M1.
1077 (define_insn_reservation "fr550_msft_2_either" 2
1078 (and (eq_attr "cpu" "fr550")
1079 (eq_attr "type" "mclracca"))
1080 "fr550_media + fr550_msft_either")
1082 ;; These insns write to ACC0-3.
1083 (define_insn_reservation "fr550_msft_2_even" 2
1084 (and (eq_attr "cpu" "fr550")
1085 (and (eq_attr "type" "mclracc,mwtacc")
1086 (eq_attr "acc_group" "even")))
1087 "fr550_media + fr550_msft_even")
1089 ;; These insns write to ACC4-7.
1090 (define_insn_reservation "fr550_msft_2_odd" 2
1091 (and (eq_attr "cpu" "fr550")
1092 (and (eq_attr "type" "mclracc,mwtacc")
1093 (eq_attr "acc_group" "odd")))
1094 "fr550_media + fr550_msft_odd")
1096 ;; These insns read from and write to ACC0-3.
1097 (define_insn_reservation "fr550_mmac_even" 2
1098 (and (eq_attr "cpu" "fr550")
1099 (and (eq_attr "type" "mmulh,mmulxh,mmach,mmrdh,mqmulh,mqmulxh,mqmach,
1100 maddacc,mdaddacc,mcpx,mqcpx")
1101 (eq_attr "acc_group" "even")))
1102 "fr550_media + fr550_mmac_even")
1104 ;; These insns read from and write to ACC4-7.
1105 (define_insn_reservation "fr550_mmac_odd" 2
1106 (and (eq_attr "cpu" "fr550")
1107 (and (eq_attr "type" "mmulh,mmulxh,mmach,mmrdh,mqmulh,mqmulxh,mqmach,
1108 maddacc,mdaddacc,mcpx,mqcpx")
1109 (eq_attr "acc_group" "odd")))
1110 "fr550_media + fr550_mmac_odd")
1112 (define_insn_reservation "fr550_mset" 1
1113 (and (eq_attr "cpu" "fr550")
1114 (eq_attr "type" "mset"))
1115 "fr550_media + fr550_mset")
1117 ;; ::::::::::::::::::::
1119 ;; :: Simple/FR300 scheduler description
1121 ;; ::::::::::::::::::::
1123 ;; Fr300 or simple processor. To describe it as 1 insn issue
1124 ;; processor, we use control unit.
1126 (define_insn_reservation "fr300_lat1" 1
1127 (and (eq_attr "cpu" "fr300,simple")
1128 (eq_attr "type" "!gload,fload,movfg,movgf"))
1131 (define_insn_reservation "fr300_lat2" 2
1132 (and (eq_attr "cpu" "fr300,simple")
1133 (eq_attr "type" "gload,fload,movfg,movgf"))
1137 ;; ::::::::::::::::::::
1141 ;; ::::::::::::::::::::
1143 ;; The insn attribute mechanism can be used to specify the requirements for
1144 ;; delay slots, if any, on a target machine. An instruction is said to require
1145 ;; a "delay slot" if some instructions that are physically after the
1146 ;; instruction are executed as if they were located before it. Classic
1147 ;; examples are branch and call instructions, which often execute the following
1148 ;; instruction before the branch or call is performed.
1150 ;; On some machines, conditional branch instructions can optionally "annul"
1151 ;; instructions in the delay slot. This means that the instruction will not be
1152 ;; executed for certain branch outcomes. Both instructions that annul if the
1153 ;; branch is true and instructions that annul if the branch is false are
1156 ;; Delay slot scheduling differs from instruction scheduling in that
1157 ;; determining whether an instruction needs a delay slot is dependent only
1158 ;; on the type of instruction being generated, not on data flow between the
1159 ;; instructions. See the next section for a discussion of data-dependent
1160 ;; instruction scheduling.
1162 ;; The requirement of an insn needing one or more delay slots is indicated via
1163 ;; the `define_delay' expression. It has the following form:
1165 ;; (define_delay TEST
1166 ;; [DELAY-1 ANNUL-TRUE-1 ANNUL-FALSE-1
1167 ;; DELAY-2 ANNUL-TRUE-2 ANNUL-FALSE-2
1170 ;; TEST is an attribute test that indicates whether this `define_delay' applies
1171 ;; to a particular insn. If so, the number of required delay slots is
1172 ;; determined by the length of the vector specified as the second argument. An
1173 ;; insn placed in delay slot N must satisfy attribute test DELAY-N.
1174 ;; ANNUL-TRUE-N is an attribute test that specifies which insns may be annulled
1175 ;; if the branch is true. Similarly, ANNUL-FALSE-N specifies which insns in
1176 ;; the delay slot may be annulled if the branch is false. If annulling is not
1177 ;; supported for that delay slot, `(nil)' should be coded.
1179 ;; For example, in the common case where branch and call insns require a single
1180 ;; delay slot, which may contain any insn other than a branch or call, the
1181 ;; following would be placed in the `md' file:
1183 ;; (define_delay (eq_attr "type" "branch,call")
1184 ;; [(eq_attr "type" "!branch,call") (nil) (nil)])
1186 ;; Multiple `define_delay' expressions may be specified. In this case, each
1187 ;; such expression specifies different delay slot requirements and there must
1188 ;; be no insn for which tests in two `define_delay' expressions are both true.
1190 ;; For example, if we have a machine that requires one delay slot for branches
1191 ;; but two for calls, no delay slot can contain a branch or call insn, and any
1192 ;; valid insn in the delay slot for the branch can be annulled if the branch is
1193 ;; true, we might represent this as follows:
1195 ;; (define_delay (eq_attr "type" "branch")
1196 ;; [(eq_attr "type" "!branch,call")
1197 ;; (eq_attr "type" "!branch,call")
1200 ;; (define_delay (eq_attr "type" "call")
1201 ;; [(eq_attr "type" "!branch,call") (nil) (nil)
1202 ;; (eq_attr "type" "!branch,call") (nil) (nil)])
1204 ;; Note - it is the backend's responsibility to fill any unfilled delay slots
1205 ;; at assembler generation time. This is usually done by adding a special print
1206 ;; operand to the delayed instruction, and then in the PRINT_OPERAND function
1207 ;; calling dbr_sequence_length() to determine how many delay slots were filled.
1210 ;; --------------<machine>.md-----------------
1211 ;; (define_insn "call"
1212 ;; [(call (match_operand 0 "memory_operand" "m")
1213 ;; (match_operand 1 "" ""))]
1215 ;; "call_delayed %0,%1,%2%#"
1216 ;; [(set_attr "length" "4")
1217 ;; (set_attr "type" "call")])
1219 ;; -------------<machine>.h-------------------
1220 ;; #define PRINT_OPERAND_PUNCT_VALID_P(CODE) (CODE == '#')
1222 ;; ------------<machine>.c------------------
1224 ;; machine_print_operand (file, x, code)
1232 ;; if (dbr_sequence_length () == 0)
1233 ;; fputs ("\n\tnop", file);
1236 ;; ::::::::::::::::::::
1238 ;; :: Notes on Patterns
1240 ;; ::::::::::::::::::::
1242 ;; If you need to construct a sequence of assembler instructions in order
1243 ;; to implement a pattern be sure to escape any backslashes and double quotes
1244 ;; that you use, e.g.:
1246 ;; (define_insn "an example"
1250 ;; { static char buffer [100];
1251 ;; sprintf (buffer, \"insn \\t %d\", REGNO (operands[1]));
1256 ;; Also if there is more than one instruction, they can be separated by \\;
1257 ;; which is a space saving synonym for \\n\\t:
1259 ;; (define_insn "another example"
1263 ;; { static char buffer [100];
1264 ;; sprintf (buffer, \"insn1 \\t %d\\;insn2 \\t %%1\",
1265 ;; REGNO (operands[1]));
1271 (include "predicates.md")
1272 (include "constraints.md")
1274 ;; ::::::::::::::::::::
1278 ;; ::::::::::::::::::::
1280 ;; Wrap moves in define_expand to prevent memory->memory moves from being
1281 ;; generated at the RTL level, which generates better code for most machines
1282 ;; which can't do mem->mem moves.
1284 ;; If operand 0 is a `subreg' with mode M of a register whose own mode is wider
1285 ;; than M, the effect of this instruction is to store the specified value in
1286 ;; the part of the register that corresponds to mode M. The effect on the rest
1287 ;; of the register is undefined.
1289 ;; This class of patterns is special in several ways. First of all, each of
1290 ;; these names *must* be defined, because there is no other way to copy a datum
1291 ;; from one place to another.
1293 ;; Second, these patterns are not used solely in the RTL generation pass. Even
1294 ;; the reload pass can generate move insns to copy values from stack slots into
1295 ;; temporary registers. When it does so, one of the operands is a hard
1296 ;; register and the other is an operand that can need to be reloaded into a
1299 ;; Therefore, when given such a pair of operands, the pattern must
1300 ;; generate RTL which needs no reloading and needs no temporary
1301 ;; registers--no registers other than the operands. For example, if
1302 ;; you support the pattern with a `define_expand', then in such a
1303 ;; case the `define_expand' mustn't call `force_reg' or any other such
1304 ;; function which might generate new pseudo registers.
1306 ;; This requirement exists even for subword modes on a RISC machine
1307 ;; where fetching those modes from memory normally requires several
1308 ;; insns and some temporary registers. Look in `spur.md' to see how
1309 ;; the requirement can be satisfied.
1311 ;; During reload a memory reference with an invalid address may be passed as an
1312 ;; operand. Such an address will be replaced with a valid address later in the
1313 ;; reload pass. In this case, nothing may be done with the address except to
1314 ;; use it as it stands. If it is copied, it will not be replaced with a valid
1315 ;; address. No attempt should be made to make such an address into a valid
1316 ;; address and no routine (such as `change_address') that will do so may be
1317 ;; called. Note that `general_operand' will fail when applied to such an
1320 ;; The global variable `reload_in_progress' (which must be explicitly declared
1321 ;; if required) can be used to determine whether such special handling is
1324 ;; The variety of operands that have reloads depends on the rest of
1325 ;; the machine description, but typically on a RISC machine these can
1326 ;; only be pseudo registers that did not get hard registers, while on
1327 ;; other machines explicit memory references will get optional
1330 ;; If a scratch register is required to move an object to or from memory, it
1331 ;; can be allocated using `gen_reg_rtx' prior to reload. But this is
1332 ;; impossible during and after reload. If there are cases needing scratch
1333 ;; registers after reload, you must define `SECONDARY_INPUT_RELOAD_CLASS' and
1334 ;; perhaps also `SECONDARY_OUTPUT_RELOAD_CLASS' to detect them, and provide
1335 ;; patterns `reload_inM' or `reload_outM' to handle them.
1337 ;; The constraints on a `moveM' must permit moving any hard register to any
1338 ;; other hard register provided that `HARD_REGNO_MODE_OK' permits mode M in
1339 ;; both registers and `REGISTER_MOVE_COST' applied to their classes returns a
1342 ;; It is obligatory to support floating point `moveM' instructions
1343 ;; into and out of any registers that can hold fixed point values,
1344 ;; because unions and structures (which have modes `SImode' or
1345 ;; `DImode') can be in those registers and they may have floating
1348 ;; There may also be a need to support fixed point `moveM' instructions in and
1349 ;; out of floating point registers. Unfortunately, I have forgotten why this
1350 ;; was so, and I don't know whether it is still true. If `HARD_REGNO_MODE_OK'
1351 ;; rejects fixed point values in floating point registers, then the constraints
1352 ;; of the fixed point `moveM' instructions must be designed to avoid ever
1353 ;; trying to reload into a floating point register.
1355 (define_expand "movqi"
1356 [(set (match_operand:QI 0 "general_operand" "")
1357 (match_operand:QI 1 "general_operand" ""))]
1359 "{ frv_emit_move (QImode, operands[0], operands[1]); DONE; }")
1361 (define_insn "*movqi_load"
1362 [(set (match_operand:QI 0 "register_operand" "=d,f")
1363 (match_operand:QI 1 "frv_load_operand" "m,m"))]
1365 "* return output_move_single (operands, insn);"
1366 [(set_attr "length" "4")
1367 (set_attr "type" "gload,fload")])
1369 (define_insn "*movqi_internal"
1370 [(set (match_operand:QI 0 "move_destination_operand" "=d,d,m,m,?f,?f,?d,?m,f,d,f")
1371 (match_operand:QI 1 "move_source_operand" "L,d,d,O, d, f, f, f,GO,!m,!m"))]
1372 "register_operand(operands[0], QImode) || reg_or_0_operand (operands[1], QImode)"
1373 "* return output_move_single (operands, insn);"
1374 [(set_attr "length" "4")
1375 (set_attr "type" "int,int,gstore,gstore,movgf,fsconv,movfg,fstore,movgf,gload,fload")])
1377 (define_expand "movhi"
1378 [(set (match_operand:HI 0 "general_operand" "")
1379 (match_operand:HI 1 "general_operand" ""))]
1381 "{ frv_emit_move (HImode, operands[0], operands[1]); DONE; }")
1383 (define_insn "*movhi_load"
1384 [(set (match_operand:HI 0 "register_operand" "=d,f")
1385 (match_operand:HI 1 "frv_load_operand" "m,m"))]
1387 "* return output_move_single (operands, insn);"
1388 [(set_attr "length" "4")
1389 (set_attr "type" "gload,fload")])
1391 (define_insn "*movhi_internal"
1392 [(set (match_operand:HI 0 "move_destination_operand" "=d,d,d,m,m,?f,?f,?d,?m,f,d,f")
1393 (match_operand:HI 1 "move_source_operand" "L,n,d,d,O, d, f, f, f,GO,!m,!m"))]
1394 "register_operand(operands[0], HImode) || reg_or_0_operand (operands[1], HImode)"
1395 "* return output_move_single (operands, insn);"
1396 [(set_attr "length" "4,8,4,4,4,4,4,4,4,4,4,4")
1397 (set_attr "type" "int,multi,int,gstore,gstore,movgf,fsconv,movfg,fstore,movgf,gload,fload")])
1399 ;; Split 2 word load of constants into sethi/setlo instructions
1401 [(set (match_operand:HI 0 "integer_register_operand" "")
1402 (match_operand:HI 1 "int_2word_operand" ""))]
1405 (high:HI (match_dup 1)))
1407 (lo_sum:HI (match_dup 0)
1411 (define_insn "movhi_high"
1412 [(set (match_operand:HI 0 "integer_register_operand" "=d")
1413 (high:HI (match_operand:HI 1 "int_2word_operand" "i")))]
1416 [(set_attr "type" "sethi")
1417 (set_attr "length" "4")])
1419 (define_insn "movhi_lo_sum"
1420 [(set (match_operand:HI 0 "integer_register_operand" "+d")
1421 (lo_sum:HI (match_dup 0)
1422 (match_operand:HI 1 "int_2word_operand" "i")))]
1425 [(set_attr "type" "setlo")
1426 (set_attr "length" "4")])
1428 (define_expand "movsi"
1429 [(set (match_operand:SI 0 "move_destination_operand" "")
1430 (match_operand:SI 1 "move_source_operand" ""))]
1432 "{ frv_emit_move (SImode, operands[0], operands[1]); DONE; }")
1434 ;; Note - it is best to only have one movsi pattern and to handle
1435 ;; all the various contingencies by the use of alternatives. This
1436 ;; allows reload the greatest amount of flexibility (since reload will
1437 ;; only choose amongst alternatives for a selected insn, it will not
1438 ;; replace the insn with another one).
1440 ;; Unfortunately, we do have to separate out load-type moves from the rest,
1441 ;; and only allow memory source operands in the former. If we do memory and
1442 ;; constant loads in a single pattern, reload will be tempted to force
1443 ;; constants into memory when the destination is a floating-point register.
1444 ;; That may make a function use a PIC pointer when it didn't before, and we
1445 ;; cannot change PIC usage (and hence stack layout) so late in the game.
1446 ;; The resulting sequences for loading constants into FPRs are preferable
1447 ;; even when we're not generating PIC code.
1449 ;; However, if we don't accept input from memory at all in the generic
1450 ;; movsi pattern, reloads for asm instructions that reference pseudos
1451 ;; that end up assigned to memory will fail to match, because we
1452 ;; recognize them right after they're emitted, and we don't
1453 ;; re-recognize them again after the substitution for memory. So keep
1454 ;; a memory constraint available, just make sure reload won't be
1455 ;; tempted to use it.
1459 (define_insn "*movsi_load"
1460 [(set (match_operand:SI 0 "register_operand" "=d,f")
1461 (match_operand:SI 1 "frv_load_operand" "m,m"))]
1463 "* return output_move_single (operands, insn);"
1464 [(set_attr "length" "4")
1465 (set_attr "type" "gload,fload")])
1467 (define_insn "*movsi_got"
1468 [(set (match_operand:SI 0 "integer_register_operand" "=d")
1469 (match_operand:SI 1 "got12_operand" ""))]
1472 [(set_attr "type" "int")
1473 (set_attr "length" "4")])
1475 (define_insn "*movsi_high_got"
1476 [(set (match_operand:SI 0 "integer_register_operand" "=d")
1477 (high:SI (match_operand:SI 1 "const_unspec_operand" "")))]
1480 [(set_attr "type" "sethi")
1481 (set_attr "length" "4")])
1483 (define_insn "*movsi_lo_sum_got"
1484 [(set (match_operand:SI 0 "integer_register_operand" "=d")
1485 (lo_sum:SI (match_operand:SI 1 "integer_register_operand" "0")
1486 (match_operand:SI 2 "const_unspec_operand" "")))]
1489 [(set_attr "type" "setlo")
1490 (set_attr "length" "4")])
1492 (define_insn "*movsi_internal"
1493 [(set (match_operand:SI 0 "move_destination_operand" "=d,d,d,m,m,z,d,d,f,f,m,?f,?z,d,f")
1494 (match_operand:SI 1 "move_source_operand" "L,n,d,d,O,d,z,f,d,f,f,GO,GO,!m,!m"))]
1495 "register_operand (operands[0], SImode) || reg_or_0_operand (operands[1], SImode)"
1496 "* return output_move_single (operands, insn);"
1497 [(set_attr "length" "4,8,4,4,4,4,4,4,4,4,4,4,4,4,4")
1498 (set_attr "type" "int,multi,int,gstore,gstore,spr,spr,movfg,movgf,fsconv,fstore,movgf,spr,gload,fload")])
1500 ;; Split 2 word load of constants into sethi/setlo instructions
1501 (define_insn_and_split "*movsi_2word"
1502 [(set (match_operand:SI 0 "integer_register_operand" "=d")
1503 (match_operand:SI 1 "int_2word_operand" "i"))]
1508 (high:SI (match_dup 1)))
1510 (lo_sum:SI (match_dup 0)
1513 [(set_attr "length" "8")
1514 (set_attr "type" "multi")])
1516 (define_insn "movsi_high"
1517 [(set (match_operand:SI 0 "integer_register_operand" "=d")
1518 (high:SI (match_operand:SI 1 "int_2word_operand" "i")))]
1521 [(set_attr "type" "sethi")
1522 (set_attr "length" "4")])
1524 (define_insn "movsi_lo_sum"
1525 [(set (match_operand:SI 0 "integer_register_operand" "+d")
1526 (lo_sum:SI (match_dup 0)
1527 (match_operand:SI 1 "int_2word_operand" "i")))]
1530 [(set_attr "type" "setlo")
1531 (set_attr "length" "4")])
1533 (define_expand "movdi"
1534 [(set (match_operand:DI 0 "nonimmediate_operand" "")
1535 (match_operand:DI 1 "general_operand" ""))]
1537 "{ frv_emit_move (DImode, operands[0], operands[1]); DONE; }")
1539 (define_insn "*movdi_double"
1540 [(set (match_operand:DI 0 "move_destination_operand" "=e,?h,??d,??f,R,?R,??m,??m,e,?h,??d,??f,?e,??d,?h,??f,R,m,e,??d,e,??d,?h,??f")
1541 (match_operand:DI 1 "move_source_operand" " e,h,d,f,e,h,d,f,R,R,m,m,h,f,e,d,GO,GO,GO,GO,nF,nF,GO,GO"))]
1543 && (register_operand (operands[0], DImode)
1544 || reg_or_0_operand (operands[1], DImode))"
1545 "* return output_move_double (operands, insn);"
1546 [(set_attr "length" "8,4,8,8,4,4,8,8,4,4,8,8,4,8,4,8,4,8,8,8,16,16,8,8")
1547 (set_attr "type" "multi,fdconv,multi,multi,gstore,fstore,gstore,fstore,gload,fload,gload,fload,movfg,movfg,movgf,movgf,gstore,gstore,multi,multi,multi,multi,movgf,movgf")])
1549 (define_insn "*movdi_nodouble"
1550 [(set (match_operand:DI 0 "move_destination_operand" "=e,?h,??d,??f,R,?R,??m,??m,e,?h,??d,??f,?e,??d,?h,??f,R,m,e,??d,e,??d,?h,??f")
1551 (match_operand:DI 1 "move_source_operand" " e,h,d,f,e,h,d,f,R,R,m,m,h,f,e,d,GO,GO,GO,GO,nF,nF,GO,GO"))]
1553 && (register_operand (operands[0], DImode)
1554 || reg_or_0_operand (operands[1], DImode))"
1555 "* return output_move_double (operands, insn);"
1556 [(set_attr "length" "8,8,8,8,4,4,8,8,4,4,8,8,8,8,8,8,4,8,8,8,16,16,8,8")
1557 (set_attr "type" "multi,multi,multi,multi,gstore,fstore,gstore,fstore,gload,fload,gload,fload,movfg,movfg,movgf,movgf,gstore,gstore,multi,multi,multi,multi,movgf,movgf")])
1560 [(set (match_operand:DI 0 "register_operand" "")
1561 (match_operand:DI 1 "dbl_memory_two_insn_operand" ""))]
1564 "frv_split_double_load (operands[0], operands[1]);")
1567 [(set (match_operand:DI 0 "odd_reg_operand" "")
1568 (match_operand:DI 1 "memory_operand" ""))]
1571 "frv_split_double_load (operands[0], operands[1]);")
1574 [(set (match_operand:DI 0 "dbl_memory_two_insn_operand" "")
1575 (match_operand:DI 1 "reg_or_0_operand" ""))]
1578 "frv_split_double_store (operands[0], operands[1]);")
1581 [(set (match_operand:DI 0 "memory_operand" "")
1582 (match_operand:DI 1 "odd_reg_operand" ""))]
1585 "frv_split_double_store (operands[0], operands[1]);")
1588 [(set (match_operand:DI 0 "register_operand" "")
1589 (match_operand:DI 1 "register_operand" ""))]
1591 && (odd_reg_operand (operands[0], DImode)
1592 || odd_reg_operand (operands[1], DImode)
1593 || (integer_register_operand (operands[0], DImode)
1594 && integer_register_operand (operands[1], DImode))
1596 && fpr_operand (operands[0], DImode)
1597 && fpr_operand (operands[1], DImode)))"
1598 [(set (match_dup 2) (match_dup 4))
1599 (set (match_dup 3) (match_dup 5))]
1602 rtx op0 = operands[0];
1603 rtx op0_low = gen_lowpart (SImode, op0);
1604 rtx op0_high = gen_highpart (SImode, op0);
1605 rtx op1 = operands[1];
1606 rtx op1_low = gen_lowpart (SImode, op1);
1607 rtx op1_high = gen_highpart (SImode, op1);
1609 /* We normally copy the low-numbered register first. However, if the first
1610 register operand 0 is the same as the second register of operand 1, we
1611 must copy in the opposite order. */
1613 if (REGNO (op0_high) == REGNO (op1_low))
1615 operands[2] = op0_low;
1616 operands[3] = op0_high;
1617 operands[4] = op1_low;
1618 operands[5] = op1_high;
1622 operands[2] = op0_high;
1623 operands[3] = op0_low;
1624 operands[4] = op1_high;
1625 operands[5] = op1_low;
1630 [(set (match_operand:DI 0 "register_operand" "")
1631 (match_operand:DI 1 "const_int_operand" ""))]
1633 [(set (match_dup 2) (match_dup 4))
1634 (set (match_dup 3) (match_dup 5))]
1637 rtx op0 = operands[0];
1638 rtx op1 = operands[1];
1640 operands[2] = gen_highpart (SImode, op0);
1641 operands[3] = gen_lowpart (SImode, op0);
1642 if (HOST_BITS_PER_WIDE_INT <= 32)
1644 operands[4] = GEN_INT ((INTVAL (op1) < 0) ? -1 : 0);
1649 operands[4] = gen_int_mode ((INTVAL (op1) >> 16) >> 16, SImode);
1650 operands[5] = gen_int_mode (INTVAL (op1), SImode);
1655 [(set (match_operand:DI 0 "register_operand" "")
1656 (match_operand:DI 1 "const_double_operand" ""))]
1658 [(set (match_dup 2) (match_dup 4))
1659 (set (match_dup 3) (match_dup 5))]
1662 rtx op0 = operands[0];
1663 rtx op1 = operands[1];
1665 operands[2] = gen_highpart (SImode, op0);
1666 operands[3] = gen_lowpart (SImode, op0);
1667 operands[4] = GEN_INT (CONST_DOUBLE_HIGH (op1));
1668 operands[5] = GEN_INT (CONST_DOUBLE_LOW (op1));
1671 ;; Floating Point Moves
1673 ;; Note - Patterns for SF mode moves are compulsory, but
1674 ;; patterns for DF are optional, as GCC can synthesize them.
1676 (define_expand "movsf"
1677 [(set (match_operand:SF 0 "general_operand" "")
1678 (match_operand:SF 1 "general_operand" ""))]
1680 "{ frv_emit_move (SFmode, operands[0], operands[1]); DONE; }")
1683 [(set (match_operand:SF 0 "integer_register_operand" "")
1684 (match_operand:SF 1 "int_2word_operand" ""))]
1687 (high:SF (match_dup 1)))
1689 (lo_sum:SF (match_dup 0)
1693 (define_insn "*movsf_load_has_fprs"
1694 [(set (match_operand:SF 0 "register_operand" "=f,d")
1695 (match_operand:SF 1 "frv_load_operand" "m,m"))]
1697 "* return output_move_single (operands, insn);"
1698 [(set_attr "length" "4")
1699 (set_attr "type" "fload,gload")])
1701 (define_insn "*movsf_internal_has_fprs"
1702 [(set (match_operand:SF 0 "move_destination_operand" "=f,f,m,m,?f,?d,?d,m,?d")
1703 (match_operand:SF 1 "move_source_operand" "f,OG,f,OG,d,f,d,d,F"))]
1705 && (register_operand (operands[0], SFmode) || reg_or_0_operand (operands[1], SFmode))"
1706 "* return output_move_single (operands, insn);"
1707 [(set_attr "length" "4,4,4,4,4,4,4,4,8")
1708 (set_attr "type" "fsconv,movgf,fstore,gstore,movgf,movfg,int,gstore,multi")])
1710 ;; If we don't support the double instructions, prefer gprs over fprs, since it
1711 ;; will all be emulated
1712 (define_insn "*movsf_internal_no_fprs"
1713 [(set (match_operand:SF 0 "move_destination_operand" "=d,d,m,d,d")
1714 (match_operand:SF 1 "move_source_operand" " d,OG,dOG,m,F"))]
1716 && (register_operand (operands[0], SFmode) || reg_or_0_operand (operands[1], SFmode))"
1717 "* return output_move_single (operands, insn);"
1718 [(set_attr "length" "4,4,4,4,8")
1719 (set_attr "type" "int,int,gstore,gload,multi")])
1721 (define_insn "movsf_high"
1722 [(set (match_operand:SF 0 "integer_register_operand" "=d")
1723 (high:SF (match_operand:SF 1 "int_2word_operand" "i")))]
1726 [(set_attr "type" "sethi")
1727 (set_attr "length" "4")])
1729 (define_insn "movsf_lo_sum"
1730 [(set (match_operand:SF 0 "integer_register_operand" "+d")
1731 (lo_sum:SF (match_dup 0)
1732 (match_operand:SF 1 "int_2word_operand" "i")))]
1735 [(set_attr "type" "setlo")
1736 (set_attr "length" "4")])
1738 (define_expand "movdf"
1739 [(set (match_operand:DF 0 "nonimmediate_operand" "")
1740 (match_operand:DF 1 "general_operand" ""))]
1742 "{ frv_emit_move (DFmode, operands[0], operands[1]); DONE; }")
1744 (define_insn "*movdf_double"
1745 [(set (match_operand:DF 0 "move_destination_operand" "=h,?e,??f,??d,R,?R,??m,??m,h,?e,??f,??d,?h,??f,?e,??d,R,m,h,??f,e,??d,e,??d")
1746 (match_operand:DF 1 "move_source_operand" " h,e,f,d,h,e,f,d,R,R,m,m,e,d,h,f,GO,GO,GO,GO,GO,GO,F,F"))]
1748 && (register_operand (operands[0], DFmode)
1749 || reg_or_0_operand (operands[1], DFmode))"
1750 "* return output_move_double (operands, insn);"
1751 [(set_attr "length" "4,8,8,8,4,4,8,8,4,4,8,8,4,8,4,8,4,8,8,8,8,8,16,16")
1752 (set_attr "type" "fdconv,multi,multi,multi,fstore,gstore,fstore,gstore,fload,gload,fload,gload,movgf,movgf,movfg,movfg,gstore,gstore,movgf,movgf,multi,multi,multi,multi")])
1754 ;; If we don't support the double instructions, prefer gprs over fprs, since it
1755 ;; will all be emulated
1756 (define_insn "*movdf_nodouble"
1757 [(set (match_operand:DF 0 "move_destination_operand" "=e,?h,??d,??f,R,?R,??m,??m,e,?h,??d,??f,?e,??d,?h,??f,R,m,e,??d,e,??d,?h,??f")
1758 (match_operand:DF 1 "move_source_operand" " e,h,d,f,e,h,d,f,R,R,m,m,h,f,e,d,GO,GO,GO,GO,nF,nF,GO,GO"))]
1760 && (register_operand (operands[0], DFmode)
1761 || reg_or_0_operand (operands[1], DFmode))"
1762 "* return output_move_double (operands, insn);"
1763 [(set_attr "length" "8,8,8,8,4,4,8,8,4,4,8,8,8,8,8,8,4,8,8,8,16,16,8,8")
1764 (set_attr "type" "multi,multi,multi,multi,gstore,fstore,gstore,fstore,gload,fload,gload,fload,movfg,movfg,movgf,movgf,gstore,gstore,multi,multi,multi,multi,movgf,movgf")])
1767 [(set (match_operand:DF 0 "register_operand" "")
1768 (match_operand:DF 1 "dbl_memory_two_insn_operand" ""))]
1771 "frv_split_double_load (operands[0], operands[1]);")
1774 [(set (match_operand:DF 0 "odd_reg_operand" "")
1775 (match_operand:DF 1 "memory_operand" ""))]
1778 "frv_split_double_load (operands[0], operands[1]);")
1781 [(set (match_operand:DF 0 "dbl_memory_two_insn_operand" "")
1782 (match_operand:DF 1 "reg_or_0_operand" ""))]
1785 "frv_split_double_store (operands[0], operands[1]);")
1788 [(set (match_operand:DF 0 "memory_operand" "")
1789 (match_operand:DF 1 "odd_reg_operand" ""))]
1792 "frv_split_double_store (operands[0], operands[1]);")
1795 [(set (match_operand:DF 0 "register_operand" "")
1796 (match_operand:DF 1 "register_operand" ""))]
1798 && (odd_reg_operand (operands[0], DFmode)
1799 || odd_reg_operand (operands[1], DFmode)
1800 || (integer_register_operand (operands[0], DFmode)
1801 && integer_register_operand (operands[1], DFmode))
1803 && fpr_operand (operands[0], DFmode)
1804 && fpr_operand (operands[1], DFmode)))"
1805 [(set (match_dup 2) (match_dup 4))
1806 (set (match_dup 3) (match_dup 5))]
1809 rtx op0 = operands[0];
1810 rtx op0_low = gen_lowpart (SImode, op0);
1811 rtx op0_high = gen_highpart (SImode, op0);
1812 rtx op1 = operands[1];
1813 rtx op1_low = gen_lowpart (SImode, op1);
1814 rtx op1_high = gen_highpart (SImode, op1);
1816 /* We normally copy the low-numbered register first. However, if the first
1817 register operand 0 is the same as the second register of operand 1, we
1818 must copy in the opposite order. */
1820 if (REGNO (op0_high) == REGNO (op1_low))
1822 operands[2] = op0_low;
1823 operands[3] = op0_high;
1824 operands[4] = op1_low;
1825 operands[5] = op1_high;
1829 operands[2] = op0_high;
1830 operands[3] = op0_low;
1831 operands[4] = op1_high;
1832 operands[5] = op1_low;
1837 [(set (match_operand:DF 0 "register_operand" "")
1838 (match_operand:DF 1 "const_int_operand" ""))]
1840 [(set (match_dup 2) (match_dup 4))
1841 (set (match_dup 3) (match_dup 5))]
1844 rtx op0 = operands[0];
1845 rtx op1 = operands[1];
1847 operands[2] = gen_highpart (SImode, op0);
1848 operands[3] = gen_lowpart (SImode, op0);
1849 if (HOST_BITS_PER_WIDE_INT <= 32)
1851 operands[4] = GEN_INT ((INTVAL (op1) < 0) ? -1 : 0);
1856 operands[4] = GEN_INT (((((unsigned HOST_WIDE_INT)INTVAL (op1) >> 16)
1857 >> 16) ^ ((unsigned HOST_WIDE_INT)1 << 31))
1858 - ((unsigned HOST_WIDE_INT)1 << 31));
1859 operands[5] = GEN_INT (trunc_int_for_mode (INTVAL (op1), SImode));
1864 [(set (match_operand:DF 0 "register_operand" "")
1865 (match_operand:DF 1 "const_double_operand" ""))]
1867 [(set (match_dup 2) (match_dup 4))
1868 (set (match_dup 3) (match_dup 5))]
1871 rtx op0 = operands[0];
1872 rtx op1 = operands[1];
1876 REAL_VALUE_FROM_CONST_DOUBLE (rv, op1);
1877 REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
1879 operands[2] = gen_highpart (SImode, op0);
1880 operands[3] = gen_lowpart (SImode, op0);
1881 operands[4] = GEN_INT (l[0]);
1882 operands[5] = GEN_INT (l[1]);
1885 ;; String/block move insn.
1886 ;; Argument 0 is the destination
1887 ;; Argument 1 is the source
1888 ;; Argument 2 is the length
1889 ;; Argument 3 is the alignment
1891 (define_expand "movmemsi"
1892 [(parallel [(set (match_operand:BLK 0 "" "")
1893 (match_operand:BLK 1 "" ""))
1894 (use (match_operand:SI 2 "" ""))
1895 (use (match_operand:SI 3 "" ""))])]
1899 if (frv_expand_block_move (operands))
1905 ;; String/block set insn.
1906 ;; Argument 0 is the destination
1907 ;; Argument 1 is the length
1908 ;; Argument 2 is the byte value -- ignore any value but zero
1909 ;; Argument 3 is the alignment
1911 (define_expand "setmemsi"
1912 [(parallel [(set (match_operand:BLK 0 "" "")
1913 (match_operand 2 "" ""))
1914 (use (match_operand:SI 1 "" ""))
1915 (use (match_operand:SI 3 "" ""))])]
1919 /* If value to set is not zero, use the library routine. */
1920 if (operands[2] != const0_rtx)
1923 if (frv_expand_block_clear (operands))
1930 ;; The "membar" part of a __builtin_read* or __builtin_write* function.
1931 ;; Operand 0 is a volatile reference to the memory that the function reads
1932 ;; or writes. Operand 1 is the address being accessed, or zero if the
1933 ;; address isn't a known constant. Operand 2 describes the __builtin
1934 ;; function (either FRV_IO_READ or FRV_IO_WRITE).
1935 (define_insn "optional_membar_<mode>"
1936 [(set (match_operand:IMODE 0 "memory_operand" "=m")
1937 (unspec:IMODE [(match_operand 1 "const_int_operand" "")
1938 (match_operand 2 "const_int_operand" "")]
1939 UNSPEC_OPTIONAL_MEMBAR))]
1942 [(set_attr "length" "4")])
1944 ;; ::::::::::::::::::::
1946 ;; :: Reload CC registers
1948 ;; ::::::::::::::::::::
1950 ;; Use as a define_expand so that cse/gcse/combine can't accidentally
1951 ;; create movcc insns.
1953 (define_expand "movcc"
1954 [(parallel [(set (match_operand:CC 0 "move_destination_operand" "")
1955 (match_operand:CC 1 "move_source_operand" ""))
1956 (clobber (match_dup 2))])]
1960 if (! reload_in_progress && ! reload_completed)
1963 operands[2] = gen_rtx_REG (CC_CCRmode, ICR_TEMP);
1966 (define_insn "*internal_movcc"
1967 [(set (match_operand:CC 0 "move_destination_operand" "=t,d,d,m,d")
1968 (match_operand:CC 1 "move_source_operand" "d,d,m,d,t"))
1969 (clobber (match_scratch:CC_CCR 2 "=X,X,X,X,&v"))]
1970 "reload_in_progress || reload_completed"
1977 [(set_attr "length" "4,4,4,4,20")
1978 (set_attr "type" "int,int,gload,gstore,multi")])
1980 ;; To move an ICC value to a GPR for a signed comparison, we create a value
1981 ;; that when compared to 0, sets the N and Z flags appropriately (we don't care
1982 ;; about the V and C flags, since these comparisons are signed).
1985 [(set (match_operand:CC 0 "integer_register_operand" "")
1986 (match_operand:CC 1 "icc_operand" ""))
1987 (clobber (match_operand:CC_CCR 2 "icr_operand" ""))]
1988 "reload_in_progress || reload_completed"
1992 rtx dest = simplify_gen_subreg (SImode, operands[0], CCmode, 0);
1993 rtx icc = operands[1];
1994 rtx icr = operands[2];
1998 emit_insn (gen_rtx_SET (icr, gen_rtx_LT (CC_CCRmode, icc, const0_rtx)));
2000 emit_insn (gen_movsi (dest, const1_rtx));
2002 emit_insn (gen_rtx_COND_EXEC (VOIDmode,
2003 gen_rtx_NE (CC_CCRmode, icr, const0_rtx),
2005 gen_rtx_NEG (SImode, dest))));
2007 emit_insn (gen_rtx_SET (icr, gen_rtx_EQ (CC_CCRmode, icc, const0_rtx)));
2009 emit_insn (gen_rtx_COND_EXEC (VOIDmode,
2010 gen_rtx_NE (CC_CCRmode, icr, const0_rtx),
2011 gen_rtx_SET (dest, const0_rtx)));
2013 operands[3] = get_insns ();
2017 ;; Reload CC_UNSmode for unsigned integer comparisons
2018 ;; Use define_expand so that cse/gcse/combine can't create movcc_uns insns
2020 (define_expand "movcc_uns"
2021 [(parallel [(set (match_operand:CC_UNS 0 "move_destination_operand" "")
2022 (match_operand:CC_UNS 1 "move_source_operand" ""))
2023 (clobber (match_dup 2))])]
2027 if (! reload_in_progress && ! reload_completed)
2029 operands[2] = gen_rtx_REG (CC_CCRmode, ICR_TEMP);
2032 (define_insn "*internal_movcc_uns"
2033 [(set (match_operand:CC_UNS 0 "move_destination_operand" "=t,d,d,m,d")
2034 (match_operand:CC_UNS 1 "move_source_operand" "d,d,m,d,t"))
2035 (clobber (match_scratch:CC_CCR 2 "=X,X,X,X,&v"))]
2036 "reload_in_progress || reload_completed"
2043 [(set_attr "length" "4,4,4,4,20")
2044 (set_attr "type" "int,int,gload,gstore,multi")])
2046 ;; To move an ICC value to a GPR for an unsigned comparison, we create a value
2047 ;; that when compared to 1, sets the Z, V, and C flags appropriately (we don't
2048 ;; care about the N flag, since these comparisons are unsigned).
2051 [(set (match_operand:CC_UNS 0 "integer_register_operand" "")
2052 (match_operand:CC_UNS 1 "icc_operand" ""))
2053 (clobber (match_operand:CC_CCR 2 "icr_operand" ""))]
2054 "reload_in_progress || reload_completed"
2058 rtx dest = simplify_gen_subreg (SImode, operands[0], CC_UNSmode, 0);
2059 rtx icc = operands[1];
2060 rtx icr = operands[2];
2064 emit_insn (gen_rtx_SET (icr, gen_rtx_GTU (CC_CCRmode, icc, const0_rtx)));
2066 emit_insn (gen_movsi (dest, const1_rtx));
2068 emit_insn (gen_rtx_COND_EXEC (VOIDmode,
2069 gen_rtx_NE (CC_CCRmode, icr, const0_rtx),
2070 gen_addsi3 (dest, dest, dest)));
2072 emit_insn (gen_rtx_SET (icr, gen_rtx_LTU (CC_CCRmode, icc, const0_rtx)));
2074 emit_insn (gen_rtx_COND_EXEC (VOIDmode,
2075 gen_rtx_NE (CC_CCRmode, icr, const0_rtx),
2076 gen_rtx_SET (dest, const0_rtx)));
2078 operands[3] = get_insns ();
2082 ;; Reload CC_NZmode. This is mostly the same as the CCmode and CC_UNSmode
2083 ;; handling, but it uses different sequences for moving between GPRs and ICCs.
2085 (define_expand "movcc_nz"
2086 [(parallel [(set (match_operand:CC_NZ 0 "move_destination_operand" "")
2087 (match_operand:CC_NZ 1 "move_source_operand" ""))
2088 (clobber (match_dup 2))])]
2092 if (!reload_in_progress && !reload_completed)
2094 operands[2] = gen_rtx_REG (CC_CCRmode, ICR_TEMP);
2097 (define_insn "*internal_movcc_nz"
2098 [(set (match_operand:CC_NZ 0 "move_destination_operand" "=t,d,d,m,d")
2099 (match_operand:CC_NZ 1 "move_source_operand" "d,d,m,d,t"))
2100 (clobber (match_scratch:CC_CCR 2 "=X,X,X,X,&v"))]
2101 "reload_in_progress || reload_completed"
2108 [(set_attr "length" "4,4,4,4,20")
2109 (set_attr "type" "int,int,gload,gstore,multi")])
2111 ;; Set the destination to a value that, when compared with zero, will
2112 ;; restore the value of the Z and N flags. The values of the other
2113 ;; flags don't matter. The sequence is:
2117 ;; csub gr0,op0,op0,op2
2121 [(set (match_operand:CC_NZ 0 "integer_register_operand" "")
2122 (match_operand:CC_NZ 1 "icc_operand" ""))
2123 (clobber (match_operand:CC_CCR 2 "icr_operand" ""))]
2124 "reload_in_progress || reload_completed"
2128 (ge:CC_CCR (match_dup 1)
2130 (cond_exec (ne:CC_CCR (match_dup 2)
2133 (neg:SI (match_dup 3))))
2135 (eq:CC_CCR (match_dup 1)
2137 (cond_exec (ne:CC_CCR (match_dup 2)
2139 (set (match_dup 3) (const_int 0)))]
2140 "operands[3] = simplify_gen_subreg (SImode, operands[0], CC_NZmode, 0);")
2142 ;; Reload CC_FPmode for floating point comparisons
2143 ;; We use a define_expand here so that cse/gcse/combine can't accidentally
2144 ;; create movcc insns. If this was a named define_insn, we would not be able
2145 ;; to make it conditional on reload.
2147 (define_expand "movcc_fp"
2148 [(set (match_operand:CC_FP 0 "movcc_fp_destination_operand" "")
2149 (match_operand:CC_FP 1 "move_source_operand" ""))]
2153 if (! reload_in_progress && ! reload_completed)
2157 (define_insn "*movcc_fp_internal"
2158 [(set (match_operand:CC_FP 0 "movcc_fp_destination_operand" "=d,d,d,m")
2159 (match_operand:CC_FP 1 "move_source_operand" "u,d,m,d"))]
2160 "TARGET_HAS_FPRS && (reload_in_progress || reload_completed)"
2166 [(set_attr "length" "12,4,4,4")
2167 (set_attr "type" "multi,int,gload,gstore")])
2170 (define_expand "reload_incc_fp"
2171 [(match_operand:CC_FP 0 "fcc_operand" "=u")
2172 (match_operand:CC_FP 1 "gpr_or_memory_operand_with_scratch" "m")
2173 (match_operand:TI 2 "integer_register_operand" "=&d")]
2177 rtx cc_op2 = simplify_gen_subreg (CC_FPmode, operands[2], TImode, 0);
2178 rtx int_op2 = simplify_gen_subreg (SImode, operands[2], TImode, 0);
2179 rtx temp1 = simplify_gen_subreg (SImode, operands[2], TImode, 4);
2180 rtx temp2 = simplify_gen_subreg (SImode, operands[2], TImode, 8);
2181 int shift = CC_SHIFT_RIGHT (REGNO (operands[0]));
2184 if (!gpr_or_memory_operand (operands[1], CC_FPmode))
2187 rtx temp3 = simplify_gen_subreg (SImode, operands[2], TImode, 12);
2189 gcc_assert (GET_CODE (operands[1]) == MEM);
2191 addr = XEXP (operands[1], 0);
2193 gcc_assert (GET_CODE (addr) == PLUS);
2195 emit_move_insn (temp3, XEXP (addr, 1));
2197 operands[1] = replace_equiv_address (operands[1],
2198 gen_rtx_PLUS (GET_MODE (addr),
2203 emit_insn (gen_movcc_fp (cc_op2, operands[1]));
2205 emit_insn (gen_ashlsi3 (int_op2, int_op2, GEN_INT (shift)));
2207 mask = ~ ((HOST_WIDE_INT)CC_MASK << shift);
2208 emit_insn (gen_movsi (temp1, GEN_INT (mask)));
2209 emit_insn (gen_update_fcc (operands[0], int_op2, temp1, temp2));
2213 (define_expand "reload_outcc_fp"
2214 [(set (match_operand:CC_FP 2 "integer_register_operand" "=&d")
2215 (match_operand:CC_FP 1 "fcc_operand" "u"))
2216 (set (match_operand:CC_FP 0 "memory_operand" "=m")
2221 ;; Convert a FCC value to gpr
2222 (define_insn "read_fcc"
2223 [(set (match_operand:SI 0 "integer_register_operand" "=d")
2224 (unspec:SI [(match_operand:CC_FP 1 "fcc_operand" "u")]
2228 [(set_attr "type" "spr")
2229 (set_attr "length" "4")])
2232 [(set (match_operand:CC_FP 0 "integer_register_operand" "")
2233 (match_operand:CC_FP 1 "fcc_operand" ""))]
2234 "reload_completed && TARGET_HAS_FPRS"
2238 rtx int_op0 = simplify_gen_subreg (SImode, operands[0], CC_FPmode, 0);
2239 int shift = CC_SHIFT_RIGHT (REGNO (operands[1]));
2243 emit_insn (gen_read_fcc (int_op0, operands[1]));
2245 emit_insn (gen_lshrsi3 (int_op0, int_op0, GEN_INT (shift)));
2247 emit_insn (gen_andsi3 (int_op0, int_op0, GEN_INT (CC_MASK)));
2249 operands[2] = get_insns ();
2253 ;; Move a gpr value to FCC.
2255 ;; Operand1 = reloaded value shifted appropriately
2256 ;; Operand2 = mask to eliminate current register
2257 ;; Operand3 = temporary to load/store ccr
2258 (define_insn "update_fcc"
2259 [(set (match_operand:CC_FP 0 "fcc_operand" "=u")
2260 (unspec:CC_FP [(match_operand:SI 1 "integer_register_operand" "d")
2261 (match_operand:SI 2 "integer_register_operand" "d")]
2263 (clobber (match_operand:SI 3 "integer_register_operand" "=&d"))]
2265 "movsg ccr, %3\;and %2, %3, %3\;or %1, %3, %3\;movgs %3, ccr"
2266 [(set_attr "type" "multi")
2267 (set_attr "length" "16")])
2269 ;; Reload CC_CCRmode for conditional execution registers
2270 (define_insn "movcc_ccr"
2271 [(set (match_operand:CC_CCR 0 "move_destination_operand" "=d,d,d,m,v,?w,C,d")
2272 (match_operand:CC_CCR 1 "move_source_operand" "C,d,m,d,n,n,C,L"))]
2283 [(set_attr "length" "8,4,4,4,8,12,4,4")
2284 (set_attr "type" "multi,int,gload,gstore,multi,multi,ccr,int")])
2286 (define_expand "reload_incc_ccr"
2287 [(match_operand:CC_CCR 0 "cr_operand" "=C")
2288 (match_operand:CC_CCR 1 "memory_operand" "m")
2289 (match_operand:CC_CCR 2 "integer_register_operand" "=&d")]
2293 rtx icc = gen_rtx_REG (CCmode, ICC_TEMP);
2294 rtx int_op2 = simplify_gen_subreg (SImode, operands[2], CC_CCRmode, 0);
2295 rtx icr = (ICR_P (REGNO (operands[0]))
2296 ? operands[0] : gen_rtx_REG (CC_CCRmode, ICR_TEMP));
2298 emit_insn (gen_movcc_ccr (operands[2], operands[1]));
2299 emit_insn (gen_cmpsi_cc (icc, int_op2, const0_rtx));
2300 emit_insn (gen_movcc_ccr (icr, gen_rtx_NE (CC_CCRmode, icc, const0_rtx)));
2302 if (! ICR_P (REGNO (operands[0])))
2303 emit_insn (gen_movcc_ccr (operands[0], icr));
2308 (define_expand "reload_outcc_ccr"
2309 [(set (match_operand:CC_CCR 2 "integer_register_operand" "=&d")
2310 (match_operand:CC_CCR 1 "cr_operand" "C"))
2311 (set (match_operand:CC_CCR 0 "memory_operand" "=m")
2317 [(set (match_operand:CC_CCR 0 "integer_register_operand" "")
2318 (match_operand:CC_CCR 1 "cr_operand" ""))]
2323 rtx int_op0 = simplify_gen_subreg (SImode, operands[0], CC_CCRmode, 0);
2326 emit_move_insn (operands[0], const1_rtx);
2327 emit_insn (gen_rtx_COND_EXEC (VOIDmode,
2328 gen_rtx_EQ (CC_CCRmode,
2331 gen_rtx_SET (int_op0, const0_rtx)));
2333 operands[2] = get_insns ();
2338 [(set (match_operand:CC_CCR 0 "cr_operand" "")
2339 (match_operand:CC_CCR 1 "const_int_operand" ""))]
2344 rtx icc = gen_rtx_REG (CCmode, ICC_TEMP);
2345 rtx r0 = gen_rtx_REG (SImode, GPR_FIRST);
2346 rtx icr = (ICR_P (REGNO (operands[0]))
2347 ? operands[0] : gen_rtx_REG (CC_CCRmode, ICR_TEMP));
2351 emit_insn (gen_cmpsi_cc (icc, r0, const0_rtx));
2353 emit_insn (gen_movcc_ccr (icr,
2354 gen_rtx_fmt_ee (((INTVAL (operands[1]) == 0)
2355 ? EQ : NE), CC_CCRmode,
2358 if (! ICR_P (REGNO (operands[0])))
2359 emit_insn (gen_movcc_ccr (operands[0], icr));
2361 operands[2] = get_insns ();
2366 ;; ::::::::::::::::::::
2370 ;; ::::::::::::::::::::
2372 ;; Signed conversions from a smaller integer to a larger integer
2374 ;; These operations are optional. If they are not
2375 ;; present GCC will synthesize them for itself
2376 ;; Even though frv does not provide these instructions, we define them
2377 ;; to allow load + sign extend to be collapsed together
2378 (define_insn "extendqihi2"
2379 [(set (match_operand:HI 0 "integer_register_operand" "=d,d")
2380 (sign_extend:HI (match_operand:QI 1 "gpr_or_memory_operand" "d,m")))]
2385 [(set_attr "length" "8,4")
2386 (set_attr "type" "multi,gload")])
2389 [(set (match_operand:HI 0 "integer_register_operand" "")
2390 (sign_extend:HI (match_operand:QI 1 "integer_register_operand" "")))]
2396 rtx op0 = gen_lowpart (SImode, operands[0]);
2397 rtx op1 = gen_lowpart (SImode, operands[1]);
2398 rtx shift = GEN_INT (24);
2400 operands[2] = gen_ashlsi3 (op0, op1, shift);
2401 operands[3] = gen_ashrsi3 (op0, op0, shift);
2404 (define_insn "extendqisi2"
2405 [(set (match_operand:SI 0 "integer_register_operand" "=d,d")
2406 (sign_extend:SI (match_operand:QI 1 "gpr_or_memory_operand" "d,m")))]
2411 [(set_attr "length" "8,4")
2412 (set_attr "type" "multi,gload")])
2415 [(set (match_operand:SI 0 "integer_register_operand" "")
2416 (sign_extend:SI (match_operand:QI 1 "integer_register_operand" "")))]
2422 rtx op0 = gen_lowpart (SImode, operands[0]);
2423 rtx op1 = gen_lowpart (SImode, operands[1]);
2424 rtx shift = GEN_INT (24);
2426 operands[2] = gen_ashlsi3 (op0, op1, shift);
2427 operands[3] = gen_ashrsi3 (op0, op0, shift);
2430 ;;(define_insn "extendqidi2"
2431 ;; [(set (match_operand:DI 0 "register_operand" "=r")
2432 ;; (sign_extend:DI (match_operand:QI 1 "general_operand" "g")))]
2434 ;; "extendqihi2 %0,%1"
2435 ;; [(set_attr "length" "4")])
2437 (define_insn "extendhisi2"
2438 [(set (match_operand:SI 0 "integer_register_operand" "=d,d")
2439 (sign_extend:SI (match_operand:HI 1 "gpr_or_memory_operand" "d,m")))]
2444 [(set_attr "length" "8,4")
2445 (set_attr "type" "multi,gload")])
2448 [(set (match_operand:SI 0 "integer_register_operand" "")
2449 (sign_extend:SI (match_operand:HI 1 "integer_register_operand" "")))]
2455 rtx op0 = gen_lowpart (SImode, operands[0]);
2456 rtx op1 = gen_lowpart (SImode, operands[1]);
2457 rtx shift = GEN_INT (16);
2459 operands[2] = gen_ashlsi3 (op0, op1, shift);
2460 operands[3] = gen_ashrsi3 (op0, op0, shift);
2463 ;;(define_insn "extendhidi2"
2464 ;; [(set (match_operand:DI 0 "register_operand" "=r")
2465 ;; (sign_extend:DI (match_operand:HI 1 "general_operand" "g")))]
2467 ;; "extendhihi2 %0,%1"
2468 ;; [(set_attr "length" "4")])
2470 ;;(define_insn "extendsidi2"
2471 ;; [(set (match_operand:DI 0 "register_operand" "=r")
2472 ;; (sign_extend:DI (match_operand:SI 1 "general_operand" "g")))]
2474 ;; "extendsidi2 %0,%1"
2475 ;; [(set_attr "length" "4")])
2477 ;; Unsigned conversions from a smaller integer to a larger integer
2478 (define_insn "zero_extendqihi2"
2479 [(set (match_operand:HI 0 "integer_register_operand" "=d,d,d")
2481 (match_operand:QI 1 "gpr_or_memory_operand" "d,L,m")))]
2487 [(set_attr "length" "4")
2488 (set_attr "type" "int,int,gload")])
2490 (define_insn "zero_extendqisi2"
2491 [(set (match_operand:SI 0 "integer_register_operand" "=d,d,d")
2493 (match_operand:QI 1 "gpr_or_memory_operand" "d,L,m")))]
2499 [(set_attr "length" "4")
2500 (set_attr "type" "int,int,gload")])
2502 ;;(define_insn "zero_extendqidi2"
2503 ;; [(set (match_operand:DI 0 "register_operand" "=r")
2504 ;; (zero_extend:DI (match_operand:QI 1 "general_operand" "g")))]
2506 ;; "zero_extendqihi2 %0,%1"
2507 ;; [(set_attr "length" "4")])
2509 ;; Do not set the type for the sethi to "sethi", since the scheduler will think
2510 ;; the sethi takes 0 cycles as part of allowing sethi/setlo to be in the same
2511 ;; VLIW instruction.
2512 (define_insn "zero_extendhisi2"
2513 [(set (match_operand:SI 0 "integer_register_operand" "=d,d")
2514 (zero_extend:SI (match_operand:HI 1 "gpr_or_memory_operand" "0,m")))]
2519 [(set_attr "length" "4")
2520 (set_attr "type" "int,gload")])
2522 ;;(define_insn "zero_extendhidi2"
2523 ;; [(set (match_operand:DI 0 "register_operand" "=r")
2524 ;; (zero_extend:DI (match_operand:HI 1 "general_operand" "g")))]
2526 ;; "zero_extendhihi2 %0,%1"
2527 ;; [(set_attr "length" "4")])
2529 ;;(define_insn "zero_extendsidi2"
2530 ;; [(set (match_operand:DI 0 "register_operand" "=r")
2531 ;; (zero_extend:DI (match_operand:SI 1 "general_operand" "g")))]
2533 ;; "zero_extendsidi2 %0,%1"
2534 ;; [(set_attr "length" "4")])
2536 ;;;; Convert between floating point types of different sizes.
2538 ;;(define_insn "extendsfdf2"
2539 ;; [(set (match_operand:DF 0 "register_operand" "=r")
2540 ;; (float_extend:DF (match_operand:SF 1 "register_operand" "r")))]
2542 ;; "extendsfdf2 %0,%1"
2543 ;; [(set_attr "length" "4")])
2545 ;;(define_insn "truncdfsf2"
2546 ;; [(set (match_operand:SF 0 "register_operand" "=r")
2547 ;; (float_truncate:SF (match_operand:DF 1 "register_operand" "r")))]
2549 ;; "truncdfsf2 %0,%1"
2550 ;; [(set_attr "length" "4")])
2552 ;;;; Convert between signed integer types and floating point.
2553 (define_insn "floatsisf2"
2554 [(set (match_operand:SF 0 "fpr_operand" "=f")
2555 (float:SF (match_operand:SI 1 "fpr_operand" "f")))]
2558 [(set_attr "length" "4")
2559 (set_attr "type" "fsconv")])
2561 (define_insn "floatsidf2"
2562 [(set (match_operand:DF 0 "fpr_operand" "=h")
2563 (float:DF (match_operand:SI 1 "fpr_operand" "f")))]
2564 "TARGET_HARD_FLOAT && TARGET_DOUBLE"
2566 [(set_attr "length" "4")
2567 (set_attr "type" "fdconv")])
2569 ;;(define_insn "floatdisf2"
2570 ;; [(set (match_operand:SF 0 "register_operand" "=r")
2571 ;; (float:SF (match_operand:DI 1 "register_operand" "r")))]
2573 ;; "floatdisf2 %0,%1"
2574 ;; [(set_attr "length" "4")])
2576 ;;(define_insn "floatdidf2"
2577 ;; [(set (match_operand:DF 0 "register_operand" "=r")
2578 ;; (float:DF (match_operand:DI 1 "register_operand" "r")))]
2580 ;; "floatdidf2 %0,%1"
2581 ;; [(set_attr "length" "4")])
2583 (define_insn "fix_truncsfsi2"
2584 [(set (match_operand:SI 0 "fpr_operand" "=f")
2585 (fix:SI (match_operand:SF 1 "fpr_operand" "f")))]
2588 [(set_attr "length" "4")
2589 (set_attr "type" "fsconv")])
2591 (define_insn "fix_truncdfsi2"
2592 [(set (match_operand:SI 0 "fpr_operand" "=f")
2593 (fix:SI (match_operand:DF 1 "fpr_operand" "h")))]
2594 "TARGET_HARD_FLOAT && TARGET_DOUBLE"
2596 [(set_attr "length" "4")
2597 (set_attr "type" "fdconv")])
2599 ;;(define_insn "fix_truncsfdi2"
2600 ;; [(set (match_operand:DI 0 "register_operand" "=r")
2601 ;; (fix:DI (match_operand:SF 1 "register_operand" "r")))]
2603 ;; "fix_truncsfdi2 %0,%1"
2604 ;; [(set_attr "length" "4")])
2606 ;;(define_insn "fix_truncdfdi2"
2607 ;; [(set (match_operand:DI 0 "register_operand" "=r")
2608 ;; (fix:DI (match_operand:DF 1 "register_operand" "r")))]
2610 ;; "fix_truncdfdi2 %0,%1"
2611 ;; [(set_attr "length" "4")])
2613 ;;;; Convert between unsigned integer types and floating point.
2615 ;;(define_insn "floatunssisf2"
2616 ;; [(set (match_operand:SF 0 "register_operand" "=r")
2617 ;; (unsigned_float:SF (match_operand:SI 1 "register_operand" "r")))]
2619 ;; "floatunssisf2 %0,%1"
2620 ;; [(set_attr "length" "4")])
2622 ;;(define_insn "floatunssidf2"
2623 ;; [(set (match_operand:DF 0 "register_operand" "=r")
2624 ;; (unsigned_float:DF (match_operand:SI 1 "register_operand" "r")))]
2626 ;; "floatunssidf2 %0,%1"
2627 ;; [(set_attr "length" "4")])
2629 ;;(define_insn "floatunsdisf2"
2630 ;; [(set (match_operand:SF 0 "register_operand" "=r")
2631 ;; (unsigned_float:SF (match_operand:DI 1 "register_operand" "r")))]
2633 ;; "floatunsdisf2 %0,%1"
2634 ;; [(set_attr "length" "4")])
2636 ;;(define_insn "floatunsdidf2"
2637 ;; [(set (match_operand:DF 0 "register_operand" "=r")
2638 ;; (unsigned_float:DF (match_operand:DI 1 "register_operand" "r")))]
2640 ;; "floatunsdidf2 %0,%1"
2641 ;; [(set_attr "length" "4")])
2643 ;;(define_insn "fixuns_truncsfsi2"
2644 ;; [(set (match_operand:SI 0 "register_operand" "=r")
2645 ;; (unsigned_fix:SI (match_operand:SF 1 "register_operand" "r")))]
2647 ;; "fixuns_truncsfsi2 %0,%1"
2648 ;; [(set_attr "length" "4")])
2650 ;;(define_insn "fixuns_truncdfsi2"
2651 ;; [(set (match_operand:SI 0 "register_operand" "=r")
2652 ;; (unsigned_fix:SI (match_operand:DF 1 "register_operand" "r")))]
2654 ;; "fixuns_truncdfsi2 %0,%1"
2655 ;; [(set_attr "length" "4")])
2657 ;;(define_insn "fixuns_truncsfdi2"
2658 ;; [(set (match_operand:DI 0 "register_operand" "=r")
2659 ;; (unsigned_fix:DI (match_operand:SF 1 "register_operand" "r")))]
2661 ;; "fixuns_truncsfdi2 %0,%1"
2662 ;; [(set_attr "length" "4")])
2664 ;;(define_insn "fixuns_truncdfdi2"
2665 ;; [(set (match_operand:DI 0 "register_operand" "=r")
2666 ;; (unsigned_fix:DI (match_operand:DF 1 "register_operand" "r")))]
2668 ;; "fixuns_truncdfdi2 %0,%1"
2669 ;; [(set_attr "length" "4")])
2672 ;; ::::::::::::::::::::
2674 ;; :: 32-bit Integer arithmetic
2676 ;; ::::::::::::::::::::
2679 (define_insn "addsi3"
2680 [(set (match_operand:SI 0 "integer_register_operand" "=d")
2681 (plus:SI (match_operand:SI 1 "integer_register_operand" "%d")
2682 (match_operand:SI 2 "gpr_or_int12_operand" "dNOPQ")))]
2685 [(set_attr "length" "4")
2686 (set_attr "type" "int")])
2688 ;; Subtraction. No need to worry about constants, since the compiler
2689 ;; canonicalizes them into addsi3's. We prevent SUBREG's here to work around a
2690 ;; combine bug, that combines the 32x32->upper 32 bit multiply that uses a
2691 ;; SUBREG with a minus that shows up in modulus by constants.
2692 (define_insn "subsi3"
2693 [(set (match_operand:SI 0 "integer_register_operand" "=d")
2694 (minus:SI (match_operand:SI 1 "gpr_no_subreg_operand" "d")
2695 (match_operand:SI 2 "gpr_no_subreg_operand" "d")))]
2698 [(set_attr "length" "4")
2699 (set_attr "type" "int")])
2701 ;; Signed multiplication producing 64-bit results from 32-bit inputs
2702 ;; Note, frv doesn't have a 32x32->32 bit multiply, but the compiler
2703 ;; will do the 32x32->64 bit multiply and use the bottom word.
2704 (define_expand "mulsidi3"
2705 [(set (match_operand:DI 0 "integer_register_operand" "")
2706 (mult:DI (sign_extend:DI (match_operand:SI 1 "integer_register_operand" ""))
2707 (sign_extend:DI (match_operand:SI 2 "gpr_or_int12_operand" ""))))]
2711 if (GET_CODE (operands[2]) == CONST_INT)
2713 emit_insn (gen_mulsidi3_const (operands[0], operands[1], operands[2]));
2718 (define_insn "*mulsidi3_reg"
2719 [(set (match_operand:DI 0 "even_gpr_operand" "=e")
2720 (mult:DI (sign_extend:DI (match_operand:SI 1 "integer_register_operand" "%d"))
2721 (sign_extend:DI (match_operand:SI 2 "integer_register_operand" "d"))))]
2724 [(set_attr "length" "4")
2725 (set_attr "type" "mul")])
2727 (define_insn "mulsidi3_const"
2728 [(set (match_operand:DI 0 "even_gpr_operand" "=e")
2729 (mult:DI (sign_extend:DI (match_operand:SI 1 "integer_register_operand" "d"))
2730 (match_operand:SI 2 "int12_operand" "NOP")))]
2733 [(set_attr "length" "4")
2734 (set_attr "type" "mul")])
2736 ;; Unsigned multiplication producing 64-bit results from 32-bit inputs
2737 (define_expand "umulsidi3"
2738 [(set (match_operand:DI 0 "even_gpr_operand" "")
2739 (mult:DI (zero_extend:DI (match_operand:SI 1 "integer_register_operand" ""))
2740 (zero_extend:DI (match_operand:SI 2 "gpr_or_int12_operand" ""))))]
2744 if (GET_CODE (operands[2]) == CONST_INT)
2746 emit_insn (gen_umulsidi3_const (operands[0], operands[1], operands[2]));
2751 (define_insn "*mulsidi3_reg"
2752 [(set (match_operand:DI 0 "even_gpr_operand" "=e")
2753 (mult:DI (zero_extend:DI (match_operand:SI 1 "integer_register_operand" "%d"))
2754 (zero_extend:DI (match_operand:SI 2 "integer_register_operand" "d"))))]
2757 [(set_attr "length" "4")
2758 (set_attr "type" "mul")])
2760 (define_insn "umulsidi3_const"
2761 [(set (match_operand:DI 0 "even_gpr_operand" "=e")
2762 (mult:DI (zero_extend:DI (match_operand:SI 1 "integer_register_operand" "d"))
2763 (match_operand:SI 2 "int12_operand" "NOP")))]
2766 [(set_attr "length" "4")
2767 (set_attr "type" "mul")])
2770 (define_insn "divsi3"
2771 [(set (match_operand:SI 0 "register_operand" "=d,d")
2772 (div:SI (match_operand:SI 1 "register_operand" "d,d")
2773 (match_operand:SI 2 "gpr_or_int12_operand" "d,NOP")))]
2776 [(set_attr "length" "4")
2777 (set_attr "type" "div")])
2779 ;; Unsigned Division
2780 (define_insn "udivsi3"
2781 [(set (match_operand:SI 0 "register_operand" "=d,d")
2782 (udiv:SI (match_operand:SI 1 "register_operand" "d,d")
2783 (match_operand:SI 2 "gpr_or_int12_operand" "d,NOP")))]
2786 [(set_attr "length" "4")
2787 (set_attr "type" "div")])
2790 (define_insn "negsi2"
2791 [(set (match_operand:SI 0 "integer_register_operand" "=d")
2792 (neg:SI (match_operand:SI 1 "integer_register_operand" "d")))]
2795 [(set_attr "length" "4")
2796 (set_attr "type" "int")])
2798 ;; Find first one bit
2799 ;; (define_insn "ffssi2"
2800 ;; [(set (match_operand:SI 0 "register_operand" "=r")
2801 ;; (ffs:SI (match_operand:SI 1 "register_operand" "r")))]
2804 ;; [(set_attr "length" "4")])
2807 ;; ::::::::::::::::::::
2809 ;; :: 64-bit Integer arithmetic
2811 ;; ::::::::::::::::::::
2814 (define_insn_and_split "adddi3"
2815 [(set (match_operand:DI 0 "integer_register_operand" "=&e,e")
2816 (plus:DI (match_operand:DI 1 "integer_register_operand" "%e,0")
2817 (match_operand:DI 2 "gpr_or_int10_operand" "eJ,eJ")))
2818 (clobber (match_scratch:CC 3 "=t,t"))]
2829 for (op = 0; op < 3; op++)
2830 for (part = 0; part < 2; part++)
2831 parts[op][part] = simplify_gen_subreg (SImode, operands[op],
2832 DImode, part * UNITS_PER_WORD);
2834 operands[4] = gen_adddi3_lower (parts[0][1], parts[1][1], parts[2][1],
2836 operands[5] = gen_adddi3_upper (parts[0][0], parts[1][0], parts[2][0],
2837 copy_rtx (operands[3]));
2839 [(set_attr "length" "8")
2840 (set_attr "type" "multi")])
2842 ;; Subtraction No need to worry about constants, since the compiler
2843 ;; canonicalizes them into adddi3's.
2844 (define_insn_and_split "subdi3"
2845 [(set (match_operand:DI 0 "integer_register_operand" "=&e,e,e")
2846 (minus:DI (match_operand:DI 1 "integer_register_operand" "e,0,e")
2847 (match_operand:DI 2 "integer_register_operand" "e,e,0")))
2848 (clobber (match_scratch:CC 3 "=t,t,t"))]
2856 rtx op0_high = gen_highpart (SImode, operands[0]);
2857 rtx op1_high = gen_highpart (SImode, operands[1]);
2858 rtx op2_high = gen_highpart (SImode, operands[2]);
2859 rtx op0_low = gen_lowpart (SImode, operands[0]);
2860 rtx op1_low = gen_lowpart (SImode, operands[1]);
2861 rtx op2_low = gen_lowpart (SImode, operands[2]);
2862 rtx op3 = operands[3];
2864 operands[4] = gen_subdi3_lower (op0_low, op1_low, op2_low, op3);
2865 operands[5] = gen_subdi3_upper (op0_high, op1_high, op2_high, op3);
2867 [(set_attr "length" "8")
2868 (set_attr "type" "multi")])
2870 ;; Patterns for addsi3/subdi3 after splitting
2871 (define_insn "adddi3_lower"
2872 [(set (match_operand:SI 0 "integer_register_operand" "=d")
2873 (plus:SI (match_operand:SI 1 "integer_register_operand" "d")
2874 (match_operand:SI 2 "gpr_or_int10_operand" "dJ")))
2875 (set (match_operand:CC 3 "icc_operand" "=t")
2876 (compare:CC (plus:SI (match_dup 1)
2880 "add%I2cc %1,%2,%0,%3"
2881 [(set_attr "length" "4")
2882 (set_attr "type" "int")])
2884 (define_insn "adddi3_upper"
2885 [(set (match_operand:SI 0 "integer_register_operand" "=d")
2886 (plus:SI (match_operand:SI 1 "integer_register_operand" "d")
2887 (plus:SI (match_operand:SI 2 "gpr_or_int10_operand" "dJ")
2888 (match_operand:CC 3 "icc_operand" "t"))))]
2890 "addx%I2 %1,%2,%0,%3"
2891 [(set_attr "length" "4")
2892 (set_attr "type" "int")])
2894 (define_insn "subdi3_lower"
2895 [(set (match_operand:SI 0 "integer_register_operand" "=d")
2896 (minus:SI (match_operand:SI 1 "integer_register_operand" "d")
2897 (match_operand:SI 2 "integer_register_operand" "d")))
2898 (set (match_operand:CC 3 "icc_operand" "=t")
2899 (compare:CC (plus:SI (match_dup 1)
2904 [(set_attr "length" "4")
2905 (set_attr "type" "int")])
2907 (define_insn "subdi3_upper"
2908 [(set (match_operand:SI 0 "integer_register_operand" "=d")
2909 (minus:SI (match_operand:SI 1 "integer_register_operand" "d")
2910 (minus:SI (match_operand:SI 2 "integer_register_operand" "d")
2911 (match_operand:CC 3 "icc_operand" "t"))))]
2914 [(set_attr "length" "4")
2915 (set_attr "type" "int")])
2917 (define_insn_and_split "negdi2"
2918 [(set (match_operand:DI 0 "integer_register_operand" "=&e,e")
2919 (neg:DI (match_operand:DI 1 "integer_register_operand" "e,0")))
2920 (clobber (match_scratch:CC 2 "=t,t"))]
2928 rtx op0_high = gen_highpart (SImode, operands[0]);
2929 rtx op1_high = gen_rtx_REG (SImode, GPR_FIRST);
2930 rtx op2_high = gen_highpart (SImode, operands[1]);
2931 rtx op0_low = gen_lowpart (SImode, operands[0]);
2932 rtx op1_low = op1_high;
2933 rtx op2_low = gen_lowpart (SImode, operands[1]);
2934 rtx op3 = operands[2];
2936 operands[3] = gen_subdi3_lower (op0_low, op1_low, op2_low, op3);
2937 operands[4] = gen_subdi3_upper (op0_high, op1_high, op2_high, op3);
2939 [(set_attr "length" "8")
2940 (set_attr "type" "multi")])
2942 ;; Multiplication (same size)
2943 ;; (define_insn "muldi3"
2944 ;; [(set (match_operand:DI 0 "register_operand" "=r")
2945 ;; (mult:DI (match_operand:DI 1 "register_operand" "%r")
2946 ;; (match_operand:DI 2 "nonmemory_operand" "ri")))]
2948 ;; "muldi3 %0,%1,%2"
2949 ;; [(set_attr "length" "4")])
2952 ;; (define_insn "divdi3"
2953 ;; [(set (match_operand:DI 0 "register_operand" "=r")
2954 ;; (div:DI (match_operand:DI 1 "register_operand" "r")
2955 ;; (match_operand:DI 2 "nonmemory_operand" "ri")))]
2957 ;; "divdi3 %0,%1,%2"
2958 ;; [(set_attr "length" "4")])
2960 ;; Undsgned Division
2961 ;; (define_insn "udivdi3"
2962 ;; [(set (match_operand:DI 0 "register_operand" "=r")
2963 ;; (udiv:DI (match_operand:DI 1 "register_operand" "r")
2964 ;; (match_operand:DI 2 "nonmemory_operand" "ri")))]
2966 ;; "udivdi3 %0,%1,%2"
2967 ;; [(set_attr "length" "4")])
2970 ;; (define_insn "negdi2"
2971 ;; [(set (match_operand:DI 0 "register_operand" "=r")
2972 ;; (neg:DI (match_operand:DI 1 "register_operand" "r")))]
2975 ;; [(set_attr "length" "4")])
2977 ;; Find first one bit
2978 ;; (define_insn "ffsdi2"
2979 ;; [(set (match_operand:DI 0 "register_operand" "=r")
2980 ;; (ffs:DI (match_operand:DI 1 "register_operand" "r")))]
2983 ;; [(set_attr "length" "4")])
2986 ;; ::::::::::::::::::::
2988 ;; :: 32-bit floating point arithmetic
2990 ;; ::::::::::::::::::::
2993 (define_insn "addsf3"
2994 [(set (match_operand:SF 0 "fpr_operand" "=f")
2995 (plus:SF (match_operand:SF 1 "fpr_operand" "%f")
2996 (match_operand:SF 2 "fpr_operand" "f")))]
2999 [(set_attr "length" "4")
3000 (set_attr "type" "fsadd")])
3003 (define_insn "subsf3"
3004 [(set (match_operand:SF 0 "fpr_operand" "=f")
3005 (minus:SF (match_operand:SF 1 "fpr_operand" "f")
3006 (match_operand:SF 2 "fpr_operand" "f")))]
3009 [(set_attr "length" "4")
3010 (set_attr "type" "fsadd")])
3013 (define_insn "mulsf3"
3014 [(set (match_operand:SF 0 "fpr_operand" "=f")
3015 (mult:SF (match_operand:SF 1 "fpr_operand" "%f")
3016 (match_operand:SF 2 "fpr_operand" "f")))]
3019 [(set_attr "length" "4")
3020 (set_attr "type" "fsmul")])
3022 ;; Multiplication with addition/subtraction
3023 (define_insn "fmasf4"
3024 [(set (match_operand:SF 0 "fpr_operand" "=f")
3025 (fma:SF (match_operand:SF 1 "fpr_operand" "f")
3026 (match_operand:SF 2 "fpr_operand" "f")
3027 (match_operand:SF 3 "fpr_operand" "0")))]
3028 "TARGET_HARD_FLOAT && TARGET_MULADD"
3030 [(set_attr "length" "4")
3031 (set_attr "type" "fsmadd")])
3033 (define_insn "fmssf4"
3034 [(set (match_operand:SF 0 "fpr_operand" "=f")
3035 (fma:SF (match_operand:SF 1 "fpr_operand" "f")
3036 (match_operand:SF 2 "fpr_operand" "f")
3037 (neg:SF (match_operand:SF 3 "fpr_operand" "0"))))]
3038 "TARGET_HARD_FLOAT && TARGET_MULADD"
3040 [(set_attr "length" "4")
3041 (set_attr "type" "fsmadd")])
3044 (define_insn "divsf3"
3045 [(set (match_operand:SF 0 "fpr_operand" "=f")
3046 (div:SF (match_operand:SF 1 "fpr_operand" "f")
3047 (match_operand:SF 2 "fpr_operand" "f")))]
3050 [(set_attr "length" "4")
3051 (set_attr "type" "fsdiv")])
3054 (define_insn "negsf2"
3055 [(set (match_operand:SF 0 "fpr_operand" "=f")
3056 (neg:SF (match_operand:SF 1 "fpr_operand" "f")))]
3059 [(set_attr "length" "4")
3060 (set_attr "type" "fsconv")])
3063 (define_insn "abssf2"
3064 [(set (match_operand:SF 0 "fpr_operand" "=f")
3065 (abs:SF (match_operand:SF 1 "fpr_operand" "f")))]
3068 [(set_attr "length" "4")
3069 (set_attr "type" "fsconv")])
3072 (define_insn "sqrtsf2"
3073 [(set (match_operand:SF 0 "fpr_operand" "=f")
3074 (sqrt:SF (match_operand:SF 1 "fpr_operand" "f")))]
3077 [(set_attr "length" "4")
3078 (set_attr "type" "sqrt_single")])
3081 ;; ::::::::::::::::::::
3083 ;; :: 64-bit floating point arithmetic
3085 ;; ::::::::::::::::::::
3088 (define_insn "adddf3"
3089 [(set (match_operand:DF 0 "even_fpr_operand" "=h")
3090 (plus:DF (match_operand:DF 1 "fpr_operand" "%h")
3091 (match_operand:DF 2 "fpr_operand" "h")))]
3092 "TARGET_HARD_FLOAT && TARGET_DOUBLE"
3094 [(set_attr "length" "4")
3095 (set_attr "type" "fdadd")])
3098 (define_insn "subdf3"
3099 [(set (match_operand:DF 0 "even_fpr_operand" "=h")
3100 (minus:DF (match_operand:DF 1 "fpr_operand" "h")
3101 (match_operand:DF 2 "fpr_operand" "h")))]
3102 "TARGET_HARD_FLOAT && TARGET_DOUBLE"
3104 [(set_attr "length" "4")
3105 (set_attr "type" "fdadd")])
3108 (define_insn "muldf3"
3109 [(set (match_operand:DF 0 "even_fpr_operand" "=h")
3110 (mult:DF (match_operand:DF 1 "fpr_operand" "%h")
3111 (match_operand:DF 2 "fpr_operand" "h")))]
3112 "TARGET_HARD_FLOAT && TARGET_DOUBLE"
3114 [(set_attr "length" "4")
3115 (set_attr "type" "fdmul")])
3117 ;; Multiplication with addition/subtraction
3118 (define_insn "*muladddf4"
3119 [(set (match_operand:DF 0 "fpr_operand" "=f")
3120 (plus:DF (mult:DF (match_operand:DF 1 "fpr_operand" "%f")
3121 (match_operand:DF 2 "fpr_operand" "f"))
3122 (match_operand:DF 3 "fpr_operand" "0")))]
3123 "TARGET_HARD_FLOAT && TARGET_DOUBLE && TARGET_MULADD"
3125 [(set_attr "length" "4")
3126 (set_attr "type" "fdmadd")])
3128 (define_insn "*mulsubdf4"
3129 [(set (match_operand:DF 0 "fpr_operand" "=f")
3130 (minus:DF (mult:DF (match_operand:DF 1 "fpr_operand" "%f")
3131 (match_operand:DF 2 "fpr_operand" "f"))
3132 (match_operand:DF 3 "fpr_operand" "0")))]
3133 "TARGET_HARD_FLOAT && TARGET_DOUBLE && TARGET_MULADD"
3135 [(set_attr "length" "4")
3136 (set_attr "type" "fdmadd")])
3139 (define_insn "divdf3"
3140 [(set (match_operand:DF 0 "even_fpr_operand" "=h")
3141 (div:DF (match_operand:DF 1 "fpr_operand" "h")
3142 (match_operand:DF 2 "fpr_operand" "h")))]
3143 "TARGET_HARD_FLOAT && TARGET_DOUBLE"
3145 [(set_attr "length" "4")
3146 (set_attr "type" "fddiv")])
3149 (define_insn "negdf2"
3150 [(set (match_operand:DF 0 "even_fpr_operand" "=h")
3151 (neg:DF (match_operand:DF 1 "fpr_operand" "h")))]
3152 "TARGET_HARD_FLOAT && TARGET_DOUBLE"
3154 [(set_attr "length" "4")
3155 (set_attr "type" "fdconv")])
3158 (define_insn "absdf2"
3159 [(set (match_operand:DF 0 "even_fpr_operand" "=h")
3160 (abs:DF (match_operand:DF 1 "fpr_operand" "h")))]
3161 "TARGET_HARD_FLOAT && TARGET_DOUBLE"
3163 [(set_attr "length" "4")
3164 (set_attr "type" "fdconv")])
3167 (define_insn "sqrtdf2"
3168 [(set (match_operand:DF 0 "even_fpr_operand" "=h")
3169 (sqrt:DF (match_operand:DF 1 "fpr_operand" "h")))]
3170 "TARGET_HARD_FLOAT && TARGET_DOUBLE"
3172 [(set_attr "length" "4")
3173 (set_attr "type" "sqrt_double")])
3176 ;; ::::::::::::::::::::
3178 ;; :: 32-bit Integer Shifts and Rotates
3180 ;; ::::::::::::::::::::
3182 ;; Arithmetic Shift Left
3183 (define_insn "ashlsi3"
3184 [(set (match_operand:SI 0 "integer_register_operand" "=d,d")
3185 (ashift:SI (match_operand:SI 1 "integer_register_operand" "d,d")
3186 (match_operand:SI 2 "gpr_or_int12_operand" "d,NOP")))]
3189 [(set_attr "length" "4")
3190 (set_attr "type" "int")])
3192 ;; Arithmetic Shift Right
3193 (define_insn "ashrsi3"
3194 [(set (match_operand:SI 0 "integer_register_operand" "=d,d")
3195 (ashiftrt:SI (match_operand:SI 1 "integer_register_operand" "d,d")
3196 (match_operand:SI 2 "gpr_or_int12_operand" "d,NOP")))]
3199 [(set_attr "length" "4")
3200 (set_attr "type" "int")])
3202 ;; Logical Shift Right
3203 (define_insn "lshrsi3"
3204 [(set (match_operand:SI 0 "integer_register_operand" "=d,d")
3205 (lshiftrt:SI (match_operand:SI 1 "integer_register_operand" "d,d")
3206 (match_operand:SI 2 "gpr_or_int12_operand" "d,NOP")))]
3209 [(set_attr "length" "4")
3210 (set_attr "type" "int")])
3213 ;; (define_insn "rotlsi3"
3214 ;; [(set (match_operand:SI 0 "register_operand" "=r")
3215 ;; (rotate:SI (match_operand:SI 1 "register_operand" "r")
3216 ;; (match_operand:SI 2 "nonmemory_operand" "ri")))]
3218 ;; "rotlsi3 %0,%1,%2"
3219 ;; [(set_attr "length" "4")])
3222 ;; (define_insn "rotrsi3"
3223 ;; [(set (match_operand:SI 0 "register_operand" "=r")
3224 ;; (rotatert:SI (match_operand:SI 1 "register_operand" "r")
3225 ;; (match_operand:SI 2 "nonmemory_operand" "ri")))]
3227 ;; "rotrsi3 %0,%1,%2"
3228 ;; [(set_attr "length" "4")])
3231 ;; ::::::::::::::::::::
3233 ;; :: 64-bit Integer Shifts and Rotates
3235 ;; ::::::::::::::::::::
3237 ;; Arithmetic Shift Left
3238 ;; (define_insn "ashldi3"
3239 ;; [(set (match_operand:DI 0 "register_operand" "=r")
3240 ;; (ashift:DI (match_operand:DI 1 "register_operand" "r")
3241 ;; (match_operand:SI 2 "nonmemory_operand" "ri")))]
3243 ;; "ashldi3 %0,%1,%2"
3244 ;; [(set_attr "length" "4")])
3246 ;; Arithmetic Shift Right
3247 ;; (define_insn "ashrdi3"
3248 ;; [(set (match_operand:DI 0 "register_operand" "=r")
3249 ;; (ashiftrt:DI (match_operand:DI 1 "register_operand" "r")
3250 ;; (match_operand:SI 2 "nonmemory_operand" "ri")))]
3252 ;; "ashrdi3 %0,%1,%2"
3253 ;; [(set_attr "length" "4")])
3255 ;; Logical Shift Right
3256 ;; (define_insn "lshrdi3"
3257 ;; [(set (match_operand:DI 0 "register_operand" "=r")
3258 ;; (lshiftrt:DI (match_operand:DI 1 "register_operand" "r")
3259 ;; (match_operand:SI 2 "nonmemory_operand" "ri")))]
3261 ;; "lshrdi3 %0,%1,%2"
3262 ;; [(set_attr "length" "4")])
3265 ;; (define_insn "rotldi3"
3266 ;; [(set (match_operand:DI 0 "register_operand" "=r")
3267 ;; (rotate:DI (match_operand:DI 1 "register_operand" "r")
3268 ;; (match_operand:SI 2 "nonmemory_operand" "ri")))]
3270 ;; "rotldi3 %0,%1,%2"
3271 ;; [(set_attr "length" "4")])
3274 ;; (define_insn "rotrdi3"
3275 ;; [(set (match_operand:DI 0 "register_operand" "=r")
3276 ;; (rotatert:DI (match_operand:DI 1 "register_operand" "r")
3277 ;; (match_operand:SI 2 "nonmemory_operand" "ri")))]
3279 ;; "rotrdi3 %0,%1,%2"
3280 ;; [(set_attr "length" "4")])
3283 ;; ::::::::::::::::::::
3285 ;; :: 32-Bit Integer Logical operations
3287 ;; ::::::::::::::::::::
3289 ;; Logical AND, 32-bit integers
3290 (define_insn "andsi3_media"
3291 [(set (match_operand:SI 0 "gpr_or_fpr_operand" "=d,f")
3292 (and:SI (match_operand:SI 1 "gpr_or_fpr_operand" "%d,f")
3293 (match_operand:SI 2 "gpr_fpr_or_int12_operand" "dNOP,f")))]
3298 [(set_attr "length" "4")
3299 (set_attr "type" "int,mlogic")])
3301 (define_insn "andsi3_nomedia"
3302 [(set (match_operand:SI 0 "integer_register_operand" "=d")
3303 (and:SI (match_operand:SI 1 "integer_register_operand" "%d")
3304 (match_operand:SI 2 "gpr_or_int12_operand" "dNOP")))]
3307 [(set_attr "length" "4")
3308 (set_attr "type" "int")])
3310 (define_expand "andsi3"
3311 [(set (match_operand:SI 0 "gpr_or_fpr_operand" "")
3312 (and:SI (match_operand:SI 1 "gpr_or_fpr_operand" "")
3313 (match_operand:SI 2 "gpr_fpr_or_int12_operand" "")))]
3317 ;; Inclusive OR, 32-bit integers
3318 (define_insn "iorsi3_media"
3319 [(set (match_operand:SI 0 "gpr_or_fpr_operand" "=d,f")
3320 (ior:SI (match_operand:SI 1 "gpr_or_fpr_operand" "%d,f")
3321 (match_operand:SI 2 "gpr_fpr_or_int12_operand" "dNOP,f")))]
3326 [(set_attr "length" "4")
3327 (set_attr "type" "int,mlogic")])
3329 (define_insn "iorsi3_nomedia"
3330 [(set (match_operand:SI 0 "integer_register_operand" "=d")
3331 (ior:SI (match_operand:SI 1 "integer_register_operand" "%d")
3332 (match_operand:SI 2 "gpr_or_int12_operand" "dNOP")))]
3335 [(set_attr "length" "4")
3336 (set_attr "type" "int")])
3338 (define_expand "iorsi3"
3339 [(set (match_operand:SI 0 "gpr_or_fpr_operand" "")
3340 (ior:SI (match_operand:SI 1 "gpr_or_fpr_operand" "")
3341 (match_operand:SI 2 "gpr_fpr_or_int12_operand" "")))]
3345 ;; Exclusive OR, 32-bit integers
3346 (define_insn "xorsi3_media"
3347 [(set (match_operand:SI 0 "gpr_or_fpr_operand" "=d,f")
3348 (xor:SI (match_operand:SI 1 "gpr_or_fpr_operand" "%d,f")
3349 (match_operand:SI 2 "gpr_fpr_or_int12_operand" "dNOP,f")))]
3354 [(set_attr "length" "4")
3355 (set_attr "type" "int,mlogic")])
3357 (define_insn "xorsi3_nomedia"
3358 [(set (match_operand:SI 0 "integer_register_operand" "=d")
3359 (xor:SI (match_operand:SI 1 "integer_register_operand" "%d")
3360 (match_operand:SI 2 "gpr_or_int12_operand" "dNOP")))]
3363 [(set_attr "length" "4")
3364 (set_attr "type" "int")])
3366 (define_expand "xorsi3"
3367 [(set (match_operand:SI 0 "gpr_or_fpr_operand" "")
3368 (xor:SI (match_operand:SI 1 "gpr_or_fpr_operand" "")
3369 (match_operand:SI 2 "gpr_fpr_or_int12_operand" "")))]
3373 ;; One's complement, 32-bit integers
3374 (define_insn "one_cmplsi2_media"
3375 [(set (match_operand:SI 0 "gpr_or_fpr_operand" "=d,f")
3376 (not:SI (match_operand:SI 1 "gpr_or_fpr_operand" "d,f")))]
3381 [(set_attr "length" "4")
3382 (set_attr "type" "int,mlogic")])
3384 (define_insn "one_cmplsi2_nomedia"
3385 [(set (match_operand:SI 0 "integer_register_operand" "=d")
3386 (not:SI (match_operand:SI 1 "integer_register_operand" "d")))]
3389 [(set_attr "length" "4")
3390 (set_attr "type" "int")])
3392 (define_expand "one_cmplsi2"
3393 [(set (match_operand:SI 0 "gpr_or_fpr_operand" "")
3394 (not:SI (match_operand:SI 1 "gpr_or_fpr_operand" "")))]
3399 ;; ::::::::::::::::::::
3401 ;; :: 64-Bit Integer Logical operations
3403 ;; ::::::::::::::::::::
3405 ;; Logical AND, 64-bit integers
3406 ;; (define_insn "anddi3"
3407 ;; [(set (match_operand:DI 0 "register_operand" "=r")
3408 ;; (and:DI (match_operand:DI 1 "register_operand" "%r")
3409 ;; (match_operand:DI 2 "nonmemory_operand" "ri")))]
3411 ;; "anddi3 %0,%1,%2"
3412 ;; [(set_attr "length" "4")])
3414 ;; Inclusive OR, 64-bit integers
3415 ;; (define_insn "iordi3"
3416 ;; [(set (match_operand:DI 0 "register_operand" "=r")
3417 ;; (ior:DI (match_operand:DI 1 "register_operand" "%r")
3418 ;; (match_operand:DI 2 "nonmemory_operand" "ri")))]
3420 ;; "iordi3 %0,%1,%2"
3421 ;; [(set_attr "length" "4")])
3423 ;; Exclusive OR, 64-bit integers
3424 ;; (define_insn "xordi3"
3425 ;; [(set (match_operand:DI 0 "register_operand" "=r")
3426 ;; (xor:DI (match_operand:DI 1 "register_operand" "%r")
3427 ;; (match_operand:DI 2 "nonmemory_operand" "ri")))]
3429 ;; "xordi3 %0,%1,%2"
3430 ;; [(set_attr "length" "4")])
3432 ;; One's complement, 64-bit integers
3433 ;; (define_insn "one_cmpldi2"
3434 ;; [(set (match_operand:DI 0 "register_operand" "=r")
3435 ;; (not:DI (match_operand:DI 1 "register_operand" "r")))]
3438 ;; [(set_attr "length" "4")])
3441 ;; ::::::::::::::::::::
3443 ;; :: Combination of integer operation with comparison
3445 ;; ::::::::::::::::::::
3447 (define_insn "*combo_intop_compare1"
3448 [(set (match_operand:CC_NZ 0 "icc_operand" "=t")
3450 (match_operator:SI 1 "intop_compare_operator"
3451 [(match_operand:SI 2 "integer_register_operand" "d")
3452 (match_operand:SI 3 "gpr_or_int10_operand" "dJ")])
3455 "%O1%I3cc %2, %3, %., %0"
3456 [(set_attr "type" "int")
3457 (set_attr "length" "4")])
3459 (define_insn "*combo_intop_compare2"
3460 [(set (match_operand:CC_NZ 0 "icc_operand" "=t")
3462 (match_operator:SI 1 "intop_compare_operator"
3463 [(match_operand:SI 2 "integer_register_operand" "d")
3464 (match_operand:SI 3 "gpr_or_int10_operand" "dJ")])
3466 (set (match_operand:SI 4 "integer_register_operand" "=d")
3467 (match_operator:SI 5 "intop_compare_operator"
3470 "GET_CODE (operands[1]) == GET_CODE (operands[5])"
3471 "%O1%I3cc %2, %3, %4, %0"
3472 [(set_attr "type" "int")
3473 (set_attr "length" "4")])
3475 ;; ::::::::::::::::::::
3479 ;; ::::::::::::::::::::
3481 ;; The comparisons are generated by the branch and/or scc operations
3483 (define_insn "cmpsi_cc"
3484 [(set (match_operand:CC 0 "icc_operand" "=t,t")
3485 (compare:CC (match_operand:SI 1 "integer_register_operand" "d,d")
3486 (match_operand:SI 2 "gpr_or_int10_operand" "d,J")))]
3489 [(set_attr "length" "4")
3490 (set_attr "type" "int")])
3492 (define_insn "*cmpsi_cc_uns"
3493 [(set (match_operand:CC_UNS 0 "icc_operand" "=t,t")
3494 (compare:CC_UNS (match_operand:SI 1 "integer_register_operand" "d,d")
3495 (match_operand:SI 2 "gpr_or_int10_operand" "d,J")))]
3498 [(set_attr "length" "4")
3499 (set_attr "type" "int")])
3501 ;; The only requirement for a CC_NZmode GPR or memory value is that
3502 ;; comparing it against zero must set the Z and N flags appropriately.
3503 ;; The source operand is therefore a valid CC_NZmode value.
3504 (define_insn "*cmpsi_cc_nz"
3505 [(set (match_operand:CC_NZ 0 "nonimmediate_operand" "=t,d,m")
3506 (compare:CC_NZ (match_operand:SI 1 "integer_register_operand" "d,d,d")
3513 [(set_attr "length" "4,4,4")
3514 (set_attr "type" "int,int,gstore")])
3516 (define_insn "*cmpsf_cc_fp"
3517 [(set (match_operand:CC_FP 0 "fcc_operand" "=u")
3518 (compare:CC_FP (match_operand:SF 1 "fpr_operand" "f")
3519 (match_operand:SF 2 "fpr_operand" "f")))]
3522 [(set_attr "length" "4")
3523 (set_attr "type" "fscmp")])
3525 (define_insn "*cmpdf_cc_fp"
3526 [(set (match_operand:CC_FP 0 "fcc_operand" "=u")
3527 (compare:CC_FP (match_operand:DF 1 "even_fpr_operand" "h")
3528 (match_operand:DF 2 "even_fpr_operand" "h")))]
3529 "TARGET_HARD_FLOAT && TARGET_DOUBLE"
3531 [(set_attr "length" "4")
3532 (set_attr "type" "fdcmp")])
3535 ;; ::::::::::::::::::::
3539 ;; ::::::::::::::::::::
3541 ;; Define_expands called by the machine independent part of the compiler
3542 ;; to allocate a new comparison register.
3544 (define_expand "cbranchdf4"
3545 [(use (match_operator 0 "ordered_comparison_operator"
3546 [(match_operand:DF 1 "fpr_operand" "")
3547 (match_operand:DF 2 "fpr_operand" "")]))
3548 (use (match_operand 3 ""))]
3549 "TARGET_HARD_FLOAT && TARGET_DOUBLE"
3550 { if (frv_emit_cond_branch (operands)) DONE; gcc_unreachable (); })
3552 (define_expand "cbranchsf4"
3553 [(use (match_operator 0 "ordered_comparison_operator"
3554 [(match_operand:SF 1 "fpr_operand" "")
3555 (match_operand:SF 2 "fpr_operand" "")]))
3556 (use (match_operand 3 ""))]
3558 { if (frv_emit_cond_branch (operands)) DONE; gcc_unreachable (); })
3560 (define_expand "cbranchsi4"
3561 [(use (match_operator 0 "ordered_comparison_operator"
3562 [(match_operand:SI 1 "integer_register_operand" "")
3563 (match_operand:SI 2 "gpr_or_int10_operand" "")]))
3564 (use (match_operand 3 ""))]
3566 { if (frv_emit_cond_branch (operands)) DONE; gcc_unreachable (); })
3568 ;; Actual branches. We must allow for the (label_ref) and the (pc) to be
3569 ;; swapped. If they are swapped, it reverses the sense of the branch.
3571 ;; Note - unlike the define expands above, these patterns can be amalgamated
3572 ;; into one pattern for branch-if-true and one for branch-if-false. This does
3573 ;; require an operand operator to select the correct branch mnemonic.
3575 ;; If a fixed condition code register is being used, (as opposed to, say,
3576 ;; using cc0), then the expands could look like this:
3578 ;; (define_insn "*branch_true"
3580 ;; (if_then_else (match_operator:CC 0 "comparison_operator"
3581 ;; [(reg:CC <number_of_CC_register>)
3583 ;; (label_ref (match_operand 1 "" ""))
3587 ;; [(set_attr "length" "4")]
3590 ;; In the above example the %B is a directive to frv_print_operand()
3591 ;; to decode and print the correct branch mnemonic.
3593 (define_insn "*branch_int_true"
3595 (if_then_else (match_operator 0 "integer_relational_operator"
3596 [(match_operand 1 "icc_operand" "t")
3598 (label_ref (match_operand 2 "" ""))
3603 if (get_attr_length (insn) == 4)
3604 return \"b%c0 %1,%#,%l2\";
3606 return \"b%C0 %1,%#,1f\;call %l2\\n1:\";
3608 [(set (attr "length")
3610 (and (ge (minus (match_dup 2) (pc)) (const_int -32768))
3611 (le (minus (match_dup 2) (pc)) (const_int 32764)))
3614 (set (attr "far_jump")
3616 (eq_attr "length" "4")
3618 (const_string "yes")))
3621 (eq_attr "length" "4")
3622 (const_string "branch")
3623 (const_string "multi")))])
3625 (define_insn "*branch_int_false"
3627 (if_then_else (match_operator 0 "integer_relational_operator"
3628 [(match_operand 1 "icc_operand" "t")
3631 (label_ref (match_operand 2 "" ""))))]
3635 if (get_attr_length (insn) == 4)
3636 return \"b%C0 %1,%#,%l2\";
3638 return \"b%c0 %1,%#,1f\;call %l2\\n1:\";
3640 [(set (attr "length")
3642 (and (ge (minus (match_dup 2) (pc)) (const_int -32768))
3643 (le (minus (match_dup 2) (pc)) (const_int 32764)))
3646 (set (attr "far_jump")
3648 (eq_attr "length" "4")
3650 (const_string "yes")))
3653 (eq_attr "length" "4")
3654 (const_string "branch")
3655 (const_string "multi")))])
3657 (define_insn "*branch_fp_true"
3659 (if_then_else (match_operator:CC_FP 0 "float_relational_operator"
3660 [(match_operand 1 "fcc_operand" "u")
3662 (label_ref (match_operand 2 "" ""))
3667 if (get_attr_length (insn) == 4)
3668 return \"fb%f0 %1,%#,%l2\";
3670 return \"fb%F0 %1,%#,1f\;call %l2\\n1:\";
3672 [(set (attr "length")
3674 (and (ge (minus (match_dup 2) (pc)) (const_int -32768))
3675 (le (minus (match_dup 2) (pc)) (const_int 32764)))
3678 (set (attr "far_jump")
3680 (eq_attr "length" "4")
3682 (const_string "yes")))
3685 (eq_attr "length" "4")
3686 (const_string "branch")
3687 (const_string "multi")))])
3689 (define_insn "*branch_fp_false"
3691 (if_then_else (match_operator:CC_FP 0 "float_relational_operator"
3692 [(match_operand 1 "fcc_operand" "u")
3695 (label_ref (match_operand 2 "" ""))))]
3699 if (get_attr_length (insn) == 4)
3700 return \"fb%F0 %1,%#,%l2\";
3702 return \"fb%f0 %1,%#,1f\;call %l2\\n1:\";
3704 [(set (attr "length")
3706 (and (ge (minus (match_dup 2) (pc)) (const_int -32768))
3707 (le (minus (match_dup 2) (pc)) (const_int 32764)))
3710 (set (attr "far_jump")
3712 (eq_attr "length" "4")
3714 (const_string "yes")))
3717 (eq_attr "length" "4")
3718 (const_string "branch")
3719 (const_string "multi")))])
3722 ;; ::::::::::::::::::::
3724 ;; :: Set flag operations
3726 ;; ::::::::::::::::::::
3728 ;; Define_expands called by the machine independent part of the compiler
3729 ;; to allocate a new comparison register
3731 (define_expand "cstoredf4"
3732 [(use (match_operator:SI 1 "ordered_comparison_operator"
3733 [(match_operand:DF 2 "fpr_operand")
3734 (match_operand:DF 3 "fpr_operand")]))
3735 (clobber (match_operand:SI 0 "register_operand"))]
3736 "TARGET_HARD_FLOAT && TARGET_DOUBLE"
3737 { if (frv_emit_scc (operands)) DONE; else FAIL; })
3739 (define_expand "cstoresf4"
3740 [(use (match_operator:SI 1 "ordered_comparison_operator"
3741 [(match_operand:SF 2 "fpr_operand")
3742 (match_operand:SF 3 "fpr_operand")]))
3743 (clobber (match_operand:SI 0 "register_operand"))]
3745 { if (frv_emit_scc (operands)) DONE; else FAIL; })
3747 (define_expand "cstoresi4"
3748 [(use (match_operator:SI 1 "ordered_comparison_operator"
3749 [(match_operand:SI 2 "integer_register_operand")
3750 (match_operand:SI 3 "gpr_or_int10_operand")]))
3751 (clobber (match_operand:SI 0 "register_operand"))]
3753 { if (frv_emit_scc (operands)) DONE; else FAIL; })
3755 (define_insn "*scc_int"
3756 [(set (match_operand:SI 0 "integer_register_operand" "=d")
3757 (match_operator:SI 1 "integer_relational_operator"
3758 [(match_operand 2 "icc_operand" "t")
3760 (clobber (match_operand:CC_CCR 3 "icr_operand" "=v"))]
3763 [(set_attr "length" "12")
3764 (set_attr "type" "multi")])
3766 (define_insn "*scc_float"
3767 [(set (match_operand:SI 0 "integer_register_operand" "=d")
3768 (match_operator:SI 1 "float_relational_operator"
3769 [(match_operand:CC_FP 2 "fcc_operand" "u")
3771 (clobber (match_operand:CC_CCR 3 "fcr_operand" "=w"))]
3774 [(set_attr "length" "12")
3775 (set_attr "type" "multi")])
3777 ;; XXX -- add reload_completed to the splits, because register allocation
3778 ;; currently isn't ready to see cond_exec packets.
3780 [(set (match_operand:SI 0 "integer_register_operand" "")
3781 (match_operator:SI 1 "relational_operator"
3782 [(match_operand 2 "cc_operand" "")
3784 (clobber (match_operand 3 "cr_operand" ""))]
3787 "operands[4] = frv_split_scc (operands[0], operands[1], operands[2],
3788 operands[3], (HOST_WIDE_INT) 1);")
3790 (define_insn "*scc_neg1_int"
3791 [(set (match_operand:SI 0 "integer_register_operand" "=d")
3792 (neg:SI (match_operator:SI 1 "integer_relational_operator"
3793 [(match_operand 2 "icc_operand" "t")
3795 (clobber (match_operand:CC_CCR 3 "icr_operand" "=v"))]
3798 [(set_attr "length" "12")
3799 (set_attr "type" "multi")])
3801 (define_insn "*scc_neg1_float"
3802 [(set (match_operand:SI 0 "integer_register_operand" "=d")
3803 (neg:SI (match_operator:SI 1 "float_relational_operator"
3804 [(match_operand:CC_FP 2 "fcc_operand" "u")
3806 (clobber (match_operand:CC_CCR 3 "fcr_operand" "=w"))]
3809 [(set_attr "length" "12")
3810 (set_attr "type" "multi")])
3813 [(set (match_operand:SI 0 "integer_register_operand" "")
3814 (neg:SI (match_operator:SI 1 "relational_operator"
3815 [(match_operand 2 "cc_operand" "")
3817 (clobber (match_operand 3 "cr_operand" ""))]
3820 "operands[4] = frv_split_scc (operands[0], operands[1], operands[2],
3821 operands[3], (HOST_WIDE_INT) -1);")
3824 ;; ::::::::::::::::::::
3826 ;; :: Conditionally executed instructions
3828 ;; ::::::::::::::::::::
3830 ;; Convert ICC/FCC comparison into CCR bits so we can do conditional execution
3831 (define_insn "*ck_signed"
3832 [(set (match_operand:CC_CCR 0 "icr_operand" "=v")
3833 (match_operator:CC_CCR 1 "integer_relational_operator"
3834 [(match_operand 2 "icc_operand" "t")
3838 [(set_attr "length" "4")
3839 (set_attr "type" "ccr")])
3841 (define_insn "*fck_float"
3842 [(set (match_operand:CC_CCR 0 "fcr_operand" "=w")
3843 (match_operator:CC_CCR 1 "float_relational_operator"
3844 [(match_operand:CC_FP 2 "fcc_operand" "u")
3848 [(set_attr "length" "4")
3849 (set_attr "type" "ccr")])
3851 ;; Conditionally convert ICC/FCC comparison into CCR bits to provide && and ||
3852 ;; tests in conditional execution
3853 (define_insn "cond_exec_ck"
3854 [(set (match_operand:CC_CCR 0 "cr_operand" "=v,w")
3855 (if_then_else:CC_CCR (match_operator 1 "ccr_eqne_operator"
3856 [(match_operand 2 "cr_operand" "C,C")
3858 (match_operator 3 "relational_operator"
3859 [(match_operand 4 "cc_operand" "t,u")
3864 cck%c3 %4, %0, %2, %e1
3865 cfck%f3 %4, %0, %2, %e1"
3866 [(set_attr "length" "4")
3867 (set_attr "type" "ccr")])
3869 ;; Conditionally set a register to either 0 or another register
3870 (define_insn "*cond_exec_movqi"
3872 (match_operator 0 "ccr_eqne_operator"
3873 [(match_operand 1 "cr_operand" "C,C,C,C,C,C")
3875 (set (match_operand:QI 2 "condexec_dest_operand" "=d,d,U,?f,?f,?d")
3876 (match_operand:QI 3 "condexec_source_operand" "dO,U,dO,f,d,f")))]
3877 "register_operand(operands[2], QImode) || reg_or_0_operand (operands[3], QImode)"
3878 "* return output_condmove_single (operands, insn);"
3879 [(set_attr "length" "4")
3880 (set_attr "type" "int,gload,gstore,fsconv,movgf,movfg")])
3882 (define_insn "*cond_exec_movhi"
3884 (match_operator 0 "ccr_eqne_operator"
3885 [(match_operand 1 "cr_operand" "C,C,C,C,C,C")
3887 (set (match_operand:HI 2 "condexec_dest_operand" "=d,d,U,?f,?f,?d")
3888 (match_operand:HI 3 "condexec_source_operand" "dO,U,dO,f,d,f")))]
3889 "register_operand(operands[2], HImode) || reg_or_0_operand (operands[3], HImode)"
3890 "* return output_condmove_single (operands, insn);"
3891 [(set_attr "length" "4")
3892 (set_attr "type" "int,gload,gstore,fsconv,movgf,movfg")])
3894 (define_insn "*cond_exec_movsi"
3896 (match_operator 0 "ccr_eqne_operator"
3897 [(match_operand 1 "cr_operand" "C,C,C,C,C,C,C,C")
3899 (set (match_operand:SI 2 "condexec_dest_operand" "=d,d,U,?f,?f,?d,?f,?m")
3900 (match_operand:SI 3 "condexec_source_operand" "dO,U,dO,f,d,f,m,f")))]
3901 "register_operand(operands[2], SImode) || reg_or_0_operand (operands[3], SImode)"
3902 "* return output_condmove_single (operands, insn);"
3903 [(set_attr "length" "4")
3904 (set_attr "type" "int,gload,gstore,fsconv,movgf,movfg,fload,fstore")])
3907 (define_insn "*cond_exec_movsf_has_fprs"
3909 (match_operator 0 "ccr_eqne_operator"
3910 [(match_operand 1 "cr_operand" "C,C,C,C,C,C,C,C,C,C")
3912 (set (match_operand:SF 2 "condexec_dest_operand" "=f,?d,?d,?f,f,f,?d,U,?U,U")
3913 (match_operand:SF 3 "condexec_source_operand" "f,d,f,d,G,U,U,f,d,G")))]
3915 "* return output_condmove_single (operands, insn);"
3916 [(set_attr "length" "4")
3917 (set_attr "type" "fsconv,int,movgf,movfg,movgf,fload,gload,fstore,gstore,gstore")])
3919 (define_insn "*cond_exec_movsf_no_fprs"
3921 (match_operator 0 "ccr_eqne_operator"
3922 [(match_operand 1 "cr_operand" "C,C,C")
3924 (set (match_operand:SF 2 "condexec_dest_operand" "=d,d,U")
3925 (match_operand:SF 3 "condexec_source_operand" "d,U,dG")))]
3927 "* return output_condmove_single (operands, insn);"
3928 [(set_attr "length" "4")
3929 (set_attr "type" "int,gload,gstore")])
3931 (define_insn "*cond_exec_si_binary1"
3933 (match_operator 0 "ccr_eqne_operator"
3934 [(match_operand 1 "cr_operand" "C")
3936 (set (match_operand:SI 2 "integer_register_operand" "=d")
3937 (match_operator:SI 3 "condexec_si_binary_operator"
3938 [(match_operand:SI 4 "integer_register_operand" "d")
3939 (match_operand:SI 5 "integer_register_operand" "d")])))]
3943 switch (GET_CODE (operands[3]))
3945 case PLUS: return \"cadd %4, %z5, %2, %1, %e0\";
3946 case MINUS: return \"csub %4, %z5, %2, %1, %e0\";
3947 case AND: return \"cand %4, %z5, %2, %1, %e0\";
3948 case IOR: return \"cor %4, %z5, %2, %1, %e0\";
3949 case XOR: return \"cxor %4, %z5, %2, %1, %e0\";
3950 case ASHIFT: return \"csll %4, %z5, %2, %1, %e0\";
3951 case ASHIFTRT: return \"csra %4, %z5, %2, %1, %e0\";
3952 case LSHIFTRT: return \"csrl %4, %z5, %2, %1, %e0\";
3953 default: gcc_unreachable ();
3956 [(set_attr "length" "4")
3957 (set_attr "type" "int")])
3959 (define_insn "*cond_exec_si_binary2"
3961 (match_operator 0 "ccr_eqne_operator"
3962 [(match_operand 1 "cr_operand" "C")
3964 (set (match_operand:SI 2 "fpr_operand" "=f")
3965 (match_operator:SI 3 "condexec_si_media_operator"
3966 [(match_operand:SI 4 "fpr_operand" "f")
3967 (match_operand:SI 5 "fpr_operand" "f")])))]
3971 switch (GET_CODE (operands[3]))
3973 case AND: return \"cmand %4, %5, %2, %1, %e0\";
3974 case IOR: return \"cmor %4, %5, %2, %1, %e0\";
3975 case XOR: return \"cmxor %4, %5, %2, %1, %e0\";
3976 default: gcc_unreachable ();
3979 [(set_attr "length" "4")
3980 (set_attr "type" "mlogic")])
3982 ;; Note, flow does not (currently) know how to handle an operation that uses
3983 ;; only part of the hard registers allocated for a multiregister value, such as
3984 ;; DImode in this case if the user is only interested in the lower 32-bits. So
3985 ;; we emit a USE of the entire register after the csmul instruction so it won't
3986 ;; get confused. See frv_ifcvt_modify_insn for more details.
3988 (define_insn "*cond_exec_si_smul"
3990 (match_operator 0 "ccr_eqne_operator"
3991 [(match_operand 1 "cr_operand" "C")
3993 (set (match_operand:DI 2 "even_gpr_operand" "=e")
3994 (mult:DI (sign_extend:DI (match_operand:SI 3 "integer_register_operand" "%d"))
3995 (sign_extend:DI (match_operand:SI 4 "integer_register_operand" "d")))))]
3997 "csmul %3, %4, %2, %1, %e0"
3998 [(set_attr "length" "4")
3999 (set_attr "type" "mul")])
4001 (define_insn "*cond_exec_si_divide"
4003 (match_operator 0 "ccr_eqne_operator"
4004 [(match_operand 1 "cr_operand" "C")
4006 (set (match_operand:SI 2 "integer_register_operand" "=d")
4007 (match_operator:SI 3 "condexec_si_divide_operator"
4008 [(match_operand:SI 4 "integer_register_operand" "d")
4009 (match_operand:SI 5 "integer_register_operand" "d")])))]
4013 switch (GET_CODE (operands[3]))
4015 case DIV: return \"csdiv %4, %z5, %2, %1, %e0\";
4016 case UDIV: return \"cudiv %4, %z5, %2, %1, %e0\";
4017 default: gcc_unreachable ();
4020 [(set_attr "length" "4")
4021 (set_attr "type" "div")])
4023 (define_insn "*cond_exec_si_unary1"
4025 (match_operator 0 "ccr_eqne_operator"
4026 [(match_operand 1 "cr_operand" "C")
4028 (set (match_operand:SI 2 "integer_register_operand" "=d")
4029 (match_operator:SI 3 "condexec_si_unary_operator"
4030 [(match_operand:SI 4 "integer_register_operand" "d")])))]
4034 switch (GET_CODE (operands[3]))
4036 case NOT: return \"cnot %4, %2, %1, %e0\";
4037 case NEG: return \"csub %., %4, %2, %1, %e0\";
4038 default: gcc_unreachable ();
4041 [(set_attr "length" "4")
4042 (set_attr "type" "int")])
4044 (define_insn "*cond_exec_si_unary2"
4046 (match_operator 0 "ccr_eqne_operator"
4047 [(match_operand 1 "cr_operand" "C")
4049 (set (match_operand:SI 2 "fpr_operand" "=f")
4050 (not:SI (match_operand:SI 3 "fpr_operand" "f"))))]
4052 "cmnot %3, %2, %1, %e0"
4053 [(set_attr "length" "4")
4054 (set_attr "type" "mlogic")])
4056 (define_insn "*cond_exec_cmpsi_cc"
4058 (match_operator 0 "ccr_eqne_operator"
4059 [(match_operand 1 "cr_operand" "C")
4061 (set (match_operand:CC 2 "icc_operand" "=t")
4062 (compare:CC (match_operand:SI 3 "integer_register_operand" "d")
4063 (match_operand:SI 4 "reg_or_0_operand" "dO"))))]
4065 && REGNO (operands[1]) == REGNO (operands[2]) - ICC_FIRST + ICR_FIRST"
4066 "ccmp %3, %z4, %1, %e0"
4067 [(set_attr "length" "4")
4068 (set_attr "type" "int")])
4070 (define_insn "*cond_exec_cmpsi_cc_uns"
4072 (match_operator 0 "ccr_eqne_operator"
4073 [(match_operand 1 "cr_operand" "C")
4075 (set (match_operand:CC_UNS 2 "icc_operand" "=t")
4076 (compare:CC_UNS (match_operand:SI 3 "integer_register_operand" "d")
4077 (match_operand:SI 4 "reg_or_0_operand" "dO"))))]
4079 && REGNO (operands[1]) == REGNO (operands[2]) - ICC_FIRST + ICR_FIRST"
4080 "ccmp %3, %z4, %1, %e0"
4081 [(set_attr "length" "4")
4082 (set_attr "type" "int")])
4084 (define_insn "*cond_exec_cmpsi_cc_nz"
4086 (match_operator 0 "ccr_eqne_operator"
4087 [(match_operand 1 "cr_operand" "C")
4089 (set (match_operand:CC_NZ 2 "icc_operand" "=t")
4090 (compare:CC_NZ (match_operand:SI 3 "integer_register_operand" "d")
4093 && REGNO (operands[1]) == REGNO (operands[2]) - ICC_FIRST + ICR_FIRST"
4094 "ccmp %3, %., %1, %e0"
4095 [(set_attr "length" "4")
4096 (set_attr "type" "int")])
4098 (define_insn "*cond_exec_sf_conv"
4100 (match_operator 0 "ccr_eqne_operator"
4101 [(match_operand 1 "cr_operand" "C")
4103 (set (match_operand:SF 2 "fpr_operand" "=f")
4104 (match_operator:SF 3 "condexec_sf_conv_operator"
4105 [(match_operand:SF 4 "fpr_operand" "f")])))]
4109 switch (GET_CODE (operands[3]))
4111 case ABS: return \"cfabss %4, %2, %1, %e0\";
4112 case NEG: return \"cfnegs %4, %2, %1, %e0\";
4113 default: gcc_unreachable ();
4116 [(set_attr "length" "4")
4117 (set_attr "type" "fsconv")])
4119 (define_insn "*cond_exec_sf_add"
4121 (match_operator 0 "ccr_eqne_operator"
4122 [(match_operand 1 "cr_operand" "C")
4124 (set (match_operand:SF 2 "fpr_operand" "=f")
4125 (match_operator:SF 3 "condexec_sf_add_operator"
4126 [(match_operand:SF 4 "fpr_operand" "f")
4127 (match_operand:SF 5 "fpr_operand" "f")])))]
4131 switch (GET_CODE (operands[3]))
4133 case PLUS: return \"cfadds %4, %5, %2, %1, %e0\";
4134 case MINUS: return \"cfsubs %4, %5, %2, %1, %e0\";
4135 default: gcc_unreachable ();
4138 [(set_attr "length" "4")
4139 (set_attr "type" "fsadd")])
4141 (define_insn "*cond_exec_sf_mul"
4143 (match_operator 0 "ccr_eqne_operator"
4144 [(match_operand 1 "cr_operand" "C")
4146 (set (match_operand:SF 2 "fpr_operand" "=f")
4147 (mult:SF (match_operand:SF 3 "fpr_operand" "f")
4148 (match_operand:SF 4 "fpr_operand" "f"))))]
4150 "cfmuls %3, %4, %2, %1, %e0"
4151 [(set_attr "length" "4")
4152 (set_attr "type" "fsmul")])
4154 (define_insn "*cond_exec_sf_div"
4156 (match_operator 0 "ccr_eqne_operator"
4157 [(match_operand 1 "cr_operand" "C")
4159 (set (match_operand:SF 2 "fpr_operand" "=f")
4160 (div:SF (match_operand:SF 3 "fpr_operand" "f")
4161 (match_operand:SF 4 "fpr_operand" "f"))))]
4163 "cfdivs %3, %4, %2, %1, %e0"
4164 [(set_attr "length" "4")
4165 (set_attr "type" "fsdiv")])
4167 (define_insn "*cond_exec_sf_sqrt"
4169 (match_operator 0 "ccr_eqne_operator"
4170 [(match_operand 1 "cr_operand" "C")
4172 (set (match_operand:SF 2 "fpr_operand" "=f")
4173 (sqrt:SF (match_operand:SF 3 "fpr_operand" "f"))))]
4175 "cfsqrts %3, %2, %1, %e0"
4176 [(set_attr "length" "4")
4177 (set_attr "type" "fsdiv")])
4179 (define_insn "*cond_exec_cmpsi_cc_fp"
4181 (match_operator 0 "ccr_eqne_operator"
4182 [(match_operand 1 "cr_operand" "C")
4184 (set (match_operand:CC_FP 2 "fcc_operand" "=u")
4185 (compare:CC_FP (match_operand:SF 3 "fpr_operand" "f")
4186 (match_operand:SF 4 "fpr_operand" "f"))))]
4187 "reload_completed && TARGET_HARD_FLOAT
4188 && REGNO (operands[1]) == REGNO (operands[2]) - FCC_FIRST + FCR_FIRST"
4189 "cfcmps %3, %4, %2, %1, %e0"
4190 [(set_attr "length" "4")
4191 (set_attr "type" "fsconv")])
4194 ;; ::::::::::::::::::::
4196 ;; :: Logical operations on CR registers
4198 ;; ::::::::::::::::::::
4200 ;; We use UNSPEC to encode andcr/iorcr/etc. rather than the normal RTL
4201 ;; operations, since the RTL operations only have an idea of TRUE and FALSE,
4202 ;; while the CRs have TRUE, FALSE, and UNDEFINED.
4204 (define_expand "andcr"
4205 [(set (match_operand:CC_CCR 0 "cr_operand" "")
4206 (unspec:CC_CCR [(match_operand:CC_CCR 1 "cr_operand" "")
4207 (match_operand:CC_CCR 2 "cr_operand" "")
4208 (const_int 0)] UNSPEC_CR_LOGIC))]
4212 (define_expand "orcr"
4213 [(set (match_operand:CC_CCR 0 "cr_operand" "")
4214 (unspec:CC_CCR [(match_operand:CC_CCR 1 "cr_operand" "")
4215 (match_operand:CC_CCR 2 "cr_operand" "")
4216 (const_int 1)] UNSPEC_CR_LOGIC))]
4220 (define_expand "xorcr"
4221 [(set (match_operand:CC_CCR 0 "cr_operand" "")
4222 (unspec:CC_CCR [(match_operand:CC_CCR 1 "cr_operand" "")
4223 (match_operand:CC_CCR 2 "cr_operand" "")
4224 (const_int 2)] UNSPEC_CR_LOGIC))]
4228 (define_expand "nandcr"
4229 [(set (match_operand:CC_CCR 0 "cr_operand" "")
4230 (unspec:CC_CCR [(match_operand:CC_CCR 1 "cr_operand" "")
4231 (match_operand:CC_CCR 2 "cr_operand" "")
4232 (const_int 3)] UNSPEC_CR_LOGIC))]
4236 (define_expand "norcr"
4237 [(set (match_operand:CC_CCR 0 "cr_operand" "")
4238 (unspec:CC_CCR [(match_operand:CC_CCR 1 "cr_operand" "")
4239 (match_operand:CC_CCR 2 "cr_operand" "")
4240 (const_int 4)] UNSPEC_CR_LOGIC))]
4244 (define_expand "andncr"
4245 [(set (match_operand:CC_CCR 0 "cr_operand" "")
4246 (unspec:CC_CCR [(match_operand:CC_CCR 1 "cr_operand" "")
4247 (match_operand:CC_CCR 2 "cr_operand" "")
4248 (const_int 5)] UNSPEC_CR_LOGIC))]
4252 (define_expand "orncr"
4253 [(set (match_operand:CC_CCR 0 "cr_operand" "")
4254 (unspec:CC_CCR [(match_operand:CC_CCR 1 "cr_operand" "")
4255 (match_operand:CC_CCR 2 "cr_operand" "")
4256 (const_int 6)] UNSPEC_CR_LOGIC))]
4260 (define_expand "nandncr"
4261 [(set (match_operand:CC_CCR 0 "cr_operand" "")
4262 (unspec:CC_CCR [(match_operand:CC_CCR 1 "cr_operand" "")
4263 (match_operand:CC_CCR 2 "cr_operand" "")
4264 (const_int 7)] UNSPEC_CR_LOGIC))]
4268 (define_expand "norncr"
4269 [(set (match_operand:CC_CCR 0 "cr_operand" "")
4270 (unspec:CC_CCR [(match_operand:CC_CCR 1 "cr_operand" "")
4271 (match_operand:CC_CCR 2 "cr_operand" "")
4272 (const_int 8)] UNSPEC_CR_LOGIC))]
4276 (define_expand "notcr"
4277 [(set (match_operand:CC_CCR 0 "cr_operand" "")
4278 (unspec:CC_CCR [(match_operand:CC_CCR 1 "cr_operand" "")
4280 (const_int 9)] UNSPEC_CR_LOGIC))]
4284 (define_insn "*logical_cr"
4285 [(set (match_operand:CC_CCR 0 "cr_operand" "=C")
4286 (unspec:CC_CCR [(match_operand:CC_CCR 1 "cr_operand" "C")
4287 (match_operand:CC_CCR 2 "cr_operand" "C")
4288 (match_operand:SI 3 "const_int_operand" "n")]
4293 switch (INTVAL (operands[3]))
4296 case 0: return \"andcr %1, %2, %0\";
4297 case 1: return \"orcr %1, %2, %0\";
4298 case 2: return \"xorcr %1, %2, %0\";
4299 case 3: return \"nandcr %1, %2, %0\";
4300 case 4: return \"norcr %1, %2, %0\";
4301 case 5: return \"andncr %1, %2, %0\";
4302 case 6: return \"orncr %1, %2, %0\";
4303 case 7: return \"nandncr %1, %2, %0\";
4304 case 8: return \"norncr %1, %2, %0\";
4305 case 9: return \"notcr %1, %0\";
4308 fatal_insn (\"logical_cr\", insn);
4310 [(set_attr "length" "4")
4311 (set_attr "type" "ccr")])
4314 ;; ::::::::::::::::::::
4316 ;; :: Conditional move instructions
4318 ;; ::::::::::::::::::::
4321 ;; - conditional moves based on floating-point comparisons require
4322 ;; TARGET_HARD_FLOAT, because an FPU is required to do the comparison.
4324 ;; - conditional moves between FPRs based on integer comparisons
4325 ;; require TARGET_HAS_FPRS.
4327 (define_expand "movqicc"
4328 [(set (match_operand:QI 0 "integer_register_operand" "")
4329 (if_then_else:QI (match_operand 1 "" "")
4330 (match_operand:QI 2 "gpr_or_int_operand" "")
4331 (match_operand:QI 3 "gpr_or_int_operand" "")))]
4335 if (!frv_emit_cond_move (operands[0], operands[1], operands[2], operands[3]))
4341 (define_insn "*movqicc_internal1_int"
4342 [(set (match_operand:QI 0 "integer_register_operand" "=d,d,d")
4343 (if_then_else:QI (match_operator 1 "integer_relational_operator"
4344 [(match_operand 2 "icc_operand" "t,t,t")
4346 (match_operand:QI 3 "reg_or_0_operand" "0,dO,dO")
4347 (match_operand:QI 4 "reg_or_0_operand" "dO,0,dO")))
4348 (clobber (match_operand:CC_CCR 5 "icr_operand" "=v,v,v"))]
4351 [(set_attr "length" "8,8,12")
4352 (set_attr "type" "multi")])
4354 (define_insn "*movqicc_internal1_float"
4355 [(set (match_operand:QI 0 "integer_register_operand" "=d,d,d")
4356 (if_then_else:QI (match_operator:CC_FP 1 "float_relational_operator"
4357 [(match_operand:CC_FP 2 "fcc_operand" "u,u,u")
4359 (match_operand:QI 3 "reg_or_0_operand" "0,dO,dO")
4360 (match_operand:QI 4 "reg_or_0_operand" "dO,0,dO")))
4361 (clobber (match_operand:CC_CCR 5 "fcr_operand" "=w,w,w"))]
4364 [(set_attr "length" "8,8,12")
4365 (set_attr "type" "multi")])
4367 (define_insn "*movqicc_internal2_int"
4368 [(set (match_operand:QI 0 "integer_register_operand" "=d,d,d,d,d")
4369 (if_then_else:QI (match_operator 1 "integer_relational_operator"
4370 [(match_operand 2 "icc_operand" "t,t,t,t,t")
4372 (match_operand:QI 3 "const_int_operand" "O,O,L,n,n")
4373 (match_operand:QI 4 "const_int_operand" "L,n,O,O,n")))
4374 (clobber (match_operand:CC_CCR 5 "icr_operand" "=v,v,v,v,v"))]
4375 "(INTVAL (operands[3]) == 0
4376 || INTVAL (operands[4]) == 0
4377 || (IN_RANGE (INTVAL (operands[3]), -2048, 2047)
4378 && IN_RANGE (INTVAL (operands[4]) - INTVAL (operands[3]), -2048, 2047)))"
4380 [(set_attr "length" "8,12,8,12,12")
4381 (set_attr "type" "multi")])
4383 (define_insn "*movqicc_internal2_float"
4384 [(set (match_operand:QI 0 "integer_register_operand" "=d,d,d,d,d")
4385 (if_then_else:QI (match_operator:CC_FP 1 "float_relational_operator"
4386 [(match_operand:CC_FP 2 "fcc_operand" "u,u,u,u,u")
4388 (match_operand:QI 3 "const_int_operand" "O,O,L,n,n")
4389 (match_operand:QI 4 "const_int_operand" "L,n,O,O,n")))
4390 (clobber (match_operand:CC_CCR 5 "fcr_operand" "=w,w,w,w,w"))]
4392 && (INTVAL (operands[3]) == 0
4393 || INTVAL (operands[4]) == 0
4394 || (IN_RANGE (INTVAL (operands[3]), -2048, 2047)
4395 && IN_RANGE (INTVAL (operands[4]) - INTVAL (operands[3]), -2048, 2047)))"
4397 [(set_attr "length" "8,12,8,12,12")
4398 (set_attr "type" "multi")])
4401 [(set (match_operand:QI 0 "integer_register_operand" "")
4402 (if_then_else:QI (match_operator 1 "relational_operator"
4403 [(match_operand 2 "cc_operand" "")
4405 (match_operand:QI 3 "gpr_or_int_operand" "")
4406 (match_operand:QI 4 "gpr_or_int_operand" "")))
4407 (clobber (match_operand:CC_CCR 5 "cr_operand" ""))]
4410 "operands[6] = frv_split_cond_move (operands);")
4412 (define_expand "movhicc"
4413 [(set (match_operand:HI 0 "integer_register_operand" "")
4414 (if_then_else:HI (match_operand 1 "" "")
4415 (match_operand:HI 2 "gpr_or_int_operand" "")
4416 (match_operand:HI 3 "gpr_or_int_operand" "")))]
4420 if (!frv_emit_cond_move (operands[0], operands[1], operands[2], operands[3]))
4426 (define_insn "*movhicc_internal1_int"
4427 [(set (match_operand:HI 0 "integer_register_operand" "=d,d,d")
4428 (if_then_else:HI (match_operator 1 "integer_relational_operator"
4429 [(match_operand 2 "icc_operand" "t,t,t")
4431 (match_operand:HI 3 "reg_or_0_operand" "0,dO,dO")
4432 (match_operand:HI 4 "reg_or_0_operand" "dO,0,dO")))
4433 (clobber (match_operand:CC_CCR 5 "icr_operand" "=v,v,v"))]
4436 [(set_attr "length" "8,8,12")
4437 (set_attr "type" "multi")])
4439 (define_insn "*movhicc_internal1_float"
4440 [(set (match_operand:HI 0 "integer_register_operand" "=d,d,d")
4441 (if_then_else:HI (match_operator:CC_FP 1 "float_relational_operator"
4442 [(match_operand:CC_FP 2 "fcc_operand" "u,u,u")
4444 (match_operand:HI 3 "reg_or_0_operand" "0,dO,dO")
4445 (match_operand:HI 4 "reg_or_0_operand" "dO,0,dO")))
4446 (clobber (match_operand:CC_CCR 5 "fcr_operand" "=w,w,w"))]
4449 [(set_attr "length" "8,8,12")
4450 (set_attr "type" "multi")])
4452 (define_insn "*movhicc_internal2_int"
4453 [(set (match_operand:HI 0 "integer_register_operand" "=d,d,d,d,d")
4454 (if_then_else:HI (match_operator 1 "integer_relational_operator"
4455 [(match_operand 2 "icc_operand" "t,t,t,t,t")
4457 (match_operand:HI 3 "const_int_operand" "O,O,L,n,n")
4458 (match_operand:HI 4 "const_int_operand" "L,n,O,O,n")))
4459 (clobber (match_operand:CC_CCR 5 "icr_operand" "=v,v,v,v,v"))]
4460 "(INTVAL (operands[3]) == 0
4461 || INTVAL (operands[4]) == 0
4462 || (IN_RANGE (INTVAL (operands[3]), -2048, 2047)
4463 && IN_RANGE (INTVAL (operands[4]) - INTVAL (operands[3]), -2048, 2047)))"
4465 [(set_attr "length" "8,12,8,12,12")
4466 (set_attr "type" "multi")])
4468 (define_insn "*movhicc_internal2_float"
4469 [(set (match_operand:HI 0 "integer_register_operand" "=d,d,d,d,d")
4470 (if_then_else:HI (match_operator:CC_FP 1 "float_relational_operator"
4471 [(match_operand:CC_FP 2 "fcc_operand" "u,u,u,u,u")
4473 (match_operand:HI 3 "const_int_operand" "O,O,L,n,n")
4474 (match_operand:HI 4 "const_int_operand" "L,n,O,O,n")))
4475 (clobber (match_operand:CC_CCR 5 "fcr_operand" "=w,w,w,w,w"))]
4477 && (INTVAL (operands[3]) == 0
4478 || INTVAL (operands[4]) == 0
4479 || (IN_RANGE (INTVAL (operands[3]), -2048, 2047)
4480 && IN_RANGE (INTVAL (operands[4]) - INTVAL (operands[3]), -2048, 2047)))"
4482 [(set_attr "length" "8,12,8,12,12")
4483 (set_attr "type" "multi")])
4486 [(set (match_operand:HI 0 "integer_register_operand" "")
4487 (if_then_else:HI (match_operator 1 "relational_operator"
4488 [(match_operand 2 "cc_operand" "")
4490 (match_operand:HI 3 "gpr_or_int_operand" "")
4491 (match_operand:HI 4 "gpr_or_int_operand" "")))
4492 (clobber (match_operand:CC_CCR 5 "cr_operand" ""))]
4495 "operands[6] = frv_split_cond_move (operands);")
4497 (define_expand "movsicc"
4498 [(set (match_operand:SI 0 "integer_register_operand" "")
4499 (if_then_else:SI (match_operand 1 "" "")
4500 (match_operand:SI 2 "gpr_or_int_operand" "")
4501 (match_operand:SI 3 "gpr_or_int_operand" "")))]
4505 if (!frv_emit_cond_move (operands[0], operands[1], operands[2], operands[3]))
4511 (define_insn "*movsicc_internal1_int"
4512 [(set (match_operand:SI 0 "integer_register_operand" "=d,d,d")
4513 (if_then_else:SI (match_operator 1 "integer_relational_operator"
4514 [(match_operand 2 "icc_operand" "t,t,t")
4516 (match_operand:SI 3 "reg_or_0_operand" "0,dO,dO")
4517 (match_operand:SI 4 "reg_or_0_operand" "dO,0,dO")))
4518 (clobber (match_operand:CC_CCR 5 "icr_operand" "=v,v,v"))]
4521 [(set_attr "length" "8,8,12")
4522 (set_attr "type" "multi")])
4524 (define_insn "*movsicc_internal1_float"
4525 [(set (match_operand:SI 0 "integer_register_operand" "=d,d,d")
4526 (if_then_else:SI (match_operator:CC_FP 1 "float_relational_operator"
4527 [(match_operand:CC_FP 2 "fcc_operand" "u,u,u")
4529 (match_operand:SI 3 "reg_or_0_operand" "0,dO,dO")
4530 (match_operand:SI 4 "reg_or_0_operand" "dO,0,dO")))
4531 (clobber (match_operand:CC_CCR 5 "fcr_operand" "=w,w,w"))]
4534 [(set_attr "length" "8,8,12")
4535 (set_attr "type" "multi")])
4537 (define_insn "*movsicc_internal2_int"
4538 [(set (match_operand:SI 0 "integer_register_operand" "=d,d,d,d,d")
4539 (if_then_else:SI (match_operator 1 "integer_relational_operator"
4540 [(match_operand 2 "icc_operand" "t,t,t,t,t")
4542 (match_operand:SI 3 "const_int_operand" "O,O,L,n,n")
4543 (match_operand:SI 4 "const_int_operand" "L,n,O,O,n")))
4544 (clobber (match_operand:CC_CCR 5 "icr_operand" "=v,v,v,v,v"))]
4545 "(INTVAL (operands[3]) == 0
4546 || INTVAL (operands[4]) == 0
4547 || (IN_RANGE (INTVAL (operands[3]), -2048, 2047)
4548 && IN_RANGE (INTVAL (operands[4]) - INTVAL (operands[3]), -2048, 2047)))"
4550 [(set_attr "length" "8,12,8,12,12")
4551 (set_attr "type" "multi")])
4553 (define_insn "*movsicc_internal2_float"
4554 [(set (match_operand:SI 0 "integer_register_operand" "=d,d,d,d,d")
4555 (if_then_else:SI (match_operator:CC_FP 1 "float_relational_operator"
4556 [(match_operand:CC_FP 2 "fcc_operand" "u,u,u,u,u")
4558 (match_operand:SI 3 "const_int_operand" "O,O,L,n,n")
4559 (match_operand:SI 4 "const_int_operand" "L,n,O,O,n")))
4560 (clobber (match_operand:CC_CCR 5 "fcr_operand" "=w,w,w,w,w"))]
4562 && (INTVAL (operands[3]) == 0
4563 || INTVAL (operands[4]) == 0
4564 || (IN_RANGE (INTVAL (operands[3]), -2048, 2047)
4565 && IN_RANGE (INTVAL (operands[4]) - INTVAL (operands[3]), -2048, 2047)))"
4567 [(set_attr "length" "8,12,8,12,12")
4568 (set_attr "type" "multi")])
4571 [(set (match_operand:SI 0 "integer_register_operand" "")
4572 (if_then_else:SI (match_operator 1 "relational_operator"
4573 [(match_operand 2 "cc_operand" "")
4575 (match_operand:SI 3 "gpr_or_int_operand" "")
4576 (match_operand:SI 4 "gpr_or_int_operand" "")))
4577 (clobber (match_operand:CC_CCR 5 "cr_operand" ""))]
4580 "operands[6] = frv_split_cond_move (operands);")
4582 (define_expand "movsfcc"
4583 [(set (match_operand:SF 0 "register_operand" "")
4584 (if_then_else:SF (match_operand 1 "" "")
4585 (match_operand:SF 2 "register_operand" "")
4586 (match_operand:SF 3 "register_operand" "")))]
4590 if (!frv_emit_cond_move (operands[0], operands[1], operands[2], operands[3]))
4596 (define_insn "*movsfcc_has_fprs_int"
4597 [(set (match_operand:SF 0 "register_operand" "=f,f,f,?f,?f,?d")
4598 (if_then_else:SF (match_operator 1 "integer_relational_operator"
4599 [(match_operand 2 "icc_operand" "t,t,t,t,t,t")
4601 (match_operand:SF 3 "register_operand" "0,f,f,f,d,fd")
4602 (match_operand:SF 4 "register_operand" "f,0,f,d,fd,fd")))
4603 (clobber (match_operand:CC_CCR 5 "icr_operand" "=v,v,v,v,v,v"))]
4606 [(set_attr "length" "8,8,12,12,12,12")
4607 (set_attr "type" "multi")])
4609 (define_insn "*movsfcc_hardfloat_float"
4610 [(set (match_operand:SF 0 "register_operand" "=f,f,f,?f,?f,?d")
4611 (if_then_else:SF (match_operator:CC_FP 1 "float_relational_operator"
4612 [(match_operand:CC_FP 2 "fcc_operand" "u,u,u,u,u,u")
4614 (match_operand:SF 3 "register_operand" "0,f,f,f,d,fd")
4615 (match_operand:SF 4 "register_operand" "f,0,f,d,fd,fd")))
4616 (clobber (match_operand:CC_CCR 5 "fcr_operand" "=w,w,w,w,w,w"))]
4619 [(set_attr "length" "8,8,12,12,12,12")
4620 (set_attr "type" "multi")])
4622 (define_insn "*movsfcc_no_fprs_int"
4623 [(set (match_operand:SF 0 "integer_register_operand" "=d,d,d")
4624 (if_then_else:SF (match_operator 1 "integer_relational_operator"
4625 [(match_operand 2 "icc_operand" "t,t,t")
4627 (match_operand:SF 3 "integer_register_operand" "0,d,d")
4628 (match_operand:SF 4 "integer_register_operand" "d,0,d")))
4629 (clobber (match_operand:CC_CCR 5 "icr_operand" "=v,v,v"))]
4632 [(set_attr "length" "8,8,12")
4633 (set_attr "type" "multi")])
4636 [(set (match_operand:SF 0 "register_operand" "")
4637 (if_then_else:SF (match_operator 1 "relational_operator"
4638 [(match_operand 2 "cc_operand" "")
4640 (match_operand:SF 3 "register_operand" "")
4641 (match_operand:SF 4 "register_operand" "")))
4642 (clobber (match_operand:CC_CCR 5 "cr_operand" ""))]
4645 "operands[6] = frv_split_cond_move (operands);")
4648 ;; ::::::::::::::::::::
4650 ;; :: Minimum, maximum, and integer absolute value
4652 ;; ::::::::::::::::::::
4654 ;; These 'instructions' are provided to give the compiler a slightly better
4655 ;; nudge at register allocation, then it would if it constructed the
4656 ;; instructions from basic building blocks (since it indicates it prefers one
4657 ;; of the operands to be the same as the destination. It also helps the
4658 ;; earlier passes of the compiler, by not breaking things into small basic
4661 (define_expand "abssi2"
4662 [(parallel [(set (match_operand:SI 0 "integer_register_operand" "")
4663 (abs:SI (match_operand:SI 1 "integer_register_operand" "")))
4664 (clobber (match_dup 2))
4665 (clobber (match_dup 3))])]
4669 operands[2] = gen_reg_rtx (CCmode);
4670 operands[3] = gen_reg_rtx (CC_CCRmode);
4673 (define_insn_and_split "*abssi2_internal"
4674 [(set (match_operand:SI 0 "integer_register_operand" "=d,d")
4675 (abs:SI (match_operand:SI 1 "integer_register_operand" "0,d")))
4676 (clobber (match_operand:CC 2 "icc_operand" "=t,t"))
4677 (clobber (match_operand:CC_CCR 3 "icr_operand" "=v,v"))]
4682 "operands[4] = frv_split_abs (operands);"
4683 [(set_attr "length" "12,16")
4684 (set_attr "type" "multi")])
4686 (define_expand "sminsi3"
4687 [(parallel [(set (match_operand:SI 0 "integer_register_operand" "")
4688 (smin:SI (match_operand:SI 1 "integer_register_operand" "")
4689 (match_operand:SI 2 "gpr_or_int10_operand" "")))
4690 (clobber (match_dup 3))
4691 (clobber (match_dup 4))])]
4695 operands[3] = gen_reg_rtx (CCmode);
4696 operands[4] = gen_reg_rtx (CC_CCRmode);
4699 (define_expand "smaxsi3"
4700 [(parallel [(set (match_operand:SI 0 "integer_register_operand" "")
4701 (smax:SI (match_operand:SI 1 "integer_register_operand" "")
4702 (match_operand:SI 2 "gpr_or_int10_operand" "")))
4703 (clobber (match_dup 3))
4704 (clobber (match_dup 4))])]
4708 operands[3] = gen_reg_rtx (CCmode);
4709 operands[4] = gen_reg_rtx (CC_CCRmode);
4712 (define_insn_and_split "*minmax_si_signed"
4713 [(set (match_operand:SI 0 "integer_register_operand" "=d,d,&d")
4714 (match_operator:SI 1 "minmax_operator"
4715 [(match_operand:SI 2 "integer_register_operand" "%0,dO,d")
4716 (match_operand:SI 3 "gpr_or_int10_operand" "dO,0,dJ")]))
4717 (clobber (match_operand:CC 4 "icc_operand" "=t,t,t"))
4718 (clobber (match_operand:CC_CCR 5 "icr_operand" "=v,v,v"))]
4723 "operands[6] = frv_split_minmax (operands);"
4724 [(set_attr "length" "12,12,16")
4725 (set_attr "type" "multi")])
4727 (define_expand "uminsi3"
4728 [(parallel [(set (match_operand:SI 0 "integer_register_operand" "")
4729 (umin:SI (match_operand:SI 1 "integer_register_operand" "")
4730 (match_operand:SI 2 "gpr_or_int10_operand" "")))
4731 (clobber (match_dup 3))
4732 (clobber (match_dup 4))])]
4736 operands[3] = gen_reg_rtx (CC_UNSmode);
4737 operands[4] = gen_reg_rtx (CC_CCRmode);
4740 (define_expand "umaxsi3"
4741 [(parallel [(set (match_operand:SI 0 "integer_register_operand" "")
4742 (umax:SI (match_operand:SI 1 "integer_register_operand" "")
4743 (match_operand:SI 2 "gpr_or_int10_operand" "")))
4744 (clobber (match_dup 3))
4745 (clobber (match_dup 4))])]
4749 operands[3] = gen_reg_rtx (CC_UNSmode);
4750 operands[4] = gen_reg_rtx (CC_CCRmode);
4753 (define_insn_and_split "*minmax_si_unsigned"
4754 [(set (match_operand:SI 0 "integer_register_operand" "=d,d,&d")
4755 (match_operator:SI 1 "minmax_operator"
4756 [(match_operand:SI 2 "integer_register_operand" "%0,dO,d")
4757 (match_operand:SI 3 "gpr_or_int10_operand" "dO,0,dJ")]))
4758 (clobber (match_operand:CC_UNS 4 "icc_operand" "=t,t,t"))
4759 (clobber (match_operand:CC_CCR 5 "icr_operand" "=v,v,v"))]
4764 "operands[6] = frv_split_minmax (operands);"
4765 [(set_attr "length" "12,12,16")
4766 (set_attr "type" "multi")])
4768 (define_expand "sminsf3"
4769 [(parallel [(set (match_operand:SF 0 "fpr_operand" "")
4770 (smin:SF (match_operand:SF 1 "fpr_operand" "")
4771 (match_operand:SF 2 "fpr_operand" "")))
4772 (clobber (match_dup 3))
4773 (clobber (match_dup 4))])]
4774 "TARGET_COND_MOVE && TARGET_HARD_FLOAT"
4777 operands[3] = gen_reg_rtx (CC_FPmode);
4778 operands[4] = gen_reg_rtx (CC_CCRmode);
4781 (define_expand "smaxsf3"
4782 [(parallel [(set (match_operand:SF 0 "fpr_operand" "")
4783 (smax:SF (match_operand:SF 1 "fpr_operand" "")
4784 (match_operand:SF 2 "fpr_operand" "")))
4785 (clobber (match_dup 3))
4786 (clobber (match_dup 4))])]
4787 "TARGET_COND_MOVE && TARGET_HARD_FLOAT"
4790 operands[3] = gen_reg_rtx (CC_FPmode);
4791 operands[4] = gen_reg_rtx (CC_CCRmode);
4794 (define_insn_and_split "*minmax_sf"
4795 [(set (match_operand:SF 0 "fpr_operand" "=f,f,f")
4796 (match_operator:SF 1 "minmax_operator"
4797 [(match_operand:SF 2 "fpr_operand" "%0,f,f")
4798 (match_operand:SF 3 "fpr_operand" "f,0,f")]))
4799 (clobber (match_operand:CC_FP 4 "fcc_operand" "=u,u,u"))
4800 (clobber (match_operand:CC_CCR 5 "fcr_operand" "=w,w,w"))]
4801 "TARGET_COND_MOVE && TARGET_HARD_FLOAT"
4805 "operands[6] = frv_split_minmax (operands);"
4806 [(set_attr "length" "12,12,16")
4807 (set_attr "type" "multi")])
4809 (define_expand "smindf3"
4810 [(parallel [(set (match_operand:DF 0 "fpr_operand" "")
4811 (smin:DF (match_operand:DF 1 "fpr_operand" "")
4812 (match_operand:DF 2 "fpr_operand" "")))
4813 (clobber (match_dup 3))
4814 (clobber (match_dup 4))])]
4815 "TARGET_COND_MOVE && TARGET_HARD_FLOAT && TARGET_DOUBLE"
4818 operands[3] = gen_reg_rtx (CC_FPmode);
4819 operands[4] = gen_reg_rtx (CC_CCRmode);
4822 (define_expand "smaxdf3"
4823 [(parallel [(set (match_operand:DF 0 "fpr_operand" "")
4824 (smax:DF (match_operand:DF 1 "fpr_operand" "")
4825 (match_operand:DF 2 "fpr_operand" "")))
4826 (clobber (match_dup 3))
4827 (clobber (match_dup 4))])]
4828 "TARGET_COND_MOVE && TARGET_HARD_FLOAT && TARGET_DOUBLE"
4831 operands[3] = gen_reg_rtx (CC_FPmode);
4832 operands[4] = gen_reg_rtx (CC_CCRmode);
4835 (define_insn_and_split "*minmax_df"
4836 [(set (match_operand:DF 0 "fpr_operand" "=f,f,f")
4837 (match_operator:DF 1 "minmax_operator"
4838 [(match_operand:DF 2 "fpr_operand" "%0,f,f")
4839 (match_operand:DF 3 "fpr_operand" "f,0,f")]))
4840 (clobber (match_operand:CC_FP 4 "fcc_operand" "=u,u,u"))
4841 (clobber (match_operand:CC_CCR 5 "fcr_operand" "=w,w,w"))]
4842 "TARGET_COND_MOVE && TARGET_HARD_FLOAT && TARGET_DOUBLE"
4846 "operands[6] = frv_split_minmax (operands);"
4847 [(set_attr "length" "12,12,16")
4848 (set_attr "type" "multi")])
4851 ;; ::::::::::::::::::::
4853 ;; :: Call and branch instructions
4855 ;; ::::::::::::::::::::
4857 ;; Subroutine call instruction returning no value. Operand 0 is the function
4858 ;; to call; operand 1 is the number of bytes of arguments pushed (in mode
4859 ;; `SImode', except it is normally a `const_int'); operand 2 is the number of
4860 ;; registers used as operands.
4862 ;; On most machines, operand 2 is not actually stored into the RTL pattern. It
4863 ;; is supplied for the sake of some RISC machines which need to put this
4864 ;; information into the assembler code; they can put it in the RTL instead of
4867 (define_expand "call"
4868 [(use (match_operand:QI 0 "" ""))
4869 (use (match_operand 1 "" ""))
4870 (use (match_operand 2 "" ""))
4871 (use (match_operand 3 "" ""))]
4875 rtx lr = gen_rtx_REG (Pmode, LR_REGNO);
4878 gcc_assert (GET_CODE (operands[0]) == MEM);
4880 addr = XEXP (operands[0], 0);
4881 if (! call_operand (addr, Pmode))
4882 addr = force_reg (Pmode, addr);
4885 operands[2] = const0_rtx;
4888 frv_expand_fdpic_call (operands, false, false);
4890 emit_call_insn (gen_call_internal (addr, operands[1], operands[2], lr));
4895 (define_insn "call_internal"
4896 [(call (mem:QI (match_operand:SI 0 "call_operand" "S,dNOP"))
4897 (match_operand 1 "" ""))
4898 (use (match_operand 2 "" ""))
4899 (clobber (match_operand:SI 3 "lr_operand" "=l,l"))]
4904 [(set_attr "length" "4")
4905 (set_attr "type" "call,jumpl")])
4907 ;; The odd use of GR0 within the UNSPEC below prevents cseing or
4908 ;; hoisting function descriptor loads out of loops. This is almost
4909 ;; never desirable, since if we preserve the function descriptor in a
4910 ;; pair of registers, it takes two insns to move it to gr14/gr15, and
4911 ;; if it's in the stack, we just waste space with the store, since
4912 ;; we'll have to load back from memory anyway. And, in the worst
4913 ;; case, we may end up reusing a function descriptor still pointing at
4914 ;; a PLT entry, instead of to the resolved function, which means going
4915 ;; through the resolver for every call that uses the outdated value.
4918 ;; The explicit MEM inside the SPEC prevents the compiler from moving
4919 ;; the load before a branch after a NULL test, or before a store that
4920 ;; initializes a function descriptor.
4922 (define_insn "movdi_ldd"
4923 [(set (match_operand:DI 0 "fdpic_fptr_operand" "=e")
4924 (unspec:DI [(mem:DI (match_operand:SI 1 "ldd_address_operand" "p"))
4925 (reg:SI 0)] UNSPEC_LDD))]
4928 [(set_attr "length" "4")
4929 (set_attr "type" "gload")])
4931 (define_insn "call_fdpicdi"
4932 [(call (mem:QI (match_operand:DI 0 "fdpic_fptr_operand" "W"))
4933 (match_operand 1 "" ""))
4934 (clobber (match_operand:SI 2 "lr_operand" "=l"))]
4937 [(set_attr "length" "4")
4938 (set_attr "type" "jumpl")])
4940 (define_insn "call_fdpicsi"
4941 [(call (mem:QI (match_operand:SI 0 "call_operand" "S,dNOP"))
4942 (match_operand 1 "" ""))
4943 (use (match_operand 2 "" ""))
4944 (use (match_operand:SI 3 "fdpic_operand" "Z,Z"))
4945 (clobber (match_operand:SI 4 "lr_operand" "=l,l"))]
4950 [(set_attr "length" "4")
4951 (set_attr "type" "call,jumpl")])
4953 (define_expand "sibcall"
4954 [(use (match_operand:QI 0 "" ""))
4955 (use (match_operand 1 "" ""))
4956 (use (match_operand 2 "" ""))
4957 (use (match_operand 3 "" ""))]
4963 gcc_assert (GET_CODE (operands[0]) == MEM);
4965 addr = XEXP (operands[0], 0);
4966 if (! sibcall_operand (addr, Pmode))
4967 addr = force_reg (Pmode, addr);
4970 operands[2] = const0_rtx;
4973 frv_expand_fdpic_call (operands, false, true);
4975 emit_call_insn (gen_sibcall_internal (addr, operands[1], operands[2]));
4980 ;; It might seem that these sibcall patterns are missing references to
4981 ;; LR, but they're not necessary because sibcall_epilogue will make
4982 ;; sure LR is restored, and having LR here will set
4983 ;; regs_ever_used[REG_LR], forcing it to be saved on the stack, and
4984 ;; then restored in sibcalls and regular return code paths, even if
4985 ;; the function becomes a leaf function after tail-call elimination.
4987 ;; We must not use a call-saved register here. `W' limits ourselves
4988 ;; to gr14 or gr15, but since we're almost running out of constraint
4989 ;; letters, and most other call-clobbered registers are often used for
4990 ;; argument-passing, this will do.
4991 (define_insn "sibcall_internal"
4992 [(call (mem:QI (match_operand:SI 0 "sibcall_operand" "WNOP"))
4993 (match_operand 1 "" ""))
4994 (use (match_operand 2 "" ""))
4998 [(set_attr "length" "4")
4999 (set_attr "type" "jumpl")])
5001 (define_insn "sibcall_fdpicdi"
5002 [(call (mem:QI (match_operand:DI 0 "fdpic_fptr_operand" "W"))
5003 (match_operand 1 "" ""))
5007 [(set_attr "length" "4")
5008 (set_attr "type" "jumpl")])
5011 ;; Subroutine call instruction returning a value. Operand 0 is the hard
5012 ;; register in which the value is returned. There are three more operands, the
5013 ;; same as the three operands of the `call' instruction (but with numbers
5014 ;; increased by one).
5016 ;; Subroutines that return `BLKmode' objects use the `call' insn.
5018 (define_expand "call_value"
5019 [(use (match_operand 0 "" ""))
5020 (use (match_operand:QI 1 "" ""))
5021 (use (match_operand 2 "" ""))
5022 (use (match_operand 3 "" ""))
5023 (use (match_operand 4 "" ""))]
5027 rtx lr = gen_rtx_REG (Pmode, LR_REGNO);
5030 gcc_assert (GET_CODE (operands[1]) == MEM);
5032 addr = XEXP (operands[1], 0);
5033 if (! call_operand (addr, Pmode))
5034 addr = force_reg (Pmode, addr);
5037 operands[3] = const0_rtx;
5040 frv_expand_fdpic_call (operands, true, false);
5042 emit_call_insn (gen_call_value_internal (operands[0], addr, operands[2],
5048 (define_insn "call_value_internal"
5049 [(set (match_operand 0 "register_operand" "=d,d")
5050 (call (mem:QI (match_operand:SI 1 "call_operand" "S,dNOP"))
5051 (match_operand 2 "" "")))
5052 (use (match_operand 3 "" ""))
5053 (clobber (match_operand:SI 4 "lr_operand" "=l,l"))]
5058 [(set_attr "length" "4")
5059 (set_attr "type" "call,jumpl")])
5061 (define_insn "call_value_fdpicdi"
5062 [(set (match_operand 0 "register_operand" "=d")
5063 (call (mem:QI (match_operand:DI 1 "fdpic_fptr_operand" "W"))
5064 (match_operand 2 "" "")))
5065 (clobber (match_operand:SI 3 "lr_operand" "=l"))]
5068 [(set_attr "length" "4")
5069 (set_attr "type" "jumpl")])
5071 (define_insn "call_value_fdpicsi"
5072 [(set (match_operand 0 "register_operand" "=d,d")
5073 (call (mem:QI (match_operand:SI 1 "call_operand" "S,dNOP"))
5074 (match_operand 2 "" "")))
5075 (use (match_operand 3 "" ""))
5076 (use (match_operand:SI 4 "fdpic_operand" "Z,Z"))
5077 (clobber (match_operand:SI 5 "lr_operand" "=l,l"))]
5082 [(set_attr "length" "4")
5083 (set_attr "type" "call,jumpl")])
5085 (define_expand "sibcall_value"
5086 [(use (match_operand 0 "" ""))
5087 (use (match_operand:QI 1 "" ""))
5088 (use (match_operand 2 "" ""))
5089 (use (match_operand 3 "" ""))
5090 (use (match_operand 4 "" ""))]
5096 gcc_assert (GET_CODE (operands[1]) == MEM);
5098 addr = XEXP (operands[1], 0);
5099 if (! sibcall_operand (addr, Pmode))
5100 addr = force_reg (Pmode, addr);
5103 operands[3] = const0_rtx;
5106 frv_expand_fdpic_call (operands, true, true);
5108 emit_call_insn (gen_sibcall_value_internal (operands[0], addr, operands[2],
5113 (define_insn "sibcall_value_internal"
5114 [(set (match_operand 0 "register_operand" "=d")
5115 (call (mem:QI (match_operand:SI 1 "sibcall_operand" "WNOP"))
5116 (match_operand 2 "" "")))
5117 (use (match_operand 3 "" ""))
5121 [(set_attr "length" "4")
5122 (set_attr "type" "jumpl")])
5124 (define_insn "sibcall_value_fdpicdi"
5125 [(set (match_operand 0 "register_operand" "=d")
5126 (call (mem:QI (match_operand:DI 1 "fdpic_fptr_operand" "W"))
5127 (match_operand 2 "" "")))
5131 [(set_attr "length" "4")
5132 (set_attr "type" "jumpl")])
5134 ;; return instruction generated instead of jmp to epilog
5135 (define_expand "return"
5136 [(parallel [(return)
5138 (use (const_int 1))])]
5139 "direct_return_p ()"
5142 operands[0] = gen_rtx_REG (Pmode, LR_REGNO);
5145 ;; return instruction generated by the epilogue
5146 (define_expand "epilogue_return"
5147 [(parallel [(return)
5148 (use (match_operand:SI 0 "register_operand" ""))
5149 (use (const_int 0))])]
5153 (define_insn "*return_internal"
5155 (use (match_operand:SI 0 "register_operand" "l,d"))
5156 (use (match_operand:SI 1 "immediate_operand" "n,n"))]
5161 [(set_attr "length" "4")
5162 (set_attr "type" "jump,jumpl")])
5164 (define_insn "*return_true"
5166 (if_then_else (match_operator 0 "integer_relational_operator"
5167 [(match_operand 1 "icc_operand" "t")
5171 "direct_return_p ()"
5173 [(set_attr "length" "4")
5174 (set_attr "type" "jump")])
5176 (define_insn "*return_false"
5178 (if_then_else (match_operator 0 "integer_relational_operator"
5179 [(match_operand 1 "icc_operand" "t")
5183 "direct_return_p ()"
5185 [(set_attr "length" "4")
5186 (set_attr "type" "jump")])
5188 ;; A version of addsi3 for deallocating stack space at the end of the
5189 ;; epilogue. The addition is done in parallel with an (unspec_volatile),
5190 ;; which represents the clobbering of the deallocated space.
5191 (define_insn "stack_adjust"
5192 [(set (match_operand:SI 0 "register_operand" "=d")
5193 (plus:SI (match_operand:SI 1 "register_operand" "d")
5194 (match_operand:SI 2 "general_operand" "dNOP")))
5195 (unspec_volatile [(const_int 0)] UNSPEC_STACK_ADJUST)]
5198 [(set_attr "length" "4")
5199 (set_attr "type" "int")])
5201 ;; Normal unconditional jump
5203 ;; Use the "call" instruction for long branches, but prefer to use "bra" for
5204 ;; short ones since it does not force us to save the link register.
5206 ;; This define_insn uses the branch-shortening code to decide which
5207 ;; instruction it emits. Since the main branch-shortening interface is
5208 ;; through get_attr_length(), the two alternatives must be given different
5209 ;; lengths. Here we pretend that the far jump is 8 rather than 4 bytes
5210 ;; long, though both alternatives are really the same size.
5212 [(set (pc) (label_ref (match_operand 0 "" "")))]
5216 if (get_attr_length (insn) == 4)
5219 return \"call %l0\";
5221 [(set (attr "length")
5223 (and (ge (minus (match_dup 0) (pc)) (const_int -32768))
5224 (le (minus (match_dup 0) (pc)) (const_int 32764)))
5227 (set (attr "far_jump")
5229 (eq_attr "length" "4")
5231 (const_string "yes")))
5234 (eq_attr "length" "4")
5235 (const_string "jump")
5236 (const_string "call")))])
5238 ;; Indirect jump through a register
5239 (define_insn "indirect_jump"
5240 [(set (pc) (match_operand:SI 0 "register_operand" "d,l"))]
5245 [(set_attr "length" "4")
5246 (set_attr "type" "jumpl,branch")])
5248 ;; Instruction to jump to a variable address. This is a low-level capability
5249 ;; which can be used to implement a dispatch table when there is no `casesi'
5250 ;; pattern. Either the 'casesi' pattern or the 'tablejump' pattern, or both,
5251 ;; MUST be present in this file.
5253 ;; This pattern requires two operands: the address or offset, and a label which
5254 ;; should immediately precede the jump table. If the macro
5255 ;; `CASE_VECTOR_PC_RELATIVE' is defined then the first operand is an offset
5256 ;; which counts from the address of the table; otherwise, it is an absolute
5257 ;; address to jump to. In either case, the first operand has mode `Pmode'.
5259 ;; The `tablejump' insn is always the last insn before the jump table it uses.
5260 ;; Its assembler code normally has no need to use the second operand, but you
5261 ;; should incorporate it in the RTL pattern so that the jump optimizer will not
5262 ;; delete the table as unreachable code.
5264 (define_expand "tablejump"
5265 [(parallel [(set (pc) (match_operand:SI 0 "address_operand" "p"))
5266 (use (label_ref (match_operand 1 "" "")))])]
5270 (define_insn "tablejump_insn"
5271 [(set (pc) (match_operand:SI 0 "address_operand" "p"))
5272 (use (label_ref (match_operand 1 "" "")))]
5275 [(set_attr "length" "4")
5276 (set_attr "type" "jumpl")])
5278 ;; Implement switch statements when generating PIC code. Switches are
5279 ;; implemented by `tablejump' when not using -fpic.
5281 ;; Emit code here to do the range checking and make the index zero based.
5282 ;; operand 0 is the index
5283 ;; operand 1 is the lower bound
5284 ;; operand 2 is the range of indices (highest - lowest + 1)
5285 ;; operand 3 is the label that precedes the table itself
5286 ;; operand 4 is the fall through label
5288 (define_expand "casesi"
5289 [(use (match_operand:SI 0 "integer_register_operand" ""))
5290 (use (match_operand:SI 1 "const_int_operand" ""))
5291 (use (match_operand:SI 2 "const_int_operand" ""))
5292 (use (match_operand 3 "" ""))
5293 (use (match_operand 4 "" ""))]
5299 rtx low = operands[1];
5300 rtx range = operands[2];
5301 rtx table = operands[3];
5303 rtx fail = operands[4];
5308 gcc_assert (GET_CODE (operands[1]) == CONST_INT);
5310 gcc_assert (GET_CODE (operands[2]) == CONST_INT);
5312 /* If we can't generate an immediate instruction, promote to register. */
5313 if (! IN_RANGE (INTVAL (range), -2048, 2047))
5314 range = force_reg (SImode, range);
5316 /* If low bound is 0, we don't have to subtract it. */
5317 if (INTVAL (operands[1]) == 0)
5321 indx = gen_reg_rtx (SImode);
5322 if (IN_RANGE (INTVAL (low), -2047, 2048))
5323 emit_insn (gen_addsi3 (indx, operands[0], GEN_INT (- INTVAL (low))));
5325 emit_insn (gen_subsi3 (indx, operands[0], force_reg (SImode, low)));
5328 /* Do an unsigned comparison (in the proper mode) between the index
5329 expression and the value which represents the length of the range.
5330 Since we just finished subtracting the lower bound of the range
5331 from the index expression, this comparison allows us to simultaneously
5332 check that the original index expression value is both greater than
5333 or equal to the minimum value of the range and less than or equal to
5334 the maximum value of the range. */
5336 emit_cmp_and_jump_insns (indx, range, GTU, NULL_RTX, SImode, 1, fail);
5338 /* Move the table address to a register. */
5339 treg = gen_reg_rtx (Pmode);
5340 emit_insn (gen_movsi (treg, gen_rtx_LABEL_REF (VOIDmode, table)));
5342 /* Scale index-low by wordsize. */
5343 scale = gen_reg_rtx (SImode);
5344 emit_insn (gen_ashlsi3 (scale, indx, const2_rtx));
5346 /* Load the address, add the start of the table back in,
5348 mem = gen_rtx_MEM (SImode, gen_rtx_PLUS (Pmode, scale, treg));
5349 reg2 = gen_reg_rtx (SImode);
5350 reg3 = gen_reg_rtx (SImode);
5351 emit_insn (gen_movsi (reg2, mem));
5352 emit_insn (gen_addsi3 (reg3, reg2, treg));
5353 emit_jump_insn (gen_tablejump_insn (reg3, table));
5358 ;; ::::::::::::::::::::
5360 ;; :: Prologue and Epilogue instructions
5362 ;; ::::::::::::::::::::
5364 ;; Called after register allocation to add any instructions needed for the
5365 ;; prologue. Using a prologue insn is favored compared to putting all of the
5366 ;; instructions in the FUNCTION_PROLOGUE macro, since it allows the scheduler
5367 ;; to intermix instructions with the saves of the caller saved registers. In
5368 ;; some cases, it might be necessary to emit a barrier instruction as the last
5369 ;; insn to prevent such scheduling.
5370 (define_expand "prologue"
5375 frv_expand_prologue ();
5379 ;; Called after register allocation to add any instructions needed for the
5380 ;; epilogue. Using an epilogue insn is favored compared to putting all of the
5381 ;; instructions in the FUNCTION_EPILOGUE macro, since it allows the scheduler
5382 ;; to intermix instructions with the restores of the caller saved registers.
5383 ;; In some cases, it might be necessary to emit a barrier instruction as the
5384 ;; first insn to prevent such scheduling.
5385 (define_expand "epilogue"
5390 frv_expand_epilogue (true);
5394 ;; This pattern, if defined, emits RTL for exit from a function without the final
5395 ;; branch back to the calling function. This pattern will be emitted before any
5396 ;; sibling call (aka tail call) sites.
5398 ;; The sibcall_epilogue pattern must not clobber any arguments used for
5399 ;; parameter passing or any stack slots for arguments passed to the current
5401 (define_expand "sibcall_epilogue"
5406 frv_expand_epilogue (false);
5410 ;; Set up the pic register to hold the address of the pic table
5411 (define_insn "pic_prologue"
5412 [(set (match_operand:SI 0 "integer_register_operand" "=d")
5413 (unspec_volatile:SI [(const_int 0)] UNSPEC_PIC_PROLOGUE))
5414 (clobber (match_operand:SI 1 "lr_operand" "=l"))
5415 (clobber (match_operand:SI 2 "integer_register_operand" "=d"))]
5419 static int frv_pic_labelno = 0;
5421 operands[3] = GEN_INT (frv_pic_labelno++);
5422 return \"call %P3\\n%P3:\;movsg %1, %0\;sethi #gprelhi(%P3), %2\;setlo #gprello(%P3), %2\;sub %0,%2,%0\";
5424 [(set_attr "length" "16")
5425 (set_attr "type" "multi")])
5427 ;; ::::::::::::::::::::
5429 ;; :: Miscellaneous instructions
5431 ;; ::::::::::::::::::::
5433 ;; No operation, needed in case the user uses -g but not -O.
5438 [(set_attr "length" "4")
5439 (set_attr "type" "int")])
5445 [(set_attr "length" "4")
5446 (set_attr "type" "fnop")])
5452 [(set_attr "length" "4")
5453 (set_attr "type" "mnop")])
5455 ;; Pseudo instruction that prevents the scheduler from moving code above this
5456 ;; point. Note, type unknown is used to make sure the VLIW instructions are
5457 ;; not continued past this point.
5458 (define_insn "blockage"
5459 [(unspec_volatile [(const_int 0)] UNSPEC_BLOCKAGE)]
5462 [(set_attr "length" "0")
5463 (set_attr "type" "unknown")])
5465 ;; ::::::::::::::::::::
5467 ;; :: Media instructions
5469 ;; ::::::::::::::::::::
5471 ;; Unimplemented instructions:
5475 [(UNSPEC_MLOGIC 100)
5482 (UNSPEC_MUNPACKH 107)
5483 (UNSPEC_MDPACKH 108)
5488 (UNSPEC_MEXPDHW 113)
5489 (UNSPEC_MEXPDHD 114)
5496 (UNSPEC_MQMULXH 121)
5502 (UNSPEC_MRDACCG 127)
5504 (UNSPEC_MWTACCG 129)
5506 (UNSPEC_MCLRACC 131)
5507 (UNSPEC_MCLRACCA 132)
5510 (UNSPEC_MDUNPACKH 135)
5511 (UNSPEC_MDUNPACKH_INTERNAL 136)
5513 (UNSPEC_MBTOHE_INTERNAL 138)
5515 (UNSPEC_MBTOHE_INTERNAL 138)
5516 (UNSPEC_MQMACH2 139)
5517 (UNSPEC_MADDACC 140)
5518 (UNSPEC_MDADDACC 141)
5520 (UNSPEC_MDROTLI 143)
5523 (UNSPEC_MDCUTSSI 146)
5524 (UNSPEC_MQSATHS 147)
5525 (UNSPEC_MHSETLOS 148)
5526 (UNSPEC_MHSETLOH 149)
5527 (UNSPEC_MHSETHIS 150)
5528 (UNSPEC_MHSETHIH 151)
5529 (UNSPEC_MHDSETS 152)
5530 (UNSPEC_MHDSETH 153)
5531 (UNSPEC_MQLCLRHS 154)
5532 (UNSPEC_MQLMTHS 155)
5533 (UNSPEC_MQSLLHI 156)
5534 (UNSPEC_MQSRAHI 157)
5535 (UNSPEC_MASACCS 158)
5536 (UNSPEC_MDASACCS 159)
5539 ;; Logic operations: type "mlogic"
5541 (define_expand "mand"
5542 [(set (match_operand:SI 0 "fpr_operand" "")
5543 (unspec:SI [(match_operand:SI 1 "fpr_operand" "")
5544 (match_operand:SI 2 "fpr_operand" "")
5548 "operands[3] = GEN_INT (FRV_BUILTIN_MAND);")
5550 (define_expand "mor"
5551 [(set (match_operand:SI 0 "fpr_operand" "")
5552 (unspec:SI [(match_operand:SI 1 "fpr_operand" "")
5553 (match_operand:SI 2 "fpr_operand" "")
5557 "operands[3] = GEN_INT (FRV_BUILTIN_MOR);")
5559 (define_expand "mxor"
5560 [(set (match_operand:SI 0 "fpr_operand" "")
5561 (unspec:SI [(match_operand:SI 1 "fpr_operand" "")
5562 (match_operand:SI 2 "fpr_operand" "")
5566 "operands[3] = GEN_INT (FRV_BUILTIN_MXOR);")
5568 (define_insn "*mlogic"
5569 [(set (match_operand:SI 0 "fpr_operand" "=f")
5570 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f")
5571 (match_operand:SI 2 "fpr_operand" "f")
5572 (match_operand:SI 3 "const_int_operand" "n")]
5577 switch (INTVAL (operands[3]))
5580 case FRV_BUILTIN_MAND: return \"mand %1, %2, %0\";
5581 case FRV_BUILTIN_MOR: return \"mor %1, %2, %0\";
5582 case FRV_BUILTIN_MXOR: return \"mxor %1, %2, %0\";
5585 fatal_insn (\"Bad media insn, mlogic\", insn);
5587 [(set_attr "length" "4")
5588 (set_attr "type" "mlogic")])
5590 (define_insn "*cond_exec_mlogic"
5592 (match_operator 0 "ccr_eqne_operator"
5593 [(match_operand 1 "cr_operand" "C")
5595 (set (match_operand:SI 2 "fpr_operand" "=f")
5596 (unspec:SI [(match_operand:SI 3 "fpr_operand" "f")
5597 (match_operand:SI 4 "fpr_operand" "f")
5598 (match_operand:SI 5 "const_int_operand" "n")]
5603 switch (INTVAL (operands[5]))
5606 case FRV_BUILTIN_MAND: return \"cmand %3, %4, %2, %1, %e0\";
5607 case FRV_BUILTIN_MOR: return \"cmor %3, %4, %2, %1, %e0\";
5608 case FRV_BUILTIN_MXOR: return \"cmxor %3, %4, %2, %1, %e0\";
5611 fatal_insn (\"Bad media insn, cond_exec_mlogic\", insn);
5613 [(set_attr "length" "4")
5614 (set_attr "type" "mlogic")])
5616 ;; Logical not: type "mlogic"
5619 [(set (match_operand:SI 0 "fpr_operand" "=f")
5620 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f")] UNSPEC_MNOT))]
5623 [(set_attr "length" "4")
5624 (set_attr "type" "mlogic")])
5626 (define_insn "*cond_exec_mnot"
5628 (match_operator 0 "ccr_eqne_operator"
5629 [(match_operand 1 "cr_operand" "C")
5631 (set (match_operand:SI 2 "fpr_operand" "=f")
5632 (unspec:SI [(match_operand:SI 3 "fpr_operand" "f")] UNSPEC_MNOT)))]
5634 "cmnot %3, %2, %1, %e0"
5635 [(set_attr "length" "4")
5636 (set_attr "type" "mlogic")])
5638 ;; Dual average (halfword): type "maveh"
5640 (define_insn "maveh"
5641 [(set (match_operand:SI 0 "fpr_operand" "=f")
5642 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f")
5643 (match_operand:SI 2 "fpr_operand" "f")]
5647 [(set_attr "length" "4")
5648 (set_attr "type" "maveh")])
5650 ;; Dual saturation (halfword): type "msath"
5652 (define_expand "msaths"
5653 [(set (match_operand:SI 0 "fpr_operand" "=f")
5654 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f")
5655 (match_operand:SI 2 "fpr_operand" "f")
5659 "operands[3] = GEN_INT (FRV_BUILTIN_MSATHS);")
5661 (define_expand "msathu"
5662 [(set (match_operand:SI 0 "fpr_operand" "=f")
5663 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f")
5664 (match_operand:SI 2 "fpr_operand" "f")
5668 "operands[3] = GEN_INT (FRV_BUILTIN_MSATHU);")
5670 (define_insn "*msath"
5671 [(set (match_operand:SI 0 "fpr_operand" "=f")
5672 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f")
5673 (match_operand:SI 2 "fpr_operand" "f")
5674 (match_operand:SI 3 "const_int_operand" "n")]
5679 switch (INTVAL (operands[3]))
5682 case FRV_BUILTIN_MSATHS: return \"msaths %1, %2, %0\";
5683 case FRV_BUILTIN_MSATHU: return \"msathu %1, %2, %0\";
5686 fatal_insn (\"Bad media insn, msath\", insn);
5688 [(set_attr "length" "4")
5689 (set_attr "type" "msath")])
5691 ;; Dual addition/subtraction with saturation (halfword): type "maddh"
5693 (define_expand "maddhss"
5694 [(set (match_operand:SI 0 "fpr_operand" "=f")
5695 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f")
5696 (match_operand:SI 2 "fpr_operand" "f")
5700 "operands[3] = GEN_INT (FRV_BUILTIN_MADDHSS);")
5702 (define_expand "maddhus"
5703 [(set (match_operand:SI 0 "fpr_operand" "=f")
5704 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f")
5705 (match_operand:SI 2 "fpr_operand" "f")
5709 "operands[3] = GEN_INT (FRV_BUILTIN_MADDHUS);")
5711 (define_expand "msubhss"
5712 [(set (match_operand:SI 0 "fpr_operand" "=f")
5713 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f")
5714 (match_operand:SI 2 "fpr_operand" "f")
5718 "operands[3] = GEN_INT (FRV_BUILTIN_MSUBHSS);")
5720 (define_expand "msubhus"
5721 [(set (match_operand:SI 0 "fpr_operand" "=f")
5722 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f")
5723 (match_operand:SI 2 "fpr_operand" "f")
5727 "operands[3] = GEN_INT (FRV_BUILTIN_MSUBHUS);")
5729 (define_insn "*maddh"
5730 [(set (match_operand:SI 0 "fpr_operand" "=f")
5731 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f")
5732 (match_operand:SI 2 "fpr_operand" "f")
5733 (match_operand:SI 3 "const_int_operand" "n")]
5738 switch (INTVAL (operands[3]))
5741 case FRV_BUILTIN_MADDHSS: return \"maddhss %1, %2, %0\";
5742 case FRV_BUILTIN_MADDHUS: return \"maddhus %1, %2, %0\";
5743 case FRV_BUILTIN_MSUBHSS: return \"msubhss %1, %2, %0\";
5744 case FRV_BUILTIN_MSUBHUS: return \"msubhus %1, %2, %0\";
5747 fatal_insn (\"Bad media insn, maddh\", insn);
5749 [(set_attr "length" "4")
5750 (set_attr "type" "maddh")])
5752 (define_insn "*cond_exec_maddh"
5754 (match_operator 0 "ccr_eqne_operator"
5755 [(match_operand 1 "cr_operand" "C")
5757 (set (match_operand:SI 2 "fpr_operand" "=f")
5758 (unspec:SI [(match_operand:SI 3 "fpr_operand" "f")
5759 (match_operand:SI 4 "fpr_operand" "f")
5760 (match_operand:SI 5 "const_int_operand" "n")]
5765 switch (INTVAL (operands[5]))
5768 case FRV_BUILTIN_MADDHSS: return \"cmaddhss %3, %4, %2, %1, %e0\";
5769 case FRV_BUILTIN_MADDHUS: return \"cmaddhus %3, %4, %2, %1, %e0\";
5770 case FRV_BUILTIN_MSUBHSS: return \"cmsubhss %3, %4, %2, %1, %e0\";
5771 case FRV_BUILTIN_MSUBHUS: return \"cmsubhus %3, %4, %2, %1, %e0\";
5774 fatal_insn (\"Bad media insn, cond_exec_maddh\", insn);
5776 [(set_attr "length" "4")
5777 (set_attr "type" "maddh")])
5779 ;; Quad addition/subtraction with saturation (halfword): type "mqaddh"
5781 (define_expand "mqaddhss"
5782 [(set (match_operand:DI 0 "even_fpr_operand" "=h")
5783 (unspec:DI [(match_operand:DI 1 "even_fpr_operand" "h")
5784 (match_operand:DI 2 "even_fpr_operand" "h")
5788 "operands[3] = GEN_INT (FRV_BUILTIN_MQADDHSS);")
5790 (define_expand "mqaddhus"
5791 [(set (match_operand:DI 0 "even_fpr_operand" "=h")
5792 (unspec:DI [(match_operand:DI 1 "even_fpr_operand" "h")
5793 (match_operand:DI 2 "even_fpr_operand" "h")
5797 "operands[3] = GEN_INT (FRV_BUILTIN_MQADDHUS);")
5799 (define_expand "mqsubhss"
5800 [(set (match_operand:DI 0 "even_fpr_operand" "=h")
5801 (unspec:DI [(match_operand:DI 1 "even_fpr_operand" "h")
5802 (match_operand:DI 2 "even_fpr_operand" "h")
5806 "operands[3] = GEN_INT (FRV_BUILTIN_MQSUBHSS);")
5808 (define_expand "mqsubhus"
5809 [(set (match_operand:DI 0 "even_fpr_operand" "=h")
5810 (unspec:DI [(match_operand:DI 1 "even_fpr_operand" "h")
5811 (match_operand:DI 2 "even_fpr_operand" "h")
5815 "operands[3] = GEN_INT (FRV_BUILTIN_MQSUBHUS);")
5817 (define_insn "*mqaddh"
5818 [(set (match_operand:DI 0 "even_fpr_operand" "=h")
5819 (unspec:DI [(match_operand:DI 1 "even_fpr_operand" "h")
5820 (match_operand:DI 2 "even_fpr_operand" "h")
5821 (match_operand:SI 3 "const_int_operand" "n")]
5826 switch (INTVAL (operands[3]))
5829 case FRV_BUILTIN_MQADDHSS: return \"mqaddhss %1, %2, %0\";
5830 case FRV_BUILTIN_MQADDHUS: return \"mqaddhus %1, %2, %0\";
5831 case FRV_BUILTIN_MQSUBHSS: return \"mqsubhss %1, %2, %0\";
5832 case FRV_BUILTIN_MQSUBHUS: return \"mqsubhus %1, %2, %0\";
5835 fatal_insn (\"Bad media insn, mqaddh\", insn);
5837 [(set_attr "length" "4")
5838 (set_attr "type" "mqaddh")])
5840 (define_insn "*cond_exec_mqaddh"
5842 (match_operator 0 "ccr_eqne_operator"
5843 [(match_operand 1 "cr_operand" "C")
5845 (set (match_operand:DI 2 "even_fpr_operand" "=h")
5846 (unspec:DI [(match_operand:DI 3 "even_fpr_operand" "h")
5847 (match_operand:DI 4 "even_fpr_operand" "h")
5848 (match_operand:SI 5 "const_int_operand" "n")]
5853 switch (INTVAL (operands[5]))
5856 case FRV_BUILTIN_MQADDHSS: return \"cmqaddhss %3, %4, %2, %1, %e0\";
5857 case FRV_BUILTIN_MQADDHUS: return \"cmqaddhus %3, %4, %2, %1, %e0\";
5858 case FRV_BUILTIN_MQSUBHSS: return \"cmqsubhss %3, %4, %2, %1, %e0\";
5859 case FRV_BUILTIN_MQSUBHUS: return \"cmqsubhus %3, %4, %2, %1, %e0\";
5862 fatal_insn (\"Bad media insn, cond_exec_mqaddh\", insn);
5864 [(set_attr "length" "4")
5865 (set_attr "type" "mqaddh")])
5867 ;; Pack halfword: type "mpackh"
5869 (define_insn "mpackh"
5870 [(set (match_operand:SI 0 "fpr_operand" "=f")
5871 (unspec:SI [(match_operand:HI 1 "fpr_operand" "f")
5872 (match_operand:HI 2 "fpr_operand" "f")]
5876 [(set_attr "length" "4")
5877 (set_attr "type" "mpackh")])
5879 ;; Unpack halfword: type "mpackh"
5881 (define_insn "munpackh"
5882 [(set (match_operand:DI 0 "even_fpr_operand" "=h")
5883 (unspec:DI [(match_operand:SI 1 "fpr_operand" "f")]
5887 [(set_attr "length" "4")
5888 (set_attr "type" "munpackh")])
5890 ;; Dual pack halfword: type "mdpackh"
5892 (define_insn "mdpackh"
5893 [(set (match_operand:DI 0 "even_fpr_operand" "=h")
5894 (unspec:DI [(match_operand:DI 1 "even_fpr_operand" "h")
5895 (match_operand:DI 2 "even_fpr_operand" "h")]
5898 "mdpackh %1, %2, %0"
5899 [(set_attr "length" "4")
5900 (set_attr "type" "mdpackh")])
5902 ;; Byte-halfword conversion: type "mbhconv"
5904 (define_insn "mbtoh"
5905 [(set (match_operand:DI 0 "even_fpr_operand" "=h")
5906 (unspec:DI [(match_operand:SI 1 "fpr_operand" "f")]
5910 [(set_attr "length" "4")
5911 (set_attr "type" "mbhconv")])
5913 (define_insn "*cond_exec_mbtoh"
5915 (match_operator 0 "ccr_eqne_operator"
5916 [(match_operand 1 "cr_operand" "C")
5918 (set (match_operand:DI 2 "even_fpr_operand" "=h")
5919 (unspec:DI [(match_operand:SI 3 "fpr_operand" "f")]
5922 "cmbtoh %3, %2, %1, %e0"
5923 [(set_attr "length" "4")
5924 (set_attr "type" "mbhconv")])
5926 (define_insn "mhtob"
5927 [(set (match_operand:SI 0 "fpr_operand" "=f")
5928 (unspec:SI [(match_operand:DI 1 "even_fpr_operand" "h")]
5932 [(set_attr "length" "4")
5933 (set_attr "type" "mbhconv")])
5935 (define_insn "*cond_exec_mhtob"
5937 (match_operator 0 "ccr_eqne_operator"
5938 [(match_operand 1 "cr_operand" "C")
5940 (set (match_operand:SI 2 "fpr_operand" "=f")
5941 (unspec:SI [(match_operand:DI 3 "even_fpr_operand" "h")]
5944 "cmhtob %3, %2, %1, %e0"
5945 [(set_attr "length" "4")
5946 (set_attr "type" "mbhconv")])
5948 ;; Rotate: type "mrot"
5950 (define_expand "mrotli"
5951 [(set (match_operand:SI 0 "fpr_operand" "")
5952 (unspec:SI [(match_operand:SI 1 "fpr_operand" "")
5953 (match_operand:SI 2 "uint5_operand" "")
5957 "operands[3] = GEN_INT (FRV_BUILTIN_MROTLI);")
5959 (define_expand "mrotri"
5960 [(set (match_operand:SI 0 "fpr_operand" "")
5961 (unspec:SI [(match_operand:SI 1 "fpr_operand" "")
5962 (match_operand:SI 2 "uint5_operand" "")
5966 "operands[3] = GEN_INT (FRV_BUILTIN_MROTRI);")
5968 (define_insn "*mrot"
5969 [(set (match_operand:SI 0 "fpr_operand" "=f")
5970 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f")
5971 (match_operand:SI 2 "uint5_operand" "I")
5972 (match_operand:SI 3 "const_int_operand" "n")]
5977 switch (INTVAL (operands[3]))
5980 case FRV_BUILTIN_MROTLI: return \"mrotli %1, %2, %0\";
5981 case FRV_BUILTIN_MROTRI: return \"mrotri %1, %2, %0\";
5984 fatal_insn (\"Bad media insn, mrot\", insn);
5986 [(set_attr "length" "4")
5987 (set_attr "type" "mrot")])
5989 ;; Dual shift halfword: type "msh"
5991 (define_expand "msllhi"
5992 [(set (match_operand:SI 0 "fpr_operand" "")
5993 (unspec:SI [(match_operand:SI 1 "fpr_operand" "")
5994 (match_operand:SI 2 "uint4_operand" "")
5998 "operands[3] = GEN_INT (FRV_BUILTIN_MSLLHI);")
6000 (define_expand "msrlhi"
6001 [(set (match_operand:SI 0 "fpr_operand" "")
6002 (unspec:SI [(match_operand:SI 1 "fpr_operand" "")
6003 (match_operand:SI 2 "uint4_operand" "")
6007 "operands[3] = GEN_INT (FRV_BUILTIN_MSRLHI);")
6009 (define_expand "msrahi"
6010 [(set (match_operand:SI 0 "fpr_operand" "")
6011 (unspec:SI [(match_operand:SI 1 "fpr_operand" "")
6012 (match_operand:SI 2 "uint4_operand" "")
6016 "operands[3] = GEN_INT (FRV_BUILTIN_MSRAHI);")
6018 (define_insn "*mshift"
6019 [(set (match_operand:SI 0 "fpr_operand" "=f")
6020 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f")
6021 (match_operand:SI 2 "uint4_operand" "I")
6022 (match_operand:SI 3 "const_int_operand" "n")]
6027 switch (INTVAL (operands[3]))
6030 case FRV_BUILTIN_MSLLHI: return \"msllhi %1, %2, %0\";
6031 case FRV_BUILTIN_MSRLHI: return \"msrlhi %1, %2, %0\";
6032 case FRV_BUILTIN_MSRAHI: return \"msrahi %1, %2, %0\";
6035 fatal_insn (\"Bad media insn, mshift\", insn);
6037 [(set_attr "length" "4")
6038 (set_attr "type" "mshift")])
6040 ;; Expand halfword to word: type "mexpdhw"
6042 (define_insn "mexpdhw"
6043 [(set (match_operand:SI 0 "fpr_operand" "=f")
6044 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f")
6045 (match_operand:SI 2 "uint1_operand" "I")]
6048 "mexpdhw %1, %2, %0"
6049 [(set_attr "length" "4")
6050 (set_attr "type" "mexpdhw")])
6052 (define_insn "*cond_exec_mexpdhw"
6054 (match_operator 0 "ccr_eqne_operator"
6055 [(match_operand 1 "cr_operand" "C")
6057 (set (match_operand:SI 2 "fpr_operand" "=f")
6058 (unspec:SI [(match_operand:SI 3 "fpr_operand" "f")
6059 (match_operand:SI 4 "uint1_operand" "I")]
6062 "cmexpdhw %3, %4, %2, %1, %e0"
6063 [(set_attr "length" "4")
6064 (set_attr "type" "mexpdhw")])
6066 ;; Expand halfword to double: type "mexpdhd"
6068 (define_insn "mexpdhd"
6069 [(set (match_operand:DI 0 "even_fpr_operand" "=h")
6070 (unspec:DI [(match_operand:SI 1 "fpr_operand" "f")
6071 (match_operand:SI 2 "uint1_operand" "I")]
6074 "mexpdhd %1, %2, %0"
6075 [(set_attr "length" "4")
6076 (set_attr "type" "mexpdhd")])
6078 (define_insn "*cond_exec_mexpdhd"
6080 (match_operator 0 "ccr_eqne_operator"
6081 [(match_operand 1 "cr_operand" "C")
6083 (set (match_operand:DI 2 "even_fpr_operand" "=h")
6084 (unspec:DI [(match_operand:SI 3 "fpr_operand" "f")
6085 (match_operand:SI 4 "uint1_operand" "I")]
6088 "cmexpdhd %3, %4, %2, %1, %e0"
6089 [(set_attr "length" "4")
6090 (set_attr "type" "mexpdhd")])
6092 ;; FR cut: type "mwcut"
6094 (define_insn "mwcut"
6095 [(set (match_operand:SI 0 "fpr_operand" "=f")
6096 (unspec:SI [(match_operand:DI 1 "fpr_operand" "f")
6097 (match_operand:SI 2 "fpr_or_int6_operand" "fI")]
6100 "mwcut%i2 %1, %2, %0"
6101 [(set_attr "length" "4")
6102 (set_attr "type" "mwcut")])
6104 ;; Dual multiplication (halfword): type "mmulh"
6106 (define_expand "mmulhs"
6107 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "=b")
6108 (unspec:DI [(match_operand:SI 1 "fpr_operand" "f")
6109 (match_operand:SI 2 "fpr_operand" "f")
6112 (set (match_operand:HI 3 "accg_operand" "=B")
6113 (unspec:HI [(const_int 0)] UNSPEC_MMULH))])]
6115 "operands[4] = GEN_INT (FRV_BUILTIN_MMULHS);")
6117 (define_expand "mmulhu"
6118 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "=b")
6119 (unspec:DI [(match_operand:SI 1 "fpr_operand" "f")
6120 (match_operand:SI 2 "fpr_operand" "f")
6123 (set (match_operand:HI 3 "accg_operand" "=B")
6124 (unspec:HI [(const_int 0)] UNSPEC_MMULH))])]
6126 "operands[4] = GEN_INT (FRV_BUILTIN_MMULHU);")
6128 (define_insn "*mmulh"
6129 [(set (match_operand:DI 0 "even_acc_operand" "=b")
6130 (unspec:DI [(match_operand:SI 1 "fpr_operand" "f")
6131 (match_operand:SI 2 "fpr_operand" "f")
6132 (match_operand:SI 3 "const_int_operand" "n")]
6134 (set (match_operand:HI 4 "accg_operand" "=B")
6135 (unspec:HI [(const_int 0)] UNSPEC_MMULH))]
6139 switch (INTVAL (operands[3]))
6142 case FRV_BUILTIN_MMULHS: return \"mmulhs %1, %2, %0\";
6143 case FRV_BUILTIN_MMULHU: return \"mmulhu %1, %2, %0\";
6146 fatal_insn (\"Bad media insn, mmulh\", insn);
6148 [(set_attr "length" "4")
6149 (set_attr "type" "mmulh")])
6151 (define_insn "*cond_exec_mmulh"
6153 (match_operator 0 "ccr_eqne_operator"
6154 [(match_operand 1 "cr_operand" "C")
6156 (parallel [(set (match_operand:DI 2 "even_acc_operand" "=b")
6157 (unspec:DI [(match_operand:SI 3 "fpr_operand" "f")
6158 (match_operand:SI 4 "fpr_operand" "f")
6159 (match_operand:SI 5 "const_int_operand" "n")]
6161 (set (match_operand:HI 6 "accg_operand" "=B")
6162 (unspec:HI [(const_int 0)] UNSPEC_MMULH))]))]
6166 switch (INTVAL (operands[5]))
6169 case FRV_BUILTIN_MMULHS: return \"cmmulhs %3, %4, %2, %1, %e0\";
6170 case FRV_BUILTIN_MMULHU: return \"cmmulhu %3, %4, %2, %1, %e0\";
6173 fatal_insn (\"Bad media insn, cond_exec_mmulh\", insn);
6175 [(set_attr "length" "4")
6176 (set_attr "type" "mmulh")])
6178 ;; Dual cross multiplication (halfword): type "mmulxh"
6180 (define_expand "mmulxhs"
6181 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "=b")
6182 (unspec:DI [(match_operand:SI 1 "fpr_operand" "f")
6183 (match_operand:SI 2 "fpr_operand" "f")
6186 (set (match_operand:HI 3 "accg_operand" "=B")
6187 (unspec:HI [(const_int 0)] UNSPEC_MMULXH))])]
6189 "operands[4] = GEN_INT (FRV_BUILTIN_MMULXHS);")
6191 (define_expand "mmulxhu"
6192 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "=b")
6193 (unspec:DI [(match_operand:SI 1 "fpr_operand" "f")
6194 (match_operand:SI 2 "fpr_operand" "f")
6197 (set (match_operand:HI 3 "accg_operand" "=B")
6198 (unspec:HI [(const_int 0)] UNSPEC_MMULXH))])]
6200 "operands[4] = GEN_INT (FRV_BUILTIN_MMULXHU);")
6202 (define_insn "*mmulxh"
6203 [(set (match_operand:DI 0 "even_acc_operand" "=b")
6204 (unspec:DI [(match_operand:SI 1 "fpr_operand" "f")
6205 (match_operand:SI 2 "fpr_operand" "f")
6206 (match_operand:SI 3 "const_int_operand" "n")]
6208 (set (match_operand:HI 4 "accg_operand" "=B")
6209 (unspec:HI [(const_int 0)] UNSPEC_MMULXH))]
6213 switch (INTVAL (operands[3]))
6216 case FRV_BUILTIN_MMULXHS: return \"mmulxhs %1, %2, %0\";
6217 case FRV_BUILTIN_MMULXHU: return \"mmulxhu %1, %2, %0\";
6220 fatal_insn (\"Bad media insn, mmulxh\", insn);
6222 [(set_attr "length" "4")
6223 (set_attr "type" "mmulxh")])
6225 ;; Dual product-sum (halfword): type "mmach"
6227 (define_expand "mmachs"
6228 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "+b")
6229 (unspec:DI [(match_dup 0)
6230 (match_operand:SI 1 "fpr_operand" "f")
6231 (match_operand:SI 2 "fpr_operand" "f")
6232 (match_operand:HI 3 "accg_operand" "+B")
6236 (unspec:HI [(const_int 0)] UNSPEC_MMACH))])]
6238 "operands[4] = GEN_INT (FRV_BUILTIN_MMACHS);")
6240 (define_expand "mmachu"
6241 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "+b")
6242 (unspec:DI [(match_dup 0)
6243 (match_operand:SI 1 "fpr_operand" "f")
6244 (match_operand:SI 2 "fpr_operand" "f")
6245 (match_operand:HI 3 "accg_operand" "+B")
6249 (unspec:HI [(const_int 0)] UNSPEC_MMACH))])]
6251 "operands[4] = GEN_INT (FRV_BUILTIN_MMACHU);")
6253 (define_insn "*mmach"
6254 [(set (match_operand:DI 0 "even_acc_operand" "+b")
6255 (unspec:DI [(match_dup 0)
6256 (match_operand:SI 1 "fpr_operand" "f")
6257 (match_operand:SI 2 "fpr_operand" "f")
6258 (match_operand:HI 3 "accg_operand" "+B")
6259 (match_operand:SI 4 "const_int_operand" "n")]
6261 (set (match_dup 3) (unspec:HI [(const_int 0)] UNSPEC_MMACH))]
6265 switch (INTVAL (operands[4]))
6268 case FRV_BUILTIN_MMACHS: return \"mmachs %1, %2, %0\";
6269 case FRV_BUILTIN_MMACHU: return \"mmachu %1, %2, %0\";
6272 fatal_insn (\"Bad media insn, mmach\", insn);
6274 [(set_attr "length" "4")
6275 (set_attr "type" "mmach")])
6277 (define_insn "*cond_exec_mmach"
6279 (match_operator 0 "ccr_eqne_operator"
6280 [(match_operand 1 "cr_operand" "C")
6282 (parallel [(set (match_operand:DI 2 "even_acc_operand" "+b")
6283 (unspec:DI [(match_dup 2)
6284 (match_operand:SI 3 "fpr_operand" "f")
6285 (match_operand:SI 4 "fpr_operand" "f")
6286 (match_operand:HI 5 "accg_operand" "+B")
6287 (match_operand:SI 6 "const_int_operand" "n")]
6290 (unspec:HI [(const_int 0)] UNSPEC_MMACH))]))]
6294 switch (INTVAL (operands[6]))
6297 case FRV_BUILTIN_MMACHS: return \"cmmachs %3, %4, %2, %1, %e0\";
6298 case FRV_BUILTIN_MMACHU: return \"cmmachu %3, %4, %2, %1, %e0\";
6301 fatal_insn (\"Bad media insn, cond_exec_mmach\", insn);
6303 [(set_attr "length" "4")
6304 (set_attr "type" "mmach")])
6306 ;; Dual product-difference: type "mmrdh"
6308 (define_expand "mmrdhs"
6309 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "+b")
6310 (unspec:DI [(match_dup 0)
6311 (match_operand:SI 1 "fpr_operand" "f")
6312 (match_operand:SI 2 "fpr_operand" "f")
6313 (match_operand:HI 3 "accg_operand" "+B")
6317 (unspec:HI [(const_int 0)] UNSPEC_MMRDH))])]
6319 "operands[4] = GEN_INT (FRV_BUILTIN_MMRDHS);")
6321 (define_expand "mmrdhu"
6322 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "+b")
6323 (unspec:DI [(match_dup 0)
6324 (match_operand:SI 1 "fpr_operand" "f")
6325 (match_operand:SI 2 "fpr_operand" "f")
6326 (match_operand:HI 3 "accg_operand" "+B")
6330 (unspec:HI [(const_int 0)] UNSPEC_MMRDH))])]
6332 "operands[4] = GEN_INT (FRV_BUILTIN_MMRDHU);")
6334 (define_insn "*mmrdh"
6335 [(set (match_operand:DI 0 "even_acc_operand" "+b")
6336 (unspec:DI [(match_dup 0)
6337 (match_operand:SI 1 "fpr_operand" "f")
6338 (match_operand:SI 2 "fpr_operand" "f")
6339 (match_operand:HI 3 "accg_operand" "+B")
6340 (match_operand:SI 4 "const_int_operand" "n")]
6343 (unspec:HI [(const_int 0)] UNSPEC_MMRDH))]
6347 switch (INTVAL (operands[4]))
6350 case FRV_BUILTIN_MMRDHS: return \"mmrdhs %1, %2, %0\";
6351 case FRV_BUILTIN_MMRDHU: return \"mmrdhu %1, %2, %0\";
6354 fatal_insn (\"Bad media insn, mrdh\", insn);
6356 [(set_attr "length" "4")
6357 (set_attr "type" "mmrdh")])
6359 ;; Quad multiply (halfword): type "mqmulh"
6361 (define_expand "mqmulhs"
6362 [(parallel [(set (match_operand:V4SI 0 "quad_acc_operand" "=A")
6363 (unspec:V4SI [(match_operand:DI 1 "even_fpr_operand" "h")
6364 (match_operand:DI 2 "even_fpr_operand" "h")
6367 (set (match_operand:V4QI 3 "accg_operand" "=B")
6368 (unspec:V4QI [(const_int 0)] UNSPEC_MQMULH))])]
6370 "operands[4] = GEN_INT (FRV_BUILTIN_MQMULHS);")
6372 (define_expand "mqmulhu"
6373 [(parallel [(set (match_operand:V4SI 0 "quad_acc_operand" "=A")
6374 (unspec:V4SI [(match_operand:DI 1 "even_fpr_operand" "h")
6375 (match_operand:DI 2 "even_fpr_operand" "h")
6378 (set (match_operand:V4QI 3 "accg_operand" "=B")
6379 (unspec:V4QI [(const_int 0)] UNSPEC_MQMULH))])]
6381 "operands[4] = GEN_INT (FRV_BUILTIN_MQMULHU);")
6383 (define_insn "*mqmulh"
6384 [(set (match_operand:V4SI 0 "quad_acc_operand" "=A")
6385 (unspec:V4SI [(match_operand:DI 1 "even_fpr_operand" "h")
6386 (match_operand:DI 2 "even_fpr_operand" "h")
6387 (match_operand:SI 3 "const_int_operand" "n")]
6389 (set (match_operand:V4QI 4 "accg_operand" "=B")
6390 (unspec:V4QI [(const_int 0)] UNSPEC_MQMULH))]
6394 switch (INTVAL (operands[3]))
6397 case FRV_BUILTIN_MQMULHS: return \"mqmulhs %1, %2, %0\";
6398 case FRV_BUILTIN_MQMULHU: return \"mqmulhu %1, %2, %0\";
6401 fatal_insn (\"Bad media insn, mqmulh\", insn);
6403 [(set_attr "length" "4")
6404 (set_attr "type" "mqmulh")])
6406 (define_insn "*cond_exec_mqmulh"
6408 (match_operator 0 "ccr_eqne_operator"
6409 [(match_operand 1 "cr_operand" "C")
6411 (parallel [(set (match_operand:V4SI 2 "quad_acc_operand" "=A")
6412 (unspec:V4SI [(match_operand:DI 3 "even_fpr_operand" "h")
6413 (match_operand:DI 4 "even_fpr_operand" "h")
6414 (match_operand:SI 5 "const_int_operand" "n")]
6416 (set (match_operand:V4QI 6 "accg_operand" "=B")
6417 (unspec:V4QI [(const_int 0)] UNSPEC_MQMULH))]))]
6421 switch (INTVAL (operands[5]))
6424 case FRV_BUILTIN_MQMULHS: return \"cmqmulhs %3, %4, %2, %1, %e0\";
6425 case FRV_BUILTIN_MQMULHU: return \"cmqmulhu %3, %4, %2, %1, %e0\";
6428 fatal_insn (\"Bad media insn, cond_exec_mqmulh\", insn);
6430 [(set_attr "length" "4")
6431 (set_attr "type" "mqmulh")])
6433 ;; Quad cross multiply (halfword): type "mqmulxh"
6435 (define_expand "mqmulxhs"
6436 [(parallel [(set (match_operand:V4SI 0 "quad_acc_operand" "=A")
6437 (unspec:V4SI [(match_operand:DI 1 "even_fpr_operand" "h")
6438 (match_operand:DI 2 "even_fpr_operand" "h")
6441 (set (match_operand:V4QI 3 "accg_operand" "=B")
6442 (unspec:V4QI [(const_int 0)] UNSPEC_MQMULXH))])]
6444 "operands[4] = GEN_INT (FRV_BUILTIN_MQMULXHS);")
6446 (define_expand "mqmulxhu"
6447 [(parallel [(set (match_operand:V4SI 0 "quad_acc_operand" "=A")
6448 (unspec:V4SI [(match_operand:DI 1 "even_fpr_operand" "h")
6449 (match_operand:DI 2 "even_fpr_operand" "h")
6452 (set (match_operand:V4QI 3 "accg_operand" "=B")
6453 (unspec:V4QI [(const_int 0)] UNSPEC_MQMULXH))])]
6455 "operands[4] = GEN_INT (FRV_BUILTIN_MQMULXHU);")
6457 (define_insn "*mqmulxh"
6458 [(set (match_operand:V4SI 0 "quad_acc_operand" "=A")
6459 (unspec:V4SI [(match_operand:DI 1 "even_fpr_operand" "h")
6460 (match_operand:DI 2 "even_fpr_operand" "h")
6461 (match_operand:SI 3 "const_int_operand" "n")]
6463 (set (match_operand:V4QI 4 "accg_operand" "=B")
6464 (unspec:V4QI [(const_int 0)] UNSPEC_MQMULXH))]
6468 switch (INTVAL (operands[3]))
6471 case FRV_BUILTIN_MQMULXHS: return \"mqmulxhs %1, %2, %0\";
6472 case FRV_BUILTIN_MQMULXHU: return \"mqmulxhu %1, %2, %0\";
6475 fatal_insn (\"Bad media insn, mqmulxh\", insn);
6477 [(set_attr "length" "4")
6478 (set_attr "type" "mqmulxh")])
6480 ;; Quad product-sum (halfword): type "mqmach"
6482 (define_expand "mqmachs"
6483 [(parallel [(set (match_operand:V4SI 0 "even_acc_operand" "+A")
6484 (unspec:V4SI [(match_dup 0)
6485 (match_operand:DI 1 "even_fpr_operand" "h")
6486 (match_operand:DI 2 "even_fpr_operand" "h")
6487 (match_operand:V4QI 3 "accg_operand" "+B")
6491 (unspec:V4QI [(const_int 0)] UNSPEC_MQMACH))])]
6493 "operands[4] = GEN_INT (FRV_BUILTIN_MQMACHS);")
6495 (define_expand "mqmachu"
6496 [(parallel [(set (match_operand:V4SI 0 "even_acc_operand" "+A")
6497 (unspec:V4SI [(match_dup 0)
6498 (match_operand:DI 1 "even_fpr_operand" "h")
6499 (match_operand:DI 2 "even_fpr_operand" "h")
6500 (match_operand:V4QI 3 "accg_operand" "+B")
6504 (unspec:V4QI [(const_int 0)] UNSPEC_MQMACH))])]
6506 "operands[4] = GEN_INT (FRV_BUILTIN_MQMACHU);")
6508 (define_insn "*mqmach"
6509 [(set (match_operand:V4SI 0 "even_acc_operand" "+A")
6510 (unspec:V4SI [(match_dup 0)
6511 (match_operand:DI 1 "even_fpr_operand" "h")
6512 (match_operand:DI 2 "even_fpr_operand" "h")
6513 (match_operand:V4QI 3 "accg_operand" "+B")
6514 (match_operand:SI 4 "const_int_operand" "n")]
6517 (unspec:V4QI [(const_int 0)] UNSPEC_MQMACH))]
6521 switch (INTVAL (operands[4]))
6524 case FRV_BUILTIN_MQMACHS: return \"mqmachs %1, %2, %0\";
6525 case FRV_BUILTIN_MQMACHU: return \"mqmachu %1, %2, %0\";
6528 fatal_insn (\"Bad media insn, mqmach\", insn);
6530 [(set_attr "length" "4")
6531 (set_attr "type" "mqmach")])
6533 (define_insn "*cond_exec_mqmach"
6535 (match_operator 0 "ccr_eqne_operator"
6536 [(match_operand 1 "cr_operand" "C")
6538 (parallel [(set (match_operand:V4SI 2 "even_acc_operand" "+A")
6539 (unspec:V4SI [(match_dup 2)
6540 (match_operand:DI 3 "even_fpr_operand" "h")
6541 (match_operand:DI 4 "even_fpr_operand" "h")
6542 (match_operand:V4QI 5 "accg_operand" "+B")
6543 (match_operand:SI 6 "const_int_operand" "n")]
6546 (unspec:V4QI [(const_int 0)] UNSPEC_MQMACH))]))]
6550 switch (INTVAL (operands[6]))
6553 case FRV_BUILTIN_MQMACHS: return \"cmqmachs %3, %4, %2, %1, %e0\";
6554 case FRV_BUILTIN_MQMACHU: return \"cmqmachu %3, %4, %2, %1, %e0\";
6557 fatal_insn (\"Bad media insn, cond_exec_mqmach\", insn);
6559 [(set_attr "length" "4")
6560 (set_attr "type" "mqmach")])
6562 ;; Dual complex number product-sum (halfword)
6564 (define_expand "mcpxrs"
6565 [(parallel [(set (match_operand:SI 0 "acc_operand" "=a")
6566 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f")
6567 (match_operand:SI 2 "fpr_operand" "f")
6570 (set (match_operand:QI 3 "accg_operand" "=B")
6571 (unspec:QI [(const_int 0)] UNSPEC_MCPX))])]
6573 "operands[4] = GEN_INT (FRV_BUILTIN_MCPXRS);")
6575 (define_expand "mcpxru"
6576 [(parallel [(set (match_operand:SI 0 "acc_operand" "=a")
6577 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f")
6578 (match_operand:SI 2 "fpr_operand" "f")
6581 (set (match_operand:QI 3 "accg_operand" "=B")
6582 (unspec:QI [(const_int 0)] UNSPEC_MCPX))])]
6584 "operands[4] = GEN_INT (FRV_BUILTIN_MCPXRU);")
6586 (define_expand "mcpxis"
6587 [(parallel [(set (match_operand:SI 0 "acc_operand" "=a")
6588 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f")
6589 (match_operand:SI 2 "fpr_operand" "f")
6592 (set (match_operand:QI 3 "accg_operand" "=B")
6593 (unspec:QI [(const_int 0)] UNSPEC_MCPX))])]
6595 "operands[4] = GEN_INT (FRV_BUILTIN_MCPXIS);")
6597 (define_expand "mcpxiu"
6598 [(parallel [(set (match_operand:SI 0 "acc_operand" "=a")
6599 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f")
6600 (match_operand:SI 2 "fpr_operand" "f")
6603 (set (match_operand:QI 3 "accg_operand" "=B")
6604 (unspec:QI [(const_int 0)] UNSPEC_MCPX))])]
6606 "operands[4] = GEN_INT (FRV_BUILTIN_MCPXIU);")
6608 (define_insn "*mcpx"
6609 [(parallel [(set (match_operand:SI 0 "acc_operand" "=a")
6610 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f")
6611 (match_operand:SI 2 "fpr_operand" "f")
6612 (match_operand:SI 3 "const_int_operand" "n")]
6614 (set (match_operand:QI 4 "accg_operand" "=B")
6615 (unspec:QI [(const_int 0)] UNSPEC_MCPX))])]
6619 switch (INTVAL (operands[3]))
6622 case FRV_BUILTIN_MCPXRS: return \"mcpxrs %1, %2, %0\";
6623 case FRV_BUILTIN_MCPXRU: return \"mcpxru %1, %2, %0\";
6624 case FRV_BUILTIN_MCPXIS: return \"mcpxis %1, %2, %0\";
6625 case FRV_BUILTIN_MCPXIU: return \"mcpxiu %1, %2, %0\";
6628 fatal_insn (\"Bad media insn, mcpx\", insn);
6630 [(set_attr "length" "4")
6631 (set_attr "type" "mcpx")])
6633 (define_insn "*cond_exec_mcpx"
6635 (match_operator 0 "ccr_eqne_operator"
6636 [(match_operand 1 "cr_operand" "C")
6638 (parallel [(set (match_operand:SI 2 "acc_operand" "=a")
6639 (unspec:SI [(match_operand:SI 3 "fpr_operand" "f")
6640 (match_operand:SI 4 "fpr_operand" "f")
6641 (match_operand:SI 5 "const_int_operand" "n")]
6643 (set (match_operand:QI 6 "accg_operand" "=B")
6644 (unspec:QI [(const_int 0)] UNSPEC_MCPX))]))]
6648 switch (INTVAL (operands[5]))
6651 case FRV_BUILTIN_MCPXRS: return \"cmcpxrs %3, %4, %2, %1, %e0\";
6652 case FRV_BUILTIN_MCPXRU: return \"cmcpxru %3, %4, %2, %1, %e0\";
6653 case FRV_BUILTIN_MCPXIS: return \"cmcpxis %3, %4, %2, %1, %e0\";
6654 case FRV_BUILTIN_MCPXIU: return \"cmcpxiu %3, %4, %2, %1, %e0\";
6657 fatal_insn (\"Bad media insn, cond_exec_mcpx\", insn);
6659 [(set_attr "length" "4")
6660 (set_attr "type" "mcpx")])
6662 ;; Quad complex number product-sum (halfword): type "mqcpx"
6664 (define_expand "mqcpxrs"
6665 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "=b")
6666 (unspec:DI [(match_operand:DI 1 "fpr_operand" "f")
6667 (match_operand:DI 2 "fpr_operand" "f")
6670 (set (match_operand:HI 3 "accg_operand" "=B")
6671 (unspec:HI [(const_int 0)] UNSPEC_MQCPX))])]
6673 "operands[4] = GEN_INT (FRV_BUILTIN_MQCPXRS);")
6675 (define_expand "mqcpxru"
6676 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "=b")
6677 (unspec:DI [(match_operand:DI 1 "fpr_operand" "f")
6678 (match_operand:DI 2 "fpr_operand" "f")
6681 (set (match_operand:HI 3 "accg_operand" "=B")
6682 (unspec:HI [(const_int 0)] UNSPEC_MQCPX))])]
6684 "operands[4] = GEN_INT (FRV_BUILTIN_MQCPXRU);")
6686 (define_expand "mqcpxis"
6687 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "=b")
6688 (unspec:DI [(match_operand:DI 1 "fpr_operand" "f")
6689 (match_operand:DI 2 "fpr_operand" "f")
6692 (set (match_operand:HI 3 "accg_operand" "=B")
6693 (unspec:HI [(const_int 0)] UNSPEC_MQCPX))])]
6695 "operands[4] = GEN_INT (FRV_BUILTIN_MQCPXIS);")
6697 (define_expand "mqcpxiu"
6698 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "=b")
6699 (unspec:DI [(match_operand:DI 1 "fpr_operand" "f")
6700 (match_operand:DI 2 "fpr_operand" "f")
6703 (set (match_operand:HI 3 "accg_operand" "=B")
6704 (unspec:HI [(const_int 0)] UNSPEC_MQCPX))])]
6706 "operands[4] = GEN_INT (FRV_BUILTIN_MQCPXIU);")
6708 (define_insn "*mqcpx"
6709 [(set (match_operand:DI 0 "even_acc_operand" "=b")
6710 (unspec:DI [(match_operand:DI 1 "fpr_operand" "f")
6711 (match_operand:DI 2 "fpr_operand" "f")
6712 (match_operand:SI 3 "const_int_operand" "n")]
6714 (set (match_operand:HI 4 "accg_operand" "=B")
6715 (unspec:HI [(const_int 0)] UNSPEC_MQCPX))]
6719 switch (INTVAL (operands[3]))
6722 case FRV_BUILTIN_MQCPXRS: return \"mqcpxrs %1, %2, %0\";
6723 case FRV_BUILTIN_MQCPXRU: return \"mqcpxru %1, %2, %0\";
6724 case FRV_BUILTIN_MQCPXIS: return \"mqcpxis %1, %2, %0\";
6725 case FRV_BUILTIN_MQCPXIU: return \"mqcpxiu %1, %2, %0\";
6728 fatal_insn (\"Bad media insn, mqcpx\", insn);
6730 [(set_attr "length" "4")
6731 (set_attr "type" "mqcpx")])
6735 (define_expand "mcut"
6736 [(set (match_operand:SI 0 "fpr_operand" "=f")
6737 (unspec:SI [(match_operand:SI 1 "acc_operand" "a")
6738 (match_operand:SI 2 "fpr_or_int6_operand" "fI")
6739 (match_operand:QI 3 "accg_operand" "B")
6743 "operands[4] = GEN_INT (FRV_BUILTIN_MCUT);")
6745 (define_expand "mcutss"
6746 [(set (match_operand:SI 0 "fpr_operand" "=f")
6747 (unspec:SI [(match_operand:SI 1 "acc_operand" "a")
6748 (match_operand:SI 2 "fpr_or_int6_operand" "fI")
6749 (match_operand:QI 3 "accg_operand" "B")
6753 "operands[4] = GEN_INT (FRV_BUILTIN_MCUTSS);")
6755 (define_insn "*mcut"
6756 [(set (match_operand:SI 0 "fpr_operand" "=f")
6757 (unspec:SI [(match_operand:SI 1 "acc_operand" "a")
6758 (match_operand:SI 2 "fpr_or_int6_operand" "fI")
6759 (match_operand:QI 3 "accg_operand" "B")
6760 (match_operand:SI 4 "const_int_operand" "n")]
6765 switch (INTVAL (operands[4]))
6768 case FRV_BUILTIN_MCUT: return \"mcut%i2 %1, %2, %0\";
6769 case FRV_BUILTIN_MCUTSS: return \"mcutss%i2 %1, %2, %0\";
6772 fatal_insn (\"Bad media insn, mcut\", insn);
6774 [(set_attr "length" "4")
6775 (set_attr "type" "mcut")])
6777 ;; Accumulator read: type "mrdacc"
6779 (define_insn "mrdacc"
6780 [(set (match_operand:SI 0 "fpr_operand" "=f")
6781 (unspec:SI [(match_operand:SI 1 "acc_operand" "a")] UNSPEC_MRDACC))]
6784 [(set_attr "length" "4")
6785 (set_attr "type" "mrdacc")])
6787 (define_insn "mrdaccg"
6788 [(set (match_operand:SI 0 "fpr_operand" "=f")
6789 (unspec:SI [(match_operand:QI 1 "accg_operand" "B")] UNSPEC_MRDACCG))]
6792 [(set_attr "length" "4")
6793 (set_attr "type" "mrdacc")])
6795 ;; Accumulator write: type "mwtacc"
6797 (define_insn "mwtacc"
6798 [(set (match_operand:SI 0 "acc_operand" "=a")
6799 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f")] UNSPEC_MWTACC))]
6802 [(set_attr "length" "4")
6803 (set_attr "type" "mwtacc")])
6805 (define_insn "mwtaccg"
6806 [(set (match_operand:QI 0 "accg_operand" "=B")
6807 (unspec:QI [(match_operand:SI 1 "fpr_operand" "f")] UNSPEC_MWTACCG))]
6810 [(set_attr "length" "4")
6811 (set_attr "type" "mwtacc")])
6813 ;; Trap: This one executes on the control unit, not the media units.
6815 (define_insn "mtrap"
6816 [(unspec_volatile [(const_int 0)] UNSPEC_MTRAP)]
6819 [(set_attr "length" "4")
6820 (set_attr "type" "trap")])
6822 ;; Clear single accumulator: type "mclracc"
6824 (define_insn "mclracc_internal"
6825 [(set (match_operand:SI 0 "acc_operand" "=a")
6826 (unspec:SI [(const_int 0)] UNSPEC_MCLRACC))
6827 (set (match_operand:QI 1 "accg_operand" "=B")
6828 (unspec:QI [(const_int 0)] UNSPEC_MCLRACC))]
6831 [(set_attr "length" "4")
6832 (set_attr "type" "mclracc")])
6834 (define_expand "mclracc"
6835 [(parallel [(set (match_operand:SI 0 "acc_operand" "=a")
6836 (unspec:SI [(const_int 0)] UNSPEC_MCLRACC))
6838 (unspec:QI [(const_int 0)] UNSPEC_MCLRACC))])]
6842 if (GET_CODE (operands[0]) != REG || !ACC_P (REGNO (operands[0])))
6845 operands[1] = frv_matching_accg_for_acc (operands[0]);
6848 ;; Clear all accumulators: type "mclracca"
6850 (define_insn "mclracca8_internal"
6851 [(set (match_operand:V4SI 0 "quad_acc_operand" "=b")
6852 (unspec:V4SI [(const_int 0)] UNSPEC_MCLRACCA))
6853 (set (match_operand:V4SI 1 "quad_acc_operand" "=b")
6854 (unspec:V4SI [(const_int 0)] UNSPEC_MCLRACCA))
6855 (set (match_operand:V4QI 2 "accg_operand" "=B")
6856 (unspec:V4QI [(const_int 0)] UNSPEC_MCLRACCA))
6857 (set (match_operand:V4QI 3 "accg_operand" "=B")
6858 (unspec:V4QI [(const_int 0)] UNSPEC_MCLRACCA))]
6859 "TARGET_MEDIA && TARGET_ACC_8"
6861 [(set_attr "length" "4")
6862 (set_attr "type" "mclracca")])
6864 (define_insn "mclracca4_internal"
6865 [(set (match_operand:V4SI 0 "quad_acc_operand" "=b")
6866 (unspec:V4SI [(const_int 0)] UNSPEC_MCLRACCA))
6867 (set (match_operand:V4QI 1 "accg_operand" "=B")
6868 (unspec:V4QI [(const_int 0)] UNSPEC_MCLRACCA))]
6869 "TARGET_MEDIA && TARGET_ACC_4"
6871 [(set_attr "length" "4")
6872 (set_attr "type" "mclracca")])
6874 (define_expand "mclracca8"
6875 [(parallel [(set (match_dup 0) (unspec:V4SI [(const_int 0)] UNSPEC_MCLRACCA))
6876 (set (match_dup 1) (unspec:V4SI [(const_int 0)] UNSPEC_MCLRACCA))
6877 (set (match_dup 2) (unspec:V4QI [(const_int 0)] UNSPEC_MCLRACCA))
6878 (set (match_dup 3) (unspec:V4QI [(const_int 0)] UNSPEC_MCLRACCA))])]
6879 "TARGET_MEDIA && TARGET_ACC_8"
6882 operands[0] = gen_rtx_REG (V4SImode, ACC_FIRST);
6883 operands[1] = gen_rtx_REG (V4SImode, ACC_FIRST + (~3 & ACC_MASK));
6884 operands[2] = gen_rtx_REG (V4QImode, ACCG_FIRST);
6885 operands[3] = gen_rtx_REG (V4QImode, ACCG_FIRST + (~3 & ACC_MASK));
6888 (define_expand "mclracca4"
6889 [(parallel [(set (match_dup 0) (unspec:V4SI [(const_int 0)] UNSPEC_MCLRACCA))
6890 (set (match_dup 1) (unspec:V4QI [(const_int 0)] UNSPEC_MCLRACCA))])]
6891 "TARGET_MEDIA && TARGET_ACC_4"
6894 operands[0] = gen_rtx_REG (V4SImode, ACC_FIRST);
6895 operands[1] = gen_rtx_REG (V4QImode, ACCG_FIRST);
6898 (define_insn "mcop1"
6899 [(set (match_operand:SI 0 "fpr_operand" "=f")
6900 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f")
6901 (match_operand:SI 2 "fpr_operand" "f")] UNSPEC_MCOP1))]
6904 [(set_attr "length" "4")
6905 ;; What is the class of the insn ???
6906 (set_attr "type" "multi")])
6908 (define_insn "mcop2"
6909 [(set (match_operand:SI 0 "fpr_operand" "=f")
6910 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f")
6911 (match_operand:SI 2 "fpr_operand" "f")] UNSPEC_MCOP2))]
6914 [(set_attr "length" "4")
6915 ;; What is the class of the insn ???
6916 (set_attr "type" "multi")])
6918 (define_insn "*mdunpackh_internal"
6919 [(set (match_operand:V4SI 0 "quad_fpr_operand" "=x")
6920 (unspec:V4SI [(match_operand:DI 1 "even_fpr_operand" "h")]
6921 UNSPEC_MDUNPACKH_INTERNAL))]
6924 [(set_attr "length" "4")
6925 (set_attr "type" "mdunpackh")])
6927 (define_insn_and_split "mdunpackh"
6928 [(set (match_operand:V4SI 0 "memory_operand" "=o")
6929 (unspec:V4SI [(match_operand:DI 1 "even_fpr_operand" "h")]
6931 (clobber (match_scratch:V4SI 2 "=x"))]
6936 (unspec:V4SI [(match_dup 1)] UNSPEC_MDUNPACKH_INTERNAL))
6943 operands[3] = change_address (operands[0], DImode, NULL_RTX);
6944 operands[4] = gen_rtx_REG (DImode, REGNO (operands[2]));
6945 operands[5] = frv_index_memory (operands[0], DImode, 1);
6946 operands[6] = gen_rtx_REG (DImode, REGNO (operands[2])+2);
6948 [(set_attr "length" "20")
6949 (set_attr "type" "multi")])
6951 (define_insn "*mbtohe_internal"
6952 [(set (match_operand:V4SI 0 "quad_fpr_operand" "=x")
6953 (unspec:V4SI [(match_operand:SI 1 "fpr_operand" "f")]
6954 UNSPEC_MBTOHE_INTERNAL))]
6957 [(set_attr "length" "4")
6958 (set_attr "type" "mbhconve")])
6960 (define_insn_and_split "mbtohe"
6961 [(set (match_operand:V4SI 0 "memory_operand" "=o")
6962 (unspec:V4SI [(match_operand:SI 1 "fpr_operand" "f")]
6964 (clobber (match_scratch:V4SI 2 "=x"))]
6969 (unspec:V4SI [(match_dup 1)] UNSPEC_MBTOHE_INTERNAL))
6976 operands[3] = change_address (operands[0], DImode, NULL_RTX);
6977 operands[4] = gen_rtx_REG (DImode, REGNO (operands[2]));
6978 operands[5] = frv_index_memory (operands[0], DImode, 1);
6979 operands[6] = gen_rtx_REG (DImode, REGNO (operands[2])+2);
6981 [(set_attr "length" "20")
6982 (set_attr "type" "multi")])
6984 ;; Quad product-sum (halfword) instructions only found on the FR400.
6987 (define_expand "mqxmachs"
6988 [(parallel [(set (match_operand:V4SI 0 "quad_acc_operand" "")
6989 (unspec:V4SI [(match_dup 0)
6990 (match_operand:DI 1 "even_fpr_operand" "")
6991 (match_operand:DI 2 "even_fpr_operand" "")
6992 (match_operand:V4QI 3 "accg_operand" "")
6996 (unspec:V4QI [(const_int 0)] UNSPEC_MQMACH2))])]
6998 "operands[4] = GEN_INT (FRV_BUILTIN_MQXMACHS);")
7000 (define_expand "mqxmacxhs"
7001 [(parallel [(set (match_operand:V4SI 0 "quad_acc_operand" "")
7002 (unspec:V4SI [(match_dup 0)
7003 (match_operand:DI 1 "even_fpr_operand" "")
7004 (match_operand:DI 2 "even_fpr_operand" "")
7005 (match_operand:V4QI 3 "accg_operand" "")
7009 (unspec:V4QI [(const_int 0)] UNSPEC_MQMACH2))])]
7011 "operands[4] = GEN_INT (FRV_BUILTIN_MQXMACXHS);")
7013 (define_expand "mqmacxhs"
7014 [(parallel [(set (match_operand:V4SI 0 "quad_acc_operand" "")
7015 (unspec:V4SI [(match_dup 0)
7016 (match_operand:DI 1 "even_fpr_operand" "")
7017 (match_operand:DI 2 "even_fpr_operand" "")
7018 (match_operand:V4QI 3 "accg_operand" "")
7022 (unspec:V4QI [(const_int 0)] UNSPEC_MQMACH2))])]
7024 "operands[4] = GEN_INT (FRV_BUILTIN_MQMACXHS);")
7026 (define_insn "*mqmach2"
7027 [(set (match_operand:V4SI 0 "quad_acc_operand" "+A")
7028 (unspec:V4SI [(match_dup 0)
7029 (match_operand:DI 1 "even_fpr_operand" "h")
7030 (match_operand:DI 2 "even_fpr_operand" "h")
7031 (match_operand:V4QI 3 "accg_operand" "+B")
7032 (match_operand:SI 4 "const_int_operand" "n")]
7035 (unspec:V4QI [(const_int 0)] UNSPEC_MQMACH2))]
7039 switch (INTVAL (operands[4]))
7042 case FRV_BUILTIN_MQXMACHS: return \"mqxmachs %1, %2, %0\";
7043 case FRV_BUILTIN_MQXMACXHS: return \"mqxmacxhs %1, %2, %0\";
7044 case FRV_BUILTIN_MQMACXHS: return \"mqmacxhs %1, %2, %0\";
7047 fatal_insn (\"Bad media insn, mqmach2\", insn);
7049 [(set_attr "length" "4")
7050 (set_attr "type" "mqmach")])
7052 ;; Accumulator addition/subtraction: type "maddacc"
7054 (define_expand "maddaccs"
7055 [(parallel [(set (match_operand:SI 0 "acc_operand" "")
7056 (unspec:SI [(match_operand:DI 1 "even_acc_operand" "")]
7058 (set (match_operand:QI 2 "accg_operand" "")
7059 (unspec:QI [(match_operand:HI 3 "accg_operand" "")
7063 "operands[4] = GEN_INT (FRV_BUILTIN_MADDACCS);")
7065 (define_expand "msubaccs"
7066 [(parallel [(set (match_operand:SI 0 "acc_operand" "")
7067 (unspec:SI [(match_operand:DI 1 "even_acc_operand" "")]
7069 (set (match_operand:QI 2 "accg_operand" "")
7070 (unspec:QI [(match_operand:HI 3 "accg_operand" "")
7074 "operands[4] = GEN_INT (FRV_BUILTIN_MSUBACCS);")
7076 (define_insn "masaccs"
7077 [(set (match_operand:DI 0 "even_acc_operand" "=b")
7078 (unspec:DI [(match_operand:DI 1 "even_acc_operand" "b")]
7080 (set (match_operand:HI 2 "accg_operand" "=B")
7081 (unspec:HI [(match_operand:HI 3 "accg_operand" "B")]
7085 [(set_attr "length" "4")
7086 (set_attr "type" "maddacc")])
7088 (define_insn "*maddacc"
7089 [(set (match_operand:SI 0 "acc_operand" "=a")
7090 (unspec:SI [(match_operand:DI 1 "even_acc_operand" "b")]
7092 (set (match_operand:QI 2 "accg_operand" "=B")
7093 (unspec:QI [(match_operand:HI 3 "accg_operand" "B")
7094 (match_operand:SI 4 "const_int_operand" "n")]
7099 switch (INTVAL (operands[4]))
7102 case FRV_BUILTIN_MADDACCS: return \"maddaccs %1, %0\";
7103 case FRV_BUILTIN_MSUBACCS: return \"msubaccs %1, %0\";
7106 fatal_insn (\"Bad media insn, maddacc\", insn);
7108 [(set_attr "length" "4")
7109 (set_attr "type" "maddacc")])
7111 ;; Dual accumulator addition/subtraction: type "mdaddacc"
7113 (define_expand "mdaddaccs"
7114 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "")
7115 (unspec:DI [(match_operand:V4SI 1 "quad_acc_operand" "")]
7117 (set (match_operand:HI 2 "accg_operand" "")
7118 (unspec:HI [(match_operand:V4QI 3 "accg_operand" "")
7120 UNSPEC_MDADDACC))])]
7122 "operands[4] = GEN_INT (FRV_BUILTIN_MDADDACCS);")
7124 (define_expand "mdsubaccs"
7125 [(parallel [(set (match_operand:DI 0 "even_acc_operand" "")
7126 (unspec:DI [(match_operand:V4SI 1 "quad_acc_operand" "")]
7128 (set (match_operand:HI 2 "accg_operand" "")
7129 (unspec:HI [(match_operand:V4QI 3 "accg_operand" "")
7131 UNSPEC_MDADDACC))])]
7133 "operands[4] = GEN_INT (FRV_BUILTIN_MDSUBACCS);")
7135 (define_insn "mdasaccs"
7136 [(set (match_operand:V4SI 0 "quad_acc_operand" "=A")
7137 (unspec:V4SI [(match_operand:V4SI 1 "quad_acc_operand" "A")]
7139 (set (match_operand:V4QI 2 "accg_operand" "=B")
7140 (unspec:V4QI [(match_operand:V4QI 3 "accg_operand" "B")]
7144 [(set_attr "length" "4")
7145 (set_attr "type" "mdaddacc")])
7147 (define_insn "*mdaddacc"
7148 [(set (match_operand:DI 0 "even_acc_operand" "=b")
7149 (unspec:DI [(match_operand:V4SI 1 "quad_acc_operand" "A")]
7151 (set (match_operand:HI 2 "accg_operand" "=B")
7152 (unspec:HI [(match_operand:V4QI 3 "accg_operand" "B")
7153 (match_operand:SI 4 "const_int_operand" "n")]
7158 switch (INTVAL (operands[4]))
7161 case FRV_BUILTIN_MDADDACCS: return \"mdaddaccs %1, %0\";
7162 case FRV_BUILTIN_MDSUBACCS: return \"mdsubaccs %1, %0\";
7165 fatal_insn (\"Bad media insn, mdaddacc\", insn);
7167 [(set_attr "length" "4")
7168 (set_attr "type" "mdaddacc")])
7170 ;; Dual absolute (halfword): type "mabsh"
7172 (define_insn "mabshs"
7173 [(set (match_operand:SI 0 "fpr_operand" "=f")
7174 (unspec:SI [(match_operand:SI 1 "fpr_operand" "f")] UNSPEC_MABSHS))]
7177 [(set_attr "length" "4")
7178 (set_attr "type" "mabsh")])
7180 ;; Dual rotate: type "mdrot"
7182 (define_insn "mdrotli"
7183 [(set (match_operand:DI 0 "even_fpr_operand" "=h")
7184 (unspec:DI [(match_operand:DI 1 "even_fpr_operand" "h")
7185 (match_operand:SI 2 "uint5_operand" "I")]
7188 "mdrotli %1, %2, %0"
7189 [(set_attr "length" "4")
7190 (set_attr "type" "mdrot")])
7192 ;; Dual coupling (concatenation): type "mcpl"
7194 (define_insn "mcplhi"
7195 [(set (match_operand:SI 0 "fpr_operand" "=f")
7196 (unspec:SI [(match_operand:DI 1 "fpr_operand" "h")
7197 (match_operand:SI 2 "uint4_operand" "I")]
7201 [(set_attr "length" "4")
7202 (set_attr "type" "mcpl")])
7204 (define_insn "mcpli"
7205 [(set (match_operand:SI 0 "fpr_operand" "=f")
7206 (unspec:SI [(match_operand:DI 1 "fpr_operand" "h")
7207 (match_operand:SI 2 "uint5_operand" "I")]
7211 [(set_attr "length" "4")
7212 (set_attr "type" "mcpl")])
7214 ;; Dual cut: type "mdcut"
7216 (define_insn "mdcutssi"
7217 [(set (match_operand:DI 0 "even_fpr_operand" "=h")
7218 (unspec:DI [(match_operand:DI 1 "even_acc_operand" "b")
7219 (match_operand:SI 2 "int6_operand" "I")
7220 (match_operand:HI 3 "accg_operand" "B")]
7223 "mdcutssi %1, %2, %0"
7224 [(set_attr "length" "4")
7225 (set_attr "type" "mdcut")])
7227 ;; Quad saturate (halfword): type "mqsath"
7229 (define_insn "mqsaths"
7230 [(set (match_operand:DI 0 "even_fpr_operand" "=h")
7231 (unspec:DI [(match_operand:DI 1 "even_fpr_operand" "h")
7232 (match_operand:DI 2 "even_fpr_operand" "h")]
7235 "mqsaths %1, %2, %0"
7236 [(set_attr "length" "4")
7237 (set_attr "type" "mqsath")])
7239 ;; Quad limit instructions: type "mqlimh"
7241 (define_insn "mqlclrhs"
7242 [(set (match_operand:DI 0 "even_fpr_operand" "=h")
7243 (unspec:DI [(match_operand:DI 1 "even_fpr_operand" "h")
7244 (match_operand:DI 2 "even_fpr_operand" "h")]
7246 "TARGET_MEDIA_FR450"
7247 "mqlclrhs %1, %2, %0"
7248 [(set_attr "length" "4")
7249 (set_attr "type" "mqlimh")])
7251 (define_insn "mqlmths"
7252 [(set (match_operand:DI 0 "even_fpr_operand" "=h")
7253 (unspec:DI [(match_operand:DI 1 "even_fpr_operand" "h")
7254 (match_operand:DI 2 "even_fpr_operand" "h")]
7256 "TARGET_MEDIA_FR450"
7257 "mqlmths %1, %2, %0"
7258 [(set_attr "length" "4")
7259 (set_attr "type" "mqlimh")])
7261 (define_insn "mqsllhi"
7262 [(set (match_operand:DI 0 "even_fpr_operand" "=h")
7263 (unspec:DI [(match_operand:DI 1 "even_fpr_operand" "h")
7264 (match_operand:SI 2 "int6_operand" "I")]
7266 "TARGET_MEDIA_FR450"
7267 "mqsllhi %1, %2, %0"
7268 [(set_attr "length" "4")
7269 (set_attr "type" "mqshift")])
7271 (define_insn "mqsrahi"
7272 [(set (match_operand:DI 0 "even_fpr_operand" "=h")
7273 (unspec:DI [(match_operand:DI 1 "even_fpr_operand" "h")
7274 (match_operand:SI 2 "int6_operand" "I")]
7276 "TARGET_MEDIA_FR450"
7277 "mqsrahi %1, %2, %0"
7278 [(set_attr "length" "4")
7279 (set_attr "type" "mqshift")])
7281 ;; Set hi/lo instructions: type "mset"
7283 (define_insn "mhsetlos"
7284 [(set (match_operand:SI 0 "fpr_operand" "=f")
7285 (unspec:SI [(match_operand:SI 1 "fpr_operand" "0")
7286 (match_operand:SI 2 "int12_operand" "NOP")]
7290 [(set_attr "length" "4")
7291 (set_attr "type" "mset")])
7293 (define_insn "mhsetloh"
7294 [(set (match_operand:SI 0 "fpr_operand" "=f")
7295 (unspec:SI [(match_operand:SI 1 "fpr_operand" "0")
7296 (match_operand:SI 2 "int5_operand" "I")]
7300 [(set_attr "length" "4")
7301 (set_attr "type" "mset")])
7303 (define_insn "mhsethis"
7304 [(set (match_operand:SI 0 "fpr_operand" "=f")
7305 (unspec:SI [(match_operand:SI 1 "fpr_operand" "0")
7306 (match_operand:SI 2 "int12_operand" "NOP")]
7310 [(set_attr "length" "4")
7311 (set_attr "type" "mset")])
7313 (define_insn "mhsethih"
7314 [(set (match_operand:SI 0 "fpr_operand" "=f")
7315 (unspec:SI [(match_operand:SI 1 "fpr_operand" "0")
7316 (match_operand:SI 2 "int5_operand" "I")]
7320 [(set_attr "length" "4")
7321 (set_attr "type" "mset")])
7323 (define_insn "mhdsets"
7324 [(set (match_operand:SI 0 "fpr_operand" "=f")
7325 (unspec:SI [(match_operand:SI 1 "int12_operand" "NOP")]
7329 [(set_attr "length" "4")
7330 (set_attr "type" "mset")])
7332 (define_insn "mhdseth"
7333 [(set (match_operand:SI 0 "fpr_operand" "=f")
7334 (unspec:SI [(match_operand:SI 1 "fpr_operand" "0")
7335 (match_operand:SI 2 "int5_operand" "I")]
7339 [(set_attr "length" "4")
7340 (set_attr "type" "mset")])
7342 ;;-----------------------------------------------------------------------------
7344 (define_expand "symGOT2reg"
7345 [(match_operand:SI 0 "" "")
7346 (match_operand:SI 1 "" "")
7347 (match_operand:SI 2 "" "")
7348 (match_operand:SI 3 "" "")]
7354 insn = emit_insn (gen_symGOT2reg_i (operands[0], operands[1], operands[2], operands[3]));
7356 MEM_READONLY_P (SET_SRC (PATTERN (insn))) = 1;
7358 set_unique_reg_note (insn, REG_EQUAL, operands[1]);
7363 (define_expand "symGOT2reg_i"
7364 [(set (match_operand:SI 0 "" "")
7365 (mem:SI (plus:SI (match_operand:SI 2 "" "")
7366 (const:SI (unspec:SI [(match_operand:SI 1 "" "")
7367 (match_operand:SI 3 "" "")]
7372 (define_expand "symGOT2reg_hilo"
7374 (high:SI (const:SI (unspec:SI [(match_operand:SI 1 "" "")
7375 (match_dup 4)] UNSPEC_GOT))))
7377 (lo_sum:SI (match_dup 6)
7378 (const:SI (unspec:SI [(match_dup 1)
7379 (match_operand:SI 3 "" "")]
7381 (set (match_operand:SI 0 "" "")
7382 (mem:SI (plus:SI (match_dup 5)
7383 (match_operand:SI 2 "" ""))))
7388 if (!can_create_pseudo_p ())
7389 operands[6] = operands[5] = operands[0];
7392 operands[6] = gen_reg_rtx (SImode);
7393 operands[5] = gen_reg_rtx (SImode);
7396 operands[4] = GEN_INT (INTVAL (operands[3]) + 1);
7397 operands[3] = GEN_INT (INTVAL (operands[3]) + 2);
7400 (define_expand "symGOTOFF2reg_hilo"
7402 (high:SI (const:SI (unspec:SI [(match_operand:SI 1 "" "")
7403 (match_dup 4)] UNSPEC_GOT))))
7405 (lo_sum:SI (match_dup 6)
7406 (const:SI (unspec:SI [(match_dup 1)
7407 (match_operand:SI 3 "" "")]
7409 (set (match_operand:SI 0 "" "")
7410 (plus:SI (match_dup 5)
7411 (match_operand:SI 2 "" "")))
7416 if (!can_create_pseudo_p ())
7417 operands[6] = operands[5] = operands[0];
7420 operands[6] = gen_reg_rtx (SImode);
7421 operands[5] = gen_reg_rtx (SImode);
7424 operands[4] = GEN_INT (INTVAL (operands[3]) + 1);
7425 operands[3] = GEN_INT (INTVAL (operands[3]) + 2);
7428 (define_expand "symGOTOFF2reg"
7429 [(match_operand:SI 0 "" "")
7430 (match_operand:SI 1 "" "")
7431 (match_operand:SI 2 "" "")
7432 (match_operand:SI 3 "" "")]
7436 rtx insn = emit_insn (gen_symGOTOFF2reg_i (operands[0], operands[1], operands[2], operands[3]));
7438 set_unique_reg_note (insn, REG_EQUAL, operands[1]);
7443 (define_expand "symGOTOFF2reg_i"
7444 [(set (match_operand:SI 0 "" "")
7445 (plus:SI (match_operand:SI 2 "" "")
7447 (unspec:SI [(match_operand:SI 1 "" "")
7448 (match_operand:SI 3 "" "")]
7453 (define_expand "symGPREL2reg"
7454 [(match_operand:SI 0 "" "")
7455 (match_operand:SI 1 "" "")
7456 (match_operand:SI 2 "" "")
7457 (match_operand:SI 3 "" "")
7464 if (!can_create_pseudo_p ())
7465 operands[4] = operands[0];
7467 operands[4] = gen_reg_rtx (SImode);
7469 emit_insn (frv_gen_GPsym2reg (operands[4], operands[2]));
7471 insn = emit_insn (gen_symGOTOFF2reg_i (operands[0], operands[1],
7472 operands[4], operands[3]));
7474 set_unique_reg_note (insn, REG_EQUAL, operands[1]);
7479 (define_expand "symGPREL2reg_hilo"
7480 [(match_operand:SI 0 "" "")
7481 (match_operand:SI 1 "" "")
7482 (match_operand:SI 2 "" "")
7483 (match_operand:SI 3 "" "")
7490 if (!can_create_pseudo_p ())
7492 emit_insn (gen_symGOT2reg (operands[0], operands[1], operands[2],
7493 GEN_INT (R_FRV_GOT12)));
7497 operands[4] = gen_reg_rtx (SImode);
7499 emit_insn (frv_gen_GPsym2reg (operands[4], operands[2]));
7501 insn = emit_insn (gen_symGOTOFF2reg_hilo (operands[0], operands[1],
7502 operands[4], operands[3]));
7504 set_unique_reg_note (insn, REG_EQUAL, operands[1]);
7520 (UNSPEC_PREFETCH0 163)
7521 (UNSPEC_PREFETCH 164)
7522 (UNSPEC_IACCreadll 165)
7523 (UNSPEC_IACCreadl 166)
7524 (UNSPEC_IACCsetll 167)
7525 (UNSPEC_IACCsetl 168)
7534 [(set (match_operand:DI 0 "integer_register_operand" "=d")
7535 (unspec:DI [(match_operand:SI 1 "integer_register_operand" "d")
7536 (match_operand:SI 2 "integer_register_operand" "d")]
7540 [(set_attr "length" "4")
7541 (set_attr "type" "mul")])
7544 [(set (match_operand:DI 0 "integer_register_operand" "=d")
7545 (unspec:DI [(match_operand:SI 1 "integer_register_operand" "d")
7546 (match_operand:SI 2 "integer_register_operand" "d")]
7550 [(set_attr "length" "4")
7551 (set_attr "type" "mul")])
7553 (define_insn "smass"
7554 [(set (reg:DI IACC0_REG)
7555 (unspec:DI [(match_operand:SI 0 "integer_register_operand" "d")
7556 (match_operand:SI 1 "integer_register_operand" "d")
7559 "TARGET_FR405_BUILTINS"
7561 [(set_attr "length" "4")
7562 (set_attr "type" "macc")])
7564 (define_insn "smsss"
7565 [(set (reg:DI IACC0_REG)
7566 (unspec:DI [(match_operand:SI 0 "integer_register_operand" "d")
7567 (match_operand:SI 1 "integer_register_operand" "d")
7570 "TARGET_FR405_BUILTINS"
7572 [(set_attr "length" "4")
7573 (set_attr "type" "macc")])
7576 [(set (reg:DI IACC0_REG)
7577 (unspec:DI [(match_operand:SI 0 "integer_register_operand" "d")
7578 (match_operand:SI 1 "integer_register_operand" "d")]
7580 "TARGET_FR405_BUILTINS"
7582 [(set_attr "length" "4")
7583 (set_attr "type" "macc")])
7585 (define_insn "addss"
7586 [(set (match_operand:SI 0 "integer_register_operand" "=d")
7587 (unspec:SI [(match_operand:SI 1 "integer_register_operand" "d")
7588 (match_operand:SI 2 "integer_register_operand" "d")]
7590 "TARGET_FR405_BUILTINS"
7592 [(set_attr "length" "4")
7593 (set_attr "type" "int")])
7595 (define_insn "subss"
7596 [(set (match_operand:SI 0 "integer_register_operand" "=d")
7597 (unspec:SI [(match_operand:SI 1 "integer_register_operand" "d")
7598 (match_operand:SI 2 "integer_register_operand" "d")]
7600 "TARGET_FR405_BUILTINS"
7602 [(set_attr "length" "4")
7603 (set_attr "type" "int")])
7605 (define_insn "slass"
7606 [(set (match_operand:SI 0 "integer_register_operand" "=d")
7607 (unspec:SI [(match_operand:SI 1 "integer_register_operand" "d")
7608 (match_operand:SI 2 "integer_register_operand" "d")]
7610 "TARGET_FR405_BUILTINS"
7612 [(set_attr "length" "4")
7613 (set_attr "type" "int")])
7616 [(set (match_operand:SI 0 "integer_register_operand" "=d")
7617 (unspec:SI [(match_operand:SI 1 "integer_register_operand" "d")
7618 (match_operand:SI 2 "integer_register_operand" "d")]
7622 [(set_attr "length" "4")
7623 (set_attr "type" "scan")])
7625 (define_insn "scutss"
7626 [(set (match_operand:SI 0 "integer_register_operand" "=d")
7627 (unspec:SI [(match_operand:SI 1 "integer_register_operand" "d")
7630 "TARGET_FR405_BUILTINS"
7632 [(set_attr "length" "4")
7633 (set_attr "type" "cut")])
7635 (define_insn "frv_prefetch0"
7636 [(prefetch (unspec:SI [(match_operand:SI 0 "register_operand" "r")]
7642 [(set_attr "length" "4")])
7644 (define_insn "frv_prefetch"
7645 [(prefetch (unspec:SI [(match_operand:SI 0 "register_operand" "r")]
7649 "TARGET_FR500_FR550_BUILTINS"
7650 "nop.p\\n\\tnldub @(%0, gr0), gr0"
7651 [(set_attr "length" "8")])
7655 (define_insn "call_gettlsoff"
7656 [(set (match_operand:SI 0 "register_operand" "=D09")
7658 [(match_operand:SI 1 "symbolic_operand" "")]
7660 (clobber (reg:SI GR8_REG))
7661 (clobber (reg:SI LRREG))
7662 (use (match_operand:SI 2 "register_operand" "D15"))]
7664 "call #gettlsoff(%a1)"
7665 [(set_attr "length" "4")
7666 (set_attr "type" "load_or_call")])
7668 ;; We have to expand this like a libcall (it sort of actually is)
7669 ;; because otherwise sched may move, for example, an insn that sets up
7670 ;; GR8 for a subsequence call before the *tls_indirect_call insn, and
7671 ;; then reload won't be able to fix things up.
7672 (define_expand "tls_indirect_call"
7673 [(set (reg:DI GR8_REG)
7674 (match_operand:DI 2 "register_operand" ""))
7676 [(set (reg:SI GR9_REG)
7678 [(match_operand:SI 1 "symbolic_operand" "")
7680 UNSPEC_TLS_INDIRECT_CALL))
7681 (clobber (reg:SI GR8_REG))
7682 (clobber (reg:SI LRREG))
7683 (use (match_operand:SI 3 "register_operand" ""))])
7684 (set (match_operand:SI 0 "register_operand" "")
7688 (define_insn "*tls_indirect_call"
7689 [(set (reg:SI GR9_REG)
7691 [(match_operand:SI 0 "symbolic_operand" "")
7693 UNSPEC_TLS_INDIRECT_CALL))
7694 (clobber (reg:SI GR8_REG))
7695 (clobber (reg:SI LRREG))
7696 ;; If there was a way to represent the fact that we don't need GR9
7697 ;; or GR15 to be set before this instruction (it could be in
7698 ;; parallel), we could use it here. This change wouldn't apply to
7699 ;; call_gettlsoff, thought, since the linker may turn the latter
7700 ;; into ldi @(gr15,offset),gr9.
7701 (use (match_operand:SI 1 "register_operand" "D15"))]
7703 "calll #gettlsoff(%a0)@(gr8,gr0)"
7704 [(set_attr "length" "4")
7705 (set_attr "type" "jumpl")])
7707 (define_insn "tls_load_gottlsoff12"
7708 [(set (match_operand:SI 0 "register_operand" "=r")
7710 [(match_operand:SI 1 "symbolic_operand" "")
7711 (match_operand:SI 2 "register_operand" "r")]
7712 UNSPEC_TLS_LOAD_GOTTLSOFF12))]
7714 "ldi @(%2, #gottlsoff12(%1)), %0"
7715 [(set_attr "length" "4")])
7717 (define_expand "tlsoff_hilo"
7718 [(set (match_operand:SI 0 "register_operand" "=r")
7719 (high:SI (const:SI (unspec:SI
7720 [(match_operand:SI 1 "symbolic_operand" "")
7721 (match_operand:SI 2 "immediate_operand" "n")]
7724 (lo_sum:SI (match_dup 0)
7725 (const:SI (unspec:SI [(match_dup 1)
7726 (match_dup 3)] UNSPEC_GOT))))]
7730 operands[3] = GEN_INT (INTVAL (operands[2]) + 1);
7733 ;; Just like movdi_ldd, but with relaxation annotations.
7734 (define_insn "tls_tlsdesc_ldd"
7735 [(set (match_operand:DI 0 "register_operand" "=r")
7736 (unspec:DI [(mem:DI (unspec:SI
7737 [(match_operand:SI 1 "register_operand" "r")
7738 (match_operand:SI 2 "register_operand" "r")
7739 (match_operand:SI 3 "symbolic_operand" "")]
7740 UNSPEC_TLS_TLSDESC_LDD_AUX))]
7741 UNSPEC_TLS_TLSDESC_LDD))]
7743 "ldd #tlsdesc(%a3)@(%1,%2), %0"
7744 [(set_attr "length" "4")
7745 (set_attr "type" "gload")])
7747 (define_insn "tls_tlsoff_ld"
7748 [(set (match_operand:SI 0 "register_operand" "=r")
7750 [(match_operand:SI 1 "register_operand" "r")
7751 (match_operand:SI 2 "register_operand" "r")
7752 (match_operand:SI 3 "symbolic_operand" "")]
7753 UNSPEC_TLS_TLSOFF_LD)))]
7755 "ld #tlsoff(%a3)@(%1,%2), %0"
7756 [(set_attr "length" "4")
7757 (set_attr "type" "gload")])
7759 (define_insn "tls_lddi"
7760 [(set (match_operand:DI 0 "register_operand" "=r")
7761 (unspec:DI [(match_operand:SI 1 "symbolic_operand" "")
7762 (match_operand:SI 2 "register_operand" "d")]
7765 "lddi @(%2, #gottlsdesc12(%a1)), %0"
7766 [(set_attr "length" "4")
7767 (set_attr "type" "gload")])