Mercurial > hg > CbC > CbC_gcc
comparison gcc/config/arm/predicates.md @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 ;; Predicate definitions for ARM and Thumb | 1 ;; Predicate definitions for ARM and Thumb |
2 ;; Copyright (C) 2004-2018 Free Software Foundation, Inc. | 2 ;; Copyright (C) 2004-2020 Free Software Foundation, Inc. |
3 ;; Contributed by ARM Ltd. | 3 ;; Contributed by ARM Ltd. |
4 | 4 |
5 ;; This file is part of GCC. | 5 ;; This file is part of GCC. |
6 | 6 |
7 ;; GCC is free software; you can redistribute it and/or modify it | 7 ;; GCC is free software; you can redistribute it and/or modify it |
29 return (REG_P (op) | 29 return (REG_P (op) |
30 && (REGNO (op) >= FIRST_PSEUDO_REGISTER | 30 && (REGNO (op) >= FIRST_PSEUDO_REGISTER |
31 || REGNO_REG_CLASS (REGNO (op)) != NO_REGS)); | 31 || REGNO_REG_CLASS (REGNO (op)) != NO_REGS)); |
32 }) | 32 }) |
33 | 33 |
34 ; Predicate for stack protector guard's address in | |
35 ; stack_protect_combined_set_insn and stack_protect_combined_test_insn patterns | |
36 (define_predicate "guard_addr_operand" | |
37 (match_test "true") | |
38 { | |
39 return (CONSTANT_ADDRESS_P (op) | |
40 || !targetm.cannot_force_const_mem (mode, op)); | |
41 }) | |
42 | |
43 ; Predicate for stack protector guard in stack_protect_combined_set and | |
44 ; stack_protect_combined_test patterns | |
45 (define_predicate "guard_operand" | |
46 (match_code "mem") | |
47 { | |
48 return guard_addr_operand (XEXP (op, 0), mode); | |
49 }) | |
50 | |
34 (define_predicate "imm_for_neon_inv_logic_operand" | 51 (define_predicate "imm_for_neon_inv_logic_operand" |
35 (match_code "const_vector") | 52 (match_code "const_vector") |
36 { | 53 { |
37 return (TARGET_NEON | 54 return (TARGET_NEON |
38 && neon_immediate_valid_for_logic (op, mode, 1, NULL, NULL)); | 55 && neon_immediate_valid_for_logic (op, mode, 1, NULL, NULL)); |
174 | 191 |
175 (define_predicate "const_neon_scalar_shift_amount_operand" | 192 (define_predicate "const_neon_scalar_shift_amount_operand" |
176 (and (match_code "const_int") | 193 (and (match_code "const_int") |
177 (match_test "IN_RANGE (UINTVAL (op), 1, GET_MODE_BITSIZE (mode))"))) | 194 (match_test "IN_RANGE (UINTVAL (op), 1, GET_MODE_BITSIZE (mode))"))) |
178 | 195 |
196 (define_predicate "ssat16_imm" | |
197 (and (match_code "const_int") | |
198 (match_test "IN_RANGE (INTVAL (op), 1, 16)"))) | |
199 | |
200 (define_predicate "usat16_imm" | |
201 (and (match_code "const_int") | |
202 (match_test "IN_RANGE (INTVAL (op), 0, 15)"))) | |
203 | |
179 (define_predicate "ldrd_strd_offset_operand" | 204 (define_predicate "ldrd_strd_offset_operand" |
180 (and (match_operand 0 "const_int_operand") | 205 (and (match_operand 0 "const_int_operand") |
181 (match_test "TARGET_LDRD && offset_ok_for_ldrd_strd (INTVAL (op))"))) | 206 (match_test "TARGET_LDRD && offset_ok_for_ldrd_strd (INTVAL (op))"))) |
182 | 207 |
183 (define_predicate "arm_add_operand" | 208 (define_predicate "arm_add_operand" |
184 (ior (match_operand 0 "arm_rhs_operand") | 209 (ior (match_operand 0 "arm_rhs_operand") |
185 (match_operand 0 "arm_neg_immediate_operand"))) | 210 (match_operand 0 "arm_neg_immediate_operand"))) |
186 | 211 |
187 (define_predicate "arm_anddi_operand_neon" | 212 (define_predicate "arm_adddi_operand" |
188 (ior (match_operand 0 "s_register_operand") | 213 (ior (match_operand 0 "s_register_operand") |
189 (and (match_code "const_int") | 214 (and (match_code "const_int") |
190 (match_test "const_ok_for_dimode_op (INTVAL (op), AND)")) | 215 (match_test "const_ok_for_dimode_op (INTVAL (op), PLUS)")))) |
191 (match_operand 0 "neon_inv_logic_op2"))) | 216 |
192 | 217 (define_predicate "arm_anddi_operand" |
193 (define_predicate "arm_iordi_operand_neon" | |
194 (ior (match_operand 0 "s_register_operand") | 218 (ior (match_operand 0 "s_register_operand") |
195 (and (match_code "const_int") | 219 (and (match_code "const_int") |
196 (match_test "const_ok_for_dimode_op (INTVAL (op), IOR)")) | 220 (match_test "const_ok_for_dimode_op (INTVAL (op), AND)")))) |
197 (match_operand 0 "neon_logic_op2"))) | 221 |
222 (define_predicate "arm_iordi_operand" | |
223 (ior (match_operand 0 "s_register_operand") | |
224 (and (match_code "const_int") | |
225 (match_test "const_ok_for_dimode_op (INTVAL (op), IOR)")))) | |
198 | 226 |
199 (define_predicate "arm_xordi_operand" | 227 (define_predicate "arm_xordi_operand" |
200 (ior (match_operand 0 "s_register_operand") | 228 (ior (match_operand 0 "s_register_operand") |
201 (and (match_code "const_int") | 229 (and (match_code "const_int") |
202 (match_test "const_ok_for_dimode_op (INTVAL (op), XOR)")))) | 230 (match_test "const_ok_for_dimode_op (INTVAL (op), XOR)")))) |
203 | |
204 (define_predicate "arm_adddi_operand" | |
205 (ior (match_operand 0 "s_register_operand") | |
206 (and (match_code "const_int") | |
207 (match_test "const_ok_for_dimode_op (INTVAL (op), PLUS)")))) | |
208 | 231 |
209 (define_predicate "arm_addimm_operand" | 232 (define_predicate "arm_addimm_operand" |
210 (ior (match_operand 0 "arm_immediate_operand") | 233 (ior (match_operand 0 "arm_immediate_operand") |
211 (match_operand 0 "arm_neg_immediate_operand"))) | 234 (match_operand 0 "arm_neg_immediate_operand"))) |
212 | 235 |
213 (define_predicate "arm_not_operand" | 236 (define_predicate "arm_not_operand" |
214 (ior (match_operand 0 "arm_rhs_operand") | 237 (ior (match_operand 0 "arm_rhs_operand") |
238 (match_operand 0 "arm_not_immediate_operand"))) | |
239 | |
240 ;; A constant that can be used with ADC(SBC) or SBC(ADC) when bit-wise | |
241 ;; inverted. Similar to arm_not_operand, but excludes registers. | |
242 (define_predicate "arm_adcimm_operand" | |
243 (ior (match_operand 0 "arm_immediate_operand") | |
215 (match_operand 0 "arm_not_immediate_operand"))) | 244 (match_operand 0 "arm_not_immediate_operand"))) |
216 | 245 |
217 (define_predicate "arm_di_operand" | 246 (define_predicate "arm_di_operand" |
218 (ior (match_operand 0 "s_register_operand") | 247 (ior (match_operand 0 "s_register_operand") |
219 (match_operand 0 "arm_immediate_di_operand"))) | 248 (match_operand 0 "arm_immediate_di_operand"))) |
305 (and (match_code "ashift,ashiftrt") | 334 (and (match_code "ashift,ashiftrt") |
306 (match_test "CONST_INT_P (XEXP (op, 1)) | 335 (match_test "CONST_INT_P (XEXP (op, 1)) |
307 && (UINTVAL (XEXP (op, 1)) < 32)"))) | 336 && (UINTVAL (XEXP (op, 1)) < 32)"))) |
308 (match_test "mode == GET_MODE (op)"))) | 337 (match_test "mode == GET_MODE (op)"))) |
309 | 338 |
339 ;; True for Armv8.1-M Mainline long shift instructions. | |
340 (define_predicate "long_shift_imm" | |
341 (match_test "satisfies_constraint_Pg (op)")) | |
342 | |
343 (define_predicate "arm_reg_or_long_shift_imm" | |
344 (ior (match_test "TARGET_THUMB2 | |
345 && arm_general_register_operand (op, GET_MODE (op))") | |
346 (match_test "satisfies_constraint_Pg (op)"))) | |
347 | |
310 ;; True for MULT, to identify which variant of shift_operator is in use. | 348 ;; True for MULT, to identify which variant of shift_operator is in use. |
311 (define_special_predicate "mult_operator" | 349 (define_special_predicate "mult_operator" |
312 (match_code "mult")) | 350 (match_code "mult")) |
313 | 351 |
314 ;; True for operators that have 16-bit thumb variants. */ | 352 ;; True for operators that have 16-bit thumb variants. */ |
338 (and (match_operand 0 "expandable_comparison_operator") | 376 (and (match_operand 0 "expandable_comparison_operator") |
339 (match_test "maybe_get_arm_condition_code (op) != ARM_NV"))) | 377 (match_test "maybe_get_arm_condition_code (op) != ARM_NV"))) |
340 | 378 |
341 (define_special_predicate "lt_ge_comparison_operator" | 379 (define_special_predicate "lt_ge_comparison_operator" |
342 (match_code "lt,ge")) | 380 (match_code "lt,ge")) |
381 | |
382 (define_special_predicate "arm_carry_operation" | |
383 (match_code "geu,ltu") | |
384 { | |
385 if (XEXP (op, 1) != const0_rtx) | |
386 return false; | |
387 | |
388 rtx op0 = XEXP (op, 0); | |
389 | |
390 if (!REG_P (op0) || REGNO (op0) != CC_REGNUM) | |
391 return false; | |
392 | |
393 machine_mode ccmode = GET_MODE (op0); | |
394 if (ccmode == CC_Cmode) | |
395 return GET_CODE (op) == LTU; | |
396 else if (ccmode == CCmode || ccmode == CC_RSBmode || ccmode == CC_ADCmode) | |
397 return GET_CODE (op) == GEU; | |
398 | |
399 return false; | |
400 } | |
401 ) | |
402 | |
403 ;; Match a "borrow" operation for use with SBC. The precise code will | |
404 ;; depend on the form of the comparison. This is generally the inverse of | |
405 ;; a carry operation, since the logic of SBC uses "not borrow" in it's | |
406 ;; calculation. | |
407 (define_special_predicate "arm_borrow_operation" | |
408 (match_code "geu,ltu") | |
409 { | |
410 if (XEXP (op, 1) != const0_rtx) | |
411 return false; | |
412 rtx op0 = XEXP (op, 0); | |
413 if (!REG_P (op0) || REGNO (op0) != CC_REGNUM) | |
414 return false; | |
415 machine_mode ccmode = GET_MODE (op0); | |
416 if (ccmode == CC_Cmode) | |
417 return GET_CODE (op) == GEU; | |
418 else if (ccmode == CCmode || ccmode == CC_RSBmode || ccmode == CC_ADCmode) | |
419 return GET_CODE (op) == LTU; | |
420 return false; | |
421 } | |
422 ) | |
343 | 423 |
344 ;; The vsel instruction only accepts the ARM condition codes listed below. | 424 ;; The vsel instruction only accepts the ARM condition codes listed below. |
345 (define_special_predicate "arm_vsel_comparison_operator" | 425 (define_special_predicate "arm_vsel_comparison_operator" |
346 (and (match_operand 0 "expandable_comparison_operator") | 426 (and (match_operand 0 "expandable_comparison_operator") |
347 (match_test "maybe_get_arm_condition_code (op) == ARM_GE | 427 (match_test "maybe_get_arm_condition_code (op) == ARM_GE |
357 (if_then_else (match_test "arm_restrict_it") | 437 (if_then_else (match_test "arm_restrict_it") |
358 (and (match_test "TARGET_VFP5") | 438 (and (match_test "TARGET_VFP5") |
359 (match_operand 0 "arm_vsel_comparison_operator")) | 439 (match_operand 0 "arm_vsel_comparison_operator")) |
360 (match_operand 0 "expandable_comparison_operator"))) | 440 (match_operand 0 "expandable_comparison_operator"))) |
361 | 441 |
362 (define_special_predicate "noov_comparison_operator" | 442 (define_special_predicate "nz_comparison_operator" |
363 (match_code "lt,ge,eq,ne")) | 443 (match_code "lt,ge,eq,ne")) |
364 | 444 |
365 (define_special_predicate "minmax_operator" | 445 (define_special_predicate "minmax_operator" |
366 (and (match_code "smin,smax,umin,umax") | 446 (and (match_code "smin,smax,umin,umax") |
367 (match_test "mode == GET_MODE (op)"))) | 447 (match_test "mode == GET_MODE (op)"))) |
453 | 533 |
454 (define_predicate "soft_df_operand" | 534 (define_predicate "soft_df_operand" |
455 (ior (match_code "const_double") | 535 (ior (match_code "const_double") |
456 (and (match_code "reg,subreg,mem") | 536 (and (match_code "reg,subreg,mem") |
457 (match_operand 0 "nonimmediate_soft_df_operand")))) | 537 (match_operand 0 "nonimmediate_soft_df_operand")))) |
538 | |
539 ;; Predicate for thumb2_movsf_vfp. Compared to general_operand, this | |
540 ;; forbids constant loaded via literal pool iff literal pools are disabled. | |
541 (define_predicate "hard_sf_operand" | |
542 (and (match_operand 0 "general_operand") | |
543 (ior (not (match_code "const_double")) | |
544 (not (match_test "arm_disable_literal_pool")) | |
545 (match_test "satisfies_constraint_Dv (op)")))) | |
546 | |
547 ;; Predicate for thumb2_movdf_vfp. Compared to soft_df_operand used in | |
548 ;; movdf_soft_insn, this forbids constant loaded via literal pool iff | |
549 ;; literal pools are disabled. | |
550 (define_predicate "hard_df_operand" | |
551 (and (match_operand 0 "soft_df_operand") | |
552 (ior (not (match_code "const_double")) | |
553 (not (match_test "arm_disable_literal_pool")) | |
554 (match_test "satisfies_constraint_Dy (op)") | |
555 (match_test "satisfies_constraint_G (op)")))) | |
556 | |
557 (define_special_predicate "clear_multiple_operation" | |
558 (match_code "parallel") | |
559 { | |
560 return clear_operation_p (op, /*vfp*/false); | |
561 }) | |
562 | |
563 (define_special_predicate "clear_vfp_multiple_operation" | |
564 (match_code "parallel") | |
565 { | |
566 return clear_operation_p (op, /*vfp*/true); | |
567 }) | |
458 | 568 |
459 (define_special_predicate "load_multiple_operation" | 569 (define_special_predicate "load_multiple_operation" |
460 (match_code "parallel") | 570 (match_code "parallel") |
461 { | 571 { |
462 return ldm_stm_operation_p (op, /*load=*/true, SImode, | 572 return ldm_stm_operation_p (op, /*load=*/true, SImode, |
656 | 766 |
657 (define_predicate "call_insn_operand" | 767 (define_predicate "call_insn_operand" |
658 (ior (and (match_code "symbol_ref") | 768 (ior (and (match_code "symbol_ref") |
659 (match_test "!arm_is_long_call_p (SYMBOL_REF_DECL (op))")) | 769 (match_test "!arm_is_long_call_p (SYMBOL_REF_DECL (op))")) |
660 (match_operand 0 "s_register_operand"))) | 770 (match_operand 0 "s_register_operand"))) |
771 | |
772 (define_special_predicate "aligned_operand" | |
773 (ior (not (match_code "mem")) | |
774 (match_test "MEM_ALIGN (op) >= GET_MODE_ALIGNMENT (mode)"))) |