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

Subversion Repositories openrisc

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

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

Line No. Rev Author Line
1 709 jeremybenn
;; Predicate definitions for ATMEL AVR micro controllers.
2
;; Copyright (C) 2006, 2007, 2008 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
;; Registers from r0 to r15.
21
(define_predicate "l_register_operand"
22
  (and (match_code "reg")
23
       (match_test "REGNO (op) <= 15")))
24
 
25
;; Registers from r16 to r31.
26
(define_predicate "d_register_operand"
27
  (and (match_code "reg")
28
       (match_test "REGNO (op) >= 16 && REGNO (op) <= 31")))
29
 
30
(define_predicate "even_register_operand"
31
  (and (match_code "reg")
32
       (and (match_test "REGNO (op) <= 31")
33
            (match_test "(REGNO (op) & 1) == 0"))))
34
 
35
(define_predicate "odd_register_operand"
36
  (and (match_code "reg")
37
       (and (match_test "REGNO (op) <= 31")
38
            (match_test "(REGNO (op) & 1) != 0"))))
39
 
40
;; SP register.
41
(define_predicate "stack_register_operand"
42
  (and (match_code "reg")
43
       (match_test "REGNO (op) == REG_SP")))
44
 
45
;; Return true if OP is a valid address for lower half of I/O space.
46
(define_predicate "low_io_address_operand"
47
  (and (match_code "const_int")
48
       (match_test "IN_RANGE (INTVAL (op) - avr_current_arch->sfr_offset,
49
                              0, 0x1f)")))
50
 
51
;; Return true if OP is a valid address for high half of I/O space.
52
(define_predicate "high_io_address_operand"
53
  (and (match_code "const_int")
54
       (match_test "IN_RANGE (INTVAL (op) - avr_current_arch->sfr_offset,
55
                              0x20, 0x3F)")))
56
 
57
;; Return true if OP is a valid address of I/O space.
58
(define_predicate "io_address_operand"
59
  (and (match_code "const_int")
60
       (match_test "IN_RANGE (INTVAL (op) - avr_current_arch->sfr_offset,
61
                              0, 0x40 - GET_MODE_SIZE (mode))")))
62
 
63
;; Return 1 if OP is a general operand not in flash memory
64
(define_predicate "nop_general_operand"
65
  (and (match_operand 0 "general_operand")
66
       (match_test "!avr_mem_flash_p (op)")))
67
 
68
;; Return 1 if OP is an "ordinary" general operand, i.e. a general
69
;; operand whose load is not handled by a libgcc call or ELPM.
70
(define_predicate "nox_general_operand"
71
  (and (match_operand 0 "general_operand")
72
       (not (match_test "avr_load_libgcc_p (op)"))
73
       (not (match_test "avr_mem_memx_p (op)"))))
74
 
75
;; Return 1 if OP is the zero constant for MODE.
76
(define_predicate "const0_operand"
77
  (and (match_code "const_int,const_double")
78
       (match_test "op == CONST0_RTX (mode)")))
79
 
80
;; Return 1 if OP is the one constant integer for MODE.
81
(define_predicate "const1_operand"
82
  (and (match_code "const_int")
83
       (match_test "op == CONST1_RTX (mode)")))
84
 
85
 
86
;; Return 1 if OP is constant integer 0..7 for MODE.
87
(define_predicate "const_0_to_7_operand"
88
  (and (match_code "const_int")
89
       (match_test "IN_RANGE (INTVAL (op), 0, 7)")))
90
 
91
;; Return 1 if OP is constant integer 2..7 for MODE.
92
(define_predicate "const_2_to_7_operand"
93
  (and (match_code "const_int")
94
       (match_test "IN_RANGE (INTVAL (op), 2, 7)")))
95
 
96
;; Return 1 if OP is constant integer 1..6 for MODE.
97
(define_predicate "const_1_to_6_operand"
98
  (and (match_code "const_int")
99
       (match_test "IN_RANGE (INTVAL (op), 1, 6)")))
100
 
101
;; Return 1 if OP is constant integer 2..6 for MODE.
102
(define_predicate "const_2_to_6_operand"
103
  (and (match_code "const_int")
104
       (match_test "IN_RANGE (INTVAL (op), 2, 6)")))
105
 
106
;; Returns true if OP is either the constant zero or a register.
107
(define_predicate "reg_or_0_operand"
108
  (ior (match_operand 0 "register_operand")
109
       (match_operand 0 "const0_operand")))
110
 
111
;; Returns 1 if OP is a SYMBOL_REF.
112
(define_predicate "symbol_ref_operand"
113
  (match_code "symbol_ref"))
114
 
115
;; Return true if OP is a text segment reference.
116
;; This is needed for program memory address expressions.
117
(define_predicate "text_segment_operand"
118
  (match_code "code_label,label_ref,symbol_ref,plus,const")
119
{
120
  switch (GET_CODE (op))
121
    {
122
    case CODE_LABEL:
123
      return true;
124
    case LABEL_REF :
125
      return true;
126
    case SYMBOL_REF :
127
      return SYMBOL_REF_FUNCTION_P (op);
128
    case PLUS :
129
      /* Assume canonical format of symbol + constant.
130
         Fall through.  */
131
    case CONST :
132
      return text_segment_operand (XEXP (op, 0), VOIDmode);
133
    default :
134
      return false;
135
    }
136
})
137
 
138
;; Return true if OP is a constant that contains only one 1 in its
139
;; binary representation.
140
(define_predicate "single_one_operand"
141
  (and (match_code "const_int")
142
       (match_test "exact_log2(INTVAL (op) & GET_MODE_MASK (mode)) >= 0")))
143
 
144
;; Return true if OP is a constant that contains only one 0 in its
145
;; binary representation.
146
(define_predicate "single_zero_operand"
147
  (and (match_code "const_int")
148
       (match_test "exact_log2(~INTVAL (op) & GET_MODE_MASK (mode)) >= 0")))
149
 
150
;;
151
(define_predicate "avr_sp_immediate_operand"
152
  (and (match_code "const_int")
153
       (match_test "satisfies_constraint_Csp (op)")))
154
 
155
;; True for EQ & NE
156
(define_predicate "eqne_operator"
157
  (match_code "eq,ne"))
158
 
159
;; True for GE & LT
160
(define_predicate "gelt_operator"
161
  (match_code "ge,lt"))
162
 
163
;; True for GT, GTU, LE & LEU
164
(define_predicate "difficult_comparison_operator"
165
  (match_code "gt,gtu,le,leu"))
166
 
167
;; False for GT, GTU, LE & LEU
168
(define_predicate "simple_comparison_operator"
169
  (and (match_operand 0 "comparison_operator")
170
       (not (match_code "gt,gtu,le,leu"))))
171
 
172
;; Return true if OP is a valid call operand.
173
(define_predicate "call_insn_operand"
174
  (and (match_code "mem")
175
       (ior (match_test "register_operand (XEXP (op, 0), mode)")
176
            (match_test "CONSTANT_ADDRESS_P (XEXP (op, 0))"))))
177
 
178
;; For some insns we must ensure that no hard register is inserted
179
;; into their operands because the insns are split and the split
180
;; involves hard registers.  An example are divmod insn that are
181
;; split to insns that represent implicit library calls.
182
 
183
;; True for register that is pseudo register.
184
(define_predicate "pseudo_register_operand"
185
  (and (match_operand 0 "register_operand")
186
       (not (and (match_code "reg")
187
                 (match_test "HARD_REGISTER_P (op)")))))
188
 
189
;; True for operand that is pseudo register or CONST_INT.
190
(define_predicate "pseudo_register_or_const_int_operand"
191
  (ior (match_operand 0 "const_int_operand")
192
       (match_operand 0 "pseudo_register_operand")))
193
 
194
;; We keep combiner from inserting hard registers into the input of sign- and
195
;; zero-extends.  A hard register in the input operand is not wanted because
196
;; 32-bit multiply patterns clobber some hard registers and extends with a
197
;; hard register that overlaps these clobbers won't combine to a widening
198
;; multiplication.  There is no need for combine to propagate or insert
199
;; hard registers, register allocation can do it just as well.
200
 
201
;; True for operand that is pseudo register at combine time.
202
(define_predicate "combine_pseudo_register_operand"
203
  (ior (match_operand 0 "pseudo_register_operand")
204
       (and (match_operand 0 "register_operand")
205
            (match_test "reload_completed || reload_in_progress"))))
206
 
207
;; Return true if OP is a constant integer that is either
208
;; 8 or 16 or 24.
209
(define_predicate "const_8_16_24_operand"
210
  (and (match_code "const_int")
211
       (match_test "8 == INTVAL(op) || 16 == INTVAL(op) || 24 == INTVAL(op)")))
212
 
213
;; Unsigned CONST_INT that fits in 8 bits, i.e. 0..255.
214
(define_predicate "u8_operand"
215
  (and (match_code "const_int")
216
       (match_test "IN_RANGE (INTVAL (op), 0, 255)")))
217
 
218
;; Signed CONST_INT that fits in 8 bits, i.e. -128..127.
219
(define_predicate "s8_operand"
220
  (and (match_code "const_int")
221
       (match_test "IN_RANGE (INTVAL (op), -128, 127)")))
222
 
223
;; One-extended CONST_INT that fits in 8 bits, i.e. -256..-1.
224
(define_predicate "o8_operand"
225
  (and (match_code "const_int")
226
       (match_test "IN_RANGE (INTVAL (op), -256, -1)")))
227
 
228
;; Signed CONST_INT that fits in 9 bits, i.e. -256..255.
229
(define_predicate "s9_operand"
230
  (and (match_code "const_int")
231
       (match_test "IN_RANGE (INTVAL (op), -256, 255)")))
232
 
233
(define_predicate "register_or_s9_operand"
234
  (ior (match_operand 0 "register_operand")
235
       (match_operand 0 "s9_operand")))
236
 
237
;; Unsigned CONST_INT that fits in 16 bits, i.e. 0..65536.
238
(define_predicate "u16_operand"
239
  (and (match_code "const_int")
240
       (match_test "IN_RANGE (INTVAL (op), 0, (1<<16)-1)")))
241
 
242
;; Signed CONST_INT that fits in 16 bits, i.e. -32768..32767.
243
(define_predicate "s16_operand"
244
  (and (match_code "const_int")
245
       (match_test "IN_RANGE (INTVAL (op), -(1<<15), (1<<15)-1)")))
246
 
247
;; One-extended CONST_INT that fits in 16 bits, i.e. -65536..-1.
248
(define_predicate "o16_operand"
249
  (and (match_code "const_int")
250
       (match_test "IN_RANGE (INTVAL (op), -(1<<16), -1)")))

powered by: WebSVN 2.1.0

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