This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[RFA:] grep rtl-expand for "(call" for hard_float (was: Re: [committed] Skip floating-point var-expand...)
- From: Hans-Peter Nilsson <hp at bitrange dot com>
- To: Janis Johnson <janis187 at us dot ibm dot com>
- Cc: Bob Wilson <bwilson at tensilica dot com>, gcc-patches at gcc dot gnu dot org, rsandifo at nildram dot co dot uk
- Date: Mon, 4 Feb 2008 00:04:43 -0500 (EST)
- Subject: [RFA:] grep rtl-expand for "(call" for hard_float (was: Re: [committed] Skip floating-point var-expand...)
- References: <87pry4bofg.fsf@firetop.home> <474B5C48.3000706@tensilica.com> <20071127192058.I52506@dair.pair.com> <3D55A9D7-6CA2-4762-91AC-D5D2482F8D0C@tensilica.com> <1196297108.6403.6.camel@janis-laptop>
On Wed, 28 Nov 2007, Janis Johnson wrote:
> The patch is OK. If H-P feels strongly enough about his approach
> then he is welcome to submit a patch to replace the guts of
> check_e*f*hard_float.
Finally. I'm not replacing it, just augmenting with a better
default-value than hard_float=1 for all but mips* and xtensa-*.
One reason to keep the old method as an override was that from
reading the port, it seems xtensa doesn't have "hardware"
doubles (only floats), so there may be actual need for an
override. Or may not; I'm not sure it should validly be called
hard_float. Or in retrospect maybe we should just really check
the type float here and have a separate hard_double.
Works for cris-elf (marks hard_float as UNSUPPORTED, being a
software floating-point target) and mmix-knuth-mmixware (runs
the tests, which then fail, but that's a different story - the
target has "hardware floating point" instructions).
There was a nice function for grepping assembly code from the
effective_target machinery where a core part just needed a bit
of adjustment to generate rtl dumps as output. Hopefully useful
in future effective_target add-ons. Could with trivial changes
also be used to test tree dumps, if that'd ever be useful for
effective_target(!) Anyway, this is what I had in mind.
(IIUC, test-suite improvements will logically be ok despite the
general regression-only state; if nothing else then because of
the rule that back-porting such from head to branches being ok.)
Ok to commit?
gcc/testsuite:
* lib/target-supports.exp (check_effective_target_hard_float): Only
use the macro definition tests for mips*-*-* and xtensa-*-*. For all
other targets, grep for a call insn in the rtl expand dump for an
add of two doubles.
(target_compile): Support generating rtl dumps as output.
Index: lib/target-supports.exp
===================================================================
--- lib/target-supports.exp (revision 132071)
+++ lib/target-supports.exp (working copy)
@@ -44,18 +44,32 @@
"*// C++*" { set src ${basename}[pid].cc }
default { set src ${basename}[pid].c }
}
- switch $type {
+ set compile_type $type
+ switch -glob $type {
assembly { set output ${basename}[pid].s }
object { set output ${basename}[pid].o }
executable { set output ${basename}[pid].exe }
+ "rtl-*" {
+ set output ${basename}[pid].s
+ lappend options "additional_flags=-fdump-$type"
+ set compile_type assembly
+ }
}
set f [open $src "w"]
puts $f $contents
close $f
- set lines [${tool}_target_compile $src $output $type "$options"]
+ set lines [${tool}_target_compile $src $output $compile_type "$options"]
file delete $src
- return [list $lines $output]
+ set scan_output $output
+ # Don't try folding this into the switch above; calling "glob" before the
+ # file is created won't work.
+ if [regexp "rtl-(.*)" $type dummy rtl_type] {
+ set scan_output "[glob $src.\[0-9\]\[0-9\]\[0-9\]r.$rtl_type]"
+ file delete $output
+ }
+
+ return [list $lines $scan_output]
}
proc current_target_name { } {
@@ -565,12 +579,19 @@
# Return true if the target has access to FPU instructions.
proc check_effective_target_hard_float { } {
- return [check_no_compiler_messages hard_float assembly {
- #if ((defined __mips \
- && (defined __mips_soft_float || defined __mips16)) \
- || (defined __xtensa__ && defined __XTENSA_SOFT_FLOAT__))
- #error FOO
- #endif
+ if { [istarget mips*-*-*] || [istarget xtensa-*-*] } {
+ return [check_no_compiler_messages hard_float assembly {
+ #if ((defined __mips \
+ && (defined __mips_soft_float || defined __mips16)) \
+ || (defined __xtensa__ && defined __XTENSA_SOFT_FLOAT__))
+ #error FOO
+ #endif
+ }]
+ }
+
+ # The generic test equates hard_float with "no call for adding doubles".
+ return [check_no_messages_and_pattern hard_float "!\\(call" rtl-expand {
+ double a (double b, double c) { return b + c; }
}]
}
brgds, H-P