]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/common.md
fortran: Add -finline-intrinsics flag for MINLOC/MAXLOC [PR90608]
[thirdparty/gcc.git] / gcc / common.md
CommitLineData
8677664e 1;; Common GCC machine description file, shared by all targets.
a945c346 2;; Copyright (C) 2014-2024 Free Software Foundation, Inc.
8677664e
RS
3;;
4;; This file is part of GCC.
5;;
6;; GCC is free software; you can redistribute it and/or modify
7;; it under the terms of the GNU General Public License as published by
8;; the Free Software Foundation; either version 3, or (at your option)
9;; any later version.
10;;
11;; GCC is distributed in the hope that it will be useful,
12;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;; GNU General Public License for more details.
15;;
16;; You should have received a copy of the GNU General Public License
17;; along with GCC; see the file COPYING3. If not see
18;; <http://www.gnu.org/licenses/>. */
19
32ce90c6
RS
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")
25{
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. */
29 if (SUBREG_P (op)
30 && multiple_p (SUBREG_BYTE (op), GET_MODE_SIZE (GET_MODE (op))))
31 op = SUBREG_REG (op);
32 if (!REG_P (op))
33 return false;
34
35 if (HARD_REGISTER_P (op))
36 {
37 if (!in_hard_reg_set_p (operand_reg_set, GET_MODE (op), REGNO (op)))
38 return false;
39
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)
43 return false;
44 }
45 return true;
46})
47
8677664e
RS
48(define_register_constraint "r" "GENERAL_REGS"
49 "Matches any general register.")
50
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))")))
56
57(define_memory_constraint "o"
58 "Matches an offsettable memory reference."
59 (and (match_code "mem")
60 (match_test "offsettable_nonstrict_memref_p (op)")))
61
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)"))))
72
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"))))
80
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"))))
87
88(define_address_constraint "p"
89 "Matches a general address."
90 (match_test "address_operand (op, VOIDmode)"))
91
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)")))
96
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)")))
102
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)")))
107
108(define_constraint "E"
109 "Matches a floating-point constant."
110 (ior (match_test "CONST_DOUBLE_AS_FLOAT_P (op)")
2072a319 111 (match_test "GET_CODE (op) == CONST_VECTOR
8677664e
RS
112 && GET_MODE_CLASS (GET_MODE (op)) == MODE_VECTOR_FLOAT")))
113
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)")
2072a319 118 (match_test "GET_CODE (op) == CONST_VECTOR
8677664e
RS
119 && GET_MODE_CLASS (GET_MODE (op)) == MODE_VECTOR_FLOAT")))
120
121(define_constraint "X"
122 "Matches anything."
123 (match_test "true"))