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