public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "olegendo at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/54429] New: [SH] SImode values get ferried through FPUL and FP regs for -O0
Date: Thu, 30 Aug 2012 22:26:00 -0000	[thread overview]
Message-ID: <bug-54429-4@http.gcc.gnu.org/bugzilla/> (raw)

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

             Bug #: 54429
           Summary: [SH] SImode values get ferried through FPUL and FP
                    regs for -O0
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: target
        AssignedTo: olegendo@gcc.gnu.org
        ReportedBy: olegendo@gcc.gnu.org
                CC: kkojima@gcc.gnu.org
            Target: sh*-*-*


I've noticed that, for some reason, when compiling code with -O0 SImode values
get ferried through FPUL reg and FP regs, like .. 

        lds     r1,fpul
        fsts    fpul,fr1
        mov     r7,r4
        flds    fr1,fpul
        sts     fpul,r5

.. which is really just:
        mov     r1,r5
        mov     r7,r4

In sh_hard_regno_mode_ok, I've tried doing:

Index: gcc/config/sh/sh.c
===================================================================
--- gcc/config/sh/sh.c    (revision 190780)
+++ gcc/config/sh/sh.c    (working copy)
@@ -11706,6 +11706,9 @@
   if (FP_REGISTER_P (regno) && mode == SFmode)
     return true;

+  if (FP_REGISTER_P (regno) && GET_MODE_CLASS (mode) != MODE_FLOAT)
+    return false;
+
   if (mode == V2SFmode)
     {
       if (((FP_REGISTER_P (regno) && (regno - FIRST_FP_REG) % 2 == 0)

.. and it makes the confusing FP reg usage go away.  Somehow, I don't
understand why it would make sense to allow any integer modes in FP regs on SH.
 No useful integer operations can be done with integer values in FP regs
anyway.  The only purpose that I see, is to allow spilling of GP regs to FP
regs, which doesn't seem beneficial.

I've checked CSiBE results with the fix above.  It causes a few increases and
decreases in the teem lib.  The increases are, because GP regs are not spilled
to FP regs anymore and have to go to the stack, which causes some unlucky
displacement address changes.  The decreases are because of the same, but where
displacement addresses are lucky.  Also, weird cases disappear where FP regs
are pushed/popped in a function but are otherwise unused.

Kaz, do you happen to know why the sh_hard_regno_mode_ok function is the way it
is?  I think The FP reg check after the V16SFmode check ...

if (FP_REGISTER_P (regno))
    {
      if (mode == SFmode
      || mode == SImode
     ....

would also become obsolete if the change above was applied?


             reply	other threads:[~2012-08-30 22:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-30 22:26 olegendo at gcc dot gnu.org [this message]
2012-08-31 10:59 ` [Bug target/54429] " kkojima at gcc dot gnu.org
2012-08-31 11:54 ` olegendo at gcc dot gnu.org
2012-11-13  8:45 ` olegendo at gcc dot gnu.org
2012-11-13 22:25 ` olegendo at gcc dot gnu.org
2012-11-14  9:45 ` olegendo at gcc dot gnu.org
2014-10-12 17:28 ` olegendo at gcc dot gnu.org
2014-12-27 11:41 ` olegendo at gcc dot gnu.org
2014-12-27 13:56 ` olegendo at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-54429-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).