public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/29042]  New: Useless floating-point stores and loads on x86
@ 2006-09-12 20:28 guillaume dot melquiond at ens-lyon dot fr
  2006-10-30  2:17 ` [Bug target/29042] [4.0/4.1/4.2/4.3 Regression] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: guillaume dot melquiond at ens-lyon dot fr @ 2006-09-12 20:28 UTC (permalink / raw)
  To: gcc-bugs

This is the same testcase as PR26778. This bug is marked as resolved, and the
patch indeed prevents GCC from using useless mmx registers. Concerning integer
operations, the generated assembly got even better than GCC 3.4, as the values
are directly incremented in memory instead of being loaded and stored; no
callee-save register is used anymore. Unfortunately, there is still a
regression with respect to the floating-point stack.

Testcase compiled with -march=pentium3 -O3:

typedef union {
  long long l;
  double d;
} db_number;

double test(double x[3]) {
  double th = x[1] + x[2];
  if (x[2] != th - x[1]) {
    db_number thdb;
    thdb.d = th;
    thdb.l++;
    th = thdb.d;
  }
  return x[0] + th;
}

It may be clearer with a unified diff between the assembly code generated by
3.4.6 and the one by 4.2.0 (svn 2006-09-12). Note: the assembly code for 3.4
was edited by hand in order to reduce the noise due to mismatching integer
registers.

        pushl   %ebp
        movl    %esp, %ebp
        subl    $16, %esp
        movl    8(%ebp), %eax
        fldl    8(%eax)
        fldl    16(%eax)
        fld     %st(1)
        fadd    %st(1), %st
+       fstl    -8(%ebp)
        fsub    %st, %st(2)
        fxch    %st(1)
        fucomip %st(2), %st
        fstp    %st(1)
        jp      .L7
-       je      .L2
+       je      .L9
 .L7:
        fstpl   -16(%ebp)
        addl    $1, -16(%ebp)
        adcl    $0, -12(%ebp)
        fldl    -16(%ebp)
+       fstpl   -8(%ebp)
+       jmp     .L2
+       .p2align 4,,7
+.L9:
+       fstp    %st(0)
+       .p2align 4,,15
 .L2:
+       fldl    -8(%ebp)
        faddl   (%eax)
        leave
        ret

The 3.4 code never stores the value of th; it is kept at the top of the
floating-point stack. In my opinion, this is optimal. This is no longer the
case with 4.2 code. The value of "th" is stored in -8(%ebp). Then, on one
branch (L7), it is overwritten with the content of -16(%ebp). And on the other
branch (L9), the value is discarded from the top of the stack and then
immediatly (L2) reloaded from memory. Each line prefixed by + is useless: if
none is present, the code will still behave correctly and it will contain five
assembly instructions less.


-- 
           Summary: Useless floating-point stores and loads on x86
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: guillaume dot melquiond at ens-lyon dot fr


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


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

* [Bug target/29042] [4.0/4.1/4.2/4.3 Regression] Useless floating-point stores and loads on x86
  2006-09-12 20:28 [Bug target/29042] New: Useless floating-point stores and loads on x86 guillaume dot melquiond at ens-lyon dot fr
@ 2006-10-30  2:17 ` pinskia at gcc dot gnu dot org
  2006-11-01 18:23 ` mmitchel at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-10-30  2:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-10-30 02:17 -------
Confirmed, this regression was caused by the removal of ADDRESSOF.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-10-30 02:17:03
               date|                            |
            Summary|Useless floating-point      |[4.0/4.1/4.2/4.3 Regression]
                   |stores and loads on x86     |Useless floating-point
                   |                            |stores and loads on x86
   Target Milestone|---                         |4.0.4


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


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

* [Bug target/29042] [4.0/4.1/4.2/4.3 Regression] Useless floating-point stores and loads on x86
  2006-09-12 20:28 [Bug target/29042] New: Useless floating-point stores and loads on x86 guillaume dot melquiond at ens-lyon dot fr
  2006-10-30  2:17 ` [Bug target/29042] [4.0/4.1/4.2/4.3 Regression] " pinskia at gcc dot gnu dot org
@ 2006-11-01 18:23 ` mmitchel at gcc dot gnu dot org
  2007-02-03 20:05 ` gdr at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-11-01 18:23 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug target/29042] [4.0/4.1/4.2/4.3 Regression] Useless floating-point stores and loads on x86
  2006-09-12 20:28 [Bug target/29042] New: Useless floating-point stores and loads on x86 guillaume dot melquiond at ens-lyon dot fr
  2006-10-30  2:17 ` [Bug target/29042] [4.0/4.1/4.2/4.3 Regression] " pinskia at gcc dot gnu dot org
  2006-11-01 18:23 ` mmitchel at gcc dot gnu dot org
@ 2007-02-03 20:05 ` gdr at gcc dot gnu dot org
  2007-02-03 21:01 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: gdr at gcc dot gnu dot org @ 2007-02-03 20:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from gdr at gcc dot gnu dot org  2007-02-03 20:05 -------
Won't fix in GCC-4.0.x.  Adjusting milestone.


-- 

gdr at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.4                       |4.1.3


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


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

* [Bug target/29042] [4.0/4.1/4.2/4.3 Regression] Useless floating-point stores and loads on x86
  2006-09-12 20:28 [Bug target/29042] New: Useless floating-point stores and loads on x86 guillaume dot melquiond at ens-lyon dot fr
                   ` (2 preceding siblings ...)
  2007-02-03 20:05 ` gdr at gcc dot gnu dot org
@ 2007-02-03 21:01 ` pinskia at gcc dot gnu dot org
  2007-02-14  9:20 ` mmitchel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-03 21:01 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.1.3                       |4.1.2


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


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

* [Bug target/29042] [4.0/4.1/4.2/4.3 Regression] Useless floating-point stores and loads on x86
  2006-09-12 20:28 [Bug target/29042] New: Useless floating-point stores and loads on x86 guillaume dot melquiond at ens-lyon dot fr
                   ` (3 preceding siblings ...)
  2007-02-03 21:01 ` pinskia at gcc dot gnu dot org
@ 2007-02-14  9:20 ` mmitchel at gcc dot gnu dot org
  2007-06-18  5:29 ` [Bug target/29042] [4.0/4.1/4.2 " pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-02-14  9:20 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.1.2                       |4.1.3


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


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

* [Bug target/29042] [4.0/4.1/4.2 Regression] Useless floating-point stores and loads on x86
  2006-09-12 20:28 [Bug target/29042] New: Useless floating-point stores and loads on x86 guillaume dot melquiond at ens-lyon dot fr
                   ` (4 preceding siblings ...)
  2007-02-14  9:20 ` mmitchel at gcc dot gnu dot org
@ 2007-06-18  5:29 ` pinskia at gcc dot gnu dot org
  2008-07-04 21:31 ` [Bug target/29042] [4.2 " jsm28 at gcc dot gnu dot org
  2009-03-30 19:37 ` jsm28 at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-06-18  5:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2007-06-18 05:29 -------
This has now been fixed on the trunk.  I think by the dataflow branch merge.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.3.0
            Summary|[4.0/4.1/4.2/4.3 Regression]|[4.0/4.1/4.2 Regression]
                   |Useless floating-point      |Useless floating-point
                   |stores and loads on x86     |stores and loads on x86


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


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

* [Bug target/29042] [4.2 Regression] Useless floating-point stores and loads on x86
  2006-09-12 20:28 [Bug target/29042] New: Useless floating-point stores and loads on x86 guillaume dot melquiond at ens-lyon dot fr
                   ` (5 preceding siblings ...)
  2007-06-18  5:29 ` [Bug target/29042] [4.0/4.1/4.2 " pinskia at gcc dot gnu dot org
@ 2008-07-04 21:31 ` jsm28 at gcc dot gnu dot org
  2009-03-30 19:37 ` jsm28 at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 21:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jsm28 at gcc dot gnu dot org  2008-07-04 21:31 -------
Closing 4.1 branch.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.1/4.2 Regression] Useless|[4.2 Regression] Useless
                   |floating-point stores and   |floating-point stores and
                   |loads on x86                |loads on x86
   Target Milestone|4.1.3                       |4.2.5


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


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

* [Bug target/29042] [4.2 Regression] Useless floating-point stores and loads on x86
  2006-09-12 20:28 [Bug target/29042] New: Useless floating-point stores and loads on x86 guillaume dot melquiond at ens-lyon dot fr
                   ` (6 preceding siblings ...)
  2008-07-04 21:31 ` [Bug target/29042] [4.2 " jsm28 at gcc dot gnu dot org
@ 2009-03-30 19:37 ` jsm28 at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-30 19:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jsm28 at gcc dot gnu dot org  2009-03-30 19:37 -------
Closing 4.2 branch, fixed in 4.3.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to fail|4.0.4                       |4.0.4 4.2.5
         Resolution|                            |FIXED
   Target Milestone|4.2.5                       |4.3.0


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


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

end of thread, other threads:[~2009-03-30 19:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-12 20:28 [Bug target/29042] New: Useless floating-point stores and loads on x86 guillaume dot melquiond at ens-lyon dot fr
2006-10-30  2:17 ` [Bug target/29042] [4.0/4.1/4.2/4.3 Regression] " pinskia at gcc dot gnu dot org
2006-11-01 18:23 ` mmitchel at gcc dot gnu dot org
2007-02-03 20:05 ` gdr at gcc dot gnu dot org
2007-02-03 21:01 ` pinskia at gcc dot gnu dot org
2007-02-14  9:20 ` mmitchel at gcc dot gnu dot org
2007-06-18  5:29 ` [Bug target/29042] [4.0/4.1/4.2 " pinskia at gcc dot gnu dot org
2008-07-04 21:31 ` [Bug target/29042] [4.2 " jsm28 at gcc dot gnu dot org
2009-03-30 19:37 ` jsm28 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).