From ac48cd5e89b1e50b1612c9473cf1f4a59b46ed0a Mon Sep 17 00:00:00 2001 From: Tamar Christina Date: Fri, 21 Jul 2017 06:46:05 +0000 Subject: [PATCH] arm.c (arm_test_cpu_arch_dat): Check for overlap. 2017-07-21 Tamar Christina * config/arm/arm.c (arm_test_cpu_arch_dat): Check for overlap. From-SVN: r250415 --- gcc/ChangeLog | 5 +++++ gcc/config/arm/arm.c | 21 ++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 713788c77c6..2e29894a920 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-07-21 Tamar Christina + + * config/arm/arm.c (arm_test_cpu_arch_dat): + Check for overlap. + 2017-07-20 Nathan Sidwell Remove TYPE_METHODS. diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 139ab701a95..c3feb4983c7 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -31222,12 +31222,15 @@ namespace selftest { inconsistencies in the option extensions at present (extensions that duplicate others but aren't marked as aliases). Furthermore, for correct canonicalization later options must never be a subset - of an earlier option. */ + of an earlier option. Any extension should also only specify other + feature bits and never an architecture bit. The architecture is inferred + from the declaration of the extension. */ static void arm_test_cpu_arch_data (void) { const arch_option *arch; const cpu_option *cpu; + auto_sbitmap target_isa (isa_num_bits); auto_sbitmap isa1 (isa_num_bits); auto_sbitmap isa2 (isa_num_bits); @@ -31238,6 +31241,8 @@ arm_test_cpu_arch_data (void) if (arch->common.extensions == NULL) continue; + arm_initialize_isa (target_isa, arch->common.isa_bits); + for (ext1 = arch->common.extensions; ext1->name != NULL; ++ext1) { if (ext1->alias) @@ -31250,7 +31255,13 @@ arm_test_cpu_arch_data (void) continue; arm_initialize_isa (isa2, ext2->isa_bits); + /* If the option is a subset of the parent option, it doesn't + add anything and so isn't useful. */ ASSERT_TRUE (!bitmap_subset_p (isa2, isa1)); + + /* If the extension specifies any architectural bits then + disallow it. Extensions should only specify feature bits. */ + ASSERT_TRUE (!bitmap_intersect_p (isa2, target_isa)); } } } @@ -31262,6 +31273,8 @@ arm_test_cpu_arch_data (void) if (cpu->common.extensions == NULL) continue; + arm_initialize_isa (target_isa, arch->common.isa_bits); + for (ext1 = cpu->common.extensions; ext1->name != NULL; ++ext1) { if (ext1->alias) @@ -31274,7 +31287,13 @@ arm_test_cpu_arch_data (void) continue; arm_initialize_isa (isa2, ext2->isa_bits); + /* If the option is a subset of the parent option, it doesn't + add anything and so isn't useful. */ ASSERT_TRUE (!bitmap_subset_p (isa2, isa1)); + + /* If the extension specifies any architectural bits then + disallow it. Extensions should only specify feature bits. */ + ASSERT_TRUE (!bitmap_intersect_p (isa2, target_isa)); } } } -- 2.30.2