Line data Source code
1 : /* Copyright (C) 1988-2026 Free Software Foundation, Inc.
2 :
3 : This file is part of GCC.
4 :
5 : GCC is free software; you can redistribute it and/or modify
6 : it under the terms of the GNU General Public License as published by
7 : the Free Software Foundation; either version 3, or (at your option)
8 : any later version.
9 :
10 : GCC is distributed in the hope that it will be useful,
11 : but WITHOUT ANY WARRANTY; without even the implied warranty of
12 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 : GNU General Public License for more details.
14 :
15 : You should have received a copy of the GNU General Public License
16 : along with GCC; see the file COPYING3. If not see
17 : <http://www.gnu.org/licenses/>. */
18 :
19 : #define IN_TARGET_CODE 1
20 :
21 : #include "config.h"
22 : #include "system.h"
23 : #include "coretypes.h"
24 : #include "backend.h"
25 : #include "rtl.h"
26 : #include "tree.h"
27 : #include "memmodel.h"
28 : #include "gimple.h"
29 : #include "cfghooks.h"
30 : #include "cfgloop.h"
31 : #include "df.h"
32 : #include "tm_p.h"
33 : #include "stringpool.h"
34 : #include "expmed.h"
35 : #include "optabs.h"
36 : #include "regs.h"
37 : #include "emit-rtl.h"
38 : #include "recog.h"
39 : #include "cgraph.h"
40 : #include "diagnostic.h"
41 : #include "cfgbuild.h"
42 : #include "alias.h"
43 : #include "fold-const.h"
44 : #include "attribs.h"
45 : #include "calls.h"
46 : #include "stor-layout.h"
47 : #include "varasm.h"
48 : #include "output.h"
49 : #include "insn-attr.h"
50 : #include "flags.h"
51 : #include "except.h"
52 : #include "explow.h"
53 : #include "expr.h"
54 : #include "cfgrtl.h"
55 : #include "common/common-target.h"
56 : #include "langhooks.h"
57 : #include "reload.h"
58 : #include "gimplify.h"
59 : #include "dwarf2.h"
60 : #include "tm-constrs.h"
61 : #include "cselib.h"
62 : #include "sched-int.h"
63 : #include "opts.h"
64 : #include "tree-pass.h"
65 : #include "context.h"
66 : #include "pass_manager.h"
67 : #include "target-globals.h"
68 : #include "gimple-iterator.h"
69 : #include "shrink-wrap.h"
70 : #include "builtins.h"
71 : #include "rtl-iter.h"
72 : #include "tree-iterator.h"
73 : #include "dbgcnt.h"
74 : #include "case-cfn-macros.h"
75 : #include "dojump.h"
76 : #include "fold-const-call.h"
77 : #include "tree-vrp.h"
78 : #include "tree-ssanames.h"
79 : #include "selftest.h"
80 : #include "selftest-rtl.h"
81 : #include "print-rtl.h"
82 : #include "intl.h"
83 : #include "ifcvt.h"
84 : #include "symbol-summary.h"
85 : #include "sreal.h"
86 : #include "ipa-cp.h"
87 : #include "ipa-prop.h"
88 : #include "ipa-fnsummary.h"
89 : #include "wide-int-bitmask.h"
90 : #include "tree-vector-builder.h"
91 : #include "debug.h"
92 : #include "dwarf2out.h"
93 : #include "i386-options.h"
94 :
95 : #include "x86-tune-costs.h"
96 :
97 : #ifndef SUBTARGET32_DEFAULT_CPU
98 : #define SUBTARGET32_DEFAULT_CPU "i386"
99 : #endif
100 :
101 : /* Processor feature/optimization bitmasks. */
102 : #define m_NONE HOST_WIDE_INT_0U
103 : #define m_ALL (~HOST_WIDE_INT_0U)
104 : #define m_386 (HOST_WIDE_INT_1U<<PROCESSOR_I386)
105 : #define m_486 (HOST_WIDE_INT_1U<<PROCESSOR_I486)
106 : #define m_PENT (HOST_WIDE_INT_1U<<PROCESSOR_PENTIUM)
107 : #define m_LAKEMONT (HOST_WIDE_INT_1U<<PROCESSOR_LAKEMONT)
108 : #define m_PPRO (HOST_WIDE_INT_1U<<PROCESSOR_PENTIUMPRO)
109 : #define m_PENT4 (HOST_WIDE_INT_1U<<PROCESSOR_PENTIUM4)
110 : #define m_NOCONA (HOST_WIDE_INT_1U<<PROCESSOR_NOCONA)
111 : #define m_P4_NOCONA (m_PENT4 | m_NOCONA)
112 : #define m_CORE2 (HOST_WIDE_INT_1U<<PROCESSOR_CORE2)
113 : #define m_NEHALEM (HOST_WIDE_INT_1U<<PROCESSOR_NEHALEM)
114 : #define m_SANDYBRIDGE (HOST_WIDE_INT_1U<<PROCESSOR_SANDYBRIDGE)
115 : #define m_HASWELL (HOST_WIDE_INT_1U<<PROCESSOR_HASWELL)
116 : #define m_BONNELL (HOST_WIDE_INT_1U<<PROCESSOR_BONNELL)
117 : #define m_SILVERMONT (HOST_WIDE_INT_1U<<PROCESSOR_SILVERMONT)
118 : #define m_SKYLAKE (HOST_WIDE_INT_1U<<PROCESSOR_SKYLAKE)
119 : #define m_SKYLAKE_AVX512 (HOST_WIDE_INT_1U<<PROCESSOR_SKYLAKE_AVX512)
120 : #define m_CANNONLAKE (HOST_WIDE_INT_1U<<PROCESSOR_CANNONLAKE)
121 : #define m_ICELAKE_CLIENT (HOST_WIDE_INT_1U<<PROCESSOR_ICELAKE_CLIENT)
122 : #define m_ICELAKE_SERVER (HOST_WIDE_INT_1U<<PROCESSOR_ICELAKE_SERVER)
123 : #define m_CASCADELAKE (HOST_WIDE_INT_1U<<PROCESSOR_CASCADELAKE)
124 : #define m_TIGERLAKE (HOST_WIDE_INT_1U<<PROCESSOR_TIGERLAKE)
125 : #define m_COOPERLAKE (HOST_WIDE_INT_1U<<PROCESSOR_COOPERLAKE)
126 : #define m_SAPPHIRERAPIDS (HOST_WIDE_INT_1U<<PROCESSOR_SAPPHIRERAPIDS)
127 : #define m_ALDERLAKE (HOST_WIDE_INT_1U<<PROCESSOR_ALDERLAKE)
128 : #define m_ROCKETLAKE (HOST_WIDE_INT_1U<<PROCESSOR_ROCKETLAKE)
129 : #define m_GRANITERAPIDS (HOST_WIDE_INT_1U<<PROCESSOR_GRANITERAPIDS)
130 : #define m_GRANITERAPIDS_D (HOST_WIDE_INT_1U<<PROCESSOR_GRANITERAPIDS_D)
131 : #define m_ARROWLAKE (HOST_WIDE_INT_1U<<PROCESSOR_ARROWLAKE)
132 : #define m_ARROWLAKE_S (HOST_WIDE_INT_1U<<PROCESSOR_ARROWLAKE_S)
133 : #define m_PANTHERLAKE (HOST_WIDE_INT_1U<<PROCESSOR_PANTHERLAKE)
134 : #define m_DIAMONDRAPIDS (HOST_WIDE_INT_1U<<PROCESSOR_DIAMONDRAPIDS)
135 : #define m_NOVALAKE (HOST_WIDE_INT_1U<<PROCESSOR_NOVALAKE)
136 : #define m_CORE_AVX512 (m_SKYLAKE_AVX512 | m_CANNONLAKE \
137 : | m_ICELAKE_CLIENT | m_ICELAKE_SERVER | m_CASCADELAKE \
138 : | m_TIGERLAKE | m_COOPERLAKE | m_SAPPHIRERAPIDS \
139 : | m_ROCKETLAKE | m_GRANITERAPIDS | m_GRANITERAPIDS_D \
140 : | m_DIAMONDRAPIDS)
141 : #define m_CORE_AVX2 (m_HASWELL | m_SKYLAKE | m_CORE_AVX512)
142 : #define m_CORE_ALL (m_CORE2 | m_NEHALEM | m_SANDYBRIDGE | m_CORE_AVX2)
143 : #define m_CORE_HYBRID (m_ALDERLAKE | m_ARROWLAKE | m_ARROWLAKE_S \
144 : | m_PANTHERLAKE | m_NOVALAKE)
145 : #define m_GOLDMONT (HOST_WIDE_INT_1U<<PROCESSOR_GOLDMONT)
146 : #define m_GOLDMONT_PLUS (HOST_WIDE_INT_1U<<PROCESSOR_GOLDMONT_PLUS)
147 : #define m_TREMONT (HOST_WIDE_INT_1U<<PROCESSOR_TREMONT)
148 : #define m_SIERRAFOREST (HOST_WIDE_INT_1U<<PROCESSOR_SIERRAFOREST)
149 : #define m_GRANDRIDGE (HOST_WIDE_INT_1U<<PROCESSOR_GRANDRIDGE)
150 : #define m_CLEARWATERFOREST (HOST_WIDE_INT_1U<<PROCESSOR_CLEARWATERFOREST)
151 : #define m_CORE_ATOM (m_SIERRAFOREST | m_GRANDRIDGE | m_CLEARWATERFOREST)
152 : #define m_INTEL (HOST_WIDE_INT_1U<<PROCESSOR_INTEL)
153 : /* Gather Data Sampling / CVE-2022-40982 / INTEL-SA-00828.
154 : Software mitigation. */
155 : #define m_GDS (m_SKYLAKE | m_SKYLAKE_AVX512 | m_CANNONLAKE \
156 : | m_ICELAKE_CLIENT | m_ICELAKE_SERVER | m_CASCADELAKE \
157 : | m_TIGERLAKE | m_COOPERLAKE | m_ROCKETLAKE)
158 :
159 : #define m_LUJIAZUI (HOST_WIDE_INT_1U<<PROCESSOR_LUJIAZUI)
160 : #define m_YONGFENG (HOST_WIDE_INT_1U<<PROCESSOR_YONGFENG)
161 : #define m_SHIJIDADAO (HOST_WIDE_INT_1U<<PROCESSOR_SHIJIDADAO)
162 : #define m_ZHAOXIN (m_LUJIAZUI | m_YONGFENG | m_SHIJIDADAO)
163 :
164 : #define m_GEODE (HOST_WIDE_INT_1U<<PROCESSOR_GEODE)
165 : #define m_K6 (HOST_WIDE_INT_1U<<PROCESSOR_K6)
166 : #define m_K6_GEODE (m_K6 | m_GEODE)
167 : #define m_K8 (HOST_WIDE_INT_1U<<PROCESSOR_K8)
168 : #define m_ATHLON (HOST_WIDE_INT_1U<<PROCESSOR_ATHLON)
169 : #define m_ATHLON_K8 (m_K8 | m_ATHLON)
170 : #define m_AMDFAM10 (HOST_WIDE_INT_1U<<PROCESSOR_AMDFAM10)
171 : #define m_BDVER1 (HOST_WIDE_INT_1U<<PROCESSOR_BDVER1)
172 : #define m_BDVER2 (HOST_WIDE_INT_1U<<PROCESSOR_BDVER2)
173 : #define m_BDVER3 (HOST_WIDE_INT_1U<<PROCESSOR_BDVER3)
174 : #define m_BDVER4 (HOST_WIDE_INT_1U<<PROCESSOR_BDVER4)
175 : #define m_ZNVER1 (HOST_WIDE_INT_1U<<PROCESSOR_ZNVER1)
176 : #define m_ZNVER2 (HOST_WIDE_INT_1U<<PROCESSOR_ZNVER2)
177 : #define m_ZNVER3 (HOST_WIDE_INT_1U<<PROCESSOR_ZNVER3)
178 : #define m_ZNVER4 (HOST_WIDE_INT_1U<<PROCESSOR_ZNVER4)
179 : #define m_ZNVER5 (HOST_WIDE_INT_1U<<PROCESSOR_ZNVER5)
180 : #define m_ZNVER6 (HOST_WIDE_INT_1U<<PROCESSOR_ZNVER6)
181 : #define m_BTVER1 (HOST_WIDE_INT_1U<<PROCESSOR_BTVER1)
182 : #define m_BTVER2 (HOST_WIDE_INT_1U<<PROCESSOR_BTVER2)
183 : #define m_BDVER (m_BDVER1 | m_BDVER2 | m_BDVER3 | m_BDVER4)
184 : #define m_BTVER (m_BTVER1 | m_BTVER2)
185 : #define m_ZNVER (m_ZNVER1 | m_ZNVER2 | m_ZNVER3 | m_ZNVER4 | m_ZNVER5 | m_ZNVER6)
186 : #define m_AMD_MULTIPLE (m_ATHLON_K8 | m_AMDFAM10 | m_BDVER | m_BTVER \
187 : | m_ZNVER)
188 : #define m_C86_4G_M4 (HOST_WIDE_INT_1U<<PROCESSOR_C86_4G_M4)
189 : #define m_C86_4G_M6 (HOST_WIDE_INT_1U<<PROCESSOR_C86_4G_M6)
190 : #define m_C86_4G_M7 (HOST_WIDE_INT_1U<<PROCESSOR_C86_4G_M7)
191 : #define m_C86_4G_M8 (HOST_WIDE_INT_1U<<PROCESSOR_C86_4G_M8)
192 : #define m_C86_4G (m_C86_4G_M4 | m_C86_4G_M6 | m_C86_4G_M7 \
193 : | m_C86_4G_M8)
194 :
195 : #define m_GENERIC (HOST_WIDE_INT_1U<<PROCESSOR_GENERIC)
196 :
197 : const char* ix86_tune_feature_names[X86_TUNE_LAST] = {
198 : #undef DEF_TUNE
199 : #define DEF_TUNE(tune, name, selector) name,
200 : #include "x86-tune.def"
201 : #undef DEF_TUNE
202 : };
203 :
204 : /* Feature tests against the various tunings. */
205 : unsigned char ix86_tune_features[X86_TUNE_LAST];
206 :
207 : /* Feature tests against the various tunings used to create ix86_tune_features
208 : based on the processor mask. */
209 : static unsigned HOST_WIDE_INT initial_ix86_tune_features[X86_TUNE_LAST] = {
210 : #undef DEF_TUNE
211 : #define DEF_TUNE(tune, name, selector) selector,
212 : #include "x86-tune.def"
213 : #undef DEF_TUNE
214 : };
215 :
216 : /* Feature tests against the various architecture variations. */
217 : unsigned char ix86_arch_features[X86_ARCH_LAST];
218 :
219 : struct ix86_target_opts
220 : {
221 : const char *option; /* option string */
222 : HOST_WIDE_INT mask; /* isa mask options */
223 : };
224 :
225 : /* This table is ordered so that options like -msse4.2 that imply other
226 : ISAs come first. Target string will be displayed in the same order. */
227 : static struct ix86_target_opts isa2_opts[] =
228 : {
229 : { "-mcx16", OPTION_MASK_ISA2_CX16 },
230 : { "-mvaes", OPTION_MASK_ISA2_VAES },
231 : { "-mrdpid", OPTION_MASK_ISA2_RDPID },
232 : { "-mpconfig", OPTION_MASK_ISA2_PCONFIG },
233 : { "-mwbnoinvd", OPTION_MASK_ISA2_WBNOINVD },
234 : { "-mavx512vp2intersect", OPTION_MASK_ISA2_AVX512VP2INTERSECT },
235 : { "-msgx", OPTION_MASK_ISA2_SGX },
236 : { "-mhle", OPTION_MASK_ISA2_HLE },
237 : { "-mmovbe", OPTION_MASK_ISA2_MOVBE },
238 : { "-mclzero", OPTION_MASK_ISA2_CLZERO },
239 : { "-mmwaitx", OPTION_MASK_ISA2_MWAITX },
240 : { "-mmwait", OPTION_MASK_ISA2_MWAIT },
241 : { "-mmovdir64b", OPTION_MASK_ISA2_MOVDIR64B },
242 : { "-mwaitpkg", OPTION_MASK_ISA2_WAITPKG },
243 : { "-mcldemote", OPTION_MASK_ISA2_CLDEMOTE },
244 : { "-mptwrite", OPTION_MASK_ISA2_PTWRITE },
245 : { "-mavx512bf16", OPTION_MASK_ISA2_AVX512BF16 },
246 : { "-menqcmd", OPTION_MASK_ISA2_ENQCMD },
247 : { "-mserialize", OPTION_MASK_ISA2_SERIALIZE },
248 : { "-mtsxldtrk", OPTION_MASK_ISA2_TSXLDTRK },
249 : { "-mamx-tile", OPTION_MASK_ISA2_AMX_TILE },
250 : { "-mamx-int8", OPTION_MASK_ISA2_AMX_INT8 },
251 : { "-mamx-bf16", OPTION_MASK_ISA2_AMX_BF16 },
252 : { "-muintr", OPTION_MASK_ISA2_UINTR },
253 : { "-mhreset", OPTION_MASK_ISA2_HRESET },
254 : { "-mkl", OPTION_MASK_ISA2_KL },
255 : { "-mwidekl", OPTION_MASK_ISA2_WIDEKL },
256 : { "-mavxvnni", OPTION_MASK_ISA2_AVXVNNI },
257 : { "-mavx512fp16", OPTION_MASK_ISA2_AVX512FP16 },
258 : { "-mavxifma", OPTION_MASK_ISA2_AVXIFMA },
259 : { "-mavxvnniint8", OPTION_MASK_ISA2_AVXVNNIINT8 },
260 : { "-mavxneconvert", OPTION_MASK_ISA2_AVXNECONVERT },
261 : { "-mcmpccxadd", OPTION_MASK_ISA2_CMPCCXADD },
262 : { "-mamx-fp16", OPTION_MASK_ISA2_AMX_FP16 },
263 : { "-mprefetchi", OPTION_MASK_ISA2_PREFETCHI },
264 : { "-mraoint", OPTION_MASK_ISA2_RAOINT },
265 : { "-mamx-complex", OPTION_MASK_ISA2_AMX_COMPLEX },
266 : { "-mavxvnniint16", OPTION_MASK_ISA2_AVXVNNIINT16 },
267 : { "-msm3", OPTION_MASK_ISA2_SM3 },
268 : { "-msha512", OPTION_MASK_ISA2_SHA512 },
269 : { "-msm4", OPTION_MASK_ISA2_SM4 },
270 : { "-musermsr", OPTION_MASK_ISA2_USER_MSR },
271 : { "-mavx10.1", OPTION_MASK_ISA2_AVX10_1 },
272 : { "-mavx10.2", OPTION_MASK_ISA2_AVX10_2 },
273 : { "-mamx-avx512", OPTION_MASK_ISA2_AMX_AVX512 },
274 : { "-mamx-fp8", OPTION_MASK_ISA2_AMX_FP8 },
275 : { "-mmovrs", OPTION_MASK_ISA2_MOVRS },
276 : { "-mamx-movrs", OPTION_MASK_ISA2_AMX_MOVRS },
277 : { "-mavx512bmm", OPTION_MASK_ISA2_AVX512BMM },
278 : { "-mavx10v2aux", OPTION_MASK_ISA2_AVX10V2AUX },
279 : { "-macev1", OPTION_MASK_ISA2_ACEV1 }
280 : };
281 : static struct ix86_target_opts isa_opts[] =
282 : {
283 : { "-mavx512vpopcntdq", OPTION_MASK_ISA_AVX512VPOPCNTDQ },
284 : { "-mavx512bitalg", OPTION_MASK_ISA_AVX512BITALG },
285 : { "-mvpclmulqdq", OPTION_MASK_ISA_VPCLMULQDQ },
286 : { "-mgfni", OPTION_MASK_ISA_GFNI },
287 : { "-mavx512vnni", OPTION_MASK_ISA_AVX512VNNI },
288 : { "-mavx512vbmi2", OPTION_MASK_ISA_AVX512VBMI2 },
289 : { "-mavx512vbmi", OPTION_MASK_ISA_AVX512VBMI },
290 : { "-mavx512ifma", OPTION_MASK_ISA_AVX512IFMA },
291 : { "-mavx512vl", OPTION_MASK_ISA_AVX512VL },
292 : { "-mavx512bw", OPTION_MASK_ISA_AVX512BW },
293 : { "-mavx512dq", OPTION_MASK_ISA_AVX512DQ },
294 : { "-mavx512cd", OPTION_MASK_ISA_AVX512CD },
295 : { "-mavx512f", OPTION_MASK_ISA_AVX512F },
296 : { "-mavx2", OPTION_MASK_ISA_AVX2 },
297 : { "-mfma", OPTION_MASK_ISA_FMA },
298 : { "-mxop", OPTION_MASK_ISA_XOP },
299 : { "-mfma4", OPTION_MASK_ISA_FMA4 },
300 : { "-mf16c", OPTION_MASK_ISA_F16C },
301 : { "-mavx", OPTION_MASK_ISA_AVX },
302 : /*{ "-msse4" OPTION_MASK_ISA_SSE4 }, */
303 : { "-msse4.2", OPTION_MASK_ISA_SSE4_2 },
304 : { "-msse4.1", OPTION_MASK_ISA_SSE4_1 },
305 : { "-msse4a", OPTION_MASK_ISA_SSE4A },
306 : { "-mssse3", OPTION_MASK_ISA_SSSE3 },
307 : { "-msse3", OPTION_MASK_ISA_SSE3 },
308 : { "-maes", OPTION_MASK_ISA_AES },
309 : { "-msha", OPTION_MASK_ISA_SHA },
310 : { "-mpclmul", OPTION_MASK_ISA_PCLMUL },
311 : { "-msse2", OPTION_MASK_ISA_SSE2 },
312 : { "-msse", OPTION_MASK_ISA_SSE },
313 : { "-m3dnowa", OPTION_MASK_ISA_3DNOW_A },
314 : { "-m3dnow", OPTION_MASK_ISA_3DNOW },
315 : { "-mmmx", OPTION_MASK_ISA_MMX },
316 : { "-mrtm", OPTION_MASK_ISA_RTM },
317 : { "-mprfchw", OPTION_MASK_ISA_PRFCHW },
318 : { "-mrdseed", OPTION_MASK_ISA_RDSEED },
319 : { "-madx", OPTION_MASK_ISA_ADX },
320 : { "-mclflushopt", OPTION_MASK_ISA_CLFLUSHOPT },
321 : { "-mxsaves", OPTION_MASK_ISA_XSAVES },
322 : { "-mxsavec", OPTION_MASK_ISA_XSAVEC },
323 : { "-mxsaveopt", OPTION_MASK_ISA_XSAVEOPT },
324 : { "-mxsave", OPTION_MASK_ISA_XSAVE },
325 : { "-mabm", OPTION_MASK_ISA_ABM },
326 : { "-mbmi", OPTION_MASK_ISA_BMI },
327 : { "-mbmi2", OPTION_MASK_ISA_BMI2 },
328 : { "-mlzcnt", OPTION_MASK_ISA_LZCNT },
329 : { "-mtbm", OPTION_MASK_ISA_TBM },
330 : { "-mpopcnt", OPTION_MASK_ISA_POPCNT },
331 : { "-msahf", OPTION_MASK_ISA_SAHF },
332 : { "-mcrc32", OPTION_MASK_ISA_CRC32 },
333 : { "-mfsgsbase", OPTION_MASK_ISA_FSGSBASE },
334 : { "-mrdrnd", OPTION_MASK_ISA_RDRND },
335 : { "-mpku", OPTION_MASK_ISA_PKU },
336 : { "-mlwp", OPTION_MASK_ISA_LWP },
337 : { "-mfxsr", OPTION_MASK_ISA_FXSR },
338 : { "-mclwb", OPTION_MASK_ISA_CLWB },
339 : { "-mshstk", OPTION_MASK_ISA_SHSTK },
340 : { "-mmovdiri", OPTION_MASK_ISA_MOVDIRI }
341 : };
342 :
343 : /* Return 1 if TRAIT NAME is present in the OpenMP context's
344 : device trait set, return 0 if not present in any OpenMP context in the
345 : whole translation unit, or -1 if not present in the current OpenMP context
346 : but might be present in another OpenMP context in the same TU. */
347 :
348 : int
349 1954 : ix86_omp_device_kind_arch_isa (enum omp_device_kind_arch_isa trait,
350 : const char *name)
351 : {
352 1954 : switch (trait)
353 : {
354 363 : case omp_device_kind:
355 363 : return strcmp (name, "cpu") == 0;
356 774 : case omp_device_arch:
357 774 : if (strcmp (name, "x86") == 0)
358 : return 1;
359 770 : if (TARGET_64BIT)
360 : {
361 770 : if (TARGET_X32)
362 0 : return strcmp (name, "x32") == 0;
363 : else
364 770 : return strcmp (name, "x86_64") == 0;
365 : }
366 0 : if (strcmp (name, "ia32") == 0 || strcmp (name, "i386") == 0)
367 : return 1;
368 0 : if (strcmp (name, "i486") == 0)
369 0 : return ix86_arch != PROCESSOR_I386 ? 1 : -1;
370 0 : if (strcmp (name, "i586") == 0)
371 0 : return (ix86_arch != PROCESSOR_I386
372 0 : && ix86_arch != PROCESSOR_I486) ? 1 : -1;
373 0 : if (strcmp (name, "i686") == 0)
374 0 : return (ix86_arch != PROCESSOR_I386
375 0 : && ix86_arch != PROCESSOR_I486
376 0 : && ix86_arch != PROCESSOR_LAKEMONT
377 0 : && ix86_arch != PROCESSOR_PENTIUM) ? 1 : -1;
378 : return 0;
379 : case omp_device_isa:
380 917 : for (int i = 0; i < 2; i++)
381 : {
382 867 : struct ix86_target_opts *opts = i ? isa2_opts : isa_opts;
383 50 : size_t nopts = i ? ARRAY_SIZE (isa2_opts) : ARRAY_SIZE (isa_opts);
384 867 : HOST_WIDE_INT mask = i ? ix86_isa_flags2 : ix86_isa_flags;
385 16331 : for (size_t n = 0; n < nopts; n++)
386 : {
387 : /* Handle sse4 as an alias to sse4.2. */
388 16231 : if (opts[n].mask == OPTION_MASK_ISA_SSE4_2)
389 : {
390 229 : if (strcmp (name, "sse4") == 0)
391 29 : return (mask & opts[n].mask) != 0 ? 1 : -1;
392 : }
393 16202 : if (strcmp (name, opts[n].option + 2) == 0)
394 738 : return (mask & opts[n].mask) != 0 ? 1 : -1;
395 : }
396 : }
397 : return 0;
398 0 : default:
399 0 : gcc_unreachable ();
400 : }
401 : }
402 :
403 : /* Return a string that documents the current -m options. The caller is
404 : responsible for freeing the string. */
405 :
406 : char *
407 23 : ix86_target_string (HOST_WIDE_INT isa, HOST_WIDE_INT isa2,
408 : int flags, int flags2,
409 : const char *arch, const char *tune,
410 : enum fpmath_unit fpmath,
411 : enum prefer_vector_width pvw,
412 : enum prefer_vector_width move_max,
413 : bool add_nl_p, bool add_abi_p)
414 : {
415 : /* Flag options. */
416 23 : static struct ix86_target_opts flag_opts[] =
417 : {
418 : { "-m128bit-long-double", MASK_128BIT_LONG_DOUBLE },
419 : { "-mlong-double-128", MASK_LONG_DOUBLE_128 },
420 : { "-mlong-double-64", MASK_LONG_DOUBLE_64 },
421 : { "-m80387", MASK_80387 },
422 : { "-maccumulate-outgoing-args", MASK_ACCUMULATE_OUTGOING_ARGS },
423 : { "-malign-double", MASK_ALIGN_DOUBLE },
424 : { "-mcld", MASK_CLD },
425 : { "-mfp-ret-in-387", MASK_FLOAT_RETURNS },
426 : { "-mieee-fp", MASK_IEEE_FP },
427 : { "-minline-all-stringops", MASK_INLINE_ALL_STRINGOPS },
428 : { "-minline-stringops-dynamically", MASK_INLINE_STRINGOPS_DYNAMICALLY },
429 : { "-mms-bitfields", MASK_MS_BITFIELD_LAYOUT },
430 : { "-mno-align-stringops", MASK_NO_ALIGN_STRINGOPS },
431 : { "-mno-fancy-math-387", MASK_NO_FANCY_MATH_387 },
432 : { "-mno-push-args", MASK_NO_PUSH_ARGS },
433 : { "-mno-red-zone", MASK_NO_RED_ZONE },
434 : { "-momit-leaf-frame-pointer", MASK_OMIT_LEAF_FRAME_POINTER },
435 : { "-mrecip", MASK_RECIP },
436 : { "-mrtd", MASK_RTD },
437 : { "-msseregparm", MASK_SSEREGPARM },
438 : { "-mstack-arg-probe", MASK_STACK_PROBE },
439 : { "-mtls-direct-seg-refs", MASK_TLS_DIRECT_SEG_REFS },
440 : { "-mvect8-ret-in-mem", MASK_VECT8_RETURNS },
441 : { "-m8bit-idiv", MASK_USE_8BIT_IDIV },
442 : { "-mvzeroupper", MASK_VZEROUPPER },
443 : { "-mstv", MASK_STV },
444 : { "-mavx256-split-unaligned-load", MASK_AVX256_SPLIT_UNALIGNED_LOAD },
445 : { "-mavx256-split-unaligned-store", MASK_AVX256_SPLIT_UNALIGNED_STORE },
446 : { "-mcall-ms2sysv-xlogues", MASK_CALL_MS2SYSV_XLOGUES },
447 : { "-mrelax-cmpxchg-loop", MASK_RELAX_CMPXCHG_LOOP }
448 : };
449 :
450 : /* Additional flag options. */
451 23 : static struct ix86_target_opts flag2_opts[] =
452 : {
453 : { "-mgeneral-regs-only", OPTION_MASK_GENERAL_REGS_ONLY }
454 : };
455 :
456 23 : const char *opts[ARRAY_SIZE (isa_opts) + ARRAY_SIZE (isa2_opts)
457 : + ARRAY_SIZE (flag_opts) + ARRAY_SIZE (flag2_opts) + 6][2];
458 :
459 23 : char isa_other[40];
460 23 : char isa2_other[40];
461 23 : char flags_other[40];
462 23 : char flags2_other[40];
463 23 : unsigned num = 0;
464 23 : unsigned i, j;
465 23 : char *ret;
466 23 : char *ptr;
467 23 : size_t len;
468 23 : size_t line_len;
469 23 : size_t sep_len;
470 23 : const char *abi;
471 :
472 23 : memset (opts, '\0', sizeof (opts));
473 :
474 : /* Add -march= option. */
475 23 : if (arch)
476 : {
477 0 : opts[num][0] = "-march=";
478 0 : opts[num++][1] = arch;
479 : }
480 :
481 : /* Add -mtune= option. */
482 23 : if (tune)
483 : {
484 0 : opts[num][0] = "-mtune=";
485 0 : opts[num++][1] = tune;
486 : }
487 :
488 : /* Add -m32/-m64/-mx32. */
489 23 : if (add_abi_p)
490 : {
491 2 : if ((isa & OPTION_MASK_ISA_64BIT) != 0)
492 : {
493 2 : if ((isa & OPTION_MASK_ABI_64) != 0)
494 : abi = "-m64";
495 : else
496 0 : abi = "-mx32";
497 : }
498 : else
499 : abi = "-m32";
500 2 : opts[num++][0] = abi;
501 : }
502 23 : isa &= ~(OPTION_MASK_ISA_64BIT | OPTION_MASK_ABI_64 | OPTION_MASK_ABI_X32);
503 :
504 : /* Pick out the options in isa2 options. */
505 1196 : for (i = 0; i < ARRAY_SIZE (isa2_opts); i++)
506 : {
507 1173 : if ((isa2 & isa2_opts[i].mask) != 0)
508 : {
509 5 : opts[num++][0] = isa2_opts[i].option;
510 5 : isa2 &= ~ isa2_opts[i].mask;
511 : }
512 : }
513 :
514 23 : if (isa2 && add_nl_p)
515 : {
516 0 : opts[num++][0] = isa2_other;
517 0 : sprintf (isa2_other, "(other isa2: %#" HOST_WIDE_INT_PRINT "x)", isa2);
518 : }
519 :
520 : /* Pick out the options in isa options. */
521 1334 : for (i = 0; i < ARRAY_SIZE (isa_opts); i++)
522 : {
523 1311 : if ((isa & isa_opts[i].mask) != 0)
524 : {
525 36 : opts[num++][0] = isa_opts[i].option;
526 36 : isa &= ~ isa_opts[i].mask;
527 : }
528 : }
529 :
530 23 : if (isa && add_nl_p)
531 : {
532 0 : opts[num++][0] = isa_other;
533 0 : sprintf (isa_other, "(other isa: %#" HOST_WIDE_INT_PRINT "x)", isa);
534 : }
535 :
536 : /* Add flag options. */
537 713 : for (i = 0; i < ARRAY_SIZE (flag_opts); i++)
538 : {
539 690 : if ((flags & flag_opts[i].mask) != 0)
540 : {
541 0 : opts[num++][0] = flag_opts[i].option;
542 0 : flags &= ~ flag_opts[i].mask;
543 : }
544 : }
545 :
546 23 : if (flags && add_nl_p)
547 : {
548 0 : opts[num++][0] = flags_other;
549 0 : sprintf (flags_other, "(other flags: %#x)", flags);
550 : }
551 :
552 : /* Add additional flag options. */
553 46 : for (i = 0; i < ARRAY_SIZE (flag2_opts); i++)
554 : {
555 23 : if ((flags2 & flag2_opts[i].mask) != 0)
556 : {
557 0 : opts[num++][0] = flag2_opts[i].option;
558 0 : flags2 &= ~ flag2_opts[i].mask;
559 : }
560 : }
561 :
562 23 : if (flags2 && add_nl_p)
563 : {
564 0 : opts[num++][0] = flags2_other;
565 0 : sprintf (flags2_other, "(other flags2: %#x)", flags2);
566 : }
567 :
568 : /* Add -mfpmath= option. */
569 23 : if (fpmath)
570 : {
571 0 : opts[num][0] = "-mfpmath=";
572 0 : switch ((int) fpmath)
573 : {
574 0 : case FPMATH_387:
575 0 : opts[num++][1] = "387";
576 0 : break;
577 :
578 0 : case FPMATH_SSE:
579 0 : opts[num++][1] = "sse";
580 0 : break;
581 :
582 0 : case FPMATH_387 | FPMATH_SSE:
583 0 : opts[num++][1] = "sse+387";
584 0 : break;
585 :
586 0 : default:
587 0 : gcc_unreachable ();
588 : }
589 : }
590 :
591 23 : auto add_vector_width = [&opts, &num] (prefer_vector_width pvw,
592 : const char *cmd)
593 : {
594 0 : opts[num][0] = cmd;
595 0 : switch ((int) pvw)
596 : {
597 0 : case PVW_AVX128:
598 0 : opts[num++][1] = "128";
599 0 : break;
600 :
601 0 : case PVW_AVX256:
602 0 : opts[num++][1] = "256";
603 0 : break;
604 :
605 0 : case PVW_AVX512:
606 0 : opts[num++][1] = "512";
607 0 : break;
608 :
609 0 : default:
610 0 : gcc_unreachable ();
611 : }
612 23 : };
613 :
614 : /* Add -mprefer-vector-width= option. */
615 23 : if (pvw)
616 0 : add_vector_width (pvw, "-mprefer-vector-width=");
617 :
618 : /* Add -mmove-max= option. */
619 23 : if (move_max)
620 0 : add_vector_width (move_max, "-mmove-max=");
621 :
622 : /* Any options? */
623 23 : if (num == 0)
624 : return NULL;
625 :
626 23 : gcc_assert (num < ARRAY_SIZE (opts));
627 :
628 : /* Size the string. */
629 23 : len = 0;
630 23 : sep_len = (add_nl_p) ? 3 : 1;
631 66 : for (i = 0; i < num; i++)
632 : {
633 43 : len += sep_len;
634 129 : for (j = 0; j < 2; j++)
635 86 : if (opts[i][j])
636 43 : len += strlen (opts[i][j]);
637 : }
638 :
639 : /* Build the string. */
640 23 : ret = ptr = (char *) xmalloc (len);
641 23 : line_len = 0;
642 :
643 89 : for (i = 0; i < num; i++)
644 : {
645 : size_t len2[2];
646 :
647 129 : for (j = 0; j < 2; j++)
648 86 : len2[j] = (opts[i][j]) ? strlen (opts[i][j]) : 0;
649 :
650 43 : if (i != 0)
651 : {
652 20 : *ptr++ = ' ';
653 20 : line_len++;
654 :
655 20 : if (add_nl_p && line_len + len2[0] + len2[1] > 70)
656 : {
657 0 : *ptr++ = '\\';
658 0 : *ptr++ = '\n';
659 0 : line_len = 0;
660 : }
661 : }
662 :
663 129 : for (j = 0; j < 2; j++)
664 86 : if (opts[i][j])
665 : {
666 43 : memcpy (ptr, opts[i][j], len2[j]);
667 43 : ptr += len2[j];
668 43 : line_len += len2[j];
669 : }
670 : }
671 :
672 23 : *ptr = '\0';
673 23 : gcc_assert (ret + len >= ptr);
674 :
675 : return ret;
676 : }
677 :
678 : /* Function that is callable from the debugger to print the current
679 : options. */
680 : void ATTRIBUTE_UNUSED
681 0 : ix86_debug_options (void)
682 : {
683 0 : char *opts = ix86_target_string (ix86_isa_flags, ix86_isa_flags2,
684 : target_flags, ix86_target_flags,
685 : ix86_arch_string, ix86_tune_string,
686 : ix86_fpmath, prefer_vector_width_type,
687 : ix86_move_max, true, true);
688 :
689 0 : if (opts)
690 : {
691 0 : fprintf (stderr, "%s\n\n", opts);
692 0 : free (opts);
693 : }
694 : else
695 0 : fputs ("<no options>\n\n", stderr);
696 :
697 0 : return;
698 : }
699 :
700 : /* Save the current options */
701 :
702 : void
703 79044407 : ix86_function_specific_save (struct cl_target_option *ptr,
704 : struct gcc_options *opts,
705 : struct gcc_options */* opts_set */)
706 : {
707 79044407 : ptr->arch = ix86_arch;
708 79044407 : ptr->schedule = ix86_schedule;
709 79044407 : ptr->prefetch_sse = ix86_prefetch_sse;
710 79044407 : ptr->tune = ix86_tune;
711 79044407 : ptr->branch_cost = ix86_branch_cost;
712 79044407 : ptr->tune_defaulted = ix86_tune_defaulted;
713 79044407 : ptr->arch_specified = ix86_arch_specified;
714 79044407 : ptr->x_ix86_apx_features = opts->x_ix86_apx_features;
715 79044407 : ptr->x_ix86_isa_flags_explicit = opts->x_ix86_isa_flags_explicit;
716 79044407 : ptr->x_ix86_isa_flags2_explicit = opts->x_ix86_isa_flags2_explicit;
717 79044407 : ptr->x_recip_mask_explicit = opts->x_recip_mask_explicit;
718 79044407 : ptr->x_ix86_arch_string = opts->x_ix86_arch_string;
719 79044407 : ptr->x_ix86_tune_string = opts->x_ix86_tune_string;
720 79044407 : ptr->x_ix86_asm_dialect = opts->x_ix86_asm_dialect;
721 79044407 : ptr->x_ix86_branch_cost = opts->x_ix86_branch_cost;
722 79044407 : ptr->x_ix86_dump_tunes = opts->x_ix86_dump_tunes;
723 79044407 : ptr->x_ix86_force_align_arg_pointer = opts->x_ix86_force_align_arg_pointer;
724 79044407 : ptr->x_ix86_force_drap = opts->x_ix86_force_drap;
725 79044407 : ptr->x_ix86_recip_name = opts->x_ix86_recip_name;
726 79044407 : ptr->x_ix86_section_threshold = opts->x_ix86_section_threshold;
727 79044407 : ptr->x_ix86_sse2avx = opts->x_ix86_sse2avx;
728 79044407 : ptr->x_ix86_stack_protector_guard = opts->x_ix86_stack_protector_guard;
729 79044407 : ptr->x_ix86_stringop_alg = opts->x_ix86_stringop_alg;
730 79044407 : ptr->x_ix86_tls_dialect = opts->x_ix86_tls_dialect;
731 79044407 : ptr->x_ix86_tune_ctrl_string = opts->x_ix86_tune_ctrl_string;
732 79044407 : ptr->x_ix86_tune_memcpy_strategy = opts->x_ix86_tune_memcpy_strategy;
733 79044407 : ptr->x_ix86_tune_memset_strategy = opts->x_ix86_tune_memset_strategy;
734 79044407 : ptr->x_ix86_tune_no_default = opts->x_ix86_tune_no_default;
735 :
736 : /* The fields are char but the variables are not; make sure the
737 : values fit in the fields. */
738 79044407 : gcc_assert (ptr->arch == ix86_arch);
739 79044407 : gcc_assert (ptr->schedule == ix86_schedule);
740 79044407 : gcc_assert (ptr->tune == ix86_tune);
741 79044407 : gcc_assert (ptr->branch_cost == ix86_branch_cost);
742 79044407 : }
743 :
744 : /* Feature tests against the various architecture variations, used to create
745 : ix86_arch_features based on the processor mask. */
746 : static unsigned HOST_WIDE_INT initial_ix86_arch_features[X86_ARCH_LAST] = {
747 : /* X86_ARCH_CMOV: Conditional move was added for pentiumpro. */
748 : ~(m_386 | m_486 | m_PENT | m_LAKEMONT | m_K6),
749 :
750 : /* X86_ARCH_CMPXCHG: Compare and exchange was added for 80486. */
751 : ~m_386,
752 :
753 : /* X86_ARCH_CMPXCHG8B: Compare and exchange 8 bytes was added for pentium. */
754 : ~(m_386 | m_486),
755 :
756 : /* X86_ARCH_XADD: Exchange and add was added for 80486. */
757 : ~m_386,
758 :
759 : /* X86_ARCH_BSWAP: Byteswap was added for 80486. */
760 : ~m_386,
761 : };
762 :
763 : /* This table must be in sync with enum processor_type in i386.h. */
764 : static const struct processor_costs *processor_cost_table[] =
765 : {
766 : &generic_cost, /* PROCESSOR_GENERIC. */
767 : &i386_cost, /* PROCESSOR_I386. */
768 : &i486_cost, /* PROCESSOR_I486. */
769 : &pentium_cost, /* PROCESSOR_PENTIUM. */
770 : &lakemont_cost, /* PROCESSOR_LAKEMONT. */
771 : &pentiumpro_cost, /* PROCESSOR_PENTIUMPRO. */
772 : &pentium4_cost, /* PROCESSOR_PENTIUM4. */
773 : &nocona_cost, /* PROCESSOR_NOCONA. */
774 : &core_cost, /* PROCESSOR_CORE2. */
775 : &core_cost, /* PROCESSOR_NEHALEM. */
776 : &core_cost, /* PROCESSOR_SANDYBRIDGE. */
777 : &core_cost, /* PROCESSOR_HASWELL. */
778 : &atom_cost, /* PROCESSOR_BONNELL. */
779 : &slm_cost, /* PROCESSOR_SILVERMONT. */
780 : &slm_cost, /* PROCESSOR_GOLDMONT. */
781 : &slm_cost, /* PROCESSOR_GOLDMONT_PLUS. */
782 : &tremont_cost, /* PROCESSOR_TREMONT. */
783 : &alderlake_cost, /* PROCESSOR_SIERRAFOREST. */
784 : &alderlake_cost, /* PROCESSOR_GRANDRIDGE. */
785 : &alderlake_cost, /* PROCESSOR_CLEARWATERFOREST. */
786 : &skylake_cost, /* PROCESSOR_SKYLAKE. */
787 : &skylake_cost, /* PROCESSOR_SKYLAKE_AVX512. */
788 : &icelake_cost, /* PROCESSOR_CANNONLAKE. */
789 : &icelake_cost, /* PROCESSOR_ICELAKE_CLIENT. */
790 : &icelake_cost, /* PROCESSOR_ICELAKE_SERVER. */
791 : &skylake_cost, /* PROCESSOR_CASCADELAKE. */
792 : &icelake_cost, /* PROCESSOR_TIGERLAKE. */
793 : &skylake_cost, /* PROCESSOR_COOPERLAKE. */
794 : &icelake_cost, /* PROCESSOR_SAPPHIRERAPIDS. */
795 : &alderlake_cost, /* PROCESSOR_ALDERLAKE. */
796 : &icelake_cost, /* PROCESSOR_ROCKETLAKE. */
797 : &icelake_cost, /* PROCESSOR_GRANITERAPIDS. */
798 : &icelake_cost, /* PROCESSOR_GRANITERAPIDS_D. */
799 : &alderlake_cost, /* PROCESSOR_ARROWLAKE. */
800 : &alderlake_cost, /* PROCESSOR_ARROWLAKE_S. */
801 : &alderlake_cost, /* PROCESSOR_PANTHERLAKE. */
802 : &icelake_cost, /* PROCESSOR_DIAMONDRAPIDS. */
803 : &alderlake_cost, /* PROCESSOR_NOVALAKE. */
804 : &alderlake_cost, /* PROCESSOR_INTEL. */
805 : &lujiazui_cost, /* PROCESSOR_LUJIAZUI. */
806 : &yongfeng_cost, /* PROCESSOR_YONGFENG. */
807 : &shijidadao_cost, /* PROCESSOR_SHIJIDADAO. */
808 : &geode_cost, /* PROCESSOR_GEODE. */
809 : &k6_cost, /* PROCESSOR_K6. */
810 : &athlon_cost, /* PROCESSOR_ATHLON. */
811 : &k8_cost, /* PROCESSOR_K8. */
812 : &amdfam10_cost, /* PROCESSOR_AMDFAM10. */
813 : &bdver_cost, /* PROCESSOR_BDVER1. */
814 : &bdver_cost, /* PROCESSOR_BDVER2. */
815 : &bdver_cost, /* PROCESSOR_BDVER3. */
816 : &bdver_cost, /* PROCESSOR_BDVER4. */
817 : &btver1_cost, /* PROCESSOR_BTVER1. */
818 : &btver2_cost, /* PROCESSOR_BTVER2. */
819 : &znver1_cost, /* PROCESSOR_ZNVER1. */
820 : &znver2_cost, /* PROCESSOR_ZNVER2. */
821 : &znver3_cost, /* PROCESSOR_ZNVER3. */
822 : &znver4_cost, /* PROCESSOR_ZNVER4. */
823 : &znver5_cost, /* PROCESSOR_ZNVER5. */
824 : &znver5_cost, /* PROCESSOR_ZNVER6. */
825 : &c86_4g_m4_cost, /* PROCESSOR_C86_4G_M4. */
826 : &c86_4g_m6_cost, /* PROCESSOR_C86_4G_M6. */
827 : &c86_4g_m7_cost, /* PROCESSOR_C86_4G_M7. */
828 : &c86_4g_m8_cost /* PROCESSOR_C86_4G_M8. */
829 : };
830 :
831 : /* Guarantee that the array is aligned with enum processor_type. */
832 : STATIC_ASSERT (ARRAY_SIZE (processor_cost_table) == PROCESSOR_max);
833 :
834 : static bool
835 : ix86_option_override_internal (bool main_args_p,
836 : struct gcc_options *opts,
837 : struct gcc_options *opts_set);
838 : static void
839 : set_ix86_tune_features (struct gcc_options *opts,
840 : enum processor_type ix86_tune, bool dump);
841 :
842 : /* Restore the current options */
843 :
844 : void
845 55055642 : ix86_function_specific_restore (struct gcc_options *opts,
846 : struct gcc_options */* opts_set */,
847 : struct cl_target_option *ptr)
848 : {
849 55055642 : enum processor_type old_tune = ix86_tune;
850 55055642 : enum processor_type old_arch = ix86_arch;
851 55055642 : unsigned HOST_WIDE_INT ix86_arch_mask;
852 55055642 : int i;
853 :
854 : /* We don't change -fPIC. */
855 55055642 : opts->x_flag_pic = flag_pic;
856 :
857 55055642 : ix86_arch = (enum processor_type) ptr->arch;
858 55055642 : ix86_schedule = (enum attr_cpu) ptr->schedule;
859 55055642 : ix86_tune = (enum processor_type) ptr->tune;
860 55055642 : ix86_prefetch_sse = ptr->prefetch_sse;
861 55055642 : ix86_tune_defaulted = ptr->tune_defaulted;
862 55055642 : ix86_arch_specified = ptr->arch_specified;
863 55055642 : opts->x_ix86_apx_features = ptr->x_ix86_apx_features;
864 55055642 : opts->x_ix86_isa_flags_explicit = ptr->x_ix86_isa_flags_explicit;
865 55055642 : opts->x_ix86_isa_flags2_explicit = ptr->x_ix86_isa_flags2_explicit;
866 55055642 : opts->x_recip_mask_explicit = ptr->x_recip_mask_explicit;
867 55055642 : opts->x_ix86_arch_string = ptr->x_ix86_arch_string;
868 55055642 : opts->x_ix86_tune_string = ptr->x_ix86_tune_string;
869 55055642 : opts->x_ix86_asm_dialect = ptr->x_ix86_asm_dialect;
870 55055642 : opts->x_ix86_branch_cost = ptr->x_ix86_branch_cost;
871 55055642 : opts->x_ix86_dump_tunes = ptr->x_ix86_dump_tunes;
872 55055642 : opts->x_ix86_force_align_arg_pointer = ptr->x_ix86_force_align_arg_pointer;
873 55055642 : opts->x_ix86_force_drap = ptr->x_ix86_force_drap;
874 55055642 : opts->x_ix86_recip_name = ptr->x_ix86_recip_name;
875 55055642 : opts->x_ix86_section_threshold = ptr->x_ix86_section_threshold;
876 55055642 : opts->x_ix86_sse2avx = ptr->x_ix86_sse2avx;
877 55055642 : opts->x_ix86_stack_protector_guard = ptr->x_ix86_stack_protector_guard;
878 55055642 : opts->x_ix86_stringop_alg = ptr->x_ix86_stringop_alg;
879 55055642 : opts->x_ix86_tls_dialect = ptr->x_ix86_tls_dialect;
880 55055642 : opts->x_ix86_tune_ctrl_string = ptr->x_ix86_tune_ctrl_string;
881 55055642 : opts->x_ix86_tune_memcpy_strategy = ptr->x_ix86_tune_memcpy_strategy;
882 55055642 : opts->x_ix86_tune_memset_strategy = ptr->x_ix86_tune_memset_strategy;
883 55055642 : opts->x_ix86_tune_no_default = ptr->x_ix86_tune_no_default;
884 55055642 : ix86_tune_cost = processor_cost_table[ix86_tune];
885 : /* TODO: ix86_cost should be chosen at instruction or function granularity
886 : so for cold code we use size_cost even in !optimize_size compilation. */
887 55055642 : if (opts->x_optimize_size)
888 : ix86_cost = &ix86_size_cost;
889 : else
890 54327468 : ix86_cost = ix86_tune_cost;
891 :
892 : /* Recreate the arch feature tests if the arch changed */
893 55055642 : if (old_arch != ix86_arch)
894 : {
895 34923 : ix86_arch_mask = HOST_WIDE_INT_1U << ix86_arch;
896 209538 : for (i = 0; i < X86_ARCH_LAST; ++i)
897 174615 : ix86_arch_features[i]
898 174615 : = !!(initial_ix86_arch_features[i] & ix86_arch_mask);
899 : }
900 :
901 : /* Recreate the tune optimization tests */
902 55055642 : if (old_tune != ix86_tune)
903 35170 : set_ix86_tune_features (opts, ix86_tune, false);
904 55055642 : }
905 :
906 : /* Adjust target options after streaming them in. This is mainly about
907 : reconciling them with global options. */
908 :
909 : void
910 21852 : ix86_function_specific_post_stream_in (struct cl_target_option *ptr)
911 : {
912 : /* flag_pic is a global option, but ix86_cmodel is target saved option
913 : partly computed from flag_pic. If flag_pic is on, adjust x_ix86_cmodel
914 : for PIC, or error out. */
915 21852 : if (flag_pic)
916 346 : switch (ptr->x_ix86_cmodel)
917 : {
918 90 : case CM_SMALL:
919 90 : ptr->x_ix86_cmodel = CM_SMALL_PIC;
920 90 : break;
921 :
922 0 : case CM_MEDIUM:
923 0 : ptr->x_ix86_cmodel = CM_MEDIUM_PIC;
924 0 : break;
925 :
926 0 : case CM_LARGE:
927 0 : ptr->x_ix86_cmodel = CM_LARGE_PIC;
928 0 : break;
929 :
930 0 : case CM_KERNEL:
931 0 : error ("code model %s does not support PIC mode", "kernel");
932 0 : break;
933 :
934 : default:
935 : break;
936 : }
937 : else
938 21506 : switch (ptr->x_ix86_cmodel)
939 : {
940 99 : case CM_SMALL_PIC:
941 99 : ptr->x_ix86_cmodel = CM_SMALL;
942 99 : break;
943 :
944 0 : case CM_MEDIUM_PIC:
945 0 : ptr->x_ix86_cmodel = CM_MEDIUM;
946 0 : break;
947 :
948 0 : case CM_LARGE_PIC:
949 0 : ptr->x_ix86_cmodel = CM_LARGE;
950 0 : break;
951 :
952 : default:
953 : break;
954 : }
955 21852 : }
956 :
957 : /* Print the current options */
958 :
959 : void
960 0 : ix86_function_specific_print (FILE *file, int indent,
961 : struct cl_target_option *ptr)
962 : {
963 0 : char *target_string
964 0 : = ix86_target_string (ptr->x_ix86_isa_flags, ptr->x_ix86_isa_flags2,
965 : ptr->x_target_flags, ptr->x_ix86_target_flags,
966 : NULL, NULL, ptr->x_ix86_fpmath,
967 : ptr->x_prefer_vector_width_type,
968 : ptr->x_ix86_move_max, false, true);
969 :
970 0 : gcc_assert (ptr->arch < PROCESSOR_max);
971 0 : fprintf (file, "%*sarch = %d (%s)\n",
972 : indent, "",
973 0 : ptr->arch, processor_names[ptr->arch]);
974 :
975 0 : gcc_assert (ptr->tune < PROCESSOR_max);
976 0 : fprintf (file, "%*stune = %d (%s)\n",
977 : indent, "",
978 0 : ptr->tune, processor_names[ptr->tune]);
979 :
980 0 : fprintf (file, "%*sbranch_cost = %d\n", indent, "", ptr->branch_cost);
981 :
982 0 : if (target_string)
983 : {
984 0 : fprintf (file, "%*s%s\n", indent, "", target_string);
985 0 : free (target_string);
986 : }
987 0 : }
988 :
989 :
990 : /* Inner function to process the attribute((target(...))), take an argument and
991 : set the current options from the argument. If we have a list, recursively go
992 : over the list. */
993 :
994 : static bool
995 102607048 : ix86_valid_target_attribute_inner_p (tree fndecl, tree args, char *p_strings[],
996 : struct gcc_options *opts,
997 : struct gcc_options *opts_set,
998 : struct gcc_options *enum_opts_set,
999 : bool target_clone_attr)
1000 : {
1001 102607048 : char *next_optstr;
1002 102607048 : bool ret = true;
1003 :
1004 : #define IX86_ATTR_ISA(S,O) { S, sizeof (S)-1, ix86_opt_isa, O, 0 }
1005 : #define IX86_ATTR_STR(S,O) { S, sizeof (S)-1, ix86_opt_str, O, 0 }
1006 : #define IX86_ATTR_ENUM(S,O) { S, sizeof (S)-1, ix86_opt_enum, O, 0 }
1007 : #define IX86_ATTR_YES(S,O,M) { S, sizeof (S)-1, ix86_opt_yes, O, M }
1008 : #define IX86_ATTR_NO(S,O,M) { S, sizeof (S)-1, ix86_opt_no, O, M }
1009 : #define IX86_ATTR_IX86_YES(S,O,M) \
1010 : { S, sizeof (S)-1, ix86_opt_ix86_yes, O, M }
1011 : #define IX86_ATTR_IX86_NO(S,O,M) \
1012 : { S, sizeof (S)-1, ix86_opt_ix86_no, O, M }
1013 :
1014 102607048 : enum ix86_opt_type
1015 : {
1016 : ix86_opt_unknown,
1017 : ix86_opt_yes,
1018 : ix86_opt_no,
1019 : ix86_opt_ix86_yes,
1020 : ix86_opt_ix86_no,
1021 : ix86_opt_str,
1022 : ix86_opt_enum,
1023 : ix86_opt_isa
1024 : };
1025 :
1026 102607048 : static const struct
1027 : {
1028 : const char *string;
1029 : size_t len;
1030 : enum ix86_opt_type type;
1031 : int opt;
1032 : int mask;
1033 : } attrs[] = {
1034 : /* isa options */
1035 : IX86_ATTR_ISA ("pconfig", OPT_mpconfig),
1036 : IX86_ATTR_ISA ("wbnoinvd", OPT_mwbnoinvd),
1037 : IX86_ATTR_ISA ("sgx", OPT_msgx),
1038 : IX86_ATTR_ISA ("avx512vpopcntdq", OPT_mavx512vpopcntdq),
1039 : IX86_ATTR_ISA ("avx512vbmi2", OPT_mavx512vbmi2),
1040 : IX86_ATTR_ISA ("avx512vnni", OPT_mavx512vnni),
1041 : IX86_ATTR_ISA ("avx512bitalg", OPT_mavx512bitalg),
1042 : IX86_ATTR_ISA ("avx512vp2intersect", OPT_mavx512vp2intersect),
1043 :
1044 : IX86_ATTR_ISA ("avx512vbmi", OPT_mavx512vbmi),
1045 : IX86_ATTR_ISA ("avx512ifma", OPT_mavx512ifma),
1046 : IX86_ATTR_ISA ("avx512vl", OPT_mavx512vl),
1047 : IX86_ATTR_ISA ("avx512bw", OPT_mavx512bw),
1048 : IX86_ATTR_ISA ("avx512dq", OPT_mavx512dq),
1049 : IX86_ATTR_ISA ("avx512cd", OPT_mavx512cd),
1050 : IX86_ATTR_ISA ("avx512f", OPT_mavx512f),
1051 : IX86_ATTR_ISA ("avx2", OPT_mavx2),
1052 : IX86_ATTR_ISA ("fma", OPT_mfma),
1053 : IX86_ATTR_ISA ("xop", OPT_mxop),
1054 : IX86_ATTR_ISA ("fma4", OPT_mfma4),
1055 : IX86_ATTR_ISA ("f16c", OPT_mf16c),
1056 : IX86_ATTR_ISA ("avx", OPT_mavx),
1057 : IX86_ATTR_ISA ("sse4", OPT_msse4),
1058 : IX86_ATTR_ISA ("sse4.2", OPT_msse4_2),
1059 : IX86_ATTR_ISA ("sse4.1", OPT_msse4_1),
1060 : IX86_ATTR_ISA ("sse4a", OPT_msse4a),
1061 : IX86_ATTR_ISA ("ssse3", OPT_mssse3),
1062 : IX86_ATTR_ISA ("sse3", OPT_msse3),
1063 : IX86_ATTR_ISA ("aes", OPT_maes),
1064 : IX86_ATTR_ISA ("sha", OPT_msha),
1065 : IX86_ATTR_ISA ("pclmul", OPT_mpclmul),
1066 : IX86_ATTR_ISA ("sse2", OPT_msse2),
1067 : IX86_ATTR_ISA ("sse", OPT_msse),
1068 : IX86_ATTR_ISA ("3dnowa", OPT_m3dnowa),
1069 : IX86_ATTR_ISA ("3dnow", OPT_m3dnow),
1070 : IX86_ATTR_ISA ("mmx", OPT_mmmx),
1071 : IX86_ATTR_ISA ("rtm", OPT_mrtm),
1072 : IX86_ATTR_ISA ("prfchw", OPT_mprfchw),
1073 : IX86_ATTR_ISA ("rdseed", OPT_mrdseed),
1074 : IX86_ATTR_ISA ("adx", OPT_madx),
1075 : IX86_ATTR_ISA ("clflushopt", OPT_mclflushopt),
1076 : IX86_ATTR_ISA ("xsaves", OPT_mxsaves),
1077 : IX86_ATTR_ISA ("xsavec", OPT_mxsavec),
1078 : IX86_ATTR_ISA ("xsaveopt", OPT_mxsaveopt),
1079 : IX86_ATTR_ISA ("xsave", OPT_mxsave),
1080 : IX86_ATTR_ISA ("abm", OPT_mabm),
1081 : IX86_ATTR_ISA ("bmi", OPT_mbmi),
1082 : IX86_ATTR_ISA ("bmi2", OPT_mbmi2),
1083 : IX86_ATTR_ISA ("lzcnt", OPT_mlzcnt),
1084 : IX86_ATTR_ISA ("tbm", OPT_mtbm),
1085 : IX86_ATTR_ISA ("popcnt", OPT_mpopcnt),
1086 : IX86_ATTR_ISA ("cx16", OPT_mcx16),
1087 : IX86_ATTR_ISA ("sahf", OPT_msahf),
1088 : IX86_ATTR_ISA ("movbe", OPT_mmovbe),
1089 : IX86_ATTR_ISA ("crc32", OPT_mcrc32),
1090 : IX86_ATTR_ISA ("fsgsbase", OPT_mfsgsbase),
1091 : IX86_ATTR_ISA ("rdrnd", OPT_mrdrnd),
1092 : IX86_ATTR_ISA ("mwaitx", OPT_mmwaitx),
1093 : IX86_ATTR_ISA ("mwait", OPT_mmwait),
1094 : IX86_ATTR_ISA ("clzero", OPT_mclzero),
1095 : IX86_ATTR_ISA ("pku", OPT_mpku),
1096 : IX86_ATTR_ISA ("lwp", OPT_mlwp),
1097 : IX86_ATTR_ISA ("hle", OPT_mhle),
1098 : IX86_ATTR_ISA ("fxsr", OPT_mfxsr),
1099 : IX86_ATTR_ISA ("clwb", OPT_mclwb),
1100 : IX86_ATTR_ISA ("rdpid", OPT_mrdpid),
1101 : IX86_ATTR_ISA ("gfni", OPT_mgfni),
1102 : IX86_ATTR_ISA ("shstk", OPT_mshstk),
1103 : IX86_ATTR_ISA ("vaes", OPT_mvaes),
1104 : IX86_ATTR_ISA ("vpclmulqdq", OPT_mvpclmulqdq),
1105 : IX86_ATTR_ISA ("movdiri", OPT_mmovdiri),
1106 : IX86_ATTR_ISA ("movdir64b", OPT_mmovdir64b),
1107 : IX86_ATTR_ISA ("waitpkg", OPT_mwaitpkg),
1108 : IX86_ATTR_ISA ("cldemote", OPT_mcldemote),
1109 : IX86_ATTR_ISA ("uintr", OPT_muintr),
1110 : IX86_ATTR_ISA ("ptwrite", OPT_mptwrite),
1111 : IX86_ATTR_ISA ("kl", OPT_mkl),
1112 : IX86_ATTR_ISA ("widekl", OPT_mwidekl),
1113 : IX86_ATTR_ISA ("avx512bf16", OPT_mavx512bf16),
1114 : IX86_ATTR_ISA ("enqcmd", OPT_menqcmd),
1115 : IX86_ATTR_ISA ("serialize", OPT_mserialize),
1116 : IX86_ATTR_ISA ("tsxldtrk", OPT_mtsxldtrk),
1117 : IX86_ATTR_ISA ("amx-tile", OPT_mamx_tile),
1118 : IX86_ATTR_ISA ("amx-int8", OPT_mamx_int8),
1119 : IX86_ATTR_ISA ("amx-bf16", OPT_mamx_bf16),
1120 : IX86_ATTR_ISA ("hreset", OPT_mhreset),
1121 : IX86_ATTR_ISA ("avxvnni", OPT_mavxvnni),
1122 : IX86_ATTR_ISA ("avx512fp16", OPT_mavx512fp16),
1123 : IX86_ATTR_ISA ("avxifma", OPT_mavxifma),
1124 : IX86_ATTR_ISA ("avxvnniint8", OPT_mavxvnniint8),
1125 : IX86_ATTR_ISA ("avxneconvert", OPT_mavxneconvert),
1126 : IX86_ATTR_ISA ("cmpccxadd", OPT_mcmpccxadd),
1127 : IX86_ATTR_ISA ("amx-fp16", OPT_mamx_fp16),
1128 : IX86_ATTR_ISA ("prefetchi", OPT_mprefetchi),
1129 : IX86_ATTR_ISA ("raoint", OPT_mraoint),
1130 : IX86_ATTR_ISA ("amx-complex", OPT_mamx_complex),
1131 : IX86_ATTR_ISA ("avxvnniint16", OPT_mavxvnniint16),
1132 : IX86_ATTR_ISA ("sm3", OPT_msm3),
1133 : IX86_ATTR_ISA ("sha512", OPT_msha512),
1134 : IX86_ATTR_ISA ("sm4", OPT_msm4),
1135 : IX86_ATTR_ISA ("apxf", OPT_mapxf),
1136 : IX86_ATTR_ISA ("usermsr", OPT_musermsr),
1137 : IX86_ATTR_ISA ("avx10.1", OPT_mavx10_1),
1138 : IX86_ATTR_ISA ("avx10.2", OPT_mavx10_2),
1139 : IX86_ATTR_ISA ("amx-avx512", OPT_mamx_avx512),
1140 : IX86_ATTR_ISA ("amx-fp8", OPT_mamx_fp8),
1141 : IX86_ATTR_ISA ("movrs", OPT_mmovrs),
1142 : IX86_ATTR_ISA ("amx-movrs", OPT_mamx_movrs),
1143 : IX86_ATTR_ISA ("avx512bmm", OPT_mavx512bmm),
1144 : IX86_ATTR_ISA ("avx10v2aux", OPT_mavx10v2aux),
1145 : IX86_ATTR_ISA ("acev1", OPT_macev1),
1146 :
1147 : /* enum options */
1148 : IX86_ATTR_ENUM ("fpmath=", OPT_mfpmath_),
1149 : IX86_ATTR_ENUM ("prefer-vector-width=", OPT_mprefer_vector_width_),
1150 :
1151 : /* string options */
1152 : IX86_ATTR_STR ("arch=", IX86_FUNCTION_SPECIFIC_ARCH),
1153 : IX86_ATTR_STR ("tune=", IX86_FUNCTION_SPECIFIC_TUNE),
1154 :
1155 : /* flag options */
1156 : IX86_ATTR_YES ("cld",
1157 : OPT_mcld,
1158 : MASK_CLD),
1159 :
1160 : IX86_ATTR_NO ("fancy-math-387",
1161 : OPT_mfancy_math_387,
1162 : MASK_NO_FANCY_MATH_387),
1163 :
1164 : IX86_ATTR_YES ("ieee-fp",
1165 : OPT_mieee_fp,
1166 : MASK_IEEE_FP),
1167 :
1168 : IX86_ATTR_YES ("inline-all-stringops",
1169 : OPT_minline_all_stringops,
1170 : MASK_INLINE_ALL_STRINGOPS),
1171 :
1172 : IX86_ATTR_YES ("inline-stringops-dynamically",
1173 : OPT_minline_stringops_dynamically,
1174 : MASK_INLINE_STRINGOPS_DYNAMICALLY),
1175 :
1176 : IX86_ATTR_NO ("align-stringops",
1177 : OPT_mno_align_stringops,
1178 : MASK_NO_ALIGN_STRINGOPS),
1179 :
1180 : IX86_ATTR_YES ("recip",
1181 : OPT_mrecip,
1182 : MASK_RECIP),
1183 :
1184 : IX86_ATTR_YES ("80387",
1185 : OPT_m80387,
1186 : MASK_80387),
1187 :
1188 : IX86_ATTR_IX86_YES ("general-regs-only",
1189 : OPT_mgeneral_regs_only,
1190 : OPTION_MASK_GENERAL_REGS_ONLY),
1191 :
1192 : IX86_ATTR_YES ("relax-cmpxchg-loop",
1193 : OPT_mrelax_cmpxchg_loop,
1194 : MASK_RELAX_CMPXCHG_LOOP),
1195 : };
1196 :
1197 102607048 : location_t loc
1198 102607048 : = fndecl == NULL ? UNKNOWN_LOCATION : DECL_SOURCE_LOCATION (fndecl);
1199 102607048 : const char *attr_name = target_clone_attr ? "target_clone" : "target";
1200 :
1201 : /* If this is a list, recurse to get the options. */
1202 102607048 : if (TREE_CODE (args) == TREE_LIST)
1203 : {
1204 102602049 : for (; args; args = TREE_CHAIN (args))
1205 52101991 : if (TREE_VALUE (args)
1206 52101991 : && !ix86_valid_target_attribute_inner_p (fndecl, TREE_VALUE (args),
1207 : p_strings, opts, opts_set,
1208 : enum_opts_set,
1209 : target_clone_attr))
1210 : ret = false;
1211 :
1212 : return ret;
1213 : }
1214 :
1215 52106990 : else if (TREE_CODE (args) != STRING_CST)
1216 : {
1217 9 : error_at (loc, "attribute %qs argument is not a string", attr_name);
1218 9 : return false;
1219 : }
1220 :
1221 : /* Handle multiple arguments separated by commas. */
1222 52106981 : next_optstr = ASTRDUP (TREE_STRING_POINTER (args));
1223 :
1224 120964051 : while (next_optstr && *next_optstr != '\0')
1225 : {
1226 68857072 : char *p = next_optstr;
1227 68857072 : char *orig_p = p;
1228 68857072 : char *comma = strchr (next_optstr, ',');
1229 68857072 : size_t len, opt_len;
1230 68857072 : int opt;
1231 68857072 : bool opt_set_p;
1232 68857072 : char ch;
1233 68857072 : unsigned i;
1234 68857072 : enum ix86_opt_type type = ix86_opt_unknown;
1235 68857072 : int mask = 0;
1236 :
1237 68857072 : if (comma)
1238 : {
1239 16750102 : *comma = '\0';
1240 16750102 : len = comma - next_optstr;
1241 16750102 : next_optstr = comma + 1;
1242 : }
1243 : else
1244 : {
1245 52106970 : len = strlen (p);
1246 52106970 : next_optstr = NULL;
1247 : }
1248 :
1249 : /* Recognize no-xxx. */
1250 68857072 : if (len > 3 && p[0] == 'n' && p[1] == 'o' && p[2] == '-')
1251 : {
1252 1592 : opt_set_p = false;
1253 1592 : p += 3;
1254 1592 : len -= 3;
1255 : }
1256 : else
1257 : opt_set_p = true;
1258 :
1259 : /* Find the option. */
1260 68857072 : ch = *p;
1261 68857072 : opt = N_OPTS;
1262 2997087354 : for (i = 0; i < ARRAY_SIZE (attrs); i++)
1263 : {
1264 2997087238 : type = attrs[i].type;
1265 2997087238 : opt_len = attrs[i].len;
1266 2997087238 : if (ch == attrs[i].string[0]
1267 942612036 : && ((type != ix86_opt_str && type != ix86_opt_enum)
1268 942612036 : ? len == opt_len
1269 : : len > opt_len)
1270 167524464 : && memcmp (p, attrs[i].string, opt_len) == 0)
1271 : {
1272 68856956 : opt = attrs[i].opt;
1273 68856956 : mask = attrs[i].mask;
1274 68856956 : break;
1275 : }
1276 : }
1277 :
1278 : /* Process the option. */
1279 68857072 : if (opt == N_OPTS)
1280 : {
1281 116 : error_at (loc, "attribute %qs argument %qs is unknown",
1282 : attr_name, orig_p);
1283 116 : ret = false;
1284 : }
1285 :
1286 68856956 : else if (type == ix86_opt_isa)
1287 : {
1288 66852140 : struct cl_decoded_option decoded;
1289 :
1290 66852140 : generate_option (opt, NULL, opt_set_p, CL_TARGET, &decoded);
1291 66852140 : ix86_handle_option (opts, opts_set,
1292 : &decoded, input_location);
1293 : }
1294 :
1295 : else if (type == ix86_opt_yes || type == ix86_opt_no)
1296 : {
1297 53 : opts_set->x_target_flags |= mask;
1298 :
1299 53 : if (type == ix86_opt_no)
1300 12 : opt_set_p = !opt_set_p;
1301 :
1302 53 : if (opt_set_p)
1303 44 : opts->x_target_flags |= mask;
1304 : else
1305 9 : opts->x_target_flags &= ~mask;
1306 : }
1307 :
1308 : else if (type == ix86_opt_ix86_yes || type == ix86_opt_ix86_no)
1309 : {
1310 1983673 : if (mask == OPTION_MASK_GENERAL_REGS_ONLY)
1311 : {
1312 1983673 : if (!opt_set_p)
1313 : {
1314 2 : error_at (loc, "pragma or attribute %<target(\"%s\")%> "
1315 : "does not allow a negated form", p);
1316 2 : return false;
1317 : }
1318 :
1319 1983671 : if (type != ix86_opt_ix86_yes)
1320 0 : gcc_unreachable ();
1321 :
1322 1983671 : opts->x_ix86_target_flags |= mask;
1323 :
1324 1983671 : struct cl_decoded_option decoded;
1325 1983671 : generate_option (opt, NULL, opt_set_p, CL_TARGET,
1326 : &decoded);
1327 1983671 : ix86_handle_option (opts, opts_set, &decoded,
1328 : input_location);
1329 : }
1330 : else
1331 : {
1332 0 : if (type == ix86_opt_ix86_no)
1333 0 : opt_set_p = !opt_set_p;
1334 :
1335 0 : if (opt_set_p)
1336 0 : opts->x_ix86_target_flags |= mask;
1337 : else
1338 0 : opts->x_ix86_target_flags &= ~mask;
1339 : }
1340 : }
1341 :
1342 : else if (type == ix86_opt_str)
1343 : {
1344 20903 : if (p_strings[opt])
1345 : {
1346 1 : error_at (loc, "attribute value %qs was already specified "
1347 : "in %qs attribute", orig_p, attr_name);
1348 1 : ret = false;
1349 : }
1350 : else
1351 : {
1352 20902 : p_strings[opt] = xstrdup (p + opt_len);
1353 20902 : if (opt == IX86_FUNCTION_SPECIFIC_ARCH)
1354 : {
1355 : /* If arch= is set, clear all bits in x_ix86_isa_flags,
1356 : except for ISA_64BIT, ABI_64, ABI_X32, and CODE16
1357 : and all bits in x_ix86_isa_flags2. */
1358 20868 : opts->x_ix86_isa_flags &= (OPTION_MASK_ISA_64BIT
1359 : | OPTION_MASK_ABI_64
1360 : | OPTION_MASK_ABI_X32
1361 : | OPTION_MASK_CODE16);
1362 20868 : opts->x_ix86_isa_flags_explicit &= (OPTION_MASK_ISA_64BIT
1363 : | OPTION_MASK_ABI_64
1364 : | OPTION_MASK_ABI_X32
1365 : | OPTION_MASK_CODE16);
1366 20868 : opts->x_ix86_isa_flags2 = 0;
1367 20868 : opts->x_ix86_isa_flags2_explicit = 0;
1368 : }
1369 : }
1370 : }
1371 :
1372 : else if (type == ix86_opt_enum)
1373 : {
1374 187 : bool arg_ok;
1375 187 : int value;
1376 :
1377 187 : arg_ok = opt_enum_arg_to_value (opt, p + opt_len, &value, CL_TARGET);
1378 187 : if (arg_ok)
1379 187 : set_option (opts, enum_opts_set, opt, value,
1380 : p + opt_len,
1381 : static_cast<int> (diagnostics::kind::unspecified),
1382 : input_location,
1383 : global_dc);
1384 : else
1385 : {
1386 0 : error_at (loc, "attribute value %qs is unknown in %qs attribute",
1387 : orig_p, attr_name);
1388 0 : ret = false;
1389 : }
1390 : }
1391 :
1392 : else
1393 0 : gcc_unreachable ();
1394 : }
1395 :
1396 : return ret;
1397 : }
1398 :
1399 : /* Release allocated strings. */
1400 : static void
1401 50504420 : release_options_strings (char **option_strings)
1402 : {
1403 : /* Free up memory allocated to hold the strings */
1404 151513260 : for (unsigned i = 0; i < IX86_FUNCTION_SPECIFIC_MAX; i++)
1405 101008840 : free (option_strings[i]);
1406 50504420 : }
1407 :
1408 : /* Return a TARGET_OPTION_NODE tree of the target options listed or NULL. */
1409 :
1410 : tree
1411 50505057 : ix86_valid_target_attribute_tree (tree fndecl, tree args,
1412 : struct gcc_options *opts,
1413 : struct gcc_options *opts_set,
1414 : bool target_clone_attr)
1415 : {
1416 50505057 : const char *orig_arch_string = opts->x_ix86_arch_string;
1417 50505057 : const char *orig_tune_string = opts->x_ix86_tune_string;
1418 50505057 : enum fpmath_unit orig_fpmath_set = opts_set->x_ix86_fpmath;
1419 50505057 : enum prefer_vector_width orig_pvw_set = opts_set->x_prefer_vector_width_type;
1420 50505057 : enum prefer_vector_width orig_ix86_move_max_set
1421 : = opts_set->x_ix86_move_max;
1422 50505057 : int orig_tune_defaulted = ix86_tune_defaulted;
1423 50505057 : int orig_arch_specified = ix86_arch_specified;
1424 50505057 : char *option_strings[IX86_FUNCTION_SPECIFIC_MAX] = { NULL, NULL };
1425 50505057 : tree t = NULL_TREE;
1426 50505057 : struct cl_target_option *def
1427 50505057 : = TREE_TARGET_OPTION (target_option_default_node);
1428 50505057 : struct gcc_options enum_opts_set;
1429 :
1430 50505057 : memset (&enum_opts_set, 0, sizeof (enum_opts_set));
1431 :
1432 : /* Process each of the options on the chain. */
1433 50505057 : if (!ix86_valid_target_attribute_inner_p (fndecl, args, option_strings, opts,
1434 : opts_set, &enum_opts_set,
1435 : target_clone_attr))
1436 125 : return error_mark_node;
1437 :
1438 : /* If the changed options are different from the default, rerun
1439 : ix86_option_override_internal, and then save the options away.
1440 : The string options are attribute options, and will be undone
1441 : when we copy the save structure. */
1442 50504932 : if (opts->x_ix86_isa_flags != def->x_ix86_isa_flags
1443 1965478 : || opts->x_ix86_isa_flags2 != def->x_ix86_isa_flags2
1444 1886 : || opts->x_target_flags != def->x_target_flags
1445 728 : || option_strings[IX86_FUNCTION_SPECIFIC_ARCH]
1446 728 : || option_strings[IX86_FUNCTION_SPECIFIC_TUNE]
1447 694 : || enum_opts_set.x_ix86_fpmath
1448 525 : || enum_opts_set.x_prefer_vector_width_type)
1449 : {
1450 : /* If we are using the default tune= or arch=, undo the string assigned,
1451 : and use the default. */
1452 50504420 : if (option_strings[IX86_FUNCTION_SPECIFIC_ARCH])
1453 20867 : opts->x_ix86_arch_string
1454 20867 : = ggc_strdup (option_strings[IX86_FUNCTION_SPECIFIC_ARCH]);
1455 50483553 : else if (!orig_arch_specified)
1456 0 : opts->x_ix86_arch_string = NULL;
1457 :
1458 50504420 : if (option_strings[IX86_FUNCTION_SPECIFIC_TUNE])
1459 34 : opts->x_ix86_tune_string
1460 34 : = ggc_strdup (option_strings[IX86_FUNCTION_SPECIFIC_TUNE]);
1461 : /* If we have explicit arch string and no tune string specified, set
1462 : tune_string to NULL and later it will be overridden by arch_string
1463 : so target clones can get proper optimization. */
1464 50504386 : else if (option_strings[IX86_FUNCTION_SPECIFIC_ARCH]
1465 50483519 : || orig_tune_defaulted)
1466 20867 : opts->x_ix86_tune_string = NULL;
1467 :
1468 : /* If fpmath= is not set, and we now have sse2 on 32-bit, use it. */
1469 50504420 : if (enum_opts_set.x_ix86_fpmath)
1470 169 : opts_set->x_ix86_fpmath = (enum fpmath_unit) 1;
1471 50504420 : if (enum_opts_set.x_prefer_vector_width_type)
1472 17 : opts_set->x_prefer_vector_width_type = (enum prefer_vector_width) 1;
1473 :
1474 : /* Do any overrides, such as arch=xxx, or tune=xxx support. */
1475 50504420 : bool r = ix86_option_override_internal (false, opts, opts_set);
1476 50504420 : if (!r)
1477 : {
1478 3 : release_options_strings (option_strings);
1479 3 : return error_mark_node;
1480 : }
1481 :
1482 : /* Add any builtin functions with the new isa if any. */
1483 50504417 : ix86_add_new_builtins (opts->x_ix86_isa_flags, opts->x_ix86_isa_flags2);
1484 :
1485 50504417 : enum excess_precision orig_ix86_excess_precision
1486 : = opts->x_ix86_excess_precision;
1487 50504417 : bool orig_ix86_unsafe_math_optimizations
1488 : = opts->x_ix86_unsafe_math_optimizations;
1489 50504417 : opts->x_ix86_excess_precision = opts->x_flag_excess_precision;
1490 50504417 : opts->x_ix86_unsafe_math_optimizations
1491 50504417 : = opts->x_flag_unsafe_math_optimizations;
1492 :
1493 : /* Save the current options unless we are validating options for
1494 : #pragma. */
1495 50504417 : t = build_target_option_node (opts, opts_set);
1496 :
1497 50504417 : opts->x_ix86_arch_string = orig_arch_string;
1498 50504417 : opts->x_ix86_tune_string = orig_tune_string;
1499 50504417 : opts_set->x_ix86_fpmath = orig_fpmath_set;
1500 50504417 : opts_set->x_prefer_vector_width_type = orig_pvw_set;
1501 50504417 : opts_set->x_ix86_move_max = orig_ix86_move_max_set;
1502 50504417 : opts->x_ix86_excess_precision = orig_ix86_excess_precision;
1503 50504417 : opts->x_ix86_unsafe_math_optimizations
1504 50504417 : = orig_ix86_unsafe_math_optimizations;
1505 :
1506 50504417 : release_options_strings (option_strings);
1507 : }
1508 :
1509 : return t;
1510 : }
1511 :
1512 : static GTY(()) tree target_attribute_cache[3];
1513 :
1514 : /* Hook to validate attribute((target("string"))). */
1515 :
1516 : bool
1517 49933514 : ix86_valid_target_attribute_p (tree fndecl,
1518 : tree ARG_UNUSED (name),
1519 : tree args,
1520 : int flags)
1521 : {
1522 49933514 : struct gcc_options func_options, func_options_set;
1523 49933514 : tree new_target, new_optimize;
1524 49933514 : bool ret = true;
1525 :
1526 : /* attribute((target("default"))) does nothing, beyond
1527 : affecting multi-versioning. */
1528 49933514 : if (TREE_VALUE (args)
1529 49933514 : && TREE_CODE (TREE_VALUE (args)) == STRING_CST
1530 49933508 : && TREE_CHAIN (args) == NULL_TREE
1531 98307679 : && strcmp (TREE_STRING_POINTER (TREE_VALUE (args)), "default") == 0)
1532 : return true;
1533 :
1534 49933301 : if ((DECL_FUNCTION_SPECIFIC_TARGET (fndecl) == target_attribute_cache[1]
1535 49930938 : || DECL_FUNCTION_SPECIFIC_TARGET (fndecl) == NULL_TREE)
1536 6582 : && (DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl)
1537 6582 : == target_attribute_cache[2]
1538 457 : || DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl) == NULL_TREE)
1539 49939849 : && simple_cst_list_equal (args, target_attribute_cache[0]))
1540 : {
1541 1323 : DECL_FUNCTION_SPECIFIC_TARGET (fndecl) = target_attribute_cache[1];
1542 1323 : DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl)
1543 1323 : = target_attribute_cache[2];
1544 1323 : return true;
1545 : }
1546 :
1547 49931978 : tree old_optimize = build_optimization_node (&global_options,
1548 : &global_options_set);
1549 :
1550 : /* Get the optimization options of the current function. */
1551 49931978 : tree func_optimize = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl);
1552 :
1553 49931978 : if (!func_optimize)
1554 5225 : func_optimize = old_optimize;
1555 :
1556 : /* Init func_options. */
1557 49931978 : memset (&func_options, 0, sizeof (func_options));
1558 49931978 : init_options_struct (&func_options, NULL);
1559 49931978 : lang_hooks.init_options_struct (&func_options);
1560 49931978 : memset (&func_options_set, 0, sizeof (func_options_set));
1561 :
1562 49931978 : cl_optimization_restore (&func_options, &func_options_set,
1563 49931978 : TREE_OPTIMIZATION (func_optimize));
1564 :
1565 : /* Initialize func_options to the default before its target options can
1566 : be set. */
1567 49931978 : tree old_target = DECL_FUNCTION_SPECIFIC_TARGET (fndecl);
1568 49931978 : if (old_target == NULL_TREE)
1569 5254 : old_target = target_option_default_node;
1570 49931978 : cl_target_option_restore (&func_options, &func_options_set,
1571 49931978 : TREE_TARGET_OPTION (old_target));
1572 :
1573 : /* FLAGS == 1 is used for target_clones attribute. */
1574 49931978 : new_target
1575 49931978 : = ix86_valid_target_attribute_tree (fndecl, args, &func_options,
1576 : &func_options_set, flags == 1);
1577 :
1578 49931978 : new_optimize = build_optimization_node (&func_options, &func_options_set);
1579 :
1580 49931978 : if (new_target == error_mark_node)
1581 : ret = false;
1582 :
1583 49931854 : else if (new_target)
1584 : {
1585 49931607 : if (DECL_FUNCTION_SPECIFIC_TARGET (fndecl) == NULL_TREE
1586 49931607 : && DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl) == NULL_TREE)
1587 : {
1588 4870 : target_attribute_cache[0] = copy_list (args);
1589 4870 : target_attribute_cache[1] = new_target;
1590 4870 : target_attribute_cache[2]
1591 9260 : = old_optimize != new_optimize ? new_optimize : NULL_TREE;
1592 : }
1593 :
1594 49931607 : DECL_FUNCTION_SPECIFIC_TARGET (fndecl) = new_target;
1595 :
1596 49931607 : if (old_optimize != new_optimize)
1597 15672 : DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl) = new_optimize;
1598 : }
1599 :
1600 : return ret;
1601 : }
1602 :
1603 : const char *stringop_alg_names[] = {
1604 : #define DEF_ALG(alg, name) #name,
1605 : #include "stringop.def"
1606 : #undef DEF_ALG
1607 : };
1608 :
1609 : /* Parse parameter string passed to -mmemcpy-strategy= or -mmemset-strategy=.
1610 : The string is of the following form (or comma separated list of it):
1611 :
1612 : strategy_alg:max_size:[align|noalign]
1613 :
1614 : where the full size range for the strategy is either [0, max_size] or
1615 : [min_size, max_size], in which min_size is the max_size + 1 of the
1616 : preceding range. The last size range must have max_size == -1.
1617 :
1618 : Examples:
1619 :
1620 : 1.
1621 : -mmemcpy-strategy=libcall:-1:noalign
1622 :
1623 : this is equivalent to (for known size memcpy) -mstringop-strategy=libcall
1624 :
1625 :
1626 : 2.
1627 : -mmemset-strategy=rep_8byte:16:noalign,vector_loop:2048:align,libcall:-1:noalign
1628 :
1629 : This is to tell the compiler to use the following strategy for memset
1630 : 1) when the expected size is between [1, 16], use rep_8byte strategy;
1631 : 2) when the size is between [17, 2048], use vector_loop;
1632 : 3) when the size is > 2048, use libcall. */
1633 :
1634 : struct stringop_size_range
1635 : {
1636 : int max;
1637 : stringop_alg alg;
1638 : bool noalign;
1639 : };
1640 :
1641 : static void
1642 52 : ix86_parse_stringop_strategy_string (char *strategy_str, bool is_memset)
1643 : {
1644 52 : const struct stringop_algs *default_algs;
1645 52 : stringop_size_range input_ranges[MAX_STRINGOP_ALGS];
1646 52 : char *curr_range_str, *next_range_str;
1647 52 : const char *opt = is_memset ? "-mmemset_strategy=" : "-mmemcpy_strategy=";
1648 52 : int i = 0, n = 0;
1649 :
1650 52 : if (is_memset)
1651 34 : default_algs = &ix86_cost->memset[TARGET_64BIT != 0];
1652 : else
1653 18 : default_algs = &ix86_cost->memcpy[TARGET_64BIT != 0];
1654 :
1655 52 : curr_range_str = strategy_str;
1656 :
1657 94 : do
1658 : {
1659 94 : int maxs;
1660 94 : char alg_name[128];
1661 94 : char align[16];
1662 94 : next_range_str = strchr (curr_range_str, ',');
1663 94 : if (next_range_str)
1664 42 : *next_range_str++ = '\0';
1665 :
1666 94 : if (sscanf (curr_range_str, "%20[^:]:%d:%10s", alg_name, &maxs,
1667 : align) != 3)
1668 : {
1669 0 : error ("wrong argument %qs to option %qs", curr_range_str, opt);
1670 1 : return;
1671 : }
1672 :
1673 94 : if (n > 0 && (maxs < (input_ranges[n - 1].max + 1) && maxs != -1))
1674 : {
1675 0 : error ("size ranges of option %qs should be increasing", opt);
1676 0 : return;
1677 : }
1678 :
1679 471 : for (i = 0; i < last_alg; i++)
1680 470 : if (!strcmp (alg_name, stringop_alg_names[i]))
1681 : break;
1682 :
1683 93 : if (i == last_alg)
1684 : {
1685 1 : error ("wrong strategy name %qs specified for option %qs",
1686 : alg_name, opt);
1687 :
1688 1 : auto_vec <const char *> candidates;
1689 10 : for (i = 0; i < last_alg; i++)
1690 9 : if ((stringop_alg) i != rep_prefix_8_byte || TARGET_64BIT)
1691 9 : candidates.safe_push (stringop_alg_names[i]);
1692 :
1693 1 : char *s;
1694 1 : const char *hint
1695 1 : = candidates_list_and_hint (alg_name, s, candidates);
1696 1 : if (hint)
1697 1 : inform (input_location,
1698 : "valid arguments to %qs are: %s; did you mean %qs?",
1699 : opt, s, hint);
1700 : else
1701 0 : inform (input_location, "valid arguments to %qs are: %s",
1702 : opt, s);
1703 1 : XDELETEVEC (s);
1704 1 : return;
1705 1 : }
1706 :
1707 93 : if ((stringop_alg) i == rep_prefix_8_byte
1708 3 : && !TARGET_64BIT)
1709 : {
1710 : /* rep; movq isn't available in 32-bit code. */
1711 0 : error ("strategy name %qs specified for option %qs "
1712 : "not supported for 32-bit code", alg_name, opt);
1713 0 : return;
1714 : }
1715 :
1716 93 : input_ranges[n].max = maxs;
1717 93 : input_ranges[n].alg = (stringop_alg) i;
1718 93 : if (!strcmp (align, "align"))
1719 18 : input_ranges[n].noalign = false;
1720 75 : else if (!strcmp (align, "noalign"))
1721 75 : input_ranges[n].noalign = true;
1722 : else
1723 : {
1724 0 : error ("unknown alignment %qs specified for option %qs", align, opt);
1725 0 : return;
1726 : }
1727 93 : n++;
1728 93 : curr_range_str = next_range_str;
1729 : }
1730 93 : while (curr_range_str);
1731 :
1732 51 : if (input_ranges[n - 1].max != -1)
1733 : {
1734 0 : error ("the max value for the last size range should be -1"
1735 : " for option %qs", opt);
1736 0 : return;
1737 : }
1738 :
1739 51 : if (n > MAX_STRINGOP_ALGS)
1740 : {
1741 0 : error ("too many size ranges specified in option %qs", opt);
1742 0 : return;
1743 : }
1744 :
1745 : /* Now override the default algs array. */
1746 144 : for (i = 0; i < n; i++)
1747 : {
1748 93 : *const_cast<int *>(&default_algs->size[i].max) = input_ranges[i].max;
1749 93 : *const_cast<stringop_alg *>(&default_algs->size[i].alg)
1750 93 : = input_ranges[i].alg;
1751 93 : *const_cast<int *>(&default_algs->size[i].noalign)
1752 93 : = input_ranges[i].noalign;
1753 : }
1754 : }
1755 :
1756 :
1757 : /* parse -mtune-ctrl= option. When DUMP is true,
1758 : print the features that are explicitly set. */
1759 :
1760 : static void
1761 50835388 : parse_mtune_ctrl_str (struct gcc_options *opts, bool dump)
1762 : {
1763 50835388 : if (!opts->x_ix86_tune_ctrl_string)
1764 : return;
1765 :
1766 75114 : char *next_feature_string = NULL;
1767 75114 : char *curr_feature_string = xstrdup (opts->x_ix86_tune_ctrl_string);
1768 75114 : char *orig = curr_feature_string;
1769 75226 : int i;
1770 75226 : do
1771 : {
1772 75226 : bool clear = false;
1773 :
1774 75226 : next_feature_string = strchr (curr_feature_string, ',');
1775 75226 : if (next_feature_string)
1776 112 : *next_feature_string++ = '\0';
1777 75226 : if (*curr_feature_string == '^')
1778 : {
1779 14052 : curr_feature_string++;
1780 14052 : clear = true;
1781 : }
1782 :
1783 75226 : if (!strcmp (curr_feature_string, "use_gather"))
1784 : {
1785 4 : ix86_tune_features[X86_TUNE_USE_GATHER_2PARTS] = !clear;
1786 4 : ix86_tune_features[X86_TUNE_USE_GATHER_4PARTS] = !clear;
1787 4 : ix86_tune_features[X86_TUNE_USE_GATHER_8PARTS] = !clear;
1788 4 : if (dump)
1789 0 : fprintf (stderr, "Explicitly %s features use_gather_2parts,"
1790 : " use_gather_4parts, use_gather_8parts\n",
1791 : clear ? "clear" : "set");
1792 :
1793 : }
1794 75222 : else if (!strcmp (curr_feature_string, "use_scatter"))
1795 : {
1796 0 : ix86_tune_features[X86_TUNE_USE_SCATTER_2PARTS] = !clear;
1797 0 : ix86_tune_features[X86_TUNE_USE_SCATTER_4PARTS] = !clear;
1798 0 : ix86_tune_features[X86_TUNE_USE_SCATTER_8PARTS] = !clear;
1799 0 : if (dump)
1800 0 : fprintf (stderr, "Explicitly %s features use_scatter_2parts,"
1801 : " use_scatter_4parts, use_scatter_8parts\n",
1802 : clear ? "clear" : "set");
1803 : }
1804 : else
1805 : {
1806 2486801 : for (i = 0; i < X86_TUNE_LAST; i++)
1807 : {
1808 2486801 : if (!strcmp (curr_feature_string, ix86_tune_feature_names[i]))
1809 : {
1810 75222 : ix86_tune_features[i] = !clear;
1811 75222 : if (dump)
1812 0 : fprintf (stderr, "Explicitly %s feature %s\n",
1813 : clear ? "clear" : "set", ix86_tune_feature_names[i]);
1814 : break;
1815 : }
1816 : }
1817 :
1818 75222 : if (i == X86_TUNE_LAST)
1819 0 : error ("unknown parameter to option %<-mtune-ctrl%>: %s",
1820 : clear ? curr_feature_string - 1 : curr_feature_string);
1821 : }
1822 75226 : curr_feature_string = next_feature_string;
1823 : }
1824 75226 : while (curr_feature_string);
1825 75114 : free (orig);
1826 : }
1827 :
1828 : /* Helper function to set ix86_tune_features. IX86_TUNE is the
1829 : processor type. */
1830 :
1831 : static void
1832 50835388 : set_ix86_tune_features (struct gcc_options *opts,
1833 : enum processor_type ix86_tune, bool dump)
1834 : {
1835 50835388 : unsigned HOST_WIDE_INT ix86_tune_mask = HOST_WIDE_INT_1U << ix86_tune;
1836 50835388 : int i;
1837 :
1838 6354423500 : for (i = 0; i < X86_TUNE_LAST; ++i)
1839 : {
1840 6303588112 : if (ix86_tune_no_default)
1841 : ix86_tune_features[i] = 0;
1842 : else
1843 6303588112 : ix86_tune_features[i]
1844 6303588112 : = !!(initial_ix86_tune_features[i] & ix86_tune_mask);
1845 : }
1846 :
1847 50835388 : if (dump)
1848 : {
1849 0 : fprintf (stderr, "List of x86 specific tuning parameter names:\n");
1850 0 : for (i = 0; i < X86_TUNE_LAST; i++)
1851 0 : fprintf (stderr, "%s : %s\n", ix86_tune_feature_names[i],
1852 0 : ix86_tune_features[i] ? "on" : "off");
1853 : }
1854 :
1855 50835388 : parse_mtune_ctrl_str (opts, dump);
1856 :
1857 : /* mgather/mscatter option would overwrite -mtune-crtl option. */
1858 50835388 : if (OPTION_SET_P (ix86_use_gather))
1859 : {
1860 103087 : ix86_tune_features[X86_TUNE_USE_GATHER_2PARTS] = ix86_use_gather;
1861 103087 : ix86_tune_features[X86_TUNE_USE_GATHER_4PARTS] = ix86_use_gather;
1862 103087 : ix86_tune_features[X86_TUNE_USE_GATHER_8PARTS] = ix86_use_gather;
1863 : }
1864 :
1865 50835388 : if (OPTION_SET_P (ix86_use_scatter))
1866 : {
1867 0 : ix86_tune_features[X86_TUNE_USE_SCATTER_2PARTS] = ix86_use_scatter;
1868 0 : ix86_tune_features[X86_TUNE_USE_SCATTER_4PARTS] = ix86_use_scatter;
1869 0 : ix86_tune_features[X86_TUNE_USE_SCATTER_8PARTS] = ix86_use_scatter;
1870 : }
1871 50835388 : }
1872 :
1873 :
1874 : /* Default align_* from the processor table. */
1875 :
1876 : static void
1877 105363100 : ix86_default_align (struct gcc_options *opts)
1878 : {
1879 : /* -falign-foo without argument: supply one. */
1880 105363100 : if (opts->x_flag_align_loops && !opts->x_str_align_loops)
1881 136609 : opts->x_str_align_loops = processor_cost_table[ix86_tune]->align_loop;
1882 105363100 : if (opts->x_flag_align_jumps && !opts->x_str_align_jumps)
1883 136610 : opts->x_str_align_jumps = processor_cost_table[ix86_tune]->align_jump;
1884 105363100 : if (opts->x_flag_align_labels && !opts->x_str_align_labels)
1885 136610 : opts->x_str_align_labels = processor_cost_table[ix86_tune]->align_label;
1886 105363100 : if (opts->x_flag_align_functions && !opts->x_str_align_functions)
1887 136605 : opts->x_str_align_functions = processor_cost_table[ix86_tune]->align_func;
1888 105363100 : }
1889 :
1890 : #ifndef USE_IX86_FRAME_POINTER
1891 : #define USE_IX86_FRAME_POINTER 0
1892 : #endif
1893 :
1894 : /* (Re)compute option overrides affected by optimization levels in
1895 : target-specific ways. */
1896 :
1897 : static void
1898 105363100 : ix86_recompute_optlev_based_flags (struct gcc_options *opts,
1899 : struct gcc_options *opts_set)
1900 : {
1901 : /* Set the default values for switches whose default depends on TARGET_64BIT
1902 : in case they weren't overwritten by command line options. */
1903 105363100 : if (TARGET_64BIT_P (opts->x_ix86_isa_flags))
1904 : {
1905 103397498 : if (opts->x_optimize >= 1)
1906 99291264 : SET_OPTION_IF_UNSET (opts, opts_set, flag_omit_frame_pointer,
1907 : !USE_IX86_FRAME_POINTER);
1908 103397498 : if (opts->x_flag_asynchronous_unwind_tables
1909 103397498 : && TARGET_64BIT_MS_ABI)
1910 277900 : SET_OPTION_IF_UNSET (opts, opts_set, flag_unwind_tables, 1);
1911 103397498 : if (opts->x_flag_asynchronous_unwind_tables == 2)
1912 288626 : opts->x_flag_unwind_tables
1913 288626 : = opts->x_flag_asynchronous_unwind_tables = 1;
1914 103397498 : if (opts->x_flag_pcc_struct_return == 2)
1915 288659 : opts->x_flag_pcc_struct_return = 0;
1916 : }
1917 : else
1918 : {
1919 1965602 : if (opts->x_optimize >= 1)
1920 1965116 : SET_OPTION_IF_UNSET (opts, opts_set, flag_omit_frame_pointer,
1921 : !(USE_IX86_FRAME_POINTER || opts->x_optimize_size));
1922 1965602 : if (opts->x_flag_asynchronous_unwind_tables == 2)
1923 7126 : opts->x_flag_asynchronous_unwind_tables = !USE_IX86_FRAME_POINTER;
1924 1965602 : if (opts->x_flag_pcc_struct_return == 2)
1925 : {
1926 : /* Intel MCU psABI specifies that -freg-struct-return should
1927 : be on. Instead of setting DEFAULT_PCC_STRUCT_RETURN to 0,
1928 : we check -miamcu so that -freg-struct-return is always
1929 : turned on if -miamcu is used. */
1930 7132 : if (TARGET_IAMCU_P (opts->x_target_flags))
1931 0 : opts->x_flag_pcc_struct_return = 0;
1932 : else
1933 7132 : opts->x_flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
1934 : }
1935 : }
1936 :
1937 : /* Keep nonleaf frame pointers. */
1938 105363100 : if (opts->x_flag_omit_frame_pointer)
1939 100768659 : opts->x_target_flags &= ~MASK_OMIT_LEAF_FRAME_POINTER;
1940 4594441 : else if (TARGET_OMIT_LEAF_FRAME_POINTER_P (opts->x_target_flags))
1941 0 : opts->x_flag_omit_frame_pointer = 1;
1942 105363100 : }
1943 :
1944 : /* Implement part of TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE hook. */
1945 :
1946 : static void
1947 105363100 : ix86_override_options_after_change_1 (struct gcc_options *opts,
1948 : struct gcc_options *opts_set)
1949 : {
1950 : #define OPTS_SET_P(OPTION) opts_set->x_ ## OPTION
1951 : #define OPTS(OPTION) opts->x_ ## OPTION
1952 :
1953 : /* Disable unrolling small loops when there's explicit
1954 : -f{,no}unroll-loop. */
1955 105363100 : if ((OPTS_SET_P (flag_unroll_loops))
1956 104612321 : || (OPTS_SET_P (flag_unroll_all_loops)
1957 127 : && OPTS (flag_unroll_all_loops)))
1958 : {
1959 750906 : if (!OPTS_SET_P (ix86_unroll_only_small_loops))
1960 750906 : OPTS (ix86_unroll_only_small_loops) = 0;
1961 : /* Re-enable -frename-registers and -fweb if funroll-loops
1962 : enabled. */
1963 750906 : if (!OPTS_SET_P (flag_web))
1964 750898 : OPTS (flag_web) = OPTS (flag_unroll_loops);
1965 750906 : if (!OPTS_SET_P (flag_rename_registers))
1966 750904 : OPTS (flag_rename_registers) = OPTS (flag_unroll_loops);
1967 : /* -fcunroll-grow-size default follows -f[no]-unroll-loops. */
1968 750906 : if (!OPTS_SET_P (flag_cunroll_grow_size))
1969 750906 : OPTS (flag_cunroll_grow_size)
1970 1501812 : = (OPTS (flag_unroll_loops)
1971 44 : || OPTS (flag_peel_loops)
1972 1501812 : || OPTS (optimize) >= 3);
1973 : }
1974 : else
1975 : {
1976 104612194 : if (!OPTS_SET_P (flag_cunroll_grow_size))
1977 104612194 : OPTS (flag_cunroll_grow_size)
1978 209224388 : = (OPTS (flag_peel_loops)
1979 108943694 : || OPTS (optimize) >= 3);
1980 : }
1981 :
1982 : #undef OPTS
1983 : #undef OPTS_SET_P
1984 105363100 : }
1985 :
1986 : /* Implement TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE hook. */
1987 :
1988 : void
1989 54562882 : ix86_override_options_after_change (void)
1990 : {
1991 54562882 : ix86_default_align (&global_options);
1992 :
1993 54562882 : ix86_recompute_optlev_based_flags (&global_options, &global_options_set);
1994 :
1995 54562882 : ix86_override_options_after_change_1 (&global_options, &global_options_set);
1996 54562882 : }
1997 :
1998 : /* Clear stack slot assignments remembered from previous functions.
1999 : This is called from INIT_EXPANDERS once before RTL is emitted for each
2000 : function. */
2001 :
2002 : static struct machine_function *
2003 208543273 : ix86_init_machine_status (void)
2004 : {
2005 208543273 : struct machine_function *f;
2006 :
2007 208543273 : f = ggc_cleared_alloc<machine_function> ();
2008 208543273 : f->call_abi = ix86_abi;
2009 208543273 : f->stack_frame_required = true;
2010 208543273 : f->silent_p = true;
2011 :
2012 208543273 : return f;
2013 : }
2014 :
2015 : /* Override various settings based on options. If MAIN_ARGS_P, the
2016 : options are from the command line, otherwise they are from
2017 : attributes. Return true if there's an error related to march
2018 : option. */
2019 :
2020 : static bool
2021 50800222 : ix86_option_override_internal (bool main_args_p,
2022 : struct gcc_options *opts,
2023 : struct gcc_options *opts_set)
2024 : {
2025 50800222 : unsigned int i;
2026 50800222 : unsigned HOST_WIDE_INT ix86_arch_mask;
2027 50800222 : const bool ix86_tune_specified = (opts->x_ix86_tune_string != NULL);
2028 :
2029 : /* -mrecip options. */
2030 50800222 : static struct
2031 : {
2032 : const char *string; /* option name */
2033 : unsigned int mask; /* mask bits to set */
2034 : }
2035 : const recip_options[] =
2036 : {
2037 : { "all", RECIP_MASK_ALL },
2038 : { "none", RECIP_MASK_NONE },
2039 : { "div", RECIP_MASK_DIV },
2040 : { "sqrt", RECIP_MASK_SQRT },
2041 : { "vec-div", RECIP_MASK_VEC_DIV },
2042 : { "vec-sqrt", RECIP_MASK_VEC_SQRT },
2043 : };
2044 :
2045 : /* Turn off both OPTION_MASK_ABI_64 and OPTION_MASK_ABI_X32 if
2046 : TARGET_64BIT_DEFAULT is true and TARGET_64BIT is false. */
2047 50800222 : if (TARGET_64BIT_DEFAULT && !TARGET_64BIT_P (opts->x_ix86_isa_flags))
2048 627529 : opts->x_ix86_isa_flags &= ~(OPTION_MASK_ABI_64 | OPTION_MASK_ABI_X32);
2049 : #ifdef TARGET_BI_ARCH
2050 : else
2051 : {
2052 : #if TARGET_BI_ARCH == 1
2053 : /* When TARGET_BI_ARCH == 1, by default, OPTION_MASK_ABI_64
2054 : is on and OPTION_MASK_ABI_X32 is off. We turn off
2055 : OPTION_MASK_ABI_64 if OPTION_MASK_ABI_X32 is turned on by
2056 : -mx32. */
2057 50172693 : if (TARGET_X32_P (opts->x_ix86_isa_flags))
2058 101 : opts->x_ix86_isa_flags &= ~OPTION_MASK_ABI_64;
2059 : #else
2060 : /* When TARGET_BI_ARCH == 2, by default, OPTION_MASK_ABI_X32 is
2061 : on and OPTION_MASK_ABI_64 is off. We turn off
2062 : OPTION_MASK_ABI_X32 if OPTION_MASK_ABI_64 is turned on by
2063 : -m64 or OPTION_MASK_CODE16 is turned on by -m16. */
2064 : if (TARGET_LP64_P (opts->x_ix86_isa_flags)
2065 : || TARGET_16BIT_P (opts->x_ix86_isa_flags))
2066 : opts->x_ix86_isa_flags &= ~OPTION_MASK_ABI_X32;
2067 : #endif
2068 50172693 : if (TARGET_64BIT_P (opts->x_ix86_isa_flags)
2069 50172693 : && TARGET_IAMCU_P (opts->x_target_flags))
2070 0 : sorry ("Intel MCU psABI isn%'t supported in %s mode",
2071 : TARGET_X32_P (opts->x_ix86_isa_flags) ? "x32" : "64-bit");
2072 : }
2073 : #endif
2074 :
2075 50800222 : if (TARGET_X32_P (opts->x_ix86_isa_flags))
2076 : {
2077 : /* Always turn on OPTION_MASK_ISA_64BIT and turn off
2078 : OPTION_MASK_ABI_64 for TARGET_X32. */
2079 101 : opts->x_ix86_isa_flags |= OPTION_MASK_ISA_64BIT;
2080 101 : opts->x_ix86_isa_flags &= ~OPTION_MASK_ABI_64;
2081 : }
2082 50800121 : else if (TARGET_16BIT_P (opts->x_ix86_isa_flags))
2083 6 : opts->x_ix86_isa_flags &= ~(OPTION_MASK_ISA_64BIT
2084 : | OPTION_MASK_ABI_X32
2085 : | OPTION_MASK_ABI_64);
2086 50800115 : else if (TARGET_LP64_P (opts->x_ix86_isa_flags))
2087 : {
2088 : /* Always turn on OPTION_MASK_ISA_64BIT and turn off
2089 : OPTION_MASK_ABI_X32 for TARGET_LP64. */
2090 50172586 : opts->x_ix86_isa_flags |= OPTION_MASK_ISA_64BIT;
2091 50172586 : opts->x_ix86_isa_flags &= ~OPTION_MASK_ABI_X32;
2092 : }
2093 :
2094 : #ifdef SUBTARGET_OVERRIDE_OPTIONS
2095 : SUBTARGET_OVERRIDE_OPTIONS;
2096 : #endif
2097 :
2098 : #ifdef SUBSUBTARGET_OVERRIDE_OPTIONS
2099 : SUBSUBTARGET_OVERRIDE_OPTIONS;
2100 : #endif
2101 :
2102 : #ifdef HAVE_LD_BROKEN_PE_DWARF5
2103 : /* If the PE linker has broken DWARF 5 support, make
2104 : DWARF 4 the default. */
2105 : if (TARGET_PECOFF)
2106 : SET_OPTION_IF_UNSET (opts, opts_set, dwarf_version, 4);
2107 : #endif
2108 :
2109 : /* -fPIC is the default for x86_64. */
2110 50800222 : if (TARGET_MACHO && TARGET_64BIT_P (opts->x_ix86_isa_flags))
2111 : opts->x_flag_pic = 2;
2112 :
2113 : /* Need to check -mtune=generic first. */
2114 50800222 : if (opts->x_ix86_tune_string)
2115 : {
2116 : /* As special support for cross compilers we read -mtune=native
2117 : as -mtune=generic. With native compilers we won't see the
2118 : -mtune=native, as it was changed by the driver. */
2119 50778089 : if (!strcmp (opts->x_ix86_tune_string, "native"))
2120 0 : opts->x_ix86_tune_string = "generic";
2121 50778089 : else if (!strcmp (opts->x_ix86_tune_string, "x86-64"))
2122 0 : warning (OPT_Wdeprecated,
2123 : main_args_p
2124 : ? G_("%<-mtune=x86-64%> is deprecated; use %<-mtune=k8%> "
2125 : "or %<-mtune=generic%> instead as appropriate")
2126 : : G_("%<target(\"tune=x86-64\")%> is deprecated; use "
2127 : "%<target(\"tune=k8\")%> or %<target(\"tune=generic\")%>"
2128 : " instead as appropriate"));
2129 : }
2130 : else
2131 : {
2132 22133 : if (opts->x_ix86_arch_string)
2133 22133 : opts->x_ix86_tune_string = opts->x_ix86_arch_string;
2134 22133 : if (!opts->x_ix86_tune_string)
2135 : {
2136 0 : opts->x_ix86_tune_string = processor_names[TARGET_CPU_DEFAULT];
2137 0 : ix86_tune_defaulted = 1;
2138 : }
2139 :
2140 : /* opts->x_ix86_tune_string is set to opts->x_ix86_arch_string
2141 : or defaulted. We need to use a sensible tune option. */
2142 22133 : if (startswith (opts->x_ix86_tune_string, "x86-64")
2143 22133 : && (opts->x_ix86_tune_string[6] == '\0'
2144 439 : || (!strcmp (opts->x_ix86_tune_string + 6, "-v2")
2145 391 : || !strcmp (opts->x_ix86_tune_string + 6, "-v3")
2146 167 : || !strcmp (opts->x_ix86_tune_string + 6, "-v4"))))
2147 734 : opts->x_ix86_tune_string = "generic";
2148 : }
2149 :
2150 50800222 : if (opts->x_ix86_stringop_alg == rep_prefix_8_byte
2151 10 : && !TARGET_64BIT_P (opts->x_ix86_isa_flags))
2152 : {
2153 : /* rep; movq isn't available in 32-bit code. */
2154 0 : error ("%<-mstringop-strategy=rep_8byte%> not supported for 32-bit code");
2155 0 : opts->x_ix86_stringop_alg = no_stringop;
2156 : }
2157 :
2158 50800222 : if (TARGET_APX_F_P (opts->x_ix86_isa_flags2)
2159 41286 : && !TARGET_64BIT_P (opts->x_ix86_isa_flags))
2160 0 : error ("%<-mapxf%> is not supported for 32-bit code");
2161 50800222 : else if (opts->x_ix86_apx_features != apx_none
2162 41301 : && !TARGET_64BIT_P (opts->x_ix86_isa_flags))
2163 0 : error ("%<-mapx-features=%> option is not supported for 32-bit code");
2164 :
2165 50800222 : if (TARGET_UINTR_P (opts->x_ix86_isa_flags2)
2166 85852 : && !TARGET_64BIT_P (opts->x_ix86_isa_flags))
2167 0 : error ("%<-muintr%> not supported for 32-bit code");
2168 :
2169 50800222 : if (ix86_lam_type && !TARGET_LP64_P (opts->x_ix86_isa_flags))
2170 0 : error ("%<-mlam=%> option: [u48|u57] not supported for 32-bit code");
2171 :
2172 50800222 : if (!opts->x_ix86_arch_string)
2173 0 : opts->x_ix86_arch_string
2174 0 : = TARGET_64BIT_P (opts->x_ix86_isa_flags)
2175 0 : ? "x86-64" : SUBTARGET32_DEFAULT_CPU;
2176 : else
2177 50800222 : ix86_arch_specified = 1;
2178 :
2179 50800222 : if (opts_set->x_ix86_pmode)
2180 : {
2181 59 : if ((TARGET_LP64_P (opts->x_ix86_isa_flags)
2182 0 : && opts->x_ix86_pmode == PMODE_SI)
2183 59 : || (!TARGET_64BIT_P (opts->x_ix86_isa_flags)
2184 0 : && opts->x_ix86_pmode == PMODE_DI))
2185 0 : error ("address mode %qs not supported in the %s bit mode",
2186 : TARGET_64BIT_P (opts->x_ix86_isa_flags) ? "short" : "long",
2187 : TARGET_64BIT_P (opts->x_ix86_isa_flags) ? "64" : "32");
2188 : }
2189 : else
2190 50800163 : opts->x_ix86_pmode = TARGET_LP64_P (opts->x_ix86_isa_flags)
2191 50800163 : ? PMODE_DI : PMODE_SI;
2192 :
2193 50800222 : SET_OPTION_IF_UNSET (opts, opts_set, ix86_abi, DEFAULT_ABI);
2194 :
2195 50800222 : if (opts->x_ix86_abi == MS_ABI && TARGET_X32_P (opts->x_ix86_isa_flags))
2196 1 : error ("%<-mabi=ms%> not supported with X32 ABI");
2197 50800222 : gcc_assert (opts->x_ix86_abi == SYSV_ABI || opts->x_ix86_abi == MS_ABI);
2198 :
2199 50800222 : const char *abi_name = opts->x_ix86_abi == MS_ABI ? "ms" : "sysv";
2200 50800222 : if ((opts->x_flag_sanitize & SANITIZE_USER_ADDRESS)
2201 2924 : && opts->x_ix86_abi != DEFAULT_ABI)
2202 7 : error ("%<-mabi=%s%> not supported with %<-fsanitize=address%>", abi_name);
2203 50800222 : if ((opts->x_flag_sanitize & SANITIZE_KERNEL_ADDRESS)
2204 144 : && opts->x_ix86_abi != DEFAULT_ABI)
2205 0 : error ("%<-mabi=%s%> not supported with %<-fsanitize=kernel-address%>",
2206 : abi_name);
2207 50800222 : if ((opts->x_flag_sanitize & SANITIZE_THREAD)
2208 299 : && opts->x_ix86_abi != DEFAULT_ABI)
2209 2 : error ("%<-mabi=%s%> not supported with %<-fsanitize=thread%>", abi_name);
2210 :
2211 : /* Hwasan is supported with lam_u57 only. */
2212 50800222 : if (opts->x_flag_sanitize & SANITIZE_HWADDRESS)
2213 : {
2214 392 : if (ix86_lam_type == lam_u48)
2215 0 : warning (0, "%<-mlam=u48%> is not compatible with Hardware-assisted "
2216 : "AddressSanitizer, override to %<-mlam=u57%>");
2217 392 : ix86_lam_type = lam_u57;
2218 : }
2219 :
2220 : /* For targets using ms ABI enable ms-extensions, if not
2221 : explicit turned off. For non-ms ABI we turn off this
2222 : option. */
2223 50800222 : SET_OPTION_IF_UNSET (opts, opts_set, flag_ms_extensions,
2224 : (MS_ABI == DEFAULT_ABI));
2225 :
2226 50800222 : if (opts_set->x_ix86_cmodel)
2227 : {
2228 36773 : switch (opts->x_ix86_cmodel)
2229 : {
2230 1 : case CM_SMALL:
2231 1 : case CM_SMALL_PIC:
2232 1 : if (opts->x_flag_pic)
2233 0 : opts->x_ix86_cmodel = CM_SMALL_PIC;
2234 1 : if (!TARGET_64BIT_P (opts->x_ix86_isa_flags))
2235 0 : error ("code model %qs not supported in the %s bit mode",
2236 : "small", "32");
2237 : break;
2238 :
2239 23255 : case CM_MEDIUM:
2240 23255 : case CM_MEDIUM_PIC:
2241 23255 : if (opts->x_flag_pic)
2242 23241 : opts->x_ix86_cmodel = CM_MEDIUM_PIC;
2243 23255 : if (!TARGET_64BIT_P (opts->x_ix86_isa_flags))
2244 0 : error ("code model %qs not supported in the %s bit mode",
2245 : "medium", "32");
2246 23255 : else if (TARGET_X32_P (opts->x_ix86_isa_flags))
2247 0 : error ("code model %qs not supported in x32 mode",
2248 : "medium");
2249 : break;
2250 :
2251 13516 : case CM_LARGE:
2252 13516 : case CM_LARGE_PIC:
2253 13516 : if (opts->x_flag_pic)
2254 29 : opts->x_ix86_cmodel = CM_LARGE_PIC;
2255 13516 : if (!TARGET_64BIT_P (opts->x_ix86_isa_flags))
2256 0 : error ("code model %qs not supported in the %s bit mode",
2257 : "large", "32");
2258 13516 : else if (TARGET_X32_P (opts->x_ix86_isa_flags))
2259 0 : error ("code model %qs not supported in x32 mode",
2260 : "large");
2261 : break;
2262 :
2263 0 : case CM_32:
2264 0 : if (opts->x_flag_pic)
2265 0 : error ("code model %s does not support PIC mode", "32");
2266 0 : if (TARGET_64BIT_P (opts->x_ix86_isa_flags))
2267 0 : error ("code model %qs not supported in the %s bit mode",
2268 : "32", "64");
2269 : break;
2270 :
2271 1 : case CM_KERNEL:
2272 1 : if (opts->x_flag_pic)
2273 : {
2274 0 : error ("code model %s does not support PIC mode", "kernel");
2275 0 : opts->x_ix86_cmodel = CM_32;
2276 : }
2277 1 : if (!TARGET_64BIT_P (opts->x_ix86_isa_flags))
2278 0 : error ("code model %qs not supported in the %s bit mode",
2279 : "kernel", "32");
2280 : break;
2281 :
2282 0 : default:
2283 0 : gcc_unreachable ();
2284 : }
2285 : }
2286 : else
2287 : {
2288 : /* For TARGET_64BIT and MS_ABI, force pic on, in order to enable the
2289 : use of rip-relative addressing. This eliminates fixups that
2290 : would otherwise be needed if this object is to be placed in a
2291 : DLL, and is essentially just as efficient as direct addressing. */
2292 50763449 : if (TARGET_64BIT_P (opts->x_ix86_isa_flags)
2293 : && (TARGET_RDOS || TARGET_PECOFF))
2294 : opts->x_ix86_cmodel = CM_MEDIUM_PIC, opts->x_flag_pic = 1;
2295 50763449 : else if (TARGET_64BIT_P (opts->x_ix86_isa_flags))
2296 99901081 : opts->x_ix86_cmodel = opts->x_flag_pic ? CM_SMALL_PIC : CM_SMALL;
2297 : else
2298 627535 : opts->x_ix86_cmodel = CM_32;
2299 : }
2300 50800222 : if (TARGET_MACHO && opts->x_ix86_asm_dialect == ASM_INTEL)
2301 : {
2302 : error ("%<-masm=intel%> not supported in this configuration");
2303 : opts->x_ix86_asm_dialect = ASM_ATT;
2304 : }
2305 50800222 : if ((TARGET_64BIT_P (opts->x_ix86_isa_flags) != 0)
2306 : != ((opts->x_ix86_isa_flags & OPTION_MASK_ISA_64BIT) != 0))
2307 : sorry ("%i-bit mode not compiled in",
2308 : (opts->x_ix86_isa_flags & OPTION_MASK_ISA_64BIT) ? 64 : 32);
2309 :
2310 50800222 : processor_vendor ix86_vendor = VENDOR_OTHER;
2311 50800222 : processor_types ix86_type = CPU_TYPE_MAX;
2312 50800222 : processor_subtypes ix86_subtype = CPU_SUBTYPE_MAX;
2313 50800222 : wide_int_bitmask ix86_pta = 0;
2314 :
2315 : /* Last processor_alias_table must point to "generic" entry. */
2316 50800222 : gcc_checking_assert (strcmp (processor_alias_table[pta_size - 1].name,
2317 : "generic") == 0);
2318 4051093294 : for (i = 0; i < pta_size; i++)
2319 4051093266 : if (! strcmp (opts->x_ix86_arch_string, processor_alias_table[i].name))
2320 : {
2321 50800194 : if (!strcmp (opts->x_ix86_arch_string, "generic"))
2322 : {
2323 2 : error (main_args_p
2324 : ? G_("%<generic%> CPU can be used only for %<-mtune=%> "
2325 : "switch")
2326 : : G_("%<generic%> CPU can be used only for "
2327 : "%<target(\"tune=\")%> attribute"));
2328 2 : return false;
2329 : }
2330 50800192 : else if (!strcmp (opts->x_ix86_arch_string, "intel"))
2331 : {
2332 1 : error (main_args_p
2333 : ? G_("%<intel%> CPU can be used only for %<-mtune=%> "
2334 : "switch")
2335 : : G_("%<intel%> CPU can be used only for "
2336 : "%<target(\"tune=\")%> attribute"));
2337 1 : return false;
2338 : }
2339 :
2340 50800191 : if (TARGET_64BIT_P (opts->x_ix86_isa_flags)
2341 50800191 : && !((processor_alias_table[i].flags & PTA_64BIT) != 0))
2342 : {
2343 1 : error ("CPU you selected does not support x86-64 "
2344 : "instruction set");
2345 1 : return false;
2346 : }
2347 :
2348 50800190 : ix86_schedule = processor_alias_table[i].schedule;
2349 50800190 : ix86_arch = processor_alias_table[i].processor;
2350 50800190 : ix86_pta = processor_alias_table[i].flags;
2351 :
2352 50800190 : ix86_decode_cpu_info (processor_alias_table[i].model,
2353 : ix86_vendor, ix86_type, ix86_subtype);
2354 :
2355 : /* Default cpu tuning to the architecture, unless the table
2356 : entry requests not to do this. Used by the x86-64 psABI
2357 : micro-architecture levels. */
2358 101205680 : if ((processor_alias_table[i].flags & PTA_NO_TUNE) == 0)
2359 50405490 : ix86_tune = ix86_arch;
2360 : else
2361 : ix86_tune = PROCESSOR_GENERIC;
2362 :
2363 : /* Enable PTA flags that are enabled by default by a -march option. */
2364 : #define TARGET_EXPLICIT_NO_SAHF_P(opts) (false)
2365 : #define SET_TARGET_NO_SAHF(opts) {}
2366 : #define TARGET_EXPLICIT_PREFETCH_SSE_P(opts) (false)
2367 : #define SET_TARGET_PREFETCH_SSE(opts) {}
2368 : #define TARGET_EXPLICIT_NO_TUNE_P(opts) (false)
2369 : #define SET_TARGET_NO_TUNE(opts) {}
2370 : #define TARGET_EXPLICIT_NO_80387_P(opts) (false)
2371 : #define SET_TARGET_NO_80387(opts) {}
2372 :
2373 : #define DEF_PTA(NAME) \
2374 : if (((processor_alias_table[i].flags & PTA_ ## NAME) != 0) \
2375 : && PTA_ ## NAME != PTA_64BIT \
2376 : && (TARGET_64BIT || (PTA_ ## NAME != PTA_UINTR \
2377 : && PTA_ ## NAME != PTA_APX_F))\
2378 : && !TARGET_EXPLICIT_ ## NAME ## _P (opts)) \
2379 : SET_TARGET_ ## NAME (opts);
2380 : #include "i386-isa.def"
2381 : #undef DEF_PTA
2382 :
2383 :
2384 50800190 : if (!(TARGET_64BIT_P (opts->x_ix86_isa_flags)
2385 50172655 : && ((processor_alias_table[i].flags & PTA_NO_SAHF) != 0))
2386 51575214 : && !TARGET_EXPLICIT_SAHF_P (opts))
2387 1402546 : SET_TARGET_SAHF (opts);
2388 :
2389 50800190 : if (((processor_alias_table[i].flags & PTA_ABM) != 0)
2390 6190 : && !TARGET_EXPLICIT_ABM_P (opts))
2391 : {
2392 6177 : if (!TARGET_EXPLICIT_LZCNT_P (opts))
2393 6176 : SET_TARGET_LZCNT (opts);
2394 6177 : if (!TARGET_EXPLICIT_POPCNT_P (opts))
2395 5744 : SET_TARGET_POPCNT (opts);
2396 : }
2397 :
2398 : /* Enable apx if apxf or apx_features are not
2399 : explicitly set for -march. */
2400 50800190 : if (TARGET_64BIT_P (opts->x_ix86_isa_flags)
2401 50172655 : && ((processor_alias_table[i].flags & PTA_APX_F) != 0)
2402 272 : && !TARGET_EXPLICIT_APX_F_P (opts)
2403 50800462 : && !OPTION_SET_P (ix86_apx_features))
2404 272 : opts->x_ix86_apx_features = apx_all;
2405 :
2406 50800190 : if ((processor_alias_table[i].flags
2407 50800190 : & (PTA_PREFETCH_SSE | PTA_SSE)) != 0)
2408 50800190 : ix86_prefetch_sse = true;
2409 :
2410 : /* Don't enable x87 instructions if only general registers are
2411 : allowed by target("general-regs-only") function attribute or
2412 : -mgeneral-regs-only. */
2413 50800190 : if (!(opts->x_ix86_target_flags & OPTION_MASK_GENERAL_REGS_ONLY)
2414 48538577 : && !(opts_set->x_target_flags & MASK_80387))
2415 : {
2416 48538542 : if (((processor_alias_table[i].flags & PTA_NO_80387) != 0))
2417 0 : opts->x_target_flags &= ~MASK_80387;
2418 : else
2419 48538542 : opts->x_target_flags |= MASK_80387;
2420 : }
2421 : break;
2422 : }
2423 :
2424 50800218 : if (i == pta_size)
2425 : {
2426 30 : error (main_args_p
2427 : ? G_("bad value %qs for %<-march=%> switch")
2428 : : G_("bad value %qs for %<target(\"arch=\")%> attribute"),
2429 : opts->x_ix86_arch_string);
2430 :
2431 28 : auto_vec <const char *> candidates;
2432 3388 : for (i = 0; i < pta_size; i++)
2433 3360 : if (strcmp (processor_alias_table[i].name, "generic")
2434 3332 : && strcmp (processor_alias_table[i].name, "intel")
2435 6664 : && (!TARGET_64BIT_P (opts->x_ix86_isa_flags)
2436 5768 : || ((processor_alias_table[i].flags & PTA_64BIT) != 0)))
2437 2408 : candidates.safe_push (processor_alias_table[i].name);
2438 :
2439 : #ifdef HAVE_LOCAL_CPU_DETECT
2440 : /* Add also "native" as possible value. */
2441 28 : candidates.safe_push ("native");
2442 : #endif
2443 :
2444 28 : char *s;
2445 28 : const char *hint
2446 28 : = candidates_list_and_hint (opts->x_ix86_arch_string, s, candidates);
2447 28 : if (hint)
2448 3 : inform (input_location,
2449 : main_args_p
2450 : ? G_("valid arguments to %<-march=%> switch are: "
2451 : "%s; did you mean %qs?")
2452 : : G_("valid arguments to %<target(\"arch=\")%> attribute are: "
2453 : "%s; did you mean %qs?"), s, hint);
2454 : else
2455 27 : inform (input_location,
2456 : main_args_p
2457 : ? G_("valid arguments to %<-march=%> switch are: %s")
2458 : : G_("valid arguments to %<target(\"arch=\")%> attribute "
2459 : "are: %s"), s);
2460 28 : XDELETEVEC (s);
2461 28 : }
2462 :
2463 50800218 : ix86_arch_mask = HOST_WIDE_INT_1U << ix86_arch;
2464 304801308 : for (i = 0; i < X86_ARCH_LAST; ++i)
2465 254001090 : ix86_arch_features[i] = !!(initial_ix86_arch_features[i] & ix86_arch_mask);
2466 :
2467 6038410436 : for (i = 0; i < pta_size; i++)
2468 6038410404 : if (! strcmp (opts->x_ix86_tune_string, processor_alias_table[i].name)
2469 6038410404 : && (processor_alias_table[i].flags & PTA_NO_TUNE) == 0)
2470 : {
2471 50800186 : ix86_schedule = processor_alias_table[i].schedule;
2472 50800186 : ix86_tune = processor_alias_table[i].processor;
2473 50800186 : if (TARGET_64BIT_P (opts->x_ix86_isa_flags))
2474 : {
2475 50172651 : if (!((processor_alias_table[i].flags & PTA_64BIT) != 0))
2476 : {
2477 0 : if (ix86_tune_defaulted)
2478 : {
2479 0 : opts->x_ix86_tune_string = "x86-64";
2480 0 : for (i = 0; i < pta_size; i++)
2481 0 : if (! strcmp (opts->x_ix86_tune_string,
2482 0 : processor_alias_table[i].name))
2483 : break;
2484 0 : ix86_schedule = processor_alias_table[i].schedule;
2485 0 : ix86_tune = processor_alias_table[i].processor;
2486 : }
2487 : else
2488 0 : error ("CPU you selected does not support x86-64 "
2489 : "instruction set");
2490 : }
2491 : }
2492 : /* Intel CPUs have always interpreted SSE prefetch instructions as
2493 : NOPs; so, we can enable SSE prefetch instructions even when
2494 : -mtune (rather than -march) points us to a processor that has them.
2495 : However, the VIA C3 gives a SIGILL, so we only do that for i686 and
2496 : higher processors. */
2497 50800186 : if (TARGET_CMOV
2498 50800186 : && ((processor_alias_table[i].flags
2499 50800186 : & (PTA_PREFETCH_SSE | PTA_SSE)) != 0))
2500 816294 : ix86_prefetch_sse = true;
2501 : break;
2502 : }
2503 :
2504 50800218 : if (ix86_tune_specified && i == pta_size)
2505 : {
2506 29 : error (main_args_p
2507 : ? G_("bad value %qs for %<-mtune=%> switch")
2508 : : G_("bad value %qs for %<target(\"tune=\")%> attribute"),
2509 : opts->x_ix86_tune_string);
2510 :
2511 27 : auto_vec <const char *> candidates;
2512 3267 : for (i = 0; i < pta_size; i++)
2513 3240 : if ((!TARGET_64BIT_P (opts->x_ix86_isa_flags)
2514 3240 : || ((processor_alias_table[i].flags & PTA_64BIT) != 0))
2515 8775 : && (processor_alias_table[i].flags & PTA_NO_TUNE) == 0)
2516 2295 : candidates.safe_push (processor_alias_table[i].name);
2517 :
2518 : #ifdef HAVE_LOCAL_CPU_DETECT
2519 : /* Add also "native" as possible value. */
2520 27 : candidates.safe_push ("native");
2521 : #endif
2522 :
2523 27 : char *s;
2524 27 : const char *hint
2525 27 : = candidates_list_and_hint (opts->x_ix86_tune_string, s, candidates);
2526 27 : if (hint)
2527 1 : inform (input_location,
2528 : main_args_p
2529 : ? G_("valid arguments to %<-mtune=%> switch are: "
2530 : "%s; did you mean %qs?")
2531 : : G_("valid arguments to %<target(\"tune=\")%> attribute are: "
2532 : "%s; did you mean %qs?"), s, hint);
2533 : else
2534 28 : inform (input_location,
2535 : main_args_p
2536 : ? G_("valid arguments to %<-mtune=%> switch are: %s")
2537 : : G_("valid arguments to %<target(\"tune=\")%> attribute "
2538 : "are: %s"), s);
2539 27 : XDELETEVEC (s);
2540 27 : }
2541 :
2542 : /* Disable -m128bit-atomic if not set on command-line. */
2543 50800218 : if (!TARGET_128BIT_ATOMIC_P (opts_set->x_ix86_target_flags))
2544 50785761 : opts->x_ix86_target_flags &= ~OPTION_MASK_128BIT_ATOMIC;
2545 :
2546 50800218 : if (TARGET_128BIT_ATOMIC_P (opts->x_ix86_target_flags))
2547 : {
2548 14456 : if (!TARGET_64BIT_P (opts->x_ix86_isa_flags))
2549 0 : error ("%<-m128bit-atomic%> not supported for 32-bit code");
2550 14456 : else if (!TARGET_CX16_P (opts_set->x_ix86_isa_flags2))
2551 : {
2552 : /* Enable CMPXCHG16B when -m128bit-atomic is enabled. */
2553 14454 : opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA2_CX16;
2554 : }
2555 : }
2556 50785762 : else if (!TARGET_128BIT_ATOMIC_P (opts_set->x_ix86_target_flags)
2557 50785761 : && TARGET_64BIT_P (opts->x_ix86_isa_flags)
2558 100943988 : && ((TARGET_AVX_P (opts->x_ix86_isa_flags)
2559 47513307 : && (ix86_vendor == VENDOR_INTEL
2560 47513307 : || ix86_vendor == VENDOR_AMD
2561 47154449 : || ix86_vendor == VENDOR_HYGON
2562 47154336 : || ix86_vendor == VENDOR_ZHAOXIN))
2563 49799210 : || (ix86_pta & PTA_X86_64_V3) == PTA_X86_64_V3
2564 49416129 : || ix86_type == AMDFAM17H
2565 : || ix86_type == AMDFAM19H
2566 : || ix86_type == AMDFAM1AH
2567 : || ix86_type == HYGONFAM18H
2568 : || (ix86_type >= INTEL_SIERRAFOREST
2569 : && ix86_type <= INTEL_CLEARWATERFOREST)
2570 49416129 : || ix86_subtype == INTEL_COREI7_SANDYBRIDGE
2571 : || (ix86_subtype >= AMDFAM17H_ZNVER1
2572 : && ix86_subtype <= INTEL_COREI7_ROCKETLAKE)
2573 : || (ix86_subtype >= AMDFAM19H_ZNVER4
2574 : && ix86_subtype <= HYGONFAM18H_C86_4G_M8)))
2575 : {
2576 : /* Turn on -m128bit-atomic in 64-bit mode by default if supported
2577 : by the targeting processor, which is one of x86-64-v3 capable
2578 : processors as well as AVX capable processors from Intel, AMD,
2579 : Hygon and Zhaoxin. */
2580 742099 : opts->x_ix86_target_flags |= OPTION_MASK_128BIT_ATOMIC;
2581 : }
2582 :
2583 50800218 : set_ix86_tune_features (opts, ix86_tune, opts->x_ix86_dump_tunes);
2584 :
2585 50800218 : ix86_recompute_optlev_based_flags (opts, opts_set);
2586 :
2587 50800218 : ix86_override_options_after_change_1 (opts, opts_set);
2588 :
2589 50800218 : ix86_tune_cost = processor_cost_table[ix86_tune];
2590 : /* TODO: ix86_cost should be chosen at instruction or function granularity
2591 : so for cold code we use size_cost even in !optimize_size compilation. */
2592 50800218 : if (opts->x_optimize_size)
2593 : ix86_cost = &ix86_size_cost;
2594 : else
2595 50079223 : ix86_cost = ix86_tune_cost;
2596 :
2597 : /* Arrange to set up i386_stack_locals for all functions. */
2598 50800218 : init_machine_status = ix86_init_machine_status;
2599 :
2600 : /* Override APX flag here if ISA bit is set. */
2601 50800218 : if (TARGET_APX_F_P (opts->x_ix86_isa_flags2)
2602 41558 : && !OPTION_SET_P (ix86_apx_features))
2603 41558 : opts->x_ix86_apx_features = apx_all;
2604 :
2605 : /* Validate -mregparm= value. */
2606 50800218 : if (opts_set->x_ix86_regparm)
2607 : {
2608 0 : if (TARGET_64BIT_P (opts->x_ix86_isa_flags))
2609 0 : warning (0, "%<-mregparm%> is ignored in 64-bit mode");
2610 0 : else if (TARGET_IAMCU_P (opts->x_target_flags))
2611 0 : warning (0, "%<-mregparm%> is ignored for Intel MCU psABI");
2612 0 : if (opts->x_ix86_regparm > REGPARM_MAX)
2613 : {
2614 0 : error ("%<-mregparm=%d%> is not between 0 and %d",
2615 0 : opts->x_ix86_regparm, REGPARM_MAX);
2616 0 : opts->x_ix86_regparm = 0;
2617 : }
2618 : }
2619 50800218 : if (TARGET_IAMCU_P (opts->x_target_flags)
2620 50800218 : || TARGET_64BIT_P (opts->x_ix86_isa_flags))
2621 100274236 : opts->x_ix86_regparm = REGPARM_MAX;
2622 :
2623 : /* Default align_* from the processor table. */
2624 50800218 : ix86_default_align (&global_options);
2625 :
2626 : /* Provide default for -mbranch-cost= value. */
2627 50800218 : SET_OPTION_IF_UNSET (opts, opts_set, ix86_branch_cost,
2628 : ix86_tune_cost->branch_cost);
2629 :
2630 50800218 : if (TARGET_64BIT_P (opts->x_ix86_isa_flags))
2631 : {
2632 50172683 : opts->x_target_flags
2633 50172683 : |= TARGET_SUBTARGET64_DEFAULT & ~opts_set->x_target_flags;
2634 :
2635 50172683 : if (!ix86_arch_specified)
2636 0 : opts->x_ix86_isa_flags
2637 0 : |= TARGET_SUBTARGET64_ISA_DEFAULT & ~opts->x_ix86_isa_flags_explicit;
2638 :
2639 50172683 : if (!TARGET_128BIT_LONG_DOUBLE_P (opts->x_target_flags))
2640 1 : error ("%<-m96bit-long-double%> is not compatible with this target");
2641 :
2642 50172683 : if (TARGET_RTD_P (opts->x_target_flags))
2643 0 : warning (0,
2644 : main_args_p
2645 : ? G_("%<-mrtd%> is ignored in 64bit mode")
2646 : : G_("%<target(\"rtd\")%> is ignored in 64bit mode"));
2647 : }
2648 : else
2649 : {
2650 627535 : opts->x_target_flags
2651 : |= TARGET_SUBTARGET32_DEFAULT & ~opts_set->x_target_flags;
2652 :
2653 627535 : if (!ix86_arch_specified)
2654 627535 : opts->x_ix86_isa_flags
2655 : |= TARGET_SUBTARGET32_ISA_DEFAULT & ~opts->x_ix86_isa_flags_explicit;
2656 :
2657 : /* i386 ABI does not specify red zone. It still makes sense to use it
2658 : when programmer takes care to stack from being destroyed. */
2659 627535 : if (!(opts_set->x_target_flags & MASK_NO_RED_ZONE))
2660 627535 : opts->x_target_flags |= MASK_NO_RED_ZONE;
2661 : }
2662 :
2663 : /* If we're doing fast math, we don't care about comparison order
2664 : wrt NaNs. This lets us use a shorter comparison sequence. */
2665 50800218 : if (opts->x_flag_finite_math_only)
2666 1040310 : opts->x_target_flags &= ~MASK_IEEE_FP;
2667 :
2668 : /* If the architecture always has an FPU, turn off NO_FANCY_MATH_387,
2669 : since the insns won't need emulation. */
2670 50800218 : if (ix86_tune_features [X86_TUNE_ALWAYS_FANCY_MATH_387])
2671 50800218 : opts->x_target_flags &= ~MASK_NO_FANCY_MATH_387;
2672 :
2673 : /* Likewise, if the target doesn't have a 387, or we've specified
2674 : software floating point, don't use 387 inline intrinsics. */
2675 50800218 : if (!TARGET_80387_P (opts->x_target_flags))
2676 2261639 : opts->x_target_flags |= MASK_NO_FANCY_MATH_387;
2677 :
2678 : /* Turn on MMX builtins for -msse. */
2679 50800218 : if (TARGET_SSE_P (opts->x_ix86_isa_flags))
2680 48598499 : opts->x_ix86_isa_flags
2681 48598499 : |= OPTION_MASK_ISA_MMX & ~opts->x_ix86_isa_flags_explicit;
2682 :
2683 : /* Enable SSE prefetch. */
2684 50800218 : if (TARGET_SSE_P (opts->x_ix86_isa_flags)
2685 2201719 : || (TARGET_PRFCHW_P (opts->x_ix86_isa_flags)
2686 18765 : && !TARGET_3DNOW_P (opts->x_ix86_isa_flags)))
2687 48617264 : ix86_prefetch_sse = true;
2688 :
2689 : /* Enable mwait/monitor instructions for -msse3. */
2690 50800218 : if (TARGET_SSE3_P (opts->x_ix86_isa_flags))
2691 48243829 : opts->x_ix86_isa_flags2
2692 48243829 : |= OPTION_MASK_ISA2_MWAIT & ~opts->x_ix86_isa_flags2_explicit;
2693 :
2694 : /* Enable popcnt instruction for -msse4.2 or -mabm. */
2695 50800218 : if (TARGET_SSE4_2_P (opts->x_ix86_isa_flags)
2696 2661453 : || TARGET_ABM_P (opts->x_ix86_isa_flags))
2697 48144848 : opts->x_ix86_isa_flags
2698 48144848 : |= OPTION_MASK_ISA_POPCNT & ~opts->x_ix86_isa_flags_explicit;
2699 :
2700 : /* Enable crc32 instruction for -msse4.2. */
2701 50800218 : if (TARGET_SSE4_2_P (opts->x_ix86_isa_flags))
2702 48138765 : opts->x_ix86_isa_flags
2703 48138765 : |= OPTION_MASK_ISA_CRC32 & ~opts->x_ix86_isa_flags_explicit;
2704 :
2705 : /* Enable lzcnt instruction for -mabm. */
2706 50800218 : if (TARGET_ABM_P(opts->x_ix86_isa_flags))
2707 70492 : opts->x_ix86_isa_flags
2708 70492 : |= OPTION_MASK_ISA_LZCNT & ~opts->x_ix86_isa_flags_explicit;
2709 :
2710 : /* Disable BMI, BMI2 and TBM instructions for -m16. */
2711 50800218 : if (TARGET_16BIT_P(opts->x_ix86_isa_flags))
2712 6 : opts->x_ix86_isa_flags
2713 6 : &= ~((OPTION_MASK_ISA_BMI | OPTION_MASK_ISA_BMI2 | OPTION_MASK_ISA_TBM)
2714 6 : & ~opts->x_ix86_isa_flags_explicit);
2715 :
2716 : /* Validate -mpreferred-stack-boundary= value or default it to
2717 : PREFERRED_STACK_BOUNDARY_DEFAULT. */
2718 50800218 : ix86_preferred_stack_boundary = PREFERRED_STACK_BOUNDARY_DEFAULT;
2719 50800218 : if (opts_set->x_ix86_preferred_stack_boundary_arg)
2720 : {
2721 1616 : int min = TARGET_64BIT_P (opts->x_ix86_isa_flags)? 3 : 2;
2722 1616 : int max = TARGET_SEH ? 4 : 12;
2723 :
2724 1616 : if (opts->x_ix86_preferred_stack_boundary_arg < min
2725 1616 : || opts->x_ix86_preferred_stack_boundary_arg > max)
2726 : {
2727 0 : if (min == max)
2728 : error ("%<-mpreferred-stack-boundary%> is not supported "
2729 : "for this target");
2730 : else
2731 0 : error ("%<-mpreferred-stack-boundary=%d%> is not between %d and %d",
2732 : opts->x_ix86_preferred_stack_boundary_arg, min, max);
2733 : }
2734 : else
2735 1616 : ix86_preferred_stack_boundary
2736 1616 : = (1 << opts->x_ix86_preferred_stack_boundary_arg) * BITS_PER_UNIT;
2737 : }
2738 :
2739 : /* Set the default value for -mstackrealign. */
2740 50800218 : SET_OPTION_IF_UNSET (opts, opts_set, ix86_force_align_arg_pointer,
2741 : STACK_REALIGN_DEFAULT);
2742 :
2743 50800218 : ix86_default_incoming_stack_boundary = PREFERRED_STACK_BOUNDARY;
2744 :
2745 : /* Validate -mincoming-stack-boundary= value or default it to
2746 : MIN_STACK_BOUNDARY/PREFERRED_STACK_BOUNDARY. */
2747 50800218 : ix86_incoming_stack_boundary = ix86_default_incoming_stack_boundary;
2748 50800218 : if (opts_set->x_ix86_incoming_stack_boundary_arg)
2749 : {
2750 15 : int min = TARGET_64BIT_P (opts->x_ix86_isa_flags) ? 3 : 2;
2751 :
2752 15 : if (opts->x_ix86_incoming_stack_boundary_arg < min
2753 15 : || opts->x_ix86_incoming_stack_boundary_arg > 12)
2754 0 : error ("%<-mincoming-stack-boundary=%d%> is not between %d and 12",
2755 : opts->x_ix86_incoming_stack_boundary_arg, min);
2756 : else
2757 : {
2758 15 : ix86_user_incoming_stack_boundary
2759 15 : = (1 << opts->x_ix86_incoming_stack_boundary_arg) * BITS_PER_UNIT;
2760 15 : ix86_incoming_stack_boundary
2761 15 : = ix86_user_incoming_stack_boundary;
2762 : }
2763 : }
2764 :
2765 : #ifndef NO_PROFILE_COUNTERS
2766 : if (flag_nop_mcount)
2767 : error ("%<-mnop-mcount%> is not compatible with this target");
2768 : #endif
2769 50800218 : if (flag_nop_mcount && flag_pic && !flag_plt)
2770 0 : error ("%<-mnop-mcount%> is not implemented for %<-fno-plt%>");
2771 :
2772 : /* Accept -msseregparm only if at least SSE support is enabled. */
2773 50800218 : if (TARGET_SSEREGPARM_P (opts->x_target_flags)
2774 0 : && ! TARGET_SSE_P (opts->x_ix86_isa_flags))
2775 0 : error (main_args_p
2776 : ? G_("%<-msseregparm%> used without SSE enabled")
2777 : : G_("%<target(\"sseregparm\")%> used without SSE enabled"));
2778 :
2779 50800218 : if (opts_set->x_ix86_fpmath)
2780 : {
2781 1347655 : if (opts->x_ix86_fpmath & FPMATH_SSE)
2782 : {
2783 1303827 : if (!TARGET_SSE_P (opts->x_ix86_isa_flags))
2784 : {
2785 45559 : if (TARGET_80387_P (opts->x_target_flags))
2786 : {
2787 0 : warning (0, "SSE instruction set disabled, using 387 arithmetics");
2788 0 : opts->x_ix86_fpmath = FPMATH_387;
2789 : }
2790 : }
2791 1258268 : else if ((opts->x_ix86_fpmath & FPMATH_387)
2792 89 : && !TARGET_80387_P (opts->x_target_flags))
2793 : {
2794 0 : warning (0, "387 instruction set disabled, using SSE arithmetics");
2795 0 : opts->x_ix86_fpmath = FPMATH_SSE;
2796 : }
2797 : }
2798 43828 : else if ((opts->x_ix86_fpmath & FPMATH_387)
2799 43828 : && !TARGET_80387_P (opts->x_target_flags)
2800 1423 : && TARGET_SSE_P (opts->x_ix86_isa_flags))
2801 : {
2802 1 : warning (0, "387 instruction set disabled, using SSE arithmetics");
2803 1 : opts->x_ix86_fpmath = FPMATH_SSE;
2804 : }
2805 : }
2806 : /* For all chips supporting SSE2, -mfpmath=sse performs better than
2807 : fpmath=387. The second is however default at many targets since the
2808 : extra 80bit precision of temporaries is considered to be part of ABI.
2809 : Overwrite the default at least for -ffast-math.
2810 : TODO: -mfpmath=both seems to produce same performing code with bit
2811 : smaller binaries. It is however not clear if register allocation is
2812 : ready for this setting.
2813 : Also -mfpmath=387 is overall a lot more compact (bout 4-5%) than SSE
2814 : codegen. We may switch to 387 with -ffast-math for size optimized
2815 : functions. */
2816 49452563 : else if (fast_math_flags_set_p (&global_options)
2817 49452563 : && TARGET_SSE2_P (opts->x_ix86_isa_flags))
2818 951772 : opts->x_ix86_fpmath = FPMATH_SSE;
2819 : else
2820 51269040 : opts->x_ix86_fpmath = TARGET_FPMATH_DEFAULT_P (opts->x_ix86_isa_flags);
2821 :
2822 : /* Use external vectorized library in vectorizing intrinsics. */
2823 50800218 : if (opts_set->x_ix86_veclibabi_type)
2824 9 : switch (opts->x_ix86_veclibabi_type)
2825 : {
2826 3 : case ix86_veclibabi_type_svml:
2827 3 : ix86_veclib_handler = &ix86_veclibabi_svml;
2828 3 : break;
2829 :
2830 2 : case ix86_veclibabi_type_acml:
2831 2 : ix86_veclib_handler = &ix86_veclibabi_acml;
2832 2 : break;
2833 :
2834 1 : case ix86_veclibabi_type_aocl:
2835 1 : ix86_veclib_handler = &ix86_veclibabi_aocl;
2836 1 : break;
2837 :
2838 3 : case ix86_veclibabi_type_hvml:
2839 3 : ix86_veclib_handler = &ix86_veclibabi_hvml;
2840 3 : break;
2841 :
2842 0 : default:
2843 0 : gcc_unreachable ();
2844 : }
2845 :
2846 50800218 : if (ix86_tune_features [X86_TUNE_ACCUMULATE_OUTGOING_ARGS]
2847 237429 : && !(opts_set->x_target_flags & MASK_ACCUMULATE_OUTGOING_ARGS))
2848 237429 : opts->x_target_flags |= MASK_ACCUMULATE_OUTGOING_ARGS;
2849 :
2850 : /* If stack probes are required, the space used for large function
2851 : arguments on the stack must also be probed, so enable
2852 : -maccumulate-outgoing-args so this happens in the prologue. */
2853 50800218 : if (TARGET_STACK_PROBE_P (opts->x_target_flags)
2854 22 : && !(opts->x_target_flags & MASK_ACCUMULATE_OUTGOING_ARGS))
2855 : {
2856 22 : if (opts_set->x_target_flags & MASK_ACCUMULATE_OUTGOING_ARGS)
2857 0 : warning (0,
2858 : main_args_p
2859 : ? G_("stack probing requires %<-maccumulate-outgoing-args%> "
2860 : "for correctness")
2861 : : G_("stack probing requires "
2862 : "%<target(\"accumulate-outgoing-args\")%> for "
2863 : "correctness"));
2864 22 : opts->x_target_flags |= MASK_ACCUMULATE_OUTGOING_ARGS;
2865 : }
2866 :
2867 : /* Stack realignment without -maccumulate-outgoing-args requires %ebp,
2868 : so enable -maccumulate-outgoing-args when %ebp is fixed. */
2869 50800218 : if (fixed_regs[BP_REG]
2870 3 : && !(opts->x_target_flags & MASK_ACCUMULATE_OUTGOING_ARGS))
2871 : {
2872 3 : if (opts_set->x_target_flags & MASK_ACCUMULATE_OUTGOING_ARGS)
2873 2 : warning (0,
2874 : main_args_p
2875 : ? G_("fixed ebp register requires "
2876 : "%<-maccumulate-outgoing-args%>")
2877 : : G_("fixed ebp register requires "
2878 : "%<target(\"accumulate-outgoing-args\")%>"));
2879 3 : opts->x_target_flags |= MASK_ACCUMULATE_OUTGOING_ARGS;
2880 : }
2881 :
2882 : /* Figure out what ASM_GENERATE_INTERNAL_LABEL builds as a prefix. */
2883 50800218 : {
2884 50800218 : char *p;
2885 50800218 : ASM_GENERATE_INTERNAL_LABEL (internal_label_prefix, "LX", 0);
2886 50800218 : p = strchr (internal_label_prefix, 'X');
2887 50800218 : internal_label_prefix_len = p - internal_label_prefix;
2888 50800218 : *p = '\0';
2889 : }
2890 :
2891 : /* When scheduling description is not available, disable scheduler pass
2892 : so it won't slow down the compilation and make x87 code slower. */
2893 50800218 : if (!TARGET_SCHEDULE)
2894 12 : opts->x_flag_schedule_insns_after_reload = opts->x_flag_schedule_insns = 0;
2895 :
2896 50800218 : SET_OPTION_IF_UNSET (opts, opts_set, param_simultaneous_prefetches,
2897 : ix86_tune_cost->simultaneous_prefetches);
2898 50800218 : SET_OPTION_IF_UNSET (opts, opts_set, param_l1_cache_line_size,
2899 : ix86_tune_cost->prefetch_block);
2900 50800218 : SET_OPTION_IF_UNSET (opts, opts_set, param_l1_cache_size,
2901 : ix86_tune_cost->l1_cache_size);
2902 50800218 : SET_OPTION_IF_UNSET (opts, opts_set, param_l2_cache_size,
2903 : ix86_tune_cost->l2_cache_size);
2904 :
2905 : /* 64B is the accepted value for these for all x86. */
2906 50800218 : SET_OPTION_IF_UNSET (&global_options, &global_options_set,
2907 : param_destruct_interfere_size, 64);
2908 50800218 : SET_OPTION_IF_UNSET (&global_options, &global_options_set,
2909 : param_construct_interfere_size, 64);
2910 :
2911 : /* Enable sw prefetching at -O3 for CPUS that prefetching is helpful. */
2912 50800218 : if (opts->x_flag_prefetch_loop_arrays < 0
2913 50800159 : && HAVE_prefetch
2914 50800133 : && (opts->x_optimize >= 3 || opts->x_flag_profile_use)
2915 2534754 : && !opts->x_optimize_size
2916 2534750 : && TARGET_SOFTWARE_PREFETCHING_BENEFICIAL)
2917 50 : opts->x_flag_prefetch_loop_arrays = 1;
2918 :
2919 : /* If using typedef char *va_list, signal that __builtin_va_start (&ap, 0)
2920 : can be opts->x_optimized to ap = __builtin_next_arg (0). */
2921 50800218 : if (!TARGET_64BIT_P (opts->x_ix86_isa_flags) && !opts->x_flag_split_stack)
2922 15503 : targetm.expand_builtin_va_start = NULL;
2923 :
2924 : #ifdef USE_IX86_CLD
2925 : /* Use -mcld by default for 32-bit code if configured with --enable-cld. */
2926 : if (!TARGET_64BIT_P (opts->x_ix86_isa_flags))
2927 : opts->x_target_flags |= MASK_CLD & ~opts_set->x_target_flags;
2928 : #endif
2929 :
2930 : /* Set the default value for -mfentry. */
2931 50800218 : if (!opts_set->x_flag_fentry)
2932 50800165 : opts->x_flag_fentry = (TARGET_SEH
2933 50800165 : || (TARGET_64BIT_P (opts->x_ix86_isa_flags)
2934 : && ENABLE_X86_64_MFENTRY));
2935 : else
2936 : {
2937 53 : if (!TARGET_64BIT_P (opts->x_ix86_isa_flags) && opts->x_flag_pic
2938 0 : && opts->x_flag_fentry)
2939 0 : sorry ("%<-mfentry%> isn%'t supported for 32-bit in combination "
2940 : "with %<-fpic%>");
2941 : else if (TARGET_SEH && !opts->x_flag_fentry)
2942 : sorry ("%<-mno-fentry%> isn%'t compatible with SEH");
2943 : }
2944 :
2945 : #ifdef OPTION_GLIBC_P
2946 : /* -mfentry is supported only on glibc targets. */
2947 50800218 : if (!opts->x_flag_fentry
2948 627548 : && OPTION_GLIBC_P (opts)
2949 627548 : && (TARGET_64BIT_P (opts->x_ix86_isa_flags) || !opts->x_flag_pic)
2950 314429 : && opts->x_flag_shrink_wrap
2951 313934 : && opts->x_profile_flag)
2952 2 : warning (0, "%<-pg%> without %<-mfentry%> may be unreliable with "
2953 : "shrink wrapping");
2954 : #endif
2955 :
2956 50800218 : if (TARGET_SEH && TARGET_CALL_MS2SYSV_XLOGUES)
2957 : sorry ("%<-mcall-ms2sysv-xlogues%> isn%'t currently supported with SEH");
2958 :
2959 50800218 : if (!(opts_set->x_target_flags & MASK_VZEROUPPER)
2960 50590733 : && flag_expensive_optimizations
2961 46873861 : && !optimize_size)
2962 46152869 : opts->x_target_flags |= MASK_VZEROUPPER;
2963 50800218 : if (!(opts_set->x_target_flags & MASK_STV))
2964 50794856 : opts->x_target_flags |= MASK_STV;
2965 : /* Disable STV if -mpreferred-stack-boundary={2,3} or
2966 : -mincoming-stack-boundary={2,3} or -mstackrealign - the needed
2967 : stack realignment will be extra cost the pass doesn't take into
2968 : account and the pass can't realign the stack. */
2969 50800218 : if (ix86_preferred_stack_boundary < 128
2970 50800210 : || ix86_incoming_stack_boundary < 128
2971 50800209 : || opts->x_ix86_force_align_arg_pointer)
2972 1617 : opts->x_target_flags &= ~MASK_STV;
2973 50800218 : if (!ix86_tune_features[X86_TUNE_AVX256_UNALIGNED_LOAD_OPTIMAL]
2974 14945 : && !(opts_set->x_target_flags & MASK_AVX256_SPLIT_UNALIGNED_LOAD))
2975 14945 : opts->x_target_flags |= MASK_AVX256_SPLIT_UNALIGNED_LOAD;
2976 50785273 : else if (!main_args_p
2977 50489528 : && ix86_tune_features[X86_TUNE_AVX256_UNALIGNED_LOAD_OPTIMAL])
2978 50489528 : opts->x_target_flags &= ~MASK_AVX256_SPLIT_UNALIGNED_LOAD;
2979 :
2980 50800218 : if (!ix86_tune_features[X86_TUNE_AVX256_UNALIGNED_STORE_OPTIMAL]
2981 15701 : && !(opts_set->x_target_flags & MASK_AVX256_SPLIT_UNALIGNED_STORE))
2982 15701 : opts->x_target_flags |= MASK_AVX256_SPLIT_UNALIGNED_STORE;
2983 50784517 : else if (!main_args_p
2984 50488821 : && ix86_tune_features[X86_TUNE_AVX256_UNALIGNED_STORE_OPTIMAL])
2985 50488821 : opts->x_target_flags &= ~MASK_AVX256_SPLIT_UNALIGNED_STORE;
2986 :
2987 : /* Enable 128-bit AVX instruction generation
2988 : for the auto-vectorizer. */
2989 50800218 : if (ix86_tune_features[X86_TUNE_AVX128_OPTIMAL]
2990 853 : && (opts_set->x_prefer_vector_width_type == PVW_NONE))
2991 842 : opts->x_prefer_vector_width_type = PVW_AVX128;
2992 :
2993 : /* Use 256-bit AVX instruction generation
2994 : in the auto-vectorizer. */
2995 50800218 : if (ix86_tune_features[X86_TUNE_AVX256_OPTIMAL]
2996 230393 : && (opts_set->x_prefer_vector_width_type == PVW_NONE))
2997 95222 : opts->x_prefer_vector_width_type = PVW_AVX256;
2998 :
2999 50800218 : if (opts_set->x_ix86_move_max == PVW_NONE)
3000 : {
3001 : /* Set the maximum number of bits can be moved from memory to
3002 : memory efficiently. */
3003 50800205 : if (opts_set->x_prefer_vector_width_type != PVW_NONE)
3004 1152140 : opts->x_ix86_move_max = opts->x_prefer_vector_width_type;
3005 49648065 : else if (ix86_tune_features[X86_TUNE_AVX512_MOVE_BY_PIECES])
3006 4712 : opts->x_ix86_move_max = PVW_AVX512;
3007 49643353 : else if (ix86_tune_features[X86_TUNE_AVX256_MOVE_BY_PIECES])
3008 422063 : opts->x_ix86_move_max = PVW_AVX256;
3009 : else
3010 : {
3011 49221290 : opts->x_ix86_move_max = opts->x_prefer_vector_width_type;
3012 49221290 : if (opts->x_ix86_move_max == PVW_NONE)
3013 : {
3014 49220514 : if (TARGET_AVX512F_P (opts->x_ix86_isa_flags))
3015 45267281 : opts->x_ix86_move_max = PVW_AVX512;
3016 : /* Align with vectorizer to avoid potential STLF issue. */
3017 3953233 : else if (TARGET_AVX_P (opts->x_ix86_isa_flags))
3018 1347286 : opts->x_ix86_move_max = PVW_AVX256;
3019 : else
3020 2605947 : opts->x_ix86_move_max = PVW_AVX128;
3021 : }
3022 : }
3023 : }
3024 :
3025 50800218 : if (opts->x_ix86_recip_name)
3026 : {
3027 0 : char *p = ASTRDUP (opts->x_ix86_recip_name);
3028 0 : char *q;
3029 0 : unsigned int mask;
3030 0 : bool invert;
3031 :
3032 0 : while ((q = strtok (p, ",")) != NULL)
3033 : {
3034 0 : p = NULL;
3035 0 : if (*q == '!')
3036 : {
3037 0 : invert = true;
3038 0 : q++;
3039 : }
3040 : else
3041 : invert = false;
3042 :
3043 0 : if (!strcmp (q, "default"))
3044 : mask = RECIP_MASK_ALL;
3045 : else
3046 : {
3047 0 : for (i = 0; i < ARRAY_SIZE (recip_options); i++)
3048 0 : if (!strcmp (q, recip_options[i].string))
3049 : {
3050 0 : mask = recip_options[i].mask;
3051 0 : break;
3052 : }
3053 :
3054 0 : if (i == ARRAY_SIZE (recip_options))
3055 : {
3056 0 : error ("unknown option for %<-mrecip=%s%>", q);
3057 0 : invert = false;
3058 0 : mask = RECIP_MASK_NONE;
3059 : }
3060 : }
3061 :
3062 0 : opts->x_recip_mask_explicit |= mask;
3063 0 : if (invert)
3064 0 : opts->x_recip_mask &= ~mask;
3065 : else
3066 0 : opts->x_recip_mask |= mask;
3067 : }
3068 : }
3069 :
3070 50800218 : if (TARGET_RECIP_P (opts->x_target_flags))
3071 13479 : opts->x_recip_mask |= RECIP_MASK_ALL & ~opts->x_recip_mask_explicit;
3072 50786739 : else if (opts_set->x_target_flags & MASK_RECIP)
3073 2 : opts->x_recip_mask &= ~(RECIP_MASK_ALL & ~opts->x_recip_mask_explicit);
3074 :
3075 : /* Default long double to 64-bit for 32-bit Bionic and to __float128
3076 : for 64-bit Bionic. Also default long double to 64-bit for Intel
3077 : MCU psABI. */
3078 50800218 : if ((TARGET_HAS_BIONIC || TARGET_IAMCU)
3079 8 : && !(opts_set->x_target_flags
3080 : & (MASK_LONG_DOUBLE_64 | MASK_LONG_DOUBLE_128)))
3081 2 : opts->x_target_flags |= (TARGET_64BIT
3082 2 : ? MASK_LONG_DOUBLE_128
3083 : : MASK_LONG_DOUBLE_64);
3084 :
3085 : /* Only one of them can be active. */
3086 50800218 : gcc_assert ((opts->x_target_flags & MASK_LONG_DOUBLE_64) == 0
3087 : || (opts->x_target_flags & MASK_LONG_DOUBLE_128) == 0);
3088 :
3089 : /* Handle stack protector */
3090 50800218 : if (!opts_set->x_ix86_stack_protector_guard)
3091 : {
3092 : #ifdef TARGET_THREAD_SSP_OFFSET
3093 50800182 : if (!TARGET_HAS_BIONIC)
3094 50800174 : opts->x_ix86_stack_protector_guard = SSP_TLS;
3095 : else
3096 : #endif
3097 8 : opts->x_ix86_stack_protector_guard = SSP_GLOBAL;
3098 : }
3099 :
3100 50800218 : if (opts_set->x_ix86_stack_protector_guard_offset_str)
3101 : {
3102 1 : char *endp;
3103 1 : const char *str = opts->x_ix86_stack_protector_guard_offset_str;
3104 :
3105 1 : errno = 0;
3106 1 : int64_t offset;
3107 :
3108 : #if defined(INT64_T_IS_LONG)
3109 1 : offset = strtol (str, &endp, 0);
3110 : #else
3111 : offset = strtoll (str, &endp, 0);
3112 : #endif
3113 :
3114 1 : if (!*str || *endp || errno)
3115 0 : error ("%qs is not a valid number "
3116 : "in %<-mstack-protector-guard-offset=%>", str);
3117 :
3118 1 : if (!IN_RANGE (offset, HOST_WIDE_INT_C (-0x80000000),
3119 : HOST_WIDE_INT_C (0x7fffffff)))
3120 0 : error ("%qs is not a valid offset "
3121 : "in %<-mstack-protector-guard-offset=%>", str);
3122 :
3123 1 : opts->x_ix86_stack_protector_guard_offset = offset;
3124 : }
3125 : #ifdef TARGET_THREAD_SSP_OFFSET
3126 : else
3127 100972798 : opts->x_ix86_stack_protector_guard_offset = TARGET_THREAD_SSP_OFFSET;
3128 : #endif
3129 :
3130 50800218 : if (opts_set->x_ix86_stack_protector_guard_reg_str)
3131 : {
3132 2 : const char *str = opts->x_ix86_stack_protector_guard_reg_str;
3133 2 : addr_space_t seg = ADDR_SPACE_GENERIC;
3134 :
3135 : /* Discard optional register prefix. */
3136 2 : if (str[0] == '%')
3137 0 : str++;
3138 :
3139 2 : if (strlen (str) == 2 && str[1] == 's')
3140 : {
3141 2 : if (str[0] == 'f')
3142 : seg = ADDR_SPACE_SEG_FS;
3143 2 : else if (str[0] == 'g')
3144 : seg = ADDR_SPACE_SEG_GS;
3145 : }
3146 :
3147 : if (seg == ADDR_SPACE_GENERIC)
3148 0 : error ("%qs is not a valid base register "
3149 : "in %<-mstack-protector-guard-reg=%>",
3150 : opts->x_ix86_stack_protector_guard_reg_str);
3151 :
3152 2 : opts->x_ix86_stack_protector_guard_reg = seg;
3153 : }
3154 : else
3155 : {
3156 50800216 : opts->x_ix86_stack_protector_guard_reg = DEFAULT_TLS_SEG_REG;
3157 :
3158 : /* The kernel uses a different segment register for performance
3159 : reasons; a system call would not have to trash the userspace
3160 : segment register, which would be expensive. */
3161 50800216 : if (opts->x_ix86_cmodel == CM_KERNEL)
3162 1 : opts->x_ix86_stack_protector_guard_reg = ADDR_SPACE_SEG_GS;
3163 : }
3164 :
3165 : /* Handle -mmemcpy-strategy= and -mmemset-strategy= */
3166 50800218 : if (opts->x_ix86_tune_memcpy_strategy)
3167 : {
3168 18 : char *str = xstrdup (opts->x_ix86_tune_memcpy_strategy);
3169 18 : ix86_parse_stringop_strategy_string (str, false);
3170 18 : free (str);
3171 : }
3172 :
3173 50800218 : if (opts->x_ix86_tune_memset_strategy)
3174 : {
3175 34 : char *str = xstrdup (opts->x_ix86_tune_memset_strategy);
3176 34 : ix86_parse_stringop_strategy_string (str, true);
3177 34 : free (str);
3178 : }
3179 :
3180 : /* Save the initial options in case the user does function specific
3181 : options. */
3182 50800218 : if (main_args_p)
3183 : {
3184 295801 : opts->x_ix86_excess_precision
3185 295801 : = opts->x_flag_excess_precision;
3186 295801 : opts->x_ix86_unsafe_math_optimizations
3187 295801 : = opts->x_flag_unsafe_math_optimizations;
3188 591602 : target_option_default_node = target_option_current_node
3189 295801 : = build_target_option_node (opts, opts_set);
3190 : }
3191 :
3192 50800218 : const bool cf_okay_p = (TARGET_64BIT || TARGET_CMOV);
3193 : /* When -fhardened, enable -fcf-protection=full, but only when it's
3194 : compatible with this target, and when it wasn't already specified
3195 : on the command line. */
3196 50800218 : if (opts->x_flag_hardened && cf_okay_p)
3197 : {
3198 92 : if (!opts_set->x_flag_cf_protection)
3199 91 : opts->x_flag_cf_protection = CF_FULL;
3200 1 : else if (opts->x_flag_cf_protection != CF_FULL)
3201 1 : warning_at (UNKNOWN_LOCATION, OPT_Whardened,
3202 : "%<-fcf-protection=full%> is not enabled by "
3203 : "%<-fhardened%> because it was specified on the command "
3204 : "line");
3205 : }
3206 :
3207 50800218 : if (opts->x_flag_cf_protection != CF_NONE)
3208 : {
3209 43368 : if ((opts->x_flag_cf_protection & CF_BRANCH) == CF_BRANCH
3210 43236 : && !cf_okay_p)
3211 0 : error ("%<-fcf-protection%> is not compatible with this target");
3212 :
3213 43368 : opts->x_flag_cf_protection
3214 43368 : = (cf_protection_level) (opts->x_flag_cf_protection | CF_SET);
3215 : }
3216 :
3217 50800218 : if (ix86_tune_features [X86_TUNE_AVOID_512FMA_CHAINS])
3218 115 : SET_OPTION_IF_UNSET (opts, opts_set, param_avoid_fma_max_bits, 512);
3219 50800103 : else if (ix86_tune_features [X86_TUNE_AVOID_256FMA_CHAINS])
3220 50027056 : SET_OPTION_IF_UNSET (opts, opts_set, param_avoid_fma_max_bits, 256);
3221 773047 : else if (ix86_tune_features [X86_TUNE_AVOID_128FMA_CHAINS])
3222 116 : SET_OPTION_IF_UNSET (opts, opts_set, param_avoid_fma_max_bits, 128);
3223 :
3224 : /* PR86952: jump table usage with retpolines is slow.
3225 : The PR provides some numbers about the slowness. */
3226 50800218 : if (ix86_indirect_branch != indirect_branch_keep)
3227 49 : SET_OPTION_IF_UNSET (opts, opts_set, flag_jump_tables, 0);
3228 :
3229 50800218 : SET_OPTION_IF_UNSET (opts, opts_set, param_ira_consider_dup_in_all_alts, 0);
3230 :
3231 : /* Fully masking the main or the epilogue vectorized loop is not
3232 : profitable generally so leave it disabled until we get more
3233 : fine grained control & costing. */
3234 50800218 : SET_OPTION_IF_UNSET (opts, opts_set, param_vect_partial_vector_usage, 0);
3235 :
3236 : return true;
3237 : }
3238 :
3239 : /* Implement the TARGET_OPTION_OVERRIDE hook. */
3240 :
3241 : void
3242 295802 : ix86_option_override (void)
3243 : {
3244 295802 : ix86_option_override_internal (true, &global_options, &global_options_set);
3245 295802 : }
3246 :
3247 : /* Remember the last target of ix86_set_current_function. */
3248 : static GTY(()) tree ix86_previous_fndecl;
3249 :
3250 : /* Set targets globals to the default (or current #pragma GCC target
3251 : if active). Invalidate ix86_previous_fndecl cache. */
3252 :
3253 : void
3254 2377496 : ix86_reset_previous_fndecl (void)
3255 : {
3256 2377496 : tree new_tree = target_option_current_node;
3257 2377496 : cl_target_option_restore (&global_options, &global_options_set,
3258 2377496 : TREE_TARGET_OPTION (new_tree));
3259 2377496 : if (TREE_TARGET_GLOBALS (new_tree))
3260 590209 : restore_target_globals (TREE_TARGET_GLOBALS (new_tree));
3261 1787287 : else if (new_tree == target_option_default_node)
3262 1297025 : restore_target_globals (&default_target_globals);
3263 : else
3264 490262 : TREE_TARGET_GLOBALS (new_tree) = save_target_globals_default_opts ();
3265 2377496 : ix86_previous_fndecl = NULL_TREE;
3266 2377496 : }
3267 :
3268 : /* Add target attribute to SIMD clone NODE if needed. */
3269 :
3270 : void
3271 7365 : ix86_simd_clone_adjust (struct cgraph_node *node)
3272 : {
3273 7365 : const char *str = NULL;
3274 :
3275 : /* Attributes need to be adjusted for definitions, not declarations. */
3276 7365 : if (!node->definition)
3277 : return;
3278 :
3279 4517 : gcc_assert (node->decl == cfun->decl);
3280 4517 : switch (node->simdclone->vecsize_mangle)
3281 : {
3282 1127 : case 'b':
3283 1127 : if (!TARGET_SSE2)
3284 : str = "sse2";
3285 : break;
3286 1187 : case 'c':
3287 1187 : if (TARGET_PREFER_AVX128)
3288 : {
3289 1 : if (!TARGET_AVX)
3290 : str = "avx,prefer-vector-width=256";
3291 : else
3292 : str = "prefer-vector-width=256";
3293 : }
3294 1186 : else if (!TARGET_AVX)
3295 : str = "avx";
3296 : break;
3297 1102 : case 'd':
3298 1102 : if (TARGET_PREFER_AVX128)
3299 : {
3300 1 : if (!TARGET_AVX2)
3301 : str = "avx2,prefer-vector-width=256";
3302 : else
3303 : str = "prefer-vector-width=256";
3304 : }
3305 1101 : else if (!TARGET_AVX2)
3306 : str = "avx2";
3307 : break;
3308 1101 : case 'e':
3309 1101 : if (TARGET_PREFER_AVX256)
3310 : {
3311 4 : if (!TARGET_AVX512F)
3312 : str = "avx512f,prefer-vector-width=512";
3313 : else
3314 2 : str = "prefer-vector-width=512";
3315 : }
3316 1097 : else if (!TARGET_AVX512F)
3317 : str = "avx512f";
3318 : break;
3319 0 : default:
3320 0 : gcc_unreachable ();
3321 : }
3322 2 : if (str == NULL)
3323 : return;
3324 2895 : push_cfun (NULL);
3325 2895 : tree args = build_tree_list (NULL_TREE, build_string (strlen (str), str));
3326 2895 : bool ok = ix86_valid_target_attribute_p (node->decl, NULL, args, 0);
3327 2895 : gcc_assert (ok);
3328 2895 : pop_cfun ();
3329 2895 : ix86_reset_previous_fndecl ();
3330 2895 : ix86_set_current_function (node->decl);
3331 : }
3332 :
3333 : /* Return the call_saved_registers_type for function type FNTYPE.
3334 : If LOC is nonnull, report incompatible attributes against that
3335 : location, otherwise remain silent. */
3336 :
3337 : call_saved_registers_type
3338 634879659 : ix86_fntype_call_saved_registers (const_tree fntype, location_t *loc)
3339 : {
3340 634879659 : auto call_saved_registers = TYPE_DEFAULT_CALL_SAVED_REGISTERS;
3341 634879659 : const char *interrupt_conflict = nullptr;
3342 634879659 : if (lookup_attribute ("preserve_none", TYPE_ATTRIBUTES (fntype)))
3343 : {
3344 : call_saved_registers = TYPE_PRESERVE_NONE;
3345 : interrupt_conflict = "preserve_none";
3346 : }
3347 634877501 : else if (lookup_attribute ("no_callee_saved_registers",
3348 634877501 : TYPE_ATTRIBUTES (fntype)))
3349 : {
3350 : call_saved_registers = TYPE_NO_CALLEE_SAVED_REGISTERS;
3351 : interrupt_conflict = "no_callee_saved_registers";
3352 : }
3353 634876259 : else if (lookup_attribute ("no_caller_saved_registers",
3354 634876259 : TYPE_ATTRIBUTES (fntype)))
3355 3635 : call_saved_registers = TYPE_NO_CALLER_SAVED_REGISTERS;
3356 :
3357 634879659 : if (lookup_attribute ("interrupt", TYPE_ATTRIBUTES (fntype)))
3358 : {
3359 281 : if (loc && interrupt_conflict)
3360 2 : error_at (*loc, "%qs and %qs attributes are not compatible",
3361 : "interrupt", interrupt_conflict);
3362 : return TYPE_NO_CALLER_SAVED_REGISTERS;
3363 : }
3364 :
3365 : return call_saved_registers;
3366 : }
3367 :
3368 : /* Set the func_type field from the function FNDECL. */
3369 :
3370 : static void
3371 413999471 : ix86_set_func_type (tree fndecl)
3372 : {
3373 413999471 : if (cfun->machine->func_type != TYPE_UNKNOWN)
3374 : return;
3375 :
3376 416644112 : cfun->machine->call_saved_registers
3377 208322056 : = ix86_fntype_call_saved_registers (TREE_TYPE (fndecl),
3378 208322056 : &DECL_SOURCE_LOCATION (fndecl));
3379 :
3380 : /* No need to save and restore callee-saved registers for a noreturn
3381 : function with nothrow or compiled with -fno-exceptions unless when
3382 : compiling with -O0 or -Og, except that it interferes with debugging
3383 : of callers. So that backtrace works for those at least
3384 : in most cases, save the bp register if it is used, because it often
3385 : is used in callers to compute CFA.
3386 :
3387 : NB: Can't use just TREE_THIS_VOLATILE to check if this is a noreturn
3388 : function. The local-pure-const pass turns an interrupt function
3389 : into a noreturn function by setting TREE_THIS_VOLATILE. Normally
3390 : the local-pure-const pass is run after ix86_set_func_type is called.
3391 : When the local-pure-const pass is enabled for LTO, the interrupt
3392 : function is marked with TREE_THIS_VOLATILE in the IR output, which
3393 : leads to the incompatible attribute error in LTO1. Ignore the
3394 : interrupt function in this case. */
3395 208322056 : if (cfun->machine->call_saved_registers == TYPE_DEFAULT_CALL_SAVED_REGISTERS
3396 208321753 : && ix86_noreturn_no_callee_saved_registers
3397 11 : && TREE_THIS_VOLATILE (fndecl)
3398 11 : && optimize
3399 10 : && !optimize_debug
3400 9 : && (TREE_NOTHROW (fndecl) || !flag_exceptions))
3401 9 : cfun->machine->call_saved_registers = TYPE_NO_CALLEE_SAVED_REGISTERS;
3402 :
3403 208322056 : if (lookup_attribute ("interrupt",
3404 208322056 : TYPE_ATTRIBUTES (TREE_TYPE (fndecl))))
3405 : {
3406 154 : if (ix86_function_naked (fndecl))
3407 1 : error_at (DECL_SOURCE_LOCATION (fndecl),
3408 : "interrupt and naked attributes are not compatible");
3409 :
3410 154 : int nargs = 0;
3411 154 : for (tree arg = DECL_ARGUMENTS (fndecl);
3412 389 : arg;
3413 235 : arg = TREE_CHAIN (arg))
3414 235 : nargs++;
3415 154 : cfun->machine->func_type = nargs == 2 ? TYPE_EXCEPTION : TYPE_INTERRUPT;
3416 :
3417 154 : ix86_optimize_mode_switching[X86_DIRFLAG] = 1;
3418 :
3419 : /* Only dwarf2out.cc can handle -WORD(AP) as a pointer argument. */
3420 154 : if (write_symbols != NO_DEBUG && write_symbols != DWARF2_DEBUG)
3421 0 : sorry ("only DWARF debug format is supported for interrupt "
3422 : "service routine");
3423 : }
3424 : else
3425 208321902 : cfun->machine->func_type = TYPE_NORMAL;
3426 : }
3427 :
3428 : /* Set the indirect_branch_type field from the function FNDECL. */
3429 :
3430 : static void
3431 413999471 : ix86_set_indirect_branch_type (tree fndecl)
3432 : {
3433 413999471 : if (cfun->machine->indirect_branch_type == indirect_branch_unset)
3434 : {
3435 208322056 : tree attr = lookup_attribute ("indirect_branch",
3436 208322056 : DECL_ATTRIBUTES (fndecl));
3437 208322056 : if (attr != NULL)
3438 : {
3439 17 : tree args = TREE_VALUE (attr);
3440 17 : if (args == NULL)
3441 0 : gcc_unreachable ();
3442 17 : tree cst = TREE_VALUE (args);
3443 17 : if (strcmp (TREE_STRING_POINTER (cst), "keep") == 0)
3444 2 : cfun->machine->indirect_branch_type = indirect_branch_keep;
3445 15 : else if (strcmp (TREE_STRING_POINTER (cst), "thunk") == 0)
3446 5 : cfun->machine->indirect_branch_type = indirect_branch_thunk;
3447 10 : else if (strcmp (TREE_STRING_POINTER (cst), "thunk-inline") == 0)
3448 3 : cfun->machine->indirect_branch_type = indirect_branch_thunk_inline;
3449 7 : else if (strcmp (TREE_STRING_POINTER (cst), "thunk-extern") == 0)
3450 7 : cfun->machine->indirect_branch_type = indirect_branch_thunk_extern;
3451 : else
3452 0 : gcc_unreachable ();
3453 : }
3454 : else
3455 208322039 : cfun->machine->indirect_branch_type = ix86_indirect_branch;
3456 :
3457 : /* -mcmodel=large is not compatible with -mindirect-branch=thunk
3458 : nor -mindirect-branch=thunk-extern. */
3459 208322056 : if ((ix86_cmodel == CM_LARGE || ix86_cmodel == CM_LARGE_PIC)
3460 7672 : && ((cfun->machine->indirect_branch_type
3461 7672 : == indirect_branch_thunk_extern)
3462 7670 : || (cfun->machine->indirect_branch_type
3463 : == indirect_branch_thunk)))
3464 6 : error ("%<-mindirect-branch=%s%> and %<-mcmodel=large%> are not "
3465 : "compatible",
3466 : ((cfun->machine->indirect_branch_type
3467 : == indirect_branch_thunk_extern)
3468 : ? "thunk-extern" : "thunk"));
3469 :
3470 208322056 : if (cfun->machine->indirect_branch_type != indirect_branch_keep
3471 78 : && (cfun->machine->indirect_branch_type
3472 : != indirect_branch_thunk_extern)
3473 52 : && (flag_cf_protection & CF_RETURN))
3474 3 : error ("%<-mindirect-branch%> and %<-fcf-protection%> are not "
3475 : "compatible");
3476 : }
3477 :
3478 413999471 : if (cfun->machine->function_return_type == indirect_branch_unset)
3479 : {
3480 208322056 : tree attr = lookup_attribute ("function_return",
3481 208322056 : DECL_ATTRIBUTES (fndecl));
3482 208322056 : if (attr != NULL)
3483 : {
3484 12 : tree args = TREE_VALUE (attr);
3485 12 : if (args == NULL)
3486 0 : gcc_unreachable ();
3487 12 : tree cst = TREE_VALUE (args);
3488 12 : if (strcmp (TREE_STRING_POINTER (cst), "keep") == 0)
3489 2 : cfun->machine->function_return_type = indirect_branch_keep;
3490 10 : else if (strcmp (TREE_STRING_POINTER (cst), "thunk") == 0)
3491 4 : cfun->machine->function_return_type = indirect_branch_thunk;
3492 6 : else if (strcmp (TREE_STRING_POINTER (cst), "thunk-inline") == 0)
3493 3 : cfun->machine->function_return_type = indirect_branch_thunk_inline;
3494 3 : else if (strcmp (TREE_STRING_POINTER (cst), "thunk-extern") == 0)
3495 3 : cfun->machine->function_return_type = indirect_branch_thunk_extern;
3496 : else
3497 0 : gcc_unreachable ();
3498 : }
3499 : else
3500 208322044 : cfun->machine->function_return_type = ix86_function_return;
3501 :
3502 : /* -mcmodel=large is not compatible with -mfunction-return=thunk
3503 : nor -mfunction-return=thunk-extern. */
3504 208322056 : if ((ix86_cmodel == CM_LARGE || ix86_cmodel == CM_LARGE_PIC)
3505 7672 : && ((cfun->machine->function_return_type
3506 7672 : == indirect_branch_thunk_extern)
3507 7670 : || (cfun->machine->function_return_type
3508 : == indirect_branch_thunk)))
3509 6 : error ("%<-mfunction-return=%s%> and %<-mcmodel=large%> are not "
3510 : "compatible",
3511 : ((cfun->machine->function_return_type
3512 : == indirect_branch_thunk_extern)
3513 : ? "thunk-extern" : "thunk"));
3514 :
3515 208322056 : if (cfun->machine->function_return_type != indirect_branch_keep
3516 32 : && (cfun->machine->function_return_type
3517 : != indirect_branch_thunk_extern)
3518 24 : && (flag_cf_protection & CF_RETURN))
3519 3 : error ("%<-mfunction-return%> and %<-fcf-protection%> are not "
3520 : "compatible");
3521 : }
3522 413999471 : }
3523 :
3524 : /* Establish appropriate back-end context for processing the function
3525 : FNDECL. The argument might be NULL to indicate processing at top
3526 : level, outside of any function scope. */
3527 : void
3528 822522787 : ix86_set_current_function (tree fndecl)
3529 : {
3530 : /* Only change the context if the function changes. This hook is called
3531 : several times in the course of compiling a function, and we don't want to
3532 : slow things down too much or call target_reinit when it isn't safe. */
3533 822522787 : if (fndecl == ix86_previous_fndecl)
3534 : {
3535 : /* There may be 2 function bodies for the same function FNDECL,
3536 : one is extern inline and one isn't. Call ix86_set_func_type
3537 : to set the func_type field. */
3538 95994061 : if (fndecl != NULL_TREE)
3539 : {
3540 95994012 : ix86_set_func_type (fndecl);
3541 95994012 : ix86_set_indirect_branch_type (fndecl);
3542 : }
3543 : return;
3544 : }
3545 :
3546 726528726 : tree old_tree;
3547 726528726 : if (ix86_previous_fndecl == NULL_TREE)
3548 2058637 : old_tree = target_option_current_node;
3549 724470089 : else if (DECL_FUNCTION_SPECIFIC_TARGET (ix86_previous_fndecl))
3550 : old_tree = DECL_FUNCTION_SPECIFIC_TARGET (ix86_previous_fndecl);
3551 : else
3552 663298075 : old_tree = target_option_default_node;
3553 :
3554 726528726 : if (fndecl == NULL_TREE)
3555 : {
3556 408523267 : if (old_tree != target_option_current_node)
3557 1243679 : ix86_reset_previous_fndecl ();
3558 : return;
3559 : }
3560 :
3561 318005459 : ix86_set_func_type (fndecl);
3562 318005459 : ix86_set_indirect_branch_type (fndecl);
3563 :
3564 318005459 : tree new_tree = DECL_FUNCTION_SPECIFIC_TARGET (fndecl);
3565 318005459 : if (new_tree == NULL_TREE)
3566 286776683 : new_tree = target_option_default_node;
3567 :
3568 318005459 : bool fp_flag_change
3569 318005459 : = (flag_unsafe_math_optimizations
3570 318005459 : != TREE_TARGET_OPTION (new_tree)->x_ix86_unsafe_math_optimizations
3571 318005459 : || (flag_excess_precision
3572 318005346 : != TREE_TARGET_OPTION (new_tree)->x_ix86_excess_precision));
3573 318005459 : if (old_tree != new_tree || fp_flag_change)
3574 : {
3575 1243754 : cl_target_option_restore (&global_options, &global_options_set,
3576 1243754 : TREE_TARGET_OPTION (new_tree));
3577 1243754 : if (fp_flag_change)
3578 : {
3579 113 : ix86_excess_precision = flag_excess_precision;
3580 113 : ix86_unsafe_math_optimizations = flag_unsafe_math_optimizations;
3581 113 : DECL_FUNCTION_SPECIFIC_TARGET (fndecl) = new_tree
3582 113 : = build_target_option_node (&global_options, &global_options_set);
3583 : }
3584 1243754 : if (TREE_TARGET_GLOBALS (new_tree))
3585 1206534 : restore_target_globals (TREE_TARGET_GLOBALS (new_tree));
3586 37220 : else if (new_tree == target_option_default_node)
3587 20542 : restore_target_globals (&default_target_globals);
3588 : else
3589 16678 : TREE_TARGET_GLOBALS (new_tree) = save_target_globals_default_opts ();
3590 : }
3591 318005459 : ix86_previous_fndecl = fndecl;
3592 :
3593 318005459 : if (cfun->machine->func_type != TYPE_NORMAL
3594 318001319 : || (cfun->machine->call_saved_registers
3595 318001319 : == TYPE_NO_CALLER_SAVED_REGISTERS))
3596 : {
3597 : /* Don't allow AVX, AVX512, MMX nor x87 instructions since they
3598 : may change processor state. Don't allow SSE instructions in
3599 : exception/interrupt service routines. */
3600 5430 : const char *isa;
3601 5430 : if (TARGET_SSE)
3602 : {
3603 470 : if (TARGET_AVX512F)
3604 : isa = "AVX512";
3605 470 : else if (TARGET_AVX)
3606 : isa = "AVX";
3607 470 : else if (cfun->machine->func_type != TYPE_NORMAL)
3608 : isa = "SSE";
3609 469 : else if (TARGET_MMX)
3610 : isa = "MMX/3Dnow";
3611 468 : else if (TARGET_80387)
3612 : isa = "80387";
3613 : else
3614 : isa = NULL;
3615 : }
3616 4960 : else if (TARGET_MMX)
3617 : isa = "MMX/3Dnow";
3618 4957 : else if (TARGET_80387)
3619 : isa = "80387";
3620 : else
3621 : isa = NULL;
3622 : if (isa != NULL)
3623 : {
3624 9 : if (cfun->machine->func_type != TYPE_NORMAL)
3625 7 : sorry (cfun->machine->func_type == TYPE_EXCEPTION
3626 : ? G_("%s instructions aren%'t allowed in an"
3627 : " exception service routine")
3628 : : G_("%s instructions aren%'t allowed in an"
3629 : " interrupt service routine"),
3630 : isa);
3631 : else
3632 4 : sorry ("%s instructions aren%'t allowed in a function with "
3633 : "the %<no_caller_saved_registers%> attribute", isa);
3634 : /* Don't issue the same error twice. */
3635 9 : cfun->machine->func_type = TYPE_NORMAL;
3636 9 : cfun->machine->call_saved_registers
3637 9 : = TYPE_DEFAULT_CALL_SAVED_REGISTERS;
3638 : }
3639 : }
3640 : }
3641 :
3642 : /* Implement the TARGET_OFFLOAD_OPTIONS hook. */
3643 : char *
3644 0 : ix86_offload_options (void)
3645 : {
3646 0 : if (TARGET_LP64)
3647 0 : return xstrdup ("-foffload-abi=lp64 -foffload-abi-host-opts=-m64");
3648 0 : return xstrdup ("-foffload-abi=ilp32 -foffload-abi-host-opts=-m32");
3649 : }
3650 :
3651 : /* Handle "cdecl", "stdcall", "fastcall", "regparm", "thiscall",
3652 : and "sseregparm" calling convention attributes;
3653 : arguments as in struct attribute_spec.handler. */
3654 :
3655 : static tree
3656 11867 : ix86_handle_cconv_attribute (tree *node, tree name, tree args, int,
3657 : bool *no_add_attrs)
3658 : {
3659 11867 : if (TREE_CODE (*node) != FUNCTION_TYPE
3660 11867 : && TREE_CODE (*node) != METHOD_TYPE
3661 : && TREE_CODE (*node) != FIELD_DECL
3662 : && TREE_CODE (*node) != TYPE_DECL)
3663 : {
3664 0 : warning (OPT_Wattributes, "%qE attribute only applies to functions",
3665 : name);
3666 0 : *no_add_attrs = true;
3667 0 : return NULL_TREE;
3668 : }
3669 :
3670 11867 : if (TARGET_64BIT)
3671 : {
3672 : /* Do not warn when emulating the MS ABI. */
3673 791 : if ((TREE_CODE (*node) != FUNCTION_TYPE
3674 : && TREE_CODE (*node) != METHOD_TYPE)
3675 791 : || ix86_function_type_abi (*node) != MS_ABI)
3676 788 : warning (OPT_Wattributes, "%qE attribute ignored",
3677 : name);
3678 791 : *no_add_attrs = true;
3679 791 : return NULL_TREE;
3680 : }
3681 :
3682 : /* Can combine regparm with all attributes but fastcall, and thiscall. */
3683 11076 : if (is_attribute_p ("regparm", name))
3684 : {
3685 11074 : tree cst;
3686 :
3687 11074 : if (lookup_attribute ("fastcall", TYPE_ATTRIBUTES (*node)))
3688 : {
3689 0 : error ("fastcall and regparm attributes are not compatible");
3690 : }
3691 :
3692 11074 : if (lookup_attribute ("thiscall", TYPE_ATTRIBUTES (*node)))
3693 : {
3694 0 : error ("regparm and thiscall attributes are not compatible");
3695 : }
3696 :
3697 11074 : cst = TREE_VALUE (args);
3698 11074 : if (TREE_CODE (cst) != INTEGER_CST)
3699 : {
3700 0 : warning (OPT_Wattributes,
3701 : "%qE attribute requires an integer constant argument",
3702 : name);
3703 0 : *no_add_attrs = true;
3704 : }
3705 11074 : else if (compare_tree_int (cst, REGPARM_MAX) > 0)
3706 : {
3707 0 : warning (OPT_Wattributes, "argument to %qE attribute larger than %d",
3708 0 : name, REGPARM_MAX);
3709 0 : *no_add_attrs = true;
3710 : }
3711 :
3712 : return NULL_TREE;
3713 : }
3714 :
3715 : /* Can combine fastcall with sseregparm. */
3716 2 : if (is_attribute_p ("fastcall", name))
3717 : {
3718 2 : if (lookup_attribute ("cdecl", TYPE_ATTRIBUTES (*node)))
3719 : {
3720 0 : error ("fastcall and cdecl attributes are not compatible");
3721 : }
3722 2 : if (lookup_attribute ("stdcall", TYPE_ATTRIBUTES (*node)))
3723 : {
3724 0 : error ("fastcall and stdcall attributes are not compatible");
3725 : }
3726 2 : if (lookup_attribute ("regparm", TYPE_ATTRIBUTES (*node)))
3727 : {
3728 0 : error ("fastcall and regparm attributes are not compatible");
3729 : }
3730 2 : if (lookup_attribute ("thiscall", TYPE_ATTRIBUTES (*node)))
3731 : {
3732 0 : error ("fastcall and thiscall attributes are not compatible");
3733 : }
3734 : }
3735 :
3736 : /* Can combine stdcall with regparm and sseregparm. */
3737 0 : else if (is_attribute_p ("stdcall", name))
3738 : {
3739 0 : if (lookup_attribute ("cdecl", TYPE_ATTRIBUTES (*node)))
3740 : {
3741 0 : error ("stdcall and cdecl attributes are not compatible");
3742 : }
3743 0 : if (lookup_attribute ("fastcall", TYPE_ATTRIBUTES (*node)))
3744 : {
3745 0 : error ("stdcall and fastcall attributes are not compatible");
3746 : }
3747 0 : if (lookup_attribute ("thiscall", TYPE_ATTRIBUTES (*node)))
3748 : {
3749 0 : error ("stdcall and thiscall attributes are not compatible");
3750 : }
3751 : }
3752 :
3753 : /* Can combine cdecl with regparm and sseregparm. */
3754 0 : else if (is_attribute_p ("cdecl", name))
3755 : {
3756 0 : if (lookup_attribute ("stdcall", TYPE_ATTRIBUTES (*node)))
3757 : {
3758 0 : error ("stdcall and cdecl attributes are not compatible");
3759 : }
3760 0 : if (lookup_attribute ("fastcall", TYPE_ATTRIBUTES (*node)))
3761 : {
3762 0 : error ("fastcall and cdecl attributes are not compatible");
3763 : }
3764 0 : if (lookup_attribute ("thiscall", TYPE_ATTRIBUTES (*node)))
3765 : {
3766 0 : error ("cdecl and thiscall attributes are not compatible");
3767 : }
3768 : }
3769 0 : else if (is_attribute_p ("thiscall", name))
3770 : {
3771 0 : if (TREE_CODE (*node) != METHOD_TYPE && pedantic)
3772 0 : warning (OPT_Wattributes, "%qE attribute is used for non-class method",
3773 : name);
3774 0 : if (lookup_attribute ("stdcall", TYPE_ATTRIBUTES (*node)))
3775 : {
3776 0 : error ("stdcall and thiscall attributes are not compatible");
3777 : }
3778 0 : if (lookup_attribute ("fastcall", TYPE_ATTRIBUTES (*node)))
3779 : {
3780 0 : error ("fastcall and thiscall attributes are not compatible");
3781 : }
3782 0 : if (lookup_attribute ("cdecl", TYPE_ATTRIBUTES (*node)))
3783 : {
3784 0 : error ("cdecl and thiscall attributes are not compatible");
3785 : }
3786 0 : if (lookup_attribute ("regparm", TYPE_ATTRIBUTES (*node)))
3787 : {
3788 0 : error ("regparm and thiscall attributes are not compatible");
3789 : }
3790 : }
3791 :
3792 : /* Can combine sseregparm with all attributes. */
3793 :
3794 : return NULL_TREE;
3795 : }
3796 :
3797 : #ifndef CHECK_STACK_LIMIT
3798 : #define CHECK_STACK_LIMIT (-1)
3799 : #endif
3800 :
3801 : /* The transactional memory builtins are implicitly regparm or fastcall
3802 : depending on the ABI. Override the generic do-nothing attribute that
3803 : these builtins were declared with, and replace it with one of the two
3804 : attributes that we expect elsewhere. */
3805 :
3806 : static tree
3807 32430 : ix86_handle_tm_regparm_attribute (tree *node, tree, tree,
3808 : int flags, bool *no_add_attrs)
3809 : {
3810 32430 : tree alt;
3811 :
3812 : /* In no case do we want to add the placeholder attribute. */
3813 32430 : *no_add_attrs = true;
3814 :
3815 : /* The 64-bit ABI is unchanged for transactional memory. */
3816 32430 : if (TARGET_64BIT)
3817 : return NULL_TREE;
3818 :
3819 : /* ??? Is there a better way to validate 32-bit windows? We have
3820 : cfun->machine->call_abi, but that seems to be set only for 64-bit. */
3821 0 : if (CHECK_STACK_LIMIT > 0)
3822 : alt = tree_cons (get_identifier ("fastcall"), NULL, NULL);
3823 : else
3824 : {
3825 0 : alt = tree_cons (NULL, build_int_cst (integer_type_node, 2), NULL);
3826 0 : alt = tree_cons (get_identifier ("regparm"), alt, NULL);
3827 : }
3828 0 : decl_attributes (node, alt, flags);
3829 :
3830 0 : return NULL_TREE;
3831 : }
3832 :
3833 : /* Handle a "force_align_arg_pointer" attribute. */
3834 :
3835 : static tree
3836 5131 : ix86_handle_force_align_arg_pointer_attribute (tree *node, tree name,
3837 : tree, int, bool *no_add_attrs)
3838 : {
3839 5131 : if (TREE_CODE (*node) != FUNCTION_TYPE
3840 5131 : && TREE_CODE (*node) != METHOD_TYPE
3841 : && TREE_CODE (*node) != FIELD_DECL
3842 : && TREE_CODE (*node) != TYPE_DECL)
3843 : {
3844 0 : warning (OPT_Wattributes, "%qE attribute only applies to functions",
3845 : name);
3846 0 : *no_add_attrs = true;
3847 : }
3848 :
3849 5131 : return NULL_TREE;
3850 : }
3851 :
3852 : /* Handle a "ms_struct" or "gcc_struct" attribute; arguments as in
3853 : struct attribute_spec.handler. */
3854 :
3855 : static tree
3856 74 : ix86_handle_struct_attribute (tree *node, tree name, tree, int,
3857 : bool *no_add_attrs)
3858 : {
3859 74 : tree *type = NULL;
3860 74 : if (DECL_P (*node))
3861 : {
3862 0 : if (TREE_CODE (*node) == TYPE_DECL)
3863 0 : type = &TREE_TYPE (*node);
3864 : }
3865 : else
3866 : type = node;
3867 :
3868 74 : if (!(type && RECORD_OR_UNION_TYPE_P (*type)))
3869 : {
3870 0 : warning (OPT_Wattributes, "%qE attribute ignored",
3871 : name);
3872 0 : *no_add_attrs = true;
3873 : }
3874 :
3875 74 : else if ((is_attribute_p ("ms_struct", name)
3876 62 : && lookup_attribute ("gcc_struct", TYPE_ATTRIBUTES (*type)))
3877 136 : || ((is_attribute_p ("gcc_struct", name)
3878 12 : && lookup_attribute ("ms_struct", TYPE_ATTRIBUTES (*type)))))
3879 : {
3880 0 : warning (OPT_Wattributes, "%qE incompatible attribute ignored",
3881 : name);
3882 0 : *no_add_attrs = true;
3883 : }
3884 :
3885 74 : return NULL_TREE;
3886 : }
3887 :
3888 : /* Handle a "callee_pop_aggregate_return" attribute; arguments as
3889 : in struct attribute_spec handler. */
3890 :
3891 : static tree
3892 0 : ix86_handle_callee_pop_aggregate_return (tree *node, tree name, tree args, int,
3893 : bool *no_add_attrs)
3894 : {
3895 0 : if (TREE_CODE (*node) != FUNCTION_TYPE
3896 0 : && TREE_CODE (*node) != METHOD_TYPE
3897 : && TREE_CODE (*node) != FIELD_DECL
3898 : && TREE_CODE (*node) != TYPE_DECL)
3899 : {
3900 0 : warning (OPT_Wattributes, "%qE attribute only applies to functions",
3901 : name);
3902 0 : *no_add_attrs = true;
3903 0 : return NULL_TREE;
3904 : }
3905 0 : if (TARGET_64BIT)
3906 : {
3907 0 : warning (OPT_Wattributes, "%qE attribute only available for 32-bit",
3908 : name);
3909 0 : *no_add_attrs = true;
3910 0 : return NULL_TREE;
3911 : }
3912 0 : if (is_attribute_p ("callee_pop_aggregate_return", name))
3913 : {
3914 0 : tree cst;
3915 :
3916 0 : cst = TREE_VALUE (args);
3917 0 : if (TREE_CODE (cst) != INTEGER_CST)
3918 : {
3919 0 : warning (OPT_Wattributes,
3920 : "%qE attribute requires an integer constant argument",
3921 : name);
3922 0 : *no_add_attrs = true;
3923 : }
3924 0 : else if (compare_tree_int (cst, 0) != 0
3925 0 : && compare_tree_int (cst, 1) != 0)
3926 : {
3927 0 : warning (OPT_Wattributes,
3928 : "argument to %qE attribute is neither zero, nor one",
3929 : name);
3930 0 : *no_add_attrs = true;
3931 : }
3932 :
3933 : return NULL_TREE;
3934 : }
3935 :
3936 : return NULL_TREE;
3937 : }
3938 :
3939 : /* Handle a "ms_abi" or "sysv" attribute; arguments as in
3940 : struct attribute_spec.handler. */
3941 :
3942 : static tree
3943 1656203 : ix86_handle_abi_attribute (tree *node, tree name, tree, int,
3944 : bool *no_add_attrs)
3945 : {
3946 1656203 : if (TREE_CODE (*node) != FUNCTION_TYPE
3947 1656203 : && TREE_CODE (*node) != METHOD_TYPE
3948 : && TREE_CODE (*node) != FIELD_DECL
3949 : && TREE_CODE (*node) != TYPE_DECL)
3950 : {
3951 0 : warning (OPT_Wattributes, "%qE attribute only applies to functions",
3952 : name);
3953 0 : *no_add_attrs = true;
3954 0 : return NULL_TREE;
3955 : }
3956 :
3957 : /* Can combine regparm with all attributes but fastcall. */
3958 1656203 : if (is_attribute_p ("ms_abi", name))
3959 : {
3960 848357 : if (lookup_attribute ("sysv_abi", TYPE_ATTRIBUTES (*node)))
3961 : {
3962 0 : error ("%qs and %qs attributes are not compatible",
3963 : "ms_abi", "sysv_abi");
3964 : }
3965 :
3966 : return NULL_TREE;
3967 : }
3968 807846 : else if (is_attribute_p ("sysv_abi", name))
3969 : {
3970 807846 : if (lookup_attribute ("ms_abi", TYPE_ATTRIBUTES (*node)))
3971 : {
3972 0 : error ("%qs and %qs attributes are not compatible",
3973 : "ms_abi", "sysv_abi");
3974 : }
3975 :
3976 : return NULL_TREE;
3977 : }
3978 :
3979 : return NULL_TREE;
3980 : }
3981 :
3982 : static tree
3983 122 : ix86_handle_fndecl_attribute (tree *node, tree name, tree args, int,
3984 : bool *no_add_attrs)
3985 : {
3986 122 : if (TREE_CODE (*node) != FUNCTION_DECL)
3987 : {
3988 0 : warning (OPT_Wattributes, "%qE attribute only applies to functions",
3989 : name);
3990 0 : *no_add_attrs = true;
3991 : }
3992 :
3993 122 : if (is_attribute_p ("indirect_branch", name))
3994 : {
3995 17 : tree cst = TREE_VALUE (args);
3996 17 : if (TREE_CODE (cst) != STRING_CST)
3997 : {
3998 0 : warning (OPT_Wattributes,
3999 : "%qE attribute requires a string constant argument",
4000 : name);
4001 0 : *no_add_attrs = true;
4002 : }
4003 17 : else if (strcmp (TREE_STRING_POINTER (cst), "keep") != 0
4004 15 : && strcmp (TREE_STRING_POINTER (cst), "thunk") != 0
4005 10 : && strcmp (TREE_STRING_POINTER (cst), "thunk-inline") != 0
4006 24 : && strcmp (TREE_STRING_POINTER (cst), "thunk-extern") != 0)
4007 : {
4008 0 : warning (OPT_Wattributes,
4009 : "argument to %qE attribute is not "
4010 : "(keep|thunk|thunk-inline|thunk-extern)", name);
4011 0 : *no_add_attrs = true;
4012 : }
4013 : }
4014 :
4015 122 : if (is_attribute_p ("function_return", name))
4016 : {
4017 12 : tree cst = TREE_VALUE (args);
4018 12 : if (TREE_CODE (cst) != STRING_CST)
4019 : {
4020 0 : warning (OPT_Wattributes,
4021 : "%qE attribute requires a string constant argument",
4022 : name);
4023 0 : *no_add_attrs = true;
4024 : }
4025 12 : else if (strcmp (TREE_STRING_POINTER (cst), "keep") != 0
4026 10 : && strcmp (TREE_STRING_POINTER (cst), "thunk") != 0
4027 6 : && strcmp (TREE_STRING_POINTER (cst), "thunk-inline") != 0
4028 15 : && strcmp (TREE_STRING_POINTER (cst), "thunk-extern") != 0)
4029 : {
4030 0 : warning (OPT_Wattributes,
4031 : "argument to %qE attribute is not "
4032 : "(keep|thunk|thunk-inline|thunk-extern)", name);
4033 0 : *no_add_attrs = true;
4034 : }
4035 : }
4036 :
4037 122 : return NULL_TREE;
4038 : }
4039 :
4040 : static tree
4041 248 : ix86_handle_call_saved_registers_attribute (tree *node, tree name, tree,
4042 : int, bool *)
4043 : {
4044 248 : const char *attr1 = nullptr;
4045 248 : const char *attr2 = nullptr;
4046 :
4047 248 : if (is_attribute_p ("no_callee_saved_registers", name))
4048 : {
4049 : /* Disallow preserve_none and no_caller_saved_registers
4050 : attributes. */
4051 92 : attr1 = "no_callee_saved_registers";
4052 92 : if (lookup_attribute ("preserve_none", TYPE_ATTRIBUTES (*node)))
4053 : attr2 = "preserve_none";
4054 91 : else if (lookup_attribute ("no_caller_saved_registers",
4055 91 : TYPE_ATTRIBUTES (*node)))
4056 : attr2 = "no_caller_saved_registers";
4057 : }
4058 156 : else if (is_attribute_p ("no_caller_saved_registers", name))
4059 : {
4060 : /* Disallow preserve_none and no_callee_saved_registers
4061 : attributes. */
4062 76 : attr1 = "no_caller_saved_registers";
4063 76 : if (lookup_attribute ("preserve_none", TYPE_ATTRIBUTES (*node)))
4064 : attr2 = "preserve_none";
4065 75 : else if (lookup_attribute ("no_callee_saved_registers",
4066 75 : TYPE_ATTRIBUTES (*node)))
4067 : attr2 = "no_callee_saved_registers";
4068 : }
4069 80 : else if (is_attribute_p ("preserve_none", name))
4070 : {
4071 : /* Disallow no_callee_saved_registers and no_caller_saved_registers
4072 : attributes. */
4073 80 : attr1 = "preserve_none";
4074 80 : if (lookup_attribute ("no_callee_saved_registers",
4075 80 : TYPE_ATTRIBUTES (*node)))
4076 : attr2 = "no_caller_saved_registers";
4077 80 : else if (lookup_attribute ("no_callee_saved_registers",
4078 80 : TYPE_ATTRIBUTES (*node)))
4079 : attr2 = "no_callee_saved_registers";
4080 : }
4081 :
4082 : if (attr2)
4083 3 : error ("%qs and %qs attributes are not compatible", attr1, attr2);
4084 :
4085 248 : return NULL_TREE;
4086 : }
4087 :
4088 : static tree
4089 129 : ix86_handle_interrupt_attribute (tree *node, tree, tree, int, bool *)
4090 : {
4091 : /* DECL_RESULT and DECL_ARGUMENTS do not exist there yet,
4092 : but the function type contains args and return type data. */
4093 129 : tree func_type = *node;
4094 129 : tree return_type = TREE_TYPE (func_type);
4095 :
4096 129 : int nargs = 0;
4097 129 : tree current_arg_type = TYPE_ARG_TYPES (func_type);
4098 129 : while (current_arg_type
4099 642 : && ! VOID_TYPE_P (TREE_VALUE (current_arg_type)))
4100 : {
4101 192 : if (nargs == 0)
4102 : {
4103 128 : if (! POINTER_TYPE_P (TREE_VALUE (current_arg_type)))
4104 2 : error ("interrupt service routine should have a pointer "
4105 : "as the first argument");
4106 : }
4107 64 : else if (nargs == 1)
4108 : {
4109 64 : if (TREE_CODE (TREE_VALUE (current_arg_type)) != INTEGER_TYPE
4110 64 : || TYPE_MODE (TREE_VALUE (current_arg_type)) != word_mode)
4111 2 : error ("interrupt service routine should have %qs "
4112 : "as the second argument",
4113 2 : TARGET_64BIT
4114 2 : ? (TARGET_X32 ? "unsigned long long int"
4115 : : "unsigned long int")
4116 : : "unsigned int");
4117 : }
4118 192 : nargs++;
4119 192 : current_arg_type = TREE_CHAIN (current_arg_type);
4120 : }
4121 129 : if (!nargs || nargs > 2)
4122 1 : error ("interrupt service routine can only have a pointer argument "
4123 : "and an optional integer argument");
4124 129 : if (! VOID_TYPE_P (return_type))
4125 1 : error ("interrupt service routine must return %<void%>");
4126 :
4127 129 : return NULL_TREE;
4128 : }
4129 :
4130 : /* Handle fentry_name / fentry_section attribute. */
4131 :
4132 : static tree
4133 4 : ix86_handle_fentry_name (tree *node, tree name, tree args,
4134 : int, bool *no_add_attrs)
4135 : {
4136 4 : if (TREE_CODE (*node) == FUNCTION_DECL
4137 8 : && TREE_CODE (TREE_VALUE (args)) == STRING_CST)
4138 : /* Do nothing else, just set the attribute. We'll get at
4139 : it later with lookup_attribute. */
4140 : ;
4141 : else
4142 : {
4143 0 : warning (OPT_Wattributes, "%qE attribute ignored", name);
4144 0 : *no_add_attrs = true;
4145 : }
4146 :
4147 4 : return NULL_TREE;
4148 : }
4149 :
4150 : /* Handle a "nodirect_extern_access" attribute; arguments as in
4151 : struct attribute_spec.handler. */
4152 :
4153 : static tree
4154 11 : handle_nodirect_extern_access_attribute (tree *pnode, tree name,
4155 : tree ARG_UNUSED (args),
4156 : int ARG_UNUSED (flags),
4157 : bool *no_add_attrs)
4158 : {
4159 11 : tree node = *pnode;
4160 :
4161 11 : if (VAR_OR_FUNCTION_DECL_P (node))
4162 : {
4163 7 : if ((!TREE_STATIC (node) && TREE_CODE (node) != FUNCTION_DECL
4164 18 : && !DECL_EXTERNAL (node)) || !TREE_PUBLIC (node))
4165 : {
4166 0 : warning (OPT_Wattributes,
4167 : "%qE attribute have effect only on public objects", name);
4168 0 : *no_add_attrs = true;
4169 : }
4170 : }
4171 : else
4172 : {
4173 0 : warning (OPT_Wattributes, "%qE attribute ignored", name);
4174 0 : *no_add_attrs = true;
4175 : }
4176 :
4177 11 : return NULL_TREE;
4178 : }
4179 :
4180 : /* Table of valid machine attributes. */
4181 : static const attribute_spec ix86_gnu_attributes[] =
4182 : {
4183 : /* { name, min_len, max_len, decl_req, type_req, fn_type_req,
4184 : affects_type_identity, handler, exclude } */
4185 : /* Stdcall attribute says callee is responsible for popping arguments
4186 : if they are not variable. */
4187 : { "stdcall", 0, 0, false, true, true, true, ix86_handle_cconv_attribute,
4188 : NULL },
4189 : /* Fastcall attribute says callee is responsible for popping arguments
4190 : if they are not variable. */
4191 : { "fastcall", 0, 0, false, true, true, true, ix86_handle_cconv_attribute,
4192 : NULL },
4193 : /* Thiscall attribute says callee is responsible for popping arguments
4194 : if they are not variable. */
4195 : { "thiscall", 0, 0, false, true, true, true, ix86_handle_cconv_attribute,
4196 : NULL },
4197 : /* Cdecl attribute says the callee is a normal C declaration */
4198 : { "cdecl", 0, 0, false, true, true, true, ix86_handle_cconv_attribute,
4199 : NULL },
4200 : /* Regparm attribute specifies how many integer arguments are to be
4201 : passed in registers. */
4202 : { "regparm", 1, 1, false, true, true, true, ix86_handle_cconv_attribute,
4203 : NULL },
4204 : /* Sseregparm attribute says we are using x86_64 calling conventions
4205 : for FP arguments. */
4206 : { "sseregparm", 0, 0, false, true, true, true, ix86_handle_cconv_attribute,
4207 : NULL },
4208 : /* The transactional memory builtins are implicitly regparm or fastcall
4209 : depending on the ABI. Override the generic do-nothing attribute that
4210 : these builtins were declared with. */
4211 : { "*tm regparm", 0, 0, false, true, true, true,
4212 : ix86_handle_tm_regparm_attribute, NULL },
4213 : /* force_align_arg_pointer says this function realigns the stack at entry. */
4214 : { "force_align_arg_pointer", 0, 0,
4215 : false, true, true, false, ix86_handle_force_align_arg_pointer_attribute,
4216 : NULL },
4217 : #if TARGET_DLLIMPORT_DECL_ATTRIBUTES
4218 : { "dllimport", 0, 0, false, false, false, false, handle_dll_attribute,
4219 : NULL },
4220 : { "dllexport", 0, 0, false, false, false, false, handle_dll_attribute,
4221 : NULL },
4222 : { "shared", 0, 0, true, false, false, false,
4223 : ix86_handle_shared_attribute, NULL },
4224 : #endif
4225 : { "ms_struct", 0, 0, false, false, false, false,
4226 : ix86_handle_struct_attribute, NULL },
4227 : { "gcc_struct", 0, 0, false, false, false, false,
4228 : ix86_handle_struct_attribute, NULL },
4229 : #ifdef SUBTARGET_ATTRIBUTE_TABLE
4230 : SUBTARGET_ATTRIBUTE_TABLE,
4231 : #endif
4232 : /* ms_abi and sysv_abi calling convention function attributes. */
4233 : { "ms_abi", 0, 0, false, true, true, true, ix86_handle_abi_attribute, NULL },
4234 : { "sysv_abi", 0, 0, false, true, true, true, ix86_handle_abi_attribute,
4235 : NULL },
4236 : { "ms_abi va_list", 0, 0, false, false, false, false, NULL, NULL },
4237 : { "sysv_abi va_list", 0, 0, false, false, false, false, NULL, NULL },
4238 : { "ms_hook_prologue", 0, 0, true, false, false, false,
4239 : ix86_handle_fndecl_attribute, NULL },
4240 : { "callee_pop_aggregate_return", 1, 1, false, true, true, true,
4241 : ix86_handle_callee_pop_aggregate_return, NULL },
4242 : { "interrupt", 0, 0, false, true, true, false,
4243 : ix86_handle_interrupt_attribute, NULL },
4244 : { "no_caller_saved_registers", 0, 0, false, true, true, false,
4245 : ix86_handle_call_saved_registers_attribute, NULL },
4246 : { "preserve_none", 0, 0, false, true, true, true,
4247 : ix86_handle_call_saved_registers_attribute, NULL },
4248 : { "no_callee_saved_registers", 0, 0, false, true, true, true,
4249 : ix86_handle_call_saved_registers_attribute, NULL },
4250 : { "naked", 0, 0, true, false, false, false,
4251 : ix86_handle_fndecl_attribute, NULL },
4252 : { "indirect_branch", 1, 1, true, false, false, false,
4253 : ix86_handle_fndecl_attribute, NULL },
4254 : { "function_return", 1, 1, true, false, false, false,
4255 : ix86_handle_fndecl_attribute, NULL },
4256 : { "indirect_return", 0, 0, false, true, true, false,
4257 : NULL, NULL },
4258 : { "fentry_name", 1, 1, true, false, false, false,
4259 : ix86_handle_fentry_name, NULL },
4260 : { "fentry_section", 1, 1, true, false, false, false,
4261 : ix86_handle_fentry_name, NULL },
4262 : { "cf_check", 0, 0, true, false, false, false,
4263 : ix86_handle_fndecl_attribute, NULL },
4264 : { "nodirect_extern_access", 0, 0, true, false, false, false,
4265 : handle_nodirect_extern_access_attribute, NULL }
4266 : };
4267 :
4268 : const scoped_attribute_specs ix86_gnu_attribute_table =
4269 : {
4270 : "gnu", { ix86_gnu_attributes }
4271 : };
4272 :
4273 : #include "gt-i386-options.h"
|