annotate gcc/config/nds32/constraints.md @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ;; Constraint definitions of Andes NDS32 cpu for GNU compiler
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
2 ;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
3 ;; Contributed by Andes Technology Corporation.
kono
parents:
diff changeset
4 ;;
kono
parents:
diff changeset
5 ;; This file is part of GCC.
kono
parents:
diff changeset
6 ;;
kono
parents:
diff changeset
7 ;; GCC is free software; you can redistribute it and/or modify it
kono
parents:
diff changeset
8 ;; under the terms of the GNU General Public License as published
kono
parents:
diff changeset
9 ;; by the Free Software Foundation; either version 3, or (at your
kono
parents:
diff changeset
10 ;; option) any later version.
kono
parents:
diff changeset
11 ;;
kono
parents:
diff changeset
12 ;; GCC is distributed in the hope that it will be useful, but WITHOUT
kono
parents:
diff changeset
13 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
kono
parents:
diff changeset
14 ;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
kono
parents:
diff changeset
15 ;; License for more details.
kono
parents:
diff changeset
16 ;;
kono
parents:
diff changeset
17 ;; You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
18 ;; along with GCC; see the file COPYING3. If not see
kono
parents:
diff changeset
19 ;; <http://www.gnu.org/licenses/>.
kono
parents:
diff changeset
20
kono
parents:
diff changeset
21 ;; Check 16.8.7 Defining Machine-Specific Constraints for detail.
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 ;; NO contrains can be prefixed with: E F V X g i m n o p r s
kono
parents:
diff changeset
24 ;; Machine-dependent integer: I J K L M N O P
kono
parents:
diff changeset
25 ;; Machine-dependent floating: G H
kono
parents:
diff changeset
26
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 (define_register_constraint "w" "(TARGET_ISA_V3 || TARGET_ISA_V3M) ? LOW_REGS : NO_REGS"
kono
parents:
diff changeset
29 "LOW register class $r0 ~ $r7 constraint for V3/V3M ISA")
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 (define_register_constraint "l" "LOW_REGS"
kono
parents:
diff changeset
32 "LOW register class $r0 ~ $r7")
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 (define_register_constraint "d" "MIDDLE_REGS"
kono
parents:
diff changeset
35 "MIDDLE register class $r0 ~ $r11, $r16 ~ $r19")
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 (define_register_constraint "h" "HIGH_REGS"
kono
parents:
diff changeset
38 "HIGH register class $r12 ~ $r14, $r20 ~ $r31")
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 (define_register_constraint "t" "R15_TA_REG"
kono
parents:
diff changeset
42 "Temporary Assist register $ta (i.e. $r15)")
kono
parents:
diff changeset
43
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
44 (define_register_constraint "e" "R8_REG"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
45 "Function Entry register $r8)")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
46
111
kono
parents:
diff changeset
47 (define_register_constraint "k" "STACK_REG"
kono
parents:
diff changeset
48 "Stack register $sp")
kono
parents:
diff changeset
49
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
50 (define_register_constraint "v" "R5_REG"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
51 "Register $r5")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
52
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
53 (define_register_constraint "x" "FRAME_POINTER_REG"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
54 "Frame pointer register $fp")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
55
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
56 (define_register_constraint "f"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
57 "(TARGET_FPU_SINGLE || TARGET_FPU_DOUBLE) ? FP_REGS : NO_REGS"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
58 "The Floating point registers $fs0 ~ $fs31")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
59
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
60 (define_constraint "Iv00"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
61 "Constant value 0"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
62 (and (match_code "const_int")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
63 (match_test "ival == 0")))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
64
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
65 (define_constraint "Iv01"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
66 "Constant value 1"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
67 (and (match_code "const_int")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
68 (match_test "ival == 1")))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
69
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
70 (define_constraint "Iv02"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
71 "Constant value 2"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
72 (and (match_code "const_int")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
73 (match_test "ival == 2")))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
74
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
75 (define_constraint "Iv04"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
76 "Constant value 4"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
77 (and (match_code "const_int")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
78 (match_test "ival == 4")))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
79
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
80 (define_constraint "Iv08"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
81 "Constant value 8"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
82 (and (match_code "const_int")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
83 (match_test "ival == 8")))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
84
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
85 (define_constraint "Iu01"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
86 "Unsigned immediate 1-bit value"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
87 (and (match_code "const_int")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
88 (match_test "ival == 1 || ival == 0")))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
89
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
90 (define_constraint "Iu02"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
91 "Unsigned immediate 2-bit value"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
92 (and (match_code "const_int")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
93 (match_test "ival < (1 << 2) && ival >= 0")))
111
kono
parents:
diff changeset
94
kono
parents:
diff changeset
95 (define_constraint "Iu03"
kono
parents:
diff changeset
96 "Unsigned immediate 3-bit value"
kono
parents:
diff changeset
97 (and (match_code "const_int")
kono
parents:
diff changeset
98 (match_test "ival < (1 << 3) && ival >= 0")))
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 (define_constraint "In03"
kono
parents:
diff changeset
101 "Negative immediate 3-bit value in the range of -7 to 0"
kono
parents:
diff changeset
102 (and (match_code "const_int")
kono
parents:
diff changeset
103 (match_test "IN_RANGE (ival, -7, 0)")))
kono
parents:
diff changeset
104
kono
parents:
diff changeset
105 (define_constraint "Iu04"
kono
parents:
diff changeset
106 "Unsigned immediate 4-bit value"
kono
parents:
diff changeset
107 (and (match_code "const_int")
kono
parents:
diff changeset
108 (match_test "ival < (1 << 4) && ival >= 0")))
kono
parents:
diff changeset
109
kono
parents:
diff changeset
110 (define_constraint "Is05"
kono
parents:
diff changeset
111 "Signed immediate 5-bit value"
kono
parents:
diff changeset
112 (and (match_code "const_int")
kono
parents:
diff changeset
113 (match_test "ival < (1 << 4) && ival >= -(1 << 4)")))
kono
parents:
diff changeset
114
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
115 (define_constraint "Cs05"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
116 "Signed immediate 5-bit value"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
117 (and (match_code "const_double")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
118 (match_test "nds32_const_double_range_ok_p (op, SFmode, -(1 << 4), (1 << 4))")))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
119
111
kono
parents:
diff changeset
120 (define_constraint "Iu05"
kono
parents:
diff changeset
121 "Unsigned immediate 5-bit value"
kono
parents:
diff changeset
122 (and (match_code "const_int")
kono
parents:
diff changeset
123 (match_test "ival < (1 << 5) && ival >= 0")))
kono
parents:
diff changeset
124
kono
parents:
diff changeset
125 (define_constraint "In05"
kono
parents:
diff changeset
126 "Negative immediate 5-bit value in the range of -31 to 0"
kono
parents:
diff changeset
127 (and (match_code "const_int")
kono
parents:
diff changeset
128 (match_test "IN_RANGE (ival, -31, 0)")))
kono
parents:
diff changeset
129
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
130 (define_constraint "Iu06"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
131 "Unsigned immediate 6-bit value"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
132 (and (match_code "const_int")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
133 (match_test "ival < (1 << 6) && ival >= 0")))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
134
111
kono
parents:
diff changeset
135 ;; Ip05 is special and dedicated for v3 movpi45 instruction.
kono
parents:
diff changeset
136 ;; movpi45 has imm5u field but the range is 16 ~ 47.
kono
parents:
diff changeset
137 (define_constraint "Ip05"
kono
parents:
diff changeset
138 "Unsigned immediate 5-bit value for movpi45 instruction with range 16-47"
kono
parents:
diff changeset
139 (and (match_code "const_int")
kono
parents:
diff changeset
140 (match_test "ival < ((1 << 5) + 16)
kono
parents:
diff changeset
141 && ival >= (0 + 16)
kono
parents:
diff changeset
142 && (TARGET_ISA_V3 || TARGET_ISA_V3M)")))
kono
parents:
diff changeset
143
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
144 (define_constraint "IU06"
111
kono
parents:
diff changeset
145 "Unsigned immediate 6-bit value constraint for addri36.sp instruction"
kono
parents:
diff changeset
146 (and (match_code "const_int")
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
147 (match_test "ival < (1 << 8)
111
kono
parents:
diff changeset
148 && ival >= 0
kono
parents:
diff changeset
149 && (ival % 4 == 0)
kono
parents:
diff changeset
150 && (TARGET_ISA_V3 || TARGET_ISA_V3M)")))
kono
parents:
diff changeset
151
kono
parents:
diff changeset
152 (define_constraint "Iu08"
kono
parents:
diff changeset
153 "Unsigned immediate 8-bit value"
kono
parents:
diff changeset
154 (and (match_code "const_int")
kono
parents:
diff changeset
155 (match_test "ival < (1 << 8) && ival >= 0")))
kono
parents:
diff changeset
156
kono
parents:
diff changeset
157 (define_constraint "Iu09"
kono
parents:
diff changeset
158 "Unsigned immediate 9-bit value"
kono
parents:
diff changeset
159 (and (match_code "const_int")
kono
parents:
diff changeset
160 (match_test "ival < (1 << 9) && ival >= 0")))
kono
parents:
diff changeset
161
kono
parents:
diff changeset
162
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
163 (define_constraint "Is08"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
164 "Signed immediate 8-bit value"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
165 (and (match_code "const_int")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
166 (match_test "ival < (1 << 7) && ival >= -(1 << 7)")))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
167
111
kono
parents:
diff changeset
168 (define_constraint "Is10"
kono
parents:
diff changeset
169 "Signed immediate 10-bit value"
kono
parents:
diff changeset
170 (and (match_code "const_int")
kono
parents:
diff changeset
171 (match_test "ival < (1 << 9) && ival >= -(1 << 9)")))
kono
parents:
diff changeset
172
kono
parents:
diff changeset
173 (define_constraint "Is11"
kono
parents:
diff changeset
174 "Signed immediate 11-bit value"
kono
parents:
diff changeset
175 (and (match_code "const_int")
kono
parents:
diff changeset
176 (match_test "ival < (1 << 10) && ival >= -(1 << 10)")))
kono
parents:
diff changeset
177
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
178 (define_constraint "Is14"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
179 "Signed immediate 14-bit value"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
180 (and (match_code "const_int")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
181 (match_test "ival < (1 << 13) && ival >= -(1 << 13)")))
111
kono
parents:
diff changeset
182
kono
parents:
diff changeset
183 (define_constraint "Is15"
kono
parents:
diff changeset
184 "Signed immediate 15-bit value"
kono
parents:
diff changeset
185 (and (match_code "const_int")
kono
parents:
diff changeset
186 (match_test "ival < (1 << 14) && ival >= -(1 << 14)")))
kono
parents:
diff changeset
187
kono
parents:
diff changeset
188 (define_constraint "Iu15"
kono
parents:
diff changeset
189 "Unsigned immediate 15-bit value"
kono
parents:
diff changeset
190 (and (match_code "const_int")
kono
parents:
diff changeset
191 (match_test "ival < (1 << 15) && ival >= 0")))
kono
parents:
diff changeset
192
kono
parents:
diff changeset
193
kono
parents:
diff changeset
194 ;; Ic15 is special and dedicated for performance extension
kono
parents:
diff changeset
195 ;; 'bclr' (single-bit-clear) instruction.
kono
parents:
diff changeset
196 ;; It is used in andsi3 pattern and recognized for the immediate
kono
parents:
diff changeset
197 ;; which is NOT in the range of imm15u but OK for 'bclr' instruction.
kono
parents:
diff changeset
198 ;; (If the immediate value IS in the range of imm15u,
kono
parents:
diff changeset
199 ;; we can directly use 'andi' instruction.)
kono
parents:
diff changeset
200 (define_constraint "Ic15"
kono
parents:
diff changeset
201 "A constant which is not in the range of imm15u but ok for bclr instruction"
kono
parents:
diff changeset
202 (and (match_code "const_int")
kono
parents:
diff changeset
203 (match_test "(ival & 0xffff8000) && nds32_can_use_bclr_p (ival)")))
kono
parents:
diff changeset
204
kono
parents:
diff changeset
205 ;; Ie15 is special and dedicated for performance extension
kono
parents:
diff changeset
206 ;; 'bset' (single-bit-set) instruction.
kono
parents:
diff changeset
207 ;; It is used in iorsi3 pattern and recognized for the immediate
kono
parents:
diff changeset
208 ;; which is NOT in the range of imm15u but OK for 'bset' instruction.
kono
parents:
diff changeset
209 ;; (If the immediate value IS in the range of imm15u,
kono
parents:
diff changeset
210 ;; we can directly use 'ori' instruction.)
kono
parents:
diff changeset
211 (define_constraint "Ie15"
kono
parents:
diff changeset
212 "A constant which is not in the range of imm15u but ok for bset instruction"
kono
parents:
diff changeset
213 (and (match_code "const_int")
kono
parents:
diff changeset
214 (match_test "(ival & 0xffff8000) && nds32_can_use_bset_p (ival)")))
kono
parents:
diff changeset
215
kono
parents:
diff changeset
216 ;; It15 is special and dedicated for performance extension
kono
parents:
diff changeset
217 ;; 'btgl' (single-bit-toggle) instruction.
kono
parents:
diff changeset
218 ;; It is used in xorsi3 pattern and recognized for the immediate
kono
parents:
diff changeset
219 ;; which is NOT in the range of imm15u but OK for 'btgl' instruction.
kono
parents:
diff changeset
220 ;; (If the immediate value IS in the range of imm15u,
kono
parents:
diff changeset
221 ;; we can directly use 'xori' instruction.)
kono
parents:
diff changeset
222 (define_constraint "It15"
kono
parents:
diff changeset
223 "A constant which is not in the range of imm15u but ok for btgl instruction"
kono
parents:
diff changeset
224 (and (match_code "const_int")
kono
parents:
diff changeset
225 (match_test "(ival & 0xffff8000) && nds32_can_use_btgl_p (ival)")))
kono
parents:
diff changeset
226
kono
parents:
diff changeset
227
kono
parents:
diff changeset
228 ;; Ii15 is special and dedicated for v3 isa
kono
parents:
diff changeset
229 ;; 'bitci' (bit-clear-immediate) instruction.
kono
parents:
diff changeset
230 ;; It is used in andsi3 pattern and recognized for the immediate whose
kono
parents:
diff changeset
231 ;; (~ival) value is in the range of imm15u and OK for 'bitci' instruction.
kono
parents:
diff changeset
232 ;; For example, 'andi $r0,$r0,0xfffffffc' can be presented
kono
parents:
diff changeset
233 ; with 'bitci $r0,$r0,3'.
kono
parents:
diff changeset
234 (define_constraint "Ii15"
kono
parents:
diff changeset
235 "A constant whose compliment value is in the range of imm15u
kono
parents:
diff changeset
236 and ok for bitci instruction"
kono
parents:
diff changeset
237 (and (match_code "const_int")
kono
parents:
diff changeset
238 (match_test "nds32_can_use_bitci_p (ival)")))
kono
parents:
diff changeset
239
kono
parents:
diff changeset
240
kono
parents:
diff changeset
241 (define_constraint "Is16"
kono
parents:
diff changeset
242 "Signed immediate 16-bit value"
kono
parents:
diff changeset
243 (and (match_code "const_int")
kono
parents:
diff changeset
244 (match_test "ival < (1 << 15) && ival >= -(1 << 15)")))
kono
parents:
diff changeset
245
kono
parents:
diff changeset
246 (define_constraint "Is17"
kono
parents:
diff changeset
247 "Signed immediate 17-bit value"
kono
parents:
diff changeset
248 (and (match_code "const_int")
kono
parents:
diff changeset
249 (match_test "ival < (1 << 16) && ival >= -(1 << 16)")))
kono
parents:
diff changeset
250
kono
parents:
diff changeset
251
kono
parents:
diff changeset
252 (define_constraint "Is19"
kono
parents:
diff changeset
253 "Signed immediate 19-bit value"
kono
parents:
diff changeset
254 (and (match_code "const_int")
kono
parents:
diff changeset
255 (match_test "ival < (1 << 18) && ival >= -(1 << 18)")))
kono
parents:
diff changeset
256
kono
parents:
diff changeset
257
kono
parents:
diff changeset
258 (define_constraint "Is20"
kono
parents:
diff changeset
259 "Signed immediate 20-bit value"
kono
parents:
diff changeset
260 (and (match_code "const_int")
kono
parents:
diff changeset
261 (match_test "ival < (1 << 19) && ival >= -(1 << 19)")))
kono
parents:
diff changeset
262
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
263 (define_constraint "Cs20"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
264 "Signed immediate 20-bit value"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
265 (and (match_code "const_double")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
266 (match_test "nds32_const_double_range_ok_p (op, SFmode, -(1 << 19), (1 << 19))")))
111
kono
parents:
diff changeset
267
kono
parents:
diff changeset
268 (define_constraint "Ihig"
kono
parents:
diff changeset
269 "The immediate value that can be simply set high 20-bit"
kono
parents:
diff changeset
270 (and (match_code "const_int")
kono
parents:
diff changeset
271 (match_test "(ival != 0) && ((ival & 0xfff) == 0)")))
kono
parents:
diff changeset
272
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
273 (define_constraint "Chig"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
274 "The immediate value that can be simply set high 20-bit"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
275 (and (match_code "high")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
276 (match_test "GET_CODE (XEXP (op, 0)) == CONST_DOUBLE")))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
277
111
kono
parents:
diff changeset
278 (define_constraint "Izeb"
kono
parents:
diff changeset
279 "The immediate value 0xff"
kono
parents:
diff changeset
280 (and (match_code "const_int")
kono
parents:
diff changeset
281 (match_test "(ival == 0xff)")))
kono
parents:
diff changeset
282
kono
parents:
diff changeset
283 (define_constraint "Izeh"
kono
parents:
diff changeset
284 "The immediate value 0xffff"
kono
parents:
diff changeset
285 (and (match_code "const_int")
kono
parents:
diff changeset
286 (match_test "(ival == 0xffff)")))
kono
parents:
diff changeset
287
kono
parents:
diff changeset
288 (define_constraint "Ixls"
kono
parents:
diff changeset
289 "The immediate value 0x01"
kono
parents:
diff changeset
290 (and (match_code "const_int")
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
291 (match_test "TARGET_EXT_PERF && (ival == 0x1)")))
111
kono
parents:
diff changeset
292
kono
parents:
diff changeset
293 (define_constraint "Ix11"
kono
parents:
diff changeset
294 "The immediate value 0x7ff"
kono
parents:
diff changeset
295 (and (match_code "const_int")
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
296 (match_test "TARGET_EXT_PERF && (ival == 0x7ff)")))
111
kono
parents:
diff changeset
297
kono
parents:
diff changeset
298 (define_constraint "Ibms"
kono
parents:
diff changeset
299 "The immediate value with power of 2"
kono
parents:
diff changeset
300 (and (match_code "const_int")
kono
parents:
diff changeset
301 (match_test "(TARGET_ISA_V3 || TARGET_ISA_V3M)
kono
parents:
diff changeset
302 && (IN_RANGE (exact_log2 (ival), 0, 7))")))
kono
parents:
diff changeset
303
kono
parents:
diff changeset
304 (define_constraint "Ifex"
kono
parents:
diff changeset
305 "The immediate value with power of 2 minus 1"
kono
parents:
diff changeset
306 (and (match_code "const_int")
kono
parents:
diff changeset
307 (match_test "(TARGET_ISA_V3 || TARGET_ISA_V3M)
kono
parents:
diff changeset
308 && (IN_RANGE (exact_log2 (ival + 1), 1, 8))")))
kono
parents:
diff changeset
309
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
310 (define_constraint "CVp5"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
311 "Unsigned immediate 5-bit value for movpi45 instruction with range 16-47"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
312 (and (match_code "const_vector")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
313 (match_test "nds32_valid_CVp5_p (op)")))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
314
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
315 (define_constraint "CVs5"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
316 "Signed immediate 5-bit value"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
317 (and (match_code "const_vector")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
318 (match_test "nds32_valid_CVs5_p (op)")))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
319
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
320 (define_constraint "CVs2"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
321 "Signed immediate 20-bit value"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
322 (and (match_code "const_vector")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
323 (match_test "nds32_valid_CVs2_p (op)")))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
324
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
325 (define_constraint "CVhi"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
326 "The immediate value that can be simply set high 20-bit"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
327 (and (match_code "const_vector")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
328 (match_test "nds32_valid_CVhi_p (op)")))
111
kono
parents:
diff changeset
329
kono
parents:
diff changeset
330 (define_memory_constraint "U33"
kono
parents:
diff changeset
331 "Memory constraint for 333 format"
kono
parents:
diff changeset
332 (and (match_code "mem")
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
333 (match_test "nds32_mem_format (op) == ADDRESS_POST_INC_LO_REG_IMM3U
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
334 || nds32_mem_format (op) == ADDRESS_POST_MODIFY_LO_REG_IMM3U
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
335 || nds32_mem_format (op) == ADDRESS_LO_REG_IMM3U")))
111
kono
parents:
diff changeset
336
kono
parents:
diff changeset
337 (define_memory_constraint "U45"
kono
parents:
diff changeset
338 "Memory constraint for 45 format"
kono
parents:
diff changeset
339 (and (match_code "mem")
kono
parents:
diff changeset
340 (match_test "(nds32_mem_format (op) == ADDRESS_REG)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
341 && ((GET_MODE (op) == SImode)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
342 || (GET_MODE (op) == SFmode))")))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
343
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
344 (define_memory_constraint "Ufe"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
345 "Memory constraint for fe format"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
346 (and (match_code "mem")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
347 (match_test "nds32_mem_format (op) == ADDRESS_R8_IMM7U
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
348 && (GET_MODE (op) == SImode
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
349 || GET_MODE (op) == SFmode)")))
111
kono
parents:
diff changeset
350
kono
parents:
diff changeset
351 (define_memory_constraint "U37"
kono
parents:
diff changeset
352 "Memory constraint for 37 format"
kono
parents:
diff changeset
353 (and (match_code "mem")
kono
parents:
diff changeset
354 (match_test "(nds32_mem_format (op) == ADDRESS_SP_IMM7U
kono
parents:
diff changeset
355 || nds32_mem_format (op) == ADDRESS_FP_IMM7U)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
356 && (GET_MODE (op) == SImode
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
357 || GET_MODE (op) == SFmode)")))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
358
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
359 (define_memory_constraint "Umw"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
360 "Memory constraint for lwm/smw"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
361 (and (match_code "mem")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
362 (match_test "nds32_valid_smw_lwm_base_p (op)")))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
363
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
364 (define_memory_constraint "Da"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
365 "Memory constraint for non-offset loads/stores"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
366 (and (match_code "mem")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
367 (match_test "REG_P (XEXP (op, 0))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
368 || (GET_CODE (XEXP (op, 0)) == POST_INC)")))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
369
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
370 (define_memory_constraint "Q"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
371 "Memory constraint for no symbol_ref and const"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
372 (and (match_code "mem")
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
373 (match_test "(TARGET_FPU_SINGLE || TARGET_FPU_DOUBLE)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
374 && nds32_float_mem_operand_p (op)")))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
375
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
376 (define_constraint "S"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
377 "@internal
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
378 A constant call address."
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
379 (match_operand 0 "nds32_symbolic_operand"))
111
kono
parents:
diff changeset
380
kono
parents:
diff changeset
381 ;; ------------------------------------------------------------------------