public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/55298] New: [SH] Add support to disable FPU usage for individual functions
@ 2012-11-12 23:21 olegendo at gcc dot gnu.org
  2014-12-10  0:51 ` [Bug target/55298] " olegendo at gcc dot gnu.org
  2015-09-19 11:05 ` olegendo at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: olegendo at gcc dot gnu.org @ 2012-11-12 23:21 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55298

             Bug #: 55298
           Summary: [SH] Add support to disable FPU usage for individual
                    functions
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: olegendo@gcc.gnu.org
            Target: sh*-*-*


On SH3* and SH4* targets, 'fast interrupt handlers' (non-reentrant ISRs) can be
implemented by specifying the 'interrupt_handler' and 'nosave_low_regs'
function attributes.  If such an ISR invokes another function the compiler
currently generates push/pop insns for all call clobbered FP registers.  This
could be avoided by specifying another function attribute ('nofpu') to turn off
hardware FPU usage for a particular function.  A 'nofpu' ISR that invokes only
'nofpu' functions then does not need to push/pop any FP registers.

Some ABI compatibility issues I can think of at the moment are:

When a 'nofpu' function invokes a normal function (that could use the FPU or
takes any args in FP regs) the best thing is probably to issue a compile time
error.

When a normal function invokes a 'nofpu' function that does not take any FP
args (in registers) there is no problem.

When a normal function invokes a 'nofpu' function that takes FP args in GP regs
the call must use the 'nofpu' ABI.
Alternatively, the compiler could generate two versions of 'nofpu' functions. 
One version that follows the 'nofpu' ABI and a normal version.  Normal
functions that invoke 'nofpu' functions could then switch to a call to the
normal variant of the 'nofpu' function.  The duplicated code would then be
eliminated by the linker.


Note: Currently the only way to disable HW FPU usage is to specify e.g.
'-m4-nofpu', which only works for whole translation units.  Also, due to the
ABI differences invoking functions in translation units that were compiled with
'-m4-nofpu' from translation units compiled with '-m4' is not going to work.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/55298] [SH] Add support to disable FPU usage for individual functions
  2012-11-12 23:21 [Bug target/55298] New: [SH] Add support to disable FPU usage for individual functions olegendo at gcc dot gnu.org
@ 2014-12-10  0:51 ` olegendo at gcc dot gnu.org
  2015-09-19 11:05 ` olegendo at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: olegendo at gcc dot gnu.org @ 2014-12-10  0:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55298

--- Comment #1 from Oleg Endo <olegendo at gcc dot gnu.org> ---
Alternatively, split the options such as -m4-single, -m4-nofpu into e.g. -mcpu
and -mfpu and implement the 'target' function attribute.  This would also allow
controlling other target specific options on a per-function basis.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/55298] [SH] Add support to disable FPU usage for individual functions
  2012-11-12 23:21 [Bug target/55298] New: [SH] Add support to disable FPU usage for individual functions olegendo at gcc dot gnu.org
  2014-12-10  0:51 ` [Bug target/55298] " olegendo at gcc dot gnu.org
@ 2015-09-19 11:05 ` olegendo at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: olegendo at gcc dot gnu.org @ 2015-09-19 11:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55298

--- Comment #2 from Oleg Endo <olegendo at gcc dot gnu.org> ---
Something similar has been done for ARM:
https://gcc.gnu.org/ml/gcc-patches/2015-09/msg00939.html


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-19 11:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-12 23:21 [Bug target/55298] New: [SH] Add support to disable FPU usage for individual functions olegendo at gcc dot gnu.org
2014-12-10  0:51 ` [Bug target/55298] " olegendo at gcc dot gnu.org
2015-09-19 11:05 ` olegendo at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).