1 |
709 |
jeremybenn |
;; Predicate definitions for DEC Alpha.
|
2 |
|
|
;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010
|
3 |
|
|
;; Free Software Foundation, Inc.
|
4 |
|
|
;;
|
5 |
|
|
;; This file is part of GCC.
|
6 |
|
|
;;
|
7 |
|
|
;; GCC is free software; you can redistribute it and/or modify
|
8 |
|
|
;; it under the terms of the GNU General Public License as published by
|
9 |
|
|
;; the Free Software Foundation; either version 3, or (at your option)
|
10 |
|
|
;; any later version.
|
11 |
|
|
;;
|
12 |
|
|
;; GCC is distributed in the hope that it will be useful,
|
13 |
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
|
|
;; GNU General Public License for more details.
|
16 |
|
|
;;
|
17 |
|
|
;; You should have received a copy of the GNU General Public License
|
18 |
|
|
;; along with GCC; see the file COPYING3. If not see
|
19 |
|
|
;; .
|
20 |
|
|
|
21 |
|
|
;; Return 1 if OP is the zero constant for MODE.
|
22 |
|
|
(define_predicate "const0_operand"
|
23 |
|
|
(and (match_code "const_int,const_double,const_vector")
|
24 |
|
|
(match_test "op == CONST0_RTX (mode)")))
|
25 |
|
|
|
26 |
|
|
;; Returns true if OP is either the constant zero or a register.
|
27 |
|
|
(define_predicate "reg_or_0_operand"
|
28 |
|
|
(ior (match_operand 0 "register_operand")
|
29 |
|
|
(match_operand 0 "const0_operand")))
|
30 |
|
|
|
31 |
|
|
;; Return 1 if OP is a constant in the range of 0-63 (for a shift) or
|
32 |
|
|
;; any register.
|
33 |
|
|
(define_predicate "reg_or_6bit_operand"
|
34 |
|
|
(if_then_else (match_code "const_int")
|
35 |
|
|
(match_test "INTVAL (op) >= 0 && INTVAL (op) < 64")
|
36 |
|
|
(match_operand 0 "register_operand")))
|
37 |
|
|
|
38 |
|
|
;; Return 1 if OP is an 8-bit constant.
|
39 |
|
|
(define_predicate "cint8_operand"
|
40 |
|
|
(and (match_code "const_int")
|
41 |
|
|
(match_test "INTVAL (op) >= 0 && INTVAL (op) < 256")))
|
42 |
|
|
|
43 |
|
|
;; Return 1 if OP is an 8-bit constant or any register.
|
44 |
|
|
(define_predicate "reg_or_8bit_operand"
|
45 |
|
|
(if_then_else (match_code "const_int")
|
46 |
|
|
(match_test "INTVAL (op) >= 0 && INTVAL (op) < 256")
|
47 |
|
|
(match_operand 0 "register_operand")))
|
48 |
|
|
|
49 |
|
|
;; Return 1 if OP is a constant or any register.
|
50 |
|
|
(define_predicate "reg_or_cint_operand"
|
51 |
|
|
(ior (match_operand 0 "register_operand")
|
52 |
|
|
(match_operand 0 "const_int_operand")))
|
53 |
|
|
|
54 |
|
|
;; Return 1 if the operand is a valid second operand to an add insn.
|
55 |
|
|
(define_predicate "add_operand"
|
56 |
|
|
(if_then_else (match_code "const_int")
|
57 |
|
|
(match_test "satisfies_constraint_K (op) || satisfies_constraint_L (op)")
|
58 |
|
|
(match_operand 0 "register_operand")))
|
59 |
|
|
|
60 |
|
|
;; Return 1 if the operand is a valid second operand to a
|
61 |
|
|
;; sign-extending add insn.
|
62 |
|
|
(define_predicate "sext_add_operand"
|
63 |
|
|
(if_then_else (match_code "const_int")
|
64 |
|
|
(match_test "satisfies_constraint_I (op) || satisfies_constraint_O (op)")
|
65 |
|
|
(match_operand 0 "register_operand")))
|
66 |
|
|
|
67 |
|
|
;; Return 1 if the operand is a non-symbolic constant operand that
|
68 |
|
|
;; does not satisfy add_operand.
|
69 |
|
|
(define_predicate "non_add_const_operand"
|
70 |
|
|
(and (match_code "const_int,const_double,const_vector")
|
71 |
|
|
(not (match_operand 0 "add_operand"))))
|
72 |
|
|
|
73 |
|
|
;; Return 1 if the operand is a non-symbolic, nonzero constant operand.
|
74 |
|
|
(define_predicate "non_zero_const_operand"
|
75 |
|
|
(and (match_code "const_int,const_double,const_vector")
|
76 |
|
|
(match_test "op != CONST0_RTX (mode)")))
|
77 |
|
|
|
78 |
|
|
;; Return 1 if OP is the constant 4 or 8.
|
79 |
|
|
(define_predicate "const48_operand"
|
80 |
|
|
(and (match_code "const_int")
|
81 |
|
|
(match_test "INTVAL (op) == 4 || INTVAL (op) == 8")))
|
82 |
|
|
|
83 |
|
|
;; Return 1 if OP is a valid first operand to an AND insn.
|
84 |
|
|
(define_predicate "and_operand"
|
85 |
|
|
(if_then_else (match_code "const_int")
|
86 |
|
|
(match_test "(unsigned HOST_WIDE_INT) INTVAL (op) < 0x100
|
87 |
|
|
|| (unsigned HOST_WIDE_INT) ~ INTVAL (op) < 0x100
|
88 |
|
|
|| zap_mask (INTVAL (op))")
|
89 |
|
|
(if_then_else (match_code "const_double")
|
90 |
|
|
(match_test "GET_MODE (op) == VOIDmode
|
91 |
|
|
&& zap_mask (CONST_DOUBLE_LOW (op))
|
92 |
|
|
&& zap_mask (CONST_DOUBLE_HIGH (op))")
|
93 |
|
|
(match_operand 0 "register_operand"))))
|
94 |
|
|
|
95 |
|
|
;; Return 1 if OP is a valid first operand to an IOR or XOR insn.
|
96 |
|
|
(define_predicate "or_operand"
|
97 |
|
|
(if_then_else (match_code "const_int")
|
98 |
|
|
(match_test "(unsigned HOST_WIDE_INT) INTVAL (op) < 0x100
|
99 |
|
|
|| (unsigned HOST_WIDE_INT) ~ INTVAL (op) < 0x100")
|
100 |
|
|
(match_operand 0 "register_operand")))
|
101 |
|
|
|
102 |
|
|
;; Return 1 if OP is a constant that is the width, in bits, of an integral
|
103 |
|
|
;; mode not larger than DImode.
|
104 |
|
|
(define_predicate "mode_width_operand"
|
105 |
|
|
(match_code "const_int")
|
106 |
|
|
{
|
107 |
|
|
HOST_WIDE_INT i = INTVAL (op);
|
108 |
|
|
return i == 8 || i == 16 || i == 32 || i == 64;
|
109 |
|
|
})
|
110 |
|
|
|
111 |
|
|
;; Return 1 if OP is a constant that is a mask of ones of width of an
|
112 |
|
|
;; integral machine mode not larger than DImode.
|
113 |
|
|
(define_predicate "mode_mask_operand"
|
114 |
|
|
(match_code "const_int,const_double")
|
115 |
|
|
{
|
116 |
|
|
if (CONST_INT_P (op))
|
117 |
|
|
{
|
118 |
|
|
HOST_WIDE_INT value = INTVAL (op);
|
119 |
|
|
|
120 |
|
|
if (value == 0xff)
|
121 |
|
|
return 1;
|
122 |
|
|
if (value == 0xffff)
|
123 |
|
|
return 1;
|
124 |
|
|
if (value == 0xffffffff)
|
125 |
|
|
return 1;
|
126 |
|
|
if (value == -1)
|
127 |
|
|
return 1;
|
128 |
|
|
}
|
129 |
|
|
else if (HOST_BITS_PER_WIDE_INT == 32 && GET_CODE (op) == CONST_DOUBLE)
|
130 |
|
|
{
|
131 |
|
|
if (CONST_DOUBLE_LOW (op) == 0xffffffff && CONST_DOUBLE_HIGH (op) == 0)
|
132 |
|
|
return 1;
|
133 |
|
|
}
|
134 |
|
|
return 0;
|
135 |
|
|
})
|
136 |
|
|
|
137 |
|
|
;; Return 1 if OP is a multiple of 8 less than 64.
|
138 |
|
|
(define_predicate "mul8_operand"
|
139 |
|
|
(match_code "const_int")
|
140 |
|
|
{
|
141 |
|
|
unsigned HOST_WIDE_INT i = INTVAL (op);
|
142 |
|
|
return i < 64 && i % 8 == 0;
|
143 |
|
|
})
|
144 |
|
|
|
145 |
|
|
;; Return 1 if OP is a hard floating-point register.
|
146 |
|
|
(define_predicate "hard_fp_register_operand"
|
147 |
|
|
(match_operand 0 "register_operand")
|
148 |
|
|
{
|
149 |
|
|
if (GET_CODE (op) == SUBREG)
|
150 |
|
|
op = SUBREG_REG (op);
|
151 |
|
|
return REGNO_REG_CLASS (REGNO (op)) == FLOAT_REGS;
|
152 |
|
|
})
|
153 |
|
|
|
154 |
|
|
;; Return 1 if OP is a hard general register.
|
155 |
|
|
(define_predicate "hard_int_register_operand"
|
156 |
|
|
(match_operand 0 "register_operand")
|
157 |
|
|
{
|
158 |
|
|
if (GET_CODE (op) == SUBREG)
|
159 |
|
|
op = SUBREG_REG (op);
|
160 |
|
|
return REGNO_REG_CLASS (REGNO (op)) == GENERAL_REGS;
|
161 |
|
|
})
|
162 |
|
|
|
163 |
|
|
;; Return 1 if OP is something that can be reloaded into a register;
|
164 |
|
|
;; if it is a MEM, it need not be valid.
|
165 |
|
|
(define_predicate "some_operand"
|
166 |
|
|
(ior (match_code "reg,mem,const_int,const_double,const_vector,
|
167 |
|
|
label_ref,symbol_ref,const,high")
|
168 |
|
|
(and (match_code "subreg")
|
169 |
|
|
(match_test "some_operand (SUBREG_REG (op), VOIDmode)"))))
|
170 |
|
|
|
171 |
|
|
;; Likewise, but don't accept constants.
|
172 |
|
|
(define_predicate "some_ni_operand"
|
173 |
|
|
(ior (match_code "reg,mem")
|
174 |
|
|
(and (match_code "subreg")
|
175 |
|
|
(match_test "some_ni_operand (SUBREG_REG (op), VOIDmode)"))))
|
176 |
|
|
|
177 |
|
|
;; Return 1 if OP is a valid operand for the source of a move insn.
|
178 |
|
|
(define_predicate "input_operand"
|
179 |
|
|
(match_code "label_ref,symbol_ref,const,high,reg,subreg,mem,
|
180 |
|
|
const_double,const_vector,const_int")
|
181 |
|
|
{
|
182 |
|
|
switch (GET_CODE (op))
|
183 |
|
|
{
|
184 |
|
|
case LABEL_REF:
|
185 |
|
|
case SYMBOL_REF:
|
186 |
|
|
case CONST:
|
187 |
|
|
if (TARGET_EXPLICIT_RELOCS)
|
188 |
|
|
{
|
189 |
|
|
/* We don't split symbolic operands into something unintelligable
|
190 |
|
|
until after reload, but we do not wish non-small, non-global
|
191 |
|
|
symbolic operands to be reconstructed from their high/lo_sum
|
192 |
|
|
form. */
|
193 |
|
|
return (small_symbolic_operand (op, mode)
|
194 |
|
|
|| global_symbolic_operand (op, mode)
|
195 |
|
|
|| gotdtp_symbolic_operand (op, mode)
|
196 |
|
|
|| gottp_symbolic_operand (op, mode));
|
197 |
|
|
}
|
198 |
|
|
/* VMS still has a 32-bit mode. */
|
199 |
|
|
return mode == ptr_mode || mode == Pmode;
|
200 |
|
|
|
201 |
|
|
case HIGH:
|
202 |
|
|
return (TARGET_EXPLICIT_RELOCS
|
203 |
|
|
&& local_symbolic_operand (XEXP (op, 0), mode));
|
204 |
|
|
|
205 |
|
|
case REG:
|
206 |
|
|
return 1;
|
207 |
|
|
|
208 |
|
|
case SUBREG:
|
209 |
|
|
if (register_operand (op, mode))
|
210 |
|
|
return 1;
|
211 |
|
|
/* ... fall through ... */
|
212 |
|
|
case MEM:
|
213 |
|
|
return ((TARGET_BWX || (mode != HImode && mode != QImode))
|
214 |
|
|
&& general_operand (op, mode));
|
215 |
|
|
|
216 |
|
|
case CONST_DOUBLE:
|
217 |
|
|
return op == CONST0_RTX (mode);
|
218 |
|
|
|
219 |
|
|
case CONST_VECTOR:
|
220 |
|
|
if (reload_in_progress || reload_completed)
|
221 |
|
|
return alpha_legitimate_constant_p (mode, op);
|
222 |
|
|
return op == CONST0_RTX (mode);
|
223 |
|
|
|
224 |
|
|
case CONST_INT:
|
225 |
|
|
if (mode == QImode || mode == HImode)
|
226 |
|
|
return true;
|
227 |
|
|
if (reload_in_progress || reload_completed)
|
228 |
|
|
return alpha_legitimate_constant_p (mode, op);
|
229 |
|
|
return add_operand (op, mode);
|
230 |
|
|
|
231 |
|
|
default:
|
232 |
|
|
gcc_unreachable ();
|
233 |
|
|
}
|
234 |
|
|
return 0;
|
235 |
|
|
})
|
236 |
|
|
|
237 |
|
|
;; Return 1 if OP is a SYMBOL_REF for a function known to be in this
|
238 |
|
|
;; file, and in the same section as the current function.
|
239 |
|
|
|
240 |
|
|
(define_predicate "samegp_function_operand"
|
241 |
|
|
(match_code "symbol_ref")
|
242 |
|
|
{
|
243 |
|
|
/* Easy test for recursion. */
|
244 |
|
|
if (op == XEXP (DECL_RTL (current_function_decl), 0))
|
245 |
|
|
return true;
|
246 |
|
|
|
247 |
|
|
/* Functions that are not local can be overridden, and thus may
|
248 |
|
|
not share the same gp. */
|
249 |
|
|
if (! SYMBOL_REF_LOCAL_P (op))
|
250 |
|
|
return false;
|
251 |
|
|
|
252 |
|
|
/* If -msmall-data is in effect, assume that there is only one GP
|
253 |
|
|
for the module, and so any local symbol has this property. We
|
254 |
|
|
need explicit relocations to be able to enforce this for symbols
|
255 |
|
|
not defined in this unit of translation, however. */
|
256 |
|
|
if (TARGET_EXPLICIT_RELOCS && TARGET_SMALL_DATA)
|
257 |
|
|
return true;
|
258 |
|
|
|
259 |
|
|
/* Functions that are not external are defined in this UoT,
|
260 |
|
|
and thus must share the same gp. */
|
261 |
|
|
return ! SYMBOL_REF_EXTERNAL_P (op);
|
262 |
|
|
})
|
263 |
|
|
|
264 |
|
|
;; Return 1 if OP is a SYMBOL_REF for which we can make a call via bsr.
|
265 |
|
|
(define_predicate "direct_call_operand"
|
266 |
|
|
(match_operand 0 "samegp_function_operand")
|
267 |
|
|
{
|
268 |
|
|
/* If profiling is implemented via linker tricks, we can't jump
|
269 |
|
|
to the nogp alternate entry point. Note that crtl->profile
|
270 |
|
|
would not be correct, since that doesn't indicate if the target
|
271 |
|
|
function uses profiling. */
|
272 |
|
|
/* ??? TARGET_PROFILING_NEEDS_GP isn't really the right test,
|
273 |
|
|
but is approximately correct for the OSF ABIs. Don't know
|
274 |
|
|
what to do for VMS, NT, or UMK. */
|
275 |
|
|
if (!TARGET_PROFILING_NEEDS_GP && profile_flag)
|
276 |
|
|
return false;
|
277 |
|
|
|
278 |
|
|
/* Must be a function. In some cases folks create thunks in static
|
279 |
|
|
data structures and then make calls to them. If we allow the
|
280 |
|
|
direct call, we'll get an error from the linker about !samegp reloc
|
281 |
|
|
against a symbol without a .prologue directive. */
|
282 |
|
|
if (!SYMBOL_REF_FUNCTION_P (op))
|
283 |
|
|
return false;
|
284 |
|
|
|
285 |
|
|
/* Must be "near" so that the branch is assumed to reach. With
|
286 |
|
|
-msmall-text, this is assumed true of all local symbols. Since
|
287 |
|
|
we've already checked samegp, locality is already assured. */
|
288 |
|
|
if (TARGET_SMALL_TEXT)
|
289 |
|
|
return true;
|
290 |
|
|
|
291 |
|
|
return false;
|
292 |
|
|
})
|
293 |
|
|
|
294 |
|
|
;; Return 1 if OP is a valid operand for the MEM of a CALL insn.
|
295 |
|
|
;;
|
296 |
|
|
;; For TARGET_ABI_OSF, we want to restrict to R27 or a pseudo.
|
297 |
|
|
|
298 |
|
|
(define_predicate "call_operand"
|
299 |
|
|
(ior (match_code "symbol_ref")
|
300 |
|
|
(and (match_code "reg")
|
301 |
|
|
(ior (match_test "!TARGET_ABI_OSF")
|
302 |
|
|
(match_test "!HARD_REGISTER_P (op)")
|
303 |
|
|
(match_test "REGNO (op) == R27_REG")))))
|
304 |
|
|
|
305 |
|
|
;; Return true if OP is a LABEL_REF, or SYMBOL_REF or CONST referencing
|
306 |
|
|
;; a (non-tls) variable known to be defined in this file.
|
307 |
|
|
(define_predicate "local_symbolic_operand"
|
308 |
|
|
(match_code "label_ref,const,symbol_ref")
|
309 |
|
|
{
|
310 |
|
|
if (GET_CODE (op) == CONST
|
311 |
|
|
&& GET_CODE (XEXP (op, 0)) == PLUS
|
312 |
|
|
&& CONST_INT_P (XEXP (XEXP (op, 0), 1)))
|
313 |
|
|
op = XEXP (XEXP (op, 0), 0);
|
314 |
|
|
|
315 |
|
|
if (GET_CODE (op) == LABEL_REF)
|
316 |
|
|
return 1;
|
317 |
|
|
|
318 |
|
|
if (GET_CODE (op) != SYMBOL_REF)
|
319 |
|
|
return 0;
|
320 |
|
|
|
321 |
|
|
return (SYMBOL_REF_LOCAL_P (op)
|
322 |
|
|
&& !SYMBOL_REF_WEAK (op)
|
323 |
|
|
&& !SYMBOL_REF_TLS_MODEL (op));
|
324 |
|
|
})
|
325 |
|
|
|
326 |
|
|
;; Return true if OP is a SYMBOL_REF or CONST referencing a variable
|
327 |
|
|
;; known to be defined in this file in the small data area.
|
328 |
|
|
(define_predicate "small_symbolic_operand"
|
329 |
|
|
(match_code "const,symbol_ref")
|
330 |
|
|
{
|
331 |
|
|
if (! TARGET_SMALL_DATA)
|
332 |
|
|
return 0;
|
333 |
|
|
|
334 |
|
|
if (GET_CODE (op) == CONST
|
335 |
|
|
&& GET_CODE (XEXP (op, 0)) == PLUS
|
336 |
|
|
&& CONST_INT_P (XEXP (XEXP (op, 0), 1)))
|
337 |
|
|
op = XEXP (XEXP (op, 0), 0);
|
338 |
|
|
|
339 |
|
|
if (GET_CODE (op) != SYMBOL_REF)
|
340 |
|
|
return 0;
|
341 |
|
|
|
342 |
|
|
/* ??? There's no encode_section_info equivalent for the rtl
|
343 |
|
|
constant pool, so SYMBOL_FLAG_SMALL never gets set. */
|
344 |
|
|
if (CONSTANT_POOL_ADDRESS_P (op))
|
345 |
|
|
return GET_MODE_SIZE (get_pool_mode (op)) <= g_switch_value;
|
346 |
|
|
|
347 |
|
|
return (SYMBOL_REF_LOCAL_P (op)
|
348 |
|
|
&& SYMBOL_REF_SMALL_P (op)
|
349 |
|
|
&& !SYMBOL_REF_WEAK (op)
|
350 |
|
|
&& !SYMBOL_REF_TLS_MODEL (op));
|
351 |
|
|
})
|
352 |
|
|
|
353 |
|
|
;; Return true if OP is a SYMBOL_REF or CONST referencing a variable
|
354 |
|
|
;; not known (or known not) to be defined in this file.
|
355 |
|
|
(define_predicate "global_symbolic_operand"
|
356 |
|
|
(match_code "const,symbol_ref")
|
357 |
|
|
{
|
358 |
|
|
if (GET_CODE (op) == CONST
|
359 |
|
|
&& GET_CODE (XEXP (op, 0)) == PLUS
|
360 |
|
|
&& CONST_INT_P (XEXP (XEXP (op, 0), 1)))
|
361 |
|
|
op = XEXP (XEXP (op, 0), 0);
|
362 |
|
|
|
363 |
|
|
if (GET_CODE (op) != SYMBOL_REF)
|
364 |
|
|
return 0;
|
365 |
|
|
|
366 |
|
|
return ((!SYMBOL_REF_LOCAL_P (op) || SYMBOL_REF_WEAK (op))
|
367 |
|
|
&& !SYMBOL_REF_TLS_MODEL (op));
|
368 |
|
|
})
|
369 |
|
|
|
370 |
|
|
;; Returns 1 if OP is a symbolic operand, i.e. a symbol_ref or a label_ref,
|
371 |
|
|
;; possibly with an offset.
|
372 |
|
|
(define_predicate "symbolic_operand"
|
373 |
|
|
(ior (match_code "symbol_ref,label_ref")
|
374 |
|
|
(and (match_code "const")
|
375 |
|
|
(match_test "GET_CODE (XEXP (op,0)) == PLUS
|
376 |
|
|
&& (GET_CODE (XEXP (XEXP (op,0), 0)) == SYMBOL_REF
|
377 |
|
|
|| GET_CODE (XEXP (XEXP (op,0), 0)) == LABEL_REF)
|
378 |
|
|
&& CONST_INT_P (XEXP (XEXP (op,0), 1))"))))
|
379 |
|
|
|
380 |
|
|
;; Return true if OP is valid for 16-bit DTP relative relocations.
|
381 |
|
|
(define_predicate "dtp16_symbolic_operand"
|
382 |
|
|
(and (match_code "const")
|
383 |
|
|
(match_test "tls_symbolic_operand_1 (op, 16, UNSPEC_DTPREL)")))
|
384 |
|
|
|
385 |
|
|
;; Return true if OP is valid for 32-bit DTP relative relocations.
|
386 |
|
|
(define_predicate "dtp32_symbolic_operand"
|
387 |
|
|
(and (match_code "const")
|
388 |
|
|
(match_test "tls_symbolic_operand_1 (op, 32, UNSPEC_DTPREL)")))
|
389 |
|
|
|
390 |
|
|
;; Return true if OP is valid for 64-bit DTP relative relocations.
|
391 |
|
|
(define_predicate "gotdtp_symbolic_operand"
|
392 |
|
|
(and (match_code "const")
|
393 |
|
|
(match_test "tls_symbolic_operand_1 (op, 64, UNSPEC_DTPREL)")))
|
394 |
|
|
|
395 |
|
|
;; Return true if OP is valid for 16-bit TP relative relocations.
|
396 |
|
|
(define_predicate "tp16_symbolic_operand"
|
397 |
|
|
(and (match_code "const")
|
398 |
|
|
(match_test "tls_symbolic_operand_1 (op, 16, UNSPEC_TPREL)")))
|
399 |
|
|
|
400 |
|
|
;; Return true if OP is valid for 32-bit TP relative relocations.
|
401 |
|
|
(define_predicate "tp32_symbolic_operand"
|
402 |
|
|
(and (match_code "const")
|
403 |
|
|
(match_test "tls_symbolic_operand_1 (op, 32, UNSPEC_TPREL)")))
|
404 |
|
|
|
405 |
|
|
;; Return true if OP is valid for 64-bit TP relative relocations.
|
406 |
|
|
(define_predicate "gottp_symbolic_operand"
|
407 |
|
|
(and (match_code "const")
|
408 |
|
|
(match_test "tls_symbolic_operand_1 (op, 64, UNSPEC_TPREL)")))
|
409 |
|
|
|
410 |
|
|
;; Return 1 if this memory address is a known aligned register plus
|
411 |
|
|
;; a constant. It must be a valid address. This means that we can do
|
412 |
|
|
;; this as an aligned reference plus some offset.
|
413 |
|
|
;;
|
414 |
|
|
;; Take into account what reload will do. Oh god this is awful.
|
415 |
|
|
;; The horrible comma-operator construct below is to prevent genrecog
|
416 |
|
|
;; from thinking that this predicate accepts REG and SUBREG. We don't
|
417 |
|
|
;; use recog during reload, so pretending these codes are accepted
|
418 |
|
|
;; pessimizes things a tad.
|
419 |
|
|
|
420 |
|
|
(define_special_predicate "aligned_memory_operand"
|
421 |
|
|
(ior (match_test "op = resolve_reload_operand (op), 0")
|
422 |
|
|
(match_code "mem"))
|
423 |
|
|
{
|
424 |
|
|
rtx base;
|
425 |
|
|
int offset;
|
426 |
|
|
|
427 |
|
|
if (MEM_ALIGN (op) >= 32)
|
428 |
|
|
return 1;
|
429 |
|
|
|
430 |
|
|
op = XEXP (op, 0);
|
431 |
|
|
|
432 |
|
|
/* LEGITIMIZE_RELOAD_ADDRESS creates (plus (plus reg const_hi) const_lo)
|
433 |
|
|
sorts of constructs. Dig for the real base register. */
|
434 |
|
|
if (reload_in_progress
|
435 |
|
|
&& GET_CODE (op) == PLUS
|
436 |
|
|
&& GET_CODE (XEXP (op, 0)) == PLUS)
|
437 |
|
|
{
|
438 |
|
|
base = XEXP (XEXP (op, 0), 0);
|
439 |
|
|
offset = INTVAL (XEXP (op, 1));
|
440 |
|
|
}
|
441 |
|
|
else
|
442 |
|
|
{
|
443 |
|
|
if (! memory_address_p (mode, op))
|
444 |
|
|
return 0;
|
445 |
|
|
if (GET_CODE (op) == PLUS)
|
446 |
|
|
{
|
447 |
|
|
base = XEXP (op, 0);
|
448 |
|
|
offset = INTVAL (XEXP (op, 1));
|
449 |
|
|
}
|
450 |
|
|
else
|
451 |
|
|
{
|
452 |
|
|
base = op;
|
453 |
|
|
offset = 0;
|
454 |
|
|
}
|
455 |
|
|
}
|
456 |
|
|
|
457 |
|
|
if (offset % GET_MODE_SIZE (mode))
|
458 |
|
|
return 0;
|
459 |
|
|
|
460 |
|
|
return (REG_P (base) && REGNO_POINTER_ALIGN (REGNO (base)) >= 32);
|
461 |
|
|
})
|
462 |
|
|
|
463 |
|
|
;; Similar, but return 1 if OP is a MEM which is not alignable.
|
464 |
|
|
|
465 |
|
|
(define_special_predicate "unaligned_memory_operand"
|
466 |
|
|
(ior (match_test "op = resolve_reload_operand (op), 0")
|
467 |
|
|
(match_code "mem"))
|
468 |
|
|
{
|
469 |
|
|
rtx base;
|
470 |
|
|
int offset;
|
471 |
|
|
|
472 |
|
|
if (MEM_ALIGN (op) >= 32)
|
473 |
|
|
return 0;
|
474 |
|
|
|
475 |
|
|
op = XEXP (op, 0);
|
476 |
|
|
|
477 |
|
|
/* LEGITIMIZE_RELOAD_ADDRESS creates (plus (plus reg const_hi) const_lo)
|
478 |
|
|
sorts of constructs. Dig for the real base register. */
|
479 |
|
|
if (reload_in_progress
|
480 |
|
|
&& GET_CODE (op) == PLUS
|
481 |
|
|
&& GET_CODE (XEXP (op, 0)) == PLUS)
|
482 |
|
|
{
|
483 |
|
|
base = XEXP (XEXP (op, 0), 0);
|
484 |
|
|
offset = INTVAL (XEXP (op, 1));
|
485 |
|
|
}
|
486 |
|
|
else
|
487 |
|
|
{
|
488 |
|
|
if (! memory_address_p (mode, op))
|
489 |
|
|
return 0;
|
490 |
|
|
if (GET_CODE (op) == PLUS)
|
491 |
|
|
{
|
492 |
|
|
base = XEXP (op, 0);
|
493 |
|
|
offset = INTVAL (XEXP (op, 1));
|
494 |
|
|
}
|
495 |
|
|
else
|
496 |
|
|
{
|
497 |
|
|
base = op;
|
498 |
|
|
offset = 0;
|
499 |
|
|
}
|
500 |
|
|
}
|
501 |
|
|
|
502 |
|
|
if (offset % GET_MODE_SIZE (mode))
|
503 |
|
|
return 1;
|
504 |
|
|
|
505 |
|
|
return (REG_P (base) && REGNO_POINTER_ALIGN (REGNO (base)) < 32);
|
506 |
|
|
})
|
507 |
|
|
|
508 |
|
|
;; Return 1 if OP is any memory location. During reload a pseudo matches.
|
509 |
|
|
(define_special_predicate "any_memory_operand"
|
510 |
|
|
(match_code "mem,reg,subreg")
|
511 |
|
|
{
|
512 |
|
|
if (GET_CODE (op) == SUBREG)
|
513 |
|
|
op = SUBREG_REG (op);
|
514 |
|
|
|
515 |
|
|
if (MEM_P (op))
|
516 |
|
|
return true;
|
517 |
|
|
if (reload_in_progress && REG_P (op))
|
518 |
|
|
{
|
519 |
|
|
unsigned regno = REGNO (op);
|
520 |
|
|
if (HARD_REGISTER_NUM_P (regno))
|
521 |
|
|
return false;
|
522 |
|
|
else
|
523 |
|
|
return reg_renumber[regno] < 0;
|
524 |
|
|
}
|
525 |
|
|
|
526 |
|
|
return false;
|
527 |
|
|
})
|
528 |
|
|
|
529 |
|
|
;; Return 1 is OP is a memory location that is not a reference
|
530 |
|
|
;; (using an AND) to an unaligned location. Take into account
|
531 |
|
|
;; what reload will do.
|
532 |
|
|
(define_special_predicate "normal_memory_operand"
|
533 |
|
|
(ior (match_test "op = resolve_reload_operand (op), 0")
|
534 |
|
|
(and (match_code "mem")
|
535 |
|
|
(match_test "GET_CODE (XEXP (op, 0)) != AND"))))
|
536 |
|
|
|
537 |
|
|
;; Returns 1 if OP is not an eliminable register.
|
538 |
|
|
;;
|
539 |
|
|
;; This exists to cure a pathological failure in the s8addq (et al) patterns,
|
540 |
|
|
;;
|
541 |
|
|
;; long foo () { long t; bar(); return (long) &t * 26107; }
|
542 |
|
|
;;
|
543 |
|
|
;; which run afoul of a hack in reload to cure a (presumably) similar
|
544 |
|
|
;; problem with lea-type instructions on other targets. But there is
|
545 |
|
|
;; one of us and many of them, so work around the problem by selectively
|
546 |
|
|
;; preventing combine from making the optimization.
|
547 |
|
|
|
548 |
|
|
(define_predicate "reg_not_elim_operand"
|
549 |
|
|
(match_operand 0 "register_operand")
|
550 |
|
|
{
|
551 |
|
|
if (GET_CODE (op) == SUBREG)
|
552 |
|
|
op = SUBREG_REG (op);
|
553 |
|
|
return op != frame_pointer_rtx && op != arg_pointer_rtx;
|
554 |
|
|
})
|
555 |
|
|
|
556 |
|
|
;; Accept a register, but not a subreg of any kind. This allows us to
|
557 |
|
|
;; avoid pathological cases in reload wrt data movement common in
|
558 |
|
|
;; int->fp conversion. */
|
559 |
|
|
(define_predicate "reg_no_subreg_operand"
|
560 |
|
|
(and (match_code "reg")
|
561 |
|
|
(match_operand 0 "register_operand")))
|
562 |
|
|
|
563 |
|
|
;; Return 1 if OP is a valid Alpha comparison operator for "cbranch"
|
564 |
|
|
;; instructions.
|
565 |
|
|
(define_predicate "alpha_cbranch_operator"
|
566 |
|
|
(ior (match_operand 0 "ordered_comparison_operator")
|
567 |
|
|
(match_code "ordered,unordered")))
|
568 |
|
|
|
569 |
|
|
;; Return 1 if OP is a valid Alpha comparison operator for "cmp" style
|
570 |
|
|
;; instructions.
|
571 |
|
|
(define_predicate "alpha_comparison_operator"
|
572 |
|
|
(match_code "eq,le,lt,leu,ltu"))
|
573 |
|
|
|
574 |
|
|
;; Similarly, but with swapped operands.
|
575 |
|
|
(define_predicate "alpha_swapped_comparison_operator"
|
576 |
|
|
(match_code "eq,ge,gt,gtu"))
|
577 |
|
|
|
578 |
|
|
;; Return 1 if OP is a valid Alpha comparison operator against zero
|
579 |
|
|
;; for "bcc" style instructions.
|
580 |
|
|
(define_predicate "alpha_zero_comparison_operator"
|
581 |
|
|
(match_code "eq,ne,le,lt,leu,ltu"))
|
582 |
|
|
|
583 |
|
|
;; Return 1 if OP is a signed comparison operation.
|
584 |
|
|
(define_predicate "signed_comparison_operator"
|
585 |
|
|
(match_code "eq,ne,le,lt,ge,gt"))
|
586 |
|
|
|
587 |
|
|
;; Return 1 if OP is a valid Alpha floating point comparison operator.
|
588 |
|
|
(define_predicate "alpha_fp_comparison_operator"
|
589 |
|
|
(match_code "eq,le,lt,unordered"))
|
590 |
|
|
|
591 |
|
|
;; Return 1 if this is a divide or modulus operator.
|
592 |
|
|
(define_predicate "divmod_operator"
|
593 |
|
|
(match_code "div,mod,udiv,umod"))
|
594 |
|
|
|
595 |
|
|
;; Return 1 if this is a float->int conversion operator.
|
596 |
|
|
(define_predicate "fix_operator"
|
597 |
|
|
(match_code "fix,unsigned_fix"))
|
598 |
|
|
|
599 |
|
|
;; Recognize an addition operation that includes a constant. Used to
|
600 |
|
|
;; convince reload to canonize (plus (plus reg c1) c2) during register
|
601 |
|
|
;; elimination.
|
602 |
|
|
|
603 |
|
|
(define_predicate "addition_operation"
|
604 |
|
|
(and (match_code "plus")
|
605 |
|
|
(match_test "register_operand (XEXP (op, 0), mode)
|
606 |
|
|
&& satisfies_constraint_K (XEXP (op, 1))")))
|
607 |
|
|
|
608 |
|
|
;; For TARGET_EXPLICIT_RELOCS, we don't obfuscate a SYMBOL_REF to a
|
609 |
|
|
;; small symbolic operand until after reload. At which point we need
|
610 |
|
|
;; to replace (mem (symbol_ref)) with (mem (lo_sum $29 symbol_ref))
|
611 |
|
|
;; so that sched2 has the proper dependency information. */
|
612 |
|
|
(define_predicate "some_small_symbolic_operand"
|
613 |
|
|
(match_code "set,parallel,prefetch,unspec,unspec_volatile")
|
614 |
|
|
{
|
615 |
|
|
/* Avoid search unless necessary. */
|
616 |
|
|
if (!TARGET_EXPLICIT_RELOCS || !reload_completed)
|
617 |
|
|
return false;
|
618 |
|
|
return for_each_rtx (&op, some_small_symbolic_operand_int, NULL);
|
619 |
|
|
})
|
620 |
|
|
|
621 |
|
|
;; Accept a register, or a memory if BWX is enabled.
|
622 |
|
|
(define_predicate "reg_or_bwx_memory_operand"
|
623 |
|
|
(ior (match_operand 0 "register_operand")
|
624 |
|
|
(and (match_test "TARGET_BWX")
|
625 |
|
|
(match_operand 0 "memory_operand"))))
|
626 |
|
|
|
627 |
|
|
;; Accept a memory whose address is only a register.
|
628 |
|
|
(define_predicate "mem_noofs_operand"
|
629 |
|
|
(and (match_code "mem")
|
630 |
|
|
(match_code "reg" "0")))
|