1 ;; GCC machine description for CRIS cpu cores.
2 ;; Copyright (C) 1998-2017 Free Software Foundation, Inc.
3 ;; Contributed by Axis Communications.
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 ;; The original PO technology requires these to be ordered by speed,
22 ;; so that assigner will pick the fastest.
24 ;; See files "md.texi" and "rtl.def" for documentation on define_insn,
27 ;; The function cris_notice_update_cc in cris.c handles condition code
28 ;; updates for most instructions, helped by the "cc" attribute.
30 ;; There are several instructions that are orthogonal in size, and seems
31 ;; they could be matched by a single pattern without a specified size
32 ;; for the operand that is orthogonal. However, this did not work on
33 ;; gcc-2.7.2 (and probably not on gcc-2.8.1), relating to that when a
34 ;; constant is substituted into an operand, the actual mode must be
35 ;; deduced from the pattern. There is reasonable hope that that has been
36 ;; fixed, so FIXME: try again.
38 ;; You will notice that three-operand alternatives ("=r", "r", "!To")
39 ;; are marked with a "!" constraint modifier to avoid being reloaded
40 ;; into. This is because gcc would otherwise prefer to use the constant
41 ;; pool and its offsettable address instead of reloading to an
42 ;; ("=r", "0", "i") alternative. Also, the constant-pool support was not
43 ;; only suboptimal but also buggy in 2.7.2, ??? maybe only in 2.6.3.
45 ;; All insns that look like (set (...) (plus (...) (reg:SI 8)))
46 ;; get problems when reloading r8 (frame pointer) to r14 + offs (stack
47 ;; pointer). Thus the instructions that get into trouble have specific
48 ;; checks against matching frame_pointer_rtx.
49 ;; ??? But it should be re-checked for gcc > 2.7.2
50 ;; FIXME: This changed some time ago (from 2000-03-16) for gcc-2.9x.
52 ;; FIXME: When PIC, all [rX=rY+S] could be enabled to match
53 ;; [rX=gotless_symbol].
54 ;; The movsi for a gotless symbol could be split (post reload).
59 ;; PLT reference from call expansion: operand 0 is the address,
60 ;; the mode is VOIDmode. Always wrapped in CONST.
61 ;; The value is relative to the GOT.
62 CRIS_UNSPEC_PLT_GOTREL
64 ;; PLT reference from call expansion: operand 0 is the address,
65 ;; the mode is VOIDmode. Always wrapped in CONST.
66 ;; The value is relative to the PC. It's arch-dependent whether
67 ;; the offset counts from the start or the end of the current item.
70 ;; The address of the global offset table as a source operand.
73 ;; The offset from the global offset table to the operand.
76 ;; The PC-relative offset to the operand. It's arch-dependent whether
77 ;; the offset counts from the start or the end of the current item.
80 ;; The index into the global offset table of a symbol, while
81 ;; also generating a GOT entry for the symbol.
84 ;; Similar to CRIS_UNSPEC_GOTREAD, but also generating a PLT entry.
85 CRIS_UNSPEC_PLTGOTREAD
87 ;; Condition for v32 casesi jump, since it needs to have if_then_else
88 ;; form with register as one branch and default label as other.
89 ;; Operand 0 is const_int 0.
92 ;; Stack frame deallocation barrier.
93 CRIS_UNSPEC_FRAME_DEALLOC
95 ;; Swap all 32 bits of the operand; 31 <=> 0, 30 <=> 1...
102 (CRIS_STATIC_CHAIN_REGNUM 7)
109 (CRIS_CC0_REGNUM 19)]
112 ;; We need an attribute to define whether an instruction can be put in
113 ;; a branch-delay slot or not, and whether it has a delay slot.
115 ;; Branches and return instructions have a delay slot, and cannot
116 ;; themselves be put in a delay slot. This has changed *for short
117 ;; branches only* between architecture variants, but the possible win
118 ;; is presumed negligible compared to the added complexity of the machine
119 ;; description: one would have to add always-correct infrastructure to
120 ;; distinguish short branches.
122 ;; Whether an instruction can be put in a delay slot depends on the
123 ;; instruction (all short instructions except jumps and branches)
124 ;; and the addressing mode (must not be prefixed or referring to pc).
125 ;; In short, any "slottable" instruction must be 16 bit and not refer
126 ;; to pc, or alter it.
128 ;; The possible values are "yes", "no", "has_slot", "has_return_slot"
129 ;; and "has_call_slot".
130 ;; Yes/no tells whether the insn is slottable or not. Has_call_slot means
131 ;; that the insn is a call insn, which for CRIS v32 has a delay-slot.
132 ;; Of special concern is that no RTX_FRAME_RELATED insn must go in that
133 ;; call delay slot, as it's located in the address *after* the call insn,
134 ;; and the unwind machinery doesn't know about delay slots.
135 ;; Has_slot means that the insn is a branch insn (which are
136 ;; not considered slottable since that is generally true). Having the
137 ;; seemingly illogical value "has_slot" means we do not have to add
138 ;; another attribute just to say that an insn has a delay-slot, since it
139 ;; also infers that it is not slottable. Better names for the attribute
140 ;; were found to be longer and not add readability to the machine
142 ;; Has_return_slot is similar, for the return insn.
144 ;; The default that is defined here for this attribute is "no", not
145 ;; slottable, not having a delay-slot, so there's no need to worry about
146 ;; it being wrong for non-branch and return instructions.
147 ;; The default could depend on the kind of insn and the addressing
148 ;; mode, but that would need more attributes and hairier, more error
151 ;; There is an extra memory constraint, 'Q', which recognizes an indirect
152 ;; register. The constraints 'Q' and '>' together match all possible
153 ;; memory operands that are slottable.
154 ;; For other operands, you need to check if it has a valid "slottable"
155 ;; quick-immediate operand, where the particular signedness-variation
156 ;; may match the constraints 'I' or 'J'.), and include it in the
157 ;; constraint pattern for the slottable pattern. An alternative using
158 ;; only "r" constraints is most often slottable.
160 (define_attr "slottable" "no,yes,has_slot,has_return_slot,has_call_slot"
163 ;; We also need attributes to sanely determine the condition code
164 ;; state. See cris_notice_update_cc for how this is used.
166 (define_attr "cc" "none,clobber,normal,noov32,rev" (const_string "normal"))
168 ;; At the moment, this attribute is just used to help bb-reorder do its
169 ;; work; the default 0 doesn't help it. Many insns have other lengths,
170 ;; though none are shorter.
171 (define_attr "length" "" (const_int 2))
173 ;; A branch has one delay-slot. The instruction in the
174 ;; delay-slot is always executed, independent of whether the branch is
175 ;; taken or not. Note that besides setting "slottable" to "has_slot",
176 ;; there also has to be a "%#" at the end of a "delayed" instruction
177 ;; output pattern (for "jump" this means "ba %l0%#"), so print_operand can
178 ;; catch it and print a "nop" if necessary. This method was stolen from
181 (define_delay (eq_attr "slottable" "has_slot")
182 [(eq_attr "slottable" "yes") (nil) (nil)])
184 ;; We can't put prologue insns in call-insn delay-slots when
185 ;; DWARF2 unwind info is emitted, because the unwinder matches the
186 ;; address after the insn. It must see the return address of a call at
187 ;; a position at least *one byte after* the insn, or it'll think that
188 ;; the insn hasn't been executed. If the insn is in a delay-slot of a
189 ;; call, it's just *exactly* after the insn.
191 (define_delay (eq_attr "slottable" "has_call_slot")
192 [(and (eq_attr "slottable" "yes")
193 (ior (not (match_test "RTX_FRAME_RELATED_P (insn)"))
194 (not (match_test "flag_exceptions"))))
197 ;; The insn in the return insn slot must not be the
198 ;; return-address-register restore. FIXME: Use has_slot and express
199 ;; as a parallel with a use of the return-address-register (currently
200 ;; only SRP). However, this requires an amount of fixing tests for
201 ;; naked RETURN in middle-end.
202 (define_delay (eq_attr "slottable" "has_return_slot")
203 [(and (eq_attr "slottable" "yes")
204 (not (match_test "dead_or_set_regno_p (insn, CRIS_SRP_REGNUM)")))
208 ;; Iterator definitions.
210 ;; For the "usual" pattern size alternatives.
211 (define_mode_iterator BWD [SI HI QI])
212 (define_mode_iterator WD [SI HI])
213 (define_mode_iterator BW [HI QI])
214 (define_mode_attr S [(SI "HI") (HI "QI")])
215 (define_mode_attr s [(SI "hi") (HI "qi")])
216 (define_mode_attr m [(SI ".d") (HI ".w") (QI ".b")])
217 (define_mode_attr mm [(SI ".w") (HI ".b")])
218 (define_mode_attr nbitsm1 [(SI "31") (HI "15") (QI "7")])
220 ;; For the sign_extend+zero_extend variants.
221 (define_code_iterator szext [sign_extend zero_extend])
222 (define_code_attr u [(sign_extend "") (zero_extend "u")])
223 (define_code_attr su [(sign_extend "s") (zero_extend "u")])
225 ;; For the shift variants.
226 (define_code_iterator shift [ashiftrt lshiftrt ashift])
227 (define_code_iterator shiftrt [ashiftrt lshiftrt])
228 (define_code_attr shlr [(ashiftrt "ashr") (lshiftrt "lshr") (ashift "ashl")])
229 (define_code_attr slr [(ashiftrt "asr") (lshiftrt "lsr") (ashift "lsl")])
231 (define_code_iterator ncond [eq ne gtu ltu geu leu])
232 (define_code_iterator ocond [gt le])
233 (define_code_iterator rcond [lt ge])
234 (define_code_attr CC [(eq "eq") (ne "ne") (gt "gt") (gtu "hi") (lt "lt")
235 (ltu "lo") (ge "ge") (geu "hs") (le "le") (leu "ls")])
236 (define_code_attr rCC [(eq "ne") (ne "eq") (gt "le") (gtu "ls") (lt "ge")
237 (ltu "hs") (ge "lt") (geu "lo") (le "gt") (leu "hi")])
238 (define_code_attr oCC [(lt "mi") (ge "pl")])
239 (define_code_attr roCC [(lt "pl") (ge "mi")])
241 ;; Operand and operator predicates.
243 (include "predicates.md")
244 (include "constraints.md")
248 ;; No test insns with side-effect on the mem addressing.
250 ;; See note on cmp-insns with side-effects (or lack of them)
252 ;; Normal named test patterns from SI on.
254 (define_insn "*tstsi"
256 (compare (match_operand:SI 0 "nonimmediate_operand" "r,Q>,m")
260 if (which_alternative == 0 && TARGET_V32)
264 [(set_attr "slottable" "yes,yes,no")])
266 (define_insn "*tst<mode>_cmp"
268 (compare (match_operand:BW 0 "nonimmediate_operand" "r,Q>,m")
270 "cris_cc0_user_requires_cmp (insn)"
275 [(set_attr "slottable" "no,yes,no")])
277 (define_insn "*tst<mode>_non_cmp"
279 (compare (match_operand:BW 0 "nonimmediate_operand" "r,Q>,m")
281 "!cris_cc0_user_requires_cmp (insn)"
286 [(set_attr "slottable" "yes,yes,no")
287 (set_attr "cc" "noov32,*,*")])
289 ;; It seems that the position of the sign-bit and the fact that 0.0 is
290 ;; all 0-bits would make "tstsf" a straight-forward implementation;
291 ;; either "test.d" it for positive/negative or "btstq 30,r" it for
294 ;; FIXME: Do that some time; check next_cc0_user to determine if
295 ;; zero or negative is tested for.
299 ;; We could optimize the sizes of the immediate operands for various
300 ;; cases, but that is not worth it because of the very little usage of
301 ;; DImode for anything else but a structure/block-mode. Just do the
302 ;; obvious stuff for the straight-forward constraint letters.
304 (define_insn "*cmpdi_non_v32"
306 (compare (match_operand:DI 0 "nonimmediate_operand" "rm,r,r,r,r,r,r,o")
307 (match_operand:DI 1 "general_operand" "M,Kc,I,P,n,r,o,r")))]
310 test.d %M0\;ax\;test.d %H0
311 cmpq %1,%M0\;ax\;cmpq 0,%H0
312 cmpq %1,%M0\;ax\;cmpq -1,%H0
313 cmp%e1.%z1 %1,%M0\;ax\;cmpq %H1,%H0
314 cmp.d %M1,%M0\;ax\;cmp.d %H1,%H0
315 cmp.d %M1,%M0\;ax\;cmp.d %H1,%H0
316 cmp.d %M1,%M0\;ax\;cmp.d %H1,%H0
317 cmp.d %M0,%M1\;ax\;cmp.d %H0,%H1")
319 (define_insn "*cmpdi_v32"
321 (compare (match_operand:DI 0 "register_operand" "r,r,r,r,r")
322 (match_operand:DI 1 "nonmemory_operand" "Kc,I,P,n,r")))]
325 cmpq %1,%M0\;ax\;cmpq 0,%H0
326 cmpq %1,%M0\;ax\;cmpq -1,%H0
327 cmp%e1.%z1 %1,%M0\;ax\;cmpq %H1,%H0
328 cmp.d %M1,%M0\;ax\;cmp.d %H1,%H0
329 cmp.d %M1,%M0\;ax\;cmp.d %H1,%H0")
331 ;; Note that compare insns with side effect addressing mode (e.g.):
333 ;; cmp.S [rx=ry+i],rz;
334 ;; cmp.S [%3=%1+%2],%0
336 ;; are *not* usable for gcc since the reloader *does not accept*
337 ;; cc0-changing insns with side-effects other than setting the condition
338 ;; codes. The reason is that the reload stage *may* cause another insn to
339 ;; be output after the main instruction, in turn invalidating cc0 for the
340 ;; insn using the test. (This does not apply to the CRIS case, since a
341 ;; reload for output -- move to memory -- does not change the condition
342 ;; code. Unfortunately we have no way to describe that at the moment. I
343 ;; think code would improve being in the order of one percent faster.
345 ;; We have cmps and cmpu (compare reg w. sign/zero extended mem).
346 ;; These are mostly useful for compares in SImode, using 8 or 16-bit
347 ;; constants, but sometimes gcc will find its way to use it for other
348 ;; (memory) operands. Avoid side-effect patterns, though (see above).
350 (define_insn "*cmp_ext<mode>"
353 (match_operand:SI 0 "register_operand" "r,r")
354 (match_operator:SI 2 "cris_extend_operator"
355 [(match_operand:BW 1 "memory_operand" "Q>,m")])))]
358 [(set_attr "slottable" "yes,no")])
360 ;; Swap operands; it seems the canonical look (if any) is not enforced.
362 ;; FIXME: Investigate that.
364 (define_insn "*cmp_swapext<mode>"
367 (match_operator:SI 2 "cris_extend_operator"
368 [(match_operand:BW 0 "memory_operand" "Q>,m")])
369 (match_operand:SI 1 "register_operand" "r,r")))]
372 [(set_attr "slottable" "yes,no")
373 (set_attr "cc" "rev")])
375 ;; The "normal" compare patterns, from SI on. Special-cases with zero
376 ;; are covered above.
378 (define_insn "*cmpsi"
381 (match_operand:SI 0 "nonimmediate_operand" "r,r,r, Q>,r,r,m")
382 (match_operand:SI 1 "general_operand" "I,r,Q>,r, P,g,r")))]
392 [(set_attr "slottable" "yes,yes,yes,yes,no,no,no")
393 (set_attr "cc" "normal,normal,normal,rev,normal,normal,rev")])
395 (define_insn "*cmp<mode>"
397 (compare (match_operand:BW 0 "nonimmediate_operand" "r,r, Q>,r,m")
398 (match_operand:BW 1 "general_operand" "r,Q>,r, g,r")))]
406 [(set_attr "slottable" "yes,yes,yes,no,no")
407 (set_attr "cc" "normal,normal,rev,normal,rev")])
409 ;; Pattern matching the BTST insn.
410 ;; It is useful for "if (i & val)" constructs, where val is an exact
411 ;; power of 2, or if val + 1 is a power of two, where we check for a bunch
412 ;; of zeros starting at bit 0).
414 ;; SImode. This mode is the only one needed, since gcc automatically
415 ;; extends subregs for lower-size modes. FIXME: Add testcase.
420 (match_operand:SI 0 "nonmemory_operand" "r, r,r, r,r, r,Kp")
421 (match_operand:SI 1 "const_int_operand" "Kc,n,Kc,n,Kc,n,n")
422 (match_operand:SI 2 "nonmemory_operand" "M, M,Kc,n,r, r,r"))
424 ;; Either it is a single bit, or consecutive ones starting at 0.
425 ;; The btst ones depend on stuff in NOTICE_UPDATE_CC.
426 "CONST_INT_P (operands[1])
427 && (operands[1] == const1_rtx || operands[2] == const0_rtx)
428 && (REG_S_P (operands[0])
429 || (operands[1] == const1_rtx
430 && REG_S_P (operands[2])
431 && CONST_INT_P (operands[0])
432 && exact_log2 (INTVAL (operands[0])) >= 0))
435 ;; The next-to-last "&&" condition above should be caught by some kind of
436 ;; canonicalization in gcc, but we can easily help with it here.
437 ;; It results from expressions of the type
438 ;; "power_of_2_value & (1 << y)".
440 ;; Since there may be codes with tests in on bits (in constant position)
441 ;; beyond the size of a word, handle that by assuming those bits are 0.
442 ;; GCC should handle that, but it's a matter of easily-added belts while
443 ;; having suspenders.
453 [(set_attr "slottable" "yes")
454 (set_attr "cc" "noov32")])
458 ;; The whole mandatory movdi family is here; expander, "anonymous"
459 ;; recognizer and splitter. We're forced to have a movdi pattern,
460 ;; although GCC should be able to split it up itself. Normally it can,
461 ;; but if other insns have DI operands (as is the case here), reload
462 ;; must be able to generate or match a movdi. many testcases fail at
463 ;; -O3 or -fssa if we don't have this. FIXME: Fix GCC... See
464 ;; <URL:http://gcc.gnu.org/ml/gcc-patches/2000-04/msg00104.html>.
465 ;; However, a patch from Richard Kenner (similar to the cause of
466 ;; discussion at the URL above), indicates otherwise. See
467 ;; <URL:http://gcc.gnu.org/ml/gcc-patches/2000-04/msg00554.html>.
468 ;; The truth has IMO is not been decided yet, so check from time to
469 ;; time by disabling the movdi patterns.
471 ;; To appease testcase gcc.c-torture/execute/920501-2.c (and others) at
472 ;; -O0, we need a movdi as a temporary measure. Here's how things fail:
473 ;; A cmpdi RTX needs reloading (global):
474 ;; (insn 185 326 186 (set (cc0)
475 ;; (compare (mem/f:DI (reg/v:SI 22) 0)
476 ;; (const_int 1 [0x1]))) 4 {cmpdi} (nil)
478 ;; Now, reg 22 is reloaded for input address, and the mem is also moved
479 ;; out of the instruction (into a register), since one of the operands
480 ;; must be a register. Reg 22 is reloaded (into reg 10), and the mem is
481 ;; moved out and synthesized in SImode parts (reg 9, reg 10 - should be ok
482 ;; wrt. overlap). The bad things happen with the synthesis in
483 ;; emit_move_insn_1; the location where to substitute reg 10 is lost into
484 ;; two new RTX:es, both still having reg 22. Later on, the left-over reg
485 ;; 22 is recognized to have an equivalent in memory which is substituted
486 ;; straight in, and we end up with an unrecognizable insn:
487 ;; (insn 325 324 326 (set (reg:SI 9 r9)
488 ;; (mem/f:SI (mem:SI (plus:SI (reg:SI 8 r8)
489 ;; (const_int -84 [0xffffffac])) 0) 0)) -1 (nil)
491 ;; which is the first part of the reloaded synthesized "movdi".
492 ;; The right thing would be to add equivalent replacement locations for
493 ;; insn with pseudos that need more reloading. The question is where.
495 (define_expand "movdi"
496 [(set (match_operand:DI 0 "nonimmediate_operand" "")
497 (match_operand:DI 1 "general_operand" ""))]
500 if (MEM_P (operands[0])
501 && operands[1] != const0_rtx
502 && can_create_pseudo_p ()
503 && (!TARGET_V32 || !REG_P (operands[1])))
504 operands[1] = copy_to_mode_reg (DImode, operands[1]);
506 /* Some other ports (as of 2001-09-10 for example mcore and romp) also
507 prefer to split up constants early, like this. The testcase in
508 gcc.c-torture/execute/961213-1.c shows that CSE2 gets confused by the
509 resulting subreg sets when using the construct from mcore (as of FSF
510 CVS, version -r 1.5), and it believes that the high part (the last one
511 emitted) is the final value. */
512 if ((CONST_INT_P (operands[1]) || GET_CODE (operands[1]) == CONST_DOUBLE)
513 && ! reload_completed
514 && ! reload_in_progress)
517 rtx op0 = operands[0];
518 rtx op1 = operands[1];
521 emit_move_insn (operand_subword (op0, 0, 1, DImode),
522 operand_subword (op1, 0, 1, DImode));
523 emit_move_insn (operand_subword (op0, 1, 1, DImode),
524 operand_subword (op1, 1, 1, DImode));
525 insns = get_insns ();
533 (define_insn_and_split "*movdi_insn_non_v32"
534 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,rx,m")
535 (match_operand:DI 1 "general_operand" "rx,g,rxM"))]
536 "(register_operand (operands[0], DImode)
537 || register_operand (operands[1], DImode)
538 || operands[1] == const0_rtx)
541 "&& reload_completed"
543 "operands[2] = cris_split_movdx (operands);")
545 ;; Overlapping (but non-identical) source memory address and destination
546 ;; register would be a compiler bug, so we don't have to specify that.
547 (define_insn "*movdi_v32"
549 (match_operand:DI 0 "nonimmediate_operand" "=r,rx,&r,>, m,r,x,m")
550 (match_operand:DI 1 "general_operand" "rxi,r>,m, rx,r,m,m,x"))]
553 switch (which_alternative)
555 /* FIXME: 1) Use autoincrement where possible. 2) Have peephole2,
556 particularly for cases where the address register is dead. */
558 if (REGNO (operands[0]) == REGNO (XEXP (operands[1], 0)))
559 return "addq 4,%L1\;move.d %1,%H0\;subq 4,%L1\;move.d %1,%M0";
560 gcc_assert (REGNO (operands[0]) + 1 == REGNO (XEXP (operands[1], 0)));
561 return "move.d [%L1+],%M0\;move.d [%L1],%H0";
563 /* We could do away with the addq if we knew the address-register
564 isn't ACR. If we knew the address-register is dead, we could do
565 away with the subq too. */
566 return "move.d [%L1],%M0\;addq 4,%L1\;move.d [%L1],%H0\;subq 4,%L1";
568 return "move.d %M1,[%L0]\;addq 4,%L0\;move.d %H1,[%L0]\;subq 4,%L0";
570 return "move [%L1],%M0\;addq 4,%L1\;move [%L1],%H0\;subq 4,%L1";
572 return "move %M1,[%L0]\;addq 4,%L0\;move %H1,[%L0]\;subq 4,%L0";
578 ;; The non-split cases clobber cc0 because of their adds and subs.
579 ;; Beware that NOTICE_UPDATE_CC is called before the forced split happens.
580 [(set_attr "cc" "*,*,clobber,*,clobber,clobber,*,*")])
582 ;; Much like "*movdi_insn_non_v32". Overlapping registers and constants
583 ;; is handled so much better in cris_split_movdx.
585 [(set (match_operand:DI 0 "nonimmediate_operand" "")
586 (match_operand:DI 1 "general_operand" ""))]
589 && (!MEM_P (operands[0]) || !REG_P (XEXP (operands[0], 0)))
590 && (!MEM_P (operands[1]) || !REG_P (XEXP (operands[1], 0)))"
592 "operands[2] = cris_split_movdx (operands);")
594 ;; Side-effect patterns for move.S1 [rx=ry+rx.S2],rw
595 ;; and move.S1 [rx=ry+i],rz
596 ;; Then movs.S1 and movu.S1 for both modes.
598 ;; move.S1 [rx=ry+rz.S],rw avoiding when rx is ry, or rw is rx
599 ;; FIXME: These could have anonymous mode for operand 0.
600 ;; FIXME: Special registers' alternatives too.
602 (define_insn "*mov_side<mode>_biap"
603 [(set (match_operand:BW 0 "register_operand" "=r,r")
605 (mult:SI (match_operand:SI 1 "register_operand" "r,r")
606 (match_operand:SI 2 "const_int_operand" "n,n"))
607 (match_operand:SI 3 "register_operand" "r,r"))))
608 (set (match_operand:SI 4 "register_operand" "=*3,r")
609 (plus:SI (mult:SI (match_dup 1)
612 "cris_side_effect_mode_ok (MULT, operands, 4, 3, 1, 2, 0)"
615 move<m> [%4=%3+%1%T2],%0")
617 (define_insn "*mov_sidesisf_biap"
618 [(set (match_operand 0 "register_operand" "=r,r,x,x")
620 (mult:SI (match_operand:SI 1 "register_operand" "r,r,r,r")
621 (match_operand:SI 2 "const_int_operand" "n,n,n,n"))
622 (match_operand:SI 3 "register_operand" "r,r,r,r"))))
623 (set (match_operand:SI 4 "register_operand" "=*3,r,*3,r")
624 (plus:SI (mult:SI (match_dup 1)
627 "GET_MODE_SIZE (GET_MODE (operands[0])) == UNITS_PER_WORD
628 && cris_side_effect_mode_ok (MULT, operands, 4, 3, 1, 2, 0)"
631 move.%s0 [%4=%3+%1%T2],%0
633 move [%4=%3+%1%T2],%0")
635 ;; move.S1 [rx=ry+i],rz
636 ;; avoiding move.S1 [ry=ry+i],rz
637 ;; and move.S1 [rz=ry+i],rz
638 ;; Note that "i" is allowed to be a register.
640 (define_insn "*mov_side<mode>"
641 [(set (match_operand:BW 0 "register_operand" "=r,r,r,r,r")
643 (plus:SI (match_operand:SI 1 "cris_bdap_operand" "%r,r,r,R,R")
644 (match_operand:SI 2 "cris_bdap_operand" "r>Rn,r,>Rn,r,r"))))
645 (set (match_operand:SI 3 "register_operand" "=*1,r,r,*2,r")
646 (plus:SI (match_dup 1)
648 "cris_side_effect_mode_ok (PLUS, operands, 3, 1, 2, -1, 0)"
650 if ((which_alternative == 0 || which_alternative == 3)
651 && (!CONST_INT_P (operands[2])
652 || INTVAL (operands[2]) > 127
653 || INTVAL (operands[2]) < -128
654 || satisfies_constraint_N (operands[2])
655 || satisfies_constraint_J (operands[2])))
657 if (which_alternative == 4)
658 return "move<m> [%3=%2%S1],%0";
659 return "move<m> [%3=%1%S2],%0";
662 (define_insn "*mov_sidesisf"
663 [(set (match_operand 0 "register_operand" "=r,r,r,x,x,x,r,r,x,x")
666 (match_operand:SI 1 "cris_bdap_operand" "%r,r,r,r,r,r,R,R,R,R")
667 (match_operand:SI 2 "cris_bdap_operand" "r>Rn,r,>Rn,r>Rn,r,>Rn,r,r,r,r"))))
668 (set (match_operand:SI 3 "register_operand" "=*1,r,r,*1,r,r,*2,r,*2,r")
669 (plus:SI (match_dup 1)
671 "GET_MODE_SIZE (GET_MODE (operands[0])) == UNITS_PER_WORD
672 && cris_side_effect_mode_ok (PLUS, operands, 3, 1, 2, -1, 0)"
674 if ((which_alternative == 0
675 || which_alternative == 3
676 || which_alternative == 6
677 || which_alternative == 8)
678 && (!CONST_INT_P (operands[2])
679 || INTVAL (operands[2]) > 127
680 || INTVAL (operands[2]) < -128
681 || satisfies_constraint_N (operands[2])
682 || satisfies_constraint_J (operands[2])))
684 if (which_alternative < 3)
685 return "move.%s0 [%3=%1%S2],%0";
686 if (which_alternative == 7)
687 return "move.%s0 [%3=%2%S1],%0";
688 if (which_alternative == 9)
689 return "move [%3=%2%S1],%0";
690 return "move [%3=%1%S2],%0";
693 ;; Other way around; move to memory.
695 ;; Note that the condition (which for side-effect patterns is usually a
696 ;; call to cris_side_effect_mode_ok), isn't consulted for register
697 ;; allocation preferences -- constraints is the method for that. The
698 ;; drawback is that we can't exclude register allocation to cause
699 ;; "move.s rw,[rx=ry+rz.S]" when rw==rx without also excluding rx==ry or
700 ;; rx==rz if we use an earlyclobber modifier for the constraint for rx.
701 ;; Instead of that, we recognize and split the cases where dangerous
702 ;; register combinations are spotted: where a register is set in the
703 ;; side-effect, and used in the main insn. We don't handle the case where
704 ;; the set in the main insn overlaps the set in the side-effect; that case
705 ;; must be handled in gcc. We handle just the case where the set in the
706 ;; side-effect overlaps the input operand of the main insn (i.e. just
710 ;; move.s rz,[ry=rx+rw.S]
712 (define_insn "*mov_side<mode>_biap_mem"
713 [(set (mem:BW (plus:SI
714 (mult:SI (match_operand:SI 0 "register_operand" "r,r,r")
715 (match_operand:SI 1 "const_int_operand" "n,n,n"))
716 (match_operand:SI 2 "register_operand" "r,r,r")))
717 (match_operand:BW 3 "register_operand" "r,r,r"))
718 (set (match_operand:SI 4 "register_operand" "=*2,!3,r")
719 (plus:SI (mult:SI (match_dup 0)
722 "cris_side_effect_mode_ok (MULT, operands, 4, 2, 0, 1, 3)"
726 move<m> %3,[%4=%2+%0%T1]")
728 (define_insn "*mov_sidesisf_biap_mem"
730 (mult:SI (match_operand:SI 0 "register_operand" "r,r,r,r,r,r")
731 (match_operand:SI 1 "const_int_operand" "n,n,n,n,n,n"))
732 (match_operand:SI 2 "register_operand" "r,r,r,r,r,r")))
733 (match_operand 3 "register_operand" "r,r,r,x,x,x"))
734 (set (match_operand:SI 4 "register_operand" "=*2,!3,r,*2,!3,r")
735 (plus:SI (mult:SI (match_dup 0)
738 "GET_MODE_SIZE (GET_MODE (operands[3])) == UNITS_PER_WORD
739 && cris_side_effect_mode_ok (MULT, operands, 4, 2, 0, 1, 3)"
743 move.%s3 %3,[%4=%2+%0%T1]
746 move %3,[%4=%2+%0%T1]")
748 ;; Split for the case above where we're out of luck with register
749 ;; allocation (again, the condition isn't checked for that), and we end up
750 ;; with the set in the side-effect getting the same register as the input
755 [(set (match_operator
758 (mult:SI (match_operand:SI 0 "register_operand" "")
759 (match_operand:SI 1 "const_int_operand" ""))
760 (match_operand:SI 2 "register_operand" ""))])
761 (match_operand 3 "register_operand" ""))
762 (set (match_operand:SI 4 "cris_nonsp_register_operand" "")
763 (plus:SI (mult:SI (match_dup 0)
766 "reload_completed && reg_overlap_mentioned_p (operands[4], operands[3])"
767 [(set (match_dup 5) (match_dup 3))
768 (set (match_dup 4) (match_dup 2))
770 (plus:SI (mult:SI (match_dup 0)
774 = replace_equiv_address (operands[6],
775 gen_rtx_PLUS (SImode,
776 gen_rtx_MULT (SImode,
781 ;; move.s rx,[ry=rz+i]
782 ;; FIXME: These could have anonymous mode for operand 2.
786 (define_insn "*mov_side<mode>_mem"
788 (plus:SI (match_operand:SI 0 "cris_bdap_operand" "%r,r,r,r,R,R,R")
789 (match_operand:SI 1 "cris_bdap_operand" "r>Rn,r>Rn,r,>Rn,r,r,r")))
790 (match_operand:BW 2 "register_operand" "r,r,r,r,r,r,r"))
791 (set (match_operand:SI 3 "register_operand" "=*0,!*2,r,r,*1,!*2,r")
792 (plus:SI (match_dup 0)
794 "cris_side_effect_mode_ok (PLUS, operands, 3, 0, 1, -1, 2)"
796 if ((which_alternative == 0 || which_alternative == 4)
797 && (!CONST_INT_P (operands[1])
798 || INTVAL (operands[1]) > 127
799 || INTVAL (operands[1]) < -128
800 || satisfies_constraint_N (operands[1])
801 || satisfies_constraint_J (operands[1])))
803 if (which_alternative == 1 || which_alternative == 5)
805 if (which_alternative == 6)
806 return "move.%s2 %2,[%3=%1%S0]";
807 return "move<m> %2,[%3=%0%S1]";
812 (define_insn "*mov_sidesisf_mem"
816 0 "cris_bdap_operand"
817 "%r, r, r,r, r, r,r, R,R, R,R, R")
819 1 "cris_bdap_operand"
820 "r>Rn,r>Rn,r,>Rn,r>Rn,r,>Rn,r,r, r,r, r")))
821 (match_operand 2 "register_operand"
822 "r, r, r,r, x, x,x, r,r, r,x, x"))
823 (set (match_operand:SI 3 "register_operand"
824 "=*0,!2, r,r, *0, r,r, *1,!*2,r,*1,r")
825 (plus:SI (match_dup 0)
827 "GET_MODE_SIZE (GET_MODE (operands[2])) == UNITS_PER_WORD
828 && cris_side_effect_mode_ok (PLUS, operands, 3, 0, 1, -1, 2)"
830 if ((which_alternative == 0 || which_alternative == 4)
831 && (!CONST_INT_P (operands[1])
832 || INTVAL (operands[1]) > 127
833 || INTVAL (operands[1]) < -128
834 || satisfies_constraint_N (operands[1])
835 || satisfies_constraint_J (operands[1])))
837 if (which_alternative == 1
838 || which_alternative == 7
839 || which_alternative == 8
840 || which_alternative == 10)
842 if (which_alternative < 4)
843 return "move.%s2 %2,[%3=%0%S1]";
844 if (which_alternative == 9)
845 return "move.%s2 %2,[%3=%1%S0]";
846 if (which_alternative == 11)
847 return "move %2,[%3=%1%S0]";
848 return "move %2,[%3=%0%S1]";
851 ;; Like the biap case, a split where the set in the side-effect gets the
852 ;; same register as the input register to the main insn, since the
853 ;; condition isn't checked at register allocation.
857 [(set (match_operator
860 (match_operand:SI 0 "cris_bdap_operand" "")
861 (match_operand:SI 1 "cris_bdap_operand" ""))])
862 (match_operand 2 "register_operand" ""))
863 (set (match_operand:SI 3 "cris_nonsp_register_operand" "")
864 (plus:SI (match_dup 0) (match_dup 1)))])]
865 "reload_completed && reg_overlap_mentioned_p (operands[3], operands[2])"
866 [(set (match_dup 4) (match_dup 2))
867 (set (match_dup 3) (match_dup 0))
868 (set (match_dup 3) (plus:SI (match_dup 3) (match_dup 1)))]
871 ;; Clear memory side-effect patterns. It is hard to get to the mode if
872 ;; the MEM was anonymous, so there will be one for each mode.
874 ;; clear.[bwd] [ry=rx+rw.s2]
876 (define_insn "*clear_side<mode>_biap"
877 [(set (mem:BWD (plus:SI
878 (mult:SI (match_operand:SI 0 "register_operand" "r,r")
879 (match_operand:SI 1 "const_int_operand" "n,n"))
880 (match_operand:SI 2 "register_operand" "r,r")))
882 (set (match_operand:SI 3 "register_operand" "=*2,r")
883 (plus:SI (mult:SI (match_dup 0)
886 "cris_side_effect_mode_ok (MULT, operands, 3, 2, 0, 1, -1)"
889 clear<m> [%3=%2+%0%T1]")
891 ;; clear.[bwd] [ry=rz+i]
893 (define_insn "*clear_side<mode>"
895 (plus:SI (match_operand:SI 0 "cris_bdap_operand" "%r,r,r,R,R")
896 (match_operand:SI 1 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")))
898 (set (match_operand:SI 2 "register_operand" "=*0,r,r,*1,r")
899 (plus:SI (match_dup 0)
901 "cris_side_effect_mode_ok (PLUS, operands, 2, 0, 1, -1, -1)"
903 if ((which_alternative == 0 || which_alternative == 3)
904 && (!CONST_INT_P (operands[1])
905 || INTVAL (operands[1]) > 127
906 || INTVAL (operands[1]) < -128
907 || satisfies_constraint_N (operands[1])
908 || satisfies_constraint_J (operands[1])))
910 if (which_alternative == 4)
911 return "clear<m> [%2=%1%S0]";
912 return "clear<m> [%2=%0%S1]";
915 ;; Normal move patterns from SI on.
917 (define_expand "movsi"
919 (match_operand:SI 0 "nonimmediate_operand" "")
920 (match_operand:SI 1 "cris_general_operand_or_symbol" ""))]
923 enum cris_symbol_type t;
925 /* If the output goes to a MEM, make sure we have zero or a register as
927 if (MEM_P (operands[0])
928 && ! REG_S_P (operands[1])
929 && operands[1] != const0_rtx
930 && can_create_pseudo_p ())
931 operands[1] = force_reg (SImode, operands[1]);
933 /* If we're generating PIC and have an incoming symbol, validize it to a
934 general operand or something that will match a special pattern.
936 FIXME: Do we *have* to recognize anything that would normally be a
937 valid symbol? Can we exclude global PIC addresses with an added
940 && CONSTANT_P (operands[1])
941 && !cris_valid_pic_const (operands[1], false))
943 t = cris_symbol_type_of (operands[1]);
945 gcc_assert (t != cris_no_symbol && t != cris_offsettable_symbol);
947 if (! REG_S_P (operands[0]))
949 /* We must have a register as destination for what we're about to
950 do, and for the patterns we generate. */
951 CRIS_ASSERT (can_create_pseudo_p ());
952 operands[1] = force_reg (SImode, operands[1]);
956 /* FIXME: add a REG_EQUAL (or is it REG_EQUIV) note to the
957 destination register for the symbol. It might not be
958 worth it. Measure. */
959 crtl->uses_pic_offset_table = 1;
960 if (t == cris_rel_symbol)
962 /* Change a "move.d sym(+offs),rN" into (allocate register rM)
964 "move.d (const (plus (unspec [sym]
965 CRIS_UNSPEC_GOTREL) offs)),rM" "add.d rPIC,rM,rN"
967 "move.d (const (plus (unspec [sym]
968 CRIS_UNSPEC_PCREL) offs)),rN". */
969 rtx tem, rm, rn = operands[0];
970 rtx sym = GET_CODE (operands[1]) != CONST
971 ? operands[1] : get_related_value (operands[1]);
972 HOST_WIDE_INT offs = get_integer_term (operands[1]);
974 gcc_assert (can_create_pseudo_p ());
978 tem = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym),
981 tem = plus_constant (Pmode, tem, offs);
983 emit_move_insn (rm, gen_rtx_CONST (Pmode, tem));
987 /* We still uses GOT-relative addressing for
989 crtl->uses_pic_offset_table = 1;
990 tem = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym),
993 tem = plus_constant (Pmode, tem, offs);
994 rm = gen_reg_rtx (Pmode);
995 emit_move_insn (rm, gen_rtx_CONST (Pmode, tem));
996 if (expand_binop (Pmode, add_optab, rm, pic_offset_table_rtx,
997 rn, 0, OPTAB_LIB_WIDEN) != rn)
998 internal_error ("expand_binop failed in movsi gotrel");
1002 else if (t == cris_got_symbol)
1004 /* Change a "move.d sym,rN" into (allocate register rM, rO)
1005 "move.d (const (unspec [sym] CRIS_UNSPEC_GOTREAD)),rM"
1006 "add.d rPIC,rM,rO", "move.d [rO],rN" with
1007 the memory access marked as read-only. */
1008 rtx tem, mem, rm, ro, rn = operands[0];
1009 gcc_assert (can_create_pseudo_p ());
1010 tem = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]),
1011 CRIS_UNSPEC_GOTREAD);
1012 rm = gen_reg_rtx (Pmode);
1013 emit_move_insn (rm, gen_rtx_CONST (Pmode, tem));
1014 ro = gen_reg_rtx (Pmode);
1015 if (expand_binop (Pmode, add_optab, rm, pic_offset_table_rtx,
1016 ro, 0, OPTAB_LIB_WIDEN) != ro)
1017 internal_error ("expand_binop failed in movsi got");
1018 mem = gen_rtx_MEM (Pmode, ro);
1020 /* This MEM doesn't alias anything. Whether it
1021 aliases other same symbols is unimportant. */
1022 set_mem_alias_set (mem, new_alias_set ());
1023 MEM_NOTRAP_P (mem) = 1;
1025 /* We can set the GOT memory read of a non-called symbol
1026 to readonly, but not that of a call symbol, as those
1027 are subject to lazy evaluation and usually have the value
1028 changed from the first call to the second (but
1029 constant thereafter). */
1030 MEM_READONLY_P (mem) = 1;
1031 emit_move_insn (rn, mem);
1036 /* We get here when we have to change something that would
1037 be recognizable if it wasn't PIC. A ``sym'' is ok for
1038 PIC symbols both with and without a GOT entry. And ``sym
1039 + offset'' is ok for local symbols, so the only thing it
1040 could be, is a global symbol with an offset. Check and
1042 rtx reg = gen_reg_rtx (Pmode);
1043 rtx sym = get_related_value (operands[1]);
1044 HOST_WIDE_INT offs = get_integer_term (operands[1]);
1046 gcc_assert (can_create_pseudo_p ()
1047 && t == cris_got_symbol_needing_fixup
1048 && sym != NULL_RTX && offs != 0);
1050 emit_move_insn (reg, sym);
1051 if (expand_binop (SImode, add_optab, reg,
1052 GEN_INT (offs), operands[0], 0,
1053 OPTAB_LIB_WIDEN) != operands[0])
1054 internal_error ("expand_binop failed in movsi got+offs");
1061 (define_insn "*movsi_got_load"
1062 [(set (reg:SI CRIS_GOT_REGNUM) (unspec:SI [(const_int 0)] CRIS_UNSPEC_GOT))]
1066 ? "lapc _GLOBAL_OFFSET_TABLE_,%:"
1067 : "move.d $pc,%:\;sub.d .:GOTOFF,%:";
1069 [(set_attr "cc" "clobber")])
1071 (define_insn "*movsi_internal"
1073 (match_operand:SI 0 "nonimmediate_operand"
1074 "=r,r, r,Q>,r,Q>,g,r,r, r,g,rQ>,x, m,x")
1075 (match_operand:SI 1 "cris_general_operand_or_pic_source"
1076 "r,Q>,M,M, I,r, M,n,!S,g,r,x, rQ>,x,gi"))]
1077 ;; Note that we prefer not to use the S alternative (if for some reason
1078 ;; it competes with others) above, but g matches S.
1081 /* Better to have c-switch here; it is worth it to optimize the size of
1082 move insns. The alternative would be to try to find more constraint
1083 letters. FIXME: Check again. It seems this could shrink a bit. */
1084 switch (which_alternative)
1090 && (GET_CODE (operands[1]) == SYMBOL_REF
1091 || GET_CODE (operands[1]) == LABEL_REF
1092 || (GET_CODE (operands[1]) == CONST
1093 && (GET_CODE (XEXP (operands[1], 0)) != UNSPEC
1094 || (XINT (XEXP (operands[1], 0), 1)
1095 == CRIS_UNSPEC_PLT_PCREL)
1096 || (XINT (XEXP (operands[1], 0), 1)
1097 == CRIS_UNSPEC_PCREL)))))
1099 /* FIXME: Express this through (set_attr cc none) instead,
1100 since we can't express the ``none'' at this point. FIXME:
1101 Use lapc for everything except const_int and when next cc0
1102 user would want the flag setting. */
1104 return "lapc %1,%0";
1107 && GET_CODE (operands[1]) == CONST
1108 && GET_CODE (XEXP (operands[1], 0)) == UNSPEC
1109 && XINT (XEXP (operands[1], 0), 1) == CRIS_UNSPEC_GOTREAD)
1110 return "movu.w %1,%0";
1117 return "move.d %1,%0";
1123 return "move %d1,%0";
1128 return "clear.d %0";
1130 /* Constants -32..31 except 0. */
1132 return "moveq %1,%0";
1134 /* We can win a little on constants -32768..-33, 32..65535. */
1136 if (INTVAL (operands[1]) > 0 && INTVAL (operands[1]) < 65536)
1138 if (INTVAL (operands[1]) < 256)
1139 return "movu.b %1,%0";
1140 return "movu.w %1,%0";
1142 else if (INTVAL (operands[1]) >= -32768 && INTVAL (operands[1]) < 32768)
1144 if (INTVAL (operands[1]) >= -128 && INTVAL (operands[1]) < 128)
1145 return "movs.b %1,%0";
1146 return "movs.w %1,%0";
1148 return "move.d %1,%0";
1152 rtx tem = operands[1];
1153 gcc_assert (GET_CODE (tem) == CONST);
1154 tem = XEXP (tem, 0);
1155 if (GET_CODE (tem) == PLUS
1156 && GET_CODE (XEXP (tem, 0)) == UNSPEC
1157 && (XINT (XEXP (tem, 0), 1) == CRIS_UNSPEC_GOTREL
1158 || XINT (XEXP (tem, 0), 1) == CRIS_UNSPEC_PCREL)
1159 && CONST_INT_P (XEXP (tem, 1)))
1160 tem = XEXP (tem, 0);
1161 gcc_assert (GET_CODE (tem) == UNSPEC);
1162 switch (XINT (tem, 1))
1164 case CRIS_UNSPEC_GOTREAD:
1165 case CRIS_UNSPEC_PLTGOTREAD:
1166 /* Using sign-extend mostly to be consistent with the
1167 indexed addressing mode. */
1169 return "movs.w %1,%0";
1170 return "move.d %1,%0";
1172 case CRIS_UNSPEC_GOTREL:
1173 case CRIS_UNSPEC_PLT_GOTREL:
1174 gcc_assert (!TARGET_V32);
1175 return "move.d %1,%0";
1177 case CRIS_UNSPEC_PCREL:
1178 case CRIS_UNSPEC_PLT_PCREL:
1179 gcc_assert (TARGET_V32);
1180 /* LAPC doesn't set condition codes; clear them to make the
1181 (equivalence-marked) result of this insn not presumed
1182 present. This instruction can be a PIC symbol load (for
1183 a hidden symbol) which for weak symbols will be followed
1184 by a test for NULL. */
1186 return "lapc %1,%0";
1193 return "BOGUS: %1 to %0";
1196 [(set_attr "slottable" "yes,yes,yes,yes,yes,yes,no,no,no,no,no,yes,yes,no,no")
1197 (set_attr "cc" "*,*,*,*,*,*,*,*,*,*,*,none,none,none,none")])
1199 ;; Extend operations with side-effect from mem to register, using
1200 ;; MOVS/MOVU. These are from mem to register only.
1206 ;; FIXME: Can we omit extend to HImode, since GCC should truncate for
1207 ;; HImode by itself? Perhaps use only anonymous modes?
1209 (define_insn "*ext_sideqihi_biap"
1210 [(set (match_operand:HI 0 "register_operand" "=r,r")
1212 5 "cris_extend_operator"
1214 (mult:SI (match_operand:SI 1 "register_operand" "r,r")
1215 (match_operand:SI 2 "const_int_operand" "n,n"))
1216 (match_operand:SI 3 "register_operand" "r,r")))]))
1217 (set (match_operand:SI 4 "register_operand" "=*3,r")
1218 (plus:SI (mult:SI (match_dup 1)
1221 "cris_side_effect_mode_ok (MULT, operands, 4, 3, 1, 2, 0)"
1224 mov%e5.%m5 [%4=%3+%1%T2],%0")
1226 (define_insn "*ext_side<mode>si_biap"
1227 [(set (match_operand:SI 0 "register_operand" "=r,r")
1229 5 "cris_extend_operator"
1231 (mult:SI (match_operand:SI 1 "register_operand" "r,r")
1232 (match_operand:SI 2 "const_int_operand" "n,n"))
1233 (match_operand:SI 3 "register_operand" "r,r")))]))
1234 (set (match_operand:SI 4 "register_operand" "=*3,r")
1235 (plus:SI (mult:SI (match_dup 1)
1238 "cris_side_effect_mode_ok (MULT, operands, 4, 3, 1, 2, 0)"
1241 mov%e5<m> [%4=%3+%1%T2],%0")
1243 ;; Same but [rx=ry+i]
1247 (define_insn "*ext_sideqihi"
1248 [(set (match_operand:HI 0 "register_operand" "=r,r,r,r,r")
1250 4 "cris_extend_operator"
1252 (match_operand:SI 1 "cris_bdap_operand" "%r,r,r,R,R")
1253 (match_operand:SI 2 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")))]))
1254 (set (match_operand:SI 3 "register_operand" "=*1,r,r,*2,r")
1255 (plus:SI (match_dup 1)
1257 "cris_side_effect_mode_ok (PLUS, operands, 3, 1, 2, -1, 0)"
1259 if ((which_alternative == 0 || which_alternative == 3)
1260 && (!CONST_INT_P (operands[2])
1261 || INTVAL (operands[2]) > 127
1262 || INTVAL (operands[2]) < -128
1263 || satisfies_constraint_N (operands[2])
1264 || satisfies_constraint_J (operands[2])))
1266 if (which_alternative == 4)
1267 return "mov%e4.%m4 [%3=%2%S1],%0";
1268 return "mov%e4.%m4 [%3=%1%S2],%0";
1271 (define_insn "*ext_side<mode>si"
1272 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r")
1274 4 "cris_extend_operator"
1276 (match_operand:SI 1 "cris_bdap_operand" "%r,r,r,R,R")
1277 (match_operand:SI 2 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")))]))
1278 (set (match_operand:SI 3 "register_operand" "=*1,r,r,*2,r")
1279 (plus:SI (match_dup 1)
1281 "cris_side_effect_mode_ok (PLUS, operands, 3, 1, 2, -1, 0)"
1283 if ((which_alternative == 0 || which_alternative == 3)
1284 && (!CONST_INT_P (operands[2])
1285 || INTVAL (operands[2]) > 127
1286 || INTVAL (operands[2]) < -128
1287 || satisfies_constraint_N (operands[2])
1288 || satisfies_constraint_J (operands[2])))
1290 if (which_alternative == 4)
1291 return "mov%e4<m> [%3=%2%S1],%0";
1292 return "mov%e4<m> [%3=%1%S2],%0";
1295 ;; FIXME: See movsi.
1297 (define_insn "movhi"
1299 (match_operand:HI 0 "nonimmediate_operand" "=r,r, r,Q>,r,Q>,r,r,r,g,g,r,r,x")
1300 (match_operand:HI 1 "general_operand" "r,Q>,M,M, I,r, L,O,n,M,r,g,x,r"))]
1303 switch (which_alternative)
1310 return "move.w %1,%0";
1313 return "move %1,%0";
1317 return "clear.w %0";
1319 return "moveq %1,%0";
1322 if (INTVAL (operands[1]) < 256 && INTVAL (operands[1]) >= -128)
1324 if (INTVAL (operands[1]) > 0)
1325 return "movu.b %1,%0";
1326 return "movs.b %1,%0";
1328 return "move.w %1,%0";
1330 return "movEq %b1,%0";
1332 return "BOGUS: %1 to %0";
1335 [(set_attr "slottable" "yes,yes,yes,yes,yes,yes,no,yes,no,no,no,no,yes,yes")
1336 (set_attr "cc" "*,*,none,none,*,none,*,clobber,*,none,none,*,none,none")])
1338 (define_insn "movstricthi"
1341 (match_operand:HI 0 "nonimmediate_operand" "+r,r, r,Q>,Q>,g,r,g"))
1342 (match_operand:HI 1 "general_operand" "r,Q>,M,M, r, M,g,r"))]
1353 [(set_attr "slottable" "yes,yes,yes,yes,yes,no,no,no")])
1355 (define_expand "reload_in<mode>"
1356 [(set (match_operand:BW 2 "register_operand" "=r")
1357 (match_operand:BW 1 "memory_operand" "m"))
1358 (set (match_operand:BW 0 "register_operand" "=x")
1363 (define_expand "reload_out<mode>"
1364 [(set (match_operand:BW 2 "register_operand" "=&r")
1365 (match_operand:BW 1 "register_operand" "x"))
1366 (set (match_operand:BW 0 "memory_operand" "=m")
1371 (define_insn "movqi"
1372 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,Q>,r, r,Q>,r,g,g,r,r,r,x")
1373 (match_operand:QI 1 "general_operand" "r,r, Q>,M,M, I,M,r,O,g,x,r"))]
1388 [(set_attr "slottable" "yes,yes,yes,yes,yes,yes,no,no,yes,no,yes,yes")
1389 (set_attr "cc" "*,*,*,*,*,*,*,*,clobber,*,none,none")])
1391 (define_insn "movstrictqi"
1392 [(set (strict_low_part
1393 (match_operand:QI 0 "nonimmediate_operand" "+r,Q>,r, r,Q>,g,g,r"))
1394 (match_operand:QI 1 "general_operand" "r,r, Q>,M,M, M,r,g"))]
1405 [(set_attr "slottable" "yes,yes,yes,yes,yes,no,no,no")])
1407 ;; The valid "quick" bit-patterns are, except for 0.0, denormalized
1408 ;; values REALLY close to 0, and some NaN:s (I think; their exponent is
1409 ;; all ones); the worthwhile one is "0.0".
1410 ;; It will use clear, so we know ALL types of immediate 0 never change cc.
1412 (define_insn "movsf"
1413 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,Q>,r, r,Q>,g,g,r,r,x,Q>,m,x, x")
1414 (match_operand:SF 1 "general_operand" "r,r, Q>,G,G, G,r,g,x,r,x, x,Q>,g"))]
1431 [(set_attr "slottable" "yes,yes,yes,yes,yes,no,no,no,yes,yes,yes,no,yes,no")])
1433 ;; Movem patterns. Primarily for use in function prologue and epilogue.
1434 ;; The V32 variants have an ordering matching the expectations of the
1435 ;; standard names "load_multiple" and "store_multiple"; pre-v32 movem
1436 ;; store R0 in the highest memory location.
1438 (define_expand "load_multiple"
1439 [(match_operand:SI 0 "register_operand" "")
1440 (match_operand:SI 1 "memory_operand" "")
1441 (match_operand:SI 2 "const_int_operand" "")]
1446 /* Apparently the predicate isn't checked, so we need to do so
1447 manually. Once happened for libstdc++-v3 locale_facets.tcc. */
1448 if (!MEM_P (operands[1]))
1451 indreg = XEXP (operands[1], 0);
1453 if (GET_CODE (indreg) == POST_INC)
1454 indreg = XEXP (indreg, 0);
1456 || GET_CODE (operands[2]) != CONST_INT
1457 || !REG_P (operands[0])
1458 || REGNO (operands[0]) != 0
1459 || INTVAL (operands[2]) > CRIS_SP_REGNUM
1460 || (int) REGNO (indreg) < INTVAL (operands[2]))
1463 emit_insn (cris_gen_movem_load (operands[1], operands[2], 0));
1467 (define_expand "store_multiple"
1468 [(match_operand:SI 0 "memory_operand" "")
1469 (match_operand:SI 1 "register_operand" "")
1470 (match_operand:SI 2 "const_int_operand" "")]
1475 /* See load_multiple. */
1476 if (!MEM_P (operands[0]))
1479 indreg = XEXP (operands[0], 0);
1481 if (GET_CODE (indreg) == POST_INC)
1482 indreg = XEXP (indreg, 0);
1484 || GET_CODE (operands[2]) != CONST_INT
1485 || !REG_P (operands[1])
1486 || REGNO (operands[1]) != 0
1487 || INTVAL (operands[2]) > CRIS_SP_REGNUM
1488 || (int) REGNO (indreg) < INTVAL (operands[2]))
1491 cris_emit_movem_store (operands[0], operands[2], 0, false);
1495 (define_insn "*cris_load_multiple"
1496 [(match_parallel 0 "cris_load_multiple_op"
1497 [(set (match_operand:SI 1 "register_operand" "=r,r")
1498 (match_operand:SI 2 "memory_operand" "Q,m"))])]
1501 [(set_attr "cc" "none")
1502 (set_attr "slottable" "yes,no")
1503 ;; Not true, but setting the length to 0 causes return sequences (ret
1504 ;; movem) to have the cost they had when (return) included the movem
1505 ;; and reduces the performance penalty taken for needing to emit an
1506 ;; epilogue (in turn copied by bb-reorder) instead of return patterns.
1507 ;; FIXME: temporary change until all insn lengths are correctly
1508 ;; described. FIXME: have better target control over bb-reorder.
1509 (set_attr "length" "0")])
1511 (define_insn "*cris_store_multiple"
1512 [(match_parallel 0 "cris_store_multiple_op"
1513 [(set (match_operand:SI 2 "memory_operand" "=Q,m")
1514 (match_operand:SI 1 "register_operand" "r,r"))])]
1517 [(set_attr "cc" "none")
1518 (set_attr "slottable" "yes,no")])
1521 ;; Sign- and zero-extend insns with standard names.
1522 ;; Those for integer source operand are ordered with the widest source
1527 (define_insn "extendsidi2"
1528 [(set (match_operand:DI 0 "register_operand" "=r")
1529 (sign_extend:DI (match_operand:SI 1 "general_operand" "g")))]
1531 "move.d %1,%M0\;smi %H0\;neg.d %H0,%H0")
1533 (define_insn "extend<mode>di2"
1534 [(set (match_operand:DI 0 "register_operand" "=r")
1535 (sign_extend:DI (match_operand:BW 1 "general_operand" "g")))]
1537 "movs<m> %1,%M0\;smi %H0\;neg.d %H0,%H0")
1539 (define_insn "extend<mode>si2"
1540 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
1541 (sign_extend:SI (match_operand:BW 1 "general_operand" "r,Q>,g")))]
1544 [(set_attr "slottable" "yes,yes,no")])
1546 ;; To do a byte->word extension, extend to dword, except that the top half
1547 ;; of the register will be clobbered. FIXME: Perhaps this is not needed.
1549 (define_insn "extendqihi2"
1550 [(set (match_operand:HI 0 "register_operand" "=r,r,r")
1551 (sign_extend:HI (match_operand:QI 1 "general_operand" "r,Q>,g")))]
1554 [(set_attr "slottable" "yes,yes,no")])
1557 ;; Zero-extend. The DImode ones are synthesized by gcc, so we don't
1558 ;; specify them here.
1560 (define_insn "zero_extend<mode>si2"
1561 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
1563 (match_operand:BW 1 "nonimmediate_operand" "r,Q>,m")))]
1566 [(set_attr "slottable" "yes,yes,no")])
1568 ;; Same comment as sign-extend QImode to HImode above applies.
1570 (define_insn "zero_extendqihi2"
1571 [(set (match_operand:HI 0 "register_operand" "=r,r,r")
1573 (match_operand:QI 1 "nonimmediate_operand" "r,Q>,m")))]
1576 [(set_attr "slottable" "yes,yes,no")])
1578 ;; All kinds of arithmetic and logical instructions.
1580 ;; First, anonymous patterns to match addressing modes with
1583 ;; op.S [rx=ry+I],rz; (add, sub, or, and, bound).
1587 (define_insn "*op_side<mode>_biap"
1588 [(set (match_operand:BWD 0 "register_operand" "=r,r")
1590 6 "cris_orthogonal_operator"
1591 [(match_operand:BWD 1 "register_operand" "0,0")
1593 (mult:SI (match_operand:SI 2 "register_operand" "r,r")
1594 (match_operand:SI 3 "const_int_operand" "n,n"))
1595 (match_operand:SI 4 "register_operand" "r,r")))]))
1596 (set (match_operand:SI 5 "register_operand" "=*4,r")
1597 (plus:SI (mult:SI (match_dup 2)
1600 "cris_side_effect_mode_ok (MULT, operands, 5, 4, 2, 3, 0)"
1603 %x6<m> [%5=%4+%2%T3],%0")
1605 ;; [rx=ry+i] ([%4=%2+%3])
1607 (define_insn "*op_side<mode>"
1608 [(set (match_operand:BWD 0 "register_operand" "=r,r,r,r,r")
1610 5 "cris_orthogonal_operator"
1611 [(match_operand:BWD 1 "register_operand" "0,0,0,0,0")
1613 (match_operand:SI 2 "cris_bdap_operand" "%r,r,r,R,R")
1614 (match_operand:SI 3 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")))]))
1615 (set (match_operand:SI 4 "register_operand" "=*2,r,r,*3,r")
1616 (plus:SI (match_dup 2)
1618 "cris_side_effect_mode_ok (PLUS, operands, 4, 2, 3, -1, 0)"
1620 if ((which_alternative == 0 || which_alternative == 3)
1621 && (!CONST_INT_P (operands[3])
1622 || INTVAL (operands[3]) > 127
1623 || INTVAL (operands[3]) < -128
1624 || satisfies_constraint_N (operands[3])
1625 || satisfies_constraint_J (operands[3])))
1627 if (which_alternative == 4)
1628 return "%x5.%s0 [%4=%3%S2],%0";
1629 return "%x5<m> [%4=%2%S3],%0";
1632 ;; To match all cases for commutative operations we may have to have the
1633 ;; following pattern for add, or & and. I do not know really, but it does
1634 ;; not break anything.
1636 ;; FIXME: This really ought to be checked.
1638 ;; op.S [rx=ry+I],rz;
1642 (define_insn "*op_swap_side<mode>_biap"
1643 [(set (match_operand:BWD 0 "register_operand" "=r,r")
1645 6 "cris_commutative_orth_op"
1647 (mult:SI (match_operand:SI 2 "register_operand" "r,r")
1648 (match_operand:SI 3 "const_int_operand" "n,n"))
1649 (match_operand:SI 4 "register_operand" "r,r")))
1650 (match_operand:BWD 1 "register_operand" "0,0")]))
1651 (set (match_operand:SI 5 "register_operand" "=*4,r")
1652 (plus:SI (mult:SI (match_dup 2)
1655 "cris_side_effect_mode_ok (MULT, operands, 5, 4, 2, 3, 0)"
1658 %x6<m> [%5=%4+%2%T3],%0")
1660 ;; [rx=ry+i] ([%4=%2+%3])
1661 ;; FIXME: These could have anonymous mode for operand 0.
1665 (define_insn "*op_swap_side<mode>"
1666 [(set (match_operand:BWD 0 "register_operand" "=r,r,r,r,r")
1668 5 "cris_commutative_orth_op"
1670 (plus:SI (match_operand:SI 2 "cris_bdap_operand" "%r,r,r,R,R")
1671 (match_operand:SI 3 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")))
1672 (match_operand:BWD 1 "register_operand" "0,0,0,0,0")]))
1673 (set (match_operand:SI 4 "register_operand" "=*2,r,r,*3,r")
1674 (plus:SI (match_dup 2)
1676 "cris_side_effect_mode_ok (PLUS, operands, 4, 2, 3, -1, 0)"
1678 if ((which_alternative == 0 || which_alternative == 3)
1679 && (!CONST_INT_P (operands[3])
1680 || INTVAL (operands[3]) > 127
1681 || INTVAL (operands[3]) < -128
1682 || satisfies_constraint_N (operands[3])
1683 || satisfies_constraint_J (operands[3])))
1685 if (which_alternative == 4)
1686 return "%x5<m> [%4=%3%S2],%0";
1687 return "%x5<m> [%4=%2%S3],%0";
1690 ;; Add operations, standard names.
1692 ;; Note that for the 'P' constraint, the high part can be -1 or 0. We
1693 ;; output the insn through the 'A' output modifier as "adds.w" and "addq",
1695 (define_expand "adddi3"
1696 [(set (match_operand:DI 0 "register_operand")
1697 (plus:DI (match_operand:DI 1 "register_operand")
1698 (match_operand:DI 2 "general_operand")))]
1701 if (MEM_P (operands[2]) && TARGET_V32)
1702 operands[2] = force_reg (DImode, operands[2]);
1705 (define_insn "*adddi3_non_v32"
1706 [(set (match_operand:DI 0 "register_operand" "=r,r,r,&r,&r")
1707 (plus:DI (match_operand:DI 1 "register_operand" "%0,0,0,0,r")
1708 (match_operand:DI 2 "general_operand" "J,N,P,g,!To")))]
1711 addq %2,%M0\;ax\;addq 0,%H0
1712 subq %n2,%M0\;ax\;subq 0,%H0
1713 add%e2.%z2 %2,%M0\;ax\;%A2 %H2,%H0
1714 add.d %M2,%M0\;ax\;add.d %H2,%H0
1715 add.d %M2,%M1,%M0\;ax\;add.d %H2,%H1,%H0")
1717 ; It seems no use allowing a memory operand for this one, because we'd
1718 ; need a scratch register for incrementing the address.
1719 (define_insn "*adddi3_v32"
1720 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r,r")
1721 (plus:DI (match_operand:DI 1 "register_operand" "%0,0,0,0,0")
1722 (match_operand:DI 2 "nonmemory_operand" "J,N,P,r,n")))]
1725 addq %2,%M0\;addc 0,%H0
1726 subq %n2,%M0\;ax\;subq 0,%H0
1727 add%e2.%z2 %2,%M0\;addc %H2,%H0
1728 add.d %M2,%M0\;addc %H2,%H0
1729 add.d %M2,%M0\;addc %H2,%H0")
1731 (define_expand "add<mode>3"
1732 [(set (match_operand:BWD 0 "register_operand")
1734 (match_operand:BWD 1 "register_operand")
1735 (match_operand:BWD 2 "general_operand")))]
1739 (define_insn "*addsi3_non_v32"
1740 [(set (match_operand:SI 0 "register_operand" "=r,r, r,r,r,r, r,r, r")
1742 (match_operand:SI 1 "register_operand" "%0,0, 0,0,0,0, 0,r, r")
1743 (match_operand:SI 2 "general_operand" "r,Q>,J,N,n,!S,g,!To,0")))]
1745 ;; The last constraint is due to that after reload, the '%' is not
1746 ;; honored, and canonicalization doesn't care about keeping the same
1747 ;; register as in destination. This will happen after insn splitting.
1748 ;; gcc <= 2.7.2. FIXME: Check for gcc-2.9x
1752 switch (which_alternative)
1756 return "add.d %2,%0";
1758 return "addq %2,%0";
1760 return "subq %n2,%0";
1762 /* 'Known value', but not in -63..63.
1763 Check if addu/subu may be used. */
1764 if (INTVAL (operands[2]) > 0)
1766 if (INTVAL (operands[2]) < 256)
1767 return "addu.b %2,%0";
1768 if (INTVAL (operands[2]) < 65536)
1769 return "addu.w %2,%0";
1773 if (INTVAL (operands[2]) >= -255)
1774 return "subu.b %n2,%0";
1775 if (INTVAL (operands[2]) >= -65535)
1776 return "subu.w %n2,%0";
1778 return "add.d %2,%0";
1781 rtx tem = operands[2];
1782 gcc_assert (GET_CODE (tem) == CONST);
1783 tem = XEXP (tem, 0);
1784 if (GET_CODE (tem) == PLUS
1785 && GET_CODE (XEXP (tem, 0)) == UNSPEC
1786 /* We don't allow CRIS_UNSPEC_PCREL here; we can't have a
1787 pc-relative operand in an add insn. */
1788 && XINT (XEXP (tem, 0), 1) == CRIS_UNSPEC_GOTREL
1789 && CONST_INT_P (XEXP (tem, 1)))
1790 tem = XEXP (tem, 0);
1791 gcc_assert (GET_CODE (tem) == UNSPEC);
1792 switch (XINT (tem, 1))
1794 case CRIS_UNSPEC_GOTREAD:
1795 case CRIS_UNSPEC_PLTGOTREAD:
1796 /* Using sign-extend mostly to be consistent with the
1797 indexed addressing mode. */
1799 return "adds.w %2,%0";
1800 return "add.d %2,%0";
1802 case CRIS_UNSPEC_PLT_GOTREL:
1803 case CRIS_UNSPEC_GOTREL:
1804 return "add.d %2,%0";
1810 return "add%u2 %2,%0";
1812 return "add.d %2,%1,%0";
1814 return "add.d %1,%0";
1816 return "BOGUS addsi %2+%1 to %0";
1819 [(set_attr "slottable" "yes,yes,yes,yes,no,no,no,no,yes")])
1821 ; FIXME: Check what's best: having the three-operand ACR alternative
1822 ; before or after the corresponding-operand2 alternative. Check for
1823 ; *all* insns. FIXME: constant constraint letter for -128..127.
1824 (define_insn "*addsi3_v32"
1825 [(set (match_operand:SI 0 "register_operand" "=r,!a,r,!a, r,r,!a,r,!a,r,r,r,!a")
1827 (match_operand:SI 1 "register_operand" "%0,r, 0, r, 0,0,r, 0,r, 0,0,0,r")
1828 (match_operand:SI 2 "general_operand" "r, r, Q>,Q>,J,N,NJ,L,L, P,n,g,g")))]
1844 [(set_attr "slottable" "yes,yes,yes,yes,yes,yes,yes,no,no,no,no,no,no")
1845 (set_attr "cc" "*,none,*,none,*,*,none,*,none,*,*,*,none")])
1847 (define_insn "*addhi3_non_v32"
1848 [(set (match_operand:HI 0 "register_operand" "=r,r, r,r,r,r")
1849 (plus:HI (match_operand:HI 1 "register_operand" "%0,0, 0,0,0,r")
1850 (match_operand:HI 2 "general_operand" "r,Q>,J,N,g,!To")))]
1859 [(set_attr "slottable" "yes,yes,yes,yes,no,no")
1860 (set_attr "cc" "normal,normal,clobber,clobber,normal,normal")])
1862 (define_insn "*addhi3_v32"
1863 [(set (match_operand:HI 0 "register_operand" "=r, !a,r,!a, r,r,!a,r,!a")
1865 (match_operand:HI 1 "register_operand" "%0,r, 0, r, 0,0,r, 0,r")
1866 (match_operand:HI 2 "general_operand" "r, r, Q>,Q>,J,N,NJ,g,g")))]
1878 [(set_attr "slottable" "yes,yes,yes,yes,yes,yes,yes,no,no")
1879 (set_attr "cc" "*,none,*,none,clobber,clobber,none,*,none")])
1881 (define_insn "*addqi3_non_v32"
1882 [(set (match_operand:QI 0 "register_operand" "=r,r, r,r,r,r,r")
1883 (plus:QI (match_operand:QI 1 "register_operand" "%0,0, 0,0,0,0,r")
1884 (match_operand:QI 2 "general_operand" "r,Q>,J,N,O,g,!To")))]
1894 [(set_attr "slottable" "yes,yes,yes,yes,yes,no,no")
1895 (set_attr "cc" "normal,normal,clobber,clobber,clobber,normal,normal")])
1897 (define_insn "*addqi3_v32"
1898 [(set (match_operand:QI 0 "register_operand" "=r,!a,r,!a, r,r,!a,r,r,!a")
1900 (match_operand:QI 1 "register_operand" "%0,r, 0, r, 0,0,r, 0,0,r")
1901 (match_operand:QI 2 "general_operand" "r,r, Q>,Q>,J,N,NJ,O,g,g")))]
1914 [(set_attr "slottable" "yes,yes,yes,yes,yes,yes,yes,yes,no,no")
1915 (set_attr "cc" "*,none,*,none,clobber,clobber,none,clobber,*,none")])
1919 ;; Note that because of insn canonicalization these will *seldom* but
1920 ;; rarely be used with a known constant as an operand.
1922 ;; Note that for the 'P' constraint, the high part can be -1 or 0. We
1923 ;; output the insn through the 'D' output modifier as "subs.w" and "subq",
1925 (define_expand "subdi3"
1926 [(set (match_operand:DI 0 "register_operand")
1927 (minus:DI (match_operand:DI 1 "register_operand")
1928 (match_operand:DI 2 "general_operand")))]
1931 if (TARGET_V32 && MEM_P (operands[2]))
1932 operands[2] = force_reg (DImode, operands[2]);
1935 (define_insn "*subdi3_non_v32"
1936 [(set (match_operand:DI 0 "register_operand" "=r,r,r,&r,&r")
1937 (minus:DI (match_operand:DI 1 "register_operand" "0,0,0,0,r")
1938 (match_operand:DI 2 "general_operand" "J,N,P,g,!To")))]
1941 subq %2,%M0\;ax\;subq 0,%H0
1942 addq %n2,%M0\;ax\;addq 0,%H0
1943 sub%e2.%z2 %2,%M0\;ax\;%D2 %H2,%H0
1944 sub.d %M2,%M0\;ax\;sub.d %H2,%H0
1945 sub.d %M2,%M1,%M0\;ax\;sub.d %H2,%H1,%H0")
1947 (define_insn "*subdi3_v32"
1948 [(set (match_operand:DI 0 "register_operand" "=r,r,r,&r")
1949 (minus:DI (match_operand:DI 1 "register_operand" "0,0,0,0")
1950 (match_operand:DI 2 "nonmemory_operand" "J,N,P,r")))]
1953 subq %2,%M0\;ax\;subq 0,%H0
1954 addq %n2,%M0\;ax\;addq 0,%H0
1955 sub%e2.%z2 %2,%M0\;ax\;%D2 %H2,%H0
1956 sub.d %M2,%M0\;ax\;sub.d %H2,%H0")
1958 (define_expand "sub<mode>3"
1959 [(set (match_operand:BWD 0 "register_operand")
1961 (match_operand:BWD 1 "register_operand")
1962 (match_operand:BWD 2 "general_operand")))]
1966 (define_insn "*subsi3_non_v32"
1967 [(set (match_operand:SI 0 "register_operand" "=r,r, r,r,r,r,r,r")
1969 (match_operand:SI 1 "register_operand" "0,0, 0,0,0,0,0,r")
1970 (match_operand:SI 2 "general_operand" "r,Q>,J,N,P,n,g,!To")))]
1973 ;; This does not do the optimal: "addu.w 65535,r0" when %2 is negative.
1974 ;; But then again, %2 should not be negative.
1985 [(set_attr "slottable" "yes,yes,yes,yes,no,no,no,no")])
1987 (define_insn "*subsi3_v32"
1988 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r,r,r")
1990 (match_operand:SI 1 "register_operand" "0,0,0,0,0,0,0")
1991 (match_operand:SI 2 "general_operand" "r,Q>,J,N,P,n,g")))]
2001 [(set_attr "slottable" "yes,yes,yes,yes,no,no,no")])
2003 (define_insn "*sub<mode>3_nonv32"
2004 [(set (match_operand:BW 0 "register_operand" "=r,r, r,r,r,r")
2005 (minus:BW (match_operand:BW 1 "register_operand" "0,0, 0,0,0,r")
2006 (match_operand:BW 2 "general_operand" "r,Q>,J,N,g,!To")))]
2015 [(set_attr "slottable" "yes,yes,yes,yes,no,no")
2016 (set_attr "cc" "normal,normal,clobber,clobber,normal,normal")])
2018 (define_insn "*sub<mode>3_v32"
2019 [(set (match_operand:BW 0 "register_operand" "=r,r,r,r,r")
2020 (minus:BW (match_operand:BW 1 "register_operand" "0,0,0,0,0")
2021 (match_operand:BW 2 "general_operand" "r,Q>,J,N,g")))]
2029 [(set_attr "slottable" "yes,yes,yes,yes,no")
2030 (set_attr "cc" "normal,normal,clobber,clobber,normal")])
2032 ;; CRIS has some add/sub-with-sign/zero-extend instructions.
2033 ;; Although these perform sign/zero-extension to SImode, they are
2034 ;; equally applicable for the HImode case.
2035 ;; FIXME: Check; GCC should handle the widening.
2036 ;; Note that these must be located after the normal add/sub patterns,
2037 ;; so not to get constants into any less specific operands.
2039 ;; Extend with add/sub and side-effect.
2041 ;; ADDS/SUBS/ADDU/SUBU and BOUND, which needs a check for zero_extend
2043 ;; adds/subs/addu/subu bound [rx=ry+rz.S]
2046 ;; FIXME: GCC should widen.
2048 (define_insn "*extopqihi_side_biap"
2049 [(set (match_operand:HI 0 "register_operand" "=r,r")
2051 6 "cris_additive_operand_extend_operator"
2052 [(match_operand:HI 1 "register_operand" "0,0")
2054 7 "cris_extend_operator"
2056 (mult:SI (match_operand:SI 2 "register_operand" "r,r")
2057 (match_operand:SI 3 "const_int_operand" "n,n"))
2058 (match_operand:SI 4 "register_operand" "r,r")))])]))
2059 (set (match_operand:SI 5 "register_operand" "=*4,r")
2060 (plus:SI (mult:SI (match_dup 2)
2063 "cris_side_effect_mode_ok (MULT, operands, 5, 4, 2, 3, 0)"
2066 %x6%e7.%m7 [%5=%4+%2%T3],%0")
2068 (define_insn "*extop<mode>si_side_biap"
2069 [(set (match_operand:SI 0 "register_operand" "=r,r")
2071 6 "cris_operand_extend_operator"
2072 [(match_operand:SI 1 "register_operand" "0,0")
2074 7 "cris_extend_operator"
2076 (mult:SI (match_operand:SI 2 "register_operand" "r,r")
2077 (match_operand:SI 3 "const_int_operand" "n,n"))
2078 (match_operand:SI 4 "register_operand" "r,r")))])]))
2079 (set (match_operand:SI 5 "register_operand" "=*4,r")
2080 (plus:SI (mult:SI (match_dup 2)
2083 "(GET_CODE (operands[6]) != UMIN || GET_CODE (operands[7]) == ZERO_EXTEND)
2084 && cris_side_effect_mode_ok (MULT, operands, 5, 4, 2, 3, 0)"
2087 %x6%e7<m> [%5=%4+%2%T3],%0")
2094 (define_insn "*extopqihi_side"
2095 [(set (match_operand:HI 0 "register_operand" "=r,r,r,r,r")
2097 5 "cris_additive_operand_extend_operator"
2098 [(match_operand:HI 1 "register_operand" "0,0,0,0,0")
2100 6 "cris_extend_operator"
2102 (plus:SI (match_operand:SI 2 "cris_bdap_operand" "%r,r,r,R,R")
2103 (match_operand:SI 3 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")
2105 (set (match_operand:SI 4 "register_operand" "=*2,r,r,*3,r")
2106 (plus:SI (match_dup 2)
2108 "cris_side_effect_mode_ok (PLUS, operands, 4, 2, 3, -1, 0)"
2110 if ((which_alternative == 0 || which_alternative == 3)
2111 && (!CONST_INT_P (operands[3])
2112 || INTVAL (operands[3]) > 127
2113 || INTVAL (operands[3]) < -128
2114 || satisfies_constraint_N (operands[3])
2115 || satisfies_constraint_J (operands[3])))
2117 if (which_alternative == 4)
2118 return "%x5%E6.%m6 [%4=%3%S2],%0";
2119 return "%x5%E6.%m6 [%4=%2%S3],%0";
2122 (define_insn "*extop<mode>si_side"
2123 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r")
2125 5 "cris_operand_extend_operator"
2126 [(match_operand:SI 1 "register_operand" "0,0,0,0,0")
2128 6 "cris_extend_operator"
2130 (plus:SI (match_operand:SI 2 "cris_bdap_operand" "%r,r,r,R,R")
2131 (match_operand:SI 3 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")
2133 (set (match_operand:SI 4 "register_operand" "=*2,r,r,*3,r")
2134 (plus:SI (match_dup 2)
2136 "(GET_CODE (operands[5]) != UMIN || GET_CODE (operands[6]) == ZERO_EXTEND)
2137 && cris_side_effect_mode_ok (PLUS, operands, 4, 2, 3, -1, 0)"
2139 if ((which_alternative == 0 || which_alternative == 3)
2140 && (!CONST_INT_P (operands[3])
2141 || INTVAL (operands[3]) > 127
2142 || INTVAL (operands[3]) < -128
2143 || satisfies_constraint_N (operands[3])
2144 || satisfies_constraint_J (operands[3])))
2146 if (which_alternative == 4)
2147 return "%x5%E6<m> [%4=%3%S2],%0";
2148 return "%x5%E6<m> [%4=%2%S3],%0";
2152 ;; As with op.S we may have to add special pattern to match commuted
2153 ;; operands to adds/addu and bound
2155 ;; adds/addu/bound [rx=ry+rz.S]
2158 ;; FIXME: GCC should widen.
2160 (define_insn "*extopqihi_swap_side_biap"
2161 [(set (match_operand:HI 0 "register_operand" "=r,r")
2164 6 "cris_extend_operator"
2166 (mult:SI (match_operand:SI 2 "register_operand" "r,r")
2167 (match_operand:SI 3 "const_int_operand" "n,n"))
2168 (match_operand:SI 4 "register_operand" "r,r")))])
2169 (match_operand:HI 1 "register_operand" "0,0")))
2170 (set (match_operand:SI 5 "register_operand" "=*4,r")
2171 (plus:SI (mult:SI (match_dup 2)
2174 "cris_side_effect_mode_ok (MULT, operands, 5, 4, 2, 3, 0)"
2177 add%e6.b [%5=%4+%2%T3],%0")
2179 (define_insn "*extop<mode>si_swap_side_biap"
2180 [(set (match_operand:SI 0 "register_operand" "=r,r")
2182 7 "cris_plus_or_bound_operator"
2184 6 "cris_extend_operator"
2186 (mult:SI (match_operand:SI 2 "register_operand" "r,r")
2187 (match_operand:SI 3 "const_int_operand" "n,n"))
2188 (match_operand:SI 4 "register_operand" "r,r")))])
2189 (match_operand:SI 1 "register_operand" "0,0")]))
2190 (set (match_operand:SI 5 "register_operand" "=*4,r")
2191 (plus:SI (mult:SI (match_dup 2)
2194 "(GET_CODE (operands[7]) != UMIN || GET_CODE (operands[6]) == ZERO_EXTEND)
2195 && cris_side_effect_mode_ok (MULT, operands, 5, 4, 2, 3, 0)"
2198 %x7%E6<m> [%5=%4+%2%T3],%0")
2201 ;; FIXME: GCC should widen.
2205 (define_insn "*extopqihi_swap_side"
2206 [(set (match_operand:HI 0 "register_operand" "=r,r,r,r,r")
2209 5 "cris_extend_operator"
2211 (match_operand:SI 2 "cris_bdap_operand" "%r,r,r,R,R")
2212 (match_operand:SI 3 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")))])
2213 (match_operand:HI 1 "register_operand" "0,0,0,0,0")))
2214 (set (match_operand:SI 4 "register_operand" "=*2,r,r,*3,r")
2215 (plus:SI (match_dup 2)
2217 "cris_side_effect_mode_ok (PLUS, operands, 4, 2, 3, -1, 0)"
2219 if ((which_alternative == 0 || which_alternative == 3)
2220 && (!CONST_INT_P (operands[3])
2221 || INTVAL (operands[3]) > 127
2222 || INTVAL (operands[3]) < -128
2223 || satisfies_constraint_N (operands[3])
2224 || satisfies_constraint_J (operands[3])))
2226 if (which_alternative == 4)
2227 return "add%e5.b [%4=%3%S2],%0";
2228 return "add%e5.b [%4=%2%S3],%0";
2231 (define_insn "*extop<mode>si_swap_side"
2232 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r")
2234 6 "cris_plus_or_bound_operator"
2236 5 "cris_extend_operator"
2238 (match_operand:SI 2 "cris_bdap_operand" "%r,r,r,R,R")
2239 (match_operand:SI 3 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")))])
2240 (match_operand:SI 1 "register_operand" "0,0,0,0,0")]))
2241 (set (match_operand:SI 4 "register_operand" "=*2,r,r,*3,r")
2242 (plus:SI (match_dup 2)
2244 "(GET_CODE (operands[6]) != UMIN || GET_CODE (operands[5]) == ZERO_EXTEND)
2245 && cris_side_effect_mode_ok (PLUS, operands, 4, 2, 3, -1, 0)"
2247 if ((which_alternative == 0 || which_alternative == 3)
2248 && (!CONST_INT_P (operands[3])
2249 || INTVAL (operands[3]) > 127
2250 || INTVAL (operands[3]) < -128
2251 || satisfies_constraint_N (operands[3])
2252 || satisfies_constraint_J (operands[3])))
2254 if (which_alternative == 4)
2255 return \"%x6%E5.%m5 [%4=%3%S2],%0\";
2256 return "%x6%E5<m> [%4=%2%S3],%0";
2259 ;; Extend versions (zero/sign) of normal add/sub (no side-effects).
2262 ;; FIXME: GCC should widen.
2264 (define_insn "*extopqihi_non_v32"
2265 [(set (match_operand:HI 0 "register_operand" "=r,r,r,r")
2267 3 "cris_additive_operand_extend_operator"
2268 [(match_operand:HI 1 "register_operand" "0,0,0,r")
2270 4 "cris_extend_operator"
2271 [(match_operand:QI 2 "nonimmediate_operand" "r,Q>,m,!To")])]))]
2272 "!TARGET_V32 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
2273 && (operands[1] != frame_pointer_rtx || GET_CODE (operands[3]) != PLUS)"
2278 %x3%E4.%m4 %2,%1,%0"
2279 [(set_attr "slottable" "yes,yes,no,no")
2280 (set_attr "cc" "clobber")])
2282 (define_insn "*extopqihi_v32"
2283 [(set (match_operand:HI 0 "register_operand" "=r,r")
2285 3 "cris_additive_operand_extend_operator"
2286 [(match_operand:HI 1 "register_operand" "0,0")
2288 4 "cris_extend_operator"
2289 [(match_operand:QI 2 "nonimmediate_operand" "r,m")])]))]
2292 [(set_attr "slottable" "yes")
2293 (set_attr "cc" "clobber")])
2297 (define_insn "*extop<mode>si_non_v32"
2298 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
2300 3 "cris_operand_extend_operator"
2301 [(match_operand:SI 1 "register_operand" "0,0,0,r")
2303 4 "cris_extend_operator"
2304 [(match_operand:BW 2 "nonimmediate_operand" "r,Q>,m,!To")])]))]
2306 && (GET_CODE (operands[3]) != UMIN || GET_CODE (operands[4]) == ZERO_EXTEND)
2307 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
2308 && (operands[1] != frame_pointer_rtx || GET_CODE (operands[3]) != PLUS)"
2314 [(set_attr "slottable" "yes,yes,no,no")])
2316 (define_insn "*extop<mode>si_v32"
2317 [(set (match_operand:SI 0 "register_operand" "=r,r")
2319 3 "cris_additive_operand_extend_operator"
2320 [(match_operand:SI 1 "register_operand" "0,0")
2322 4 "cris_extend_operator"
2323 [(match_operand:BW 2 "nonimmediate_operand" "r,m")])]))]
2326 [(set_attr "slottable" "yes")])
2328 ;; As with the side-effect patterns, may have to have swapped operands for add.
2329 ;; For commutative operands, these are the canonical forms.
2333 (define_insn "*addxqihi_swap_non_v32"
2334 [(set (match_operand:HI 0 "register_operand" "=r,r,r,r")
2337 3 "cris_extend_operator"
2338 [(match_operand:QI 2 "nonimmediate_operand" "r,Q>,m,!To")])
2339 (match_operand:HI 1 "register_operand" "0,0,0,r")))]
2340 "!TARGET_V32 && operands[1] != frame_pointer_rtx"
2346 [(set_attr "slottable" "yes,yes,no,no")
2347 (set_attr "cc" "clobber")])
2349 ;; A case for v32, to catch the "addo" insn in addition to "adds". We
2350 ;; only care to match the canonical form; there should be no other.
2352 (define_insn "*addsbw_v32"
2353 [(set (match_operand:HI 0 "register_operand" "=r,r,!a")
2356 (match_operand:QI 2 "nonimmediate_operand" "r,m,m"))
2357 (match_operand:HI 1 "register_operand" "0,0,r")))]
2363 [(set_attr "slottable" "yes")
2364 (set_attr "cc" "clobber,clobber,none")])
2366 (define_insn "*addubw_v32"
2367 [(set (match_operand:HI 0 "register_operand" "=r,r")
2370 (match_operand:QI 2 "nonimmediate_operand" "r,m"))
2371 (match_operand:HI 1 "register_operand" "0,0")))]
2374 [(set_attr "slottable" "yes")
2375 (set_attr "cc" "clobber")])
2377 (define_insn "*extop<mode>si_swap_non_v32"
2378 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
2380 4 "cris_plus_or_bound_operator"
2382 3 "cris_extend_operator"
2383 [(match_operand:BW 2 "nonimmediate_operand" "r,Q>,m,!To")])
2384 (match_operand:SI 1 "register_operand" "0,0,0,r")]))]
2386 && (GET_CODE (operands[4]) != UMIN || GET_CODE (operands[3]) == ZERO_EXTEND)
2387 && operands[1] != frame_pointer_rtx"
2393 [(set_attr "slottable" "yes,yes,no,no")])
2395 (define_insn "*adds<mode>_v32"
2396 [(set (match_operand:SI 0 "register_operand" "=r,r,!a")
2399 (match_operand:BW 2 "nonimmediate_operand" "r,m,m"))
2400 (match_operand:SI 1 "register_operand" "0,0,r")))]
2406 [(set_attr "slottable" "yes")
2407 (set_attr "cc" "*,*,none")])
2409 (define_insn "*addu<mode>_v32"
2410 [(set (match_operand:SI 0 "register_operand" "=r,r")
2413 (match_operand:BW 2 "nonimmediate_operand" "r,m"))
2414 (match_operand:SI 1 "register_operand" "0,0")))]
2415 "TARGET_V32 && operands[1] != frame_pointer_rtx"
2417 [(set_attr "slottable" "yes")])
2419 (define_insn "*bound<mode>_v32"
2420 [(set (match_operand:SI 0 "register_operand" "=r")
2423 (match_operand:BW 2 "register_operand" "r"))
2424 (match_operand:SI 1 "register_operand" "0")))]
2425 "TARGET_V32 && operands[1] != frame_pointer_rtx"
2427 [(set_attr "slottable" "yes")])
2429 ;; This is the special case when we use what corresponds to the
2430 ;; instruction above in "casesi". Do *not* change it to use the generic
2431 ;; pattern and "REG 15" as pc; I did that and it led to madness and
2432 ;; maintenance problems: Instead of (as imagined) recognizing and removing
2433 ;; or replacing this pattern with something simpler, other variant
2434 ;; patterns were recognized or combined, including some prefix variants
2435 ;; where the value in pc is not that of the next instruction (which means
2436 ;; this instruction actually *is* special and *should* be marked as such).
2437 ;; When switching from the "generic pattern match" approach to this simpler
2438 ;; approach, there were insignificant differences in gcc, ipps and
2439 ;; product code, somehow due to scratching reload behind the ear or
2440 ;; something. Testcase "gcc" looked .01% slower and 4 bytes bigger;
2441 ;; product code became .001% smaller but "looked better". The testcase
2442 ;; "ipps" was just different at register allocation).
2444 ;; Assumptions in the jump optimizer forces us to use IF_THEN_ELSE in this
2445 ;; pattern with the default-label as the else, with the "if" being
2446 ;; index-is-less-than the max number of cases plus one. The default-label
2447 ;; is attached to the end of the case-table at time of output.
2449 (define_insn "*casesi_adds_w"
2452 (ltu (match_operand:SI 0 "register_operand" "r")
2453 (match_operand:SI 1 "const_int_operand" "n"))
2454 (plus:SI (sign_extend:SI
2456 (plus:SI (mult:SI (match_dup 0) (const_int 2))
2459 (label_ref (match_operand 2 "" ""))))
2460 (use (label_ref (match_operand 3 "" "")))]
2461 "!TARGET_V32 && operands[0] != frame_pointer_rtx"
2462 "adds.w [$pc+%0.w],$pc"
2463 [(set_attr "cc" "clobber")])
2465 ;; For V32, we just have a jump, but we need to mark the table as used,
2466 ;; and the jump insn must have the if_then_else form expected by core
2467 ;; GCC. Since we don't want to prolong the lifetime of the original
2468 ;; index value, we compare against "unspec 0". It's a pity we have to
2469 ;; jump through to get the default label in place and to keep the jump
2470 ;; table around. FIXME: Look into it some time.
2472 (define_insn "*casesi_jump_v32"
2475 (ltu (unspec [(const_int 0)] CRIS_UNSPEC_CASESI)
2476 (match_operand:SI 0 "const_int_operand" "n"))
2477 (match_operand:SI 1 "register_operand" "r")
2478 (label_ref (match_operand 2 "" ""))))
2479 (use (label_ref (match_operand 3 "" "")))]
2482 [(set_attr "cc" "clobber")
2483 (set_attr "slottable" "has_slot")])
2485 ;; Multiply instructions.
2487 ;; Sometimes powers of 2 (which are normally canonicalized to a
2488 ;; left-shift) appear here, as a result of address reloading.
2489 ;; As a special, for values 3 and 5, we can match with an addi, so add those.
2491 ;; FIXME: This may be unnecessary now.
2492 ;; Explicitly named for convenience of having a gen_... function.
2494 (define_insn "addi_mul"
2495 [(set (match_operand:SI 0 "register_operand" "=r")
2497 (match_operand:SI 1 "register_operand" "%0")
2498 (match_operand:SI 2 "const_int_operand" "n")))]
2499 "operands[0] != frame_pointer_rtx
2500 && operands[1] != frame_pointer_rtx
2501 && CONST_INT_P (operands[2])
2502 && (INTVAL (operands[2]) == 2
2503 || INTVAL (operands[2]) == 4 || INTVAL (operands[2]) == 3
2504 || INTVAL (operands[2]) == 5)"
2506 if (INTVAL (operands[2]) == 2)
2508 else if (INTVAL (operands[2]) == 4)
2510 else if (INTVAL (operands[2]) == 3)
2511 return "addi %0.w,%0";
2512 else if (INTVAL (operands[2]) == 5)
2513 return "addi %0.d,%0";
2514 return "BAD: adr_mulsi: %0=%1*%2";
2516 [(set_attr "slottable" "yes")
2517 ;; No flags are changed if this insn is "addi", but it does not seem
2518 ;; worth the trouble to distinguish that to the lslq cases.
2519 (set_attr "cc" "clobber")])
2521 ;; The addi insn as it is normally used.
2523 ;; Make the ACR alternative taste bad enough to not choose it as a
2524 ;; preference to avoid spilling problems (unwind-dw2-fde.c at build).
2525 ;; FIXME: Revisit for new register allocator.
2527 (define_insn "*addi"
2528 [(set (match_operand:SI 0 "register_operand" "=r,!a")
2530 (mult:SI (match_operand:SI 2 "register_operand" "r,r")
2531 (match_operand:SI 3 "const_int_operand" "n,n"))
2532 (match_operand:SI 1 "register_operand" "0,r")))]
2533 "operands[0] != frame_pointer_rtx
2534 && operands[1] != frame_pointer_rtx
2535 && CONST_INT_P (operands[3])
2536 && (INTVAL (operands[3]) == 1
2537 || INTVAL (operands[3]) == 2 || INTVAL (operands[3]) == 4)"
2541 [(set_attr "slottable" "yes")
2542 (set_attr "cc" "none")])
2544 ;; The mstep instruction. Probably not useful by itself; it's to
2545 ;; non-linear wrt. the other insns. We used to expand to it, so at least
2548 (define_insn "mstep_shift"
2549 [(set (match_operand:SI 0 "register_operand" "=r")
2551 (lt:SI (cc0) (const_int 0))
2552 (plus:SI (ashift:SI (match_operand:SI 1 "register_operand" "0")
2554 (match_operand:SI 2 "register_operand" "r"))
2555 (ashift:SI (match_operand:SI 3 "register_operand" "0")
2559 [(set_attr "slottable" "yes")])
2561 ;; When illegitimate addresses are legitimized, sometimes gcc forgets
2562 ;; to canonicalize the multiplications.
2564 ;; FIXME: Check gcc > 2.7.2, remove and possibly fix in gcc.
2566 (define_insn "mstep_mul"
2567 [(set (match_operand:SI 0 "register_operand" "=r")
2569 (lt:SI (cc0) (const_int 0))
2570 (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "0")
2572 (match_operand:SI 2 "register_operand" "r"))
2573 (mult:SI (match_operand:SI 3 "register_operand" "0")
2576 && operands[0] != frame_pointer_rtx
2577 && operands[1] != frame_pointer_rtx
2578 && operands[2] != frame_pointer_rtx
2579 && operands[3] != frame_pointer_rtx"
2581 [(set_attr "slottable" "yes")])
2583 (define_insn "<u>mul<s><mode>3"
2584 [(set (match_operand:WD 0 "register_operand" "=r")
2586 (szext:WD (match_operand:<S> 1 "register_operand" "%0"))
2587 (szext:WD (match_operand:<S> 2 "register_operand" "r"))))
2588 (clobber (match_scratch:SI 3 "=h"))]
2589 "TARGET_HAS_MUL_INSNS"
2590 "%!mul<su><mm> %2,%0"
2591 [(set (attr "slottable")
2592 (if_then_else (match_test "TARGET_MUL_BUG")
2594 (const_string "yes")))
2595 ;; For umuls.[bwd] it's just N unusable here, but let's be safe.
2596 ;; For muls.b, this really extends to SImode, so cc should be
2597 ;; considered clobbered.
2598 ;; For muls.w, it's just N unusable here, but let's be safe.
2599 (set_attr "cc" "clobber")])
2601 ;; Note that gcc does not make use of such a thing as umulqisi3. It gets
2602 ;; confused and will erroneously use it instead of umulhisi3, failing (at
2603 ;; least) gcc.c-torture/execute/arith-rand.c at all optimization levels.
2604 ;; Inspection of optab code shows that there must be only one widening
2605 ;; multiplication per mode widened to.
2607 (define_insn "mulsi3"
2608 [(set (match_operand:SI 0 "register_operand" "=r")
2609 (mult:SI (match_operand:SI 1 "register_operand" "%0")
2610 (match_operand:SI 2 "register_operand" "r")))
2611 (clobber (match_scratch:SI 3 "=h"))]
2612 "TARGET_HAS_MUL_INSNS"
2614 [(set (attr "slottable")
2615 (if_then_else (match_test "TARGET_MUL_BUG")
2617 (const_string "yes")))
2618 ;; Just N unusable here, but let's be safe.
2619 (set_attr "cc" "clobber")])
2621 ;; A few multiply variations.
2623 ;; When needed, we can get the high 32 bits from the overflow
2624 ;; register. We don't care to split and optimize these.
2626 ;; Note that cc0 is still valid after the move-from-overflow-register
2627 ;; insn; no special precaution need to be taken in cris_notice_update_cc.
2629 (define_insn "<u>mulsidi3"
2630 [(set (match_operand:DI 0 "register_operand" "=r")
2632 (szext:DI (match_operand:SI 1 "register_operand" "%0"))
2633 (szext:DI (match_operand:SI 2 "register_operand" "r"))))
2634 (clobber (match_scratch:SI 3 "=h"))]
2635 "TARGET_HAS_MUL_INSNS"
2636 "%!mul<su>.d %2,%M0\;move $mof,%H0")
2638 ;; These two patterns may be expressible by other means, perhaps by making
2639 ;; [u]?mulsidi3 a define_expand.
2641 ;; Due to register allocation braindamage, the clobber 1,2 alternatives
2642 ;; cause a move into the clobbered register *before* the insn, then
2643 ;; after the insn, mof is moved too, rather than the clobber assigned
2644 ;; the last mof target. This became apparent when making MOF and SRP
2645 ;; visible registers, with the necessary tweak to smulsi3_highpart.
2646 ;; Because these patterns are used in division by constants, that damage
2647 ;; is visible (ipps regression tests). Therefore the last two
2648 ;; alternatives, "helping" reload to avoid an unnecessary move, but
2649 ;; punished by force of one "?". Check code from "int d (int a) {return
2650 ;; a / 1000;}" and unsigned. FIXME: Comment above was for 3.2, revisit.
2652 (define_insn "<su>mulsi3_highpart"
2653 [(set (match_operand:SI 0 "register_operand" "=h,h,?r,?r")
2657 (szext:DI (match_operand:SI 1 "register_operand" "r,r,0,r"))
2658 (szext:DI (match_operand:SI 2 "register_operand" "r,r,r,0")))
2660 (clobber (match_scratch:SI 3 "=1,2,h,h"))]
2661 "TARGET_HAS_MUL_INSNS"
2665 %!mul<su>.d %2,%1\;move $mof,%0
2666 %!mul<su>.d %1,%2\;move $mof,%0"
2667 [(set_attr "slottable" "yes,yes,no,no")
2668 (set_attr "cc" "clobber")])
2670 ;; Divide and modulus instructions. CRIS only has a step instruction.
2672 (define_insn "dstep_shift"
2673 [(set (match_operand:SI 0 "register_operand" "=r")
2675 (geu:SI (ashift:SI (match_operand:SI 1 "register_operand" "0")
2677 (match_operand:SI 2 "register_operand" "r"))
2678 (minus:SI (ashift:SI (match_operand:SI 3 "register_operand" "0")
2680 (match_operand:SI 4 "register_operand" "2"))
2681 (ashift:SI (match_operand:SI 5 "register_operand" "0")
2685 [(set_attr "slottable" "yes")
2686 (set_attr "cc" "noov32")])
2688 ;; Here's a variant with mult instead of ashift.
2690 ;; FIXME: This should be investigated. Which one matches through combination?
2692 (define_insn "dstep_mul"
2693 [(set (match_operand:SI 0 "register_operand" "=r")
2695 (geu:SI (mult:SI (match_operand:SI 1 "register_operand" "0")
2697 (match_operand:SI 2 "register_operand" "r"))
2698 (minus:SI (mult:SI (match_operand:SI 3 "register_operand" "0")
2700 (match_operand:SI 4 "register_operand" "2"))
2701 (mult:SI (match_operand:SI 5 "register_operand" "0")
2703 "operands[0] != frame_pointer_rtx
2704 && operands[1] != frame_pointer_rtx
2705 && operands[2] != frame_pointer_rtx
2706 && operands[3] != frame_pointer_rtx"
2708 [(set_attr "slottable" "yes")
2709 (set_attr "cc" "noov32")])
2711 ;; Logical operators.
2715 ;; There is no use in defining "anddi3", because gcc can expand this by
2716 ;; itself, and make reasonable code without interference.
2718 ;; If the first operand is memory or a register and is the same as the
2719 ;; second operand, and the third operand is -256 or -65536, we can use
2720 ;; CLEAR instead. Or, if the first operand is a register, and the third
2721 ;; operand is 255 or 65535, we can zero_extend.
2722 ;; GCC isn't smart enough to recognize these cases (yet), and they seem
2723 ;; to be common enough to be worthwhile.
2724 ;; FIXME: This should be made obsolete.
2726 (define_expand "andsi3"
2727 [(set (match_operand:SI 0 "nonimmediate_operand" "")
2728 (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
2729 (match_operand:SI 2 "general_operand" "")))]
2732 if (! (CONST_INT_P (operands[2])
2733 && (((INTVAL (operands[2]) == -256
2734 || INTVAL (operands[2]) == -65536)
2735 && rtx_equal_p (operands[1], operands[0]))
2736 || ((INTVAL (operands[2]) == 255
2737 || INTVAL (operands[2]) == 65535)
2738 && REG_P (operands[0])))))
2740 /* Make intermediate steps if operand0 is not a register or
2741 operand1 is not a register, and hope that the reload pass will
2742 make something useful out of it. Note that the operands are
2743 *not* canonicalized. For the moment, I chicken out on this,
2744 because all or most ports do not describe 'and' with
2745 canonicalized operands, and I seem to remember magic in reload,
2746 checking that operand1 has constraint '%0', in which case
2747 operand0 and operand1 must have similar predicates.
2748 FIXME: Investigate. */
2749 rtx reg0 = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (SImode);
2750 rtx reg1 = operands[1];
2754 emit_move_insn (reg0, reg1);
2758 emit_insn (gen_rtx_SET (reg0, gen_rtx_AND (SImode, reg1, operands[2])));
2760 /* Make sure we get the right *final* destination. */
2761 if (! REG_P (operands[0]))
2762 emit_move_insn (operands[0], reg0);
2768 ;; Some special cases of andsi3.
2770 (define_insn "*andsi_movu"
2771 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
2772 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%r,Q,To")
2773 (match_operand:SI 2 "const_int_operand" "n,n,n")))]
2774 "(INTVAL (operands[2]) == 255 || INTVAL (operands[2]) == 65535)
2775 && !side_effects_p (operands[1])"
2777 [(set_attr "slottable" "yes,yes,no")])
2779 (define_insn "*andsi_clear"
2780 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,Q,Q,To,To")
2781 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0,0,0")
2782 (match_operand:SI 2 "const_int_operand" "P,n,P,n,P,n")))]
2783 "(INTVAL (operands[2]) == -65536 || INTVAL (operands[2]) == -256)
2784 && !side_effects_p (operands[0])"
2792 [(set_attr "slottable" "yes,yes,yes,yes,no,no")
2793 (set_attr "cc" "none")])
2795 ;; This is a catch-all pattern, taking care of everything that was not
2796 ;; matched in the insns above.
2798 ;; Sidenote: the tightening from "nonimmediate_operand" to
2799 ;; "register_operand" for operand 1 actually increased the register
2800 ;; pressure (worse code). That will hopefully change with an
2801 ;; improved reload pass.
2803 (define_insn "*expanded_andsi_non_v32"
2804 [(set (match_operand:SI 0 "register_operand" "=r,r,r, r,r")
2805 (and:SI (match_operand:SI 1 "register_operand" "%0,0,0, 0,r")
2806 (match_operand:SI 2 "general_operand" "I,r,Q>,g,!To")))]
2814 [(set_attr "slottable" "yes,yes,yes,no,no")])
2816 (define_insn "*expanded_andsi_v32"
2817 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
2818 (and:SI (match_operand:SI 1 "register_operand" "%0,0,0,0")
2819 (match_operand:SI 2 "general_operand" "I,r,Q>,g")))]
2826 [(set_attr "slottable" "yes,yes,yes,no")
2827 (set_attr "cc" "noov32")])
2829 ;; For both QI and HI we may use the quick patterns. This results in
2830 ;; useless condition codes, but that is used rarely enough for it to
2831 ;; normally be a win (could check ahead for use of cc0, but seems to be
2832 ;; more pain than win).
2834 ;; FIXME: See note for andsi3
2836 (define_expand "andhi3"
2837 [(set (match_operand:HI 0 "nonimmediate_operand" "")
2838 (and:HI (match_operand:HI 1 "nonimmediate_operand" "")
2839 (match_operand:HI 2 "general_operand" "")))]
2842 if (! (CONST_INT_P (operands[2])
2843 && (((INTVAL (operands[2]) == -256
2844 || INTVAL (operands[2]) == 65280)
2845 && rtx_equal_p (operands[1], operands[0]))
2846 || (INTVAL (operands[2]) == 255
2847 && REG_P (operands[0])))))
2849 /* See comment for andsi3. */
2850 rtx reg0 = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (HImode);
2851 rtx reg1 = operands[1];
2855 emit_move_insn (reg0, reg1);
2859 emit_insn (gen_rtx_SET (reg0, gen_rtx_AND (HImode, reg1, operands[2])));
2861 /* Make sure we get the right destination. */
2862 if (! REG_P (operands[0]))
2863 emit_move_insn (operands[0], reg0);
2869 ;; Some fast andhi3 special cases.
2871 (define_insn "*andhi_movu"
2872 [(set (match_operand:HI 0 "register_operand" "=r,r,r")
2873 (and:HI (match_operand:HI 1 "nonimmediate_operand" "r,Q,To")
2875 "!side_effects_p (operands[1])"
2877 [(set_attr "slottable" "yes,yes,no")])
2879 (define_insn "*andhi_clear"
2880 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,Q,To")
2881 (and:HI (match_operand:HI 1 "nonimmediate_operand" "0,0,0")
2883 "!side_effects_p (operands[0])"
2885 [(set_attr "slottable" "yes,yes,no")
2886 (set_attr "cc" "none")])
2888 ;; Catch-all andhi3 pattern.
2890 (define_insn "*expanded_andhi_non_v32"
2891 [(set (match_operand:HI 0 "register_operand" "=r,r,r, r,r,r,r")
2892 (and:HI (match_operand:HI 1 "register_operand" "%0,0,0, 0,0,0,r")
2893 (match_operand:HI 2 "general_operand" "I,r,Q>,L,O,g,!To")))]
2895 ;; Sidenote: the tightening from "general_operand" to
2896 ;; "register_operand" for operand 1 actually increased the register
2897 ;; pressure (worse code). That will hopefully change with an
2898 ;; improved reload pass.
2909 [(set_attr "slottable" "yes,yes,yes,no,yes,no,no")
2910 (set_attr "cc" "clobber,normal,normal,normal,clobber,normal,normal")])
2912 (define_insn "*expanded_andhi_v32"
2913 [(set (match_operand:HI 0 "register_operand" "=r,r,r,r,r,r")
2914 (and:HI (match_operand:HI 1 "register_operand" "%0,0,0,0,0,0")
2915 (match_operand:HI 2 "general_operand" "I,r,Q>,L,O,g")))]
2924 [(set_attr "slottable" "yes,yes,yes,no,yes,no")
2925 (set_attr "cc" "clobber,noov32,noov32,noov32,clobber,noov32")])
2927 ;; A strict_low_part pattern.
2929 ;; Note the use of (match_dup 0) for the first operand of the operation
2930 ;; here. Reload can't handle an operand pair where one is read-write
2931 ;; and must match a read, like in:
2933 ;; (set (strict_low_part
2934 ;; (subreg:QI (reg/v:SI 0 r0 [orig:36 data ] [36]) 0))
2936 ;; (subreg:QI (reg:SI 15 acr [orig:27 D.7531 ] [27]) 0)
2937 ;; (const_int -64 [0xf..fc0]))) x.c:126 147 {*andqi_lowpart_v32}
2939 ;; In theory, it could reload this as a movstrictqi of the register
2940 ;; operand at the and:QI to the destination register and change the
2941 ;; and:QI operand to the same as the read-write output operand and the
2942 ;; result would be recognized, but it doesn't recognize that's a valid
2943 ;; reload for a strict_low_part-destination; it just sees a "+" at the
2944 ;; destination constraints. Better than adding complexity to reload is
2945 ;; to follow the lead of m68k (see comment that begins with "These insns
2946 ;; must use MATCH_DUP") since prehistoric times and make it just a
2947 ;; match_dup. FIXME: a sanity-check in gen* to refuse an insn with
2948 ;; input-constraints matching input-output-constraints, e.g. "+r" <- "0".
2950 (define_insn "*andhi_lowpart_non_v32"
2951 [(set (strict_low_part
2952 (match_operand:HI 0 "register_operand" "+r,r,r"))
2953 (and:HI (match_dup 0)
2954 (match_operand:HI 1 "general_operand" "r,Q>,g")))]
2960 [(set_attr "slottable" "yes,yes,no")])
2962 (define_insn "*andhi_lowpart_v32"
2963 [(set (strict_low_part
2964 (match_operand:HI 0 "register_operand" "+r,r,r"))
2965 (and:HI (match_dup 0)
2966 (match_operand:HI 1 "general_operand" "r,Q>,g")))]
2972 [(set_attr "slottable" "yes,yes,no")
2973 (set_attr "cc" "noov32")])
2975 (define_expand "andqi3"
2976 [(set (match_operand:QI 0 "register_operand")
2977 (and:QI (match_operand:QI 1 "register_operand")
2978 (match_operand:QI 2 "general_operand")))]
2982 (define_insn "*andqi3_non_v32"
2983 [(set (match_operand:QI 0 "register_operand" "=r,r,r, r,r,r")
2984 (and:QI (match_operand:QI 1 "register_operand" "%0,0,0, 0,0,r")
2985 (match_operand:QI 2 "general_operand" "I,r,Q>,O,g,!To")))]
2994 [(set_attr "slottable" "yes,yes,yes,yes,no,no")
2995 (set_attr "cc" "clobber,normal,normal,clobber,normal,normal")])
2997 (define_insn "*andqi3_v32"
2998 [(set (match_operand:QI 0 "register_operand" "=r,r,r,r,r")
2999 (and:QI (match_operand:QI 1 "register_operand" "%0,0,0,0,0")
3000 (match_operand:QI 2 "general_operand" "I,r,Q>,O,g")))]
3008 [(set_attr "slottable" "yes,yes,yes,yes,no")
3009 (set_attr "cc" "clobber,noov32,noov32,clobber,noov32")])
3011 (define_insn "*andqi_lowpart_non_v32"
3012 [(set (strict_low_part
3013 (match_operand:QI 0 "register_operand" "+r,r,r"))
3014 (and:QI (match_dup 0)
3015 (match_operand:QI 1 "general_operand" "r,Q>,g")))]
3021 [(set_attr "slottable" "yes,yes,no")])
3023 (define_insn "*andqi_lowpart_v32"
3024 [(set (strict_low_part
3025 (match_operand:QI 0 "register_operand" "+r,r,r"))
3026 (and:QI (match_dup 0)
3027 (match_operand:QI 1 "general_operand" "r,Q>,g")))]
3033 [(set_attr "slottable" "yes,yes,no")
3034 (set_attr "cc" "noov32")])
3038 ;; Same comment as anddi3 applies here - no need for such a pattern.
3040 ;; It seems there's no need to jump through hoops to get good code such as
3043 (define_expand "ior<mode>3"
3044 [(set (match_operand:BWD 0 "register_operand")
3045 (ior:BWD (match_operand:BWD 1 "register_operand")
3046 (match_operand:BWD 2 "general_operand")))]
3050 (define_insn "*iorsi3_non_v32"
3051 [(set (match_operand:SI 0 "register_operand" "=r,r,r, r,r,r")
3052 (ior:SI (match_operand:SI 1 "register_operand" "%0,0,0, 0,0,r")
3053 (match_operand:SI 2 "general_operand" "I, r,Q>,n,g,!To")))]
3062 [(set_attr "slottable" "yes,yes,yes,no,no,no")
3063 (set_attr "cc" "normal,normal,normal,clobber,normal,normal")])
3065 (define_insn "*iorsi3_v32"
3066 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r")
3067 (ior:SI (match_operand:SI 1 "register_operand" "%0,0,0,0,0")
3068 (match_operand:SI 2 "general_operand" "I,r,Q>,n,g")))]
3076 [(set_attr "slottable" "yes,yes,yes,no,no")
3077 (set_attr "cc" "noov32,noov32,noov32,clobber,noov32")])
3079 (define_insn "*iorhi3_non_v32"
3080 [(set (match_operand:HI 0 "register_operand" "=r,r,r, r,r,r,r")
3081 (ior:HI (match_operand:HI 1 "register_operand" "%0,0,0, 0,0,0,r")
3082 (match_operand:HI 2 "general_operand" "I,r,Q>,L,O,g,!To")))]
3092 [(set_attr "slottable" "yes,yes,yes,no,yes,no,no")
3093 (set_attr "cc" "clobber,normal,normal,normal,clobber,normal,normal")])
3095 (define_insn "*iorhi3_v32"
3096 [(set (match_operand:HI 0 "register_operand" "=r,r,r,r,r,r")
3097 (ior:HI (match_operand:HI 1 "register_operand" "%0,0,0,0,0,0")
3098 (match_operand:HI 2 "general_operand" "I,r,Q>,L,O,g")))]
3107 [(set_attr "slottable" "yes,yes,yes,no,yes,no")
3108 (set_attr "cc" "clobber,noov32,noov32,noov32,clobber,noov32")])
3110 (define_insn "*iorqi3_non_v32"
3111 [(set (match_operand:QI 0 "register_operand" "=r,r,r, r,r,r")
3112 (ior:QI (match_operand:QI 1 "register_operand" "%0,0,0, 0,0,r")
3113 (match_operand:QI 2 "general_operand" "I,r,Q>,O,g,!To")))]
3122 [(set_attr "slottable" "yes,yes,yes,yes,no,no")
3123 (set_attr "cc" "clobber,normal,normal,clobber,normal,normal")])
3125 (define_insn "*iorqi3_v32"
3126 [(set (match_operand:QI 0 "register_operand" "=r,r,r,r,r")
3127 (ior:QI (match_operand:QI 1 "register_operand" "%0,0,0,0,0")
3128 (match_operand:QI 2 "general_operand" "I,r,Q>,O,g")))]
3136 [(set_attr "slottable" "yes,yes,yes,yes,no")
3137 (set_attr "cc" "clobber,noov32,noov32,clobber,noov32")])
3141 ;; See comment about "anddi3" for xordi3 - no need for such a pattern.
3142 ;; FIXME: Do we really need the shorter variants?
3144 (define_insn "xorsi3"
3145 [(set (match_operand:SI 0 "register_operand" "=r")
3146 (xor:SI (match_operand:SI 1 "register_operand" "%0")
3147 (match_operand:SI 2 "register_operand" "r")))]
3150 [(set_attr "slottable" "yes")
3151 (set_attr "cc" "noov32")])
3153 (define_insn "xor<mode>3"
3154 [(set (match_operand:BW 0 "register_operand" "=r")
3155 (xor:BW (match_operand:BW 1 "register_operand" "%0")
3156 (match_operand:BW 2 "register_operand" "r")))]
3159 [(set_attr "slottable" "yes")
3160 (set_attr "cc" "clobber")])
3164 ;; Questionable use, here mostly as a (slightly usable) define_expand
3167 (define_expand "negsf2"
3170 (parallel [(set (match_operand:SF 0 "register_operand" "=r")
3171 (neg:SF (match_operand:SF 1
3172 "register_operand" "0")))
3173 (use (match_dup 2))])]
3176 operands[2] = gen_reg_rtx (SImode);
3177 operands[3] = GEN_INT (1 << 31);
3180 (define_insn "*expanded_negsf2"
3181 [(set (match_operand:SF 0 "register_operand" "=r")
3182 (neg:SF (match_operand:SF 1 "register_operand" "0")))
3183 (use (match_operand:SI 2 "register_operand" "r"))]
3186 [(set_attr "slottable" "yes")])
3188 ;; No "negdi2" although we could make one up that may be faster than
3189 ;; the one in libgcc.
3191 (define_insn "neg<mode>2"
3192 [(set (match_operand:BWD 0 "register_operand" "=r")
3193 (neg:BWD (match_operand:BWD 1 "register_operand" "r")))]
3196 [(set_attr "slottable" "yes")])
3200 ;; See comment on anddi3 - no need for a DImode pattern.
3201 ;; See also xor comment.
3203 (define_insn "one_cmplsi2"
3204 [(set (match_operand:SI 0 "register_operand" "=r")
3205 (not:SI (match_operand:SI 1 "register_operand" "0")))]
3208 [(set_attr "slottable" "yes")
3209 (set_attr "cc" "noov32")])
3211 (define_insn "one_cmpl<mode>2"
3212 [(set (match_operand:BW 0 "register_operand" "=r")
3213 (not:BW (match_operand:BW 1 "register_operand" "0")))]
3216 [(set_attr "slottable" "yes")
3217 (set_attr "cc" "clobber")])
3219 ;; Arithmetic/Logical shift right (and SI left).
3221 (define_insn "<shlr>si3"
3222 [(set (match_operand:SI 0 "register_operand" "=r")
3223 (shift:SI (match_operand:SI 1 "register_operand" "0")
3224 (match_operand:SI 2 "nonmemory_operand" "Kcr")))]
3227 if (REG_S_P (operands[2]))
3228 return "<slr>.d %2,%0";
3230 return "<slr>q %2,%0";
3232 [(set_attr "slottable" "yes")
3233 (set_attr "cc" "noov32")])
3235 ;; Since gcc gets lost, and forgets to zero-extend the source (or mask
3236 ;; the destination) when it changes shifts of lower modes into SImode,
3237 ;; it is better to make these expands an anonymous patterns instead of
3238 ;; the more correct define_insns. This occurs when gcc thinks that is
3239 ;; is better to widen to SImode and use immediate shift count.
3241 ;; FIXME: Is this legacy or still true for gcc >= 2.7.2?
3243 ;; FIXME: Can't parametrize sign_extend and zero_extend (before
3244 ;; mentioning "shiftrt"), so we need two patterns.
3245 (define_expand "ashr<mode>3"
3247 (sign_extend:SI (match_operand:BW 1 "nonimmediate_operand" "")))
3249 (zero_extend:SI (match_operand:BW 2 "nonimmediate_operand" "")))
3250 (set (match_dup 5) (ashiftrt:SI (match_dup 3) (match_dup 4)))
3251 (set (match_operand:BW 0 "general_operand" "")
3252 (subreg:BW (match_dup 5) 0))]
3257 for (i = 3; i < 6; i++)
3258 operands[i] = gen_reg_rtx (SImode);
3261 (define_expand "lshr<mode>3"
3263 (zero_extend:SI (match_operand:BW 1 "nonimmediate_operand" "")))
3265 (zero_extend:SI (match_operand:BW 2 "nonimmediate_operand" "")))
3266 (set (match_dup 5) (lshiftrt:SI (match_dup 3) (match_dup 4)))
3267 (set (match_operand:BW 0 "general_operand" "")
3268 (subreg:BW (match_dup 5) 0))]
3273 for (i = 3; i < 6; i++)
3274 operands[i] = gen_reg_rtx (SImode);
3277 (define_insn "*expanded_<shlr><mode>"
3278 [(set (match_operand:BW 0 "register_operand" "=r")
3279 (shiftrt:BW (match_operand:BW 1 "register_operand" "0")
3280 (match_operand:BW 2 "register_operand" "r")))]
3283 [(set_attr "slottable" "yes")
3284 (set_attr "cc" "noov32")])
3286 (define_insn "*<shlr><mode>_lowpart"
3287 [(set (strict_low_part (match_operand:BW 0 "register_operand" "+r"))
3288 (shiftrt:BW (match_dup 0)
3289 (match_operand:BW 1 "register_operand" "r")))]
3292 [(set_attr "slottable" "yes")
3293 (set_attr "cc" "noov32")])
3295 ;; Arithmetic/logical shift left.
3297 ;; For narrower modes than SI, we can use lslq although it makes cc
3298 ;; unusable. The win is that we do not have to reload the shift-count
3301 (define_insn "ashl<mode>3"
3302 [(set (match_operand:BW 0 "register_operand" "=r,r")
3303 (ashift:BW (match_operand:BW 1 "register_operand" "0,0")
3304 (match_operand:BW 2 "nonmemory_operand" "r,Kc")))]
3308 (CONST_INT_P (operands[2]) && INTVAL (operands[2]) > <nbitsm1>)
3310 : (CONSTANT_P (operands[2])
3311 ? "lslq %2,%0" : "lsl<m> %2,%0");
3313 [(set_attr "slottable" "yes")
3314 (set_attr "cc" "noov32,clobber")])
3316 ;; A strict_low_part matcher.
3318 (define_insn "*ashl<mode>_lowpart"
3319 [(set (strict_low_part (match_operand:BW 0 "register_operand" "+r"))
3320 (ashift:BW (match_dup 0)
3321 (match_operand:HI 1 "register_operand" "r")))]
3324 [(set_attr "slottable" "yes")
3325 (set_attr "cc" "noov32")])
3327 ;; Various strange insns that gcc likes.
3329 ;; Fortunately, it is simple to construct an abssf (although it may not
3330 ;; be very much used in practice).
3332 (define_insn "abssf2"
3333 [(set (match_operand:SF 0 "register_operand" "=r")
3334 (abs:SF (match_operand:SF 1 "register_operand" "0")))]
3336 "lslq 1,%0\;lsrq 1,%0")
3338 (define_insn "abssi2"
3339 [(set (match_operand:SI 0 "register_operand" "=r")
3340 (abs:SI (match_operand:SI 1 "register_operand" "r")))]
3343 [(set_attr "slottable" "yes")
3344 (set_attr "cc" "noov32")])
3346 ;; FIXME: GCC should be able to do these expansions itself.
3348 (define_expand "abs<mode>2"
3350 (sign_extend:SI (match_operand:BW 1 "general_operand" "")))
3351 (set (match_dup 3) (abs:SI (match_dup 2)))
3352 (set (match_operand:BW 0 "register_operand" "")
3353 (subreg:BW (match_dup 3) 0))]
3355 "operands[2] = gen_reg_rtx (SImode); operands[3] = gen_reg_rtx (SImode);")
3357 (define_insn "clzsi2"
3358 [(set (match_operand:SI 0 "register_operand" "=r")
3359 (clz:SI (match_operand:SI 1 "register_operand" "r")))]
3362 [(set_attr "slottable" "yes")
3363 (set_attr "cc" "noov32")])
3365 (define_insn "bswapsi2"
3366 [(set (match_operand:SI 0 "register_operand" "=r")
3367 (bswap:SI (match_operand:SI 1 "register_operand" "0")))]
3370 [(set_attr "slottable" "yes")
3371 (set_attr "cc" "noov32")])
3373 ;; This instruction swaps all bits in a register.
3374 ;; That means that the most significant bit is put in the place
3375 ;; of the least significant bit, and so on.
3377 (define_insn "cris_swap_bits"
3378 [(set (match_operand:SI 0 "register_operand" "=r")
3379 (unspec:SI [(match_operand:SI 1 "register_operand" "0")]
3380 CRIS_UNSPEC_SWAP_BITS))]
3383 [(set_attr "slottable" "yes")
3384 (set_attr "cc" "noov32")])
3386 ;; Implement ctz using two instructions, one for bit swap and one for clz.
3387 ;; Defines a scratch register to avoid clobbering input.
3389 (define_expand "ctzsi2"
3391 (match_operand:SI 1 "register_operand"))
3393 (unspec:SI [(match_dup 2)] CRIS_UNSPEC_SWAP_BITS))
3394 (set (match_operand:SI 0 "register_operand")
3395 (clz:SI (match_dup 2)))]
3396 "TARGET_HAS_LZ && TARGET_HAS_SWAP"
3397 "operands[2] = gen_reg_rtx (SImode);")
3399 ;; Bound-insn. Defined to be the same as an unsigned minimum, which is an
3400 ;; operation supported by gcc. Used in casesi, but used now and then in
3403 (define_expand "uminsi3"
3404 [(set (match_operand:SI 0 "register_operand" "")
3405 (umin:SI (match_operand:SI 1 "register_operand" "")
3406 (match_operand:SI 2 "general_operand" "")))]
3409 if (MEM_P (operands[2]) && TARGET_V32)
3410 operands[2] = force_reg (SImode, operands[2]);
3413 (define_insn "*uminsi3_non_v32"
3414 [(set (match_operand:SI 0 "register_operand" "=r,r, r,r")
3415 (umin:SI (match_operand:SI 1 "register_operand" "%0,0, 0,r")
3416 (match_operand:SI 2 "general_operand" "r,Q>,g,!To")))]
3419 if (CONST_INT_P (operands[2]))
3421 /* Constant operands are zero-extended, so only 32-bit operands
3423 if (INTVAL (operands[2]) >= 0)
3425 if (INTVAL (operands[2]) < 256)
3426 return "bound.b %2,%0";
3428 if (INTVAL (operands[2]) < 65536)
3429 return "bound.w %2,%0";
3432 else if (which_alternative == 3)
3433 return "bound.d %2,%1,%0";
3435 return "bound.d %2,%0";
3437 [(set_attr "slottable" "yes,yes,no,no")])
3439 (define_insn "*uminsi3_v32"
3440 [(set (match_operand:SI 0 "register_operand" "=r,r")
3441 (umin:SI (match_operand:SI 1 "register_operand" "%0,0")
3442 (match_operand:SI 2 "nonmemory_operand" "r,i")))]
3445 if (GET_CODE (operands[2]) == CONST_INT)
3447 /* Constant operands are zero-extended, so only 32-bit operands
3449 if (INTVAL (operands[2]) >= 0)
3451 if (INTVAL (operands[2]) < 256)
3452 return "bound.b %2,%0";
3454 if (INTVAL (operands[2]) < 65536)
3455 return "bound.w %2,%0";
3459 return "bound.d %2,%0";
3461 [(set_attr "slottable" "yes,no")])
3463 ;; Jump and branch insns.
3467 (label_ref (match_operand 0 "" "")))]
3470 [(set_attr "slottable" "has_slot")])
3472 ;; Testcase gcc.c-torture/compile/991213-3.c fails if we allow a constant
3473 ;; here, since the insn is not recognized as an indirect jump by
3474 ;; jmp_uses_reg_or_mem used by computed_jump_p. Perhaps it is a kludge to
3475 ;; change from general_operand to nonimmediate_operand (at least the docs
3476 ;; should be changed), but then again the pattern is called indirect_jump.
3477 (define_expand "indirect_jump"
3478 [(set (pc) (match_operand:SI 0 "nonimmediate_operand"))]
3481 if (TARGET_V32 && MEM_P (operands[0]))
3482 operands[0] = force_reg (SImode, operands[0]);
3485 (define_insn "*indirect_jump_non_v32"
3486 [(set (pc) (match_operand:SI 0 "nonimmediate_operand" "rm"))]
3490 (define_insn "*indirect_jump_v32"
3491 [(set (pc) (match_operand:SI 0 "register_operand" "r"))]
3494 [(set_attr "slottable" "has_slot")])
3496 ;; Return insn. Used whenever the epilogue is very simple; if it is only
3497 ;; a single ret or jump [sp+]. No allocated stack space or saved
3498 ;; registers are allowed.
3499 ;; Note that for this pattern, although named, it is ok to check the
3500 ;; context of the insn in the test, not only compiler switches.
3502 (define_expand "return"
3504 "cris_simple_epilogue ()"
3505 "cris_expand_return (cris_return_address_on_stack ()); DONE;")
3507 (define_insn "*return_expanded"
3511 return cris_return_address_on_stack_for_return ()
3512 ? "jump [$sp+]" : "ret%#";
3514 [(set (attr "slottable")
3516 (match_test "cris_return_address_on_stack_for_return ()")
3518 (const_string "has_return_slot")))])
3520 (define_expand "prologue"
3523 "cris_expand_prologue (); DONE;")
3525 (define_expand "epilogue"
3528 "cris_expand_epilogue (); DONE;")
3530 ;; Conditional branches.
3532 (define_expand "cbranch<mode>4"
3533 [(set (cc0) (compare
3534 (match_operand:BWD 1 "nonimmediate_operand")
3535 (match_operand:BWD 2 "general_operand")))
3537 (if_then_else (match_operator 0 "ordered_comparison_operator"
3538 [(cc0) (const_int 0)])
3539 (label_ref (match_operand 3 "" ""))
3544 (define_expand "cbranchdi4"
3546 (compare (match_operand:DI 1 "nonimmediate_operand" "")
3547 (match_operand:DI 2 "general_operand" "")))
3549 (if_then_else (match_operator 0 "ordered_comparison_operator"
3550 [(cc0) (const_int 0)])
3551 (label_ref (match_operand 3 "" ""))
3555 if (TARGET_V32 && !REG_P (operands[1]))
3556 operands[1] = force_reg (DImode, operands[1]);
3557 if (TARGET_V32 && MEM_P (operands[2]))
3558 operands[2] = force_reg (DImode, operands[2]);
3562 ;; We suffer from the same overflow-bit-gets-in-the-way problem as
3563 ;; e.g. m68k, so we have to check if overflow bit is set on all "signed"
3566 (define_insn "b<ncond:code>"
3568 (if_then_else (ncond (cc0)
3570 (label_ref (match_operand 0 "" ""))
3574 [(set_attr "slottable" "has_slot")])
3576 (define_insn "b<ocond:code>"
3578 (if_then_else (ocond (cc0)
3580 (label_ref (match_operand 0 "" ""))
3585 (cc_prev_status.flags & CC_NO_OVERFLOW)
3586 ? 0 : "b<CC> %l0%#";
3588 [(set_attr "slottable" "has_slot")])
3590 (define_insn "b<rcond:code>"
3592 (if_then_else (rcond (cc0)
3594 (label_ref (match_operand 0 "" ""))
3599 (cc_prev_status.flags & CC_NO_OVERFLOW)
3600 ? "b<oCC> %l0%#" : "b<CC> %l0%#";
3602 [(set_attr "slottable" "has_slot")])
3604 ;; Reversed anonymous patterns to the ones above, as mandated.
3606 (define_insn "*b<ncond:code>_reversed"
3608 (if_then_else (ncond (cc0)
3611 (label_ref (match_operand 0 "" ""))))]
3614 [(set_attr "slottable" "has_slot")])
3616 (define_insn "*b<ocond:code>_reversed"
3618 (if_then_else (ocond (cc0)
3621 (label_ref (match_operand 0 "" ""))))]
3625 (cc_prev_status.flags & CC_NO_OVERFLOW)
3626 ? 0 : "b<rCC> %l0%#";
3628 [(set_attr "slottable" "has_slot")])
3630 (define_insn "*b<rcond:code>_reversed"
3632 (if_then_else (rcond (cc0)
3635 (label_ref (match_operand 0 "" ""))))]
3639 (cc_prev_status.flags & CC_NO_OVERFLOW)
3640 ? "b<roCC> %l0%#" : "b<rCC> %l0%#";
3642 [(set_attr "slottable" "has_slot")])
3644 ;; Set on condition: sCC.
3646 (define_expand "cstoredi4"
3647 [(set (cc0) (compare
3648 (match_operand:DI 2 "nonimmediate_operand")
3649 (match_operand:DI 3 "general_operand")))
3650 (set (match_operand:SI 0 "register_operand")
3651 (match_operator:SI 1 "ordered_comparison_operator"
3652 [(cc0) (const_int 0)]))]
3655 if (TARGET_V32 && !REG_P (operands[2]))
3656 operands[2] = force_reg (DImode, operands[2]);
3657 if (TARGET_V32 && MEM_P (operands[3]))
3658 operands[3] = force_reg (DImode, operands[3]);
3661 (define_expand "cstore<mode>4"
3662 [(set (cc0) (compare
3663 (match_operand:BWD 2 "nonimmediate_operand")
3664 (match_operand:BWD 3 "general_operand")))
3665 (set (match_operand:SI 0 "register_operand")
3666 (match_operator:SI 1 "ordered_comparison_operator"
3667 [(cc0) (const_int 0)]))]
3671 ;; Like bCC, we have to check the overflow bit for
3672 ;; signed conditions.
3674 (define_insn "s<ncond:code>"
3675 [(set (match_operand:SI 0 "register_operand" "=r")
3676 (ncond:SI (cc0) (const_int 0)))]
3679 [(set_attr "slottable" "yes")
3680 (set_attr "cc" "none")])
3682 (define_insn "s<rcond:code>"
3683 [(set (match_operand:SI 0 "register_operand" "=r")
3684 (rcond:SI (cc0) (const_int 0)))]
3688 (cc_prev_status.flags & CC_NO_OVERFLOW)
3689 ? "s<oCC> %0" : "s<CC> %0";
3691 [(set_attr "slottable" "yes")
3692 (set_attr "cc" "none")])
3694 (define_insn "s<ocond:code>"
3695 [(set (match_operand:SI 0 "register_operand" "=r")
3696 (ocond:SI (cc0) (const_int 0)))]
3700 (cc_prev_status.flags & CC_NO_OVERFLOW)
3703 [(set_attr "slottable" "yes")
3704 (set_attr "cc" "none")])
3708 ;; We need to make these patterns "expand", since the real operand is
3709 ;; hidden in a (mem:QI ) inside operand[0] (call_value: operand[1]),
3710 ;; and cannot be checked if it were a "normal" pattern.
3711 ;; Note that "call" and "call_value" are *always* called with a
3712 ;; mem-operand for operand 0 and 1 respective. What happens for combined
3713 ;; instructions is a different issue.
3715 (define_expand "call"
3716 [(parallel [(call (match_operand:QI 0 "cris_mem_call_operand" "")
3717 (match_operand 1 "general_operand" ""))
3718 (clobber (reg:SI CRIS_SRP_REGNUM))])]
3721 gcc_assert (MEM_P (operands[0]));
3723 cris_expand_pic_call_address (&operands[0], &operands[1]);
3725 operands[1] = const0_rtx;
3728 ;; Accept operands for operand 0 in order of preference.
3730 (define_insn "*expanded_call_non_v32"
3731 [(call (mem:QI (match_operand:SI 0 "general_operand" "r,Q>,g"))
3732 (match_operand:SI 1 "cris_call_type_marker" "rM,rM,rM"))
3733 (clobber (reg:SI CRIS_SRP_REGNUM))]
3737 (define_insn "*expanded_call_v32"
3740 (match_operand:SI 0 "cris_nonmemory_operand_or_callable_symbol" "n,r,U,i"))
3741 (match_operand:SI 1 "cris_call_type_marker" "rM,rM,rM,rM"))
3742 (clobber (reg:SI CRIS_SRP_REGNUM))]
3749 [(set_attr "slottable" "has_call_slot")])
3751 ;; Parallel when calculating and reusing address of indirect pointer
3752 ;; with simple offset. (Makes most sense with PIC.) It looks a bit
3753 ;; wrong not to have the clobber last, but that's the way combine
3754 ;; generates it (except it doesn't look into the *inner* mem, so this
3755 ;; just matches a peephole2). FIXME: investigate that.
3756 (define_insn "*expanded_call_side"
3759 (plus:SI (match_operand:SI 0 "cris_bdap_operand" "%r, r,r")
3760 (match_operand:SI 1 "cris_bdap_operand" "r>Rn,r,>Rn"))))
3761 (match_operand:SI 2 "cris_call_type_marker" "rM,rM,rM"))
3762 (clobber (reg:SI CRIS_SRP_REGNUM))
3763 (set (match_operand:SI 3 "register_operand" "=*0,r,r")
3764 (plus:SI (match_dup 0)
3766 ;; Disabled until after reload until we can avoid an output reload for
3767 ;; operand 3 (being forbidden for call insns).
3768 "reload_completed && !TARGET_AVOID_GOTPLT && !TARGET_V32"
3771 (define_expand "call_value"
3772 [(parallel [(set (match_operand 0 "" "")
3773 (call (match_operand:QI 1 "cris_mem_call_operand" "")
3774 (match_operand 2 "" "")))
3775 (clobber (reg:SI CRIS_SRP_REGNUM))])]
3778 gcc_assert (MEM_P (operands[1]));
3780 cris_expand_pic_call_address (&operands[1], &operands[2]);
3782 operands[2] = const0_rtx;
3785 ;; The validity other than "general" of
3786 ;; operand 0 will be checked elsewhere. Accept operands for operand 1 in
3787 ;; order of preference (Q includes r, but r is shorter, faster).
3788 ;; We also accept a PLT symbol. We output it as [rPIC+sym:GOTPLT] rather
3789 ;; than requiring getting rPIC + sym:PLT into a register.
3791 (define_insn "*expanded_call_value_non_v32"
3792 [(set (match_operand 0 "nonimmediate_operand" "=g,g,g")
3793 (call (mem:QI (match_operand:SI 1 "general_operand" "r,Q>,g"))
3794 (match_operand:SI 2 "cris_call_type_marker" "rM,rM,rM")))
3795 (clobber (reg:SI CRIS_SRP_REGNUM))]
3798 [(set_attr "cc" "clobber")])
3800 ;; See similar call special-case.
3801 (define_insn "*expanded_call_value_side"
3802 [(set (match_operand 0 "nonimmediate_operand" "=g,g,g")
3806 (plus:SI (match_operand:SI 1 "cris_bdap_operand" "%r, r,r")
3807 (match_operand:SI 2 "cris_bdap_operand" "r>Rn,r,>Rn"))))
3808 (match_operand:SI 3 "cris_call_type_marker" "rM,rM,rM")))
3809 (clobber (reg:SI CRIS_SRP_REGNUM))
3810 (set (match_operand:SI 4 "register_operand" "=*1,r,r")
3811 (plus:SI (match_dup 1)
3813 ;; Disabled until after reload until we can avoid an output reload for
3814 ;; operand 4 (being forbidden for call insns).
3815 "reload_completed && !TARGET_AVOID_GOTPLT && !TARGET_V32"
3817 [(set_attr "cc" "clobber")])
3819 (define_insn "*expanded_call_value_v32"
3821 (match_operand 0 "nonimmediate_operand" "=g,g,g,g")
3824 (match_operand:SI 1 "cris_nonmemory_operand_or_callable_symbol" "n,r,U,i"))
3825 (match_operand:SI 2 "cris_call_type_marker" "rM,rM,rM,rM")))
3826 (clobber (reg:SI 16))]
3833 [(set_attr "cc" "clobber")
3834 (set_attr "slottable" "has_call_slot")])
3836 ;; Used in debugging. No use for the direct pattern; unfilled
3837 ;; delayed-branches are taken care of by other means.
3843 [(set_attr "cc" "none")])
3845 ;; Same as the gdb trap breakpoint, will cause a SIGTRAP for
3846 ;; cris-linux* and crisv32-linux*, as intended. Will work in
3847 ;; freestanding environments with sufficient framework.
3849 [(trap_if (const_int 1) (const_int 8))]
3850 "TARGET_TRAP_USING_BREAK8"
3853 ;; We need to stop accesses to the stack after the memory is
3854 ;; deallocated. Unfortunately, reorg doesn't look at naked clobbers,
3855 ;; e.g. (insn ... (clobber (mem:BLK (stack_pointer_rtx)))) and we don't
3856 ;; want to use a naked (unspec_volatile) as that would stop any
3857 ;; scheduling in the epilogue. Hence we model it as a "real" insn that
3858 ;; sets the memory in an unspecified manner. FIXME: Unfortunately it
3859 ;; still has the effect of an unspec_volatile.
3860 (define_insn "cris_frame_deallocated_barrier"
3861 [(set (mem:BLK (reg:SI CRIS_SP_REGNUM))
3862 (unspec:BLK [(const_int 0)] CRIS_UNSPEC_FRAME_DEALLOC))]
3865 [(set_attr "length" "0")])
3867 ;; We expand on casesi so we can use "bound" and "add offset fetched from
3868 ;; a table to pc" (adds.w [pc+%0.w],pc).
3870 ;; Note: if you change the "parallel" (or add anything after it) in
3871 ;; this expansion, you must change the macro ASM_OUTPUT_CASE_END
3872 ;; accordingly, to add the default case at the end of the jump-table.
3874 (define_expand "cris_casesi_non_v32"
3875 [(set (match_dup 5) (match_operand:SI 0 "general_operand" ""))
3877 (minus:SI (match_dup 5)
3878 (match_operand:SI 1 "const_int_operand" "n")))
3880 (umin:SI (match_dup 6)
3881 (match_operand:SI 2 "const_int_operand" "n")))
3885 (ltu (match_dup 7) (match_dup 2))
3886 (plus:SI (sign_extend:SI
3888 (plus:SI (mult:SI (match_dup 7) (const_int 2))
3891 (label_ref (match_operand 4 "" ""))))
3892 (use (label_ref (match_operand 3 "" "")))])]
3895 operands[2] = plus_constant (SImode, operands[2], 1);
3896 operands[5] = gen_reg_rtx (SImode);
3897 operands[6] = gen_reg_rtx (SImode);
3898 operands[7] = gen_reg_rtx (SImode);
3901 ;; FIXME: Check effect of not JUMP_TABLES_IN_TEXT_SECTION.
3902 (define_expand "cris_casesi_v32"
3903 [(set (match_dup 5) (match_operand:SI 0 "general_operand"))
3905 (minus:SI (match_dup 5)
3906 (match_operand:SI 1 "const_int_operand")))
3908 (umin:SI (match_dup 6)
3909 (match_operand:SI 2 "const_int_operand")))
3910 (set (match_dup 8) (match_dup 11))
3912 (plus:SI (mult:SI (match_dup 7) (const_int 2))
3915 (plus:SI (sign_extend:SI (mem:HI (match_dup 9)))
3920 (ltu (unspec [(const_int 0)] CRIS_UNSPEC_CASESI) (match_dup 2))
3922 (label_ref (match_operand 4 "" ""))))
3923 (use (label_ref (match_dup 3)))])]
3927 rtx xlabel = gen_rtx_LABEL_REF (VOIDmode, operands[3]);
3928 for (i = 5; i <= 10; i++)
3929 operands[i] = gen_reg_rtx (SImode);
3930 operands[2] = plus_constant (SImode, operands[2], 1);
3932 /* Don't forget to decorate labels too, for PIC. */
3933 operands[11] = flag_pic
3934 ? gen_rtx_CONST (Pmode,
3935 gen_rtx_UNSPEC (Pmode, gen_rtvec (1, xlabel),
3940 (define_expand "casesi"
3941 [(match_operand:SI 0 "general_operand")
3942 (match_operand:SI 1 "const_int_operand")
3943 (match_operand:SI 2 "const_int_operand")
3944 (match_operand 3 "" "")
3945 (match_operand 4 "" "")]
3949 emit_insn (gen_cris_casesi_v32 (operands[0], operands[1], operands[2],
3950 operands[3], operands[4]));
3952 emit_insn (gen_cris_casesi_non_v32 (operands[0], operands[1], operands[2],
3953 operands[3], operands[4]));
3957 ;; Split-patterns. Some of them have modes unspecified. This
3958 ;; should always be ok; if for no other reason sparc.md has it as
3961 ;; When register_operand is specified for an operand, we can get a
3962 ;; subreg as well (Axis-990331), so don't just assume that REG_P is true
3963 ;; for a register_operand and that REGNO can be used as is. It is best to
3964 ;; guard with REG_P, unless it is worth it to adjust for the subreg case.
3966 ;; op [rx + 0],ry,rz
3967 ;; The index to rx is optimized into zero, and gone.
3969 ;; First, recognize bound [rx],ry,rz; where [rx] is zero-extended,
3970 ;; and add/sub [rx],ry,rz, with zero or sign-extend on [rx].
3974 ;; Lose if rz=ry or rx=rz.
3975 ;; Call this op-extend-split.
3976 ;; Do not match for V32; the addo and addi shouldn't be split
3980 [(set (match_operand 0 "cris_nonsp_register_operand" "")
3982 4 "cris_operand_extend_operator"
3983 [(match_operand 1 "register_operand" "")
3985 3 "cris_extend_operator"
3986 [(match_operand 2 "memory_operand" "")])]))]
3988 && REG_P (operands[0])
3989 && REG_P (operands[1])
3990 && REGNO (operands[1]) != REGNO (operands[0])
3991 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
3992 && REG_P (XEXP (operands[2], 0))
3993 && REGNO (XEXP (operands[2], 0)) != REGNO (operands[0])"
3999 (match_op_dup 3 [(match_dup 2)])]))]
4002 ;; As op-extend-split, but recognize and split op [rz],ry,rz into
4005 ;; Do this for plus or bound only, being commutative operations, since we
4006 ;; have swapped the operands.
4007 ;; Call this op-extend-split-rx=rz
4010 [(set (match_operand 0 "cris_nonsp_register_operand" "")
4012 4 "cris_plus_or_bound_operator"
4013 [(match_operand 1 "register_operand" "")
4015 3 "cris_extend_operator"
4016 [(match_operand 2 "memory_operand" "")])]))]
4018 && REG_P (operands[0])
4019 && REG_P (operands[1])
4020 && REGNO (operands[1]) != REGNO (operands[0])
4021 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
4022 && REG_P (XEXP (operands[2], 0))
4023 && REGNO (XEXP (operands[2], 0)) == REGNO (operands[0])"
4025 (match_op_dup 3 [(match_dup 2)]))
4032 ;; As the op-extend-split, but swapped operands, and only for
4033 ;; plus or bound, being the commutative extend-operators. FIXME: Why is
4034 ;; this needed? Is it?
4035 ;; Call this op-extend-split-swapped
4038 [(set (match_operand 0 "cris_nonsp_register_operand" "")
4040 4 "cris_plus_or_bound_operator"
4042 3 "cris_extend_operator"
4043 [(match_operand 2 "memory_operand" "")])
4044 (match_operand 1 "register_operand" "")]))]
4046 && REG_P (operands[0])
4047 && REG_P (operands[1])
4048 && REGNO (operands[1]) != REGNO (operands[0])
4049 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
4050 && REG_P (XEXP (operands[2], 0))
4051 && REGNO (XEXP (operands[2], 0)) != REGNO (operands[0])"
4057 (match_op_dup 3 [(match_dup 2)])]))]
4060 ;; As op-extend-split-rx=rz, but swapped operands, only for plus or
4061 ;; bound. Call this op-extend-split-swapped-rx=rz.
4064 [(set (match_operand 0 "cris_nonsp_register_operand" "")
4066 4 "cris_plus_or_bound_operator"
4068 3 "cris_extend_operator"
4069 [(match_operand 2 "memory_operand" "")])
4070 (match_operand 1 "register_operand" "")]))]
4072 && REG_P (operands[0])
4073 && REG_P (operands[1])
4074 && REGNO (operands[1]) != REGNO (operands[0])
4075 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
4076 && REG_P (XEXP (operands[2], 0))
4077 && REGNO (XEXP (operands[2], 0)) == REGNO (operands[0])"
4079 (match_op_dup 3 [(match_dup 2)]))
4086 ;; As op-extend-split, but the mem operand is not extended.
4088 ;; op [rx],ry,rz changed into
4091 ;; lose if ry=rz or rx=rz
4092 ;; Call this op-extend.
4095 [(set (match_operand 0 "cris_nonsp_register_operand" "")
4097 3 "cris_orthogonal_operator"
4098 [(match_operand 1 "register_operand" "")
4099 (match_operand 2 "memory_operand" "")]))]
4101 && REG_P (operands[0])
4102 && REG_P (operands[1])
4103 && REGNO (operands[1]) != REGNO (operands[0])
4104 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
4105 && REG_P (XEXP (operands[2], 0))
4106 && REGNO (XEXP (operands[2], 0)) != REGNO (operands[0])"
4115 ;; As op-extend-split-rx=rz, non-extended.
4116 ;; Call this op-split-rx=rz
4119 [(set (match_operand 0 "cris_nonsp_register_operand" "")
4121 3 "cris_commutative_orth_op"
4122 [(match_operand 2 "memory_operand" "")
4123 (match_operand 1 "register_operand" "")]))]
4125 && REG_P (operands[0])
4126 && REG_P (operands[1])
4127 && REGNO (operands[1]) != REGNO (operands[0])
4128 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
4129 && REG_P (XEXP (operands[2], 0))
4130 && REGNO (XEXP (operands[2], 0)) != REGNO (operands[0])"
4139 ;; As op-extend-split-swapped, nonextended.
4140 ;; Call this op-split-swapped.
4143 [(set (match_operand 0 "cris_nonsp_register_operand" "")
4145 3 "cris_commutative_orth_op"
4146 [(match_operand 1 "register_operand" "")
4147 (match_operand 2 "memory_operand" "")]))]
4149 && REG_P (operands[0]) && REG_P (operands[1])
4150 && REGNO (operands[1]) != REGNO (operands[0])
4151 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
4152 && REG_P (XEXP (operands[2], 0))
4153 && REGNO (XEXP (operands[2], 0)) == REGNO (operands[0])"
4162 ;; As op-extend-split-swapped-rx=rz, non-extended.
4163 ;; Call this op-split-swapped-rx=rz.
4166 [(set (match_operand 0 "cris_nonsp_register_operand" "")
4168 3 "cris_orthogonal_operator"
4169 [(match_operand 2 "memory_operand" "")
4170 (match_operand 1 "register_operand" "")]))]
4172 && REG_P (operands[0]) && REG_P (operands[1])
4173 && REGNO (operands[1]) != REGNO (operands[0])
4174 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
4175 && REG_P (XEXP (operands[2], 0))
4176 && REGNO (XEXP (operands[2], 0)) == REGNO (operands[0])"
4187 ;; Splits for all cases in side-effect insns where (possibly after reload
4188 ;; and register allocation) rx and ry in [rx=ry+i] are equal.
4190 ;; move.S1 [rx=rx+rz.S2],ry
4194 [(set (match_operand 0 "register_operand" "")
4198 (mult:SI (match_operand:SI 1 "register_operand" "")
4199 (match_operand:SI 2 "const_int_operand" ""))
4200 (match_operand:SI 3 "register_operand" ""))]))
4201 (set (match_operand:SI 4 "register_operand" "")
4202 (plus:SI (mult:SI (match_dup 1)
4205 "REG_P (operands[3]) && REG_P (operands[4])
4206 && REGNO (operands[3]) == REGNO (operands[4])"
4207 [(set (match_dup 4) (plus:SI (mult:SI (match_dup 1) (match_dup 2))
4209 (set (match_dup 0) (match_dup 5))]
4210 "operands[5] = replace_equiv_address (operands[6], operands[3]);")
4212 ;; move.S1 [rx=rx+i],ry
4216 [(set (match_operand 0 "register_operand" "")
4219 [(plus:SI (match_operand:SI 1 "cris_bdap_operand" "")
4220 (match_operand:SI 2 "cris_bdap_operand" ""))]))
4221 (set (match_operand:SI 3 "register_operand" "")
4222 (plus:SI (match_dup 1)
4224 "(rtx_equal_p (operands[3], operands[1])
4225 || rtx_equal_p (operands[3], operands[2]))"
4226 [(set (match_dup 3) (plus:SI (match_dup 1) (match_dup 2)))
4227 (set (match_dup 0) (match_dup 4))]
4229 operands[4] = replace_equiv_address (operands[5], operands[3]);
4230 cris_order_for_addsi3 (operands, 1);
4233 ;; move.S1 ry,[rx=rx+rz.S2]
4237 [(set (match_operator
4240 (mult:SI (match_operand:SI 0 "register_operand" "")
4241 (match_operand:SI 1 "const_int_operand" ""))
4242 (match_operand:SI 2 "register_operand" ""))])
4243 (match_operand 3 "register_operand" ""))
4244 (set (match_operand:SI 4 "register_operand" "")
4245 (plus:SI (mult:SI (match_dup 0)
4248 "REG_P (operands[2]) && REG_P (operands[4])
4249 && REGNO (operands[4]) == REGNO (operands[2])"
4250 [(set (match_dup 4) (plus:SI (mult:SI (match_dup 0) (match_dup 1))
4252 (set (match_dup 5) (match_dup 3))]
4253 "operands[5] = replace_equiv_address (operands[6], operands[4]);")
4255 ;; move.S1 ry,[rx=rx+i]
4259 [(set (match_operator
4261 [(plus:SI (match_operand:SI 0 "cris_bdap_operand" "")
4262 (match_operand:SI 1 "cris_bdap_operand" ""))])
4263 (match_operand 2 "register_operand" ""))
4264 (set (match_operand:SI 3 "register_operand" "")
4265 (plus:SI (match_dup 0)
4267 "(rtx_equal_p (operands[3], operands[0])
4268 || rtx_equal_p (operands[3], operands[1]))"
4269 [(set (match_dup 3) (plus:SI (match_dup 0) (match_dup 1)))
4270 (set (match_dup 5) (match_dup 2))]
4272 operands[5] = replace_equiv_address (operands[6], operands[3]);
4273 cris_order_for_addsi3 (operands, 0);
4276 ;; clear.[bwd] [rx=rx+rz.S2]
4280 [(set (mem:BWD (plus:SI
4281 (mult:SI (match_operand:SI 0 "register_operand" "")
4282 (match_operand:SI 1 "const_int_operand" ""))
4283 (match_operand:SI 2 "register_operand" "")))
4285 (set (match_operand:SI 3 "register_operand" "")
4286 (plus:SI (mult:SI (match_dup 0)
4289 "REG_P (operands[2]) && REG_P (operands[3])
4290 && REGNO (operands[3]) == REGNO (operands[2])"
4291 [(set (match_dup 3) (plus:SI (mult:SI (match_dup 0) (match_dup 1))
4293 (set (mem:BWD (match_dup 3)) (const_int 0))]
4296 ;; clear.[bwd] [rx=rx+i]
4301 (plus:SI (match_operand:SI 0 "cris_bdap_operand" "")
4302 (match_operand:SI 1 "cris_bdap_operand" "")))
4304 (set (match_operand:SI 2 "register_operand" "")
4305 (plus:SI (match_dup 0)
4307 "(rtx_equal_p (operands[0], operands[2])
4308 || rtx_equal_p (operands[2], operands[1]))"
4309 [(set (match_dup 2) (plus:SI (match_dup 0) (match_dup 1)))
4310 (set (mem:BWD (match_dup 2)) (const_int 0))]
4311 "cris_order_for_addsi3 (operands, 0);")
4313 ;; mov(s|u).S1 [rx=rx+rz.S2],ry
4317 [(set (match_operand 0 "register_operand" "")
4319 5 "cris_extend_operator"
4321 (mult:SI (match_operand:SI 1 "register_operand" "")
4322 (match_operand:SI 2 "const_int_operand" ""))
4323 (match_operand:SI 3 "register_operand" "")))]))
4324 (set (match_operand:SI 4 "register_operand" "")
4325 (plus:SI (mult:SI (match_dup 1)
4328 "REG_P (operands[3])
4329 && REG_P (operands[4])
4330 && REGNO (operands[3]) == REGNO (operands[4])"
4331 [(set (match_dup 4) (plus:SI (mult:SI (match_dup 1) (match_dup 2))
4333 (set (match_dup 0) (match_op_dup 5 [(match_dup 6)]))]
4334 "operands[6] = replace_equiv_address (XEXP (operands[5], 0), operands[4]);")
4336 ;; mov(s|u).S1 [rx=rx+i],ry
4340 [(set (match_operand 0 "register_operand" "")
4342 4 "cris_extend_operator"
4344 (match_operand:SI 1 "cris_bdap_operand" "")
4345 (match_operand:SI 2 "cris_bdap_operand" "")))]))
4346 (set (match_operand:SI 3 "register_operand" "")
4347 (plus:SI (match_dup 1)
4349 "(rtx_equal_p (operands[1], operands[3])
4350 || rtx_equal_p (operands[2], operands[3]))"
4351 [(set (match_dup 3) (plus:SI (match_dup 1) (match_dup 2)))
4352 (set (match_dup 0) (match_op_dup 4 [(match_dup 5)]))]
4354 operands[5] = replace_equiv_address (XEXP (operands[4], 0), operands[3]);
4355 cris_order_for_addsi3 (operands, 1);
4358 ;; op.S1 [rx=rx+i],ry
4362 [(set (match_operand 0 "register_operand" "")
4364 5 "cris_orthogonal_operator"
4365 [(match_operand 1 "register_operand" "")
4367 (match_operand:SI 2 "cris_bdap_operand" "")
4368 (match_operand:SI 3 "cris_bdap_operand" "")))]))
4369 (set (match_operand:SI 4 "register_operand" "")
4370 (plus:SI (match_dup 2)
4372 "(rtx_equal_p (operands[4], operands[2])
4373 || rtx_equal_p (operands[4], operands[3]))"
4374 [(set (match_dup 4) (plus:SI (match_dup 2) (match_dup 3)))
4375 (set (match_dup 0) (match_op_dup 5 [(match_dup 1) (match_dup 6)]))]
4377 operands[6] = replace_equiv_address (XEXP (operands[5], 1), operands[4]);
4378 cris_order_for_addsi3 (operands, 2);
4381 ;; op.S1 [rx=rx+rz.S2],ry
4385 [(set (match_operand 0 "register_operand" "")
4387 6 "cris_orthogonal_operator"
4388 [(match_operand 1 "register_operand" "")
4390 (mult:SI (match_operand:SI 2 "register_operand" "")
4391 (match_operand:SI 3 "const_int_operand" ""))
4392 (match_operand:SI 4 "register_operand" "")))]))
4393 (set (match_operand:SI 5 "register_operand" "")
4394 (plus:SI (mult:SI (match_dup 2)
4397 "REG_P (operands[4])
4398 && REG_P (operands[5])
4399 && REGNO (operands[5]) == REGNO (operands[4])"
4400 [(set (match_dup 5) (plus:SI (mult:SI (match_dup 2) (match_dup 3))
4402 (set (match_dup 0) (match_op_dup 6 [(match_dup 1) (match_dup 7)]))]
4403 "operands[7] = replace_equiv_address (XEXP (operands[6], 1), operands[5]);")
4405 ;; op.S1 [rx=rx+rz.S2],ry (swapped)
4409 [(set (match_operand 0 "register_operand" "")
4411 6 "cris_commutative_orth_op"
4413 (mult:SI (match_operand:SI 2 "register_operand" "")
4414 (match_operand:SI 3 "const_int_operand" ""))
4415 (match_operand:SI 4 "register_operand" "")))
4416 (match_operand 1 "register_operand" "")]))
4417 (set (match_operand:SI 5 "register_operand" "")
4418 (plus:SI (mult:SI (match_dup 2)
4421 "REG_P (operands[4])
4422 && REG_P (operands[5])
4423 && REGNO (operands[5]) == REGNO (operands[4])"
4424 [(set (match_dup 5) (plus:SI (mult:SI (match_dup 2) (match_dup 3))
4426 (set (match_dup 0) (match_op_dup 6 [(match_dup 7) (match_dup 1)]))]
4427 "operands[7] = replace_equiv_address (XEXP (operands[6], 0), operands[5]);")
4429 ;; op.S1 [rx=rx+i],ry (swapped)
4433 [(set (match_operand 0 "register_operand" "")
4435 5 "cris_commutative_orth_op"
4437 (plus:SI (match_operand:SI 2 "cris_bdap_operand" "")
4438 (match_operand:SI 3 "cris_bdap_operand" "")))
4439 (match_operand 1 "register_operand" "")]))
4440 (set (match_operand:SI 4 "register_operand" "")
4441 (plus:SI (match_dup 2)
4443 "(rtx_equal_p (operands[4], operands[2])
4444 || rtx_equal_p (operands[4], operands[3]))"
4445 [(set (match_dup 4) (plus:SI (match_dup 2) (match_dup 3)))
4446 (set (match_dup 0) (match_op_dup 5 [(match_dup 6) (match_dup 1)]))]
4448 operands[6] = replace_equiv_address (XEXP (operands[5], 0), operands[4]);
4449 cris_order_for_addsi3 (operands, 2);
4452 ;; op(s|u).S1 [rx=rx+rz.S2],ry
4456 [(set (match_operand 0 "register_operand" "")
4458 6 "cris_operand_extend_operator"
4459 [(match_operand 1 "register_operand" "")
4461 7 "cris_extend_operator"
4463 (mult:SI (match_operand:SI 2 "register_operand" "")
4464 (match_operand:SI 3 "const_int_operand" ""))
4465 (match_operand:SI 4 "register_operand" "")))])]))
4466 (set (match_operand:SI 5 "register_operand" "")
4467 (plus:SI (mult:SI (match_dup 2)
4470 "REG_P (operands[4])
4471 && REG_P (operands[5])
4472 && REGNO (operands[5]) == REGNO (operands[4])"
4473 [(set (match_dup 5) (plus:SI (mult:SI (match_dup 2) (match_dup 3))
4475 (set (match_dup 0) (match_op_dup 6 [(match_dup 1) (match_dup 8)]))]
4476 "operands[8] = gen_rtx_fmt_e (GET_CODE (operands[7]), GET_MODE (operands[7]),
4477 replace_equiv_address (XEXP (operands[7], 0),
4480 ;; op(s|u).S1 [rx=rx+i],ry
4484 [(set (match_operand 0 "register_operand" "")
4486 5 "cris_operand_extend_operator"
4487 [(match_operand 1 "register_operand" "")
4489 6 "cris_extend_operator"
4491 (plus:SI (match_operand:SI 2 "cris_bdap_operand" "")
4492 (match_operand:SI 3 "cris_bdap_operand" "")
4494 (set (match_operand:SI 4 "register_operand" "")
4495 (plus:SI (match_dup 2)
4497 "(rtx_equal_p (operands[4], operands[2])
4498 || rtx_equal_p (operands[4], operands[3]))"
4499 [(set (match_dup 4) (plus:SI (match_dup 2) (match_dup 3)))
4500 (set (match_dup 0) (match_op_dup 5 [(match_dup 1) (match_dup 7)]))]
4502 operands[7] = gen_rtx_fmt_e (GET_CODE (operands[6]), GET_MODE (operands[6]),
4503 replace_equiv_address (XEXP (operands[6], 0),
4505 cris_order_for_addsi3 (operands, 2);
4508 ;; op(s|u).S1 [rx=rx+rz.S2],ry (swapped, plus or bound)
4512 [(set (match_operand 0 "register_operand" "")
4514 7 "cris_plus_or_bound_operator"
4516 6 "cris_extend_operator"
4518 (mult:SI (match_operand:SI 2 "register_operand" "")
4519 (match_operand:SI 3 "const_int_operand" ""))
4520 (match_operand:SI 4 "register_operand" "")))])
4521 (match_operand 1 "register_operand" "")]))
4522 (set (match_operand:SI 5 "register_operand" "")
4523 (plus:SI (mult:SI (match_dup 2)
4526 "REG_P (operands[4]) && REG_P (operands[5])
4527 && REGNO (operands[5]) == REGNO (operands[4])"
4528 [(set (match_dup 5) (plus:SI (mult:SI (match_dup 2) (match_dup 3))
4530 (set (match_dup 0) (match_op_dup 6 [(match_dup 8) (match_dup 1)]))]
4531 "operands[8] = gen_rtx_fmt_e (GET_CODE (operands[6]), GET_MODE (operands[6]),
4532 replace_equiv_address (XEXP (operands[6], 0),
4535 ;; op(s|u).S1 [rx=rx+i],ry (swapped, plus or bound)
4539 [(set (match_operand 0 "register_operand" "")
4541 6 "cris_plus_or_bound_operator"
4543 5 "cris_extend_operator"
4545 (match_operand:SI 2 "cris_bdap_operand" "")
4546 (match_operand:SI 3 "cris_bdap_operand" "")))])
4547 (match_operand 1 "register_operand" "")]))
4548 (set (match_operand:SI 4 "register_operand" "")
4549 (plus:SI (match_dup 2)
4551 "(rtx_equal_p (operands[4], operands[2])
4552 || rtx_equal_p (operands[4], operands[3]))"
4553 [(set (match_dup 4) (plus:SI (match_dup 2) (match_dup 3)))
4554 (set (match_dup 0) (match_op_dup 6 [(match_dup 7) (match_dup 1)]))]
4556 operands[7] = gen_rtx_fmt_e (GET_CODE (operands[5]), GET_MODE (operands[5]),
4557 replace_equiv_address (XEXP (operands[5], 0),
4559 cris_order_for_addsi3 (operands, 2);
4562 ;; Splits for addressing prefixes that have no side-effects, so we can
4563 ;; fill a delay slot. Never split if we lose something, though.
4566 ;; move [indirect_ref],rx
4567 ;; where indirect ref = {const, [r+], [r]}, it costs as much as
4568 ;; move indirect_ref,rx
4570 ;; Take care not to allow indirect_ref = register.
4572 ;; We're not allowed to generate copies of registers with different mode
4573 ;; until after reload; copying pseudos upsets reload. CVS as of
4574 ;; 2001-08-24, unwind-dw2-fde.c, _Unwind_Find_FDE ICE in
4575 ;; cselib_invalidate_regno. Also, don't do this for the stack-pointer,
4576 ;; as we don't want it set temporarily to an invalid value.
4578 (define_split ; indir_to_reg_split
4579 [(set (match_operand 0 "cris_nonsp_register_operand" "")
4580 (match_operand 1 "indirect_operand" ""))]
4582 && REG_P (operands[0])
4583 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
4584 && (MEM_P (XEXP (operands[1], 0)) || CONSTANT_P (XEXP (operands[1], 0)))
4585 && REGNO (operands[0]) < CRIS_LAST_GENERAL_REGISTER"
4586 [(set (match_dup 2) (match_dup 4))
4587 (set (match_dup 0) (match_dup 3))]
4588 "operands[2] = gen_rtx_REG (Pmode, REGNO (operands[0]));
4589 operands[3] = replace_equiv_address (operands[1], operands[2]);
4590 operands[4] = XEXP (operands[1], 0);")
4592 ;; As the above, but MOVS and MOVU.
4595 [(set (match_operand 0 "cris_nonsp_register_operand" "")
4597 4 "cris_extend_operator"
4598 [(match_operand 1 "indirect_operand" "")]))]
4600 && REG_P (operands[0])
4601 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
4602 && (MEM_P (XEXP (operands[1], 0))
4603 || CONSTANT_P (XEXP (operands[1], 0)))"
4604 [(set (match_dup 2) (match_dup 5))
4605 (set (match_dup 0) (match_op_dup 4 [(match_dup 3)]))]
4606 "operands[2] = gen_rtx_REG (Pmode, REGNO (operands[0]));
4607 operands[3] = replace_equiv_address (XEXP (operands[4], 0), operands[2]);
4608 operands[5] = XEXP (operands[1], 0);")
4610 ;; Various peephole optimizations.
4612 ;; Watch out: when you exchange one set of instructions for another, the
4613 ;; condition codes setting must be the same, or you have to CC_INIT or
4614 ;; whatever is appropriate, in the pattern before you emit the
4615 ;; assembly text. This is best done here, not in cris_notice_update_cc,
4616 ;; to keep changes local to their cause.
4618 ;; Do not add patterns that you do not know will be matched.
4619 ;; Please also add a self-contained testcase.
4621 ;; We have trouble with and:s and shifts. Maybe something is broken in
4622 ;; gcc? Or it could just be that bit-field insn expansion is a bit
4623 ;; suboptimal when not having extzv insns.
4624 ;; Testcase for the following four peepholes: gcc.dg/cris-peep2-xsrand.c
4626 (define_peephole2 ; asrandb (peephole casesi+31)
4627 [(set (match_operand:SI 0 "register_operand" "")
4628 (ashiftrt:SI (match_dup 0)
4629 (match_operand:SI 1 "const_int_operand" "")))
4631 (and:SI (match_dup 0)
4632 (match_operand 2 "const_int_operand" "")))]
4633 "INTVAL (operands[2]) > 31
4634 && INTVAL (operands[2]) < 255
4635 && INTVAL (operands[1]) > 23
4636 /* Check that the and-operation enables us to use logical-shift. */
4637 && (INTVAL (operands[2])
4638 & ((HOST_WIDE_INT) (HOST_WIDE_INT_M1U
4639 << (32 - INTVAL (operands[1]))))) == 0"
4640 [(set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 1)))
4641 (set (match_dup 3) (and:QI (match_dup 3) (match_dup 4)))]
4642 ;; FIXME: CC0 is valid except for the M bit.
4644 operands[3] = gen_rtx_REG (QImode, REGNO (operands[0]));
4645 operands[4] = GEN_INT (trunc_int_for_mode (INTVAL (operands[2]), QImode));
4648 (define_peephole2 ; asrandw (peephole casesi+32)
4649 [(set (match_operand:SI 0 "register_operand" "")
4650 (ashiftrt:SI (match_dup 0)
4651 (match_operand:SI 1 "const_int_operand" "")))
4653 (and:SI (match_dup 0) (match_operand 2 "const_int_operand" "")))]
4654 "INTVAL (operands[2]) > 31
4655 && INTVAL (operands[2]) < 65535
4656 && INTVAL (operands[2]) != 255
4657 && INTVAL (operands[1]) > 15
4658 /* Check that the and-operation enables us to use logical-shift. */
4659 && (INTVAL (operands[2])
4660 & ((HOST_WIDE_INT) (HOST_WIDE_INT_M1U
4661 << (32 - INTVAL (operands[1]))))) == 0"
4662 [(set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 1)))
4663 (set (match_dup 3) (and:HI (match_dup 3) (match_dup 4)))]
4664 ;; FIXME: CC0 is valid except for the M bit.
4666 operands[3] = gen_rtx_REG (HImode, REGNO (operands[0]));
4667 operands[4] = GEN_INT (trunc_int_for_mode (INTVAL (operands[2]), HImode));
4670 (define_peephole2 ; lsrandb (peephole casesi+33)
4671 [(set (match_operand:SI 0 "register_operand" "")
4672 (lshiftrt:SI (match_dup 0)
4673 (match_operand:SI 1 "const_int_operand" "")))
4675 (and:SI (match_dup 0) (match_operand 2 "const_int_operand" "")))]
4676 "INTVAL (operands[2]) > 31
4677 && INTVAL (operands[2]) < 255
4678 && INTVAL (operands[1]) > 23"
4679 [(set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 1)))
4680 (set (match_dup 3) (and:QI (match_dup 3) (match_dup 4)))]
4681 ;; FIXME: CC0 is valid except for the M bit.
4683 operands[3] = gen_rtx_REG (QImode, REGNO (operands[0]));
4684 operands[4] = GEN_INT (trunc_int_for_mode (INTVAL (operands[2]), QImode));
4687 (define_peephole2 ; lsrandw (peephole casesi+34)
4688 [(set (match_operand:SI 0 "register_operand" "")
4689 (lshiftrt:SI (match_dup 0)
4690 (match_operand:SI 1 "const_int_operand" "")))
4692 (and:SI (match_dup 0) (match_operand 2 "const_int_operand" "")))]
4693 "INTVAL (operands[2]) > 31 && INTVAL (operands[2]) < 65535
4694 && INTVAL (operands[2]) != 255
4695 && INTVAL (operands[1]) > 15"
4696 [(set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 1)))
4697 (set (match_dup 3) (and:HI (match_dup 3) (match_dup 4)))]
4698 ;; FIXME: CC0 is valid except for the M bit.
4700 operands[3] = gen_rtx_REG (HImode, REGNO (operands[0]));
4701 operands[4] = GEN_INT (trunc_int_for_mode (INTVAL (operands[2]), HImode));
4709 ;; move [rx=rx+n],ry
4710 ;; when -128 <= n <= 127.
4711 ;; This will reduce the size of the assembler code for n = [-128..127],
4712 ;; and speed up accordingly. Don't match if the previous insn is
4713 ;; (set rx rz) because that combination is matched by another peephole.
4714 ;; No stable test-case.
4716 (define_peephole2 ; moversideqi (peephole casesi+35)
4717 [(set (match_operand:SI 0 "register_operand" "")
4718 (plus:SI (match_operand:SI 1 "register_operand" "")
4719 (match_operand:SI 2 "const_int_operand" "")))
4720 (set (match_operand 3 "register_operand" "")
4721 (match_operator 4 "cris_mem_op" [(match_dup 0)]))]
4722 "GET_MODE_SIZE (GET_MODE (operands[4])) <= UNITS_PER_WORD
4723 && REGNO (operands[3]) != REGNO (operands[0])
4724 && (cris_base_p (operands[1], true) || cris_base_p (operands[2], true))
4725 && !satisfies_constraint_J (operands[2])
4726 && !satisfies_constraint_N (operands[2])
4727 && (INTVAL (operands[2]) >= -128 && INTVAL (operands[2]) < 128)
4728 && TARGET_SIDE_EFFECT_PREFIXES"
4730 [(set (match_dup 3) (match_dup 5))
4731 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))])]
4732 ;; Checking the previous insn is a bit too awkward for the condition.
4734 rtx_insn *prev = prev_nonnote_insn (curr_insn);
4735 if (prev != NULL_RTX)
4737 rtx set = single_set (prev);
4739 && REG_S_P (SET_DEST (set))
4740 && REGNO (SET_DEST (set)) == REGNO (operands[0])
4741 && REG_S_P (SET_SRC (set)))
4745 = replace_equiv_address (operands[4],
4746 gen_rtx_PLUS (SImode,
4747 operands[1], operands[2]));
4750 ;; Vice versa: move ry,[rx=rx+n]
4752 (define_peephole2 ; movemsideqi (peephole casesi+36)
4753 [(set (match_operand:SI 0 "register_operand" "")
4754 (plus:SI (match_operand:SI 1 "register_operand" "")
4755 (match_operand:SI 2 "const_int_operand" "")))
4756 (set (match_operator 3 "cris_mem_op" [(match_dup 0)])
4757 (match_operand 4 "register_operand" ""))]
4758 "GET_MODE_SIZE (GET_MODE (operands[4])) <= UNITS_PER_WORD
4759 && REGNO (operands[4]) != REGNO (operands[0])
4760 && (cris_base_p (operands[1], true) || cris_base_p (operands[2], true))
4761 && !satisfies_constraint_J (operands[2])
4762 && !satisfies_constraint_N (operands[2])
4763 && (INTVAL (operands[2]) >= -128 && INTVAL (operands[2]) < 128)
4764 && TARGET_SIDE_EFFECT_PREFIXES"
4766 [(set (match_dup 5) (match_dup 4))
4767 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))])]
4769 = replace_equiv_address (operands[3],
4770 gen_rtx_PLUS (SImode,
4771 operands[1], operands[2]));")
4773 ;; As above, change:
4777 ;; op.d [rx=rx+n],ry
4778 ;; Saves when n = [-128..127].
4780 ;; Splitting and joining combinations for side-effect modes are slightly
4781 ;; out of hand. They probably will not save the time they take typing in,
4782 ;; not to mention the bugs that creep in. FIXME: Get rid of as many of
4783 ;; the splits and peepholes as possible.
4784 ;; No stable test-case.
4786 (define_peephole2 ; mover2side (peephole casesi+37)
4787 [(set (match_operand:SI 0 "register_operand" "")
4788 (plus:SI (match_operand:SI 1 "register_operand" "")
4789 (match_operand:SI 2 "const_int_operand" "")))
4790 (set (match_operand 3 "register_operand" "")
4791 (match_operator 4 "cris_orthogonal_operator"
4794 5 "cris_mem_op" [(match_dup 0)])]))]
4795 ;; FIXME: What about DFmode?
4796 ;; Change to GET_MODE_SIZE (GET_MODE (operands[3])) <= UNITS_PER_WORD?
4797 "GET_MODE (operands[3]) != DImode
4798 && REGNO (operands[0]) != REGNO (operands[3])
4799 && !satisfies_constraint_J (operands[2])
4800 && !satisfies_constraint_N (operands[2])
4801 && INTVAL (operands[2]) >= -128
4802 && INTVAL (operands[2]) <= 127
4803 && TARGET_SIDE_EFFECT_PREFIXES"
4805 [(set (match_dup 3) (match_op_dup 4 [(match_dup 3) (match_dup 6)]))
4806 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))])]
4808 = replace_equiv_address (operands[5],
4809 gen_rtx_PLUS (SImode,
4810 operands[1], operands[2]));")
4812 ;; Sometimes, for some reason the pattern
4816 ;; will occur. Solve this, and likewise for to-memory.
4817 ;; No stable test-case.
4819 (define_peephole2 ; moverside (peephole casesi+38)
4820 [(set (match_operand:SI 0 "register_operand" "")
4821 (match_operand:SI 1 "cris_bdap_biap_operand" ""))
4823 (plus:SI (match_operand:SI 2 "cris_bdap_biap_operand" "")
4824 (match_operand:SI 3 "cris_bdap_biap_operand" "")))
4825 (set (match_operand 4 "register_operand" "")
4826 (match_operator 5 "cris_mem_op" [(match_dup 0)]))]
4827 "(rtx_equal_p (operands[2], operands[0])
4828 || rtx_equal_p (operands[3], operands[0]))
4829 && cris_side_effect_mode_ok (PLUS, operands, 0,
4830 (REG_S_P (operands[1])
4832 : (rtx_equal_p (operands[2], operands[0])
4834 (! REG_S_P (operands[1])
4836 : (rtx_equal_p (operands[2], operands[0])
4840 [(set (match_dup 4) (match_dup 6))
4841 (set (match_dup 0) (plus:SI (match_dup 7) (match_dup 8)))])]
4844 = rtx_equal_p (operands[2], operands[0]) ? operands[3] : operands[2];
4846 /* Make sure we have canonical RTX so we match the insn pattern -
4847 not a constant in the first operand. We also require the order
4848 (plus reg mem) to match the final pattern. */
4849 if (CRIS_CONSTANT_P (otherop) || MEM_P (otherop))
4851 operands[7] = operands[1];
4852 operands[8] = otherop;
4856 operands[7] = otherop;
4857 operands[8] = operands[1];
4860 = replace_equiv_address (operands[5],
4861 gen_rtx_PLUS (SImode,
4862 operands[7], operands[8]));
4865 ;; As above but to memory.
4866 ;; FIXME: Split movemside and moverside into variants and prune
4867 ;; the ones that don't trig.
4868 ;; No stable test-case.
4870 (define_peephole2 ; movemside (peephole casesi+39)
4871 [(set (match_operand:SI 0 "register_operand" "")
4872 (match_operand:SI 1 "cris_bdap_biap_operand" ""))
4874 (plus:SI (match_operand:SI 2 "cris_bdap_biap_operand" "")
4875 (match_operand:SI 3 "cris_bdap_biap_operand" "")))
4876 (set (match_operator 4 "cris_mem_op" [(match_dup 0)])
4877 (match_operand 5 "register_operand" ""))]
4878 "(rtx_equal_p (operands[2], operands[0])
4879 || rtx_equal_p (operands[3], operands[0]))
4880 && cris_side_effect_mode_ok (PLUS, operands, 0,
4881 (REG_S_P (operands[1])
4883 : (rtx_equal_p (operands[2], operands[0])
4885 (! REG_S_P (operands[1])
4887 : (rtx_equal_p (operands[2], operands[0])
4891 [(set (match_dup 6) (match_dup 5))
4892 (set (match_dup 0) (plus:SI (match_dup 7) (match_dup 8)))])]
4895 = rtx_equal_p (operands[2], operands[0]) ? operands[3] : operands[2];
4897 /* Make sure we have canonical RTX so we match the insn pattern -
4898 not a constant in the first operand. We also require the order
4899 (plus reg mem) to match the final pattern. */
4900 if (CRIS_CONSTANT_P (otherop) || MEM_P (otherop))
4902 operands[7] = operands[1];
4903 operands[8] = otherop;
4907 operands[7] = otherop;
4908 operands[8] = operands[1];
4911 = replace_equiv_address (operands[4],
4912 gen_rtx_PLUS (SImode,
4913 operands[7], operands[8]));
4916 ;; Another spotted bad code:
4919 ;; No stable test-case.
4921 (define_peephole2 ; movei (peephole casesi+42)
4922 [(set (match_operand:SI 0 "register_operand" "")
4923 (match_operand:SI 1 "register_operand" ""))
4924 (set (match_operand 2 "register_operand" "")
4925 (match_operator 3 "cris_mem_op" [(match_dup 0)]))]
4926 "REGNO (operands[0]) == REGNO (operands[2])
4927 && (REGNO_REG_CLASS (REGNO (operands[0]))
4928 == REGNO_REG_CLASS (REGNO (operands[1])))
4929 && GET_MODE_SIZE (GET_MODE (operands[2])) <= UNITS_PER_WORD"
4930 [(set (match_dup 2) (match_dup 4))]
4931 "operands[4] = replace_equiv_address (operands[3], operands[1]);")
4933 ;; move.d [r10+16],r9
4936 ;; and.d [r10+16],r12,r9
4937 ;; With generalization of the operation, the size and the addressing mode.
4938 ;; This seems to be the result of a quirk in register allocation
4939 ;; missing the three-operand cases when having different predicates.
4940 ;; Maybe that it matters that it is a commutative operation.
4941 ;; This pattern helps that situation, but there's still the increased
4942 ;; register pressure.
4943 ;; Note that adding the noncommutative variant did not show any matches
4944 ;; in ipps and cc1, so it's not here.
4945 ;; No stable test-case.
4947 (define_peephole2 ; op3 (peephole casesi+44)
4948 [(set (match_operand 0 "register_operand" "")
4952 (match_operand:SI 1 "cris_bdap_biap_operand" "")
4953 (match_operand:SI 2 "cris_bdap_biap_operand" ""))]))
4956 5 "cris_commutative_orth_op"
4957 [(match_operand 3 "register_operand" "")
4958 (match_operand 4 "register_operand" "")]))]
4959 "(rtx_equal_p (operands[3], operands[0])
4960 || rtx_equal_p (operands[4], operands[0]))
4961 && ! rtx_equal_p (operands[3], operands[4])
4962 && (REG_S_P (operands[1]) || REG_S_P (operands[2]))
4963 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD"
4964 [(set (match_dup 0) (match_op_dup 5 [(match_dup 7) (match_dup 6)]))]
4966 = rtx_equal_p (operands[3], operands[0]) ? operands[4] : operands[3];")
4968 ;; There seems to be no other way to make GCC (including 4.8/trunk at
4969 ;; r186932) optimally reload an instruction that looks like
4970 ;; and.d reg_or_mem,const_32__65535,other_reg
4971 ;; where other_reg is the destination.
4973 ;; movu.[bw] reg_or_mem,reg_32
4974 ;; and.[bw] trunc_int_for_mode([bw], const_32__65535),reg_32 ;; or andq
4975 ;; but it turns into:
4976 ;; move.d reg_or_mem,reg_32
4977 ;; and.d const_32__65535,reg_32
4978 ;; Fix it with these two peephole2's.
4979 ;; Testcases: gcc.dg/cris-peep2-andu1.c gcc.dg/cris-peep2-andu2.c
4981 (define_peephole2 ; andu (casesi+45)
4982 [(set (match_operand:SI 0 "register_operand" "")
4983 (match_operand:SI 1 "nonimmediate_operand" ""))
4984 (set (match_operand:SI 2 "register_operand" "")
4985 (and:SI (match_dup 0)
4986 (match_operand:SI 3 "const_int_operand" "")))]
4987 ;; Since the size of the memory access could be made different here,
4988 ;; don't do this for a mem-volatile access.
4989 "REGNO (operands[2]) == REGNO (operands[0])
4990 && INTVAL (operands[3]) <= 65535 && INTVAL (operands[3]) >= 0
4991 && !satisfies_constraint_I (operands[3])
4992 && !side_effects_p (operands[1])
4993 && (!REG_P (operands[1])
4994 || REGNO (operands[1]) <= CRIS_LAST_GENERAL_REGISTER)"
4995 ;; FIXME: CC0 valid except for M (i.e. CC_NOT_NEGATIVE).
4996 [(set (match_dup 0) (match_dup 4))
4997 (set (match_dup 5) (match_dup 6))]
4999 machine_mode zmode = INTVAL (operands[3]) <= 255 ? QImode : HImode;
5001 = satisfies_constraint_O (operands[3]) ? SImode : zmode;
5003 = (REG_S_P (operands[1])
5004 ? gen_rtx_REG (zmode, REGNO (operands[1]))
5005 : adjust_address (operands[1], zmode, 0));
5007 = gen_rtx_ZERO_EXTEND (SImode, op1);
5008 operands[5] = gen_rtx_REG (amode, REGNO (operands[0]));
5010 = gen_rtx_AND (amode, gen_rtx_REG (amode, REGNO (operands[0])),
5011 GEN_INT (trunc_int_for_mode (INTVAL (operands[3]),
5013 ? QImode : amode)));
5016 ;; Since r186861, gcc.dg/cris-peep2-andu2.c trigs this pattern, with which
5023 ;; Only do this for values fitting the quick immediate operand.
5024 (define_peephole2 ; andqu (casesi+46)
5025 [(set (match_operand:SI 0 "register_operand")
5026 (match_operand:SI 1 "const_int_operand"))
5028 (and:SI (match_dup 0) (match_operand:SI 2 "nonimmediate_operand")))]
5029 ;; Since the size of the memory access will be made different here,
5030 ;; don't do this for a volatile access or a post-incremented address.
5031 "satisfies_constraint_O (operands[1])
5032 && !side_effects_p (operands[2])
5033 && !reg_overlap_mentioned_p (operands[0], operands[2])"
5034 [(set (match_dup 0) (match_dup 3))
5035 (set (match_dup 0) (and:SI (match_dup 0) (match_dup 4)))]
5037 machine_mode zmode = INTVAL (operands[1]) <= 255 ? QImode : HImode;
5039 = (REG_S_P (operands[2])
5040 ? gen_rtx_REG (zmode, REGNO (operands[2]))
5041 : adjust_address (operands[2], zmode, 0));
5042 operands[3] = gen_rtx_ZERO_EXTEND (SImode, op1);
5043 operands[4] = GEN_INT (trunc_int_for_mode (INTVAL (operands[1]), QImode));
5046 ;; Try and avoid GOTPLT reads escaping a call: transform them into
5047 ;; PLT. Curiously (but thankfully), peepholes for instructions
5048 ;; *without side-effects* that just feed a call (or call_value) are
5049 ;; not matched neither in a build or test-suite, so those patterns are
5052 ;; A "normal" move where we don't check the consumer.
5054 (define_peephole2 ; gotplt-to-plt
5056 (match_operand:SI 0 "register_operand" "")
5060 (reg:SI CRIS_GOT_REGNUM)
5062 (unspec:SI [(match_operand:SI 2 "cris_general_operand_or_symbol" "")]
5063 CRIS_UNSPEC_PLTGOTREAD)))]))]
5065 && cris_valid_pic_const (XEXP (XEXP (operands[1], 0), 1), true)
5066 && REGNO_REG_CLASS (REGNO (operands[0])) == REGNO_REG_CLASS (0)"
5067 [(set (match_dup 0) (const:SI (unspec:SI [(match_dup 2)] CRIS_UNSPEC_PLT_GOTREL)))
5068 (set (match_dup 0) (plus:SI (match_dup 0) (reg:SI CRIS_GOT_REGNUM)))]
5071 ;; And one set with a side-effect getting the PLTGOT offset.
5072 ;; First call and call_value variants.
5074 (define_peephole2 ; gotplt-to-plt-side-call
5077 (match_operand:SI 0 "register_operand" "")
5081 (reg:SI CRIS_GOT_REGNUM)
5083 (unspec:SI [(match_operand:SI
5084 2 "cris_general_operand_or_symbol" "")]
5085 CRIS_UNSPEC_PLTGOTREAD)))]))
5086 (set (match_operand:SI 3 "register_operand" "")
5087 (plus:SI (reg:SI CRIS_GOT_REGNUM)
5089 (unspec:SI [(match_dup 2)] CRIS_UNSPEC_PLTGOTREAD))))])
5090 (parallel [(call (mem:QI (match_dup 0))
5091 (match_operand 4 "" ""))
5092 (clobber (reg:SI CRIS_SRP_REGNUM))])]
5094 && cris_valid_pic_const (XEXP (XEXP (operands[1], 0), 1), true)
5095 && peep2_reg_dead_p (2, operands[0])"
5096 [(parallel [(call (mem:QI (match_dup 1))
5098 (clobber (reg:SI CRIS_SRP_REGNUM))
5100 (plus:SI (reg:SI CRIS_GOT_REGNUM)
5102 (unspec:SI [(match_dup 2)]
5103 CRIS_UNSPEC_PLTGOTREAD))))])]
5106 (define_peephole2 ; gotplt-to-plt-side-call-value
5109 (match_operand:SI 0 "register_operand" "")
5113 (reg:SI CRIS_GOT_REGNUM)
5115 (unspec:SI [(match_operand:SI
5116 2 "cris_general_operand_or_symbol" "")]
5117 CRIS_UNSPEC_PLTGOTREAD)))]))
5118 (set (match_operand:SI 3 "register_operand" "")
5119 (plus:SI (reg:SI CRIS_GOT_REGNUM)
5121 (unspec:SI [(match_dup 2)] CRIS_UNSPEC_PLTGOTREAD))))])
5122 (parallel [(set (match_operand 5 "" "")
5123 (call (mem:QI (match_dup 0))
5124 (match_operand 4 "" "")))
5125 (clobber (reg:SI CRIS_SRP_REGNUM))])]
5127 && cris_valid_pic_const (XEXP (XEXP (operands[1], 0), 1), true)
5128 && peep2_reg_dead_p (2, operands[0])"
5129 [(parallel [(set (match_dup 5)
5130 (call (mem:QI (match_dup 1))
5132 (clobber (reg:SI CRIS_SRP_REGNUM))
5134 (plus:SI (reg:SI CRIS_GOT_REGNUM)
5136 (unspec:SI [(match_dup 2)]
5137 CRIS_UNSPEC_PLTGOTREAD))))])]
5140 (define_peephole2 ; gotplt-to-plt-side
5143 (match_operand:SI 0 "register_operand" "")
5147 (reg:SI CRIS_GOT_REGNUM)
5149 (unspec:SI [(match_operand:SI
5150 2 "cris_general_operand_or_symbol" "")]
5151 CRIS_UNSPEC_PLTGOTREAD)))]))
5152 (set (match_operand:SI 3 "register_operand" "")
5153 (plus:SI (reg:SI CRIS_GOT_REGNUM)
5155 (unspec:SI [(match_dup 2)] CRIS_UNSPEC_PLTGOTREAD))))])]
5157 && cris_valid_pic_const (XEXP (XEXP (operands[1], 0), 1), true)
5158 && REGNO_REG_CLASS (REGNO (operands[0])) == REGNO_REG_CLASS (0)"
5160 (const:SI (unspec:SI [(match_dup 2)] CRIS_UNSPEC_PLTGOTREAD)))
5161 (set (match_dup 3) (plus:SI (match_dup 3) (reg:SI CRIS_GOT_REGNUM)))
5163 (const:SI (unspec:SI [(match_dup 2)] CRIS_UNSPEC_PLT_GOTREL)))
5164 (set (match_dup 0) (plus:SI (match_dup 0) (reg:SI CRIS_GOT_REGNUM)))]
5169 ;; comment-start: ";; "
5170 ;; eval: (set-syntax-table (copy-sequence (syntax-table)))
5171 ;; eval: (modify-syntax-entry ?[ "(]")
5172 ;; eval: (modify-syntax-entry ?] ")[")
5173 ;; eval: (modify-syntax-entry ?{ "(}")
5174 ;; eval: (modify-syntax-entry ?} "){")
5175 ;; eval: (setq indent-tabs-mode t)