+2013-12-17 James Greenhalgh <james.greenhalgh@arm.com>
+
+ * common/config/arm/arm-common.c (arm_rewrite_selected_cpu): New.
+ (arm_rewrite_mcpu): Likewise.
+ * config/arm/arm-protos.h (arm_rewrite_selected_cpu): New.
+ * config/arm/arm.h (BIG_LITTLE_SPEC): New.
+ (BIG_LITTLE_SPEC_FUNCTIONS): Likewise.
+ (EXTRA_SPEC_FUNCTIONS): Include BIG_LITTLE_SPEC_FUNCTIONS.
+ (ASM_CPU_SPEC): Include BIG_LITTLE_SPEC.
+ * config/arm/arm.c (arm_file_start): Rewrite arm_selecetd_cpu values.
+
2013-12-17 Eric Botcazou <ebotcazou@adacore.com>
* expmed.c (lowpart_bit_field_p): Fix comment.
return UI_SJLJ;
}
+#define ARM_CPU_NAME_LENGTH 20
+
+/* Truncate NAME at the first '.' character seen, or return
+ NAME unmodified. */
+
+const char *
+arm_rewrite_selected_cpu (const char *name)
+{
+ static char output_buf[ARM_CPU_NAME_LENGTH + 1] = {0};
+ char *arg_pos;
+
+ strncpy (output_buf, name, ARM_CPU_NAME_LENGTH);
+ arg_pos = strchr (output_buf, '.');
+
+ /* If we found a '.' truncate the entry at that point. */
+ if (arg_pos)
+ *arg_pos = '\0';
+
+ return output_buf;
+}
+
+/* Called by the driver to rewrite a name passed to the -mcpu
+ argument in preparation to be passed to the assembler. The
+ name will be in ARGV[0], ARGC should always be 1. */
+
+const char *
+arm_rewrite_mcpu (int argc, const char **argv)
+{
+ gcc_assert (argc == 1);
+ return arm_rewrite_selected_cpu (argv[0]);
+}
+
+#undef ARM_CPU_NAME_LENGTH
+
+
#undef TARGET_DEFAULT_TARGET_FLAGS
#define TARGET_DEFAULT_TARGET_FLAGS (TARGET_DEFAULT | MASK_SCHED_PROLOG)
extern void arm_emit_eabi_attribute (const char *, int, int);
+/* Defined in gcc/common/config/arm-common.c. */
+extern const char *arm_rewrite_selected_cpu (const char *name);
+
#endif /* ! GCC_ARM_PROTOS_H */
else if (strncmp (arm_selected_cpu->name, "generic", 7) == 0)
asm_fprintf (asm_out_file, "\t.arch %s\n", arm_selected_cpu->name + 8);
else
- asm_fprintf (asm_out_file, "\t.cpu %s\n", arm_selected_cpu->name);
+ {
+ const char* truncated_name
+ = arm_rewrite_selected_cpu (arm_selected_cpu->name);
+ asm_fprintf (asm_out_file, "\t.cpu %s\n", truncated_name);
+ }
if (TARGET_SOFT_FLOAT)
{
instruction. */
#define MAX_LDM_STM_OPS 4
+#define BIG_LITTLE_SPEC \
+ " %{mcpu=*:%<mcpu=* -mcpu=%:rewrite_mcpu(%{mcpu=*:%*})}" \
+
+extern const char *arm_rewrite_mcpu (int argc, const char **argv);
+#define BIG_LITTLE_CPU_SPEC_FUNCTIONS \
+ { "rewrite_mcpu", arm_rewrite_mcpu },
+
#define ASM_CPU_SPEC \
" %{mcpu=generic-*:-march=%*;" \
- " :%{mcpu=*:-mcpu=%*} %{march=*:-march=%*}}"
+ " :%{march=*:-march=%*}}" \
+ BIG_LITTLE_SPEC
/* -mcpu=native handling only makes sense with compiler running on
an ARM chip. */
#if defined(__arm__)
extern const char *host_detect_local_cpu (int argc, const char **argv);
# define EXTRA_SPEC_FUNCTIONS \
- { "local_cpu_detect", host_detect_local_cpu },
+ { "local_cpu_detect", host_detect_local_cpu }, \
+ BIG_LITTLE_CPU_SPEC_FUNCTIONS
# define MCPU_MTUNE_NATIVE_SPECS \
" %{march=native:%<march=native %:local_cpu_detect(arch)}" \
" %{mtune=native:%<mtune=native %:local_cpu_detect(tune)}"
#else
# define MCPU_MTUNE_NATIVE_SPECS ""
+# define EXTRA_SPEC_FUNCTIONS BIG_LITTLE_CPU_SPEC_FUNCTIONS
#endif
#define DRIVER_SELF_SPECS MCPU_MTUNE_NATIVE_SPECS