annotate gcc/config/nds32/constraints.md @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
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
kono
parents:
diff changeset
2 ;; Copyright (C) 2012-2017 Free Software Foundation, Inc.
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
kono
parents:
diff changeset
44 (define_register_constraint "k" "STACK_REG"
kono
parents:
diff changeset
45 "Stack register $sp")
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 (define_constraint "Iu03"
kono
parents:
diff changeset
49 "Unsigned immediate 3-bit value"
kono
parents:
diff changeset
50 (and (match_code "const_int")
kono
parents:
diff changeset
51 (match_test "ival < (1 << 3) && ival >= 0")))
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 (define_constraint "In03"
kono
parents:
diff changeset
54 "Negative immediate 3-bit value in the range of -7 to 0"
kono
parents:
diff changeset
55 (and (match_code "const_int")
kono
parents:
diff changeset
56 (match_test "IN_RANGE (ival, -7, 0)")))
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 (define_constraint "Iu04"
kono
parents:
diff changeset
59 "Unsigned immediate 4-bit value"
kono
parents:
diff changeset
60 (and (match_code "const_int")
kono
parents:
diff changeset
61 (match_test "ival < (1 << 4) && ival >= 0")))
kono
parents:
diff changeset
62
kono
parents:
diff changeset
63 (define_constraint "Is05"
kono
parents:
diff changeset
64 "Signed immediate 5-bit value"
kono
parents:
diff changeset
65 (and (match_code "const_int")
kono
parents:
diff changeset
66 (match_test "ival < (1 << 4) && ival >= -(1 << 4)")))
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 (define_constraint "Iu05"
kono
parents:
diff changeset
69 "Unsigned immediate 5-bit value"
kono
parents:
diff changeset
70 (and (match_code "const_int")
kono
parents:
diff changeset
71 (match_test "ival < (1 << 5) && ival >= 0")))
kono
parents:
diff changeset
72
kono
parents:
diff changeset
73 (define_constraint "In05"
kono
parents:
diff changeset
74 "Negative immediate 5-bit value in the range of -31 to 0"
kono
parents:
diff changeset
75 (and (match_code "const_int")
kono
parents:
diff changeset
76 (match_test "IN_RANGE (ival, -31, 0)")))
kono
parents:
diff changeset
77
kono
parents:
diff changeset
78 ;; Ip05 is special and dedicated for v3 movpi45 instruction.
kono
parents:
diff changeset
79 ;; movpi45 has imm5u field but the range is 16 ~ 47.
kono
parents:
diff changeset
80 (define_constraint "Ip05"
kono
parents:
diff changeset
81 "Unsigned immediate 5-bit value for movpi45 instruction with range 16-47"
kono
parents:
diff changeset
82 (and (match_code "const_int")
kono
parents:
diff changeset
83 (match_test "ival < ((1 << 5) + 16)
kono
parents:
diff changeset
84 && ival >= (0 + 16)
kono
parents:
diff changeset
85 && (TARGET_ISA_V3 || TARGET_ISA_V3M)")))
kono
parents:
diff changeset
86
kono
parents:
diff changeset
87 (define_constraint "Iu06"
kono
parents:
diff changeset
88 "Unsigned immediate 6-bit value constraint for addri36.sp instruction"
kono
parents:
diff changeset
89 (and (match_code "const_int")
kono
parents:
diff changeset
90 (match_test "ival < (1 << 6)
kono
parents:
diff changeset
91 && ival >= 0
kono
parents:
diff changeset
92 && (ival % 4 == 0)
kono
parents:
diff changeset
93 && (TARGET_ISA_V3 || TARGET_ISA_V3M)")))
kono
parents:
diff changeset
94
kono
parents:
diff changeset
95 (define_constraint "Iu08"
kono
parents:
diff changeset
96 "Unsigned immediate 8-bit value"
kono
parents:
diff changeset
97 (and (match_code "const_int")
kono
parents:
diff changeset
98 (match_test "ival < (1 << 8) && ival >= 0")))
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 (define_constraint "Iu09"
kono
parents:
diff changeset
101 "Unsigned immediate 9-bit value"
kono
parents:
diff changeset
102 (and (match_code "const_int")
kono
parents:
diff changeset
103 (match_test "ival < (1 << 9) && ival >= 0")))
kono
parents:
diff changeset
104
kono
parents:
diff changeset
105
kono
parents:
diff changeset
106 (define_constraint "Is10"
kono
parents:
diff changeset
107 "Signed immediate 10-bit value"
kono
parents:
diff changeset
108 (and (match_code "const_int")
kono
parents:
diff changeset
109 (match_test "ival < (1 << 9) && ival >= -(1 << 9)")))
kono
parents:
diff changeset
110
kono
parents:
diff changeset
111 (define_constraint "Is11"
kono
parents:
diff changeset
112 "Signed immediate 11-bit value"
kono
parents:
diff changeset
113 (and (match_code "const_int")
kono
parents:
diff changeset
114 (match_test "ival < (1 << 10) && ival >= -(1 << 10)")))
kono
parents:
diff changeset
115
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 (define_constraint "Is15"
kono
parents:
diff changeset
118 "Signed immediate 15-bit value"
kono
parents:
diff changeset
119 (and (match_code "const_int")
kono
parents:
diff changeset
120 (match_test "ival < (1 << 14) && ival >= -(1 << 14)")))
kono
parents:
diff changeset
121
kono
parents:
diff changeset
122 (define_constraint "Iu15"
kono
parents:
diff changeset
123 "Unsigned immediate 15-bit value"
kono
parents:
diff changeset
124 (and (match_code "const_int")
kono
parents:
diff changeset
125 (match_test "ival < (1 << 15) && ival >= 0")))
kono
parents:
diff changeset
126
kono
parents:
diff changeset
127
kono
parents:
diff changeset
128 ;; Ic15 is special and dedicated for performance extension
kono
parents:
diff changeset
129 ;; 'bclr' (single-bit-clear) instruction.
kono
parents:
diff changeset
130 ;; It is used in andsi3 pattern and recognized for the immediate
kono
parents:
diff changeset
131 ;; which is NOT in the range of imm15u but OK for 'bclr' instruction.
kono
parents:
diff changeset
132 ;; (If the immediate value IS in the range of imm15u,
kono
parents:
diff changeset
133 ;; we can directly use 'andi' instruction.)
kono
parents:
diff changeset
134 (define_constraint "Ic15"
kono
parents:
diff changeset
135 "A constant which is not in the range of imm15u but ok for bclr instruction"
kono
parents:
diff changeset
136 (and (match_code "const_int")
kono
parents:
diff changeset
137 (match_test "(ival & 0xffff8000) && nds32_can_use_bclr_p (ival)")))
kono
parents:
diff changeset
138
kono
parents:
diff changeset
139 ;; Ie15 is special and dedicated for performance extension
kono
parents:
diff changeset
140 ;; 'bset' (single-bit-set) instruction.
kono
parents:
diff changeset
141 ;; It is used in iorsi3 pattern and recognized for the immediate
kono
parents:
diff changeset
142 ;; which is NOT in the range of imm15u but OK for 'bset' instruction.
kono
parents:
diff changeset
143 ;; (If the immediate value IS in the range of imm15u,
kono
parents:
diff changeset
144 ;; we can directly use 'ori' instruction.)
kono
parents:
diff changeset
145 (define_constraint "Ie15"
kono
parents:
diff changeset
146 "A constant which is not in the range of imm15u but ok for bset instruction"
kono
parents:
diff changeset
147 (and (match_code "const_int")
kono
parents:
diff changeset
148 (match_test "(ival & 0xffff8000) && nds32_can_use_bset_p (ival)")))
kono
parents:
diff changeset
149
kono
parents:
diff changeset
150 ;; It15 is special and dedicated for performance extension
kono
parents:
diff changeset
151 ;; 'btgl' (single-bit-toggle) instruction.
kono
parents:
diff changeset
152 ;; It is used in xorsi3 pattern and recognized for the immediate
kono
parents:
diff changeset
153 ;; which is NOT in the range of imm15u but OK for 'btgl' instruction.
kono
parents:
diff changeset
154 ;; (If the immediate value IS in the range of imm15u,
kono
parents:
diff changeset
155 ;; we can directly use 'xori' instruction.)
kono
parents:
diff changeset
156 (define_constraint "It15"
kono
parents:
diff changeset
157 "A constant which is not in the range of imm15u but ok for btgl instruction"
kono
parents:
diff changeset
158 (and (match_code "const_int")
kono
parents:
diff changeset
159 (match_test "(ival & 0xffff8000) && nds32_can_use_btgl_p (ival)")))
kono
parents:
diff changeset
160
kono
parents:
diff changeset
161
kono
parents:
diff changeset
162 ;; Ii15 is special and dedicated for v3 isa
kono
parents:
diff changeset
163 ;; 'bitci' (bit-clear-immediate) instruction.
kono
parents:
diff changeset
164 ;; It is used in andsi3 pattern and recognized for the immediate whose
kono
parents:
diff changeset
165 ;; (~ival) value is in the range of imm15u and OK for 'bitci' instruction.
kono
parents:
diff changeset
166 ;; For example, 'andi $r0,$r0,0xfffffffc' can be presented
kono
parents:
diff changeset
167 ; with 'bitci $r0,$r0,3'.
kono
parents:
diff changeset
168 (define_constraint "Ii15"
kono
parents:
diff changeset
169 "A constant whose compliment value is in the range of imm15u
kono
parents:
diff changeset
170 and ok for bitci instruction"
kono
parents:
diff changeset
171 (and (match_code "const_int")
kono
parents:
diff changeset
172 (match_test "nds32_can_use_bitci_p (ival)")))
kono
parents:
diff changeset
173
kono
parents:
diff changeset
174
kono
parents:
diff changeset
175 (define_constraint "Is16"
kono
parents:
diff changeset
176 "Signed immediate 16-bit value"
kono
parents:
diff changeset
177 (and (match_code "const_int")
kono
parents:
diff changeset
178 (match_test "ival < (1 << 15) && ival >= -(1 << 15)")))
kono
parents:
diff changeset
179
kono
parents:
diff changeset
180 (define_constraint "Is17"
kono
parents:
diff changeset
181 "Signed immediate 17-bit value"
kono
parents:
diff changeset
182 (and (match_code "const_int")
kono
parents:
diff changeset
183 (match_test "ival < (1 << 16) && ival >= -(1 << 16)")))
kono
parents:
diff changeset
184
kono
parents:
diff changeset
185
kono
parents:
diff changeset
186 (define_constraint "Is19"
kono
parents:
diff changeset
187 "Signed immediate 19-bit value"
kono
parents:
diff changeset
188 (and (match_code "const_int")
kono
parents:
diff changeset
189 (match_test "ival < (1 << 18) && ival >= -(1 << 18)")))
kono
parents:
diff changeset
190
kono
parents:
diff changeset
191
kono
parents:
diff changeset
192 (define_constraint "Is20"
kono
parents:
diff changeset
193 "Signed immediate 20-bit value"
kono
parents:
diff changeset
194 (and (match_code "const_int")
kono
parents:
diff changeset
195 (match_test "ival < (1 << 19) && ival >= -(1 << 19)")))
kono
parents:
diff changeset
196
kono
parents:
diff changeset
197
kono
parents:
diff changeset
198 (define_constraint "Ihig"
kono
parents:
diff changeset
199 "The immediate value that can be simply set high 20-bit"
kono
parents:
diff changeset
200 (and (match_code "const_int")
kono
parents:
diff changeset
201 (match_test "(ival != 0) && ((ival & 0xfff) == 0)")))
kono
parents:
diff changeset
202
kono
parents:
diff changeset
203 (define_constraint "Izeb"
kono
parents:
diff changeset
204 "The immediate value 0xff"
kono
parents:
diff changeset
205 (and (match_code "const_int")
kono
parents:
diff changeset
206 (match_test "(ival == 0xff)")))
kono
parents:
diff changeset
207
kono
parents:
diff changeset
208 (define_constraint "Izeh"
kono
parents:
diff changeset
209 "The immediate value 0xffff"
kono
parents:
diff changeset
210 (and (match_code "const_int")
kono
parents:
diff changeset
211 (match_test "(ival == 0xffff)")))
kono
parents:
diff changeset
212
kono
parents:
diff changeset
213 (define_constraint "Ixls"
kono
parents:
diff changeset
214 "The immediate value 0x01"
kono
parents:
diff changeset
215 (and (match_code "const_int")
kono
parents:
diff changeset
216 (match_test "TARGET_PERF_EXT && (ival == 0x1)")))
kono
parents:
diff changeset
217
kono
parents:
diff changeset
218 (define_constraint "Ix11"
kono
parents:
diff changeset
219 "The immediate value 0x7ff"
kono
parents:
diff changeset
220 (and (match_code "const_int")
kono
parents:
diff changeset
221 (match_test "TARGET_PERF_EXT && (ival == 0x7ff)")))
kono
parents:
diff changeset
222
kono
parents:
diff changeset
223 (define_constraint "Ibms"
kono
parents:
diff changeset
224 "The immediate value with power of 2"
kono
parents:
diff changeset
225 (and (match_code "const_int")
kono
parents:
diff changeset
226 (match_test "(TARGET_ISA_V3 || TARGET_ISA_V3M)
kono
parents:
diff changeset
227 && (IN_RANGE (exact_log2 (ival), 0, 7))")))
kono
parents:
diff changeset
228
kono
parents:
diff changeset
229 (define_constraint "Ifex"
kono
parents:
diff changeset
230 "The immediate value with power of 2 minus 1"
kono
parents:
diff changeset
231 (and (match_code "const_int")
kono
parents:
diff changeset
232 (match_test "(TARGET_ISA_V3 || TARGET_ISA_V3M)
kono
parents:
diff changeset
233 && (IN_RANGE (exact_log2 (ival + 1), 1, 8))")))
kono
parents:
diff changeset
234
kono
parents:
diff changeset
235
kono
parents:
diff changeset
236 (define_memory_constraint "U33"
kono
parents:
diff changeset
237 "Memory constraint for 333 format"
kono
parents:
diff changeset
238 (and (match_code "mem")
kono
parents:
diff changeset
239 (match_test "nds32_mem_format (op) == ADDRESS_LO_REG_IMM3U")))
kono
parents:
diff changeset
240
kono
parents:
diff changeset
241 (define_memory_constraint "U45"
kono
parents:
diff changeset
242 "Memory constraint for 45 format"
kono
parents:
diff changeset
243 (and (match_code "mem")
kono
parents:
diff changeset
244 (match_test "(nds32_mem_format (op) == ADDRESS_REG)
kono
parents:
diff changeset
245 && (GET_MODE (op) == SImode)")))
kono
parents:
diff changeset
246
kono
parents:
diff changeset
247 (define_memory_constraint "U37"
kono
parents:
diff changeset
248 "Memory constraint for 37 format"
kono
parents:
diff changeset
249 (and (match_code "mem")
kono
parents:
diff changeset
250 (match_test "(nds32_mem_format (op) == ADDRESS_SP_IMM7U
kono
parents:
diff changeset
251 || nds32_mem_format (op) == ADDRESS_FP_IMM7U)
kono
parents:
diff changeset
252 && (GET_MODE (op) == SImode)")))
kono
parents:
diff changeset
253
kono
parents:
diff changeset
254 ;; ------------------------------------------------------------------------