1 |
709 |
jeremybenn |
;; GCC machine description for CRIS cpu cores.
|
2 |
|
|
;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
3 |
|
|
;; 2008, 2009, 2010 Free Software Foundation, Inc.
|
4 |
|
|
;; Contributed by Axis Communications.
|
5 |
|
|
|
6 |
|
|
;; This file is part of GCC.
|
7 |
|
|
;;
|
8 |
|
|
;; GCC is free software; you can redistribute it and/or modify
|
9 |
|
|
;; it under the terms of the GNU General Public License as published by
|
10 |
|
|
;; the Free Software Foundation; either version 3, or (at your option)
|
11 |
|
|
;; any later version.
|
12 |
|
|
;;
|
13 |
|
|
;; GCC is distributed in the hope that it will be useful,
|
14 |
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
|
|
;; GNU General Public License for more details.
|
17 |
|
|
;;
|
18 |
|
|
;; You should have received a copy of the GNU General Public License
|
19 |
|
|
;; along with GCC; see the file COPYING3. If not see
|
20 |
|
|
;; .
|
21 |
|
|
|
22 |
|
|
;; The original PO technology requires these to be ordered by speed,
|
23 |
|
|
;; so that assigner will pick the fastest.
|
24 |
|
|
|
25 |
|
|
;; See files "md.texi" and "rtl.def" for documentation on define_insn,
|
26 |
|
|
;; match_*, et. al.
|
27 |
|
|
;;
|
28 |
|
|
;; The function cris_notice_update_cc in cris.c handles condition code
|
29 |
|
|
;; updates for most instructions, helped by the "cc" attribute.
|
30 |
|
|
|
31 |
|
|
;; There are several instructions that are orthogonal in size, and seems
|
32 |
|
|
;; they could be matched by a single pattern without a specified size
|
33 |
|
|
;; for the operand that is orthogonal. However, this did not work on
|
34 |
|
|
;; gcc-2.7.2 (and probably not on gcc-2.8.1), relating to that when a
|
35 |
|
|
;; constant is substituted into an operand, the actual mode must be
|
36 |
|
|
;; deduced from the pattern. There is reasonable hope that that has been
|
37 |
|
|
;; fixed, so FIXME: try again.
|
38 |
|
|
|
39 |
|
|
;; You will notice that three-operand alternatives ("=r", "r", "!To")
|
40 |
|
|
;; are marked with a "!" constraint modifier to avoid being reloaded
|
41 |
|
|
;; into. This is because gcc would otherwise prefer to use the constant
|
42 |
|
|
;; pool and its offsettable address instead of reloading to an
|
43 |
|
|
;; ("=r", "0", "i") alternative. Also, the constant-pool support was not
|
44 |
|
|
;; only suboptimal but also buggy in 2.7.2, ??? maybe only in 2.6.3.
|
45 |
|
|
|
46 |
|
|
;; All insns that look like (set (...) (plus (...) (reg:SI 8)))
|
47 |
|
|
;; get problems when reloading r8 (frame pointer) to r14 + offs (stack
|
48 |
|
|
;; pointer). Thus the instructions that get into trouble have specific
|
49 |
|
|
;; checks against matching frame_pointer_rtx.
|
50 |
|
|
;; ??? But it should be re-checked for gcc > 2.7.2
|
51 |
|
|
;; FIXME: This changed some time ago (from 2000-03-16) for gcc-2.9x.
|
52 |
|
|
|
53 |
|
|
;; FIXME: When PIC, all [rX=rY+S] could be enabled to match
|
54 |
|
|
;; [rX=gotless_symbol].
|
55 |
|
|
;; The movsi for a gotless symbol could be split (post reload).
|
56 |
|
|
|
57 |
|
|
|
58 |
|
|
(define_constants
|
59 |
|
|
[
|
60 |
|
|
;; PLT reference from call expansion: operand 0 is the address,
|
61 |
|
|
;; the mode is VOIDmode. Always wrapped in CONST.
|
62 |
|
|
;; The value is relative to the GOT.
|
63 |
|
|
(CRIS_UNSPEC_PLT_GOTREL 0)
|
64 |
|
|
|
65 |
|
|
;; PLT reference from call expansion: operand 0 is the address,
|
66 |
|
|
;; the mode is VOIDmode. Always wrapped in CONST.
|
67 |
|
|
;; The value is relative to the PC. It's arch-dependent whether
|
68 |
|
|
;; the offset counts from the start or the end of the current item.
|
69 |
|
|
(CRIS_UNSPEC_PLT_PCREL 1)
|
70 |
|
|
|
71 |
|
|
;; The address of the global offset table as a source operand.
|
72 |
|
|
(CRIS_UNSPEC_GOT 2)
|
73 |
|
|
|
74 |
|
|
;; The offset from the global offset table to the operand.
|
75 |
|
|
(CRIS_UNSPEC_GOTREL 3)
|
76 |
|
|
|
77 |
|
|
;; The PC-relative offset to the operand. It's arch-dependent whether
|
78 |
|
|
;; the offset counts from the start or the end of the current item.
|
79 |
|
|
(CRIS_UNSPEC_PCREL 4)
|
80 |
|
|
|
81 |
|
|
;; The index into the global offset table of a symbol, while
|
82 |
|
|
;; also generating a GOT entry for the symbol.
|
83 |
|
|
(CRIS_UNSPEC_GOTREAD 5)
|
84 |
|
|
|
85 |
|
|
;; Similar to CRIS_UNSPEC_GOTREAD, but also generating a PLT entry.
|
86 |
|
|
(CRIS_UNSPEC_PLTGOTREAD 6)
|
87 |
|
|
|
88 |
|
|
;; Condition for v32 casesi jump, since it needs to have if_then_else
|
89 |
|
|
;; form with register as one branch and default label as other.
|
90 |
|
|
;; Operand 0 is const_int 0.
|
91 |
|
|
(CRIS_UNSPEC_CASESI 7)
|
92 |
|
|
|
93 |
|
|
;; Stack frame deallocation barrier.
|
94 |
|
|
(CRIS_UNSPEC_FRAME_DEALLOC 8)
|
95 |
|
|
|
96 |
|
|
;; Swap all 32 bits of the operand; 31 <=> 0, 30 <=> 1...
|
97 |
|
|
(CRIS_UNSPEC_SWAP_BITS 9)
|
98 |
|
|
])
|
99 |
|
|
|
100 |
|
|
;; Register numbers.
|
101 |
|
|
(define_constants
|
102 |
|
|
[(CRIS_GOT_REGNUM 0)
|
103 |
|
|
(CRIS_STATIC_CHAIN_REGNUM 7)
|
104 |
|
|
(CRIS_FP_REGNUM 8)
|
105 |
|
|
(CRIS_SP_REGNUM 14)
|
106 |
|
|
(CRIS_ACR_REGNUM 15)
|
107 |
|
|
(CRIS_SRP_REGNUM 16)
|
108 |
|
|
(CRIS_MOF_REGNUM 17)
|
109 |
|
|
(CRIS_AP_REGNUM 18)
|
110 |
|
|
(CRIS_CC0_REGNUM 19)]
|
111 |
|
|
)
|
112 |
|
|
|
113 |
|
|
;; We need an attribute to define whether an instruction can be put in
|
114 |
|
|
;; a branch-delay slot or not, and whether it has a delay slot.
|
115 |
|
|
;;
|
116 |
|
|
;; Branches and return instructions have a delay slot, and cannot
|
117 |
|
|
;; themselves be put in a delay slot. This has changed *for short
|
118 |
|
|
;; branches only* between architecture variants, but the possible win
|
119 |
|
|
;; is presumed negligible compared to the added complexity of the machine
|
120 |
|
|
;; description: one would have to add always-correct infrastructure to
|
121 |
|
|
;; distinguish short branches.
|
122 |
|
|
;;
|
123 |
|
|
;; Whether an instruction can be put in a delay slot depends on the
|
124 |
|
|
;; instruction (all short instructions except jumps and branches)
|
125 |
|
|
;; and the addressing mode (must not be prefixed or referring to pc).
|
126 |
|
|
;; In short, any "slottable" instruction must be 16 bit and not refer
|
127 |
|
|
;; to pc, or alter it.
|
128 |
|
|
;;
|
129 |
|
|
;; The possible values are "yes", "no", "has_slot", "has_return_slot"
|
130 |
|
|
;; and "has_call_slot".
|
131 |
|
|
;; Yes/no tells whether the insn is slottable or not. Has_call_slot means
|
132 |
|
|
;; that the insn is a call insn, which for CRIS v32 has a delay-slot.
|
133 |
|
|
;; Of special concern is that no RTX_FRAME_RELATED insn must go in that
|
134 |
|
|
;; call delay slot, as it's located in the address *after* the call insn,
|
135 |
|
|
;; and the unwind machinery doesn't know about delay slots.
|
136 |
|
|
;; Has_slot means that the insn is a branch insn (which are
|
137 |
|
|
;; not considered slottable since that is generally true). Having the
|
138 |
|
|
;; seemingly illogical value "has_slot" means we do not have to add
|
139 |
|
|
;; another attribute just to say that an insn has a delay-slot, since it
|
140 |
|
|
;; also infers that it is not slottable. Better names for the attribute
|
141 |
|
|
;; were found to be longer and not add readability to the machine
|
142 |
|
|
;; description.
|
143 |
|
|
;; Has_return_slot is similar, for the return insn.
|
144 |
|
|
;;
|
145 |
|
|
;; The default that is defined here for this attribute is "no", not
|
146 |
|
|
;; slottable, not having a delay-slot, so there's no need to worry about
|
147 |
|
|
;; it being wrong for non-branch and return instructions.
|
148 |
|
|
;; The default could depend on the kind of insn and the addressing
|
149 |
|
|
;; mode, but that would need more attributes and hairier, more error
|
150 |
|
|
;; prone code.
|
151 |
|
|
;;
|
152 |
|
|
;; There is an extra memory constraint, 'Q', which recognizes an indirect
|
153 |
|
|
;; register. The constraints 'Q' and '>' together match all possible
|
154 |
|
|
;; memory operands that are slottable.
|
155 |
|
|
;; For other operands, you need to check if it has a valid "slottable"
|
156 |
|
|
;; quick-immediate operand, where the particular signedness-variation
|
157 |
|
|
;; may match the constraints 'I' or 'J'.), and include it in the
|
158 |
|
|
;; constraint pattern for the slottable pattern. An alternative using
|
159 |
|
|
;; only "r" constraints is most often slottable.
|
160 |
|
|
|
161 |
|
|
(define_attr "slottable" "no,yes,has_slot,has_return_slot,has_call_slot"
|
162 |
|
|
(const_string "no"))
|
163 |
|
|
|
164 |
|
|
;; We also need attributes to sanely determine the condition code
|
165 |
|
|
;; state. See cris_notice_update_cc for how this is used.
|
166 |
|
|
|
167 |
|
|
(define_attr "cc" "none,clobber,normal,noov32,rev" (const_string "normal"))
|
168 |
|
|
|
169 |
|
|
;; At the moment, this attribute is just used to help bb-reorder do its
|
170 |
|
|
;; work; the default 0 doesn't help it. Many insns have other lengths,
|
171 |
|
|
;; though none are shorter.
|
172 |
|
|
(define_attr "length" "" (const_int 2))
|
173 |
|
|
|
174 |
|
|
;; A branch has one delay-slot. The instruction in the
|
175 |
|
|
;; delay-slot is always executed, independent of whether the branch is
|
176 |
|
|
;; taken or not. Note that besides setting "slottable" to "has_slot",
|
177 |
|
|
;; there also has to be a "%#" at the end of a "delayed" instruction
|
178 |
|
|
;; output pattern (for "jump" this means "ba %l0%#"), so print_operand can
|
179 |
|
|
;; catch it and print a "nop" if necessary. This method was stolen from
|
180 |
|
|
;; sparc.md.
|
181 |
|
|
|
182 |
|
|
(define_delay (eq_attr "slottable" "has_slot")
|
183 |
|
|
[(eq_attr "slottable" "yes") (nil) (nil)])
|
184 |
|
|
|
185 |
|
|
;; We can't put prologue insns in call-insn delay-slots when
|
186 |
|
|
;; DWARF2 unwind info is emitted, because the unwinder matches the
|
187 |
|
|
;; address after the insn. It must see the return address of a call at
|
188 |
|
|
;; a position at least *one byte after* the insn, or it'll think that
|
189 |
|
|
;; the insn hasn't been executed. If the insn is in a delay-slot of a
|
190 |
|
|
;; call, it's just *exactly* after the insn.
|
191 |
|
|
|
192 |
|
|
(define_delay (eq_attr "slottable" "has_call_slot")
|
193 |
|
|
[(and (eq_attr "slottable" "yes")
|
194 |
|
|
(ior (not (match_test "RTX_FRAME_RELATED_P (insn)"))
|
195 |
|
|
(not (match_test "flag_exceptions"))))
|
196 |
|
|
(nil) (nil)])
|
197 |
|
|
|
198 |
|
|
;; The insn in the return insn slot must not be the
|
199 |
|
|
;; return-address-register restore. FIXME: Use has_slot and express
|
200 |
|
|
;; as a parallel with a use of the return-address-register (currently
|
201 |
|
|
;; only SRP). However, this requires an amount of fixing tests for
|
202 |
|
|
;; naked RETURN in middle-end.
|
203 |
|
|
(define_delay (eq_attr "slottable" "has_return_slot")
|
204 |
|
|
[(and (eq_attr "slottable" "yes")
|
205 |
|
|
(not (match_test "dead_or_set_regno_p (insn, CRIS_SRP_REGNUM)")))
|
206 |
|
|
(nil) (nil)])
|
207 |
|
|
|
208 |
|
|
|
209 |
|
|
;; Iterator definitions.
|
210 |
|
|
|
211 |
|
|
;; For the "usual" pattern size alternatives.
|
212 |
|
|
(define_mode_iterator BWD [SI HI QI])
|
213 |
|
|
(define_mode_iterator WD [SI HI])
|
214 |
|
|
(define_mode_iterator BW [HI QI])
|
215 |
|
|
(define_mode_attr S [(SI "HI") (HI "QI")])
|
216 |
|
|
(define_mode_attr s [(SI "hi") (HI "qi")])
|
217 |
|
|
(define_mode_attr m [(SI ".d") (HI ".w") (QI ".b")])
|
218 |
|
|
(define_mode_attr mm [(SI ".w") (HI ".b")])
|
219 |
|
|
(define_mode_attr nbitsm1 [(SI "31") (HI "15") (QI "7")])
|
220 |
|
|
|
221 |
|
|
;; For the sign_extend+zero_extend variants.
|
222 |
|
|
(define_code_iterator szext [sign_extend zero_extend])
|
223 |
|
|
(define_code_attr u [(sign_extend "") (zero_extend "u")])
|
224 |
|
|
(define_code_attr su [(sign_extend "s") (zero_extend "u")])
|
225 |
|
|
|
226 |
|
|
;; For the shift variants.
|
227 |
|
|
(define_code_iterator shift [ashiftrt lshiftrt ashift])
|
228 |
|
|
(define_code_iterator shiftrt [ashiftrt lshiftrt])
|
229 |
|
|
(define_code_attr shlr [(ashiftrt "ashr") (lshiftrt "lshr") (ashift "ashl")])
|
230 |
|
|
(define_code_attr slr [(ashiftrt "asr") (lshiftrt "lsr") (ashift "lsl")])
|
231 |
|
|
|
232 |
|
|
(define_code_iterator ncond [eq ne gtu ltu geu leu])
|
233 |
|
|
(define_code_iterator ocond [gt le])
|
234 |
|
|
(define_code_iterator rcond [lt ge])
|
235 |
|
|
(define_code_attr CC [(eq "eq") (ne "ne") (gt "gt") (gtu "hi") (lt "lt")
|
236 |
|
|
(ltu "lo") (ge "ge") (geu "hs") (le "le") (leu "ls")])
|
237 |
|
|
(define_code_attr rCC [(eq "ne") (ne "eq") (gt "le") (gtu "ls") (lt "ge")
|
238 |
|
|
(ltu "hs") (ge "lt") (geu "lo") (le "gt") (leu "hi")])
|
239 |
|
|
(define_code_attr oCC [(lt "mi") (ge "pl")])
|
240 |
|
|
(define_code_attr roCC [(lt "pl") (ge "mi")])
|
241 |
|
|
|
242 |
|
|
;; Operand and operator predicates.
|
243 |
|
|
|
244 |
|
|
(include "predicates.md")
|
245 |
|
|
(include "constraints.md")
|
246 |
|
|
|
247 |
|
|
;; Test insns.
|
248 |
|
|
|
249 |
|
|
;; No test insns with side-effect on the mem addressing.
|
250 |
|
|
;;
|
251 |
|
|
;; See note on cmp-insns with side-effects (or lack of them)
|
252 |
|
|
|
253 |
|
|
;; Normal named test patterns from SI on.
|
254 |
|
|
|
255 |
|
|
(define_insn "*tstsi"
|
256 |
|
|
[(set (cc0)
|
257 |
|
|
(compare (match_operand:SI 0 "nonimmediate_operand" "r,Q>,m")
|
258 |
|
|
(const_int 0)))]
|
259 |
|
|
""
|
260 |
|
|
{
|
261 |
|
|
if (which_alternative == 0 && TARGET_V32)
|
262 |
|
|
return "cmpq 0,%0";
|
263 |
|
|
return "test.d %0";
|
264 |
|
|
}
|
265 |
|
|
[(set_attr "slottable" "yes,yes,no")])
|
266 |
|
|
|
267 |
|
|
(define_insn "*tst_cmp"
|
268 |
|
|
[(set (cc0)
|
269 |
|
|
(compare (match_operand:BW 0 "nonimmediate_operand" "r,Q>,m")
|
270 |
|
|
(const_int 0)))]
|
271 |
|
|
"cris_cc0_user_requires_cmp (insn)"
|
272 |
|
|
"@
|
273 |
|
|
cmp 0,%0
|
274 |
|
|
test %0
|
275 |
|
|
test %0"
|
276 |
|
|
[(set_attr "slottable" "no,yes,no")])
|
277 |
|
|
|
278 |
|
|
(define_insn "*tst_non_cmp"
|
279 |
|
|
[(set (cc0)
|
280 |
|
|
(compare (match_operand:BW 0 "nonimmediate_operand" "r,Q>,m")
|
281 |
|
|
(const_int 0)))]
|
282 |
|
|
"!cris_cc0_user_requires_cmp (insn)"
|
283 |
|
|
"@
|
284 |
|
|
move %0,%0
|
285 |
|
|
test %0
|
286 |
|
|
test %0"
|
287 |
|
|
[(set_attr "slottable" "yes,yes,no")
|
288 |
|
|
(set_attr "cc" "noov32,*,*")])
|
289 |
|
|
|
290 |
|
|
;; It seems that the position of the sign-bit and the fact that 0.0 is
|
291 |
|
|
;; all 0-bits would make "tstsf" a straight-forward implementation;
|
292 |
|
|
;; either "test.d" it for positive/negative or "btstq 30,r" it for
|
293 |
|
|
;; zeroness.
|
294 |
|
|
;;
|
295 |
|
|
;; FIXME: Do that some time; check next_cc0_user to determine if
|
296 |
|
|
;; zero or negative is tested for.
|
297 |
|
|
|
298 |
|
|
;; Compare insns.
|
299 |
|
|
|
300 |
|
|
;; We could optimize the sizes of the immediate operands for various
|
301 |
|
|
;; cases, but that is not worth it because of the very little usage of
|
302 |
|
|
;; DImode for anything else but a structure/block-mode. Just do the
|
303 |
|
|
;; obvious stuff for the straight-forward constraint letters.
|
304 |
|
|
|
305 |
|
|
(define_insn "*cmpdi_non_v32"
|
306 |
|
|
[(set (cc0)
|
307 |
|
|
(compare (match_operand:DI 0 "nonimmediate_operand" "rm,r,r,r,r,r,r,o")
|
308 |
|
|
(match_operand:DI 1 "general_operand" "M,Kc,I,P,n,r,o,r")))]
|
309 |
|
|
"!TARGET_V32"
|
310 |
|
|
"@
|
311 |
|
|
test.d %M0\;ax\;test.d %H0
|
312 |
|
|
cmpq %1,%M0\;ax\;cmpq 0,%H0
|
313 |
|
|
cmpq %1,%M0\;ax\;cmpq -1,%H0
|
314 |
|
|
cmp%e1.%z1 %1,%M0\;ax\;cmpq %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 %M1,%M0\;ax\;cmp.d %H1,%H0
|
318 |
|
|
cmp.d %M0,%M1\;ax\;cmp.d %H0,%H1")
|
319 |
|
|
|
320 |
|
|
(define_insn "*cmpdi_v32"
|
321 |
|
|
[(set (cc0)
|
322 |
|
|
(compare (match_operand:DI 0 "register_operand" "r,r,r,r,r")
|
323 |
|
|
(match_operand:DI 1 "nonmemory_operand" "Kc,I,P,n,r")))]
|
324 |
|
|
"TARGET_V32"
|
325 |
|
|
"@
|
326 |
|
|
cmpq %1,%M0\;ax\;cmpq 0,%H0
|
327 |
|
|
cmpq %1,%M0\;ax\;cmpq -1,%H0
|
328 |
|
|
cmp%e1.%z1 %1,%M0\;ax\;cmpq %H1,%H0
|
329 |
|
|
cmp.d %M1,%M0\;ax\;cmp.d %H1,%H0
|
330 |
|
|
cmp.d %M1,%M0\;ax\;cmp.d %H1,%H0")
|
331 |
|
|
|
332 |
|
|
;; Note that compare insns with side effect addressing mode (e.g.):
|
333 |
|
|
;;
|
334 |
|
|
;; cmp.S [rx=ry+i],rz;
|
335 |
|
|
;; cmp.S [%3=%1+%2],%0
|
336 |
|
|
;;
|
337 |
|
|
;; are *not* usable for gcc since the reloader *does not accept*
|
338 |
|
|
;; cc0-changing insns with side-effects other than setting the condition
|
339 |
|
|
;; codes. The reason is that the reload stage *may* cause another insn to
|
340 |
|
|
;; be output after the main instruction, in turn invalidating cc0 for the
|
341 |
|
|
;; insn using the test. (This does not apply to the CRIS case, since a
|
342 |
|
|
;; reload for output -- move to memory -- does not change the condition
|
343 |
|
|
;; code. Unfortunately we have no way to describe that at the moment. I
|
344 |
|
|
;; think code would improve being in the order of one percent faster.
|
345 |
|
|
|
346 |
|
|
;; We have cmps and cmpu (compare reg w. sign/zero extended mem).
|
347 |
|
|
;; These are mostly useful for compares in SImode, using 8 or 16-bit
|
348 |
|
|
;; constants, but sometimes gcc will find its way to use it for other
|
349 |
|
|
;; (memory) operands. Avoid side-effect patterns, though (see above).
|
350 |
|
|
|
351 |
|
|
(define_insn "*cmp_ext"
|
352 |
|
|
[(set (cc0)
|
353 |
|
|
(compare
|
354 |
|
|
(match_operand:SI 0 "register_operand" "r,r")
|
355 |
|
|
(match_operator:SI 2 "cris_extend_operator"
|
356 |
|
|
[(match_operand:BW 1 "memory_operand" "Q>,m")])))]
|
357 |
|
|
""
|
358 |
|
|
"cmp%e2 %1,%0"
|
359 |
|
|
[(set_attr "slottable" "yes,no")])
|
360 |
|
|
|
361 |
|
|
;; Swap operands; it seems the canonical look (if any) is not enforced.
|
362 |
|
|
;;
|
363 |
|
|
;; FIXME: Investigate that.
|
364 |
|
|
|
365 |
|
|
(define_insn "*cmp_swapext"
|
366 |
|
|
[(set (cc0)
|
367 |
|
|
(compare
|
368 |
|
|
(match_operator:SI 2 "cris_extend_operator"
|
369 |
|
|
[(match_operand:BW 0 "memory_operand" "Q>,m")])
|
370 |
|
|
(match_operand:SI 1 "register_operand" "r,r")))]
|
371 |
|
|
""
|
372 |
|
|
"cmp%e2 %0,%1"
|
373 |
|
|
[(set_attr "slottable" "yes,no")
|
374 |
|
|
(set_attr "cc" "rev")])
|
375 |
|
|
|
376 |
|
|
;; The "normal" compare patterns, from SI on. Special-cases with zero
|
377 |
|
|
;; are covered above.
|
378 |
|
|
|
379 |
|
|
(define_insn "*cmpsi"
|
380 |
|
|
[(set (cc0)
|
381 |
|
|
(compare
|
382 |
|
|
(match_operand:SI 0 "nonimmediate_operand" "r,r,r, Q>,r,r,m")
|
383 |
|
|
(match_operand:SI 1 "general_operand" "I,r,Q>,r, P,g,r")))]
|
384 |
|
|
""
|
385 |
|
|
"@
|
386 |
|
|
cmpq %1,%0
|
387 |
|
|
cmp.d %1,%0
|
388 |
|
|
cmp.d %1,%0
|
389 |
|
|
cmp.d %0,%1
|
390 |
|
|
cmp%e1.%z1 %1,%0
|
391 |
|
|
cmp.d %1,%0
|
392 |
|
|
cmp.d %0,%1"
|
393 |
|
|
[(set_attr "slottable" "yes,yes,yes,yes,no,no,no")
|
394 |
|
|
(set_attr "cc" "normal,normal,normal,rev,normal,normal,rev")])
|
395 |
|
|
|
396 |
|
|
(define_insn "*cmp"
|
397 |
|
|
[(set (cc0)
|
398 |
|
|
(compare (match_operand:BW 0 "nonimmediate_operand" "r,r, Q>,r,m")
|
399 |
|
|
(match_operand:BW 1 "general_operand" "r,Q>,r, g,r")))]
|
400 |
|
|
""
|
401 |
|
|
"@
|
402 |
|
|
cmp %1,%0
|
403 |
|
|
cmp %1,%0
|
404 |
|
|
cmp %0,%1
|
405 |
|
|
cmp %1,%0
|
406 |
|
|
cmp %0,%1"
|
407 |
|
|
[(set_attr "slottable" "yes,yes,yes,no,no")
|
408 |
|
|
(set_attr "cc" "normal,normal,rev,normal,rev")])
|
409 |
|
|
|
410 |
|
|
;; Pattern matching the BTST insn.
|
411 |
|
|
;; It is useful for "if (i & val)" constructs, where val is an exact
|
412 |
|
|
;; power of 2, or if val + 1 is a power of two, where we check for a bunch
|
413 |
|
|
;; of zeros starting at bit 0).
|
414 |
|
|
|
415 |
|
|
;; SImode. This mode is the only one needed, since gcc automatically
|
416 |
|
|
;; extends subregs for lower-size modes. FIXME: Add testcase.
|
417 |
|
|
(define_insn "*btst"
|
418 |
|
|
[(set (cc0)
|
419 |
|
|
(compare
|
420 |
|
|
(zero_extract:SI
|
421 |
|
|
(match_operand:SI 0 "nonmemory_operand" "r, r,r, r,r, r,Kp")
|
422 |
|
|
(match_operand:SI 1 "const_int_operand" "Kc,n,Kc,n,Kc,n,n")
|
423 |
|
|
(match_operand:SI 2 "nonmemory_operand" "M, M,Kc,n,r, r,r"))
|
424 |
|
|
(const_int 0)))]
|
425 |
|
|
;; Either it is a single bit, or consecutive ones starting at 0.
|
426 |
|
|
;; The btst ones depend on stuff in NOTICE_UPDATE_CC.
|
427 |
|
|
"CONST_INT_P (operands[1])
|
428 |
|
|
&& (operands[1] == const1_rtx || operands[2] == const0_rtx)
|
429 |
|
|
&& (REG_S_P (operands[0])
|
430 |
|
|
|| (operands[1] == const1_rtx
|
431 |
|
|
&& REG_S_P (operands[2])
|
432 |
|
|
&& CONST_INT_P (operands[0])
|
433 |
|
|
&& exact_log2 (INTVAL (operands[0])) >= 0))
|
434 |
|
|
&& !TARGET_CCINIT"
|
435 |
|
|
|
436 |
|
|
;; The next-to-last "&&" condition above should be caught by some kind of
|
437 |
|
|
;; canonicalization in gcc, but we can easily help with it here.
|
438 |
|
|
;; It results from expressions of the type
|
439 |
|
|
;; "power_of_2_value & (1 << y)".
|
440 |
|
|
;;
|
441 |
|
|
;; Since there may be codes with tests in on bits (in constant position)
|
442 |
|
|
;; beyond the size of a word, handle that by assuming those bits are 0.
|
443 |
|
|
;; GCC should handle that, but it's a matter of easily-added belts while
|
444 |
|
|
;; having suspenders.
|
445 |
|
|
|
446 |
|
|
"@
|
447 |
|
|
btstq (%1-1),%0
|
448 |
|
|
cmpq 0,%0
|
449 |
|
|
btstq %2,%0
|
450 |
|
|
clearf nz
|
451 |
|
|
btst %2,%0
|
452 |
|
|
clearf nz
|
453 |
|
|
cmpq %p0,%2"
|
454 |
|
|
[(set_attr "slottable" "yes")
|
455 |
|
|
(set_attr "cc" "noov32")])
|
456 |
|
|
|
457 |
|
|
;; Move insns.
|
458 |
|
|
|
459 |
|
|
;; The whole mandatory movdi family is here; expander, "anonymous"
|
460 |
|
|
;; recognizer and splitter. We're forced to have a movdi pattern,
|
461 |
|
|
;; although GCC should be able to split it up itself. Normally it can,
|
462 |
|
|
;; but if other insns have DI operands (as is the case here), reload
|
463 |
|
|
;; must be able to generate or match a movdi. many testcases fail at
|
464 |
|
|
;; -O3 or -fssa if we don't have this. FIXME: Fix GCC... See
|
465 |
|
|
;; .
|
466 |
|
|
;; However, a patch from Richard Kenner (similar to the cause of
|
467 |
|
|
;; discussion at the URL above), indicates otherwise. See
|
468 |
|
|
;; .
|
469 |
|
|
;; The truth has IMO is not been decided yet, so check from time to
|
470 |
|
|
;; time by disabling the movdi patterns.
|
471 |
|
|
|
472 |
|
|
;; To appease testcase gcc.c-torture/execute/920501-2.c (and others) at
|
473 |
|
|
;; -O0, we need a movdi as a temporary measure. Here's how things fail:
|
474 |
|
|
;; A cmpdi RTX needs reloading (global):
|
475 |
|
|
;; (insn 185 326 186 (set (cc0)
|
476 |
|
|
;; (compare (mem/f:DI (reg/v:SI 22) 0)
|
477 |
|
|
;; (const_int 1 [0x1]))) 4 {cmpdi} (nil)
|
478 |
|
|
;; (nil))
|
479 |
|
|
;; Now, reg 22 is reloaded for input address, and the mem is also moved
|
480 |
|
|
;; out of the instruction (into a register), since one of the operands
|
481 |
|
|
;; must be a register. Reg 22 is reloaded (into reg 10), and the mem is
|
482 |
|
|
;; moved out and synthesized in SImode parts (reg 9, reg 10 - should be ok
|
483 |
|
|
;; wrt. overlap). The bad things happen with the synthesis in
|
484 |
|
|
;; emit_move_insn_1; the location where to substitute reg 10 is lost into
|
485 |
|
|
;; two new RTX:es, both still having reg 22. Later on, the left-over reg
|
486 |
|
|
;; 22 is recognized to have an equivalent in memory which is substituted
|
487 |
|
|
;; straight in, and we end up with an unrecognizable insn:
|
488 |
|
|
;; (insn 325 324 326 (set (reg:SI 9 r9)
|
489 |
|
|
;; (mem/f:SI (mem:SI (plus:SI (reg:SI 8 r8)
|
490 |
|
|
;; (const_int -84 [0xffffffac])) 0) 0)) -1 (nil)
|
491 |
|
|
;; (nil))
|
492 |
|
|
;; which is the first part of the reloaded synthesized "movdi".
|
493 |
|
|
;; The right thing would be to add equivalent replacement locations for
|
494 |
|
|
;; insn with pseudos that need more reloading. The question is where.
|
495 |
|
|
|
496 |
|
|
(define_expand "movdi"
|
497 |
|
|
[(set (match_operand:DI 0 "nonimmediate_operand" "")
|
498 |
|
|
(match_operand:DI 1 "general_operand" ""))]
|
499 |
|
|
""
|
500 |
|
|
{
|
501 |
|
|
if (MEM_P (operands[0])
|
502 |
|
|
&& operands[1] != const0_rtx
|
503 |
|
|
&& (!TARGET_V32 || (!REG_P (operands[1]) && can_create_pseudo_p ())))
|
504 |
|
|
operands[1] = copy_to_mode_reg (DImode, operands[1]);
|
505 |
|
|
|
506 |
|
|
/* Some other ports (as of 2001-09-10 for example mcore and romp) also
|
507 |
|
|
prefer to split up constants early, like this. The testcase in
|
508 |
|
|
gcc.c-torture/execute/961213-1.c shows that CSE2 gets confused by the
|
509 |
|
|
resulting subreg sets when using the construct from mcore (as of FSF
|
510 |
|
|
CVS, version -r 1.5), and it believes that the high part (the last one
|
511 |
|
|
emitted) is the final value. */
|
512 |
|
|
if ((CONST_INT_P (operands[1]) || GET_CODE (operands[1]) == CONST_DOUBLE)
|
513 |
|
|
&& ! reload_completed
|
514 |
|
|
&& ! reload_in_progress)
|
515 |
|
|
{
|
516 |
|
|
rtx insns;
|
517 |
|
|
rtx op0 = operands[0];
|
518 |
|
|
rtx op1 = operands[1];
|
519 |
|
|
|
520 |
|
|
start_sequence ();
|
521 |
|
|
emit_move_insn (operand_subword (op0, 0, 1, DImode),
|
522 |
|
|
operand_subword (op1, 0, 1, DImode));
|
523 |
|
|
emit_move_insn (operand_subword (op0, 1, 1, DImode),
|
524 |
|
|
operand_subword (op1, 1, 1, DImode));
|
525 |
|
|
insns = get_insns ();
|
526 |
|
|
end_sequence ();
|
527 |
|
|
|
528 |
|
|
emit_insn (insns);
|
529 |
|
|
DONE;
|
530 |
|
|
}
|
531 |
|
|
})
|
532 |
|
|
|
533 |
|
|
(define_insn_and_split "*movdi_insn_non_v32"
|
534 |
|
|
[(set (match_operand:DI 0 "nonimmediate_operand" "=r,rx,m")
|
535 |
|
|
(match_operand:DI 1 "general_operand" "rx,g,rxM"))]
|
536 |
|
|
"(register_operand (operands[0], DImode)
|
537 |
|
|
|| register_operand (operands[1], DImode)
|
538 |
|
|
|| operands[1] == const0_rtx)
|
539 |
|
|
&& !TARGET_V32"
|
540 |
|
|
"#"
|
541 |
|
|
"&& reload_completed"
|
542 |
|
|
[(match_dup 2)]
|
543 |
|
|
"operands[2] = cris_split_movdx (operands);")
|
544 |
|
|
|
545 |
|
|
;; Overlapping (but non-identical) source memory address and destination
|
546 |
|
|
;; register would be a compiler bug, so we don't have to specify that.
|
547 |
|
|
(define_insn "*movdi_v32"
|
548 |
|
|
[(set
|
549 |
|
|
(match_operand:DI 0 "nonimmediate_operand" "=r,rx,&r,>, m,r,x,m")
|
550 |
|
|
(match_operand:DI 1 "general_operand" "rxi,r>,m, rx,r,m,m,x"))]
|
551 |
|
|
"TARGET_V32"
|
552 |
|
|
{
|
553 |
|
|
switch (which_alternative)
|
554 |
|
|
{
|
555 |
|
|
/* FIXME: 1) Use autoincrement where possible. 2) Have peephole2,
|
556 |
|
|
particularly for cases where the address register is dead. */
|
557 |
|
|
case 5:
|
558 |
|
|
if (REGNO (operands[0]) == REGNO (XEXP (operands[1], 0)))
|
559 |
|
|
return "addq 4,%L1\;move.d %1,%H0\;subq 4,%L1\;move.d %1,%M0";
|
560 |
|
|
gcc_assert (REGNO (operands[0]) + 1 == REGNO (XEXP (operands[1], 0)));
|
561 |
|
|
return "move.d [%L1+],%M0\;move.d [%L1],%H0";
|
562 |
|
|
case 2:
|
563 |
|
|
/* We could do away with the addq if we knew the address-register
|
564 |
|
|
isn't ACR. If we knew the address-register is dead, we could do
|
565 |
|
|
away with the subq too. */
|
566 |
|
|
return "move.d [%L1],%M0\;addq 4,%L1\;move.d [%L1],%H0\;subq 4,%L1";
|
567 |
|
|
case 4:
|
568 |
|
|
return "move.d %M1,[%L0]\;addq 4,%L0\;move.d %H1,[%L0]\;subq 4,%L0";
|
569 |
|
|
case 6:
|
570 |
|
|
return "move [%L1],%M0\;addq 4,%L1\;move [%L1],%H0\;subq 4,%L1";
|
571 |
|
|
case 7:
|
572 |
|
|
return "move %M1,[%L0]\;addq 4,%L0\;move %H1,[%L0]\;subq 4,%L0";
|
573 |
|
|
|
574 |
|
|
default:
|
575 |
|
|
return "#";
|
576 |
|
|
}
|
577 |
|
|
}
|
578 |
|
|
;; The non-split cases clobber cc0 because of their adds and subs.
|
579 |
|
|
;; Beware that NOTICE_UPDATE_CC is called before the forced split happens.
|
580 |
|
|
[(set_attr "cc" "*,*,clobber,*,clobber,clobber,*,*")])
|
581 |
|
|
|
582 |
|
|
;; Much like "*movdi_insn_non_v32". Overlapping registers and constants
|
583 |
|
|
;; is handled so much better in cris_split_movdx.
|
584 |
|
|
(define_split
|
585 |
|
|
[(set (match_operand:DI 0 "nonimmediate_operand" "")
|
586 |
|
|
(match_operand:DI 1 "general_operand" ""))]
|
587 |
|
|
"TARGET_V32
|
588 |
|
|
&& reload_completed
|
589 |
|
|
&& (!MEM_P (operands[0]) || !REG_P (XEXP (operands[0], 0)))
|
590 |
|
|
&& (!MEM_P (operands[1]) || !REG_P (XEXP (operands[1], 0)))"
|
591 |
|
|
[(match_dup 2)]
|
592 |
|
|
"operands[2] = cris_split_movdx (operands);")
|
593 |
|
|
|
594 |
|
|
;; Side-effect patterns for move.S1 [rx=ry+rx.S2],rw
|
595 |
|
|
;; and move.S1 [rx=ry+i],rz
|
596 |
|
|
;; Then movs.S1 and movu.S1 for both modes.
|
597 |
|
|
;;
|
598 |
|
|
;; move.S1 [rx=ry+rz.S],rw avoiding when rx is ry, or rw is rx
|
599 |
|
|
;; FIXME: These could have anonymous mode for operand 0.
|
600 |
|
|
;; FIXME: Special registers' alternatives too.
|
601 |
|
|
|
602 |
|
|
(define_insn "*mov_side_biap"
|
603 |
|
|
[(set (match_operand:BW 0 "register_operand" "=r,r")
|
604 |
|
|
(mem:BW (plus:SI
|
605 |
|
|
(mult:SI (match_operand:SI 1 "register_operand" "r,r")
|
606 |
|
|
(match_operand:SI 2 "const_int_operand" "n,n"))
|
607 |
|
|
(match_operand:SI 3 "register_operand" "r,r"))))
|
608 |
|
|
(set (match_operand:SI 4 "register_operand" "=*3,r")
|
609 |
|
|
(plus:SI (mult:SI (match_dup 1)
|
610 |
|
|
(match_dup 2))
|
611 |
|
|
(match_dup 3)))]
|
612 |
|
|
"cris_side_effect_mode_ok (MULT, operands, 4, 3, 1, 2, 0)"
|
613 |
|
|
"@
|
614 |
|
|
#
|
615 |
|
|
move [%4=%3+%1%T2],%0")
|
616 |
|
|
|
617 |
|
|
(define_insn "*mov_sidesisf_biap"
|
618 |
|
|
[(set (match_operand 0 "register_operand" "=r,r,x,x")
|
619 |
|
|
(mem (plus:SI
|
620 |
|
|
(mult:SI (match_operand:SI 1 "register_operand" "r,r,r,r")
|
621 |
|
|
(match_operand:SI 2 "const_int_operand" "n,n,n,n"))
|
622 |
|
|
(match_operand:SI 3 "register_operand" "r,r,r,r"))))
|
623 |
|
|
(set (match_operand:SI 4 "register_operand" "=*3,r,*3,r")
|
624 |
|
|
(plus:SI (mult:SI (match_dup 1)
|
625 |
|
|
(match_dup 2))
|
626 |
|
|
(match_dup 3)))]
|
627 |
|
|
"GET_MODE_SIZE (GET_MODE (operands[0])) == UNITS_PER_WORD
|
628 |
|
|
&& cris_side_effect_mode_ok (MULT, operands, 4, 3, 1, 2, 0)"
|
629 |
|
|
"@
|
630 |
|
|
#
|
631 |
|
|
move.%s0 [%4=%3+%1%T2],%0
|
632 |
|
|
#
|
633 |
|
|
move [%4=%3+%1%T2],%0")
|
634 |
|
|
|
635 |
|
|
;; move.S1 [rx=ry+i],rz
|
636 |
|
|
;; avoiding move.S1 [ry=ry+i],rz
|
637 |
|
|
;; and move.S1 [rz=ry+i],rz
|
638 |
|
|
;; Note that "i" is allowed to be a register.
|
639 |
|
|
|
640 |
|
|
(define_insn "*mov_side"
|
641 |
|
|
[(set (match_operand:BW 0 "register_operand" "=r,r,r,r,r")
|
642 |
|
|
(mem:BW
|
643 |
|
|
(plus:SI (match_operand:SI 1 "cris_bdap_operand" "%r,r,r,R,R")
|
644 |
|
|
(match_operand:SI 2 "cris_bdap_operand" "r>Rn,r,>Rn,r,r"))))
|
645 |
|
|
(set (match_operand:SI 3 "register_operand" "=*1,r,r,*2,r")
|
646 |
|
|
(plus:SI (match_dup 1)
|
647 |
|
|
(match_dup 2)))]
|
648 |
|
|
"cris_side_effect_mode_ok (PLUS, operands, 3, 1, 2, -1, 0)"
|
649 |
|
|
{
|
650 |
|
|
if ((which_alternative == 0 || which_alternative == 3)
|
651 |
|
|
&& (!CONST_INT_P (operands[2])
|
652 |
|
|
|| INTVAL (operands[2]) > 127
|
653 |
|
|
|| INTVAL (operands[2]) < -128
|
654 |
|
|
|| satisfies_constraint_N (operands[2])
|
655 |
|
|
|| satisfies_constraint_J (operands[2])))
|
656 |
|
|
return "#";
|
657 |
|
|
if (which_alternative == 4)
|
658 |
|
|
return "move [%3=%2%S1],%0";
|
659 |
|
|
return "move [%3=%1%S2],%0";
|
660 |
|
|
})
|
661 |
|
|
|
662 |
|
|
(define_insn "*mov_sidesisf"
|
663 |
|
|
[(set (match_operand 0 "register_operand" "=r,r,r,x,x,x,r,r,x,x")
|
664 |
|
|
(mem
|
665 |
|
|
(plus:SI
|
666 |
|
|
(match_operand:SI 1 "cris_bdap_operand" "%r,r,r,r,r,r,R,R,R,R")
|
667 |
|
|
(match_operand:SI 2 "cris_bdap_operand" "r>Rn,r,>Rn,r>Rn,r,>Rn,r,r,r,r"))))
|
668 |
|
|
(set (match_operand:SI 3 "register_operand" "=*1,r,r,*1,r,r,*2,r,*2,r")
|
669 |
|
|
(plus:SI (match_dup 1)
|
670 |
|
|
(match_dup 2)))]
|
671 |
|
|
"GET_MODE_SIZE (GET_MODE (operands[0])) == UNITS_PER_WORD
|
672 |
|
|
&& cris_side_effect_mode_ok (PLUS, operands, 3, 1, 2, -1, 0)"
|
673 |
|
|
{
|
674 |
|
|
if ((which_alternative == 0
|
675 |
|
|
|| which_alternative == 3
|
676 |
|
|
|| which_alternative == 6
|
677 |
|
|
|| which_alternative == 8)
|
678 |
|
|
&& (!CONST_INT_P (operands[2])
|
679 |
|
|
|| INTVAL (operands[2]) > 127
|
680 |
|
|
|| INTVAL (operands[2]) < -128
|
681 |
|
|
|| satisfies_constraint_N (operands[2])
|
682 |
|
|
|| satisfies_constraint_J (operands[2])))
|
683 |
|
|
return "#";
|
684 |
|
|
if (which_alternative < 3)
|
685 |
|
|
return "move.%s0 [%3=%1%S2],%0";
|
686 |
|
|
if (which_alternative == 7)
|
687 |
|
|
return "move.%s0 [%3=%2%S1],%0";
|
688 |
|
|
if (which_alternative == 9)
|
689 |
|
|
return "move [%3=%2%S1],%0";
|
690 |
|
|
return "move [%3=%1%S2],%0";
|
691 |
|
|
})
|
692 |
|
|
|
693 |
|
|
;; Other way around; move to memory.
|
694 |
|
|
|
695 |
|
|
;; Note that the condition (which for side-effect patterns is usually a
|
696 |
|
|
;; call to cris_side_effect_mode_ok), isn't consulted for register
|
697 |
|
|
;; allocation preferences -- constraints is the method for that. The
|
698 |
|
|
;; drawback is that we can't exclude register allocation to cause
|
699 |
|
|
;; "move.s rw,[rx=ry+rz.S]" when rw==rx without also excluding rx==ry or
|
700 |
|
|
;; rx==rz if we use an earlyclobber modifier for the constraint for rx.
|
701 |
|
|
;; Instead of that, we recognize and split the cases where dangerous
|
702 |
|
|
;; register combinations are spotted: where a register is set in the
|
703 |
|
|
;; side-effect, and used in the main insn. We don't handle the case where
|
704 |
|
|
;; the set in the main insn overlaps the set in the side-effect; that case
|
705 |
|
|
;; must be handled in gcc. We handle just the case where the set in the
|
706 |
|
|
;; side-effect overlaps the input operand of the main insn (i.e. just
|
707 |
|
|
;; moves to memory).
|
708 |
|
|
|
709 |
|
|
;;
|
710 |
|
|
;; move.s rz,[ry=rx+rw.S]
|
711 |
|
|
|
712 |
|
|
(define_insn "*mov_side_biap_mem"
|
713 |
|
|
[(set (mem:BW (plus:SI
|
714 |
|
|
(mult:SI (match_operand:SI 0 "register_operand" "r,r,r")
|
715 |
|
|
(match_operand:SI 1 "const_int_operand" "n,n,n"))
|
716 |
|
|
(match_operand:SI 2 "register_operand" "r,r,r")))
|
717 |
|
|
(match_operand:BW 3 "register_operand" "r,r,r"))
|
718 |
|
|
(set (match_operand:SI 4 "register_operand" "=*2,!3,r")
|
719 |
|
|
(plus:SI (mult:SI (match_dup 0)
|
720 |
|
|
(match_dup 1))
|
721 |
|
|
(match_dup 2)))]
|
722 |
|
|
"cris_side_effect_mode_ok (MULT, operands, 4, 2, 0, 1, 3)"
|
723 |
|
|
"@
|
724 |
|
|
#
|
725 |
|
|
#
|
726 |
|
|
move %3,[%4=%2+%0%T1]")
|
727 |
|
|
|
728 |
|
|
(define_insn "*mov_sidesisf_biap_mem"
|
729 |
|
|
[(set (mem (plus:SI
|
730 |
|
|
(mult:SI (match_operand:SI 0 "register_operand" "r,r,r,r,r,r")
|
731 |
|
|
(match_operand:SI 1 "const_int_operand" "n,n,n,n,n,n"))
|
732 |
|
|
(match_operand:SI 2 "register_operand" "r,r,r,r,r,r")))
|
733 |
|
|
(match_operand 3 "register_operand" "r,r,r,x,x,x"))
|
734 |
|
|
(set (match_operand:SI 4 "register_operand" "=*2,!3,r,*2,!3,r")
|
735 |
|
|
(plus:SI (mult:SI (match_dup 0)
|
736 |
|
|
(match_dup 1))
|
737 |
|
|
(match_dup 2)))]
|
738 |
|
|
"GET_MODE_SIZE (GET_MODE (operands[3])) == UNITS_PER_WORD
|
739 |
|
|
&& cris_side_effect_mode_ok (MULT, operands, 4, 2, 0, 1, 3)"
|
740 |
|
|
"@
|
741 |
|
|
#
|
742 |
|
|
#
|
743 |
|
|
move.%s3 %3,[%4=%2+%0%T1]
|
744 |
|
|
#
|
745 |
|
|
#
|
746 |
|
|
move %3,[%4=%2+%0%T1]")
|
747 |
|
|
|
748 |
|
|
;; Split for the case above where we're out of luck with register
|
749 |
|
|
;; allocation (again, the condition isn't checked for that), and we end up
|
750 |
|
|
;; with the set in the side-effect getting the same register as the input
|
751 |
|
|
;; register.
|
752 |
|
|
|
753 |
|
|
(define_split
|
754 |
|
|
[(parallel
|
755 |
|
|
[(set (match_operator
|
756 |
|
|
6 "cris_mem_op"
|
757 |
|
|
[(plus:SI
|
758 |
|
|
(mult:SI (match_operand:SI 0 "register_operand" "")
|
759 |
|
|
(match_operand:SI 1 "const_int_operand" ""))
|
760 |
|
|
(match_operand:SI 2 "register_operand" ""))])
|
761 |
|
|
(match_operand 3 "register_operand" ""))
|
762 |
|
|
(set (match_operand:SI 4 "register_operand" "")
|
763 |
|
|
(plus:SI (mult:SI (match_dup 0)
|
764 |
|
|
(match_dup 1))
|
765 |
|
|
(match_dup 2)))])]
|
766 |
|
|
"reload_completed && reg_overlap_mentioned_p (operands[4], operands[3])"
|
767 |
|
|
[(set (match_dup 5) (match_dup 3))
|
768 |
|
|
(set (match_dup 4) (match_dup 2))
|
769 |
|
|
(set (match_dup 4)
|
770 |
|
|
(plus:SI (mult:SI (match_dup 0)
|
771 |
|
|
(match_dup 1))
|
772 |
|
|
(match_dup 4)))]
|
773 |
|
|
"operands[5]
|
774 |
|
|
= replace_equiv_address (operands[6],
|
775 |
|
|
gen_rtx_PLUS (SImode,
|
776 |
|
|
gen_rtx_MULT (SImode,
|
777 |
|
|
operands[0],
|
778 |
|
|
operands[1]),
|
779 |
|
|
operands[2]));")
|
780 |
|
|
|
781 |
|
|
;; move.s rx,[ry=rz+i]
|
782 |
|
|
;; FIXME: These could have anonymous mode for operand 2.
|
783 |
|
|
|
784 |
|
|
;; QImode
|
785 |
|
|
|
786 |
|
|
(define_insn "*mov_side_mem"
|
787 |
|
|
[(set (mem:BW
|
788 |
|
|
(plus:SI (match_operand:SI 0 "cris_bdap_operand" "%r,r,r,r,R,R,R")
|
789 |
|
|
(match_operand:SI 1 "cris_bdap_operand" "r>Rn,r>Rn,r,>Rn,r,r,r")))
|
790 |
|
|
(match_operand:BW 2 "register_operand" "r,r,r,r,r,r,r"))
|
791 |
|
|
(set (match_operand:SI 3 "register_operand" "=*0,!*2,r,r,*1,!*2,r")
|
792 |
|
|
(plus:SI (match_dup 0)
|
793 |
|
|
(match_dup 1)))]
|
794 |
|
|
"cris_side_effect_mode_ok (PLUS, operands, 3, 0, 1, -1, 2)"
|
795 |
|
|
{
|
796 |
|
|
if ((which_alternative == 0 || which_alternative == 4)
|
797 |
|
|
&& (!CONST_INT_P (operands[1])
|
798 |
|
|
|| INTVAL (operands[1]) > 127
|
799 |
|
|
|| INTVAL (operands[1]) < -128
|
800 |
|
|
|| satisfies_constraint_N (operands[1])
|
801 |
|
|
|| satisfies_constraint_J (operands[1])))
|
802 |
|
|
return "#";
|
803 |
|
|
if (which_alternative == 1 || which_alternative == 5)
|
804 |
|
|
return "#";
|
805 |
|
|
if (which_alternative == 6)
|
806 |
|
|
return "move.%s2 %2,[%3=%1%S0]";
|
807 |
|
|
return "move %2,[%3=%0%S1]";
|
808 |
|
|
})
|
809 |
|
|
|
810 |
|
|
;; SImode
|
811 |
|
|
|
812 |
|
|
(define_insn "*mov_sidesisf_mem"
|
813 |
|
|
[(set (mem
|
814 |
|
|
(plus:SI
|
815 |
|
|
(match_operand:SI
|
816 |
|
|
|
817 |
|
|
"%r, r, r,r, r, r,r, R,R, R,R, R")
|
818 |
|
|
(match_operand:SI
|
819 |
|
|
1 "cris_bdap_operand"
|
820 |
|
|
"r>Rn,r>Rn,r,>Rn,r>Rn,r,>Rn,r,r, r,r, r")))
|
821 |
|
|
(match_operand 2 "register_operand"
|
822 |
|
|
"r, r, r,r, x, x,x, r,r, r,x, x"))
|
823 |
|
|
(set (match_operand:SI 3 "register_operand"
|
824 |
|
|
"=*0,!2, r,r, *0, r,r, *1,!*2,r,*1,r")
|
825 |
|
|
(plus:SI (match_dup 0)
|
826 |
|
|
(match_dup 1)))]
|
827 |
|
|
"GET_MODE_SIZE (GET_MODE (operands[2])) == UNITS_PER_WORD
|
828 |
|
|
&& cris_side_effect_mode_ok (PLUS, operands, 3, 0, 1, -1, 2)"
|
829 |
|
|
{
|
830 |
|
|
if ((which_alternative == 0 || which_alternative == 4)
|
831 |
|
|
&& (!CONST_INT_P (operands[1])
|
832 |
|
|
|| INTVAL (operands[1]) > 127
|
833 |
|
|
|| INTVAL (operands[1]) < -128
|
834 |
|
|
|| satisfies_constraint_N (operands[1])
|
835 |
|
|
|| satisfies_constraint_J (operands[1])))
|
836 |
|
|
return "#";
|
837 |
|
|
if (which_alternative == 1
|
838 |
|
|
|| which_alternative == 7
|
839 |
|
|
|| which_alternative == 8
|
840 |
|
|
|| which_alternative == 10)
|
841 |
|
|
return "#";
|
842 |
|
|
if (which_alternative < 4)
|
843 |
|
|
return "move.%s2 %2,[%3=%0%S1]";
|
844 |
|
|
if (which_alternative == 9)
|
845 |
|
|
return "move.%s2 %2,[%3=%1%S0]";
|
846 |
|
|
if (which_alternative == 11)
|
847 |
|
|
return "move %2,[%3=%1%S0]";
|
848 |
|
|
return "move %2,[%3=%0%S1]";
|
849 |
|
|
})
|
850 |
|
|
|
851 |
|
|
;; Like the biap case, a split where the set in the side-effect gets the
|
852 |
|
|
;; same register as the input register to the main insn, since the
|
853 |
|
|
;; condition isn't checked at register allocation.
|
854 |
|
|
|
855 |
|
|
(define_split
|
856 |
|
|
[(parallel
|
857 |
|
|
[(set (match_operator
|
858 |
|
|
4 "cris_mem_op"
|
859 |
|
|
[(plus:SI
|
860 |
|
|
(match_operand:SI 0 "cris_bdap_operand" "")
|
861 |
|
|
(match_operand:SI 1 "cris_bdap_operand" ""))])
|
862 |
|
|
(match_operand 2 "register_operand" ""))
|
863 |
|
|
(set (match_operand:SI 3 "register_operand" "")
|
864 |
|
|
(plus:SI (match_dup 0) (match_dup 1)))])]
|
865 |
|
|
"reload_completed && reg_overlap_mentioned_p (operands[3], operands[2])"
|
866 |
|
|
[(set (match_dup 4) (match_dup 2))
|
867 |
|
|
(set (match_dup 3) (match_dup 0))
|
868 |
|
|
(set (match_dup 3) (plus:SI (match_dup 3) (match_dup 1)))]
|
869 |
|
|
"")
|
870 |
|
|
|
871 |
|
|
;; Clear memory side-effect patterns. It is hard to get to the mode if
|
872 |
|
|
;; the MEM was anonymous, so there will be one for each mode.
|
873 |
|
|
|
874 |
|
|
;; clear.[bwd] [ry=rx+rw.s2]
|
875 |
|
|
|
876 |
|
|
(define_insn "*clear_side_biap"
|
877 |
|
|
[(set (mem:BWD (plus:SI
|
878 |
|
|
(mult:SI (match_operand:SI 0 "register_operand" "r,r")
|
879 |
|
|
(match_operand:SI 1 "const_int_operand" "n,n"))
|
880 |
|
|
(match_operand:SI 2 "register_operand" "r,r")))
|
881 |
|
|
(const_int 0))
|
882 |
|
|
(set (match_operand:SI 3 "register_operand" "=*2,r")
|
883 |
|
|
(plus:SI (mult:SI (match_dup 0)
|
884 |
|
|
(match_dup 1))
|
885 |
|
|
(match_dup 2)))]
|
886 |
|
|
"cris_side_effect_mode_ok (MULT, operands, 3, 2, 0, 1, -1)"
|
887 |
|
|
"@
|
888 |
|
|
#
|
889 |
|
|
clear [%3=%2+%0%T1]")
|
890 |
|
|
|
891 |
|
|
;; clear.[bwd] [ry=rz+i]
|
892 |
|
|
|
893 |
|
|
(define_insn "*clear_side"
|
894 |
|
|
[(set (mem:BWD
|
895 |
|
|
(plus:SI (match_operand:SI 0 "cris_bdap_operand" "%r,r,r,R,R")
|
896 |
|
|
(match_operand:SI 1 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")))
|
897 |
|
|
(const_int 0))
|
898 |
|
|
(set (match_operand:SI 2 "register_operand" "=*0,r,r,*1,r")
|
899 |
|
|
(plus:SI (match_dup 0)
|
900 |
|
|
(match_dup 1)))]
|
901 |
|
|
"cris_side_effect_mode_ok (PLUS, operands, 2, 0, 1, -1, -1)"
|
902 |
|
|
{
|
903 |
|
|
if ((which_alternative == 0 || which_alternative == 3)
|
904 |
|
|
&& (!CONST_INT_P (operands[1])
|
905 |
|
|
|| INTVAL (operands[1]) > 127
|
906 |
|
|
|| INTVAL (operands[1]) < -128
|
907 |
|
|
|| satisfies_constraint_N (operands[1])
|
908 |
|
|
|| satisfies_constraint_J (operands[1])))
|
909 |
|
|
return "#";
|
910 |
|
|
if (which_alternative == 4)
|
911 |
|
|
return "clear [%2=%1%S0]";
|
912 |
|
|
return "clear [%2=%0%S1]";
|
913 |
|
|
})
|
914 |
|
|
|
915 |
|
|
;; Normal move patterns from SI on.
|
916 |
|
|
|
917 |
|
|
(define_expand "movsi"
|
918 |
|
|
[(set
|
919 |
|
|
(match_operand:SI 0 "nonimmediate_operand" "")
|
920 |
|
|
(match_operand:SI 1 "cris_general_operand_or_symbol" ""))]
|
921 |
|
|
""
|
922 |
|
|
{
|
923 |
|
|
/* If the output goes to a MEM, make sure we have zero or a register as
|
924 |
|
|
input. */
|
925 |
|
|
if (MEM_P (operands[0])
|
926 |
|
|
&& ! REG_S_P (operands[1])
|
927 |
|
|
&& operands[1] != const0_rtx
|
928 |
|
|
&& can_create_pseudo_p ())
|
929 |
|
|
operands[1] = force_reg (SImode, operands[1]);
|
930 |
|
|
|
931 |
|
|
/* If we're generating PIC and have an incoming symbol, validize it to a
|
932 |
|
|
general operand or something that will match a special pattern.
|
933 |
|
|
|
934 |
|
|
FIXME: Do we *have* to recognize anything that would normally be a
|
935 |
|
|
valid symbol? Can we exclude global PIC addresses with an added
|
936 |
|
|
offset? */
|
937 |
|
|
if (flag_pic
|
938 |
|
|
&& CONSTANT_ADDRESS_P (operands[1])
|
939 |
|
|
&& !cris_valid_pic_const (operands[1], false))
|
940 |
|
|
{
|
941 |
|
|
enum cris_pic_symbol_type t = cris_pic_symbol_type_of (operands[1]);
|
942 |
|
|
|
943 |
|
|
gcc_assert (t != cris_no_symbol);
|
944 |
|
|
|
945 |
|
|
if (! REG_S_P (operands[0]))
|
946 |
|
|
{
|
947 |
|
|
/* We must have a register as destination for what we're about to
|
948 |
|
|
do, and for the patterns we generate. */
|
949 |
|
|
CRIS_ASSERT (can_create_pseudo_p ());
|
950 |
|
|
operands[1] = force_reg (SImode, operands[1]);
|
951 |
|
|
}
|
952 |
|
|
else
|
953 |
|
|
{
|
954 |
|
|
/* FIXME: add a REG_EQUAL (or is it REG_EQUIV) note to the
|
955 |
|
|
destination register for the symbol. It might not be
|
956 |
|
|
worth it. Measure. */
|
957 |
|
|
crtl->uses_pic_offset_table = 1;
|
958 |
|
|
if (t == cris_rel_symbol)
|
959 |
|
|
{
|
960 |
|
|
/* Change a "move.d sym(+offs),rN" into (allocate register rM)
|
961 |
|
|
for pre-v32:
|
962 |
|
|
"move.d (const (plus (unspec [sym]
|
963 |
|
|
CRIS_UNSPEC_GOTREL) offs)),rM" "add.d rPIC,rM,rN"
|
964 |
|
|
and for v32:
|
965 |
|
|
"move.d (const (plus (unspec [sym]
|
966 |
|
|
CRIS_UNSPEC_PCREL) offs)),rN". */
|
967 |
|
|
rtx tem, rm, rn = operands[0];
|
968 |
|
|
rtx sym = GET_CODE (operands[1]) != CONST
|
969 |
|
|
? operands[1] : get_related_value (operands[1]);
|
970 |
|
|
HOST_WIDE_INT offs = get_integer_term (operands[1]);
|
971 |
|
|
|
972 |
|
|
gcc_assert (can_create_pseudo_p ());
|
973 |
|
|
|
974 |
|
|
if (TARGET_V32)
|
975 |
|
|
{
|
976 |
|
|
tem = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym),
|
977 |
|
|
CRIS_UNSPEC_PCREL);
|
978 |
|
|
if (offs != 0)
|
979 |
|
|
tem = plus_constant (tem, offs);
|
980 |
|
|
rm = rn;
|
981 |
|
|
emit_move_insn (rm, gen_rtx_CONST (Pmode, tem));
|
982 |
|
|
}
|
983 |
|
|
else
|
984 |
|
|
{
|
985 |
|
|
/* We still uses GOT-relative addressing for
|
986 |
|
|
pre-v32. */
|
987 |
|
|
crtl->uses_pic_offset_table = 1;
|
988 |
|
|
tem = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, sym),
|
989 |
|
|
CRIS_UNSPEC_GOTREL);
|
990 |
|
|
if (offs != 0)
|
991 |
|
|
tem = plus_constant (tem, offs);
|
992 |
|
|
rm = gen_reg_rtx (Pmode);
|
993 |
|
|
emit_move_insn (rm, gen_rtx_CONST (Pmode, tem));
|
994 |
|
|
if (expand_binop (Pmode, add_optab, rm, pic_offset_table_rtx,
|
995 |
|
|
rn, 0, OPTAB_LIB_WIDEN) != rn)
|
996 |
|
|
internal_error ("expand_binop failed in movsi gotrel");
|
997 |
|
|
}
|
998 |
|
|
DONE;
|
999 |
|
|
}
|
1000 |
|
|
else if (t == cris_got_symbol)
|
1001 |
|
|
{
|
1002 |
|
|
/* Change a "move.d sym,rN" into (allocate register rM, rO)
|
1003 |
|
|
"move.d (const (unspec [sym] CRIS_UNSPEC_GOTREAD)),rM"
|
1004 |
|
|
"add.d rPIC,rM,rO", "move.d [rO],rN" with
|
1005 |
|
|
the memory access marked as read-only. */
|
1006 |
|
|
rtx tem, mem, rm, ro, rn = operands[0];
|
1007 |
|
|
gcc_assert (can_create_pseudo_p ());
|
1008 |
|
|
tem = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, operands[1]),
|
1009 |
|
|
CRIS_UNSPEC_GOTREAD);
|
1010 |
|
|
rm = gen_reg_rtx (Pmode);
|
1011 |
|
|
emit_move_insn (rm, gen_rtx_CONST (Pmode, tem));
|
1012 |
|
|
ro = gen_reg_rtx (Pmode);
|
1013 |
|
|
if (expand_binop (Pmode, add_optab, rm, pic_offset_table_rtx,
|
1014 |
|
|
ro, 0, OPTAB_LIB_WIDEN) != ro)
|
1015 |
|
|
internal_error ("expand_binop failed in movsi got");
|
1016 |
|
|
mem = gen_rtx_MEM (Pmode, ro);
|
1017 |
|
|
|
1018 |
|
|
/* This MEM doesn't alias anything. Whether it
|
1019 |
|
|
aliases other same symbols is unimportant. */
|
1020 |
|
|
set_mem_alias_set (mem, new_alias_set ());
|
1021 |
|
|
MEM_NOTRAP_P (mem) = 1;
|
1022 |
|
|
|
1023 |
|
|
/* We can set the GOT memory read of a non-called symbol
|
1024 |
|
|
to readonly, but not that of a call symbol, as those
|
1025 |
|
|
are subject to lazy evaluation and usually have the value
|
1026 |
|
|
changed from the first call to the second (but
|
1027 |
|
|
constant thereafter). */
|
1028 |
|
|
MEM_READONLY_P (mem) = 1;
|
1029 |
|
|
emit_move_insn (rn, mem);
|
1030 |
|
|
DONE;
|
1031 |
|
|
}
|
1032 |
|
|
else
|
1033 |
|
|
{
|
1034 |
|
|
/* We get here when we have to change something that would
|
1035 |
|
|
be recognizable if it wasn't PIC. A ``sym'' is ok for
|
1036 |
|
|
PIC symbols both with and without a GOT entry. And ``sym
|
1037 |
|
|
+ offset'' is ok for local symbols, so the only thing it
|
1038 |
|
|
could be, is a global symbol with an offset. Check and
|
1039 |
|
|
abort if not. */
|
1040 |
|
|
rtx reg = gen_reg_rtx (Pmode);
|
1041 |
|
|
rtx sym = get_related_value (operands[1]);
|
1042 |
|
|
HOST_WIDE_INT offs = get_integer_term (operands[1]);
|
1043 |
|
|
|
1044 |
|
|
gcc_assert (can_create_pseudo_p ()
|
1045 |
|
|
&& t == cris_got_symbol_needing_fixup
|
1046 |
|
|
&& sym != NULL_RTX && offs != 0);
|
1047 |
|
|
|
1048 |
|
|
emit_move_insn (reg, sym);
|
1049 |
|
|
if (expand_binop (SImode, add_optab, reg,
|
1050 |
|
|
GEN_INT (offs), operands[0], 0,
|
1051 |
|
|
OPTAB_LIB_WIDEN) != operands[0])
|
1052 |
|
|
internal_error ("expand_binop failed in movsi got+offs");
|
1053 |
|
|
DONE;
|
1054 |
|
|
}
|
1055 |
|
|
}
|
1056 |
|
|
}
|
1057 |
|
|
})
|
1058 |
|
|
|
1059 |
|
|
(define_insn "*movsi_got_load"
|
1060 |
|
|
[(set (reg:SI CRIS_GOT_REGNUM) (unspec:SI [(const_int 0)] CRIS_UNSPEC_GOT))]
|
1061 |
|
|
"flag_pic"
|
1062 |
|
|
{
|
1063 |
|
|
return TARGET_V32
|
1064 |
|
|
? "lapc _GLOBAL_OFFSET_TABLE_,%:"
|
1065 |
|
|
: "move.d $pc,%:\;sub.d .:GOTOFF,%:";
|
1066 |
|
|
}
|
1067 |
|
|
[(set_attr "cc" "clobber")])
|
1068 |
|
|
|
1069 |
|
|
(define_insn "*movsi_internal"
|
1070 |
|
|
[(set
|
1071 |
|
|
(match_operand:SI 0 "nonimmediate_operand"
|
1072 |
|
|
"=r,r, r,Q>,r,Q>,g,r,r, r,g,rQ>,x, m,x")
|
1073 |
|
|
(match_operand:SI 1 "cris_general_operand_or_pic_source"
|
1074 |
|
|
"r,Q>,M,M, I,r, M,n,!S,g,r,x, rQ>,x,gi"))]
|
1075 |
|
|
;; Note that we prefer not to use the S alternative (if for some reason
|
1076 |
|
|
;; it competes with others) above, but g matches S.
|
1077 |
|
|
""
|
1078 |
|
|
{
|
1079 |
|
|
/* Better to have c-switch here; it is worth it to optimize the size of
|
1080 |
|
|
move insns. The alternative would be to try to find more constraint
|
1081 |
|
|
letters. FIXME: Check again. It seems this could shrink a bit. */
|
1082 |
|
|
switch (which_alternative)
|
1083 |
|
|
{
|
1084 |
|
|
case 9:
|
1085 |
|
|
if (TARGET_V32)
|
1086 |
|
|
{
|
1087 |
|
|
if (!flag_pic
|
1088 |
|
|
&& (GET_CODE (operands[1]) == SYMBOL_REF
|
1089 |
|
|
|| GET_CODE (operands[1]) == LABEL_REF
|
1090 |
|
|
|| GET_CODE (operands[1]) == CONST))
|
1091 |
|
|
{
|
1092 |
|
|
/* FIXME: Express this through (set_attr cc none) instead,
|
1093 |
|
|
since we can't express the ``none'' at this point. FIXME:
|
1094 |
|
|
Use lapc for everything except const_int and when next cc0
|
1095 |
|
|
user would want the flag setting. */
|
1096 |
|
|
CC_STATUS_INIT;
|
1097 |
|
|
return "lapc %1,%0";
|
1098 |
|
|
}
|
1099 |
|
|
if (flag_pic == 1
|
1100 |
|
|
&& GET_CODE (operands[1]) == CONST
|
1101 |
|
|
&& GET_CODE (XEXP (operands[1], 0)) == UNSPEC
|
1102 |
|
|
&& XINT (XEXP (operands[1], 0), 1) == CRIS_UNSPEC_GOTREAD)
|
1103 |
|
|
return "movu.w %1,%0";
|
1104 |
|
|
}
|
1105 |
|
|
/* FALLTHROUGH */
|
1106 |
|
|
case 0:
|
1107 |
|
|
case 1:
|
1108 |
|
|
case 5:
|
1109 |
|
|
case 10:
|
1110 |
|
|
return "move.d %1,%0";
|
1111 |
|
|
|
1112 |
|
|
case 11:
|
1113 |
|
|
case 12:
|
1114 |
|
|
case 13:
|
1115 |
|
|
case 14:
|
1116 |
|
|
return "move %d1,%0";
|
1117 |
|
|
|
1118 |
|
|
case 2:
|
1119 |
|
|
case 3:
|
1120 |
|
|
case 6:
|
1121 |
|
|
return "clear.d %0";
|
1122 |
|
|
|
1123 |
|
|
/* Constants -32..31 except 0. */
|
1124 |
|
|
case 4:
|
1125 |
|
|
return "moveq %1,%0";
|
1126 |
|
|
|
1127 |
|
|
/* We can win a little on constants -32768..-33, 32..65535. */
|
1128 |
|
|
case 7:
|
1129 |
|
|
if (INTVAL (operands[1]) > 0 && INTVAL (operands[1]) < 65536)
|
1130 |
|
|
{
|
1131 |
|
|
if (INTVAL (operands[1]) < 256)
|
1132 |
|
|
return "movu.b %1,%0";
|
1133 |
|
|
return "movu.w %1,%0";
|
1134 |
|
|
}
|
1135 |
|
|
else if (INTVAL (operands[1]) >= -32768 && INTVAL (operands[1]) < 32768)
|
1136 |
|
|
{
|
1137 |
|
|
if (INTVAL (operands[1]) >= -128 && INTVAL (operands[1]) < 128)
|
1138 |
|
|
return "movs.b %1,%0";
|
1139 |
|
|
return "movs.w %1,%0";
|
1140 |
|
|
}
|
1141 |
|
|
return "move.d %1,%0";
|
1142 |
|
|
|
1143 |
|
|
case 8:
|
1144 |
|
|
{
|
1145 |
|
|
rtx tem = operands[1];
|
1146 |
|
|
gcc_assert (GET_CODE (tem) == CONST);
|
1147 |
|
|
tem = XEXP (tem, 0);
|
1148 |
|
|
if (GET_CODE (tem) == PLUS
|
1149 |
|
|
&& GET_CODE (XEXP (tem, 0)) == UNSPEC
|
1150 |
|
|
&& (XINT (XEXP (tem, 0), 1) == CRIS_UNSPEC_GOTREL
|
1151 |
|
|
|| XINT (XEXP (tem, 0), 1) == CRIS_UNSPEC_PCREL)
|
1152 |
|
|
&& CONST_INT_P (XEXP (tem, 1)))
|
1153 |
|
|
tem = XEXP (tem, 0);
|
1154 |
|
|
gcc_assert (GET_CODE (tem) == UNSPEC);
|
1155 |
|
|
switch (XINT (tem, 1))
|
1156 |
|
|
{
|
1157 |
|
|
case CRIS_UNSPEC_GOTREAD:
|
1158 |
|
|
case CRIS_UNSPEC_PLTGOTREAD:
|
1159 |
|
|
/* Using sign-extend mostly to be consistent with the
|
1160 |
|
|
indexed addressing mode. */
|
1161 |
|
|
if (flag_pic == 1)
|
1162 |
|
|
return "movs.w %1,%0";
|
1163 |
|
|
return "move.d %1,%0";
|
1164 |
|
|
|
1165 |
|
|
case CRIS_UNSPEC_GOTREL:
|
1166 |
|
|
case CRIS_UNSPEC_PLT_GOTREL:
|
1167 |
|
|
gcc_assert (!TARGET_V32);
|
1168 |
|
|
return "move.d %1,%0";
|
1169 |
|
|
|
1170 |
|
|
case CRIS_UNSPEC_PCREL:
|
1171 |
|
|
case CRIS_UNSPEC_PLT_PCREL:
|
1172 |
|
|
gcc_assert (TARGET_V32);
|
1173 |
|
|
return "lapc %1,%0";
|
1174 |
|
|
|
1175 |
|
|
default:
|
1176 |
|
|
gcc_unreachable ();
|
1177 |
|
|
}
|
1178 |
|
|
}
|
1179 |
|
|
default:
|
1180 |
|
|
return "BOGUS: %1 to %0";
|
1181 |
|
|
}
|
1182 |
|
|
}
|
1183 |
|
|
[(set_attr "slottable" "yes,yes,yes,yes,yes,yes,no,no,no,no,no,yes,yes,no,no")
|
1184 |
|
|
(set_attr "cc" "*,*,*,*,*,*,*,*,*,*,*,none,none,none,none")])
|
1185 |
|
|
|
1186 |
|
|
;; Extend operations with side-effect from mem to register, using
|
1187 |
|
|
;; MOVS/MOVU. These are from mem to register only.
|
1188 |
|
|
;;
|
1189 |
|
|
;; [rx=ry+rz.S]
|
1190 |
|
|
;;
|
1191 |
|
|
;; QImode to HImode
|
1192 |
|
|
;;
|
1193 |
|
|
;; FIXME: Can we omit extend to HImode, since GCC should truncate for
|
1194 |
|
|
;; HImode by itself? Perhaps use only anonymous modes?
|
1195 |
|
|
|
1196 |
|
|
(define_insn "*ext_sideqihi_biap"
|
1197 |
|
|
[(set (match_operand:HI 0 "register_operand" "=r,r")
|
1198 |
|
|
(match_operator:HI
|
1199 |
|
|
5 "cris_extend_operator"
|
1200 |
|
|
[(mem:QI (plus:SI
|
1201 |
|
|
(mult:SI (match_operand:SI 1 "register_operand" "r,r")
|
1202 |
|
|
(match_operand:SI 2 "const_int_operand" "n,n"))
|
1203 |
|
|
(match_operand:SI 3 "register_operand" "r,r")))]))
|
1204 |
|
|
(set (match_operand:SI 4 "register_operand" "=*3,r")
|
1205 |
|
|
(plus:SI (mult:SI (match_dup 1)
|
1206 |
|
|
(match_dup 2))
|
1207 |
|
|
(match_dup 3)))]
|
1208 |
|
|
"cris_side_effect_mode_ok (MULT, operands, 4, 3, 1, 2, 0)"
|
1209 |
|
|
"@
|
1210 |
|
|
#
|
1211 |
|
|
mov%e5.%m5 [%4=%3+%1%T2],%0")
|
1212 |
|
|
|
1213 |
|
|
(define_insn "*ext_sidesi_biap"
|
1214 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r")
|
1215 |
|
|
(match_operator:SI
|
1216 |
|
|
5 "cris_extend_operator"
|
1217 |
|
|
[(mem:BW (plus:SI
|
1218 |
|
|
(mult:SI (match_operand:SI 1 "register_operand" "r,r")
|
1219 |
|
|
(match_operand:SI 2 "const_int_operand" "n,n"))
|
1220 |
|
|
(match_operand:SI 3 "register_operand" "r,r")))]))
|
1221 |
|
|
(set (match_operand:SI 4 "register_operand" "=*3,r")
|
1222 |
|
|
(plus:SI (mult:SI (match_dup 1)
|
1223 |
|
|
(match_dup 2))
|
1224 |
|
|
(match_dup 3)))]
|
1225 |
|
|
"cris_side_effect_mode_ok (MULT, operands, 4, 3, 1, 2, 0)"
|
1226 |
|
|
"@
|
1227 |
|
|
#
|
1228 |
|
|
mov%e5 [%4=%3+%1%T2],%0")
|
1229 |
|
|
|
1230 |
|
|
;; Same but [rx=ry+i]
|
1231 |
|
|
|
1232 |
|
|
;; QImode to HImode
|
1233 |
|
|
|
1234 |
|
|
(define_insn "*ext_sideqihi"
|
1235 |
|
|
[(set (match_operand:HI 0 "register_operand" "=r,r,r,r,r")
|
1236 |
|
|
(match_operator:HI
|
1237 |
|
|
4 "cris_extend_operator"
|
1238 |
|
|
[(mem:QI (plus:SI
|
1239 |
|
|
(match_operand:SI 1 "cris_bdap_operand" "%r,r,r,R,R")
|
1240 |
|
|
(match_operand:SI 2 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")))]))
|
1241 |
|
|
(set (match_operand:SI 3 "register_operand" "=*1,r,r,*2,r")
|
1242 |
|
|
(plus:SI (match_dup 1)
|
1243 |
|
|
(match_dup 2)))]
|
1244 |
|
|
"cris_side_effect_mode_ok (PLUS, operands, 3, 1, 2, -1, 0)"
|
1245 |
|
|
{
|
1246 |
|
|
if ((which_alternative == 0 || which_alternative == 3)
|
1247 |
|
|
&& (!CONST_INT_P (operands[2])
|
1248 |
|
|
|| INTVAL (operands[2]) > 127
|
1249 |
|
|
|| INTVAL (operands[2]) < -128
|
1250 |
|
|
|| satisfies_constraint_N (operands[2])
|
1251 |
|
|
|| satisfies_constraint_J (operands[2])))
|
1252 |
|
|
return "#";
|
1253 |
|
|
if (which_alternative == 4)
|
1254 |
|
|
return "mov%e4.%m4 [%3=%2%S1],%0";
|
1255 |
|
|
return "mov%e4.%m4 [%3=%1%S2],%0";
|
1256 |
|
|
})
|
1257 |
|
|
|
1258 |
|
|
(define_insn "*ext_sidesi"
|
1259 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r")
|
1260 |
|
|
(match_operator:SI
|
1261 |
|
|
4 "cris_extend_operator"
|
1262 |
|
|
[(mem:BW (plus:SI
|
1263 |
|
|
(match_operand:SI 1 "cris_bdap_operand" "%r,r,r,R,R")
|
1264 |
|
|
(match_operand:SI 2 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")))]))
|
1265 |
|
|
(set (match_operand:SI 3 "register_operand" "=*1,r,r,*2,r")
|
1266 |
|
|
(plus:SI (match_dup 1)
|
1267 |
|
|
(match_dup 2)))]
|
1268 |
|
|
"cris_side_effect_mode_ok (PLUS, operands, 3, 1, 2, -1, 0)"
|
1269 |
|
|
{
|
1270 |
|
|
if ((which_alternative == 0 || which_alternative == 3)
|
1271 |
|
|
&& (!CONST_INT_P (operands[2])
|
1272 |
|
|
|| INTVAL (operands[2]) > 127
|
1273 |
|
|
|| INTVAL (operands[2]) < -128
|
1274 |
|
|
|| satisfies_constraint_N (operands[2])
|
1275 |
|
|
|| satisfies_constraint_J (operands[2])))
|
1276 |
|
|
return "#";
|
1277 |
|
|
if (which_alternative == 4)
|
1278 |
|
|
return "mov%e4 [%3=%2%S1],%0";
|
1279 |
|
|
return "mov%e4 [%3=%1%S2],%0";
|
1280 |
|
|
})
|
1281 |
|
|
|
1282 |
|
|
;; FIXME: See movsi.
|
1283 |
|
|
|
1284 |
|
|
(define_insn "movhi"
|
1285 |
|
|
[(set
|
1286 |
|
|
(match_operand:HI 0 "nonimmediate_operand" "=r,r, r,Q>,r,Q>,r,r,r,g,g,r,r,x")
|
1287 |
|
|
(match_operand:HI 1 "general_operand" "r,Q>,M,M, I,r, L,O,n,M,r,g,x,r"))]
|
1288 |
|
|
""
|
1289 |
|
|
{
|
1290 |
|
|
switch (which_alternative)
|
1291 |
|
|
{
|
1292 |
|
|
case 0:
|
1293 |
|
|
case 1:
|
1294 |
|
|
case 5:
|
1295 |
|
|
case 10:
|
1296 |
|
|
case 11:
|
1297 |
|
|
return "move.w %1,%0";
|
1298 |
|
|
case 12:
|
1299 |
|
|
case 13:
|
1300 |
|
|
return "move %1,%0";
|
1301 |
|
|
case 2:
|
1302 |
|
|
case 3:
|
1303 |
|
|
case 9:
|
1304 |
|
|
return "clear.w %0";
|
1305 |
|
|
case 4:
|
1306 |
|
|
return "moveq %1,%0";
|
1307 |
|
|
case 6:
|
1308 |
|
|
case 8:
|
1309 |
|
|
if (INTVAL (operands[1]) < 256 && INTVAL (operands[1]) >= -128)
|
1310 |
|
|
{
|
1311 |
|
|
if (INTVAL (operands[1]) > 0)
|
1312 |
|
|
return "movu.b %1,%0";
|
1313 |
|
|
return "movs.b %1,%0";
|
1314 |
|
|
}
|
1315 |
|
|
return "move.w %1,%0";
|
1316 |
|
|
case 7:
|
1317 |
|
|
return "movEq %b1,%0";
|
1318 |
|
|
default:
|
1319 |
|
|
return "BOGUS: %1 to %0";
|
1320 |
|
|
}
|
1321 |
|
|
}
|
1322 |
|
|
[(set_attr "slottable" "yes,yes,yes,yes,yes,yes,no,yes,no,no,no,no,yes,yes")
|
1323 |
|
|
(set_attr "cc" "*,*,none,none,*,none,*,clobber,*,none,none,*,none,none")])
|
1324 |
|
|
|
1325 |
|
|
(define_insn "movstricthi"
|
1326 |
|
|
[(set
|
1327 |
|
|
(strict_low_part
|
1328 |
|
|
(match_operand:HI 0 "nonimmediate_operand" "+r,r, r,Q>,Q>,g,r,g"))
|
1329 |
|
|
(match_operand:HI 1 "general_operand" "r,Q>,M,M, r, M,g,r"))]
|
1330 |
|
|
""
|
1331 |
|
|
"@
|
1332 |
|
|
move.w %1,%0
|
1333 |
|
|
move.w %1,%0
|
1334 |
|
|
clear.w %0
|
1335 |
|
|
clear.w %0
|
1336 |
|
|
move.w %1,%0
|
1337 |
|
|
clear.w %0
|
1338 |
|
|
move.w %1,%0
|
1339 |
|
|
move.w %1,%0"
|
1340 |
|
|
[(set_attr "slottable" "yes,yes,yes,yes,yes,no,no,no")])
|
1341 |
|
|
|
1342 |
|
|
(define_expand "reload_in"
|
1343 |
|
|
[(set (match_operand:BW 2 "register_operand" "=r")
|
1344 |
|
|
(match_operand:BW 1 "memory_operand" "m"))
|
1345 |
|
|
(set (match_operand:BW 0 "register_operand" "=x")
|
1346 |
|
|
(match_dup 2))]
|
1347 |
|
|
""
|
1348 |
|
|
"")
|
1349 |
|
|
|
1350 |
|
|
(define_expand "reload_out"
|
1351 |
|
|
[(set (match_operand:BW 2 "register_operand" "=&r")
|
1352 |
|
|
(match_operand:BW 1 "register_operand" "x"))
|
1353 |
|
|
(set (match_operand:BW 0 "memory_operand" "=m")
|
1354 |
|
|
(match_dup 2))]
|
1355 |
|
|
""
|
1356 |
|
|
"")
|
1357 |
|
|
|
1358 |
|
|
(define_insn "movqi"
|
1359 |
|
|
[(set (match_operand:QI 0 "nonimmediate_operand" "=r,Q>,r, r,Q>,r,g,g,r,r,r,x")
|
1360 |
|
|
(match_operand:QI 1 "general_operand" "r,r, Q>,M,M, I,M,r,O,g,x,r"))]
|
1361 |
|
|
""
|
1362 |
|
|
"@
|
1363 |
|
|
move.b %1,%0
|
1364 |
|
|
move.b %1,%0
|
1365 |
|
|
move.b %1,%0
|
1366 |
|
|
clear.b %0
|
1367 |
|
|
clear.b %0
|
1368 |
|
|
moveq %1,%0
|
1369 |
|
|
clear.b %0
|
1370 |
|
|
move.b %1,%0
|
1371 |
|
|
moveq %b1,%0
|
1372 |
|
|
move.b %1,%0
|
1373 |
|
|
move %1,%0
|
1374 |
|
|
move %1,%0"
|
1375 |
|
|
[(set_attr "slottable" "yes,yes,yes,yes,yes,yes,no,no,yes,no,yes,yes")
|
1376 |
|
|
(set_attr "cc" "*,*,*,*,*,*,*,*,clobber,*,none,none")])
|
1377 |
|
|
|
1378 |
|
|
(define_insn "movstrictqi"
|
1379 |
|
|
[(set (strict_low_part
|
1380 |
|
|
(match_operand:QI 0 "nonimmediate_operand" "+r,Q>,r, r,Q>,g,g,r"))
|
1381 |
|
|
(match_operand:QI 1 "general_operand" "r,r, Q>,M,M, M,r,g"))]
|
1382 |
|
|
""
|
1383 |
|
|
"@
|
1384 |
|
|
move.b %1,%0
|
1385 |
|
|
move.b %1,%0
|
1386 |
|
|
move.b %1,%0
|
1387 |
|
|
clear.b %0
|
1388 |
|
|
clear.b %0
|
1389 |
|
|
clear.b %0
|
1390 |
|
|
move.b %1,%0
|
1391 |
|
|
move.b %1,%0"
|
1392 |
|
|
[(set_attr "slottable" "yes,yes,yes,yes,yes,no,no,no")])
|
1393 |
|
|
|
1394 |
|
|
;; The valid "quick" bit-patterns are, except for 0.0, denormalized
|
1395 |
|
|
;; values REALLY close to 0, and some NaN:s (I think; their exponent is
|
1396 |
|
|
;; all ones); the worthwhile one is "0.0".
|
1397 |
|
|
;; It will use clear, so we know ALL types of immediate 0 never change cc.
|
1398 |
|
|
|
1399 |
|
|
(define_insn "movsf"
|
1400 |
|
|
[(set (match_operand:SF 0 "nonimmediate_operand" "=r,Q>,r, r,Q>,g,g,r,r,x,Q>,m,x, x")
|
1401 |
|
|
(match_operand:SF 1 "general_operand" "r,r, Q>,G,G, G,r,g,x,r,x, x,Q>,g"))]
|
1402 |
|
|
""
|
1403 |
|
|
"@
|
1404 |
|
|
move.d %1,%0
|
1405 |
|
|
move.d %1,%0
|
1406 |
|
|
move.d %1,%0
|
1407 |
|
|
clear.d %0
|
1408 |
|
|
clear.d %0
|
1409 |
|
|
clear.d %0
|
1410 |
|
|
move.d %1,%0
|
1411 |
|
|
move.d %1,%0
|
1412 |
|
|
move %1,%0
|
1413 |
|
|
move %1,%0
|
1414 |
|
|
move %1,%0
|
1415 |
|
|
move %1,%0
|
1416 |
|
|
move %1,%0
|
1417 |
|
|
move %1,%0"
|
1418 |
|
|
[(set_attr "slottable" "yes,yes,yes,yes,yes,no,no,no,yes,yes,yes,no,yes,no")])
|
1419 |
|
|
|
1420 |
|
|
;; Movem patterns. Primarily for use in function prologue and epilogue.
|
1421 |
|
|
;; The V32 variants have an ordering matching the expectations of the
|
1422 |
|
|
;; standard names "load_multiple" and "store_multiple"; pre-v32 movem
|
1423 |
|
|
;; store R0 in the highest memory location.
|
1424 |
|
|
|
1425 |
|
|
(define_expand "load_multiple"
|
1426 |
|
|
[(match_operand:SI 0 "register_operand" "")
|
1427 |
|
|
(match_operand:SI 1 "memory_operand" "")
|
1428 |
|
|
(match_operand:SI 2 "const_int_operand" "")]
|
1429 |
|
|
"TARGET_V32"
|
1430 |
|
|
{
|
1431 |
|
|
rtx indreg;
|
1432 |
|
|
|
1433 |
|
|
/* Apparently the predicate isn't checked, so we need to do so
|
1434 |
|
|
manually. Once happened for libstdc++-v3 locale_facets.tcc. */
|
1435 |
|
|
if (!MEM_P (operands[1]))
|
1436 |
|
|
FAIL;
|
1437 |
|
|
|
1438 |
|
|
indreg = XEXP (operands[1], 0);
|
1439 |
|
|
|
1440 |
|
|
if (GET_CODE (indreg) == POST_INC)
|
1441 |
|
|
indreg = XEXP (indreg, 0);
|
1442 |
|
|
if (!REG_P (indreg)
|
1443 |
|
|
|| GET_CODE (operands[2]) != CONST_INT
|
1444 |
|
|
|| !REG_P (operands[0])
|
1445 |
|
|
|| REGNO (operands[0]) != 0
|
1446 |
|
|
|| INTVAL (operands[2]) > CRIS_SP_REGNUM
|
1447 |
|
|
|| (int) REGNO (indreg) < INTVAL (operands[2]))
|
1448 |
|
|
FAIL;
|
1449 |
|
|
gcc_unreachable ();
|
1450 |
|
|
emit_insn (cris_gen_movem_load (operands[1], operands[2], 0));
|
1451 |
|
|
DONE;
|
1452 |
|
|
})
|
1453 |
|
|
|
1454 |
|
|
(define_expand "store_multiple"
|
1455 |
|
|
[(match_operand:SI 0 "memory_operand" "")
|
1456 |
|
|
(match_operand:SI 1 "register_operand" "")
|
1457 |
|
|
(match_operand:SI 2 "const_int_operand" "")]
|
1458 |
|
|
"TARGET_V32"
|
1459 |
|
|
{
|
1460 |
|
|
rtx indreg;
|
1461 |
|
|
|
1462 |
|
|
/* See load_multiple. */
|
1463 |
|
|
if (!MEM_P (operands[0]))
|
1464 |
|
|
FAIL;
|
1465 |
|
|
|
1466 |
|
|
indreg = XEXP (operands[0], 0);
|
1467 |
|
|
|
1468 |
|
|
if (GET_CODE (indreg) == POST_INC)
|
1469 |
|
|
indreg = XEXP (indreg, 0);
|
1470 |
|
|
if (!REG_P (indreg)
|
1471 |
|
|
|| GET_CODE (operands[2]) != CONST_INT
|
1472 |
|
|
|| !REG_P (operands[1])
|
1473 |
|
|
|| REGNO (operands[1]) != 0
|
1474 |
|
|
|| INTVAL (operands[2]) > CRIS_SP_REGNUM
|
1475 |
|
|
|| (int) REGNO (indreg) < INTVAL (operands[2]))
|
1476 |
|
|
FAIL;
|
1477 |
|
|
gcc_unreachable ();
|
1478 |
|
|
cris_emit_movem_store (operands[0], operands[2], 0, false);
|
1479 |
|
|
DONE;
|
1480 |
|
|
})
|
1481 |
|
|
|
1482 |
|
|
(define_insn "*cris_load_multiple"
|
1483 |
|
|
[(match_parallel 0 "cris_load_multiple_op"
|
1484 |
|
|
[(set (match_operand:SI 1 "register_operand" "=r,r")
|
1485 |
|
|
(match_operand:SI 2 "memory_operand" "Q,m"))])]
|
1486 |
|
|
""
|
1487 |
|
|
"movem %O0,%o0"
|
1488 |
|
|
[(set_attr "cc" "none")
|
1489 |
|
|
(set_attr "slottable" "yes,no")
|
1490 |
|
|
;; Not true, but setting the length to 0 causes return sequences (ret
|
1491 |
|
|
;; movem) to have the cost they had when (return) included the movem
|
1492 |
|
|
;; and reduces the performance penalty taken for needing to emit an
|
1493 |
|
|
;; epilogue (in turn copied by bb-reorder) instead of return patterns.
|
1494 |
|
|
;; FIXME: temporary change until all insn lengths are correctly
|
1495 |
|
|
;; described. FIXME: have better target control over bb-reorder.
|
1496 |
|
|
(set_attr "length" "0")])
|
1497 |
|
|
|
1498 |
|
|
(define_insn "*cris_store_multiple"
|
1499 |
|
|
[(match_parallel 0 "cris_store_multiple_op"
|
1500 |
|
|
[(set (match_operand:SI 2 "memory_operand" "=Q,m")
|
1501 |
|
|
(match_operand:SI 1 "register_operand" "r,r"))])]
|
1502 |
|
|
""
|
1503 |
|
|
"movem %o0,%O0"
|
1504 |
|
|
[(set_attr "cc" "none")
|
1505 |
|
|
(set_attr "slottable" "yes,no")])
|
1506 |
|
|
|
1507 |
|
|
|
1508 |
|
|
;; Sign- and zero-extend insns with standard names.
|
1509 |
|
|
;; Those for integer source operand are ordered with the widest source
|
1510 |
|
|
;; type first.
|
1511 |
|
|
|
1512 |
|
|
;; Sign-extend.
|
1513 |
|
|
|
1514 |
|
|
(define_insn "extendsidi2"
|
1515 |
|
|
[(set (match_operand:DI 0 "register_operand" "=r")
|
1516 |
|
|
(sign_extend:DI (match_operand:SI 1 "general_operand" "g")))]
|
1517 |
|
|
""
|
1518 |
|
|
"move.d %1,%M0\;smi %H0\;neg.d %H0,%H0")
|
1519 |
|
|
|
1520 |
|
|
(define_insn "extenddi2"
|
1521 |
|
|
[(set (match_operand:DI 0 "register_operand" "=r")
|
1522 |
|
|
(sign_extend:DI (match_operand:BW 1 "general_operand" "g")))]
|
1523 |
|
|
""
|
1524 |
|
|
"movs %1,%M0\;smi %H0\;neg.d %H0,%H0")
|
1525 |
|
|
|
1526 |
|
|
(define_insn "extendsi2"
|
1527 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r,r")
|
1528 |
|
|
(sign_extend:SI (match_operand:BW 1 "general_operand" "r,Q>,g")))]
|
1529 |
|
|
""
|
1530 |
|
|
"movs %1,%0"
|
1531 |
|
|
[(set_attr "slottable" "yes,yes,no")])
|
1532 |
|
|
|
1533 |
|
|
;; To do a byte->word extension, extend to dword, exept that the top half
|
1534 |
|
|
;; of the register will be clobbered. FIXME: Perhaps this is not needed.
|
1535 |
|
|
|
1536 |
|
|
(define_insn "extendqihi2"
|
1537 |
|
|
[(set (match_operand:HI 0 "register_operand" "=r,r,r")
|
1538 |
|
|
(sign_extend:HI (match_operand:QI 1 "general_operand" "r,Q>,g")))]
|
1539 |
|
|
""
|
1540 |
|
|
"movs.b %1,%0"
|
1541 |
|
|
[(set_attr "slottable" "yes,yes,no")])
|
1542 |
|
|
|
1543 |
|
|
|
1544 |
|
|
;; Zero-extend. The DImode ones are synthesized by gcc, so we don't
|
1545 |
|
|
;; specify them here.
|
1546 |
|
|
|
1547 |
|
|
(define_insn "zero_extendsi2"
|
1548 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r,r")
|
1549 |
|
|
(zero_extend:SI
|
1550 |
|
|
(match_operand:BW 1 "nonimmediate_operand" "r,Q>,m")))]
|
1551 |
|
|
""
|
1552 |
|
|
"movu %1,%0"
|
1553 |
|
|
[(set_attr "slottable" "yes,yes,no")])
|
1554 |
|
|
|
1555 |
|
|
;; Same comment as sign-extend QImode to HImode above applies.
|
1556 |
|
|
|
1557 |
|
|
(define_insn "zero_extendqihi2"
|
1558 |
|
|
[(set (match_operand:HI 0 "register_operand" "=r,r,r")
|
1559 |
|
|
(zero_extend:HI
|
1560 |
|
|
(match_operand:QI 1 "nonimmediate_operand" "r,Q>,m")))]
|
1561 |
|
|
""
|
1562 |
|
|
"movu.b %1,%0"
|
1563 |
|
|
[(set_attr "slottable" "yes,yes,no")])
|
1564 |
|
|
|
1565 |
|
|
;; All kinds of arithmetic and logical instructions.
|
1566 |
|
|
;;
|
1567 |
|
|
;; First, anonymous patterns to match addressing modes with
|
1568 |
|
|
;; side-effects.
|
1569 |
|
|
;;
|
1570 |
|
|
;; op.S [rx=ry+I],rz; (add, sub, or, and, bound).
|
1571 |
|
|
;;
|
1572 |
|
|
;; [rx=ry+rz.S]
|
1573 |
|
|
|
1574 |
|
|
(define_insn "*op_side_biap"
|
1575 |
|
|
[(set (match_operand:BWD 0 "register_operand" "=r,r")
|
1576 |
|
|
(match_operator:BWD
|
1577 |
|
|
6 "cris_orthogonal_operator"
|
1578 |
|
|
[(match_operand:BWD 1 "register_operand" "0,0")
|
1579 |
|
|
(mem:BWD (plus:SI
|
1580 |
|
|
(mult:SI (match_operand:SI 2 "register_operand" "r,r")
|
1581 |
|
|
(match_operand:SI 3 "const_int_operand" "n,n"))
|
1582 |
|
|
(match_operand:SI 4 "register_operand" "r,r")))]))
|
1583 |
|
|
(set (match_operand:SI 5 "register_operand" "=*4,r")
|
1584 |
|
|
(plus:SI (mult:SI (match_dup 2)
|
1585 |
|
|
(match_dup 3))
|
1586 |
|
|
(match_dup 4)))]
|
1587 |
|
|
"cris_side_effect_mode_ok (MULT, operands, 5, 4, 2, 3, 0)"
|
1588 |
|
|
"@
|
1589 |
|
|
#
|
1590 |
|
|
%x6 [%5=%4+%2%T3],%0")
|
1591 |
|
|
|
1592 |
|
|
;; [rx=ry+i] ([%4=%2+%3])
|
1593 |
|
|
|
1594 |
|
|
(define_insn "*op_side"
|
1595 |
|
|
[(set (match_operand:BWD 0 "register_operand" "=r,r,r,r,r")
|
1596 |
|
|
(match_operator:BWD
|
1597 |
|
|
5 "cris_orthogonal_operator"
|
1598 |
|
|
[(match_operand:BWD 1 "register_operand" "0,0,0,0,0")
|
1599 |
|
|
(mem:BWD (plus:SI
|
1600 |
|
|
(match_operand:SI 2 "cris_bdap_operand" "%r,r,r,R,R")
|
1601 |
|
|
(match_operand:SI 3 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")))]))
|
1602 |
|
|
(set (match_operand:SI 4 "register_operand" "=*2,r,r,*3,r")
|
1603 |
|
|
(plus:SI (match_dup 2)
|
1604 |
|
|
(match_dup 3)))]
|
1605 |
|
|
"cris_side_effect_mode_ok (PLUS, operands, 4, 2, 3, -1, 0)"
|
1606 |
|
|
{
|
1607 |
|
|
if ((which_alternative == 0 || which_alternative == 3)
|
1608 |
|
|
&& (!CONST_INT_P (operands[3])
|
1609 |
|
|
|| INTVAL (operands[3]) > 127
|
1610 |
|
|
|| INTVAL (operands[3]) < -128
|
1611 |
|
|
|| satisfies_constraint_N (operands[3])
|
1612 |
|
|
|| satisfies_constraint_J (operands[3])))
|
1613 |
|
|
return "#";
|
1614 |
|
|
if (which_alternative == 4)
|
1615 |
|
|
return "%x5.%s0 [%4=%3%S2],%0";
|
1616 |
|
|
return "%x5 [%4=%2%S3],%0";
|
1617 |
|
|
})
|
1618 |
|
|
|
1619 |
|
|
;; To match all cases for commutative operations we may have to have the
|
1620 |
|
|
;; following pattern for add, or & and. I do not know really, but it does
|
1621 |
|
|
;; not break anything.
|
1622 |
|
|
;;
|
1623 |
|
|
;; FIXME: This really ought to be checked.
|
1624 |
|
|
;;
|
1625 |
|
|
;; op.S [rx=ry+I],rz;
|
1626 |
|
|
;;
|
1627 |
|
|
;; [rx=ry+rz.S]
|
1628 |
|
|
|
1629 |
|
|
(define_insn "*op_swap_side_biap"
|
1630 |
|
|
[(set (match_operand:BWD 0 "register_operand" "=r,r")
|
1631 |
|
|
(match_operator:BWD
|
1632 |
|
|
6 "cris_commutative_orth_op"
|
1633 |
|
|
[(mem:BWD (plus:SI
|
1634 |
|
|
(mult:SI (match_operand:SI 2 "register_operand" "r,r")
|
1635 |
|
|
(match_operand:SI 3 "const_int_operand" "n,n"))
|
1636 |
|
|
(match_operand:SI 4 "register_operand" "r,r")))
|
1637 |
|
|
(match_operand:BWD 1 "register_operand" "0,0")]))
|
1638 |
|
|
(set (match_operand:SI 5 "register_operand" "=*4,r")
|
1639 |
|
|
(plus:SI (mult:SI (match_dup 2)
|
1640 |
|
|
(match_dup 3))
|
1641 |
|
|
(match_dup 4)))]
|
1642 |
|
|
"cris_side_effect_mode_ok (MULT, operands, 5, 4, 2, 3, 0)"
|
1643 |
|
|
"@
|
1644 |
|
|
#
|
1645 |
|
|
%x6 [%5=%4+%2%T3],%0")
|
1646 |
|
|
|
1647 |
|
|
;; [rx=ry+i] ([%4=%2+%3])
|
1648 |
|
|
;; FIXME: These could have anonymous mode for operand 0.
|
1649 |
|
|
|
1650 |
|
|
;; QImode
|
1651 |
|
|
|
1652 |
|
|
(define_insn "*op_swap_side"
|
1653 |
|
|
[(set (match_operand:BWD 0 "register_operand" "=r,r,r,r,r")
|
1654 |
|
|
(match_operator:BWD
|
1655 |
|
|
5 "cris_commutative_orth_op"
|
1656 |
|
|
[(mem:BWD
|
1657 |
|
|
(plus:SI (match_operand:SI 2 "cris_bdap_operand" "%r,r,r,R,R")
|
1658 |
|
|
(match_operand:SI 3 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")))
|
1659 |
|
|
(match_operand:BWD 1 "register_operand" "0,0,0,0,0")]))
|
1660 |
|
|
(set (match_operand:SI 4 "register_operand" "=*2,r,r,*3,r")
|
1661 |
|
|
(plus:SI (match_dup 2)
|
1662 |
|
|
(match_dup 3)))]
|
1663 |
|
|
"cris_side_effect_mode_ok (PLUS, operands, 4, 2, 3, -1, 0)"
|
1664 |
|
|
{
|
1665 |
|
|
if ((which_alternative == 0 || which_alternative == 3)
|
1666 |
|
|
&& (!CONST_INT_P (operands[3])
|
1667 |
|
|
|| INTVAL (operands[3]) > 127
|
1668 |
|
|
|| INTVAL (operands[3]) < -128
|
1669 |
|
|
|| satisfies_constraint_N (operands[3])
|
1670 |
|
|
|| satisfies_constraint_J (operands[3])))
|
1671 |
|
|
return "#";
|
1672 |
|
|
if (which_alternative == 4)
|
1673 |
|
|
return "%x5 [%4=%3%S2],%0";
|
1674 |
|
|
return "%x5 [%4=%2%S3],%0";
|
1675 |
|
|
})
|
1676 |
|
|
|
1677 |
|
|
;; Add operations, standard names.
|
1678 |
|
|
|
1679 |
|
|
;; Note that for the 'P' constraint, the high part can be -1 or 0. We
|
1680 |
|
|
;; output the insn through the 'A' output modifier as "adds.w" and "addq",
|
1681 |
|
|
;; respectively.
|
1682 |
|
|
(define_expand "adddi3"
|
1683 |
|
|
[(set (match_operand:DI 0 "register_operand")
|
1684 |
|
|
(plus:DI (match_operand:DI 1 "register_operand")
|
1685 |
|
|
(match_operand:DI 2 "general_operand")))]
|
1686 |
|
|
""
|
1687 |
|
|
{
|
1688 |
|
|
if (MEM_P (operands[2]) && TARGET_V32)
|
1689 |
|
|
operands[2] = force_reg (DImode, operands[2]);
|
1690 |
|
|
})
|
1691 |
|
|
|
1692 |
|
|
(define_insn "*adddi3_non_v32"
|
1693 |
|
|
[(set (match_operand:DI 0 "register_operand" "=r,r,r,&r,&r")
|
1694 |
|
|
(plus:DI (match_operand:DI 1 "register_operand" "%0,0,0,0,r")
|
1695 |
|
|
(match_operand:DI 2 "general_operand" "J,N,P,g,!To")))]
|
1696 |
|
|
"!TARGET_V32"
|
1697 |
|
|
"@
|
1698 |
|
|
addq %2,%M0\;ax\;addq 0,%H0
|
1699 |
|
|
subq %n2,%M0\;ax\;subq 0,%H0
|
1700 |
|
|
add%e2.%z2 %2,%M0\;ax\;%A2 %H2,%H0
|
1701 |
|
|
add.d %M2,%M0\;ax\;add.d %H2,%H0
|
1702 |
|
|
add.d %M2,%M1,%M0\;ax\;add.d %H2,%H1,%H0")
|
1703 |
|
|
|
1704 |
|
|
; It seems no use allowing a memory operand for this one, because we'd
|
1705 |
|
|
; need a scratch register for incrementing the address.
|
1706 |
|
|
(define_insn "*adddi3_v32"
|
1707 |
|
|
[(set (match_operand:DI 0 "register_operand" "=r,r,r,r,r")
|
1708 |
|
|
(plus:DI (match_operand:DI 1 "register_operand" "%0,0,0,0,0")
|
1709 |
|
|
(match_operand:DI 2 "nonmemory_operand" "J,N,P,r,n")))]
|
1710 |
|
|
"TARGET_V32"
|
1711 |
|
|
"@
|
1712 |
|
|
addq %2,%M0\;addc 0,%H0
|
1713 |
|
|
subq %n2,%M0\;ax\;subq 0,%H0
|
1714 |
|
|
add%e2.%z2 %2,%M0\;addc %H2,%H0
|
1715 |
|
|
add.d %M2,%M0\;addc %H2,%H0
|
1716 |
|
|
add.d %M2,%M0\;addc %H2,%H0")
|
1717 |
|
|
|
1718 |
|
|
(define_expand "add3"
|
1719 |
|
|
[(set (match_operand:BWD 0 "register_operand")
|
1720 |
|
|
(plus:BWD
|
1721 |
|
|
(match_operand:BWD 1 "register_operand")
|
1722 |
|
|
(match_operand:BWD 2 "general_operand")))]
|
1723 |
|
|
""
|
1724 |
|
|
"")
|
1725 |
|
|
|
1726 |
|
|
(define_insn "*addsi3_non_v32"
|
1727 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r, r,r,r,r, r,r, r")
|
1728 |
|
|
(plus:SI
|
1729 |
|
|
(match_operand:SI 1 "register_operand" "%0,0, 0,0,0,0, 0,r, r")
|
1730 |
|
|
(match_operand:SI 2 "general_operand" "r,Q>,J,N,n,!S,g,!To,0")))]
|
1731 |
|
|
|
1732 |
|
|
;; The last constraint is due to that after reload, the '%' is not
|
1733 |
|
|
;; honored, and canonicalization doesn't care about keeping the same
|
1734 |
|
|
;; register as in destination. This will happen after insn splitting.
|
1735 |
|
|
;; gcc <= 2.7.2. FIXME: Check for gcc-2.9x
|
1736 |
|
|
|
1737 |
|
|
"!TARGET_V32"
|
1738 |
|
|
{
|
1739 |
|
|
switch (which_alternative)
|
1740 |
|
|
{
|
1741 |
|
|
case 0:
|
1742 |
|
|
case 1:
|
1743 |
|
|
return "add.d %2,%0";
|
1744 |
|
|
case 2:
|
1745 |
|
|
return "addq %2,%0";
|
1746 |
|
|
case 3:
|
1747 |
|
|
return "subq %n2,%0";
|
1748 |
|
|
case 4:
|
1749 |
|
|
/* 'Known value', but not in -63..63.
|
1750 |
|
|
Check if addu/subu may be used. */
|
1751 |
|
|
if (INTVAL (operands[2]) > 0)
|
1752 |
|
|
{
|
1753 |
|
|
if (INTVAL (operands[2]) < 256)
|
1754 |
|
|
return "addu.b %2,%0";
|
1755 |
|
|
if (INTVAL (operands[2]) < 65536)
|
1756 |
|
|
return "addu.w %2,%0";
|
1757 |
|
|
}
|
1758 |
|
|
else
|
1759 |
|
|
{
|
1760 |
|
|
if (INTVAL (operands[2]) >= -255)
|
1761 |
|
|
return "subu.b %n2,%0";
|
1762 |
|
|
if (INTVAL (operands[2]) >= -65535)
|
1763 |
|
|
return "subu.w %n2,%0";
|
1764 |
|
|
}
|
1765 |
|
|
return "add.d %2,%0";
|
1766 |
|
|
case 5:
|
1767 |
|
|
{
|
1768 |
|
|
rtx tem = operands[2];
|
1769 |
|
|
gcc_assert (GET_CODE (tem) == CONST);
|
1770 |
|
|
tem = XEXP (tem, 0);
|
1771 |
|
|
if (GET_CODE (tem) == PLUS
|
1772 |
|
|
&& GET_CODE (XEXP (tem, 0)) == UNSPEC
|
1773 |
|
|
/* We don't allow CRIS_UNSPEC_PCREL here; we can't have a
|
1774 |
|
|
pc-relative operand in an add insn. */
|
1775 |
|
|
&& XINT (XEXP (tem, 0), 1) == CRIS_UNSPEC_GOTREL
|
1776 |
|
|
&& CONST_INT_P (XEXP (tem, 1)))
|
1777 |
|
|
tem = XEXP (tem, 0);
|
1778 |
|
|
gcc_assert (GET_CODE (tem) == UNSPEC);
|
1779 |
|
|
switch (XINT (tem, 1))
|
1780 |
|
|
{
|
1781 |
|
|
case CRIS_UNSPEC_GOTREAD:
|
1782 |
|
|
case CRIS_UNSPEC_PLTGOTREAD:
|
1783 |
|
|
/* Using sign-extend mostly to be consistent with the
|
1784 |
|
|
indexed addressing mode. */
|
1785 |
|
|
if (flag_pic == 1)
|
1786 |
|
|
return "adds.w %2,%0";
|
1787 |
|
|
return "add.d %2,%0";
|
1788 |
|
|
|
1789 |
|
|
case CRIS_UNSPEC_PLT_GOTREL:
|
1790 |
|
|
case CRIS_UNSPEC_GOTREL:
|
1791 |
|
|
return "add.d %2,%0";
|
1792 |
|
|
default:
|
1793 |
|
|
gcc_unreachable ();
|
1794 |
|
|
}
|
1795 |
|
|
}
|
1796 |
|
|
case 6:
|
1797 |
|
|
return "add%u2 %2,%0";
|
1798 |
|
|
case 7:
|
1799 |
|
|
return "add.d %2,%1,%0";
|
1800 |
|
|
case 8:
|
1801 |
|
|
return "add.d %1,%0";
|
1802 |
|
|
default:
|
1803 |
|
|
return "BOGUS addsi %2+%1 to %0";
|
1804 |
|
|
}
|
1805 |
|
|
}
|
1806 |
|
|
[(set_attr "slottable" "yes,yes,yes,yes,no,no,no,no,yes")])
|
1807 |
|
|
|
1808 |
|
|
; FIXME: Check what's best: having the three-operand ACR alternative
|
1809 |
|
|
; before or after the corresponding-operand2 alternative. Check for
|
1810 |
|
|
; *all* insns. FIXME: constant constraint letter for -128..127.
|
1811 |
|
|
(define_insn "*addsi3_v32"
|
1812 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,!a,r,!a, r,r,!a,r,!a,r,r,r,!a")
|
1813 |
|
|
(plus:SI
|
1814 |
|
|
(match_operand:SI 1 "register_operand" "%0,r, 0, r, 0,0,r, 0,r, 0,0,0,r")
|
1815 |
|
|
(match_operand:SI 2 "general_operand" "r, r, Q>,Q>,J,N,NJ,L,L, P,n,g,g")))]
|
1816 |
|
|
"TARGET_V32"
|
1817 |
|
|
"@
|
1818 |
|
|
add.d %2,%0
|
1819 |
|
|
addi %2.b,%1,%0
|
1820 |
|
|
add.d %2,%0
|
1821 |
|
|
addo.d %2,%1,%0
|
1822 |
|
|
addq %2,%0
|
1823 |
|
|
subq %n2,%0
|
1824 |
|
|
addoq %2,%1,%0
|
1825 |
|
|
adds.w %2,%0
|
1826 |
|
|
addo %2,%1,%0
|
1827 |
|
|
addu.w %2,%0
|
1828 |
|
|
add.d %2,%0
|
1829 |
|
|
add%u2 %2,%0
|
1830 |
|
|
addo.%Z2 %2,%1,%0"
|
1831 |
|
|
[(set_attr "slottable" "yes,yes,yes,yes,yes,yes,yes,no,no,no,no,no,no")
|
1832 |
|
|
(set_attr "cc" "*,none,*,none,*,*,none,*,none,*,*,*,none")])
|
1833 |
|
|
|
1834 |
|
|
(define_insn "*addhi3_non_v32"
|
1835 |
|
|
[(set (match_operand:HI 0 "register_operand" "=r,r, r,r,r,r")
|
1836 |
|
|
(plus:HI (match_operand:HI 1 "register_operand" "%0,0, 0,0,0,r")
|
1837 |
|
|
(match_operand:HI 2 "general_operand" "r,Q>,J,N,g,!To")))]
|
1838 |
|
|
"!TARGET_V32"
|
1839 |
|
|
"@
|
1840 |
|
|
add.w %2,%0
|
1841 |
|
|
add.w %2,%0
|
1842 |
|
|
addq %2,%0
|
1843 |
|
|
subq %n2,%0
|
1844 |
|
|
add.w %2,%0
|
1845 |
|
|
add.w %2,%1,%0"
|
1846 |
|
|
[(set_attr "slottable" "yes,yes,yes,yes,no,no")
|
1847 |
|
|
(set_attr "cc" "normal,normal,clobber,clobber,normal,normal")])
|
1848 |
|
|
|
1849 |
|
|
(define_insn "*addhi3_v32"
|
1850 |
|
|
[(set (match_operand:HI 0 "register_operand" "=r, !a,r,!a, r,r,!a,r,!a")
|
1851 |
|
|
(plus:HI
|
1852 |
|
|
(match_operand:HI 1 "register_operand" "%0,r, 0, r, 0,0,r, 0,r")
|
1853 |
|
|
(match_operand:HI 2 "general_operand" "r, r, Q>,Q>,J,N,NJ,g,g")))]
|
1854 |
|
|
"TARGET_V32"
|
1855 |
|
|
"@
|
1856 |
|
|
add.w %2,%0
|
1857 |
|
|
addi %2.b,%1,%0
|
1858 |
|
|
add.w %2,%0
|
1859 |
|
|
addo.w %2,%1,%0
|
1860 |
|
|
addq %2,%0
|
1861 |
|
|
subq %n2,%0
|
1862 |
|
|
addoq %2,%1,%0
|
1863 |
|
|
add.w %2,%0
|
1864 |
|
|
addo.w %2,%1,%0"
|
1865 |
|
|
[(set_attr "slottable" "yes,yes,yes,yes,yes,yes,yes,no,no")
|
1866 |
|
|
(set_attr "cc" "*,none,*,none,clobber,clobber,none,*,none")])
|
1867 |
|
|
|
1868 |
|
|
(define_insn "*addqi3_non_v32"
|
1869 |
|
|
[(set (match_operand:QI 0 "register_operand" "=r,r, r,r,r,r,r")
|
1870 |
|
|
(plus:QI (match_operand:QI 1 "register_operand" "%0,0, 0,0,0,0,r")
|
1871 |
|
|
(match_operand:QI 2 "general_operand" "r,Q>,J,N,O,g,!To")))]
|
1872 |
|
|
"!TARGET_V32"
|
1873 |
|
|
"@
|
1874 |
|
|
add.b %2,%0
|
1875 |
|
|
add.b %2,%0
|
1876 |
|
|
addq %2,%0
|
1877 |
|
|
subq %n2,%0
|
1878 |
|
|
subQ -%b2,%0
|
1879 |
|
|
add.b %2,%0
|
1880 |
|
|
add.b %2,%1,%0"
|
1881 |
|
|
[(set_attr "slottable" "yes,yes,yes,yes,yes,no,no")
|
1882 |
|
|
(set_attr "cc" "normal,normal,clobber,clobber,clobber,normal,normal")])
|
1883 |
|
|
|
1884 |
|
|
(define_insn "*addqi3_v32"
|
1885 |
|
|
[(set (match_operand:QI 0 "register_operand" "=r,!a,r,!a, r,r,!a,r,r,!a")
|
1886 |
|
|
(plus:QI
|
1887 |
|
|
(match_operand:QI 1 "register_operand" "%0,r, 0, r, 0,0,r, 0,0,r")
|
1888 |
|
|
(match_operand:QI 2 "general_operand" "r,r, Q>,Q>,J,N,NJ,O,g,g")))]
|
1889 |
|
|
"TARGET_V32"
|
1890 |
|
|
"@
|
1891 |
|
|
add.b %2,%0
|
1892 |
|
|
addi %2.b,%1,%0
|
1893 |
|
|
add.b %2,%0
|
1894 |
|
|
addo.b %2,%1,%0
|
1895 |
|
|
addq %2,%0
|
1896 |
|
|
subq %n2,%0
|
1897 |
|
|
addoq %2,%1,%0
|
1898 |
|
|
subQ -%b2,%0
|
1899 |
|
|
add.b %2,%0
|
1900 |
|
|
addo.b %2,%1,%0"
|
1901 |
|
|
[(set_attr "slottable" "yes,yes,yes,yes,yes,yes,yes,yes,no,no")
|
1902 |
|
|
(set_attr "cc" "*,none,*,none,clobber,clobber,none,clobber,*,none")])
|
1903 |
|
|
|
1904 |
|
|
;; Subtract.
|
1905 |
|
|
;;
|
1906 |
|
|
;; Note that because of insn canonicalization these will *seldom* but
|
1907 |
|
|
;; rarely be used with a known constant as an operand.
|
1908 |
|
|
|
1909 |
|
|
;; Note that for the 'P' constraint, the high part can be -1 or 0. We
|
1910 |
|
|
;; output the insn through the 'D' output modifier as "subs.w" and "subq",
|
1911 |
|
|
;; respectively.
|
1912 |
|
|
(define_expand "subdi3"
|
1913 |
|
|
[(set (match_operand:DI 0 "register_operand")
|
1914 |
|
|
(minus:DI (match_operand:DI 1 "register_operand")
|
1915 |
|
|
(match_operand:DI 2 "general_operand")))]
|
1916 |
|
|
""
|
1917 |
|
|
{
|
1918 |
|
|
if (TARGET_V32 && MEM_P (operands[2]))
|
1919 |
|
|
operands[2] = force_reg (DImode, operands[2]);
|
1920 |
|
|
})
|
1921 |
|
|
|
1922 |
|
|
(define_insn "*subdi3_non_v32"
|
1923 |
|
|
[(set (match_operand:DI 0 "register_operand" "=r,r,r,&r,&r")
|
1924 |
|
|
(minus:DI (match_operand:DI 1 "register_operand" "0,0,0,0,r")
|
1925 |
|
|
(match_operand:DI 2 "general_operand" "J,N,P,g,!To")))]
|
1926 |
|
|
"!TARGET_V32"
|
1927 |
|
|
"@
|
1928 |
|
|
subq %2,%M0\;ax\;subq 0,%H0
|
1929 |
|
|
addq %n2,%M0\;ax\;addq 0,%H0
|
1930 |
|
|
sub%e2.%z2 %2,%M0\;ax\;%D2 %H2,%H0
|
1931 |
|
|
sub.d %M2,%M0\;ax\;sub.d %H2,%H0
|
1932 |
|
|
sub.d %M2,%M1,%M0\;ax\;sub.d %H2,%H1,%H0")
|
1933 |
|
|
|
1934 |
|
|
(define_insn "*subdi3_v32"
|
1935 |
|
|
[(set (match_operand:DI 0 "register_operand" "=r,r,r,&r")
|
1936 |
|
|
(minus:DI (match_operand:DI 1 "register_operand" "0,0,0,0")
|
1937 |
|
|
(match_operand:DI 2 "nonmemory_operand" "J,N,P,r")))]
|
1938 |
|
|
"TARGET_V32"
|
1939 |
|
|
"@
|
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 |
|
|
|
1945 |
|
|
(define_expand "sub3"
|
1946 |
|
|
[(set (match_operand:BWD 0 "register_operand")
|
1947 |
|
|
(minus:BWD
|
1948 |
|
|
(match_operand:BWD 1 "register_operand")
|
1949 |
|
|
(match_operand:BWD 2 "general_operand")))]
|
1950 |
|
|
""
|
1951 |
|
|
"")
|
1952 |
|
|
|
1953 |
|
|
(define_insn "*subsi3_non_v32"
|
1954 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r, r,r,r,r,r,r")
|
1955 |
|
|
(minus:SI
|
1956 |
|
|
(match_operand:SI 1 "register_operand" "0,0, 0,0,0,0,0,r")
|
1957 |
|
|
(match_operand:SI 2 "general_operand" "r,Q>,J,N,P,n,g,!To")))]
|
1958 |
|
|
"!TARGET_V32"
|
1959 |
|
|
|
1960 |
|
|
;; This does not do the optimal: "addu.w 65535,r0" when %2 is negative.
|
1961 |
|
|
;; But then again, %2 should not be negative.
|
1962 |
|
|
|
1963 |
|
|
"@
|
1964 |
|
|
sub.d %2,%0
|
1965 |
|
|
sub.d %2,%0
|
1966 |
|
|
subq %2,%0
|
1967 |
|
|
addq %n2,%0
|
1968 |
|
|
sub%e2.%z2 %2,%0
|
1969 |
|
|
sub.d %2,%0
|
1970 |
|
|
sub.d %2,%0
|
1971 |
|
|
sub.d %2,%1,%0"
|
1972 |
|
|
[(set_attr "slottable" "yes,yes,yes,yes,no,no,no,no")])
|
1973 |
|
|
|
1974 |
|
|
(define_insn "*subsi3_v32"
|
1975 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r,r,r")
|
1976 |
|
|
(minus:SI
|
1977 |
|
|
(match_operand:SI 1 "register_operand" "0,0,0,0,0,0,0")
|
1978 |
|
|
(match_operand:SI 2 "general_operand" "r,Q>,J,N,P,n,g")))]
|
1979 |
|
|
"TARGET_V32"
|
1980 |
|
|
"@
|
1981 |
|
|
sub.d %2,%0
|
1982 |
|
|
sub.d %2,%0
|
1983 |
|
|
subq %2,%0
|
1984 |
|
|
addq %n2,%0
|
1985 |
|
|
sub%e2.%z2 %2,%0
|
1986 |
|
|
sub.d %2,%0
|
1987 |
|
|
sub.d %2,%0"
|
1988 |
|
|
[(set_attr "slottable" "yes,yes,yes,yes,no,no,no")])
|
1989 |
|
|
|
1990 |
|
|
(define_insn "*sub3_nonv32"
|
1991 |
|
|
[(set (match_operand:BW 0 "register_operand" "=r,r, r,r,r,r")
|
1992 |
|
|
(minus:BW (match_operand:BW 1 "register_operand" "0,0, 0,0,0,r")
|
1993 |
|
|
(match_operand:BW 2 "general_operand" "r,Q>,J,N,g,!To")))]
|
1994 |
|
|
"!TARGET_V32"
|
1995 |
|
|
"@
|
1996 |
|
|
sub %2,%0
|
1997 |
|
|
sub %2,%0
|
1998 |
|
|
subq %2,%0
|
1999 |
|
|
addq %n2,%0
|
2000 |
|
|
sub %2,%0
|
2001 |
|
|
sub %2,%1,%0"
|
2002 |
|
|
[(set_attr "slottable" "yes,yes,yes,yes,no,no")
|
2003 |
|
|
(set_attr "cc" "normal,normal,clobber,clobber,normal,normal")])
|
2004 |
|
|
|
2005 |
|
|
(define_insn "*sub3_v32"
|
2006 |
|
|
[(set (match_operand:BW 0 "register_operand" "=r,r,r,r,r")
|
2007 |
|
|
(minus:BW (match_operand:BW 1 "register_operand" "0,0,0,0,0")
|
2008 |
|
|
(match_operand:BW 2 "general_operand" "r,Q>,J,N,g")))]
|
2009 |
|
|
"TARGET_V32"
|
2010 |
|
|
"@
|
2011 |
|
|
sub %2,%0
|
2012 |
|
|
sub %2,%0
|
2013 |
|
|
subq %2,%0
|
2014 |
|
|
addq %n2,%0
|
2015 |
|
|
sub %2,%0"
|
2016 |
|
|
[(set_attr "slottable" "yes,yes,yes,yes,no")
|
2017 |
|
|
(set_attr "cc" "normal,normal,clobber,clobber,normal")])
|
2018 |
|
|
|
2019 |
|
|
;; CRIS has some add/sub-with-sign/zero-extend instructions.
|
2020 |
|
|
;; Although these perform sign/zero-extension to SImode, they are
|
2021 |
|
|
;; equally applicable for the HImode case.
|
2022 |
|
|
;; FIXME: Check; GCC should handle the widening.
|
2023 |
|
|
;; Note that these must be located after the normal add/sub patterns,
|
2024 |
|
|
;; so not to get constants into any less specific operands.
|
2025 |
|
|
;;
|
2026 |
|
|
;; Extend with add/sub and side-effect.
|
2027 |
|
|
;;
|
2028 |
|
|
;; ADDS/SUBS/ADDU/SUBU and BOUND, which needs a check for zero_extend
|
2029 |
|
|
;;
|
2030 |
|
|
;; adds/subs/addu/subu bound [rx=ry+rz.S]
|
2031 |
|
|
|
2032 |
|
|
;; QImode to HImode
|
2033 |
|
|
;; FIXME: GCC should widen.
|
2034 |
|
|
|
2035 |
|
|
(define_insn "*extopqihi_side_biap"
|
2036 |
|
|
[(set (match_operand:HI 0 "register_operand" "=r,r")
|
2037 |
|
|
(match_operator:HI
|
2038 |
|
|
6 "cris_additive_operand_extend_operator"
|
2039 |
|
|
[(match_operand:HI 1 "register_operand" "0,0")
|
2040 |
|
|
(match_operator:HI
|
2041 |
|
|
7 "cris_extend_operator"
|
2042 |
|
|
[(mem:QI (plus:SI
|
2043 |
|
|
(mult:SI (match_operand:SI 2 "register_operand" "r,r")
|
2044 |
|
|
(match_operand:SI 3 "const_int_operand" "n,n"))
|
2045 |
|
|
(match_operand:SI 4 "register_operand" "r,r")))])]))
|
2046 |
|
|
(set (match_operand:SI 5 "register_operand" "=*4,r")
|
2047 |
|
|
(plus:SI (mult:SI (match_dup 2)
|
2048 |
|
|
(match_dup 3))
|
2049 |
|
|
(match_dup 4)))]
|
2050 |
|
|
"cris_side_effect_mode_ok (MULT, operands, 5, 4, 2, 3, 0)"
|
2051 |
|
|
"@
|
2052 |
|
|
#
|
2053 |
|
|
%x6%e7.%m7 [%5=%4+%2%T3],%0")
|
2054 |
|
|
|
2055 |
|
|
(define_insn "*extopsi_side_biap"
|
2056 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r")
|
2057 |
|
|
(match_operator:SI
|
2058 |
|
|
6 "cris_operand_extend_operator"
|
2059 |
|
|
[(match_operand:SI 1 "register_operand" "0,0")
|
2060 |
|
|
(match_operator:SI
|
2061 |
|
|
7 "cris_extend_operator"
|
2062 |
|
|
[(mem:BW (plus:SI
|
2063 |
|
|
(mult:SI (match_operand:SI 2 "register_operand" "r,r")
|
2064 |
|
|
(match_operand:SI 3 "const_int_operand" "n,n"))
|
2065 |
|
|
(match_operand:SI 4 "register_operand" "r,r")))])]))
|
2066 |
|
|
(set (match_operand:SI 5 "register_operand" "=*4,r")
|
2067 |
|
|
(plus:SI (mult:SI (match_dup 2)
|
2068 |
|
|
(match_dup 3))
|
2069 |
|
|
(match_dup 4)))]
|
2070 |
|
|
"(GET_CODE (operands[6]) != UMIN || GET_CODE (operands[7]) == ZERO_EXTEND)
|
2071 |
|
|
&& cris_side_effect_mode_ok (MULT, operands, 5, 4, 2, 3, 0)"
|
2072 |
|
|
"@
|
2073 |
|
|
#
|
2074 |
|
|
%x6%e7 [%5=%4+%2%T3],%0")
|
2075 |
|
|
|
2076 |
|
|
|
2077 |
|
|
;; [rx=ry+i]
|
2078 |
|
|
|
2079 |
|
|
;; QImode to HImode
|
2080 |
|
|
|
2081 |
|
|
(define_insn "*extopqihi_side"
|
2082 |
|
|
[(set (match_operand:HI 0 "register_operand" "=r,r,r,r,r")
|
2083 |
|
|
(match_operator:HI
|
2084 |
|
|
5 "cris_additive_operand_extend_operator"
|
2085 |
|
|
[(match_operand:HI 1 "register_operand" "0,0,0,0,0")
|
2086 |
|
|
(match_operator:HI
|
2087 |
|
|
6 "cris_extend_operator"
|
2088 |
|
|
[(mem:QI
|
2089 |
|
|
(plus:SI (match_operand:SI 2 "cris_bdap_operand" "%r,r,r,R,R")
|
2090 |
|
|
(match_operand:SI 3 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")
|
2091 |
|
|
))])]))
|
2092 |
|
|
(set (match_operand:SI 4 "register_operand" "=*2,r,r,*3,r")
|
2093 |
|
|
(plus:SI (match_dup 2)
|
2094 |
|
|
(match_dup 3)))]
|
2095 |
|
|
"cris_side_effect_mode_ok (PLUS, operands, 4, 2, 3, -1, 0)"
|
2096 |
|
|
{
|
2097 |
|
|
if ((which_alternative == 0 || which_alternative == 3)
|
2098 |
|
|
&& (!CONST_INT_P (operands[3])
|
2099 |
|
|
|| INTVAL (operands[3]) > 127
|
2100 |
|
|
|| INTVAL (operands[3]) < -128
|
2101 |
|
|
|| satisfies_constraint_N (operands[3])
|
2102 |
|
|
|| satisfies_constraint_J (operands[3])))
|
2103 |
|
|
return "#";
|
2104 |
|
|
if (which_alternative == 4)
|
2105 |
|
|
return "%x5%E6.%m6 [%4=%3%S2],%0";
|
2106 |
|
|
return "%x5%E6.%m6 [%4=%2%S3],%0";
|
2107 |
|
|
})
|
2108 |
|
|
|
2109 |
|
|
(define_insn "*extopsi_side"
|
2110 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r")
|
2111 |
|
|
(match_operator:SI
|
2112 |
|
|
5 "cris_operand_extend_operator"
|
2113 |
|
|
[(match_operand:SI 1 "register_operand" "0,0,0,0,0")
|
2114 |
|
|
(match_operator:SI
|
2115 |
|
|
6 "cris_extend_operator"
|
2116 |
|
|
[(mem:BW
|
2117 |
|
|
(plus:SI (match_operand:SI 2 "cris_bdap_operand" "%r,r,r,R,R")
|
2118 |
|
|
(match_operand:SI 3 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")
|
2119 |
|
|
))])]))
|
2120 |
|
|
(set (match_operand:SI 4 "register_operand" "=*2,r,r,*3,r")
|
2121 |
|
|
(plus:SI (match_dup 2)
|
2122 |
|
|
(match_dup 3)))]
|
2123 |
|
|
"(GET_CODE (operands[5]) != UMIN || GET_CODE (operands[6]) == ZERO_EXTEND)
|
2124 |
|
|
&& cris_side_effect_mode_ok (PLUS, operands, 4, 2, 3, -1, 0)"
|
2125 |
|
|
{
|
2126 |
|
|
if ((which_alternative == 0 || which_alternative == 3)
|
2127 |
|
|
&& (!CONST_INT_P (operands[3])
|
2128 |
|
|
|| INTVAL (operands[3]) > 127
|
2129 |
|
|
|| INTVAL (operands[3]) < -128
|
2130 |
|
|
|| satisfies_constraint_N (operands[3])
|
2131 |
|
|
|| satisfies_constraint_J (operands[3])))
|
2132 |
|
|
return "#";
|
2133 |
|
|
if (which_alternative == 4)
|
2134 |
|
|
return "%x5%E6 [%4=%3%S2],%0";
|
2135 |
|
|
return "%x5%E6 [%4=%2%S3],%0";
|
2136 |
|
|
})
|
2137 |
|
|
|
2138 |
|
|
|
2139 |
|
|
;; As with op.S we may have to add special pattern to match commuted
|
2140 |
|
|
;; operands to adds/addu and bound
|
2141 |
|
|
;;
|
2142 |
|
|
;; adds/addu/bound [rx=ry+rz.S]
|
2143 |
|
|
|
2144 |
|
|
;; QImode to HImode
|
2145 |
|
|
;; FIXME: GCC should widen.
|
2146 |
|
|
|
2147 |
|
|
(define_insn "*extopqihi_swap_side_biap"
|
2148 |
|
|
[(set (match_operand:HI 0 "register_operand" "=r,r")
|
2149 |
|
|
(plus:HI
|
2150 |
|
|
(match_operator:HI
|
2151 |
|
|
6 "cris_extend_operator"
|
2152 |
|
|
[(mem:QI (plus:SI
|
2153 |
|
|
(mult:SI (match_operand:SI 2 "register_operand" "r,r")
|
2154 |
|
|
(match_operand:SI 3 "const_int_operand" "n,n"))
|
2155 |
|
|
(match_operand:SI 4 "register_operand" "r,r")))])
|
2156 |
|
|
(match_operand:HI 1 "register_operand" "0,0")))
|
2157 |
|
|
(set (match_operand:SI 5 "register_operand" "=*4,r")
|
2158 |
|
|
(plus:SI (mult:SI (match_dup 2)
|
2159 |
|
|
(match_dup 3))
|
2160 |
|
|
(match_dup 4)))]
|
2161 |
|
|
"cris_side_effect_mode_ok (MULT, operands, 5, 4, 2, 3, 0)"
|
2162 |
|
|
"@
|
2163 |
|
|
#
|
2164 |
|
|
add%e6.b [%5=%4+%2%T3],%0")
|
2165 |
|
|
|
2166 |
|
|
(define_insn "*extopsi_swap_side_biap"
|
2167 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r")
|
2168 |
|
|
(match_operator:SI
|
2169 |
|
|
7 "cris_plus_or_bound_operator"
|
2170 |
|
|
[(match_operator:SI
|
2171 |
|
|
6 "cris_extend_operator"
|
2172 |
|
|
[(mem:BW (plus:SI
|
2173 |
|
|
(mult:SI (match_operand:SI 2 "register_operand" "r,r")
|
2174 |
|
|
(match_operand:SI 3 "const_int_operand" "n,n"))
|
2175 |
|
|
(match_operand:SI 4 "register_operand" "r,r")))])
|
2176 |
|
|
(match_operand:SI 1 "register_operand" "0,0")]))
|
2177 |
|
|
(set (match_operand:SI 5 "register_operand" "=*4,r")
|
2178 |
|
|
(plus:SI (mult:SI (match_dup 2)
|
2179 |
|
|
(match_dup 3))
|
2180 |
|
|
(match_dup 4)))]
|
2181 |
|
|
"(GET_CODE (operands[7]) != UMIN || GET_CODE (operands[6]) == ZERO_EXTEND)
|
2182 |
|
|
&& cris_side_effect_mode_ok (MULT, operands, 5, 4, 2, 3, 0)"
|
2183 |
|
|
"@
|
2184 |
|
|
#
|
2185 |
|
|
%x7%E6 [%5=%4+%2%T3],%0")
|
2186 |
|
|
|
2187 |
|
|
;; [rx=ry+i]
|
2188 |
|
|
;; FIXME: GCC should widen.
|
2189 |
|
|
|
2190 |
|
|
;; QImode to HImode
|
2191 |
|
|
|
2192 |
|
|
(define_insn "*extopqihi_swap_side"
|
2193 |
|
|
[(set (match_operand:HI 0 "register_operand" "=r,r,r,r,r")
|
2194 |
|
|
(plus:HI
|
2195 |
|
|
(match_operator:HI
|
2196 |
|
|
5 "cris_extend_operator"
|
2197 |
|
|
[(mem:QI (plus:SI
|
2198 |
|
|
(match_operand:SI 2 "cris_bdap_operand" "%r,r,r,R,R")
|
2199 |
|
|
(match_operand:SI 3 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")))])
|
2200 |
|
|
(match_operand:HI 1 "register_operand" "0,0,0,0,0")))
|
2201 |
|
|
(set (match_operand:SI 4 "register_operand" "=*2,r,r,*3,r")
|
2202 |
|
|
(plus:SI (match_dup 2)
|
2203 |
|
|
(match_dup 3)))]
|
2204 |
|
|
"cris_side_effect_mode_ok (PLUS, operands, 4, 2, 3, -1, 0)"
|
2205 |
|
|
{
|
2206 |
|
|
if ((which_alternative == 0 || which_alternative == 3)
|
2207 |
|
|
&& (!CONST_INT_P (operands[3])
|
2208 |
|
|
|| INTVAL (operands[3]) > 127
|
2209 |
|
|
|| INTVAL (operands[3]) < -128
|
2210 |
|
|
|| satisfies_constraint_N (operands[3])
|
2211 |
|
|
|| satisfies_constraint_J (operands[3])))
|
2212 |
|
|
return "#";
|
2213 |
|
|
if (which_alternative == 4)
|
2214 |
|
|
return "add%e5.b [%4=%3%S2],%0";
|
2215 |
|
|
return "add%e5.b [%4=%2%S3],%0";
|
2216 |
|
|
})
|
2217 |
|
|
|
2218 |
|
|
(define_insn "*extopsi_swap_side"
|
2219 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r")
|
2220 |
|
|
(match_operator:SI
|
2221 |
|
|
6 "cris_plus_or_bound_operator"
|
2222 |
|
|
[(match_operator:SI
|
2223 |
|
|
5 "cris_extend_operator"
|
2224 |
|
|
[(mem:BW (plus:SI
|
2225 |
|
|
(match_operand:SI 2 "cris_bdap_operand" "%r,r,r,R,R")
|
2226 |
|
|
(match_operand:SI 3 "cris_bdap_operand" "r>Rn,r,>Rn,r,r")))])
|
2227 |
|
|
(match_operand:SI 1 "register_operand" "0,0,0,0,0")]))
|
2228 |
|
|
(set (match_operand:SI 4 "register_operand" "=*2,r,r,*3,r")
|
2229 |
|
|
(plus:SI (match_dup 2)
|
2230 |
|
|
(match_dup 3)))]
|
2231 |
|
|
"(GET_CODE (operands[6]) != UMIN || GET_CODE (operands[5]) == ZERO_EXTEND)
|
2232 |
|
|
&& cris_side_effect_mode_ok (PLUS, operands, 4, 2, 3, -1, 0)"
|
2233 |
|
|
{
|
2234 |
|
|
if ((which_alternative == 0 || which_alternative == 3)
|
2235 |
|
|
&& (!CONST_INT_P (operands[3])
|
2236 |
|
|
|| INTVAL (operands[3]) > 127
|
2237 |
|
|
|| INTVAL (operands[3]) < -128
|
2238 |
|
|
|| satisfies_constraint_N (operands[3])
|
2239 |
|
|
|| satisfies_constraint_J (operands[3])))
|
2240 |
|
|
return "#";
|
2241 |
|
|
if (which_alternative == 4)
|
2242 |
|
|
return \"%x6%E5.%m5 [%4=%3%S2],%0\";
|
2243 |
|
|
return "%x6%E5 [%4=%2%S3],%0";
|
2244 |
|
|
})
|
2245 |
|
|
|
2246 |
|
|
;; Extend versions (zero/sign) of normal add/sub (no side-effects).
|
2247 |
|
|
|
2248 |
|
|
;; QImode to HImode
|
2249 |
|
|
;; FIXME: GCC should widen.
|
2250 |
|
|
|
2251 |
|
|
(define_insn "*extopqihi_non_v32"
|
2252 |
|
|
[(set (match_operand:HI 0 "register_operand" "=r,r,r,r")
|
2253 |
|
|
(match_operator:HI
|
2254 |
|
|
3 "cris_additive_operand_extend_operator"
|
2255 |
|
|
[(match_operand:HI 1 "register_operand" "0,0,0,r")
|
2256 |
|
|
(match_operator:HI
|
2257 |
|
|
4 "cris_extend_operator"
|
2258 |
|
|
[(match_operand:QI 2 "nonimmediate_operand" "r,Q>,m,!To")])]))]
|
2259 |
|
|
"!TARGET_V32 && GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
|
2260 |
|
|
&& (operands[1] != frame_pointer_rtx || GET_CODE (operands[3]) != PLUS)"
|
2261 |
|
|
"@
|
2262 |
|
|
%x3%E4.%m4 %2,%0
|
2263 |
|
|
%x3%E4.%m4 %2,%0
|
2264 |
|
|
%x3%E4.%m4 %2,%0
|
2265 |
|
|
%x3%E4.%m4 %2,%1,%0"
|
2266 |
|
|
[(set_attr "slottable" "yes,yes,no,no")
|
2267 |
|
|
(set_attr "cc" "clobber")])
|
2268 |
|
|
|
2269 |
|
|
(define_insn "*extopqihi_v32"
|
2270 |
|
|
[(set (match_operand:HI 0 "register_operand" "=r,r")
|
2271 |
|
|
(match_operator:HI
|
2272 |
|
|
3 "cris_additive_operand_extend_operator"
|
2273 |
|
|
[(match_operand:HI 1 "register_operand" "0,0")
|
2274 |
|
|
(match_operator:HI
|
2275 |
|
|
4 "cris_extend_operator"
|
2276 |
|
|
[(match_operand:QI 2 "nonimmediate_operand" "r,m")])]))]
|
2277 |
|
|
"TARGET_V32"
|
2278 |
|
|
"%x3%e4.%m4 %2,%0"
|
2279 |
|
|
[(set_attr "slottable" "yes")
|
2280 |
|
|
(set_attr "cc" "clobber")])
|
2281 |
|
|
|
2282 |
|
|
;; QImode to SImode
|
2283 |
|
|
|
2284 |
|
|
(define_insn "*extopsi_non_v32"
|
2285 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
|
2286 |
|
|
(match_operator:SI
|
2287 |
|
|
3 "cris_operand_extend_operator"
|
2288 |
|
|
[(match_operand:SI 1 "register_operand" "0,0,0,r")
|
2289 |
|
|
(match_operator:SI
|
2290 |
|
|
4 "cris_extend_operator"
|
2291 |
|
|
[(match_operand:BW 2 "nonimmediate_operand" "r,Q>,m,!To")])]))]
|
2292 |
|
|
"!TARGET_V32
|
2293 |
|
|
&& (GET_CODE (operands[3]) != UMIN || GET_CODE (operands[4]) == ZERO_EXTEND)
|
2294 |
|
|
&& GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
|
2295 |
|
|
&& (operands[1] != frame_pointer_rtx || GET_CODE (operands[3]) != PLUS)"
|
2296 |
|
|
"@
|
2297 |
|
|
%x3%E4 %2,%0
|
2298 |
|
|
%x3%E4 %2,%0
|
2299 |
|
|
%x3%E4 %2,%0
|
2300 |
|
|
%x3%E4 %2,%1,%0"
|
2301 |
|
|
[(set_attr "slottable" "yes,yes,no,no")])
|
2302 |
|
|
|
2303 |
|
|
(define_insn "*extopsi_v32"
|
2304 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r")
|
2305 |
|
|
(match_operator:SI
|
2306 |
|
|
3 "cris_additive_operand_extend_operator"
|
2307 |
|
|
[(match_operand:SI 1 "register_operand" "0,0")
|
2308 |
|
|
(match_operator:SI
|
2309 |
|
|
4 "cris_extend_operator"
|
2310 |
|
|
[(match_operand:BW 2 "nonimmediate_operand" "r,m")])]))]
|
2311 |
|
|
"TARGET_V32"
|
2312 |
|
|
"%x3%e4.%m4 %2,%0"
|
2313 |
|
|
[(set_attr "slottable" "yes")])
|
2314 |
|
|
|
2315 |
|
|
;; As with the side-effect patterns, may have to have swapped operands for add.
|
2316 |
|
|
;; For commutative operands, these are the canonical forms.
|
2317 |
|
|
|
2318 |
|
|
;; QImode to HImode
|
2319 |
|
|
|
2320 |
|
|
(define_insn "*addxqihi_swap_non_v32"
|
2321 |
|
|
[(set (match_operand:HI 0 "register_operand" "=r,r,r,r")
|
2322 |
|
|
(plus:HI
|
2323 |
|
|
(match_operator:HI
|
2324 |
|
|
3 "cris_extend_operator"
|
2325 |
|
|
[(match_operand:QI 2 "nonimmediate_operand" "r,Q>,m,!To")])
|
2326 |
|
|
(match_operand:HI 1 "register_operand" "0,0,0,r")))]
|
2327 |
|
|
"!TARGET_V32 && operands[1] != frame_pointer_rtx"
|
2328 |
|
|
"@
|
2329 |
|
|
add%e3.b %2,%0
|
2330 |
|
|
add%e3.b %2,%0
|
2331 |
|
|
add%e3.b %2,%0
|
2332 |
|
|
add%e3.b %2,%1,%0"
|
2333 |
|
|
[(set_attr "slottable" "yes,yes,no,no")
|
2334 |
|
|
(set_attr "cc" "clobber")])
|
2335 |
|
|
|
2336 |
|
|
;; A case for v32, to catch the "addo" insn in addition to "adds". We
|
2337 |
|
|
;; only care to match the canonical form; there should be no other.
|
2338 |
|
|
|
2339 |
|
|
(define_insn "*addsbw_v32"
|
2340 |
|
|
[(set (match_operand:HI 0 "register_operand" "=r,r,!a")
|
2341 |
|
|
(plus:HI
|
2342 |
|
|
(sign_extend:HI
|
2343 |
|
|
(match_operand:QI 2 "nonimmediate_operand" "r,m,m"))
|
2344 |
|
|
(match_operand:HI 1 "register_operand" "0,0,r")))]
|
2345 |
|
|
"TARGET_V32"
|
2346 |
|
|
"@
|
2347 |
|
|
adds.b %2,%0
|
2348 |
|
|
adds.b %2,%0
|
2349 |
|
|
addo.b %2,%1,%0"
|
2350 |
|
|
[(set_attr "slottable" "yes")
|
2351 |
|
|
(set_attr "cc" "clobber,clobber,none")])
|
2352 |
|
|
|
2353 |
|
|
(define_insn "*addubw_v32"
|
2354 |
|
|
[(set (match_operand:HI 0 "register_operand" "=r,r")
|
2355 |
|
|
(plus:HI
|
2356 |
|
|
(zero_extend:HI
|
2357 |
|
|
(match_operand:QI 2 "nonimmediate_operand" "r,m"))
|
2358 |
|
|
(match_operand:HI 1 "register_operand" "0,0")))]
|
2359 |
|
|
"TARGET_V32"
|
2360 |
|
|
"addu.b %2,%0"
|
2361 |
|
|
[(set_attr "slottable" "yes")
|
2362 |
|
|
(set_attr "cc" "clobber")])
|
2363 |
|
|
|
2364 |
|
|
(define_insn "*extopsi_swap_non_v32"
|
2365 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
|
2366 |
|
|
(match_operator:SI
|
2367 |
|
|
4 "cris_plus_or_bound_operator"
|
2368 |
|
|
[(match_operator:SI
|
2369 |
|
|
3 "cris_extend_operator"
|
2370 |
|
|
[(match_operand:BW 2 "nonimmediate_operand" "r,Q>,m,!To")])
|
2371 |
|
|
(match_operand:SI 1 "register_operand" "0,0,0,r")]))]
|
2372 |
|
|
"!TARGET_V32
|
2373 |
|
|
&& (GET_CODE (operands[4]) != UMIN || GET_CODE (operands[3]) == ZERO_EXTEND)
|
2374 |
|
|
&& operands[1] != frame_pointer_rtx"
|
2375 |
|
|
"@
|
2376 |
|
|
%x4%E3 %2,%0
|
2377 |
|
|
%x4%E3 %2,%0
|
2378 |
|
|
%x4%E3 %2,%0
|
2379 |
|
|
%x4%E3 %2,%1,%0"
|
2380 |
|
|
[(set_attr "slottable" "yes,yes,no,no")])
|
2381 |
|
|
|
2382 |
|
|
(define_insn "*adds_v32"
|
2383 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r,!a")
|
2384 |
|
|
(plus:SI
|
2385 |
|
|
(sign_extend:SI
|
2386 |
|
|
(match_operand:BW 2 "nonimmediate_operand" "r,m,m"))
|
2387 |
|
|
(match_operand:SI 1 "register_operand" "0,0,r")))]
|
2388 |
|
|
"TARGET_V32"
|
2389 |
|
|
"@
|
2390 |
|
|
adds %2,%0
|
2391 |
|
|
adds %2,%0
|
2392 |
|
|
addo %2,%1,%0"
|
2393 |
|
|
[(set_attr "slottable" "yes")
|
2394 |
|
|
(set_attr "cc" "*,*,none")])
|
2395 |
|
|
|
2396 |
|
|
(define_insn "*addu_v32"
|
2397 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r")
|
2398 |
|
|
(plus:SI
|
2399 |
|
|
(zero_extend:SI
|
2400 |
|
|
(match_operand:BW 2 "nonimmediate_operand" "r,m"))
|
2401 |
|
|
(match_operand:SI 1 "register_operand" "0,0")))]
|
2402 |
|
|
"TARGET_V32 && operands[1] != frame_pointer_rtx"
|
2403 |
|
|
"addu %2,%0"
|
2404 |
|
|
[(set_attr "slottable" "yes")])
|
2405 |
|
|
|
2406 |
|
|
(define_insn "*bound_v32"
|
2407 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
2408 |
|
|
(umin:SI
|
2409 |
|
|
(zero_extend:SI
|
2410 |
|
|
(match_operand:BW 2 "register_operand" "r"))
|
2411 |
|
|
(match_operand:SI 1 "register_operand" "0")))]
|
2412 |
|
|
"TARGET_V32 && operands[1] != frame_pointer_rtx"
|
2413 |
|
|
"bound %2,%0"
|
2414 |
|
|
[(set_attr "slottable" "yes")])
|
2415 |
|
|
|
2416 |
|
|
;; This is the special case when we use what corresponds to the
|
2417 |
|
|
;; instruction above in "casesi". Do *not* change it to use the generic
|
2418 |
|
|
;; pattern and "REG 15" as pc; I did that and it led to madness and
|
2419 |
|
|
;; maintenance problems: Instead of (as imagined) recognizing and removing
|
2420 |
|
|
;; or replacing this pattern with something simpler, other variant
|
2421 |
|
|
;; patterns were recognized or combined, including some prefix variants
|
2422 |
|
|
;; where the value in pc is not that of the next instruction (which means
|
2423 |
|
|
;; this instruction actually *is* special and *should* be marked as such).
|
2424 |
|
|
;; When switching from the "generic pattern match" approach to this simpler
|
2425 |
|
|
;; approach, there were insignificant differences in gcc, ipps and
|
2426 |
|
|
;; product code, somehow due to scratching reload behind the ear or
|
2427 |
|
|
;; something. Testcase "gcc" looked .01% slower and 4 bytes bigger;
|
2428 |
|
|
;; product code became .001% smaller but "looked better". The testcase
|
2429 |
|
|
;; "ipps" was just different at register allocation).
|
2430 |
|
|
;;
|
2431 |
|
|
;; Assumptions in the jump optimizer forces us to use IF_THEN_ELSE in this
|
2432 |
|
|
;; pattern with the default-label as the else, with the "if" being
|
2433 |
|
|
;; index-is-less-than the max number of cases plus one. The default-label
|
2434 |
|
|
;; is attached to the end of the case-table at time of output.
|
2435 |
|
|
|
2436 |
|
|
(define_insn "*casesi_adds_w"
|
2437 |
|
|
[(set (pc)
|
2438 |
|
|
(if_then_else
|
2439 |
|
|
(ltu (match_operand:SI 0 "register_operand" "r")
|
2440 |
|
|
(match_operand:SI 1 "const_int_operand" "n"))
|
2441 |
|
|
(plus:SI (sign_extend:SI
|
2442 |
|
|
(mem:HI
|
2443 |
|
|
(plus:SI (mult:SI (match_dup 0) (const_int 2))
|
2444 |
|
|
(pc))))
|
2445 |
|
|
(pc))
|
2446 |
|
|
(label_ref (match_operand 2 "" ""))))
|
2447 |
|
|
(use (label_ref (match_operand 3 "" "")))]
|
2448 |
|
|
"!TARGET_V32 && operands[0] != frame_pointer_rtx"
|
2449 |
|
|
"adds.w [$pc+%0.w],$pc"
|
2450 |
|
|
[(set_attr "cc" "clobber")])
|
2451 |
|
|
|
2452 |
|
|
;; For V32, we just have a jump, but we need to mark the table as used,
|
2453 |
|
|
;; and the jump insn must have the if_then_else form expected by core
|
2454 |
|
|
;; GCC. Since we don't want to prolong the lifetime of the original
|
2455 |
|
|
;; index value, we compare against "unspec 0". It's a pity we have to
|
2456 |
|
|
;; jump through to get the default label in place and to keep the jump
|
2457 |
|
|
;; table around. FIXME: Look into it some time.
|
2458 |
|
|
|
2459 |
|
|
(define_insn "*casesi_jump_v32"
|
2460 |
|
|
[(set (pc)
|
2461 |
|
|
(if_then_else
|
2462 |
|
|
(ltu (unspec [(const_int 0)] CRIS_UNSPEC_CASESI)
|
2463 |
|
|
(match_operand:SI 0 "const_int_operand" "n"))
|
2464 |
|
|
(match_operand:SI 1 "register_operand" "r")
|
2465 |
|
|
(label_ref (match_operand 2 "" ""))))
|
2466 |
|
|
(use (label_ref (match_operand 3 "" "")))]
|
2467 |
|
|
"TARGET_V32"
|
2468 |
|
|
"jump %1%#"
|
2469 |
|
|
[(set_attr "cc" "clobber")
|
2470 |
|
|
(set_attr "slottable" "has_slot")])
|
2471 |
|
|
|
2472 |
|
|
;; Multiply instructions.
|
2473 |
|
|
|
2474 |
|
|
;; Sometimes powers of 2 (which are normally canonicalized to a
|
2475 |
|
|
;; left-shift) appear here, as a result of address reloading.
|
2476 |
|
|
;; As a special, for values 3 and 5, we can match with an addi, so add those.
|
2477 |
|
|
;;
|
2478 |
|
|
;; FIXME: This may be unnecessary now.
|
2479 |
|
|
;; Explicitly named for convenience of having a gen_... function.
|
2480 |
|
|
|
2481 |
|
|
(define_insn "addi_mul"
|
2482 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
2483 |
|
|
(mult:SI
|
2484 |
|
|
(match_operand:SI 1 "register_operand" "%0")
|
2485 |
|
|
(match_operand:SI 2 "const_int_operand" "n")))]
|
2486 |
|
|
"operands[0] != frame_pointer_rtx
|
2487 |
|
|
&& operands[1] != frame_pointer_rtx
|
2488 |
|
|
&& CONST_INT_P (operands[2])
|
2489 |
|
|
&& (INTVAL (operands[2]) == 2
|
2490 |
|
|
|| INTVAL (operands[2]) == 4 || INTVAL (operands[2]) == 3
|
2491 |
|
|
|| INTVAL (operands[2]) == 5)"
|
2492 |
|
|
{
|
2493 |
|
|
if (INTVAL (operands[2]) == 2)
|
2494 |
|
|
return "lslq 1,%0";
|
2495 |
|
|
else if (INTVAL (operands[2]) == 4)
|
2496 |
|
|
return "lslq 2,%0";
|
2497 |
|
|
else if (INTVAL (operands[2]) == 3)
|
2498 |
|
|
return "addi %0.w,%0";
|
2499 |
|
|
else if (INTVAL (operands[2]) == 5)
|
2500 |
|
|
return "addi %0.d,%0";
|
2501 |
|
|
return "BAD: adr_mulsi: %0=%1*%2";
|
2502 |
|
|
}
|
2503 |
|
|
[(set_attr "slottable" "yes")
|
2504 |
|
|
;; No flags are changed if this insn is "addi", but it does not seem
|
2505 |
|
|
;; worth the trouble to distinguish that to the lslq cases.
|
2506 |
|
|
(set_attr "cc" "clobber")])
|
2507 |
|
|
|
2508 |
|
|
;; The addi insn as it is normally used.
|
2509 |
|
|
|
2510 |
|
|
;; Make the ACR alternative taste bad enough to not choose it as a
|
2511 |
|
|
;; preference to avoid spilling problems (unwind-dw2-fde.c at build).
|
2512 |
|
|
;; FIXME: Revisit for new register allocator.
|
2513 |
|
|
|
2514 |
|
|
(define_insn "*addi"
|
2515 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,!a")
|
2516 |
|
|
(plus:SI
|
2517 |
|
|
(mult:SI (match_operand:SI 2 "register_operand" "r,r")
|
2518 |
|
|
(match_operand:SI 3 "const_int_operand" "n,n"))
|
2519 |
|
|
(match_operand:SI 1 "register_operand" "0,r")))]
|
2520 |
|
|
"operands[0] != frame_pointer_rtx
|
2521 |
|
|
&& operands[1] != frame_pointer_rtx
|
2522 |
|
|
&& CONST_INT_P (operands[3])
|
2523 |
|
|
&& (INTVAL (operands[3]) == 1
|
2524 |
|
|
|| INTVAL (operands[3]) == 2 || INTVAL (operands[3]) == 4)"
|
2525 |
|
|
"@
|
2526 |
|
|
addi %2%T3,%0
|
2527 |
|
|
addi %2%T3,%1,%0"
|
2528 |
|
|
[(set_attr "slottable" "yes")
|
2529 |
|
|
(set_attr "cc" "none")])
|
2530 |
|
|
|
2531 |
|
|
;; The mstep instruction. Probably not useful by itself; it's to
|
2532 |
|
|
;; non-linear wrt. the other insns. We used to expand to it, so at least
|
2533 |
|
|
;; it's correct.
|
2534 |
|
|
|
2535 |
|
|
(define_insn "mstep_shift"
|
2536 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
2537 |
|
|
(if_then_else:SI
|
2538 |
|
|
(lt:SI (cc0) (const_int 0))
|
2539 |
|
|
(plus:SI (ashift:SI (match_operand:SI 1 "register_operand" "0")
|
2540 |
|
|
(const_int 1))
|
2541 |
|
|
(match_operand:SI 2 "register_operand" "r"))
|
2542 |
|
|
(ashift:SI (match_operand:SI 3 "register_operand" "0")
|
2543 |
|
|
(const_int 1))))]
|
2544 |
|
|
"!TARGET_V32"
|
2545 |
|
|
"mstep %2,%0"
|
2546 |
|
|
[(set_attr "slottable" "yes")])
|
2547 |
|
|
|
2548 |
|
|
;; When illegitimate addresses are legitimized, sometimes gcc forgets
|
2549 |
|
|
;; to canonicalize the multiplications.
|
2550 |
|
|
;;
|
2551 |
|
|
;; FIXME: Check gcc > 2.7.2, remove and possibly fix in gcc.
|
2552 |
|
|
|
2553 |
|
|
(define_insn "mstep_mul"
|
2554 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
2555 |
|
|
(if_then_else:SI
|
2556 |
|
|
(lt:SI (cc0) (const_int 0))
|
2557 |
|
|
(plus:SI (mult:SI (match_operand:SI 1 "register_operand" "0")
|
2558 |
|
|
(const_int 2))
|
2559 |
|
|
(match_operand:SI 2 "register_operand" "r"))
|
2560 |
|
|
(mult:SI (match_operand:SI 3 "register_operand" "0")
|
2561 |
|
|
(const_int 2))))]
|
2562 |
|
|
"!TARGET_V32
|
2563 |
|
|
&& operands[0] != frame_pointer_rtx
|
2564 |
|
|
&& operands[1] != frame_pointer_rtx
|
2565 |
|
|
&& operands[2] != frame_pointer_rtx
|
2566 |
|
|
&& operands[3] != frame_pointer_rtx"
|
2567 |
|
|
"mstep %2,%0"
|
2568 |
|
|
[(set_attr "slottable" "yes")])
|
2569 |
|
|
|
2570 |
|
|
(define_insn "mul3"
|
2571 |
|
|
[(set (match_operand:WD 0 "register_operand" "=r")
|
2572 |
|
|
(mult:WD
|
2573 |
|
|
(szext:WD (match_operand: 1 "register_operand" "%0"))
|
2574 |
|
|
(szext:WD (match_operand: 2 "register_operand" "r"))))
|
2575 |
|
|
(clobber (match_scratch:SI 3 "=h"))]
|
2576 |
|
|
"TARGET_HAS_MUL_INSNS"
|
2577 |
|
|
"%!mul %2,%0"
|
2578 |
|
|
[(set (attr "slottable")
|
2579 |
|
|
(if_then_else (match_test "TARGET_MUL_BUG")
|
2580 |
|
|
(const_string "no")
|
2581 |
|
|
(const_string "yes")))
|
2582 |
|
|
;; For umuls.[bwd] it's just N unusable here, but let's be safe.
|
2583 |
|
|
;; For muls.b, this really extends to SImode, so cc should be
|
2584 |
|
|
;; considered clobbered.
|
2585 |
|
|
;; For muls.w, it's just N unusable here, but let's be safe.
|
2586 |
|
|
(set_attr "cc" "clobber")])
|
2587 |
|
|
|
2588 |
|
|
;; Note that gcc does not make use of such a thing as umulqisi3. It gets
|
2589 |
|
|
;; confused and will erroneously use it instead of umulhisi3, failing (at
|
2590 |
|
|
;; least) gcc.c-torture/execute/arith-rand.c at all optimization levels.
|
2591 |
|
|
;; Inspection of optab code shows that there must be only one widening
|
2592 |
|
|
;; multiplication per mode widened to.
|
2593 |
|
|
|
2594 |
|
|
(define_insn "mulsi3"
|
2595 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
2596 |
|
|
(mult:SI (match_operand:SI 1 "register_operand" "%0")
|
2597 |
|
|
(match_operand:SI 2 "register_operand" "r")))
|
2598 |
|
|
(clobber (match_scratch:SI 3 "=h"))]
|
2599 |
|
|
"TARGET_HAS_MUL_INSNS"
|
2600 |
|
|
"%!muls.d %2,%0"
|
2601 |
|
|
[(set (attr "slottable")
|
2602 |
|
|
(if_then_else (match_test "TARGET_MUL_BUG")
|
2603 |
|
|
(const_string "no")
|
2604 |
|
|
(const_string "yes")))
|
2605 |
|
|
;; Just N unusable here, but let's be safe.
|
2606 |
|
|
(set_attr "cc" "clobber")])
|
2607 |
|
|
|
2608 |
|
|
;; A few multiply variations.
|
2609 |
|
|
|
2610 |
|
|
;; When needed, we can get the high 32 bits from the overflow
|
2611 |
|
|
;; register. We don't care to split and optimize these.
|
2612 |
|
|
;;
|
2613 |
|
|
;; Note that cc0 is still valid after the move-from-overflow-register
|
2614 |
|
|
;; insn; no special precaution need to be taken in cris_notice_update_cc.
|
2615 |
|
|
|
2616 |
|
|
(define_insn "mulsidi3"
|
2617 |
|
|
[(set (match_operand:DI 0 "register_operand" "=r")
|
2618 |
|
|
(mult:DI
|
2619 |
|
|
(szext:DI (match_operand:SI 1 "register_operand" "%0"))
|
2620 |
|
|
(szext:DI (match_operand:SI 2 "register_operand" "r"))))
|
2621 |
|
|
(clobber (match_scratch:SI 3 "=h"))]
|
2622 |
|
|
"TARGET_HAS_MUL_INSNS"
|
2623 |
|
|
"%!mul.d %2,%M0\;move $mof,%H0")
|
2624 |
|
|
|
2625 |
|
|
;; These two patterns may be expressible by other means, perhaps by making
|
2626 |
|
|
;; [u]?mulsidi3 a define_expand.
|
2627 |
|
|
|
2628 |
|
|
;; Due to register allocation braindamage, the clobber 1,2 alternatives
|
2629 |
|
|
;; cause a move into the clobbered register *before* the insn, then
|
2630 |
|
|
;; after the insn, mof is moved too, rather than the clobber assigned
|
2631 |
|
|
;; the last mof target. This became apparent when making MOF and SRP
|
2632 |
|
|
;; visible registers, with the necessary tweak to smulsi3_highpart.
|
2633 |
|
|
;; Because these patterns are used in division by constants, that damage
|
2634 |
|
|
;; is visible (ipps regression tests). Therefore the last two
|
2635 |
|
|
;; alternatives, "helping" reload to avoid an unnecessary move, but
|
2636 |
|
|
;; punished by force of one "?". Check code from "int d (int a) {return
|
2637 |
|
|
;; a / 1000;}" and unsigned. FIXME: Comment above was for 3.2, revisit.
|
2638 |
|
|
|
2639 |
|
|
(define_insn "mulsi3_highpart"
|
2640 |
|
|
[(set (match_operand:SI 0 "register_operand" "=h,h,?r,?r")
|
2641 |
|
|
(truncate:SI
|
2642 |
|
|
(lshiftrt:DI
|
2643 |
|
|
(mult:DI
|
2644 |
|
|
(szext:DI (match_operand:SI 1 "register_operand" "r,r,0,r"))
|
2645 |
|
|
(szext:DI (match_operand:SI 2 "register_operand" "r,r,r,0")))
|
2646 |
|
|
(const_int 32))))
|
2647 |
|
|
(clobber (match_scratch:SI 3 "=1,2,h,h"))]
|
2648 |
|
|
"TARGET_HAS_MUL_INSNS"
|
2649 |
|
|
"@
|
2650 |
|
|
%!mul.d %2,%1
|
2651 |
|
|
%!mul.d %1,%2
|
2652 |
|
|
%!mul.d %2,%1\;move $mof,%0
|
2653 |
|
|
%!mul.d %1,%2\;move $mof,%0"
|
2654 |
|
|
[(set_attr "slottable" "yes,yes,no,no")
|
2655 |
|
|
(set_attr "cc" "clobber")])
|
2656 |
|
|
|
2657 |
|
|
;; Divide and modulus instructions. CRIS only has a step instruction.
|
2658 |
|
|
|
2659 |
|
|
(define_insn "dstep_shift"
|
2660 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
2661 |
|
|
(if_then_else:SI
|
2662 |
|
|
(geu:SI (ashift:SI (match_operand:SI 1 "register_operand" "0")
|
2663 |
|
|
(const_int 1))
|
2664 |
|
|
(match_operand:SI 2 "register_operand" "r"))
|
2665 |
|
|
(minus:SI (ashift:SI (match_operand:SI 3 "register_operand" "0")
|
2666 |
|
|
(const_int 1))
|
2667 |
|
|
(match_operand:SI 4 "register_operand" "2"))
|
2668 |
|
|
(ashift:SI (match_operand:SI 5 "register_operand" "0")
|
2669 |
|
|
(const_int 1))))]
|
2670 |
|
|
""
|
2671 |
|
|
"dstep %2,%0"
|
2672 |
|
|
[(set_attr "slottable" "yes")
|
2673 |
|
|
(set_attr "cc" "noov32")])
|
2674 |
|
|
|
2675 |
|
|
;; Here's a variant with mult instead of ashift.
|
2676 |
|
|
;;
|
2677 |
|
|
;; FIXME: This should be investigated. Which one matches through combination?
|
2678 |
|
|
|
2679 |
|
|
(define_insn "dstep_mul"
|
2680 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
2681 |
|
|
(if_then_else:SI
|
2682 |
|
|
(geu:SI (mult:SI (match_operand:SI 1 "register_operand" "0")
|
2683 |
|
|
(const_int 2))
|
2684 |
|
|
(match_operand:SI 2 "register_operand" "r"))
|
2685 |
|
|
(minus:SI (mult:SI (match_operand:SI 3 "register_operand" "0")
|
2686 |
|
|
(const_int 2))
|
2687 |
|
|
(match_operand:SI 4 "register_operand" "2"))
|
2688 |
|
|
(mult:SI (match_operand:SI 5 "register_operand" "0")
|
2689 |
|
|
(const_int 2))))]
|
2690 |
|
|
"operands[0] != frame_pointer_rtx
|
2691 |
|
|
&& operands[1] != frame_pointer_rtx
|
2692 |
|
|
&& operands[2] != frame_pointer_rtx
|
2693 |
|
|
&& operands[3] != frame_pointer_rtx"
|
2694 |
|
|
"dstep %2,%0"
|
2695 |
|
|
[(set_attr "slottable" "yes")
|
2696 |
|
|
(set_attr "cc" "noov32")])
|
2697 |
|
|
|
2698 |
|
|
;; Logical operators.
|
2699 |
|
|
|
2700 |
|
|
;; Bitwise "and".
|
2701 |
|
|
|
2702 |
|
|
;; There is no use in defining "anddi3", because gcc can expand this by
|
2703 |
|
|
;; itself, and make reasonable code without interference.
|
2704 |
|
|
|
2705 |
|
|
;; If the first operand is memory or a register and is the same as the
|
2706 |
|
|
;; second operand, and the third operand is -256 or -65536, we can use
|
2707 |
|
|
;; CLEAR instead. Or, if the first operand is a register, and the third
|
2708 |
|
|
;; operand is 255 or 65535, we can zero_extend.
|
2709 |
|
|
;; GCC isn't smart enough to recognize these cases (yet), and they seem
|
2710 |
|
|
;; to be common enough to be worthwhile.
|
2711 |
|
|
;; FIXME: This should be made obsolete.
|
2712 |
|
|
|
2713 |
|
|
(define_expand "andsi3"
|
2714 |
|
|
[(set (match_operand:SI 0 "nonimmediate_operand" "")
|
2715 |
|
|
(and:SI (match_operand:SI 1 "nonimmediate_operand" "")
|
2716 |
|
|
(match_operand:SI 2 "general_operand" "")))]
|
2717 |
|
|
""
|
2718 |
|
|
{
|
2719 |
|
|
if (! (CONST_INT_P (operands[2])
|
2720 |
|
|
&& (((INTVAL (operands[2]) == -256
|
2721 |
|
|
|| INTVAL (operands[2]) == -65536)
|
2722 |
|
|
&& rtx_equal_p (operands[1], operands[0]))
|
2723 |
|
|
|| ((INTVAL (operands[2]) == 255
|
2724 |
|
|
|| INTVAL (operands[2]) == 65535)
|
2725 |
|
|
&& REG_P (operands[0])))))
|
2726 |
|
|
{
|
2727 |
|
|
/* Make intermediate steps if operand0 is not a register or
|
2728 |
|
|
operand1 is not a register, and hope that the reload pass will
|
2729 |
|
|
make something useful out of it. Note that the operands are
|
2730 |
|
|
*not* canonicalized. For the moment, I chicken out on this,
|
2731 |
|
|
because all or most ports do not describe 'and' with
|
2732 |
|
|
canonicalized operands, and I seem to remember magic in reload,
|
2733 |
|
|
checking that operand1 has constraint '%0', in which case
|
2734 |
|
|
operand0 and operand1 must have similar predicates.
|
2735 |
|
|
FIXME: Investigate. */
|
2736 |
|
|
rtx reg0 = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (SImode);
|
2737 |
|
|
rtx reg1 = operands[1];
|
2738 |
|
|
|
2739 |
|
|
if (! REG_P (reg1))
|
2740 |
|
|
{
|
2741 |
|
|
emit_move_insn (reg0, reg1);
|
2742 |
|
|
reg1 = reg0;
|
2743 |
|
|
}
|
2744 |
|
|
|
2745 |
|
|
emit_insn (gen_rtx_SET (SImode, reg0,
|
2746 |
|
|
gen_rtx_AND (SImode, reg1, operands[2])));
|
2747 |
|
|
|
2748 |
|
|
/* Make sure we get the right *final* destination. */
|
2749 |
|
|
if (! REG_P (operands[0]))
|
2750 |
|
|
emit_move_insn (operands[0], reg0);
|
2751 |
|
|
|
2752 |
|
|
DONE;
|
2753 |
|
|
}
|
2754 |
|
|
})
|
2755 |
|
|
|
2756 |
|
|
;; Some special cases of andsi3.
|
2757 |
|
|
|
2758 |
|
|
(define_insn "*andsi_movu"
|
2759 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r,r")
|
2760 |
|
|
(and:SI (match_operand:SI 1 "nonimmediate_operand" "%r,Q,To")
|
2761 |
|
|
(match_operand:SI 2 "const_int_operand" "n,n,n")))]
|
2762 |
|
|
"(INTVAL (operands[2]) == 255 || INTVAL (operands[2]) == 65535)
|
2763 |
|
|
&& !side_effects_p (operands[1])"
|
2764 |
|
|
"movu.%z2 %1,%0"
|
2765 |
|
|
[(set_attr "slottable" "yes,yes,no")])
|
2766 |
|
|
|
2767 |
|
|
(define_insn "*andsi_clear"
|
2768 |
|
|
[(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,Q,Q,To,To")
|
2769 |
|
|
(and:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0,0,0,0,0")
|
2770 |
|
|
(match_operand:SI 2 "const_int_operand" "P,n,P,n,P,n")))]
|
2771 |
|
|
"(INTVAL (operands[2]) == -65536 || INTVAL (operands[2]) == -256)
|
2772 |
|
|
&& !side_effects_p (operands[0])"
|
2773 |
|
|
"@
|
2774 |
|
|
cLear.b %0
|
2775 |
|
|
cLear.w %0
|
2776 |
|
|
cLear.b %0
|
2777 |
|
|
cLear.w %0
|
2778 |
|
|
cLear.b %0
|
2779 |
|
|
cLear.w %0"
|
2780 |
|
|
[(set_attr "slottable" "yes,yes,yes,yes,no,no")
|
2781 |
|
|
(set_attr "cc" "none")])
|
2782 |
|
|
|
2783 |
|
|
;; This is a catch-all pattern, taking care of everything that was not
|
2784 |
|
|
;; matched in the insns above.
|
2785 |
|
|
;;
|
2786 |
|
|
;; Sidenote: the tightening from "nonimmediate_operand" to
|
2787 |
|
|
;; "register_operand" for operand 1 actually increased the register
|
2788 |
|
|
;; pressure (worse code). That will hopefully change with an
|
2789 |
|
|
;; improved reload pass.
|
2790 |
|
|
|
2791 |
|
|
(define_insn "*expanded_andsi_non_v32"
|
2792 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r,r, r,r")
|
2793 |
|
|
(and:SI (match_operand:SI 1 "register_operand" "%0,0,0, 0,r")
|
2794 |
|
|
(match_operand:SI 2 "general_operand" "I,r,Q>,g,!To")))]
|
2795 |
|
|
"!TARGET_V32"
|
2796 |
|
|
"@
|
2797 |
|
|
andq %2,%0
|
2798 |
|
|
and.d %2,%0
|
2799 |
|
|
and.d %2,%0
|
2800 |
|
|
and.d %2,%0
|
2801 |
|
|
and.d %2,%1,%0"
|
2802 |
|
|
[(set_attr "slottable" "yes,yes,yes,no,no")])
|
2803 |
|
|
|
2804 |
|
|
(define_insn "*expanded_andsi_v32"
|
2805 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
|
2806 |
|
|
(and:SI (match_operand:SI 1 "register_operand" "%0,0,0,0")
|
2807 |
|
|
(match_operand:SI 2 "general_operand" "I,r,Q>,g")))]
|
2808 |
|
|
"TARGET_V32"
|
2809 |
|
|
"@
|
2810 |
|
|
andq %2,%0
|
2811 |
|
|
and.d %2,%0
|
2812 |
|
|
and.d %2,%0
|
2813 |
|
|
and.d %2,%0"
|
2814 |
|
|
[(set_attr "slottable" "yes,yes,yes,no")
|
2815 |
|
|
(set_attr "cc" "noov32")])
|
2816 |
|
|
|
2817 |
|
|
;; For both QI and HI we may use the quick patterns. This results in
|
2818 |
|
|
;; useless condition codes, but that is used rarely enough for it to
|
2819 |
|
|
;; normally be a win (could check ahead for use of cc0, but seems to be
|
2820 |
|
|
;; more pain than win).
|
2821 |
|
|
|
2822 |
|
|
;; FIXME: See note for andsi3
|
2823 |
|
|
|
2824 |
|
|
(define_expand "andhi3"
|
2825 |
|
|
[(set (match_operand:HI 0 "nonimmediate_operand" "")
|
2826 |
|
|
(and:HI (match_operand:HI 1 "nonimmediate_operand" "")
|
2827 |
|
|
(match_operand:HI 2 "general_operand" "")))]
|
2828 |
|
|
""
|
2829 |
|
|
{
|
2830 |
|
|
if (! (CONST_INT_P (operands[2])
|
2831 |
|
|
&& (((INTVAL (operands[2]) == -256
|
2832 |
|
|
|| INTVAL (operands[2]) == 65280)
|
2833 |
|
|
&& rtx_equal_p (operands[1], operands[0]))
|
2834 |
|
|
|| (INTVAL (operands[2]) == 255
|
2835 |
|
|
&& REG_P (operands[0])))))
|
2836 |
|
|
{
|
2837 |
|
|
/* See comment for andsi3. */
|
2838 |
|
|
rtx reg0 = REG_P (operands[0]) ? operands[0] : gen_reg_rtx (HImode);
|
2839 |
|
|
rtx reg1 = operands[1];
|
2840 |
|
|
|
2841 |
|
|
if (! REG_P (reg1))
|
2842 |
|
|
{
|
2843 |
|
|
emit_move_insn (reg0, reg1);
|
2844 |
|
|
reg1 = reg0;
|
2845 |
|
|
}
|
2846 |
|
|
|
2847 |
|
|
emit_insn (gen_rtx_SET (HImode, reg0,
|
2848 |
|
|
gen_rtx_AND (HImode, reg1, operands[2])));
|
2849 |
|
|
|
2850 |
|
|
/* Make sure we get the right destination. */
|
2851 |
|
|
if (! REG_P (operands[0]))
|
2852 |
|
|
emit_move_insn (operands[0], reg0);
|
2853 |
|
|
|
2854 |
|
|
DONE;
|
2855 |
|
|
}
|
2856 |
|
|
})
|
2857 |
|
|
|
2858 |
|
|
;; Some fast andhi3 special cases.
|
2859 |
|
|
|
2860 |
|
|
(define_insn "*andhi_movu"
|
2861 |
|
|
[(set (match_operand:HI 0 "register_operand" "=r,r,r")
|
2862 |
|
|
(and:HI (match_operand:HI 1 "nonimmediate_operand" "r,Q,To")
|
2863 |
|
|
(const_int 255)))]
|
2864 |
|
|
"!side_effects_p (operands[1])"
|
2865 |
|
|
"mOvu.b %1,%0"
|
2866 |
|
|
[(set_attr "slottable" "yes,yes,no")])
|
2867 |
|
|
|
2868 |
|
|
(define_insn "*andhi_clear"
|
2869 |
|
|
[(set (match_operand:HI 0 "nonimmediate_operand" "=r,Q,To")
|
2870 |
|
|
(and:HI (match_operand:HI 1 "nonimmediate_operand" "0,0,0")
|
2871 |
|
|
(const_int -256)))]
|
2872 |
|
|
"!side_effects_p (operands[0])"
|
2873 |
|
|
"cLear.b %0"
|
2874 |
|
|
[(set_attr "slottable" "yes,yes,no")
|
2875 |
|
|
(set_attr "cc" "none")])
|
2876 |
|
|
|
2877 |
|
|
;; Catch-all andhi3 pattern.
|
2878 |
|
|
|
2879 |
|
|
(define_insn "*expanded_andhi_non_v32"
|
2880 |
|
|
[(set (match_operand:HI 0 "register_operand" "=r,r,r, r,r,r,r")
|
2881 |
|
|
(and:HI (match_operand:HI 1 "register_operand" "%0,0,0, 0,0,0,r")
|
2882 |
|
|
(match_operand:HI 2 "general_operand" "I,r,Q>,L,O,g,!To")))]
|
2883 |
|
|
|
2884 |
|
|
;; Sidenote: the tightening from "general_operand" to
|
2885 |
|
|
;; "register_operand" for operand 1 actually increased the register
|
2886 |
|
|
;; pressure (worse code). That will hopefully change with an
|
2887 |
|
|
;; improved reload pass.
|
2888 |
|
|
|
2889 |
|
|
"!TARGET_V32"
|
2890 |
|
|
"@
|
2891 |
|
|
andq %2,%0
|
2892 |
|
|
and.w %2,%0
|
2893 |
|
|
and.w %2,%0
|
2894 |
|
|
and.w %2,%0
|
2895 |
|
|
anDq %b2,%0
|
2896 |
|
|
and.w %2,%0
|
2897 |
|
|
and.w %2,%1,%0"
|
2898 |
|
|
[(set_attr "slottable" "yes,yes,yes,no,yes,no,no")
|
2899 |
|
|
(set_attr "cc" "clobber,normal,normal,normal,clobber,normal,normal")])
|
2900 |
|
|
|
2901 |
|
|
(define_insn "*expanded_andhi_v32"
|
2902 |
|
|
[(set (match_operand:HI 0 "register_operand" "=r,r,r,r,r,r")
|
2903 |
|
|
(and:HI (match_operand:HI 1 "register_operand" "%0,0,0,0,0,0")
|
2904 |
|
|
(match_operand:HI 2 "general_operand" "I,r,Q>,L,O,g")))]
|
2905 |
|
|
"TARGET_V32"
|
2906 |
|
|
"@
|
2907 |
|
|
andq %2,%0
|
2908 |
|
|
and.w %2,%0
|
2909 |
|
|
and.w %2,%0
|
2910 |
|
|
and.w %2,%0
|
2911 |
|
|
anDq %b2,%0
|
2912 |
|
|
and.w %2,%0"
|
2913 |
|
|
[(set_attr "slottable" "yes,yes,yes,no,yes,no")
|
2914 |
|
|
(set_attr "cc" "clobber,noov32,noov32,noov32,clobber,noov32")])
|
2915 |
|
|
|
2916 |
|
|
;; A strict_low_part pattern.
|
2917 |
|
|
|
2918 |
|
|
(define_insn "*andhi_lowpart_non_v32"
|
2919 |
|
|
[(set (strict_low_part
|
2920 |
|
|
(match_operand:HI 0 "register_operand" "+r,r, r,r,r,r"))
|
2921 |
|
|
(and:HI (match_operand:HI 1 "register_operand" "%0,0, 0,0,0,r")
|
2922 |
|
|
(match_operand:HI 2 "general_operand" "r,Q>,L,O,g,!To")))]
|
2923 |
|
|
"!TARGET_V32"
|
2924 |
|
|
"@
|
2925 |
|
|
and.w %2,%0
|
2926 |
|
|
and.w %2,%0
|
2927 |
|
|
and.w %2,%0
|
2928 |
|
|
anDq %b2,%0
|
2929 |
|
|
and.w %2,%0
|
2930 |
|
|
and.w %2,%1,%0"
|
2931 |
|
|
[(set_attr "slottable" "yes,yes,no,yes,no,no")
|
2932 |
|
|
(set_attr "cc" "normal,normal,normal,clobber,normal,normal")])
|
2933 |
|
|
|
2934 |
|
|
(define_insn "*andhi_lowpart_v32"
|
2935 |
|
|
[(set (strict_low_part
|
2936 |
|
|
(match_operand:HI 0 "register_operand" "+r,r,r,r,r"))
|
2937 |
|
|
(and:HI (match_operand:HI 1 "register_operand" "%0,0,0,0,0")
|
2938 |
|
|
(match_operand:HI 2 "general_operand" "r,Q>,L,O,g")))]
|
2939 |
|
|
"TARGET_V32"
|
2940 |
|
|
"@
|
2941 |
|
|
and.w %2,%0
|
2942 |
|
|
and.w %2,%0
|
2943 |
|
|
and.w %2,%0
|
2944 |
|
|
anDq %b2,%0
|
2945 |
|
|
and.w %2,%0"
|
2946 |
|
|
[(set_attr "slottable" "yes,yes,no,yes,no")
|
2947 |
|
|
(set_attr "cc" "noov32,noov32,noov32,clobber,noov32")])
|
2948 |
|
|
|
2949 |
|
|
(define_expand "andqi3"
|
2950 |
|
|
[(set (match_operand:QI 0 "register_operand")
|
2951 |
|
|
(and:QI (match_operand:QI 1 "register_operand")
|
2952 |
|
|
(match_operand:QI 2 "general_operand")))]
|
2953 |
|
|
""
|
2954 |
|
|
"")
|
2955 |
|
|
|
2956 |
|
|
(define_insn "*andqi3_non_v32"
|
2957 |
|
|
[(set (match_operand:QI 0 "register_operand" "=r,r,r, r,r,r")
|
2958 |
|
|
(and:QI (match_operand:QI 1 "register_operand" "%0,0,0, 0,0,r")
|
2959 |
|
|
(match_operand:QI 2 "general_operand" "I,r,Q>,O,g,!To")))]
|
2960 |
|
|
"!TARGET_V32"
|
2961 |
|
|
"@
|
2962 |
|
|
andq %2,%0
|
2963 |
|
|
and.b %2,%0
|
2964 |
|
|
and.b %2,%0
|
2965 |
|
|
andQ %b2,%0
|
2966 |
|
|
and.b %2,%0
|
2967 |
|
|
and.b %2,%1,%0"
|
2968 |
|
|
[(set_attr "slottable" "yes,yes,yes,yes,no,no")
|
2969 |
|
|
(set_attr "cc" "clobber,normal,normal,clobber,normal,normal")])
|
2970 |
|
|
|
2971 |
|
|
(define_insn "*andqi3_v32"
|
2972 |
|
|
[(set (match_operand:QI 0 "register_operand" "=r,r,r,r,r")
|
2973 |
|
|
(and:QI (match_operand:QI 1 "register_operand" "%0,0,0,0,0")
|
2974 |
|
|
(match_operand:QI 2 "general_operand" "I,r,Q>,O,g")))]
|
2975 |
|
|
"TARGET_V32"
|
2976 |
|
|
"@
|
2977 |
|
|
andq %2,%0
|
2978 |
|
|
and.b %2,%0
|
2979 |
|
|
and.b %2,%0
|
2980 |
|
|
andQ %b2,%0
|
2981 |
|
|
and.b %2,%0"
|
2982 |
|
|
[(set_attr "slottable" "yes,yes,yes,yes,no")
|
2983 |
|
|
(set_attr "cc" "clobber,noov32,noov32,clobber,noov32")])
|
2984 |
|
|
|
2985 |
|
|
(define_insn "*andqi_lowpart_non_v32"
|
2986 |
|
|
[(set (strict_low_part
|
2987 |
|
|
(match_operand:QI 0 "register_operand" "+r,r, r,r,r"))
|
2988 |
|
|
(and:QI (match_operand:QI 1 "register_operand" "%0,0, 0,0,r")
|
2989 |
|
|
(match_operand:QI 2 "general_operand" "r,Q>,O,g,!To")))]
|
2990 |
|
|
"!TARGET_V32"
|
2991 |
|
|
"@
|
2992 |
|
|
and.b %2,%0
|
2993 |
|
|
and.b %2,%0
|
2994 |
|
|
andQ %b2,%0
|
2995 |
|
|
and.b %2,%0
|
2996 |
|
|
and.b %2,%1,%0"
|
2997 |
|
|
[(set_attr "slottable" "yes,yes,yes,no,no")
|
2998 |
|
|
(set_attr "cc" "normal,normal,clobber,normal,normal")])
|
2999 |
|
|
|
3000 |
|
|
(define_insn "*andqi_lowpart_v32"
|
3001 |
|
|
[(set (strict_low_part
|
3002 |
|
|
(match_operand:QI 0 "register_operand" "+r,r,r,r"))
|
3003 |
|
|
(and:QI (match_operand:QI 1 "register_operand" "%0,0,0,0")
|
3004 |
|
|
(match_operand:QI 2 "general_operand" "r,Q>,O,g")))]
|
3005 |
|
|
"TARGET_V32"
|
3006 |
|
|
"@
|
3007 |
|
|
and.b %2,%0
|
3008 |
|
|
and.b %2,%0
|
3009 |
|
|
andQ %b2,%0
|
3010 |
|
|
and.b %2,%0"
|
3011 |
|
|
[(set_attr "slottable" "yes,yes,yes,no")
|
3012 |
|
|
(set_attr "cc" "noov32,noov32,clobber,noov32")])
|
3013 |
|
|
|
3014 |
|
|
;; Bitwise or.
|
3015 |
|
|
|
3016 |
|
|
;; Same comment as anddi3 applies here - no need for such a pattern.
|
3017 |
|
|
|
3018 |
|
|
;; It seems there's no need to jump through hoops to get good code such as
|
3019 |
|
|
;; with andsi3.
|
3020 |
|
|
|
3021 |
|
|
(define_expand "ior3"
|
3022 |
|
|
[(set (match_operand:BWD 0 "register_operand")
|
3023 |
|
|
(ior:BWD (match_operand:BWD 1 "register_operand")
|
3024 |
|
|
(match_operand:BWD 2 "general_operand")))]
|
3025 |
|
|
""
|
3026 |
|
|
"")
|
3027 |
|
|
|
3028 |
|
|
(define_insn "*iorsi3_non_v32"
|
3029 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r,r, r,r,r")
|
3030 |
|
|
(ior:SI (match_operand:SI 1 "register_operand" "%0,0,0, 0,0,r")
|
3031 |
|
|
(match_operand:SI 2 "general_operand" "I, r,Q>,n,g,!To")))]
|
3032 |
|
|
"!TARGET_V32"
|
3033 |
|
|
"@
|
3034 |
|
|
orq %2,%0
|
3035 |
|
|
or.d %2,%0
|
3036 |
|
|
or.d %2,%0
|
3037 |
|
|
oR.%s2 %2,%0
|
3038 |
|
|
or.d %2,%0
|
3039 |
|
|
or.d %2,%1,%0"
|
3040 |
|
|
[(set_attr "slottable" "yes,yes,yes,no,no,no")
|
3041 |
|
|
(set_attr "cc" "normal,normal,normal,clobber,normal,normal")])
|
3042 |
|
|
|
3043 |
|
|
(define_insn "*iorsi3_v32"
|
3044 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r,r,r,r")
|
3045 |
|
|
(ior:SI (match_operand:SI 1 "register_operand" "%0,0,0,0,0")
|
3046 |
|
|
(match_operand:SI 2 "general_operand" "I,r,Q>,n,g")))]
|
3047 |
|
|
"TARGET_V32"
|
3048 |
|
|
"@
|
3049 |
|
|
orq %2,%0
|
3050 |
|
|
or.d %2,%0
|
3051 |
|
|
or.d %2,%0
|
3052 |
|
|
oR.%s2 %2,%0
|
3053 |
|
|
or.d %2,%0"
|
3054 |
|
|
[(set_attr "slottable" "yes,yes,yes,no,no")
|
3055 |
|
|
(set_attr "cc" "noov32,noov32,noov32,clobber,noov32")])
|
3056 |
|
|
|
3057 |
|
|
(define_insn "*iorhi3_non_v32"
|
3058 |
|
|
[(set (match_operand:HI 0 "register_operand" "=r,r,r, r,r,r,r")
|
3059 |
|
|
(ior:HI (match_operand:HI 1 "register_operand" "%0,0,0, 0,0,0,r")
|
3060 |
|
|
(match_operand:HI 2 "general_operand" "I,r,Q>,L,O,g,!To")))]
|
3061 |
|
|
"!TARGET_V32"
|
3062 |
|
|
"@
|
3063 |
|
|
orq %2,%0
|
3064 |
|
|
or.w %2,%0
|
3065 |
|
|
or.w %2,%0
|
3066 |
|
|
or.w %2,%0
|
3067 |
|
|
oRq %b2,%0
|
3068 |
|
|
or.w %2,%0
|
3069 |
|
|
or.w %2,%1,%0"
|
3070 |
|
|
[(set_attr "slottable" "yes,yes,yes,no,yes,no,no")
|
3071 |
|
|
(set_attr "cc" "clobber,normal,normal,normal,clobber,normal,normal")])
|
3072 |
|
|
|
3073 |
|
|
(define_insn "*iorhi3_v32"
|
3074 |
|
|
[(set (match_operand:HI 0 "register_operand" "=r,r,r,r,r,r")
|
3075 |
|
|
(ior:HI (match_operand:HI 1 "register_operand" "%0,0,0,0,0,0")
|
3076 |
|
|
(match_operand:HI 2 "general_operand" "I,r,Q>,L,O,g")))]
|
3077 |
|
|
"TARGET_V32"
|
3078 |
|
|
"@
|
3079 |
|
|
orq %2,%0
|
3080 |
|
|
or.w %2,%0
|
3081 |
|
|
or.w %2,%0
|
3082 |
|
|
or.w %2,%0
|
3083 |
|
|
oRq %b2,%0
|
3084 |
|
|
or.w %2,%0"
|
3085 |
|
|
[(set_attr "slottable" "yes,yes,yes,no,yes,no")
|
3086 |
|
|
(set_attr "cc" "clobber,noov32,noov32,noov32,clobber,noov32")])
|
3087 |
|
|
|
3088 |
|
|
(define_insn "*iorqi3_non_v32"
|
3089 |
|
|
[(set (match_operand:QI 0 "register_operand" "=r,r,r, r,r,r")
|
3090 |
|
|
(ior:QI (match_operand:QI 1 "register_operand" "%0,0,0, 0,0,r")
|
3091 |
|
|
(match_operand:QI 2 "general_operand" "I,r,Q>,O,g,!To")))]
|
3092 |
|
|
"!TARGET_V32"
|
3093 |
|
|
"@
|
3094 |
|
|
orq %2,%0
|
3095 |
|
|
or.b %2,%0
|
3096 |
|
|
or.b %2,%0
|
3097 |
|
|
orQ %b2,%0
|
3098 |
|
|
or.b %2,%0
|
3099 |
|
|
or.b %2,%1,%0"
|
3100 |
|
|
[(set_attr "slottable" "yes,yes,yes,yes,no,no")
|
3101 |
|
|
(set_attr "cc" "clobber,normal,normal,clobber,normal,normal")])
|
3102 |
|
|
|
3103 |
|
|
(define_insn "*iorqi3_v32"
|
3104 |
|
|
[(set (match_operand:QI 0 "register_operand" "=r,r,r,r,r")
|
3105 |
|
|
(ior:QI (match_operand:QI 1 "register_operand" "%0,0,0,0,0")
|
3106 |
|
|
(match_operand:QI 2 "general_operand" "I,r,Q>,O,g")))]
|
3107 |
|
|
"TARGET_V32"
|
3108 |
|
|
"@
|
3109 |
|
|
orq %2,%0
|
3110 |
|
|
or.b %2,%0
|
3111 |
|
|
or.b %2,%0
|
3112 |
|
|
orQ %b2,%0
|
3113 |
|
|
or.b %2,%0"
|
3114 |
|
|
[(set_attr "slottable" "yes,yes,yes,yes,no")
|
3115 |
|
|
(set_attr "cc" "clobber,noov32,noov32,clobber,noov32")])
|
3116 |
|
|
|
3117 |
|
|
;; Exclusive-or
|
3118 |
|
|
|
3119 |
|
|
;; See comment about "anddi3" for xordi3 - no need for such a pattern.
|
3120 |
|
|
;; FIXME: Do we really need the shorter variants?
|
3121 |
|
|
|
3122 |
|
|
(define_insn "xorsi3"
|
3123 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
3124 |
|
|
(xor:SI (match_operand:SI 1 "register_operand" "%0")
|
3125 |
|
|
(match_operand:SI 2 "register_operand" "r")))]
|
3126 |
|
|
""
|
3127 |
|
|
"xor %2,%0"
|
3128 |
|
|
[(set_attr "slottable" "yes")
|
3129 |
|
|
(set_attr "cc" "noov32")])
|
3130 |
|
|
|
3131 |
|
|
(define_insn "xor3"
|
3132 |
|
|
[(set (match_operand:BW 0 "register_operand" "=r")
|
3133 |
|
|
(xor:BW (match_operand:BW 1 "register_operand" "%0")
|
3134 |
|
|
(match_operand:BW 2 "register_operand" "r")))]
|
3135 |
|
|
""
|
3136 |
|
|
"xor %2,%0"
|
3137 |
|
|
[(set_attr "slottable" "yes")
|
3138 |
|
|
(set_attr "cc" "clobber")])
|
3139 |
|
|
|
3140 |
|
|
;; Negation insns.
|
3141 |
|
|
|
3142 |
|
|
;; Questionable use, here mostly as a (slightly usable) define_expand
|
3143 |
|
|
;; example.
|
3144 |
|
|
|
3145 |
|
|
(define_expand "negsf2"
|
3146 |
|
|
[(set (match_dup 2)
|
3147 |
|
|
(match_dup 3))
|
3148 |
|
|
(parallel [(set (match_operand:SF 0 "register_operand" "=r")
|
3149 |
|
|
(neg:SF (match_operand:SF 1
|
3150 |
|
|
"register_operand" "0")))
|
3151 |
|
|
(use (match_dup 2))])]
|
3152 |
|
|
""
|
3153 |
|
|
{
|
3154 |
|
|
operands[2] = gen_reg_rtx (SImode);
|
3155 |
|
|
operands[3] = GEN_INT (1 << 31);
|
3156 |
|
|
})
|
3157 |
|
|
|
3158 |
|
|
(define_insn "*expanded_negsf2"
|
3159 |
|
|
[(set (match_operand:SF 0 "register_operand" "=r")
|
3160 |
|
|
(neg:SF (match_operand:SF 1 "register_operand" "0")))
|
3161 |
|
|
(use (match_operand:SI 2 "register_operand" "r"))]
|
3162 |
|
|
""
|
3163 |
|
|
"xor %2,%0"
|
3164 |
|
|
[(set_attr "slottable" "yes")])
|
3165 |
|
|
|
3166 |
|
|
;; No "negdi2" although we could make one up that may be faster than
|
3167 |
|
|
;; the one in libgcc.
|
3168 |
|
|
|
3169 |
|
|
(define_insn "neg2"
|
3170 |
|
|
[(set (match_operand:BWD 0 "register_operand" "=r")
|
3171 |
|
|
(neg:BWD (match_operand:BWD 1 "register_operand" "r")))]
|
3172 |
|
|
""
|
3173 |
|
|
"neg %1,%0"
|
3174 |
|
|
[(set_attr "slottable" "yes")])
|
3175 |
|
|
|
3176 |
|
|
;; One-complements.
|
3177 |
|
|
|
3178 |
|
|
;; See comment on anddi3 - no need for a DImode pattern.
|
3179 |
|
|
;; See also xor comment.
|
3180 |
|
|
|
3181 |
|
|
(define_insn "one_cmplsi2"
|
3182 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
3183 |
|
|
(not:SI (match_operand:SI 1 "register_operand" "0")))]
|
3184 |
|
|
""
|
3185 |
|
|
"not %0"
|
3186 |
|
|
[(set_attr "slottable" "yes")
|
3187 |
|
|
(set_attr "cc" "noov32")])
|
3188 |
|
|
|
3189 |
|
|
(define_insn "one_cmpl2"
|
3190 |
|
|
[(set (match_operand:BW 0 "register_operand" "=r")
|
3191 |
|
|
(not:BW (match_operand:BW 1 "register_operand" "0")))]
|
3192 |
|
|
""
|
3193 |
|
|
"not %0"
|
3194 |
|
|
[(set_attr "slottable" "yes")
|
3195 |
|
|
(set_attr "cc" "clobber")])
|
3196 |
|
|
|
3197 |
|
|
;; Arithmetic/Logical shift right (and SI left).
|
3198 |
|
|
|
3199 |
|
|
(define_insn "si3"
|
3200 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
3201 |
|
|
(shift:SI (match_operand:SI 1 "register_operand" "0")
|
3202 |
|
|
(match_operand:SI 2 "nonmemory_operand" "Kcr")))]
|
3203 |
|
|
""
|
3204 |
|
|
{
|
3205 |
|
|
if (REG_S_P (operands[2]))
|
3206 |
|
|
return ".d %2,%0";
|
3207 |
|
|
|
3208 |
|
|
return "q %2,%0";
|
3209 |
|
|
}
|
3210 |
|
|
[(set_attr "slottable" "yes")
|
3211 |
|
|
(set_attr "cc" "noov32")])
|
3212 |
|
|
|
3213 |
|
|
;; Since gcc gets lost, and forgets to zero-extend the source (or mask
|
3214 |
|
|
;; the destination) when it changes shifts of lower modes into SImode,
|
3215 |
|
|
;; it is better to make these expands an anonymous patterns instead of
|
3216 |
|
|
;; the more correct define_insns. This occurs when gcc thinks that is
|
3217 |
|
|
;; is better to widen to SImode and use immediate shift count.
|
3218 |
|
|
|
3219 |
|
|
;; FIXME: Is this legacy or still true for gcc >= 2.7.2?
|
3220 |
|
|
|
3221 |
|
|
;; FIXME: Can't parametrize sign_extend and zero_extend (before
|
3222 |
|
|
;; mentioning "shiftrt"), so we need two patterns.
|
3223 |
|
|
(define_expand "ashr3"
|
3224 |
|
|
[(set (match_dup 3)
|
3225 |
|
|
(sign_extend:SI (match_operand:BW 1 "nonimmediate_operand" "")))
|
3226 |
|
|
(set (match_dup 4)
|
3227 |
|
|
(zero_extend:SI (match_operand:BW 2 "nonimmediate_operand" "")))
|
3228 |
|
|
(set (match_dup 5) (ashiftrt:SI (match_dup 3) (match_dup 4)))
|
3229 |
|
|
(set (match_operand:BW 0 "general_operand" "")
|
3230 |
|
|
(subreg:BW (match_dup 5) 0))]
|
3231 |
|
|
""
|
3232 |
|
|
{
|
3233 |
|
|
int i;
|
3234 |
|
|
|
3235 |
|
|
for (i = 3; i < 6; i++)
|
3236 |
|
|
operands[i] = gen_reg_rtx (SImode);
|
3237 |
|
|
})
|
3238 |
|
|
|
3239 |
|
|
(define_expand "lshr3"
|
3240 |
|
|
[(set (match_dup 3)
|
3241 |
|
|
(zero_extend:SI (match_operand:BW 1 "nonimmediate_operand" "")))
|
3242 |
|
|
(set (match_dup 4)
|
3243 |
|
|
(zero_extend:SI (match_operand:BW 2 "nonimmediate_operand" "")))
|
3244 |
|
|
(set (match_dup 5) (lshiftrt:SI (match_dup 3) (match_dup 4)))
|
3245 |
|
|
(set (match_operand:BW 0 "general_operand" "")
|
3246 |
|
|
(subreg:BW (match_dup 5) 0))]
|
3247 |
|
|
""
|
3248 |
|
|
{
|
3249 |
|
|
int i;
|
3250 |
|
|
|
3251 |
|
|
for (i = 3; i < 6; i++)
|
3252 |
|
|
operands[i] = gen_reg_rtx (SImode);
|
3253 |
|
|
})
|
3254 |
|
|
|
3255 |
|
|
(define_insn "*expanded_"
|
3256 |
|
|
[(set (match_operand:BW 0 "register_operand" "=r")
|
3257 |
|
|
(shiftrt:BW (match_operand:BW 1 "register_operand" "0")
|
3258 |
|
|
(match_operand:BW 2 "register_operand" "r")))]
|
3259 |
|
|
""
|
3260 |
|
|
" %2,%0"
|
3261 |
|
|
[(set_attr "slottable" "yes")
|
3262 |
|
|
(set_attr "cc" "noov32")])
|
3263 |
|
|
|
3264 |
|
|
(define_insn "*_lowpart"
|
3265 |
|
|
[(set (strict_low_part (match_operand:BW 0 "register_operand" "+r"))
|
3266 |
|
|
(shiftrt:BW (match_dup 0)
|
3267 |
|
|
(match_operand:BW 1 "register_operand" "r")))]
|
3268 |
|
|
""
|
3269 |
|
|
" %1,%0"
|
3270 |
|
|
[(set_attr "slottable" "yes")
|
3271 |
|
|
(set_attr "cc" "noov32")])
|
3272 |
|
|
|
3273 |
|
|
;; Arithmetic/logical shift left.
|
3274 |
|
|
|
3275 |
|
|
;; For narrower modes than SI, we can use lslq although it makes cc
|
3276 |
|
|
;; unusable. The win is that we do not have to reload the shift-count
|
3277 |
|
|
;; into a register.
|
3278 |
|
|
|
3279 |
|
|
(define_insn "ashl3"
|
3280 |
|
|
[(set (match_operand:BW 0 "register_operand" "=r,r")
|
3281 |
|
|
(ashift:BW (match_operand:BW 1 "register_operand" "0,0")
|
3282 |
|
|
(match_operand:BW 2 "nonmemory_operand" "r,Kc")))]
|
3283 |
|
|
""
|
3284 |
|
|
{
|
3285 |
|
|
return
|
3286 |
|
|
(CONST_INT_P (operands[2]) && INTVAL (operands[2]) > )
|
3287 |
|
|
? "moveq 0,%0"
|
3288 |
|
|
: (CONSTANT_P (operands[2])
|
3289 |
|
|
? "lslq %2,%0" : "lsl %2,%0");
|
3290 |
|
|
}
|
3291 |
|
|
[(set_attr "slottable" "yes")
|
3292 |
|
|
(set_attr "cc" "noov32,clobber")])
|
3293 |
|
|
|
3294 |
|
|
;; A strict_low_part matcher.
|
3295 |
|
|
|
3296 |
|
|
(define_insn "*ashl_lowpart"
|
3297 |
|
|
[(set (strict_low_part (match_operand:BW 0 "register_operand" "+r"))
|
3298 |
|
|
(ashift:BW (match_dup 0)
|
3299 |
|
|
(match_operand:HI 1 "register_operand" "r")))]
|
3300 |
|
|
""
|
3301 |
|
|
"lsl %1,%0"
|
3302 |
|
|
[(set_attr "slottable" "yes")
|
3303 |
|
|
(set_attr "cc" "noov32")])
|
3304 |
|
|
|
3305 |
|
|
;; Various strange insns that gcc likes.
|
3306 |
|
|
|
3307 |
|
|
;; Fortunately, it is simple to construct an abssf (although it may not
|
3308 |
|
|
;; be very much used in practice).
|
3309 |
|
|
|
3310 |
|
|
(define_insn "abssf2"
|
3311 |
|
|
[(set (match_operand:SF 0 "register_operand" "=r")
|
3312 |
|
|
(abs:SF (match_operand:SF 1 "register_operand" "0")))]
|
3313 |
|
|
""
|
3314 |
|
|
"lslq 1,%0\;lsrq 1,%0")
|
3315 |
|
|
|
3316 |
|
|
(define_insn "abssi2"
|
3317 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
3318 |
|
|
(abs:SI (match_operand:SI 1 "register_operand" "r")))]
|
3319 |
|
|
""
|
3320 |
|
|
"abs %1,%0"
|
3321 |
|
|
[(set_attr "slottable" "yes")
|
3322 |
|
|
(set_attr "cc" "noov32")])
|
3323 |
|
|
|
3324 |
|
|
;; FIXME: GCC should be able to do these expansions itself.
|
3325 |
|
|
|
3326 |
|
|
(define_expand "abs2"
|
3327 |
|
|
[(set (match_dup 2)
|
3328 |
|
|
(sign_extend:SI (match_operand:BW 1 "general_operand" "")))
|
3329 |
|
|
(set (match_dup 3) (abs:SI (match_dup 2)))
|
3330 |
|
|
(set (match_operand:BW 0 "register_operand" "")
|
3331 |
|
|
(subreg:BW (match_dup 3) 0))]
|
3332 |
|
|
""
|
3333 |
|
|
"operands[2] = gen_reg_rtx (SImode); operands[3] = gen_reg_rtx (SImode);")
|
3334 |
|
|
|
3335 |
|
|
(define_insn "clzsi2"
|
3336 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
3337 |
|
|
(clz:SI (match_operand:SI 1 "register_operand" "r")))]
|
3338 |
|
|
"TARGET_HAS_LZ"
|
3339 |
|
|
"lz %1,%0"
|
3340 |
|
|
[(set_attr "slottable" "yes")
|
3341 |
|
|
(set_attr "cc" "noov32")])
|
3342 |
|
|
|
3343 |
|
|
(define_insn "bswapsi2"
|
3344 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
3345 |
|
|
(bswap:SI (match_operand:SI 1 "register_operand" "0")))]
|
3346 |
|
|
"TARGET_HAS_SWAP"
|
3347 |
|
|
"swapwb %0"
|
3348 |
|
|
[(set_attr "slottable" "yes")
|
3349 |
|
|
(set_attr "cc" "noov32")])
|
3350 |
|
|
|
3351 |
|
|
;; This instruction swaps all bits in a register.
|
3352 |
|
|
;; That means that the most significant bit is put in the place
|
3353 |
|
|
;; of the least significant bit, and so on.
|
3354 |
|
|
|
3355 |
|
|
(define_insn "cris_swap_bits"
|
3356 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
3357 |
|
|
(unspec:SI [(match_operand:SI 1 "register_operand" "0")]
|
3358 |
|
|
CRIS_UNSPEC_SWAP_BITS))]
|
3359 |
|
|
"TARGET_HAS_SWAP"
|
3360 |
|
|
"swapwbr %0"
|
3361 |
|
|
[(set_attr "slottable" "yes")
|
3362 |
|
|
(set_attr "cc" "noov32")])
|
3363 |
|
|
|
3364 |
|
|
;; Implement ctz using two instructions, one for bit swap and one for clz.
|
3365 |
|
|
;; Defines a scratch register to avoid clobbering input.
|
3366 |
|
|
|
3367 |
|
|
(define_expand "ctzsi2"
|
3368 |
|
|
[(set (match_dup 2)
|
3369 |
|
|
(match_operand:SI 1 "register_operand"))
|
3370 |
|
|
(set (match_dup 2)
|
3371 |
|
|
(unspec:SI [(match_dup 2)] CRIS_UNSPEC_SWAP_BITS))
|
3372 |
|
|
(set (match_operand:SI 0 "register_operand")
|
3373 |
|
|
(clz:SI (match_dup 2)))]
|
3374 |
|
|
"TARGET_HAS_LZ && TARGET_HAS_SWAP"
|
3375 |
|
|
"operands[2] = gen_reg_rtx (SImode);")
|
3376 |
|
|
|
3377 |
|
|
;; Bound-insn. Defined to be the same as an unsigned minimum, which is an
|
3378 |
|
|
;; operation supported by gcc. Used in casesi, but used now and then in
|
3379 |
|
|
;; normal code too.
|
3380 |
|
|
|
3381 |
|
|
(define_expand "uminsi3"
|
3382 |
|
|
[(set (match_operand:SI 0 "register_operand" "")
|
3383 |
|
|
(umin:SI (match_operand:SI 1 "register_operand" "")
|
3384 |
|
|
(match_operand:SI 2 "general_operand" "")))]
|
3385 |
|
|
""
|
3386 |
|
|
{
|
3387 |
|
|
if (MEM_P (operands[2]) && TARGET_V32)
|
3388 |
|
|
operands[2] = force_reg (SImode, operands[2]);
|
3389 |
|
|
})
|
3390 |
|
|
|
3391 |
|
|
(define_insn "*uminsi3_non_v32"
|
3392 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r, r,r")
|
3393 |
|
|
(umin:SI (match_operand:SI 1 "register_operand" "%0,0, 0,r")
|
3394 |
|
|
(match_operand:SI 2 "general_operand" "r,Q>,g,!To")))]
|
3395 |
|
|
"!TARGET_V32"
|
3396 |
|
|
{
|
3397 |
|
|
if (CONST_INT_P (operands[2]))
|
3398 |
|
|
{
|
3399 |
|
|
/* Constant operands are zero-extended, so only 32-bit operands
|
3400 |
|
|
may be negative. */
|
3401 |
|
|
if (INTVAL (operands[2]) >= 0)
|
3402 |
|
|
{
|
3403 |
|
|
if (INTVAL (operands[2]) < 256)
|
3404 |
|
|
return "bound.b %2,%0";
|
3405 |
|
|
|
3406 |
|
|
if (INTVAL (operands[2]) < 65536)
|
3407 |
|
|
return "bound.w %2,%0";
|
3408 |
|
|
}
|
3409 |
|
|
}
|
3410 |
|
|
else if (which_alternative == 3)
|
3411 |
|
|
return "bound.d %2,%1,%0";
|
3412 |
|
|
|
3413 |
|
|
return "bound.d %2,%0";
|
3414 |
|
|
}
|
3415 |
|
|
[(set_attr "slottable" "yes,yes,no,no")])
|
3416 |
|
|
|
3417 |
|
|
(define_insn "*uminsi3_v32"
|
3418 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r,r")
|
3419 |
|
|
(umin:SI (match_operand:SI 1 "register_operand" "%0,0")
|
3420 |
|
|
(match_operand:SI 2 "nonmemory_operand" "r,i")))]
|
3421 |
|
|
"TARGET_V32"
|
3422 |
|
|
{
|
3423 |
|
|
if (GET_CODE (operands[2]) == CONST_INT)
|
3424 |
|
|
{
|
3425 |
|
|
/* Constant operands are zero-extended, so only 32-bit operands
|
3426 |
|
|
may be negative. */
|
3427 |
|
|
if (INTVAL (operands[2]) >= 0)
|
3428 |
|
|
{
|
3429 |
|
|
if (INTVAL (operands[2]) < 256)
|
3430 |
|
|
return "bound.b %2,%0";
|
3431 |
|
|
|
3432 |
|
|
if (INTVAL (operands[2]) < 65536)
|
3433 |
|
|
return "bound.w %2,%0";
|
3434 |
|
|
}
|
3435 |
|
|
}
|
3436 |
|
|
|
3437 |
|
|
return "bound.d %2,%0";
|
3438 |
|
|
}
|
3439 |
|
|
[(set_attr "slottable" "yes,no")])
|
3440 |
|
|
|
3441 |
|
|
;; Jump and branch insns.
|
3442 |
|
|
|
3443 |
|
|
(define_insn "jump"
|
3444 |
|
|
[(set (pc)
|
3445 |
|
|
(label_ref (match_operand 0 "" "")))]
|
3446 |
|
|
""
|
3447 |
|
|
"ba %l0%#"
|
3448 |
|
|
[(set_attr "slottable" "has_slot")])
|
3449 |
|
|
|
3450 |
|
|
;; Testcase gcc.c-torture/compile/991213-3.c fails if we allow a constant
|
3451 |
|
|
;; here, since the insn is not recognized as an indirect jump by
|
3452 |
|
|
;; jmp_uses_reg_or_mem used by computed_jump_p. Perhaps it is a kludge to
|
3453 |
|
|
;; change from general_operand to nonimmediate_operand (at least the docs
|
3454 |
|
|
;; should be changed), but then again the pattern is called indirect_jump.
|
3455 |
|
|
(define_expand "indirect_jump"
|
3456 |
|
|
[(set (pc) (match_operand:SI 0 "nonimmediate_operand"))]
|
3457 |
|
|
""
|
3458 |
|
|
{
|
3459 |
|
|
if (TARGET_V32 && MEM_P (operands[0]))
|
3460 |
|
|
operands[0] = force_reg (SImode, operands[0]);
|
3461 |
|
|
})
|
3462 |
|
|
|
3463 |
|
|
(define_insn "*indirect_jump_non_v32"
|
3464 |
|
|
[(set (pc) (match_operand:SI 0 "nonimmediate_operand" "rm"))]
|
3465 |
|
|
"!TARGET_V32"
|
3466 |
|
|
"jump %0")
|
3467 |
|
|
|
3468 |
|
|
(define_insn "*indirect_jump_v32"
|
3469 |
|
|
[(set (pc) (match_operand:SI 0 "register_operand" "r"))]
|
3470 |
|
|
"TARGET_V32"
|
3471 |
|
|
"jump %0%#"
|
3472 |
|
|
[(set_attr "slottable" "has_slot")])
|
3473 |
|
|
|
3474 |
|
|
;; Return insn. Used whenever the epilogue is very simple; if it is only
|
3475 |
|
|
;; a single ret or jump [sp+]. No allocated stack space or saved
|
3476 |
|
|
;; registers are allowed.
|
3477 |
|
|
;; Note that for this pattern, although named, it is ok to check the
|
3478 |
|
|
;; context of the insn in the test, not only compiler switches.
|
3479 |
|
|
|
3480 |
|
|
(define_expand "return"
|
3481 |
|
|
[(return)]
|
3482 |
|
|
"cris_simple_epilogue ()"
|
3483 |
|
|
"cris_expand_return (cris_return_address_on_stack ()); DONE;")
|
3484 |
|
|
|
3485 |
|
|
(define_insn "*return_expanded"
|
3486 |
|
|
[(return)]
|
3487 |
|
|
""
|
3488 |
|
|
{
|
3489 |
|
|
return cris_return_address_on_stack_for_return ()
|
3490 |
|
|
? "jump [$sp+]" : "ret%#";
|
3491 |
|
|
}
|
3492 |
|
|
[(set (attr "slottable")
|
3493 |
|
|
(if_then_else
|
3494 |
|
|
(match_test "cris_return_address_on_stack_for_return ()")
|
3495 |
|
|
(const_string "no")
|
3496 |
|
|
(const_string "has_return_slot")))])
|
3497 |
|
|
|
3498 |
|
|
(define_expand "prologue"
|
3499 |
|
|
[(const_int 0)]
|
3500 |
|
|
"TARGET_PROLOGUE_EPILOGUE"
|
3501 |
|
|
"cris_expand_prologue (); DONE;")
|
3502 |
|
|
|
3503 |
|
|
;; Note that the (return) from the expander itself is always the last
|
3504 |
|
|
;; insn in the epilogue.
|
3505 |
|
|
(define_expand "epilogue"
|
3506 |
|
|
[(const_int 0)]
|
3507 |
|
|
"TARGET_PROLOGUE_EPILOGUE"
|
3508 |
|
|
"cris_expand_epilogue (); DONE;")
|
3509 |
|
|
|
3510 |
|
|
;; Conditional branches.
|
3511 |
|
|
|
3512 |
|
|
(define_expand "cbranch4"
|
3513 |
|
|
[(set (cc0) (compare
|
3514 |
|
|
(match_operand:BWD 1 "nonimmediate_operand")
|
3515 |
|
|
(match_operand:BWD 2 "general_operand")))
|
3516 |
|
|
(set (pc)
|
3517 |
|
|
(if_then_else (match_operator 0 "ordered_comparison_operator"
|
3518 |
|
|
[(cc0) (const_int 0)])
|
3519 |
|
|
(label_ref (match_operand 3 "" ""))
|
3520 |
|
|
(pc)))]
|
3521 |
|
|
""
|
3522 |
|
|
"")
|
3523 |
|
|
|
3524 |
|
|
(define_expand "cbranchdi4"
|
3525 |
|
|
[(set (cc0)
|
3526 |
|
|
(compare (match_operand:DI 1 "nonimmediate_operand" "")
|
3527 |
|
|
(match_operand:DI 2 "general_operand" "")))
|
3528 |
|
|
(set (pc)
|
3529 |
|
|
(if_then_else (match_operator 0 "ordered_comparison_operator"
|
3530 |
|
|
[(cc0) (const_int 0)])
|
3531 |
|
|
(label_ref (match_operand 3 "" ""))
|
3532 |
|
|
(pc)))]
|
3533 |
|
|
""
|
3534 |
|
|
{
|
3535 |
|
|
if (TARGET_V32 && !REG_P (operands[1]))
|
3536 |
|
|
operands[1] = force_reg (DImode, operands[1]);
|
3537 |
|
|
if (TARGET_V32 && MEM_P (operands[2]))
|
3538 |
|
|
operands[2] = force_reg (DImode, operands[2]);
|
3539 |
|
|
})
|
3540 |
|
|
|
3541 |
|
|
|
3542 |
|
|
;; We suffer from the same overflow-bit-gets-in-the-way problem as
|
3543 |
|
|
;; e.g. m68k, so we have to check if overflow bit is set on all "signed"
|
3544 |
|
|
;; conditions.
|
3545 |
|
|
|
3546 |
|
|
(define_insn "b"
|
3547 |
|
|
[(set (pc)
|
3548 |
|
|
(if_then_else (ncond (cc0)
|
3549 |
|
|
(const_int 0))
|
3550 |
|
|
(label_ref (match_operand 0 "" ""))
|
3551 |
|
|
(pc)))]
|
3552 |
|
|
""
|
3553 |
|
|
"b %l0%#"
|
3554 |
|
|
[(set_attr "slottable" "has_slot")])
|
3555 |
|
|
|
3556 |
|
|
(define_insn "b"
|
3557 |
|
|
[(set (pc)
|
3558 |
|
|
(if_then_else (ocond (cc0)
|
3559 |
|
|
(const_int 0))
|
3560 |
|
|
(label_ref (match_operand 0 "" ""))
|
3561 |
|
|
(pc)))]
|
3562 |
|
|
""
|
3563 |
|
|
{
|
3564 |
|
|
return
|
3565 |
|
|
(cc_prev_status.flags & CC_NO_OVERFLOW)
|
3566 |
|
|
? 0 : "b %l0%#";
|
3567 |
|
|
}
|
3568 |
|
|
[(set_attr "slottable" "has_slot")])
|
3569 |
|
|
|
3570 |
|
|
(define_insn "b"
|
3571 |
|
|
[(set (pc)
|
3572 |
|
|
(if_then_else (rcond (cc0)
|
3573 |
|
|
(const_int 0))
|
3574 |
|
|
(label_ref (match_operand 0 "" ""))
|
3575 |
|
|
(pc)))]
|
3576 |
|
|
""
|
3577 |
|
|
{
|
3578 |
|
|
return
|
3579 |
|
|
(cc_prev_status.flags & CC_NO_OVERFLOW)
|
3580 |
|
|
? "b %l0%#" : "b %l0%#";
|
3581 |
|
|
}
|
3582 |
|
|
[(set_attr "slottable" "has_slot")])
|
3583 |
|
|
|
3584 |
|
|
;; Reversed anonymous patterns to the ones above, as mandated.
|
3585 |
|
|
|
3586 |
|
|
(define_insn "*b_reversed"
|
3587 |
|
|
[(set (pc)
|
3588 |
|
|
(if_then_else (ncond (cc0)
|
3589 |
|
|
(const_int 0))
|
3590 |
|
|
(pc)
|
3591 |
|
|
(label_ref (match_operand 0 "" ""))))]
|
3592 |
|
|
""
|
3593 |
|
|
"b %l0%#"
|
3594 |
|
|
[(set_attr "slottable" "has_slot")])
|
3595 |
|
|
|
3596 |
|
|
(define_insn "*b_reversed"
|
3597 |
|
|
[(set (pc)
|
3598 |
|
|
(if_then_else (ocond (cc0)
|
3599 |
|
|
(const_int 0))
|
3600 |
|
|
(pc)
|
3601 |
|
|
(label_ref (match_operand 0 "" ""))))]
|
3602 |
|
|
""
|
3603 |
|
|
{
|
3604 |
|
|
return
|
3605 |
|
|
(cc_prev_status.flags & CC_NO_OVERFLOW)
|
3606 |
|
|
? 0 : "b %l0%#";
|
3607 |
|
|
}
|
3608 |
|
|
[(set_attr "slottable" "has_slot")])
|
3609 |
|
|
|
3610 |
|
|
(define_insn "*b_reversed"
|
3611 |
|
|
[(set (pc)
|
3612 |
|
|
(if_then_else (rcond (cc0)
|
3613 |
|
|
(const_int 0))
|
3614 |
|
|
(pc)
|
3615 |
|
|
(label_ref (match_operand 0 "" ""))))]
|
3616 |
|
|
""
|
3617 |
|
|
{
|
3618 |
|
|
return
|
3619 |
|
|
(cc_prev_status.flags & CC_NO_OVERFLOW)
|
3620 |
|
|
? "b %l0%#" : "b %l0%#";
|
3621 |
|
|
}
|
3622 |
|
|
[(set_attr "slottable" "has_slot")])
|
3623 |
|
|
|
3624 |
|
|
;; Set on condition: sCC.
|
3625 |
|
|
|
3626 |
|
|
(define_expand "cstoredi4"
|
3627 |
|
|
[(set (cc0) (compare
|
3628 |
|
|
(match_operand:DI 2 "nonimmediate_operand")
|
3629 |
|
|
(match_operand:DI 3 "general_operand")))
|
3630 |
|
|
(set (match_operand:SI 0 "register_operand")
|
3631 |
|
|
(match_operator:SI 1 "ordered_comparison_operator"
|
3632 |
|
|
[(cc0) (const_int 0)]))]
|
3633 |
|
|
""
|
3634 |
|
|
{
|
3635 |
|
|
if (TARGET_V32 && !REG_P (operands[2]))
|
3636 |
|
|
operands[2] = force_reg (DImode, operands[2]);
|
3637 |
|
|
if (TARGET_V32 && MEM_P (operands[3]))
|
3638 |
|
|
operands[3] = force_reg (DImode, operands[3]);
|
3639 |
|
|
})
|
3640 |
|
|
|
3641 |
|
|
(define_expand "cstore4"
|
3642 |
|
|
[(set (cc0) (compare
|
3643 |
|
|
(match_operand:BWD 2 "nonimmediate_operand")
|
3644 |
|
|
(match_operand:BWD 3 "general_operand")))
|
3645 |
|
|
(set (match_operand:SI 0 "register_operand")
|
3646 |
|
|
(match_operator:SI 1 "ordered_comparison_operator"
|
3647 |
|
|
[(cc0) (const_int 0)]))]
|
3648 |
|
|
""
|
3649 |
|
|
"")
|
3650 |
|
|
|
3651 |
|
|
;; Like bCC, we have to check the overflow bit for
|
3652 |
|
|
;; signed conditions.
|
3653 |
|
|
|
3654 |
|
|
(define_insn "s"
|
3655 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
3656 |
|
|
(ncond:SI (cc0) (const_int 0)))]
|
3657 |
|
|
""
|
3658 |
|
|
"s %0"
|
3659 |
|
|
[(set_attr "slottable" "yes")
|
3660 |
|
|
(set_attr "cc" "none")])
|
3661 |
|
|
|
3662 |
|
|
(define_insn "s"
|
3663 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
3664 |
|
|
(rcond:SI (cc0) (const_int 0)))]
|
3665 |
|
|
""
|
3666 |
|
|
{
|
3667 |
|
|
return
|
3668 |
|
|
(cc_prev_status.flags & CC_NO_OVERFLOW)
|
3669 |
|
|
? "s %0" : "s %0";
|
3670 |
|
|
}
|
3671 |
|
|
[(set_attr "slottable" "yes")
|
3672 |
|
|
(set_attr "cc" "none")])
|
3673 |
|
|
|
3674 |
|
|
(define_insn "s"
|
3675 |
|
|
[(set (match_operand:SI 0 "register_operand" "=r")
|
3676 |
|
|
(ocond:SI (cc0) (const_int 0)))]
|
3677 |
|
|
""
|
3678 |
|
|
{
|
3679 |
|
|
return
|
3680 |
|
|
(cc_prev_status.flags & CC_NO_OVERFLOW)
|
3681 |
|
|
? 0 : "s %0";
|
3682 |
|
|
}
|
3683 |
|
|
[(set_attr "slottable" "yes")
|
3684 |
|
|
(set_attr "cc" "none")])
|
3685 |
|
|
|
3686 |
|
|
;; Call insns.
|
3687 |
|
|
|
3688 |
|
|
;; We need to make these patterns "expand", since the real operand is
|
3689 |
|
|
;; hidden in a (mem:QI ) inside operand[0] (call_value: operand[1]),
|
3690 |
|
|
;; and cannot be checked if it were a "normal" pattern.
|
3691 |
|
|
;; Note that "call" and "call_value" are *always* called with a
|
3692 |
|
|
;; mem-operand for operand 0 and 1 respective. What happens for combined
|
3693 |
|
|
;; instructions is a different issue.
|
3694 |
|
|
|
3695 |
|
|
(define_expand "call"
|
3696 |
|
|
[(parallel [(call (match_operand:QI 0 "cris_mem_call_operand" "")
|
3697 |
|
|
(match_operand 1 "general_operand" ""))
|
3698 |
|
|
(clobber (reg:SI CRIS_SRP_REGNUM))])]
|
3699 |
|
|
""
|
3700 |
|
|
{
|
3701 |
|
|
gcc_assert (MEM_P (operands[0]));
|
3702 |
|
|
if (flag_pic)
|
3703 |
|
|
cris_expand_pic_call_address (&operands[0]);
|
3704 |
|
|
})
|
3705 |
|
|
|
3706 |
|
|
;; Accept *anything* as operand 1. Accept operands for operand 0 in
|
3707 |
|
|
;; order of preference.
|
3708 |
|
|
|
3709 |
|
|
(define_insn "*expanded_call_non_v32"
|
3710 |
|
|
[(call (mem:QI (match_operand:SI 0 "general_operand" "r,Q>,g"))
|
3711 |
|
|
(match_operand 1 "" ""))
|
3712 |
|
|
(clobber (reg:SI CRIS_SRP_REGNUM))]
|
3713 |
|
|
"!TARGET_V32"
|
3714 |
|
|
"jsr %0")
|
3715 |
|
|
|
3716 |
|
|
(define_insn "*expanded_call_v32"
|
3717 |
|
|
[(call
|
3718 |
|
|
(mem:QI
|
3719 |
|
|
(match_operand:SI 0 "cris_nonmemory_operand_or_callable_symbol" "n,r,U,i"))
|
3720 |
|
|
(match_operand 1 "" ""))
|
3721 |
|
|
(clobber (reg:SI CRIS_SRP_REGNUM))]
|
3722 |
|
|
"TARGET_V32"
|
3723 |
|
|
"@
|
3724 |
|
|
jsr %0%#
|
3725 |
|
|
jsr %0%#
|
3726 |
|
|
bsr %0%#
|
3727 |
|
|
bsr %0%#"
|
3728 |
|
|
[(set_attr "slottable" "has_call_slot")])
|
3729 |
|
|
|
3730 |
|
|
;; Parallel when calculating and reusing address of indirect pointer
|
3731 |
|
|
;; with simple offset. (Makes most sense with PIC.) It looks a bit
|
3732 |
|
|
;; wrong not to have the clobber last, but that's the way combine
|
3733 |
|
|
;; generates it (except it doesn' look into the *inner* mem, so this
|
3734 |
|
|
;; just matches a peephole2). FIXME: investigate that.
|
3735 |
|
|
(define_insn "*expanded_call_side"
|
3736 |
|
|
[(call (mem:QI
|
3737 |
|
|
(mem:SI
|
3738 |
|
|
(plus:SI (match_operand:SI 0 "cris_bdap_operand" "%r, r,r")
|
3739 |
|
|
(match_operand:SI 1 "cris_bdap_operand" "r>Rn,r,>Rn"))))
|
3740 |
|
|
(match_operand 2 "" ""))
|
3741 |
|
|
(clobber (reg:SI CRIS_SRP_REGNUM))
|
3742 |
|
|
(set (match_operand:SI 3 "register_operand" "=*0,r,r")
|
3743 |
|
|
(plus:SI (match_dup 0)
|
3744 |
|
|
(match_dup 1)))]
|
3745 |
|
|
"!TARGET_AVOID_GOTPLT && !TARGET_V32"
|
3746 |
|
|
"jsr [%3=%0%S1]")
|
3747 |
|
|
|
3748 |
|
|
(define_expand "call_value"
|
3749 |
|
|
[(parallel [(set (match_operand 0 "" "")
|
3750 |
|
|
(call (match_operand:QI 1 "cris_mem_call_operand" "")
|
3751 |
|
|
(match_operand 2 "" "")))
|
3752 |
|
|
(clobber (reg:SI CRIS_SRP_REGNUM))])]
|
3753 |
|
|
""
|
3754 |
|
|
{
|
3755 |
|
|
gcc_assert (MEM_P (operands[1]));
|
3756 |
|
|
if (flag_pic)
|
3757 |
|
|
cris_expand_pic_call_address (&operands[1]);
|
3758 |
|
|
})
|
3759 |
|
|
|
3760 |
|
|
;; Accept *anything* as operand 2. The validity other than "general" of
|
3761 |
|
|
;; operand 0 will be checked elsewhere. Accept operands for operand 1 in
|
3762 |
|
|
;; order of preference (Q includes r, but r is shorter, faster).
|
3763 |
|
|
;; We also accept a PLT symbol. We output it as [rPIC+sym:GOTPLT] rather
|
3764 |
|
|
;; than requiring getting rPIC + sym:PLT into a register.
|
3765 |
|
|
|
3766 |
|
|
(define_insn "*expanded_call_value_non_v32"
|
3767 |
|
|
[(set (match_operand 0 "nonimmediate_operand" "=g,g,g")
|
3768 |
|
|
(call (mem:QI (match_operand:SI 1 "general_operand" "r,Q>,g"))
|
3769 |
|
|
(match_operand 2 "" "")))
|
3770 |
|
|
(clobber (reg:SI CRIS_SRP_REGNUM))]
|
3771 |
|
|
"!TARGET_V32"
|
3772 |
|
|
"Jsr %1"
|
3773 |
|
|
[(set_attr "cc" "clobber")])
|
3774 |
|
|
|
3775 |
|
|
;; See similar call special-case.
|
3776 |
|
|
(define_insn "*expanded_call_value_side"
|
3777 |
|
|
[(set (match_operand 0 "nonimmediate_operand" "=g,g,g")
|
3778 |
|
|
(call
|
3779 |
|
|
(mem:QI
|
3780 |
|
|
(mem:SI
|
3781 |
|
|
(plus:SI (match_operand:SI 1 "cris_bdap_operand" "%r, r,r")
|
3782 |
|
|
(match_operand:SI 2 "cris_bdap_operand" "r>Rn,r,>Rn"))))
|
3783 |
|
|
(match_operand 3 "" "")))
|
3784 |
|
|
(clobber (reg:SI CRIS_SRP_REGNUM))
|
3785 |
|
|
(set (match_operand:SI 4 "register_operand" "=*1,r,r")
|
3786 |
|
|
(plus:SI (match_dup 1)
|
3787 |
|
|
(match_dup 2)))]
|
3788 |
|
|
"!TARGET_AVOID_GOTPLT && !TARGET_V32"
|
3789 |
|
|
"Jsr [%4=%1%S2]"
|
3790 |
|
|
[(set_attr "cc" "clobber")])
|
3791 |
|
|
|
3792 |
|
|
(define_insn "*expanded_call_value_v32"
|
3793 |
|
|
[(set
|
3794 |
|
|
(match_operand 0 "nonimmediate_operand" "=g,g,g,g")
|
3795 |
|
|
(call
|
3796 |
|
|
(mem:QI
|
3797 |
|
|
(match_operand:SI 1 "cris_nonmemory_operand_or_callable_symbol" "n,r,U,i"))
|
3798 |
|
|
(match_operand 2 "" "")))
|
3799 |
|
|
(clobber (reg:SI 16))]
|
3800 |
|
|
"TARGET_V32"
|
3801 |
|
|
"@
|
3802 |
|
|
Jsr %1%#
|
3803 |
|
|
Jsr %1%#
|
3804 |
|
|
Bsr %1%#
|
3805 |
|
|
Bsr %1%#"
|
3806 |
|
|
[(set_attr "cc" "clobber")
|
3807 |
|
|
(set_attr "slottable" "has_call_slot")])
|
3808 |
|
|
|
3809 |
|
|
;; Used in debugging. No use for the direct pattern; unfilled
|
3810 |
|
|
;; delayed-branches are taken care of by other means.
|
3811 |
|
|
|
3812 |
|
|
(define_insn "nop"
|
3813 |
|
|
[(const_int 0)]
|
3814 |
|
|
""
|
3815 |
|
|
"nop"
|
3816 |
|
|
[(set_attr "cc" "none")])
|
3817 |
|
|
|
3818 |
|
|
;; We need to stop accesses to the stack after the memory is
|
3819 |
|
|
;; deallocated. Unfortunately, reorg doesn't look at naked clobbers,
|
3820 |
|
|
;; e.g. (insn ... (clobber (mem:BLK (stack_pointer_rtx)))) and we don't
|
3821 |
|
|
;; want to use a naked (unspec_volatile) as that would stop any
|
3822 |
|
|
;; scheduling in the epilogue. Hence we model it as a "real" insn that
|
3823 |
|
|
;; sets the memory in an unspecified manner. FIXME: Unfortunately it
|
3824 |
|
|
;; still has the effect of an unspec_volatile.
|
3825 |
|
|
(define_insn "cris_frame_deallocated_barrier"
|
3826 |
|
|
[(set (mem:BLK (reg:SI CRIS_SP_REGNUM))
|
3827 |
|
|
(unspec:BLK [(const_int 0)] CRIS_UNSPEC_FRAME_DEALLOC))]
|
3828 |
|
|
""
|
3829 |
|
|
""
|
3830 |
|
|
[(set_attr "length" "0")])
|
3831 |
|
|
|
3832 |
|
|
;; We expand on casesi so we can use "bound" and "add offset fetched from
|
3833 |
|
|
;; a table to pc" (adds.w [pc+%0.w],pc).
|
3834 |
|
|
|
3835 |
|
|
;; Note: if you change the "parallel" (or add anything after it) in
|
3836 |
|
|
;; this expansion, you must change the macro ASM_OUTPUT_CASE_END
|
3837 |
|
|
;; accordingly, to add the default case at the end of the jump-table.
|
3838 |
|
|
|
3839 |
|
|
(define_expand "cris_casesi_non_v32"
|
3840 |
|
|
[(set (match_dup 5) (match_operand:SI 0 "general_operand" ""))
|
3841 |
|
|
(set (match_dup 6)
|
3842 |
|
|
(minus:SI (match_dup 5)
|
3843 |
|
|
(match_operand:SI 1 "const_int_operand" "n")))
|
3844 |
|
|
(set (match_dup 7)
|
3845 |
|
|
(umin:SI (match_dup 6)
|
3846 |
|
|
(match_operand:SI 2 "const_int_operand" "n")))
|
3847 |
|
|
(parallel
|
3848 |
|
|
[(set (pc)
|
3849 |
|
|
(if_then_else
|
3850 |
|
|
(ltu (match_dup 7) (match_dup 2))
|
3851 |
|
|
(plus:SI (sign_extend:SI
|
3852 |
|
|
(mem:HI
|
3853 |
|
|
(plus:SI (mult:SI (match_dup 7) (const_int 2))
|
3854 |
|
|
(pc))))
|
3855 |
|
|
(pc))
|
3856 |
|
|
(label_ref (match_operand 4 "" ""))))
|
3857 |
|
|
(use (label_ref (match_operand 3 "" "")))])]
|
3858 |
|
|
""
|
3859 |
|
|
{
|
3860 |
|
|
operands[2] = plus_constant (operands[2], 1);
|
3861 |
|
|
operands[5] = gen_reg_rtx (SImode);
|
3862 |
|
|
operands[6] = gen_reg_rtx (SImode);
|
3863 |
|
|
operands[7] = gen_reg_rtx (SImode);
|
3864 |
|
|
})
|
3865 |
|
|
|
3866 |
|
|
;; FIXME: Check effect of not JUMP_TABLES_IN_TEXT_SECTION.
|
3867 |
|
|
(define_expand "cris_casesi_v32"
|
3868 |
|
|
[(set (match_dup 5) (match_operand:SI 0 "general_operand"))
|
3869 |
|
|
(set (match_dup 6)
|
3870 |
|
|
(minus:SI (match_dup 5)
|
3871 |
|
|
(match_operand:SI 1 "const_int_operand")))
|
3872 |
|
|
(set (match_dup 7)
|
3873 |
|
|
(umin:SI (match_dup 6)
|
3874 |
|
|
(match_operand:SI 2 "const_int_operand")))
|
3875 |
|
|
(set (match_dup 8) (match_dup 11))
|
3876 |
|
|
(set (match_dup 9)
|
3877 |
|
|
(plus:SI (mult:SI (match_dup 7) (const_int 2))
|
3878 |
|
|
(match_dup 8)))
|
3879 |
|
|
(set (match_dup 10)
|
3880 |
|
|
(plus:SI (sign_extend:SI (mem:HI (match_dup 9)))
|
3881 |
|
|
(match_dup 9)))
|
3882 |
|
|
(parallel
|
3883 |
|
|
[(set (pc)
|
3884 |
|
|
(if_then_else
|
3885 |
|
|
(ltu (unspec [(const_int 0)] CRIS_UNSPEC_CASESI) (match_dup 2))
|
3886 |
|
|
(match_dup 10)
|
3887 |
|
|
(label_ref (match_operand 4 "" ""))))
|
3888 |
|
|
(use (label_ref (match_dup 3)))])]
|
3889 |
|
|
"TARGET_V32"
|
3890 |
|
|
{
|
3891 |
|
|
int i;
|
3892 |
|
|
rtx xlabel = gen_rtx_LABEL_REF (VOIDmode, operands[3]);
|
3893 |
|
|
for (i = 5; i <= 10; i++)
|
3894 |
|
|
operands[i] = gen_reg_rtx (SImode);
|
3895 |
|
|
operands[2] = plus_constant (operands[2], 1);
|
3896 |
|
|
|
3897 |
|
|
/* Don't forget to decorate labels too, for PIC. */
|
3898 |
|
|
operands[11] = flag_pic
|
3899 |
|
|
? gen_rtx_CONST (Pmode,
|
3900 |
|
|
gen_rtx_UNSPEC (Pmode, gen_rtvec (1, xlabel),
|
3901 |
|
|
CRIS_UNSPEC_PCREL))
|
3902 |
|
|
: xlabel;
|
3903 |
|
|
})
|
3904 |
|
|
|
3905 |
|
|
(define_expand "casesi"
|
3906 |
|
|
[(match_operand:SI 0 "general_operand")
|
3907 |
|
|
(match_operand:SI 1 "const_int_operand")
|
3908 |
|
|
(match_operand:SI 2 "const_int_operand")
|
3909 |
|
|
(match_operand 3 "" "")
|
3910 |
|
|
(match_operand 4 "" "")]
|
3911 |
|
|
""
|
3912 |
|
|
{
|
3913 |
|
|
if (TARGET_V32)
|
3914 |
|
|
emit_insn (gen_cris_casesi_v32 (operands[0], operands[1], operands[2],
|
3915 |
|
|
operands[3], operands[4]));
|
3916 |
|
|
else
|
3917 |
|
|
emit_insn (gen_cris_casesi_non_v32 (operands[0], operands[1], operands[2],
|
3918 |
|
|
operands[3], operands[4]));
|
3919 |
|
|
DONE;
|
3920 |
|
|
})
|
3921 |
|
|
|
3922 |
|
|
;; Split-patterns. Some of them have modes unspecified. This
|
3923 |
|
|
;; should always be ok; if for no other reason sparc.md has it as
|
3924 |
|
|
;; well.
|
3925 |
|
|
;;
|
3926 |
|
|
;; When register_operand is specified for an operand, we can get a
|
3927 |
|
|
;; subreg as well (Axis-990331), so don't just assume that REG_P is true
|
3928 |
|
|
;; for a register_operand and that REGNO can be used as is. It is best to
|
3929 |
|
|
;; guard with REG_P, unless it is worth it to adjust for the subreg case.
|
3930 |
|
|
|
3931 |
|
|
;; op [rx + 0],ry,rz
|
3932 |
|
|
;; The index to rx is optimized into zero, and gone.
|
3933 |
|
|
|
3934 |
|
|
;; First, recognize bound [rx],ry,rz; where [rx] is zero-extended,
|
3935 |
|
|
;; and add/sub [rx],ry,rz, with zero or sign-extend on [rx].
|
3936 |
|
|
;; Split this into:
|
3937 |
|
|
;; move ry,rz
|
3938 |
|
|
;; op [rx],rz
|
3939 |
|
|
;; Lose if rz=ry or rx=rz.
|
3940 |
|
|
;; Call this op-extend-split.
|
3941 |
|
|
;; Do not match for V32; the addo and addi shouldn't be split
|
3942 |
|
|
;; up.
|
3943 |
|
|
|
3944 |
|
|
(define_split
|
3945 |
|
|
[(set (match_operand 0 "register_operand" "")
|
3946 |
|
|
(match_operator
|
3947 |
|
|
4 "cris_operand_extend_operator"
|
3948 |
|
|
[(match_operand 1 "register_operand" "")
|
3949 |
|
|
(match_operator
|
3950 |
|
|
3 "cris_extend_operator"
|
3951 |
|
|
[(match_operand 2 "memory_operand" "")])]))]
|
3952 |
|
|
"!TARGET_V32
|
3953 |
|
|
&& REG_P (operands[0])
|
3954 |
|
|
&& REG_P (operands[1])
|
3955 |
|
|
&& REGNO (operands[1]) != REGNO (operands[0])
|
3956 |
|
|
&& GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
|
3957 |
|
|
&& REG_P (XEXP (operands[2], 0))
|
3958 |
|
|
&& REGNO (XEXP (operands[2], 0)) != REGNO (operands[0])"
|
3959 |
|
|
[(set (match_dup 0)
|
3960 |
|
|
(match_dup 1))
|
3961 |
|
|
(set (match_dup 0)
|
3962 |
|
|
(match_op_dup
|
3963 |
|
|
4 [(match_dup 0)
|
3964 |
|
|
(match_op_dup 3 [(match_dup 2)])]))]
|
3965 |
|
|
"")
|
3966 |
|
|
|
3967 |
|
|
;; As op-extend-split, but recognize and split op [rz],ry,rz into
|
3968 |
|
|
;; ext [rz],rz
|
3969 |
|
|
;; op ry,rz
|
3970 |
|
|
;; Do this for plus or bound only, being commutative operations, since we
|
3971 |
|
|
;; have swapped the operands.
|
3972 |
|
|
;; Call this op-extend-split-rx=rz
|
3973 |
|
|
|
3974 |
|
|
(define_split
|
3975 |
|
|
[(set (match_operand 0 "register_operand" "")
|
3976 |
|
|
(match_operator
|
3977 |
|
|
4 "cris_plus_or_bound_operator"
|
3978 |
|
|
[(match_operand 1 "register_operand" "")
|
3979 |
|
|
(match_operator
|
3980 |
|
|
3 "cris_extend_operator"
|
3981 |
|
|
[(match_operand 2 "memory_operand" "")])]))]
|
3982 |
|
|
"!TARGET_V32
|
3983 |
|
|
&& REG_P (operands[0])
|
3984 |
|
|
&& REG_P (operands[1])
|
3985 |
|
|
&& REGNO (operands[1]) != REGNO (operands[0])
|
3986 |
|
|
&& GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
|
3987 |
|
|
&& REG_P (XEXP (operands[2], 0))
|
3988 |
|
|
&& REGNO (XEXP (operands[2], 0)) == REGNO (operands[0])"
|
3989 |
|
|
[(set (match_dup 0)
|
3990 |
|
|
(match_op_dup 3 [(match_dup 2)]))
|
3991 |
|
|
(set (match_dup 0)
|
3992 |
|
|
(match_op_dup
|
3993 |
|
|
4 [(match_dup 0)
|
3994 |
|
|
(match_dup 1)]))]
|
3995 |
|
|
"")
|
3996 |
|
|
|
3997 |
|
|
;; As the op-extend-split, but swapped operands, and only for
|
3998 |
|
|
;; plus or bound, being the commutative extend-operators. FIXME: Why is
|
3999 |
|
|
;; this needed? Is it?
|
4000 |
|
|
;; Call this op-extend-split-swapped
|
4001 |
|
|
|
4002 |
|
|
(define_split
|
4003 |
|
|
[(set (match_operand 0 "register_operand" "")
|
4004 |
|
|
(match_operator
|
4005 |
|
|
4 "cris_plus_or_bound_operator"
|
4006 |
|
|
[(match_operator
|
4007 |
|
|
3 "cris_extend_operator"
|
4008 |
|
|
[(match_operand 2 "memory_operand" "")])
|
4009 |
|
|
(match_operand 1 "register_operand" "")]))]
|
4010 |
|
|
"!TARGET_V32
|
4011 |
|
|
&& REG_P (operands[0])
|
4012 |
|
|
&& REG_P (operands[1])
|
4013 |
|
|
&& REGNO (operands[1]) != REGNO (operands[0])
|
4014 |
|
|
&& GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
|
4015 |
|
|
&& REG_P (XEXP (operands[2], 0))
|
4016 |
|
|
&& REGNO (XEXP (operands[2], 0)) != REGNO (operands[0])"
|
4017 |
|
|
[(set (match_dup 0)
|
4018 |
|
|
(match_dup 1))
|
4019 |
|
|
(set (match_dup 0)
|
4020 |
|
|
(match_op_dup
|
4021 |
|
|
4 [(match_dup 0)
|
4022 |
|
|
(match_op_dup 3 [(match_dup 2)])]))]
|
4023 |
|
|
"")
|
4024 |
|
|
|
4025 |
|
|
;; As op-extend-split-rx=rz, but swapped operands, only for plus or
|
4026 |
|
|
;; bound. Call this op-extend-split-swapped-rx=rz.
|
4027 |
|
|
|
4028 |
|
|
(define_split
|
4029 |
|
|
[(set (match_operand 0 "register_operand" "")
|
4030 |
|
|
(match_operator
|
4031 |
|
|
4 "cris_plus_or_bound_operator"
|
4032 |
|
|
[(match_operator
|
4033 |
|
|
3 "cris_extend_operator"
|
4034 |
|
|
[(match_operand 2 "memory_operand" "")])
|
4035 |
|
|
(match_operand 1 "register_operand" "")]))]
|
4036 |
|
|
"!TARGET_V32
|
4037 |
|
|
&& REG_P (operands[0])
|
4038 |
|
|
&& REG_P (operands[1])
|
4039 |
|
|
&& REGNO (operands[1]) != REGNO (operands[0])
|
4040 |
|
|
&& GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
|
4041 |
|
|
&& REG_P (XEXP (operands[2], 0))
|
4042 |
|
|
&& REGNO (XEXP (operands[2], 0)) == REGNO (operands[0])"
|
4043 |
|
|
[(set (match_dup 0)
|
4044 |
|
|
(match_op_dup 3 [(match_dup 2)]))
|
4045 |
|
|
(set (match_dup 0)
|
4046 |
|
|
(match_op_dup
|
4047 |
|
|
4 [(match_dup 0)
|
4048 |
|
|
(match_dup 1)]))]
|
4049 |
|
|
"")
|
4050 |
|
|
|
4051 |
|
|
;; As op-extend-split, but the mem operand is not extended.
|
4052 |
|
|
;;
|
4053 |
|
|
;; op [rx],ry,rz changed into
|
4054 |
|
|
;; move ry,rz
|
4055 |
|
|
;; op [rx],rz
|
4056 |
|
|
;; lose if ry=rz or rx=rz
|
4057 |
|
|
;; Call this op-extend.
|
4058 |
|
|
|
4059 |
|
|
(define_split
|
4060 |
|
|
[(set (match_operand 0 "register_operand" "")
|
4061 |
|
|
(match_operator
|
4062 |
|
|
3 "cris_orthogonal_operator"
|
4063 |
|
|
[(match_operand 1 "register_operand" "")
|
4064 |
|
|
(match_operand 2 "memory_operand" "")]))]
|
4065 |
|
|
"!TARGET_V32
|
4066 |
|
|
&& REG_P (operands[0])
|
4067 |
|
|
&& REG_P (operands[1])
|
4068 |
|
|
&& REGNO (operands[1]) != REGNO (operands[0])
|
4069 |
|
|
&& GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
|
4070 |
|
|
&& REG_P (XEXP (operands[2], 0))
|
4071 |
|
|
&& REGNO (XEXP (operands[2], 0)) != REGNO (operands[0])"
|
4072 |
|
|
[(set (match_dup 0)
|
4073 |
|
|
(match_dup 1))
|
4074 |
|
|
(set (match_dup 0)
|
4075 |
|
|
(match_op_dup
|
4076 |
|
|
3 [(match_dup 0)
|
4077 |
|
|
(match_dup 2)]))]
|
4078 |
|
|
"")
|
4079 |
|
|
|
4080 |
|
|
;; As op-extend-split-rx=rz, non-extended.
|
4081 |
|
|
;; Call this op-split-rx=rz
|
4082 |
|
|
|
4083 |
|
|
(define_split
|
4084 |
|
|
[(set (match_operand 0 "register_operand" "")
|
4085 |
|
|
(match_operator
|
4086 |
|
|
3 "cris_commutative_orth_op"
|
4087 |
|
|
[(match_operand 2 "memory_operand" "")
|
4088 |
|
|
(match_operand 1 "register_operand" "")]))]
|
4089 |
|
|
"!TARGET_V32
|
4090 |
|
|
&& REG_P (operands[0])
|
4091 |
|
|
&& REG_P (operands[1])
|
4092 |
|
|
&& REGNO (operands[1]) != REGNO (operands[0])
|
4093 |
|
|
&& GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
|
4094 |
|
|
&& REG_P (XEXP (operands[2], 0))
|
4095 |
|
|
&& REGNO (XEXP (operands[2], 0)) != REGNO (operands[0])"
|
4096 |
|
|
[(set (match_dup 0)
|
4097 |
|
|
(match_dup 1))
|
4098 |
|
|
(set (match_dup 0)
|
4099 |
|
|
(match_op_dup
|
4100 |
|
|
3 [(match_dup 0)
|
4101 |
|
|
(match_dup 2)]))]
|
4102 |
|
|
"")
|
4103 |
|
|
|
4104 |
|
|
;; As op-extend-split-swapped, nonextended.
|
4105 |
|
|
;; Call this op-split-swapped.
|
4106 |
|
|
|
4107 |
|
|
(define_split
|
4108 |
|
|
[(set (match_operand 0 "register_operand" "")
|
4109 |
|
|
(match_operator
|
4110 |
|
|
3 "cris_commutative_orth_op"
|
4111 |
|
|
[(match_operand 1 "register_operand" "")
|
4112 |
|
|
(match_operand 2 "memory_operand" "")]))]
|
4113 |
|
|
"!TARGET_V32
|
4114 |
|
|
&& REG_P (operands[0]) && REG_P (operands[1])
|
4115 |
|
|
&& REGNO (operands[1]) != REGNO (operands[0])
|
4116 |
|
|
&& GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
|
4117 |
|
|
&& REG_P (XEXP (operands[2], 0))
|
4118 |
|
|
&& REGNO (XEXP (operands[2], 0)) == REGNO (operands[0])"
|
4119 |
|
|
[(set (match_dup 0)
|
4120 |
|
|
(match_dup 2))
|
4121 |
|
|
(set (match_dup 0)
|
4122 |
|
|
(match_op_dup
|
4123 |
|
|
3 [(match_dup 0)
|
4124 |
|
|
(match_dup 1)]))]
|
4125 |
|
|
"")
|
4126 |
|
|
|
4127 |
|
|
;; As op-extend-split-swapped-rx=rz, non-extended.
|
4128 |
|
|
;; Call this op-split-swapped-rx=rz.
|
4129 |
|
|
|
4130 |
|
|
(define_split
|
4131 |
|
|
[(set (match_operand 0 "register_operand" "")
|
4132 |
|
|
(match_operator
|
4133 |
|
|
3 "cris_orthogonal_operator"
|
4134 |
|
|
[(match_operand 2 "memory_operand" "")
|
4135 |
|
|
(match_operand 1 "register_operand" "")]))]
|
4136 |
|
|
"!TARGET_V32
|
4137 |
|
|
&& REG_P (operands[0]) && REG_P (operands[1])
|
4138 |
|
|
&& REGNO (operands[1]) != REGNO (operands[0])
|
4139 |
|
|
&& GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
|
4140 |
|
|
&& REG_P (XEXP (operands[2], 0))
|
4141 |
|
|
&& REGNO (XEXP (operands[2], 0)) == REGNO (operands[0])"
|
4142 |
|
|
[(set (match_dup 0)
|
4143 |
|
|
(match_dup 2))
|
4144 |
|
|
(set (match_dup 0)
|
4145 |
|
|
(match_op_dup
|
4146 |
|
|
3 [(match_dup 0)
|
4147 |
|
|
(match_dup 1)]))]
|
4148 |
|
|
"")
|
4149 |
|
|
|
4150 |
|
|
;; Splits for all cases in side-effect insns where (possibly after reload
|
4151 |
|
|
;; and register allocation) rx and ry in [rx=ry+i] are equal.
|
4152 |
|
|
|
4153 |
|
|
;; move.S1 [rx=rx+rz.S2],ry
|
4154 |
|
|
|
4155 |
|
|
(define_split
|
4156 |
|
|
[(parallel
|
4157 |
|
|
[(set (match_operand 0 "register_operand" "")
|
4158 |
|
|
(match_operator
|
4159 |
|
|
6 "cris_mem_op"
|
4160 |
|
|
[(plus:SI
|
4161 |
|
|
(mult:SI (match_operand:SI 1 "register_operand" "")
|
4162 |
|
|
(match_operand:SI 2 "const_int_operand" ""))
|
4163 |
|
|
(match_operand:SI 3 "register_operand" ""))]))
|
4164 |
|
|
(set (match_operand:SI 4 "register_operand" "")
|
4165 |
|
|
(plus:SI (mult:SI (match_dup 1)
|
4166 |
|
|
(match_dup 2))
|
4167 |
|
|
(match_dup 3)))])]
|
4168 |
|
|
"REG_P (operands[3]) && REG_P (operands[4])
|
4169 |
|
|
&& REGNO (operands[3]) == REGNO (operands[4])"
|
4170 |
|
|
[(set (match_dup 4) (plus:SI (mult:SI (match_dup 1) (match_dup 2))
|
4171 |
|
|
(match_dup 3)))
|
4172 |
|
|
(set (match_dup 0) (match_dup 5))]
|
4173 |
|
|
"operands[5] = replace_equiv_address (operands[6], operands[3]);")
|
4174 |
|
|
|
4175 |
|
|
;; move.S1 [rx=rx+i],ry
|
4176 |
|
|
|
4177 |
|
|
(define_split
|
4178 |
|
|
[(parallel
|
4179 |
|
|
[(set (match_operand 0 "register_operand" "")
|
4180 |
|
|
(match_operator
|
4181 |
|
|
5 "cris_mem_op"
|
4182 |
|
|
[(plus:SI (match_operand:SI 1 "cris_bdap_operand" "")
|
4183 |
|
|
(match_operand:SI 2 "cris_bdap_operand" ""))]))
|
4184 |
|
|
(set (match_operand:SI 3 "register_operand" "")
|
4185 |
|
|
(plus:SI (match_dup 1)
|
4186 |
|
|
(match_dup 2)))])]
|
4187 |
|
|
"(rtx_equal_p (operands[3], operands[1])
|
4188 |
|
|
|| rtx_equal_p (operands[3], operands[2]))"
|
4189 |
|
|
[(set (match_dup 3) (plus:SI (match_dup 1) (match_dup 2)))
|
4190 |
|
|
(set (match_dup 0) (match_dup 4))]
|
4191 |
|
|
{
|
4192 |
|
|
operands[4] = replace_equiv_address (operands[5], operands[3]);
|
4193 |
|
|
cris_order_for_addsi3 (operands, 1);
|
4194 |
|
|
})
|
4195 |
|
|
|
4196 |
|
|
;; move.S1 ry,[rx=rx+rz.S2]
|
4197 |
|
|
|
4198 |
|
|
(define_split
|
4199 |
|
|
[(parallel
|
4200 |
|
|
[(set (match_operator
|
4201 |
|
|
6 "cris_mem_op"
|
4202 |
|
|
[(plus:SI
|
4203 |
|
|
(mult:SI (match_operand:SI 0 "register_operand" "")
|
4204 |
|
|
(match_operand:SI 1 "const_int_operand" ""))
|
4205 |
|
|
(match_operand:SI 2 "register_operand" ""))])
|
4206 |
|
|
(match_operand 3 "register_operand" ""))
|
4207 |
|
|
(set (match_operand:SI 4 "register_operand" "")
|
4208 |
|
|
(plus:SI (mult:SI (match_dup 0)
|
4209 |
|
|
(match_dup 1))
|
4210 |
|
|
(match_dup 2)))])]
|
4211 |
|
|
"REG_P (operands[2]) && REG_P (operands[4])
|
4212 |
|
|
&& REGNO (operands[4]) == REGNO (operands[2])"
|
4213 |
|
|
[(set (match_dup 4) (plus:SI (mult:SI (match_dup 0) (match_dup 1))
|
4214 |
|
|
(match_dup 2)))
|
4215 |
|
|
(set (match_dup 5) (match_dup 3))]
|
4216 |
|
|
"operands[5] = replace_equiv_address (operands[6], operands[4]);")
|
4217 |
|
|
|
4218 |
|
|
;; move.S1 ry,[rx=rx+i]
|
4219 |
|
|
|
4220 |
|
|
(define_split
|
4221 |
|
|
[(parallel
|
4222 |
|
|
[(set (match_operator
|
4223 |
|
|
6 "cris_mem_op"
|
4224 |
|
|
[(plus:SI (match_operand:SI 0 "cris_bdap_operand" "")
|
4225 |
|
|
(match_operand:SI 1 "cris_bdap_operand" ""))])
|
4226 |
|
|
(match_operand 2 "register_operand" ""))
|
4227 |
|
|
(set (match_operand:SI 3 "register_operand" "")
|
4228 |
|
|
(plus:SI (match_dup 0)
|
4229 |
|
|
(match_dup 1)))])]
|
4230 |
|
|
"(rtx_equal_p (operands[3], operands[0])
|
4231 |
|
|
|| rtx_equal_p (operands[3], operands[1]))"
|
4232 |
|
|
[(set (match_dup 3) (plus:SI (match_dup 0) (match_dup 1)))
|
4233 |
|
|
(set (match_dup 5) (match_dup 2))]
|
4234 |
|
|
{
|
4235 |
|
|
operands[5] = replace_equiv_address (operands[6], operands[3]);
|
4236 |
|
|
cris_order_for_addsi3 (operands, 0);
|
4237 |
|
|
})
|
4238 |
|
|
|
4239 |
|
|
;; clear.[bwd] [rx=rx+rz.S2]
|
4240 |
|
|
|
4241 |
|
|
(define_split
|
4242 |
|
|
[(parallel
|
4243 |
|
|
[(set (mem:BWD (plus:SI
|
4244 |
|
|
(mult:SI (match_operand:SI 0 "register_operand" "")
|
4245 |
|
|
(match_operand:SI 1 "const_int_operand" ""))
|
4246 |
|
|
(match_operand:SI 2 "register_operand" "")))
|
4247 |
|
|
(const_int 0))
|
4248 |
|
|
(set (match_operand:SI 3 "register_operand" "")
|
4249 |
|
|
(plus:SI (mult:SI (match_dup 0)
|
4250 |
|
|
(match_dup 1))
|
4251 |
|
|
(match_dup 2)))])]
|
4252 |
|
|
"REG_P (operands[2]) && REG_P (operands[3])
|
4253 |
|
|
&& REGNO (operands[3]) == REGNO (operands[2])"
|
4254 |
|
|
[(set (match_dup 3) (plus:SI (mult:SI (match_dup 0) (match_dup 1))
|
4255 |
|
|
(match_dup 2)))
|
4256 |
|
|
(set (mem:BWD (match_dup 3)) (const_int 0))]
|
4257 |
|
|
"")
|
4258 |
|
|
|
4259 |
|
|
;; clear.[bwd] [rx=rx+i]
|
4260 |
|
|
|
4261 |
|
|
(define_split
|
4262 |
|
|
[(parallel
|
4263 |
|
|
[(set (mem:BWD
|
4264 |
|
|
(plus:SI (match_operand:SI 0 "cris_bdap_operand" "")
|
4265 |
|
|
(match_operand:SI 1 "cris_bdap_operand" "")))
|
4266 |
|
|
(const_int 0))
|
4267 |
|
|
(set (match_operand:SI 2 "register_operand" "")
|
4268 |
|
|
(plus:SI (match_dup 0)
|
4269 |
|
|
(match_dup 1)))])]
|
4270 |
|
|
"(rtx_equal_p (operands[0], operands[2])
|
4271 |
|
|
|| rtx_equal_p (operands[2], operands[1]))"
|
4272 |
|
|
[(set (match_dup 2) (plus:SI (match_dup 0) (match_dup 1)))
|
4273 |
|
|
(set (mem:BWD (match_dup 2)) (const_int 0))]
|
4274 |
|
|
"cris_order_for_addsi3 (operands, 0);")
|
4275 |
|
|
|
4276 |
|
|
;; mov(s|u).S1 [rx=rx+rz.S2],ry
|
4277 |
|
|
|
4278 |
|
|
(define_split
|
4279 |
|
|
[(parallel
|
4280 |
|
|
[(set (match_operand 0 "register_operand" "")
|
4281 |
|
|
(match_operator
|
4282 |
|
|
5 "cris_extend_operator"
|
4283 |
|
|
[(mem (plus:SI
|
4284 |
|
|
(mult:SI (match_operand:SI 1 "register_operand" "")
|
4285 |
|
|
(match_operand:SI 2 "const_int_operand" ""))
|
4286 |
|
|
(match_operand:SI 3 "register_operand" "")))]))
|
4287 |
|
|
(set (match_operand:SI 4 "register_operand" "")
|
4288 |
|
|
(plus:SI (mult:SI (match_dup 1)
|
4289 |
|
|
(match_dup 2))
|
4290 |
|
|
(match_dup 3)))])]
|
4291 |
|
|
"REG_P (operands[3])
|
4292 |
|
|
&& REG_P (operands[4])
|
4293 |
|
|
&& REGNO (operands[3]) == REGNO (operands[4])"
|
4294 |
|
|
[(set (match_dup 4) (plus:SI (mult:SI (match_dup 1) (match_dup 2))
|
4295 |
|
|
(match_dup 3)))
|
4296 |
|
|
(set (match_dup 0) (match_op_dup 5 [(match_dup 6)]))]
|
4297 |
|
|
"operands[6] = replace_equiv_address (XEXP (operands[5], 0), operands[4]);")
|
4298 |
|
|
|
4299 |
|
|
;; mov(s|u).S1 [rx=rx+i],ry
|
4300 |
|
|
|
4301 |
|
|
(define_split
|
4302 |
|
|
[(parallel
|
4303 |
|
|
[(set (match_operand 0 "register_operand" "")
|
4304 |
|
|
(match_operator
|
4305 |
|
|
4 "cris_extend_operator"
|
4306 |
|
|
[(mem (plus:SI
|
4307 |
|
|
(match_operand:SI 1 "cris_bdap_operand" "")
|
4308 |
|
|
(match_operand:SI 2 "cris_bdap_operand" "")))]))
|
4309 |
|
|
(set (match_operand:SI 3 "register_operand" "")
|
4310 |
|
|
(plus:SI (match_dup 1)
|
4311 |
|
|
(match_dup 2)))])]
|
4312 |
|
|
"(rtx_equal_p (operands[1], operands[3])
|
4313 |
|
|
|| rtx_equal_p (operands[2], operands[3]))"
|
4314 |
|
|
[(set (match_dup 3) (plus:SI (match_dup 1) (match_dup 2)))
|
4315 |
|
|
(set (match_dup 0) (match_op_dup 4 [(match_dup 5)]))]
|
4316 |
|
|
{
|
4317 |
|
|
operands[5] = replace_equiv_address (XEXP (operands[4], 0), operands[3]);
|
4318 |
|
|
cris_order_for_addsi3 (operands, 1);
|
4319 |
|
|
})
|
4320 |
|
|
|
4321 |
|
|
;; op.S1 [rx=rx+i],ry
|
4322 |
|
|
|
4323 |
|
|
(define_split
|
4324 |
|
|
[(parallel
|
4325 |
|
|
[(set (match_operand 0 "register_operand" "")
|
4326 |
|
|
(match_operator
|
4327 |
|
|
5 "cris_orthogonal_operator"
|
4328 |
|
|
[(match_operand 1 "register_operand" "")
|
4329 |
|
|
(mem (plus:SI
|
4330 |
|
|
(match_operand:SI 2 "cris_bdap_operand" "")
|
4331 |
|
|
(match_operand:SI 3 "cris_bdap_operand" "")))]))
|
4332 |
|
|
(set (match_operand:SI 4 "register_operand" "")
|
4333 |
|
|
(plus:SI (match_dup 2)
|
4334 |
|
|
(match_dup 3)))])]
|
4335 |
|
|
"(rtx_equal_p (operands[4], operands[2])
|
4336 |
|
|
|| rtx_equal_p (operands[4], operands[3]))"
|
4337 |
|
|
[(set (match_dup 4) (plus:SI (match_dup 2) (match_dup 3)))
|
4338 |
|
|
(set (match_dup 0) (match_op_dup 5 [(match_dup 1) (match_dup 6)]))]
|
4339 |
|
|
{
|
4340 |
|
|
operands[6] = replace_equiv_address (XEXP (operands[5], 1), operands[4]);
|
4341 |
|
|
cris_order_for_addsi3 (operands, 2);
|
4342 |
|
|
})
|
4343 |
|
|
|
4344 |
|
|
;; op.S1 [rx=rx+rz.S2],ry
|
4345 |
|
|
|
4346 |
|
|
(define_split
|
4347 |
|
|
[(parallel
|
4348 |
|
|
[(set (match_operand 0 "register_operand" "")
|
4349 |
|
|
(match_operator
|
4350 |
|
|
6 "cris_orthogonal_operator"
|
4351 |
|
|
[(match_operand 1 "register_operand" "")
|
4352 |
|
|
(mem (plus:SI
|
4353 |
|
|
(mult:SI (match_operand:SI 2 "register_operand" "")
|
4354 |
|
|
(match_operand:SI 3 "const_int_operand" ""))
|
4355 |
|
|
(match_operand:SI 4 "register_operand" "")))]))
|
4356 |
|
|
(set (match_operand:SI 5 "register_operand" "")
|
4357 |
|
|
(plus:SI (mult:SI (match_dup 2)
|
4358 |
|
|
(match_dup 3))
|
4359 |
|
|
(match_dup 4)))])]
|
4360 |
|
|
"REG_P (operands[4])
|
4361 |
|
|
&& REG_P (operands[5])
|
4362 |
|
|
&& REGNO (operands[5]) == REGNO (operands[4])"
|
4363 |
|
|
[(set (match_dup 5) (plus:SI (mult:SI (match_dup 2) (match_dup 3))
|
4364 |
|
|
(match_dup 4)))
|
4365 |
|
|
(set (match_dup 0) (match_op_dup 6 [(match_dup 1) (match_dup 7)]))]
|
4366 |
|
|
"operands[7] = replace_equiv_address (XEXP (operands[6], 1), operands[5]);")
|
4367 |
|
|
|
4368 |
|
|
;; op.S1 [rx=rx+rz.S2],ry (swapped)
|
4369 |
|
|
|
4370 |
|
|
(define_split
|
4371 |
|
|
[(parallel
|
4372 |
|
|
[(set (match_operand 0 "register_operand" "")
|
4373 |
|
|
(match_operator
|
4374 |
|
|
6 "cris_commutative_orth_op"
|
4375 |
|
|
[(mem (plus:SI
|
4376 |
|
|
(mult:SI (match_operand:SI 2 "register_operand" "")
|
4377 |
|
|
(match_operand:SI 3 "const_int_operand" ""))
|
4378 |
|
|
(match_operand:SI 4 "register_operand" "")))
|
4379 |
|
|
(match_operand 1 "register_operand" "")]))
|
4380 |
|
|
(set (match_operand:SI 5 "register_operand" "")
|
4381 |
|
|
(plus:SI (mult:SI (match_dup 2)
|
4382 |
|
|
(match_dup 3))
|
4383 |
|
|
(match_dup 4)))])]
|
4384 |
|
|
"REG_P (operands[4])
|
4385 |
|
|
&& REG_P (operands[5])
|
4386 |
|
|
&& REGNO (operands[5]) == REGNO (operands[4])"
|
4387 |
|
|
[(set (match_dup 5) (plus:SI (mult:SI (match_dup 2) (match_dup 3))
|
4388 |
|
|
(match_dup 4)))
|
4389 |
|
|
(set (match_dup 0) (match_op_dup 6 [(match_dup 7) (match_dup 1)]))]
|
4390 |
|
|
"operands[7] = replace_equiv_address (XEXP (operands[6], 0), operands[5]);")
|
4391 |
|
|
|
4392 |
|
|
;; op.S1 [rx=rx+i],ry (swapped)
|
4393 |
|
|
|
4394 |
|
|
(define_split
|
4395 |
|
|
[(parallel
|
4396 |
|
|
[(set (match_operand 0 "register_operand" "")
|
4397 |
|
|
(match_operator
|
4398 |
|
|
5 "cris_commutative_orth_op"
|
4399 |
|
|
[(mem
|
4400 |
|
|
(plus:SI (match_operand:SI 2 "cris_bdap_operand" "")
|
4401 |
|
|
(match_operand:SI 3 "cris_bdap_operand" "")))
|
4402 |
|
|
(match_operand 1 "register_operand" "")]))
|
4403 |
|
|
(set (match_operand:SI 4 "register_operand" "")
|
4404 |
|
|
(plus:SI (match_dup 2)
|
4405 |
|
|
(match_dup 3)))])]
|
4406 |
|
|
"(rtx_equal_p (operands[4], operands[2])
|
4407 |
|
|
|| rtx_equal_p (operands[4], operands[3]))"
|
4408 |
|
|
[(set (match_dup 4) (plus:SI (match_dup 2) (match_dup 3)))
|
4409 |
|
|
(set (match_dup 0) (match_op_dup 5 [(match_dup 6) (match_dup 1)]))]
|
4410 |
|
|
{
|
4411 |
|
|
operands[6] = replace_equiv_address (XEXP (operands[5], 0), operands[4]);
|
4412 |
|
|
cris_order_for_addsi3 (operands, 2);
|
4413 |
|
|
})
|
4414 |
|
|
|
4415 |
|
|
;; op(s|u).S1 [rx=rx+rz.S2],ry
|
4416 |
|
|
|
4417 |
|
|
(define_split
|
4418 |
|
|
[(parallel
|
4419 |
|
|
[(set (match_operand 0 "register_operand" "")
|
4420 |
|
|
(match_operator
|
4421 |
|
|
6 "cris_operand_extend_operator"
|
4422 |
|
|
[(match_operand 1 "register_operand" "")
|
4423 |
|
|
(match_operator
|
4424 |
|
|
7 "cris_extend_operator"
|
4425 |
|
|
[(mem (plus:SI
|
4426 |
|
|
(mult:SI (match_operand:SI 2 "register_operand" "")
|
4427 |
|
|
(match_operand:SI 3 "const_int_operand" ""))
|
4428 |
|
|
(match_operand:SI 4 "register_operand" "")))])]))
|
4429 |
|
|
(set (match_operand:SI 5 "register_operand" "")
|
4430 |
|
|
(plus:SI (mult:SI (match_dup 2)
|
4431 |
|
|
(match_dup 3))
|
4432 |
|
|
(match_dup 4)))])]
|
4433 |
|
|
"REG_P (operands[4])
|
4434 |
|
|
&& REG_P (operands[5])
|
4435 |
|
|
&& REGNO (operands[5]) == REGNO (operands[4])"
|
4436 |
|
|
[(set (match_dup 5) (plus:SI (mult:SI (match_dup 2) (match_dup 3))
|
4437 |
|
|
(match_dup 4)))
|
4438 |
|
|
(set (match_dup 0) (match_op_dup 6 [(match_dup 1) (match_dup 8)]))]
|
4439 |
|
|
"operands[8] = gen_rtx_fmt_e (GET_CODE (operands[7]), GET_MODE (operands[7]),
|
4440 |
|
|
replace_equiv_address (XEXP (operands[7], 0),
|
4441 |
|
|
operands[5]));")
|
4442 |
|
|
|
4443 |
|
|
;; op(s|u).S1 [rx=rx+i],ry
|
4444 |
|
|
|
4445 |
|
|
(define_split
|
4446 |
|
|
[(parallel
|
4447 |
|
|
[(set (match_operand 0 "register_operand" "")
|
4448 |
|
|
(match_operator
|
4449 |
|
|
5 "cris_operand_extend_operator"
|
4450 |
|
|
[(match_operand 1 "register_operand" "")
|
4451 |
|
|
(match_operator
|
4452 |
|
|
6 "cris_extend_operator"
|
4453 |
|
|
[(mem
|
4454 |
|
|
(plus:SI (match_operand:SI 2 "cris_bdap_operand" "")
|
4455 |
|
|
(match_operand:SI 3 "cris_bdap_operand" "")
|
4456 |
|
|
))])]))
|
4457 |
|
|
(set (match_operand:SI 4 "register_operand" "")
|
4458 |
|
|
(plus:SI (match_dup 2)
|
4459 |
|
|
(match_dup 3)))])]
|
4460 |
|
|
"(rtx_equal_p (operands[4], operands[2])
|
4461 |
|
|
|| rtx_equal_p (operands[4], operands[3]))"
|
4462 |
|
|
[(set (match_dup 4) (plus:SI (match_dup 2) (match_dup 3)))
|
4463 |
|
|
(set (match_dup 0) (match_op_dup 5 [(match_dup 1) (match_dup 7)]))]
|
4464 |
|
|
{
|
4465 |
|
|
operands[7] = gen_rtx_fmt_e (GET_CODE (operands[6]), GET_MODE (operands[6]),
|
4466 |
|
|
replace_equiv_address (XEXP (operands[6], 0),
|
4467 |
|
|
operands[4]));
|
4468 |
|
|
cris_order_for_addsi3 (operands, 2);
|
4469 |
|
|
})
|
4470 |
|
|
|
4471 |
|
|
;; op(s|u).S1 [rx=rx+rz.S2],ry (swapped, plus or bound)
|
4472 |
|
|
|
4473 |
|
|
(define_split
|
4474 |
|
|
[(parallel
|
4475 |
|
|
[(set (match_operand 0 "register_operand" "")
|
4476 |
|
|
(match_operator
|
4477 |
|
|
7 "cris_plus_or_bound_operator"
|
4478 |
|
|
[(match_operator
|
4479 |
|
|
6 "cris_extend_operator"
|
4480 |
|
|
[(mem (plus:SI
|
4481 |
|
|
(mult:SI (match_operand:SI 2 "register_operand" "")
|
4482 |
|
|
(match_operand:SI 3 "const_int_operand" ""))
|
4483 |
|
|
(match_operand:SI 4 "register_operand" "")))])
|
4484 |
|
|
(match_operand 1 "register_operand" "")]))
|
4485 |
|
|
(set (match_operand:SI 5 "register_operand" "")
|
4486 |
|
|
(plus:SI (mult:SI (match_dup 2)
|
4487 |
|
|
(match_dup 3))
|
4488 |
|
|
(match_dup 4)))])]
|
4489 |
|
|
"REG_P (operands[4]) && REG_P (operands[5])
|
4490 |
|
|
&& REGNO (operands[5]) == REGNO (operands[4])"
|
4491 |
|
|
[(set (match_dup 5) (plus:SI (mult:SI (match_dup 2) (match_dup 3))
|
4492 |
|
|
(match_dup 4)))
|
4493 |
|
|
(set (match_dup 0) (match_op_dup 6 [(match_dup 8) (match_dup 1)]))]
|
4494 |
|
|
"operands[8] = gen_rtx_fmt_e (GET_CODE (operands[6]), GET_MODE (operands[6]),
|
4495 |
|
|
replace_equiv_address (XEXP (operands[6], 0),
|
4496 |
|
|
operands[5]));")
|
4497 |
|
|
|
4498 |
|
|
;; op(s|u).S1 [rx=rx+i],ry (swapped, plus or bound)
|
4499 |
|
|
|
4500 |
|
|
(define_split
|
4501 |
|
|
[(parallel
|
4502 |
|
|
[(set (match_operand 0 "register_operand" "")
|
4503 |
|
|
(match_operator
|
4504 |
|
|
6 "cris_plus_or_bound_operator"
|
4505 |
|
|
[(match_operator
|
4506 |
|
|
5 "cris_extend_operator"
|
4507 |
|
|
[(mem (plus:SI
|
4508 |
|
|
(match_operand:SI 2 "cris_bdap_operand" "")
|
4509 |
|
|
(match_operand:SI 3 "cris_bdap_operand" "")))])
|
4510 |
|
|
(match_operand 1 "register_operand" "")]))
|
4511 |
|
|
(set (match_operand:SI 4 "register_operand" "")
|
4512 |
|
|
(plus:SI (match_dup 2)
|
4513 |
|
|
(match_dup 3)))])]
|
4514 |
|
|
"(rtx_equal_p (operands[4], operands[2])
|
4515 |
|
|
|| rtx_equal_p (operands[4], operands[3]))"
|
4516 |
|
|
[(set (match_dup 4) (plus:SI (match_dup 2) (match_dup 3)))
|
4517 |
|
|
(set (match_dup 0) (match_op_dup 6 [(match_dup 7) (match_dup 1)]))]
|
4518 |
|
|
{
|
4519 |
|
|
operands[7] = gen_rtx_fmt_e (GET_CODE (operands[5]), GET_MODE (operands[5]),
|
4520 |
|
|
replace_equiv_address (XEXP (operands[5], 0),
|
4521 |
|
|
operands[4]));
|
4522 |
|
|
cris_order_for_addsi3 (operands, 2);
|
4523 |
|
|
})
|
4524 |
|
|
|
4525 |
|
|
;; Splits for addressing prefixes that have no side-effects, so we can
|
4526 |
|
|
;; fill a delay slot. Never split if we lose something, though.
|
4527 |
|
|
|
4528 |
|
|
;; If we have a
|
4529 |
|
|
;; move [indirect_ref],rx
|
4530 |
|
|
;; where indirect ref = {const, [r+], [r]}, it costs as much as
|
4531 |
|
|
;; move indirect_ref,rx
|
4532 |
|
|
;; move [rx],rx
|
4533 |
|
|
;; Take care not to allow indirect_ref = register.
|
4534 |
|
|
|
4535 |
|
|
;; We're not allowed to generate copies of registers with different mode
|
4536 |
|
|
;; until after reload; copying pseudos upsets reload. CVS as of
|
4537 |
|
|
;; 2001-08-24, unwind-dw2-fde.c, _Unwind_Find_FDE ICE in
|
4538 |
|
|
;; cselib_invalidate_regno.
|
4539 |
|
|
|
4540 |
|
|
(define_split ; indir_to_reg_split
|
4541 |
|
|
[(set (match_operand 0 "register_operand" "")
|
4542 |
|
|
(match_operand 1 "indirect_operand" ""))]
|
4543 |
|
|
"reload_completed
|
4544 |
|
|
&& REG_P (operands[0])
|
4545 |
|
|
&& GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
|
4546 |
|
|
&& (MEM_P (XEXP (operands[1], 0)) || CONSTANT_P (XEXP (operands[1], 0)))
|
4547 |
|
|
&& REGNO (operands[0]) < CRIS_LAST_GENERAL_REGISTER"
|
4548 |
|
|
[(set (match_dup 2) (match_dup 4))
|
4549 |
|
|
(set (match_dup 0) (match_dup 3))]
|
4550 |
|
|
"operands[2] = gen_rtx_REG (Pmode, REGNO (operands[0]));
|
4551 |
|
|
operands[3] = replace_equiv_address (operands[1], operands[2]);
|
4552 |
|
|
operands[4] = XEXP (operands[1], 0);")
|
4553 |
|
|
|
4554 |
|
|
;; As the above, but MOVS and MOVU.
|
4555 |
|
|
|
4556 |
|
|
(define_split
|
4557 |
|
|
[(set (match_operand 0 "register_operand" "")
|
4558 |
|
|
(match_operator
|
4559 |
|
|
4 "cris_extend_operator"
|
4560 |
|
|
[(match_operand 1 "indirect_operand" "")]))]
|
4561 |
|
|
"reload_completed
|
4562 |
|
|
&& REG_P (operands[0])
|
4563 |
|
|
&& GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD
|
4564 |
|
|
&& (MEM_P (XEXP (operands[1], 0))
|
4565 |
|
|
|| CONSTANT_P (XEXP (operands[1], 0)))"
|
4566 |
|
|
[(set (match_dup 2) (match_dup 5))
|
4567 |
|
|
(set (match_dup 0) (match_op_dup 4 [(match_dup 3)]))]
|
4568 |
|
|
"operands[2] = gen_rtx_REG (Pmode, REGNO (operands[0]));
|
4569 |
|
|
operands[3] = replace_equiv_address (XEXP (operands[4], 0), operands[2]);
|
4570 |
|
|
operands[5] = XEXP (operands[1], 0);")
|
4571 |
|
|
|
4572 |
|
|
;; Various peephole optimizations.
|
4573 |
|
|
;;
|
4574 |
|
|
;; Watch out: when you exchange one set of instructions for another, the
|
4575 |
|
|
;; condition codes setting must be the same, or you have to CC_INIT or
|
4576 |
|
|
;; whatever is appropriate, in the pattern before you emit the
|
4577 |
|
|
;; assembly text. This is best done here, not in cris_notice_update_cc,
|
4578 |
|
|
;; to keep changes local to their cause.
|
4579 |
|
|
;;
|
4580 |
|
|
;; Do not add patterns that you do not know will be matched.
|
4581 |
|
|
;; Please also add a self-contained testcase.
|
4582 |
|
|
|
4583 |
|
|
;; We have trouble with and:s and shifts. Maybe something is broken in
|
4584 |
|
|
;; gcc? Or it could just be that bit-field insn expansion is a bit
|
4585 |
|
|
;; suboptimal when not having extzv insns.
|
4586 |
|
|
;; Testcase for the following four peepholes: gcc.dg/cris-peep2-xsrand.c
|
4587 |
|
|
|
4588 |
|
|
(define_peephole2 ; asrandb (peephole casesi+31)
|
4589 |
|
|
[(set (match_operand:SI 0 "register_operand" "")
|
4590 |
|
|
(ashiftrt:SI (match_dup 0)
|
4591 |
|
|
(match_operand:SI 1 "const_int_operand" "")))
|
4592 |
|
|
(set (match_dup 0)
|
4593 |
|
|
(and:SI (match_dup 0)
|
4594 |
|
|
(match_operand 2 "const_int_operand" "")))]
|
4595 |
|
|
"INTVAL (operands[2]) > 31
|
4596 |
|
|
&& INTVAL (operands[2]) < 255
|
4597 |
|
|
&& INTVAL (operands[1]) > 23
|
4598 |
|
|
/* Check that the and-operation enables us to use logical-shift. */
|
4599 |
|
|
&& (INTVAL (operands[2])
|
4600 |
|
|
& ((HOST_WIDE_INT) -1 << (32 - INTVAL (operands[1])))) == 0"
|
4601 |
|
|
[(set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 1)))
|
4602 |
|
|
(set (match_dup 3) (and:QI (match_dup 3) (match_dup 4)))]
|
4603 |
|
|
;; FIXME: CC0 is valid except for the M bit.
|
4604 |
|
|
{
|
4605 |
|
|
operands[3] = gen_rtx_REG (QImode, REGNO (operands[0]));
|
4606 |
|
|
operands[4] = GEN_INT (trunc_int_for_mode (INTVAL (operands[2]), QImode));
|
4607 |
|
|
})
|
4608 |
|
|
|
4609 |
|
|
(define_peephole2 ; asrandw (peephole casesi+32)
|
4610 |
|
|
[(set (match_operand:SI 0 "register_operand" "")
|
4611 |
|
|
(ashiftrt:SI (match_dup 0)
|
4612 |
|
|
(match_operand:SI 1 "const_int_operand" "")))
|
4613 |
|
|
(set (match_dup 0)
|
4614 |
|
|
(and:SI (match_dup 0) (match_operand 2 "const_int_operand" "")))]
|
4615 |
|
|
"INTVAL (operands[2]) > 31
|
4616 |
|
|
&& INTVAL (operands[2]) < 65535
|
4617 |
|
|
&& INTVAL (operands[2]) != 255
|
4618 |
|
|
&& INTVAL (operands[1]) > 15
|
4619 |
|
|
/* Check that the and-operation enables us to use logical-shift. */
|
4620 |
|
|
&& (INTVAL (operands[2])
|
4621 |
|
|
& ((HOST_WIDE_INT) -1 << (32 - INTVAL (operands[1])))) == 0"
|
4622 |
|
|
[(set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 1)))
|
4623 |
|
|
(set (match_dup 3) (and:HI (match_dup 3) (match_dup 4)))]
|
4624 |
|
|
;; FIXME: CC0 is valid except for the M bit.
|
4625 |
|
|
{
|
4626 |
|
|
operands[3] = gen_rtx_REG (HImode, REGNO (operands[0]));
|
4627 |
|
|
operands[4] = GEN_INT (trunc_int_for_mode (INTVAL (operands[2]), HImode));
|
4628 |
|
|
})
|
4629 |
|
|
|
4630 |
|
|
(define_peephole2 ; lsrandb (peephole casesi+33)
|
4631 |
|
|
[(set (match_operand:SI 0 "register_operand" "")
|
4632 |
|
|
(lshiftrt:SI (match_dup 0)
|
4633 |
|
|
(match_operand:SI 1 "const_int_operand" "")))
|
4634 |
|
|
(set (match_dup 0)
|
4635 |
|
|
(and:SI (match_dup 0) (match_operand 2 "const_int_operand" "")))]
|
4636 |
|
|
"INTVAL (operands[2]) > 31
|
4637 |
|
|
&& INTVAL (operands[2]) < 255
|
4638 |
|
|
&& INTVAL (operands[1]) > 23"
|
4639 |
|
|
[(set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 1)))
|
4640 |
|
|
(set (match_dup 3) (and:QI (match_dup 3) (match_dup 4)))]
|
4641 |
|
|
;; FIXME: CC0 is valid except for the M bit.
|
4642 |
|
|
{
|
4643 |
|
|
operands[3] = gen_rtx_REG (QImode, REGNO (operands[0]));
|
4644 |
|
|
operands[4] = GEN_INT (trunc_int_for_mode (INTVAL (operands[2]), QImode));
|
4645 |
|
|
})
|
4646 |
|
|
|
4647 |
|
|
(define_peephole2 ; lsrandw (peephole casesi+34)
|
4648 |
|
|
[(set (match_operand:SI 0 "register_operand" "")
|
4649 |
|
|
(lshiftrt:SI (match_dup 0)
|
4650 |
|
|
(match_operand:SI 1 "const_int_operand" "")))
|
4651 |
|
|
(set (match_dup 0)
|
4652 |
|
|
(and:SI (match_dup 0) (match_operand 2 "const_int_operand" "")))]
|
4653 |
|
|
"INTVAL (operands[2]) > 31 && INTVAL (operands[2]) < 65535
|
4654 |
|
|
&& INTVAL (operands[2]) != 255
|
4655 |
|
|
&& INTVAL (operands[1]) > 15"
|
4656 |
|
|
[(set (match_dup 0) (lshiftrt:SI (match_dup 0) (match_dup 1)))
|
4657 |
|
|
(set (match_dup 3) (and:HI (match_dup 3) (match_dup 4)))]
|
4658 |
|
|
;; FIXME: CC0 is valid except for the M bit.
|
4659 |
|
|
{
|
4660 |
|
|
operands[3] = gen_rtx_REG (HImode, REGNO (operands[0]));
|
4661 |
|
|
operands[4] = GEN_INT (trunc_int_for_mode (INTVAL (operands[2]), HImode));
|
4662 |
|
|
})
|
4663 |
|
|
|
4664 |
|
|
|
4665 |
|
|
;; Change
|
4666 |
|
|
;; add.d n,rx
|
4667 |
|
|
;; move [rx],ry
|
4668 |
|
|
;; into
|
4669 |
|
|
;; move [rx=rx+n],ry
|
4670 |
|
|
;; when -128 <= n <= 127.
|
4671 |
|
|
;; This will reduce the size of the assembler code for n = [-128..127],
|
4672 |
|
|
;; and speed up accordingly. Don't match if the previous insn is
|
4673 |
|
|
;; (set rx rz) because that combination is matched by another peephole.
|
4674 |
|
|
;; No stable test-case.
|
4675 |
|
|
|
4676 |
|
|
(define_peephole2 ; moversideqi (peephole casesi+35)
|
4677 |
|
|
[(set (match_operand:SI 0 "register_operand" "")
|
4678 |
|
|
(plus:SI (match_operand:SI 1 "register_operand" "")
|
4679 |
|
|
(match_operand:SI 2 "const_int_operand" "")))
|
4680 |
|
|
(set (match_operand 3 "register_operand" "")
|
4681 |
|
|
(match_operator 4 "cris_mem_op" [(match_dup 0)]))]
|
4682 |
|
|
"GET_MODE_SIZE (GET_MODE (operands[4])) <= UNITS_PER_WORD
|
4683 |
|
|
&& REGNO (operands[3]) != REGNO (operands[0])
|
4684 |
|
|
&& (cris_base_p (operands[1], true) || cris_base_p (operands[2], true))
|
4685 |
|
|
&& !satisfies_constraint_J (operands[2])
|
4686 |
|
|
&& !satisfies_constraint_N (operands[2])
|
4687 |
|
|
&& (INTVAL (operands[2]) >= -128 && INTVAL (operands[2]) < 128)
|
4688 |
|
|
&& TARGET_SIDE_EFFECT_PREFIXES"
|
4689 |
|
|
[(parallel
|
4690 |
|
|
[(set (match_dup 3) (match_dup 5))
|
4691 |
|
|
(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))])]
|
4692 |
|
|
;; Checking the previous insn is a bit too awkward for the condition.
|
4693 |
|
|
{
|
4694 |
|
|
rtx prev = prev_nonnote_insn (curr_insn);
|
4695 |
|
|
if (prev != NULL_RTX)
|
4696 |
|
|
{
|
4697 |
|
|
rtx set = single_set (prev);
|
4698 |
|
|
if (set != NULL_RTX
|
4699 |
|
|
&& REG_S_P (SET_DEST (set))
|
4700 |
|
|
&& REGNO (SET_DEST (set)) == REGNO (operands[0])
|
4701 |
|
|
&& REG_S_P (SET_SRC (set)))
|
4702 |
|
|
FAIL;
|
4703 |
|
|
}
|
4704 |
|
|
operands[5]
|
4705 |
|
|
= replace_equiv_address (operands[4],
|
4706 |
|
|
gen_rtx_PLUS (SImode,
|
4707 |
|
|
operands[1], operands[2]));
|
4708 |
|
|
})
|
4709 |
|
|
|
4710 |
|
|
;; Vice versa: move ry,[rx=rx+n]
|
4711 |
|
|
|
4712 |
|
|
(define_peephole2 ; movemsideqi (peephole casesi+36)
|
4713 |
|
|
[(set (match_operand:SI 0 "register_operand" "")
|
4714 |
|
|
(plus:SI (match_operand:SI 1 "register_operand" "")
|
4715 |
|
|
(match_operand:SI 2 "const_int_operand" "")))
|
4716 |
|
|
(set (match_operator 3 "cris_mem_op" [(match_dup 0)])
|
4717 |
|
|
(match_operand 4 "register_operand" ""))]
|
4718 |
|
|
"GET_MODE_SIZE (GET_MODE (operands[4])) <= UNITS_PER_WORD
|
4719 |
|
|
&& REGNO (operands[4]) != REGNO (operands[0])
|
4720 |
|
|
&& (cris_base_p (operands[1], true) || cris_base_p (operands[2], true))
|
4721 |
|
|
&& !satisfies_constraint_J (operands[2])
|
4722 |
|
|
&& !satisfies_constraint_N (operands[2])
|
4723 |
|
|
&& (INTVAL (operands[2]) >= -128 && INTVAL (operands[2]) < 128)
|
4724 |
|
|
&& TARGET_SIDE_EFFECT_PREFIXES"
|
4725 |
|
|
[(parallel
|
4726 |
|
|
[(set (match_dup 5) (match_dup 4))
|
4727 |
|
|
(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))])]
|
4728 |
|
|
"operands[5]
|
4729 |
|
|
= replace_equiv_address (operands[3],
|
4730 |
|
|
gen_rtx_PLUS (SImode,
|
4731 |
|
|
operands[1], operands[2]));")
|
4732 |
|
|
|
4733 |
|
|
;; As above, change:
|
4734 |
|
|
;; add.d n,rx
|
4735 |
|
|
;; op.d [rx],ry
|
4736 |
|
|
;; into:
|
4737 |
|
|
;; op.d [rx=rx+n],ry
|
4738 |
|
|
;; Saves when n = [-128..127].
|
4739 |
|
|
;;
|
4740 |
|
|
;; Splitting and joining combinations for side-effect modes are slightly
|
4741 |
|
|
;; out of hand. They probably will not save the time they take typing in,
|
4742 |
|
|
;; not to mention the bugs that creep in. FIXME: Get rid of as many of
|
4743 |
|
|
;; the splits and peepholes as possible.
|
4744 |
|
|
;; No stable test-case.
|
4745 |
|
|
|
4746 |
|
|
(define_peephole2 ; mover2side (peephole casesi+37)
|
4747 |
|
|
[(set (match_operand:SI 0 "register_operand" "")
|
4748 |
|
|
(plus:SI (match_operand:SI 1 "register_operand" "")
|
4749 |
|
|
(match_operand:SI 2 "const_int_operand" "")))
|
4750 |
|
|
(set (match_operand 3 "register_operand" "")
|
4751 |
|
|
(match_operator 4 "cris_orthogonal_operator"
|
4752 |
|
|
[(match_dup 3)
|
4753 |
|
|
(match_operator
|
4754 |
|
|
5 "cris_mem_op" [(match_dup 0)])]))]
|
4755 |
|
|
;; FIXME: What about DFmode?
|
4756 |
|
|
;; Change to GET_MODE_SIZE (GET_MODE (operands[3])) <= UNITS_PER_WORD?
|
4757 |
|
|
"GET_MODE (operands[3]) != DImode
|
4758 |
|
|
&& REGNO (operands[0]) != REGNO (operands[3])
|
4759 |
|
|
&& !satisfies_constraint_J (operands[2])
|
4760 |
|
|
&& !satisfies_constraint_N (operands[2])
|
4761 |
|
|
&& INTVAL (operands[2]) >= -128
|
4762 |
|
|
&& INTVAL (operands[2]) <= 127
|
4763 |
|
|
&& TARGET_SIDE_EFFECT_PREFIXES"
|
4764 |
|
|
[(parallel
|
4765 |
|
|
[(set (match_dup 3) (match_op_dup 4 [(match_dup 3) (match_dup 6)]))
|
4766 |
|
|
(set (match_dup 0) (plus:SI (match_dup 1) (match_dup 2)))])]
|
4767 |
|
|
"operands[6]
|
4768 |
|
|
= replace_equiv_address (operands[5],
|
4769 |
|
|
gen_rtx_PLUS (SImode,
|
4770 |
|
|
operands[1], operands[2]));")
|
4771 |
|
|
|
4772 |
|
|
;; Sometimes, for some reason the pattern
|
4773 |
|
|
;; move x,rx
|
4774 |
|
|
;; add y,rx
|
4775 |
|
|
;; move [rx],rz
|
4776 |
|
|
;; will occur. Solve this, and likewise for to-memory.
|
4777 |
|
|
;; No stable test-case.
|
4778 |
|
|
|
4779 |
|
|
(define_peephole2 ; moverside (peephole casesi+38)
|
4780 |
|
|
[(set (match_operand:SI 0 "register_operand" "")
|
4781 |
|
|
(match_operand:SI 1 "cris_bdap_biap_operand" ""))
|
4782 |
|
|
(set (match_dup 0)
|
4783 |
|
|
(plus:SI (match_operand:SI 2 "cris_bdap_biap_operand" "")
|
4784 |
|
|
(match_operand:SI 3 "cris_bdap_biap_operand" "")))
|
4785 |
|
|
(set (match_operand 4 "register_operand" "")
|
4786 |
|
|
(match_operator 5 "cris_mem_op" [(match_dup 0)]))]
|
4787 |
|
|
"(rtx_equal_p (operands[2], operands[0])
|
4788 |
|
|
|| rtx_equal_p (operands[3], operands[0]))
|
4789 |
|
|
&& cris_side_effect_mode_ok (PLUS, operands, 0,
|
4790 |
|
|
(REG_S_P (operands[1])
|
4791 |
|
|
? 1
|
4792 |
|
|
: (rtx_equal_p (operands[2], operands[0])
|
4793 |
|
|
? 3 : 2)),
|
4794 |
|
|
(! REG_S_P (operands[1])
|
4795 |
|
|
? 1
|
4796 |
|
|
: (rtx_equal_p (operands[2], operands[0])
|
4797 |
|
|
? 3 : 2)),
|
4798 |
|
|
-1, 4)"
|
4799 |
|
|
[(parallel
|
4800 |
|
|
[(set (match_dup 4) (match_dup 6))
|
4801 |
|
|
(set (match_dup 0) (plus:SI (match_dup 7) (match_dup 8)))])]
|
4802 |
|
|
{
|
4803 |
|
|
rtx otherop
|
4804 |
|
|
= rtx_equal_p (operands[2], operands[0]) ? operands[3] : operands[2];
|
4805 |
|
|
|
4806 |
|
|
/* Make sure we have canonical RTX so we match the insn pattern -
|
4807 |
|
|
not a constant in the first operand. We also require the order
|
4808 |
|
|
(plus reg mem) to match the final pattern. */
|
4809 |
|
|
if (CONSTANT_P (otherop) || MEM_P (otherop))
|
4810 |
|
|
{
|
4811 |
|
|
operands[7] = operands[1];
|
4812 |
|
|
operands[8] = otherop;
|
4813 |
|
|
}
|
4814 |
|
|
else
|
4815 |
|
|
{
|
4816 |
|
|
operands[7] = otherop;
|
4817 |
|
|
operands[8] = operands[1];
|
4818 |
|
|
}
|
4819 |
|
|
operands[6]
|
4820 |
|
|
= replace_equiv_address (operands[5],
|
4821 |
|
|
gen_rtx_PLUS (SImode,
|
4822 |
|
|
operands[7], operands[8]));
|
4823 |
|
|
})
|
4824 |
|
|
|
4825 |
|
|
;; As above but to memory.
|
4826 |
|
|
;; FIXME: Split movemside and moverside into variants and prune
|
4827 |
|
|
;; the ones that don't trig.
|
4828 |
|
|
;; No stable test-case.
|
4829 |
|
|
|
4830 |
|
|
(define_peephole2 ; movemside (peephole casesi+39)
|
4831 |
|
|
[(set (match_operand:SI 0 "register_operand" "")
|
4832 |
|
|
(match_operand:SI 1 "cris_bdap_biap_operand" ""))
|
4833 |
|
|
(set (match_dup 0)
|
4834 |
|
|
(plus:SI (match_operand:SI 2 "cris_bdap_biap_operand" "")
|
4835 |
|
|
(match_operand:SI 3 "cris_bdap_biap_operand" "")))
|
4836 |
|
|
(set (match_operator 4 "cris_mem_op" [(match_dup 0)])
|
4837 |
|
|
(match_operand 5 "register_operand" ""))]
|
4838 |
|
|
"(rtx_equal_p (operands[2], operands[0])
|
4839 |
|
|
|| rtx_equal_p (operands[3], operands[0]))
|
4840 |
|
|
&& cris_side_effect_mode_ok (PLUS, operands, 0,
|
4841 |
|
|
(REG_S_P (operands[1])
|
4842 |
|
|
? 1
|
4843 |
|
|
: (rtx_equal_p (operands[2], operands[0])
|
4844 |
|
|
? 3 : 2)),
|
4845 |
|
|
(! REG_S_P (operands[1])
|
4846 |
|
|
? 1
|
4847 |
|
|
: (rtx_equal_p (operands[2], operands[0])
|
4848 |
|
|
? 3 : 2)),
|
4849 |
|
|
-1, 5)"
|
4850 |
|
|
[(parallel
|
4851 |
|
|
[(set (match_dup 6) (match_dup 5))
|
4852 |
|
|
(set (match_dup 0) (plus:SI (match_dup 7) (match_dup 8)))])]
|
4853 |
|
|
{
|
4854 |
|
|
rtx otherop
|
4855 |
|
|
= rtx_equal_p (operands[2], operands[0]) ? operands[3] : operands[2];
|
4856 |
|
|
|
4857 |
|
|
/* Make sure we have canonical RTX so we match the insn pattern -
|
4858 |
|
|
not a constant in the first operand. We also require the order
|
4859 |
|
|
(plus reg mem) to match the final pattern. */
|
4860 |
|
|
if (CONSTANT_P (otherop) || MEM_P (otherop))
|
4861 |
|
|
{
|
4862 |
|
|
operands[7] = operands[1];
|
4863 |
|
|
operands[8] = otherop;
|
4864 |
|
|
}
|
4865 |
|
|
else
|
4866 |
|
|
{
|
4867 |
|
|
operands[7] = otherop;
|
4868 |
|
|
operands[8] = operands[1];
|
4869 |
|
|
}
|
4870 |
|
|
operands[6]
|
4871 |
|
|
= replace_equiv_address (operands[4],
|
4872 |
|
|
gen_rtx_PLUS (SImode,
|
4873 |
|
|
operands[7], operands[8]));
|
4874 |
|
|
})
|
4875 |
|
|
|
4876 |
|
|
;; Another spotted bad code:
|
4877 |
|
|
;; move rx,ry
|
4878 |
|
|
;; move [ry],ry
|
4879 |
|
|
;; No stable test-case.
|
4880 |
|
|
|
4881 |
|
|
(define_peephole2 ; movei (peephole casesi+42)
|
4882 |
|
|
[(set (match_operand:SI 0 "register_operand" "")
|
4883 |
|
|
(match_operand:SI 1 "register_operand" ""))
|
4884 |
|
|
(set (match_operand 2 "register_operand" "")
|
4885 |
|
|
(match_operator 3 "cris_mem_op" [(match_dup 0)]))]
|
4886 |
|
|
"REGNO (operands[0]) == REGNO (operands[2])
|
4887 |
|
|
&& (REGNO_REG_CLASS (REGNO (operands[0]))
|
4888 |
|
|
== REGNO_REG_CLASS (REGNO (operands[1])))
|
4889 |
|
|
&& GET_MODE_SIZE (GET_MODE (operands[2])) <= UNITS_PER_WORD"
|
4890 |
|
|
[(set (match_dup 2) (match_dup 4))]
|
4891 |
|
|
"operands[4] = replace_equiv_address (operands[3], operands[1]);")
|
4892 |
|
|
|
4893 |
|
|
;; move.d [r10+16],r9
|
4894 |
|
|
;; and.d r12,r9
|
4895 |
|
|
;; change to
|
4896 |
|
|
;; and.d [r10+16],r12,r9
|
4897 |
|
|
;; With generalization of the operation, the size and the addressing mode.
|
4898 |
|
|
;; This seems to be the result of a quirk in register allocation
|
4899 |
|
|
;; missing the three-operand cases when having different predicates.
|
4900 |
|
|
;; Maybe that it matters that it is a commutative operation.
|
4901 |
|
|
;; This pattern helps that situation, but there's still the increased
|
4902 |
|
|
;; register pressure.
|
4903 |
|
|
;; Note that adding the noncommutative variant did not show any matches
|
4904 |
|
|
;; in ipps and cc1, so it's not here.
|
4905 |
|
|
;; No stable test-case.
|
4906 |
|
|
|
4907 |
|
|
(define_peephole2 ; op3 (peephole casesi+44)
|
4908 |
|
|
[(set (match_operand 0 "register_operand" "")
|
4909 |
|
|
(match_operator
|
4910 |
|
|
6 "cris_mem_op"
|
4911 |
|
|
[(plus:SI
|
4912 |
|
|
(match_operand:SI 1 "cris_bdap_biap_operand" "")
|
4913 |
|
|
(match_operand:SI 2 "cris_bdap_biap_operand" ""))]))
|
4914 |
|
|
(set (match_dup 0)
|
4915 |
|
|
(match_operator
|
4916 |
|
|
5 "cris_commutative_orth_op"
|
4917 |
|
|
[(match_operand 3 "register_operand" "")
|
4918 |
|
|
(match_operand 4 "register_operand" "")]))]
|
4919 |
|
|
"(rtx_equal_p (operands[3], operands[0])
|
4920 |
|
|
|| rtx_equal_p (operands[4], operands[0]))
|
4921 |
|
|
&& ! rtx_equal_p (operands[3], operands[4])
|
4922 |
|
|
&& (REG_S_P (operands[1]) || REG_S_P (operands[2]))
|
4923 |
|
|
&& GET_MODE_SIZE (GET_MODE (operands[0])) <= UNITS_PER_WORD"
|
4924 |
|
|
[(set (match_dup 0) (match_op_dup 5 [(match_dup 7) (match_dup 6)]))]
|
4925 |
|
|
"operands[7]
|
4926 |
|
|
= rtx_equal_p (operands[3], operands[0]) ? operands[4] : operands[3];")
|
4927 |
|
|
|
4928 |
|
|
;; I cannot tell GCC (2.1, 2.7.2) how to correctly reload an instruction
|
4929 |
|
|
;; that looks like
|
4930 |
|
|
;; and.b some_byte,const,reg_32
|
4931 |
|
|
;; where reg_32 is the destination of the "three-address" code optimally.
|
4932 |
|
|
;; It should be:
|
4933 |
|
|
;; movu.b some_byte,reg_32
|
4934 |
|
|
;; and.b const,reg_32
|
4935 |
|
|
;; but it turns into:
|
4936 |
|
|
;; move.b some_byte,reg_32
|
4937 |
|
|
;; and.d const,reg_32
|
4938 |
|
|
;; Fix it here.
|
4939 |
|
|
;; Testcases: gcc.dg/cris-peep2-andu1.c gcc.dg/cris-peep2-andu2.c
|
4940 |
|
|
|
4941 |
|
|
(define_peephole2 ; andu (casesi+45)
|
4942 |
|
|
[(set (match_operand:SI 0 "register_operand" "")
|
4943 |
|
|
(match_operand:SI 1 "nonimmediate_operand" ""))
|
4944 |
|
|
(set (match_operand:SI 2 "register_operand" "")
|
4945 |
|
|
(and:SI (match_dup 0)
|
4946 |
|
|
(match_operand:SI 3 "const_int_operand" "")))]
|
4947 |
|
|
;; Since the size of the memory access could be made different here,
|
4948 |
|
|
;; don't do this for a mem-volatile access.
|
4949 |
|
|
"REGNO (operands[2]) == REGNO (operands[0])
|
4950 |
|
|
&& INTVAL (operands[3]) <= 65535 && INTVAL (operands[3]) >= 0
|
4951 |
|
|
&& !satisfies_constraint_I (operands[3])
|
4952 |
|
|
&& !side_effects_p (operands[1])
|
4953 |
|
|
&& (!REG_P (operands[1])
|
4954 |
|
|
|| REGNO (operands[1]) <= CRIS_LAST_GENERAL_REGISTER)"
|
4955 |
|
|
;; FIXME: CC0 valid except for M (i.e. CC_NOT_NEGATIVE).
|
4956 |
|
|
[(set (match_dup 0) (match_dup 4))
|
4957 |
|
|
(set (match_dup 5) (match_dup 6))]
|
4958 |
|
|
{
|
4959 |
|
|
enum machine_mode zmode = INTVAL (operands[3]) <= 255 ? QImode : HImode;
|
4960 |
|
|
enum machine_mode amode
|
4961 |
|
|
= satisfies_constraint_O (operands[3]) ? SImode : zmode;
|
4962 |
|
|
rtx op1
|
4963 |
|
|
= (REG_S_P (operands[1])
|
4964 |
|
|
? gen_rtx_REG (zmode, REGNO (operands[1]))
|
4965 |
|
|
: adjust_address (operands[1], zmode, 0));
|
4966 |
|
|
operands[4]
|
4967 |
|
|
= gen_rtx_ZERO_EXTEND (SImode, op1);
|
4968 |
|
|
operands[5] = gen_rtx_REG (amode, REGNO (operands[0]));
|
4969 |
|
|
operands[6]
|
4970 |
|
|
= gen_rtx_AND (amode, gen_rtx_REG (amode, REGNO (operands[0])),
|
4971 |
|
|
GEN_INT (trunc_int_for_mode (INTVAL (operands[3]),
|
4972 |
|
|
amode == SImode
|
4973 |
|
|
? QImode : amode)));
|
4974 |
|
|
})
|
4975 |
|
|
|
4976 |
|
|
;; Try and avoid GOTPLT reads escaping a call: transform them into
|
4977 |
|
|
;; PLT. Curiously (but thankfully), peepholes for instructions
|
4978 |
|
|
;; *without side-effects* that just feed a call (or call_value) are
|
4979 |
|
|
;; not matched neither in a build or test-suite, so those patterns are
|
4980 |
|
|
;; omitted.
|
4981 |
|
|
|
4982 |
|
|
;; A "normal" move where we don't check the consumer.
|
4983 |
|
|
|
4984 |
|
|
(define_peephole2 ; gotplt-to-plt
|
4985 |
|
|
[(set
|
4986 |
|
|
(match_operand:SI 0 "register_operand" "")
|
4987 |
|
|
(match_operator:SI
|
4988 |
|
|
1 "cris_mem_op"
|
4989 |
|
|
[(plus:SI
|
4990 |
|
|
(reg:SI CRIS_GOT_REGNUM)
|
4991 |
|
|
(const:SI
|
4992 |
|
|
(unspec:SI [(match_operand:SI 2 "cris_general_operand_or_symbol" "")]
|
4993 |
|
|
CRIS_UNSPEC_PLTGOTREAD)))]))]
|
4994 |
|
|
"flag_pic
|
4995 |
|
|
&& cris_valid_pic_const (XEXP (XEXP (operands[1], 0), 1), true)
|
4996 |
|
|
&& REGNO_REG_CLASS (REGNO (operands[0])) == REGNO_REG_CLASS (0)"
|
4997 |
|
|
[(set (match_dup 0) (const:SI (unspec:SI [(match_dup 2)] CRIS_UNSPEC_PLT_GOTREL)))
|
4998 |
|
|
(set (match_dup 0) (plus:SI (match_dup 0) (reg:SI CRIS_GOT_REGNUM)))]
|
4999 |
|
|
"")
|
5000 |
|
|
|
5001 |
|
|
;; And one set with a side-effect getting the PLTGOT offset.
|
5002 |
|
|
;; First call and call_value variants.
|
5003 |
|
|
|
5004 |
|
|
(define_peephole2 ; gotplt-to-plt-side-call
|
5005 |
|
|
[(parallel
|
5006 |
|
|
[(set
|
5007 |
|
|
(match_operand:SI 0 "register_operand" "")
|
5008 |
|
|
(match_operator:SI
|
5009 |
|
|
1 "cris_mem_op"
|
5010 |
|
|
[(plus:SI
|
5011 |
|
|
(reg:SI CRIS_GOT_REGNUM)
|
5012 |
|
|
(const:SI
|
5013 |
|
|
(unspec:SI [(match_operand:SI
|
5014 |
|
|
2 "cris_general_operand_or_symbol" "")]
|
5015 |
|
|
CRIS_UNSPEC_PLTGOTREAD)))]))
|
5016 |
|
|
(set (match_operand:SI 3 "register_operand" "")
|
5017 |
|
|
(plus:SI (reg:SI CRIS_GOT_REGNUM)
|
5018 |
|
|
(const:SI
|
5019 |
|
|
(unspec:SI [(match_dup 2)] CRIS_UNSPEC_PLTGOTREAD))))])
|
5020 |
|
|
(parallel [(call (mem:QI (match_dup 0))
|
5021 |
|
|
(match_operand 4 "" ""))
|
5022 |
|
|
(clobber (reg:SI CRIS_SRP_REGNUM))])]
|
5023 |
|
|
"flag_pic
|
5024 |
|
|
&& cris_valid_pic_const (XEXP (XEXP (operands[1], 0), 1), true)
|
5025 |
|
|
&& peep2_reg_dead_p (2, operands[0])"
|
5026 |
|
|
[(parallel [(call (mem:QI (match_dup 1))
|
5027 |
|
|
(match_dup 4))
|
5028 |
|
|
(clobber (reg:SI CRIS_SRP_REGNUM))
|
5029 |
|
|
(set (match_dup 3)
|
5030 |
|
|
(plus:SI (reg:SI CRIS_GOT_REGNUM)
|
5031 |
|
|
(const:SI
|
5032 |
|
|
(unspec:SI [(match_dup 2)]
|
5033 |
|
|
CRIS_UNSPEC_PLTGOTREAD))))])]
|
5034 |
|
|
"")
|
5035 |
|
|
|
5036 |
|
|
(define_peephole2 ; gotplt-to-plt-side-call-value
|
5037 |
|
|
[(parallel
|
5038 |
|
|
[(set
|
5039 |
|
|
(match_operand:SI 0 "register_operand" "")
|
5040 |
|
|
(match_operator:SI
|
5041 |
|
|
1 "cris_mem_op"
|
5042 |
|
|
[(plus:SI
|
5043 |
|
|
(reg:SI CRIS_GOT_REGNUM)
|
5044 |
|
|
(const:SI
|
5045 |
|
|
(unspec:SI [(match_operand:SI
|
5046 |
|
|
2 "cris_general_operand_or_symbol" "")]
|
5047 |
|
|
CRIS_UNSPEC_PLTGOTREAD)))]))
|
5048 |
|
|
(set (match_operand:SI 3 "register_operand" "")
|
5049 |
|
|
(plus:SI (reg:SI CRIS_GOT_REGNUM)
|
5050 |
|
|
(const:SI
|
5051 |
|
|
(unspec:SI [(match_dup 2)] CRIS_UNSPEC_PLTGOTREAD))))])
|
5052 |
|
|
(parallel [(set (match_operand 5 "" "")
|
5053 |
|
|
(call (mem:QI (match_dup 0))
|
5054 |
|
|
(match_operand 4 "" "")))
|
5055 |
|
|
(clobber (reg:SI CRIS_SRP_REGNUM))])]
|
5056 |
|
|
"flag_pic
|
5057 |
|
|
&& cris_valid_pic_const (XEXP (XEXP (operands[1], 0), 1), true)
|
5058 |
|
|
&& peep2_reg_dead_p (2, operands[0])"
|
5059 |
|
|
[(parallel [(set (match_dup 5)
|
5060 |
|
|
(call (mem:QI (match_dup 1))
|
5061 |
|
|
(match_dup 4)))
|
5062 |
|
|
(clobber (reg:SI CRIS_SRP_REGNUM))
|
5063 |
|
|
(set (match_dup 3)
|
5064 |
|
|
(plus:SI (reg:SI CRIS_GOT_REGNUM)
|
5065 |
|
|
(const:SI
|
5066 |
|
|
(unspec:SI [(match_dup 2)]
|
5067 |
|
|
CRIS_UNSPEC_PLTGOTREAD))))])]
|
5068 |
|
|
"")
|
5069 |
|
|
|
5070 |
|
|
(define_peephole2 ; gotplt-to-plt-side
|
5071 |
|
|
[(parallel
|
5072 |
|
|
[(set
|
5073 |
|
|
(match_operand:SI 0 "register_operand" "")
|
5074 |
|
|
(match_operator:SI
|
5075 |
|
|
1 "cris_mem_op"
|
5076 |
|
|
[(plus:SI
|
5077 |
|
|
(reg:SI CRIS_GOT_REGNUM)
|
5078 |
|
|
(const:SI
|
5079 |
|
|
(unspec:SI [(match_operand:SI
|
5080 |
|
|
2 "cris_general_operand_or_symbol" "")]
|
5081 |
|
|
CRIS_UNSPEC_PLTGOTREAD)))]))
|
5082 |
|
|
(set (match_operand:SI 3 "register_operand" "")
|
5083 |
|
|
(plus:SI (reg:SI CRIS_GOT_REGNUM)
|
5084 |
|
|
(const:SI
|
5085 |
|
|
(unspec:SI [(match_dup 2)] CRIS_UNSPEC_PLTGOTREAD))))])]
|
5086 |
|
|
"flag_pic
|
5087 |
|
|
&& cris_valid_pic_const (XEXP (XEXP (operands[1], 0), 1), true)
|
5088 |
|
|
&& REGNO_REG_CLASS (REGNO (operands[0])) == REGNO_REG_CLASS (0)"
|
5089 |
|
|
[(set (match_dup 3)
|
5090 |
|
|
(const:SI (unspec:SI [(match_dup 2)] CRIS_UNSPEC_PLTGOTREAD)))
|
5091 |
|
|
(set (match_dup 3) (plus:SI (match_dup 3) (reg:SI CRIS_GOT_REGNUM)))
|
5092 |
|
|
(set (match_dup 0)
|
5093 |
|
|
(const:SI (unspec:SI [(match_dup 2)] CRIS_UNSPEC_PLT_GOTREL)))
|
5094 |
|
|
(set (match_dup 0) (plus:SI (match_dup 0) (reg:SI CRIS_GOT_REGNUM)))]
|
5095 |
|
|
"")
|
5096 |
|
|
|
5097 |
|
|
;; Local variables:
|
5098 |
|
|
;; mode:emacs-lisp
|
5099 |
|
|
;; comment-start: ";; "
|
5100 |
|
|
;; eval: (set-syntax-table (copy-sequence (syntax-table)))
|
5101 |
|
|
;; eval: (modify-syntax-entry ?[ "(]")
|
5102 |
|
|
;; eval: (modify-syntax-entry ?] ")[")
|
5103 |
|
|
;; eval: (modify-syntax-entry ?{ "(}")
|
5104 |
|
|
;; eval: (modify-syntax-entry ?} "){")
|
5105 |
|
|
;; eval: (setq indent-tabs-mode t)
|
5106 |
|
|
;; End:
|