1 ;; Constraint definitions for SPU
2 ;; Copyright (C) 2006 Free Software Foundation, Inc.
4 ;; This file is free software; you can redistribute it and/or modify it under
5 ;; the terms of the GNU General Public License as published by the Free
6 ;; Software Foundation; either version 2 of the License, or (at your option)
9 ;; This file is distributed in the hope that it will be useful, but WITHOUT
10 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 ;; You should have received a copy of the GNU General Public License
15 ;; along with this file; see the file COPYING. If not, write to the Free
16 ;; Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
20 ;; GCC standard constraints: g, i, m, n, o, p, r, s, E-H, I-P, V, X
21 ;; unused for SPU: E-H, L, Q, d, e, h, j-l, q, t-z
23 ;; For most immediate constraints we have 3 variations to deal with the
24 ;; fact const_int has no mode. One variation treats const_int as 32 bit,
25 ;; another treats it as 64 bit, and the third sign extends it to 128 bit.
27 (define_constraint "A"
28 "An immediate which can be loaded with the il/ila/ilh/ilhu instructions. const_int is treated as a 32 bit value."
29 (ior (and (match_code "const_int,const_double,const_vector")
30 (match_test "immediate_load_p (op, SImode)"))
31 (match_code "symbol_ref,label_ref,high,const")))
33 (define_constraint "B"
34 "An immediate for arithmetic instructions (e.g., ai, ceqi). const_int is treated as a 32 bit value."
35 (and (match_code "const_int,const_double,const_vector")
36 (match_test "arith_immediate_p (op, SImode, -0x200, 0x1ff)")))
38 (define_constraint "C"
39 "An immediate for and/xor/or instructions. const_int is treated as a 32 bit value."
40 (and (match_code "const_int,const_double,const_vector")
41 (match_test "logical_immediate_p (op, SImode)")))
43 (define_constraint "D"
44 "An immediate for iohl instruction. const_int is treated as a 32 bit value."
45 (and (match_code "const_int,const_double,const_vector")
46 (match_test "iohl_immediate_p (op, SImode)")))
48 (define_constraint "U"
49 "An immediate which can be loaded with the il/ila/ilh/ilhu instructions. const_int is sign extended to 128 bit."
50 (and (match_code "const_int,const_double,const_vector")
51 (match_test "immediate_load_p (op, TImode)")))
53 (define_constraint "W"
54 "An immediate for shift and rotate instructions. const_int is treated as a 32 bit value."
55 (and (match_code "const_int,const_double,const_vector")
56 (match_test "arith_immediate_p (op, SImode, -0x40, 0x3f)")))
58 (define_constraint "Y"
59 "An immediate for and/xor/or instructions. const_int is sign extended as a 128 bit."
60 (and (match_code "const_int,const_double,const_vector")
61 (match_test "logical_immediate_p (op, TImode)")))
63 (define_constraint "Z"
64 "An immediate for iohl instruction. const_int is sign extended to 128 bit."
65 (and (match_code "const_int,const_double,const_vector")
66 (match_test "iohl_immediate_p (op, TImode)")))
68 (define_constraint "a"
69 "An immediate which can be loaded with the il/ila/ilh/ilhu instructions. const_int is treated as a 64 bit value."
70 (and (match_code "const_int")
71 (match_test "immediate_load_p (op, DImode)")))
73 (define_constraint "c"
74 "An immediate for and/xor/or instructions. const_int is treated as a 64 bit value."
75 (and (match_code "const_int")
76 (match_test "logical_immediate_p (op, DImode)")))
78 (define_constraint "d"
79 "An immediate for iohl instruction. const_int is treated as a 64 bit value."
80 (and (match_code "const_int")
81 (match_test "iohl_immediate_p (op, DImode)")))
83 (define_constraint "f"
84 "An immediate which can be loaded with fsmbi."
85 (and (match_code "const_int,const_double,const_vector")
86 (match_test "fsmbi_const_p (op)")))
88 ;; Integer constraints
90 (define_constraint "I"
91 "A constant in the range [-64, 63] for shift/rotate instructions."
92 (and (match_code "const_int")
93 (match_test "ival >= -0x40 && ival <= 0x3f")))
95 (define_constraint "J"
96 "An unsigned 7-bit constant for conversion/nop/channel instructions."
97 (and (match_code "const_int")
98 (match_test "ival >= 0 && ival <= 0x7f")))
100 (define_constraint "K"
101 "A signed 10-bit constant for most arithmetic instructions."
102 (and (match_code "const_int")
103 (match_test "ival >= -0x200 && ival <= 0x1ff")))
105 (define_constraint "M"
106 "A signed 16 bit immediate for @code{stop}."
107 (and (match_code "const_int")
108 (match_test "ival >= -0x8000ll && ival <= 0x7fffll")))
110 (define_constraint "N"
111 "An unsigned 16-bit constant for @code{iohl} and @code{fsmbi}."
112 (and (match_code "const_int")
113 (match_test "ival >= 0 && ival <= 0xffff")))
115 (define_constraint "O"
116 "An unsigned 7-bit constant whose 3 least significant bits are 0."
117 (and (match_code "const_int")
118 (match_test "ival >= 0 && ival <= 0x7f && (ival & 7) == 0")))
120 (define_constraint "P"
121 "An unsigned 3-bit constant for 16-byte rotates and shifts"
122 (and (match_code "const_int")
123 (match_test "ival >= 0 && ival <= 7")))
126 ;; Memory constraints
128 (define_memory_constraint "R"
129 "Call operand, reg, for indirect calls"
130 (and (match_code "mem")
131 (match_test "GET_CODE(XEXP(op, 0)) == REG")))
133 (define_memory_constraint "S"
134 "Call operand, symbol, for relative calls."
135 (and (match_code "mem")
136 (match_test "!TARGET_LARGE_MEM
137 && ((GET_CODE (XEXP (op, 0)) == SYMBOL_REF
138 || GET_CODE (XEXP (op, 0)) == LABEL_REF))")))
140 (define_memory_constraint "T"
141 "Call operand, const_int, for absolute calls."
142 (and (match_code "mem")
143 (match_test "GET_CODE (XEXP (op, 0)) == CONST_INT
144 && INTVAL (XEXP (op, 0)) >= 0
145 && INTVAL (XEXP (op, 0)) <= 0x3ffff")))