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

Subversion Repositories openrisc

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

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

Line No. Rev Author Line
1 709 jeremybenn
;; Constraint definitions for Renesas / SuperH SH.
2
;; Copyright (C) 2007, 2008, 2011 Free Software Foundation, Inc.
3
;;
4
;; This file is part of GCC.
5
;;
6
;; GCC is free software; you can redistribute it and/or modify
7
;; it under the terms of the GNU General Public License as published by
8
;; the Free Software Foundation; either version 3, or (at your option)
9
;; any later version.
10
;;
11
;; GCC is distributed in the hope that it will be useful,
12
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
;; GNU General Public License for more details.
15
;;
16
;; You should have received a copy of the GNU General Public License
17
;; along with GCC; see the file COPYING3.  If not see
18
;; .
19
 
20
;; Overview of uppercase letter constraints:
21
;; Bxx: miscellaneous constraints
22
;;  Bsc: SCRATCH - for the scratch register in movsi_ie in the
23
;;       fldi0 / fldi0 cases
24
;; Cxx: Constants other than only CONST_INT
25
;;  Css: signed 16-bit constant, literal or symbolic
26
;;  Csu: unsigned 16-bit constant, literal or symbolic
27
;;  Csy: label or symbol
28
;;  Cpg: non-explicit constants that can be directly loaded into a general
29
;;       purpose register in PIC code.  like 's' except we don't allow
30
;;       PIC_ADDR_P
31
;; IJKLMNOP: CONT_INT constants
32
;;  Ixx: signed xx bit
33
;;  J16: 0xffffffff00000000 | 0x00000000ffffffff
34
;;  Kxx: unsigned xx bit
35
;;  M: 1
36
;;  N: 0
37
;;  P27: 1 | 2 | 8 | 16
38
;;  Pso: 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128
39
;;  Psz: ~1 | ~2 | ~4 | ~8 | ~16 | ~32 | ~64 | ~128
40
;; Q: pc relative load operand
41
;; Rxx: reserved for exotic register classes.
42
;; Sxx: extra memory (storage) constraints
43
;;  Sua: unaligned memory operations
44
;; W: vector
45
;; Z: zero in any mode
46
;;
47
;; unused CONST_INT constraint letters: LO
48
;; unused EXTRA_CONSTRAINT letters: D T U Y
49
 
50
;; Register constraints
51
(define_register_constraint "a" "ALL_REGS"
52
  "@internal")
53
 
54
(define_register_constraint "b" "TARGET_REGS"
55
  "Branch target registers.")
56
 
57
(define_register_constraint "c" "FPSCR_REGS"
58
  "Floating-point status register.")
59
 
60
(define_register_constraint "d" "DF_REGS"
61
  "Double precision floating-point register.")
62
 
63
(define_register_constraint "e" "TARGET_FMOVD ? NO_REGS : FP_REGS"
64
  "Floating-point register.")
65
 
66
(define_register_constraint "f" "FP_REGS"
67
  "Floating-point register.")
68
 
69
(define_register_constraint "k" "SIBCALL_REGS"
70
  "@internal")
71
 
72
(define_register_constraint "l" "PR_REGS"
73
  "PR register.")
74
 
75
(define_register_constraint "t" "T_REGS"
76
  "T register.")
77
 
78
(define_register_constraint "u" "NON_SP_REGS"
79
  "Non-stack-pointer register.")
80
 
81
(define_register_constraint "w" "FP0_REGS"
82
  "Floating-point register 0.")
83
 
84
(define_register_constraint "x" "MAC_REGS"
85
  "MACH and MACL registers.")
86
 
87
(define_register_constraint "y" "FPUL_REGS"
88
  "FPUL register.")
89
 
90
(define_register_constraint "z" "R0_REGS"
91
  "R0 register.")
92
 
93
;; Integer constraints
94
(define_constraint "I06"
95
  "A signed 6-bit constant, as used in SHmedia beqi, bnei and xori."
96
  (and (match_code "const_int")
97
       (match_test "ival >= -32 && ival <= 31")))
98
 
99
(define_constraint "I08"
100
  "A signed 8-bit constant, as used in add, sub, etc."
101
  (and (match_code "const_int")
102
       (match_test "ival >= -128 && ival <= 127")))
103
 
104
(define_constraint "I10"
105
  "A signed 10-bit constant, as used in SHmedia andi, ori."
106
  (and (match_code "const_int")
107
       (match_test "ival >= -512 && ival <= 511")))
108
 
109
(define_constraint "I16"
110
  "A signed 16-bit constant, as used in SHmedia movi."
111
  (and (match_code "const_int")
112
       (match_test "ival >= -32768 && ival <= 32767")))
113
 
114
(define_constraint "I20"
115
  "A signed 20-bit constant, as used in SH2A movi20."
116
  (and (match_code "const_int")
117
       (match_test "ival >= -524288 && ival <= 524287")
118
       (match_test "TARGET_SH2A")))
119
 
120
(define_constraint "I28"
121
  "A signed 28-bit constant, as used in SH2A movi20s."
122
  (and (match_code "const_int")
123
       (match_test "ival >=  -134217728 && ival <= 134217727")
124
       (match_test "(ival & 255) == 0")
125
       (match_test "TARGET_SH2A")))
126
(define_constraint "J16"
127
  "0xffffffff00000000 or 0x00000000ffffffff."
128
  (and (match_code "const_int")
129
       (match_test "CONST_OK_FOR_J16 (ival)")))
130
 
131
(define_constraint "K03"
132
  "An unsigned 3-bit constant, as used in SH2A bclr, bset, etc."
133
  (and (match_code "const_int")
134
       (match_test "ival >= 0 && ival <= 7")))
135
 
136
(define_constraint "K08"
137
  "An unsigned 8-bit constant, as used in and, or, etc."
138
  (and (match_code "const_int")
139
       (match_test "ival >= 0 && ival <= 255")))
140
 
141
(define_constraint "K12"
142
  "An unsigned 8-bit constant, as used in SH2A 12-bit displacement addressing."
143
  (and (match_code "const_int")
144
       (match_test "ival >= 0 && ival <= 4095")))
145
 
146
(define_constraint "K16"
147
  "An unsigned 16-bit constant, as used in SHmedia shori."
148
  (and (match_code "const_int")
149
       (match_test "ival >= 0 && ival <= 65535")))
150
 
151
(define_constraint "P27"
152
  "A constant for shift operand 1,2,8 or 16."
153
  (and (match_code "const_int")
154
       (match_test "ival == 1 || ival == 2 || ival == 8 || ival == 16")))
155
 
156
(define_constraint "M"
157
  "Integer constant 1."
158
  (and (match_code "const_int")
159
       (match_test "ival == 1")))
160
 
161
(define_constraint "N"
162
  "Integer constant 0."
163
  (and (match_code "const_int")
164
       (match_test "ival == 0")))
165
 
166
;; Floating-point constraints
167
(define_constraint "G"
168
  "Double constant 0."
169
  (and (match_code "const_double")
170
       (match_test "fp_zero_operand (op) && fldi_ok ()")))
171
 
172
(define_constraint "H"
173
  "Double constant 1."
174
  (and (match_code "const_double")
175
       (match_test "fp_one_operand (op) && fldi_ok ()")))
176
 
177
;; Extra constraints
178
(define_constraint "Q"
179
  "A pc relative load operand."
180
  (and (match_code "mem")
181
       (match_test "IS_PC_RELATIVE_LOAD_ADDR_P (XEXP (op, 0))")))
182
 
183
(define_constraint "Bsc"
184
  "Constraint for selecting FLDI0 or FLDI1 instruction.  If the clobber
185
   operand is not SCRATCH (i.e. REG) then R0 is probably being used,
186
   hence mova is being used, hence do not select this pattern."
187
  (match_code "scratch"))
188
 
189
(define_constraint "Css"
190
  "A signed 16-bit constant, literal or symbolic."
191
  (and (match_code "const")
192
       (match_test "GET_CODE (XEXP (op, 0)) == UNSPEC")
193
       (match_test "XINT (XEXP (op, 0), 1) == UNSPEC_EXTRACT_S16")))
194
 
195
(define_constraint "Csu"
196
  "An unsigned 16-bit constant, literal or symbolic."
197
  (and (match_code "const")
198
       (match_test "GET_CODE (XEXP (op, 0)) == UNSPEC")
199
       (match_test "XINT (XEXP (op, 0), 1) == UNSPEC_EXTRACT_U16")))
200
 
201
(define_constraint "Csy"
202
  "A label or a symbol."
203
  (ior (match_test "NON_PIC_REFERENCE_P (op)")
204
       (match_test "PIC_ADDR_P (op)")))
205
 
206
(define_constraint "Z"
207
  "A zero in any shape or form."
208
  (match_test "op == CONST0_RTX (GET_MODE (op))"))
209
 
210
(define_constraint "W"
211
  "Any vector constant we can handle."
212
  (and (match_code "const_vector")
213
       (ior (match_test "sh_rep_vec (op, VOIDmode)")
214
            (match_test "HOST_BITS_PER_WIDE_INT >= 64
215
                         ? sh_const_vec (op, VOIDmode)
216
                         : sh_1el_vec (op, VOIDmode)"))))
217
 
218
(define_constraint "Cpg"
219
  "A non-explicit constant that can be loaded directly into a general
220
   purpose register.  This is like 's' except we don't allow
221
   PIC_ADDR_P."
222
  (match_test "IS_NON_EXPLICIT_CONSTANT_P (op)"))
223
 
224
(define_constraint "Pso"
225
  "Integer constant with a single bit set in its lower 8-bit."
226
  (and (match_code "const_int")
227
       (ior (match_test "ival == 1")
228
            (match_test "ival == 2")
229
            (match_test "ival == 4")
230
            (match_test "ival == 8")
231
            (match_test "ival == 16")
232
            (match_test "ival == 32")
233
            (match_test "ival == 64")
234
            (match_test "ival == 128"))))
235
 
236
(define_constraint "Psz"
237
  "Integer constant with a single zero bit in the lower 8-bit."
238
  (and (match_code "const_int")
239
       (ior (match_test "~ival == 1")
240
            (match_test "~ival == 2")
241
            (match_test "~ival == 4")
242
            (match_test "~ival == 8")
243
            (match_test "~ival == 16")
244
            (match_test "~ival == 32")
245
            (match_test "~ival == 64")
246
            (match_test "~ival == 128"))))
247
 
248
(define_memory_constraint "Sr0"
249
  "@internal"
250
  (and (match_test "memory_operand (op, GET_MODE (op))")
251
       (match_test "!refers_to_regno_p (R0_REG, R0_REG + 1, op, (rtx *) 0)")))
252
 
253
(define_memory_constraint "Sua"
254
  "@internal"
255
  (and (match_test "memory_operand (op, GET_MODE (op))")
256
       (match_test "GET_CODE (XEXP (op, 0)) != PLUS")))
257
 
258
(define_memory_constraint "Sbv"
259
  "A memory reference, as used in SH2A bclr.b, bset.b, etc."
260
  (and (match_test "MEM_P (op) && GET_MODE (op) == QImode")
261
       (match_test "REG_P (XEXP (op, 0))")))
262
 
263
(define_memory_constraint "Sbw"
264
  "A memory reference, as used in SH2A bclr.b, bset.b, etc."
265
  (and (match_test "MEM_P (op) && GET_MODE (op) == QImode")
266
       (match_test "GET_CODE (XEXP (op, 0)) == PLUS")
267
       (match_test "REG_P (XEXP (XEXP (op, 0), 0))")
268
       (match_test "satisfies_constraint_K12 (XEXP (XEXP (op, 0), 1))")))

powered by: WebSVN 2.1.0

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