OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [config/] [arm/] [constraints.md] - Blame information for rev 754

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 709 jeremybenn
;; Constraint definitions for ARM and Thumb
2
;; Copyright (C) 2006, 2007, 2008, 2010 Free Software Foundation, Inc.
3
;; Contributed by ARM Ltd.
4
 
5
;; This file is part of GCC.
6
 
7
;; GCC is free software; you can redistribute it and/or modify it
8
;; under the terms of the GNU General Public License as published
9
;; by the Free Software Foundation; either version 3, or (at your
10
;; option) any later version.
11
 
12
;; GCC is distributed in the hope that it will be useful, but WITHOUT
13
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14
;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
15
;; License for more details.
16
 
17
;; You should have received a copy of the GNU General Public License
18
;; along with GCC; see the file COPYING3.  If not see
19
;; .
20
 
21
;; The following register constraints have been used:
22
;; - in ARM/Thumb-2 state: f, t, v, w, x, y, z
23
;; - in Thumb state: h, b
24
;; - in both states: l, c, k
25
;; In ARM state, 'l' is an alias for 'r'
26
 
27
;; The following normal constraints have been used:
28
;; in ARM/Thumb-2 state: G, H, I, j, J, K, L, M
29
;; in Thumb-1 state: I, J, K, L, M, N, O
30
 
31
;; The following multi-letter normal constraints have been used:
32
;; in ARM/Thumb-2 state: Da, Db, Dc, Dn, Dl, DL, Dv, Dy, Di, Dt, Dz
33
;; in Thumb-1 state: Pa, Pb, Pc, Pd
34
;; in Thumb-2 state: Pj, PJ, Ps, Pt, Pu, Pv, Pw, Px, Py
35
 
36
;; The following memory constraints have been used:
37
;; in ARM/Thumb-2 state: Q, Ut, Uv, Uy, Un, Um, Us
38
;; in ARM state: Uq
39
;; in Thumb state: Uu, Uw
40
 
41
 
42
(define_register_constraint "f" "TARGET_ARM ? FPA_REGS : NO_REGS"
43
 "Legacy FPA registers @code{f0}-@code{f7}.")
44
 
45
(define_register_constraint "t" "TARGET_32BIT ? VFP_LO_REGS : NO_REGS"
46
 "The VFP registers @code{s0}-@code{s31}.")
47
 
48
(define_register_constraint "v" "TARGET_ARM ? CIRRUS_REGS : NO_REGS"
49
 "The Cirrus Maverick co-processor registers.")
50
 
51
(define_register_constraint "w"
52
  "TARGET_32BIT ? (TARGET_VFPD32 ? VFP_REGS : VFP_LO_REGS) : NO_REGS"
53
 "The VFP registers @code{d0}-@code{d15}, or @code{d0}-@code{d31} for VFPv3.")
54
 
55
(define_register_constraint "x" "TARGET_32BIT ? VFP_D0_D7_REGS : NO_REGS"
56
 "The VFP registers @code{d0}-@code{d7}.")
57
 
58
(define_register_constraint "y" "TARGET_REALLY_IWMMXT ? IWMMXT_REGS : NO_REGS"
59
 "The Intel iWMMX co-processor registers.")
60
 
61
(define_register_constraint "z"
62
 "TARGET_REALLY_IWMMXT ? IWMMXT_GR_REGS : NO_REGS"
63
 "The Intel iWMMX GR registers.")
64
 
65
(define_register_constraint "l" "TARGET_THUMB ? LO_REGS : GENERAL_REGS"
66
 "In Thumb state the core registers @code{r0}-@code{r7}.")
67
 
68
(define_register_constraint "h" "TARGET_THUMB ? HI_REGS : NO_REGS"
69
 "In Thumb state the core registers @code{r8}-@code{r15}.")
70
 
71
(define_constraint "j"
72
 "A constant suitable for a MOVW instruction. (ARM/Thumb-2)"
73
 (and (match_test "TARGET_32BIT && arm_arch_thumb2")
74
      (ior (match_code "high")
75
           (and (match_code "const_int")
76
                (match_test "(ival & 0xffff0000) == 0")))))
77
 
78
(define_constraint "Pj"
79
 "@internal A 12-bit constant suitable for an ADDW or SUBW instruction. (Thumb-2)"
80
 (and (match_code "const_int")
81
      (and (match_test "TARGET_THUMB2")
82
           (match_test "(ival & 0xfffff000) == 0"))))
83
 
84
(define_constraint "PJ"
85
 "@internal A constant that satisfies the Pj constrant if negated."
86
 (and (match_code "const_int")
87
      (and (match_test "TARGET_THUMB2")
88
           (match_test "((-ival) & 0xfffff000) == 0"))))
89
 
90
(define_register_constraint "k" "STACK_REG"
91
 "@internal The stack register.")
92
 
93
(define_register_constraint "b" "TARGET_THUMB ? BASE_REGS : NO_REGS"
94
 "@internal
95
  Thumb only.  The union of the low registers and the stack register.")
96
 
97
(define_register_constraint "c" "CC_REG"
98
 "@internal The condition code register.")
99
 
100
(define_constraint "I"
101
 "In ARM/Thumb-2 state a constant that can be used as an immediate value in a
102
  Data Processing instruction.  In Thumb-1 state a constant in the range
103
  0-255."
104
 (and (match_code "const_int")
105
      (match_test "TARGET_32BIT ? const_ok_for_arm (ival)
106
                   : ival >= 0 && ival <= 255")))
107
 
108
(define_constraint "J"
109
 "In ARM/Thumb-2 state a constant in the range @minus{}4095-4095.  In Thumb-1
110
  state a constant in the range @minus{}255-@minus{}1."
111
 (and (match_code "const_int")
112
      (match_test "TARGET_32BIT ? (ival >= -4095 && ival <= 4095)
113
                   : (ival >= -255 && ival <= -1)")))
114
 
115
(define_constraint "K"
116
 "In ARM/Thumb-2 state a constant that satisfies the @code{I} constraint if
117
  inverted.  In Thumb-1 state a constant that satisfies the @code{I}
118
  constraint multiplied by any power of 2."
119
 (and (match_code "const_int")
120
      (match_test "TARGET_32BIT ? const_ok_for_arm (~ival)
121
                   : thumb_shiftable_const (ival)")))
122
 
123
(define_constraint "L"
124
 "In ARM/Thumb-2 state a constant that satisfies the @code{I} constraint if
125
  negated.  In Thumb-1 state a constant in the range @minus{}7-7."
126
 (and (match_code "const_int")
127
      (match_test "TARGET_32BIT ? const_ok_for_arm (-ival)
128
                   : (ival >= -7 && ival <= 7)")))
129
 
130
;; The ARM state version is internal...
131
;; @internal In ARM/Thumb-2 state a constant in the range 0-32 or any
132
;; power of 2.
133
(define_constraint "M"
134
 "In Thumb-1 state a constant that is a multiple of 4 in the range 0-1020."
135
 (and (match_code "const_int")
136
      (match_test "TARGET_32BIT ? ((ival >= 0 && ival <= 32)
137
                                 || (((ival & (ival - 1)) & 0xFFFFFFFF) == 0))
138
                   : ival >= 0 && ival <= 1020 && (ival & 3) == 0")))
139
 
140
(define_constraint "N"
141
 "Thumb-1 state a constant in the range 0-31."
142
 (and (match_code "const_int")
143
      (match_test "!TARGET_32BIT && (ival >= 0 && ival <= 31)")))
144
 
145
(define_constraint "O"
146
 "In Thumb-1 state a constant that is a multiple of 4 in the range
147
  @minus{}508-508."
148
 (and (match_code "const_int")
149
      (match_test "TARGET_THUMB1 && ival >= -508 && ival <= 508
150
                   && ((ival & 3) == 0)")))
151
 
152
(define_constraint "Pa"
153
  "@internal In Thumb-1 state a constant in the range -510 to +510"
154
  (and (match_code "const_int")
155
       (match_test "TARGET_THUMB1 && ival >= -510 && ival <= 510
156
                    && (ival > 255 || ival < -255)")))
157
 
158
(define_constraint "Pb"
159
  "@internal In Thumb-1 state a constant in the range -262 to +262"
160
  (and (match_code "const_int")
161
       (match_test "TARGET_THUMB1 && ival >= -262 && ival <= 262
162
                    && (ival > 255 || ival < -255)")))
163
 
164
(define_constraint "Pc"
165
  "@internal In Thumb-1 state a constant that is in the range 1021 to 1275"
166
  (and (match_code "const_int")
167
       (match_test "TARGET_THUMB1
168
                    && ival > 1020 && ival <= 1275")))
169
 
170
(define_constraint "Pd"
171
  "@internal In Thumb-1 state a constant in the range 0 to 7"
172
  (and (match_code "const_int")
173
       (match_test "TARGET_THUMB1 && ival >= 0 && ival <= 7")))
174
 
175
(define_constraint "Ps"
176
  "@internal In Thumb-2 state a constant in the range -255 to +255"
177
  (and (match_code "const_int")
178
       (match_test "TARGET_THUMB2 && ival >= -255 && ival <= 255")))
179
 
180
(define_constraint "Pt"
181
  "@internal In Thumb-2 state a constant in the range -7 to +7"
182
  (and (match_code "const_int")
183
       (match_test "TARGET_THUMB2 && ival >= -7 && ival <= 7")))
184
 
185
(define_constraint "Pu"
186
  "@internal In Thumb-2 state a constant in the range +1 to +8"
187
  (and (match_code "const_int")
188
       (match_test "TARGET_THUMB2 && ival >= 1 && ival <= 8")))
189
 
190
(define_constraint "Pv"
191
  "@internal In Thumb-2 state a constant in the range -255 to 0"
192
  (and (match_code "const_int")
193
       (match_test "TARGET_THUMB2 && ival >= -255 && ival <= 0")))
194
 
195
(define_constraint "Pw"
196
  "@internal In Thumb-2 state a constant in the range -255 to -1"
197
  (and (match_code "const_int")
198
       (match_test "TARGET_THUMB2 && ival >= -255 && ival <= -1")))
199
 
200
(define_constraint "Px"
201
  "@internal In Thumb-2 state a constant in the range -7 to -1"
202
  (and (match_code "const_int")
203
       (match_test "TARGET_THUMB2 && ival >= -7 && ival <= -1")))
204
 
205
(define_constraint "Py"
206
  "@internal In Thumb-2 state a constant in the range 0 to 255"
207
  (and (match_code "const_int")
208
       (match_test "TARGET_THUMB2 && ival >= 0 && ival <= 255")))
209
 
210
(define_constraint "G"
211
 "In ARM/Thumb-2 state a valid FPA immediate constant."
212
 (and (match_code "const_double")
213
      (match_test "TARGET_32BIT && arm_const_double_rtx (op)")))
214
 
215
(define_constraint "H"
216
 "In ARM/Thumb-2 state a valid FPA immediate constant when negated."
217
 (and (match_code "const_double")
218
      (match_test "TARGET_32BIT && neg_const_double_rtx_ok_for_fpa (op)")))
219
 
220
(define_constraint "Dz"
221
 "@internal
222
  In ARM/Thumb-2 state a vector of constant zeros."
223
 (and (match_code "const_vector")
224
      (match_test "TARGET_NEON && op == CONST0_RTX (mode)")))
225
 
226
(define_constraint "Da"
227
 "@internal
228
  In ARM/Thumb-2 state a const_int, const_double or const_vector that can
229
  be generated with two Data Processing insns."
230
 (and (match_code "const_double,const_int,const_vector")
231
      (match_test "TARGET_32BIT && arm_const_double_inline_cost (op) == 2")))
232
 
233
(define_constraint "Db"
234
 "@internal
235
  In ARM/Thumb-2 state a const_int, const_double or const_vector that can
236
  be generated with three Data Processing insns."
237
 (and (match_code "const_double,const_int,const_vector")
238
      (match_test "TARGET_32BIT && arm_const_double_inline_cost (op) == 3")))
239
 
240
(define_constraint "Dc"
241
 "@internal
242
  In ARM/Thumb-2 state a const_int, const_double or const_vector that can
243
  be generated with four Data Processing insns.  This pattern is disabled
244
  if optimizing for space or when we have load-delay slots to fill."
245
 (and (match_code "const_double,const_int,const_vector")
246
      (match_test "TARGET_32BIT && arm_const_double_inline_cost (op) == 4
247
                   && !(optimize_size || arm_ld_sched)")))
248
 
249
(define_constraint "Di"
250
 "@internal
251
  In ARM/Thumb-2 state a const_int or const_double where both the high
252
  and low SImode words can be generated as immediates in 32-bit instructions."
253
 (and (match_code "const_double,const_int")
254
      (match_test "TARGET_32BIT && arm_const_double_by_immediates (op)")))
255
 
256
(define_constraint "Dn"
257
 "@internal
258
  In ARM/Thumb-2 state a const_vector which can be loaded with a Neon vmov
259
  immediate instruction."
260
 (and (match_code "const_vector")
261
      (match_test "TARGET_32BIT
262
                   && imm_for_neon_mov_operand (op, GET_MODE (op))")))
263
 
264
(define_constraint "Dl"
265
 "@internal
266
  In ARM/Thumb-2 state a const_vector which can be used with a Neon vorr or
267
  vbic instruction."
268
 (and (match_code "const_vector")
269
      (match_test "TARGET_32BIT
270
                   && imm_for_neon_logic_operand (op, GET_MODE (op))")))
271
 
272
(define_constraint "DL"
273
 "@internal
274
  In ARM/Thumb-2 state a const_vector which can be used with a Neon vorn or
275
  vand instruction."
276
 (and (match_code "const_vector")
277
      (match_test "TARGET_32BIT
278
                   && imm_for_neon_inv_logic_operand (op, GET_MODE (op))")))
279
 
280
(define_constraint "Dv"
281
 "@internal
282
  In ARM/Thumb-2 state a const_double which can be used with a VFP fconsts
283
  instruction."
284
 (and (match_code "const_double")
285
      (match_test "TARGET_32BIT && vfp3_const_double_rtx (op)")))
286
 
287
(define_constraint "Dy"
288
 "@internal
289
  In ARM/Thumb-2 state a const_double which can be used with a VFP fconstd
290
  instruction."
291
 (and (match_code "const_double")
292
      (match_test "TARGET_32BIT && TARGET_VFP_DOUBLE && vfp3_const_double_rtx (op)")))
293
 
294
(define_constraint "Dt"
295
 "@internal
296
  In ARM/ Thumb2 a const_double which can be used with a vcvt.f32.s32 with fract bits operation"
297
  (and (match_code "const_double")
298
       (match_test "TARGET_32BIT && TARGET_VFP && vfp3_const_double_for_fract_bits (op)")))
299
 
300
(define_memory_constraint "Ua"
301
 "@internal
302
  An address valid for loading/storing register exclusive"
303
 (match_operand 0 "mem_noofs_operand"))
304
 
305
(define_memory_constraint "Ut"
306
 "@internal
307
  In ARM/Thumb-2 state an address valid for loading/storing opaque structure
308
  types wider than TImode."
309
 (and (match_code "mem")
310
      (match_test "TARGET_32BIT && neon_struct_mem_operand (op)")))
311
 
312
(define_memory_constraint "Uv"
313
 "@internal
314
  In ARM/Thumb-2 state a valid VFP load/store address."
315
 (and (match_code "mem")
316
      (match_test "TARGET_32BIT && arm_coproc_mem_operand (op, FALSE)")))
317
 
318
(define_memory_constraint "Uy"
319
 "@internal
320
  In ARM/Thumb-2 state a valid iWMMX load/store address."
321
 (and (match_code "mem")
322
      (match_test "TARGET_32BIT && arm_coproc_mem_operand (op, TRUE)")))
323
 
324
(define_memory_constraint "Un"
325
 "@internal
326
  In ARM/Thumb-2 state a valid address for Neon doubleword vector
327
  load/store instructions."
328
 (and (match_code "mem")
329
      (match_test "TARGET_32BIT && neon_vector_mem_operand (op, 0)")))
330
 
331
(define_memory_constraint "Um"
332
 "@internal
333
  In ARM/Thumb-2 state a valid address for Neon element and structure
334
  load/store instructions."
335
 (and (match_code "mem")
336
      (match_test "TARGET_32BIT && neon_vector_mem_operand (op, 2)")))
337
 
338
(define_memory_constraint "Us"
339
 "@internal
340
  In ARM/Thumb-2 state a valid address for non-offset loads/stores of
341
  quad-word values in four ARM registers."
342
 (and (match_code "mem")
343
      (match_test "TARGET_32BIT && neon_vector_mem_operand (op, 1)")))
344
 
345
(define_memory_constraint "Uq"
346
 "@internal
347
  In ARM state an address valid in ldrsb instructions."
348
 (and (match_code "mem")
349
      (match_test "TARGET_ARM
350
                   && arm_legitimate_address_outer_p (GET_MODE (op), XEXP (op, 0),
351
                                                      SIGN_EXTEND, 0)")))
352
 
353
(define_memory_constraint "Q"
354
 "@internal
355
  In ARM/Thumb-2 state an address that is a single base register."
356
 (and (match_code "mem")
357
      (match_test "REG_P (XEXP (op, 0))")))
358
 
359
(define_memory_constraint "Uu"
360
 "@internal
361
  In Thumb state an address that is valid in 16bit encoding."
362
 (and (match_code "mem")
363
      (match_test "TARGET_THUMB
364
                   && thumb1_legitimate_address_p (GET_MODE (op), XEXP (op, 0),
365
                                                   0)")))
366
 
367
; The 16-bit post-increment LDR/STR accepted by thumb1_legitimate_address_p
368
; are actually LDM/STM instructions, so cannot be used to access unaligned
369
; data.
370
(define_memory_constraint "Uw"
371
 "@internal
372
  In Thumb state an address that is valid in 16bit encoding, and that can be
373
  used for unaligned accesses."
374
 (and (match_code "mem")
375
      (match_test "TARGET_THUMB
376
                   && thumb1_legitimate_address_p (GET_MODE (op), XEXP (op, 0),
377
                                                   0)
378
                   && GET_CODE (XEXP (op, 0)) != POST_INC")))
379
 
380
;; We used to have constraint letters for S and R in ARM state, but
381
;; all uses of these now appear to have been removed.
382
 
383
;; Additionally, we used to have a Q constraint in Thumb state, but
384
;; this wasn't really a valid memory constraint.  Again, all uses of
385
;; this now seem to have been removed.

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.