}
/* This will be called by the spec parser in gcc.c when it sees
- a %:local_cpu_detect(args) construct. Currently it will be called
- with either "arch" or "tune" as argument depending on if -march=native
- or -mtune=native is to be substituted.
+ a %:local_cpu_detect(args) construct. Currently it will be
+ called with either "arch [32|64]" or "tune [32|64]" as argument
+ depending on if -march=native or -mtune=native is to be substituted.
It returns a string containing new command line parameters to be
put at the place of the above two options, depending on what CPU
unsigned int l2sizekb = 0;
- if (argc < 1)
+ if (argc < 2)
return NULL;
arch = !strcmp (argv[0], "arch");
if (!arch && strcmp (argv[0], "tune"))
return NULL;
+ bool codegen_x86_64;
+
+ if (!strcmp (argv[1], "32"))
+ codegen_x86_64 = false;
+ else if (!strcmp (argv[1], "64"))
+ codegen_x86_64 = true;
+ else
+ return NULL;
+
struct __processor_model cpu_model = { };
struct __processor_model2 cpu_model2 = { };
unsigned int cpu_features2[SIZE_OF_CPU_FEATURES] = { };
if (isa_names_table[i].option)
{
if (has_feature (isa_names_table[i].feature))
- options = concat (options, " ",
- isa_names_table[i].option, NULL);
+ {
+ if (codegen_x86_64
+ || isa_names_table[i].feature != FEATURE_UINTR)
+ options = concat (options, " ",
+ isa_names_table[i].option, NULL);
+ }
else
options = concat (options, neg_option,
isa_names_table[i].option + 2, NULL);
#ifndef HAVE_LOCAL_CPU_DETECT
#define CC1_CPU_SPEC CC1_CPU_SPEC_1
#else
+#define ARCH_ARG "%{" OPT_ARCH64 ":64;:32}"
#define CC1_CPU_SPEC CC1_CPU_SPEC_1 \
-"%{march=native:%>march=native %:local_cpu_detect(arch) \
- %{!mtune=*:%>mtune=native %:local_cpu_detect(tune)}} \
-%{mtune=native:%>mtune=native %:local_cpu_detect(tune)}"
+"%{march=native:%>march=native %:local_cpu_detect(arch " ARCH_ARG ") \
+ %{!mtune=*:%>mtune=native %:local_cpu_detect(tune " ARCH_ARG ")}} \
+%{mtune=native:%>mtune=native %:local_cpu_detect(tune " ARCH_ARG ")}"
#endif
#endif
\f