1 |
38 |
julius |
;; Constraints definitions belonging to the gcc backend for IBM S/390.
|
2 |
|
|
;; Copyright (C) 2006, 2007 Free Software Foundation, Inc.
|
3 |
|
|
;; Written by Wolfgang Gellerich, using code and information found in
|
4 |
|
|
;; files s390.md, s390.h, and s390.c.
|
5 |
|
|
;;
|
6 |
|
|
;; This file is part of GCC.
|
7 |
|
|
;;
|
8 |
|
|
;; GCC is free software; you can redistribute it and/or modify it under
|
9 |
|
|
;; the terms of the GNU General Public License as published by the Free
|
10 |
|
|
;; Software Foundation; either version 3, or (at your option) any later
|
11 |
|
|
;; version.
|
12 |
|
|
;;
|
13 |
|
|
;; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
14 |
|
|
;; WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
15 |
|
|
;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
16 |
|
|
;; for more details.
|
17 |
|
|
;;
|
18 |
|
|
;; You should have received a copy of the GNU General Public License
|
19 |
|
|
;; along with GCC; see the file COPYING3. If not see
|
20 |
|
|
;; .
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
;;
|
24 |
|
|
;; Special constraints for s/390 machine description:
|
25 |
|
|
;;
|
26 |
|
|
;; a -- Any address register from 1 to 15.
|
27 |
|
|
;; c -- Condition code register 33.
|
28 |
|
|
;; d -- Any register from 0 to 15.
|
29 |
|
|
;; f -- Floating point registers.
|
30 |
|
|
;; t -- Access registers 36 and 37.
|
31 |
|
|
;; G -- Const double zero operand
|
32 |
|
|
;; I -- An 8-bit constant (0..255).
|
33 |
|
|
;; J -- A 12-bit constant (0..4095).
|
34 |
|
|
;; K -- A 16-bit constant (-32768..32767).
|
35 |
|
|
;; L -- Value appropriate as displacement.
|
36 |
|
|
;; (0..4095) for short displacement
|
37 |
|
|
;; (-524288..524287) for long displacement
|
38 |
|
|
;; M -- Constant integer with a value of 0x7fffffff.
|
39 |
|
|
;; N -- Multiple letter constraint followed by 4 parameter letters.
|
40 |
|
|
;; 0..9,x: number of the part counting from most to least significant
|
41 |
|
|
;; H,Q: mode of the part
|
42 |
|
|
;; D,S,H: mode of the containing operand
|
43 |
|
|
;; 0,F: value of the other parts (F - all bits set)
|
44 |
|
|
;;
|
45 |
|
|
;; The constraint matches if the specified part of a constant
|
46 |
|
|
;; has a value different from its other parts. If the letter x
|
47 |
|
|
;; is specified instead of a part number, the constraint matches
|
48 |
|
|
;; if there is any single part with non-default value.
|
49 |
|
|
;; O -- Multiple letter constraint followed by 1 parameter.
|
50 |
|
|
;; s: Signed extended immediate value (-2G .. 2G-1).
|
51 |
|
|
;; p: Positive extended immediate value (0 .. 4G-1).
|
52 |
|
|
;; n: Negative extended immediate value (-4G .. -1).
|
53 |
|
|
;; These constraints do not accept any operand if the machine does
|
54 |
|
|
;; not provide the extended-immediate facility.
|
55 |
|
|
;; P -- Any integer constant that can be loaded without literal pool.
|
56 |
|
|
;; Q -- Memory reference without index register and with short displacement.
|
57 |
|
|
;; R -- Memory reference with index register and short displacement.
|
58 |
|
|
;; S -- Memory reference without index register but with long displacement.
|
59 |
|
|
;; T -- Memory reference with index register and long displacement.
|
60 |
|
|
;; A -- Multiple letter constraint followed by Q, R, S, or T:
|
61 |
|
|
;; Offsettable memory reference of type specified by second letter.
|
62 |
|
|
;; B -- Multiple letter constraint followed by Q, R, S, or T:
|
63 |
|
|
;; Memory reference of the type specified by second letter that
|
64 |
|
|
;; does *not* refer to a literal pool entry.
|
65 |
|
|
;; U -- Pointer with short displacement.
|
66 |
|
|
;; W -- Pointer with long displacement.
|
67 |
|
|
;; Y -- Shift count operand.
|
68 |
|
|
;;
|
69 |
|
|
|
70 |
|
|
|
71 |
|
|
;;
|
72 |
|
|
;; Register constraints.
|
73 |
|
|
;;
|
74 |
|
|
|
75 |
|
|
(define_register_constraint "a"
|
76 |
|
|
"ADDR_REGS"
|
77 |
|
|
"Any address register from 1 to 15.")
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
(define_register_constraint "c"
|
81 |
|
|
"CC_REGS"
|
82 |
|
|
"Condition code register 33")
|
83 |
|
|
|
84 |
|
|
|
85 |
|
|
(define_register_constraint "d"
|
86 |
|
|
"GENERAL_REGS"
|
87 |
|
|
"Any register from 0 to 15")
|
88 |
|
|
|
89 |
|
|
|
90 |
|
|
(define_register_constraint "f"
|
91 |
|
|
"FP_REGS"
|
92 |
|
|
"Floating point registers")
|
93 |
|
|
|
94 |
|
|
|
95 |
|
|
(define_register_constraint "t"
|
96 |
|
|
"ACCESS_REGS"
|
97 |
|
|
"@internal
|
98 |
|
|
Access registers 36 and 37")
|
99 |
|
|
|
100 |
|
|
|
101 |
|
|
;;
|
102 |
|
|
;; General constraints for constants.
|
103 |
|
|
;;
|
104 |
|
|
|
105 |
|
|
(define_constraint "G"
|
106 |
|
|
"@internal
|
107 |
|
|
Const double zero operand"
|
108 |
|
|
(and (match_code "const_double")
|
109 |
|
|
(match_test "s390_float_const_zero_p (op)")))
|
110 |
|
|
|
111 |
|
|
|
112 |
|
|
(define_constraint "I"
|
113 |
|
|
"An 8-bit constant (0..255)"
|
114 |
|
|
(and (match_code "const_int")
|
115 |
|
|
(match_test "(unsigned int) ival <= 255")))
|
116 |
|
|
|
117 |
|
|
|
118 |
|
|
(define_constraint "J"
|
119 |
|
|
"A 12-bit constant (0..4095)"
|
120 |
|
|
(and (match_code "const_int")
|
121 |
|
|
(match_test "(unsigned int) ival <= 4095")))
|
122 |
|
|
|
123 |
|
|
|
124 |
|
|
(define_constraint "K"
|
125 |
|
|
"A 16-bit constant (-32768..32767)"
|
126 |
|
|
(and (match_code "const_int")
|
127 |
|
|
(match_test "ival >= -32768 && ival <= 32767")))
|
128 |
|
|
|
129 |
|
|
|
130 |
|
|
|
131 |
|
|
(define_constraint "L"
|
132 |
|
|
"Value appropriate as displacement.
|
133 |
|
|
(0..4095) for short displacement
|
134 |
|
|
(-524288..524287) for long displacement"
|
135 |
|
|
(and (match_code "const_int")
|
136 |
|
|
(match_test "TARGET_LONG_DISPLACEMENT ?
|
137 |
|
|
(ival >= -524288 && ival <= 524287)
|
138 |
|
|
: (ival >= 0 && ival <= 4095)")))
|
139 |
|
|
|
140 |
|
|
|
141 |
|
|
(define_constraint "M"
|
142 |
|
|
"Constant integer with a value of 0x7fffffff"
|
143 |
|
|
(and (match_code "const_int")
|
144 |
|
|
(match_test "ival == 2147483647")))
|
145 |
|
|
|
146 |
|
|
|
147 |
|
|
(define_constraint "P"
|
148 |
|
|
"@internal
|
149 |
|
|
Any integer constant that can be loaded without literal pool"
|
150 |
|
|
(and (match_code "const_int")
|
151 |
|
|
(match_test "legitimate_reload_constant_p (GEN_INT (ival))")))
|
152 |
|
|
|
153 |
|
|
|
154 |
|
|
(define_address_constraint "Y"
|
155 |
|
|
"Shift count operand"
|
156 |
|
|
|
157 |
|
|
;; Simply check for the basic form of a shift count. Reload will
|
158 |
|
|
;; take care of making sure we have a proper base register.
|
159 |
|
|
|
160 |
|
|
(match_test "s390_decompose_shift_count (op, NULL, NULL)" ))
|
161 |
|
|
|
162 |
|
|
|
163 |
|
|
;; N -- Multiple letter constraint followed by 4 parameter letters.
|
164 |
|
|
;; 0..9,x: number of the part counting from most to least significant
|
165 |
|
|
;; H,Q: mode of the part
|
166 |
|
|
;; D,S,H: mode of the containing operand
|
167 |
|
|
;; 0,F: value of the other parts (F = all bits set)
|
168 |
|
|
;;
|
169 |
|
|
;; The constraint matches if the specified part of a constant
|
170 |
|
|
;; has a value different from its other parts. If the letter x
|
171 |
|
|
;; is specified instead of a part number, the constraint matches
|
172 |
|
|
;; if there is any single part with non-default value.
|
173 |
|
|
;;
|
174 |
|
|
;; The following patterns define only those constraints that are actually
|
175 |
|
|
;; used in s390.md. If you need an additional one, simply add it in the
|
176 |
|
|
;; obvious way. Function s390_N_constraint_str is ready to handle all
|
177 |
|
|
;; combinations.
|
178 |
|
|
;;
|
179 |
|
|
|
180 |
|
|
|
181 |
|
|
(define_constraint "NxQS0"
|
182 |
|
|
"@internal"
|
183 |
|
|
(and (match_code "const_int")
|
184 |
|
|
(match_test "s390_N_constraint_str (\"xQS0\", ival)")))
|
185 |
|
|
|
186 |
|
|
|
187 |
|
|
(define_constraint "NxQD0"
|
188 |
|
|
"@internal"
|
189 |
|
|
(and (match_code "const_int")
|
190 |
|
|
(match_test "s390_N_constraint_str (\"xQD0\", ival)")))
|
191 |
|
|
|
192 |
|
|
|
193 |
|
|
(define_constraint "N3HD0"
|
194 |
|
|
"@internal"
|
195 |
|
|
(and (match_code "const_int")
|
196 |
|
|
(match_test "s390_N_constraint_str (\"3HD0\", ival)")))
|
197 |
|
|
|
198 |
|
|
|
199 |
|
|
(define_constraint "N2HD0"
|
200 |
|
|
"@internal"
|
201 |
|
|
(and (match_code "const_int")
|
202 |
|
|
(match_test "s390_N_constraint_str (\"2HD0\", ival)")))
|
203 |
|
|
|
204 |
|
|
|
205 |
|
|
(define_constraint "N1SD0"
|
206 |
|
|
"@internal"
|
207 |
|
|
(and (match_code "const_int")
|
208 |
|
|
(match_test "s390_N_constraint_str (\"1SD0\", ival)")))
|
209 |
|
|
|
210 |
|
|
|
211 |
|
|
(define_constraint "N1HS0"
|
212 |
|
|
"@internal"
|
213 |
|
|
(and (match_code "const_int")
|
214 |
|
|
(match_test "s390_N_constraint_str (\"1HS0\", ival)")))
|
215 |
|
|
|
216 |
|
|
|
217 |
|
|
(define_constraint "N1HD0"
|
218 |
|
|
"@internal"
|
219 |
|
|
(and (match_code "const_int")
|
220 |
|
|
(match_test "s390_N_constraint_str (\"1HD0\", ival)")))
|
221 |
|
|
|
222 |
|
|
|
223 |
|
|
(define_constraint "N0SD0"
|
224 |
|
|
"@internal"
|
225 |
|
|
(and (match_code "const_int")
|
226 |
|
|
(match_test "s390_N_constraint_str (\"0SD0\", ival)")))
|
227 |
|
|
|
228 |
|
|
|
229 |
|
|
(define_constraint "N0HS0"
|
230 |
|
|
"@internal"
|
231 |
|
|
(and (match_code "const_int")
|
232 |
|
|
(match_test "s390_N_constraint_str (\"0HS0\", ival)")))
|
233 |
|
|
|
234 |
|
|
|
235 |
|
|
(define_constraint "N0HD0"
|
236 |
|
|
"@internal"
|
237 |
|
|
(and (match_code "const_int")
|
238 |
|
|
(match_test "s390_N_constraint_str (\"0HD0\", ival)")))
|
239 |
|
|
|
240 |
|
|
|
241 |
|
|
(define_constraint "NxQDF"
|
242 |
|
|
"@internal"
|
243 |
|
|
(and (match_code "const_int")
|
244 |
|
|
(match_test "s390_N_constraint_str (\"xQDF\", ival)")))
|
245 |
|
|
|
246 |
|
|
|
247 |
|
|
(define_constraint "N1SDF"
|
248 |
|
|
"@internal"
|
249 |
|
|
(and (match_code "const_int")
|
250 |
|
|
(match_test "s390_N_constraint_str (\"1SDF\", ival)")))
|
251 |
|
|
|
252 |
|
|
|
253 |
|
|
(define_constraint "N0SDF"
|
254 |
|
|
"@internal"
|
255 |
|
|
(and (match_code "const_int")
|
256 |
|
|
(match_test "s390_N_constraint_str (\"0SDF\", ival)")))
|
257 |
|
|
|
258 |
|
|
|
259 |
|
|
(define_constraint "N3HDF"
|
260 |
|
|
"@internal"
|
261 |
|
|
(and (match_code "const_int")
|
262 |
|
|
(match_test "s390_N_constraint_str (\"3HDF\", ival)")))
|
263 |
|
|
|
264 |
|
|
|
265 |
|
|
(define_constraint "N2HDF"
|
266 |
|
|
"@internal"
|
267 |
|
|
(and (match_code "const_int")
|
268 |
|
|
(match_test "s390_N_constraint_str (\"2HDF\", ival)")))
|
269 |
|
|
|
270 |
|
|
|
271 |
|
|
(define_constraint "N1HDF"
|
272 |
|
|
"@internal"
|
273 |
|
|
(and (match_code "const_int")
|
274 |
|
|
(match_test "s390_N_constraint_str (\"1HDF\", ival)")))
|
275 |
|
|
|
276 |
|
|
|
277 |
|
|
(define_constraint "N0HDF"
|
278 |
|
|
"@internal"
|
279 |
|
|
(and (match_code "const_int")
|
280 |
|
|
(match_test "s390_N_constraint_str (\"0HDF\", ival)")))
|
281 |
|
|
|
282 |
|
|
|
283 |
|
|
(define_constraint "N0HSF"
|
284 |
|
|
"@internal"
|
285 |
|
|
(and (match_code "const_int")
|
286 |
|
|
(match_test "s390_N_constraint_str (\"0HSF\", ival)")))
|
287 |
|
|
|
288 |
|
|
|
289 |
|
|
(define_constraint "N1HSF"
|
290 |
|
|
"@internal"
|
291 |
|
|
(and (match_code "const_int")
|
292 |
|
|
(match_test "s390_N_constraint_str (\"1HSF\", ival)")))
|
293 |
|
|
|
294 |
|
|
|
295 |
|
|
(define_constraint "NxQSF"
|
296 |
|
|
"@internal"
|
297 |
|
|
(and (match_code "const_int")
|
298 |
|
|
(match_test "s390_N_constraint_str (\"xQSF\", ival)")))
|
299 |
|
|
|
300 |
|
|
|
301 |
|
|
(define_constraint "NxQHF"
|
302 |
|
|
"@internal"
|
303 |
|
|
(and (match_code "const_int")
|
304 |
|
|
(match_test "s390_N_constraint_str (\"xQHF\", ival)")))
|
305 |
|
|
|
306 |
|
|
|
307 |
|
|
(define_constraint "NxQH0"
|
308 |
|
|
"@internal"
|
309 |
|
|
(and (match_code "const_int")
|
310 |
|
|
(match_test "s390_N_constraint_str (\"xQH0\", ival)")))
|
311 |
|
|
|
312 |
|
|
|
313 |
|
|
|
314 |
|
|
|
315 |
|
|
;;
|
316 |
|
|
;; Double-letter constraints starting with O follow.
|
317 |
|
|
;;
|
318 |
|
|
|
319 |
|
|
|
320 |
|
|
(define_constraint "Os"
|
321 |
|
|
"@internal
|
322 |
|
|
Signed extended immediate value (-2G .. 2G-1).
|
323 |
|
|
This constraint will only match if the machine provides
|
324 |
|
|
the extended-immediate facility."
|
325 |
|
|
(and (match_code "const_int")
|
326 |
|
|
(match_test "s390_O_constraint_str ('s', ival)")))
|
327 |
|
|
|
328 |
|
|
|
329 |
|
|
(define_constraint "Op"
|
330 |
|
|
"@internal
|
331 |
|
|
Positive extended immediate value (0 .. 4G-1).
|
332 |
|
|
This constraint will only match if the machine provides
|
333 |
|
|
the extended-immediate facility."
|
334 |
|
|
(and (match_code "const_int")
|
335 |
|
|
(match_test "s390_O_constraint_str ('p', ival)")))
|
336 |
|
|
|
337 |
|
|
|
338 |
|
|
(define_constraint "On"
|
339 |
|
|
"@internal
|
340 |
|
|
Negative extended immediate value (-4G .. -1).
|
341 |
|
|
This constraint will only match if the machine provides
|
342 |
|
|
the extended-immediate facility."
|
343 |
|
|
(and (match_code "const_int")
|
344 |
|
|
(match_test "s390_O_constraint_str ('n', ival)")))
|
345 |
|
|
|
346 |
|
|
|
347 |
|
|
|
348 |
|
|
|
349 |
|
|
;;
|
350 |
|
|
;; Memory constraints follow.
|
351 |
|
|
;;
|
352 |
|
|
|
353 |
|
|
(define_memory_constraint "Q"
|
354 |
|
|
"Memory reference without index register and with short displacement"
|
355 |
|
|
(match_test "s390_mem_constraint (\"Q\", op)"))
|
356 |
|
|
|
357 |
|
|
|
358 |
|
|
|
359 |
|
|
(define_memory_constraint "R"
|
360 |
|
|
"Memory reference with index register and short displacement"
|
361 |
|
|
(match_test "s390_mem_constraint (\"R\", op)"))
|
362 |
|
|
|
363 |
|
|
|
364 |
|
|
(define_memory_constraint "S"
|
365 |
|
|
"Memory reference without index register but with long displacement"
|
366 |
|
|
(match_test "s390_mem_constraint (\"S\", op)"))
|
367 |
|
|
|
368 |
|
|
|
369 |
|
|
(define_memory_constraint "T"
|
370 |
|
|
"Memory reference with index register and long displacement"
|
371 |
|
|
(match_test "s390_mem_constraint (\"T\", op)"))
|
372 |
|
|
|
373 |
|
|
|
374 |
|
|
|
375 |
|
|
(define_memory_constraint "AQ"
|
376 |
|
|
"@internal
|
377 |
|
|
Offsettable memory reference without index register and with short displacement"
|
378 |
|
|
(match_test "s390_mem_constraint (\"AQ\", op)"))
|
379 |
|
|
|
380 |
|
|
|
381 |
|
|
(define_memory_constraint "AR"
|
382 |
|
|
"@internal
|
383 |
|
|
Offsettable memory reference with index register and short displacement"
|
384 |
|
|
(match_test "s390_mem_constraint (\"AR\", op)"))
|
385 |
|
|
|
386 |
|
|
|
387 |
|
|
(define_memory_constraint "AS"
|
388 |
|
|
"@internal
|
389 |
|
|
Offsettable memory reference without index register but with long displacement"
|
390 |
|
|
(match_test "s390_mem_constraint (\"AS\", op)"))
|
391 |
|
|
|
392 |
|
|
|
393 |
|
|
(define_memory_constraint "AT"
|
394 |
|
|
"@internal
|
395 |
|
|
Offsettable memory reference with index register and long displacement"
|
396 |
|
|
(match_test "s390_mem_constraint (\"AT\", op)"))
|
397 |
|
|
|
398 |
|
|
|
399 |
|
|
|
400 |
|
|
(define_constraint "BQ"
|
401 |
|
|
"@internal
|
402 |
|
|
Memory reference without index register and with short
|
403 |
|
|
displacement that does *not* refer to a literal pool entry."
|
404 |
|
|
(match_test "s390_mem_constraint (\"BQ\", op)"))
|
405 |
|
|
|
406 |
|
|
|
407 |
|
|
(define_constraint "BR"
|
408 |
|
|
"@internal
|
409 |
|
|
Memory reference with index register and short displacement that
|
410 |
|
|
does *not* refer to a literal pool entry. "
|
411 |
|
|
(match_test "s390_mem_constraint (\"BR\", op)"))
|
412 |
|
|
|
413 |
|
|
|
414 |
|
|
(define_constraint "BS"
|
415 |
|
|
"@internal
|
416 |
|
|
Memory reference without index register but with long displacement
|
417 |
|
|
that does *not* refer to a literal pool entry. "
|
418 |
|
|
(match_test "s390_mem_constraint (\"BS\", op)"))
|
419 |
|
|
|
420 |
|
|
|
421 |
|
|
(define_constraint "BT"
|
422 |
|
|
"@internal
|
423 |
|
|
Memory reference with index register and long displacement that
|
424 |
|
|
does *not* refer to a literal pool entry. "
|
425 |
|
|
(match_test "s390_mem_constraint (\"BT\", op)"))
|
426 |
|
|
|
427 |
|
|
|
428 |
|
|
|
429 |
|
|
(define_address_constraint "U"
|
430 |
|
|
"Pointer with short displacement"
|
431 |
|
|
(match_test "s390_mem_constraint (\"U\", op)"))
|
432 |
|
|
|
433 |
|
|
|
434 |
|
|
|
435 |
|
|
(define_address_constraint "W"
|
436 |
|
|
"Pointer with long displacement"
|
437 |
|
|
(match_test "s390_mem_constraint (\"W\", op)"))
|