comparison gcc/config/avr/constraints.md @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents a06113de4d67
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 ;; Constraint definitions for ATMEL AVR micro controllers. 1 ;; Constraint definitions for ATMEL AVR micro controllers.
2 ;; Copyright (C) 2006, 2007 Free Software Foundation, Inc. 2 ;; Copyright (C) 2006-2017 Free Software Foundation, Inc.
3 ;; 3 ;;
4 ;; This file is part of GCC. 4 ;; This file is part of GCC.
5 ;; 5 ;;
6 ;; GCC is free software; you can redistribute it and/or modify 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 7 ;; it under the terms of the GNU General Public License as published by
96 (define_constraint "G" 96 (define_constraint "G"
97 "Constant float 0." 97 "Constant float 0."
98 (and (match_code "const_double") 98 (and (match_code "const_double")
99 (match_test "op == CONST0_RTX (SFmode)"))) 99 (match_test "op == CONST0_RTX (SFmode)")))
100 100
101 (define_constraint "R"
102 "Integer constant in the range -6 @dots{} 5."
103 (and (match_code "const_int")
104 (match_test "ival >= -6 && ival <= 5")))
105
106 (define_memory_constraint "Q" 101 (define_memory_constraint "Q"
107 "A memory address based on Y or Z pointer with displacement." 102 "A memory address based on Y or Z pointer with displacement."
108 (and (match_code "mem") 103 (and (match_code "mem")
109 (match_test "extra_constraint_Q (op)"))) 104 (match_test "extra_constraint_Q (op)")))
105
106 (define_constraint "Cm2"
107 "Constant integer @minus{}2."
108 (and (match_code "const_int")
109 (match_test "ival == -2")))
110
111 (define_constraint "C03"
112 "Constant integer 3."
113 (and (match_code "const_int")
114 (match_test "ival == 3")))
115
116 (define_constraint "C04"
117 "Constant integer 4."
118 (and (match_code "const_int")
119 (match_test "ival == 4")))
120
121 (define_constraint "C05"
122 "Constant integer 5."
123 (and (match_code "const_int")
124 (match_test "ival == 5")))
125
126 (define_constraint "C06"
127 "Constant integer 6."
128 (and (match_code "const_int")
129 (match_test "ival == 6")))
130
131 (define_constraint "C07"
132 "Constant integer 7."
133 (and (match_code "const_int")
134 (match_test "ival == 7")))
135
136 (define_constraint "Ca1"
137 "Constant 1-byte integer that allows AND by means of CLT + BLD."
138 (and (match_code "const_int")
139 (match_test "avr_popcount_each_byte (op, 1, 1<<7)")))
140
141 (define_constraint "Ca2"
142 "Constant 2-byte integer that allows AND without clobber register."
143 (and (match_code "const_int")
144 (match_test "avr_popcount_each_byte (op, 2, (1<<0) | (1<<7) | (1<<8))")))
145
146 (define_constraint "Ca3"
147 "Constant 3-byte integer that allows AND without clobber register."
148 (and (match_code "const_int")
149 (match_test "avr_popcount_each_byte (op, 3, (1<<0) | (1<<7) | (1<<8))")))
150
151 (define_constraint "Ca4"
152 "Constant 4-byte integer that allows AND without clobber register."
153 (and (match_code "const_int")
154 (match_test "avr_popcount_each_byte (op, 4, (1<<0) | (1<<7) | (1<<8))")))
155
156 (define_constraint "Co1"
157 "Constant 1-byte integer that allows AND by means of SET + BLD."
158 (and (match_code "const_int")
159 (match_test "avr_popcount_each_byte (op, 1, 1<<1)")))
160
161 (define_constraint "Co2"
162 "Constant 2-byte integer that allows OR without clobber register."
163 (and (match_code "const_int")
164 (match_test "avr_popcount_each_byte (op, 2, (1<<0) | (1<<1) | (1<<8))")))
165
166 (define_constraint "Co3"
167 "Constant 3-byte integer that allows OR without clobber register."
168 (and (match_code "const_int")
169 (match_test "avr_popcount_each_byte (op, 3, (1<<0) | (1<<1) | (1<<8))")))
170
171 (define_constraint "Co4"
172 "Constant 4-byte integer that allows OR without clobber register."
173 (and (match_code "const_int")
174 (match_test "avr_popcount_each_byte (op, 4, (1<<0) | (1<<1) | (1<<8))")))
175
176 (define_constraint "Cx2"
177 "Constant 2-byte integer that allows XOR without clobber register."
178 (and (match_code "const_int")
179 (match_test "avr_popcount_each_byte (op, 2, (1<<0) | (1<<8))")))
180
181 (define_constraint "Cx3"
182 "Constant 3-byte integer that allows XOR without clobber register."
183 (and (match_code "const_int")
184 (match_test "avr_popcount_each_byte (op, 3, (1<<0) | (1<<8))")))
185
186 (define_constraint "Cx4"
187 "Constant 4-byte integer that allows XOR without clobber register."
188 (and (match_code "const_int")
189 (match_test "avr_popcount_each_byte (op, 4, (1<<0) | (1<<8))")))
190
191 (define_constraint "Csp"
192 "Integer constant in the range -11 @dots{} 6."
193 (and (match_code "const_int")
194 (match_test "IN_RANGE (ival, -11, 6)")))
195
196 (define_constraint "Cxf"
197 "32-bit integer constant where at least one nibble is 0xf."
198 (and (match_code "const_int")
199 (match_test "avr_has_nibble_0xf (op)")))
200
201 (define_constraint "C0f"
202 "32-bit integer constant where no nibble equals 0xf."
203 (and (match_code "const_int")
204 (match_test "!avr_has_nibble_0xf (op)")))
205
206 (define_constraint "Cn8"
207 "A negative constant integer in the range @minus{}255 @dots{} @minus{}1."
208 (and (match_code "const_int")
209 (match_test "IN_RANGE (ival, -255, -1)")))
210
211 ;; CONST_FIXED is no element of 'n' so cook our own.
212 ;; "i" or "s" would match but because the insn uses iterators that cover
213 ;; INT_MODE, "i" or "s" is not always possible.
214
215 (define_constraint "Ynn"
216 "Fixed-point constant known at compile time."
217 (match_code "const_fixed"))
218
219 (define_constraint "Y00"
220 "Fixed-point or integer constant with bit representation 0x0"
221 (and (match_code "const_fixed,const_int")
222 (match_test "op == CONST0_RTX (GET_MODE (op))")))
223
224 (define_constraint "Y01"
225 "Fixed-point or integer constant with bit representation 0x1"
226 (ior (and (match_code "const_fixed")
227 (match_test "1 == INTVAL (avr_to_int_mode (op))"))
228 (match_test "satisfies_constraint_P (op)")))
229
230 (define_constraint "Ym1"
231 "Fixed-point or integer constant with bit representation -0x1"
232 (ior (and (match_code "const_fixed")
233 (match_test "-1 == INTVAL (avr_to_int_mode (op))"))
234 (match_test "satisfies_constraint_N (op)")))
235
236 (define_constraint "Y02"
237 "Fixed-point or integer constant with bit representation 0x2"
238 (ior (and (match_code "const_fixed")
239 (match_test "2 == INTVAL (avr_to_int_mode (op))"))
240 (match_test "satisfies_constraint_K (op)")))
241
242 (define_constraint "Ym2"
243 "Fixed-point or integer constant with bit representation -0x2"
244 (ior (and (match_code "const_fixed")
245 (match_test "-2 == INTVAL (avr_to_int_mode (op))"))
246 (match_test "satisfies_constraint_Cm2 (op)")))
247
248 (define_constraint "Yx2"
249 "Fixed-point or integer constant not in the range @minus{}2 @dots{} 2"
250 (and (ior (match_code "const_int")
251 (match_code "const_fixed"))
252 (match_test "!IN_RANGE (INTVAL (avr_to_int_mode (op)), -2, 2)")))
253
254 ;; Similar to "IJ" used with ADIW/SBIW, but for CONST_FIXED.
255
256 (define_constraint "YIJ"
257 "Fixed-point constant from @minus{}0x003f to 0x003f."
258 (and (match_code "const_fixed")
259 (match_test "IN_RANGE (INTVAL (avr_to_int_mode (op)), -63, 63)")))