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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [config/] [tilegx/] [predicates.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
;; Predicate definitions for Tilera TILE-Gx.
2
;; Copyright (C) 2011, 2012
3
;; Free Software Foundation, Inc.
4
;; Contributed by Walter Lee (walt@tilera.com)
5
;;
6
;; This file is part of GCC.
7
;;
8
;; GCC is free software; you can redistribute it and/or modify it
9
;; under the terms of the GNU General Public License as published
10
;; by the Free Software Foundation; either version 3, or (at your
11
;; option) any later version.
12
;;
13
;; GCC is distributed in the hope that it will be useful, but WITHOUT
14
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15
;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
16
;; License 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
;; Return true if OP is the zero constant for MODE.
23
(define_predicate "const_zero_operand"
24
  (and (match_code "const_int,const_double,const_vector")
25
       (match_test "op == CONST0_RTX (mode)")))
26
 
27
;; Returns true if OP is either the constant zero or a register.
28
(define_predicate "reg_or_0_operand"
29
  (and (ior (match_operand 0 "register_operand")
30
            (match_operand 0 "const_zero_operand"))
31
       (match_test "GET_MODE_SIZE (mode) <= UNITS_PER_WORD")))
32
 
33
; Return 1 if OP is a valid Pmode pointer.
34
(define_predicate "pointer_operand"
35
  (and (match_operand 0 "address_operand")
36
       (ior (match_operand 0 "pmode_register_operand")
37
            (match_operand 0 "const_zero_operand"))))
38
 
39
; Return 1 if OP is a network register identifier.
40
(define_predicate "netreg_operand"
41
  (and (match_code "const_int")
42
       (match_test "IN_RANGE (INTVAL (op), 0, 5)")))
43
 
44
; Return 1 if OP is an unsigned 6-bit constant.
45
(define_predicate "u6bit_cint_operand"
46
  (and (match_code "const_int")
47
       (match_test "INTVAL (op) == (INTVAL (op) & 0x3F)")))
48
 
49
;; Return 1 if OP is an unsigned 16-bit constant.
50
(define_predicate "u16bit_cint_operand"
51
  (and (match_code "const_int")
52
       (match_test "(unsigned HOST_WIDE_INT)INTVAL (op) < (1U << 16)")))
53
 
54
;; Return 1 if OP is a signed 8-bit constant.
55
(define_predicate "s8bit_cint_operand"
56
  (and (match_code "const_int")
57
       (match_test "satisfies_constraint_I (op)")))
58
 
59
;; Return 1 if OP is a signed 16-bit constant.
60
(define_predicate "s16bit_cint_operand"
61
  (and (match_code "const_int")
62
       (match_test "satisfies_constraint_J (op)")))
63
 
64
;; Return 1 if OP is an unsigned 14-bit constant.
65
(define_predicate "u14bit_cint_operand"
66
  (and (match_code "const_int")
67
       (match_test "(unsigned HOST_WIDE_INT)INTVAL (op) < (1U << 14)")))
68
 
69
;; Return 1 if OP is a constant or any register.
70
(define_predicate "reg_or_cint_operand"
71
  (ior (match_operand 0 "register_operand")
72
       (match_operand 0 "const_int_operand")))
73
 
74
;; Returns 1 if OP is a "last" unspec wrapper for a symbol, got, or
75
;; tls reference.
76
(define_predicate "const_last_symbolic_operand"
77
  (and (match_code "const")
78
       (match_test "GET_CODE (XEXP (op,0)) == UNSPEC")
79
       (ior (match_test "XINT (XEXP (op,0), 1) == UNSPEC_HW0_LAST")
80
            (match_test "XINT (XEXP (op,0), 1) == UNSPEC_HW1_LAST")
81
            (match_test "XINT (XEXP (op,0), 1) == UNSPEC_HW2_LAST")
82
            (match_test "XINT (XEXP (op,0), 1) == UNSPEC_HW1_LAST_PCREL")
83
            (match_test "XINT (XEXP (op,0), 1) == UNSPEC_HW0_LAST_GOT")
84
            (match_test "XINT (XEXP (op,0), 1) == UNSPEC_HW1_LAST_GOT")
85
            (match_test "XINT (XEXP (op,0), 1) == UNSPEC_HW1_LAST_TLS_GD")
86
            (match_test "XINT (XEXP (op,0), 1) == UNSPEC_HW1_LAST_TLS_IE")
87
            (match_test "XINT (XEXP (op,0), 1) == UNSPEC_HW1_LAST_TLS_LE"))))
88
 
89
;; Returns 1 if OP is an unspec wrapper for a symbol, got, or tls
90
;; reference.
91
(define_predicate "const_symbolic_operand"
92
  (and (match_code "const")
93
       (match_test "GET_CODE (XEXP (op,0)) == UNSPEC")
94
       (ior (match_test "XINT (XEXP (op,0), 1) == UNSPEC_HW0")
95
            (match_test "XINT (XEXP (op,0), 1) == UNSPEC_HW1")
96
            (match_test "XINT (XEXP (op,0), 1) == UNSPEC_HW2")
97
            (match_test "XINT (XEXP (op,0), 1) == UNSPEC_HW3")
98
            (match_test "XINT (XEXP (op,0), 1) == UNSPEC_HW0_PCREL")
99
            (match_test "XINT (XEXP (op,0), 1) == UNSPEC_HW0_GOT")
100
            (match_test "XINT (XEXP (op,0), 1) == UNSPEC_HW0_TLS_GD")
101
            (match_test "XINT (XEXP (op,0), 1) == UNSPEC_HW0_TLS_IE")
102
            (match_test "XINT (XEXP (op,0), 1) == UNSPEC_HW0_TLS_LE"))))
103
 
104
;; Return 1 if OP is a 8-element vector constant with identical signed
105
;; 8-bit elements or any register.
106
(define_predicate "reg_or_v8s8bit_operand"
107
  (ior (match_operand 0 "register_operand")
108
       (and (match_code "const_vector")
109
            (match_test "CONST_VECTOR_NUNITS (op) == 8
110
                         && satisfies_constraint_I (CONST_VECTOR_ELT (op, 0))
111
                         && CONST_VECTOR_ELT (op, 0) == CONST_VECTOR_ELT (op, 1)
112
                         && CONST_VECTOR_ELT (op, 0) == CONST_VECTOR_ELT (op, 2)
113
                         && CONST_VECTOR_ELT (op, 0) == CONST_VECTOR_ELT (op, 3)
114
                         && CONST_VECTOR_ELT (op, 0) == CONST_VECTOR_ELT (op, 4)
115
                         && CONST_VECTOR_ELT (op, 0) == CONST_VECTOR_ELT (op, 5)
116
                         && CONST_VECTOR_ELT (op, 0) == CONST_VECTOR_ELT (op, 6)
117
                         && CONST_VECTOR_ELT (op, 0) == CONST_VECTOR_ELT (op, 7)"))))
118
 
119
;; Return 1 if OP is a 4-element vector constant with identical signed
120
;; 8-bit elements or any register.
121
(define_predicate "reg_or_v4s8bit_operand"
122
  (ior (match_operand 0 "register_operand")
123
       (and (match_code "const_vector")
124
            (match_test "CONST_VECTOR_NUNITS (op) == 4
125
                         && satisfies_constraint_I (CONST_VECTOR_ELT (op, 0))
126
                         && CONST_VECTOR_ELT (op, 0) == CONST_VECTOR_ELT (op, 1)
127
                         && CONST_VECTOR_ELT (op, 0) == CONST_VECTOR_ELT (op, 2)
128
                         && CONST_VECTOR_ELT (op, 0) == CONST_VECTOR_ELT (op, 3)"))))
129
 
130
;; Return 1 if the operand is a valid second operand to an add insn.
131
(define_predicate "add_operand"
132
  (if_then_else (match_code "const_int")
133
    (match_test "satisfies_constraint_J (op)")
134
    (ior (match_operand 0 "register_operand")
135
         (match_operand 0 "const_last_symbolic_operand"))))
136
 
137
;; Return 1 if the operand is a register or signed 8-bit immediate operand.
138
(define_predicate "reg_or_s8bit_operand"
139
  (if_then_else (match_code "const_int")
140
    (match_test "satisfies_constraint_I (op)")
141
    (match_operand 0 "register_operand")))
142
 
143
;; Return 1 if the operand is a register or unsigned 5-bit immediate operand.
144
(define_predicate "reg_or_u5bit_operand"
145
  (if_then_else (match_code "const_int")
146
    (match_test "INTVAL (op) == (INTVAL (op) & 0x1F)")
147
    (match_operand 0 "register_operand")))
148
 
149
;; Return 1 if the operand is a register or unsigned 6-bit immediate operand.
150
(define_predicate "reg_or_u6bit_operand"
151
  (if_then_else (match_code "const_int")
152
    (match_test "INTVAL (op) == (INTVAL (op) & 0x3F)")
153
    (match_operand 0 "register_operand")))
154
 
155
;; Return 1 for an operand suitable for ANDing with a register.
156
(define_predicate "and_operand"
157
  (if_then_else (match_code "const_int")
158
    (match_test "satisfies_constraint_I (op) || satisfies_constraint_M (op)")
159
    (match_operand 0 "register_operand")))
160
 
161
; Return 1 if the operand is 2, 4 or 8.
162
(define_predicate "cint_248_operand"
163
  (and (match_code "const_int")
164
       (match_test
165
        "INTVAL (op) == 2 || INTVAL (op) == 4 || INTVAL (op) == 8")))
166
 
167
;; Return true if OP is a TLS symbolic operand.
168
(define_predicate "tls_symbolic_operand"
169
  (and (match_code "symbol_ref")
170
       (match_test "SYMBOL_REF_TLS_MODEL (op) !=  TLS_MODEL_NONE")))
171
 
172
;; Return true if OP is a symbolic operand for the TLS Global Dynamic model.
173
(define_predicate "tls_gd_symbolic_operand"
174
  (and (match_code "symbol_ref")
175
       (match_test "SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_GLOBAL_DYNAMIC")))
176
 
177
;; Return true if OP is a symbolic operand for the TLS Local Dynamic model.
178
(define_predicate "tls_ld_symbolic_operand"
179
  (and (match_code "symbol_ref")
180
       (match_test "SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_LOCAL_DYNAMIC")))
181
 
182
;; Return true if OP is a symbolic operand that can be used for the
183
;; TLS Initial Exec model.
184
(define_predicate "tls_ie_symbolic_operand"
185
  (and (match_code "symbol_ref")
186
       (ior (match_test "SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_INITIAL_EXEC")
187
            (match_test "SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_LOCAL_EXEC"))))
188
 
189
;; Return true if OP is a symbolic operand for the TLS Local Exec model.
190
(define_predicate "tls_le_symbolic_operand"
191
  (and (match_code "symbol_ref")
192
       (match_test "SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_LOCAL_EXEC")))
193
 
194
;; Returns true if OP is any general operand except for an
195
;; auto-incrementing address operand.
196
(define_predicate "nonautoinc_operand"
197
  (and (match_operand 0 "general_operand")
198
       (not (ior (match_code "pre_dec") (match_code "pre_inc")
199
                 (match_code "post_dec") (match_code "post_inc")
200
                 (match_code "post_modify") (match_code "pre_modify")))))
201
 
202
;; Returns true if OP is a non-auto-incrementing memory operand.
203
(define_predicate "nonautoincmem_operand"
204
  (match_operand 0 "memory_operand")
205
{
206
  return nonautoinc_operand (XEXP (op, 0), GET_MODE (XEXP (op, 0)));
207
})
208
 
209
;; Returns true if OP is a non-auto-incrementing memory, general
210
;; operand.
211
(define_predicate "nonautoincmem_general_operand"
212
  (match_operand 0 "general_operand")
213
{
214
  if (memory_operand (op, mode))
215
    return nonautoinc_operand (XEXP (op, 0), GET_MODE (XEXP (op, 0)));
216
  else
217
    return true;
218
})
219
 
220
;; Returns true if OP is a non-auto-incrementing memory, non-immediate
221
;; operand.
222
(define_predicate "nonautoincmem_nonimmediate_operand"
223
  (match_operand 0 "nonimmediate_operand")
224
{
225
  if (memory_operand (op, mode))
226
    return nonautoinc_operand (XEXP (op, 0), GET_MODE (XEXP (op, 0)));
227
  else
228
    return true;
229
})
230
 
231
;; Return true if OP is a valid operand for the source of a move insn.
232
(define_predicate "move_operand"
233
  (match_operand 0 "general_operand")
234
{
235
  /* If both modes are non-void they must be the same.  */
236
  if (mode != VOIDmode && GET_MODE (op) != VOIDmode && mode != GET_MODE (op))
237
    return false;
238
 
239
  switch (GET_CODE (op))
240
    {
241
    case CONST_INT:
242
      return (satisfies_constraint_J (op)
243
              || satisfies_constraint_K (op)
244
              || (mode == DImode &&
245
                  (satisfies_constraint_N (op)
246
                   || satisfies_constraint_P (op))));
247
 
248
    case MEM:
249
      return memory_address_p (mode, XEXP (op, 0));
250
 
251
    case CONST:
252
      return const_last_symbolic_operand (op, mode);
253
 
254
    default:
255
      return register_operand (op, mode);
256
    }
257
})
258
 
259
;; Returns 1 if OP is a symbolic operand, i.e. a symbol_ref or a label_ref,
260
;; possibly with an offset.
261
(define_predicate "symbolic_operand"
262
  (ior (match_code "symbol_ref,label_ref")
263
       (and (match_code "const")
264
            (match_test "GET_CODE (XEXP (op,0)) == PLUS
265
                         && (GET_CODE (XEXP (XEXP (op,0), 0)) == SYMBOL_REF
266
                             || GET_CODE (XEXP (XEXP (op,0), 0)) == LABEL_REF)
267
                         && CONST_INT_P (XEXP (XEXP (op,0), 1))"))))
268
 
269
;; Return 1 for an unsigned 16 bit or a const symbolc operand.
270
(define_predicate "u16bit_or_const_symbolic_operand"
271
  (ior (match_operand 0 "u16bit_cint_operand")
272
       (match_operand 0 "const_symbolic_operand")))
273
 
274
;; Return true if OP is an address suitable for a call insn.
275
;; Call insn on TILE can take a PC-relative constant address
276
;; or any regular memory address.
277
(define_predicate "call_address_operand"
278
  (ior (match_operand 0 "symbolic_operand")
279
       (match_test "memory_address_p (Pmode, op)")))
280
 
281
;; Return true if OP is an operand suitable for a call insn.
282
(define_predicate "call_operand"
283
  (and (match_code "mem")
284
       (match_test "call_address_operand (XEXP (op, 0), mode)")))
285
 
286
;; Return 1 if OP is a signed comparison operation.
287
;; We can use these directly in compares against zero.
288
(define_predicate "signed_comparison_operator"
289
  (match_code "eq,ne,le,lt,ge,gt"))
290
 
291
;; Return 1 if OP is a equal or not-equal operation.
292
(define_predicate "eqne_operator"
293
  (match_code "eq,ne"))

powered by: WebSVN 2.1.0

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