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