public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/16815] New: MIPS n32/n64 inefficient code for float arguments
@ 2004-07-29  2:05 wilson at gcc dot gnu dot org
  2004-07-29  2:08 ` [Bug middle-end/16815] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: wilson at gcc dot gnu dot org @ 2004-07-29  2:05 UTC (permalink / raw)
  To: gcc-bugs

If you compile code using a float argument, and compile with optimization for
the n32 or n64 ABIs, then gcc-3.4 and later will emit code that stores the float
arg onto the stack, and then  loads it back into a register.

A trivial example
float
sub (float f, float g)
{
  return f + g;
}
gives
        swc1    $f12,0($sp)
        swc1    $f13,16($sp)
        lwc1    $f1,16($sp)
        lwc1    $f0,0($sp)
        add.s   $f0,$f0,$f1

The problem here is related to the definition of the BLOCK_REG_PADDING macro in
the mips port.  A float arg has natural alignment in a register, but when
big-endian, it has the "wrong" alignment in a stack slot.  In this case,
FUNCTION_ARG_PADDING and BLOCK_REG_PADDING return different values.  There is
code in function.c in assign_parms_setup_block_p that forces values onto the
stack if they have the wrong padding, but there are a number of things wrong
here.  It is testing locate->where_pad, but this is from FUNCTION_ARG_PADDING,
not BLOCK_REG_PADDING.  If the argument was passed in a reg, then
FUNCTION_ARG_PADDING should be irrelevant here.  It should be testing
BLOCK_REG_PADDING instead, and possibly only if the arg was passed in a
register.  Also, there is the issue of why we are storing it to the stack,
instead of just shifting it into position as is done in calls.c.  I am unsure
what the purpose of this code is, so I am unsure what exact fix is needed here.
 I haven't tried to fully analyze the code yet.

I am mainly filing this to document the problem, so I won't forget it.  I
noticed it while doing other work.

I don't care whether this gets fixed in gcc-3.4.

-- 
           Summary: MIPS n32/n64 inefficient code for float arguments
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wilson at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: mips64-linux


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


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

* [Bug middle-end/16815] MIPS n32/n64 inefficient code for float arguments
  2004-07-29  2:05 [Bug middle-end/16815] New: MIPS n32/n64 inefficient code for float arguments wilson at gcc dot gnu dot org
@ 2004-07-29  2:08 ` pinskia at gcc dot gnu dot org
  2004-07-29  2:10 ` wilson at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-29  2:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-29 02:08 -------
Isn't this the same as PR 15043.

-- 


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


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

* [Bug middle-end/16815] MIPS n32/n64 inefficient code for float arguments
  2004-07-29  2:05 [Bug middle-end/16815] New: MIPS n32/n64 inefficient code for float arguments wilson at gcc dot gnu dot org
  2004-07-29  2:08 ` [Bug middle-end/16815] " pinskia at gcc dot gnu dot org
@ 2004-07-29  2:10 ` wilson at gcc dot gnu dot org
  2004-07-29  2:25 ` wilson at tuliptree dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: wilson at gcc dot gnu dot org @ 2004-07-29  2:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From wilson at gcc dot gnu dot org  2004-07-29 02:10 -------
Created an attachment (id=6852)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6852&action=view)
experimental assign_parm_setup_block_p patch

This is a patch which gives the right result for the trivial testcase, but may
be completely bogus.  I haven't tried to test this, or determine whether this
also works for PA and rs6000 targets which would also be affected by this
change, or determine why the code is there in the first place.

-- 


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


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

* [Bug middle-end/16815] MIPS n32/n64 inefficient code for float arguments
  2004-07-29  2:05 [Bug middle-end/16815] New: MIPS n32/n64 inefficient code for float arguments wilson at gcc dot gnu dot org
  2004-07-29  2:08 ` [Bug middle-end/16815] " pinskia at gcc dot gnu dot org
  2004-07-29  2:10 ` wilson at gcc dot gnu dot org
@ 2004-07-29  2:25 ` wilson at tuliptree dot org
  2004-07-29  4:26 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: wilson at tuliptree dot org @ 2004-07-29  2:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From wilson at tuliptree dot org  2004-07-29 02:25 -------
Subject: Re:  MIPS n32/n64 inefficient code for float
	arguments

On Wed, 2004-07-28 at 19:08, pinskia at gcc dot gnu dot org wrote:
> ------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-29 02:08 -------
> Isn't this the same as PR 15043.

Yes, it is.  I didn't manage to find this when looking for related bug
reports, partly because I didn't understand how bugzilla searching
works, and partly because none of the keywords I searched for are
mentioned in the summary of that bug report.


-- 


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


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

* [Bug middle-end/16815] MIPS n32/n64 inefficient code for float arguments
  2004-07-29  2:05 [Bug middle-end/16815] New: MIPS n32/n64 inefficient code for float arguments wilson at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-07-29  2:25 ` wilson at tuliptree dot org
@ 2004-07-29  4:26 ` pinskia at gcc dot gnu dot org
  2004-09-30 11:19 ` giovannibajo at libero dot it
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-29  4:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-29 04:26 -------
*** Bug 15043 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nigel at mips dot com


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


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

* [Bug middle-end/16815] MIPS n32/n64 inefficient code for float arguments
  2004-07-29  2:05 [Bug middle-end/16815] New: MIPS n32/n64 inefficient code for float arguments wilson at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-07-29  4:26 ` pinskia at gcc dot gnu dot org
@ 2004-09-30 11:19 ` giovannibajo at libero dot it
  2004-10-07  5:34 ` cvs-commit at gcc dot gnu dot org
  2004-10-07  5:37 ` rsandifo at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: giovannibajo at libero dot it @ 2004-09-30 11:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-09-30 11:19 -------
Patch here:
http://gcc.gnu.org/ml/gcc-patches/2004-09/msg01735.html

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rsandifo at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
           Keywords|                            |patch


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


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

* [Bug middle-end/16815] MIPS n32/n64 inefficient code for float arguments
  2004-07-29  2:05 [Bug middle-end/16815] New: MIPS n32/n64 inefficient code for float arguments wilson at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-09-30 11:19 ` giovannibajo at libero dot it
@ 2004-10-07  5:34 ` cvs-commit at gcc dot gnu dot org
  2004-10-07  5:37 ` rsandifo at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-10-07  5:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-10-07 05:34 -------
Subject: Bug 16815

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rsandifo@gcc.gnu.org	2004-10-07 05:34:31

Modified files:
	gcc            : ChangeLog function.c 
	gcc/config/pa  : pa.h 

Log message:
	PR target/16815
	* function.c (assign_parm_setup_block_p): Tighten BLOCK_REG_PADDING
	check.
	* config/pa/pa.h (BLOCK_REG_PADDING): Define in terms of
	function_arg_padding.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.5775&r2=2.5776
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/function.c.diff?cvsroot=gcc&r1=1.579&r2=1.580
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/pa/pa.h.diff?cvsroot=gcc&r1=1.235&r2=1.236



-- 


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


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

* [Bug middle-end/16815] MIPS n32/n64 inefficient code for float arguments
  2004-07-29  2:05 [Bug middle-end/16815] New: MIPS n32/n64 inefficient code for float arguments wilson at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2004-10-07  5:34 ` cvs-commit at gcc dot gnu dot org
@ 2004-10-07  5:37 ` rsandifo at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: rsandifo at gcc dot gnu dot org @ 2004-10-07  5:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rsandifo at gcc dot gnu dot org  2004-10-07 05:37 -------
Fixed in mainline.  The change isn't suitable for a release branch.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.0.0


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


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

end of thread, other threads:[~2004-10-07  5:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-29  2:05 [Bug middle-end/16815] New: MIPS n32/n64 inefficient code for float arguments wilson at gcc dot gnu dot org
2004-07-29  2:08 ` [Bug middle-end/16815] " pinskia at gcc dot gnu dot org
2004-07-29  2:10 ` wilson at gcc dot gnu dot org
2004-07-29  2:25 ` wilson at tuliptree dot org
2004-07-29  4:26 ` pinskia at gcc dot gnu dot org
2004-09-30 11:19 ` giovannibajo at libero dot it
2004-10-07  5:34 ` cvs-commit at gcc dot gnu dot org
2004-10-07  5:37 ` rsandifo at gcc dot gnu dot 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).