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