annotate gcc/config/h8300/constraints.md @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ;; Constraint definitions for Renesas H8/300.
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
2 ;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
3 ;;
kono
parents:
diff changeset
4 ;; This file is part of GCC.
kono
parents:
diff changeset
5 ;;
kono
parents:
diff changeset
6 ;; GCC is free software; you can redistribute it and/or modify
kono
parents:
diff changeset
7 ;; it under the terms of the GNU General Public License as published by
kono
parents:
diff changeset
8 ;; the Free Software Foundation; either version 3, or (at your option)
kono
parents:
diff changeset
9 ;; any later version.
kono
parents:
diff changeset
10 ;;
kono
parents:
diff changeset
11 ;; GCC is distributed in the hope that it will be useful,
kono
parents:
diff changeset
12 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
kono
parents:
diff changeset
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
kono
parents:
diff changeset
14 ;; GNU General Public License for more details.
kono
parents:
diff changeset
15 ;;
kono
parents:
diff changeset
16 ;; You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
17 ;; along with GCC; see the file COPYING3. If not see
kono
parents:
diff changeset
18 ;; <http://www.gnu.org/licenses/>.
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 ;; Register constraints.
kono
parents:
diff changeset
21 (define_register_constraint "a" "MAC_REGS"
kono
parents:
diff changeset
22 "@internal")
kono
parents:
diff changeset
23
kono
parents:
diff changeset
24 (define_register_constraint "c" "COUNTER_REGS"
kono
parents:
diff changeset
25 "@internal")
kono
parents:
diff changeset
26
kono
parents:
diff changeset
27 ;; Some patterns need to use er6 as a scratch register. This is
kono
parents:
diff changeset
28 ;; difficult to arrange since er6 is the frame pointer and usually can't
kono
parents:
diff changeset
29 ;; be spilled.
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 ;; Such patterns should define two alternatives, one which allows only
kono
parents:
diff changeset
32 ;; er6 and one which allows any general register. The former
kono
parents:
diff changeset
33 ;; alternative should have a 'd' constraint while the latter should be
kono
parents:
diff changeset
34 ;; disparaged and use 'D'.
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 ;; Normally, 'd' maps to DESTINATION_REGS and 'D' maps to GENERAL_REGS.
kono
parents:
diff changeset
37 ;; However, there are cases where they should be NO_REGS:
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 ;; - 'd' should be NO_REGS when reloading a function that uses the
kono
parents:
diff changeset
40 ;; frame pointer. In this case, DESTINATION_REGS won't contain any
kono
parents:
diff changeset
41 ;; spillable registers, so the first alternative can't be used.
kono
parents:
diff changeset
42
kono
parents:
diff changeset
43 ;; - -fno-omit-frame-pointer means that the frame pointer will
kono
parents:
diff changeset
44 ;; always be in use. It's therefore better to map 'd' to NO_REGS
kono
parents:
diff changeset
45 ;; before reload so that register allocator will pick the second
kono
parents:
diff changeset
46 ;; alternative.
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 ;; - we would like 'D' to be NO_REGS when the frame pointer isn't
kono
parents:
diff changeset
49 ;; live, but we the frame pointer may turn out to be needed after
kono
parents:
diff changeset
50 ;; we start reload, and then we may have already decided we don't
kono
parents:
diff changeset
51 ;; have a choice, so we can't do that. Forcing the register
kono
parents:
diff changeset
52 ;; allocator to use er6 if possible might produce better code for
kono
parents:
diff changeset
53 ;; small functions: it's more efficient to save and restore er6 in
kono
parents:
diff changeset
54 ;; the prologue & epilogue than to do it in a define_split.
kono
parents:
diff changeset
55 ;; Hopefully disparaging 'D' will have a similar effect, without
kono
parents:
diff changeset
56 ;; forcing a reload failure if the frame pointer is found to be
kono
parents:
diff changeset
57 ;; needed too late.
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 (define_register_constraint "d"
kono
parents:
diff changeset
60 "(!flag_omit_frame_pointer && !reload_completed
kono
parents:
diff changeset
61 ? NO_REGS
kono
parents:
diff changeset
62 : (frame_pointer_needed && reload_in_progress
kono
parents:
diff changeset
63 ? NO_REGS
kono
parents:
diff changeset
64 : DESTINATION_REGS))"
kono
parents:
diff changeset
65 "@internal")
kono
parents:
diff changeset
66
kono
parents:
diff changeset
67 (define_register_constraint "D" "GENERAL_REGS"
kono
parents:
diff changeset
68 "@internal")
kono
parents:
diff changeset
69
kono
parents:
diff changeset
70 (define_register_constraint "f" "SOURCE_REGS"
kono
parents:
diff changeset
71 "@internal")
kono
parents:
diff changeset
72
kono
parents:
diff changeset
73 ;; Integer constraints.
kono
parents:
diff changeset
74 (define_constraint "I"
kono
parents:
diff changeset
75 "Integer zero."
kono
parents:
diff changeset
76 (and (match_code "const_int")
kono
parents:
diff changeset
77 (match_test "ival == 0")))
kono
parents:
diff changeset
78
kono
parents:
diff changeset
79 (define_constraint "J"
kono
parents:
diff changeset
80 "An integer with its low byte clear."
kono
parents:
diff changeset
81 (and (match_code "const_int")
kono
parents:
diff changeset
82 (match_test "(ival & 0xff) == 0")))
kono
parents:
diff changeset
83
kono
parents:
diff changeset
84 (define_constraint "L"
kono
parents:
diff changeset
85 "1, 2 or 4 on the H8300H or S; 1 or 2 otherwise."
kono
parents:
diff changeset
86 (and (match_code "const_int")
kono
parents:
diff changeset
87 (if_then_else (match_test "TARGET_H8300H || TARGET_H8300S")
kono
parents:
diff changeset
88 (match_test "ival == 1 || ival == 2 || ival == 4")
kono
parents:
diff changeset
89 (match_test "ival == 1 || ival == 2"))))
kono
parents:
diff changeset
90
kono
parents:
diff changeset
91 (define_constraint "M"
kono
parents:
diff changeset
92 "Integer 1 or 2."
kono
parents:
diff changeset
93 (and (match_code "const_int")
kono
parents:
diff changeset
94 (match_test "ival == 1 || ival == 2")))
kono
parents:
diff changeset
95
kono
parents:
diff changeset
96 (define_constraint "N"
kono
parents:
diff changeset
97 "-1, -2, or -4 on the H8300H or S; -1 or -2 otherwise."
kono
parents:
diff changeset
98 (and (match_code "const_int")
kono
parents:
diff changeset
99 (if_then_else (match_test "TARGET_H8300H || TARGET_H8300S")
kono
parents:
diff changeset
100 (match_test "ival == -1 || ival == -2 || ival == -4")
kono
parents:
diff changeset
101 (match_test "ival == -1 || ival == -2"))))
kono
parents:
diff changeset
102
kono
parents:
diff changeset
103 (define_constraint "O"
kono
parents:
diff changeset
104 "Integer -1 or -2."
kono
parents:
diff changeset
105 (and (match_code "const_int")
kono
parents:
diff changeset
106 (match_test "ival == -1 || ival == -2")))
kono
parents:
diff changeset
107
kono
parents:
diff changeset
108 (define_constraint "P1>X"
kono
parents:
diff changeset
109 "A positive, non-zero integer that fits in 1 bits."
kono
parents:
diff changeset
110 (and (match_code "const_int")
kono
parents:
diff changeset
111 (match_test "TARGET_H8300SX")
kono
parents:
diff changeset
112 (match_test "IN_RANGE (ival, 1, (1 << 1) - 1)")))
kono
parents:
diff changeset
113
kono
parents:
diff changeset
114 (define_constraint "P3>X"
kono
parents:
diff changeset
115 "A positive, non-zero integer that fits in 3 bits."
kono
parents:
diff changeset
116 (and (match_code "const_int")
kono
parents:
diff changeset
117 (match_test "TARGET_H8300SX")
kono
parents:
diff changeset
118 (match_test "IN_RANGE (ival, 1, (1 << 3) - 1)")))
kono
parents:
diff changeset
119
kono
parents:
diff changeset
120 (define_constraint "P4>X"
kono
parents:
diff changeset
121 "A positive, non-zero integer that fits in 4 bits."
kono
parents:
diff changeset
122 (and (match_code "const_int")
kono
parents:
diff changeset
123 (match_test "TARGET_H8300SX")
kono
parents:
diff changeset
124 (match_test "IN_RANGE (ival, 1, (1 << 4) - 1)")))
kono
parents:
diff changeset
125
kono
parents:
diff changeset
126 (define_constraint "P5>X"
kono
parents:
diff changeset
127 "A positive, non-zero integer that fits in 5 bits."
kono
parents:
diff changeset
128 (and (match_code "const_int")
kono
parents:
diff changeset
129 (match_test "TARGET_H8300SX")
kono
parents:
diff changeset
130 (match_test "IN_RANGE (ival, 1, (1 << 5) - 1)")))
kono
parents:
diff changeset
131
kono
parents:
diff changeset
132 (define_constraint "P8>X"
kono
parents:
diff changeset
133 "A positive, non-zero integer that fits in 8 bits."
kono
parents:
diff changeset
134 (and (match_code "const_int")
kono
parents:
diff changeset
135 (match_test "TARGET_H8300SX")
kono
parents:
diff changeset
136 (match_test "IN_RANGE (ival, 1, (1 << 8) - 1)")))
kono
parents:
diff changeset
137
kono
parents:
diff changeset
138 (define_constraint "P3<X"
kono
parents:
diff changeset
139 "A negative, non-zero integer that fits in 3 bits."
kono
parents:
diff changeset
140 (and (match_code "const_int")
kono
parents:
diff changeset
141 (match_test "TARGET_H8300SX")
kono
parents:
diff changeset
142 (match_test "IN_RANGE (ival, (-(1 << 3)) + 1, -1)")))
kono
parents:
diff changeset
143
kono
parents:
diff changeset
144 ;; Floating-point constraints.
kono
parents:
diff changeset
145 (define_constraint "G"
kono
parents:
diff changeset
146 "Single-float zero."
kono
parents:
diff changeset
147 (and (match_code "const_double")
kono
parents:
diff changeset
148 (match_test "op == CONST0_RTX (SFmode)")))
kono
parents:
diff changeset
149
kono
parents:
diff changeset
150 ;; Extra constraints.
kono
parents:
diff changeset
151 (define_constraint "Q"
kono
parents:
diff changeset
152 "@internal"
kono
parents:
diff changeset
153 (and (match_test "TARGET_H8300SX")
kono
parents:
diff changeset
154 (match_operand 0 "memory_operand")))
kono
parents:
diff changeset
155
kono
parents:
diff changeset
156 (define_constraint "R"
kono
parents:
diff changeset
157 "@internal"
kono
parents:
diff changeset
158 (and (match_code "const_int")
kono
parents:
diff changeset
159 (match_test "!h8300_shift_needs_scratch_p (ival, QImode)")))
kono
parents:
diff changeset
160
kono
parents:
diff changeset
161 (define_constraint "S"
kono
parents:
diff changeset
162 "@internal"
kono
parents:
diff changeset
163 (and (match_code "const_int")
kono
parents:
diff changeset
164 (match_test "!h8300_shift_needs_scratch_p (ival, HImode)")))
kono
parents:
diff changeset
165
kono
parents:
diff changeset
166 (define_constraint "T"
kono
parents:
diff changeset
167 "@internal"
kono
parents:
diff changeset
168 (and (match_code "const_int")
kono
parents:
diff changeset
169 (match_test "!h8300_shift_needs_scratch_p (ival, SImode)")))
kono
parents:
diff changeset
170
kono
parents:
diff changeset
171 (define_constraint "U"
kono
parents:
diff changeset
172 "An operand valid for a bset destination."
kono
parents:
diff changeset
173 (ior (and (match_code "reg")
kono
parents:
diff changeset
174 (match_test "(reload_in_progress || reload_completed)
kono
parents:
diff changeset
175 ? REG_OK_FOR_BASE_STRICT_P (op)
kono
parents:
diff changeset
176 : REG_OK_FOR_BASE_P (op)"))
kono
parents:
diff changeset
177 (and (match_code "mem")
kono
parents:
diff changeset
178 (match_code "reg" "0")
kono
parents:
diff changeset
179 (match_test "(reload_in_progress || reload_completed)
kono
parents:
diff changeset
180 ? REG_OK_FOR_BASE_STRICT_P (XEXP (op, 0))
kono
parents:
diff changeset
181 : REG_OK_FOR_BASE_P (XEXP (op, 0))"))
kono
parents:
diff changeset
182 (and (match_code "mem")
kono
parents:
diff changeset
183 (match_code "symbol_ref" "0")
kono
parents:
diff changeset
184 (match_test "TARGET_H8300S"))
kono
parents:
diff changeset
185 (and (match_code "mem")
kono
parents:
diff changeset
186 (match_code "const" "0")
kono
parents:
diff changeset
187 (match_code "plus" "00")
kono
parents:
diff changeset
188 (match_code "symbol_ref" "000")
kono
parents:
diff changeset
189 (match_code "const_int" "001")
kono
parents:
diff changeset
190 (ior (match_test "TARGET_H8300S")
kono
parents:
diff changeset
191 (match_test "(SYMBOL_REF_FLAGS (XEXP (XEXP (XEXP (op, 0), 0), 0)) & SYMBOL_FLAG_EIGHTBIT_DATA) != 0")))
kono
parents:
diff changeset
192 (and (match_code "mem")
kono
parents:
diff changeset
193 (match_test "h8300_eightbit_constant_address_p (XEXP (op, 0))"))
kono
parents:
diff changeset
194 (and (match_code "mem")
kono
parents:
diff changeset
195 (ior (match_test "TARGET_H8300S")
kono
parents:
diff changeset
196 (match_test "TARGET_H8300SX"))
kono
parents:
diff changeset
197 (match_code "const_int" "0"))))
kono
parents:
diff changeset
198
kono
parents:
diff changeset
199 (define_memory_constraint "WU"
kono
parents:
diff changeset
200 "@internal"
kono
parents:
diff changeset
201 (and (match_code "mem")
kono
parents:
diff changeset
202 (match_test "satisfies_constraint_U (op)")))
kono
parents:
diff changeset
203
kono
parents:
diff changeset
204 (define_constraint "Y0"
kono
parents:
diff changeset
205 "@internal"
kono
parents:
diff changeset
206 (and (match_code "const_int")
kono
parents:
diff changeset
207 (match_test "exact_log2 (~ival & 0xff) != -1")))
kono
parents:
diff changeset
208
kono
parents:
diff changeset
209 (define_constraint "Y2"
kono
parents:
diff changeset
210 "@internal"
kono
parents:
diff changeset
211 (and (match_code "const_int")
kono
parents:
diff changeset
212 (match_test "exact_log2 (ival & 0xff) != -1")))
kono
parents:
diff changeset
213
kono
parents:
diff changeset
214 (define_constraint "Z"
kono
parents:
diff changeset
215 "@internal"
kono
parents:
diff changeset
216 (and (match_test "TARGET_H8300SX")
kono
parents:
diff changeset
217 (match_code "mem")
kono
parents:
diff changeset
218 (match_test "CONSTANT_P (XEXP (op, 0))")))