Commit 631c905a by Adam Nemet Committed by Richard Sandiford

mips.exp: Replace isa(_rev)=...!...

gcc/testsuite/
2009-08-18  Adam Nemet  <anemet@caviumnetworks.com>
	    Richard Sandiford  <rdsandiford@googlemail.com>

	* gcc.target/mips/mips.exp: Replace isa(_rev)=...!... mechanism
	with "forbid_cpu".
	* gcc.target/mips/branch-1.c: Update accordingly.
	* gcc.target/mips/extend-1.c: Likewise.
	* gcc.target/mips/dmult-1.c: Likewise.  Remove redundant isa=64.

Co-Authored-By: Richard Sandiford <rdsandiford@googlemail.com>

From-SVN: r151129
parent 6f5a62e9
2009-08-26 Adam Nemet <anemet@caviumnetworks.com>
Richard Sandiford <rdsandiford@googlemail.com>
* gcc.target/mips/mips.exp: Replace isa(_rev)=...!... mechanism
with "forbid_cpu".
* gcc.target/mips/branch-1.c: Update accordingly.
* gcc.target/mips/extend-1.c: Likewise.
* gcc.target/mips/dmult-1.c: Likewise. Remove redundant isa=64.
2009-08-26 Richard Guenther <rguenther@suse.de> 2009-08-26 Richard Guenther <rguenther@suse.de>
PR middle-end/41163 PR middle-end/41163
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
but we test for "bbit" elsewhere. On other targets, we should implement but we test for "bbit" elsewhere. On other targets, we should implement
the "if" statements using an "andi" instruction followed by a branch the "if" statements using an "andi" instruction followed by a branch
on zero. */ on zero. */
/* { dg-options "-O2 isa=!octeon" } */ /* { dg-options "-O2 forbid_cpu=octeon" } */
void bar (void); void bar (void);
NOMIPS16 void f1 (int x) { if (x & 4) bar (); } NOMIPS16 void f1 (int x) { if (x & 4) bar (); }
......
/* { dg-options "isa=64!octeon -mgp64" } */ /* { dg-options "forbid_cpu=octeon -mgp64" } */
/* { dg-final { scan-assembler "\tdmult\t" } } */ /* { dg-final { scan-assembler "\tdmult\t" } } */
/* { dg-final { scan-assembler "\tmflo\t" } } */ /* { dg-final { scan-assembler "\tmflo\t" } } */
/* { dg-final { scan-assembler-not "\tdmul\t" } } */ /* { dg-final { scan-assembler-not "\tdmul\t" } } */
......
/* { dg-options "-O -mgp64 isa=!octeon" } */ /* { dg-options "-O -mgp64 forbid_cpu=octeon" } */
/* { dg-final { scan-assembler-times "\tdsll\t" 5 } } */ /* { dg-final { scan-assembler-times "\tdsll\t" 5 } } */
/* { dg-final { scan-assembler-times "\tdsra\t" 5 } } */ /* { dg-final { scan-assembler-times "\tdsra\t" 5 } } */
/* { dg-final { scan-assembler-not "\tsll\t" } } */ /* { dg-final { scan-assembler-not "\tsll\t" } } */
......
...@@ -137,13 +137,6 @@ ...@@ -137,13 +137,6 @@
# For example, "isa_rev>=1" selects a MIPS32 or MIPS64 processor, # For example, "isa_rev>=1" selects a MIPS32 or MIPS64 processor,
# "isa=4" selects a MIPS IV processor, and so on. # "isa=4" selects a MIPS IV processor, and so on.
# #
# If certain processor-specific extensions are not applicable to the
# test you can list them as !CPU in the isa or isa_rev options. For
# example, isa=64!octeon enforces MIPS64 while avoiding octeon. You
# can also use ! without an ISA value. For example
# isa=!octeon!loongson2e disables octeon and loongson2e if otherwise
# you would compile for one of them.
#
# There are also the following special pseudo-options: # There are also the following special pseudo-options:
# #
# isa=loongson # isa=loongson
...@@ -152,6 +145,10 @@ ...@@ -152,6 +145,10 @@
# addressing=absolute # addressing=absolute
# force absolute addresses to be used # force absolute addresses to be used
# #
# forbid_cpu=REGEXP
# forbid processors that match the given regexp; choose a
# generic ISA instead.
#
# #
# In summary: # In summary:
# #
...@@ -183,7 +180,7 @@ ...@@ -183,7 +180,7 @@
# "-mips32r2" or "-mips64r2". # "-mips32r2" or "-mips64r2".
# #
# (6) If you need to disable processor-specific extensions use # (6) If you need to disable processor-specific extensions use
# isa=!CPU instead of forcing a generic ISA. # forbid_cpu=REGEXP instead of forcing a generic ISA.
# #
# #
# Terminology # Terminology
...@@ -232,6 +229,7 @@ set mips_option_groups { ...@@ -232,6 +229,7 @@ set mips_option_groups {
dump_pattern "-dp" dump_pattern "-dp"
endianness "-E(L|B)|-me(l|b)" endianness "-E(L|B)|-me(l|b)"
float "-m(hard|soft)-float" float "-m(hard|soft)-float"
forbid_cpu "forbid_cpu=.*"
fp "-mfp(32|64)" fp "-mfp(32|64)"
gp "-mgp(32|64)" gp "-mgp(32|64)"
long "-mlong(32|64)" long "-mlong(32|64)"
...@@ -856,60 +854,47 @@ proc mips-dg-options { args } { ...@@ -856,60 +854,47 @@ proc mips-dg-options { args } {
} }
} }
# See whether forbid_cpu forces us to choose a new architecture.
set arch [mips_option mips_base_options arch]
set force_generic_isa_p [expr {
[regexp "forbid_cpu=(.*)" [mips_option options forbid_cpu] dummy spec]
&& [regexp -- "^-march=$spec\$" $arch]
}]
# Interpret the special "isa" and "isa_rev" options. If we have # Interpret the special "isa" and "isa_rev" options. If we have
# a choice of a 32-bit or a 64-bit architecture, prefer to keep # a choice of a 32-bit or a 64-bit architecture, prefer to keep
# the -mgp setting the same. # the -mgp setting the same.
set spec [mips_option options arch] set spec [mips_option options arch]
if { [regexp {^[^-]} $spec] } { if { [regexp {^[^-]} $spec] } {
set arch [mips_option mips_base_options arch]
if { [string equal $spec "isa=loongson"] } { if { [string equal $spec "isa=loongson"] } {
if { ![regexp {^-march=loongson} $arch] } { if { ![regexp {^-march=loongson} $arch] } {
set arch "-march=loongson2f" set arch "-march=loongson2f"
} }
} else { } else {
# With ! and = the ISA value is optional. if { ![regexp {^(isa(?:|_rev))(=|<=|>=)([0-9]*)$} \
if { ![regexp {^(isa(?:|_rev))(=|<=|>=)([0-9]*)((?:![^!]+)*)$} \ $spec dummy prop relation value nocpus] } {
$spec dummy prop relation value nocpus]
|| ($value eq ""
&& ($relation ne "="
|| $nocpus eq ""))} {
error "Unrecognized isa specification: $spec" error "Unrecognized isa specification: $spec"
} }
if { $value ne "" } { set current [mips_arch_info $arch $prop]
set current [mips_arch_info $arch $prop] if { $force_generic_isa_p
if { ($current < $value && ![string equal $relation "<="]) || ($current < $value && ![string equal $relation "<="])
|| ($current > $value && ![string equal $relation ">="]) || ($current > $value && ![string equal $relation ">="])
|| ([mips_have_test_option_p options "-mgp64"] || ([mips_have_test_option_p options "-mgp64"]
&& [mips_32bit_arch_p $arch]) } { && [mips_32bit_arch_p $arch]) } {
# The current setting is out of range; it cannot # The current setting is out of range; it cannot
# possibly be used. Find a replacement that can. # possibly be used. Find a replacement that can.
if { [string equal $prop "isa"] } { if { [string equal $prop "isa"] } {
set arch "-mips$value" set arch "-mips$value"
} elseif { $value == 0 } { } elseif { $value == 0 } {
set arch "-mips4" set arch "-mips4"
} else {
if { [mips_have_option_p options "-mgp32"] } {
set arch "-mips32"
} else { } else {
if { [mips_have_option_p options "-mgp32"] } { set arch "-mips64"
set arch "-mips32"
} else {
set arch "-mips64"
}
if { $value > 1 } {
append arch "r$value"
}
} }
} if { $value > 1 } {
} append arch "r$value"
# If we haven't switched to a generic ISA based on the
# isa* value, do it here if the processor-specific
# extension is not allowed.
if { $nocpus ne ""
&& $arch eq [mips_option mips_base_options arch] } {
set cpu [regsub -- {-march=} $arch ""]
if { [regexp "!$cpu!" "$nocpus!"] } {
set isa_rev [mips_arch_info $arch isa_rev]
set arch "-mips[mips_arch_info $arch isa]"
if { $isa_rev > 1 } {
append arch "r$isa_rev"
} }
} }
} }
...@@ -994,6 +979,14 @@ proc mips-dg-options { args } { ...@@ -994,6 +979,14 @@ proc mips-dg-options { args } {
} else { } else {
mips_make_test_option options "-mips64r$isa_rev" mips_make_test_option options "-mips64r$isa_rev"
} }
# Otherwise, if the current choice of architecture is unacceptable,
# choose the equivalent generic architecture.
} elseif { $force_generic_isa_p } {
set arch "-mips[mips_arch_info $arch isa]"
if { $isa_rev > 1 } {
append arch "r$isa_rev"
}
mips_make_test_option options $arch
} }
unset arch unset arch
unset isa unset isa
...@@ -1140,6 +1133,7 @@ proc mips-dg-options { args } { ...@@ -1140,6 +1133,7 @@ proc mips-dg-options { args } {
# Add all options to the dg variable. # Add all options to the dg variable.
set options(explicit_p,addressing) 0 set options(explicit_p,addressing) 0
set options(explicit_p,forbid_cpu) 0
foreach { group regexp } $mips_option_groups { foreach { group regexp } $mips_option_groups {
if { $options(explicit_p,$group) } { if { $options(explicit_p,$group) } {
append extra_tool_flags " " $options(option,$group) append extra_tool_flags " " $options(option,$group)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment