[arm][aarch64] Make no_insn issue to nothing
[gcc.git] / gcc / config / aarch64 / predicates.md
1 ;; Machine description for AArch64 architecture.
2 ;; Copyright (C) 2009-2019 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 (define_special_predicate "cc_register"
22 (and (match_code "reg")
23 (and (match_test "REGNO (op) == CC_REGNUM")
24 (ior (match_test "mode == GET_MODE (op)")
25 (match_test "mode == VOIDmode
26 && GET_MODE_CLASS (GET_MODE (op)) == MODE_CC"))))
27 )
28
29 (define_predicate "aarch64_call_insn_operand"
30 (ior (match_code "symbol_ref")
31 (match_operand 0 "register_operand")))
32
33 (define_predicate "aarch64_general_reg"
34 (and (match_operand 0 "register_operand")
35 (match_test "REGNO_REG_CLASS (REGNO (op)) == GENERAL_REGS")))
36
37 ;; Return true if OP a (const_int 0) operand.
38 (define_predicate "const0_operand"
39 (and (match_code "const_int")
40 (match_test "op == CONST0_RTX (mode)")))
41
42 (define_predicate "const_1_to_3_operand"
43 (match_code "const_int,const_vector")
44 {
45 op = unwrap_const_vec_duplicate (op);
46 return CONST_INT_P (op) && IN_RANGE (INTVAL (op), 1, 3);
47 })
48
49 (define_special_predicate "subreg_lowpart_operator"
50 (and (match_code "subreg")
51 (match_test "subreg_lowpart_p (op)")))
52
53 (define_predicate "aarch64_ccmp_immediate"
54 (and (match_code "const_int")
55 (match_test "IN_RANGE (INTVAL (op), -31, 31)")))
56
57 (define_predicate "aarch64_ccmp_operand"
58 (ior (match_operand 0 "register_operand")
59 (match_operand 0 "aarch64_ccmp_immediate")))
60
61 (define_predicate "aarch64_simd_register"
62 (and (match_code "reg")
63 (match_test "FP_REGNUM_P (REGNO (op))")))
64
65 (define_predicate "aarch64_reg_or_zero"
66 (and (match_code "reg,subreg,const_int,const_double")
67 (ior (match_operand 0 "register_operand")
68 (match_test "op == CONST0_RTX (GET_MODE (op))"))))
69
70 (define_predicate "aarch64_reg_or_fp_zero"
71 (ior (match_operand 0 "register_operand")
72 (and (match_code "const_double")
73 (match_test "aarch64_float_const_zero_rtx_p (op)"))))
74
75 (define_predicate "aarch64_reg_zero_or_fp_zero"
76 (ior (match_operand 0 "aarch64_reg_or_fp_zero")
77 (match_operand 0 "aarch64_reg_or_zero")))
78
79 (define_predicate "aarch64_reg_zero_or_m1_or_1"
80 (and (match_code "reg,subreg,const_int")
81 (ior (match_operand 0 "register_operand")
82 (ior (match_test "op == const0_rtx")
83 (ior (match_test "op == constm1_rtx")
84 (match_test "op == const1_rtx"))))))
85
86 (define_predicate "aarch64_reg_or_orr_imm"
87 (ior (match_operand 0 "register_operand")
88 (and (match_code "const_vector")
89 (match_test "aarch64_simd_valid_immediate (op, NULL,
90 AARCH64_CHECK_ORR)"))))
91
92 (define_predicate "aarch64_reg_or_bic_imm"
93 (ior (match_operand 0 "register_operand")
94 (and (match_code "const_vector")
95 (match_test "aarch64_simd_valid_immediate (op, NULL,
96 AARCH64_CHECK_BIC)"))))
97
98 (define_predicate "aarch64_fp_compare_operand"
99 (ior (match_operand 0 "register_operand")
100 (and (match_code "const_double")
101 (match_test "aarch64_float_const_zero_rtx_p (op)"))))
102
103 (define_predicate "aarch64_fp_pow2"
104 (and (match_code "const_double")
105 (match_test "aarch64_fpconst_pow_of_2 (op) > 0")))
106
107 (define_predicate "aarch64_fp_pow2_recip"
108 (and (match_code "const_double")
109 (match_test "aarch64_fpconst_pow2_recip (op) > 0")))
110
111 (define_predicate "aarch64_fp_vec_pow2"
112 (match_test "aarch64_vec_fpconst_pow_of_2 (op) > 0"))
113
114 (define_predicate "aarch64_sve_cnt_immediate"
115 (and (match_code "const_poly_int")
116 (match_test "aarch64_sve_cnt_immediate_p (op)")))
117
118 (define_predicate "aarch64_sub_immediate"
119 (and (match_code "const_int")
120 (match_test "aarch64_uimm12_shift (-INTVAL (op))")))
121
122 (define_predicate "aarch64_plus_immediate"
123 (and (match_code "const_int")
124 (ior (match_test "aarch64_uimm12_shift (INTVAL (op))")
125 (match_test "aarch64_uimm12_shift (-INTVAL (op))"))))
126
127 (define_predicate "aarch64_plus_operand"
128 (ior (match_operand 0 "register_operand")
129 (match_operand 0 "aarch64_plus_immediate")))
130
131 (define_predicate "aarch64_plushi_immediate"
132 (match_code "const_int")
133 {
134 HOST_WIDE_INT val = INTVAL (op);
135 /* The HImode value must be zero-extendable to an SImode plus_operand. */
136 return ((val & 0xfff) == val || sext_hwi (val & 0xf000, 16) == val);
137 })
138
139 (define_predicate "aarch64_plushi_operand"
140 (ior (match_operand 0 "register_operand")
141 (match_operand 0 "aarch64_plushi_immediate")))
142
143 (define_predicate "aarch64_pluslong_immediate"
144 (and (match_code "const_int")
145 (match_test "(INTVAL (op) < 0xffffff && INTVAL (op) > -0xffffff)")))
146
147 (define_predicate "aarch64_pluslong_strict_immedate"
148 (and (match_operand 0 "aarch64_pluslong_immediate")
149 (not (match_operand 0 "aarch64_plus_immediate"))))
150
151 (define_predicate "aarch64_sve_scalar_inc_dec_immediate"
152 (and (match_code "const_poly_int")
153 (match_test "aarch64_sve_scalar_inc_dec_immediate_p (op)")))
154
155 (define_predicate "aarch64_sve_addvl_addpl_immediate"
156 (and (match_code "const_poly_int")
157 (match_test "aarch64_sve_addvl_addpl_immediate_p (op)")))
158
159 (define_predicate "aarch64_sve_plus_immediate"
160 (ior (match_operand 0 "aarch64_sve_scalar_inc_dec_immediate")
161 (match_operand 0 "aarch64_sve_addvl_addpl_immediate")))
162
163 (define_predicate "aarch64_split_add_offset_immediate"
164 (and (match_code "const_poly_int")
165 (match_test "aarch64_add_offset_temporaries (op) == 1")))
166
167 (define_predicate "aarch64_pluslong_operand"
168 (ior (match_operand 0 "register_operand")
169 (match_operand 0 "aarch64_pluslong_immediate")
170 (and (match_test "TARGET_SVE")
171 (match_operand 0 "aarch64_sve_plus_immediate"))))
172
173 (define_predicate "aarch64_pluslong_or_poly_operand"
174 (ior (match_operand 0 "aarch64_pluslong_operand")
175 (match_operand 0 "aarch64_split_add_offset_immediate")))
176
177 (define_predicate "aarch64_logical_immediate"
178 (and (match_code "const_int")
179 (match_test "aarch64_bitmask_imm (INTVAL (op), mode)")))
180
181 (define_predicate "aarch64_logical_operand"
182 (ior (match_operand 0 "register_operand")
183 (match_operand 0 "aarch64_logical_immediate")))
184
185 (define_predicate "aarch64_mov_imm_operand"
186 (and (match_code "const_int")
187 (match_test "aarch64_move_imm (INTVAL (op), mode)")))
188
189 (define_predicate "aarch64_logical_and_immediate"
190 (and (match_code "const_int")
191 (match_test "aarch64_and_bitmask_imm (INTVAL (op), mode)")))
192
193 (define_predicate "aarch64_shift_imm_si"
194 (and (match_code "const_int")
195 (match_test "(unsigned HOST_WIDE_INT) INTVAL (op) < 32")))
196
197 (define_predicate "aarch64_shift_imm_di"
198 (and (match_code "const_int")
199 (match_test "(unsigned HOST_WIDE_INT) INTVAL (op) < 64")))
200
201 (define_predicate "aarch64_shift_imm64_di"
202 (and (match_code "const_int")
203 (match_test "(unsigned HOST_WIDE_INT) INTVAL (op) <= 64")))
204
205 (define_predicate "aarch64_reg_or_shift_imm_si"
206 (ior (match_operand 0 "register_operand")
207 (match_operand 0 "aarch64_shift_imm_si")))
208
209 (define_predicate "aarch64_reg_or_shift_imm_di"
210 (ior (match_operand 0 "register_operand")
211 (match_operand 0 "aarch64_shift_imm_di")))
212
213 ;; The imm3 field is a 3-bit field that only accepts immediates in the
214 ;; range 0..4.
215 (define_predicate "aarch64_imm3"
216 (and (match_code "const_int")
217 (match_test "(unsigned HOST_WIDE_INT) INTVAL (op) <= 4")))
218
219 ;; The imm2 field is a 2-bit field that only accepts immediates in the
220 ;; range 0..3.
221 (define_predicate "aarch64_imm2"
222 (and (match_code "const_int")
223 (match_test "UINTVAL (op) <= 3")))
224
225 ;; The imm3 field is a 3-bit field that only accepts immediates in the
226 ;; range 0..7.
227 (define_predicate "aarch64_lane_imm3"
228 (and (match_code "const_int")
229 (match_test "UINTVAL (op) <= 7")))
230
231 ;; An immediate that fits into 24 bits.
232 (define_predicate "aarch64_imm24"
233 (and (match_code "const_int")
234 (match_test "IN_RANGE (UINTVAL (op), 0, 0xffffff)")))
235
236 (define_predicate "aarch64_pwr_imm3"
237 (and (match_code "const_int")
238 (match_test "INTVAL (op) != 0
239 && (unsigned) exact_log2 (INTVAL (op)) <= 4")))
240
241 (define_predicate "aarch64_pwr_2_si"
242 (and (match_code "const_int")
243 (match_test "INTVAL (op) != 0
244 && (unsigned) exact_log2 (INTVAL (op)) < 32")))
245
246 (define_predicate "aarch64_pwr_2_di"
247 (and (match_code "const_int")
248 (match_test "INTVAL (op) != 0
249 && (unsigned) exact_log2 (INTVAL (op)) < 64")))
250
251 (define_predicate "aarch64_mem_pair_offset"
252 (and (match_code "const_int")
253 (match_test "aarch64_offset_7bit_signed_scaled_p (mode, INTVAL (op))")))
254
255 (define_predicate "aarch64_mem_pair_operand"
256 (and (match_code "mem")
257 (match_test "aarch64_legitimate_address_p (mode, XEXP (op, 0), false,
258 ADDR_QUERY_LDP_STP)")))
259
260 ;; Used for storing two 64-bit values in an AdvSIMD register using an STP
261 ;; as a 128-bit vec_concat.
262 (define_predicate "aarch64_mem_pair_lanes_operand"
263 (and (match_code "mem")
264 (match_test "aarch64_legitimate_address_p (GET_MODE (op), XEXP (op, 0),
265 false,
266 ADDR_QUERY_LDP_STP_N)")))
267
268 (define_predicate "aarch64_prefetch_operand"
269 (match_test "aarch64_address_valid_for_prefetch_p (op, false)"))
270
271 (define_predicate "aarch64_valid_symref"
272 (match_code "const, symbol_ref, label_ref")
273 {
274 return (aarch64_classify_symbolic_expression (op)
275 != SYMBOL_FORCE_TO_MEM);
276 })
277
278 (define_predicate "aarch64_tls_ie_symref"
279 (match_code "const, symbol_ref, label_ref")
280 {
281 switch (GET_CODE (op))
282 {
283 case CONST:
284 op = XEXP (op, 0);
285 if (GET_CODE (op) != PLUS
286 || GET_CODE (XEXP (op, 0)) != SYMBOL_REF
287 || GET_CODE (XEXP (op, 1)) != CONST_INT)
288 return false;
289 op = XEXP (op, 0);
290 /* FALLTHRU */
291
292 case SYMBOL_REF:
293 return SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_INITIAL_EXEC;
294
295 default:
296 gcc_unreachable ();
297 }
298 })
299
300 (define_predicate "aarch64_tls_le_symref"
301 (match_code "const, symbol_ref, label_ref")
302 {
303 switch (GET_CODE (op))
304 {
305 case CONST:
306 op = XEXP (op, 0);
307 if (GET_CODE (op) != PLUS
308 || GET_CODE (XEXP (op, 0)) != SYMBOL_REF
309 || GET_CODE (XEXP (op, 1)) != CONST_INT)
310 return false;
311 op = XEXP (op, 0);
312 /* FALLTHRU */
313
314 case SYMBOL_REF:
315 return SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_LOCAL_EXEC;
316
317 default:
318 gcc_unreachable ();
319 }
320 })
321
322 (define_predicate "aarch64_mov_operand"
323 (and (match_code "reg,subreg,mem,const,const_int,symbol_ref,label_ref,high,
324 const_poly_int,const_vector")
325 (ior (match_operand 0 "register_operand")
326 (ior (match_operand 0 "memory_operand")
327 (match_test "aarch64_mov_operand_p (op, mode)")))))
328
329 (define_predicate "aarch64_nonmemory_operand"
330 (and (match_code "reg,subreg,const,const_int,symbol_ref,label_ref,high,
331 const_poly_int,const_vector")
332 (ior (match_operand 0 "register_operand")
333 (match_test "aarch64_mov_operand_p (op, mode)"))))
334
335 (define_predicate "aarch64_movti_operand"
336 (ior (match_operand 0 "register_operand")
337 (match_operand 0 "memory_operand")
338 (and (match_operand 0 "const_scalar_int_operand")
339 (match_test "aarch64_mov128_immediate (op)"))))
340
341 (define_predicate "aarch64_reg_or_imm"
342 (ior (match_operand 0 "register_operand")
343 (match_operand 0 "const_scalar_int_operand")))
344
345 ;; True for integer comparisons and for FP comparisons other than LTGT or UNEQ.
346 (define_special_predicate "aarch64_comparison_operator"
347 (match_code "eq,ne,le,lt,ge,gt,geu,gtu,leu,ltu,unordered,
348 ordered,unlt,unle,unge,ungt"))
349
350 ;; Same as aarch64_comparison_operator but don't ignore the mode.
351 ;; RTL SET operations require their operands source and destination have
352 ;; the same modes, so we can't ignore the modes there. See PR target/69161.
353 (define_predicate "aarch64_comparison_operator_mode"
354 (match_code "eq,ne,le,lt,ge,gt,geu,gtu,leu,ltu,unordered,
355 ordered,unlt,unle,unge,ungt"))
356
357 (define_special_predicate "aarch64_comparison_operation"
358 (match_code "eq,ne,le,lt,ge,gt,geu,gtu,leu,ltu,unordered,
359 ordered,unlt,unle,unge,ungt")
360 {
361 if (XEXP (op, 1) != const0_rtx)
362 return false;
363 rtx op0 = XEXP (op, 0);
364 if (!REG_P (op0) || REGNO (op0) != CC_REGNUM)
365 return false;
366 return aarch64_get_condition_code (op) >= 0;
367 })
368
369 (define_special_predicate "aarch64_equality_operator"
370 (match_code "eq,ne"))
371
372 (define_special_predicate "aarch64_carry_operation"
373 (match_code "ltu,geu")
374 {
375 if (XEXP (op, 1) != const0_rtx)
376 return false;
377 rtx op0 = XEXP (op, 0);
378 if (!REG_P (op0) || REGNO (op0) != CC_REGNUM)
379 return false;
380 machine_mode ccmode = GET_MODE (op0);
381 if (ccmode == CC_Cmode)
382 return GET_CODE (op) == LTU;
383 if (ccmode == CC_ADCmode || ccmode == CCmode)
384 return GET_CODE (op) == GEU;
385 return false;
386 })
387
388 ; borrow is essentially the inverse of carry since the sense of the C flag
389 ; is inverted during subtraction. See the note in aarch64-modes.def.
390 (define_special_predicate "aarch64_borrow_operation"
391 (match_code "geu,ltu")
392 {
393 if (XEXP (op, 1) != const0_rtx)
394 return false;
395 rtx op0 = XEXP (op, 0);
396 if (!REG_P (op0) || REGNO (op0) != CC_REGNUM)
397 return false;
398 machine_mode ccmode = GET_MODE (op0);
399 if (ccmode == CC_Cmode)
400 return GET_CODE (op) == GEU;
401 if (ccmode == CC_ADCmode || ccmode == CCmode)
402 return GET_CODE (op) == LTU;
403 return false;
404 })
405
406 ;; True if the operand is memory reference suitable for a load/store exclusive.
407 (define_predicate "aarch64_sync_memory_operand"
408 (and (match_operand 0 "memory_operand")
409 (match_code "reg" "0")))
410
411 (define_predicate "aarch64_9bit_offset_memory_operand"
412 (and (match_operand 0 "memory_operand")
413 (ior (match_code "reg" "0")
414 (and (match_code "plus" "0")
415 (match_code "reg" "00")
416 (match_code "const_int" "01"))))
417 {
418 rtx mem_op = XEXP (op, 0);
419
420 if (REG_P (mem_op))
421 return GET_MODE (mem_op) == DImode;
422
423 rtx plus_op0 = XEXP (mem_op, 0);
424 rtx plus_op1 = XEXP (mem_op, 1);
425
426 if (GET_MODE (plus_op0) != DImode)
427 return false;
428
429 poly_int64 offset;
430 if (!poly_int_rtx_p (plus_op1, &offset))
431 gcc_unreachable ();
432
433 return aarch64_offset_9bit_signed_unscaled_p (mode, offset);
434 })
435
436 (define_predicate "aarch64_rcpc_memory_operand"
437 (if_then_else (match_test "AARCH64_ISA_RCPC8_4")
438 (match_operand 0 "aarch64_9bit_offset_memory_operand")
439 (match_operand 0 "aarch64_sync_memory_operand")))
440
441 ;; Predicates for parallel expanders based on mode.
442 (define_special_predicate "vect_par_cnst_hi_half"
443 (match_code "parallel")
444 {
445 return aarch64_simd_check_vect_par_cnst_half (op, mode, true);
446 })
447
448 (define_special_predicate "vect_par_cnst_lo_half"
449 (match_code "parallel")
450 {
451 return aarch64_simd_check_vect_par_cnst_half (op, mode, false);
452 })
453
454 (define_predicate "descending_int_parallel"
455 (match_code "parallel")
456 {
457 return aarch64_stepped_int_parallel_p (op, -1);
458 })
459
460 (define_special_predicate "aarch64_simd_lshift_imm"
461 (match_code "const,const_vector")
462 {
463 return aarch64_simd_shift_imm_p (op, mode, true);
464 })
465
466 (define_special_predicate "aarch64_simd_rshift_imm"
467 (match_code "const,const_vector")
468 {
469 return aarch64_simd_shift_imm_p (op, mode, false);
470 })
471
472 (define_predicate "aarch64_simd_imm_zero"
473 (and (match_code "const,const_vector")
474 (match_test "op == CONST0_RTX (GET_MODE (op))")))
475
476 (define_predicate "aarch64_simd_imm_one"
477 (and (match_code "const_vector")
478 (match_test "op == CONST1_RTX (GET_MODE (op))")))
479
480 (define_predicate "aarch64_simd_or_scalar_imm_zero"
481 (and (match_code "const_int,const_double,const,const_vector")
482 (match_test "op == CONST0_RTX (GET_MODE (op))")))
483
484 (define_predicate "aarch64_simd_imm_minus_one"
485 (and (match_code "const,const_vector")
486 (match_test "op == CONSTM1_RTX (GET_MODE (op))")))
487
488 (define_predicate "aarch64_simd_reg_or_zero"
489 (and (match_code "reg,subreg,const_int,const_double,const,const_vector")
490 (ior (match_operand 0 "register_operand")
491 (match_test "op == const0_rtx")
492 (match_operand 0 "aarch64_simd_or_scalar_imm_zero"))))
493
494 (define_predicate "aarch64_simd_struct_operand"
495 (and (match_code "mem")
496 (match_test "TARGET_SIMD && aarch64_simd_mem_operand_p (op)")))
497
498 ;; Like general_operand but allow only valid SIMD addressing modes.
499 (define_predicate "aarch64_simd_general_operand"
500 (and (match_operand 0 "general_operand")
501 (match_test "!MEM_P (op)
502 || GET_CODE (XEXP (op, 0)) == POST_INC
503 || GET_CODE (XEXP (op, 0)) == REG")))
504
505 ;; Like nonimmediate_operand but allow only valid SIMD addressing modes.
506 (define_predicate "aarch64_simd_nonimmediate_operand"
507 (and (match_operand 0 "nonimmediate_operand")
508 (match_test "!MEM_P (op)
509 || GET_CODE (XEXP (op, 0)) == POST_INC
510 || GET_CODE (XEXP (op, 0)) == REG")))
511
512 ;; Predicates used by the various SIMD shift operations. These
513 ;; fall in to 3 categories.
514 ;; Shifts with a range 0-(bit_size - 1) (aarch64_simd_shift_imm)
515 ;; Shifts with a range 1-bit_size (aarch64_simd_shift_imm_offset)
516 ;; Shifts with a range 0-bit_size (aarch64_simd_shift_imm_bitsize)
517 (define_predicate "aarch64_simd_shift_imm_qi"
518 (and (match_code "const_int")
519 (match_test "IN_RANGE (INTVAL (op), 0, 7)")))
520
521 (define_predicate "aarch64_simd_shift_imm_hi"
522 (and (match_code "const_int")
523 (match_test "IN_RANGE (INTVAL (op), 0, 15)")))
524
525 (define_predicate "aarch64_simd_shift_imm_si"
526 (and (match_code "const_int")
527 (match_test "IN_RANGE (INTVAL (op), 0, 31)")))
528
529 (define_predicate "aarch64_simd_shift_imm_di"
530 (and (match_code "const_int")
531 (match_test "IN_RANGE (INTVAL (op), 0, 63)")))
532
533 (define_predicate "aarch64_simd_shift_imm_offset_qi"
534 (and (match_code "const_int")
535 (match_test "IN_RANGE (INTVAL (op), 1, 8)")))
536
537 (define_predicate "aarch64_simd_shift_imm_offset_hi"
538 (and (match_code "const_int")
539 (match_test "IN_RANGE (INTVAL (op), 1, 16)")))
540
541 (define_predicate "aarch64_simd_shift_imm_offset_si"
542 (and (match_code "const_int")
543 (match_test "IN_RANGE (INTVAL (op), 1, 32)")))
544
545 (define_predicate "aarch64_simd_shift_imm_offset_di"
546 (and (match_code "const_int")
547 (match_test "IN_RANGE (INTVAL (op), 1, 64)")))
548
549 (define_predicate "aarch64_simd_shift_imm_bitsize_qi"
550 (and (match_code "const_int")
551 (match_test "IN_RANGE (INTVAL (op), 0, 8)")))
552
553 (define_predicate "aarch64_simd_shift_imm_bitsize_hi"
554 (and (match_code "const_int")
555 (match_test "IN_RANGE (INTVAL (op), 0, 16)")))
556
557 (define_predicate "aarch64_simd_shift_imm_bitsize_si"
558 (and (match_code "const_int")
559 (match_test "IN_RANGE (INTVAL (op), 0, 32)")))
560
561 (define_predicate "aarch64_simd_shift_imm_bitsize_di"
562 (and (match_code "const_int")
563 (match_test "IN_RANGE (INTVAL (op), 0, 64)")))
564
565 (define_predicate "aarch64_constant_pool_symref"
566 (and (match_code "symbol_ref")
567 (match_test "CONSTANT_POOL_ADDRESS_P (op)")))
568
569 (define_predicate "aarch64_constant_vector_operand"
570 (match_code "const,const_vector"))
571
572 (define_predicate "aarch64_sve_ld1r_operand"
573 (and (match_operand 0 "memory_operand")
574 (match_test "aarch64_sve_ld1r_operand_p (op)")))
575
576 (define_predicate "aarch64_sve_ld1rq_operand"
577 (and (match_code "mem")
578 (match_test "aarch64_sve_ld1rq_operand_p (op)")))
579
580 ;; Like memory_operand, but restricted to addresses that are valid for
581 ;; SVE LDR and STR instructions.
582 (define_predicate "aarch64_sve_ldr_operand"
583 (and (match_code "mem")
584 (match_test "aarch64_sve_ldr_operand_p (op)")))
585
586 (define_predicate "aarch64_sve_nonimmediate_operand"
587 (ior (match_operand 0 "register_operand")
588 (match_operand 0 "aarch64_sve_ldr_operand")))
589
590 (define_predicate "aarch64_sve_general_operand"
591 (and (match_code "reg,subreg,mem,const,const_vector")
592 (ior (match_operand 0 "register_operand")
593 (match_operand 0 "aarch64_sve_ldr_operand")
594 (match_test "aarch64_mov_operand_p (op, mode)"))))
595
596 (define_predicate "aarch64_sve_struct_memory_operand"
597 (and (match_code "mem")
598 (match_test "aarch64_sve_struct_memory_operand_p (op)")))
599
600 (define_predicate "aarch64_sve_struct_nonimmediate_operand"
601 (ior (match_operand 0 "register_operand")
602 (match_operand 0 "aarch64_sve_struct_memory_operand")))
603
604 ;; Doesn't include immediates, since those are handled by the move
605 ;; patterns instead.
606 (define_predicate "aarch64_sve_dup_operand"
607 (ior (match_operand 0 "register_operand")
608 (match_operand 0 "aarch64_sve_ld1r_operand")))
609
610 (define_predicate "aarch64_sve_arith_immediate"
611 (and (match_code "const,const_vector")
612 (match_test "aarch64_sve_arith_immediate_p (op, false)")))
613
614 (define_predicate "aarch64_sve_sub_arith_immediate"
615 (and (match_code "const,const_vector")
616 (match_test "aarch64_sve_arith_immediate_p (op, true)")))
617
618 (define_predicate "aarch64_sve_vector_inc_dec_immediate"
619 (and (match_code "const,const_vector")
620 (match_test "aarch64_sve_vector_inc_dec_immediate_p (op)")))
621
622 (define_predicate "aarch64_sve_uxtb_immediate"
623 (and (match_code "const_vector")
624 (match_test "GET_MODE_UNIT_BITSIZE (GET_MODE (op)) > 8")
625 (match_test "aarch64_const_vec_all_same_int_p (op, 0xff)")))
626
627 (define_predicate "aarch64_sve_uxth_immediate"
628 (and (match_code "const_vector")
629 (match_test "GET_MODE_UNIT_BITSIZE (GET_MODE (op)) > 16")
630 (match_test "aarch64_const_vec_all_same_int_p (op, 0xffff)")))
631
632 (define_predicate "aarch64_sve_uxtw_immediate"
633 (and (match_code "const_vector")
634 (match_test "GET_MODE_UNIT_BITSIZE (GET_MODE (op)) > 32")
635 (match_test "aarch64_const_vec_all_same_int_p (op, 0xffffffff)")))
636
637 (define_predicate "aarch64_sve_uxt_immediate"
638 (ior (match_operand 0 "aarch64_sve_uxtb_immediate")
639 (match_operand 0 "aarch64_sve_uxth_immediate")
640 (match_operand 0 "aarch64_sve_uxtw_immediate")))
641
642 (define_predicate "aarch64_sve_logical_immediate"
643 (and (match_code "const,const_vector")
644 (match_test "aarch64_sve_bitmask_immediate_p (op)")))
645
646 ;; Used for SVE UMAX and UMIN.
647 (define_predicate "aarch64_sve_vsb_immediate"
648 (and (match_code "const_vector")
649 (match_test "GET_MODE_INNER (GET_MODE (op)) == QImode
650 ? aarch64_const_vec_all_same_in_range_p (op, -128, 127)
651 : aarch64_const_vec_all_same_in_range_p (op, 0, 255)")))
652
653 ;; Used for SVE MUL, SMAX and SMIN.
654 (define_predicate "aarch64_sve_vsm_immediate"
655 (and (match_code "const,const_vector")
656 (match_test "aarch64_const_vec_all_same_in_range_p (op, -128, 127)")))
657
658 (define_predicate "aarch64_sve_dup_immediate"
659 (and (match_code "const,const_vector")
660 (ior (match_test "aarch64_sve_dup_immediate_p (op)")
661 (match_test "aarch64_float_const_representable_p (op)"))))
662
663 (define_predicate "aarch64_sve_cmp_vsc_immediate"
664 (and (match_code "const,const_vector")
665 (match_test "aarch64_sve_cmp_immediate_p (op, true)")))
666
667 (define_predicate "aarch64_sve_cmp_vsd_immediate"
668 (and (match_code "const,const_vector")
669 (match_test "aarch64_sve_cmp_immediate_p (op, false)")))
670
671 (define_predicate "aarch64_sve_index_immediate"
672 (and (match_code "const_int")
673 (match_test "aarch64_sve_index_immediate_p (op)")))
674
675 (define_predicate "aarch64_sve_float_arith_immediate"
676 (and (match_code "const,const_vector")
677 (match_test "aarch64_sve_float_arith_immediate_p (op, false)")))
678
679 (define_predicate "aarch64_sve_float_negated_arith_immediate"
680 (and (match_code "const,const_vector")
681 (match_test "aarch64_sve_float_arith_immediate_p (op, true)")))
682
683 (define_predicate "aarch64_sve_float_arith_with_sub_immediate"
684 (ior (match_operand 0 "aarch64_sve_float_arith_immediate")
685 (match_operand 0 "aarch64_sve_float_negated_arith_immediate")))
686
687 (define_predicate "aarch64_sve_float_mul_immediate"
688 (and (match_code "const,const_vector")
689 (match_test "aarch64_sve_float_mul_immediate_p (op)")))
690
691 (define_predicate "aarch64_sve_float_maxmin_immediate"
692 (and (match_code "const_vector")
693 (ior (match_test "op == CONST0_RTX (GET_MODE (op))")
694 (match_test "op == CONST1_RTX (GET_MODE (op))"))))
695
696 (define_predicate "aarch64_sve_arith_operand"
697 (ior (match_operand 0 "register_operand")
698 (match_operand 0 "aarch64_sve_arith_immediate")))
699
700 (define_predicate "aarch64_sve_add_operand"
701 (ior (match_operand 0 "aarch64_sve_arith_operand")
702 (match_operand 0 "aarch64_sve_sub_arith_immediate")
703 (match_operand 0 "aarch64_sve_vector_inc_dec_immediate")))
704
705 (define_predicate "aarch64_sve_pred_and_operand"
706 (ior (match_operand 0 "register_operand")
707 (match_operand 0 "aarch64_sve_uxt_immediate")))
708
709 (define_predicate "aarch64_sve_logical_operand"
710 (ior (match_operand 0 "register_operand")
711 (match_operand 0 "aarch64_sve_logical_immediate")))
712
713 (define_predicate "aarch64_sve_lshift_operand"
714 (ior (match_operand 0 "register_operand")
715 (match_operand 0 "aarch64_simd_lshift_imm")))
716
717 (define_predicate "aarch64_sve_rshift_operand"
718 (ior (match_operand 0 "register_operand")
719 (match_operand 0 "aarch64_simd_rshift_imm")))
720
721 (define_predicate "aarch64_sve_vsb_operand"
722 (ior (match_operand 0 "register_operand")
723 (match_operand 0 "aarch64_sve_vsb_immediate")))
724
725 (define_predicate "aarch64_sve_vsm_operand"
726 (ior (match_operand 0 "register_operand")
727 (match_operand 0 "aarch64_sve_vsm_immediate")))
728
729 (define_predicate "aarch64_sve_reg_or_dup_imm"
730 (ior (match_operand 0 "register_operand")
731 (match_operand 0 "aarch64_sve_dup_immediate")))
732
733 (define_predicate "aarch64_sve_cmp_vsc_operand"
734 (ior (match_operand 0 "register_operand")
735 (match_operand 0 "aarch64_sve_cmp_vsc_immediate")))
736
737 (define_predicate "aarch64_sve_cmp_vsd_operand"
738 (ior (match_operand 0 "register_operand")
739 (match_operand 0 "aarch64_sve_cmp_vsd_immediate")))
740
741 (define_predicate "aarch64_sve_index_operand"
742 (ior (match_operand 0 "register_operand")
743 (match_operand 0 "aarch64_sve_index_immediate")))
744
745 (define_predicate "aarch64_sve_float_arith_operand"
746 (ior (match_operand 0 "register_operand")
747 (match_operand 0 "aarch64_sve_float_arith_immediate")))
748
749 (define_predicate "aarch64_sve_float_arith_with_sub_operand"
750 (ior (match_operand 0 "register_operand")
751 (match_operand 0 "aarch64_sve_float_arith_with_sub_immediate")))
752
753 (define_predicate "aarch64_sve_float_mul_operand"
754 (ior (match_operand 0 "register_operand")
755 (match_operand 0 "aarch64_sve_float_mul_immediate")))
756
757 (define_predicate "aarch64_sve_float_maxmin_operand"
758 (ior (match_operand 0 "register_operand")
759 (match_operand 0 "aarch64_sve_float_maxmin_immediate")))
760
761 (define_predicate "aarch64_sve_vec_perm_operand"
762 (ior (match_operand 0 "register_operand")
763 (match_operand 0 "aarch64_constant_vector_operand")))
764
765 (define_predicate "aarch64_sve_ptrue_flag"
766 (and (match_code "const_int")
767 (ior (match_test "INTVAL (op) == SVE_MAYBE_NOT_PTRUE")
768 (match_test "INTVAL (op) == SVE_KNOWN_PTRUE"))))
769
770 (define_predicate "aarch64_sve_gp_strictness"
771 (and (match_code "const_int")
772 (ior (match_test "INTVAL (op) == SVE_RELAXED_GP")
773 (match_test "INTVAL (op) == SVE_STRICT_GP"))))
774
775 (define_predicate "aarch64_gather_scale_operand_w"
776 (and (match_code "const_int")
777 (match_test "INTVAL (op) == 1 || INTVAL (op) == 4")))
778
779 (define_predicate "aarch64_gather_scale_operand_d"
780 (and (match_code "const_int")
781 (match_test "INTVAL (op) == 1 || INTVAL (op) == 8")))
782
783 ;; A special predicate that doesn't match a particular mode.
784 (define_special_predicate "aarch64_any_register_operand"
785 (match_code "reg"))
786
787 (define_predicate "aarch64_sve_any_binary_operator"
788 (match_code "plus,minus,mult,div,udiv,smax,umax,smin,umin,and,ior,xor"))