| 1 |
;; Predicate definitions for HP PA-RISC. |
| 2 |
;; Copyright (C) 2005-2025 Free Software Foundation, Inc. |
| 3 |
;; |
| 4 |
;; This file is part of GCC. |
| 5 |
;; |
| 6 |
;; GCC is free software; you can redistribute it and/or modify |
| 7 |
;; it under the terms of the GNU General Public License as published by |
| 8 |
;; the Free Software Foundation; either version 3, or (at your option) |
| 9 |
;; any later version. |
| 10 |
;; |
| 11 |
;; GCC is distributed in the hope that it will be useful, |
| 12 |
;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
;; GNU General Public License for more details. |
| 15 |
;; |
| 16 |
;; You should have received a copy of the GNU General Public License |
| 17 |
;; along with GCC; see the file COPYING3. If not see |
| 18 |
;; <http://www.gnu.org/licenses/>. |
| 19 |
|
| 20 |
;; Return truth value of whether OP is an integer which fits the range |
| 21 |
;; constraining 5-bit signed immediate operands in three-address insns. |
| 22 |
|
| 23 |
(define_predicate "int5_operand" |
| 24 |
(and (match_code "const_int") |
| 25 |
(match_test "INT_5_BITS (op)"))) |
| 26 |
|
| 27 |
;; Return truth value of whether OP is an integer which fits the range |
| 28 |
;; constraining 5-bit unsigned immediate operands in three-address insns. |
| 29 |
|
| 30 |
(define_predicate "uint5_operand" |
| 31 |
(and (match_code "const_int") |
| 32 |
(match_test "INT_U5_BITS (op)"))) |
| 33 |
|
| 34 |
;; Return truth value of whether OP is an integer which fits the range |
| 35 |
;; constraining 6-bit unsigned immediate operands in three-address insns. |
| 36 |
|
| 37 |
(define_predicate "uint6_operand" |
| 38 |
(and (match_code "const_int") |
| 39 |
(match_test "INT_U6_BITS (op)"))) |
| 40 |
|
| 41 |
;; Return truth value of whether OP is an integer which fits the range |
| 42 |
;; constraining 11-bit signed immediate operands in three-address insns. |
| 43 |
|
| 44 |
(define_predicate "int11_operand" |
| 45 |
(and (match_code "const_int") |
| 46 |
(match_test "INT_11_BITS (op)"))) |
| 47 |
|
| 48 |
;; Return truth value of whether OP is an integer which fits the range |
| 49 |
;; constraining 14-bit signed immediate operands in three-address insns. |
| 50 |
|
| 51 |
(define_predicate "int14_operand" |
| 52 |
(and (match_code "const_int") |
| 53 |
(match_test "INT_14_BITS (op)"))) |
| 54 |
|
| 55 |
;; True iff OP is a const_int or const_double that will fit in 32 bits. |
| 56 |
|
| 57 |
(define_predicate "uint32_operand" |
| 58 |
(if_then_else (match_test "HOST_BITS_PER_WIDE_INT > 32") |
| 59 |
(and (match_code "const_int") |
| 60 |
(match_test "INTVAL (op) >= 0 |
| 61 |
&& INTVAL (op) < (HOST_WIDE_INT) 1 << 32")) |
| 62 |
(and (match_code "const_int,const_double") |
| 63 |
(match_test "CONST_INT_P (op) || CONST_DOUBLE_HIGH (op) == 0")))) |
| 64 |
|
| 65 |
;; True iff depi can be used to compute (reg | OP). |
| 66 |
|
| 67 |
(define_predicate "cint_ior_operand" |
| 68 |
(and (match_code "const_int") |
| 69 |
(match_test "pa_ior_mask_p (INTVAL (op))"))) |
| 70 |
|
| 71 |
;; True iff OP is CONST_INT that can be moved in one instruction |
| 72 |
;; into a general register. |
| 73 |
|
| 74 |
(define_predicate "cint_move_operand" |
| 75 |
(and (match_code "const_int") |
| 76 |
(match_test "pa_cint_ok_for_move (INTVAL (op))"))) |
| 77 |
|
| 78 |
;; True iff OP is a CONST0_RTX for MODE. |
| 79 |
|
| 80 |
(define_predicate "const_0_operand" |
| 81 |
(and (match_code "const_int,const_double") |
| 82 |
(match_test "op == CONST0_RTX (mode)"))) |
| 83 |
|
| 84 |
;; A constant integer suitable for use in a PRE_MODIFY memory reference. |
| 85 |
|
| 86 |
(define_predicate "pre_cint_operand" |
| 87 |
(and (match_code "const_int") |
| 88 |
(match_test "INTVAL (op) >= -0x2000 && INTVAL (op) < 0x10"))) |
| 89 |
|
| 90 |
;; A constant integer suitable for use in a POST_MODIFY memory reference. |
| 91 |
|
| 92 |
(define_predicate "post_cint_operand" |
| 93 |
(and (match_code "const_int") |
| 94 |
(match_test "INTVAL (op) < 0x2000 && INTVAL (op) >= -0x10"))) |
| 95 |
|
| 96 |
;; True iff depi or extru can be used to compute (reg & OP). |
| 97 |
|
| 98 |
(define_predicate "and_operand" |
| 99 |
(ior (match_operand 0 "register_operand") |
| 100 |
(and (match_code "const_int") |
| 101 |
(match_test "pa_and_mask_p (INTVAL (op))")))) |
| 102 |
|
| 103 |
;; Return truth value of whether OP can be used as an operand in a |
| 104 |
;; three operand arithmetic insn that accepts registers of mode MODE |
| 105 |
;; or 5-bit signed integers. |
| 106 |
|
| 107 |
(define_predicate "arith5_operand" |
| 108 |
(ior (match_operand 0 "register_operand") |
| 109 |
(match_operand 0 "int5_operand"))) |
| 110 |
|
| 111 |
;; Return truth value of whether OP can be used as an operand in a |
| 112 |
;; three operand arithmetic insn that accepts registers of mode MODE |
| 113 |
;; or 11-bit signed integers. |
| 114 |
|
| 115 |
(define_predicate "arith11_operand" |
| 116 |
(ior (match_operand 0 "register_operand") |
| 117 |
(match_operand 0 "int11_operand"))) |
| 118 |
|
| 119 |
;; Return truth value of whether OP can be used as an operand in a |
| 120 |
;; three operand arithmetic insn that accepts registers of mode MODE |
| 121 |
;; or 14-bit signed integers. |
| 122 |
|
| 123 |
(define_predicate "arith14_operand" |
| 124 |
(ior (match_operand 0 "register_operand") |
| 125 |
(match_operand 0 "int14_operand"))) |
| 126 |
|
| 127 |
;; Return truth value of whether OP can be used as an operand in a |
| 128 |
;; three operand arithmetic insn that accepts registers of mode MODE |
| 129 |
;; or 32-bit signed integers. |
| 130 |
|
| 131 |
(define_predicate "arith32_operand" |
| 132 |
(ior (match_operand 0 "register_operand") |
| 133 |
(match_code "const_int"))) |
| 134 |
|
| 135 |
;; Return truth value of whether OP can be used as a shift operand in |
| 136 |
;; a shift insn that accepts registers of mode MODE or 5-bit shift amounts. |
| 137 |
|
| 138 |
(define_predicate "shift5_operand" |
| 139 |
(ior (match_operand 0 "register_operand") |
| 140 |
(match_operand 0 "uint5_operand"))) |
| 141 |
|
| 142 |
;; Return truth value of whether OP can be used as a shift operand in |
| 143 |
;; a shift insn that accepts registers of mode MODE or 6-bit shift amounts. |
| 144 |
|
| 145 |
(define_predicate "shift6_operand" |
| 146 |
(ior (match_operand 0 "register_operand") |
| 147 |
(match_operand 0 "uint6_operand"))) |
| 148 |
|
| 149 |
;; True iff OP can be used as an operand in an adddi3 insn. |
| 150 |
|
| 151 |
(define_predicate "adddi3_operand" |
| 152 |
(if_then_else (match_test "TARGET_64BIT") |
| 153 |
(match_operand 0 "arith14_operand") |
| 154 |
(match_operand 0 "arith11_operand"))) |
| 155 |
|
| 156 |
;; True iff OP is valid as a base or index register in a REG+REG address. |
| 157 |
|
| 158 |
(define_predicate "borx_reg_operand" |
| 159 |
(match_code "reg") |
| 160 |
{ |
| 161 |
/* We must reject virtual registers as the only expressions that |
| 162 |
can be instantiated are REG and REG+CONST. */ |
| 163 |
if (op == virtual_incoming_args_rtx |
| 164 |
|| op == virtual_stack_vars_rtx |
| 165 |
|| op == virtual_stack_dynamic_rtx |
| 166 |
|| op == virtual_outgoing_args_rtx |
| 167 |
|| op == virtual_cfa_rtx) |
| 168 |
return false; |
| 169 |
|
| 170 |
/* While it's always safe to index off the frame pointer, it's not |
| 171 |
profitable to do so when the frame pointer is being eliminated. */ |
| 172 |
if (!reload_completed |
| 173 |
&& flag_omit_frame_pointer |
| 174 |
&& !cfun->calls_alloca |
| 175 |
&& op == frame_pointer_rtx) |
| 176 |
return false; |
| 177 |
|
| 178 |
return register_operand (op, mode); |
| 179 |
}) |
| 180 |
|
| 181 |
;; Return nonzero if OP is suitable for use in a call to a named |
| 182 |
;; function. |
| 183 |
;; |
| 184 |
;; For 2.5 try to eliminate either call_operand_address or |
| 185 |
;; function_label_operand, they perform very similar functions. |
| 186 |
|
| 187 |
(define_predicate "call_operand_address" |
| 188 |
(match_code "label_ref,symbol_ref,const_int,const_double,const,high") |
| 189 |
{ |
| 190 |
return (GET_MODE (op) == word_mode |
| 191 |
&& CONSTANT_P (op) && ! TARGET_PORTABLE_RUNTIME); |
| 192 |
}) |
| 193 |
|
| 194 |
;; True iff OP is a SImode r25 register operand. |
| 195 |
|
| 196 |
(define_predicate "r25_operand" |
| 197 |
(match_code "reg") |
| 198 |
{ |
| 199 |
return mode == SImode && REG_P (op) && REGNO (op) == 25; |
| 200 |
}) |
| 201 |
|
| 202 |
;; True iff OP is a SImode r26 register operand. |
| 203 |
|
| 204 |
(define_predicate "r26_operand" |
| 205 |
(match_code "reg") |
| 206 |
{ |
| 207 |
return mode == SImode && REG_P (op) && REGNO (op) == 26; |
| 208 |
}) |
| 209 |
|
| 210 |
;; True iff OP can be used as the divisor in a div millicode call. |
| 211 |
|
| 212 |
(define_predicate "div_operand" |
| 213 |
(match_code "reg,const_int") |
| 214 |
{ |
| 215 |
return (mode == SImode |
| 216 |
&& ((REG_P (op) && REGNO (op) == 25) |
| 217 |
|| (CONST_INT_P (op) |
| 218 |
&& INTVAL (op) > 0 && INTVAL (op) < 16 |
| 219 |
&& pa_magic_milli[INTVAL (op)]))); |
| 220 |
}) |
| 221 |
|
| 222 |
;; True iff OP is a reloading floating point register |
| 223 |
|
| 224 |
(define_predicate "fp_reg_operand" |
| 225 |
(and (match_code "reg") |
| 226 |
(match_test "reg_renumber && FP_REG_P (op)"))) |
| 227 |
|
| 228 |
;; True iff OP is a function label operand. |
| 229 |
|
| 230 |
(define_special_predicate "function_label_operand" |
| 231 |
(and (match_code "symbol_ref") |
| 232 |
(match_test "FUNCTION_NAME_P (XSTR (op, 0))"))) |
| 233 |
|
| 234 |
;; True iff OP is an indexed memory operand. |
| 235 |
|
| 236 |
(define_predicate "indexed_memory_operand" |
| 237 |
(match_code "subreg,mem") |
| 238 |
{ |
| 239 |
if (GET_MODE (op) != mode) |
| 240 |
return false; |
| 241 |
|
| 242 |
/* Before reload, a (SUBREG (MEM...)) forces reloading into a register. */ |
| 243 |
if (reload_completed && GET_CODE (op) == SUBREG) |
| 244 |
op = SUBREG_REG (op); |
| 245 |
|
| 246 |
if (! MEM_P (op)) |
| 247 |
return false; |
| 248 |
|
| 249 |
op = XEXP (op, 0); |
| 250 |
return IS_INDEX_ADDR_P (op) && memory_address_p (mode, op); |
| 251 |
}) |
| 252 |
|
| 253 |
;; True iff OP is a register plus base memory operand. |
| 254 |
|
| 255 |
(define_predicate "reg_plus_base_memory_operand" |
| 256 |
(match_code "subreg,mem") |
| 257 |
{ |
| 258 |
if (GET_MODE (op) != mode) |
| 259 |
return false; |
| 260 |
|
| 261 |
/* Before reload, a (SUBREG (MEM...)) forces reloading into a register. */ |
| 262 |
if (reload_completed && GET_CODE (op) == SUBREG) |
| 263 |
op = SUBREG_REG (op); |
| 264 |
|
| 265 |
if (! MEM_P (op)) |
| 266 |
return false; |
| 267 |
|
| 268 |
op = XEXP (op, 0); |
| 269 |
if (GET_CODE (op) != PLUS) |
| 270 |
return false; |
| 271 |
|
| 272 |
if (REG_P (XEXP (op, 0)) && REG_OK_FOR_BASE_P (XEXP (op, 0))) |
| 273 |
return GET_CODE (XEXP (op, 1)) == CONST_INT; |
| 274 |
|
| 275 |
return false; |
| 276 |
}) |
| 277 |
|
| 278 |
;; True iff OP is a base14 operand. |
| 279 |
|
| 280 |
(define_predicate "base14_operand" |
| 281 |
(match_code "const_int") |
| 282 |
{ |
| 283 |
if (!INT_14_BITS (op)) |
| 284 |
return false; |
| 285 |
|
| 286 |
/* Short displacement. */ |
| 287 |
if (INT_5_BITS (op)) |
| 288 |
return true; |
| 289 |
|
| 290 |
/* Although this may not be necessary, we require that the |
| 291 |
base value is correctly aligned for its mode as this is |
| 292 |
assumed in the instruction encoding. */ |
| 293 |
switch (mode) |
| 294 |
{ |
| 295 |
case E_BLKmode: |
| 296 |
case E_QImode: |
| 297 |
case E_HImode: |
| 298 |
return true; |
| 299 |
|
| 300 |
case E_VOIDmode: |
| 301 |
return false; |
| 302 |
|
| 303 |
default: |
| 304 |
return (INTVAL (op) & (GET_MODE_SIZE (mode) - 1)) == 0; |
| 305 |
} |
| 306 |
|
| 307 |
return false; |
| 308 |
}) |
| 309 |
|
| 310 |
;; True iff the operand OP can be used as the destination operand of |
| 311 |
;; an integer store. This also implies the operand could be used as |
| 312 |
;; the source operand of an integer load. LO_SUM DLT and indexed |
| 313 |
;; memory operands are not allowed. We accept reloading pseudos and |
| 314 |
;; other memory operands. |
| 315 |
|
| 316 |
(define_predicate "integer_store_memory_operand" |
| 317 |
(match_code "reg,mem") |
| 318 |
{ |
| 319 |
if ((lra_in_progress || reload_in_progress) |
| 320 |
&& REG_P (op) |
| 321 |
&& REGNO (op) >= FIRST_PSEUDO_REGISTER |
| 322 |
&& reg_renumber [REGNO (op)] < 0) |
| 323 |
return true; |
| 324 |
|
| 325 |
if (reg_plus_base_memory_operand (op, mode)) |
| 326 |
{ |
| 327 |
/* There is no support for handling secondary reloads of integer |
| 328 |
REG+D instructions in pa_emit_move_sequence. Further, the Q |
| 329 |
constraint is used in more than simple move instructions. So, |
| 330 |
we must return true and let reload handle the reload. */ |
| 331 |
if (lra_in_progress || reload_in_progress) |
| 332 |
return true; |
| 333 |
|
| 334 |
/* Extract CONST_INT operand. */ |
| 335 |
if (GET_CODE (op) == SUBREG) |
| 336 |
op = SUBREG_REG (op); |
| 337 |
op = XEXP (op, 0); |
| 338 |
op = REG_P (XEXP (op, 0)) ? XEXP (op, 1) : XEXP (op, 0); |
| 339 |
return base14_operand (op, mode); |
| 340 |
} |
| 341 |
|
| 342 |
if (!MEM_P (op)) |
| 343 |
return false; |
| 344 |
|
| 345 |
return ((lra_in_progress || reload_in_progress |
| 346 |
|| memory_address_p (mode, XEXP (op, 0))) |
| 347 |
&& !IS_LO_SUM_DLT_ADDR_P (XEXP (op, 0)) |
| 348 |
&& !IS_INDEX_ADDR_P (XEXP (op, 0))); |
| 349 |
}) |
| 350 |
|
| 351 |
;; True iff the operand OP can be used as the destination operand of a |
| 352 |
;; floating point store. This also implies the operand could be used as |
| 353 |
;; the source operand of a floating point load. LO_SUM DLT and indexed |
| 354 |
;; memory operands are not allowed. Symbolic operands are accepted for |
| 355 |
;; PA 2.0. We accept reloading pseudos and other memory operands. |
| 356 |
|
| 357 |
;; NOTE: The GNU ELF32 linker clobbered the least significant bit of |
| 358 |
;; the target floating-point register in PA 2.0 floating-point loads |
| 359 |
;; and stores with long displacements in ld versions prior to 2.42. |
| 360 |
;; The global pointer also was not double-word aligned. This broke |
| 361 |
;; various DPREL relocations. |
| 362 |
|
| 363 |
(define_predicate "floating_point_store_memory_operand" |
| 364 |
(match_code "reg,mem") |
| 365 |
{ |
| 366 |
if ((lra_in_progress || reload_in_progress) |
| 367 |
&& REG_P (op) |
| 368 |
&& REGNO (op) >= FIRST_PSEUDO_REGISTER |
| 369 |
&& reg_renumber [REGNO (op)] < 0) |
| 370 |
return true; |
| 371 |
|
| 372 |
if (reg_plus_base_memory_operand (op, mode)) |
| 373 |
{ |
| 374 |
/* Extract CONST_INT operand. */ |
| 375 |
if (GET_CODE (op) == SUBREG) |
| 376 |
op = SUBREG_REG (op); |
| 377 |
op = XEXP (op, 0); |
| 378 |
op = REG_P (XEXP (op, 0)) ? XEXP (op, 1) : XEXP (op, 0); |
| 379 |
return ((INT14_OK_STRICT && base14_operand (op, mode)) |
| 380 |
|| INT_5_BITS (op)); |
| 381 |
} |
| 382 |
|
| 383 |
if (!MEM_P (op)) |
| 384 |
return false; |
| 385 |
|
| 386 |
return ((lra_in_progress || reload_in_progress |
| 387 |
|| memory_address_p (mode, XEXP (op, 0))) |
| 388 |
&& (INT14_OK_STRICT || !symbolic_memory_operand (op, VOIDmode)) |
| 389 |
&& !IS_LO_SUM_DLT_ADDR_P (XEXP (op, 0)) |
| 390 |
&& !IS_INDEX_ADDR_P (XEXP (op, 0))); |
| 391 |
}) |
| 392 |
|
| 393 |
;; Return true iff OP is an integer register. |
| 394 |
|
| 395 |
(define_predicate "ireg_operand" |
| 396 |
(and (match_code "reg") |
| 397 |
(match_test "REGNO (op) > 0 && REGNO (op) < 32"))) |
| 398 |
|
| 399 |
;; Return truth value of whether OP is an integer which fits the range |
| 400 |
;; constraining immediate operands in three-address insns, or is an |
| 401 |
;; integer register. |
| 402 |
|
| 403 |
(define_predicate "ireg_or_int5_operand" |
| 404 |
(ior (match_operand 0 "ireg_operand") |
| 405 |
(match_operand 0 "int5_operand"))) |
| 406 |
|
| 407 |
;; True iff OP is a CONST_INT of the forms 0...0xxxx, 0...01...1xxxx, |
| 408 |
;; or 1...1xxxx. Such values can be the left hand side x in (x << r), |
| 409 |
;; using the zvdepi instruction. |
| 410 |
|
| 411 |
(define_predicate "lhs_lshift_cint_operand" |
| 412 |
(match_code "const_int") |
| 413 |
{ |
| 414 |
unsigned HOST_WIDE_INT x; |
| 415 |
x = INTVAL (op) >> 4; |
| 416 |
return (x & (x + 1)) == 0; |
| 417 |
}) |
| 418 |
|
| 419 |
;; True iff OP can be used in a zvdep instruction. |
| 420 |
|
| 421 |
(define_predicate "lhs_lshift_operand" |
| 422 |
(ior (match_operand 0 "register_operand") |
| 423 |
(match_operand 0 "lhs_lshift_cint_operand"))) |
| 424 |
|
| 425 |
;; Accept anything that can be used as a destination operand for a |
| 426 |
;; move instruction. We don't accept indexed memory operands since |
| 427 |
;; they are supported only for floating point stores. |
| 428 |
|
| 429 |
(define_predicate "move_dest_operand" |
| 430 |
(match_code "subreg,reg,mem") |
| 431 |
{ |
| 432 |
if (register_operand (op, mode)) |
| 433 |
return true; |
| 434 |
|
| 435 |
if (GET_MODE (op) != mode) |
| 436 |
return false; |
| 437 |
|
| 438 |
if (GET_CODE (op) == SUBREG) |
| 439 |
op = SUBREG_REG (op); |
| 440 |
|
| 441 |
if (! MEM_P (op)) |
| 442 |
return false; |
| 443 |
|
| 444 |
op = XEXP (op, 0); |
| 445 |
|
| 446 |
return (memory_address_p (mode, op) |
| 447 |
&& !IS_INDEX_ADDR_P (op) |
| 448 |
&& !IS_LO_SUM_DLT_ADDR_P (op)); |
| 449 |
}) |
| 450 |
|
| 451 |
;; Accept anything that can be used as a source operand for a move |
| 452 |
;; instruction. |
| 453 |
|
| 454 |
(define_predicate "move_src_operand" |
| 455 |
(match_code "subreg,reg,const_int,const_double,mem") |
| 456 |
{ |
| 457 |
if (register_operand (op, mode)) |
| 458 |
return true; |
| 459 |
|
| 460 |
if (op == CONST0_RTX (mode)) |
| 461 |
return true; |
| 462 |
|
| 463 |
if (CONST_INT_P (op)) |
| 464 |
return pa_cint_ok_for_move (INTVAL (op)); |
| 465 |
|
| 466 |
if (GET_MODE (op) != mode) |
| 467 |
return false; |
| 468 |
|
| 469 |
if (GET_CODE (op) == SUBREG) |
| 470 |
op = SUBREG_REG (op); |
| 471 |
|
| 472 |
if (! MEM_P (op)) |
| 473 |
return false; |
| 474 |
|
| 475 |
/* Until problems with management of the REG_POINTER flag are resolved, |
| 476 |
we need to delay creating move insns with unscaled indexed addresses |
| 477 |
until CSE is not expected. */ |
| 478 |
if (!TARGET_NO_SPACE_REGS |
| 479 |
&& !cse_not_expected |
| 480 |
&& GET_CODE (XEXP (op, 0)) == PLUS |
| 481 |
&& REG_P (XEXP (XEXP (op, 0), 0)) |
| 482 |
&& REG_P (XEXP (XEXP (op, 0), 1))) |
| 483 |
return false; |
| 484 |
|
| 485 |
return memory_address_p (mode, XEXP (op, 0)); |
| 486 |
}) |
| 487 |
|
| 488 |
;; True iff OP is a valid memory operand. |
| 489 |
|
| 490 |
(define_predicate "mem_operand" |
| 491 |
(match_code "subreg,mem") |
| 492 |
{ |
| 493 |
if (GET_CODE (op) == SUBREG) |
| 494 |
op = SUBREG_REG (op); |
| 495 |
|
| 496 |
if (! MEM_P (op)) |
| 497 |
return false; |
| 498 |
|
| 499 |
/* Until problems with management of the REG_POINTER flag are resolved, |
| 500 |
we need to delay creating move insns with unscaled indexed addresses |
| 501 |
until CSE is not expected. */ |
| 502 |
if (!TARGET_NO_SPACE_REGS |
| 503 |
&& !cse_not_expected |
| 504 |
&& GET_CODE (XEXP (op, 0)) == PLUS |
| 505 |
&& REG_P (XEXP (XEXP (op, 0), 0)) |
| 506 |
&& REG_P (XEXP (XEXP (op, 0), 1))) |
| 507 |
return false; |
| 508 |
|
| 509 |
return (memory_address_p (mode, XEXP (op, 0))); |
| 510 |
}) |
| 511 |
|
| 512 |
;; True iff OP is anything other than a hard register. |
| 513 |
|
| 514 |
(define_predicate "non_hard_reg_operand" |
| 515 |
(match_test "! (REG_P (op) && REGNO (op) < FIRST_PSEUDO_REGISTER)")) |
| 516 |
|
| 517 |
;; True iff OP is a reference to a label whose address can be loaded |
| 518 |
;; while generating PIC code. |
| 519 |
|
| 520 |
(define_predicate "pic_label_operand" |
| 521 |
(match_code "label_ref,const") |
| 522 |
{ |
| 523 |
if (!flag_pic) |
| 524 |
return false; |
| 525 |
|
| 526 |
switch (GET_CODE (op)) |
| 527 |
{ |
| 528 |
case LABEL_REF: |
| 529 |
return true; |
| 530 |
case CONST: |
| 531 |
op = XEXP (op, 0); |
| 532 |
return (GET_CODE (XEXP (op, 0)) == LABEL_REF |
| 533 |
&& CONST_INT_P (XEXP (op, 1))); |
| 534 |
default: |
| 535 |
gcc_unreachable (); |
| 536 |
} |
| 537 |
return false; |
| 538 |
}) |
| 539 |
|
| 540 |
;; True iff the operand OP lives in text space. OP is a symbolic operand. |
| 541 |
;; If so, SYMBOL_REF_FLAG, which is set by pa_encode_section_info, is true. |
| 542 |
|
| 543 |
(define_special_predicate "read_only_operand" |
| 544 |
(match_test "true") |
| 545 |
{ |
| 546 |
if (GET_CODE (op) == CONST) |
| 547 |
op = XEXP (XEXP (op, 0), 0); |
| 548 |
if (GET_CODE (op) == SYMBOL_REF) |
| 549 |
{ |
| 550 |
if (flag_pic) |
| 551 |
return SYMBOL_REF_FLAG (op) && !CONSTANT_POOL_ADDRESS_P (op); |
| 552 |
else |
| 553 |
return SYMBOL_REF_FLAG (op) || CONSTANT_POOL_ADDRESS_P (op); |
| 554 |
} |
| 555 |
return true; |
| 556 |
}) |
| 557 |
|
| 558 |
;; True iff the operand is a register operand, or a non-symbolic |
| 559 |
;; memory operand after reload. A SUBREG is not accepted since it |
| 560 |
;; will need a reload. |
| 561 |
;; |
| 562 |
;; This predicate is used for branch patterns that internally handle |
| 563 |
;; register reloading. We need to accept non-symbolic memory operands |
| 564 |
;; after reload to ensure that the pattern is still valid if reload |
| 565 |
;; didn't find a hard register for the operand. We also reject index |
| 566 |
;; and lo_sum DLT address as these are invalid for move destinations. |
| 567 |
|
| 568 |
(define_predicate "reg_before_reload_operand" |
| 569 |
(match_code "reg,mem") |
| 570 |
{ |
| 571 |
rtx op0; |
| 572 |
|
| 573 |
if (register_operand (op, mode)) |
| 574 |
return true; |
| 575 |
|
| 576 |
if (!lra_in_progress && !reload_in_progress && !reload_completed) |
| 577 |
return false; |
| 578 |
|
| 579 |
if (! MEM_P (op)) |
| 580 |
return false; |
| 581 |
|
| 582 |
op0 = XEXP (op, 0); |
| 583 |
|
| 584 |
return (memory_address_p (mode, op0) |
| 585 |
&& !IS_INDEX_ADDR_P (op0) |
| 586 |
&& !IS_LO_SUM_DLT_ADDR_P (op0) |
| 587 |
&& !symbolic_memory_operand (op, mode)); |
| 588 |
}) |
| 589 |
|
| 590 |
;; True iff OP is a register or const_0 operand for MODE. |
| 591 |
|
| 592 |
(define_predicate "reg_or_0_operand" |
| 593 |
(ior (match_operand 0 "register_operand") |
| 594 |
(match_operand 0 "const_0_operand"))) |
| 595 |
|
| 596 |
;; True iff OP is either a register, zero, or a memory operand. |
| 597 |
|
| 598 |
(define_predicate "reg_or_0_or_mem_operand" |
| 599 |
(ior (match_operand 0 "reg_or_0_operand") |
| 600 |
(match_operand 0 "mem_operand"))) |
| 601 |
|
| 602 |
;; Accept REG and any CONST_INT that can be moved in one instruction |
| 603 |
;; into a general register. |
| 604 |
|
| 605 |
(define_predicate "reg_or_cint_move_operand" |
| 606 |
(ior (match_operand 0 "register_operand") |
| 607 |
(match_operand 0 "cint_move_operand"))) |
| 608 |
|
| 609 |
;; True iff OP can be used to compute (reg | OP). |
| 610 |
|
| 611 |
(define_predicate "reg_or_cint_ior_operand" |
| 612 |
(ior (match_operand 0 "register_operand") |
| 613 |
(match_operand 0 "cint_ior_operand"))) |
| 614 |
|
| 615 |
;; Return 1 if OP is a CONST_INT with the value 2, 4, or 8. These are |
| 616 |
;; the valid constants for shadd instructions. |
| 617 |
|
| 618 |
(define_predicate "mem_shadd_operand" |
| 619 |
(and (match_code "const_int") |
| 620 |
(match_test "pa_mem_shadd_constant_p (INTVAL (op))"))) |
| 621 |
|
| 622 |
(define_predicate "shadd_operand" |
| 623 |
(and (match_code "const_int") |
| 624 |
(match_test "pa_shadd_constant_p (INTVAL (op))"))) |
| 625 |
|
| 626 |
;; Return truth value of statement that OP is a symbolic memory operand. |
| 627 |
|
| 628 |
(define_predicate "symbolic_memory_operand" |
| 629 |
(match_code "subreg,mem") |
| 630 |
{ |
| 631 |
if (GET_CODE (op) == SUBREG) |
| 632 |
op = SUBREG_REG (op); |
| 633 |
if (!MEM_P (op)) |
| 634 |
return false; |
| 635 |
op = XEXP (op, 0); |
| 636 |
if (GET_CODE (op) == LO_SUM) |
| 637 |
op = XEXP (op, 1); |
| 638 |
return pa_symbolic_expression_p (op); |
| 639 |
}) |
| 640 |
|
| 641 |
;; True iff OP is a symbolic operand. |
| 642 |
;; Note: an inline copy of this code is present in pa_secondary_reload. |
| 643 |
|
| 644 |
(define_predicate "symbolic_operand" |
| 645 |
(match_code "symbol_ref,label_ref,const") |
| 646 |
{ |
| 647 |
switch (GET_CODE (op)) |
| 648 |
{ |
| 649 |
case SYMBOL_REF: |
| 650 |
return !SYMBOL_REF_TLS_MODEL (op); |
| 651 |
case LABEL_REF: |
| 652 |
return true; |
| 653 |
case CONST: |
| 654 |
op = XEXP (op, 0); |
| 655 |
return (GET_CODE (op) == PLUS |
| 656 |
&& ((GET_CODE (XEXP (op, 0)) == SYMBOL_REF |
| 657 |
&& !SYMBOL_REF_TLS_MODEL (XEXP (op, 0))) |
| 658 |
|| GET_CODE (XEXP (op, 0)) == LABEL_REF) |
| 659 |
&& GET_CODE (XEXP (op, 1)) == CONST_INT); |
| 660 |
default: |
| 661 |
break; |
| 662 |
} |
| 663 |
return false; |
| 664 |
}) |
| 665 |
|
| 666 |
;; Return true if OP is a symbolic operand for the TLS Global Dynamic model. |
| 667 |
|
| 668 |
(define_predicate "tgd_symbolic_operand" |
| 669 |
(and (match_code "symbol_ref") |
| 670 |
(match_test "SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_GLOBAL_DYNAMIC"))) |
| 671 |
|
| 672 |
;; Return true if OP is a symbolic operand for the TLS Local Dynamic model. |
| 673 |
|
| 674 |
(define_predicate "tld_symbolic_operand" |
| 675 |
(and (match_code "symbol_ref") |
| 676 |
(match_test "SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_LOCAL_DYNAMIC"))) |
| 677 |
|
| 678 |
;; Return true if OP is a symbolic operand for the TLS Initial Exec model. |
| 679 |
|
| 680 |
(define_predicate "tie_symbolic_operand" |
| 681 |
(and (match_code "symbol_ref") |
| 682 |
(match_test "SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_INITIAL_EXEC"))) |
| 683 |
|
| 684 |
;; Return true if OP is a symbolic operand for the TLS Local Exec model. |
| 685 |
|
| 686 |
(define_predicate "tle_symbolic_operand" |
| 687 |
(and (match_code "symbol_ref") |
| 688 |
(match_test "SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_LOCAL_EXEC"))) |
| 689 |
|
| 690 |
;; True iff OP is an operator suitable for use in a double-word cmpib |
| 691 |
;; instruction. |
| 692 |
|
| 693 |
(define_predicate "cmpib_comparison_operator" |
| 694 |
(match_code "eq,ne,lt,le,leu,gt,gtu,ge")) |
| 695 |
|
| 696 |
;; True iff OP is an operator suitable for use in a movb instruction. |
| 697 |
|
| 698 |
(define_predicate "movb_comparison_operator" |
| 699 |
(match_code "eq,ne,lt,ge")) |
| 700 |
|
| 701 |
;; True iff OP is a PLUS, XOR or IOR operator. |
| 702 |
|
| 703 |
(define_predicate "plus_xor_ior_operator" |
| 704 |
(match_code "plus,xor,ior")) |