1 ;; Common GCC machine description file, shared by all targets.
2 ;; Copyright (C) 2014-2023 Free Software Foundation, Inc.
4 ;; This file is part of GCC.
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)
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.
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/>. */
20 ;; This predicate is intended to be paired with register constraints that use
21 ;; register filters to impose an alignment. Operands that are aligned via
22 ;; TARGET_HARD_REGNO_MODE_OK should use normal register_operands instead.
23 (define_predicate "aligned_register_operand"
24 (match_code "reg,subreg")
26 /* Require the offset in a non-paradoxical subreg to be naturally aligned.
27 For example, if we have a subreg of something that is double the size of
28 this operand, the offset must select the first or second half of it. */
30 && multiple_p (SUBREG_BYTE (op), GET_MODE_SIZE (GET_MODE (op))))
35 if (HARD_REGISTER_P (op))
37 if (!in_hard_reg_set_p (operand_reg_set, GET_MODE (op), REGNO (op)))
40 /* Reject hard registers that would need reloading, so that the reload
41 is visible to IRA and to pre-RA optimizers. */
42 if (REGNO (op) % REG_NREGS (op) != 0)
48 (define_register_constraint "r" "GENERAL_REGS"
49 "Matches any general register.")
51 (define_memory_constraint "TARGET_MEM_CONSTRAINT"
52 "Matches any valid memory."
53 (and (match_code "mem")
54 (match_test "memory_address_addr_space_p (GET_MODE (op), XEXP (op, 0),
55 MEM_ADDR_SPACE (op))")))
57 (define_memory_constraint "o"
58 "Matches an offsettable memory reference."
59 (and (match_code "mem")
60 (match_test "offsettable_nonstrict_memref_p (op)")))
62 ;; "V" matches TARGET_MEM_CONSTRAINTs that are rejected by "o".
63 ;; This means that it is not a memory constraint in the usual sense,
64 ;; since reloading the address into a base register would make the
65 ;; address offsettable.
66 (define_constraint "V"
67 "Matches a non-offsettable memory reference."
68 (and (match_code "mem")
69 (match_test "memory_address_addr_space_p (GET_MODE (op), XEXP (op, 0),
70 MEM_ADDR_SPACE (op))")
71 (not (match_test "offsettable_nonstrict_memref_p (op)"))))
73 ;; Like "V", this is not a memory constraint, since reloading the address
74 ;; into a base register would cause it not to match.
75 (define_constraint "<"
76 "Matches a pre-dec or post-dec operand."
77 (and (match_code "mem")
78 (ior (match_test "GET_CODE (XEXP (op, 0)) == PRE_DEC")
79 (match_test "GET_CODE (XEXP (op, 0)) == POST_DEC"))))
81 ;; See the comment for "<".
82 (define_constraint ">"
83 "Matches a pre-inc or post-inc operand."
84 (and (match_code "mem")
85 (ior (match_test "GET_CODE (XEXP (op, 0)) == PRE_INC")
86 (match_test "GET_CODE (XEXP (op, 0)) == POST_INC"))))
88 (define_address_constraint "p"
89 "Matches a general address."
90 (match_test "address_operand (op, VOIDmode)"))
92 (define_constraint "i"
93 "Matches a general integer constant."
94 (and (match_test "CONSTANT_P (op)")
95 (match_test "!flag_pic || LEGITIMATE_PIC_OPERAND_P (op)")))
97 (define_constraint "s"
98 "Matches a symbolic integer constant."
99 (and (match_test "CONSTANT_P (op)")
100 (match_test "!CONST_SCALAR_INT_P (op)")
101 (match_test "!flag_pic || LEGITIMATE_PIC_OPERAND_P (op)")))
103 (define_constraint "n"
104 "Matches a non-symbolic integer constant."
105 (and (match_test "CONST_SCALAR_INT_P (op)")
106 (match_test "!flag_pic || LEGITIMATE_PIC_OPERAND_P (op)")))
108 (define_constraint "E"
109 "Matches a floating-point constant."
110 (ior (match_test "CONST_DOUBLE_AS_FLOAT_P (op)")
111 (match_test "GET_CODE (op) == CONST_VECTOR
112 && GET_MODE_CLASS (GET_MODE (op)) == MODE_VECTOR_FLOAT")))
114 ;; There is no longer a distinction between "E" and "F".
115 (define_constraint "F"
116 "Matches a floating-point constant."
117 (ior (match_test "CONST_DOUBLE_AS_FLOAT_P (op)")
118 (match_test "GET_CODE (op) == CONST_VECTOR
119 && GET_MODE_CLASS (GET_MODE (op)) == MODE_VECTOR_FLOAT")))
121 (define_constraint "X"