aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Earnshaw <rearnsha@arm.com>2016-12-15 15:58:02 +0000
committerRichard Earnshaw <rearnsha@gcc.gnu.org>2016-12-15 15:58:02 +0000
commit8990ddcdbc634df731387515e0f17b8b825b6300 (patch)
tree1c4898f81f44c5ad890f25ce8d91b6c0c98a6328
parent851966d6a7e711755b6a96f06f166054d6e877ef (diff)
downloadgcc-8990ddcdbc634df731387515e0f17b8b825b6300.zip
gcc-8990ddcdbc634df731387515e0f17b8b825b6300.tar.gz
gcc-8990ddcdbc634df731387515e0f17b8b825b6300.tar.bz2
[arm] Eliminate TARGET_FPU_NAME
Rather than assuming a specific fpu name has been selected, we work out the FPU from the ISA properties. This is necessary since once we have default FPUs selected by the processor, there will be no explicit entry in the table of fpus to refer to. This also fixes a bug with the code I added recently to permit new aliases for existing FPU names: the new names cannot be passed to the assembler since it does not recognize them. By mapping the ISA features back to the canonical names we avoid having to teach the assembler about the new names. * arm.h (TARGET_FPU_NAME): Delete. * arm.c (arm_identify_fpu_from_isa): New function. (arm_declare_function_name): Use it to get the name for the FPU. From-SVN: r243711
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/arm/arm.c26
-rw-r--r--gcc/config/arm/arm.h1
3 files changed, 30 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 94b3e50..4ccd46e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2016-12-15 Richard Earnshaw <rearnsha@arm.com>
+ * arm.h (TARGET_FPU_NAME): Delete.
+ * arm.c (arm_identify_fpu_from_isa): New function.
+ (arm_declare_function_name): Use it to get the name for the FPU.
+
+2016-12-15 Richard Earnshaw <rearnsha@arm.com>
+
* arm-protos.h: Include sbitmap.h
(arm_configure_build_target): Make public.
* arm.c (arm_configure_build_target): Now not static.
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 437ee2d..df7a3ea 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -3256,7 +3256,7 @@ arm_configure_build_target (struct arm_build_target *target,
gcc_assert (arm_selected_cpu);
arm_selected_fpu = &all_fpus[opts->x_arm_fpu_index];
- auto_sbitmap fpu_bits(isa_num_bits);
+ auto_sbitmap fpu_bits (isa_num_bits);
arm_initialize_isa (fpu_bits, arm_selected_fpu->isa_bits);
bitmap_and_compl (target->isa, target->isa, isa_all_fpubits);
@@ -30433,6 +30433,26 @@ arm_valid_target_attribute_p (tree fndecl, tree ARG_UNUSED (name),
return ret;
}
+/* Match an ISA feature bitmap to a named FPU. We always use the
+ first entry that exactly matches the feature set, so that we
+ effectively canonicalize the FPU name for the assembler. */
+static const char*
+arm_identify_fpu_from_isa (sbitmap isa)
+{
+ auto_sbitmap fpubits (isa_num_bits);
+ auto_sbitmap cand_fpubits (isa_num_bits);
+
+ bitmap_and (fpubits, isa, isa_all_fpubits);
+ for (unsigned int i = 0; i < ARRAY_SIZE (all_fpus); i++)
+ {
+ arm_initialize_isa (cand_fpubits, all_fpus[i].isa_bits);
+ if (bitmap_equal_p (fpubits, cand_fpubits))
+ return all_fpus[i].name;
+ }
+ /* We must find an entry, or things have gone wrong. */
+ gcc_unreachable ();
+}
+
void
arm_declare_function_name (FILE *stream, const char *name, tree decl)
{
@@ -30454,7 +30474,9 @@ arm_declare_function_name (FILE *stream, const char *name, tree decl)
fprintf (stream, "\t.arm\n");
asm_fprintf (asm_out_file, "\t.fpu %s\n",
- TARGET_SOFT_FLOAT ? "softvfp" : TARGET_FPU_NAME);
+ (TARGET_SOFT_FLOAT
+ ? "softvfp"
+ : arm_identify_fpu_from_isa (arm_active_target.isa)));
if (TARGET_POKE_FUNCTION_NAME)
arm_poke_function_name (stream, (const char *) name);
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index 908e763..980bb74 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -369,7 +369,6 @@ extern const struct arm_fpu_desc
/* Accessors. */
-#define TARGET_FPU_NAME (all_fpus[arm_fpu_index].name)
#define TARGET_FPU_FEATURES (all_fpus[arm_fpu_index].features)
/* Which floating point hardware to schedule for. */