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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [config/] [tilepro/] [predicates.md] - Blame information for rev 750

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

Line No. Rev Author Line
1 709 jeremybenn
;; Predicate definitions for Tilera TILEPro chip.
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 network register identifier.
34
(define_predicate "netreg_operand"
35
  (and (match_code "const_int")
36
       (match_test "IN_RANGE (INTVAL (op), 0, 6)")))
37
 
38
; Return 1 if OP is an unsigned 5-bit constant.
39
(define_predicate "u5bit_cint_operand"
40
  (and (match_code "const_int")
41
       (match_test "INTVAL (op) == (INTVAL (op) & 0x1F)")))
42
 
43
;; Return 1 if OP is an unsigned 16-bit constant.
44
(define_predicate "u16bit_cint_operand"
45
  (and (match_code "const_int")
46
       (match_test "(unsigned HOST_WIDE_INT)INTVAL (op) < (1U << 16)")))
47
 
48
;; Return 1 if OP is a signed 8-bit constant.
49
(define_predicate "s8bit_cint_operand"
50
  (and (match_code "const_int")
51
       (match_test "satisfies_constraint_I (op)")))
52
 
53
;; Return 1 if OP is a signed 16-bit constant.
54
(define_predicate "s16bit_cint_operand"
55
  (and (match_code "const_int")
56
       (match_test "satisfies_constraint_J (op)")))
57
 
58
;; Return 1 if OP is a nonzero integer constant whose low 16 bits are zero.
59
(define_predicate "auli_cint_operand"
60
  (and (match_code "const_int")
61
       (match_test "satisfies_constraint_K (op)")))
62
 
63
;; Return 1 if OP is an unsigned 15-bit constant.
64
(define_predicate "u15bit_cint_operand"
65
  (and (match_code "const_int")
66
       (match_test "(unsigned HOST_WIDE_INT)INTVAL (op) < (1U << 15)")))
67
 
68
;; Return 1 if OP is a constant or any register.
69
(define_predicate "reg_or_cint_operand"
70
  (ior (match_operand 0 "register_operand")
71
       (match_operand 0 "const_int_operand")))
72
 
73
;; Return 1 if OP is a 4-element vector constant with identical signed
74
;; 8-bit elements or any register.
75
(define_predicate "reg_or_v4s8bit_operand"
76
  (ior (match_operand 0 "register_operand")
77
       (and (match_code "const_vector")
78
            (match_test "CONST_VECTOR_NUNITS (op) == 4
79
                         && satisfies_constraint_I (CONST_VECTOR_ELT (op, 0))
80
                         && CONST_VECTOR_ELT (op, 0) == CONST_VECTOR_ELT (op, 1)
81
                         && CONST_VECTOR_ELT (op, 0) == CONST_VECTOR_ELT (op, 2)
82
                         && CONST_VECTOR_ELT (op, 0) == CONST_VECTOR_ELT (op, 3)"))))
83
 
84
;; Return 1 if OP is a 2-element vector constant with identical signed
85
;; 8-bit elements or any register.
86
(define_predicate "reg_or_v2s8bit_operand"
87
  (ior (match_operand 0 "register_operand")
88
       (and (match_code "const_vector")
89
            (match_test "CONST_VECTOR_NUNITS (op) == 2
90
                         && satisfies_constraint_I (CONST_VECTOR_ELT (op, 0))
91
                         && CONST_VECTOR_ELT (op, 0) == CONST_VECTOR_ELT (op, 1)"))))
92
 
93
;; Return 1 if the operand is a valid second operand to an add insn.
94
(define_predicate "add_operand"
95
  (if_then_else (match_code "const_int")
96
    (match_test "satisfies_constraint_J (op) || satisfies_constraint_K (op)")
97
    (match_operand 0 "register_operand")))
98
 
99
;; Return 1 if the operand is a register or signed 8-bit immediate operand.
100
(define_predicate "reg_or_s8bit_operand"
101
  (if_then_else (match_code "const_int")
102
    (match_test "satisfies_constraint_I (op)")
103
    (match_operand 0 "register_operand")))
104
 
105
;; Return 1 for an operand suitable for ANDing with a register.
106
(define_predicate "and_operand"
107
  (if_then_else (match_code "const_int")
108
    (match_test "satisfies_constraint_I (op) || satisfies_constraint_M (op)")
109
    (match_operand 0 "register_operand")))
110
 
111
;; Return 1 if the operand is a register or unsigned 5-bit immediate operand.
112
(define_predicate "reg_or_u5bit_operand"
113
  (if_then_else (match_code "const_int")
114
    (match_test "INTVAL (op) == (INTVAL (op) & 0x1F)")
115
    (match_operand 0 "register_operand")))
116
 
117
; Return 1 if the operand is 2, 4 or 8.
118
(define_predicate "cint_248_operand"
119
  (and (match_code "const_int")
120
       (match_test
121
        "INTVAL (op) == 2 || INTVAL (op) == 4 || INTVAL (op) == 8")))
122
 
123
 
124
;; Return true if OP is a TLS symbolic operand.
125
(define_predicate "tls_symbolic_operand"
126
  (and (match_code "symbol_ref")
127
       (match_test "SYMBOL_REF_TLS_MODEL (op) !=  TLS_MODEL_NONE")))
128
 
129
;; Return true if OP is a symbolic operand for the TLS Global Dynamic model.
130
(define_predicate "tls_gd_symbolic_operand"
131
  (and (match_code "symbol_ref")
132
       (match_test "SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_GLOBAL_DYNAMIC")))
133
 
134
;; Return true if OP is a symbolic operand for the TLS Local Dynamic model.
135
(define_predicate "tls_ld_symbolic_operand"
136
  (and (match_code "symbol_ref")
137
       (match_test "SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_LOCAL_DYNAMIC")))
138
 
139
;; Return true if OP is a symbolic operand that can be used for the
140
;; TLS Initial Exec model.
141
(define_predicate "tls_ie_symbolic_operand"
142
  (and (match_code "symbol_ref")
143
       (ior (match_test "SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_INITIAL_EXEC")
144
            (match_test "SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_LOCAL_EXEC"))))
145
 
146
;; Return true if OP is a symbolic operand for the TLS Local Exec model.
147
(define_predicate "tls_le_symbolic_operand"
148
  (and (match_code "symbol_ref")
149
       (match_test "SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_LOCAL_EXEC")))
150
 
151
;; Returns true if OP is any general operand except for an
152
;; auto-incrementing address operand.
153
(define_predicate "nonautoinc_operand"
154
  (and (match_operand 0 "general_operand")
155
       (not (ior (match_code "pre_dec") (match_code "pre_inc")
156
                 (match_code "post_dec") (match_code "post_inc")
157
                 (match_code "post_modify") (match_code "pre_modify")))))
158
 
159
;; Returns true if OP is a non-auto-incrementing memory operand.
160
(define_predicate "nonautoincmem_operand"
161
  (match_operand 0 "memory_operand")
162
{
163
  return nonautoinc_operand (XEXP (op, 0), GET_MODE (XEXP (op, 0)));
164
})
165
 
166
;; Returns true if OP is a non-auto-incrementing memory, general
167
;; operand.
168
(define_predicate "nonautoincmem_general_operand"
169
  (match_operand 0 "general_operand")
170
{
171
  if (memory_operand (op, mode))
172
    return nonautoinc_operand (XEXP (op, 0), GET_MODE (XEXP (op, 0)));
173
  else
174
    return true;
175
})
176
 
177
;; Returns true if OP is a non-auto-incrementing memory, non-immediate
178
;; operand.
179
(define_predicate "nonautoincmem_nonimmediate_operand"
180
  (match_operand 0 "nonimmediate_operand")
181
{
182
  if (memory_operand (op, mode))
183
    return nonautoinc_operand (XEXP (op, 0), GET_MODE (XEXP (op, 0)));
184
  else
185
    return true;
186
})
187
 
188
;; Return true if OP is a valid operand for the source of a move insn.
189
(define_predicate "move_operand"
190
  (match_operand 0 "general_operand")
191
{
192
  /* If both modes are non-void they must be the same.  */
193
  if (mode != VOIDmode && GET_MODE (op) != VOIDmode && mode != GET_MODE (op))
194
    return false;
195
 
196
  if (GET_MODE_SIZE (mode) > 4)
197
    return false;
198
 
199
  switch (GET_CODE (op))
200
    {
201
    case CONST_INT:
202
      return (satisfies_constraint_J (op)
203
              || satisfies_constraint_K (op)
204
              || satisfies_constraint_N (op)
205
              || satisfies_constraint_P (op));
206
 
207
    case HIGH:
208
      return true;
209
 
210
    case MEM:
211
      return memory_address_p (mode, XEXP (op, 0));
212
 
213
    default:
214
      return register_operand (op, mode);
215
    }
216
})
217
 
218
;; Returns 1 if OP is a symbolic operand, i.e. a symbol_ref or a label_ref,
219
;; possibly with an offset.
220
(define_predicate "symbolic_operand"
221
  (ior (match_code "symbol_ref,label_ref")
222
       (and (match_code "const")
223
            (match_test "GET_CODE (XEXP (op,0)) == PLUS
224
                         && (GET_CODE (XEXP (XEXP (op,0), 0)) == SYMBOL_REF
225
                             || GET_CODE (XEXP (XEXP (op,0), 0)) == LABEL_REF)
226
                         && CONST_INT_P (XEXP (XEXP (op,0), 1))"))))
227
 
228
;; Returns 1 if OP is a symbolic operand, or a const unspec wrapper
229
;; representing a got reference, a tls reference, or pc-relative
230
;; reference.
231
(define_predicate "const_symbolic_operand"
232
  (ior (match_operand 0 "symbolic_operand")
233
       (and (match_code "const")
234
            (match_test "GET_CODE (XEXP (op,0)) == UNSPEC")
235
            (ior (match_test "XINT (XEXP (op,0), 1) == UNSPEC_GOT16_SYM")
236
                 (match_test "XINT (XEXP (op,0), 1) == UNSPEC_GOT32_SYM")
237
                 (match_test "XINT (XEXP (op,0), 1) == UNSPEC_PCREL_SYM")
238
                 (match_test "XINT (XEXP (op,0), 1) == UNSPEC_TLS_GD")
239
                 (match_test "XINT (XEXP (op,0), 1) == UNSPEC_TLS_IE")
240
                 (match_test "XINT (XEXP (op,0), 1) == UNSPEC_TLS_LE")))))
241
 
242
;; Return true if OP is an address suitable for a call insn.
243
;; Call insn on TILE can take a PC-relative constant address
244
;; or any regular memory address.
245
(define_predicate "call_address_operand"
246
  (ior (match_operand 0 "symbolic_operand")
247
       (match_test "memory_address_p (Pmode, op)")))
248
 
249
;; Return true if OP is an operand suitable for a call insn.
250
(define_predicate "call_operand"
251
  (and (match_code "mem")
252
       (match_test "call_address_operand (XEXP (op, 0), mode)")))
253
 
254
;; Return 1 if OP is a signed comparison operation.
255
;; We can use these directly in compares against zero.
256
(define_predicate "signed_comparison_operator"
257
  (match_code "eq,ne,le,lt,ge,gt"))
258
 
259
;; Return 1 if OP is a equal or not-equal operation.
260
(define_predicate "eqne_operator"
261
  (match_code "eq,ne"))

powered by: WebSVN 2.1.0

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