1 ;; GCC machine description for CRIS cpu cores.
2 ;; Copyright (C) 1998-2015 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 && (!TARGET_V32 || (!REG_P (operands[1]) && can_create_pseudo_p ())))
503 operands[1] = copy_to_mode_reg (DImode, operands[1]);
505 /* Some other ports (as of 2001-09-10 for example mcore and romp) also
506 prefer to split up constants early, like this. The testcase in
507 gcc.c-torture/execute/961213-1.c shows that CSE2 gets confused by the
508 resulting subreg sets when using the construct from mcore (as of FSF
509 CVS, version -r 1.5), and it believes that the high part (the last one
510 emitted) is the final value. */
511 if ((CONST_INT_P (operands[1]) || GET_CODE (operands[1]) == CONST_DOUBLE)
512 && ! reload_completed
513 && ! reload_in_progress)
516 rtx op0 = operands[0];
517 rtx op1 = operands[1];
520 emit_move_insn (operand_subword (op0, 0, 1, DImode),
521 operand_subword (op1, 0, 1, DImode));
522 emit_move_insn (operand_subword (op0, 1, 1, DImode),
523 operand_subword (op1, 1, 1, DImode));
524 insns = get_insns ();
532 (define_insn_and_split "*movdi_insn_non_v32"
533 [(set (match_operand:DI 0 "nonimmediate_operand" "=r,rx,m")
534 (match_operand:DI 1 "general_operand" "rx,g,rxM"))]
535 "(register_operand (operands[0], DImode)
536 || register_operand (operands[1], DImode)
537 || operands[1] == const0_rtx)
540 "&& reload_completed"
542 "operands[2] = cris_split_movdx (operands);")
544 ;; Overlapping (but non-identical) source memory address and destination
545 ;; register would be a compiler bug, so we don't have to specify that.
546 (define_insn "*movdi_v32"
548 (match_operand:DI 0 "nonimmediate_operand" "=r,rx,&r,>, m,r,x,m")
549 (match_operand:DI 1 "general_operand" "rxi,r>,m, rx,r,m,m,x"))]
552 switch (which_alternative)
554 /* FIXME: 1) Use autoincrement where possible. 2) Have peephole2,
555 particularly for cases where the address register is dead. */
557 if (REGNO (operands[0]) == REGNO (XEXP (operands[1], 0)))
558 return "addq 4,%L1\;move.d %1,%H0\;subq 4,%L1\;move.d %1,%M0";
559 gcc_assert (REGNO (operands[0]) + 1 == REGNO (XEXP (operands[1], 0)));
560 return "move.d [%L1+],%M0\;move.d [%L1],%H0";
562 /* We could do away with the addq if we knew the address-register
563 isn't ACR. If we knew the address-register is dead, we could do
564 away with the subq too. */
565 return "move.d [%L1],%M0\;addq 4,%L1\;move.d [%L1],%H0\;subq 4,%L1";
567 return "move.d %M1,[%L0]\;addq 4,%L0\;move.d %H1,[%L0]\;subq 4,%L0";
569 return "move [%L1],%M0\;addq 4,%L1\;move [%L1],%H0\;subq 4,%L1";
571 return "move %M1,[%L0]\;addq 4,%L0\;move %H1,[%L0]\;subq 4,%L0";
577 ;; The non-split cases clobber cc0 because of their adds and subs.
578 ;; Beware that NOTICE_UPDATE_CC is called before the forced split happens.
579 [(set_attr "cc" "*,*,clobber,*,clobber,clobber,*,*")])
581 ;; Much like "*movdi_insn_non_v32". Overlapping registers and constants
582 ;; is handled so much better in cris_split_movdx.
584 [(set (match_operand:DI 0 "nonimmediate_operand" "")
585 (match_operand:DI 1 "general_operand" ""))]
588 && (!MEM_P (operands[0]) || !REG_P (XEXP (operands[0], 0)))
589 && (!MEM_P (operands[1]) || !REG_P (XEXP (operands[1], 0)))"
591 "operands[2] = cris_split_movdx (operands);")
593 ;; Side-effect patterns for move.S1 [rx=ry+rx.S2],rw
594 ;; and move.S1 [rx=ry+i],rz
595 ;; Then movs.S1 and movu.S1 for both modes.
597 ;; move.S1 [rx=ry+rz.S],rw avoiding when rx is ry, or rw is rx
598 ;; FIXME: These could have anonymous mode for operand 0.
599 ;; FIXME: Special registers' alternatives too.
601 (define_insn "*mov_side<mode>_biap"
602 [(set (match_operand:BW 0 "register_operand" "=r,r")
604 (mult:SI (match_operand:SI 1 "register_operand" "r,r")
605 (match_operand:SI 2 "const_int_operand" "n,n"))
606 (match_operand:SI 3 "register_operand" "r,r"))))
607 (set (match_operand:SI 4 "register_operand" "=*3,r")
608 (plus:SI (mult:SI (match_dup 1)
611 "cris_side_effect_mode_ok (MULT, operands, 4, 3, 1, 2, 0)"
614 move<m> [%4=%3+%1%T2],%0")
616 (define_insn "*mov_sidesisf_biap"
617 [(set (match_operand 0 "register_operand" "=r,r,x,x")
619 (mult:SI (match_operand:SI 1 "register_operand" "r,r,r,r")
620 (match_operand:SI 2 "const_int_operand" "n,n,n,n"))
621 (match_operand:SI 3 "register_operand" "r,r,r,r"))))
622 (set (match_operand:SI 4 "register_operand" "=*3,r,*3,r")
623 (plus:SI (mult:SI (match_dup 1)
626 "GET_MODE_SIZE (GET_MODE (operands[0])) == UNITS_PER_WORD
627 && cris_side_effect_mode_ok (MULT, operands, 4, 3, 1, 2, 0)"
630 move.%s0 [%4=%3+%1%T2],%0
632 move [%4=%3+%1%T2],%0")
634 ;; move.S1 [rx=ry+i],rz
635 ;; avoiding move.S1 [ry=ry+i],rz
636 ;; and move.S1 [rz=ry+i],rz
637 ;; Note that "i" is allowed to be a register.
639 (define_insn "*mov_side<mode>"
640 [(set (match_operand:BW 0 "register_operand" "=r,r,r,r,r")
642 (plus:SI (match_operand:SI 1 "cris_bdap_operand" "%r,r,r,R,R")
643 (match_operand:SI 2 "cris_bdap_operand" "r>Rn,r,>Rn,r,r"))))
644 (set (match_operand:SI 3 "register_operand" "=*1,r,r,*2,r")
645 (plus:SI (match_dup 1)
647 "cris_side_effect_mode_ok (PLUS, operands, 3, 1, 2, -1, 0)"
649 if ((which_alternative == 0 || which_alternative == 3)
650 && (!CONST_INT_P (operands[2])
651 || INTVAL (operands[2]) > 127
652 || INTVAL (operands[2]) < -128
653 || satisfies_constraint_N (operands[2])
654 || satisfies_constraint_J (operands[2])))
656 if (which_alternative == 4)
657 return "move<m> [%3=%2%S1],%0";
658 return "move<m> [%3=%1%S2],%0";
661 (define_insn "*mov_sidesisf"
662 [(set (match_operand 0 "register_operand" "=r,r,r,x,x,x,r,r,x,x")
665 (match_operand:SI 1 "cris_bdap_operand" "%r,r,r,r,r,r,R,R,R,R")
666 (match_operand:SI 2 "cris_bdap_operand" "r>Rn,r,>Rn,r>Rn,r,>Rn,r,r,r,r"))))
667 (set (match_operand:SI 3 "register_operand" "=*1,r,r,*1,r,r,*2,r,*2,r")
668 (plus:SI (match_dup 1)
670 "GET_MODE_SIZE (GET_MODE (operands[0])) == UNITS_PER_WORD
671 && cris_side_effect_mode_ok (PLUS, operands, 3, 1, 2, -1, 0)"
673 if ((which_alternative == 0
674 || which_alternative == 3
675 || which_alternative == 6
676 || which_alternative == 8)
677 && (!CONST_INT_P (operands[2])
678 || INTVAL (operands[2]) > 127
679 || INTVAL (operands[2]) < -128
680 || satisfies_constraint_N (operands[2])
681 || satisfies_constraint_J (operands[2])))
683 if (which_alternative < 3)
684 return "move.%s0 [%3=%1%S2],%0";
685 if (which_alternative == 7)
686 return "move.%s0 [%3=%2%S1],%0";
687 if (which_alternative == 9)
688 return "move [%3=%2%S1],%0";
689 return "move [%3=%1%S2],%0";
692 ;; Other way around; move to memory.
694 ;; Note that the condition (which for side-effect patterns is usually a
695 ;; call to cris_side_effect_mode_ok), isn't consulted for register
696 ;; allocation preferences -- constraints is the method for that. The
697 ;; drawback is that we can't exclude register allocation to cause
698 ;; "move.s rw,[rx=ry+rz.S]" when rw==rx without also excluding rx==ry or
699 ;; rx==rz if we use an earlyclobber modifier for the constraint for rx.
700 ;; Instead of that, we recognize and split the cases where dangerous
701 ;; register combinations are spotted: where a register is set in the
702 ;; side-effect, and used in the main insn. We don't handle the case where
703 ;; the set in the main insn overlaps the set in the side-effect; that case
704 ;; must be handled in gcc. We handle just the case where the set in the
705 ;; side-effect overlaps the input operand of the main insn (i.e. just
709 ;; move.s rz,[ry=rx+rw.S]
711 (define_insn "*mov_side<mode>_biap_mem"
712 [(set (mem:BW (plus:SI
713 (mult:SI (match_operand:SI 0 "register_operand" "r,r,r")
714 (match_operand:SI 1 "const_int_operand" "n,n,n"))
715 (match_operand:SI 2 "register_operand" "r,r,r")))
716 (match_operand:BW 3 "register_operand" "r,r,r"))
717 (set (match_operand:SI 4 "register_operand" "=*2,!3,r")
718 (plus:SI (mult:SI (match_dup 0)
721 "cris_side_effect_mode_ok (MULT, operands, 4, 2, 0, 1, 3)"
725 move<m> %3,[%4=%2+%0%T1]")
727 (define_insn "*mov_sidesisf_biap_mem"
729 (mult:SI (match_operand:SI 0 "register_operand" "r,r,r,r,r,r")
730 (match_operand:SI 1 "const_int_operand" "n,n,n,n,n,n"))
731 (match_operand:SI 2 "register_operand" "r,r,r,r,r,r")))
732 (match_operand 3 "register_operand" "r,r,r,x,x,x"))
733 (set (match_operand:SI 4 "register_operand" "=*2,!3,r,*2,!3,r")
734 (plus:SI (mult:SI (match_dup 0)
737 "GET_MODE_SIZE (GET_MODE (operands[3])) == UNITS_PER_WORD
738 && cris_side_effect_mode_ok (MULT, operands, 4, 2, 0, 1, 3)"
742 move.%s3 %3,[%4=%2+%0%T1]
745 move %3,[%4=%2+%0%T1]")
747 ;; Split for the case above where we're out of luck with register
748 ;; allocation (again, the condition isn't checked for that), and we end up
749 ;; with the set in the side-effect getting the same register as the input
754 [(set (match_operator
757 (mult:SI (match_operand:SI 0 "register_operand" "")
758 (match_operand:SI 1 "const_int_operand" ""))
759 (match_operand:SI 2 "register_operand" ""))])
760 (match_operand 3 "register_operand" ""))
761 (set (match_operand:SI 4 "cris_nonsp_register_operand" "")
762 (plus:SI (mult:SI (match_dup 0)
765 "reload_completed && reg_overlap_mentioned_p (operands[4], operands[3])"
766 [(set (match_dup 5) (match_dup 3))
767 (set (match_dup 4) (match_dup 2))
769 (plus:SI (mult:SI (match_dup 0)
773 = replace_equiv_address (operands[6],
774 gen_rtx_PLUS (SImode,
775 gen_rtx_MULT (SImode,
780 ;; move.s rx,[ry=rz+i]
781 ;; FIXME: These could have anonymous mode for operand 2.
785 (define_insn "*mov_side<mode>_mem"
787 (plus:SI (match_operand:SI 0 "cris_bdap_operand" "%r,r,r,r,R,R,R")
788 (match_operand:SI 1 "cris_bdap_operand" "r>Rn,r>Rn,r,>Rn,r,r,r")))
789 (match_operand:BW 2 "register_operand" "r,r,r,r,r,r,r"))
790 (set (match_operand:SI 3 "register_operand" "=*0,!*2,r,r,*1,!*2,r")
791 (plus:SI (match_dup 0)
793 "cris_side_effect_mode_ok (PLUS, operands, 3, 0, 1, -1, 2)"
795 if ((which_alternative == 0 || which_alternative == 4)
796 && (!CONST_INT_P (operands[1])
797 || INTVAL (operands[1]) > 127
798 || INTVAL (operands[1]) < -128
799 || satisfies_constraint_N (operands[1])
800 || satisfies_constraint_J (operands[1])))
802 if (which_alternative == 1 || which_alternative == 5)
804 if (which_alternative == 6)
805 return "move.%s2 %2,[%3=%1%S0]";
806 return "move<m> %2,[%3=%0%S1]";
811 (define_insn "*mov_sidesisf_mem"
815 0 "cris_bdap_operand"
816 "%r, r, r,r, r, r,r, R,R, R,R, R")
818 1 "cris_bdap_operand"
819 "r>Rn,r>Rn,r,>Rn,r>Rn,r,>Rn,r,r, r,r, r")))
820 (match_operand 2 "register_operand"
821 "r, r, r,r, x, x,x, r,r, r,x, x"))
822 (set (match_operand:SI 3 "register_operand"
823 "=*0,!2, r,r, *0, r,r, *1,!*2,r,*1,r")
824 (plus:SI (match_dup 0)
826 "GET_MODE_SIZE (GET_MODE (operands[2])) == UNITS_PER_WORD
827 && cris_side_effect_mode_ok (PLUS, operands, 3, 0, 1, -1, 2)"
829 if ((which_alternative == 0 || which_alternative == 4)
830 && (!CONST_INT_P (operands[1])
831 || INTVAL (operands[1]) > 127
832 || INTVAL (operands[1]) < -128
833 || satisfies_constraint_N (operands[1])
834 || satisfies_constraint_J (operands[1])))
836 if (which_alternative == 1
837 || which_alternative == 7
838 || which_alternative == 8
839 || which_alternative == 10)
841 if (which_alternative < 4)
842 return "move.%s2 %2,[%3=%0%S1]";
843 if (which_alternative == 9)
844 return "move.%s2 %2,[%3=%1%S0]";
845 if (which_alternative == 11)
846 return "move %2,[%3=%1%S0]";
847 return "move %2,[%3=%0%S1]";
850 ;; Like the biap case, a split where the set in the side-effect gets the
851 ;; same register as the input register to the main insn, since the
852 ;; condition isn't checked at register allocation.
856 [(set (match_operator
859 (match_operand:SI 0 "cris_bdap_operand" "")
860 (match_operand:SI 1 "cris_bdap_operand" ""))])
861 (match_operand 2 "register_operand" ""))
862 (set (match_operand:SI 3 "cris_nonsp_register_operand" "")
863 (plus:SI (match_dup 0) (match_dup 1)))])]
864 "reload_completed && reg_overlap_mentioned_p (operands[3], operands[2])"
865 [(set (match_dup 4) (match_dup 2))
866 (set (match_dup 3) (match_dup 0))
867 (set (match_dup 3) (plus:SI (match_dup 3) (match_dup 1)))]
870 ;; Clear memory side-effect patterns. It is hard to get to the mode if
871 ;; the MEM was anonymous, so there will be one for each mode.
873 ;; clear.[bwd] [ry=rx+rw.s2]
875 (define_insn "*clear_side<mode>_biap"
876 [(set (mem:BWD (plus:SI
877 (mult:SI (match_operand:SI 0 "register_operand" "r,r")
878 (match_operand:SI 1 "const_int_operand" "n,n"))
879 (match_operand:SI 2 "register_operand" "r,r")))
881 (set (match_operand:SI 3 "register_operand" "=*2,r")
882 (plus:SI (mult:SI (match_dup 0)
885 "cris_side_effect_mode_ok (MULT, operands, 3, 2, 0, 1, -1)"
888 clear<m> [%3=%2+%0%T1]")
890 ;; clear.[bwd] [ry=rz+i]
892 (define_insn "*clear_side<mode>"
894 (plus:SI (match_operand:SI 0 "cris_bdap_operand" "%r,r,r,R,R")
895 (match_operand:SI 1 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")))
897 (set (match_operand:SI 2 "register_operand" "=*0,r,r,*1,r")
898 (plus:SI (match_dup 0)
900 "cris_side_effect_mode_ok (PLUS, operands, 2, 0, 1, -1, -1)"
902 if ((which_alternative == 0 || which_alternative == 3)
903 && (!CONST_INT_P (operands[1])
904 || INTVAL (operands[1]) > 127
905 || INTVAL (operands[1]) < -128
906 || satisfies_constraint_N (operands[1])
907 || satisfies_constraint_J (operands[1])))
909 if (which_alternative == 4)
910 return "clear<m> [%2=%1%S0]";
911 return "clear<m> [%2=%0%S1]";
914 ;; Normal move patterns from SI on.
916 (define_expand "movsi"
918 (match_operand:SI 0 "nonimmediate_operand" "")
919 (match_operand:SI 1 "cris_general_operand_or_symbol" ""))]
922 enum cris_symbol_type t;
924 /* If the output goes to a MEM, make sure we have zero or a register as
926 if (MEM_P (operands[0])
927 && ! REG_S_P (operands[1])
928 && operands[1] != const0_rtx
929 && can_create_pseudo_p ())
930 operands[1] = force_reg (SImode, operands[1]);
932 /* If we're generating PIC and have an incoming symbol, validize it to a
933 general operand or something that will match a special pattern.
935 FIXME: Do we *have* to recognize anything that would normally be a
936 valid symbol? Can we exclude global PIC addresses with an added
939 && CONSTANT_P (operands[1])
940 && !cris_valid_pic_const (operands[1], false))
942 t = cris_symbol_type_of (operands[1]);
944 gcc_assert (t != cris_no_symbol && t != cris_offsettable_symbol);
946 if (! REG_S_P (operands[0]))
948 /* We must have a register as destination for what we're about to
949 do, and for the patterns we generate. */
950 CRIS_ASSERT (can_create_pseudo_p ());
951 operands[1] = force_reg (SImode, operands[1]);
955 /* FIXME: add a REG_EQUAL (or is it REG_EQUIV) note to the
956 destination register for the symbol. It might not be
957 worth it. Measure. */
958 crtl->uses_pic_offset_table = 1;
959 if (t == cris_rel_symbol)
961 /* Change a "move.d sym(+offs),rN" into (allocate register rM)
963 "move.d (const (plus (unspec [sym]
964 CRIS_UNSPEC_GOTREL) offs)),rM" "add.d rPIC,rM,rN"
966 "move.d (const (plus (unspec [sym]
967 CRIS_UNSPEC_PCREL) offs)),rN". */
968 rtx tem, rm, rn = operands[0];
969 rtx sym = GET_CODE (operands[1]) != CONST
970 ? operands[1] : get_related_value (operands[1]);
971 HOST_WIDE_INT offs = get_integer_term (operands[1]);
973 gcc_assert (can_create_pseudo_p ());
977 tem = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym),
980 tem = plus_constant (Pmode, tem, offs);
982 emit_move_insn (rm, gen_rtx_CONST (Pmode, tem));
986 /* We still uses GOT-relative addressing for
988 crtl->uses_pic_offset_table = 1;
989 tem = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym),
992 tem = plus_constant (Pmode, tem, offs);
993 rm = gen_reg_rtx (Pmode);
994 emit_move_insn (rm, gen_rtx_CONST (Pmode, tem));
995 if (expand_binop (Pmode, add_optab, rm, pic_offset_table_rtx,
996 rn, 0, OPTAB_LIB_WIDEN) != rn)
997 internal_error ("expand_binop failed in movsi gotrel");
1001 else if (t == cris_got_symbol)
1003 /* Change a "move.d sym,rN" into (allocate register rM, rO)
1004 "move.d (const (unspec [sym] CRIS_UNSPEC_GOTREAD)),rM"
1005 "add.d rPIC,rM,rO", "move.d [rO],rN" with
1006 the memory access marked as read-only. */
1007 rtx tem, mem, rm, ro, rn = operands[0];
1008 gcc_assert (can_create_pseudo_p ());
1009 tem = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]),
1010 CRIS_UNSPEC_GOTREAD);
1011 rm = gen_reg_rtx (Pmode);
1012 emit_move_insn (rm, gen_rtx_CONST (Pmode, tem));
1013 ro = gen_reg_rtx (Pmode);
1014 if (expand_binop (Pmode, add_optab, rm, pic_offset_table_rtx,
1015 ro, 0, OPTAB_LIB_WIDEN) != ro)
1016 internal_error ("expand_binop failed in movsi got");
1017 mem = gen_rtx_MEM (Pmode, ro);
1019 /* This MEM doesn't alias anything. Whether it
1020 aliases other same symbols is unimportant. */
1021 set_mem_alias_set (mem, new_alias_set ());
1022 MEM_NOTRAP_P (mem) = 1;
1024 /* We can set the GOT memory read of a non-called symbol
1025 to readonly, but not that of a call symbol, as those
1026 are subject to lazy evaluation and usually have the value
1027 changed from the first call to the second (but
1028 constant thereafter). */
1029 MEM_READONLY_P (mem) = 1;
1030 emit_move_insn (rn, mem);
1035 /* We get here when we have to change something that would
1036 be recognizable if it wasn't PIC. A ``sym'' is ok for
1037 PIC symbols both with and without a GOT entry. And ``sym
1038 + offset'' is ok for local symbols, so the only thing it
1039 could be, is a global symbol with an offset. Check and
1041 rtx reg = gen_reg_rtx (Pmode);
1042 rtx sym = get_related_value (operands[1]);
1043 HOST_WIDE_INT offs = get_integer_term (operands[1]);
1045 gcc_assert (can_create_pseudo_p ()
1046 && t == cris_got_symbol_needing_fixup
1047 && sym != NULL_RTX && offs != 0);
1049 emit_move_insn (reg, sym);
1050 if (expand_binop (SImode, add_optab, reg,
1051 GEN_INT (offs), operands[0], 0,
1052 OPTAB_LIB_WIDEN) != operands[0])
1053 internal_error ("expand_binop failed in movsi got+offs");
1060 (define_insn "*movsi_got_load"
1061 [(set (reg:SI CRIS_GOT_REGNUM) (unspec:SI [(const_int 0)] CRIS_UNSPEC_GOT))]
1065 ? "lapc _GLOBAL_OFFSET_TABLE_,%:"
1066 : "move.d $pc,%:\;sub.d .:GOTOFF,%:";
1068 [(set_attr "cc" "clobber")])
1070 (define_insn "*movsi_internal"
1072 (match_operand:SI 0 "nonimmediate_operand"
1073 "=r,r, r,Q>,r,Q>,g,r,r, r,g,rQ>,x, m,x")
1074 (match_operand:SI 1 "cris_general_operand_or_pic_source"
1075 "r,Q>,M,M, I,r, M,n,!S,g,r,x, rQ>,x,gi"))]
1076 ;; Note that we prefer not to use the S alternative (if for some reason
1077 ;; it competes with others) above, but g matches S.
1080 /* Better to have c-switch here; it is worth it to optimize the size of
1081 move insns. The alternative would be to try to find more constraint
1082 letters. FIXME: Check again. It seems this could shrink a bit. */
1083 switch (which_alternative)
1089 && (GET_CODE (operands[1]) == SYMBOL_REF
1090 || GET_CODE (operands[1]) == LABEL_REF
1091 || (GET_CODE (operands[1]) == CONST
1092 && (GET_CODE (XEXP (operands[1], 0)) != UNSPEC
1093 || (XINT (XEXP (operands[1], 0), 1)
1094 == CRIS_UNSPEC_PLT_PCREL)
1095 || (XINT (XEXP (operands[1], 0), 1)
1096 == CRIS_UNSPEC_PCREL)))))
1098 /* FIXME: Express this through (set_attr cc none) instead,
1099 since we can't express the ``none'' at this point. FIXME:
1100 Use lapc for everything except const_int and when next cc0
1101 user would want the flag setting. */
1103 return "lapc %1,%0";
1106 && GET_CODE (operands[1]) == CONST
1107 && GET_CODE (XEXP (operands[1], 0)) == UNSPEC
1108 && XINT (XEXP (operands[1], 0), 1) == CRIS_UNSPEC_GOTREAD)
1109 return "movu.w %1,%0";
1116 return "move.d %1,%0";
1122 return "move %d1,%0";
1127 return "clear.d %0";
1129 /* Constants -32..31 except 0. */
1131 return "moveq %1,%0";
1133 /* We can win a little on constants -32768..-33, 32..65535. */
1135 if (INTVAL (operands[1]) > 0 && INTVAL (operands[1]) < 65536)
1137 if (INTVAL (operands[1]) < 256)
1138 return "movu.b %1,%0";
1139 return "movu.w %1,%0";
1141 else if (INTVAL (operands[1]) >= -32768 && INTVAL (operands[1]) < 32768)
1143 if (INTVAL (operands[1]) >= -128 && INTVAL (operands[1]) < 128)
1144 return "movs.b %1,%0";
1145 return "movs.w %1,%0";
1147 return "move.d %1,%0";
1151 rtx tem = operands[1];
1152 gcc_assert (GET_CODE (tem) == CONST);
1153 tem = XEXP (tem, 0);
1154 if (GET_CODE (tem) == PLUS
1155 && GET_CODE (XEXP (tem, 0)) == UNSPEC
1156 && (XINT (XEXP (tem, 0), 1) == CRIS_UNSPEC_GOTREL
1157 || XINT (XEXP (tem, 0), 1) == CRIS_UNSPEC_PCREL)
1158 && CONST_INT_P (XEXP (tem, 1)))
1159 tem = XEXP (tem, 0);
1160 gcc_assert (GET_CODE (tem) == UNSPEC);
1161 switch (XINT (tem, 1))
1163 case CRIS_UNSPEC_GOTREAD:
1164 case CRIS_UNSPEC_PLTGOTREAD:
1165 /* Using sign-extend mostly to be consistent with the
1166 indexed addressing mode. */
1168 return "movs.w %1,%0";
1169 return "move.d %1,%0";
1171 case CRIS_UNSPEC_GOTREL:
1172 case CRIS_UNSPEC_PLT_GOTREL:
1173 gcc_assert (!TARGET_V32);
1174 return "move.d %1,%0";
1176 case CRIS_UNSPEC_PCREL:
1177 case CRIS_UNSPEC_PLT_PCREL:
1178 gcc_assert (TARGET_V32);
1179 /* LAPC doesn't set condition codes; clear them to make the
1180 (equivalence-marked) result of this insn not presumed
1181 present. This instruction can be a PIC symbol load (for
1182 a hidden symbol) which for weak symbols will be followed
1183 by a test for NULL. */
1185 return "lapc %1,%0";
1192 return "BOGUS: %1 to %0";
1195 [(set_attr "slottable" "yes,yes,yes,yes,yes,yes,no,no,no,no,no,yes,yes,no,no")
1196 (set_attr "cc" "*,*,*,*,*,*,*,*,*,*,*,none,none,none,none")])
1198 ;; Extend operations with side-effect from mem to register, using
1199 ;; MOVS/MOVU. These are from mem to register only.
1205 ;; FIXME: Can we omit extend to HImode, since GCC should truncate for
1206 ;; HImode by itself? Perhaps use only anonymous modes?
1208 (define_insn "*ext_sideqihi_biap"
1209 [(set (match_operand:HI 0 "register_operand" "=r,r")
1211 5 "cris_extend_operator"
1213 (mult:SI (match_operand:SI 1 "register_operand" "r,r")
1214 (match_operand:SI 2 "const_int_operand" "n,n"))
1215 (match_operand:SI 3 "register_operand" "r,r")))]))
1216 (set (match_operand:SI 4 "register_operand" "=*3,r")
1217 (plus:SI (mult:SI (match_dup 1)
1220 "cris_side_effect_mode_ok (MULT, operands, 4, 3, 1, 2, 0)"
1223 mov%e5.%m5 [%4=%3+%1%T2],%0")
1225 (define_insn "*ext_side<mode>si_biap"
1226 [(set (match_operand:SI 0 "register_operand" "=r,r")
1228 5 "cris_extend_operator"
1230 (mult:SI (match_operand:SI 1 "register_operand" "r,r")
1231 (match_operand:SI 2 "const_int_operand" "n,n"))
1232 (match_operand:SI 3 "register_operand" "r,r")))]))
1233 (set (match_operand:SI 4 "register_operand" "=*3,r")
1234 (plus:SI (mult:SI (match_dup 1)
1237 "cris_side_effect_mode_ok (MULT, operands, 4, 3, 1, 2, 0)"
1240 mov%e5<m> [%4=%3+%1%T2],%0")
1242 ;; Same but [rx=ry+i]
1246 (define_insn "*ext_sideqihi"
1247 [(set (match_operand:HI 0 "register_operand" "=r,r,r,r,r")
1249 4 "cris_extend_operator"
1251 (match_operand:SI 1 "cris_bdap_operand" "%r,r,r,R,R")
1252 (match_operand:SI 2 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")))]))
1253 (set (match_operand:SI 3 "register_operand" "=*1,r,r,*2,r")
1254 (plus:SI (match_dup 1)
1256 "cris_side_effect_mode_ok (PLUS, operands, 3, 1, 2, -1, 0)"
1258 if ((which_alternative == 0 || which_alternative == 3)
1259 && (!CONST_INT_P (operands[2])
1260 || INTVAL (operands[2]) > 127
1261 || INTVAL (operands[2]) < -128
1262 || satisfies_constraint_N (operands[2])
1263 || satisfies_constraint_J (operands[2])))
1265 if (which_alternative == 4)
1266 return "mov%e4.%m4 [%3=%2%S1],%0";
1267 return "mov%e4.%m4 [%3=%1%S2],%0";
1270 (define_insn "*ext_side<mode>si"
1271 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r")
1273 4 "cris_extend_operator"
1275 (match_operand:SI 1 "cris_bdap_operand" "%r,r,r,R,R")
1276 (match_operand:SI 2 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")))]))
1277 (set (match_operand:SI 3 "register_operand" "=*1,r,r,*2,r")
1278 (plus:SI (match_dup 1)
1280 "cris_side_effect_mode_ok (PLUS, operands, 3, 1, 2, -1, 0)"
1282 if ((which_alternative == 0 || which_alternative == 3)
1283 && (!CONST_INT_P (operands[2])
1284 || INTVAL (operands[2]) > 127
1285 || INTVAL (operands[2]) < -128
1286 || satisfies_constraint_N (operands[2])
1287 || satisfies_constraint_J (operands[2])))
1289 if (which_alternative == 4)
1290 return "mov%e4<m> [%3=%2%S1],%0";
1291 return "mov%e4<m> [%3=%1%S2],%0";
1294 ;; FIXME: See movsi.
1296 (define_insn "movhi"
1298 (match_operand:HI 0 "nonimmediate_operand" "=r,r, r,Q>,r,Q>,r,r,r,g,g,r,r,x")
1299 (match_operand:HI 1 "general_operand" "r,Q>,M,M, I,r, L,O,n,M,r,g,x,r"))]
1302 switch (which_alternative)
1309 return "move.w %1,%0";
1312 return "move %1,%0";
1316 return "clear.w %0";
1318 return "moveq %1,%0";
1321 if (INTVAL (operands[1]) < 256 && INTVAL (operands[1]) >= -128)
1323 if (INTVAL (operands[1]) > 0)
1324 return "movu.b %1,%0";
1325 return "movs.b %1,%0";
1327 return "move.w %1,%0";
1329 return "movEq %b1,%0";
1331 return "BOGUS: %1 to %0";
1334 [(set_attr "slottable" "yes,yes,yes,yes,yes,yes,no,yes,no,no,no,no,yes,yes")
1335 (set_attr "cc" "*,*,none,none,*,none,*,clobber,*,none,none,*,none,none")])
1337 (define_insn "movstricthi"
1340 (match_operand:HI 0 "nonimmediate_operand" "+r,r, r,Q>,Q>,g,r,g"))
1341 (match_operand:HI 1 "general_operand" "r,Q>,M,M, r, M,g,r"))]
1352 [(set_attr "slottable" "yes,yes,yes,yes,yes,no,no,no")])
1354 (define_expand "reload_in<mode>"
1355 [(set (match_operand:BW 2 "register_operand" "=r")
1356 (match_operand:BW 1 "memory_operand" "m"))
1357 (set (match_operand:BW 0 "register_operand" "=x")
1362 (define_expand "reload_out<mode>"
1363 [(set (match_operand:BW 2 "register_operand" "=&r")
1364 (match_operand:BW 1 "register_operand" "x"))
1365 (set (match_operand:BW 0 "memory_operand" "=m")
1370 (define_insn "movqi"
1371 [(set (match_operand:QI 0 "nonimmediate_operand" "=r,Q>,r, r,Q>,r,g,g,r,r,r,x")
1372 (match_operand:QI 1 "general_operand" "r,r, Q>,M,M, I,M,r,O,g,x,r"))]
1387 [(set_attr "slottable" "yes,yes,yes,yes,yes,yes,no,no,yes,no,yes,yes")
1388 (set_attr "cc" "*,*,*,*,*,*,*,*,clobber,*,none,none")])
1390 (define_insn "movstrictqi"
1391 [(set (strict_low_part
1392 (match_operand:QI 0 "nonimmediate_operand" "+r,Q>,r, r,Q>,g,g,r"))
1393 (match_operand:QI 1 "general_operand" "r,r, Q>,M,M, M,r,g"))]
1404 [(set_attr "slottable" "yes,yes,yes,yes,yes,no,no,no")])
1406 ;; The valid "quick" bit-patterns are, except for 0.0, denormalized
1407 ;; values REALLY close to 0, and some NaN:s (I think; their exponent is
1408 ;; all ones); the worthwhile one is "0.0".
1409 ;; It will use clear, so we know ALL types of immediate 0 never change cc.
1411 (define_insn "movsf"
1412 [(set (match_operand:SF 0 "nonimmediate_operand" "=r,Q>,r, r,Q>,g,g,r,r,x,Q>,m,x, x")
1413 (match_operand:SF 1 "general_operand" "r,r, Q>,G,G, G,r,g,x,r,x, x,Q>,g"))]
1430 [(set_attr "slottable" "yes,yes,yes,yes,yes,no,no,no,yes,yes,yes,no,yes,no")])
1432 ;; Movem patterns. Primarily for use in function prologue and epilogue.
1433 ;; The V32 variants have an ordering matching the expectations of the
1434 ;; standard names "load_multiple" and "store_multiple"; pre-v32 movem
1435 ;; store R0 in the highest memory location.
1437 (define_expand "load_multiple"
1438 [(match_operand:SI 0 "register_operand" "")
1439 (match_operand:SI 1 "memory_operand" "")
1440 (match_operand:SI 2 "const_int_operand" "")]
1445 /* Apparently the predicate isn't checked, so we need to do so
1446 manually. Once happened for libstdc++-v3 locale_facets.tcc. */
1447 if (!MEM_P (operands[1]))
1450 indreg = XEXP (operands[1], 0);
1452 if (GET_CODE (indreg) == POST_INC)
1453 indreg = XEXP (indreg, 0);
1455 || GET_CODE (operands[2]) != CONST_INT
1456 || !REG_P (operands[0])
1457 || REGNO (operands[0]) != 0
1458 || INTVAL (operands[2]) > CRIS_SP_REGNUM
1459 || (int) REGNO (indreg) < INTVAL (operands[2]))
1462 emit_insn (cris_gen_movem_load (operands[1], operands[2], 0));
1466 (define_expand "store_multiple"
1467 [(match_operand:SI 0 "memory_operand" "")
1468 (match_operand:SI 1 "register_operand" "")
1469 (match_operand:SI 2 "const_int_operand" "")]
1474 /* See load_multiple. */
1475 if (!MEM_P (operands[0]))
1478 indreg = XEXP (operands[0], 0);
1480 if (GET_CODE (indreg) == POST_INC)
1481 indreg = XEXP (indreg, 0);
1483 || GET_CODE (operands[2]) != CONST_INT
1484 || !REG_P (operands[1])
1485 || REGNO (operands[1]) != 0
1486 || INTVAL (operands[2]) > CRIS_SP_REGNUM
1487 || (int) REGNO (indreg) < INTVAL (operands[2]))
1490 cris_emit_movem_store (operands[0], operands[2], 0, false);
1494 (define_insn "*cris_load_multiple"
1495 [(match_parallel 0 "cris_load_multiple_op"
1496 [(set (match_operand:SI 1 "register_operand" "=r,r")
1497 (match_operand:SI 2 "memory_operand" "Q,m"))])]
1500 [(set_attr "cc" "none")
1501 (set_attr "slottable" "yes,no")
1502 ;; Not true, but setting the length to 0 causes return sequences (ret
1503 ;; movem) to have the cost they had when (return) included the movem
1504 ;; and reduces the performance penalty taken for needing to emit an
1505 ;; epilogue (in turn copied by bb-reorder) instead of return patterns.
1506 ;; FIXME: temporary change until all insn lengths are correctly
1507 ;; described. FIXME: have better target control over bb-reorder.
1508 (set_attr "length" "0")])
1510 (define_insn "*cris_store_multiple"
1511 [(match_parallel 0 "cris_store_multiple_op"
1512 [(set (match_operand:SI 2 "memory_operand" "=Q,m")
1513 (match_operand:SI 1 "register_operand" "r,r"))])]
1516 [(set_attr "cc" "none")
1517 (set_attr "slottable" "yes,no")])
1520 ;; Sign- and zero-extend insns with standard names.
1521 ;; Those for integer source operand are ordered with the widest source
1526 (define_insn "extendsidi2"
1527 [(set (match_operand:DI 0 "register_operand" "=r")
1528 (sign_extend:DI (match_operand:SI 1 "general_operand" "g")))]
1530 "move.d %1,%M0\;smi %H0\;neg.d %H0,%H0")
1532 (define_insn "extend<mode>di2"
1533 [(set (match_operand:DI 0 "register_operand" "=r")
1534 (sign_extend:DI (match_operand:BW 1 "general_operand" "g")))]
1536 "movs<m> %1,%M0\;smi %H0\;neg.d %H0,%H0")
1538 (define_insn "extend<mode>si2"
1539 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
1540 (sign_extend:SI (match_operand:BW 1 "general_operand" "r,Q>,g")))]
1543 [(set_attr "slottable" "yes,yes,no")])
1545 ;; To do a byte->word extension, extend to dword, except that the top half
1546 ;; of the register will be clobbered. FIXME: Perhaps this is not needed.
1548 (define_insn "extendqihi2"
1549 [(set (match_operand:HI 0 "register_operand" "=r,r,r")
1550 (sign_extend:HI (match_operand:QI 1 "general_operand" "r,Q>,g")))]
1553 [(set_attr "slottable" "yes,yes,no")])
1556 ;; Zero-extend. The DImode ones are synthesized by gcc, so we don't
1557 ;; specify them here.
1559 (define_insn "zero_extend<mode>si2"
1560 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
1562 (match_operand:BW 1 "nonimmediate_operand" "r,Q>,m")))]
1565 [(set_attr "slottable" "yes,yes,no")])
1567 ;; Same comment as sign-extend QImode to HImode above applies.
1569 (define_insn "zero_extendqihi2"
1570 [(set (match_operand:HI 0 "register_operand" "=r,r,r")
1572 (match_operand:QI 1 "nonimmediate_operand" "r,Q>,m")))]
1575 [(set_attr "slottable" "yes,yes,no")])
1577 ;; All kinds of arithmetic and logical instructions.
1579 ;; First, anonymous patterns to match addressing modes with
1582 ;; op.S [rx=ry+I],rz; (add, sub, or, and, bound).
1586 (define_insn "*op_side<mode>_biap"
1587 [(set (match_operand:BWD 0 "register_operand" "=r,r")
1589 6 "cris_orthogonal_operator"
1590 [(match_operand:BWD 1 "register_operand" "0,0")
1592 (mult:SI (match_operand:SI 2 "register_operand" "r,r")
1593 (match_operand:SI 3 "const_int_operand" "n,n"))
1594 (match_operand:SI 4 "register_operand" "r,r")))]))
1595 (set (match_operand:SI 5 "register_operand" "=*4,r")
1596 (plus:SI (mult:SI (match_dup 2)
1599 "cris_side_effect_mode_ok (MULT, operands, 5, 4, 2, 3, 0)"
1602 %x6<m> [%5=%4+%2%T3],%0")
1604 ;; [rx=ry+i] ([%4=%2+%3])
1606 (define_insn "*op_side<mode>"
1607 [(set (match_operand:BWD 0 "register_operand" "=r,r,r,r,r")
1609 5 "cris_orthogonal_operator"
1610 [(match_operand:BWD 1 "register_operand" "0,0,0,0,0")
1612 (match_operand:SI 2 "cris_bdap_operand" "%r,r,r,R,R")
1613 (match_operand:SI 3 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")))]))
1614 (set (match_operand:SI 4 "register_operand" "=*2,r,r,*3,r")
1615 (plus:SI (match_dup 2)
1617 "cris_side_effect_mode_ok (PLUS, operands, 4, 2, 3, -1, 0)"
1619 if ((which_alternative == 0 || which_alternative == 3)
1620 && (!CONST_INT_P (operands[3])
1621 || INTVAL (operands[3]) > 127
1622 || INTVAL (operands[3]) < -128
1623 || satisfies_constraint_N (operands[3])
1624 || satisfies_constraint_J (operands[3])))
1626 if (which_alternative == 4)
1627 return "%x5.%s0 [%4=%3%S2],%0";
1628 return "%x5<m> [%4=%2%S3],%0";
1631 ;; To match all cases for commutative operations we may have to have the
1632 ;; following pattern for add, or & and. I do not know really, but it does
1633 ;; not break anything.
1635 ;; FIXME: This really ought to be checked.
1637 ;; op.S [rx=ry+I],rz;
1641 (define_insn "*op_swap_side<mode>_biap"
1642 [(set (match_operand:BWD 0 "register_operand" "=r,r")
1644 6 "cris_commutative_orth_op"
1646 (mult:SI (match_operand:SI 2 "register_operand" "r,r")
1647 (match_operand:SI 3 "const_int_operand" "n,n"))
1648 (match_operand:SI 4 "register_operand" "r,r")))
1649 (match_operand:BWD 1 "register_operand" "0,0")]))
1650 (set (match_operand:SI 5 "register_operand" "=*4,r")
1651 (plus:SI (mult:SI (match_dup 2)
1654 "cris_side_effect_mode_ok (MULT, operands, 5, 4, 2, 3, 0)"
1657 %x6<m> [%5=%4+%2%T3],%0")
1659 ;; [rx=ry+i] ([%4=%2+%3])
1660 ;; FIXME: These could have anonymous mode for operand 0.
1664 (define_insn "*op_swap_side<mode>"
1665 [(set (match_operand:BWD 0 "register_operand" "=r,r,r,r,r")
1667 5 "cris_commutative_orth_op"
1669 (plus:SI (match_operand:SI 2 "cris_bdap_operand" "%r,r,r,R,R")
1670 (match_operand:SI 3 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")))
1671 (match_operand:BWD 1 "register_operand" "0,0,0,0,0")]))
1672 (set (match_operand:SI 4 "register_operand" "=*2,r,r,*3,r")
1673 (plus:SI (match_dup 2)
1675 "cris_side_effect_mode_ok (PLUS, operands, 4, 2, 3, -1, 0)"
1677 if ((which_alternative == 0 || which_alternative == 3)
1678 && (!CONST_INT_P (operands[3])
1679 || INTVAL (operands[3]) > 127
1680 || INTVAL (operands[3]) < -128
1681 || satisfies_constraint_N (operands[3])
1682 || satisfies_constraint_J (operands[3])))
1684 if (which_alternative == 4)
1685 return "%x5<m> [%4=%3%S2],%0";
1686 return "%x5<m> [%4=%2%S3],%0";
1689 ;; Add operations, standard names.
1691 ;; Note that for the 'P' constraint, the high part can be -1 or 0. We
1692 ;; output the insn through the 'A' output modifier as "adds.w" and "addq",
1694 (define_expand "adddi3"
1695 [(set (match_operand:DI 0 "register_operand")
1696 (plus:DI (match_operand:DI 1 "register_operand")
1697 (match_operand:DI 2 "general_operand")))]
1700 if (MEM_P (operands[2]) && TARGET_V32)
1701 operands[2] = force_reg (DImode, operands[2]);
1704 (define_insn "*adddi3_non_v32"
1705 [(set (match_operand:DI 0 "register_operand" "=r,r,r,&r,&r")
1706 (plus:DI (match_operand:DI 1 "register_operand" "%0,0,0,0,r")
1707 (match_operand:DI 2 "general_operand" "J,N,P,g,!To")))]
1710 addq %2,%M0\;ax\;addq 0,%H0
1711 subq %n2,%M0\;ax\;subq 0,%H0
1712 add%e2.%z2 %2,%M0\;ax\;%A2 %H2,%H0
1713 add.d %M2,%M0\;ax\;add.d %H2,%H0
1714 add.d %M2,%M1,%M0\;ax\;add.d %H2,%H1,%H0")
1716 ; It seems no use allowing a memory operand for this one, because we'd
1717 ; need a scratch register for incrementing the address.
1718 (define_insn "*adddi3_v32"
1719 [(set (match_operand:DI 0 "register_operand" "=r,r,r,r,r")
1720 (plus:DI (match_operand:DI 1 "register_operand" "%0,0,0,0,0")
1721 (match_operand:DI 2 "nonmemory_operand" "J,N,P,r,n")))]
1724 addq %2,%M0\;addc 0,%H0
1725 subq %n2,%M0\;ax\;subq 0,%H0
1726 add%e2.%z2 %2,%M0\;addc %H2,%H0
1727 add.d %M2,%M0\;addc %H2,%H0
1728 add.d %M2,%M0\;addc %H2,%H0")
1730 (define_expand "add<mode>3"
1731 [(set (match_operand:BWD 0 "register_operand")
1733 (match_operand:BWD 1 "register_operand")
1734 (match_operand:BWD 2 "general_operand")))]
1738 (define_insn "*addsi3_non_v32"
1739 [(set (match_operand:SI 0 "register_operand" "=r,r, r,r,r,r, r,r, r")
1741 (match_operand:SI 1 "register_operand" "%0,0, 0,0,0,0, 0,r, r")
1742 (match_operand:SI 2 "general_operand" "r,Q>,J,N,n,!S,g,!To,0")))]
1744 ;; The last constraint is due to that after reload, the '%' is not
1745 ;; honored, and canonicalization doesn't care about keeping the same
1746 ;; register as in destination. This will happen after insn splitting.
1747 ;; gcc <= 2.7.2. FIXME: Check for gcc-2.9x
1751 switch (which_alternative)
1755 return "add.d %2,%0";
1757 return "addq %2,%0";
1759 return "subq %n2,%0";
1761 /* 'Known value', but not in -63..63.
1762 Check if addu/subu may be used. */
1763 if (INTVAL (operands[2]) > 0)
1765 if (INTVAL (operands[2]) < 256)
1766 return "addu.b %2,%0";
1767 if (INTVAL (operands[2]) < 65536)
1768 return "addu.w %2,%0";
1772 if (INTVAL (operands[2]) >= -255)
1773 return "subu.b %n2,%0";
1774 if (INTVAL (operands[2]) >= -65535)
1775 return "subu.w %n2,%0";
1777 return "add.d %2,%0";
1780 rtx tem = operands[2];
1781 gcc_assert (GET_CODE (tem) == CONST);
1782 tem = XEXP (tem, 0);
1783 if (GET_CODE (tem) == PLUS
1784 && GET_CODE (XEXP (tem, 0)) == UNSPEC
1785 /* We don't allow CRIS_UNSPEC_PCREL here; we can't have a
1786 pc-relative operand in an add insn. */
1787 && XINT (XEXP (tem, 0), 1) == CRIS_UNSPEC_GOTREL
1788 && CONST_INT_P (XEXP (tem, 1)))
1789 tem = XEXP (tem, 0);
1790 gcc_assert (GET_CODE (tem) == UNSPEC);
1791 switch (XINT (tem, 1))
1793 case CRIS_UNSPEC_GOTREAD:
1794 case CRIS_UNSPEC_PLTGOTREAD:
1795 /* Using sign-extend mostly to be consistent with the
1796 indexed addressing mode. */
1798 return "adds.w %2,%0";
1799 return "add.d %2,%0";
1801 case CRIS_UNSPEC_PLT_GOTREL:
1802 case CRIS_UNSPEC_GOTREL:
1803 return "add.d %2,%0";
1809 return "add%u2 %2,%0";
1811 return "add.d %2,%1,%0";
1813 return "add.d %1,%0";
1815 return "BOGUS addsi %2+%1 to %0";
1818 [(set_attr "slottable" "yes,yes,yes,yes,no,no,no,no,yes")])
1820 ; FIXME: Check what's best: having the three-operand ACR alternative
1821 ; before or after the corresponding-operand2 alternative. Check for
1822 ; *all* insns. FIXME: constant constraint letter for -128..127.
1823 (define_insn "*addsi3_v32"
1824 [(set (match_operand:SI 0 "register_operand" "=r,!a,r,!a, r,r,!a,r,!a,r,r,r,!a")
1826 (match_operand:SI 1 "register_operand" "%0,r, 0, r, 0,0,r, 0,r, 0,0,0,r")
1827 (match_operand:SI 2 "general_operand" "r, r, Q>,Q>,J,N,NJ,L,L, P,n,g,g")))]
1843 [(set_attr "slottable" "yes,yes,yes,yes,yes,yes,yes,no,no,no,no,no,no")
1844 (set_attr "cc" "*,none,*,none,*,*,none,*,none,*,*,*,none")])
1846 (define_insn "*addhi3_non_v32"
1847 [(set (match_operand:HI 0 "register_operand" "=r,r, r,r,r,r")
1848 (plus:HI (match_operand:HI 1 "register_operand" "%0,0, 0,0,0,r")
1849 (match_operand:HI 2 "general_operand" "r,Q>,J,N,g,!To")))]
1858 [(set_attr "slottable" "yes,yes,yes,yes,no,no")
1859 (set_attr "cc" "normal,normal,clobber,clobber,normal,normal")])
1861 (define_insn "*addhi3_v32"
1862 [(set (match_operand:HI 0 "register_operand" "=r, !a,r,!a, r,r,!a,r,!a")
1864 (match_operand:HI 1 "register_operand" "%0,r, 0, r, 0,0,r, 0,r")
1865 (match_operand:HI 2 "general_operand" "r, r, Q>,Q>,J,N,NJ,g,g")))]
1877 [(set_attr "slottable" "yes,yes,yes,yes,yes,yes,yes,no,no")
1878 (set_attr "cc" "*,none,*,none,clobber,clobber,none,*,none")])
1880 (define_insn "*addqi3_non_v32"
1881 [(set (match_operand:QI 0 "register_operand" "=r,r, r,r,r,r,r")
1882 (plus:QI (match_operand:QI 1 "register_operand" "%0,0, 0,0,0,0,r")
1883 (match_operand:QI 2 "general_operand" "r,Q>,J,N,O,g,!To")))]
1893 [(set_attr "slottable" "yes,yes,yes,yes,yes,no,no")
1894 (set_attr "cc" "normal,normal,clobber,clobber,clobber,normal,normal")])
1896 (define_insn "*addqi3_v32"
1897 [(set (match_operand:QI 0 "register_operand" "=r,!a,r,!a, r,r,!a,r,r,!a")
1899 (match_operand:QI 1 "register_operand" "%0,r, 0, r, 0,0,r, 0,0,r")
1900 (match_operand:QI 2 "general_operand" "r,r, Q>,Q>,J,N,NJ,O,g,g")))]
1913 [(set_attr "slottable" "yes,yes,yes,yes,yes,yes,yes,yes,no,no")
1914 (set_attr "cc" "*,none,*,none,clobber,clobber,none,clobber,*,none")])
1918 ;; Note that because of insn canonicalization these will *seldom* but
1919 ;; rarely be used with a known constant as an operand.
1921 ;; Note that for the 'P' constraint, the high part can be -1 or 0. We
1922 ;; output the insn through the 'D' output modifier as "subs.w" and "subq",
1924 (define_expand "subdi3"
1925 [(set (match_operand:DI 0 "register_operand")
1926 (minus:DI (match_operand:DI 1 "register_operand")
1927 (match_operand:DI 2 "general_operand")))]
1930 if (TARGET_V32 && MEM_P (operands[2]))
1931 operands[2] = force_reg (DImode, operands[2]);
1934 (define_insn "*subdi3_non_v32"
1935 [(set (match_operand:DI 0 "register_operand" "=r,r,r,&r,&r")
1936 (minus:DI (match_operand:DI 1 "register_operand" "0,0,0,0,r")
1937 (match_operand:DI 2 "general_operand" "J,N,P,g,!To")))]
1940 subq %2,%M0\;ax\;subq 0,%H0
1941 addq %n2,%M0\;ax\;addq 0,%H0
1942 sub%e2.%z2 %2,%M0\;ax\;%D2 %H2,%H0
1943 sub.d %M2,%M0\;ax\;sub.d %H2,%H0
1944 sub.d %M2,%M1,%M0\;ax\;sub.d %H2,%H1,%H0")
1946 (define_insn "*subdi3_v32"
1947 [(set (match_operand:DI 0 "register_operand" "=r,r,r,&r")
1948 (minus:DI (match_operand:DI 1 "register_operand" "0,0,0,0")
1949 (match_operand:DI 2 "nonmemory_operand" "J,N,P,r")))]
1952 subq %2,%M0\;ax\;subq 0,%H0
1953 addq %n2,%M0\;ax\;addq 0,%H0
1954 sub%e2.%z2 %2,%M0\;ax\;%D2 %H2,%H0
1955 sub.d %M2,%M0\;ax\;sub.d %H2,%H0")
1957 (define_expand "sub<mode>3"
1958 [(set (match_operand:BWD 0 "register_operand")
1960 (match_operand:BWD 1 "register_operand")
1961 (match_operand:BWD 2 "general_operand")))]
1965 (define_insn "*subsi3_non_v32"
1966 [(set (match_operand:SI 0 "register_operand" "=r,r, r,r,r,r,r,r")
1968 (match_operand:SI 1 "register_operand" "0,0, 0,0,0,0,0,r")
1969 (match_operand:SI 2 "general_operand" "r,Q>,J,N,P,n,g,!To")))]
1972 ;; This does not do the optimal: "addu.w 65535,r0" when %2 is negative.
1973 ;; But then again, %2 should not be negative.
1984 [(set_attr "slottable" "yes,yes,yes,yes,no,no,no,no")])
1986 (define_insn "*subsi3_v32"
1987 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r,r,r")
1989 (match_operand:SI 1 "register_operand" "0,0,0,0,0,0,0")
1990 (match_operand:SI 2 "general_operand" "r,Q>,J,N,P,n,g")))]
2000 [(set_attr "slottable" "yes,yes,yes,yes,no,no,no")])
2002 (define_insn "*sub<mode>3_nonv32"
2003 [(set (match_operand:BW 0 "register_operand" "=r,r, r,r,r,r")
2004 (minus:BW (match_operand:BW 1 "register_operand" "0,0, 0,0,0,r")
2005 (match_operand:BW 2 "general_operand" "r,Q>,J,N,g,!To")))]
2014 [(set_attr "slottable" "yes,yes,yes,yes,no,no")
2015 (set_attr "cc" "normal,normal,clobber,clobber,normal,normal")])
2017 (define_insn "*sub<mode>3_v32"
2018 [(set (match_operand:BW 0 "register_operand" "=r,r,r,r,r")
2019 (minus:BW (match_operand:BW 1 "register_operand" "0,0,0,0,0")
2020 (match_operand:BW 2 "general_operand" "r,Q>,J,N,g")))]
2028 [(set_attr "slottable" "yes,yes,yes,yes,no")
2029 (set_attr "cc" "normal,normal,clobber,clobber,normal")])
2031 ;; CRIS has some add/sub-with-sign/zero-extend instructions.
2032 ;; Although these perform sign/zero-extension to SImode, they are
2033 ;; equally applicable for the HImode case.
2034 ;; FIXME: Check; GCC should handle the widening.
2035 ;; Note that these must be located after the normal add/sub patterns,
2036 ;; so not to get constants into any less specific operands.
2038 ;; Extend with add/sub and side-effect.
2040 ;; ADDS/SUBS/ADDU/SUBU and BOUND, which needs a check for zero_extend
2042 ;; adds/subs/addu/subu bound [rx=ry+rz.S]
2045 ;; FIXME: GCC should widen.
2047 (define_insn "*extopqihi_side_biap"
2048 [(set (match_operand:HI 0 "register_operand" "=r,r")
2050 6 "cris_additive_operand_extend_operator"
2051 [(match_operand:HI 1 "register_operand" "0,0")
2053 7 "cris_extend_operator"
2055 (mult:SI (match_operand:SI 2 "register_operand" "r,r")
2056 (match_operand:SI 3 "const_int_operand" "n,n"))
2057 (match_operand:SI 4 "register_operand" "r,r")))])]))
2058 (set (match_operand:SI 5 "register_operand" "=*4,r")
2059 (plus:SI (mult:SI (match_dup 2)
2062 "cris_side_effect_mode_ok (MULT, operands, 5, 4, 2, 3, 0)"
2065 %x6%e7.%m7 [%5=%4+%2%T3],%0")
2067 (define_insn "*extop<mode>si_side_biap"
2068 [(set (match_operand:SI 0 "register_operand" "=r,r")
2070 6 "cris_operand_extend_operator"
2071 [(match_operand:SI 1 "register_operand" "0,0")
2073 7 "cris_extend_operator"
2075 (mult:SI (match_operand:SI 2 "register_operand" "r,r")
2076 (match_operand:SI 3 "const_int_operand" "n,n"))
2077 (match_operand:SI 4 "register_operand" "r,r")))])]))
2078 (set (match_operand:SI 5 "register_operand" "=*4,r")
2079 (plus:SI (mult:SI (match_dup 2)
2082 "(GET_CODE (operands[6]) != UMIN || GET_CODE (operands[7]) == ZERO_EXTEND)
2083 && cris_side_effect_mode_ok (MULT, operands, 5, 4, 2, 3, 0)"
2086 %x6%e7<m> [%5=%4+%2%T3],%0")
2093 (define_insn "*extopqihi_side"
2094 [(set (match_operand:HI 0 "register_operand" "=r,r,r,r,r")
2096 5 "cris_additive_operand_extend_operator"
2097 [(match_operand:HI 1 "register_operand" "0,0,0,0,0")
2099 6 "cris_extend_operator"
2101 (plus:SI (match_operand:SI 2 "cris_bdap_operand" "%r,r,r,R,R")
2102 (match_operand:SI 3 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")
2104 (set (match_operand:SI 4 "register_operand" "=*2,r,r,*3,r")
2105 (plus:SI (match_dup 2)
2107 "cris_side_effect_mode_ok (PLUS, operands, 4, 2, 3, -1, 0)"
2109 if ((which_alternative == 0 || which_alternative == 3)
2110 && (!CONST_INT_P (operands[3])
2111 || INTVAL (operands[3]) > 127
2112 || INTVAL (operands[3]) < -128
2113 || satisfies_constraint_N (operands[3])
2114 || satisfies_constraint_J (operands[3])))
2116 if (which_alternative == 4)
2117 return "%x5%E6.%m6 [%4=%3%S2],%0";
2118 return "%x5%E6.%m6 [%4=%2%S3],%0";
2121 (define_insn "*extop<mode>si_side"
2122 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r")
2124 5 "cris_operand_extend_operator"
2125 [(match_operand:SI 1 "register_operand" "0,0,0,0,0")
2127 6 "cris_extend_operator"
2129 (plus:SI (match_operand:SI 2 "cris_bdap_operand" "%r,r,r,R,R")
2130 (match_operand:SI 3 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")
2132 (set (match_operand:SI 4 "register_operand" "=*2,r,r,*3,r")
2133 (plus:SI (match_dup 2)
2135 "(GET_CODE (operands[5]) != UMIN || GET_CODE (operands[6]) == ZERO_EXTEND)
2136 && cris_side_effect_mode_ok (PLUS, operands, 4, 2, 3, -1, 0)"
2138 if ((which_alternative == 0 || which_alternative == 3)
2139 && (!CONST_INT_P (operands[3])
2140 || INTVAL (operands[3]) > 127
2141 || INTVAL (operands[3]) < -128
2142 || satisfies_constraint_N (operands[3])
2143 || satisfies_constraint_J (operands[3])))
2145 if (which_alternative == 4)
2146 return "%x5%E6<m> [%4=%3%S2],%0";
2147 return "%x5%E6<m> [%4=%2%S3],%0";
2151 ;; As with op.S we may have to add special pattern to match commuted
2152 ;; operands to adds/addu and bound
2154 ;; adds/addu/bound [rx=ry+rz.S]
2157 ;; FIXME: GCC should widen.
2159 (define_insn "*extopqihi_swap_side_biap"
2160 [(set (match_operand:HI 0 "register_operand" "=r,r")
2163 6 "cris_extend_operator"
2165 (mult:SI (match_operand:SI 2 "register_operand" "r,r")
2166 (match_operand:SI 3 "const_int_operand" "n,n"))
2167 (match_operand:SI 4 "register_operand" "r,r")))])
2168 (match_operand:HI 1 "register_operand" "0,0")))
2169 (set (match_operand:SI 5 "register_operand" "=*4,r")
2170 (plus:SI (mult:SI (match_dup 2)
2173 "cris_side_effect_mode_ok (MULT, operands, 5, 4, 2, 3, 0)"
2176 add%e6.b [%5=%4+%2%T3],%0")
2178 (define_insn "*extop<mode>si_swap_side_biap"
2179 [(set (match_operand:SI 0 "register_operand" "=r,r")
2181 7 "cris_plus_or_bound_operator"
2183 6 "cris_extend_operator"
2185 (mult:SI (match_operand:SI 2 "register_operand" "r,r")
2186 (match_operand:SI 3 "const_int_operand" "n,n"))
2187 (match_operand:SI 4 "register_operand" "r,r")))])
2188 (match_operand:SI 1 "register_operand" "0,0")]))
2189 (set (match_operand:SI 5 "register_operand" "=*4,r")
2190 (plus:SI (mult:SI (match_dup 2)
2193 "(GET_CODE (operands[7]) != UMIN || GET_CODE (operands[6]) == ZERO_EXTEND)
2194 && cris_side_effect_mode_ok (MULT, operands, 5, 4, 2, 3, 0)"
2197 %x7%E6<m> [%5=%4+%2%T3],%0")
2200 ;; FIXME: GCC should widen.
2204 (define_insn "*extopqihi_swap_side"
2205 [(set (match_operand:HI 0 "register_operand" "=r,r,r,r,r")
2208 5 "cris_extend_operator"
2210 (match_operand:SI 2 "cris_bdap_operand" "%r,r,r,R,R")
2211 (match_operand:SI 3 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")))])
2212 (match_operand:HI 1 "register_operand" "0,0,0,0,0")))
2213 (set (match_operand:SI 4 "register_operand" "=*2,r,r,*3,r")
2214 (plus:SI (match_dup 2)
2216 "cris_side_effect_mode_ok (PLUS, operands, 4, 2, 3, -1, 0)"
2218 if ((which_alternative == 0 || which_alternative == 3)
2219 && (!CONST_INT_P (operands[3])
2220 || INTVAL (operands[3]) > 127
2221 || INTVAL (operands[3]) < -128
2222 || satisfies_constraint_N (operands[3])
2223 || satisfies_constraint_J (operands[3])))
2225 if (which_alternative == 4)
2226 return "add%e5.b [%4=%3%S2],%0";
2227 return "add%e5.b [%4=%2%S3],%0";
2230 (define_insn "*extop<mode>si_swap_side"
2231 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r")
2233 6 "cris_plus_or_bound_operator"
2235 5 "cris_extend_operator"
2237 (match_operand:SI 2 "cris_bdap_operand" "%r,r,r,R,R")
2238 (match_operand:SI 3 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")))])
2239 (match_operand:SI 1 "register_operand" "0,0,0,0,0")]))
2240 (set (match_operand:SI 4 "register_operand" "=*2,r,r,*3,r")
2241 (plus:SI (match_dup 2)
2243 "(GET_CODE (operands[6]) != UMIN || GET_CODE (operands[5]) == ZERO_EXTEND)
2244 && cris_side_effect_mode_ok (PLUS, operands, 4, 2, 3, -1, 0)"
2246 if ((which_alternative == 0 || which_alternative == 3)
2247 && (!CONST_INT_P (operands[3])
2248 || INTVAL (operands[3]) > 127
2249 || INTVAL (operands[3]) < -128
2250 || satisfies_constraint_N (operands[3])
2251 || satisfies_constraint_J (operands[3])))
2253 if (which_alternative == 4)
2254 return \"%x6%E5.%m5 [%4=%3%S2],%0\";
2255 return "%x6%E5<m> [%4=%2%S3],%0";
2258 ;; Extend versions (zero/sign) of normal add/sub (no side-effects).
2261 ;; FIXME: GCC should widen.
2263 (define_insn "*extopqihi_non_v32"
2264 [(set (match_operand:HI 0 "register_operand" "=r,r,r,r")
2266 3 "cris_additive_operand_extend_operator"
2267 [(match_operand:HI 1 "register_operand" "0,0,0,r")
2269 4 "cris_extend_operator"
2270 [(match_operand:QI 2 "nonimmediate_operand" "r,Q>,m,!To")])]))]
2271 "!TARGET_V32 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
2272 && (operands[1] != frame_pointer_rtx || GET_CODE (operands[3]) != PLUS)"
2277 %x3%E4.%m4 %2,%1,%0"
2278 [(set_attr "slottable" "yes,yes,no,no")
2279 (set_attr "cc" "clobber")])
2281 (define_insn "*extopqihi_v32"
2282 [(set (match_operand:HI 0 "register_operand" "=r,r")
2284 3 "cris_additive_operand_extend_operator"
2285 [(match_operand:HI 1 "register_operand" "0,0")
2287 4 "cris_extend_operator"
2288 [(match_operand:QI 2 "nonimmediate_operand" "r,m")])]))]
2291 [(set_attr "slottable" "yes")
2292 (set_attr "cc" "clobber")])
2296 (define_insn "*extop<mode>si_non_v32"
2297 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
2299 3 "cris_operand_extend_operator"
2300 [(match_operand:SI 1 "register_operand" "0,0,0,r")
2302 4 "cris_extend_operator"
2303 [(match_operand:BW 2 "nonimmediate_operand" "r,Q>,m,!To")])]))]
2305 && (GET_CODE (operands[3]) != UMIN || GET_CODE (operands[4]) == ZERO_EXTEND)
2306 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
2307 && (operands[1] != frame_pointer_rtx || GET_CODE (operands[3]) != PLUS)"
2313 [(set_attr "slottable" "yes,yes,no,no")])
2315 (define_insn "*extop<mode>si_v32"
2316 [(set (match_operand:SI 0 "register_operand" "=r,r")
2318 3 "cris_additive_operand_extend_operator"
2319 [(match_operand:SI 1 "register_operand" "0,0")
2321 4 "cris_extend_operator"
2322 [(match_operand:BW 2 "nonimmediate_operand" "r,m")])]))]
2325 [(set_attr "slottable" "yes")])
2327 ;; As with the side-effect patterns, may have to have swapped operands for add.
2328 ;; For commutative operands, these are the canonical forms.
2332 (define_insn "*addxqihi_swap_non_v32"
2333 [(set (match_operand:HI 0 "register_operand" "=r,r,r,r")
2336 3 "cris_extend_operator"
2337 [(match_operand:QI 2 "nonimmediate_operand" "r,Q>,m,!To")])
2338 (match_operand:HI 1 "register_operand" "0,0,0,r")))]
2339 "!TARGET_V32 && operands[1] != frame_pointer_rtx"
2345 [(set_attr "slottable" "yes,yes,no,no")
2346 (set_attr "cc" "clobber")])
2348 ;; A case for v32, to catch the "addo" insn in addition to "adds". We
2349 ;; only care to match the canonical form; there should be no other.
2351 (define_insn "*addsbw_v32"
2352 [(set (match_operand:HI 0 "register_operand" "=r,r,!a")
2355 (match_operand:QI 2 "nonimmediate_operand" "r,m,m"))
2356 (match_operand:HI 1 "register_operand" "0,0,r")))]
2362 [(set_attr "slottable" "yes")
2363 (set_attr "cc" "clobber,clobber,none")])
2365 (define_insn "*addubw_v32"
2366 [(set (match_operand:HI 0 "register_operand" "=r,r")
2369 (match_operand:QI 2 "nonimmediate_operand" "r,m"))
2370 (match_operand:HI 1 "register_operand" "0,0")))]
2373 [(set_attr "slottable" "yes")
2374 (set_attr "cc" "clobber")])
2376 (define_insn "*extop<mode>si_swap_non_v32"
2377 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
2379 4 "cris_plus_or_bound_operator"
2381 3 "cris_extend_operator"
2382 [(match_operand:BW 2 "nonimmediate_operand" "r,Q>,m,!To")])
2383 (match_operand:SI 1 "register_operand" "0,0,0,r")]))]
2385 && (GET_CODE (operands[4]) != UMIN || GET_CODE (operands[3]) == ZERO_EXTEND)
2386 && operands[1] != frame_pointer_rtx"
2392 [(set_attr "slottable" "yes,yes,no,no")])
2394 (define_insn "*adds<mode>_v32"
2395 [(set (match_operand:SI 0 "register_operand" "=r,r,!a")
2398 (match_operand:BW 2 "nonimmediate_operand" "r,m,m"))
2399 (match_operand:SI 1 "register_operand" "0,0,r")))]
2405 [(set_attr "slottable" "yes")
2406 (set_attr "cc" "*,*,none")])
2408 (define_insn "*addu<mode>_v32"
2409 [(set (match_operand:SI 0 "register_operand" "=r,r")
2412 (match_operand:BW 2 "nonimmediate_operand" "r,m"))
2413 (match_operand:SI 1 "register_operand" "0,0")))]
2414 "TARGET_V32 && operands[1] != frame_pointer_rtx"
2416 [(set_attr "slottable" "yes")])
2418 (define_insn "*bound<mode>_v32"
2419 [(set (match_operand:SI 0 "register_operand" "=r")
2422 (match_operand:BW 2 "register_operand" "r"))
2423 (match_operand:SI 1 "register_operand" "0")))]
2424 "TARGET_V32 && operands[1] != frame_pointer_rtx"
2426 [(set_attr "slottable" "yes")])
2428 ;; This is the special case when we use what corresponds to the
2429 ;; instruction above in "casesi". Do *not* change it to use the generic
2430 ;; pattern and "REG 15" as pc; I did that and it led to madness and
2431 ;; maintenance problems: Instead of (as imagined) recognizing and removing
2432 ;; or replacing this pattern with something simpler, other variant
2433 ;; patterns were recognized or combined, including some prefix variants
2434 ;; where the value in pc is not that of the next instruction (which means
2435 ;; this instruction actually *is* special and *should* be marked as such).
2436 ;; When switching from the "generic pattern match" approach to this simpler
2437 ;; approach, there were insignificant differences in gcc, ipps and
2438 ;; product code, somehow due to scratching reload behind the ear or
2439 ;; something. Testcase "gcc" looked .01% slower and 4 bytes bigger;
2440 ;; product code became .001% smaller but "looked better". The testcase
2441 ;; "ipps" was just different at register allocation).
2443 ;; Assumptions in the jump optimizer forces us to use IF_THEN_ELSE in this
2444 ;; pattern with the default-label as the else, with the "if" being
2445 ;; index-is-less-than the max number of cases plus one. The default-label
2446 ;; is attached to the end of the case-table at time of output.
2448 (define_insn "*casesi_adds_w"
2451 (ltu (match_operand:SI 0 "register_operand" "r")
2452 (match_operand:SI 1 "const_int_operand" "n"))
2453 (plus:SI (sign_extend:SI
2455 (plus:SI (mult:SI (match_dup 0) (const_int 2))
2458 (label_ref (match_operand 2 "" ""))))
2459 (use (label_ref (match_operand 3 "" "")))]
2460 "!TARGET_V32 && operands[0] != frame_pointer_rtx"
2461 "adds.w [$pc+%0.w],$pc"
2462 [(set_attr "cc" "clobber")])
2464 ;; For V32, we just have a jump, but we need to mark the table as used,
2465 ;; and the jump insn must have the if_then_else form expected by core
2466 ;; GCC. Since we don't want to prolong the lifetime of the original
2467 ;; index value, we compare against "unspec 0". It's a pity we have to
2468 ;; jump through to get the default label in place and to keep the jump
2469 ;; table around. FIXME: Look into it some time.
2471 (define_insn "*casesi_jump_v32"
2474 (ltu (unspec [(const_int 0)] CRIS_UNSPEC_CASESI)
2475 (match_operand:SI 0 "const_int_operand" "n"))
2476 (match_operand:SI 1 "register_operand" "r")
2477 (label_ref (match_operand 2 "" ""))))
2478 (use (label_ref (match_operand 3 "" "")))]
2481 [(set_attr "cc" "clobber")
2482 (set_attr "slottable" "has_slot")])
2484 ;; Multiply instructions.
2486 ;; Sometimes powers of 2 (which are normally canonicalized to a
2487 ;; left-shift) appear here, as a result of address reloading.
2488 ;; As a special, for values 3 and 5, we can match with an addi, so add those.
2490 ;; FIXME: This may be unnecessary now.
2491 ;; Explicitly named for convenience of having a gen_... function.
2493 (define_insn "addi_mul"
2494 [(set (match_operand:SI 0 "register_operand" "=r")
2496 (match_operand:SI 1 "register_operand" "%0")
2497 (match_operand:SI 2 "const_int_operand" "n")))]
2498 "operands[0] != frame_pointer_rtx
2499 && operands[1] != frame_pointer_rtx
2500 && CONST_INT_P (operands[2])
2501 && (INTVAL (operands[2]) == 2
2502 || INTVAL (operands[2]) == 4 || INTVAL (operands[2]) == 3
2503 || INTVAL (operands[2]) == 5)"
2505 if (INTVAL (operands[2]) == 2)
2507 else if (INTVAL (operands[2]) == 4)
2509 else if (INTVAL (operands[2]) == 3)
2510 return "addi %0.w,%0";
2511 else if (INTVAL (operands[2]) == 5)
2512 return "addi %0.d,%0";
2513 return "BAD: adr_mulsi: %0=%1*%2";
2515 [(set_attr "slottable" "yes")
2516 ;; No flags are changed if this insn is "addi", but it does not seem
2517 ;; worth the trouble to distinguish that to the lslq cases.
2518 (set_attr "cc" "clobber")])
2520 ;; The addi insn as it is normally used.
2522 ;; Make the ACR alternative taste bad enough to not choose it as a
2523 ;; preference to avoid spilling problems (unwind-dw2-fde.c at build).
2524 ;; FIXME: Revisit for new register allocator.
2526 (define_insn "*addi"
2527 [(set (match_operand:SI 0 "register_operand" "=r,!a")
2529 (mult:SI (match_operand:SI 2 "register_operand" "r,r")
2530 (match_operand:SI 3 "const_int_operand" "n,n"))
2531 (match_operand:SI 1 "register_operand" "0,r")))]
2532 "operands[0] != frame_pointer_rtx
2533 && operands[1] != frame_pointer_rtx
2534 && CONST_INT_P (operands[3])
2535 && (INTVAL (operands[3]) == 1
2536 || INTVAL (operands[3]) == 2 || INTVAL (operands[3]) == 4)"
2540 [(set_attr "slottable" "yes")
2541 (set_attr "cc" "none")])
2543 ;; The mstep instruction. Probably not useful by itself; it's to
2544 ;; non-linear wrt. the other insns. We used to expand to it, so at least
2547 (define_insn "mstep_shift"
2548 [(set (match_operand:SI 0 "register_operand" "=r")
2550 (lt:SI (cc0) (const_int 0))
2551 (plus:SI (ashift:SI (match_operand:SI 1 "register_operand" "0")
2553 (match_operand:SI 2 "register_operand" "r"))
2554 (ashift:SI (match_operand:SI 3 "register_operand" "0")
2558 [(set_attr "slottable" "yes")])
2560 ;; When illegitimate addresses are legitimized, sometimes gcc forgets
2561 ;; to canonicalize the multiplications.
2563 ;; FIXME: Check gcc > 2.7.2, remove and possibly fix in gcc.
2565 (define_insn "mstep_mul"
2566 [(set (match_operand:SI 0 "register_operand" "=r")
2568 (lt:SI (cc0) (const_int 0))
2569 (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "0")
2571 (match_operand:SI 2 "register_operand" "r"))
2572 (mult:SI (match_operand:SI 3 "register_operand" "0")
2575 && operands[0] != frame_pointer_rtx
2576 && operands[1] != frame_pointer_rtx
2577 && operands[2] != frame_pointer_rtx
2578 && operands[3] != frame_pointer_rtx"
2580 [(set_attr "slottable" "yes")])
2582 (define_insn "<u>mul<s><mode>3"
2583 [(set (match_operand:WD 0 "register_operand" "=r")
2585 (szext:WD (match_operand:<S> 1 "register_operand" "%0"))
2586 (szext:WD (match_operand:<S> 2 "register_operand" "r"))))
2587 (clobber (match_scratch:SI 3 "=h"))]
2588 "TARGET_HAS_MUL_INSNS"
2589 "%!mul<su><mm> %2,%0"
2590 [(set (attr "slottable")
2591 (if_then_else (match_test "TARGET_MUL_BUG")
2593 (const_string "yes")))
2594 ;; For umuls.[bwd] it's just N unusable here, but let's be safe.
2595 ;; For muls.b, this really extends to SImode, so cc should be
2596 ;; considered clobbered.
2597 ;; For muls.w, it's just N unusable here, but let's be safe.
2598 (set_attr "cc" "clobber")])
2600 ;; Note that gcc does not make use of such a thing as umulqisi3. It gets
2601 ;; confused and will erroneously use it instead of umulhisi3, failing (at
2602 ;; least) gcc.c-torture/execute/arith-rand.c at all optimization levels.
2603 ;; Inspection of optab code shows that there must be only one widening
2604 ;; multiplication per mode widened to.
2606 (define_insn "mulsi3"
2607 [(set (match_operand:SI 0 "register_operand" "=r")
2608 (mult:SI (match_operand:SI 1 "register_operand" "%0")
2609 (match_operand:SI 2 "register_operand" "r")))
2610 (clobber (match_scratch:SI 3 "=h"))]
2611 "TARGET_HAS_MUL_INSNS"
2613 [(set (attr "slottable")
2614 (if_then_else (match_test "TARGET_MUL_BUG")
2616 (const_string "yes")))
2617 ;; Just N unusable here, but let's be safe.
2618 (set_attr "cc" "clobber")])
2620 ;; A few multiply variations.
2622 ;; When needed, we can get the high 32 bits from the overflow
2623 ;; register. We don't care to split and optimize these.
2625 ;; Note that cc0 is still valid after the move-from-overflow-register
2626 ;; insn; no special precaution need to be taken in cris_notice_update_cc.
2628 (define_insn "<u>mulsidi3"
2629 [(set (match_operand:DI 0 "register_operand" "=r")
2631 (szext:DI (match_operand:SI 1 "register_operand" "%0"))
2632 (szext:DI (match_operand:SI 2 "register_operand" "r"))))
2633 (clobber (match_scratch:SI 3 "=h"))]
2634 "TARGET_HAS_MUL_INSNS"
2635 "%!mul<su>.d %2,%M0\;move $mof,%H0")
2637 ;; These two patterns may be expressible by other means, perhaps by making
2638 ;; [u]?mulsidi3 a define_expand.
2640 ;; Due to register allocation braindamage, the clobber 1,2 alternatives
2641 ;; cause a move into the clobbered register *before* the insn, then
2642 ;; after the insn, mof is moved too, rather than the clobber assigned
2643 ;; the last mof target. This became apparent when making MOF and SRP
2644 ;; visible registers, with the necessary tweak to smulsi3_highpart.
2645 ;; Because these patterns are used in division by constants, that damage
2646 ;; is visible (ipps regression tests). Therefore the last two
2647 ;; alternatives, "helping" reload to avoid an unnecessary move, but
2648 ;; punished by force of one "?". Check code from "int d (int a) {return
2649 ;; a / 1000;}" and unsigned. FIXME: Comment above was for 3.2, revisit.
2651 (define_insn "<su>mulsi3_highpart"
2652 [(set (match_operand:SI 0 "register_operand" "=h,h,?r,?r")
2656 (szext:DI (match_operand:SI 1 "register_operand" "r,r,0,r"))
2657 (szext:DI (match_operand:SI 2 "register_operand" "r,r,r,0")))
2659 (clobber (match_scratch:SI 3 "=1,2,h,h"))]
2660 "TARGET_HAS_MUL_INSNS"
2664 %!mul<su>.d %2,%1\;move $mof,%0
2665 %!mul<su>.d %1,%2\;move $mof,%0"
2666 [(set_attr "slottable" "yes,yes,no,no")
2667 (set_attr "cc" "clobber")])
2669 ;; Divide and modulus instructions. CRIS only has a step instruction.
2671 (define_insn "dstep_shift"
2672 [(set (match_operand:SI 0 "register_operand" "=r")
2674 (geu:SI (ashift:SI (match_operand:SI 1 "register_operand" "0")
2676 (match_operand:SI 2 "register_operand" "r"))
2677 (minus:SI (ashift:SI (match_operand:SI 3 "register_operand" "0")
2679 (match_operand:SI 4 "register_operand" "2"))
2680 (ashift:SI (match_operand:SI 5 "register_operand" "0")
2684 [(set_attr "slottable" "yes")
2685 (set_attr "cc" "noov32")])
2687 ;; Here's a variant with mult instead of ashift.
2689 ;; FIXME: This should be investigated. Which one matches through combination?
2691 (define_insn "dstep_mul"
2692 [(set (match_operand:SI 0 "register_operand" "=r")
2694 (geu:SI (mult:SI (match_operand:SI 1 "register_operand" "0")
2696 (match_operand:SI 2 "register_operand" "r"))
2697 (minus:SI (mult:SI (match_operand:SI 3 "register_operand" "0")
2699 (match_operand:SI 4 "register_operand" "2"))
2700 (mult:SI (match_operand:SI 5 "register_operand" "0")
2702 "operands[0] != frame_pointer_rtx
2703 && operands[1] != frame_pointer_rtx
2704 && operands[2] != frame_pointer_rtx
2705 && operands[3] != frame_pointer_rtx"
2707 [(set_attr "slottable" "yes")
2708 (set_attr "cc" "noov32")])
2710 ;; Logical operators.
2714 ;; There is no use in defining "anddi3", because gcc can expand this by
2715 ;; itself, and make reasonable code without interference.
2717 ;; If the first operand is memory or a register and is the same as the
2718 ;; second operand, and the third operand is -256 or -65536, we can use
2719 ;; CLEAR instead. Or, if the first operand is a register, and the third
2720 ;; operand is 255 or 65535, we can zero_extend.
2721 ;; GCC isn't smart enough to recognize these cases (yet), and they seem
2722 ;; to be common enough to be worthwhile.
2723 ;; FIXME: This should be made obsolete.
2725 (define_expand "andsi3"
2726 [(set (match_operand:SI 0 "nonimmediate_operand" "")
2727 (and:SI (match_operand:SI 1 "nonimmediate_operand" "")
2728 (match_operand:SI 2 "general_operand" "")))]
2731 if (! (CONST_INT_P (operands[2])
2732 && (((INTVAL (operands[2]) == -256
2733 || INTVAL (operands[2]) == -65536)
2734 && rtx_equal_p (operands[1], operands[0]))
2735 || ((INTVAL (operands[2]) == 255
2736 || INTVAL (operands[2]) == 65535)
2737 && REG_P (operands[0])))))
2739 /* Make intermediate steps if operand0 is not a register or
2740 operand1 is not a register, and hope that the reload pass will
2741 make something useful out of it. Note that the operands are
2742 *not* canonicalized. For the moment, I chicken out on this,
2743 because all or most ports do not describe 'and' with
2744 canonicalized operands, and I seem to remember magic in reload,
2745 checking that operand1 has constraint '%0', in which case
2746 operand0 and operand1 must have similar predicates.
2747 FIXME: Investigate. */
2748 rtx reg0 = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (SImode);
2749 rtx reg1 = operands[1];
2753 emit_move_insn (reg0, reg1);
2757 emit_insn (gen_rtx_SET (reg0, gen_rtx_AND (SImode, reg1, operands[2])));
2759 /* Make sure we get the right *final* destination. */
2760 if (! REG_P (operands[0]))
2761 emit_move_insn (operands[0], reg0);
2767 ;; Some special cases of andsi3.
2769 (define_insn "*andsi_movu"
2770 [(set (match_operand:SI 0 "register_operand" "=r,r,r")
2771 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%r,Q,To")
2772 (match_operand:SI 2 "const_int_operand" "n,n,n")))]
2773 "(INTVAL (operands[2]) == 255 || INTVAL (operands[2]) == 65535)
2774 && !side_effects_p (operands[1])"
2776 [(set_attr "slottable" "yes,yes,no")])
2778 (define_insn "*andsi_clear"
2779 [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,Q,Q,To,To")
2780 (and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0,0,0")
2781 (match_operand:SI 2 "const_int_operand" "P,n,P,n,P,n")))]
2782 "(INTVAL (operands[2]) == -65536 || INTVAL (operands[2]) == -256)
2783 && !side_effects_p (operands[0])"
2791 [(set_attr "slottable" "yes,yes,yes,yes,no,no")
2792 (set_attr "cc" "none")])
2794 ;; This is a catch-all pattern, taking care of everything that was not
2795 ;; matched in the insns above.
2797 ;; Sidenote: the tightening from "nonimmediate_operand" to
2798 ;; "register_operand" for operand 1 actually increased the register
2799 ;; pressure (worse code). That will hopefully change with an
2800 ;; improved reload pass.
2802 (define_insn "*expanded_andsi_non_v32"
2803 [(set (match_operand:SI 0 "register_operand" "=r,r,r, r,r")
2804 (and:SI (match_operand:SI 1 "register_operand" "%0,0,0, 0,r")
2805 (match_operand:SI 2 "general_operand" "I,r,Q>,g,!To")))]
2813 [(set_attr "slottable" "yes,yes,yes,no,no")])
2815 (define_insn "*expanded_andsi_v32"
2816 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
2817 (and:SI (match_operand:SI 1 "register_operand" "%0,0,0,0")
2818 (match_operand:SI 2 "general_operand" "I,r,Q>,g")))]
2825 [(set_attr "slottable" "yes,yes,yes,no")
2826 (set_attr "cc" "noov32")])
2828 ;; For both QI and HI we may use the quick patterns. This results in
2829 ;; useless condition codes, but that is used rarely enough for it to
2830 ;; normally be a win (could check ahead for use of cc0, but seems to be
2831 ;; more pain than win).
2833 ;; FIXME: See note for andsi3
2835 (define_expand "andhi3"
2836 [(set (match_operand:HI 0 "nonimmediate_operand" "")
2837 (and:HI (match_operand:HI 1 "nonimmediate_operand" "")
2838 (match_operand:HI 2 "general_operand" "")))]
2841 if (! (CONST_INT_P (operands[2])
2842 && (((INTVAL (operands[2]) == -256
2843 || INTVAL (operands[2]) == 65280)
2844 && rtx_equal_p (operands[1], operands[0]))
2845 || (INTVAL (operands[2]) == 255
2846 && REG_P (operands[0])))))
2848 /* See comment for andsi3. */
2849 rtx reg0 = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (HImode);
2850 rtx reg1 = operands[1];
2854 emit_move_insn (reg0, reg1);
2858 emit_insn (gen_rtx_SET (reg0, gen_rtx_AND (HImode, reg1, operands[2])));
2860 /* Make sure we get the right destination. */
2861 if (! REG_P (operands[0]))
2862 emit_move_insn (operands[0], reg0);
2868 ;; Some fast andhi3 special cases.
2870 (define_insn "*andhi_movu"
2871 [(set (match_operand:HI 0 "register_operand" "=r,r,r")
2872 (and:HI (match_operand:HI 1 "nonimmediate_operand" "r,Q,To")
2874 "!side_effects_p (operands[1])"
2876 [(set_attr "slottable" "yes,yes,no")])
2878 (define_insn "*andhi_clear"
2879 [(set (match_operand:HI 0 "nonimmediate_operand" "=r,Q,To")
2880 (and:HI (match_operand:HI 1 "nonimmediate_operand" "0,0,0")
2882 "!side_effects_p (operands[0])"
2884 [(set_attr "slottable" "yes,yes,no")
2885 (set_attr "cc" "none")])
2887 ;; Catch-all andhi3 pattern.
2889 (define_insn "*expanded_andhi_non_v32"
2890 [(set (match_operand:HI 0 "register_operand" "=r,r,r, r,r,r,r")
2891 (and:HI (match_operand:HI 1 "register_operand" "%0,0,0, 0,0,0,r")
2892 (match_operand:HI 2 "general_operand" "I,r,Q>,L,O,g,!To")))]
2894 ;; Sidenote: the tightening from "general_operand" to
2895 ;; "register_operand" for operand 1 actually increased the register
2896 ;; pressure (worse code). That will hopefully change with an
2897 ;; improved reload pass.
2908 [(set_attr "slottable" "yes,yes,yes,no,yes,no,no")
2909 (set_attr "cc" "clobber,normal,normal,normal,clobber,normal,normal")])
2911 (define_insn "*expanded_andhi_v32"
2912 [(set (match_operand:HI 0 "register_operand" "=r,r,r,r,r,r")
2913 (and:HI (match_operand:HI 1 "register_operand" "%0,0,0,0,0,0")
2914 (match_operand:HI 2 "general_operand" "I,r,Q>,L,O,g")))]
2923 [(set_attr "slottable" "yes,yes,yes,no,yes,no")
2924 (set_attr "cc" "clobber,noov32,noov32,noov32,clobber,noov32")])
2926 ;; A strict_low_part pattern.
2928 ;; Note the use of (match_dup 0) for the first operand of the operation
2929 ;; here. Reload can't handle an operand pair where one is read-write
2930 ;; and must match a read, like in:
2932 ;; (set (strict_low_part
2933 ;; (subreg:QI (reg/v:SI 0 r0 [orig:36 data ] [36]) 0))
2935 ;; (subreg:QI (reg:SI 15 acr [orig:27 D.7531 ] [27]) 0)
2936 ;; (const_int -64 [0xf..fc0]))) x.c:126 147 {*andqi_lowpart_v32}
2938 ;; In theory, it could reload this as a movstrictqi of the register
2939 ;; operand at the and:QI to the destination register and change the
2940 ;; and:QI operand to the same as the read-write output operand and the
2941 ;; result would be recognized, but it doesn't recognize that's a valid
2942 ;; reload for a strict_low_part-destination; it just sees a "+" at the
2943 ;; destination constraints. Better than adding complexity to reload is
2944 ;; to follow the lead of m68k (see comment that begins with "These insns
2945 ;; must use MATCH_DUP") since prehistoric times and make it just a
2946 ;; match_dup. FIXME: a sanity-check in gen* to refuse an insn with
2947 ;; input-constraints matching input-output-constraints, e.g. "+r" <- "0".
2949 (define_insn "*andhi_lowpart_non_v32"
2950 [(set (strict_low_part
2951 (match_operand:HI 0 "register_operand" "+r,r,r"))
2952 (and:HI (match_dup 0)
2953 (match_operand:HI 1 "general_operand" "r,Q>,g")))]
2959 [(set_attr "slottable" "yes,yes,no")])
2961 (define_insn "*andhi_lowpart_v32"
2962 [(set (strict_low_part
2963 (match_operand:HI 0 "register_operand" "+r,r,r"))
2964 (and:HI (match_dup 0)
2965 (match_operand:HI 1 "general_operand" "r,Q>,g")))]
2971 [(set_attr "slottable" "yes,yes,no")
2972 (set_attr "cc" "noov32")])
2974 (define_expand "andqi3"
2975 [(set (match_operand:QI 0 "register_operand")
2976 (and:QI (match_operand:QI 1 "register_operand")
2977 (match_operand:QI 2 "general_operand")))]
2981 (define_insn "*andqi3_non_v32"
2982 [(set (match_operand:QI 0 "register_operand" "=r,r,r, r,r,r")
2983 (and:QI (match_operand:QI 1 "register_operand" "%0,0,0, 0,0,r")
2984 (match_operand:QI 2 "general_operand" "I,r,Q>,O,g,!To")))]
2993 [(set_attr "slottable" "yes,yes,yes,yes,no,no")
2994 (set_attr "cc" "clobber,normal,normal,clobber,normal,normal")])
2996 (define_insn "*andqi3_v32"
2997 [(set (match_operand:QI 0 "register_operand" "=r,r,r,r,r")
2998 (and:QI (match_operand:QI 1 "register_operand" "%0,0,0,0,0")
2999 (match_operand:QI 2 "general_operand" "I,r,Q>,O,g")))]
3007 [(set_attr "slottable" "yes,yes,yes,yes,no")
3008 (set_attr "cc" "clobber,noov32,noov32,clobber,noov32")])
3010 (define_insn "*andqi_lowpart_non_v32"
3011 [(set (strict_low_part
3012 (match_operand:QI 0 "register_operand" "+r,r,r"))
3013 (and:QI (match_dup 0)
3014 (match_operand:QI 1 "general_operand" "r,Q>,g")))]
3020 [(set_attr "slottable" "yes,yes,no")])
3022 (define_insn "*andqi_lowpart_v32"
3023 [(set (strict_low_part
3024 (match_operand:QI 0 "register_operand" "+r,r,r"))
3025 (and:QI (match_dup 0)
3026 (match_operand:QI 1 "general_operand" "r,Q>,g")))]
3032 [(set_attr "slottable" "yes,yes,no")
3033 (set_attr "cc" "noov32")])
3037 ;; Same comment as anddi3 applies here - no need for such a pattern.
3039 ;; It seems there's no need to jump through hoops to get good code such as
3042 (define_expand "ior<mode>3"
3043 [(set (match_operand:BWD 0 "register_operand")
3044 (ior:BWD (match_operand:BWD 1 "register_operand")
3045 (match_operand:BWD 2 "general_operand")))]
3049 (define_insn "*iorsi3_non_v32"
3050 [(set (match_operand:SI 0 "register_operand" "=r,r,r, r,r,r")
3051 (ior:SI (match_operand:SI 1 "register_operand" "%0,0,0, 0,0,r")
3052 (match_operand:SI 2 "general_operand" "I, r,Q>,n,g,!To")))]
3061 [(set_attr "slottable" "yes,yes,yes,no,no,no")
3062 (set_attr "cc" "normal,normal,normal,clobber,normal,normal")])
3064 (define_insn "*iorsi3_v32"
3065 [(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r")
3066 (ior:SI (match_operand:SI 1 "register_operand" "%0,0,0,0,0")
3067 (match_operand:SI 2 "general_operand" "I,r,Q>,n,g")))]
3075 [(set_attr "slottable" "yes,yes,yes,no,no")
3076 (set_attr "cc" "noov32,noov32,noov32,clobber,noov32")])
3078 (define_insn "*iorhi3_non_v32"
3079 [(set (match_operand:HI 0 "register_operand" "=r,r,r, r,r,r,r")
3080 (ior:HI (match_operand:HI 1 "register_operand" "%0,0,0, 0,0,0,r")
3081 (match_operand:HI 2 "general_operand" "I,r,Q>,L,O,g,!To")))]
3091 [(set_attr "slottable" "yes,yes,yes,no,yes,no,no")
3092 (set_attr "cc" "clobber,normal,normal,normal,clobber,normal,normal")])
3094 (define_insn "*iorhi3_v32"
3095 [(set (match_operand:HI 0 "register_operand" "=r,r,r,r,r,r")
3096 (ior:HI (match_operand:HI 1 "register_operand" "%0,0,0,0,0,0")
3097 (match_operand:HI 2 "general_operand" "I,r,Q>,L,O,g")))]
3106 [(set_attr "slottable" "yes,yes,yes,no,yes,no")
3107 (set_attr "cc" "clobber,noov32,noov32,noov32,clobber,noov32")])
3109 (define_insn "*iorqi3_non_v32"
3110 [(set (match_operand:QI 0 "register_operand" "=r,r,r, r,r,r")
3111 (ior:QI (match_operand:QI 1 "register_operand" "%0,0,0, 0,0,r")
3112 (match_operand:QI 2 "general_operand" "I,r,Q>,O,g,!To")))]
3121 [(set_attr "slottable" "yes,yes,yes,yes,no,no")
3122 (set_attr "cc" "clobber,normal,normal,clobber,normal,normal")])
3124 (define_insn "*iorqi3_v32"
3125 [(set (match_operand:QI 0 "register_operand" "=r,r,r,r,r")
3126 (ior:QI (match_operand:QI 1 "register_operand" "%0,0,0,0,0")
3127 (match_operand:QI 2 "general_operand" "I,r,Q>,O,g")))]
3135 [(set_attr "slottable" "yes,yes,yes,yes,no")
3136 (set_attr "cc" "clobber,noov32,noov32,clobber,noov32")])
3140 ;; See comment about "anddi3" for xordi3 - no need for such a pattern.
3141 ;; FIXME: Do we really need the shorter variants?
3143 (define_insn "xorsi3"
3144 [(set (match_operand:SI 0 "register_operand" "=r")
3145 (xor:SI (match_operand:SI 1 "register_operand" "%0")
3146 (match_operand:SI 2 "register_operand" "r")))]
3149 [(set_attr "slottable" "yes")
3150 (set_attr "cc" "noov32")])
3152 (define_insn "xor<mode>3"
3153 [(set (match_operand:BW 0 "register_operand" "=r")
3154 (xor:BW (match_operand:BW 1 "register_operand" "%0")
3155 (match_operand:BW 2 "register_operand" "r")))]
3158 [(set_attr "slottable" "yes")
3159 (set_attr "cc" "clobber")])
3163 ;; Questionable use, here mostly as a (slightly usable) define_expand
3166 (define_expand "negsf2"
3169 (parallel [(set (match_operand:SF 0 "register_operand" "=r")
3170 (neg:SF (match_operand:SF 1
3171 "register_operand" "0")))
3172 (use (match_dup 2))])]
3175 operands[2] = gen_reg_rtx (SImode);
3176 operands[3] = GEN_INT (1 << 31);
3179 (define_insn "*expanded_negsf2"
3180 [(set (match_operand:SF 0 "register_operand" "=r")
3181 (neg:SF (match_operand:SF 1 "register_operand" "0")))
3182 (use (match_operand:SI 2 "register_operand" "r"))]
3185 [(set_attr "slottable" "yes")])
3187 ;; No "negdi2" although we could make one up that may be faster than
3188 ;; the one in libgcc.
3190 (define_insn "neg<mode>2"
3191 [(set (match_operand:BWD 0 "register_operand" "=r")
3192 (neg:BWD (match_operand:BWD 1 "register_operand" "r")))]
3195 [(set_attr "slottable" "yes")])
3199 ;; See comment on anddi3 - no need for a DImode pattern.
3200 ;; See also xor comment.
3202 (define_insn "one_cmplsi2"
3203 [(set (match_operand:SI 0 "register_operand" "=r")
3204 (not:SI (match_operand:SI 1 "register_operand" "0")))]
3207 [(set_attr "slottable" "yes")
3208 (set_attr "cc" "noov32")])
3210 (define_insn "one_cmpl<mode>2"
3211 [(set (match_operand:BW 0 "register_operand" "=r")
3212 (not:BW (match_operand:BW 1 "register_operand" "0")))]
3215 [(set_attr "slottable" "yes")
3216 (set_attr "cc" "clobber")])
3218 ;; Arithmetic/Logical shift right (and SI left).
3220 (define_insn "<shlr>si3"
3221 [(set (match_operand:SI 0 "register_operand" "=r")
3222 (shift:SI (match_operand:SI 1 "register_operand" "0")
3223 (match_operand:SI 2 "nonmemory_operand" "Kcr")))]
3226 if (REG_S_P (operands[2]))
3227 return "<slr>.d %2,%0";
3229 return "<slr>q %2,%0";
3231 [(set_attr "slottable" "yes")
3232 (set_attr "cc" "noov32")])
3234 ;; Since gcc gets lost, and forgets to zero-extend the source (or mask
3235 ;; the destination) when it changes shifts of lower modes into SImode,
3236 ;; it is better to make these expands an anonymous patterns instead of
3237 ;; the more correct define_insns. This occurs when gcc thinks that is
3238 ;; is better to widen to SImode and use immediate shift count.
3240 ;; FIXME: Is this legacy or still true for gcc >= 2.7.2?
3242 ;; FIXME: Can't parametrize sign_extend and zero_extend (before
3243 ;; mentioning "shiftrt"), so we need two patterns.
3244 (define_expand "ashr<mode>3"
3246 (sign_extend:SI (match_operand:BW 1 "nonimmediate_operand" "")))
3248 (zero_extend:SI (match_operand:BW 2 "nonimmediate_operand" "")))
3249 (set (match_dup 5) (ashiftrt:SI (match_dup 3) (match_dup 4)))
3250 (set (match_operand:BW 0 "general_operand" "")
3251 (subreg:BW (match_dup 5) 0))]
3256 for (i = 3; i < 6; i++)
3257 operands[i] = gen_reg_rtx (SImode);
3260 (define_expand "lshr<mode>3"
3262 (zero_extend:SI (match_operand:BW 1 "nonimmediate_operand" "")))
3264 (zero_extend:SI (match_operand:BW 2 "nonimmediate_operand" "")))
3265 (set (match_dup 5) (lshiftrt:SI (match_dup 3) (match_dup 4)))
3266 (set (match_operand:BW 0 "general_operand" "")
3267 (subreg:BW (match_dup 5) 0))]
3272 for (i = 3; i < 6; i++)
3273 operands[i] = gen_reg_rtx (SImode);
3276 (define_insn "*expanded_<shlr><mode>"
3277 [(set (match_operand:BW 0 "register_operand" "=r")
3278 (shiftrt:BW (match_operand:BW 1 "register_operand" "0")
3279 (match_operand:BW 2 "register_operand" "r")))]
3282 [(set_attr "slottable" "yes")
3283 (set_attr "cc" "noov32")])
3285 (define_insn "*<shlr><mode>_lowpart"
3286 [(set (strict_low_part (match_operand:BW 0 "register_operand" "+r"))
3287 (shiftrt:BW (match_dup 0)
3288 (match_operand:BW 1 "register_operand" "r")))]
3291 [(set_attr "slottable" "yes")
3292 (set_attr "cc" "noov32")])
3294 ;; Arithmetic/logical shift left.
3296 ;; For narrower modes than SI, we can use lslq although it makes cc
3297 ;; unusable. The win is that we do not have to reload the shift-count
3300 (define_insn "ashl<mode>3"
3301 [(set (match_operand:BW 0 "register_operand" "=r,r")
3302 (ashift:BW (match_operand:BW 1 "register_operand" "0,0")
3303 (match_operand:BW 2 "nonmemory_operand" "r,Kc")))]
3307 (CONST_INT_P (operands[2]) && INTVAL (operands[2]) > <nbitsm1>)
3309 : (CONSTANT_P (operands[2])
3310 ? "lslq %2,%0" : "lsl<m> %2,%0");
3312 [(set_attr "slottable" "yes")
3313 (set_attr "cc" "noov32,clobber")])
3315 ;; A strict_low_part matcher.
3317 (define_insn "*ashl<mode>_lowpart"
3318 [(set (strict_low_part (match_operand:BW 0 "register_operand" "+r"))
3319 (ashift:BW (match_dup 0)
3320 (match_operand:HI 1 "register_operand" "r")))]
3323 [(set_attr "slottable" "yes")
3324 (set_attr "cc" "noov32")])
3326 ;; Various strange insns that gcc likes.
3328 ;; Fortunately, it is simple to construct an abssf (although it may not
3329 ;; be very much used in practice).
3331 (define_insn "abssf2"
3332 [(set (match_operand:SF 0 "register_operand" "=r")
3333 (abs:SF (match_operand:SF 1 "register_operand" "0")))]
3335 "lslq 1,%0\;lsrq 1,%0")
3337 (define_insn "abssi2"
3338 [(set (match_operand:SI 0 "register_operand" "=r")
3339 (abs:SI (match_operand:SI 1 "register_operand" "r")))]
3342 [(set_attr "slottable" "yes")
3343 (set_attr "cc" "noov32")])
3345 ;; FIXME: GCC should be able to do these expansions itself.
3347 (define_expand "abs<mode>2"
3349 (sign_extend:SI (match_operand:BW 1 "general_operand" "")))
3350 (set (match_dup 3) (abs:SI (match_dup 2)))
3351 (set (match_operand:BW 0 "register_operand" "")
3352 (subreg:BW (match_dup 3) 0))]
3354 "operands[2] = gen_reg_rtx (SImode); operands[3] = gen_reg_rtx (SImode);")
3356 (define_insn "clzsi2"
3357 [(set (match_operand:SI 0 "register_operand" "=r")
3358 (clz:SI (match_operand:SI 1 "register_operand" "r")))]
3361 [(set_attr "slottable" "yes")
3362 (set_attr "cc" "noov32")])
3364 (define_insn "bswapsi2"
3365 [(set (match_operand:SI 0 "register_operand" "=r")
3366 (bswap:SI (match_operand:SI 1 "register_operand" "0")))]
3369 [(set_attr "slottable" "yes")
3370 (set_attr "cc" "noov32")])
3372 ;; This instruction swaps all bits in a register.
3373 ;; That means that the most significant bit is put in the place
3374 ;; of the least significant bit, and so on.
3376 (define_insn "cris_swap_bits"
3377 [(set (match_operand:SI 0 "register_operand" "=r")
3378 (unspec:SI [(match_operand:SI 1 "register_operand" "0")]
3379 CRIS_UNSPEC_SWAP_BITS))]
3382 [(set_attr "slottable" "yes")
3383 (set_attr "cc" "noov32")])
3385 ;; Implement ctz using two instructions, one for bit swap and one for clz.
3386 ;; Defines a scratch register to avoid clobbering input.
3388 (define_expand "ctzsi2"
3390 (match_operand:SI 1 "register_operand"))
3392 (unspec:SI [(match_dup 2)] CRIS_UNSPEC_SWAP_BITS))
3393 (set (match_operand:SI 0 "register_operand")
3394 (clz:SI (match_dup 2)))]
3395 "TARGET_HAS_LZ && TARGET_HAS_SWAP"
3396 "operands[2] = gen_reg_rtx (SImode);")
3398 ;; Bound-insn. Defined to be the same as an unsigned minimum, which is an
3399 ;; operation supported by gcc. Used in casesi, but used now and then in
3402 (define_expand "uminsi3"
3403 [(set (match_operand:SI 0 "register_operand" "")
3404 (umin:SI (match_operand:SI 1 "register_operand" "")
3405 (match_operand:SI 2 "general_operand" "")))]
3408 if (MEM_P (operands[2]) && TARGET_V32)
3409 operands[2] = force_reg (SImode, operands[2]);
3412 (define_insn "*uminsi3_non_v32"
3413 [(set (match_operand:SI 0 "register_operand" "=r,r, r,r")
3414 (umin:SI (match_operand:SI 1 "register_operand" "%0,0, 0,r")
3415 (match_operand:SI 2 "general_operand" "r,Q>,g,!To")))]
3418 if (CONST_INT_P (operands[2]))
3420 /* Constant operands are zero-extended, so only 32-bit operands
3422 if (INTVAL (operands[2]) >= 0)
3424 if (INTVAL (operands[2]) < 256)
3425 return "bound.b %2,%0";
3427 if (INTVAL (operands[2]) < 65536)
3428 return "bound.w %2,%0";
3431 else if (which_alternative == 3)
3432 return "bound.d %2,%1,%0";
3434 return "bound.d %2,%0";
3436 [(set_attr "slottable" "yes,yes,no,no")])
3438 (define_insn "*uminsi3_v32"
3439 [(set (match_operand:SI 0 "register_operand" "=r,r")
3440 (umin:SI (match_operand:SI 1 "register_operand" "%0,0")
3441 (match_operand:SI 2 "nonmemory_operand" "r,i")))]
3444 if (GET_CODE (operands[2]) == CONST_INT)
3446 /* Constant operands are zero-extended, so only 32-bit operands
3448 if (INTVAL (operands[2]) >= 0)
3450 if (INTVAL (operands[2]) < 256)
3451 return "bound.b %2,%0";
3453 if (INTVAL (operands[2]) < 65536)
3454 return "bound.w %2,%0";
3458 return "bound.d %2,%0";
3460 [(set_attr "slottable" "yes,no")])
3462 ;; Jump and branch insns.
3466 (label_ref (match_operand 0 "" "")))]
3469 [(set_attr "slottable" "has_slot")])
3471 ;; Testcase gcc.c-torture/compile/991213-3.c fails if we allow a constant
3472 ;; here, since the insn is not recognized as an indirect jump by
3473 ;; jmp_uses_reg_or_mem used by computed_jump_p. Perhaps it is a kludge to
3474 ;; change from general_operand to nonimmediate_operand (at least the docs
3475 ;; should be changed), but then again the pattern is called indirect_jump.
3476 (define_expand "indirect_jump"
3477 [(set (pc) (match_operand:SI 0 "nonimmediate_operand"))]
3480 if (TARGET_V32 && MEM_P (operands[0]))
3481 operands[0] = force_reg (SImode, operands[0]);
3484 (define_insn "*indirect_jump_non_v32"
3485 [(set (pc) (match_operand:SI 0 "nonimmediate_operand" "rm"))]
3489 (define_insn "*indirect_jump_v32"
3490 [(set (pc) (match_operand:SI 0 "register_operand" "r"))]
3493 [(set_attr "slottable" "has_slot")])
3495 ;; Return insn. Used whenever the epilogue is very simple; if it is only
3496 ;; a single ret or jump [sp+]. No allocated stack space or saved
3497 ;; registers are allowed.
3498 ;; Note that for this pattern, although named, it is ok to check the
3499 ;; context of the insn in the test, not only compiler switches.
3501 (define_expand "return"
3503 "cris_simple_epilogue ()"
3504 "cris_expand_return (cris_return_address_on_stack ()); DONE;")
3506 (define_insn "*return_expanded"
3510 return cris_return_address_on_stack_for_return ()
3511 ? "jump [$sp+]" : "ret%#";
3513 [(set (attr "slottable")
3515 (match_test "cris_return_address_on_stack_for_return ()")
3517 (const_string "has_return_slot")))])
3519 (define_expand "prologue"
3521 "TARGET_PROLOGUE_EPILOGUE"
3522 "cris_expand_prologue (); DONE;")
3524 ;; Note that the (return) from the expander itself is always the last
3525 ;; insn in the epilogue.
3526 (define_expand "epilogue"
3528 "TARGET_PROLOGUE_EPILOGUE"
3529 "cris_expand_epilogue (); DONE;")
3531 ;; Conditional branches.
3533 (define_expand "cbranch<mode>4"
3534 [(set (cc0) (compare
3535 (match_operand:BWD 1 "nonimmediate_operand")
3536 (match_operand:BWD 2 "general_operand")))
3538 (if_then_else (match_operator 0 "ordered_comparison_operator"
3539 [(cc0) (const_int 0)])
3540 (label_ref (match_operand 3 "" ""))
3545 (define_expand "cbranchdi4"
3547 (compare (match_operand:DI 1 "nonimmediate_operand" "")
3548 (match_operand:DI 2 "general_operand" "")))
3550 (if_then_else (match_operator 0 "ordered_comparison_operator"
3551 [(cc0) (const_int 0)])
3552 (label_ref (match_operand 3 "" ""))
3556 if (TARGET_V32 && !REG_P (operands[1]))
3557 operands[1] = force_reg (DImode, operands[1]);
3558 if (TARGET_V32 && MEM_P (operands[2]))
3559 operands[2] = force_reg (DImode, operands[2]);
3563 ;; We suffer from the same overflow-bit-gets-in-the-way problem as
3564 ;; e.g. m68k, so we have to check if overflow bit is set on all "signed"
3567 (define_insn "b<ncond:code>"
3569 (if_then_else (ncond (cc0)
3571 (label_ref (match_operand 0 "" ""))
3575 [(set_attr "slottable" "has_slot")])
3577 (define_insn "b<ocond:code>"
3579 (if_then_else (ocond (cc0)
3581 (label_ref (match_operand 0 "" ""))
3586 (cc_prev_status.flags & CC_NO_OVERFLOW)
3587 ? 0 : "b<CC> %l0%#";
3589 [(set_attr "slottable" "has_slot")])
3591 (define_insn "b<rcond:code>"
3593 (if_then_else (rcond (cc0)
3595 (label_ref (match_operand 0 "" ""))
3600 (cc_prev_status.flags & CC_NO_OVERFLOW)
3601 ? "b<oCC> %l0%#" : "b<CC> %l0%#";
3603 [(set_attr "slottable" "has_slot")])
3605 ;; Reversed anonymous patterns to the ones above, as mandated.
3607 (define_insn "*b<ncond:code>_reversed"
3609 (if_then_else (ncond (cc0)
3612 (label_ref (match_operand 0 "" ""))))]
3615 [(set_attr "slottable" "has_slot")])
3617 (define_insn "*b<ocond:code>_reversed"
3619 (if_then_else (ocond (cc0)
3622 (label_ref (match_operand 0 "" ""))))]
3626 (cc_prev_status.flags & CC_NO_OVERFLOW)
3627 ? 0 : "b<rCC> %l0%#";
3629 [(set_attr "slottable" "has_slot")])
3631 (define_insn "*b<rcond:code>_reversed"
3633 (if_then_else (rcond (cc0)
3636 (label_ref (match_operand 0 "" ""))))]
3640 (cc_prev_status.flags & CC_NO_OVERFLOW)
3641 ? "b<roCC> %l0%#" : "b<rCC> %l0%#";
3643 [(set_attr "slottable" "has_slot")])
3645 ;; Set on condition: sCC.
3647 (define_expand "cstoredi4"
3648 [(set (cc0) (compare
3649 (match_operand:DI 2 "nonimmediate_operand")
3650 (match_operand:DI 3 "general_operand")))
3651 (set (match_operand:SI 0 "register_operand")
3652 (match_operator:SI 1 "ordered_comparison_operator"
3653 [(cc0) (const_int 0)]))]
3656 if (TARGET_V32 && !REG_P (operands[2]))
3657 operands[2] = force_reg (DImode, operands[2]);
3658 if (TARGET_V32 && MEM_P (operands[3]))
3659 operands[3] = force_reg (DImode, operands[3]);
3662 (define_expand "cstore<mode>4"
3663 [(set (cc0) (compare
3664 (match_operand:BWD 2 "nonimmediate_operand")
3665 (match_operand:BWD 3 "general_operand")))
3666 (set (match_operand:SI 0 "register_operand")
3667 (match_operator:SI 1 "ordered_comparison_operator"
3668 [(cc0) (const_int 0)]))]
3672 ;; Like bCC, we have to check the overflow bit for
3673 ;; signed conditions.
3675 (define_insn "s<ncond:code>"
3676 [(set (match_operand:SI 0 "register_operand" "=r")
3677 (ncond:SI (cc0) (const_int 0)))]
3680 [(set_attr "slottable" "yes")
3681 (set_attr "cc" "none")])
3683 (define_insn "s<rcond:code>"
3684 [(set (match_operand:SI 0 "register_operand" "=r")
3685 (rcond:SI (cc0) (const_int 0)))]
3689 (cc_prev_status.flags & CC_NO_OVERFLOW)
3690 ? "s<oCC> %0" : "s<CC> %0";
3692 [(set_attr "slottable" "yes")
3693 (set_attr "cc" "none")])
3695 (define_insn "s<ocond:code>"
3696 [(set (match_operand:SI 0 "register_operand" "=r")
3697 (ocond:SI (cc0) (const_int 0)))]
3701 (cc_prev_status.flags & CC_NO_OVERFLOW)
3704 [(set_attr "slottable" "yes")
3705 (set_attr "cc" "none")])
3709 ;; We need to make these patterns "expand", since the real operand is
3710 ;; hidden in a (mem:QI ) inside operand[0] (call_value: operand[1]),
3711 ;; and cannot be checked if it were a "normal" pattern.
3712 ;; Note that "call" and "call_value" are *always* called with a
3713 ;; mem-operand for operand 0 and 1 respective. What happens for combined
3714 ;; instructions is a different issue.
3716 (define_expand "call"
3717 [(parallel [(call (match_operand:QI 0 "cris_mem_call_operand" "")
3718 (match_operand 1 "general_operand" ""))
3719 (clobber (reg:SI CRIS_SRP_REGNUM))])]
3722 gcc_assert (MEM_P (operands[0]));
3724 cris_expand_pic_call_address (&operands[0], &operands[1]);
3726 operands[1] = const0_rtx;
3729 ;; Accept operands for operand 0 in order of preference.
3731 (define_insn "*expanded_call_non_v32"
3732 [(call (mem:QI (match_operand:SI 0 "general_operand" "r,Q>,g"))
3733 (match_operand:SI 1 "cris_call_type_marker" "rM,rM,rM"))
3734 (clobber (reg:SI CRIS_SRP_REGNUM))]
3738 (define_insn "*expanded_call_v32"
3741 (match_operand:SI 0 "cris_nonmemory_operand_or_callable_symbol" "n,r,U,i"))
3742 (match_operand:SI 1 "cris_call_type_marker" "rM,rM,rM,rM"))
3743 (clobber (reg:SI CRIS_SRP_REGNUM))]
3750 [(set_attr "slottable" "has_call_slot")])
3752 ;; Parallel when calculating and reusing address of indirect pointer
3753 ;; with simple offset. (Makes most sense with PIC.) It looks a bit
3754 ;; wrong not to have the clobber last, but that's the way combine
3755 ;; generates it (except it doesn't look into the *inner* mem, so this
3756 ;; just matches a peephole2). FIXME: investigate that.
3757 (define_insn "*expanded_call_side"
3760 (plus:SI (match_operand:SI 0 "cris_bdap_operand" "%r, r,r")
3761 (match_operand:SI 1 "cris_bdap_operand" "r>Rn,r,>Rn"))))
3762 (match_operand:SI 2 "cris_call_type_marker" "rM,rM,rM"))
3763 (clobber (reg:SI CRIS_SRP_REGNUM))
3764 (set (match_operand:SI 3 "register_operand" "=*0,r,r")
3765 (plus:SI (match_dup 0)
3767 ;; Disabled until after reload until we can avoid an output reload for
3768 ;; operand 3 (being forbidden for call insns).
3769 "reload_completed && !TARGET_AVOID_GOTPLT && !TARGET_V32"
3772 (define_expand "call_value"
3773 [(parallel [(set (match_operand 0 "" "")
3774 (call (match_operand:QI 1 "cris_mem_call_operand" "")
3775 (match_operand 2 "" "")))
3776 (clobber (reg:SI CRIS_SRP_REGNUM))])]
3779 gcc_assert (MEM_P (operands[1]));
3781 cris_expand_pic_call_address (&operands[1], &operands[2]);
3783 operands[2] = const0_rtx;
3786 ;; The validity other than "general" of
3787 ;; operand 0 will be checked elsewhere. Accept operands for operand 1 in
3788 ;; order of preference (Q includes r, but r is shorter, faster).
3789 ;; We also accept a PLT symbol. We output it as [rPIC+sym:GOTPLT] rather
3790 ;; than requiring getting rPIC + sym:PLT into a register.
3792 (define_insn "*expanded_call_value_non_v32"
3793 [(set (match_operand 0 "nonimmediate_operand" "=g,g,g")
3794 (call (mem:QI (match_operand:SI 1 "general_operand" "r,Q>,g"))
3795 (match_operand:SI 2 "cris_call_type_marker" "rM,rM,rM")))
3796 (clobber (reg:SI CRIS_SRP_REGNUM))]
3799 [(set_attr "cc" "clobber")])
3801 ;; See similar call special-case.
3802 (define_insn "*expanded_call_value_side"
3803 [(set (match_operand 0 "nonimmediate_operand" "=g,g,g")
3807 (plus:SI (match_operand:SI 1 "cris_bdap_operand" "%r, r,r")
3808 (match_operand:SI 2 "cris_bdap_operand" "r>Rn,r,>Rn"))))
3809 (match_operand:SI 3 "cris_call_type_marker" "rM,rM,rM")))
3810 (clobber (reg:SI CRIS_SRP_REGNUM))
3811 (set (match_operand:SI 4 "register_operand" "=*1,r,r")
3812 (plus:SI (match_dup 1)
3814 ;; Disabled until after reload until we can avoid an output reload for
3815 ;; operand 4 (being forbidden for call insns).
3816 "reload_completed && !TARGET_AVOID_GOTPLT && !TARGET_V32"
3818 [(set_attr "cc" "clobber")])
3820 (define_insn "*expanded_call_value_v32"
3822 (match_operand 0 "nonimmediate_operand" "=g,g,g,g")
3825 (match_operand:SI 1 "cris_nonmemory_operand_or_callable_symbol" "n,r,U,i"))
3826 (match_operand:SI 2 "cris_call_type_marker" "rM,rM,rM,rM")))
3827 (clobber (reg:SI 16))]
3834 [(set_attr "cc" "clobber")
3835 (set_attr "slottable" "has_call_slot")])
3837 ;; Used in debugging. No use for the direct pattern; unfilled
3838 ;; delayed-branches are taken care of by other means.
3844 [(set_attr "cc" "none")])
3846 ;; Same as the gdb trap breakpoint, will cause a SIGTRAP for
3847 ;; cris-linux* and crisv32-linux*, as intended. Will work in
3848 ;; freestanding environments with sufficient framework.
3850 [(trap_if (const_int 1) (const_int 8))]
3851 "TARGET_TRAP_USING_BREAK8"
3854 ;; We need to stop accesses to the stack after the memory is
3855 ;; deallocated. Unfortunately, reorg doesn't look at naked clobbers,
3856 ;; e.g. (insn ... (clobber (mem:BLK (stack_pointer_rtx)))) and we don't
3857 ;; want to use a naked (unspec_volatile) as that would stop any
3858 ;; scheduling in the epilogue. Hence we model it as a "real" insn that
3859 ;; sets the memory in an unspecified manner. FIXME: Unfortunately it
3860 ;; still has the effect of an unspec_volatile.
3861 (define_insn "cris_frame_deallocated_barrier"
3862 [(set (mem:BLK (reg:SI CRIS_SP_REGNUM))
3863 (unspec:BLK [(const_int 0)] CRIS_UNSPEC_FRAME_DEALLOC))]
3866 [(set_attr "length" "0")])
3868 ;; We expand on casesi so we can use "bound" and "add offset fetched from
3869 ;; a table to pc" (adds.w [pc+%0.w],pc).
3871 ;; Note: if you change the "parallel" (or add anything after it) in
3872 ;; this expansion, you must change the macro ASM_OUTPUT_CASE_END
3873 ;; accordingly, to add the default case at the end of the jump-table.
3875 (define_expand "cris_casesi_non_v32"
3876 [(set (match_dup 5) (match_operand:SI 0 "general_operand" ""))
3878 (minus:SI (match_dup 5)
3879 (match_operand:SI 1 "const_int_operand" "n")))
3881 (umin:SI (match_dup 6)
3882 (match_operand:SI 2 "const_int_operand" "n")))
3886 (ltu (match_dup 7) (match_dup 2))
3887 (plus:SI (sign_extend:SI
3889 (plus:SI (mult:SI (match_dup 7) (const_int 2))
3892 (label_ref (match_operand 4 "" ""))))
3893 (use (label_ref (match_operand 3 "" "")))])]
3896 operands[2] = plus_constant (SImode, operands[2], 1);
3897 operands[5] = gen_reg_rtx (SImode);
3898 operands[6] = gen_reg_rtx (SImode);
3899 operands[7] = gen_reg_rtx (SImode);
3902 ;; FIXME: Check effect of not JUMP_TABLES_IN_TEXT_SECTION.
3903 (define_expand "cris_casesi_v32"
3904 [(set (match_dup 5) (match_operand:SI 0 "general_operand"))
3906 (minus:SI (match_dup 5)
3907 (match_operand:SI 1 "const_int_operand")))
3909 (umin:SI (match_dup 6)
3910 (match_operand:SI 2 "const_int_operand")))
3911 (set (match_dup 8) (match_dup 11))
3913 (plus:SI (mult:SI (match_dup 7) (const_int 2))
3916 (plus:SI (sign_extend:SI (mem:HI (match_dup 9)))
3921 (ltu (unspec [(const_int 0)] CRIS_UNSPEC_CASESI) (match_dup 2))
3923 (label_ref (match_operand 4 "" ""))))
3924 (use (label_ref (match_dup 3)))])]
3928 rtx xlabel = gen_rtx_LABEL_REF (VOIDmode, operands[3]);
3929 for (i = 5; i <= 10; i++)
3930 operands[i] = gen_reg_rtx (SImode);
3931 operands[2] = plus_constant (SImode, operands[2], 1);
3933 /* Don't forget to decorate labels too, for PIC. */
3934 operands[11] = flag_pic
3935 ? gen_rtx_CONST (Pmode,
3936 gen_rtx_UNSPEC (Pmode, gen_rtvec (1, xlabel),
3941 (define_expand "casesi"
3942 [(match_operand:SI 0 "general_operand")
3943 (match_operand:SI 1 "const_int_operand")
3944 (match_operand:SI 2 "const_int_operand")
3945 (match_operand 3 "" "")
3946 (match_operand 4 "" "")]
3950 emit_insn (gen_cris_casesi_v32 (operands[0], operands[1], operands[2],
3951 operands[3], operands[4]));
3953 emit_insn (gen_cris_casesi_non_v32 (operands[0], operands[1], operands[2],
3954 operands[3], operands[4]));
3958 ;; Split-patterns. Some of them have modes unspecified. This
3959 ;; should always be ok; if for no other reason sparc.md has it as
3962 ;; When register_operand is specified for an operand, we can get a
3963 ;; subreg as well (Axis-990331), so don't just assume that REG_P is true
3964 ;; for a register_operand and that REGNO can be used as is. It is best to
3965 ;; guard with REG_P, unless it is worth it to adjust for the subreg case.
3967 ;; op [rx + 0],ry,rz
3968 ;; The index to rx is optimized into zero, and gone.
3970 ;; First, recognize bound [rx],ry,rz; where [rx] is zero-extended,
3971 ;; and add/sub [rx],ry,rz, with zero or sign-extend on [rx].
3975 ;; Lose if rz=ry or rx=rz.
3976 ;; Call this op-extend-split.
3977 ;; Do not match for V32; the addo and addi shouldn't be split
3981 [(set (match_operand 0 "cris_nonsp_register_operand" "")
3983 4 "cris_operand_extend_operator"
3984 [(match_operand 1 "register_operand" "")
3986 3 "cris_extend_operator"
3987 [(match_operand 2 "memory_operand" "")])]))]
3989 && REG_P (operands[0])
3990 && REG_P (operands[1])
3991 && REGNO (operands[1]) != REGNO (operands[0])
3992 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
3993 && REG_P (XEXP (operands[2], 0))
3994 && REGNO (XEXP (operands[2], 0)) != REGNO (operands[0])"
4000 (match_op_dup 3 [(match_dup 2)])]))]
4003 ;; As op-extend-split, but recognize and split op [rz],ry,rz into
4006 ;; Do this for plus or bound only, being commutative operations, since we
4007 ;; have swapped the operands.
4008 ;; Call this op-extend-split-rx=rz
4011 [(set (match_operand 0 "cris_nonsp_register_operand" "")
4013 4 "cris_plus_or_bound_operator"
4014 [(match_operand 1 "register_operand" "")
4016 3 "cris_extend_operator"
4017 [(match_operand 2 "memory_operand" "")])]))]
4019 && REG_P (operands[0])
4020 && REG_P (operands[1])
4021 && REGNO (operands[1]) != REGNO (operands[0])
4022 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
4023 && REG_P (XEXP (operands[2], 0))
4024 && REGNO (XEXP (operands[2], 0)) == REGNO (operands[0])"
4026 (match_op_dup 3 [(match_dup 2)]))
4033 ;; As the op-extend-split, but swapped operands, and only for
4034 ;; plus or bound, being the commutative extend-operators. FIXME: Why is
4035 ;; this needed? Is it?
4036 ;; Call this op-extend-split-swapped
4039 [(set (match_operand 0 "cris_nonsp_register_operand" "")
4041 4 "cris_plus_or_bound_operator"
4043 3 "cris_extend_operator"
4044 [(match_operand 2 "memory_operand" "")])
4045 (match_operand 1 "register_operand" "")]))]
4047 && REG_P (operands[0])
4048 && REG_P (operands[1])
4049 && REGNO (operands[1]) != REGNO (operands[0])
4050 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
4051 && REG_P (XEXP (operands[2], 0))
4052 && REGNO (XEXP (operands[2], 0)) != REGNO (operands[0])"
4058 (match_op_dup 3 [(match_dup 2)])]))]
4061 ;; As op-extend-split-rx=rz, but swapped operands, only for plus or
4062 ;; bound. Call this op-extend-split-swapped-rx=rz.
4065 [(set (match_operand 0 "cris_nonsp_register_operand" "")
4067 4 "cris_plus_or_bound_operator"
4069 3 "cris_extend_operator"
4070 [(match_operand 2 "memory_operand" "")])
4071 (match_operand 1 "register_operand" "")]))]
4073 && REG_P (operands[0])
4074 && REG_P (operands[1])
4075 && REGNO (operands[1]) != REGNO (operands[0])
4076 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
4077 && REG_P (XEXP (operands[2], 0))
4078 && REGNO (XEXP (operands[2], 0)) == REGNO (operands[0])"
4080 (match_op_dup 3 [(match_dup 2)]))
4087 ;; As op-extend-split, but the mem operand is not extended.
4089 ;; op [rx],ry,rz changed into
4092 ;; lose if ry=rz or rx=rz
4093 ;; Call this op-extend.
4096 [(set (match_operand 0 "cris_nonsp_register_operand" "")
4098 3 "cris_orthogonal_operator"
4099 [(match_operand 1 "register_operand" "")
4100 (match_operand 2 "memory_operand" "")]))]
4102 && REG_P (operands[0])
4103 && REG_P (operands[1])
4104 && REGNO (operands[1]) != REGNO (operands[0])
4105 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
4106 && REG_P (XEXP (operands[2], 0))
4107 && REGNO (XEXP (operands[2], 0)) != REGNO (operands[0])"
4116 ;; As op-extend-split-rx=rz, non-extended.
4117 ;; Call this op-split-rx=rz
4120 [(set (match_operand 0 "cris_nonsp_register_operand" "")
4122 3 "cris_commutative_orth_op"
4123 [(match_operand 2 "memory_operand" "")
4124 (match_operand 1 "register_operand" "")]))]
4126 && REG_P (operands[0])
4127 && REG_P (operands[1])
4128 && REGNO (operands[1]) != REGNO (operands[0])
4129 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
4130 && REG_P (XEXP (operands[2], 0))
4131 && REGNO (XEXP (operands[2], 0)) != REGNO (operands[0])"
4140 ;; As op-extend-split-swapped, nonextended.
4141 ;; Call this op-split-swapped.
4144 [(set (match_operand 0 "cris_nonsp_register_operand" "")
4146 3 "cris_commutative_orth_op"
4147 [(match_operand 1 "register_operand" "")
4148 (match_operand 2 "memory_operand" "")]))]
4150 && REG_P (operands[0]) && REG_P (operands[1])
4151 && REGNO (operands[1]) != REGNO (operands[0])
4152 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
4153 && REG_P (XEXP (operands[2], 0))
4154 && REGNO (XEXP (operands[2], 0)) == REGNO (operands[0])"
4163 ;; As op-extend-split-swapped-rx=rz, non-extended.
4164 ;; Call this op-split-swapped-rx=rz.
4167 [(set (match_operand 0 "cris_nonsp_register_operand" "")
4169 3 "cris_orthogonal_operator"
4170 [(match_operand 2 "memory_operand" "")
4171 (match_operand 1 "register_operand" "")]))]
4173 && REG_P (operands[0]) && REG_P (operands[1])
4174 && REGNO (operands[1]) != REGNO (operands[0])
4175 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
4176 && REG_P (XEXP (operands[2], 0))
4177 && REGNO (XEXP (operands[2], 0)) == REGNO (operands[0])"
4188 ;; Splits for all cases in side-effect insns where (possibly after reload
4189 ;; and register allocation) rx and ry in [rx=ry+i] are equal.
4191 ;; move.S1 [rx=rx+rz.S2],ry
4195 [(set (match_operand 0 "register_operand" "")
4199 (mult:SI (match_operand:SI 1 "register_operand" "")
4200 (match_operand:SI 2 "const_int_operand" ""))
4201 (match_operand:SI 3 "register_operand" ""))]))
4202 (set (match_operand:SI 4 "register_operand" "")
4203 (plus:SI (mult:SI (match_dup 1)
4206 "REG_P (operands[3]) && REG_P (operands[4])
4207 && REGNO (operands[3]) == REGNO (operands[4])"
4208 [(set (match_dup 4) (plus:SI (mult:SI (match_dup 1) (match_dup 2))
4210 (set (match_dup 0) (match_dup 5))]
4211 "operands[5] = replace_equiv_address (operands[6], operands[3]);")
4213 ;; move.S1 [rx=rx+i],ry
4217 [(set (match_operand 0 "register_operand" "")
4220 [(plus:SI (match_operand:SI 1 "cris_bdap_operand" "")
4221 (match_operand:SI 2 "cris_bdap_operand" ""))]))
4222 (set (match_operand:SI 3 "register_operand" "")
4223 (plus:SI (match_dup 1)
4225 "(rtx_equal_p (operands[3], operands[1])
4226 || rtx_equal_p (operands[3], operands[2]))"
4227 [(set (match_dup 3) (plus:SI (match_dup 1) (match_dup 2)))
4228 (set (match_dup 0) (match_dup 4))]
4230 operands[4] = replace_equiv_address (operands[5], operands[3]);
4231 cris_order_for_addsi3 (operands, 1);
4234 ;; move.S1 ry,[rx=rx+rz.S2]
4238 [(set (match_operator
4241 (mult:SI (match_operand:SI 0 "register_operand" "")
4242 (match_operand:SI 1 "const_int_operand" ""))
4243 (match_operand:SI 2 "register_operand" ""))])
4244 (match_operand 3 "register_operand" ""))
4245 (set (match_operand:SI 4 "register_operand" "")
4246 (plus:SI (mult:SI (match_dup 0)
4249 "REG_P (operands[2]) && REG_P (operands[4])
4250 && REGNO (operands[4]) == REGNO (operands[2])"
4251 [(set (match_dup 4) (plus:SI (mult:SI (match_dup 0) (match_dup 1))
4253 (set (match_dup 5) (match_dup 3))]
4254 "operands[5] = replace_equiv_address (operands[6], operands[4]);")
4256 ;; move.S1 ry,[rx=rx+i]
4260 [(set (match_operator
4262 [(plus:SI (match_operand:SI 0 "cris_bdap_operand" "")
4263 (match_operand:SI 1 "cris_bdap_operand" ""))])
4264 (match_operand 2 "register_operand" ""))
4265 (set (match_operand:SI 3 "register_operand" "")
4266 (plus:SI (match_dup 0)
4268 "(rtx_equal_p (operands[3], operands[0])
4269 || rtx_equal_p (operands[3], operands[1]))"
4270 [(set (match_dup 3) (plus:SI (match_dup 0) (match_dup 1)))
4271 (set (match_dup 5) (match_dup 2))]
4273 operands[5] = replace_equiv_address (operands[6], operands[3]);
4274 cris_order_for_addsi3 (operands, 0);
4277 ;; clear.[bwd] [rx=rx+rz.S2]
4281 [(set (mem:BWD (plus:SI
4282 (mult:SI (match_operand:SI 0 "register_operand" "")
4283 (match_operand:SI 1 "const_int_operand" ""))
4284 (match_operand:SI 2 "register_operand" "")))
4286 (set (match_operand:SI 3 "register_operand" "")
4287 (plus:SI (mult:SI (match_dup 0)
4290 "REG_P (operands[2]) && REG_P (operands[3])
4291 && REGNO (operands[3]) == REGNO (operands[2])"
4292 [(set (match_dup 3) (plus:SI (mult:SI (match_dup 0) (match_dup 1))
4294 (set (mem:BWD (match_dup 3)) (const_int 0))]
4297 ;; clear.[bwd] [rx=rx+i]
4302 (plus:SI (match_operand:SI 0 "cris_bdap_operand" "")
4303 (match_operand:SI 1 "cris_bdap_operand" "")))
4305 (set (match_operand:SI 2 "register_operand" "")
4306 (plus:SI (match_dup 0)
4308 "(rtx_equal_p (operands[0], operands[2])
4309 || rtx_equal_p (operands[2], operands[1]))"
4310 [(set (match_dup 2) (plus:SI (match_dup 0) (match_dup 1)))
4311 (set (mem:BWD (match_dup 2)) (const_int 0))]
4312 "cris_order_for_addsi3 (operands, 0);")
4314 ;; mov(s|u).S1 [rx=rx+rz.S2],ry
4318 [(set (match_operand 0 "register_operand" "")
4320 5 "cris_extend_operator"
4322 (mult:SI (match_operand:SI 1 "register_operand" "")
4323 (match_operand:SI 2 "const_int_operand" ""))
4324 (match_operand:SI 3 "register_operand" "")))]))
4325 (set (match_operand:SI 4 "register_operand" "")
4326 (plus:SI (mult:SI (match_dup 1)
4329 "REG_P (operands[3])
4330 && REG_P (operands[4])
4331 && REGNO (operands[3]) == REGNO (operands[4])"
4332 [(set (match_dup 4) (plus:SI (mult:SI (match_dup 1) (match_dup 2))
4334 (set (match_dup 0) (match_op_dup 5 [(match_dup 6)]))]
4335 "operands[6] = replace_equiv_address (XEXP (operands[5], 0), operands[4]);")
4337 ;; mov(s|u).S1 [rx=rx+i],ry
4341 [(set (match_operand 0 "register_operand" "")
4343 4 "cris_extend_operator"
4345 (match_operand:SI 1 "cris_bdap_operand" "")
4346 (match_operand:SI 2 "cris_bdap_operand" "")))]))
4347 (set (match_operand:SI 3 "register_operand" "")
4348 (plus:SI (match_dup 1)
4350 "(rtx_equal_p (operands[1], operands[3])
4351 || rtx_equal_p (operands[2], operands[3]))"
4352 [(set (match_dup 3) (plus:SI (match_dup 1) (match_dup 2)))
4353 (set (match_dup 0) (match_op_dup 4 [(match_dup 5)]))]
4355 operands[5] = replace_equiv_address (XEXP (operands[4], 0), operands[3]);
4356 cris_order_for_addsi3 (operands, 1);
4359 ;; op.S1 [rx=rx+i],ry
4363 [(set (match_operand 0 "register_operand" "")
4365 5 "cris_orthogonal_operator"
4366 [(match_operand 1 "register_operand" "")
4368 (match_operand:SI 2 "cris_bdap_operand" "")
4369 (match_operand:SI 3 "cris_bdap_operand" "")))]))
4370 (set (match_operand:SI 4 "register_operand" "")
4371 (plus:SI (match_dup 2)
4373 "(rtx_equal_p (operands[4], operands[2])
4374 || rtx_equal_p (operands[4], operands[3]))"
4375 [(set (match_dup 4) (plus:SI (match_dup 2) (match_dup 3)))
4376 (set (match_dup 0) (match_op_dup 5 [(match_dup 1) (match_dup 6)]))]
4378 operands[6] = replace_equiv_address (XEXP (operands[5], 1), operands[4]);
4379 cris_order_for_addsi3 (operands, 2);
4382 ;; op.S1 [rx=rx+rz.S2],ry
4386 [(set (match_operand 0 "register_operand" "")
4388 6 "cris_orthogonal_operator"
4389 [(match_operand 1 "register_operand" "")
4391 (mult:SI (match_operand:SI 2 "register_operand" "")
4392 (match_operand:SI 3 "const_int_operand" ""))
4393 (match_operand:SI 4 "register_operand" "")))]))
4394 (set (match_operand:SI 5 "register_operand" "")
4395 (plus:SI (mult:SI (match_dup 2)
4398 "REG_P (operands[4])
4399 && REG_P (operands[5])
4400 && REGNO (operands[5]) == REGNO (operands[4])"
4401 [(set (match_dup 5) (plus:SI (mult:SI (match_dup 2) (match_dup 3))
4403 (set (match_dup 0) (match_op_dup 6 [(match_dup 1) (match_dup 7)]))]
4404 "operands[7] = replace_equiv_address (XEXP (operands[6], 1), operands[5]);")
4406 ;; op.S1 [rx=rx+rz.S2],ry (swapped)
4410 [(set (match_operand 0 "register_operand" "")
4412 6 "cris_commutative_orth_op"
4414 (mult:SI (match_operand:SI 2 "register_operand" "")
4415 (match_operand:SI 3 "const_int_operand" ""))
4416 (match_operand:SI 4 "register_operand" "")))
4417 (match_operand 1 "register_operand" "")]))
4418 (set (match_operand:SI 5 "register_operand" "")
4419 (plus:SI (mult:SI (match_dup 2)
4422 "REG_P (operands[4])
4423 && REG_P (operands[5])
4424 && REGNO (operands[5]) == REGNO (operands[4])"
4425 [(set (match_dup 5) (plus:SI (mult:SI (match_dup 2) (match_dup 3))
4427 (set (match_dup 0) (match_op_dup 6 [(match_dup 7) (match_dup 1)]))]
4428 "operands[7] = replace_equiv_address (XEXP (operands[6], 0), operands[5]);")
4430 ;; op.S1 [rx=rx+i],ry (swapped)
4434 [(set (match_operand 0 "register_operand" "")
4436 5 "cris_commutative_orth_op"
4438 (plus:SI (match_operand:SI 2 "cris_bdap_operand" "")
4439 (match_operand:SI 3 "cris_bdap_operand" "")))
4440 (match_operand 1 "register_operand" "")]))
4441 (set (match_operand:SI 4 "register_operand" "")
4442 (plus:SI (match_dup 2)
4444 "(rtx_equal_p (operands[4], operands[2])
4445 || rtx_equal_p (operands[4], operands[3]))"
4446 [(set (match_dup 4) (plus:SI (match_dup 2) (match_dup 3)))
4447 (set (match_dup 0) (match_op_dup 5 [(match_dup 6) (match_dup 1)]))]
4449 operands[6] = replace_equiv_address (XEXP (operands[5], 0), operands[4]);
4450 cris_order_for_addsi3 (operands, 2);
4453 ;; op(s|u).S1 [rx=rx+rz.S2],ry
4457 [(set (match_operand 0 "register_operand" "")
4459 6 "cris_operand_extend_operator"
4460 [(match_operand 1 "register_operand" "")
4462 7 "cris_extend_operator"
4464 (mult:SI (match_operand:SI 2 "register_operand" "")
4465 (match_operand:SI 3 "const_int_operand" ""))
4466 (match_operand:SI 4 "register_operand" "")))])]))
4467 (set (match_operand:SI 5 "register_operand" "")
4468 (plus:SI (mult:SI (match_dup 2)
4471 "REG_P (operands[4])
4472 && REG_P (operands[5])
4473 && REGNO (operands[5]) == REGNO (operands[4])"
4474 [(set (match_dup 5) (plus:SI (mult:SI (match_dup 2) (match_dup 3))
4476 (set (match_dup 0) (match_op_dup 6 [(match_dup 1) (match_dup 8)]))]
4477 "operands[8] = gen_rtx_fmt_e (GET_CODE (operands[7]), GET_MODE (operands[7]),
4478 replace_equiv_address (XEXP (operands[7], 0),
4481 ;; op(s|u).S1 [rx=rx+i],ry
4485 [(set (match_operand 0 "register_operand" "")
4487 5 "cris_operand_extend_operator"
4488 [(match_operand 1 "register_operand" "")
4490 6 "cris_extend_operator"
4492 (plus:SI (match_operand:SI 2 "cris_bdap_operand" "")
4493 (match_operand:SI 3 "cris_bdap_operand" "")
4495 (set (match_operand:SI 4 "register_operand" "")
4496 (plus:SI (match_dup 2)
4498 "(rtx_equal_p (operands[4], operands[2])
4499 || rtx_equal_p (operands[4], operands[3]))"
4500 [(set (match_dup 4) (plus:SI (match_dup 2) (match_dup 3)))
4501 (set (match_dup 0) (match_op_dup 5 [(match_dup 1) (match_dup 7)]))]
4503 operands[7] = gen_rtx_fmt_e (GET_CODE (operands[6]), GET_MODE (operands[6]),
4504 replace_equiv_address (XEXP (operands[6], 0),
4506 cris_order_for_addsi3 (operands, 2);
4509 ;; op(s|u).S1 [rx=rx+rz.S2],ry (swapped, plus or bound)
4513 [(set (match_operand 0 "register_operand" "")
4515 7 "cris_plus_or_bound_operator"
4517 6 "cris_extend_operator"
4519 (mult:SI (match_operand:SI 2 "register_operand" "")
4520 (match_operand:SI 3 "const_int_operand" ""))
4521 (match_operand:SI 4 "register_operand" "")))])
4522 (match_operand 1 "register_operand" "")]))
4523 (set (match_operand:SI 5 "register_operand" "")
4524 (plus:SI (mult:SI (match_dup 2)
4527 "REG_P (operands[4]) && REG_P (operands[5])
4528 && REGNO (operands[5]) == REGNO (operands[4])"
4529 [(set (match_dup 5) (plus:SI (mult:SI (match_dup 2) (match_dup 3))
4531 (set (match_dup 0) (match_op_dup 6 [(match_dup 8) (match_dup 1)]))]
4532 "operands[8] = gen_rtx_fmt_e (GET_CODE (operands[6]), GET_MODE (operands[6]),
4533 replace_equiv_address (XEXP (operands[6], 0),
4536 ;; op(s|u).S1 [rx=rx+i],ry (swapped, plus or bound)
4540 [(set (match_operand 0 "register_operand" "")
4542 6 "cris_plus_or_bound_operator"
4544 5 "cris_extend_operator"
4546 (match_operand:SI 2 "cris_bdap_operand" "")
4547 (match_operand:SI 3 "cris_bdap_operand" "")))])
4548 (match_operand 1 "register_operand" "")]))
4549 (set (match_operand:SI 4 "register_operand" "")
4550 (plus:SI (match_dup 2)
4552 "(rtx_equal_p (operands[4], operands[2])
4553 || rtx_equal_p (operands[4], operands[3]))"
4554 [(set (match_dup 4) (plus:SI (match_dup 2) (match_dup 3)))
4555 (set (match_dup 0) (match_op_dup 6 [(match_dup 7) (match_dup 1)]))]
4557 operands[7] = gen_rtx_fmt_e (GET_CODE (operands[5]), GET_MODE (operands[5]),
4558 replace_equiv_address (XEXP (operands[5], 0),
4560 cris_order_for_addsi3 (operands, 2);
4563 ;; Splits for addressing prefixes that have no side-effects, so we can
4564 ;; fill a delay slot. Never split if we lose something, though.
4567 ;; move [indirect_ref],rx
4568 ;; where indirect ref = {const, [r+], [r]}, it costs as much as
4569 ;; move indirect_ref,rx
4571 ;; Take care not to allow indirect_ref = register.
4573 ;; We're not allowed to generate copies of registers with different mode
4574 ;; until after reload; copying pseudos upsets reload. CVS as of
4575 ;; 2001-08-24, unwind-dw2-fde.c, _Unwind_Find_FDE ICE in
4576 ;; cselib_invalidate_regno. Also, don't do this for the stack-pointer,
4577 ;; as we don't want it set temporarily to an invalid value.
4579 (define_split ; indir_to_reg_split
4580 [(set (match_operand 0 "cris_nonsp_register_operand" "")
4581 (match_operand 1 "indirect_operand" ""))]
4583 && REG_P (operands[0])
4584 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
4585 && (MEM_P (XEXP (operands[1], 0)) || CONSTANT_P (XEXP (operands[1], 0)))
4586 && REGNO (operands[0]) < CRIS_LAST_GENERAL_REGISTER"
4587 [(set (match_dup 2) (match_dup 4))
4588 (set (match_dup 0) (match_dup 3))]
4589 "operands[2] = gen_rtx_REG (Pmode, REGNO (operands[0]));
4590 operands[3] = replace_equiv_address (operands[1], operands[2]);
4591 operands[4] = XEXP (operands[1], 0);")
4593 ;; As the above, but MOVS and MOVU.
4596 [(set (match_operand 0 "cris_nonsp_register_operand" "")
4598 4 "cris_extend_operator"
4599 [(match_operand 1 "indirect_operand" "")]))]
4601 && REG_P (operands[0])
4602 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
4603 && (MEM_P (XEXP (operands[1], 0))
4604 || CONSTANT_P (XEXP (operands[1], 0)))"
4605 [(set (match_dup 2) (match_dup 5))
4606 (set (match_dup 0) (match_op_dup 4 [(match_dup 3)]))]
4607 "operands[2] = gen_rtx_REG (Pmode, REGNO (operands[0]));
4608 operands[3] = replace_equiv_address (XEXP (operands[4], 0), operands[2]);
4609 operands[5] = XEXP (operands[1], 0);")
4611 ;; Various peephole optimizations.
4613 ;; Watch out: when you exchange one set of instructions for another, the
4614 ;; condition codes setting must be the same, or you have to CC_INIT or
4615 ;; whatever is appropriate, in the pattern before you emit the
4616 ;; assembly text. This is best done here, not in cris_notice_update_cc,
4617 ;; to keep changes local to their cause.
4619 ;; Do not add patterns that you do not know will be matched.
4620 ;; Please also add a self-contained testcase.
4622 ;; We have trouble with and:s and shifts. Maybe something is broken in
4623 ;; gcc? Or it could just be that bit-field insn expansion is a bit
4624 ;; suboptimal when not having extzv insns.
4625 ;; Testcase for the following four peepholes: gcc.dg/cris-peep2-xsrand.c
4627 (define_peephole2 ; asrandb (peephole casesi+31)
4628 [(set (match_operand:SI 0 "register_operand" "")
4629 (ashiftrt:SI (match_dup 0)
4630 (match_operand:SI 1 "const_int_operand" "")))
4632 (and:SI (match_dup 0)
4633 (match_operand 2 "const_int_operand" "")))]
4634 "INTVAL (operands[2]) > 31
4635 && INTVAL (operands[2]) < 255
4636 && INTVAL (operands[1]) > 23
4637 /* Check that the and-operation enables us to use logical-shift. */
4638 && (INTVAL (operands[2])
4639 & ((HOST_WIDE_INT) -1 << (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) -1 << (32 - INTVAL (operands[1])))) == 0"
4661 [(set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 1)))
4662 (set (match_dup 3) (and:HI (match_dup 3) (match_dup 4)))]
4663 ;; FIXME: CC0 is valid except for the M bit.
4665 operands[3] = gen_rtx_REG (HImode, REGNO (operands[0]));
4666 operands[4] = GEN_INT (trunc_int_for_mode (INTVAL (operands[2]), HImode));
4669 (define_peephole2 ; lsrandb (peephole casesi+33)
4670 [(set (match_operand:SI 0 "register_operand" "")
4671 (lshiftrt:SI (match_dup 0)
4672 (match_operand:SI 1 "const_int_operand" "")))
4674 (and:SI (match_dup 0) (match_operand 2 "const_int_operand" "")))]
4675 "INTVAL (operands[2]) > 31
4676 && INTVAL (operands[2]) < 255
4677 && INTVAL (operands[1]) > 23"
4678 [(set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 1)))
4679 (set (match_dup 3) (and:QI (match_dup 3) (match_dup 4)))]
4680 ;; FIXME: CC0 is valid except for the M bit.
4682 operands[3] = gen_rtx_REG (QImode, REGNO (operands[0]));
4683 operands[4] = GEN_INT (trunc_int_for_mode (INTVAL (operands[2]), QImode));
4686 (define_peephole2 ; lsrandw (peephole casesi+34)
4687 [(set (match_operand:SI 0 "register_operand" "")
4688 (lshiftrt:SI (match_dup 0)
4689 (match_operand:SI 1 "const_int_operand" "")))
4691 (and:SI (match_dup 0) (match_operand 2 "const_int_operand" "")))]
4692 "INTVAL (operands[2]) > 31 && INTVAL (operands[2]) < 65535
4693 && INTVAL (operands[2]) != 255
4694 && INTVAL (operands[1]) > 15"
4695 [(set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 1)))
4696 (set (match_dup 3) (and:HI (match_dup 3) (match_dup 4)))]
4697 ;; FIXME: CC0 is valid except for the M bit.
4699 operands[3] = gen_rtx_REG (HImode, REGNO (operands[0]));
4700 operands[4] = GEN_INT (trunc_int_for_mode (INTVAL (operands[2]), HImode));
4708 ;; move [rx=rx+n],ry
4709 ;; when -128 <= n <= 127.
4710 ;; This will reduce the size of the assembler code for n = [-128..127],
4711 ;; and speed up accordingly. Don't match if the previous insn is
4712 ;; (set rx rz) because that combination is matched by another peephole.
4713 ;; No stable test-case.
4715 (define_peephole2 ; moversideqi (peephole casesi+35)
4716 [(set (match_operand:SI 0 "register_operand" "")
4717 (plus:SI (match_operand:SI 1 "register_operand" "")
4718 (match_operand:SI 2 "const_int_operand" "")))
4719 (set (match_operand 3 "register_operand" "")
4720 (match_operator 4 "cris_mem_op" [(match_dup 0)]))]
4721 "GET_MODE_SIZE (GET_MODE (operands[4])) <= UNITS_PER_WORD
4722 && REGNO (operands[3]) != REGNO (operands[0])
4723 && (cris_base_p (operands[1], true) || cris_base_p (operands[2], true))
4724 && !satisfies_constraint_J (operands[2])
4725 && !satisfies_constraint_N (operands[2])
4726 && (INTVAL (operands[2]) >= -128 && INTVAL (operands[2]) < 128)
4727 && TARGET_SIDE_EFFECT_PREFIXES"
4729 [(set (match_dup 3) (match_dup 5))
4730 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))])]
4731 ;; Checking the previous insn is a bit too awkward for the condition.
4733 rtx_insn *prev = prev_nonnote_insn (curr_insn);
4734 if (prev != NULL_RTX)
4736 rtx set = single_set (prev);
4738 && REG_S_P (SET_DEST (set))
4739 && REGNO (SET_DEST (set)) == REGNO (operands[0])
4740 && REG_S_P (SET_SRC (set)))
4744 = replace_equiv_address (operands[4],
4745 gen_rtx_PLUS (SImode,
4746 operands[1], operands[2]));
4749 ;; Vice versa: move ry,[rx=rx+n]
4751 (define_peephole2 ; movemsideqi (peephole casesi+36)
4752 [(set (match_operand:SI 0 "register_operand" "")
4753 (plus:SI (match_operand:SI 1 "register_operand" "")
4754 (match_operand:SI 2 "const_int_operand" "")))
4755 (set (match_operator 3 "cris_mem_op" [(match_dup 0)])
4756 (match_operand 4 "register_operand" ""))]
4757 "GET_MODE_SIZE (GET_MODE (operands[4])) <= UNITS_PER_WORD
4758 && REGNO (operands[4]) != REGNO (operands[0])
4759 && (cris_base_p (operands[1], true) || cris_base_p (operands[2], true))
4760 && !satisfies_constraint_J (operands[2])
4761 && !satisfies_constraint_N (operands[2])
4762 && (INTVAL (operands[2]) >= -128 && INTVAL (operands[2]) < 128)
4763 && TARGET_SIDE_EFFECT_PREFIXES"
4765 [(set (match_dup 5) (match_dup 4))
4766 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))])]
4768 = replace_equiv_address (operands[3],
4769 gen_rtx_PLUS (SImode,
4770 operands[1], operands[2]));")
4772 ;; As above, change:
4776 ;; op.d [rx=rx+n],ry
4777 ;; Saves when n = [-128..127].
4779 ;; Splitting and joining combinations for side-effect modes are slightly
4780 ;; out of hand. They probably will not save the time they take typing in,
4781 ;; not to mention the bugs that creep in. FIXME: Get rid of as many of
4782 ;; the splits and peepholes as possible.
4783 ;; No stable test-case.
4785 (define_peephole2 ; mover2side (peephole casesi+37)
4786 [(set (match_operand:SI 0 "register_operand" "")
4787 (plus:SI (match_operand:SI 1 "register_operand" "")
4788 (match_operand:SI 2 "const_int_operand" "")))
4789 (set (match_operand 3 "register_operand" "")
4790 (match_operator 4 "cris_orthogonal_operator"
4793 5 "cris_mem_op" [(match_dup 0)])]))]
4794 ;; FIXME: What about DFmode?
4795 ;; Change to GET_MODE_SIZE (GET_MODE (operands[3])) <= UNITS_PER_WORD?
4796 "GET_MODE (operands[3]) != DImode
4797 && REGNO (operands[0]) != REGNO (operands[3])
4798 && !satisfies_constraint_J (operands[2])
4799 && !satisfies_constraint_N (operands[2])
4800 && INTVAL (operands[2]) >= -128
4801 && INTVAL (operands[2]) <= 127
4802 && TARGET_SIDE_EFFECT_PREFIXES"
4804 [(set (match_dup 3) (match_op_dup 4 [(match_dup 3) (match_dup 6)]))
4805 (set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))])]
4807 = replace_equiv_address (operands[5],
4808 gen_rtx_PLUS (SImode,
4809 operands[1], operands[2]));")
4811 ;; Sometimes, for some reason the pattern
4815 ;; will occur. Solve this, and likewise for to-memory.
4816 ;; No stable test-case.
4818 (define_peephole2 ; moverside (peephole casesi+38)
4819 [(set (match_operand:SI 0 "register_operand" "")
4820 (match_operand:SI 1 "cris_bdap_biap_operand" ""))
4822 (plus:SI (match_operand:SI 2 "cris_bdap_biap_operand" "")
4823 (match_operand:SI 3 "cris_bdap_biap_operand" "")))
4824 (set (match_operand 4 "register_operand" "")
4825 (match_operator 5 "cris_mem_op" [(match_dup 0)]))]
4826 "(rtx_equal_p (operands[2], operands[0])
4827 || rtx_equal_p (operands[3], operands[0]))
4828 && cris_side_effect_mode_ok (PLUS, operands, 0,
4829 (REG_S_P (operands[1])
4831 : (rtx_equal_p (operands[2], operands[0])
4833 (! REG_S_P (operands[1])
4835 : (rtx_equal_p (operands[2], operands[0])
4839 [(set (match_dup 4) (match_dup 6))
4840 (set (match_dup 0) (plus:SI (match_dup 7) (match_dup 8)))])]
4843 = rtx_equal_p (operands[2], operands[0]) ? operands[3] : operands[2];
4845 /* Make sure we have canonical RTX so we match the insn pattern -
4846 not a constant in the first operand. We also require the order
4847 (plus reg mem) to match the final pattern. */
4848 if (CRIS_CONSTANT_P (otherop) || MEM_P (otherop))
4850 operands[7] = operands[1];
4851 operands[8] = otherop;
4855 operands[7] = otherop;
4856 operands[8] = operands[1];
4859 = replace_equiv_address (operands[5],
4860 gen_rtx_PLUS (SImode,
4861 operands[7], operands[8]));
4864 ;; As above but to memory.
4865 ;; FIXME: Split movemside and moverside into variants and prune
4866 ;; the ones that don't trig.
4867 ;; No stable test-case.
4869 (define_peephole2 ; movemside (peephole casesi+39)
4870 [(set (match_operand:SI 0 "register_operand" "")
4871 (match_operand:SI 1 "cris_bdap_biap_operand" ""))
4873 (plus:SI (match_operand:SI 2 "cris_bdap_biap_operand" "")
4874 (match_operand:SI 3 "cris_bdap_biap_operand" "")))
4875 (set (match_operator 4 "cris_mem_op" [(match_dup 0)])
4876 (match_operand 5 "register_operand" ""))]
4877 "(rtx_equal_p (operands[2], operands[0])
4878 || rtx_equal_p (operands[3], operands[0]))
4879 && cris_side_effect_mode_ok (PLUS, operands, 0,
4880 (REG_S_P (operands[1])
4882 : (rtx_equal_p (operands[2], operands[0])
4884 (! REG_S_P (operands[1])
4886 : (rtx_equal_p (operands[2], operands[0])
4890 [(set (match_dup 6) (match_dup 5))
4891 (set (match_dup 0) (plus:SI (match_dup 7) (match_dup 8)))])]
4894 = rtx_equal_p (operands[2], operands[0]) ? operands[3] : operands[2];
4896 /* Make sure we have canonical RTX so we match the insn pattern -
4897 not a constant in the first operand. We also require the order
4898 (plus reg mem) to match the final pattern. */
4899 if (CRIS_CONSTANT_P (otherop) || MEM_P (otherop))
4901 operands[7] = operands[1];
4902 operands[8] = otherop;
4906 operands[7] = otherop;
4907 operands[8] = operands[1];
4910 = replace_equiv_address (operands[4],
4911 gen_rtx_PLUS (SImode,
4912 operands[7], operands[8]));
4915 ;; Another spotted bad code:
4918 ;; No stable test-case.
4920 (define_peephole2 ; movei (peephole casesi+42)
4921 [(set (match_operand:SI 0 "register_operand" "")
4922 (match_operand:SI 1 "register_operand" ""))
4923 (set (match_operand 2 "register_operand" "")
4924 (match_operator 3 "cris_mem_op" [(match_dup 0)]))]
4925 "REGNO (operands[0]) == REGNO (operands[2])
4926 && (REGNO_REG_CLASS (REGNO (operands[0]))
4927 == REGNO_REG_CLASS (REGNO (operands[1])))
4928 && GET_MODE_SIZE (GET_MODE (operands[2])) <= UNITS_PER_WORD"
4929 [(set (match_dup 2) (match_dup 4))]
4930 "operands[4] = replace_equiv_address (operands[3], operands[1]);")
4932 ;; move.d [r10+16],r9
4935 ;; and.d [r10+16],r12,r9
4936 ;; With generalization of the operation, the size and the addressing mode.
4937 ;; This seems to be the result of a quirk in register allocation
4938 ;; missing the three-operand cases when having different predicates.
4939 ;; Maybe that it matters that it is a commutative operation.
4940 ;; This pattern helps that situation, but there's still the increased
4941 ;; register pressure.
4942 ;; Note that adding the noncommutative variant did not show any matches
4943 ;; in ipps and cc1, so it's not here.
4944 ;; No stable test-case.
4946 (define_peephole2 ; op3 (peephole casesi+44)
4947 [(set (match_operand 0 "register_operand" "")
4951 (match_operand:SI 1 "cris_bdap_biap_operand" "")
4952 (match_operand:SI 2 "cris_bdap_biap_operand" ""))]))
4955 5 "cris_commutative_orth_op"
4956 [(match_operand 3 "register_operand" "")
4957 (match_operand 4 "register_operand" "")]))]
4958 "(rtx_equal_p (operands[3], operands[0])
4959 || rtx_equal_p (operands[4], operands[0]))
4960 && ! rtx_equal_p (operands[3], operands[4])
4961 && (REG_S_P (operands[1]) || REG_S_P (operands[2]))
4962 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD"
4963 [(set (match_dup 0) (match_op_dup 5 [(match_dup 7) (match_dup 6)]))]
4965 = rtx_equal_p (operands[3], operands[0]) ? operands[4] : operands[3];")
4967 ;; There seems to be no other way to make GCC (including 4.8/trunk at
4968 ;; r186932) optimally reload an instruction that looks like
4969 ;; and.d reg_or_mem,const_32__65535,other_reg
4970 ;; where other_reg is the destination.
4972 ;; movu.[bw] reg_or_mem,reg_32
4973 ;; and.[bw] trunc_int_for_mode([bw], const_32__65535),reg_32 ;; or andq
4974 ;; but it turns into:
4975 ;; move.d reg_or_mem,reg_32
4976 ;; and.d const_32__65535,reg_32
4977 ;; Fix it with these two peephole2's.
4978 ;; Testcases: gcc.dg/cris-peep2-andu1.c gcc.dg/cris-peep2-andu2.c
4980 (define_peephole2 ; andu (casesi+45)
4981 [(set (match_operand:SI 0 "register_operand" "")
4982 (match_operand:SI 1 "nonimmediate_operand" ""))
4983 (set (match_operand:SI 2 "register_operand" "")
4984 (and:SI (match_dup 0)
4985 (match_operand:SI 3 "const_int_operand" "")))]
4986 ;; Since the size of the memory access could be made different here,
4987 ;; don't do this for a mem-volatile access.
4988 "REGNO (operands[2]) == REGNO (operands[0])
4989 && INTVAL (operands[3]) <= 65535 && INTVAL (operands[3]) >= 0
4990 && !satisfies_constraint_I (operands[3])
4991 && !side_effects_p (operands[1])
4992 && (!REG_P (operands[1])
4993 || REGNO (operands[1]) <= CRIS_LAST_GENERAL_REGISTER)"
4994 ;; FIXME: CC0 valid except for M (i.e. CC_NOT_NEGATIVE).
4995 [(set (match_dup 0) (match_dup 4))
4996 (set (match_dup 5) (match_dup 6))]
4998 machine_mode zmode = INTVAL (operands[3]) <= 255 ? QImode : HImode;
5000 = satisfies_constraint_O (operands[3]) ? SImode : zmode;
5002 = (REG_S_P (operands[1])
5003 ? gen_rtx_REG (zmode, REGNO (operands[1]))
5004 : adjust_address (operands[1], zmode, 0));
5006 = gen_rtx_ZERO_EXTEND (SImode, op1);
5007 operands[5] = gen_rtx_REG (amode, REGNO (operands[0]));
5009 = gen_rtx_AND (amode, gen_rtx_REG (amode, REGNO (operands[0])),
5010 GEN_INT (trunc_int_for_mode (INTVAL (operands[3]),
5012 ? QImode : amode)));
5015 ;; Since r186861, gcc.dg/cris-peep2-andu2.c trigs this pattern, with which
5022 ;; Only do this for values fitting the quick immediate operand.
5023 (define_peephole2 ; andqu (casesi+46)
5024 [(set (match_operand:SI 0 "register_operand")
5025 (match_operand:SI 1 "const_int_operand"))
5027 (and:SI (match_dup 0) (match_operand:SI 2 "nonimmediate_operand")))]
5028 ;; Since the size of the memory access will be made different here,
5029 ;; don't do this for a volatile access or a post-incremented address.
5030 "satisfies_constraint_O (operands[1])
5031 && !side_effects_p (operands[2])
5032 && !reg_overlap_mentioned_p (operands[0], operands[2])"
5033 [(set (match_dup 0) (match_dup 3))
5034 (set (match_dup 0) (and:SI (match_dup 0) (match_dup 4)))]
5036 machine_mode zmode = INTVAL (operands[2]) <= 255 ? QImode : HImode;
5038 = (REG_S_P (operands[2])
5039 ? gen_rtx_REG (zmode, REGNO (operands[2]))
5040 : adjust_address (operands[2], zmode, 0));
5041 operands[3] = gen_rtx_ZERO_EXTEND (SImode, op1);
5042 operands[4] = GEN_INT (trunc_int_for_mode (INTVAL (operands[1]), QImode));
5045 ;; Try and avoid GOTPLT reads escaping a call: transform them into
5046 ;; PLT. Curiously (but thankfully), peepholes for instructions
5047 ;; *without side-effects* that just feed a call (or call_value) are
5048 ;; not matched neither in a build or test-suite, so those patterns are
5051 ;; A "normal" move where we don't check the consumer.
5053 (define_peephole2 ; gotplt-to-plt
5055 (match_operand:SI 0 "register_operand" "")
5059 (reg:SI CRIS_GOT_REGNUM)
5061 (unspec:SI [(match_operand:SI 2 "cris_general_operand_or_symbol" "")]
5062 CRIS_UNSPEC_PLTGOTREAD)))]))]
5064 && cris_valid_pic_const (XEXP (XEXP (operands[1], 0), 1), true)
5065 && REGNO_REG_CLASS (REGNO (operands[0])) == REGNO_REG_CLASS (0)"
5066 [(set (match_dup 0) (const:SI (unspec:SI [(match_dup 2)] CRIS_UNSPEC_PLT_GOTREL)))
5067 (set (match_dup 0) (plus:SI (match_dup 0) (reg:SI CRIS_GOT_REGNUM)))]
5070 ;; And one set with a side-effect getting the PLTGOT offset.
5071 ;; First call and call_value variants.
5073 (define_peephole2 ; gotplt-to-plt-side-call
5076 (match_operand:SI 0 "register_operand" "")
5080 (reg:SI CRIS_GOT_REGNUM)
5082 (unspec:SI [(match_operand:SI
5083 2 "cris_general_operand_or_symbol" "")]
5084 CRIS_UNSPEC_PLTGOTREAD)))]))
5085 (set (match_operand:SI 3 "register_operand" "")
5086 (plus:SI (reg:SI CRIS_GOT_REGNUM)
5088 (unspec:SI [(match_dup 2)] CRIS_UNSPEC_PLTGOTREAD))))])
5089 (parallel [(call (mem:QI (match_dup 0))
5090 (match_operand 4 "" ""))
5091 (clobber (reg:SI CRIS_SRP_REGNUM))])]
5093 && cris_valid_pic_const (XEXP (XEXP (operands[1], 0), 1), true)
5094 && peep2_reg_dead_p (2, operands[0])"
5095 [(parallel [(call (mem:QI (match_dup 1))
5097 (clobber (reg:SI CRIS_SRP_REGNUM))
5099 (plus:SI (reg:SI CRIS_GOT_REGNUM)
5101 (unspec:SI [(match_dup 2)]
5102 CRIS_UNSPEC_PLTGOTREAD))))])]
5105 (define_peephole2 ; gotplt-to-plt-side-call-value
5108 (match_operand:SI 0 "register_operand" "")
5112 (reg:SI CRIS_GOT_REGNUM)
5114 (unspec:SI [(match_operand:SI
5115 2 "cris_general_operand_or_symbol" "")]
5116 CRIS_UNSPEC_PLTGOTREAD)))]))
5117 (set (match_operand:SI 3 "register_operand" "")
5118 (plus:SI (reg:SI CRIS_GOT_REGNUM)
5120 (unspec:SI [(match_dup 2)] CRIS_UNSPEC_PLTGOTREAD))))])
5121 (parallel [(set (match_operand 5 "" "")
5122 (call (mem:QI (match_dup 0))
5123 (match_operand 4 "" "")))
5124 (clobber (reg:SI CRIS_SRP_REGNUM))])]
5126 && cris_valid_pic_const (XEXP (XEXP (operands[1], 0), 1), true)
5127 && peep2_reg_dead_p (2, operands[0])"
5128 [(parallel [(set (match_dup 5)
5129 (call (mem:QI (match_dup 1))
5131 (clobber (reg:SI CRIS_SRP_REGNUM))
5133 (plus:SI (reg:SI CRIS_GOT_REGNUM)
5135 (unspec:SI [(match_dup 2)]
5136 CRIS_UNSPEC_PLTGOTREAD))))])]
5139 (define_peephole2 ; gotplt-to-plt-side
5142 (match_operand:SI 0 "register_operand" "")
5146 (reg:SI CRIS_GOT_REGNUM)
5148 (unspec:SI [(match_operand:SI
5149 2 "cris_general_operand_or_symbol" "")]
5150 CRIS_UNSPEC_PLTGOTREAD)))]))
5151 (set (match_operand:SI 3 "register_operand" "")
5152 (plus:SI (reg:SI CRIS_GOT_REGNUM)
5154 (unspec:SI [(match_dup 2)] CRIS_UNSPEC_PLTGOTREAD))))])]
5156 && cris_valid_pic_const (XEXP (XEXP (operands[1], 0), 1), true)
5157 && REGNO_REG_CLASS (REGNO (operands[0])) == REGNO_REG_CLASS (0)"
5159 (const:SI (unspec:SI [(match_dup 2)] CRIS_UNSPEC_PLTGOTREAD)))
5160 (set (match_dup 3) (plus:SI (match_dup 3) (reg:SI CRIS_GOT_REGNUM)))
5162 (const:SI (unspec:SI [(match_dup 2)] CRIS_UNSPEC_PLT_GOTREL)))
5163 (set (match_dup 0) (plus:SI (match_dup 0) (reg:SI CRIS_GOT_REGNUM)))]
5168 ;; comment-start: ";; "
5169 ;; eval: (set-syntax-table (copy-sequence (syntax-table)))
5170 ;; eval: (modify-syntax-entry ?[ "(]")
5171 ;; eval: (modify-syntax-entry ?] ")[")
5172 ;; eval: (modify-syntax-entry ?{ "(}")
5173 ;; eval: (modify-syntax-entry ?} "){")
5174 ;; eval: (setq indent-tabs-mode t)