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

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents 58ad6c70ea60
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 ;; Constraint definitions for IA-32 and x86-64. 1 ;; Constraint definitions for IA-32 and x86-64.
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
16 ;; You should have received a copy of the GNU General Public License 16 ;; You should have received a copy of the GNU General Public License
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 ;;; Unused letters: 20 ;;; Unused letters:
21 ;;; B H T W 21 ;;; H
22 ;;; h jk vw z 22 ;;; h j z
23 23
24 ;; Integer register constraints. 24 ;; Integer register constraints.
25 ;; It is not necessary to define 'r' here. 25 ;; It is not necessary to define 'r' here.
26 (define_register_constraint "R" "LEGACY_REGS" 26 (define_register_constraint "R" "LEGACY_REGS"
27 "Legacy register---the eight integer registers available on all 27 "Legacy register---the eight integer registers available on all
76 76
77 (define_register_constraint "u" 77 (define_register_constraint "u"
78 "TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 ? FP_SECOND_REG : NO_REGS" 78 "TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 ? FP_SECOND_REG : NO_REGS"
79 "Second from top of 80387 floating-point stack (@code{%st(1)}).") 79 "Second from top of 80387 floating-point stack (@code{%st(1)}).")
80 80
81 (define_register_constraint "Yk" "TARGET_AVX512F ? MASK_EVEX_REGS : NO_REGS"
82 "@internal Any mask register that can be used as predicate, i.e. k1-k7.")
83
84 (define_register_constraint "k" "TARGET_AVX512F ? MASK_REGS : NO_REGS"
85 "@internal Any mask register.")
86
81 ;; Vector registers (also used for plain floating point nowadays). 87 ;; Vector registers (also used for plain floating point nowadays).
82 (define_register_constraint "y" "TARGET_MMX ? MMX_REGS : NO_REGS" 88 (define_register_constraint "y" "TARGET_MMX ? MMX_REGS : NO_REGS"
83 "Any MMX register.") 89 "Any MMX register.")
84 90
85 (define_register_constraint "x" "TARGET_SSE ? SSE_REGS : NO_REGS" 91 (define_register_constraint "x" "TARGET_SSE ? SSE_REGS : NO_REGS"
86 "Any SSE register.") 92 "Any SSE register.")
87 93
94 (define_register_constraint "v" "TARGET_SSE ? ALL_SSE_REGS : NO_REGS"
95 "Any EVEX encodable SSE register (@code{%xmm0-%xmm31}).")
96
97 (define_register_constraint "w" "TARGET_MPX ? BND_REGS : NO_REGS"
98 "@internal Any bound register.")
99
88 ;; We use the Y prefix to denote any number of conditional register sets: 100 ;; We use the Y prefix to denote any number of conditional register sets:
89 ;; z First SSE register. 101 ;; z First SSE register.
90 ;; 2 SSE2 enabled 102 ;; c SSE inter-unit conversions enabled
91 ;; i SSE2 inter-unit moves enabled 103 ;; i SSE2 inter-unit moves to SSE register enabled
92 ;; m MMX inter-unit moves enabled 104 ;; j SSE2 inter-unit moves from SSE register enabled
105 ;; d any EVEX encodable SSE register for AVX512BW target or any SSE register
106 ;; for SSE4_1 target, when inter-unit moves to SSE register are enabled
107 ;; e any EVEX encodable SSE register for AVX512BW target or any SSE register
108 ;; for SSE4_1 target, when inter-unit moves from SSE register are enabled
109 ;; m MMX inter-unit moves to MMX register enabled
110 ;; n MMX inter-unit moves from MMX register enabled
111 ;; p Integer register when TARGET_PARTIAL_REG_STALL is disabled
112 ;; a Integer register when zero extensions with AND are disabled
113 ;; b Any register that can be used as the GOT base when calling
114 ;; ___tls_get_addr: that is, any general register except EAX
115 ;; and ESP, for -fno-plt if linker supports it. Otherwise,
116 ;; EBX.
117 ;; f x87 register when 80387 floating point arithmetic is enabled
118 ;; r SSE regs not requiring REX prefix when prefixes avoidance is enabled
119 ;; and all SSE regs otherwise
120 ;; v any EVEX encodable SSE register for AVX512VL target,
121 ;; otherwise any SSE register
122 ;; h EVEX encodable SSE register with number factor of four
93 123
94 (define_register_constraint "Yz" "TARGET_SSE ? SSE_FIRST_REG : NO_REGS" 124 (define_register_constraint "Yz" "TARGET_SSE ? SSE_FIRST_REG : NO_REGS"
95 "First SSE register (@code{%xmm0}).") 125 "First SSE register (@code{%xmm0}).")
96 126
97 (define_register_constraint "Y2" "TARGET_SSE2 ? SSE_REGS : NO_REGS" 127 (define_register_constraint "Yc"
98 "@internal Any SSE register, when SSE2 is enabled.") 128 "TARGET_SSE && TARGET_INTER_UNIT_CONVERSIONS ? ALL_SSE_REGS : NO_REGS"
129 "@internal Any SSE register, when SSE and inter-unit conversions are enabled.")
99 130
100 (define_register_constraint "Yi" 131 (define_register_constraint "Yi"
101 "TARGET_SSE2 && TARGET_INTER_UNIT_MOVES ? SSE_REGS : NO_REGS" 132 "TARGET_SSE2 && TARGET_INTER_UNIT_MOVES_TO_VEC ? ALL_SSE_REGS : NO_REGS"
102 "@internal Any SSE register, when SSE2 and inter-unit moves are enabled.") 133 "@internal Any SSE register, when SSE2 and inter-unit moves to vector registers are enabled.")
134
135 (define_register_constraint "Yj"
136 "TARGET_SSE2 && TARGET_INTER_UNIT_MOVES_FROM_VEC ? ALL_SSE_REGS : NO_REGS"
137 "@internal Any SSE register, when SSE2 and inter-unit moves from vector registers are enabled.")
138
139 (define_register_constraint "Yd"
140 "TARGET_INTER_UNIT_MOVES_TO_VEC
141 ? (TARGET_AVX512DQ
142 ? ALL_SSE_REGS
143 : (TARGET_SSE4_1 ? SSE_REGS : NO_REGS))
144 : NO_REGS"
145 "@internal Any EVEX encodable SSE register (@code{%xmm0-%xmm31}) for AVX512DQ target or any SSE register for SSE4_1 target, when inter-unit moves to vector registers are enabled.")
146
147 (define_register_constraint "Ye"
148 "TARGET_INTER_UNIT_MOVES_FROM_VEC
149 ? (TARGET_AVX512DQ
150 ? ALL_SSE_REGS
151 : (TARGET_SSE4_1 ? SSE_REGS : NO_REGS))
152 : NO_REGS"
153 "@internal Any EVEX encodable SSE register (@code{%xmm0-%xmm31}) for AVX512DQ target or any SSE register for SSE4_1 target, when inter-unit moves from vector registers are enabled.")
103 154
104 (define_register_constraint "Ym" 155 (define_register_constraint "Ym"
105 "TARGET_MMX && TARGET_INTER_UNIT_MOVES ? MMX_REGS : NO_REGS" 156 "TARGET_MMX && TARGET_INTER_UNIT_MOVES_TO_VEC ? MMX_REGS : NO_REGS"
106 "@internal Any MMX register, when inter-unit moves are enabled.") 157 "@internal Any MMX register, when inter-unit moves to vector registers are enabled.")
158
159 (define_register_constraint "Yn"
160 "TARGET_MMX && TARGET_INTER_UNIT_MOVES_FROM_VEC ? MMX_REGS : NO_REGS"
161 "@internal Any MMX register, when inter-unit moves from vector registers are enabled.")
162
163 (define_register_constraint "Yp"
164 "TARGET_PARTIAL_REG_STALL ? NO_REGS : GENERAL_REGS"
165 "@internal Any integer register when TARGET_PARTIAL_REG_STALL is disabled.")
166
167 (define_register_constraint "Ya"
168 "TARGET_ZERO_EXTEND_WITH_AND && optimize_function_for_speed_p (cfun)
169 ? NO_REGS : GENERAL_REGS"
170 "@internal Any integer register when zero extensions with AND are disabled.")
171
172 (define_register_constraint "Yb"
173 "(!flag_plt && HAVE_AS_IX86_TLS_GET_ADDR_GOT) ? TLS_GOTBASE_REGS : BREG"
174 "@internal Any register that can be used as the GOT base when calling
175 ___tls_get_addr: that is, any general register except @code{a} and
176 @code{sp} registers, for -fno-plt if linker supports it. Otherwise,
177 @code{b} register.")
178
179 (define_register_constraint "Yf"
180 "(ix86_fpmath & FPMATH_387) ? FLOAT_REGS : NO_REGS"
181 "@internal Any x87 register when 80387 FP arithmetic is enabled.")
182
183 (define_register_constraint "Yr"
184 "TARGET_SSE ? (TARGET_AVOID_4BYTE_PREFIXES ? NO_REX_SSE_REGS : ALL_SSE_REGS) : NO_REGS"
185 "@internal Lower SSE register when avoiding REX prefix and all SSE registers otherwise.")
186
187 (define_register_constraint "Yv"
188 "TARGET_AVX512VL ? ALL_SSE_REGS : TARGET_SSE ? SSE_REGS : NO_REGS"
189 "@internal For AVX512VL, any EVEX encodable SSE register (@code{%xmm0-%xmm31}), otherwise any SSE register.")
190
191 (define_register_constraint "Yh" "TARGET_AVX512F ? MOD4_SSE_REGS : NO_REGS"
192 "@internal Any EVEX encodable SSE register, which has number factor of four.")
193
194 ;; We use the B prefix to denote any number of internal operands:
195 ;; f FLAGS_REG
196 ;; g GOT memory operand.
197 ;; m Vector memory operand
198 ;; c Constant memory operand
199 ;; n Memory operand without REX prefix
200 ;; s Sibcall memory operand, not valid for TARGET_X32
201 ;; w Call memory operand, not valid for TARGET_X32
202 ;; z Constant call address operand.
203 ;; C SSE constant operand.
204
205 (define_constraint "Bf"
206 "@internal Flags register operand."
207 (match_operand 0 "flags_reg_operand"))
208
209 (define_constraint "Bg"
210 "@internal GOT memory operand."
211 (match_operand 0 "GOT_memory_operand"))
212
213 (define_special_memory_constraint "Bm"
214 "@internal Vector memory operand."
215 (match_operand 0 "vector_memory_operand"))
216
217 (define_special_memory_constraint "Bc"
218 "@internal Constant memory operand."
219 (and (match_operand 0 "memory_operand")
220 (match_test "constant_address_p (XEXP (op, 0))")))
221
222 (define_special_memory_constraint "Bn"
223 "@internal Memory operand without REX prefix."
224 (match_operand 0 "norex_memory_operand"))
225
226 (define_constraint "Bs"
227 "@internal Sibcall memory operand."
228 (ior (and (not (match_test "TARGET_X32"))
229 (match_operand 0 "sibcall_memory_operand"))
230 (and (match_test "TARGET_X32 && Pmode == DImode")
231 (match_operand 0 "GOT_memory_operand"))))
232
233 (define_constraint "Bw"
234 "@internal Call memory operand."
235 (ior (and (not (match_test "TARGET_X32"))
236 (match_operand 0 "memory_operand"))
237 (and (match_test "TARGET_X32 && Pmode == DImode")
238 (match_operand 0 "GOT_memory_operand"))))
239
240 (define_constraint "Bz"
241 "@internal Constant call address operand."
242 (match_operand 0 "constant_call_address_operand"))
243
244 (define_constraint "BC"
245 "@internal SSE constant -1 operand."
246 (and (match_test "TARGET_SSE")
247 (ior (match_test "op == constm1_rtx")
248 (match_operand 0 "vector_all_ones_operand"))))
107 249
108 ;; Integer constant constraints. 250 ;; Integer constant constraints.
109 (define_constraint "I" 251 (define_constraint "I"
110 "Integer constant in the range 0 @dots{} 31, for 32-bit shifts." 252 "Integer constant in the range 0 @dots{} 31, for 32-bit shifts."
111 (and (match_code "const_int") 253 (and (match_code "const_int")
120 "Signed 8-bit integer constant." 262 "Signed 8-bit integer constant."
121 (and (match_code "const_int") 263 (and (match_code "const_int")
122 (match_test "IN_RANGE (ival, -128, 127)"))) 264 (match_test "IN_RANGE (ival, -128, 127)")))
123 265
124 (define_constraint "L" 266 (define_constraint "L"
125 "@code{0xFF} or @code{0xFFFF}, for andsi as a zero-extending move." 267 "@code{0xFF}, @code{0xFFFF} or @code{0xFFFFFFFF}
126 (and (match_code "const_int") 268 for AND as a zero-extending move."
127 (match_test "ival == 0xFF || ival == 0xFFFF"))) 269 (and (match_code "const_int")
270 (match_test "ival == 0xff || ival == 0xffff
271 || ival == (HOST_WIDE_INT) 0xffffffff")))
128 272
129 (define_constraint "M" 273 (define_constraint "M"
130 "0, 1, 2, or 3 (shifts for the @code{lea} instruction)." 274 "0, 1, 2, or 3 (shifts for the @code{lea} instruction)."
131 (and (match_code "const_int") 275 (and (match_code "const_int")
132 (match_test "IN_RANGE (ival, 0, 3)"))) 276 (match_test "IN_RANGE (ival, 0, 3)")))
147 ;; stack register converter may need to load 0.0 into the function 291 ;; stack register converter may need to load 0.0 into the function
148 ;; value register (top of stack). 292 ;; value register (top of stack).
149 (define_constraint "G" 293 (define_constraint "G"
150 "Standard 80387 floating point constant." 294 "Standard 80387 floating point constant."
151 (and (match_code "const_double") 295 (and (match_code "const_double")
152 (match_test "standard_80387_constant_p (op)"))) 296 (match_test "standard_80387_constant_p (op) > 0")))
153 297
154 ;; This can theoretically be any mode's CONST0_RTX. 298 ;; This can theoretically be any mode's CONST0_RTX.
155 (define_constraint "C" 299 (define_constraint "C"
156 "Standard SSE floating point constant." 300 "SSE constant zero operand."
157 (match_test "standard_sse_constant_p (op)")) 301 (and (match_test "TARGET_SSE")
302 (ior (match_test "op == const0_rtx")
303 (match_operand 0 "const0_operand"))))
158 304
159 ;; Constant-or-symbol-reference constraints. 305 ;; Constant-or-symbol-reference constraints.
160 306
161 (define_constraint "e" 307 (define_constraint "e"
162 "32-bit signed integer constant, or a symbolic reference known 308 "32-bit signed integer constant, or a symbolic reference known
163 to fit that range (for immediate operands in sign-extending x86-64 309 to fit that range (for immediate operands in sign-extending x86-64
164 instructions)." 310 instructions)."
165 (match_operand 0 "x86_64_immediate_operand")) 311 (match_operand 0 "x86_64_immediate_operand"))
166 312
313 ;; We use W prefix to denote any number of
314 ;; constant-or-symbol-reference constraints
315
316 (define_constraint "We"
317 "32-bit signed integer constant, or a symbolic reference known
318 to fit that range (for sign-extending conversion operations that
319 require non-VOIDmode immediate operands)."
320 (and (match_operand 0 "x86_64_immediate_operand")
321 (match_test "GET_MODE (op) != VOIDmode")))
322
323 (define_constraint "Wz"
324 "32-bit unsigned integer constant, or a symbolic reference known
325 to fit that range (for zero-extending conversion operations that
326 require non-VOIDmode immediate operands)."
327 (and (match_operand 0 "x86_64_zext_immediate_operand")
328 (match_test "GET_MODE (op) != VOIDmode")))
329
330 (define_constraint "Wd"
331 "128-bit integer constant where both the high and low 64-bit word
332 of it satisfies the e constraint."
333 (match_operand 0 "x86_64_hilo_int_operand"))
334
335 (define_constraint "Wf"
336 "32-bit signed integer constant zero extended from word size
337 to double word size."
338 (match_operand 0 "x86_64_dwzext_immediate_operand"))
339
167 (define_constraint "Z" 340 (define_constraint "Z"
168 "32-bit unsigned integer constant, or a symbolic reference known 341 "32-bit unsigned integer constant, or a symbolic reference known
169 to fit that range (for immediate operands in zero-extending x86-64 342 to fit that range (for immediate operands in zero-extending x86-64
170 instructions)." 343 instructions)."
171 (match_operand 0 "x86_64_zext_immediate_operand")) 344 (match_operand 0 "x86_64_zext_immediate_operand"))
345
346 ;; T prefix is used for different address constraints
347 ;; v - VSIB address
348 ;; s - address with no segment register
349 ;; i - address with no index and no rip
350 ;; b - address with no base and no rip
351
352 (define_address_constraint "Tv"
353 "VSIB address operand"
354 (match_operand 0 "vsib_address_operand"))
355
356 (define_address_constraint "Ts"
357 "Address operand without segment register"
358 (match_operand 0 "address_no_seg_operand"))
359
360 (define_address_constraint "Ti"
361 "MPX address operand without index"
362 (match_operand 0 "address_mpx_no_index_operand"))
363
364 (define_address_constraint "Tb"
365 "MPX address operand without base"
366 (match_operand 0 "address_mpx_no_base_operand"))