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

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents f6334be47118
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 ;; Constraint definitions for MIPS. 1 ;; Constraint definitions for MIPS.
2 ;; Copyright (C) 2006, 2007, 2008, 2010 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
17 ;; along with GCC; see the file COPYING3. If not see 17 ;; along with GCC; see the file COPYING3. If not see
18 ;; <http://www.gnu.org/licenses/>. 18 ;; <http://www.gnu.org/licenses/>.
19 19
20 ;; Register constraints 20 ;; Register constraints
21 21
22 (define_register_constraint "d" "BASE_REG_CLASS" 22 (define_register_constraint "d" "TARGET_MIPS16 ? M16_REGS : GR_REGS"
23 "An address register. This is equivalent to @code{r} unless 23 "A general-purpose register. This is equivalent to @code{r} unless
24 generating MIPS16 code.") 24 generating MIPS16 code, in which case the MIPS16 register set is used.")
25 25
26 (define_register_constraint "t" "T_REG" 26 (define_register_constraint "t" "T_REG"
27 "@internal") 27 "@internal")
28 28
29 (define_register_constraint "f" "TARGET_HARD_FLOAT ? FP_REGS : NO_REGS" 29 (define_register_constraint "f" "TARGET_HARD_FLOAT ? FP_REGS : NO_REGS"
39 (define_register_constraint "x" "MD_REGS" 39 (define_register_constraint "x" "MD_REGS"
40 "The concatenated @code{hi} and @code{lo} registers. Use this register 40 "The concatenated @code{hi} and @code{lo} registers. Use this register
41 to store doubleword values.") 41 to store doubleword values.")
42 42
43 (define_register_constraint "b" "ALL_REGS" 43 (define_register_constraint "b" "ALL_REGS"
44 "@internal")
45
46 (define_register_constraint "u" "M16_REGS"
44 "@internal") 47 "@internal")
45 48
46 ;; MIPS16 code always calls through a MIPS16 register; see mips_emit_call_insn 49 ;; MIPS16 code always calls through a MIPS16 register; see mips_emit_call_insn
47 ;; for details. 50 ;; for details.
48 (define_register_constraint "c" "TARGET_MIPS16 ? M16_REGS 51 (define_register_constraint "c" "TARGET_MIPS16 ? M16_REGS
87 ;; Registers that can be used as the target of multiply-accumulate 90 ;; Registers that can be used as the target of multiply-accumulate
88 ;; instructions. The core MIPS32 ISA provides a hi/lo madd, 91 ;; instructions. The core MIPS32 ISA provides a hi/lo madd,
89 ;; but the DSP version allows any accumulator target. 92 ;; but the DSP version allows any accumulator target.
90 (define_register_constraint "ka" "ISA_HAS_DSP_MULT ? ACC_REGS : MD_REGS") 93 (define_register_constraint "ka" "ISA_HAS_DSP_MULT ? ACC_REGS : MD_REGS")
91 94
95 (define_register_constraint "kb" "M16_STORE_REGS"
96 "@internal")
97
92 (define_constraint "kf" 98 (define_constraint "kf"
93 "@internal" 99 "@internal"
94 (match_operand 0 "force_to_mem_operand")) 100 (match_operand 0 "force_to_mem_operand"))
95 101
96 ;; This is a normal rather than a register constraint because we can 102 ;; This is a normal rather than a register constraint because we can
125 131
126 (define_constraint "M" 132 (define_constraint "M"
127 "A constant that cannot be loaded using @code{lui}, @code{addiu} 133 "A constant that cannot be loaded using @code{lui}, @code{addiu}
128 or @code{ori}." 134 or @code{ori}."
129 (and (match_code "const_int") 135 (and (match_code "const_int")
130 (match_test "!SMALL_OPERAND (ival)") 136 (not (match_test "SMALL_OPERAND (ival)"))
131 (match_test "!SMALL_OPERAND_UNSIGNED (ival)") 137 (not (match_test "SMALL_OPERAND_UNSIGNED (ival)"))
132 (match_test "!LUI_OPERAND (ival)"))) 138 (not (match_test "LUI_OPERAND (ival)"))))
133 139
134 (define_constraint "N" 140 (define_constraint "N"
135 "A constant in the range -65535 to -1 (inclusive)." 141 "A constant in the range -65535 to -1 (inclusive)."
136 (and (match_code "const_int") 142 (and (match_code "const_int")
137 (match_test "ival >= -0xffff && ival < 0"))) 143 (match_test "ival >= -0xffff && ival < 0")))
168 "@internal 174 "@internal
169 A constant call address." 175 A constant call address."
170 (and (match_operand 0 "call_insn_operand") 176 (and (match_operand 0 "call_insn_operand")
171 (match_test "CONSTANT_P (op)"))) 177 (match_test "CONSTANT_P (op)")))
172 178
173 (define_constraint "T" 179 (define_constraint "Udb7"
180 "@internal
181 A decremented unsigned constant of 7 bits."
182 (match_operand 0 "db7_operand"))
183
184 (define_constraint "Udb8"
185 "@internal
186 A decremented unsigned constant of 8 bits."
187 (match_operand 0 "db8_operand"))
188
189 (define_constraint "Uead"
190 "@internal
191 A microMIPS encoded ADDIUR2 immediate operand."
192 (match_operand 0 "addiur2_operand"))
193
194 (define_constraint "Uean"
195 "@internal
196 A microMIPS encoded ANDI operand."
197 (match_operand 0 "andi16_operand"))
198
199 (define_constraint "Uesp"
200 "@internal
201 A microMIPS encoded ADDIUSP operand."
202 (match_operand 0 "addiusp_operand"))
203
204 (define_constraint "Uib3"
205 "@internal
206 An unsigned, incremented constant of 3 bits."
207 (match_operand 0 "ib3_operand"))
208
209 (define_constraint "Usb4"
210 "@internal
211 A signed constant of 4 bits."
212 (match_operand 0 "sb4_operand"))
213
214 (define_constraint "Usb5"
215 "@internal
216 A signed constant of 5 bits."
217 (match_operand 0 "sb5_operand"))
218
219 (define_constraint "Usb8"
220 "@internal
221 A signed constant of 8 bits."
222 (match_operand 0 "sb8_operand"))
223
224 (define_constraint "Usd8"
225 "@internal
226 A signed constant of 8 bits, shifted left three places."
227 (match_operand 0 "sd8_operand"))
228
229 (define_constraint "Uub8"
230 "@internal
231 An unsigned constant of 8 bits."
232 (match_operand 0 "ub8_operand"))
233
234 (define_constraint "Uuw5"
235 "@internal
236 An unsigned constant of 5 bits, shifted left two places."
237 (match_operand 0 "uw5_operand"))
238
239 (define_constraint "Uuw6"
240 "@internal
241 An unsigned constant of 6 bits, shifted left two places."
242 (match_operand 0 "uw6_operand"))
243
244 (define_constraint "Uuw8"
245 "@internal
246 An unsigned constant of 8 bits, shifted left two places."
247 (match_operand 0 "uw8_operand"))
248
249 (define_memory_constraint "W"
250 "@internal
251 A memory address based on a member of @code{BASE_REG_CLASS}. This is
252 true for all non-mips16 references (although it can sometimes be implicit
253 if @samp{!TARGET_EXPLICIT_RELOCS}). For MIPS16, it excludes stack and
254 constant-pool references."
255 (and (match_code "mem")
256 (match_operand 0 "memory_operand")
257 (ior (not (match_test "TARGET_MIPS16"))
258 (and (not (match_operand 0 "stack_operand"))
259 (not (match_test "CONSTANT_P (XEXP (op, 0))"))))))
260
261 (define_constraint "YG"
262 "@internal
263 A vector zero."
264 (and (match_code "const_vector")
265 (match_test "op == CONST0_RTX (mode)")))
266
267 (define_constraint "YA"
268 "@internal
269 An unsigned 6-bit constant."
270 (and (match_code "const_int")
271 (match_test "UIMM6_OPERAND (ival)")))
272
273 (define_constraint "YB"
274 "@internal
275 A signed 10-bit constant."
276 (and (match_code "const_int")
277 (match_test "IMM10_OPERAND (ival)")))
278
279 (define_constraint "Yb"
280 "@internal"
281 (match_operand 0 "qi_mask_operand"))
282
283 (define_constraint "Yd"
284 "@internal
285 A constant @code{move_operand} that can be safely loaded into @code{$25}
286 using @code{la}."
287 (and (match_operand 0 "move_operand")
288 (match_test "CONSTANT_P (op)")
289 (not (match_test "mips_dangerous_for_la25_p (op)"))))
290
291 (define_constraint "Yf"
174 "@internal 292 "@internal
175 A constant @code{move_operand} that cannot be safely loaded into @code{$25} 293 A constant @code{move_operand} that cannot be safely loaded into @code{$25}
176 using @code{la}." 294 using @code{la}."
177 (and (match_operand 0 "move_operand") 295 (and (match_operand 0 "move_operand")
178 (match_test "CONSTANT_P (op)") 296 (match_test "CONSTANT_P (op)")
179 (match_test "mips_dangerous_for_la25_p (op)"))) 297 (match_test "mips_dangerous_for_la25_p (op)")))
180 298
181 (define_constraint "U"
182 "@internal
183 A constant @code{move_operand} that can be safely loaded into @code{$25}
184 using @code{la}."
185 (and (match_operand 0 "move_operand")
186 (match_test "CONSTANT_P (op)")
187 (match_test "!mips_dangerous_for_la25_p (op)")))
188
189 (define_memory_constraint "W"
190 "@internal
191 A memory address based on a member of @code{BASE_REG_CLASS}. This is
192 true for all non-mips16 references (although it can sometimes be implicit
193 if @samp{!TARGET_EXPLICIT_RELOCS}). For MIPS16, it excludes stack and
194 constant-pool references."
195 (and (match_code "mem")
196 (match_operand 0 "memory_operand")
197 (ior (match_test "!TARGET_MIPS16")
198 (and (not (match_operand 0 "stack_operand"))
199 (not (match_test "CONSTANT_P (XEXP (op, 0))"))))))
200
201 (define_constraint "YG"
202 "@internal
203 A vector zero."
204 (and (match_code "const_vector")
205 (match_test "op == CONST0_RTX (mode)")))
206
207 (define_constraint "YA"
208 "@internal
209 An unsigned 6-bit constant."
210 (and (match_code "const_int")
211 (match_test "UIMM6_OPERAND (ival)")))
212
213 (define_constraint "YB"
214 "@internal
215 A signed 10-bit constant."
216 (and (match_code "const_int")
217 (match_test "IMM10_OPERAND (ival)")))
218
219 (define_constraint "Yb"
220 "@internal"
221 (match_operand 0 "qi_mask_operand"))
222
223 (define_constraint "Yh" 299 (define_constraint "Yh"
224 "@internal" 300 "@internal"
225 (match_operand 0 "hi_mask_operand")) 301 (match_operand 0 "hi_mask_operand"))
226 302
227 (define_constraint "Yw" 303 (define_constraint "Yw"
229 (match_operand 0 "si_mask_operand")) 305 (match_operand 0 "si_mask_operand"))
230 306
231 (define_constraint "Yx" 307 (define_constraint "Yx"
232 "@internal" 308 "@internal"
233 (match_operand 0 "low_bitmask_operand")) 309 (match_operand 0 "low_bitmask_operand"))
310
311 (define_constraint "YI"
312 "@internal
313 A replicated vector const in which the replicated value is in the range
314 [-512,511]."
315 (and (match_code "const_vector")
316 (match_test "mips_const_vector_same_int_p (op, mode, -512, 511)")))
317
318 (define_constraint "YC"
319 "@internal
320 A replicated vector const in which the replicated value has a single
321 bit set."
322 (and (match_code "const_vector")
323 (match_test "mips_const_vector_bitimm_set_p (op, mode)")))
324
325 (define_constraint "YZ"
326 "@internal
327 A replicated vector const in which the replicated value has a single
328 bit clear."
329 (and (match_code "const_vector")
330 (match_test "mips_const_vector_bitimm_clr_p (op, mode)")))
331
332 (define_constraint "Unv5"
333 "@internal
334 A replicated vector const in which the replicated value is in the range
335 [-31,0]."
336 (and (match_code "const_vector")
337 (match_test "mips_const_vector_same_int_p (op, mode, -31, 0)")))
338
339 (define_constraint "Uuv5"
340 "@internal
341 A replicated vector const in which the replicated value is in the range
342 [0,31]."
343 (and (match_code "const_vector")
344 (match_test "mips_const_vector_same_int_p (op, mode, 0, 31)")))
345
346 (define_constraint "Usv5"
347 "@internal
348 A replicated vector const in which the replicated value is in the range
349 [-16,15]."
350 (and (match_code "const_vector")
351 (match_test "mips_const_vector_same_int_p (op, mode, -16, 15)")))
352
353 (define_constraint "Uuv6"
354 "@internal
355 A replicated vector const in which the replicated value is in the range
356 [0,63]."
357 (and (match_code "const_vector")
358 (match_test "mips_const_vector_same_int_p (op, mode, 0, 63)")))
359
360 (define_constraint "Urv8"
361 "@internal
362 A replicated vector const with replicated byte values as well as elements"
363 (and (match_code "const_vector")
364 (match_test "mips_const_vector_same_bytes_p (op, mode)")))
365
366 (define_memory_constraint "ZC"
367 "A memory operand whose address is formed by a base register and offset
368 that is suitable for use in instructions with the same addressing mode
369 as @code{ll} and @code{sc}."
370 (and (match_code "mem")
371 (if_then_else
372 (match_test "TARGET_MICROMIPS")
373 (match_test "umips_12bit_offset_address_p (XEXP (op, 0), mode)")
374 (if_then_else (match_test "ISA_HAS_9BIT_DISPLACEMENT")
375 (match_test "mips_9bit_offset_address_p (XEXP (op, 0), mode)")
376 (match_test "mips_address_insns (XEXP (op, 0), mode, false)")))))
377
378 (define_address_constraint "ZD"
379 "An address suitable for a @code{prefetch} instruction, or for any other
380 instruction with the same addressing mode as @code{prefetch}."
381 (if_then_else (match_test "TARGET_MICROMIPS")
382 (match_test "umips_12bit_offset_address_p (op, mode)")
383 (if_then_else (match_test "ISA_HAS_9BIT_DISPLACEMENT")
384 (match_test "mips_9bit_offset_address_p (op, mode)")
385 (match_test "mips_address_insns (op, mode, false)"))))
386
387 (define_memory_constraint "ZR"
388 "@internal
389 An address valid for loading/storing register exclusive"
390 (match_operand 0 "mem_noofs_operand"))
391
392 (define_memory_constraint "ZS"
393 "@internal
394 A microMIPS memory operand for use with the LWSP/SWSP insns."
395 (and (match_code "mem")
396 (match_operand 0 "lwsp_swsp_operand")))
397
398 (define_memory_constraint "ZT"
399 "@internal
400 A microMIPS memory operand for use with the LW16/SW16 insns."
401 (and (match_code "mem")
402 (match_operand 0 "lw16_sw16_operand")))
403
404 (define_memory_constraint "ZU"
405 "@internal
406 A microMIPS memory operand for use with the LHU16/SH16 insns."
407 (and (match_code "mem")
408 (match_operand 0 "lhu16_sh16_operand")))
409
410 (define_memory_constraint "ZV"
411 "@internal
412 A microMIPS memory operand for use with the SB16 insn."
413 (and (match_code "mem")
414 (match_operand 0 "sb16_operand")))
415
416 (define_memory_constraint "ZW"
417 "@internal
418 A microMIPS memory operand for use with the LBU16 insn."
419 (and (match_code "mem")
420 (match_operand 0 "lbu16_operand")))
421