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