| 1 |
;; Machine description for AArch64 architecture. |
| 2 |
;; Copyright (C) 2009-2025 Free Software Foundation, Inc. |
| 3 |
;; Contributed by ARM Ltd. |
| 4 |
;; |
| 5 |
;; This file is part of GCC. |
| 6 |
;; |
| 7 |
;; GCC is free software; you can redistribute it and/or modify it |
| 8 |
;; 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, but |
| 13 |
;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 |
;; 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 |
;; <http://www.gnu.org/licenses/>. |
| 20 |
|
| 21 |
(include "../arm/common.md") |
| 22 |
|
| 23 |
(define_predicate "aarch64_sysreg_string" |
| 24 |
(and (match_code "const_string") |
| 25 |
(match_test "aarch64_valid_sysreg_name_p (XSTR (op, 0))"))) |
| 26 |
|
| 27 |
(define_special_predicate "cc_register" |
| 28 |
(and (match_code "reg") |
| 29 |
(and (match_test "REGNO (op) == CC_REGNUM") |
| 30 |
(ior (match_test "mode == GET_MODE (op)") |
| 31 |
(match_test "mode == VOIDmode |
| 32 |
&& GET_MODE_CLASS (GET_MODE (op)) == MODE_CC")))) |
| 33 |
) |
| 34 |
|
| 35 |
(define_predicate "aarch64_call_insn_operand" |
| 36 |
(ior (match_code "symbol_ref") |
| 37 |
(match_operand 0 "register_operand"))) |
| 38 |
|
| 39 |
(define_predicate "aarch64_general_reg" |
| 40 |
(and (match_operand 0 "register_operand") |
| 41 |
(match_test "REGNO_REG_CLASS (REGNO (op)) == STUB_REGS |
| 42 |
|| REGNO_REG_CLASS (REGNO (op)) == GENERAL_REGS"))) |
| 43 |
|
| 44 |
;; Return true if OP a (const_int 0) operand. |
| 45 |
(define_predicate "const0_operand" |
| 46 |
(and (match_code "const_int") |
| 47 |
(match_test "op == CONST0_RTX (mode)"))) |
| 48 |
|
| 49 |
(define_predicate "const_0_to_7_operand" |
| 50 |
(and (match_code "const_int") |
| 51 |
(match_test "IN_RANGE (INTVAL (op), 0, 7)"))) |
| 52 |
|
| 53 |
(define_predicate "const_0_to_4_step_4_operand" |
| 54 |
(and (match_code "const_int") |
| 55 |
(match_test "IN_RANGE (INTVAL (op), 0, 4)") |
| 56 |
(match_test "(INTVAL (op) & 3) == 0"))) |
| 57 |
|
| 58 |
(define_predicate "const_0_to_6_step_2_operand" |
| 59 |
(and (match_code "const_int") |
| 60 |
(match_test "IN_RANGE (INTVAL (op), 0, 6)") |
| 61 |
(match_test "(INTVAL (op) & 1) == 0"))) |
| 62 |
|
| 63 |
(define_predicate "const_0_to_12_step_4_operand" |
| 64 |
(and (match_code "const_int") |
| 65 |
(match_test "IN_RANGE (INTVAL (op), 0, 12)") |
| 66 |
(match_test "(INTVAL (op) & 3) == 0"))) |
| 67 |
|
| 68 |
(define_predicate "const_0_to_14_step_2_operand" |
| 69 |
(and (match_code "const_int") |
| 70 |
(match_test "IN_RANGE (INTVAL (op), 0, 14)") |
| 71 |
(match_test "(INTVAL (op) & 1) == 0"))) |
| 72 |
|
| 73 |
(define_predicate "const_1_to_3_operand" |
| 74 |
(match_code "const_int,const_vector") |
| 75 |
{ |
| 76 |
op = unwrap_const_vec_duplicate (op); |
| 77 |
return CONST_INT_P (op) && IN_RANGE (INTVAL (op), 1, 3); |
| 78 |
}) |
| 79 |
|
| 80 |
(define_predicate "subreg_lowpart_operator" |
| 81 |
(ior (match_code "truncate") |
| 82 |
(and (match_code "subreg") |
| 83 |
(match_test "subreg_lowpart_p (op)")))) |
| 84 |
|
| 85 |
(define_predicate "aarch64_ccmp_immediate" |
| 86 |
(and (match_code "const_int") |
| 87 |
(match_test "IN_RANGE (INTVAL (op), -31, 31)"))) |
| 88 |
|
| 89 |
(define_predicate "aarch64_ccmp_operand" |
| 90 |
(ior (match_operand 0 "register_operand") |
| 91 |
(match_operand 0 "aarch64_ccmp_immediate"))) |
| 92 |
|
| 93 |
(define_predicate "aarch64_simd_register" |
| 94 |
(and (match_code "reg") |
| 95 |
(match_test "FP_REGNUM_P (REGNO (op))"))) |
| 96 |
|
| 97 |
(define_predicate "aarch64_reg_or_zero" |
| 98 |
(and (match_code "reg,subreg,const_int,const_double") |
| 99 |
(ior (match_operand 0 "register_operand") |
| 100 |
(match_test "op == CONST0_RTX (GET_MODE (op))")))) |
| 101 |
|
| 102 |
(define_predicate "aarch64_reg_or_fp_zero" |
| 103 |
(ior (match_operand 0 "register_operand") |
| 104 |
(and (match_code "const_double") |
| 105 |
(match_test "aarch64_float_const_zero_rtx_p (op)")))) |
| 106 |
|
| 107 |
(define_predicate "aarch64_reg_zero_or_fp_zero" |
| 108 |
(ior (match_operand 0 "aarch64_reg_or_fp_zero") |
| 109 |
(match_operand 0 "aarch64_reg_or_zero"))) |
| 110 |
|
| 111 |
(define_predicate "aarch64_reg_zero_or_m1_or_1" |
| 112 |
(and (match_code "reg,subreg,const_int") |
| 113 |
(ior (match_operand 0 "register_operand") |
| 114 |
(ior (match_test "op == const0_rtx") |
| 115 |
(ior (match_test "op == constm1_rtx") |
| 116 |
(match_test "op == const1_rtx")))))) |
| 117 |
|
| 118 |
(define_predicate "aarch64_reg_or_orr_imm" |
| 119 |
(ior (match_operand 0 "register_operand") |
| 120 |
(and (match_code "const_vector") |
| 121 |
(match_test "aarch64_simd_valid_orr_imm (op)")))) |
| 122 |
|
| 123 |
(define_predicate "aarch64_reg_or_and_imm" |
| 124 |
(ior (match_operand 0 "register_operand") |
| 125 |
(and (match_code "const_vector") |
| 126 |
(match_test "aarch64_simd_valid_and_imm (op)")))) |
| 127 |
|
| 128 |
(define_predicate "aarch64_reg_or_xor_imm" |
| 129 |
(ior (match_operand 0 "register_operand") |
| 130 |
(and (match_code "const_vector") |
| 131 |
(match_test "aarch64_simd_valid_xor_imm (op)")))) |
| 132 |
|
| 133 |
(define_predicate "aarch64_fp_compare_operand" |
| 134 |
(ior (match_operand 0 "register_operand") |
| 135 |
(and (match_code "const_double") |
| 136 |
(match_test "aarch64_float_const_zero_rtx_p (op)")))) |
| 137 |
|
| 138 |
(define_predicate "aarch64_fp_pow2" |
| 139 |
(and (match_code "const_double") |
| 140 |
(match_test "aarch64_fpconst_pow_of_2 (op) > 0"))) |
| 141 |
|
| 142 |
(define_predicate "aarch64_fp_pow2_recip" |
| 143 |
(and (match_code "const_double") |
| 144 |
(match_test "aarch64_fpconst_pow2_recip (op) > 0"))) |
| 145 |
|
| 146 |
(define_predicate "aarch64_fp_vec_pow2" |
| 147 |
(match_test "aarch64_vec_fpconst_pow_of_2 (op) > 0")) |
| 148 |
|
| 149 |
(define_predicate "aarch64_sve_cnt_immediate" |
| 150 |
(and (match_code "const_poly_int") |
| 151 |
(match_test "aarch64_sve_cnt_immediate_p (op)"))) |
| 152 |
|
| 153 |
(define_predicate "aarch64_sub_immediate" |
| 154 |
(and (match_code "const_int") |
| 155 |
(match_test "aarch64_uimm12_shift (-UINTVAL (op))"))) |
| 156 |
|
| 157 |
(define_predicate "aarch64_plus_immediate" |
| 158 |
(and (match_code "const_int") |
| 159 |
(ior (match_test "aarch64_uimm12_shift (INTVAL (op))") |
| 160 |
(match_test "aarch64_uimm12_shift (-UINTVAL (op))")))) |
| 161 |
|
| 162 |
(define_predicate "aarch64_plus_operand" |
| 163 |
(ior (match_operand 0 "register_operand") |
| 164 |
(match_operand 0 "aarch64_plus_immediate"))) |
| 165 |
|
| 166 |
(define_predicate "aarch64_plushi_immediate" |
| 167 |
(match_code "const_int") |
| 168 |
{ |
| 169 |
HOST_WIDE_INT val = INTVAL (op); |
| 170 |
/* The HImode value must be zero-extendable to an SImode plus_operand. */ |
| 171 |
return ((val & 0xfff) == val || sext_hwi (val & 0xf000, 16) == val); |
| 172 |
}) |
| 173 |
|
| 174 |
(define_predicate "aarch64_plushi_operand" |
| 175 |
(ior (match_operand 0 "register_operand") |
| 176 |
(match_operand 0 "aarch64_plushi_immediate"))) |
| 177 |
|
| 178 |
(define_predicate "aarch64_pluslong_immediate" |
| 179 |
(and (match_code "const_int") |
| 180 |
(match_test "IN_RANGE (INTVAL (op), -0xffffff, 0xffffff)"))) |
| 181 |
|
| 182 |
(define_predicate "aarch64_sminmax_immediate" |
| 183 |
(and (match_code "const_int") |
| 184 |
(match_test "IN_RANGE (INTVAL (op), -128, 127)"))) |
| 185 |
|
| 186 |
(define_predicate "aarch64_sminmax_operand" |
| 187 |
(ior (match_operand 0 "register_operand") |
| 188 |
(match_operand 0 "aarch64_sminmax_immediate"))) |
| 189 |
|
| 190 |
(define_predicate "aarch64_uminmax_immediate" |
| 191 |
(and (match_code "const_int") |
| 192 |
(match_test "IN_RANGE (INTVAL (op), 0, 255)"))) |
| 193 |
|
| 194 |
(define_predicate "aarch64_uminmax_operand" |
| 195 |
(ior (match_operand 0 "register_operand") |
| 196 |
(match_operand 0 "aarch64_uminmax_immediate"))) |
| 197 |
|
| 198 |
(define_predicate "aarch64_pluslong_strict_immedate" |
| 199 |
(and (match_operand 0 "aarch64_pluslong_immediate") |
| 200 |
(not (match_operand 0 "aarch64_plus_immediate")))) |
| 201 |
|
| 202 |
(define_predicate "aarch64_sve_scalar_inc_dec_immediate" |
| 203 |
(and (match_code "const_poly_int") |
| 204 |
(match_test "aarch64_sve_scalar_inc_dec_immediate_p (op)"))) |
| 205 |
|
| 206 |
(define_predicate "aarch64_sve_addvl_addpl_immediate" |
| 207 |
(and (match_code "const_poly_int") |
| 208 |
(match_test "aarch64_sve_addvl_addpl_immediate_p (op)"))) |
| 209 |
|
| 210 |
(define_predicate "aarch64_sve_plus_immediate" |
| 211 |
(ior (match_operand 0 "aarch64_sve_scalar_inc_dec_immediate") |
| 212 |
(match_operand 0 "aarch64_sve_addvl_addpl_immediate"))) |
| 213 |
|
| 214 |
(define_predicate "aarch64_split_add_offset_immediate" |
| 215 |
(and (match_code "const_poly_int") |
| 216 |
(match_test "aarch64_add_offset_temporaries (op) == 1"))) |
| 217 |
|
| 218 |
(define_predicate "aarch64_addsvl_addspl_immediate" |
| 219 |
(and (match_code "const") |
| 220 |
(match_test "aarch64_addsvl_addspl_immediate_p (op)"))) |
| 221 |
|
| 222 |
(define_predicate "aarch64_pluslong_operand" |
| 223 |
(ior (match_operand 0 "register_operand") |
| 224 |
(match_operand 0 "aarch64_pluslong_immediate") |
| 225 |
(and (match_test "TARGET_SVE") |
| 226 |
(match_operand 0 "aarch64_sve_plus_immediate")) |
| 227 |
(and (match_test "TARGET_SME") |
| 228 |
(match_operand 0 "aarch64_addsvl_addspl_immediate")))) |
| 229 |
|
| 230 |
(define_predicate "aarch64_pluslong_or_poly_operand" |
| 231 |
(ior (match_operand 0 "aarch64_pluslong_operand") |
| 232 |
(match_operand 0 "aarch64_split_add_offset_immediate"))) |
| 233 |
|
| 234 |
(define_predicate "aarch64_logical_immediate" |
| 235 |
(and (match_code "const_int") |
| 236 |
(match_test "aarch64_bitmask_imm (INTVAL (op), mode)"))) |
| 237 |
|
| 238 |
(define_predicate "aarch64_logical_operand" |
| 239 |
(ior (match_operand 0 "register_operand") |
| 240 |
(match_operand 0 "aarch64_logical_immediate"))) |
| 241 |
|
| 242 |
(define_predicate "aarch64_mov_imm_operand" |
| 243 |
(and (match_code "const_int") |
| 244 |
(match_test "aarch64_move_imm (INTVAL (op), mode)"))) |
| 245 |
|
| 246 |
(define_predicate "aarch64_logical_and_immediate" |
| 247 |
(and (match_code "const_int") |
| 248 |
(match_test "aarch64_and_bitmask_imm (INTVAL (op), mode)"))) |
| 249 |
|
| 250 |
(define_predicate "aarch64_shift_imm_si" |
| 251 |
(and (match_code "const_int") |
| 252 |
(match_test "(unsigned HOST_WIDE_INT) INTVAL (op) < 32"))) |
| 253 |
|
| 254 |
(define_predicate "aarch64_shift_imm_di" |
| 255 |
(and (match_code "const_int") |
| 256 |
(match_test "(unsigned HOST_WIDE_INT) INTVAL (op) < 64"))) |
| 257 |
|
| 258 |
(define_predicate "aarch64_shift_imm64_di" |
| 259 |
(and (match_code "const_int") |
| 260 |
(match_test "(unsigned HOST_WIDE_INT) INTVAL (op) <= 64"))) |
| 261 |
|
| 262 |
(define_predicate "aarch64_reg_or_shift_imm_si" |
| 263 |
(ior (match_operand 0 "register_operand") |
| 264 |
(match_operand 0 "aarch64_shift_imm_si"))) |
| 265 |
|
| 266 |
(define_predicate "aarch64_reg_or_shift_imm_di" |
| 267 |
(ior (match_operand 0 "register_operand") |
| 268 |
(match_operand 0 "aarch64_shift_imm_di"))) |
| 269 |
|
| 270 |
;; The imm3 field is a 3-bit field that only accepts immediates in the |
| 271 |
;; range 0..4. |
| 272 |
(define_predicate "aarch64_imm3" |
| 273 |
(and (match_code "const_int") |
| 274 |
(match_test "(unsigned HOST_WIDE_INT) INTVAL (op) <= 4"))) |
| 275 |
|
| 276 |
;; The imm2 field is a 2-bit field that only accepts immediates in the |
| 277 |
;; range 0..3. |
| 278 |
(define_predicate "aarch64_imm2" |
| 279 |
(and (match_code "const_int") |
| 280 |
(match_test "UINTVAL (op) <= 3"))) |
| 281 |
|
| 282 |
;; The imm3 field is a 3-bit field that only accepts immediates in the |
| 283 |
;; range 0..7. |
| 284 |
(define_predicate "aarch64_lane_imm3" |
| 285 |
(and (match_code "const_int") |
| 286 |
(match_test "UINTVAL (op) <= 7"))) |
| 287 |
|
| 288 |
;; An immediate that fits into 24 bits. |
| 289 |
(define_predicate "aarch64_imm24" |
| 290 |
(and (match_code "const_int") |
| 291 |
(match_test "IN_RANGE (UINTVAL (op), 0, 0xffffff)"))) |
| 292 |
|
| 293 |
(define_predicate "aarch64_mem_pair_offset" |
| 294 |
(and (match_code "const_int") |
| 295 |
(match_test "aarch64_offset_7bit_signed_scaled_p (mode, INTVAL (op))"))) |
| 296 |
|
| 297 |
(define_special_predicate "aarch64_mem_pair_operator" |
| 298 |
(and |
| 299 |
(match_code "mem") |
| 300 |
(match_test "aarch64_ldpstp_operand_mode_p (GET_MODE (op))") |
| 301 |
(ior |
| 302 |
(match_test "mode == VOIDmode") |
| 303 |
(match_test "known_eq (GET_MODE_SIZE (mode), |
| 304 |
GET_MODE_SIZE (GET_MODE (op)))")))) |
| 305 |
|
| 306 |
;; Like aarch64_mem_pair_operator, but additionally check the |
| 307 |
;; address is suitable. |
| 308 |
(define_special_predicate "aarch64_mem_pair_operand" |
| 309 |
(and (match_operand 0 "aarch64_mem_pair_operator") |
| 310 |
(match_test "aarch64_legitimate_address_p (GET_MODE (op), XEXP (op, 0), |
| 311 |
false, ADDR_QUERY_LDP_STP)"))) |
| 312 |
|
| 313 |
(define_predicate "pmode_plus_operator" |
| 314 |
(and (match_code "plus") |
| 315 |
(match_test "GET_MODE (op) == Pmode"))) |
| 316 |
|
| 317 |
(define_special_predicate "aarch64_ldp_reg_operand" |
| 318 |
(and |
| 319 |
(ior |
| 320 |
(match_code "reg") |
| 321 |
(and |
| 322 |
(match_code "subreg") |
| 323 |
(match_test "REG_P (SUBREG_REG (op))"))) |
| 324 |
(match_test "aarch64_ldpstp_operand_mode_p (GET_MODE (op))") |
| 325 |
(ior |
| 326 |
(match_test "mode == VOIDmode") |
| 327 |
(match_test "known_eq (GET_MODE_SIZE (mode), |
| 328 |
GET_MODE_SIZE (GET_MODE (op)))")))) |
| 329 |
|
| 330 |
(define_special_predicate "aarch64_stp_reg_operand" |
| 331 |
(ior (match_operand 0 "aarch64_ldp_reg_operand") |
| 332 |
(and (match_code "const_int,const,const_vector,const_double") |
| 333 |
(match_test "aarch64_const_zero_rtx_p (op)") |
| 334 |
(ior |
| 335 |
(match_test "GET_MODE (op) == VOIDmode") |
| 336 |
(and |
| 337 |
(match_test "aarch64_ldpstp_operand_mode_p (GET_MODE (op))") |
| 338 |
(ior |
| 339 |
(match_test "mode == VOIDmode") |
| 340 |
(match_test "known_eq (GET_MODE_SIZE (mode), |
| 341 |
GET_MODE_SIZE (GET_MODE (op)))"))))))) |
| 342 |
|
| 343 |
;; Used for storing two 64-bit values in an AdvSIMD register using an STP |
| 344 |
;; as a 128-bit vec_concat. |
| 345 |
(define_predicate "aarch64_mem_pair_lanes_operand" |
| 346 |
(and (match_code "mem") |
| 347 |
(match_test "aarch64_legitimate_address_p (GET_MODE (op), XEXP (op, 0), |
| 348 |
false, |
| 349 |
ADDR_QUERY_LDP_STP_N)"))) |
| 350 |
|
| 351 |
(define_predicate "aarch64_reg_or_mem_pair_operand" |
| 352 |
(ior (match_operand 0 "register_operand") |
| 353 |
(match_operand 0 "aarch64_mem_pair_lanes_operand"))) |
| 354 |
|
| 355 |
(define_predicate "aarch64_prefetch_operand" |
| 356 |
(match_test "aarch64_address_valid_for_prefetch_p (op, false)")) |
| 357 |
|
| 358 |
(define_predicate "aarch64_valid_symref" |
| 359 |
(match_code "const, symbol_ref, label_ref") |
| 360 |
{ |
| 361 |
return (aarch64_classify_symbolic_expression (op) |
| 362 |
!= SYMBOL_FORCE_TO_MEM); |
| 363 |
}) |
| 364 |
|
| 365 |
(define_predicate "aarch64_tls_ie_symref" |
| 366 |
(match_code "const, symbol_ref, label_ref") |
| 367 |
{ |
| 368 |
switch (GET_CODE (op)) |
| 369 |
{ |
| 370 |
case CONST: |
| 371 |
op = XEXP (op, 0); |
| 372 |
if (GET_CODE (op) != PLUS |
| 373 |
|| GET_CODE (XEXP (op, 0)) != SYMBOL_REF |
| 374 |
|| GET_CODE (XEXP (op, 1)) != CONST_INT) |
| 375 |
return false; |
| 376 |
op = XEXP (op, 0); |
| 377 |
/* FALLTHRU */ |
| 378 |
|
| 379 |
case SYMBOL_REF: |
| 380 |
return SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_INITIAL_EXEC; |
| 381 |
|
| 382 |
default: |
| 383 |
gcc_unreachable (); |
| 384 |
} |
| 385 |
}) |
| 386 |
|
| 387 |
(define_predicate "aarch64_tls_le_symref" |
| 388 |
(match_code "const, symbol_ref, label_ref") |
| 389 |
{ |
| 390 |
switch (GET_CODE (op)) |
| 391 |
{ |
| 392 |
case CONST: |
| 393 |
op = XEXP (op, 0); |
| 394 |
if (GET_CODE (op) != PLUS |
| 395 |
|| GET_CODE (XEXP (op, 0)) != SYMBOL_REF |
| 396 |
|| GET_CODE (XEXP (op, 1)) != CONST_INT) |
| 397 |
return false; |
| 398 |
op = XEXP (op, 0); |
| 399 |
/* FALLTHRU */ |
| 400 |
|
| 401 |
case SYMBOL_REF: |
| 402 |
return SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_LOCAL_EXEC; |
| 403 |
|
| 404 |
default: |
| 405 |
gcc_unreachable (); |
| 406 |
} |
| 407 |
}) |
| 408 |
|
| 409 |
(define_predicate "aarch64_mov_operand" |
| 410 |
(and (match_code "reg,subreg,mem,const,const_int,symbol_ref,label_ref,high, |
| 411 |
const_poly_int,const_vector") |
| 412 |
(ior (match_operand 0 "register_operand") |
| 413 |
(ior (match_operand 0 "memory_operand") |
| 414 |
(match_test "aarch64_mov_operand_p (op, mode)"))))) |
| 415 |
|
| 416 |
(define_predicate "aarch64_nonmemory_operand" |
| 417 |
(and (match_code "reg,subreg,const,const_int,symbol_ref,label_ref,high, |
| 418 |
const_poly_int,const_vector") |
| 419 |
(ior (match_operand 0 "register_operand") |
| 420 |
(match_test "aarch64_mov_operand_p (op, mode)")))) |
| 421 |
|
| 422 |
(define_predicate "aarch64_movti_operand" |
| 423 |
(ior (match_operand 0 "register_operand") |
| 424 |
(match_operand 0 "memory_operand") |
| 425 |
(and (match_operand 0 "const_scalar_int_operand") |
| 426 |
(match_test "aarch64_mov128_immediate (op)")))) |
| 427 |
|
| 428 |
(define_predicate "aarch64_reg_or_imm" |
| 429 |
(ior (match_operand 0 "register_operand") |
| 430 |
(match_operand 0 "const_scalar_int_operand"))) |
| 431 |
|
| 432 |
;; True for integer comparisons and for FP comparisons other than LTGT or UNEQ. |
| 433 |
(define_special_predicate "aarch64_comparison_operator" |
| 434 |
(match_code "eq,ne,le,lt,ge,gt,geu,gtu,leu,ltu,unordered, |
| 435 |
ordered,unlt,unle,unge,ungt")) |
| 436 |
|
| 437 |
;; Same as aarch64_comparison_operator but don't ignore the mode. |
| 438 |
;; RTL SET operations require their operands source and destination have |
| 439 |
;; the same modes, so we can't ignore the modes there. See PR target/69161. |
| 440 |
(define_predicate "aarch64_comparison_operator_mode" |
| 441 |
(match_code "eq,ne,le,lt,ge,gt,geu,gtu,leu,ltu,unordered, |
| 442 |
ordered,unlt,unle,unge,ungt")) |
| 443 |
|
| 444 |
(define_special_predicate "aarch64_comparison_operation" |
| 445 |
(match_code "eq,ne,le,lt,ge,gt,geu,gtu,leu,ltu,unordered, |
| 446 |
ordered,unlt,unle,unge,ungt") |
| 447 |
{ |
| 448 |
if (XEXP (op, 1) != const0_rtx) |
| 449 |
return false; |
| 450 |
rtx op0 = XEXP (op, 0); |
| 451 |
if (!REG_P (op0) || REGNO (op0) != CC_REGNUM) |
| 452 |
return false; |
| 453 |
return aarch64_get_condition_code (op) >= 0; |
| 454 |
}) |
| 455 |
|
| 456 |
(define_special_predicate "aarch64_equality_operator" |
| 457 |
(match_code "eq,ne")) |
| 458 |
|
| 459 |
(define_special_predicate "aarch64_carry_operation" |
| 460 |
(match_code "ltu,geu") |
| 461 |
{ |
| 462 |
if (XEXP (op, 1) != const0_rtx) |
| 463 |
return false; |
| 464 |
rtx op0 = XEXP (op, 0); |
| 465 |
if (!REG_P (op0) || REGNO (op0) != CC_REGNUM) |
| 466 |
return false; |
| 467 |
machine_mode ccmode = GET_MODE (op0); |
| 468 |
if (ccmode == CC_Cmode) |
| 469 |
return GET_CODE (op) == LTU; |
| 470 |
if (ccmode == CC_ADCmode || ccmode == CCmode) |
| 471 |
return GET_CODE (op) == GEU; |
| 472 |
return false; |
| 473 |
}) |
| 474 |
|
| 475 |
; borrow is essentially the inverse of carry since the sense of the C flag |
| 476 |
; is inverted during subtraction. See the note in aarch64-modes.def. |
| 477 |
(define_special_predicate "aarch64_borrow_operation" |
| 478 |
(match_code "geu,ltu") |
| 479 |
{ |
| 480 |
if (XEXP (op, 1) != const0_rtx) |
| 481 |
return false; |
| 482 |
rtx op0 = XEXP (op, 0); |
| 483 |
if (!REG_P (op0) || REGNO (op0) != CC_REGNUM) |
| 484 |
return false; |
| 485 |
machine_mode ccmode = GET_MODE (op0); |
| 486 |
if (ccmode == CC_Cmode) |
| 487 |
return GET_CODE (op) == GEU; |
| 488 |
if (ccmode == CC_ADCmode || ccmode == CCmode) |
| 489 |
return GET_CODE (op) == LTU; |
| 490 |
return false; |
| 491 |
}) |
| 492 |
|
| 493 |
;; True if the operand is memory reference suitable for a load/store exclusive. |
| 494 |
(define_predicate "aarch64_sync_memory_operand" |
| 495 |
(and (match_operand 0 "memory_operand") |
| 496 |
(match_code "reg" "0"))) |
| 497 |
|
| 498 |
(define_predicate "aarch64_9bit_offset_memory_operand" |
| 499 |
(and (match_operand 0 "memory_operand") |
| 500 |
(ior (match_code "reg" "0") |
| 501 |
(and (match_code "plus" "0") |
| 502 |
(match_code "reg" "00") |
| 503 |
(match_code "const_int" "01")))) |
| 504 |
{ |
| 505 |
rtx mem_op = XEXP (op, 0); |
| 506 |
|
| 507 |
if (REG_P (mem_op)) |
| 508 |
return GET_MODE (mem_op) == DImode; |
| 509 |
|
| 510 |
rtx plus_op0 = XEXP (mem_op, 0); |
| 511 |
rtx plus_op1 = XEXP (mem_op, 1); |
| 512 |
|
| 513 |
if (GET_MODE (plus_op0) != DImode) |
| 514 |
return false; |
| 515 |
|
| 516 |
poly_int64 offset; |
| 517 |
if (!poly_int_rtx_p (plus_op1, &offset)) |
| 518 |
gcc_unreachable (); |
| 519 |
|
| 520 |
return aarch64_offset_9bit_signed_unscaled_p (mode, offset); |
| 521 |
}) |
| 522 |
|
| 523 |
(define_predicate "aarch64_rcpc_memory_operand" |
| 524 |
(if_then_else (match_test "TARGET_RCPC2") |
| 525 |
(match_operand 0 "aarch64_9bit_offset_memory_operand") |
| 526 |
(match_operand 0 "aarch64_sync_memory_operand"))) |
| 527 |
|
| 528 |
;; Predicates for parallel expanders based on mode. |
| 529 |
(define_special_predicate "vect_par_cnst_hi_half" |
| 530 |
(match_code "parallel") |
| 531 |
{ |
| 532 |
return aarch64_simd_check_vect_par_cnst_half (op, mode, true); |
| 533 |
}) |
| 534 |
|
| 535 |
(define_special_predicate "vect_par_cnst_lo_half" |
| 536 |
(match_code "parallel") |
| 537 |
{ |
| 538 |
return aarch64_simd_check_vect_par_cnst_half (op, mode, false); |
| 539 |
}) |
| 540 |
|
| 541 |
;; PARALLEL for a vec_select that selects all the even or all the odd |
| 542 |
;; elements of a vector of MODE. |
| 543 |
(define_special_predicate "vect_par_cnst_even_or_odd_half" |
| 544 |
(match_code "parallel") |
| 545 |
{ |
| 546 |
int nunits = XVECLEN (op, 0); |
| 547 |
if (!known_eq (GET_MODE_NUNITS (mode), nunits * 2)) |
| 548 |
return false; |
| 549 |
rtx first = XVECEXP (op, 0, 0); |
| 550 |
if (!CONST_INT_P (first)) |
| 551 |
return false; |
| 552 |
return (INTVAL (first) == 0 || INTVAL (first) == 1) |
| 553 |
&& aarch64_stepped_int_parallel_p (op, 2); |
| 554 |
}) |
| 555 |
|
| 556 |
;; PARALLEL for a vec_select that selects half the elements in a vector of |
| 557 |
;; MODE. Allows any combination of elements, as long as there's no |
| 558 |
;; duplicate entries. |
| 559 |
(define_special_predicate "vect_par_cnst_select_half" |
| 560 |
(match_code "parallel") |
| 561 |
{ |
| 562 |
return aarch64_parallel_select_half_p (mode, op); |
| 563 |
}) |
| 564 |
|
| 565 |
(define_predicate "descending_int_parallel" |
| 566 |
(match_code "parallel") |
| 567 |
{ |
| 568 |
return aarch64_stepped_int_parallel_p (op, -1); |
| 569 |
}) |
| 570 |
|
| 571 |
(define_predicate "ascending_int_parallel" |
| 572 |
(match_code "parallel") |
| 573 |
{ |
| 574 |
return aarch64_stepped_int_parallel_p (op, 1); |
| 575 |
}) |
| 576 |
|
| 577 |
(define_special_predicate "aarch64_simd_lshift_imm" |
| 578 |
(match_code "const,const_vector") |
| 579 |
{ |
| 580 |
return aarch64_simd_shift_imm_p (op, mode, true); |
| 581 |
}) |
| 582 |
|
| 583 |
(define_special_predicate "aarch64_simd_rshift_imm" |
| 584 |
(match_code "const,const_vector") |
| 585 |
{ |
| 586 |
return aarch64_simd_shift_imm_p (op, mode, false); |
| 587 |
}) |
| 588 |
|
| 589 |
(define_predicate "aarch64_simd_imm_zero" |
| 590 |
(and (match_code "const,const_vector") |
| 591 |
(match_test "op == CONST0_RTX (GET_MODE (op))"))) |
| 592 |
|
| 593 |
(define_predicate "aarch64_simd_imm_one" |
| 594 |
(and (match_code "const_vector") |
| 595 |
(match_test "op == CONST1_RTX (GET_MODE (op))"))) |
| 596 |
|
| 597 |
(define_predicate "aarch64_simd_or_scalar_imm_zero" |
| 598 |
(and (match_code "const_int,const_double,const,const_vector") |
| 599 |
(match_test "op == CONST0_RTX (GET_MODE (op))"))) |
| 600 |
|
| 601 |
(define_predicate "aarch64_simd_imm_minus_one" |
| 602 |
(and (match_code "const,const_vector") |
| 603 |
(match_test "op == CONSTM1_RTX (GET_MODE (op))"))) |
| 604 |
|
| 605 |
(define_predicate "aarch64_simd_reg_or_zero" |
| 606 |
(and (match_code "reg,subreg,const_int,const_double,const,const_vector") |
| 607 |
(ior (match_operand 0 "register_operand") |
| 608 |
(match_test "op == const0_rtx") |
| 609 |
(match_operand 0 "aarch64_simd_or_scalar_imm_zero")))) |
| 610 |
|
| 611 |
(define_predicate "aarch64_simd_reg_or_minus_one" |
| 612 |
(ior (match_operand 0 "register_operand") |
| 613 |
(match_operand 0 "aarch64_simd_imm_minus_one"))) |
| 614 |
|
| 615 |
(define_predicate "aarch64_simd_struct_operand" |
| 616 |
(and (match_code "mem") |
| 617 |
(match_test "TARGET_SIMD && aarch64_simd_mem_operand_p (op)"))) |
| 618 |
|
| 619 |
;; Like general_operand but allow only valid SIMD addressing modes. |
| 620 |
(define_predicate "aarch64_simd_general_operand" |
| 621 |
(and (match_operand 0 "general_operand") |
| 622 |
(match_test "!MEM_P (op) |
| 623 |
|| GET_CODE (XEXP (op, 0)) == POST_INC |
| 624 |
|| GET_CODE (XEXP (op, 0)) == REG"))) |
| 625 |
|
| 626 |
;; Like nonimmediate_operand but allow only valid SIMD addressing modes. |
| 627 |
(define_predicate "aarch64_simd_nonimmediate_operand" |
| 628 |
(and (match_operand 0 "nonimmediate_operand") |
| 629 |
(match_test "!MEM_P (op) |
| 630 |
|| GET_CODE (XEXP (op, 0)) == POST_INC |
| 631 |
|| GET_CODE (XEXP (op, 0)) == REG"))) |
| 632 |
|
| 633 |
;; Predicates used by the various SIMD shift operations. These |
| 634 |
;; fall in to 3 categories. |
| 635 |
;; Shifts with a range 0-(bit_size - 1) (aarch64_simd_shift_imm) |
| 636 |
;; Shifts with a range 1-bit_size (aarch64_simd_shift_imm_offset) |
| 637 |
;; Shifts with a range 0-bit_size (aarch64_simd_shift_imm_bitsize) |
| 638 |
(define_predicate "aarch64_simd_shift_imm_qi" |
| 639 |
(match_operand 0 "const_0_to_7_operand")) |
| 640 |
|
| 641 |
(define_predicate "aarch64_simd_shift_imm_hi" |
| 642 |
(and (match_code "const_int") |
| 643 |
(match_test "IN_RANGE (INTVAL (op), 0, 15)"))) |
| 644 |
|
| 645 |
(define_predicate "aarch64_simd_shift_imm_si" |
| 646 |
(and (match_code "const_int") |
| 647 |
(match_test "IN_RANGE (INTVAL (op), 0, 31)"))) |
| 648 |
|
| 649 |
(define_predicate "aarch64_simd_shift_imm_di" |
| 650 |
(and (match_code "const_int") |
| 651 |
(match_test "IN_RANGE (INTVAL (op), 0, 63)"))) |
| 652 |
|
| 653 |
(define_predicate "aarch64_simd_shift_imm_offset_qi" |
| 654 |
(and (match_code "const_int") |
| 655 |
(match_test "IN_RANGE (INTVAL (op), 1, 8)"))) |
| 656 |
|
| 657 |
(define_predicate "aarch64_simd_shift_imm_offset_hi" |
| 658 |
(and (match_code "const_int") |
| 659 |
(match_test "IN_RANGE (INTVAL (op), 1, 16)"))) |
| 660 |
|
| 661 |
(define_predicate "aarch64_simd_shift_imm_offset_si" |
| 662 |
(and (match_code "const_int") |
| 663 |
(match_test "IN_RANGE (INTVAL (op), 1, 32)"))) |
| 664 |
|
| 665 |
(define_predicate "aarch64_simd_shift_imm_offset_di" |
| 666 |
(and (match_code "const_int") |
| 667 |
(match_test "IN_RANGE (INTVAL (op), 1, 64)"))) |
| 668 |
|
| 669 |
(define_predicate "aarch64_simd_shift_imm_vec_exact_top" |
| 670 |
(and (match_code "const_vector") |
| 671 |
(match_test "aarch64_const_vec_all_same_in_range_p (op, |
| 672 |
GET_MODE_UNIT_BITSIZE (GET_MODE (op)) / 2, |
| 673 |
GET_MODE_UNIT_BITSIZE (GET_MODE (op)) / 2)"))) |
| 674 |
|
| 675 |
(define_predicate "aarch64_simd_umax_half_mode" |
| 676 |
(and (match_code "const_vector") |
| 677 |
(match_test "aarch64_const_vec_all_same_in_range_p (op, |
| 678 |
(HOST_WIDE_INT_1U |
| 679 |
<< (GET_MODE_UNIT_BITSIZE (mode) / 2)) - 1, |
| 680 |
(HOST_WIDE_INT_1U |
| 681 |
<< (GET_MODE_UNIT_BITSIZE (mode) / 2)) - 1)"))) |
| 682 |
|
| 683 |
(define_predicate "aarch64_simd_umax_quarter_mode" |
| 684 |
(and (match_code "const_vector") |
| 685 |
(match_test "aarch64_const_vec_all_same_in_range_p (op, |
| 686 |
(HOST_WIDE_INT_1U |
| 687 |
<< (GET_MODE_UNIT_BITSIZE (mode) / 4)) - 1, |
| 688 |
(HOST_WIDE_INT_1U |
| 689 |
<< (GET_MODE_UNIT_BITSIZE (mode) / 4)) - 1)"))) |
| 690 |
(define_predicate "aarch64_simd_shift_imm_vec_qi" |
| 691 |
(and (match_code "const_vector") |
| 692 |
(match_test "aarch64_const_vec_all_same_in_range_p (op, 1, 8)"))) |
| 693 |
|
| 694 |
(define_predicate "aarch64_simd_shift_imm_vec_hi" |
| 695 |
(and (match_code "const_vector") |
| 696 |
(match_test "aarch64_const_vec_all_same_in_range_p (op, 1, 16)"))) |
| 697 |
|
| 698 |
(define_predicate "aarch64_simd_shift_imm_vec_si" |
| 699 |
(and (match_code "const_vector") |
| 700 |
(match_test "aarch64_const_vec_all_same_in_range_p (op, 1, 32)"))) |
| 701 |
|
| 702 |
(define_predicate "aarch64_simd_shift_imm_vec_di" |
| 703 |
(and (match_code "const_vector") |
| 704 |
(match_test "aarch64_const_vec_all_same_in_range_p (op, 1, 64)"))) |
| 705 |
|
| 706 |
;; A constant or vector of constants that represents an integer rounding |
| 707 |
;; constant added during fixed-point arithmetic calculations |
| 708 |
(define_predicate "aarch64_int_rnd_operand" |
| 709 |
(and (match_code "const_vector,const_int,const_wide_int") |
| 710 |
(match_test "aarch64_rnd_imm_p (op)"))) |
| 711 |
|
| 712 |
(define_predicate "aarch64_simd_raddsubhn_imm_vec" |
| 713 |
(and (match_code "const_vector") |
| 714 |
(match_test "aarch64_const_vec_all_same_in_range_p (op, 1, |
| 715 |
HOST_WIDE_INT_1U |
| 716 |
<< (GET_MODE_UNIT_BITSIZE (mode) / 2 - 1))"))) |
| 717 |
|
| 718 |
(define_predicate "aarch64_simd_shll_imm_vec" |
| 719 |
(and (match_code "const_vector") |
| 720 |
(match_test "aarch64_const_vec_all_same_in_range_p (op, 0, |
| 721 |
GET_MODE_UNIT_BITSIZE (mode) / 2)"))) |
| 722 |
|
| 723 |
(define_predicate "aarch64_simd_shift_imm_bitsize_qi" |
| 724 |
(and (match_code "const_int") |
| 725 |
(match_test "IN_RANGE (INTVAL (op), 0, 8)"))) |
| 726 |
|
| 727 |
(define_predicate "aarch64_simd_shift_imm_bitsize_hi" |
| 728 |
(and (match_code "const_int") |
| 729 |
(match_test "IN_RANGE (INTVAL (op), 0, 16)"))) |
| 730 |
|
| 731 |
(define_predicate "aarch64_simd_shift_imm_bitsize_si" |
| 732 |
(and (match_code "const_int") |
| 733 |
(match_test "IN_RANGE (INTVAL (op), 0, 32)"))) |
| 734 |
|
| 735 |
(define_predicate "aarch64_simd_shift_imm_bitsize_di" |
| 736 |
(and (match_code "const_int") |
| 737 |
(match_test "IN_RANGE (INTVAL (op), 0, 64)"))) |
| 738 |
|
| 739 |
(define_predicate "aarch64_constant_pool_symref" |
| 740 |
(and (match_code "symbol_ref") |
| 741 |
(match_test "CONSTANT_POOL_ADDRESS_P (op)"))) |
| 742 |
|
| 743 |
(define_predicate "aarch64_constant_vector_operand" |
| 744 |
(match_code "const,const_vector")) |
| 745 |
|
| 746 |
(define_predicate "aarch64_sve_ld1r_operand" |
| 747 |
(and (match_operand 0 "memory_operand") |
| 748 |
(match_test "aarch64_sve_ld1r_operand_p (op)"))) |
| 749 |
|
| 750 |
(define_predicate "aarch64_sve_ld1rq_operand" |
| 751 |
(and (match_code "mem") |
| 752 |
(match_test "aarch64_sve_ld1rq_operand_p (op)"))) |
| 753 |
|
| 754 |
(define_predicate "aarch64_sve_ld1ro_operand_b" |
| 755 |
(and (match_code "mem") |
| 756 |
(match_test "aarch64_sve_ld1ro_operand_p (op, QImode)"))) |
| 757 |
|
| 758 |
(define_predicate "aarch64_sve_ld1ro_operand_h" |
| 759 |
(and (match_code "mem") |
| 760 |
(match_test "aarch64_sve_ld1ro_operand_p (op, HImode)"))) |
| 761 |
|
| 762 |
(define_predicate "aarch64_sve_ld1ro_operand_w" |
| 763 |
(and (match_code "mem") |
| 764 |
(match_test "aarch64_sve_ld1ro_operand_p (op, SImode)"))) |
| 765 |
|
| 766 |
(define_predicate "aarch64_sve_ld1ro_operand_d" |
| 767 |
(and (match_code "mem") |
| 768 |
(match_test "aarch64_sve_ld1ro_operand_p (op, DImode)"))) |
| 769 |
|
| 770 |
(define_predicate "aarch64_sve_ldff1_operand" |
| 771 |
(and (match_code "mem") |
| 772 |
(match_test "aarch64_sve_ldff1_operand_p (op)"))) |
| 773 |
|
| 774 |
(define_predicate "aarch64_sve_ldnf1_operand" |
| 775 |
(and (match_code "mem") |
| 776 |
(match_test "aarch64_sve_ldnf1_operand_p (op)"))) |
| 777 |
|
| 778 |
;; Like memory_operand, but restricted to addresses that are valid for |
| 779 |
;; SVE LDR and STR instructions. |
| 780 |
(define_predicate "aarch64_sve_ldr_operand" |
| 781 |
(and (match_code "mem") |
| 782 |
(match_test "aarch64_sve_ldr_operand_p (op)"))) |
| 783 |
|
| 784 |
(define_special_predicate "aarch64_sve_prefetch_operand" |
| 785 |
(and (match_code "reg, plus") |
| 786 |
(match_test "aarch64_sve_prefetch_operand_p (op, mode)"))) |
| 787 |
|
| 788 |
(define_predicate "aarch64_sve_nonimmediate_operand" |
| 789 |
(ior (match_operand 0 "register_operand") |
| 790 |
(match_operand 0 "aarch64_sve_ldr_operand"))) |
| 791 |
|
| 792 |
(define_predicate "aarch64_sve_general_operand" |
| 793 |
(and (match_code "reg,subreg,mem,const,const_vector") |
| 794 |
(ior (match_operand 0 "register_operand") |
| 795 |
(match_operand 0 "aarch64_sve_ldr_operand") |
| 796 |
(match_test "aarch64_mov_operand_p (op, mode)")))) |
| 797 |
|
| 798 |
(define_predicate "aarch64_sve_struct_memory_operand" |
| 799 |
(and (match_code "mem") |
| 800 |
(match_test "aarch64_sve_struct_memory_operand_p (op)"))) |
| 801 |
|
| 802 |
(define_predicate "aarch64_sve_struct_nonimmediate_operand" |
| 803 |
(ior (match_operand 0 "register_operand") |
| 804 |
(match_operand 0 "aarch64_sve_struct_memory_operand"))) |
| 805 |
|
| 806 |
;; Doesn't include immediates, since those are handled by the move |
| 807 |
;; patterns instead. |
| 808 |
(define_predicate "aarch64_sve_dup_operand" |
| 809 |
(ior (match_operand 0 "register_operand") |
| 810 |
(match_operand 0 "aarch64_sve_ld1r_operand"))) |
| 811 |
|
| 812 |
(define_predicate "aarch64_sve_ptrue_svpattern_immediate" |
| 813 |
(and (match_code "const") |
| 814 |
(match_test "aarch64_sve_ptrue_svpattern_p (op, NULL)"))) |
| 815 |
|
| 816 |
(define_predicate "aarch64_sve_arith_immediate" |
| 817 |
(and (match_code "const,const_vector") |
| 818 |
(match_test "aarch64_sve_arith_immediate_p (mode, op, false)"))) |
| 819 |
|
| 820 |
(define_predicate "aarch64_sve_sub_arith_immediate" |
| 821 |
(and (match_code "const,const_vector") |
| 822 |
(match_test "aarch64_sve_arith_immediate_p (mode, op, true)"))) |
| 823 |
|
| 824 |
(define_predicate "aarch64_sve_qadd_immediate" |
| 825 |
(and (match_code "const,const_vector") |
| 826 |
(match_test "aarch64_sve_sqadd_sqsub_immediate_p (mode, op, false)"))) |
| 827 |
|
| 828 |
(define_predicate "aarch64_sve_qsub_immediate" |
| 829 |
(and (match_code "const,const_vector") |
| 830 |
(match_test "aarch64_sve_sqadd_sqsub_immediate_p (mode, op, true)"))) |
| 831 |
|
| 832 |
(define_predicate "aarch64_sve_vector_inc_dec_immediate" |
| 833 |
(and (match_code "const,const_vector") |
| 834 |
(match_test "aarch64_sve_vector_inc_dec_immediate_p (op)"))) |
| 835 |
|
| 836 |
(define_predicate "aarch64_sve_gather_immediate_b" |
| 837 |
(and (match_code "const_int") |
| 838 |
(match_test "IN_RANGE (INTVAL (op), 0, 31)"))) |
| 839 |
|
| 840 |
(define_predicate "aarch64_sve_gather_immediate_h" |
| 841 |
(and (match_code "const_int") |
| 842 |
(match_test "IN_RANGE (INTVAL (op), 0, 62)") |
| 843 |
(match_test "(INTVAL (op) & 1) == 0"))) |
| 844 |
|
| 845 |
(define_predicate "aarch64_sve_gather_immediate_w" |
| 846 |
(and (match_code "const_int") |
| 847 |
(match_test "IN_RANGE (INTVAL (op), 0, 124)") |
| 848 |
(match_test "(INTVAL (op) & 3) == 0"))) |
| 849 |
|
| 850 |
(define_predicate "aarch64_sve_gather_immediate_d" |
| 851 |
(and (match_code "const_int") |
| 852 |
(match_test "IN_RANGE (INTVAL (op), 0, 248)") |
| 853 |
(match_test "(INTVAL (op) & 7) == 0"))) |
| 854 |
|
| 855 |
(define_predicate "aarch64_sve_uxtb_immediate" |
| 856 |
(and (match_code "const_vector") |
| 857 |
(match_test "GET_MODE_UNIT_BITSIZE (GET_MODE (op)) > 8") |
| 858 |
(match_test "aarch64_const_vec_all_same_int_p (op, 0xff)"))) |
| 859 |
|
| 860 |
(define_predicate "aarch64_sve_uxth_immediate" |
| 861 |
(and (match_code "const_vector") |
| 862 |
(match_test "GET_MODE_UNIT_BITSIZE (GET_MODE (op)) > 16") |
| 863 |
(match_test "aarch64_const_vec_all_same_int_p (op, 0xffff)"))) |
| 864 |
|
| 865 |
(define_predicate "aarch64_sve_uxtw_immediate" |
| 866 |
(and (match_code "const_vector") |
| 867 |
(match_test "GET_MODE_UNIT_BITSIZE (GET_MODE (op)) > 32") |
| 868 |
(match_test "aarch64_const_vec_all_same_int_p (op, 0xffffffff)"))) |
| 869 |
|
| 870 |
(define_predicate "aarch64_sve_uxt_immediate" |
| 871 |
(ior (match_operand 0 "aarch64_sve_uxtb_immediate") |
| 872 |
(match_operand 0 "aarch64_sve_uxth_immediate") |
| 873 |
(match_operand 0 "aarch64_sve_uxtw_immediate"))) |
| 874 |
|
| 875 |
(define_predicate "aarch64_sve_logical_immediate" |
| 876 |
(and (match_code "const,const_vector") |
| 877 |
(match_test "aarch64_sve_bitmask_immediate_p (op)"))) |
| 878 |
|
| 879 |
;; Used for SVE UMAX and UMIN. |
| 880 |
(define_predicate "aarch64_sve_vsb_immediate" |
| 881 |
(and (match_code "const_vector") |
| 882 |
(match_test "GET_MODE_INNER (GET_MODE (op)) == QImode |
| 883 |
? aarch64_const_vec_all_same_in_range_p (op, -128, 127) |
| 884 |
: aarch64_const_vec_all_same_in_range_p (op, 0, 255)"))) |
| 885 |
|
| 886 |
;; Used for SVE MUL, SMAX and SMIN. |
| 887 |
(define_predicate "aarch64_sve_vsm_immediate" |
| 888 |
(and (match_code "const,const_vector") |
| 889 |
(match_test "aarch64_const_vec_all_same_in_range_p (op, -128, 127)"))) |
| 890 |
|
| 891 |
(define_predicate "aarch64_sve_dup_immediate" |
| 892 |
(and (match_code "const,const_vector") |
| 893 |
(ior (match_test "aarch64_sve_dup_immediate_p (op)") |
| 894 |
(match_test "aarch64_float_const_representable_p (op)")))) |
| 895 |
|
| 896 |
(define_predicate "aarch64_sve_cmp_vsc_immediate" |
| 897 |
(and (match_code "const_int,const_vector") |
| 898 |
(match_test "aarch64_sve_cmp_immediate_p (op, true)"))) |
| 899 |
|
| 900 |
(define_predicate "aarch64_sve_cmp_vsd_immediate" |
| 901 |
(and (match_code "const_int,const_vector") |
| 902 |
(match_test "aarch64_sve_cmp_immediate_p (op, false)"))) |
| 903 |
|
| 904 |
(define_predicate "aarch64_sve_index_immediate" |
| 905 |
(and (match_code "const_int") |
| 906 |
(match_test "aarch64_sve_index_immediate_p (op)"))) |
| 907 |
|
| 908 |
(define_predicate "aarch64_sve_float_arith_immediate" |
| 909 |
(and (match_code "const,const_vector") |
| 910 |
(match_test "aarch64_sve_float_arith_immediate_p (op, false)"))) |
| 911 |
|
| 912 |
(define_predicate "aarch64_sve_float_negated_arith_immediate" |
| 913 |
(and (match_code "const,const_vector") |
| 914 |
(match_test "aarch64_sve_float_arith_immediate_p (op, true)"))) |
| 915 |
|
| 916 |
(define_predicate "aarch64_sve_float_arith_with_sub_immediate" |
| 917 |
(ior (match_operand 0 "aarch64_sve_float_arith_immediate") |
| 918 |
(match_operand 0 "aarch64_sve_float_negated_arith_immediate"))) |
| 919 |
|
| 920 |
(define_predicate "aarch64_sve_float_mul_immediate" |
| 921 |
(and (match_code "const,const_vector") |
| 922 |
(match_test "aarch64_sve_float_mul_immediate_p (op)"))) |
| 923 |
|
| 924 |
(define_predicate "aarch64_sve_float_maxmin_immediate" |
| 925 |
(and (match_code "const_vector") |
| 926 |
(match_test "GET_MODE_INNER (GET_MODE (op)) != BFmode") |
| 927 |
(ior (match_test "op == CONST0_RTX (GET_MODE (op))") |
| 928 |
(match_test "op == CONST1_RTX (GET_MODE (op))")))) |
| 929 |
|
| 930 |
(define_predicate "aarch64_sve_arith_operand" |
| 931 |
(ior (match_operand 0 "register_operand") |
| 932 |
(match_operand 0 "aarch64_sve_arith_immediate"))) |
| 933 |
|
| 934 |
(define_predicate "aarch64_sve_add_operand" |
| 935 |
(ior (match_operand 0 "aarch64_sve_arith_operand") |
| 936 |
(match_operand 0 "aarch64_sve_sub_arith_immediate") |
| 937 |
(match_operand 0 "aarch64_sve_vector_inc_dec_immediate"))) |
| 938 |
|
| 939 |
(define_predicate "aarch64_sve_sqadd_operand" |
| 940 |
(ior (match_operand 0 "register_operand") |
| 941 |
(match_operand 0 "aarch64_sve_qadd_immediate") |
| 942 |
(match_operand 0 "aarch64_sve_qsub_immediate"))) |
| 943 |
|
| 944 |
(define_predicate "aarch64_sve_pred_and_operand" |
| 945 |
(ior (match_operand 0 "register_operand") |
| 946 |
(match_operand 0 "aarch64_sve_uxt_immediate"))) |
| 947 |
|
| 948 |
(define_predicate "aarch64_sve_logical_operand" |
| 949 |
(ior (match_operand 0 "register_operand") |
| 950 |
(match_operand 0 "aarch64_sve_logical_immediate"))) |
| 951 |
|
| 952 |
(define_predicate "aarch64_sve_gather_offset_b" |
| 953 |
(ior (match_operand 0 "register_operand") |
| 954 |
(match_operand 0 "aarch64_sve_gather_immediate_b"))) |
| 955 |
|
| 956 |
(define_predicate "aarch64_sve_gather_offset_h" |
| 957 |
(ior (match_operand 0 "register_operand") |
| 958 |
(match_operand 0 "aarch64_sve_gather_immediate_h"))) |
| 959 |
|
| 960 |
(define_predicate "aarch64_sve_gather_offset_w" |
| 961 |
(ior (match_operand 0 "register_operand") |
| 962 |
(match_operand 0 "aarch64_sve_gather_immediate_w"))) |
| 963 |
|
| 964 |
(define_predicate "aarch64_sve_gather_offset_d" |
| 965 |
(ior (match_operand 0 "register_operand") |
| 966 |
(match_operand 0 "aarch64_sve_gather_immediate_d"))) |
| 967 |
|
| 968 |
(define_predicate "aarch64_sve_lshift_operand" |
| 969 |
(ior (match_operand 0 "register_operand") |
| 970 |
(match_operand 0 "aarch64_simd_lshift_imm"))) |
| 971 |
|
| 972 |
(define_predicate "aarch64_sve_rshift_operand" |
| 973 |
(ior (match_operand 0 "register_operand") |
| 974 |
(match_operand 0 "aarch64_simd_rshift_imm"))) |
| 975 |
|
| 976 |
(define_predicate "aarch64_sve_vsb_operand" |
| 977 |
(ior (match_operand 0 "register_operand") |
| 978 |
(match_operand 0 "aarch64_sve_vsb_immediate"))) |
| 979 |
|
| 980 |
(define_predicate "aarch64_sve_vsm_operand" |
| 981 |
(ior (match_operand 0 "register_operand") |
| 982 |
(match_operand 0 "aarch64_sve_vsm_immediate"))) |
| 983 |
|
| 984 |
(define_predicate "aarch64_sve_reg_or_dup_imm" |
| 985 |
(ior (match_operand 0 "register_operand") |
| 986 |
(match_operand 0 "aarch64_sve_dup_immediate"))) |
| 987 |
|
| 988 |
(define_predicate "aarch64_sve_cmp_vsc_operand" |
| 989 |
(ior (match_operand 0 "register_operand") |
| 990 |
(match_operand 0 "aarch64_sve_cmp_vsc_immediate"))) |
| 991 |
|
| 992 |
(define_predicate "aarch64_sve_cmp_vsd_operand" |
| 993 |
(ior (match_operand 0 "register_operand") |
| 994 |
(match_operand 0 "aarch64_sve_cmp_vsd_immediate"))) |
| 995 |
|
| 996 |
(define_predicate "aarch64_sve_index_operand" |
| 997 |
(ior (match_operand 0 "register_operand") |
| 998 |
(match_operand 0 "aarch64_sve_index_immediate"))) |
| 999 |
|
| 1000 |
(define_predicate "aarch64_sve_float_arith_operand" |
| 1001 |
(ior (match_operand 0 "register_operand") |
| 1002 |
(match_operand 0 "aarch64_sve_float_arith_immediate"))) |
| 1003 |
|
| 1004 |
(define_predicate "aarch64_sve_float_arith_with_sub_operand" |
| 1005 |
(ior (match_operand 0 "register_operand") |
| 1006 |
(match_operand 0 "aarch64_sve_float_arith_with_sub_immediate"))) |
| 1007 |
|
| 1008 |
(define_predicate "aarch64_sve_float_mul_operand" |
| 1009 |
(ior (match_operand 0 "register_operand") |
| 1010 |
(match_operand 0 "aarch64_sve_float_mul_immediate"))) |
| 1011 |
|
| 1012 |
(define_predicate "aarch64_sve_float_maxmin_operand" |
| 1013 |
(ior (match_operand 0 "register_operand") |
| 1014 |
(match_operand 0 "aarch64_sve_float_maxmin_immediate"))) |
| 1015 |
|
| 1016 |
(define_predicate "aarch64_sve_vec_perm_operand" |
| 1017 |
(ior (match_operand 0 "register_operand") |
| 1018 |
(match_operand 0 "aarch64_constant_vector_operand"))) |
| 1019 |
|
| 1020 |
(define_predicate "aarch64_sve_ptrue_flag" |
| 1021 |
(and (match_code "const_int") |
| 1022 |
(ior (match_test "INTVAL (op) == SVE_MAYBE_NOT_PTRUE") |
| 1023 |
(match_test "INTVAL (op) == SVE_KNOWN_PTRUE")))) |
| 1024 |
|
| 1025 |
(define_predicate "aarch64_sve_gp_strictness" |
| 1026 |
(and (match_code "const_int") |
| 1027 |
(ior (match_test "INTVAL (op) == SVE_RELAXED_GP") |
| 1028 |
(match_test "INTVAL (op) == SVE_STRICT_GP")))) |
| 1029 |
|
| 1030 |
(define_predicate "aarch64_gather_scale_operand_b" |
| 1031 |
(and (match_code "const_int") |
| 1032 |
(match_test "INTVAL (op) == 1"))) |
| 1033 |
|
| 1034 |
(define_predicate "aarch64_gather_scale_operand_h" |
| 1035 |
(and (match_code "const_int") |
| 1036 |
(match_test "INTVAL (op) == 1 || INTVAL (op) == 2"))) |
| 1037 |
|
| 1038 |
(define_predicate "aarch64_gather_scale_operand_w" |
| 1039 |
(and (match_code "const_int") |
| 1040 |
(match_test "INTVAL (op) == 1 || INTVAL (op) == 4"))) |
| 1041 |
|
| 1042 |
(define_predicate "aarch64_gather_scale_operand_d" |
| 1043 |
(and (match_code "const_int") |
| 1044 |
(match_test "INTVAL (op) == 1 || INTVAL (op) == 8"))) |
| 1045 |
|
| 1046 |
;; A special predicate that doesn't match a particular mode. |
| 1047 |
(define_special_predicate "aarch64_any_register_operand" |
| 1048 |
(match_code "reg")) |
| 1049 |
|
| 1050 |
(define_predicate "aarch64_sve_any_binary_operator" |
| 1051 |
(match_code "plus,minus,mult,div,udiv,smax,umax,smin,umin,and,ior,xor")) |
| 1052 |
|
| 1053 |
(define_predicate "aarch64_bytes_per_sve_vector_operand" |
| 1054 |
(and (match_code "const_int,const_poly_int") |
| 1055 |
(match_test "known_eq (wi::to_poly_wide (op, mode), |
| 1056 |
BYTES_PER_SVE_VECTOR)"))) |
| 1057 |
|
| 1058 |
(define_predicate "aarch64_memtag_tag_offset" |
| 1059 |
(and (match_code "const_int") |
| 1060 |
(match_test "IN_RANGE (INTVAL (op), 0, 15)"))) |
| 1061 |
|
| 1062 |
(define_predicate "aarch64_granule16_uimm6" |
| 1063 |
(and (match_code "const_int") |
| 1064 |
(match_test "IN_RANGE (INTVAL (op), 0, 1008) |
| 1065 |
&& !(INTVAL (op) & 0xf)"))) |
| 1066 |
|
| 1067 |
(define_predicate "aarch64_granule16_simm9" |
| 1068 |
(and (match_code "const_int") |
| 1069 |
(match_test "IN_RANGE (INTVAL (op), -4096, 4080) |
| 1070 |
&& !(INTVAL (op) & 0xf)"))) |
| 1071 |
|
| 1072 |
(define_predicate "aarch64_maskload_else_operand" |
| 1073 |
(and (match_code "const_int,const_vector") |
| 1074 |
(match_test "op == CONST0_RTX (GET_MODE (op))"))) |