From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23676 invoked by alias); 30 Aug 2012 22:26:55 -0000 Received: (qmail 23667 invoked by uid 22791); 30 Aug 2012 22:26:54 -0000 X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 30 Aug 2012 22:26:41 +0000 From: "olegendo at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: olegendo at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: olegendo at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-08/txt/msg02021.txt.bz2 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?