1 /* Copyright (C) 1988-2021 Free Software Foundation, Inc.
3 This file is part of GCC.
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)
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.
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/>. */
19 #define IN_TARGET_CODE 1
23 #include "coretypes.h"
33 #include "stringpool.h"
40 #include "diagnostic.h"
43 #include "fold-const.h"
46 #include "stor-layout.h"
49 #include "insn-attr.h"
55 #include "common/common-target.h"
56 #include "langhooks.h"
60 #include "tm-constrs.h"
62 #include "sched-int.h"
64 #include "tree-pass.h"
66 #include "pass_manager.h"
67 #include "target-globals.h"
68 #include "gimple-iterator.h"
69 #include "tree-vectorizer.h"
70 #include "shrink-wrap.h"
73 #include "tree-iterator.h"
75 #include "case-cfn-macros.h"
77 #include "fold-const-call.h"
79 #include "tree-ssanames.h"
81 #include "selftest-rtl.h"
82 #include "print-rtl.h"
85 #include "symbol-summary.h"
87 #include "ipa-fnsummary.h"
88 #include "wide-int-bitmask.h"
89 #include "tree-vector-builder.h"
91 #include "dwarf2out.h"
92 #include "i386-options.h"
94 #include "x86-tune-costs.h"
96 #ifndef SUBTARGET32_DEFAULT_CPU
97 #define SUBTARGET32_DEFAULT_CPU "i386"
100 /* Processor feature/optimization bitmasks. */
101 #define m_386 (HOST_WIDE_INT_1U<<PROCESSOR_I386)
102 #define m_486 (HOST_WIDE_INT_1U<<PROCESSOR_I486)
103 #define m_PENT (HOST_WIDE_INT_1U<<PROCESSOR_PENTIUM)
104 #define m_LAKEMONT (HOST_WIDE_INT_1U<<PROCESSOR_LAKEMONT)
105 #define m_PPRO (HOST_WIDE_INT_1U<<PROCESSOR_PENTIUMPRO)
106 #define m_PENT4 (HOST_WIDE_INT_1U<<PROCESSOR_PENTIUM4)
107 #define m_NOCONA (HOST_WIDE_INT_1U<<PROCESSOR_NOCONA)
108 #define m_P4_NOCONA (m_PENT4 | m_NOCONA)
109 #define m_CORE2 (HOST_WIDE_INT_1U<<PROCESSOR_CORE2)
110 #define m_NEHALEM (HOST_WIDE_INT_1U<<PROCESSOR_NEHALEM)
111 #define m_SANDYBRIDGE (HOST_WIDE_INT_1U<<PROCESSOR_SANDYBRIDGE)
112 #define m_HASWELL (HOST_WIDE_INT_1U<<PROCESSOR_HASWELL)
113 #define m_BONNELL (HOST_WIDE_INT_1U<<PROCESSOR_BONNELL)
114 #define m_SILVERMONT (HOST_WIDE_INT_1U<<PROCESSOR_SILVERMONT)
115 #define m_KNL (HOST_WIDE_INT_1U<<PROCESSOR_KNL)
116 #define m_KNM (HOST_WIDE_INT_1U<<PROCESSOR_KNM)
117 #define m_SKYLAKE (HOST_WIDE_INT_1U<<PROCESSOR_SKYLAKE)
118 #define m_SKYLAKE_AVX512 (HOST_WIDE_INT_1U<<PROCESSOR_SKYLAKE_AVX512)
119 #define m_CANNONLAKE (HOST_WIDE_INT_1U<<PROCESSOR_CANNONLAKE)
120 #define m_ICELAKE_CLIENT (HOST_WIDE_INT_1U<<PROCESSOR_ICELAKE_CLIENT)
121 #define m_ICELAKE_SERVER (HOST_WIDE_INT_1U<<PROCESSOR_ICELAKE_SERVER)
122 #define m_CASCADELAKE (HOST_WIDE_INT_1U<<PROCESSOR_CASCADELAKE)
123 #define m_TIGERLAKE (HOST_WIDE_INT_1U<<PROCESSOR_TIGERLAKE)
124 #define m_COOPERLAKE (HOST_WIDE_INT_1U<<PROCESSOR_COOPERLAKE)
125 #define m_SAPPHIRERAPIDS (HOST_WIDE_INT_1U<<PROCESSOR_SAPPHIRERAPIDS)
126 #define m_ALDERLAKE (HOST_WIDE_INT_1U<<PROCESSOR_ALDERLAKE)
127 #define m_CORE_AVX512 (m_SKYLAKE_AVX512 | m_CANNONLAKE \
128 | m_ICELAKE_CLIENT | m_ICELAKE_SERVER | m_CASCADELAKE \
129 | m_TIGERLAKE | m_COOPERLAKE | m_SAPPHIRERAPIDS)
130 #define m_CORE_AVX2 (m_HASWELL | m_SKYLAKE | m_CORE_AVX512)
131 #define m_CORE_ALL (m_CORE2 | m_NEHALEM | m_SANDYBRIDGE | m_CORE_AVX2)
132 #define m_GOLDMONT (HOST_WIDE_INT_1U<<PROCESSOR_GOLDMONT)
133 #define m_GOLDMONT_PLUS (HOST_WIDE_INT_1U<<PROCESSOR_GOLDMONT_PLUS)
134 #define m_TREMONT (HOST_WIDE_INT_1U<<PROCESSOR_TREMONT)
135 #define m_INTEL (HOST_WIDE_INT_1U<<PROCESSOR_INTEL)
137 #define m_GEODE (HOST_WIDE_INT_1U<<PROCESSOR_GEODE)
138 #define m_K6 (HOST_WIDE_INT_1U<<PROCESSOR_K6)
139 #define m_K6_GEODE (m_K6 | m_GEODE)
140 #define m_K8 (HOST_WIDE_INT_1U<<PROCESSOR_K8)
141 #define m_ATHLON (HOST_WIDE_INT_1U<<PROCESSOR_ATHLON)
142 #define m_ATHLON_K8 (m_K8 | m_ATHLON)
143 #define m_AMDFAM10 (HOST_WIDE_INT_1U<<PROCESSOR_AMDFAM10)
144 #define m_BDVER1 (HOST_WIDE_INT_1U<<PROCESSOR_BDVER1)
145 #define m_BDVER2 (HOST_WIDE_INT_1U<<PROCESSOR_BDVER2)
146 #define m_BDVER3 (HOST_WIDE_INT_1U<<PROCESSOR_BDVER3)
147 #define m_BDVER4 (HOST_WIDE_INT_1U<<PROCESSOR_BDVER4)
148 #define m_ZNVER1 (HOST_WIDE_INT_1U<<PROCESSOR_ZNVER1)
149 #define m_ZNVER2 (HOST_WIDE_INT_1U<<PROCESSOR_ZNVER2)
150 #define m_ZNVER3 (HOST_WIDE_INT_1U<<PROCESSOR_ZNVER3)
151 #define m_BTVER1 (HOST_WIDE_INT_1U<<PROCESSOR_BTVER1)
152 #define m_BTVER2 (HOST_WIDE_INT_1U<<PROCESSOR_BTVER2)
153 #define m_BDVER (m_BDVER1 | m_BDVER2 | m_BDVER3 | m_BDVER4)
154 #define m_BTVER (m_BTVER1 | m_BTVER2)
155 #define m_ZNVER (m_ZNVER1 | m_ZNVER2 | m_ZNVER3)
156 #define m_AMD_MULTIPLE (m_ATHLON_K8 | m_AMDFAM10 | m_BDVER | m_BTVER \
159 #define m_GENERIC (HOST_WIDE_INT_1U<<PROCESSOR_GENERIC)
161 const char* ix86_tune_feature_names
[X86_TUNE_LAST
] = {
163 #define DEF_TUNE(tune, name, selector) name,
164 #include "x86-tune.def"
168 /* Feature tests against the various tunings. */
169 unsigned char ix86_tune_features
[X86_TUNE_LAST
];
171 /* Feature tests against the various tunings used to create ix86_tune_features
172 based on the processor mask. */
173 static unsigned HOST_WIDE_INT initial_ix86_tune_features
[X86_TUNE_LAST
] = {
175 #define DEF_TUNE(tune, name, selector) selector,
176 #include "x86-tune.def"
180 /* Feature tests against the various architecture variations. */
181 unsigned char ix86_arch_features
[X86_ARCH_LAST
];
183 struct ix86_target_opts
185 const char *option
; /* option string */
186 HOST_WIDE_INT mask
; /* isa mask options */
189 /* This table is ordered so that options like -msse4.2 that imply other
190 ISAs come first. Target string will be displayed in the same order. */
191 static struct ix86_target_opts isa2_opts
[] =
193 { "-mcx16", OPTION_MASK_ISA2_CX16
},
194 { "-mvaes", OPTION_MASK_ISA2_VAES
},
195 { "-mrdpid", OPTION_MASK_ISA2_RDPID
},
196 { "-mpconfig", OPTION_MASK_ISA2_PCONFIG
},
197 { "-mwbnoinvd", OPTION_MASK_ISA2_WBNOINVD
},
198 { "-mavx512vp2intersect", OPTION_MASK_ISA2_AVX512VP2INTERSECT
},
199 { "-msgx", OPTION_MASK_ISA2_SGX
},
200 { "-mavx5124vnniw", OPTION_MASK_ISA2_AVX5124VNNIW
},
201 { "-mavx5124fmaps", OPTION_MASK_ISA2_AVX5124FMAPS
},
202 { "-mhle", OPTION_MASK_ISA2_HLE
},
203 { "-mmovbe", OPTION_MASK_ISA2_MOVBE
},
204 { "-mclzero", OPTION_MASK_ISA2_CLZERO
},
205 { "-mmwaitx", OPTION_MASK_ISA2_MWAITX
},
206 { "-mmovdir64b", OPTION_MASK_ISA2_MOVDIR64B
},
207 { "-mwaitpkg", OPTION_MASK_ISA2_WAITPKG
},
208 { "-mcldemote", OPTION_MASK_ISA2_CLDEMOTE
},
209 { "-mptwrite", OPTION_MASK_ISA2_PTWRITE
},
210 { "-mavx512bf16", OPTION_MASK_ISA2_AVX512BF16
},
211 { "-menqcmd", OPTION_MASK_ISA2_ENQCMD
},
212 { "-mserialize", OPTION_MASK_ISA2_SERIALIZE
},
213 { "-mtsxldtrk", OPTION_MASK_ISA2_TSXLDTRK
},
214 { "-mamx-tile", OPTION_MASK_ISA2_AMX_TILE
},
215 { "-mamx-int8", OPTION_MASK_ISA2_AMX_INT8
},
216 { "-mamx-bf16", OPTION_MASK_ISA2_AMX_BF16
},
217 { "-muintr", OPTION_MASK_ISA2_UINTR
},
218 { "-mhreset", OPTION_MASK_ISA2_HRESET
},
219 { "-mkl", OPTION_MASK_ISA2_KL
},
220 { "-mwidekl", OPTION_MASK_ISA2_WIDEKL
},
221 { "-mavxvnni", OPTION_MASK_ISA2_AVXVNNI
}
223 static struct ix86_target_opts isa_opts
[] =
225 { "-mavx512vpopcntdq", OPTION_MASK_ISA_AVX512VPOPCNTDQ
},
226 { "-mavx512bitalg", OPTION_MASK_ISA_AVX512BITALG
},
227 { "-mvpclmulqdq", OPTION_MASK_ISA_VPCLMULQDQ
},
228 { "-mgfni", OPTION_MASK_ISA_GFNI
},
229 { "-mavx512vnni", OPTION_MASK_ISA_AVX512VNNI
},
230 { "-mavx512vbmi2", OPTION_MASK_ISA_AVX512VBMI2
},
231 { "-mavx512vbmi", OPTION_MASK_ISA_AVX512VBMI
},
232 { "-mavx512ifma", OPTION_MASK_ISA_AVX512IFMA
},
233 { "-mavx512vl", OPTION_MASK_ISA_AVX512VL
},
234 { "-mavx512bw", OPTION_MASK_ISA_AVX512BW
},
235 { "-mavx512dq", OPTION_MASK_ISA_AVX512DQ
},
236 { "-mavx512er", OPTION_MASK_ISA_AVX512ER
},
237 { "-mavx512pf", OPTION_MASK_ISA_AVX512PF
},
238 { "-mavx512cd", OPTION_MASK_ISA_AVX512CD
},
239 { "-mavx512f", OPTION_MASK_ISA_AVX512F
},
240 { "-mavx2", OPTION_MASK_ISA_AVX2
},
241 { "-mfma", OPTION_MASK_ISA_FMA
},
242 { "-mxop", OPTION_MASK_ISA_XOP
},
243 { "-mfma4", OPTION_MASK_ISA_FMA4
},
244 { "-mf16c", OPTION_MASK_ISA_F16C
},
245 { "-mavx", OPTION_MASK_ISA_AVX
},
246 /*{ "-msse4" OPTION_MASK_ISA_SSE4 }, */
247 { "-msse4.2", OPTION_MASK_ISA_SSE4_2
},
248 { "-msse4.1", OPTION_MASK_ISA_SSE4_1
},
249 { "-msse4a", OPTION_MASK_ISA_SSE4A
},
250 { "-mssse3", OPTION_MASK_ISA_SSSE3
},
251 { "-msse3", OPTION_MASK_ISA_SSE3
},
252 { "-maes", OPTION_MASK_ISA_AES
},
253 { "-msha", OPTION_MASK_ISA_SHA
},
254 { "-mpclmul", OPTION_MASK_ISA_PCLMUL
},
255 { "-msse2", OPTION_MASK_ISA_SSE2
},
256 { "-msse", OPTION_MASK_ISA_SSE
},
257 { "-m3dnowa", OPTION_MASK_ISA_3DNOW_A
},
258 { "-m3dnow", OPTION_MASK_ISA_3DNOW
},
259 { "-mmmx", OPTION_MASK_ISA_MMX
},
260 { "-mrtm", OPTION_MASK_ISA_RTM
},
261 { "-mprfchw", OPTION_MASK_ISA_PRFCHW
},
262 { "-mrdseed", OPTION_MASK_ISA_RDSEED
},
263 { "-madx", OPTION_MASK_ISA_ADX
},
264 { "-mprefetchwt1", OPTION_MASK_ISA_PREFETCHWT1
},
265 { "-mclflushopt", OPTION_MASK_ISA_CLFLUSHOPT
},
266 { "-mxsaves", OPTION_MASK_ISA_XSAVES
},
267 { "-mxsavec", OPTION_MASK_ISA_XSAVEC
},
268 { "-mxsaveopt", OPTION_MASK_ISA_XSAVEOPT
},
269 { "-mxsave", OPTION_MASK_ISA_XSAVE
},
270 { "-mabm", OPTION_MASK_ISA_ABM
},
271 { "-mbmi", OPTION_MASK_ISA_BMI
},
272 { "-mbmi2", OPTION_MASK_ISA_BMI2
},
273 { "-mlzcnt", OPTION_MASK_ISA_LZCNT
},
274 { "-mtbm", OPTION_MASK_ISA_TBM
},
275 { "-mpopcnt", OPTION_MASK_ISA_POPCNT
},
276 { "-msahf", OPTION_MASK_ISA_SAHF
},
277 { "-mcrc32", OPTION_MASK_ISA_CRC32
},
278 { "-mfsgsbase", OPTION_MASK_ISA_FSGSBASE
},
279 { "-mrdrnd", OPTION_MASK_ISA_RDRND
},
280 { "-mpku", OPTION_MASK_ISA_PKU
},
281 { "-mlwp", OPTION_MASK_ISA_LWP
},
282 { "-mfxsr", OPTION_MASK_ISA_FXSR
},
283 { "-mclwb", OPTION_MASK_ISA_CLWB
},
284 { "-mshstk", OPTION_MASK_ISA_SHSTK
},
285 { "-mmovdiri", OPTION_MASK_ISA_MOVDIRI
}
288 /* Return 1 if TRAIT NAME is present in the OpenMP context's
289 device trait set, return 0 if not present in any OpenMP context in the
290 whole translation unit, or -1 if not present in the current OpenMP context
291 but might be present in another OpenMP context in the same TU. */
294 ix86_omp_device_kind_arch_isa (enum omp_device_kind_arch_isa trait
,
299 case omp_device_kind
:
300 return strcmp (name
, "cpu") == 0;
301 case omp_device_arch
:
302 if (strcmp (name
, "x86") == 0)
307 return strcmp (name
, "x32") == 0;
309 return strcmp (name
, "x86_64") == 0;
311 if (strcmp (name
, "ia32") == 0 || strcmp (name
, "i386") == 0)
313 if (strcmp (name
, "i486") == 0)
314 return ix86_arch
!= PROCESSOR_I386
? 1 : -1;
315 if (strcmp (name
, "i586") == 0)
316 return (ix86_arch
!= PROCESSOR_I386
317 && ix86_arch
!= PROCESSOR_I486
) ? 1 : -1;
318 if (strcmp (name
, "i686") == 0)
319 return (ix86_arch
!= PROCESSOR_I386
320 && ix86_arch
!= PROCESSOR_I486
321 && ix86_arch
!= PROCESSOR_LAKEMONT
322 && ix86_arch
!= PROCESSOR_PENTIUM
) ? 1 : -1;
325 for (int i
= 0; i
< 2; i
++)
327 struct ix86_target_opts
*opts
= i
? isa2_opts
: isa_opts
;
328 size_t nopts
= i
? ARRAY_SIZE (isa2_opts
) : ARRAY_SIZE (isa_opts
);
329 HOST_WIDE_INT mask
= i
? ix86_isa_flags2
: ix86_isa_flags
;
330 for (size_t n
= 0; n
< nopts
; n
++)
332 /* Handle sse4 as an alias to sse4.2. */
333 if (opts
[n
].mask
== OPTION_MASK_ISA_SSE4_2
)
335 if (strcmp (name
, "sse4") == 0)
336 return (mask
& opts
[n
].mask
) != 0 ? 1 : -1;
338 if (strcmp (name
, opts
[n
].option
+ 2) == 0)
339 return (mask
& opts
[n
].mask
) != 0 ? 1 : -1;
348 /* Return a string that documents the current -m options. The caller is
349 responsible for freeing the string. */
352 ix86_target_string (HOST_WIDE_INT isa
, HOST_WIDE_INT isa2
,
353 int flags
, int flags2
,
354 const char *arch
, const char *tune
,
355 enum fpmath_unit fpmath
,
356 enum prefer_vector_width pvw
,
357 bool add_nl_p
, bool add_abi_p
)
360 static struct ix86_target_opts flag_opts
[] =
362 { "-m128bit-long-double", MASK_128BIT_LONG_DOUBLE
},
363 { "-mlong-double-128", MASK_LONG_DOUBLE_128
},
364 { "-mlong-double-64", MASK_LONG_DOUBLE_64
},
365 { "-m80387", MASK_80387
},
366 { "-maccumulate-outgoing-args", MASK_ACCUMULATE_OUTGOING_ARGS
},
367 { "-malign-double", MASK_ALIGN_DOUBLE
},
368 { "-mcld", MASK_CLD
},
369 { "-mfp-ret-in-387", MASK_FLOAT_RETURNS
},
370 { "-mieee-fp", MASK_IEEE_FP
},
371 { "-minline-all-stringops", MASK_INLINE_ALL_STRINGOPS
},
372 { "-minline-stringops-dynamically", MASK_INLINE_STRINGOPS_DYNAMICALLY
},
373 { "-mms-bitfields", MASK_MS_BITFIELD_LAYOUT
},
374 { "-mno-align-stringops", MASK_NO_ALIGN_STRINGOPS
},
375 { "-mno-fancy-math-387", MASK_NO_FANCY_MATH_387
},
376 { "-mno-push-args", MASK_NO_PUSH_ARGS
},
377 { "-mno-red-zone", MASK_NO_RED_ZONE
},
378 { "-momit-leaf-frame-pointer", MASK_OMIT_LEAF_FRAME_POINTER
},
379 { "-mrecip", MASK_RECIP
},
380 { "-mrtd", MASK_RTD
},
381 { "-msseregparm", MASK_SSEREGPARM
},
382 { "-mstack-arg-probe", MASK_STACK_PROBE
},
383 { "-mtls-direct-seg-refs", MASK_TLS_DIRECT_SEG_REFS
},
384 { "-mvect8-ret-in-mem", MASK_VECT8_RETURNS
},
385 { "-m8bit-idiv", MASK_USE_8BIT_IDIV
},
386 { "-mvzeroupper", MASK_VZEROUPPER
},
387 { "-mstv", MASK_STV
},
388 { "-mavx256-split-unaligned-load", MASK_AVX256_SPLIT_UNALIGNED_LOAD
},
389 { "-mavx256-split-unaligned-store", MASK_AVX256_SPLIT_UNALIGNED_STORE
},
390 { "-mcall-ms2sysv-xlogues", MASK_CALL_MS2SYSV_XLOGUES
}
393 /* Additional flag options. */
394 static struct ix86_target_opts flag2_opts
[] =
396 { "-mgeneral-regs-only", OPTION_MASK_GENERAL_REGS_ONLY
}
399 const char *opts
[ARRAY_SIZE (isa_opts
) + ARRAY_SIZE (isa2_opts
)
400 + ARRAY_SIZE (flag_opts
) + ARRAY_SIZE (flag2_opts
) + 6][2];
404 char flags_other
[40];
405 char flags2_other
[40];
415 memset (opts
, '\0', sizeof (opts
));
417 /* Add -march= option. */
420 opts
[num
][0] = "-march=";
421 opts
[num
++][1] = arch
;
424 /* Add -mtune= option. */
427 opts
[num
][0] = "-mtune=";
428 opts
[num
++][1] = tune
;
431 /* Add -m32/-m64/-mx32. */
434 if ((isa
& OPTION_MASK_ISA_64BIT
) != 0)
436 if ((isa
& OPTION_MASK_ABI_64
) != 0)
443 opts
[num
++][0] = abi
;
445 isa
&= ~(OPTION_MASK_ISA_64BIT
| OPTION_MASK_ABI_64
| OPTION_MASK_ABI_X32
);
447 /* Pick out the options in isa2 options. */
448 for (i
= 0; i
< ARRAY_SIZE (isa2_opts
); i
++)
450 if ((isa2
& isa2_opts
[i
].mask
) != 0)
452 opts
[num
++][0] = isa2_opts
[i
].option
;
453 isa2
&= ~ isa2_opts
[i
].mask
;
457 if (isa2
&& add_nl_p
)
459 opts
[num
++][0] = isa2_other
;
460 sprintf (isa2_other
, "(other isa2: %#" HOST_WIDE_INT_PRINT
"x)", isa2
);
463 /* Pick out the options in isa options. */
464 for (i
= 0; i
< ARRAY_SIZE (isa_opts
); i
++)
466 if ((isa
& isa_opts
[i
].mask
) != 0)
468 opts
[num
++][0] = isa_opts
[i
].option
;
469 isa
&= ~ isa_opts
[i
].mask
;
475 opts
[num
++][0] = isa_other
;
476 sprintf (isa_other
, "(other isa: %#" HOST_WIDE_INT_PRINT
"x)", isa
);
479 /* Add flag options. */
480 for (i
= 0; i
< ARRAY_SIZE (flag_opts
); i
++)
482 if ((flags
& flag_opts
[i
].mask
) != 0)
484 opts
[num
++][0] = flag_opts
[i
].option
;
485 flags
&= ~ flag_opts
[i
].mask
;
489 if (flags
&& add_nl_p
)
491 opts
[num
++][0] = flags_other
;
492 sprintf (flags_other
, "(other flags: %#x)", flags
);
495 /* Add additional flag options. */
496 for (i
= 0; i
< ARRAY_SIZE (flag2_opts
); i
++)
498 if ((flags2
& flag2_opts
[i
].mask
) != 0)
500 opts
[num
++][0] = flag2_opts
[i
].option
;
501 flags2
&= ~ flag2_opts
[i
].mask
;
505 if (flags2
&& add_nl_p
)
507 opts
[num
++][0] = flags2_other
;
508 sprintf (flags2_other
, "(other flags2: %#x)", flags2
);
511 /* Add -mfpmath= option. */
514 opts
[num
][0] = "-mfpmath=";
515 switch ((int) fpmath
)
518 opts
[num
++][1] = "387";
522 opts
[num
++][1] = "sse";
525 case FPMATH_387
| FPMATH_SSE
:
526 opts
[num
++][1] = "sse+387";
534 /* Add -mprefer-vector-width= option. */
537 opts
[num
][0] = "-mprefer-vector-width=";
541 opts
[num
++][1] = "128";
545 opts
[num
++][1] = "256";
549 opts
[num
++][1] = "512";
561 gcc_assert (num
< ARRAY_SIZE (opts
));
563 /* Size the string. */
565 sep_len
= (add_nl_p
) ? 3 : 1;
566 for (i
= 0; i
< num
; i
++)
569 for (j
= 0; j
< 2; j
++)
571 len
+= strlen (opts
[i
][j
]);
574 /* Build the string. */
575 ret
= ptr
= (char *) xmalloc (len
);
578 for (i
= 0; i
< num
; i
++)
582 for (j
= 0; j
< 2; j
++)
583 len2
[j
] = (opts
[i
][j
]) ? strlen (opts
[i
][j
]) : 0;
590 if (add_nl_p
&& line_len
+ len2
[0] + len2
[1] > 70)
598 for (j
= 0; j
< 2; j
++)
601 memcpy (ptr
, opts
[i
][j
], len2
[j
]);
608 gcc_assert (ret
+ len
>= ptr
);
613 /* Function that is callable from the debugger to print the current
615 void ATTRIBUTE_UNUSED
616 ix86_debug_options (void)
618 char *opts
= ix86_target_string (ix86_isa_flags
, ix86_isa_flags2
,
619 target_flags
, ix86_target_flags
,
620 ix86_arch_string
, ix86_tune_string
,
621 ix86_fpmath
, prefer_vector_width_type
,
626 fprintf (stderr
, "%s\n\n", opts
);
630 fputs ("<no options>\n\n", stderr
);
635 /* Save the current options */
638 ix86_function_specific_save (struct cl_target_option
*ptr
,
639 struct gcc_options
*opts
,
640 struct gcc_options */
* opts_set */
)
642 ptr
->arch
= ix86_arch
;
643 ptr
->schedule
= ix86_schedule
;
644 ptr
->prefetch_sse
= x86_prefetch_sse
;
645 ptr
->tune
= ix86_tune
;
646 ptr
->branch_cost
= ix86_branch_cost
;
647 ptr
->tune_defaulted
= ix86_tune_defaulted
;
648 ptr
->arch_specified
= ix86_arch_specified
;
649 ptr
->x_ix86_isa_flags_explicit
= opts
->x_ix86_isa_flags_explicit
;
650 ptr
->x_ix86_isa_flags2_explicit
= opts
->x_ix86_isa_flags2_explicit
;
651 ptr
->x_recip_mask_explicit
= opts
->x_recip_mask_explicit
;
652 ptr
->x_ix86_arch_string
= opts
->x_ix86_arch_string
;
653 ptr
->x_ix86_tune_string
= opts
->x_ix86_tune_string
;
654 ptr
->x_ix86_cmodel
= opts
->x_ix86_cmodel
;
655 ptr
->x_ix86_abi
= opts
->x_ix86_abi
;
656 ptr
->x_ix86_asm_dialect
= opts
->x_ix86_asm_dialect
;
657 ptr
->x_ix86_branch_cost
= opts
->x_ix86_branch_cost
;
658 ptr
->x_ix86_dump_tunes
= opts
->x_ix86_dump_tunes
;
659 ptr
->x_ix86_force_align_arg_pointer
= opts
->x_ix86_force_align_arg_pointer
;
660 ptr
->x_ix86_force_drap
= opts
->x_ix86_force_drap
;
661 ptr
->x_ix86_incoming_stack_boundary_arg
= opts
->x_ix86_incoming_stack_boundary_arg
;
662 ptr
->x_ix86_pmode
= opts
->x_ix86_pmode
;
663 ptr
->x_ix86_preferred_stack_boundary_arg
= opts
->x_ix86_preferred_stack_boundary_arg
;
664 ptr
->x_ix86_recip_name
= opts
->x_ix86_recip_name
;
665 ptr
->x_ix86_regparm
= opts
->x_ix86_regparm
;
666 ptr
->x_ix86_section_threshold
= opts
->x_ix86_section_threshold
;
667 ptr
->x_ix86_sse2avx
= opts
->x_ix86_sse2avx
;
668 ptr
->x_ix86_stack_protector_guard
= opts
->x_ix86_stack_protector_guard
;
669 ptr
->x_ix86_stringop_alg
= opts
->x_ix86_stringop_alg
;
670 ptr
->x_ix86_tls_dialect
= opts
->x_ix86_tls_dialect
;
671 ptr
->x_ix86_tune_ctrl_string
= opts
->x_ix86_tune_ctrl_string
;
672 ptr
->x_ix86_tune_memcpy_strategy
= opts
->x_ix86_tune_memcpy_strategy
;
673 ptr
->x_ix86_tune_memset_strategy
= opts
->x_ix86_tune_memset_strategy
;
674 ptr
->x_ix86_tune_no_default
= opts
->x_ix86_tune_no_default
;
675 ptr
->x_ix86_veclibabi_type
= opts
->x_ix86_veclibabi_type
;
677 /* The fields are char but the variables are not; make sure the
678 values fit in the fields. */
679 gcc_assert (ptr
->arch
== ix86_arch
);
680 gcc_assert (ptr
->schedule
== ix86_schedule
);
681 gcc_assert (ptr
->tune
== ix86_tune
);
682 gcc_assert (ptr
->branch_cost
== ix86_branch_cost
);
685 /* Feature tests against the various architecture variations, used to create
686 ix86_arch_features based on the processor mask. */
687 static unsigned HOST_WIDE_INT initial_ix86_arch_features
[X86_ARCH_LAST
] = {
688 /* X86_ARCH_CMOV: Conditional move was added for pentiumpro. */
689 ~(m_386
| m_486
| m_PENT
| m_LAKEMONT
| m_K6
),
691 /* X86_ARCH_CMPXCHG: Compare and exchange was added for 80486. */
694 /* X86_ARCH_CMPXCHG8B: Compare and exchange 8 bytes was added for pentium. */
697 /* X86_ARCH_XADD: Exchange and add was added for 80486. */
700 /* X86_ARCH_BSWAP: Byteswap was added for 80486. */
704 /* This table must be in sync with enum processor_type in i386.h. */
705 static const struct processor_costs
*processor_cost_table
[] =
753 /* Guarantee that the array is aligned with enum processor_type. */
754 STATIC_ASSERT (ARRAY_SIZE (processor_cost_table
) == PROCESSOR_max
);
757 ix86_option_override_internal (bool main_args_p
,
758 struct gcc_options
*opts
,
759 struct gcc_options
*opts_set
);
761 set_ix86_tune_features (struct gcc_options
*opts
,
762 enum processor_type ix86_tune
, bool dump
);
764 /* Restore the current options */
767 ix86_function_specific_restore (struct gcc_options
*opts
,
768 struct gcc_options */
* opts_set */
,
769 struct cl_target_option
*ptr
)
771 enum processor_type old_tune
= ix86_tune
;
772 enum processor_type old_arch
= ix86_arch
;
773 unsigned HOST_WIDE_INT ix86_arch_mask
;
776 /* We don't change -fPIC. */
777 opts
->x_flag_pic
= flag_pic
;
779 ix86_arch
= (enum processor_type
) ptr
->arch
;
780 ix86_schedule
= (enum attr_cpu
) ptr
->schedule
;
781 ix86_tune
= (enum processor_type
) ptr
->tune
;
782 x86_prefetch_sse
= ptr
->prefetch_sse
;
783 opts
->x_ix86_branch_cost
= ptr
->branch_cost
;
784 ix86_tune_defaulted
= ptr
->tune_defaulted
;
785 ix86_arch_specified
= ptr
->arch_specified
;
786 opts
->x_ix86_isa_flags_explicit
= ptr
->x_ix86_isa_flags_explicit
;
787 opts
->x_ix86_isa_flags2_explicit
= ptr
->x_ix86_isa_flags2_explicit
;
788 opts
->x_recip_mask_explicit
= ptr
->x_recip_mask_explicit
;
789 opts
->x_ix86_arch_string
= ptr
->x_ix86_arch_string
;
790 opts
->x_ix86_tune_string
= ptr
->x_ix86_tune_string
;
791 opts
->x_ix86_cmodel
= ptr
->x_ix86_cmodel
;
792 opts
->x_ix86_abi
= ptr
->x_ix86_abi
;
793 opts
->x_ix86_asm_dialect
= ptr
->x_ix86_asm_dialect
;
794 opts
->x_ix86_branch_cost
= ptr
->x_ix86_branch_cost
;
795 opts
->x_ix86_dump_tunes
= ptr
->x_ix86_dump_tunes
;
796 opts
->x_ix86_force_align_arg_pointer
= ptr
->x_ix86_force_align_arg_pointer
;
797 opts
->x_ix86_force_drap
= ptr
->x_ix86_force_drap
;
798 opts
->x_ix86_incoming_stack_boundary_arg
= ptr
->x_ix86_incoming_stack_boundary_arg
;
799 opts
->x_ix86_pmode
= ptr
->x_ix86_pmode
;
800 opts
->x_ix86_preferred_stack_boundary_arg
= ptr
->x_ix86_preferred_stack_boundary_arg
;
801 opts
->x_ix86_recip_name
= ptr
->x_ix86_recip_name
;
802 opts
->x_ix86_regparm
= ptr
->x_ix86_regparm
;
803 opts
->x_ix86_section_threshold
= ptr
->x_ix86_section_threshold
;
804 opts
->x_ix86_sse2avx
= ptr
->x_ix86_sse2avx
;
805 opts
->x_ix86_stack_protector_guard
= ptr
->x_ix86_stack_protector_guard
;
806 opts
->x_ix86_stringop_alg
= ptr
->x_ix86_stringop_alg
;
807 opts
->x_ix86_tls_dialect
= ptr
->x_ix86_tls_dialect
;
808 opts
->x_ix86_tune_ctrl_string
= ptr
->x_ix86_tune_ctrl_string
;
809 opts
->x_ix86_tune_memcpy_strategy
= ptr
->x_ix86_tune_memcpy_strategy
;
810 opts
->x_ix86_tune_memset_strategy
= ptr
->x_ix86_tune_memset_strategy
;
811 opts
->x_ix86_tune_no_default
= ptr
->x_ix86_tune_no_default
;
812 opts
->x_ix86_veclibabi_type
= ptr
->x_ix86_veclibabi_type
;
813 ix86_tune_cost
= processor_cost_table
[ix86_tune
];
814 /* TODO: ix86_cost should be chosen at instruction or function granuality
815 so for cold code we use size_cost even in !optimize_size compilation. */
816 if (opts
->x_optimize_size
)
817 ix86_cost
= &ix86_size_cost
;
819 ix86_cost
= ix86_tune_cost
;
821 /* Recreate the arch feature tests if the arch changed */
822 if (old_arch
!= ix86_arch
)
824 ix86_arch_mask
= HOST_WIDE_INT_1U
<< ix86_arch
;
825 for (i
= 0; i
< X86_ARCH_LAST
; ++i
)
826 ix86_arch_features
[i
]
827 = !!(initial_ix86_arch_features
[i
] & ix86_arch_mask
);
830 /* Recreate the tune optimization tests */
831 if (old_tune
!= ix86_tune
)
832 set_ix86_tune_features (opts
, ix86_tune
, false);
835 /* Adjust target options after streaming them in. This is mainly about
836 reconciling them with global options. */
839 ix86_function_specific_post_stream_in (struct cl_target_option
*ptr
)
841 /* flag_pic is a global option, but ix86_cmodel is target saved option
842 partly computed from flag_pic. If flag_pic is on, adjust x_ix86_cmodel
843 for PIC, or error out. */
845 switch (ptr
->x_ix86_cmodel
)
848 ptr
->x_ix86_cmodel
= CM_SMALL_PIC
;
852 ptr
->x_ix86_cmodel
= CM_MEDIUM_PIC
;
856 ptr
->x_ix86_cmodel
= CM_LARGE_PIC
;
860 error ("code model %s does not support PIC mode", "kernel");
867 switch (ptr
->x_ix86_cmodel
)
870 ptr
->x_ix86_cmodel
= CM_SMALL
;
874 ptr
->x_ix86_cmodel
= CM_MEDIUM
;
878 ptr
->x_ix86_cmodel
= CM_LARGE
;
886 /* Print the current options */
889 ix86_function_specific_print (FILE *file
, int indent
,
890 struct cl_target_option
*ptr
)
893 = ix86_target_string (ptr
->x_ix86_isa_flags
, ptr
->x_ix86_isa_flags2
,
894 ptr
->x_target_flags
, ptr
->x_ix86_target_flags
,
895 NULL
, NULL
, ptr
->x_ix86_fpmath
,
896 ptr
->x_prefer_vector_width_type
, false, true);
898 gcc_assert (ptr
->arch
< PROCESSOR_max
);
899 fprintf (file
, "%*sarch = %d (%s)\n",
901 ptr
->arch
, processor_names
[ptr
->arch
]);
903 gcc_assert (ptr
->tune
< PROCESSOR_max
);
904 fprintf (file
, "%*stune = %d (%s)\n",
906 ptr
->tune
, processor_names
[ptr
->tune
]);
908 fprintf (file
, "%*sbranch_cost = %d\n", indent
, "", ptr
->branch_cost
);
912 fprintf (file
, "%*s%s\n", indent
, "", target_string
);
913 free (target_string
);
918 /* Inner function to process the attribute((target(...))), take an argument and
919 set the current options from the argument. If we have a list, recursively go
923 ix86_valid_target_attribute_inner_p (tree fndecl
, tree args
, char *p_strings
[],
924 struct gcc_options
*opts
,
925 struct gcc_options
*opts_set
,
926 struct gcc_options
*enum_opts_set
,
927 bool target_clone_attr
)
932 #define IX86_ATTR_ISA(S,O) { S, sizeof (S)-1, ix86_opt_isa, O, 0 }
933 #define IX86_ATTR_STR(S,O) { S, sizeof (S)-1, ix86_opt_str, O, 0 }
934 #define IX86_ATTR_ENUM(S,O) { S, sizeof (S)-1, ix86_opt_enum, O, 0 }
935 #define IX86_ATTR_YES(S,O,M) { S, sizeof (S)-1, ix86_opt_yes, O, M }
936 #define IX86_ATTR_NO(S,O,M) { S, sizeof (S)-1, ix86_opt_no, O, M }
937 #define IX86_ATTR_IX86_YES(S,O,M) \
938 { S, sizeof (S)-1, ix86_opt_ix86_yes, O, M }
939 #define IX86_ATTR_IX86_NO(S,O,M) \
940 { S, sizeof (S)-1, ix86_opt_ix86_no, O, M }
958 enum ix86_opt_type type
;
963 IX86_ATTR_ISA ("pconfig", OPT_mpconfig
),
964 IX86_ATTR_ISA ("wbnoinvd", OPT_mwbnoinvd
),
965 IX86_ATTR_ISA ("sgx", OPT_msgx
),
966 IX86_ATTR_ISA ("avx5124fmaps", OPT_mavx5124fmaps
),
967 IX86_ATTR_ISA ("avx5124vnniw", OPT_mavx5124vnniw
),
968 IX86_ATTR_ISA ("avx512vpopcntdq", OPT_mavx512vpopcntdq
),
969 IX86_ATTR_ISA ("avx512vbmi2", OPT_mavx512vbmi2
),
970 IX86_ATTR_ISA ("avx512vnni", OPT_mavx512vnni
),
971 IX86_ATTR_ISA ("avx512bitalg", OPT_mavx512bitalg
),
972 IX86_ATTR_ISA ("avx512vp2intersect", OPT_mavx512vp2intersect
),
974 IX86_ATTR_ISA ("avx512vbmi", OPT_mavx512vbmi
),
975 IX86_ATTR_ISA ("avx512ifma", OPT_mavx512ifma
),
976 IX86_ATTR_ISA ("avx512vl", OPT_mavx512vl
),
977 IX86_ATTR_ISA ("avx512bw", OPT_mavx512bw
),
978 IX86_ATTR_ISA ("avx512dq", OPT_mavx512dq
),
979 IX86_ATTR_ISA ("avx512er", OPT_mavx512er
),
980 IX86_ATTR_ISA ("avx512pf", OPT_mavx512pf
),
981 IX86_ATTR_ISA ("avx512cd", OPT_mavx512cd
),
982 IX86_ATTR_ISA ("avx512f", OPT_mavx512f
),
983 IX86_ATTR_ISA ("avx2", OPT_mavx2
),
984 IX86_ATTR_ISA ("fma", OPT_mfma
),
985 IX86_ATTR_ISA ("xop", OPT_mxop
),
986 IX86_ATTR_ISA ("fma4", OPT_mfma4
),
987 IX86_ATTR_ISA ("f16c", OPT_mf16c
),
988 IX86_ATTR_ISA ("avx", OPT_mavx
),
989 IX86_ATTR_ISA ("sse4", OPT_msse4
),
990 IX86_ATTR_ISA ("sse4.2", OPT_msse4_2
),
991 IX86_ATTR_ISA ("sse4.1", OPT_msse4_1
),
992 IX86_ATTR_ISA ("sse4a", OPT_msse4a
),
993 IX86_ATTR_ISA ("ssse3", OPT_mssse3
),
994 IX86_ATTR_ISA ("sse3", OPT_msse3
),
995 IX86_ATTR_ISA ("aes", OPT_maes
),
996 IX86_ATTR_ISA ("sha", OPT_msha
),
997 IX86_ATTR_ISA ("pclmul", OPT_mpclmul
),
998 IX86_ATTR_ISA ("sse2", OPT_msse2
),
999 IX86_ATTR_ISA ("sse", OPT_msse
),
1000 IX86_ATTR_ISA ("3dnowa", OPT_m3dnowa
),
1001 IX86_ATTR_ISA ("3dnow", OPT_m3dnow
),
1002 IX86_ATTR_ISA ("mmx", OPT_mmmx
),
1003 IX86_ATTR_ISA ("rtm", OPT_mrtm
),
1004 IX86_ATTR_ISA ("prfchw", OPT_mprfchw
),
1005 IX86_ATTR_ISA ("rdseed", OPT_mrdseed
),
1006 IX86_ATTR_ISA ("adx", OPT_madx
),
1007 IX86_ATTR_ISA ("prefetchwt1", OPT_mprefetchwt1
),
1008 IX86_ATTR_ISA ("clflushopt", OPT_mclflushopt
),
1009 IX86_ATTR_ISA ("xsaves", OPT_mxsaves
),
1010 IX86_ATTR_ISA ("xsavec", OPT_mxsavec
),
1011 IX86_ATTR_ISA ("xsaveopt", OPT_mxsaveopt
),
1012 IX86_ATTR_ISA ("xsave", OPT_mxsave
),
1013 IX86_ATTR_ISA ("abm", OPT_mabm
),
1014 IX86_ATTR_ISA ("bmi", OPT_mbmi
),
1015 IX86_ATTR_ISA ("bmi2", OPT_mbmi2
),
1016 IX86_ATTR_ISA ("lzcnt", OPT_mlzcnt
),
1017 IX86_ATTR_ISA ("tbm", OPT_mtbm
),
1018 IX86_ATTR_ISA ("popcnt", OPT_mpopcnt
),
1019 IX86_ATTR_ISA ("cx16", OPT_mcx16
),
1020 IX86_ATTR_ISA ("sahf", OPT_msahf
),
1021 IX86_ATTR_ISA ("movbe", OPT_mmovbe
),
1022 IX86_ATTR_ISA ("crc32", OPT_mcrc32
),
1023 IX86_ATTR_ISA ("fsgsbase", OPT_mfsgsbase
),
1024 IX86_ATTR_ISA ("rdrnd", OPT_mrdrnd
),
1025 IX86_ATTR_ISA ("mwaitx", OPT_mmwaitx
),
1026 IX86_ATTR_ISA ("clzero", OPT_mclzero
),
1027 IX86_ATTR_ISA ("pku", OPT_mpku
),
1028 IX86_ATTR_ISA ("lwp", OPT_mlwp
),
1029 IX86_ATTR_ISA ("hle", OPT_mhle
),
1030 IX86_ATTR_ISA ("fxsr", OPT_mfxsr
),
1031 IX86_ATTR_ISA ("clwb", OPT_mclwb
),
1032 IX86_ATTR_ISA ("rdpid", OPT_mrdpid
),
1033 IX86_ATTR_ISA ("gfni", OPT_mgfni
),
1034 IX86_ATTR_ISA ("shstk", OPT_mshstk
),
1035 IX86_ATTR_ISA ("vaes", OPT_mvaes
),
1036 IX86_ATTR_ISA ("vpclmulqdq", OPT_mvpclmulqdq
),
1037 IX86_ATTR_ISA ("movdiri", OPT_mmovdiri
),
1038 IX86_ATTR_ISA ("movdir64b", OPT_mmovdir64b
),
1039 IX86_ATTR_ISA ("waitpkg", OPT_mwaitpkg
),
1040 IX86_ATTR_ISA ("cldemote", OPT_mcldemote
),
1041 IX86_ATTR_ISA ("uintr", OPT_muintr
),
1042 IX86_ATTR_ISA ("ptwrite", OPT_mptwrite
),
1043 IX86_ATTR_ISA ("kl", OPT_mkl
),
1044 IX86_ATTR_ISA ("widekl", OPT_mwidekl
),
1045 IX86_ATTR_ISA ("avx512bf16", OPT_mavx512bf16
),
1046 IX86_ATTR_ISA ("enqcmd", OPT_menqcmd
),
1047 IX86_ATTR_ISA ("serialize", OPT_mserialize
),
1048 IX86_ATTR_ISA ("tsxldtrk", OPT_mtsxldtrk
),
1049 IX86_ATTR_ISA ("amx-tile", OPT_mamx_tile
),
1050 IX86_ATTR_ISA ("amx-int8", OPT_mamx_int8
),
1051 IX86_ATTR_ISA ("amx-bf16", OPT_mamx_bf16
),
1052 IX86_ATTR_ISA ("hreset", OPT_mhreset
),
1053 IX86_ATTR_ISA ("avxvnni", OPT_mavxvnni
),
1056 IX86_ATTR_ENUM ("fpmath=", OPT_mfpmath_
),
1057 IX86_ATTR_ENUM ("prefer-vector-width=", OPT_mprefer_vector_width_
),
1059 /* string options */
1060 IX86_ATTR_STR ("arch=", IX86_FUNCTION_SPECIFIC_ARCH
),
1061 IX86_ATTR_STR ("tune=", IX86_FUNCTION_SPECIFIC_TUNE
),
1064 IX86_ATTR_YES ("cld",
1068 IX86_ATTR_NO ("fancy-math-387",
1069 OPT_mfancy_math_387
,
1070 MASK_NO_FANCY_MATH_387
),
1072 IX86_ATTR_YES ("ieee-fp",
1076 IX86_ATTR_YES ("inline-all-stringops",
1077 OPT_minline_all_stringops
,
1078 MASK_INLINE_ALL_STRINGOPS
),
1080 IX86_ATTR_YES ("inline-stringops-dynamically",
1081 OPT_minline_stringops_dynamically
,
1082 MASK_INLINE_STRINGOPS_DYNAMICALLY
),
1084 IX86_ATTR_NO ("align-stringops",
1085 OPT_mno_align_stringops
,
1086 MASK_NO_ALIGN_STRINGOPS
),
1088 IX86_ATTR_YES ("recip",
1092 IX86_ATTR_IX86_YES ("general-regs-only",
1093 OPT_mgeneral_regs_only
,
1094 OPTION_MASK_GENERAL_REGS_ONLY
),
1098 = fndecl
== NULL
? UNKNOWN_LOCATION
: DECL_SOURCE_LOCATION (fndecl
);
1099 const char *attr_name
= target_clone_attr
? "target_clone" : "target";
1101 /* If this is a list, recurse to get the options. */
1102 if (TREE_CODE (args
) == TREE_LIST
)
1106 for (; args
; args
= TREE_CHAIN (args
))
1107 if (TREE_VALUE (args
)
1108 && !ix86_valid_target_attribute_inner_p (fndecl
, TREE_VALUE (args
),
1109 p_strings
, opts
, opts_set
,
1117 else if (TREE_CODE (args
) != STRING_CST
)
1119 error_at (loc
, "attribute %qs argument is not a string", attr_name
);
1123 /* Handle multiple arguments separated by commas. */
1124 next_optstr
= ASTRDUP (TREE_STRING_POINTER (args
));
1126 while (next_optstr
&& *next_optstr
!= '\0')
1128 char *p
= next_optstr
;
1130 char *comma
= strchr (next_optstr
, ',');
1131 size_t len
, opt_len
;
1136 enum ix86_opt_type type
= ix86_opt_unknown
;
1142 len
= comma
- next_optstr
;
1143 next_optstr
= comma
+ 1;
1151 /* Recognize no-xxx. */
1152 if (len
> 3 && p
[0] == 'n' && p
[1] == 'o' && p
[2] == '-')
1161 /* Find the option. */
1164 for (i
= 0; i
< ARRAY_SIZE (attrs
); i
++)
1166 type
= attrs
[i
].type
;
1167 opt_len
= attrs
[i
].len
;
1168 if (ch
== attrs
[i
].string
[0]
1169 && ((type
!= ix86_opt_str
&& type
!= ix86_opt_enum
)
1172 && memcmp (p
, attrs
[i
].string
, opt_len
) == 0)
1175 mask
= attrs
[i
].mask
;
1180 /* Process the option. */
1183 error_at (loc
, "attribute %qs argument %qs is unknown",
1188 else if (type
== ix86_opt_isa
)
1190 struct cl_decoded_option decoded
;
1192 generate_option (opt
, NULL
, opt_set_p
, CL_TARGET
, &decoded
);
1193 ix86_handle_option (opts
, opts_set
,
1194 &decoded
, input_location
);
1197 else if (type
== ix86_opt_yes
|| type
== ix86_opt_no
)
1199 if (type
== ix86_opt_no
)
1200 opt_set_p
= !opt_set_p
;
1203 opts
->x_target_flags
|= mask
;
1205 opts
->x_target_flags
&= ~mask
;
1208 else if (type
== ix86_opt_ix86_yes
|| type
== ix86_opt_ix86_no
)
1210 if (mask
== OPTION_MASK_GENERAL_REGS_ONLY
)
1214 error_at (loc
, "pragma or attribute %<target(\"%s\")%> "
1215 "does not allow a negated form", p
);
1219 if (type
!= ix86_opt_ix86_yes
)
1222 opts
->x_ix86_target_flags
|= mask
;
1224 struct cl_decoded_option decoded
;
1225 generate_option (opt
, NULL
, opt_set_p
, CL_TARGET
,
1227 ix86_handle_option (opts
, opts_set
, &decoded
,
1232 if (type
== ix86_opt_ix86_no
)
1233 opt_set_p
= !opt_set_p
;
1236 opts
->x_ix86_target_flags
|= mask
;
1238 opts
->x_ix86_target_flags
&= ~mask
;
1242 else if (type
== ix86_opt_str
)
1246 error_at (loc
, "attribute value %qs was already specified "
1247 "in %qs attribute", orig_p
, attr_name
);
1252 p_strings
[opt
] = xstrdup (p
+ opt_len
);
1253 if (opt
== IX86_FUNCTION_SPECIFIC_ARCH
)
1255 /* If arch= is set, clear all bits in x_ix86_isa_flags,
1256 except for ISA_64BIT, ABI_64, ABI_X32, and CODE16
1257 and all bits in x_ix86_isa_flags2. */
1258 opts
->x_ix86_isa_flags
&= (OPTION_MASK_ISA_64BIT
1259 | OPTION_MASK_ABI_64
1260 | OPTION_MASK_ABI_X32
1261 | OPTION_MASK_CODE16
);
1262 opts
->x_ix86_isa_flags_explicit
&= (OPTION_MASK_ISA_64BIT
1263 | OPTION_MASK_ABI_64
1264 | OPTION_MASK_ABI_X32
1265 | OPTION_MASK_CODE16
);
1266 opts
->x_ix86_isa_flags2
= 0;
1267 opts
->x_ix86_isa_flags2_explicit
= 0;
1272 else if (type
== ix86_opt_enum
)
1277 arg_ok
= opt_enum_arg_to_value (opt
, p
+ opt_len
, &value
, CL_TARGET
);
1279 set_option (opts
, enum_opts_set
, opt
, value
,
1280 p
+ opt_len
, DK_UNSPECIFIED
, input_location
,
1284 error_at (loc
, "attribute value %qs is unknown in %qs attribute",
1297 /* Release allocated strings. */
1299 release_options_strings (char **option_strings
)
1301 /* Free up memory allocated to hold the strings */
1302 for (unsigned i
= 0; i
< IX86_FUNCTION_SPECIFIC_MAX
; i
++)
1303 free (option_strings
[i
]);
1306 /* Return a TARGET_OPTION_NODE tree of the target options listed or NULL. */
1309 ix86_valid_target_attribute_tree (tree fndecl
, tree args
,
1310 struct gcc_options
*opts
,
1311 struct gcc_options
*opts_set
,
1312 bool target_clone_attr
)
1314 const char *orig_arch_string
= opts
->x_ix86_arch_string
;
1315 const char *orig_tune_string
= opts
->x_ix86_tune_string
;
1316 enum fpmath_unit orig_fpmath_set
= opts_set
->x_ix86_fpmath
;
1317 enum prefer_vector_width orig_pvw_set
= opts_set
->x_prefer_vector_width_type
;
1318 int orig_tune_defaulted
= ix86_tune_defaulted
;
1319 int orig_arch_specified
= ix86_arch_specified
;
1320 char *option_strings
[IX86_FUNCTION_SPECIFIC_MAX
] = { NULL
, NULL
};
1322 struct cl_target_option
*def
1323 = TREE_TARGET_OPTION (target_option_default_node
);
1324 struct gcc_options enum_opts_set
;
1326 memset (&enum_opts_set
, 0, sizeof (enum_opts_set
));
1328 /* Process each of the options on the chain. */
1329 if (!ix86_valid_target_attribute_inner_p (fndecl
, args
, option_strings
, opts
,
1330 opts_set
, &enum_opts_set
,
1332 return error_mark_node
;
1334 /* If the changed options are different from the default, rerun
1335 ix86_option_override_internal, and then save the options away.
1336 The string options are attribute options, and will be undone
1337 when we copy the save structure. */
1338 if (opts
->x_ix86_isa_flags
!= def
->x_ix86_isa_flags
1339 || opts
->x_ix86_isa_flags2
!= def
->x_ix86_isa_flags2
1340 || opts
->x_target_flags
!= def
->x_target_flags
1341 || option_strings
[IX86_FUNCTION_SPECIFIC_ARCH
]
1342 || option_strings
[IX86_FUNCTION_SPECIFIC_TUNE
]
1343 || enum_opts_set
.x_ix86_fpmath
1344 || enum_opts_set
.x_prefer_vector_width_type
)
1346 /* If we are using the default tune= or arch=, undo the string assigned,
1347 and use the default. */
1348 if (option_strings
[IX86_FUNCTION_SPECIFIC_ARCH
])
1349 opts
->x_ix86_arch_string
1350 = ggc_strdup (option_strings
[IX86_FUNCTION_SPECIFIC_ARCH
]);
1351 else if (!orig_arch_specified
)
1352 opts
->x_ix86_arch_string
= NULL
;
1354 if (option_strings
[IX86_FUNCTION_SPECIFIC_TUNE
])
1355 opts
->x_ix86_tune_string
1356 = ggc_strdup (option_strings
[IX86_FUNCTION_SPECIFIC_TUNE
]);
1357 else if (orig_tune_defaulted
)
1358 opts
->x_ix86_tune_string
= NULL
;
1360 /* If fpmath= is not set, and we now have sse2 on 32-bit, use it. */
1361 if (enum_opts_set
.x_ix86_fpmath
)
1362 opts_set
->x_ix86_fpmath
= (enum fpmath_unit
) 1;
1363 if (enum_opts_set
.x_prefer_vector_width_type
)
1364 opts_set
->x_prefer_vector_width_type
= (enum prefer_vector_width
) 1;
1366 /* Do any overrides, such as arch=xxx, or tune=xxx support. */
1367 bool r
= ix86_option_override_internal (false, opts
, opts_set
);
1370 release_options_strings (option_strings
);
1371 return error_mark_node
;
1374 /* Add any builtin functions with the new isa if any. */
1375 ix86_add_new_builtins (opts
->x_ix86_isa_flags
, opts
->x_ix86_isa_flags2
);
1377 enum excess_precision orig_ix86_excess_precision
1378 = opts
->x_ix86_excess_precision
;
1379 bool orig_ix86_unsafe_math_optimizations
1380 = opts
->x_ix86_unsafe_math_optimizations
;
1381 opts
->x_ix86_excess_precision
= opts
->x_flag_excess_precision
;
1382 opts
->x_ix86_unsafe_math_optimizations
1383 = opts
->x_flag_unsafe_math_optimizations
;
1385 /* Save the current options unless we are validating options for
1387 t
= build_target_option_node (opts
, opts_set
);
1389 opts
->x_ix86_arch_string
= orig_arch_string
;
1390 opts
->x_ix86_tune_string
= orig_tune_string
;
1391 opts_set
->x_ix86_fpmath
= orig_fpmath_set
;
1392 opts_set
->x_prefer_vector_width_type
= orig_pvw_set
;
1393 opts
->x_ix86_excess_precision
= orig_ix86_excess_precision
;
1394 opts
->x_ix86_unsafe_math_optimizations
1395 = orig_ix86_unsafe_math_optimizations
;
1397 release_options_strings (option_strings
);
1403 /* Hook to validate attribute((target("string"))). */
1406 ix86_valid_target_attribute_p (tree fndecl
,
1407 tree
ARG_UNUSED (name
),
1411 struct gcc_options func_options
, func_options_set
;
1412 tree new_target
, new_optimize
;
1415 /* attribute((target("default"))) does nothing, beyond
1416 affecting multi-versioning. */
1417 if (TREE_VALUE (args
)
1418 && TREE_CODE (TREE_VALUE (args
)) == STRING_CST
1419 && TREE_CHAIN (args
) == NULL_TREE
1420 && strcmp (TREE_STRING_POINTER (TREE_VALUE (args
)), "default") == 0)
1423 tree old_optimize
= build_optimization_node (&global_options
,
1424 &global_options_set
);
1426 /* Get the optimization options of the current function. */
1427 tree func_optimize
= DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl
);
1430 func_optimize
= old_optimize
;
1432 /* Init func_options. */
1433 memset (&func_options
, 0, sizeof (func_options
));
1434 init_options_struct (&func_options
, NULL
);
1435 lang_hooks
.init_options_struct (&func_options
);
1436 memset (&func_options_set
, 0, sizeof (func_options_set
));
1438 cl_optimization_restore (&func_options
, &func_options_set
,
1439 TREE_OPTIMIZATION (func_optimize
));
1441 /* Initialize func_options to the default before its target options can
1443 cl_target_option_restore (&func_options
, &func_options_set
,
1444 TREE_TARGET_OPTION (target_option_default_node
));
1446 /* FLAGS == 1 is used for target_clones attribute. */
1448 = ix86_valid_target_attribute_tree (fndecl
, args
, &func_options
,
1449 &func_options_set
, flags
== 1);
1451 new_optimize
= build_optimization_node (&func_options
, &func_options_set
);
1453 if (new_target
== error_mark_node
)
1456 else if (fndecl
&& new_target
)
1458 DECL_FUNCTION_SPECIFIC_TARGET (fndecl
) = new_target
;
1460 if (old_optimize
!= new_optimize
)
1461 DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl
) = new_optimize
;
1467 const char *stringop_alg_names
[] = {
1469 #define DEF_ALG(alg, name) #name,
1470 #include "stringop.def"
1475 /* Parse parameter string passed to -mmemcpy-strategy= or -mmemset-strategy=.
1476 The string is of the following form (or comma separated list of it):
1478 strategy_alg:max_size:[align|noalign]
1480 where the full size range for the strategy is either [0, max_size] or
1481 [min_size, max_size], in which min_size is the max_size + 1 of the
1482 preceding range. The last size range must have max_size == -1.
1487 -mmemcpy-strategy=libcall:-1:noalign
1489 this is equivalent to (for known size memcpy) -mstringop-strategy=libcall
1493 -mmemset-strategy=rep_8byte:16:noalign,vector_loop:2048:align,libcall:-1:noalign
1495 This is to tell the compiler to use the following strategy for memset
1496 1) when the expected size is between [1, 16], use rep_8byte strategy;
1497 2) when the size is between [17, 2048], use vector_loop;
1498 3) when the size is > 2048, use libcall. */
1500 struct stringop_size_range
1508 ix86_parse_stringop_strategy_string (char *strategy_str
, bool is_memset
)
1510 const struct stringop_algs
*default_algs
;
1511 stringop_size_range input_ranges
[MAX_STRINGOP_ALGS
];
1512 char *curr_range_str
, *next_range_str
;
1513 const char *opt
= is_memset
? "-mmemset_strategy=" : "-mmemcpy_strategy=";
1517 default_algs
= &ix86_cost
->memset
[TARGET_64BIT
!= 0];
1519 default_algs
= &ix86_cost
->memcpy
[TARGET_64BIT
!= 0];
1521 curr_range_str
= strategy_str
;
1528 next_range_str
= strchr (curr_range_str
, ',');
1530 *next_range_str
++ = '\0';
1532 if (sscanf (curr_range_str
, "%20[^:]:%d:%10s", alg_name
, &maxs
,
1535 error ("wrong argument %qs to option %qs", curr_range_str
, opt
);
1539 if (n
> 0 && (maxs
< (input_ranges
[n
- 1].max
+ 1) && maxs
!= -1))
1541 error ("size ranges of option %qs should be increasing", opt
);
1545 for (i
= 0; i
< last_alg
; i
++)
1546 if (!strcmp (alg_name
, stringop_alg_names
[i
]))
1551 error ("wrong strategy name %qs specified for option %qs",
1554 auto_vec
<const char *> candidates
;
1555 for (i
= 0; i
< last_alg
; i
++)
1556 if ((stringop_alg
) i
!= rep_prefix_8_byte
|| TARGET_64BIT
)
1557 candidates
.safe_push (stringop_alg_names
[i
]);
1561 = candidates_list_and_hint (alg_name
, s
, candidates
);
1563 inform (input_location
,
1564 "valid arguments to %qs are: %s; did you mean %qs?",
1567 inform (input_location
, "valid arguments to %qs are: %s",
1573 if ((stringop_alg
) i
== rep_prefix_8_byte
1576 /* rep; movq isn't available in 32-bit code. */
1577 error ("strategy name %qs specified for option %qs "
1578 "not supported for 32-bit code", alg_name
, opt
);
1582 input_ranges
[n
].max
= maxs
;
1583 input_ranges
[n
].alg
= (stringop_alg
) i
;
1584 if (!strcmp (align
, "align"))
1585 input_ranges
[n
].noalign
= false;
1586 else if (!strcmp (align
, "noalign"))
1587 input_ranges
[n
].noalign
= true;
1590 error ("unknown alignment %qs specified for option %qs", align
, opt
);
1594 curr_range_str
= next_range_str
;
1596 while (curr_range_str
);
1598 if (input_ranges
[n
- 1].max
!= -1)
1600 error ("the max value for the last size range should be -1"
1601 " for option %qs", opt
);
1605 if (n
> MAX_STRINGOP_ALGS
)
1607 error ("too many size ranges specified in option %qs", opt
);
1611 /* Now override the default algs array. */
1612 for (i
= 0; i
< n
; i
++)
1614 *const_cast<int *>(&default_algs
->size
[i
].max
) = input_ranges
[i
].max
;
1615 *const_cast<stringop_alg
*>(&default_algs
->size
[i
].alg
)
1616 = input_ranges
[i
].alg
;
1617 *const_cast<int *>(&default_algs
->size
[i
].noalign
)
1618 = input_ranges
[i
].noalign
;
1623 /* parse -mtune-ctrl= option. When DUMP is true,
1624 print the features that are explicitly set. */
1627 parse_mtune_ctrl_str (struct gcc_options
*opts
, bool dump
)
1629 if (!opts
->x_ix86_tune_ctrl_string
)
1632 char *next_feature_string
= NULL
;
1633 char *curr_feature_string
= xstrdup (opts
->x_ix86_tune_ctrl_string
);
1634 char *orig
= curr_feature_string
;
1640 next_feature_string
= strchr (curr_feature_string
, ',');
1641 if (next_feature_string
)
1642 *next_feature_string
++ = '\0';
1643 if (*curr_feature_string
== '^')
1645 curr_feature_string
++;
1648 for (i
= 0; i
< X86_TUNE_LAST
; i
++)
1650 if (!strcmp (curr_feature_string
, ix86_tune_feature_names
[i
]))
1652 ix86_tune_features
[i
] = !clear
;
1654 fprintf (stderr
, "Explicitly %s feature %s\n",
1655 clear
? "clear" : "set", ix86_tune_feature_names
[i
]);
1659 if (i
== X86_TUNE_LAST
)
1660 error ("unknown parameter to option %<-mtune-ctrl%>: %s",
1661 clear
? curr_feature_string
- 1 : curr_feature_string
);
1662 curr_feature_string
= next_feature_string
;
1664 while (curr_feature_string
);
1668 /* Helper function to set ix86_tune_features. IX86_TUNE is the
1672 set_ix86_tune_features (struct gcc_options
*opts
,
1673 enum processor_type ix86_tune
, bool dump
)
1675 unsigned HOST_WIDE_INT ix86_tune_mask
= HOST_WIDE_INT_1U
<< ix86_tune
;
1678 for (i
= 0; i
< X86_TUNE_LAST
; ++i
)
1680 if (ix86_tune_no_default
)
1681 ix86_tune_features
[i
] = 0;
1683 ix86_tune_features
[i
]
1684 = !!(initial_ix86_tune_features
[i
] & ix86_tune_mask
);
1689 fprintf (stderr
, "List of x86 specific tuning parameter names:\n");
1690 for (i
= 0; i
< X86_TUNE_LAST
; i
++)
1691 fprintf (stderr
, "%s : %s\n", ix86_tune_feature_names
[i
],
1692 ix86_tune_features
[i
] ? "on" : "off");
1695 parse_mtune_ctrl_str (opts
, dump
);
1699 /* Default align_* from the processor table. */
1702 ix86_default_align (struct gcc_options
*opts
)
1704 /* -falign-foo without argument: supply one. */
1705 if (opts
->x_flag_align_loops
&& !opts
->x_str_align_loops
)
1706 opts
->x_str_align_loops
= processor_cost_table
[ix86_tune
]->align_loop
;
1707 if (opts
->x_flag_align_jumps
&& !opts
->x_str_align_jumps
)
1708 opts
->x_str_align_jumps
= processor_cost_table
[ix86_tune
]->align_jump
;
1709 if (opts
->x_flag_align_labels
&& !opts
->x_str_align_labels
)
1710 opts
->x_str_align_labels
= processor_cost_table
[ix86_tune
]->align_label
;
1711 if (opts
->x_flag_align_functions
&& !opts
->x_str_align_functions
)
1712 opts
->x_str_align_functions
= processor_cost_table
[ix86_tune
]->align_func
;
1715 #ifndef USE_IX86_FRAME_POINTER
1716 #define USE_IX86_FRAME_POINTER 0
1719 /* (Re)compute option overrides affected by optimization levels in
1720 target-specific ways. */
1723 ix86_recompute_optlev_based_flags (struct gcc_options
*opts
,
1724 struct gcc_options
*opts_set
)
1726 /* Set the default values for switches whose default depends on TARGET_64BIT
1727 in case they weren't overwritten by command line options. */
1728 if (TARGET_64BIT_P (opts
->x_ix86_isa_flags
))
1730 if (opts
->x_optimize
>= 1)
1731 SET_OPTION_IF_UNSET (opts
, opts_set
, flag_omit_frame_pointer
,
1732 !USE_IX86_FRAME_POINTER
);
1733 if (opts
->x_flag_asynchronous_unwind_tables
1734 && TARGET_64BIT_MS_ABI
)
1735 SET_OPTION_IF_UNSET (opts
, opts_set
, flag_unwind_tables
, 1);
1736 if (opts
->x_flag_asynchronous_unwind_tables
== 2)
1737 opts
->x_flag_unwind_tables
1738 = opts
->x_flag_asynchronous_unwind_tables
= 1;
1739 if (opts
->x_flag_pcc_struct_return
== 2)
1740 opts
->x_flag_pcc_struct_return
= 0;
1744 if (opts
->x_optimize
>= 1)
1745 SET_OPTION_IF_UNSET (opts
, opts_set
, flag_omit_frame_pointer
,
1746 !(USE_IX86_FRAME_POINTER
|| opts
->x_optimize_size
));
1747 if (opts
->x_flag_asynchronous_unwind_tables
== 2)
1748 opts
->x_flag_asynchronous_unwind_tables
= !USE_IX86_FRAME_POINTER
;
1749 if (opts
->x_flag_pcc_struct_return
== 2)
1751 /* Intel MCU psABI specifies that -freg-struct-return should
1752 be on. Instead of setting DEFAULT_PCC_STRUCT_RETURN to 0,
1753 we check -miamcu so that -freg-struct-return is always
1754 turned on if -miamcu is used. */
1755 if (TARGET_IAMCU_P (opts
->x_target_flags
))
1756 opts
->x_flag_pcc_struct_return
= 0;
1758 opts
->x_flag_pcc_struct_return
= DEFAULT_PCC_STRUCT_RETURN
;
1763 /* Implement TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE hook. */
1766 ix86_override_options_after_change (void)
1768 ix86_default_align (&global_options
);
1769 ix86_recompute_optlev_based_flags (&global_options
, &global_options_set
);
1772 /* Clear stack slot assignments remembered from previous functions.
1773 This is called from INIT_EXPANDERS once before RTL is emitted for each
1776 static struct machine_function
*
1777 ix86_init_machine_status (void)
1779 struct machine_function
*f
;
1781 f
= ggc_cleared_alloc
<machine_function
> ();
1782 f
->call_abi
= ix86_abi
;
1783 f
->stack_frame_required
= true;
1788 /* Override various settings based on options. If MAIN_ARGS_P, the
1789 options are from the command line, otherwise they are from
1790 attributes. Return true if there's an error related to march
1794 ix86_option_override_internal (bool main_args_p
,
1795 struct gcc_options
*opts
,
1796 struct gcc_options
*opts_set
)
1799 unsigned HOST_WIDE_INT ix86_arch_mask
;
1800 const bool ix86_tune_specified
= (opts
->x_ix86_tune_string
!= NULL
);
1802 /* -mrecip options. */
1805 const char *string
; /* option name */
1806 unsigned int mask
; /* mask bits to set */
1808 const recip_options
[] =
1810 { "all", RECIP_MASK_ALL
},
1811 { "none", RECIP_MASK_NONE
},
1812 { "div", RECIP_MASK_DIV
},
1813 { "sqrt", RECIP_MASK_SQRT
},
1814 { "vec-div", RECIP_MASK_VEC_DIV
},
1815 { "vec-sqrt", RECIP_MASK_VEC_SQRT
},
1819 /* Turn off both OPTION_MASK_ABI_64 and OPTION_MASK_ABI_X32 if
1820 TARGET_64BIT_DEFAULT is true and TARGET_64BIT is false. */
1821 if (TARGET_64BIT_DEFAULT
&& !TARGET_64BIT_P (opts
->x_ix86_isa_flags
))
1822 opts
->x_ix86_isa_flags
&= ~(OPTION_MASK_ABI_64
| OPTION_MASK_ABI_X32
);
1823 #ifdef TARGET_BI_ARCH
1826 #if TARGET_BI_ARCH == 1
1827 /* When TARGET_BI_ARCH == 1, by default, OPTION_MASK_ABI_64
1828 is on and OPTION_MASK_ABI_X32 is off. We turn off
1829 OPTION_MASK_ABI_64 if OPTION_MASK_ABI_X32 is turned on by
1831 if (TARGET_X32_P (opts
->x_ix86_isa_flags
))
1832 opts
->x_ix86_isa_flags
&= ~OPTION_MASK_ABI_64
;
1834 /* When TARGET_BI_ARCH == 2, by default, OPTION_MASK_ABI_X32 is
1835 on and OPTION_MASK_ABI_64 is off. We turn off
1836 OPTION_MASK_ABI_X32 if OPTION_MASK_ABI_64 is turned on by
1837 -m64 or OPTION_MASK_CODE16 is turned on by -m16. */
1838 if (TARGET_LP64_P (opts
->x_ix86_isa_flags
)
1839 || TARGET_16BIT_P (opts
->x_ix86_isa_flags
))
1840 opts
->x_ix86_isa_flags
&= ~OPTION_MASK_ABI_X32
;
1842 if (TARGET_64BIT_P (opts
->x_ix86_isa_flags
)
1843 && TARGET_IAMCU_P (opts
->x_target_flags
))
1844 sorry ("Intel MCU psABI isn%'t supported in %s mode",
1845 TARGET_X32_P (opts
->x_ix86_isa_flags
) ? "x32" : "64-bit");
1849 if (TARGET_X32_P (opts
->x_ix86_isa_flags
))
1851 /* Always turn on OPTION_MASK_ISA_64BIT and turn off
1852 OPTION_MASK_ABI_64 for TARGET_X32. */
1853 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_64BIT
;
1854 opts
->x_ix86_isa_flags
&= ~OPTION_MASK_ABI_64
;
1856 else if (TARGET_16BIT_P (opts
->x_ix86_isa_flags
))
1857 opts
->x_ix86_isa_flags
&= ~(OPTION_MASK_ISA_64BIT
1858 | OPTION_MASK_ABI_X32
1859 | OPTION_MASK_ABI_64
);
1860 else if (TARGET_LP64_P (opts
->x_ix86_isa_flags
))
1862 /* Always turn on OPTION_MASK_ISA_64BIT and turn off
1863 OPTION_MASK_ABI_X32 for TARGET_LP64. */
1864 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_64BIT
;
1865 opts
->x_ix86_isa_flags
&= ~OPTION_MASK_ABI_X32
;
1868 #ifdef SUBTARGET_OVERRIDE_OPTIONS
1869 SUBTARGET_OVERRIDE_OPTIONS
;
1872 #ifdef SUBSUBTARGET_OVERRIDE_OPTIONS
1873 SUBSUBTARGET_OVERRIDE_OPTIONS
;
1876 /* -fPIC is the default for x86_64. */
1877 if (TARGET_MACHO
&& TARGET_64BIT_P (opts
->x_ix86_isa_flags
))
1878 opts
->x_flag_pic
= 2;
1880 /* Need to check -mtune=generic first. */
1881 if (opts
->x_ix86_tune_string
)
1883 /* As special support for cross compilers we read -mtune=native
1884 as -mtune=generic. With native compilers we won't see the
1885 -mtune=native, as it was changed by the driver. */
1886 if (!strcmp (opts
->x_ix86_tune_string
, "native"))
1887 opts
->x_ix86_tune_string
= "generic";
1888 else if (!strcmp (opts
->x_ix86_tune_string
, "x86-64"))
1889 warning (OPT_Wdeprecated
,
1891 ? G_("%<-mtune=x86-64%> is deprecated; use %<-mtune=k8%> "
1892 "or %<-mtune=generic%> instead as appropriate")
1893 : G_("%<target(\"tune=x86-64\")%> is deprecated; use "
1894 "%<target(\"tune=k8\")%> or %<target(\"tune=generic\")%>"
1895 " instead as appropriate"));
1899 if (opts
->x_ix86_arch_string
)
1900 opts
->x_ix86_tune_string
= opts
->x_ix86_arch_string
;
1901 if (!opts
->x_ix86_tune_string
)
1903 opts
->x_ix86_tune_string
= processor_names
[TARGET_CPU_DEFAULT
];
1904 ix86_tune_defaulted
= 1;
1907 /* opts->x_ix86_tune_string is set to opts->x_ix86_arch_string
1908 or defaulted. We need to use a sensible tune option. */
1909 if (!strncmp (opts
->x_ix86_tune_string
, "x86-64", 6)
1910 && (opts
->x_ix86_tune_string
[6] == '\0'
1911 || (!strcmp (opts
->x_ix86_tune_string
+ 6, "-v2")
1912 || !strcmp (opts
->x_ix86_tune_string
+ 6, "-v3")
1913 || !strcmp (opts
->x_ix86_tune_string
+ 6, "-v4"))))
1914 opts
->x_ix86_tune_string
= "generic";
1917 if (opts
->x_ix86_stringop_alg
== rep_prefix_8_byte
1918 && !TARGET_64BIT_P (opts
->x_ix86_isa_flags
))
1920 /* rep; movq isn't available in 32-bit code. */
1921 error ("%<-mstringop-strategy=rep_8byte%> not supported for 32-bit code");
1922 opts
->x_ix86_stringop_alg
= no_stringop
;
1925 if (TARGET_UINTR
&& !TARGET_64BIT
)
1926 error ("%<-muintr%> not supported for 32-bit code");
1928 if (!opts
->x_ix86_arch_string
)
1929 opts
->x_ix86_arch_string
1930 = TARGET_64BIT_P (opts
->x_ix86_isa_flags
)
1931 ? "x86-64" : SUBTARGET32_DEFAULT_CPU
;
1933 ix86_arch_specified
= 1;
1935 if (opts_set
->x_ix86_pmode
)
1937 if ((TARGET_LP64_P (opts
->x_ix86_isa_flags
)
1938 && opts
->x_ix86_pmode
== PMODE_SI
)
1939 || (!TARGET_64BIT_P (opts
->x_ix86_isa_flags
)
1940 && opts
->x_ix86_pmode
== PMODE_DI
))
1941 error ("address mode %qs not supported in the %s bit mode",
1942 TARGET_64BIT_P (opts
->x_ix86_isa_flags
) ? "short" : "long",
1943 TARGET_64BIT_P (opts
->x_ix86_isa_flags
) ? "64" : "32");
1946 opts
->x_ix86_pmode
= TARGET_LP64_P (opts
->x_ix86_isa_flags
)
1947 ? PMODE_DI
: PMODE_SI
;
1949 SET_OPTION_IF_UNSET (opts
, opts_set
, ix86_abi
, DEFAULT_ABI
);
1951 if (opts
->x_ix86_abi
== MS_ABI
&& TARGET_X32_P (opts
->x_ix86_isa_flags
))
1952 error ("%<-mabi=ms%> not supported with X32 ABI");
1953 gcc_assert (opts
->x_ix86_abi
== SYSV_ABI
|| opts
->x_ix86_abi
== MS_ABI
);
1955 const char *abi_name
= opts
->x_ix86_abi
== MS_ABI
? "ms" : "sysv";
1956 if ((opts
->x_flag_sanitize
& SANITIZE_USER_ADDRESS
)
1957 && opts
->x_ix86_abi
!= DEFAULT_ABI
)
1958 error ("%<-mabi=%s%> not supported with %<-fsanitize=address%>", abi_name
);
1959 if ((opts
->x_flag_sanitize
& SANITIZE_KERNEL_ADDRESS
)
1960 && opts
->x_ix86_abi
!= DEFAULT_ABI
)
1961 error ("%<-mabi=%s%> not supported with %<-fsanitize=kernel-address%>",
1963 if ((opts
->x_flag_sanitize
& SANITIZE_THREAD
)
1964 && opts
->x_ix86_abi
!= DEFAULT_ABI
)
1965 error ("%<-mabi=%s%> not supported with %<-fsanitize=thread%>", abi_name
);
1967 /* For targets using ms ABI enable ms-extensions, if not
1968 explicit turned off. For non-ms ABI we turn off this
1970 SET_OPTION_IF_UNSET (opts
, opts_set
, flag_ms_extensions
,
1971 (MS_ABI
== DEFAULT_ABI
));
1973 if (opts_set
->x_ix86_cmodel
)
1975 switch (opts
->x_ix86_cmodel
)
1979 if (opts
->x_flag_pic
)
1980 opts
->x_ix86_cmodel
= CM_SMALL_PIC
;
1981 if (!TARGET_64BIT_P (opts
->x_ix86_isa_flags
))
1982 error ("code model %qs not supported in the %s bit mode",
1988 if (opts
->x_flag_pic
)
1989 opts
->x_ix86_cmodel
= CM_MEDIUM_PIC
;
1990 if (!TARGET_64BIT_P (opts
->x_ix86_isa_flags
))
1991 error ("code model %qs not supported in the %s bit mode",
1993 else if (TARGET_X32_P (opts
->x_ix86_isa_flags
))
1994 error ("code model %qs not supported in x32 mode",
2000 if (opts
->x_flag_pic
)
2001 opts
->x_ix86_cmodel
= CM_LARGE_PIC
;
2002 if (!TARGET_64BIT_P (opts
->x_ix86_isa_flags
))
2003 error ("code model %qs not supported in the %s bit mode",
2005 else if (TARGET_X32_P (opts
->x_ix86_isa_flags
))
2006 error ("code model %qs not supported in x32 mode",
2011 if (opts
->x_flag_pic
)
2012 error ("code model %s does not support PIC mode", "32");
2013 if (TARGET_64BIT_P (opts
->x_ix86_isa_flags
))
2014 error ("code model %qs not supported in the %s bit mode",
2019 if (opts
->x_flag_pic
)
2021 error ("code model %s does not support PIC mode", "kernel");
2022 opts
->x_ix86_cmodel
= CM_32
;
2024 if (!TARGET_64BIT_P (opts
->x_ix86_isa_flags
))
2025 error ("code model %qs not supported in the %s bit mode",
2035 /* For TARGET_64BIT and MS_ABI, force pic on, in order to enable the
2036 use of rip-relative addressing. This eliminates fixups that
2037 would otherwise be needed if this object is to be placed in a
2038 DLL, and is essentially just as efficient as direct addressing. */
2039 if (TARGET_64BIT_P (opts
->x_ix86_isa_flags
)
2040 && (TARGET_RDOS
|| TARGET_PECOFF
))
2041 opts
->x_ix86_cmodel
= CM_MEDIUM_PIC
, opts
->x_flag_pic
= 1;
2042 else if (TARGET_64BIT_P (opts
->x_ix86_isa_flags
))
2043 opts
->x_ix86_cmodel
= opts
->x_flag_pic
? CM_SMALL_PIC
: CM_SMALL
;
2045 opts
->x_ix86_cmodel
= CM_32
;
2047 if (TARGET_MACHO
&& opts
->x_ix86_asm_dialect
== ASM_INTEL
)
2049 error ("%<-masm=intel%> not supported in this configuration");
2050 opts
->x_ix86_asm_dialect
= ASM_ATT
;
2052 if ((TARGET_64BIT_P (opts
->x_ix86_isa_flags
) != 0)
2053 != ((opts
->x_ix86_isa_flags
& OPTION_MASK_ISA_64BIT
) != 0))
2054 sorry ("%i-bit mode not compiled in",
2055 (opts
->x_ix86_isa_flags
& OPTION_MASK_ISA_64BIT
) ? 64 : 32);
2057 for (i
= 0; i
< pta_size
; i
++)
2058 if (! strcmp (opts
->x_ix86_arch_string
, processor_alias_table
[i
].name
))
2060 if (!strcmp (opts
->x_ix86_arch_string
, "generic"))
2063 ? G_("%<generic%> CPU can be used only for %<-mtune=%> "
2065 : G_("%<generic%> CPU can be used only for "
2066 "%<target(\"tune=\")%> attribute"));
2069 else if (!strcmp (opts
->x_ix86_arch_string
, "intel"))
2072 ? G_("%<intel%> CPU can be used only for %<-mtune=%> "
2074 : G_("%<intel%> CPU can be used only for "
2075 "%<target(\"tune=\")%> attribute"));
2079 if (TARGET_64BIT_P (opts
->x_ix86_isa_flags
)
2080 && !((processor_alias_table
[i
].flags
& PTA_64BIT
) != 0))
2082 error ("CPU you selected does not support x86-64 "
2087 ix86_schedule
= processor_alias_table
[i
].schedule
;
2088 ix86_arch
= processor_alias_table
[i
].processor
;
2090 /* Default cpu tuning to the architecture, unless the table
2091 entry requests not to do this. Used by the x86-64 psABI
2092 micro-architecture levels. */
2093 if ((processor_alias_table
[i
].flags
& PTA_NO_TUNE
) == 0)
2094 ix86_tune
= ix86_arch
;
2096 ix86_tune
= PROCESSOR_GENERIC
;
2098 if (((processor_alias_table
[i
].flags
& PTA_MMX
) != 0)
2099 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_MMX
))
2100 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_MMX
;
2101 if (((processor_alias_table
[i
].flags
& PTA_3DNOW
) != 0)
2102 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_3DNOW
))
2103 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_3DNOW
;
2104 if (((processor_alias_table
[i
].flags
& PTA_3DNOW_A
) != 0)
2105 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_3DNOW_A
))
2106 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_3DNOW_A
;
2107 if (((processor_alias_table
[i
].flags
& PTA_SSE
) != 0)
2108 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_SSE
))
2109 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_SSE
;
2110 if (((processor_alias_table
[i
].flags
& PTA_SSE2
) != 0)
2111 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_SSE2
))
2112 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_SSE2
;
2113 if (((processor_alias_table
[i
].flags
& PTA_SSE3
) != 0)
2114 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_SSE3
))
2115 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_SSE3
;
2116 if (((processor_alias_table
[i
].flags
& PTA_SSSE3
) != 0)
2117 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_SSSE3
))
2118 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_SSSE3
;
2119 if (((processor_alias_table
[i
].flags
& PTA_SSE4_1
) != 0)
2120 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_SSE4_1
))
2121 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_SSE4_1
;
2122 if (((processor_alias_table
[i
].flags
& PTA_SSE4_2
) != 0)
2123 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_SSE4_2
))
2124 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_SSE4_2
;
2125 if (((processor_alias_table
[i
].flags
& PTA_AVX
) != 0)
2126 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_AVX
))
2127 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_AVX
;
2128 if (((processor_alias_table
[i
].flags
& PTA_AVX2
) != 0)
2129 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_AVX2
))
2130 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_AVX2
;
2131 if (((processor_alias_table
[i
].flags
& PTA_FMA
) != 0)
2132 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_FMA
))
2133 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_FMA
;
2134 if (((processor_alias_table
[i
].flags
& PTA_SSE4A
) != 0)
2135 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_SSE4A
))
2136 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_SSE4A
;
2137 if (((processor_alias_table
[i
].flags
& PTA_FMA4
) != 0)
2138 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_FMA4
))
2139 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_FMA4
;
2140 if (((processor_alias_table
[i
].flags
& PTA_XOP
) != 0)
2141 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_XOP
))
2142 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_XOP
;
2143 if (((processor_alias_table
[i
].flags
& PTA_LWP
) != 0)
2144 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_LWP
))
2145 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_LWP
;
2146 if (((processor_alias_table
[i
].flags
& PTA_ABM
) != 0)
2147 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_ABM
))
2148 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_ABM
;
2149 if (((processor_alias_table
[i
].flags
& PTA_BMI
) != 0)
2150 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_BMI
))
2151 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_BMI
;
2152 if (((processor_alias_table
[i
].flags
& (PTA_LZCNT
| PTA_ABM
)) != 0)
2153 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_LZCNT
))
2154 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_LZCNT
;
2155 if (((processor_alias_table
[i
].flags
& PTA_TBM
) != 0)
2156 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_TBM
))
2157 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_TBM
;
2158 if (((processor_alias_table
[i
].flags
& PTA_BMI2
) != 0)
2159 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_BMI2
))
2160 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_BMI2
;
2161 if (((processor_alias_table
[i
].flags
& PTA_CX16
) != 0)
2162 && !(opts
->x_ix86_isa_flags2_explicit
& OPTION_MASK_ISA2_CX16
))
2163 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_CX16
;
2164 if (((processor_alias_table
[i
].flags
& (PTA_POPCNT
| PTA_ABM
)) != 0)
2165 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_POPCNT
))
2166 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_POPCNT
;
2167 if (!(TARGET_64BIT_P (opts
->x_ix86_isa_flags
)
2168 && ((processor_alias_table
[i
].flags
& PTA_NO_SAHF
) != 0))
2169 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_SAHF
))
2170 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_SAHF
;
2171 if (((processor_alias_table
[i
].flags
& PTA_MOVBE
) != 0)
2172 && !(opts
->x_ix86_isa_flags2_explicit
& OPTION_MASK_ISA2_MOVBE
))
2173 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_MOVBE
;
2174 if (((processor_alias_table
[i
].flags
& PTA_AES
) != 0)
2175 && !(ix86_isa_flags_explicit
& OPTION_MASK_ISA_AES
))
2176 ix86_isa_flags
|= OPTION_MASK_ISA_AES
;
2177 if (((processor_alias_table
[i
].flags
& PTA_SHA
) != 0)
2178 && !(ix86_isa_flags_explicit
& OPTION_MASK_ISA_SHA
))
2179 ix86_isa_flags
|= OPTION_MASK_ISA_SHA
;
2180 if (((processor_alias_table
[i
].flags
& PTA_PCLMUL
) != 0)
2181 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_PCLMUL
))
2182 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_PCLMUL
;
2183 if (((processor_alias_table
[i
].flags
& PTA_FSGSBASE
) != 0)
2184 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_FSGSBASE
))
2185 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_FSGSBASE
;
2186 if (((processor_alias_table
[i
].flags
& PTA_RDRND
) != 0)
2187 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_RDRND
))
2188 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_RDRND
;
2189 if (((processor_alias_table
[i
].flags
& PTA_F16C
) != 0)
2190 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_F16C
))
2191 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_F16C
;
2192 if (((processor_alias_table
[i
].flags
& PTA_RTM
) != 0)
2193 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_RTM
))
2194 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_RTM
;
2195 if (((processor_alias_table
[i
].flags
& PTA_HLE
) != 0)
2196 && !(opts
->x_ix86_isa_flags2_explicit
& OPTION_MASK_ISA2_HLE
))
2197 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_HLE
;
2198 if (((processor_alias_table
[i
].flags
& PTA_PRFCHW
) != 0)
2199 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_PRFCHW
))
2200 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_PRFCHW
;
2201 if (((processor_alias_table
[i
].flags
& PTA_RDSEED
) != 0)
2202 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_RDSEED
))
2203 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_RDSEED
;
2204 if (((processor_alias_table
[i
].flags
& PTA_ADX
) != 0)
2205 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_ADX
))
2206 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_ADX
;
2207 if (((processor_alias_table
[i
].flags
& PTA_FXSR
) != 0)
2208 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_FXSR
))
2209 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_FXSR
;
2210 if (((processor_alias_table
[i
].flags
& PTA_XSAVE
) != 0)
2211 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_XSAVE
))
2212 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_XSAVE
;
2213 if (((processor_alias_table
[i
].flags
& PTA_XSAVEOPT
) != 0)
2214 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_XSAVEOPT
))
2215 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_XSAVEOPT
;
2216 if (((processor_alias_table
[i
].flags
& PTA_AVX512F
) != 0)
2217 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_AVX512F
))
2218 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_AVX512F
;
2219 if (((processor_alias_table
[i
].flags
& PTA_AVX512ER
) != 0)
2220 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_AVX512ER
))
2221 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_AVX512ER
;
2222 if (((processor_alias_table
[i
].flags
& PTA_AVX512PF
) != 0)
2223 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_AVX512PF
))
2224 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_AVX512PF
;
2225 if (((processor_alias_table
[i
].flags
& PTA_AVX512CD
) != 0)
2226 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_AVX512CD
))
2227 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_AVX512CD
;
2228 if (((processor_alias_table
[i
].flags
& PTA_PREFETCHWT1
) != 0)
2229 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_PREFETCHWT1
))
2230 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_PREFETCHWT1
;
2231 if (((processor_alias_table
[i
].flags
& PTA_CLWB
) != 0)
2232 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_CLWB
))
2233 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_CLWB
;
2234 if (((processor_alias_table
[i
].flags
& PTA_CLFLUSHOPT
) != 0)
2235 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_CLFLUSHOPT
))
2236 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_CLFLUSHOPT
;
2237 if (((processor_alias_table
[i
].flags
& PTA_CLZERO
) != 0)
2238 && !(opts
->x_ix86_isa_flags2_explicit
& OPTION_MASK_ISA2_CLZERO
))
2239 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_CLZERO
;
2240 if (((processor_alias_table
[i
].flags
& PTA_XSAVEC
) != 0)
2241 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_XSAVEC
))
2242 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_XSAVEC
;
2243 if (((processor_alias_table
[i
].flags
& PTA_XSAVES
) != 0)
2244 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_XSAVES
))
2245 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_XSAVES
;
2246 if (((processor_alias_table
[i
].flags
& PTA_AVX512DQ
) != 0)
2247 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_AVX512DQ
))
2248 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_AVX512DQ
;
2249 if (((processor_alias_table
[i
].flags
& PTA_AVX512BW
) != 0)
2250 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_AVX512BW
))
2251 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_AVX512BW
;
2252 if (((processor_alias_table
[i
].flags
& PTA_AVX512VL
) != 0)
2253 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_AVX512VL
))
2254 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_AVX512VL
;
2255 if (((processor_alias_table
[i
].flags
& PTA_AVX512VBMI
) != 0)
2256 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_AVX512VBMI
))
2257 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_AVX512VBMI
;
2258 if (((processor_alias_table
[i
].flags
& PTA_AVX512IFMA
) != 0)
2259 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_AVX512IFMA
))
2260 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_AVX512IFMA
;
2261 if (((processor_alias_table
[i
].flags
& PTA_AVX512VNNI
) != 0)
2262 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_AVX512VNNI
))
2263 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_AVX512VNNI
;
2264 if (((processor_alias_table
[i
].flags
& PTA_GFNI
) != 0)
2265 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_GFNI
))
2266 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_GFNI
;
2267 if (((processor_alias_table
[i
].flags
& PTA_AVX512VBMI2
) != 0)
2268 && !(opts
->x_ix86_isa_flags_explicit
2269 & OPTION_MASK_ISA_AVX512VBMI2
))
2270 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_AVX512VBMI2
;
2271 if (((processor_alias_table
[i
].flags
& PTA_VPCLMULQDQ
) != 0)
2272 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_VPCLMULQDQ
))
2273 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_VPCLMULQDQ
;
2274 if (((processor_alias_table
[i
].flags
& PTA_AVX512BITALG
) != 0)
2275 && !(opts
->x_ix86_isa_flags_explicit
2276 & OPTION_MASK_ISA_AVX512BITALG
))
2277 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_AVX512BITALG
;
2279 if (((processor_alias_table
[i
].flags
& PTA_AVX512VP2INTERSECT
) != 0)
2280 && !(opts
->x_ix86_isa_flags2_explicit
2281 & OPTION_MASK_ISA2_AVX512VP2INTERSECT
))
2282 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_AVX512VP2INTERSECT
;
2283 if (((processor_alias_table
[i
].flags
& PTA_AVX5124VNNIW
) != 0)
2284 && !(opts
->x_ix86_isa_flags2_explicit
2285 & OPTION_MASK_ISA2_AVX5124VNNIW
))
2286 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_AVX5124VNNIW
;
2287 if (((processor_alias_table
[i
].flags
& PTA_AVX5124FMAPS
) != 0)
2288 && !(opts
->x_ix86_isa_flags2_explicit
2289 & OPTION_MASK_ISA2_AVX5124FMAPS
))
2290 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_AVX5124FMAPS
;
2291 if (((processor_alias_table
[i
].flags
& PTA_AVX512VPOPCNTDQ
) != 0)
2292 && !(opts
->x_ix86_isa_flags_explicit
2293 & OPTION_MASK_ISA_AVX512VPOPCNTDQ
))
2294 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_AVX512VPOPCNTDQ
;
2295 if (((processor_alias_table
[i
].flags
& PTA_AVX512BF16
) != 0)
2296 && !(opts
->x_ix86_isa_flags2_explicit
2297 & OPTION_MASK_ISA2_AVX512BF16
))
2298 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_AVX512BF16
;
2299 if (((processor_alias_table
[i
].flags
& PTA_AMX_TILE
) != 0)
2300 && !(opts
->x_ix86_isa_flags2_explicit
2301 & OPTION_MASK_ISA2_AMX_TILE
))
2302 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_AMX_TILE
;
2303 if (((processor_alias_table
[i
].flags
& PTA_AMX_INT8
) != 0)
2304 && !(opts
->x_ix86_isa_flags2_explicit
2305 & OPTION_MASK_ISA2_AMX_INT8
))
2306 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_AMX_INT8
;
2307 if (((processor_alias_table
[i
].flags
& PTA_AMX_BF16
) != 0)
2308 && !(opts
->x_ix86_isa_flags2_explicit
2309 & OPTION_MASK_ISA2_AMX_BF16
))
2310 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_AMX_BF16
;
2311 if (((processor_alias_table
[i
].flags
& PTA_AVXVNNI
) != 0)
2312 && !(opts
->x_ix86_isa_flags2_explicit
2313 & OPTION_MASK_ISA2_AVXVNNI
))
2314 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_AVXVNNI
;
2315 if (((processor_alias_table
[i
].flags
& PTA_MOVDIRI
) != 0)
2316 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_MOVDIRI
))
2317 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_MOVDIRI
;
2318 if (((processor_alias_table
[i
].flags
& PTA_MOVDIR64B
) != 0)
2319 && !(opts
->x_ix86_isa_flags2_explicit
& OPTION_MASK_ISA2_MOVDIR64B
))
2320 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_MOVDIR64B
;
2321 if (((processor_alias_table
[i
].flags
& PTA_SGX
) != 0)
2322 && !(opts
->x_ix86_isa_flags2_explicit
& OPTION_MASK_ISA2_SGX
))
2323 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_SGX
;
2324 if (((processor_alias_table
[i
].flags
& PTA_VAES
) != 0)
2325 && !(opts
->x_ix86_isa_flags2_explicit
& OPTION_MASK_ISA2_VAES
))
2326 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_VAES
;
2327 if (((processor_alias_table
[i
].flags
& PTA_RDPID
) != 0)
2328 && !(opts
->x_ix86_isa_flags2_explicit
& OPTION_MASK_ISA2_RDPID
))
2329 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_RDPID
;
2330 if (((processor_alias_table
[i
].flags
& PTA_PCONFIG
) != 0)
2331 && !(opts
->x_ix86_isa_flags2_explicit
& OPTION_MASK_ISA2_PCONFIG
))
2332 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_PCONFIG
;
2333 if (((processor_alias_table
[i
].flags
& PTA_WBNOINVD
) != 0)
2334 && !(opts
->x_ix86_isa_flags2_explicit
& OPTION_MASK_ISA2_WBNOINVD
))
2335 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_WBNOINVD
;
2336 if (((processor_alias_table
[i
].flags
& PTA_PTWRITE
) != 0)
2337 && !(opts
->x_ix86_isa_flags2_explicit
& OPTION_MASK_ISA2_PTWRITE
))
2338 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_PTWRITE
;
2339 if (((processor_alias_table
[i
].flags
& PTA_WAITPKG
) != 0)
2340 && !(opts
->x_ix86_isa_flags2_explicit
& OPTION_MASK_ISA2_WAITPKG
))
2341 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_WAITPKG
;
2342 if (((processor_alias_table
[i
].flags
& PTA_ENQCMD
) != 0)
2343 && !(opts
->x_ix86_isa_flags2_explicit
& OPTION_MASK_ISA2_ENQCMD
))
2344 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_ENQCMD
;
2345 if (((processor_alias_table
[i
].flags
& PTA_CLDEMOTE
) != 0)
2346 && !(opts
->x_ix86_isa_flags2_explicit
& OPTION_MASK_ISA2_CLDEMOTE
))
2347 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_CLDEMOTE
;
2348 if (((processor_alias_table
[i
].flags
& PTA_SERIALIZE
) != 0)
2349 && !(opts
->x_ix86_isa_flags2_explicit
& OPTION_MASK_ISA2_SERIALIZE
))
2350 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_SERIALIZE
;
2351 if (((processor_alias_table
[i
].flags
& PTA_TSXLDTRK
) != 0)
2352 && !(opts
->x_ix86_isa_flags2_explicit
& OPTION_MASK_ISA2_TSXLDTRK
))
2353 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_TSXLDTRK
;
2354 if (((processor_alias_table
[i
].flags
& PTA_KL
) != 0)
2355 && !(opts
->x_ix86_isa_flags2_explicit
& OPTION_MASK_ISA2_KL
))
2356 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_KL
;
2357 if (((processor_alias_table
[i
].flags
& PTA_WIDEKL
) != 0)
2358 && !(opts
->x_ix86_isa_flags2_explicit
& OPTION_MASK_ISA2_WIDEKL
))
2359 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_WIDEKL
;
2361 if ((processor_alias_table
[i
].flags
2362 & (PTA_PREFETCH_SSE
| PTA_SSE
)) != 0)
2363 x86_prefetch_sse
= true;
2364 if (((processor_alias_table
[i
].flags
& PTA_MWAITX
) != 0)
2365 && !(opts
->x_ix86_isa_flags2_explicit
& OPTION_MASK_ISA2_MWAITX
))
2366 opts
->x_ix86_isa_flags2
|= OPTION_MASK_ISA2_MWAITX
;
2367 if (((processor_alias_table
[i
].flags
& PTA_PKU
) != 0)
2368 && !(opts
->x_ix86_isa_flags_explicit
& OPTION_MASK_ISA_PKU
))
2369 opts
->x_ix86_isa_flags
|= OPTION_MASK_ISA_PKU
;
2371 /* Don't enable x87 instructions if only general registers are
2372 allowed by target("general-regs-only") function attribute or
2373 -mgeneral-regs-only. */
2374 if (!(opts
->x_ix86_target_flags
& OPTION_MASK_GENERAL_REGS_ONLY
)
2375 && !(opts_set
->x_target_flags
& MASK_80387
))
2377 if (((processor_alias_table
[i
].flags
& PTA_NO_80387
) != 0))
2378 opts
->x_target_flags
&= ~MASK_80387
;
2380 opts
->x_target_flags
|= MASK_80387
;
2388 ? G_("bad value (%qs) for %<-march=%> switch")
2389 : G_("bad value (%qs) for %<target(\"arch=\")%> attribute"),
2390 opts
->x_ix86_arch_string
);
2392 auto_vec
<const char *> candidates
;
2393 for (i
= 0; i
< pta_size
; i
++)
2394 if (strcmp (processor_alias_table
[i
].name
, "generic")
2395 && strcmp (processor_alias_table
[i
].name
, "intel")
2396 && (!TARGET_64BIT_P (opts
->x_ix86_isa_flags
)
2397 || ((processor_alias_table
[i
].flags
& PTA_64BIT
) != 0)))
2398 candidates
.safe_push (processor_alias_table
[i
].name
);
2400 #ifdef HAVE_LOCAL_CPU_DETECT
2401 /* Add also "native" as possible value. */
2402 candidates
.safe_push ("native");
2407 = candidates_list_and_hint (opts
->x_ix86_arch_string
, s
, candidates
);
2409 inform (input_location
,
2411 ? G_("valid arguments to %<-march=%> switch are: "
2412 "%s; did you mean %qs?")
2413 : G_("valid arguments to %<target(\"arch=\")%> attribute are: "
2414 "%s; did you mean %qs?"), s
, hint
);
2416 inform (input_location
,
2418 ? G_("valid arguments to %<-march=%> switch are: %s")
2419 : G_("valid arguments to %<target(\"arch=\")%> attribute "
2424 ix86_arch_mask
= HOST_WIDE_INT_1U
<< ix86_arch
;
2425 for (i
= 0; i
< X86_ARCH_LAST
; ++i
)
2426 ix86_arch_features
[i
] = !!(initial_ix86_arch_features
[i
] & ix86_arch_mask
);
2428 for (i
= 0; i
< pta_size
; i
++)
2429 if (! strcmp (opts
->x_ix86_tune_string
, processor_alias_table
[i
].name
)
2430 && (processor_alias_table
[i
].flags
& PTA_NO_TUNE
) == 0)
2432 ix86_schedule
= processor_alias_table
[i
].schedule
;
2433 ix86_tune
= processor_alias_table
[i
].processor
;
2434 if (TARGET_64BIT_P (opts
->x_ix86_isa_flags
))
2436 if (!((processor_alias_table
[i
].flags
& PTA_64BIT
) != 0))
2438 if (ix86_tune_defaulted
)
2440 opts
->x_ix86_tune_string
= "x86-64";
2441 for (i
= 0; i
< pta_size
; i
++)
2442 if (! strcmp (opts
->x_ix86_tune_string
,
2443 processor_alias_table
[i
].name
))
2445 ix86_schedule
= processor_alias_table
[i
].schedule
;
2446 ix86_tune
= processor_alias_table
[i
].processor
;
2449 error ("CPU you selected does not support x86-64 "
2453 /* Intel CPUs have always interpreted SSE prefetch instructions as
2454 NOPs; so, we can enable SSE prefetch instructions even when
2455 -mtune (rather than -march) points us to a processor that has them.
2456 However, the VIA C3 gives a SIGILL, so we only do that for i686 and
2457 higher processors. */
2459 && ((processor_alias_table
[i
].flags
2460 & (PTA_PREFETCH_SSE
| PTA_SSE
)) != 0))
2461 x86_prefetch_sse
= true;
2465 if (ix86_tune_specified
&& i
== pta_size
)
2468 ? G_("bad value (%qs) for %<-mtune=%> switch")
2469 : G_("bad value (%qs) for %<target(\"tune=\")%> attribute"),
2470 opts
->x_ix86_tune_string
);
2472 auto_vec
<const char *> candidates
;
2473 for (i
= 0; i
< pta_size
; i
++)
2474 if ((!TARGET_64BIT_P (opts
->x_ix86_isa_flags
)
2475 || ((processor_alias_table
[i
].flags
& PTA_64BIT
) != 0))
2476 && (processor_alias_table
[i
].flags
& PTA_NO_TUNE
) == 0)
2477 candidates
.safe_push (processor_alias_table
[i
].name
);
2479 #ifdef HAVE_LOCAL_CPU_DETECT
2480 /* Add also "native" as possible value. */
2481 candidates
.safe_push ("native");
2486 = candidates_list_and_hint (opts
->x_ix86_tune_string
, s
, candidates
);
2488 inform (input_location
,
2490 ? G_("valid arguments to %<-mtune=%> switch are: "
2491 "%s; did you mean %qs?")
2492 : G_("valid arguments to %<target(\"tune=\")%> attribute are: "
2493 "%s; did you mean %qs?"), s
, hint
);
2495 inform (input_location
,
2497 ? G_("valid arguments to %<-mtune=%> switch are: %s")
2498 : G_("valid arguments to %<target(\"tune=\")%> attribute "
2503 set_ix86_tune_features (opts
, ix86_tune
, opts
->x_ix86_dump_tunes
);
2505 ix86_recompute_optlev_based_flags (opts
, opts_set
);
2507 ix86_tune_cost
= processor_cost_table
[ix86_tune
];
2508 /* TODO: ix86_cost should be chosen at instruction or function granuality
2509 so for cold code we use size_cost even in !optimize_size compilation. */
2510 if (opts
->x_optimize_size
)
2511 ix86_cost
= &ix86_size_cost
;
2513 ix86_cost
= ix86_tune_cost
;
2515 /* Arrange to set up i386_stack_locals for all functions. */
2516 init_machine_status
= ix86_init_machine_status
;
2518 /* Validate -mregparm= value. */
2519 if (opts_set
->x_ix86_regparm
)
2521 if (TARGET_64BIT_P (opts
->x_ix86_isa_flags
))
2522 warning (0, "%<-mregparm%> is ignored in 64-bit mode");
2523 else if (TARGET_IAMCU_P (opts
->x_target_flags
))
2524 warning (0, "%<-mregparm%> is ignored for Intel MCU psABI");
2525 if (opts
->x_ix86_regparm
> REGPARM_MAX
)
2527 error ("%<-mregparm=%d%> is not between 0 and %d",
2528 opts
->x_ix86_regparm
, REGPARM_MAX
);
2529 opts
->x_ix86_regparm
= 0;
2532 if (TARGET_IAMCU_P (opts
->x_target_flags
)
2533 || TARGET_64BIT_P (opts
->x_ix86_isa_flags
))
2534 opts
->x_ix86_regparm
= REGPARM_MAX
;
2536 /* Default align_* from the processor table. */
2537 ix86_default_align (opts
);
2539 /* Provide default for -mbranch-cost= value. */
2540 SET_OPTION_IF_UNSET (opts
, opts_set
, ix86_branch_cost
,
2541 ix86_tune_cost
->branch_cost
);
2543 if (TARGET_64BIT_P (opts
->x_ix86_isa_flags
))
2545 opts
->x_target_flags
2546 |= TARGET_SUBTARGET64_DEFAULT
& ~opts_set
->x_target_flags
;
2548 if (!ix86_arch_specified
)
2549 opts
->x_ix86_isa_flags
2550 |= TARGET_SUBTARGET64_ISA_DEFAULT
& ~opts
->x_ix86_isa_flags_explicit
;
2552 if (TARGET_RTD_P (opts
->x_target_flags
))
2555 ? G_("%<-mrtd%> is ignored in 64bit mode")
2556 : G_("%<target(\"rtd\")%> is ignored in 64bit mode"));
2560 opts
->x_target_flags
2561 |= TARGET_SUBTARGET32_DEFAULT
& ~opts_set
->x_target_flags
;
2563 if (!ix86_arch_specified
)
2564 opts
->x_ix86_isa_flags
2565 |= TARGET_SUBTARGET32_ISA_DEFAULT
& ~opts
->x_ix86_isa_flags_explicit
;
2567 /* i386 ABI does not specify red zone. It still makes sense to use it
2568 when programmer takes care to stack from being destroyed. */
2569 if (!(opts_set
->x_target_flags
& MASK_NO_RED_ZONE
))
2570 opts
->x_target_flags
|= MASK_NO_RED_ZONE
;
2573 /* Keep nonleaf frame pointers. */
2574 if (opts
->x_flag_omit_frame_pointer
)
2575 opts
->x_target_flags
&= ~MASK_OMIT_LEAF_FRAME_POINTER
;
2576 else if (TARGET_OMIT_LEAF_FRAME_POINTER_P (opts
->x_target_flags
))
2577 opts
->x_flag_omit_frame_pointer
= 1;
2579 /* If we're doing fast math, we don't care about comparison order
2580 wrt NaNs. This lets us use a shorter comparison sequence. */
2581 if (opts
->x_flag_finite_math_only
)
2582 opts
->x_target_flags
&= ~MASK_IEEE_FP
;
2584 /* If the architecture always has an FPU, turn off NO_FANCY_MATH_387,
2585 since the insns won't need emulation. */
2586 if (ix86_tune_features
[X86_TUNE_ALWAYS_FANCY_MATH_387
])
2587 opts
->x_target_flags
&= ~MASK_NO_FANCY_MATH_387
;
2589 /* Likewise, if the target doesn't have a 387, or we've specified
2590 software floating point, don't use 387 inline intrinsics. */
2591 if (!TARGET_80387_P (opts
->x_target_flags
))
2592 opts
->x_target_flags
|= MASK_NO_FANCY_MATH_387
;
2594 /* Turn on MMX builtins for -msse. */
2595 if (TARGET_SSE_P (opts
->x_ix86_isa_flags
))
2596 opts
->x_ix86_isa_flags
2597 |= OPTION_MASK_ISA_MMX
& ~opts
->x_ix86_isa_flags_explicit
;
2599 /* Enable SSE prefetch. */
2600 if (TARGET_SSE_P (opts
->x_ix86_isa_flags
)
2601 || (TARGET_PRFCHW_P (opts
->x_ix86_isa_flags
)
2602 && !TARGET_3DNOW_P (opts
->x_ix86_isa_flags
))
2603 || TARGET_PREFETCHWT1_P (opts
->x_ix86_isa_flags
))
2604 x86_prefetch_sse
= true;
2606 /* Enable popcnt instruction for -msse4.2 or -mabm. */
2607 if (TARGET_SSE4_2_P (opts
->x_ix86_isa_flags
)
2608 || TARGET_ABM_P (opts
->x_ix86_isa_flags
))
2609 opts
->x_ix86_isa_flags
2610 |= OPTION_MASK_ISA_POPCNT
& ~opts
->x_ix86_isa_flags_explicit
;
2612 /* Enable lzcnt instruction for -mabm. */
2613 if (TARGET_ABM_P(opts
->x_ix86_isa_flags
))
2614 opts
->x_ix86_isa_flags
2615 |= OPTION_MASK_ISA_LZCNT
& ~opts
->x_ix86_isa_flags_explicit
;
2617 /* Disable BMI, BMI2 and TBM instructions for -m16. */
2618 if (TARGET_16BIT_P(opts
->x_ix86_isa_flags
))
2619 opts
->x_ix86_isa_flags
2620 &= ~((OPTION_MASK_ISA_BMI
| OPTION_MASK_ISA_BMI2
| OPTION_MASK_ISA_TBM
)
2621 & ~opts
->x_ix86_isa_flags_explicit
);
2623 /* Validate -mpreferred-stack-boundary= value or default it to
2624 PREFERRED_STACK_BOUNDARY_DEFAULT. */
2625 ix86_preferred_stack_boundary
= PREFERRED_STACK_BOUNDARY_DEFAULT
;
2626 if (opts_set
->x_ix86_preferred_stack_boundary_arg
)
2628 int min
= TARGET_64BIT_P (opts
->x_ix86_isa_flags
)? 3 : 2;
2629 int max
= TARGET_SEH
? 4 : 12;
2631 if (opts
->x_ix86_preferred_stack_boundary_arg
< min
2632 || opts
->x_ix86_preferred_stack_boundary_arg
> max
)
2635 error ("%<-mpreferred-stack-boundary%> is not supported "
2638 error ("%<-mpreferred-stack-boundary=%d%> is not between %d and %d",
2639 opts
->x_ix86_preferred_stack_boundary_arg
, min
, max
);
2642 ix86_preferred_stack_boundary
2643 = (1 << opts
->x_ix86_preferred_stack_boundary_arg
) * BITS_PER_UNIT
;
2646 /* Set the default value for -mstackrealign. */
2647 SET_OPTION_IF_UNSET (opts
, opts_set
, ix86_force_align_arg_pointer
,
2648 STACK_REALIGN_DEFAULT
);
2650 ix86_default_incoming_stack_boundary
= PREFERRED_STACK_BOUNDARY
;
2652 /* Validate -mincoming-stack-boundary= value or default it to
2653 MIN_STACK_BOUNDARY/PREFERRED_STACK_BOUNDARY. */
2654 ix86_incoming_stack_boundary
= ix86_default_incoming_stack_boundary
;
2655 if (opts_set
->x_ix86_incoming_stack_boundary_arg
)
2657 int min
= TARGET_64BIT_P (opts
->x_ix86_isa_flags
) ? 3 : 2;
2659 if (opts
->x_ix86_incoming_stack_boundary_arg
< min
2660 || opts
->x_ix86_incoming_stack_boundary_arg
> 12)
2661 error ("%<-mincoming-stack-boundary=%d%> is not between %d and 12",
2662 opts
->x_ix86_incoming_stack_boundary_arg
, min
);
2665 ix86_user_incoming_stack_boundary
2666 = (1 << opts
->x_ix86_incoming_stack_boundary_arg
) * BITS_PER_UNIT
;
2667 ix86_incoming_stack_boundary
2668 = ix86_user_incoming_stack_boundary
;
2672 #ifndef NO_PROFILE_COUNTERS
2673 if (flag_nop_mcount
)
2674 error ("%<-mnop-mcount%> is not compatible with this target");
2676 if (flag_nop_mcount
&& flag_pic
)
2677 error ("%<-mnop-mcount%> is not implemented for %<-fPIC%>");
2679 /* Accept -msseregparm only if at least SSE support is enabled. */
2680 if (TARGET_SSEREGPARM_P (opts
->x_target_flags
)
2681 && ! TARGET_SSE_P (opts
->x_ix86_isa_flags
))
2683 ? G_("%<-msseregparm%> used without SSE enabled")
2684 : G_("%<target(\"sseregparm\")%> used without SSE enabled"));
2686 if (opts_set
->x_ix86_fpmath
)
2688 if (opts
->x_ix86_fpmath
& FPMATH_SSE
)
2690 if (!TARGET_SSE_P (opts
->x_ix86_isa_flags
))
2692 if (TARGET_80387_P (opts
->x_target_flags
))
2694 warning (0, "SSE instruction set disabled, using 387 arithmetics");
2695 opts
->x_ix86_fpmath
= FPMATH_387
;
2698 else if ((opts
->x_ix86_fpmath
& FPMATH_387
)
2699 && !TARGET_80387_P (opts
->x_target_flags
))
2701 warning (0, "387 instruction set disabled, using SSE arithmetics");
2702 opts
->x_ix86_fpmath
= FPMATH_SSE
;
2706 /* For all chips supporting SSE2, -mfpmath=sse performs better than
2707 fpmath=387. The second is however default at many targets since the
2708 extra 80bit precision of temporaries is considered to be part of ABI.
2709 Overwrite the default at least for -ffast-math.
2710 TODO: -mfpmath=both seems to produce same performing code with bit
2711 smaller binaries. It is however not clear if register allocation is
2712 ready for this setting.
2713 Also -mfpmath=387 is overall a lot more compact (bout 4-5%) than SSE
2714 codegen. We may switch to 387 with -ffast-math for size optimized
2716 else if (fast_math_flags_set_p (&global_options
)
2717 && TARGET_SSE2_P (opts
->x_ix86_isa_flags
))
2718 opts
->x_ix86_fpmath
= FPMATH_SSE
;
2720 opts
->x_ix86_fpmath
= TARGET_FPMATH_DEFAULT_P (opts
->x_ix86_isa_flags
);
2722 /* Use external vectorized library in vectorizing intrinsics. */
2723 if (opts_set
->x_ix86_veclibabi_type
)
2724 switch (opts
->x_ix86_veclibabi_type
)
2726 case ix86_veclibabi_type_svml
:
2727 ix86_veclib_handler
= &ix86_veclibabi_svml
;
2730 case ix86_veclibabi_type_acml
:
2731 ix86_veclib_handler
= &ix86_veclibabi_acml
;
2738 if (ix86_tune_features
[X86_TUNE_ACCUMULATE_OUTGOING_ARGS
]
2739 && !(opts_set
->x_target_flags
& MASK_ACCUMULATE_OUTGOING_ARGS
))
2740 opts
->x_target_flags
|= MASK_ACCUMULATE_OUTGOING_ARGS
;
2742 /* If stack probes are required, the space used for large function
2743 arguments on the stack must also be probed, so enable
2744 -maccumulate-outgoing-args so this happens in the prologue. */
2745 if (TARGET_STACK_PROBE_P (opts
->x_target_flags
)
2746 && !(opts
->x_target_flags
& MASK_ACCUMULATE_OUTGOING_ARGS
))
2748 if (opts_set
->x_target_flags
& MASK_ACCUMULATE_OUTGOING_ARGS
)
2751 ? G_("stack probing requires %<-maccumulate-outgoing-args%> "
2753 : G_("stack probing requires "
2754 "%<target(\"accumulate-outgoing-args\")%> for "
2756 opts
->x_target_flags
|= MASK_ACCUMULATE_OUTGOING_ARGS
;
2759 /* Stack realignment without -maccumulate-outgoing-args requires %ebp,
2760 so enable -maccumulate-outgoing-args when %ebp is fixed. */
2761 if (fixed_regs
[BP_REG
]
2762 && !(opts
->x_target_flags
& MASK_ACCUMULATE_OUTGOING_ARGS
))
2764 if (opts_set
->x_target_flags
& MASK_ACCUMULATE_OUTGOING_ARGS
)
2767 ? G_("fixed ebp register requires "
2768 "%<-maccumulate-outgoing-args%>")
2769 : G_("fixed ebp register requires "
2770 "%<target(\"accumulate-outgoing-args\")%>"));
2771 opts
->x_target_flags
|= MASK_ACCUMULATE_OUTGOING_ARGS
;
2774 /* Figure out what ASM_GENERATE_INTERNAL_LABEL builds as a prefix. */
2777 ASM_GENERATE_INTERNAL_LABEL (internal_label_prefix
, "LX", 0);
2778 p
= strchr (internal_label_prefix
, 'X');
2779 internal_label_prefix_len
= p
- internal_label_prefix
;
2783 /* When scheduling description is not available, disable scheduler pass
2784 so it won't slow down the compilation and make x87 code slower. */
2785 if (!TARGET_SCHEDULE
)
2786 opts
->x_flag_schedule_insns_after_reload
= opts
->x_flag_schedule_insns
= 0;
2788 SET_OPTION_IF_UNSET (opts
, opts_set
, param_simultaneous_prefetches
,
2789 ix86_tune_cost
->simultaneous_prefetches
);
2790 SET_OPTION_IF_UNSET (opts
, opts_set
, param_l1_cache_line_size
,
2791 ix86_tune_cost
->prefetch_block
);
2792 SET_OPTION_IF_UNSET (opts
, opts_set
, param_l1_cache_size
,
2793 ix86_tune_cost
->l1_cache_size
);
2794 SET_OPTION_IF_UNSET (opts
, opts_set
, param_l2_cache_size
,
2795 ix86_tune_cost
->l2_cache_size
);
2797 /* Enable sw prefetching at -O3 for CPUS that prefetching is helpful. */
2798 if (opts
->x_flag_prefetch_loop_arrays
< 0
2800 && (opts
->x_optimize
>= 3 || opts
->x_flag_profile_use
)
2801 && !opts
->x_optimize_size
2802 && TARGET_SOFTWARE_PREFETCHING_BENEFICIAL
)
2803 opts
->x_flag_prefetch_loop_arrays
= 1;
2805 /* If using typedef char *va_list, signal that __builtin_va_start (&ap, 0)
2806 can be opts->x_optimized to ap = __builtin_next_arg (0). */
2807 if (!TARGET_64BIT_P (opts
->x_ix86_isa_flags
) && !opts
->x_flag_split_stack
)
2808 targetm
.expand_builtin_va_start
= NULL
;
2811 /* Use -mcld by default for 32-bit code if configured with --enable-cld. */
2812 if (!TARGET_64BIT_P (opts
->x_ix86_isa_flags
))
2813 opts
->x_target_flags
|= MASK_CLD
& ~opts_set
->x_target_flags
;
2816 /* Set the default value for -mfentry. */
2817 if (!opts_set
->x_flag_fentry
)
2818 opts
->x_flag_fentry
= TARGET_SEH
;
2821 if (!TARGET_64BIT_P (opts
->x_ix86_isa_flags
) && opts
->x_flag_pic
2822 && opts
->x_flag_fentry
)
2823 sorry ("%<-mfentry%> isn%'t supported for 32-bit in combination "
2825 else if (TARGET_SEH
&& !opts
->x_flag_fentry
)
2826 sorry ("%<-mno-fentry%> isn%'t compatible with SEH");
2829 if (TARGET_SEH
&& TARGET_CALL_MS2SYSV_XLOGUES
)
2830 sorry ("%<-mcall-ms2sysv-xlogues%> isn%'t currently supported with SEH");
2832 if (!(opts_set
->x_target_flags
& MASK_VZEROUPPER
)
2833 && TARGET_EMIT_VZEROUPPER
)
2834 opts
->x_target_flags
|= MASK_VZEROUPPER
;
2835 if (!(opts_set
->x_target_flags
& MASK_STV
))
2836 opts
->x_target_flags
|= MASK_STV
;
2837 /* Disable STV if -mpreferred-stack-boundary={2,3} or
2838 -mincoming-stack-boundary={2,3} or -mstackrealign - the needed
2839 stack realignment will be extra cost the pass doesn't take into
2840 account and the pass can't realign the stack. */
2841 if (ix86_preferred_stack_boundary
< 128
2842 || ix86_incoming_stack_boundary
< 128
2843 || opts
->x_ix86_force_align_arg_pointer
)
2844 opts
->x_target_flags
&= ~MASK_STV
;
2845 if (!ix86_tune_features
[X86_TUNE_AVX256_UNALIGNED_LOAD_OPTIMAL
]
2846 && !(opts_set
->x_target_flags
& MASK_AVX256_SPLIT_UNALIGNED_LOAD
))
2847 opts
->x_target_flags
|= MASK_AVX256_SPLIT_UNALIGNED_LOAD
;
2848 if (!ix86_tune_features
[X86_TUNE_AVX256_UNALIGNED_STORE_OPTIMAL
]
2849 && !(opts_set
->x_target_flags
& MASK_AVX256_SPLIT_UNALIGNED_STORE
))
2850 opts
->x_target_flags
|= MASK_AVX256_SPLIT_UNALIGNED_STORE
;
2852 /* Enable 128-bit AVX instruction generation
2853 for the auto-vectorizer. */
2854 if (ix86_tune_features
[X86_TUNE_AVX128_OPTIMAL
]
2855 && (opts_set
->x_prefer_vector_width_type
== PVW_NONE
))
2856 opts
->x_prefer_vector_width_type
= PVW_AVX128
;
2858 /* Use 256-bit AVX instruction generation
2859 in the auto-vectorizer. */
2860 if (ix86_tune_features
[X86_TUNE_AVX256_OPTIMAL
]
2861 && (opts_set
->x_prefer_vector_width_type
== PVW_NONE
))
2862 opts
->x_prefer_vector_width_type
= PVW_AVX256
;
2864 if (opts
->x_ix86_recip_name
)
2866 char *p
= ASTRDUP (opts
->x_ix86_recip_name
);
2868 unsigned int mask
, i
;
2871 while ((q
= strtok (p
, ",")) != NULL
)
2882 if (!strcmp (q
, "default"))
2883 mask
= RECIP_MASK_ALL
;
2886 for (i
= 0; i
< ARRAY_SIZE (recip_options
); i
++)
2887 if (!strcmp (q
, recip_options
[i
].string
))
2889 mask
= recip_options
[i
].mask
;
2893 if (i
== ARRAY_SIZE (recip_options
))
2895 error ("unknown option for %<-mrecip=%s%>", q
);
2897 mask
= RECIP_MASK_NONE
;
2901 opts
->x_recip_mask_explicit
|= mask
;
2903 opts
->x_recip_mask
&= ~mask
;
2905 opts
->x_recip_mask
|= mask
;
2909 if (TARGET_RECIP_P (opts
->x_target_flags
))
2910 opts
->x_recip_mask
|= RECIP_MASK_ALL
& ~opts
->x_recip_mask_explicit
;
2911 else if (opts_set
->x_target_flags
& MASK_RECIP
)
2912 opts
->x_recip_mask
&= ~(RECIP_MASK_ALL
& ~opts
->x_recip_mask_explicit
);
2914 /* Default long double to 64-bit for 32-bit Bionic and to __float128
2915 for 64-bit Bionic. Also default long double to 64-bit for Intel
2917 if ((TARGET_HAS_BIONIC
|| TARGET_IAMCU
)
2918 && !(opts_set
->x_target_flags
2919 & (MASK_LONG_DOUBLE_64
| MASK_LONG_DOUBLE_128
)))
2920 opts
->x_target_flags
|= (TARGET_64BIT
2921 ? MASK_LONG_DOUBLE_128
2922 : MASK_LONG_DOUBLE_64
);
2924 /* Only one of them can be active. */
2925 gcc_assert ((opts
->x_target_flags
& MASK_LONG_DOUBLE_64
) == 0
2926 || (opts
->x_target_flags
& MASK_LONG_DOUBLE_128
) == 0);
2928 /* Handle stack protector */
2929 if (!opts_set
->x_ix86_stack_protector_guard
)
2931 #ifdef TARGET_THREAD_SSP_OFFSET
2932 if (!TARGET_HAS_BIONIC
)
2933 opts
->x_ix86_stack_protector_guard
= SSP_TLS
;
2936 opts
->x_ix86_stack_protector_guard
= SSP_GLOBAL
;
2939 if (opts_set
->x_ix86_stack_protector_guard_offset_str
)
2942 const char *str
= opts
->x_ix86_stack_protector_guard_offset_str
;
2947 #if defined(INT64_T_IS_LONG)
2948 offset
= strtol (str
, &endp
, 0);
2950 offset
= strtoll (str
, &endp
, 0);
2953 if (!*str
|| *endp
|| errno
)
2954 error ("%qs is not a valid number "
2955 "in %<-mstack-protector-guard-offset=%>", str
);
2957 if (!IN_RANGE (offset
, HOST_WIDE_INT_C (-0x80000000),
2958 HOST_WIDE_INT_C (0x7fffffff)))
2959 error ("%qs is not a valid offset "
2960 "in %<-mstack-protector-guard-offset=%>", str
);
2962 opts
->x_ix86_stack_protector_guard_offset
= offset
;
2964 #ifdef TARGET_THREAD_SSP_OFFSET
2966 opts
->x_ix86_stack_protector_guard_offset
= TARGET_THREAD_SSP_OFFSET
;
2969 if (opts_set
->x_ix86_stack_protector_guard_reg_str
)
2971 const char *str
= opts
->x_ix86_stack_protector_guard_reg_str
;
2972 addr_space_t seg
= ADDR_SPACE_GENERIC
;
2974 /* Discard optional register prefix. */
2978 if (strlen (str
) == 2 && str
[1] == 's')
2981 seg
= ADDR_SPACE_SEG_FS
;
2982 else if (str
[0] == 'g')
2983 seg
= ADDR_SPACE_SEG_GS
;
2986 if (seg
== ADDR_SPACE_GENERIC
)
2987 error ("%qs is not a valid base register "
2988 "in %<-mstack-protector-guard-reg=%>",
2989 opts
->x_ix86_stack_protector_guard_reg_str
);
2991 opts
->x_ix86_stack_protector_guard_reg
= seg
;
2995 opts
->x_ix86_stack_protector_guard_reg
= DEFAULT_TLS_SEG_REG
;
2997 /* The kernel uses a different segment register for performance
2998 reasons; a system call would not have to trash the userspace
2999 segment register, which would be expensive. */
3000 if (opts
->x_ix86_cmodel
== CM_KERNEL
)
3001 opts
->x_ix86_stack_protector_guard_reg
= ADDR_SPACE_SEG_GS
;
3004 /* Handle -mmemcpy-strategy= and -mmemset-strategy= */
3005 if (opts
->x_ix86_tune_memcpy_strategy
)
3007 char *str
= xstrdup (opts
->x_ix86_tune_memcpy_strategy
);
3008 ix86_parse_stringop_strategy_string (str
, false);
3012 if (opts
->x_ix86_tune_memset_strategy
)
3014 char *str
= xstrdup (opts
->x_ix86_tune_memset_strategy
);
3015 ix86_parse_stringop_strategy_string (str
, true);
3019 /* Save the initial options in case the user does function specific
3023 opts
->x_ix86_excess_precision
3024 = opts
->x_flag_excess_precision
;
3025 opts
->x_ix86_unsafe_math_optimizations
3026 = opts
->x_flag_unsafe_math_optimizations
;
3027 target_option_default_node
= target_option_current_node
3028 = build_target_option_node (opts
, opts_set
);
3031 if (opts
->x_flag_cf_protection
!= CF_NONE
)
3032 opts
->x_flag_cf_protection
3033 = (cf_protection_level
) (opts
->x_flag_cf_protection
| CF_SET
);
3035 if (ix86_tune_features
[X86_TUNE_AVOID_256FMA_CHAINS
])
3036 SET_OPTION_IF_UNSET (opts
, opts_set
, param_avoid_fma_max_bits
, 256);
3037 else if (ix86_tune_features
[X86_TUNE_AVOID_128FMA_CHAINS
])
3038 SET_OPTION_IF_UNSET (opts
, opts_set
, param_avoid_fma_max_bits
, 128);
3040 /* PR86952: jump table usage with retpolines is slow.
3041 The PR provides some numbers about the slowness. */
3042 if (ix86_indirect_branch
!= indirect_branch_keep
)
3043 SET_OPTION_IF_UNSET (opts
, opts_set
, flag_jump_tables
, 0);
3048 /* Implement the TARGET_OPTION_OVERRIDE hook. */
3051 ix86_option_override (void)
3053 ix86_option_override_internal (true, &global_options
, &global_options_set
);
3056 /* Remember the last target of ix86_set_current_function. */
3057 static GTY(()) tree ix86_previous_fndecl
;
3059 /* Set targets globals to the default (or current #pragma GCC target
3060 if active). Invalidate ix86_previous_fndecl cache. */
3063 ix86_reset_previous_fndecl (void)
3065 tree new_tree
= target_option_current_node
;
3066 cl_target_option_restore (&global_options
, &global_options_set
,
3067 TREE_TARGET_OPTION (new_tree
));
3068 if (TREE_TARGET_GLOBALS (new_tree
))
3069 restore_target_globals (TREE_TARGET_GLOBALS (new_tree
));
3070 else if (new_tree
== target_option_default_node
)
3071 restore_target_globals (&default_target_globals
);
3073 TREE_TARGET_GLOBALS (new_tree
) = save_target_globals_default_opts ();
3074 ix86_previous_fndecl
= NULL_TREE
;
3077 /* Add target attribute to SIMD clone NODE if needed. */
3080 ix86_simd_clone_adjust (struct cgraph_node
*node
)
3082 const char *str
= NULL
;
3084 /* Attributes need to be adjusted for definitions, not declarations. */
3085 if (!node
->definition
)
3088 gcc_assert (node
->decl
== cfun
->decl
);
3089 switch (node
->simdclone
->vecsize_mangle
)
3096 if (TARGET_PREFER_AVX128
)
3099 str
= "avx,prefer-vector-width=256";
3101 str
= "prefer-vector-width=256";
3103 else if (!TARGET_AVX
)
3107 if (TARGET_PREFER_AVX128
)
3110 str
= "avx2,prefer-vector-width=256";
3112 str
= "prefer-vector-width=256";
3114 else if (!TARGET_AVX2
)
3118 if (TARGET_PREFER_AVX256
)
3120 if (!TARGET_AVX512F
)
3121 str
= "avx512f,prefer-vector-width=512";
3123 str
= "prefer-vector-width=512";
3125 else if (!TARGET_AVX512F
)
3134 tree args
= build_tree_list (NULL_TREE
, build_string (strlen (str
), str
));
3135 bool ok
= ix86_valid_target_attribute_p (node
->decl
, NULL
, args
, 0);
3138 ix86_reset_previous_fndecl ();
3139 ix86_set_current_function (node
->decl
);
3144 /* Set the func_type field from the function FNDECL. */
3147 ix86_set_func_type (tree fndecl
)
3149 if (cfun
->machine
->func_type
== TYPE_UNKNOWN
)
3151 if (lookup_attribute ("interrupt",
3152 TYPE_ATTRIBUTES (TREE_TYPE (fndecl
))))
3154 if (ix86_function_naked (fndecl
))
3155 error_at (DECL_SOURCE_LOCATION (fndecl
),
3156 "interrupt and naked attributes are not compatible");
3159 for (tree arg
= DECL_ARGUMENTS (fndecl
);
3161 arg
= TREE_CHAIN (arg
))
3163 cfun
->machine
->no_caller_saved_registers
= true;
3164 cfun
->machine
->func_type
3165 = nargs
== 2 ? TYPE_EXCEPTION
: TYPE_INTERRUPT
;
3167 ix86_optimize_mode_switching
[X86_DIRFLAG
] = 1;
3169 /* Only dwarf2out.c can handle -WORD(AP) as a pointer argument. */
3170 if (write_symbols
!= NO_DEBUG
&& write_symbols
!= DWARF2_DEBUG
)
3171 sorry ("only DWARF debug format is supported for interrupt "
3176 cfun
->machine
->func_type
= TYPE_NORMAL
;
3177 if (lookup_attribute ("no_caller_saved_registers",
3178 TYPE_ATTRIBUTES (TREE_TYPE (fndecl
))))
3179 cfun
->machine
->no_caller_saved_registers
= true;
3184 /* Set the indirect_branch_type field from the function FNDECL. */
3187 ix86_set_indirect_branch_type (tree fndecl
)
3189 if (cfun
->machine
->indirect_branch_type
== indirect_branch_unset
)
3191 tree attr
= lookup_attribute ("indirect_branch",
3192 DECL_ATTRIBUTES (fndecl
));
3195 tree args
= TREE_VALUE (attr
);
3198 tree cst
= TREE_VALUE (args
);
3199 if (strcmp (TREE_STRING_POINTER (cst
), "keep") == 0)
3200 cfun
->machine
->indirect_branch_type
= indirect_branch_keep
;
3201 else if (strcmp (TREE_STRING_POINTER (cst
), "thunk") == 0)
3202 cfun
->machine
->indirect_branch_type
= indirect_branch_thunk
;
3203 else if (strcmp (TREE_STRING_POINTER (cst
), "thunk-inline") == 0)
3204 cfun
->machine
->indirect_branch_type
= indirect_branch_thunk_inline
;
3205 else if (strcmp (TREE_STRING_POINTER (cst
), "thunk-extern") == 0)
3206 cfun
->machine
->indirect_branch_type
= indirect_branch_thunk_extern
;
3211 cfun
->machine
->indirect_branch_type
= ix86_indirect_branch
;
3213 /* -mcmodel=large is not compatible with -mindirect-branch=thunk
3214 nor -mindirect-branch=thunk-extern. */
3215 if ((ix86_cmodel
== CM_LARGE
|| ix86_cmodel
== CM_LARGE_PIC
)
3216 && ((cfun
->machine
->indirect_branch_type
3217 == indirect_branch_thunk_extern
)
3218 || (cfun
->machine
->indirect_branch_type
3219 == indirect_branch_thunk
)))
3220 error ("%<-mindirect-branch=%s%> and %<-mcmodel=large%> are not "
3222 ((cfun
->machine
->indirect_branch_type
3223 == indirect_branch_thunk_extern
)
3224 ? "thunk-extern" : "thunk"));
3226 if (cfun
->machine
->indirect_branch_type
!= indirect_branch_keep
3227 && (cfun
->machine
->indirect_branch_type
3228 != indirect_branch_thunk_extern
)
3229 && (flag_cf_protection
& CF_RETURN
))
3230 error ("%<-mindirect-branch%> and %<-fcf-protection%> are not "
3234 if (cfun
->machine
->function_return_type
== indirect_branch_unset
)
3236 tree attr
= lookup_attribute ("function_return",
3237 DECL_ATTRIBUTES (fndecl
));
3240 tree args
= TREE_VALUE (attr
);
3243 tree cst
= TREE_VALUE (args
);
3244 if (strcmp (TREE_STRING_POINTER (cst
), "keep") == 0)
3245 cfun
->machine
->function_return_type
= indirect_branch_keep
;
3246 else if (strcmp (TREE_STRING_POINTER (cst
), "thunk") == 0)
3247 cfun
->machine
->function_return_type
= indirect_branch_thunk
;
3248 else if (strcmp (TREE_STRING_POINTER (cst
), "thunk-inline") == 0)
3249 cfun
->machine
->function_return_type
= indirect_branch_thunk_inline
;
3250 else if (strcmp (TREE_STRING_POINTER (cst
), "thunk-extern") == 0)
3251 cfun
->machine
->function_return_type
= indirect_branch_thunk_extern
;
3256 cfun
->machine
->function_return_type
= ix86_function_return
;
3258 /* -mcmodel=large is not compatible with -mfunction-return=thunk
3259 nor -mfunction-return=thunk-extern. */
3260 if ((ix86_cmodel
== CM_LARGE
|| ix86_cmodel
== CM_LARGE_PIC
)
3261 && ((cfun
->machine
->function_return_type
3262 == indirect_branch_thunk_extern
)
3263 || (cfun
->machine
->function_return_type
3264 == indirect_branch_thunk
)))
3265 error ("%<-mfunction-return=%s%> and %<-mcmodel=large%> are not "
3267 ((cfun
->machine
->function_return_type
3268 == indirect_branch_thunk_extern
)
3269 ? "thunk-extern" : "thunk"));
3271 if (cfun
->machine
->function_return_type
!= indirect_branch_keep
3272 && (cfun
->machine
->function_return_type
3273 != indirect_branch_thunk_extern
)
3274 && (flag_cf_protection
& CF_RETURN
))
3275 error ("%<-mfunction-return%> and %<-fcf-protection%> are not "
3280 /* Establish appropriate back-end context for processing the function
3281 FNDECL. The argument might be NULL to indicate processing at top
3282 level, outside of any function scope. */
3284 ix86_set_current_function (tree fndecl
)
3286 /* Only change the context if the function changes. This hook is called
3287 several times in the course of compiling a function, and we don't want to
3288 slow things down too much or call target_reinit when it isn't safe. */
3289 if (fndecl
== ix86_previous_fndecl
)
3291 /* There may be 2 function bodies for the same function FNDECL,
3292 one is extern inline and one isn't. Call ix86_set_func_type
3293 to set the func_type field. */
3294 if (fndecl
!= NULL_TREE
)
3296 ix86_set_func_type (fndecl
);
3297 ix86_set_indirect_branch_type (fndecl
);
3303 if (ix86_previous_fndecl
== NULL_TREE
)
3304 old_tree
= target_option_current_node
;
3305 else if (DECL_FUNCTION_SPECIFIC_TARGET (ix86_previous_fndecl
))
3306 old_tree
= DECL_FUNCTION_SPECIFIC_TARGET (ix86_previous_fndecl
);
3308 old_tree
= target_option_default_node
;
3310 if (fndecl
== NULL_TREE
)
3312 if (old_tree
!= target_option_current_node
)
3313 ix86_reset_previous_fndecl ();
3317 ix86_set_func_type (fndecl
);
3318 ix86_set_indirect_branch_type (fndecl
);
3320 tree new_tree
= DECL_FUNCTION_SPECIFIC_TARGET (fndecl
);
3321 if (new_tree
== NULL_TREE
)
3322 new_tree
= target_option_default_node
;
3324 if (old_tree
!= new_tree
)
3326 cl_target_option_restore (&global_options
, &global_options_set
,
3327 TREE_TARGET_OPTION (new_tree
));
3328 if (TREE_TARGET_GLOBALS (new_tree
))
3329 restore_target_globals (TREE_TARGET_GLOBALS (new_tree
));
3330 else if (new_tree
== target_option_default_node
)
3331 restore_target_globals (&default_target_globals
);
3333 TREE_TARGET_GLOBALS (new_tree
) = save_target_globals_default_opts ();
3335 else if (flag_unsafe_math_optimizations
3336 != TREE_TARGET_OPTION (new_tree
)->x_ix86_unsafe_math_optimizations
3337 || (flag_excess_precision
3338 != TREE_TARGET_OPTION (new_tree
)->x_ix86_excess_precision
))
3340 cl_target_option_restore (&global_options
, &global_options_set
,
3341 TREE_TARGET_OPTION (new_tree
));
3342 ix86_excess_precision
= flag_excess_precision
;
3343 ix86_unsafe_math_optimizations
= flag_unsafe_math_optimizations
;
3344 DECL_FUNCTION_SPECIFIC_TARGET (fndecl
) = new_tree
3345 = build_target_option_node (&global_options
, &global_options_set
);
3346 if (TREE_TARGET_GLOBALS (new_tree
))
3347 restore_target_globals (TREE_TARGET_GLOBALS (new_tree
));
3348 else if (new_tree
== target_option_default_node
)
3349 restore_target_globals (&default_target_globals
);
3351 TREE_TARGET_GLOBALS (new_tree
) = save_target_globals_default_opts ();
3353 ix86_previous_fndecl
= fndecl
;
3355 static bool prev_no_caller_saved_registers
;
3357 /* 64-bit MS and SYSV ABI have different set of call used registers.
3358 Avoid expensive re-initialization of init_regs each time we switch
3359 function context. */
3361 && (call_used_or_fixed_reg_p (SI_REG
)
3362 == (cfun
->machine
->call_abi
== MS_ABI
)))
3364 /* Need to re-initialize init_regs if caller-saved registers are
3366 else if (prev_no_caller_saved_registers
3367 != cfun
->machine
->no_caller_saved_registers
)
3370 if (cfun
->machine
->func_type
!= TYPE_NORMAL
3371 || cfun
->machine
->no_caller_saved_registers
)
3373 /* Don't allow SSE, MMX nor x87 instructions since they
3374 may change processor state. */
3378 else if (TARGET_MMX
)
3380 else if (TARGET_80387
)
3386 if (cfun
->machine
->func_type
!= TYPE_NORMAL
)
3387 sorry (cfun
->machine
->func_type
== TYPE_EXCEPTION
3388 ? G_("%s instructions aren%'t allowed in an"
3389 " exception service routine")
3390 : G_("%s instructions aren%'t allowed in an"
3391 " interrupt service routine"),
3394 sorry ("%s instructions aren%'t allowed in a function with "
3395 "the %<no_caller_saved_registers%> attribute", isa
);
3396 /* Don't issue the same error twice. */
3397 cfun
->machine
->func_type
= TYPE_NORMAL
;
3398 cfun
->machine
->no_caller_saved_registers
= false;
3402 prev_no_caller_saved_registers
3403 = cfun
->machine
->no_caller_saved_registers
;
3406 /* Implement the TARGET_OFFLOAD_OPTIONS hook. */
3408 ix86_offload_options (void)
3411 return xstrdup ("-foffload-abi=lp64");
3412 return xstrdup ("-foffload-abi=ilp32");
3415 /* Handle "cdecl", "stdcall", "fastcall", "regparm", "thiscall",
3416 and "sseregparm" calling convention attributes;
3417 arguments as in struct attribute_spec.handler. */
3420 ix86_handle_cconv_attribute (tree
*node
, tree name
, tree args
, int,
3423 if (TREE_CODE (*node
) != FUNCTION_TYPE
3424 && TREE_CODE (*node
) != METHOD_TYPE
3425 && TREE_CODE (*node
) != FIELD_DECL
3426 && TREE_CODE (*node
) != TYPE_DECL
)
3428 warning (OPT_Wattributes
, "%qE attribute only applies to functions",
3430 *no_add_attrs
= true;
3434 /* Can combine regparm with all attributes but fastcall, and thiscall. */
3435 if (is_attribute_p ("regparm", name
))
3439 if (lookup_attribute ("fastcall", TYPE_ATTRIBUTES (*node
)))
3441 error ("fastcall and regparm attributes are not compatible");
3444 if (lookup_attribute ("thiscall", TYPE_ATTRIBUTES (*node
)))
3446 error ("regparam and thiscall attributes are not compatible");
3449 cst
= TREE_VALUE (args
);
3450 if (TREE_CODE (cst
) != INTEGER_CST
)
3452 warning (OPT_Wattributes
,
3453 "%qE attribute requires an integer constant argument",
3455 *no_add_attrs
= true;
3457 else if (compare_tree_int (cst
, REGPARM_MAX
) > 0)
3459 warning (OPT_Wattributes
, "argument to %qE attribute larger than %d",
3461 *no_add_attrs
= true;
3469 /* Do not warn when emulating the MS ABI. */
3470 if ((TREE_CODE (*node
) != FUNCTION_TYPE
3471 && TREE_CODE (*node
) != METHOD_TYPE
)
3472 || ix86_function_type_abi (*node
) != MS_ABI
)
3473 warning (OPT_Wattributes
, "%qE attribute ignored",
3475 *no_add_attrs
= true;
3479 /* Can combine fastcall with stdcall (redundant) and sseregparm. */
3480 if (is_attribute_p ("fastcall", name
))
3482 if (lookup_attribute ("cdecl", TYPE_ATTRIBUTES (*node
)))
3484 error ("fastcall and cdecl attributes are not compatible");
3486 if (lookup_attribute ("stdcall", TYPE_ATTRIBUTES (*node
)))
3488 error ("fastcall and stdcall attributes are not compatible");
3490 if (lookup_attribute ("regparm", TYPE_ATTRIBUTES (*node
)))
3492 error ("fastcall and regparm attributes are not compatible");
3494 if (lookup_attribute ("thiscall", TYPE_ATTRIBUTES (*node
)))
3496 error ("fastcall and thiscall attributes are not compatible");
3500 /* Can combine stdcall with fastcall (redundant), regparm and
3502 else if (is_attribute_p ("stdcall", name
))
3504 if (lookup_attribute ("cdecl", TYPE_ATTRIBUTES (*node
)))
3506 error ("stdcall and cdecl attributes are not compatible");
3508 if (lookup_attribute ("fastcall", TYPE_ATTRIBUTES (*node
)))
3510 error ("stdcall and fastcall attributes are not compatible");
3512 if (lookup_attribute ("thiscall", TYPE_ATTRIBUTES (*node
)))
3514 error ("stdcall and thiscall attributes are not compatible");
3518 /* Can combine cdecl with regparm and sseregparm. */
3519 else if (is_attribute_p ("cdecl", name
))
3521 if (lookup_attribute ("stdcall", TYPE_ATTRIBUTES (*node
)))
3523 error ("stdcall and cdecl attributes are not compatible");
3525 if (lookup_attribute ("fastcall", TYPE_ATTRIBUTES (*node
)))
3527 error ("fastcall and cdecl attributes are not compatible");
3529 if (lookup_attribute ("thiscall", TYPE_ATTRIBUTES (*node
)))
3531 error ("cdecl and thiscall attributes are not compatible");
3534 else if (is_attribute_p ("thiscall", name
))
3536 if (TREE_CODE (*node
) != METHOD_TYPE
&& pedantic
)
3537 warning (OPT_Wattributes
, "%qE attribute is used for non-class method",
3539 if (lookup_attribute ("stdcall", TYPE_ATTRIBUTES (*node
)))
3541 error ("stdcall and thiscall attributes are not compatible");
3543 if (lookup_attribute ("fastcall", TYPE_ATTRIBUTES (*node
)))
3545 error ("fastcall and thiscall attributes are not compatible");
3547 if (lookup_attribute ("cdecl", TYPE_ATTRIBUTES (*node
)))
3549 error ("cdecl and thiscall attributes are not compatible");
3553 /* Can combine sseregparm with all attributes. */
3558 #ifndef CHECK_STACK_LIMIT
3559 #define CHECK_STACK_LIMIT (-1)
3562 /* The transactional memory builtins are implicitly regparm or fastcall
3563 depending on the ABI. Override the generic do-nothing attribute that
3564 these builtins were declared with, and replace it with one of the two
3565 attributes that we expect elsewhere. */
3568 ix86_handle_tm_regparm_attribute (tree
*node
, tree
, tree
,
3569 int flags
, bool *no_add_attrs
)
3573 /* In no case do we want to add the placeholder attribute. */
3574 *no_add_attrs
= true;
3576 /* The 64-bit ABI is unchanged for transactional memory. */
3580 /* ??? Is there a better way to validate 32-bit windows? We have
3581 cfun->machine->call_abi, but that seems to be set only for 64-bit. */
3582 if (CHECK_STACK_LIMIT
> 0)
3583 alt
= tree_cons (get_identifier ("fastcall"), NULL
, NULL
);
3586 alt
= tree_cons (NULL
, build_int_cst (NULL
, 2), NULL
);
3587 alt
= tree_cons (get_identifier ("regparm"), alt
, NULL
);
3589 decl_attributes (node
, alt
, flags
);
3594 /* Handle a "force_align_arg_pointer" attribute. */
3597 ix86_handle_force_align_arg_pointer_attribute (tree
*node
, tree name
,
3598 tree
, int, bool *no_add_attrs
)
3600 if (TREE_CODE (*node
) != FUNCTION_TYPE
3601 && TREE_CODE (*node
) != METHOD_TYPE
3602 && TREE_CODE (*node
) != FIELD_DECL
3603 && TREE_CODE (*node
) != TYPE_DECL
)
3605 warning (OPT_Wattributes
, "%qE attribute only applies to functions",
3607 *no_add_attrs
= true;
3613 /* Handle a "ms_struct" or "gcc_struct" attribute; arguments as in
3614 struct attribute_spec.handler. */
3617 ix86_handle_struct_attribute (tree
*node
, tree name
, tree
, int,
3623 if (TREE_CODE (*node
) == TYPE_DECL
)
3624 type
= &TREE_TYPE (*node
);
3629 if (!(type
&& RECORD_OR_UNION_TYPE_P (*type
)))
3631 warning (OPT_Wattributes
, "%qE attribute ignored",
3633 *no_add_attrs
= true;
3636 else if ((is_attribute_p ("ms_struct", name
)
3637 && lookup_attribute ("gcc_struct", TYPE_ATTRIBUTES (*type
)))
3638 || ((is_attribute_p ("gcc_struct", name
)
3639 && lookup_attribute ("ms_struct", TYPE_ATTRIBUTES (*type
)))))
3641 warning (OPT_Wattributes
, "%qE incompatible attribute ignored",
3643 *no_add_attrs
= true;
3649 /* Handle a "callee_pop_aggregate_return" attribute; arguments as
3650 in struct attribute_spec handler. */
3653 ix86_handle_callee_pop_aggregate_return (tree
*node
, tree name
, tree args
, int,
3656 if (TREE_CODE (*node
) != FUNCTION_TYPE
3657 && TREE_CODE (*node
) != METHOD_TYPE
3658 && TREE_CODE (*node
) != FIELD_DECL
3659 && TREE_CODE (*node
) != TYPE_DECL
)
3661 warning (OPT_Wattributes
, "%qE attribute only applies to functions",
3663 *no_add_attrs
= true;
3668 warning (OPT_Wattributes
, "%qE attribute only available for 32-bit",
3670 *no_add_attrs
= true;
3673 if (is_attribute_p ("callee_pop_aggregate_return", name
))
3677 cst
= TREE_VALUE (args
);
3678 if (TREE_CODE (cst
) != INTEGER_CST
)
3680 warning (OPT_Wattributes
,
3681 "%qE attribute requires an integer constant argument",
3683 *no_add_attrs
= true;
3685 else if (compare_tree_int (cst
, 0) != 0
3686 && compare_tree_int (cst
, 1) != 0)
3688 warning (OPT_Wattributes
,
3689 "argument to %qE attribute is neither zero, nor one",
3691 *no_add_attrs
= true;
3700 /* Handle a "ms_abi" or "sysv" attribute; arguments as in
3701 struct attribute_spec.handler. */
3704 ix86_handle_abi_attribute (tree
*node
, tree name
, tree
, int,
3707 if (TREE_CODE (*node
) != FUNCTION_TYPE
3708 && TREE_CODE (*node
) != METHOD_TYPE
3709 && TREE_CODE (*node
) != FIELD_DECL
3710 && TREE_CODE (*node
) != TYPE_DECL
)
3712 warning (OPT_Wattributes
, "%qE attribute only applies to functions",
3714 *no_add_attrs
= true;
3718 /* Can combine regparm with all attributes but fastcall. */
3719 if (is_attribute_p ("ms_abi", name
))
3721 if (lookup_attribute ("sysv_abi", TYPE_ATTRIBUTES (*node
)))
3723 error ("%qs and %qs attributes are not compatible",
3724 "ms_abi", "sysv_abi");
3729 else if (is_attribute_p ("sysv_abi", name
))
3731 if (lookup_attribute ("ms_abi", TYPE_ATTRIBUTES (*node
)))
3733 error ("%qs and %qs attributes are not compatible",
3734 "ms_abi", "sysv_abi");
3744 ix86_handle_fndecl_attribute (tree
*node
, tree name
, tree args
, int,
3747 if (TREE_CODE (*node
) != FUNCTION_DECL
)
3749 warning (OPT_Wattributes
, "%qE attribute only applies to functions",
3751 *no_add_attrs
= true;
3754 if (is_attribute_p ("indirect_branch", name
))
3756 tree cst
= TREE_VALUE (args
);
3757 if (TREE_CODE (cst
) != STRING_CST
)
3759 warning (OPT_Wattributes
,
3760 "%qE attribute requires a string constant argument",
3762 *no_add_attrs
= true;
3764 else if (strcmp (TREE_STRING_POINTER (cst
), "keep") != 0
3765 && strcmp (TREE_STRING_POINTER (cst
), "thunk") != 0
3766 && strcmp (TREE_STRING_POINTER (cst
), "thunk-inline") != 0
3767 && strcmp (TREE_STRING_POINTER (cst
), "thunk-extern") != 0)
3769 warning (OPT_Wattributes
,
3770 "argument to %qE attribute is not "
3771 "(keep|thunk|thunk-inline|thunk-extern)", name
);
3772 *no_add_attrs
= true;
3776 if (is_attribute_p ("function_return", name
))
3778 tree cst
= TREE_VALUE (args
);
3779 if (TREE_CODE (cst
) != STRING_CST
)
3781 warning (OPT_Wattributes
,
3782 "%qE attribute requires a string constant argument",
3784 *no_add_attrs
= true;
3786 else if (strcmp (TREE_STRING_POINTER (cst
), "keep") != 0
3787 && strcmp (TREE_STRING_POINTER (cst
), "thunk") != 0
3788 && strcmp (TREE_STRING_POINTER (cst
), "thunk-inline") != 0
3789 && strcmp (TREE_STRING_POINTER (cst
), "thunk-extern") != 0)
3791 warning (OPT_Wattributes
,
3792 "argument to %qE attribute is not "
3793 "(keep|thunk|thunk-inline|thunk-extern)", name
);
3794 *no_add_attrs
= true;
3802 ix86_handle_no_caller_saved_registers_attribute (tree
*, tree
, tree
,
3809 ix86_handle_interrupt_attribute (tree
*node
, tree
, tree
, int, bool *)
3811 /* DECL_RESULT and DECL_ARGUMENTS do not exist there yet,
3812 but the function type contains args and return type data. */
3813 tree func_type
= *node
;
3814 tree return_type
= TREE_TYPE (func_type
);
3817 tree current_arg_type
= TYPE_ARG_TYPES (func_type
);
3818 while (current_arg_type
3819 && ! VOID_TYPE_P (TREE_VALUE (current_arg_type
)))
3823 if (! POINTER_TYPE_P (TREE_VALUE (current_arg_type
)))
3824 error ("interrupt service routine should have a pointer "
3825 "as the first argument");
3827 else if (nargs
== 1)
3829 if (TREE_CODE (TREE_VALUE (current_arg_type
)) != INTEGER_TYPE
3830 || TYPE_MODE (TREE_VALUE (current_arg_type
)) != word_mode
)
3831 error ("interrupt service routine should have %qs "
3832 "as the second argument",
3834 ? (TARGET_X32
? "unsigned long long int"
3835 : "unsigned long int")
3839 current_arg_type
= TREE_CHAIN (current_arg_type
);
3841 if (!nargs
|| nargs
> 2)
3842 error ("interrupt service routine can only have a pointer argument "
3843 "and an optional integer argument");
3844 if (! VOID_TYPE_P (return_type
))
3845 error ("interrupt service routine must return %<void%>");
3850 /* Handle fentry_name / fentry_section attribute. */
3853 ix86_handle_fentry_name (tree
*node
, tree name
, tree args
,
3854 int, bool *no_add_attrs
)
3856 if (TREE_CODE (*node
) == FUNCTION_DECL
3857 && TREE_CODE (TREE_VALUE (args
)) == STRING_CST
)
3858 /* Do nothing else, just set the attribute. We'll get at
3859 it later with lookup_attribute. */
3863 warning (OPT_Wattributes
, "%qE attribute ignored", name
);
3864 *no_add_attrs
= true;
3870 /* Table of valid machine attributes. */
3871 const struct attribute_spec ix86_attribute_table
[] =
3873 /* { name, min_len, max_len, decl_req, type_req, fn_type_req,
3874 affects_type_identity, handler, exclude } */
3875 /* Stdcall attribute says callee is responsible for popping arguments
3876 if they are not variable. */
3877 { "stdcall", 0, 0, false, true, true, true, ix86_handle_cconv_attribute
,
3879 /* Fastcall attribute says callee is responsible for popping arguments
3880 if they are not variable. */
3881 { "fastcall", 0, 0, false, true, true, true, ix86_handle_cconv_attribute
,
3883 /* Thiscall attribute says callee is responsible for popping arguments
3884 if they are not variable. */
3885 { "thiscall", 0, 0, false, true, true, true, ix86_handle_cconv_attribute
,
3887 /* Cdecl attribute says the callee is a normal C declaration */
3888 { "cdecl", 0, 0, false, true, true, true, ix86_handle_cconv_attribute
,
3890 /* Regparm attribute specifies how many integer arguments are to be
3891 passed in registers. */
3892 { "regparm", 1, 1, false, true, true, true, ix86_handle_cconv_attribute
,
3894 /* Sseregparm attribute says we are using x86_64 calling conventions
3895 for FP arguments. */
3896 { "sseregparm", 0, 0, false, true, true, true, ix86_handle_cconv_attribute
,
3898 /* The transactional memory builtins are implicitly regparm or fastcall
3899 depending on the ABI. Override the generic do-nothing attribute that
3900 these builtins were declared with. */
3901 { "*tm regparm", 0, 0, false, true, true, true,
3902 ix86_handle_tm_regparm_attribute
, NULL
},
3903 /* force_align_arg_pointer says this function realigns the stack at entry. */
3904 { "force_align_arg_pointer", 0, 0,
3905 false, true, true, false, ix86_handle_force_align_arg_pointer_attribute
,
3907 #if TARGET_DLLIMPORT_DECL_ATTRIBUTES
3908 { "dllimport", 0, 0, false, false, false, false, handle_dll_attribute
,
3910 { "dllexport", 0, 0, false, false, false, false, handle_dll_attribute
,
3912 { "shared", 0, 0, true, false, false, false,
3913 ix86_handle_shared_attribute
, NULL
},
3915 { "ms_struct", 0, 0, false, false, false, false,
3916 ix86_handle_struct_attribute
, NULL
},
3917 { "gcc_struct", 0, 0, false, false, false, false,
3918 ix86_handle_struct_attribute
, NULL
},
3919 #ifdef SUBTARGET_ATTRIBUTE_TABLE
3920 SUBTARGET_ATTRIBUTE_TABLE
,
3922 /* ms_abi and sysv_abi calling convention function attributes. */
3923 { "ms_abi", 0, 0, false, true, true, true, ix86_handle_abi_attribute
, NULL
},
3924 { "sysv_abi", 0, 0, false, true, true, true, ix86_handle_abi_attribute
,
3926 { "ms_abi va_list", 0, 0, false, false, false, false, NULL
, NULL
},
3927 { "sysv_abi va_list", 0, 0, false, false, false, false, NULL
, NULL
},
3928 { "ms_hook_prologue", 0, 0, true, false, false, false,
3929 ix86_handle_fndecl_attribute
, NULL
},
3930 { "callee_pop_aggregate_return", 1, 1, false, true, true, true,
3931 ix86_handle_callee_pop_aggregate_return
, NULL
},
3932 { "interrupt", 0, 0, false, true, true, false,
3933 ix86_handle_interrupt_attribute
, NULL
},
3934 { "no_caller_saved_registers", 0, 0, false, true, true, false,
3935 ix86_handle_no_caller_saved_registers_attribute
, NULL
},
3936 { "naked", 0, 0, true, false, false, false,
3937 ix86_handle_fndecl_attribute
, NULL
},
3938 { "indirect_branch", 1, 1, true, false, false, false,
3939 ix86_handle_fndecl_attribute
, NULL
},
3940 { "function_return", 1, 1, true, false, false, false,
3941 ix86_handle_fndecl_attribute
, NULL
},
3942 { "indirect_return", 0, 0, false, true, true, false,
3944 { "fentry_name", 1, 1, true, false, false, false,
3945 ix86_handle_fentry_name
, NULL
},
3946 { "fentry_section", 1, 1, true, false, false, false,
3947 ix86_handle_fentry_name
, NULL
},
3948 { "cf_check", 0, 0, true, false, false, false,
3949 ix86_handle_fndecl_attribute
, NULL
},
3952 { NULL
, 0, 0, false, false, false, false, NULL
, NULL
}
3955 #include "gt-i386-options.h"