public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/25724]  New: Emits call to __cmpdi2 for long long comparison
@ 2006-01-09 14:31 rguenth at gcc dot gnu dot org
  2006-01-09 14:33 ` [Bug middle-end/25724] " pinskia at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-01-09 14:31 UTC (permalink / raw)
  To: gcc-bugs

The kernel for s390 (and ppc) currently drags in __cmpdi2 from libgcc with
the following reduced testcase even though s390 is supposed to have an 8
byte comparison opcode and archs such as i686 generate bit-twiddling for
this unsupported case (admittandly not from ifcvt, but from some define-expand
hackery), i.e. ll[0] | ll[1] == 0.

void foo(void);
int dcache_readdir(long long ll)
{
    switch(ll) {
        case 0:
          foo();
    }
}


-- 
           Summary: Emits call to __cmpdi2 for long long comparison
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: critical
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org
GCC target triplet: s390-ibm-linux


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



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

* [Bug middle-end/25724] Emits call to __cmpdi2 for long long comparison
  2006-01-09 14:31 [Bug target/25724] New: Emits call to __cmpdi2 for long long comparison rguenth at gcc dot gnu dot org
@ 2006-01-09 14:33 ` pinskia at gcc dot gnu dot org
  2006-01-09 14:38 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-09 14:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-01-09 14:33 -------
This is no way critical at all.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
           Severity|critical                    |normal
          Component|target                      |middle-end


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



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

* [Bug middle-end/25724] Emits call to __cmpdi2 for long long comparison
  2006-01-09 14:31 [Bug target/25724] New: Emits call to __cmpdi2 for long long comparison rguenth at gcc dot gnu dot org
  2006-01-09 14:33 ` [Bug middle-end/25724] " pinskia at gcc dot gnu dot org
@ 2006-01-09 14:38 ` pinskia at gcc dot gnu dot org
  2006-01-09 14:41 ` rguenth at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-09 14:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-01-09 14:38 -------
Confirmed, this is just a missed optimization and not a regression at best.  If
the kernel is using long long on a 32bit target, it needs all support functions
including __cmpdi2.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
      Known to fail|                            |3.3.3 3.4.0 4.0.0 4.1.0
                   |                            |4.2.0


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



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

* [Bug middle-end/25724] Emits call to __cmpdi2 for long long comparison
  2006-01-09 14:31 [Bug target/25724] New: Emits call to __cmpdi2 for long long comparison rguenth at gcc dot gnu dot org
  2006-01-09 14:33 ` [Bug middle-end/25724] " pinskia at gcc dot gnu dot org
  2006-01-09 14:38 ` pinskia at gcc dot gnu dot org
@ 2006-01-09 14:41 ` rguenth at gcc dot gnu dot org
  2006-01-09 15:14 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-01-09 14:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2006-01-09 14:41 -------
Using

void foo(void);
int dcache_readdir(long long ll)
{
    if (ll == 0)
          foo();
}

the correct bit-twiddling is generated...

So it looks like a generic switch expand issue.


-- 


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



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

* [Bug middle-end/25724] Emits call to __cmpdi2 for long long comparison
  2006-01-09 14:31 [Bug target/25724] New: Emits call to __cmpdi2 for long long comparison rguenth at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2006-01-09 14:41 ` rguenth at gcc dot gnu dot org
@ 2006-01-09 15:14 ` pinskia at gcc dot gnu dot org
  2006-01-09 15:46 ` pluto at agmk dot net
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-01-09 15:14 UTC (permalink / raw)
  To: gcc-bugs



-- 

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-01-09 15:14:35
               date|                            |


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



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

* [Bug middle-end/25724] Emits call to __cmpdi2 for long long comparison
  2006-01-09 14:31 [Bug target/25724] New: Emits call to __cmpdi2 for long long comparison rguenth at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2006-01-09 15:14 ` pinskia at gcc dot gnu dot org
@ 2006-01-09 15:46 ` pluto at agmk dot net
  2006-01-09 15:48 ` pluto at agmk dot net
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pluto at agmk dot net @ 2006-01-09 15:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pluto at agmk dot net  2006-01-09 15:46 -------

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


-- 

pluto at agmk dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pluto at agmk dot net


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



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

* [Bug middle-end/25724] Emits call to __cmpdi2 for long long comparison
  2006-01-09 14:31 [Bug target/25724] New: Emits call to __cmpdi2 for long long comparison rguenth at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2006-01-09 15:46 ` pluto at agmk dot net
@ 2006-01-09 15:48 ` pluto at agmk dot net
  2006-01-09 18:26 ` krebbel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pluto at agmk dot net @ 2006-01-09 15:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pluto at agmk dot net  2006-01-09 15:48 -------
(In reply to comment #4)
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21237

oops, I accidentally posted this link:(


-- 


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



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

* [Bug middle-end/25724] Emits call to __cmpdi2 for long long comparison
  2006-01-09 14:31 [Bug target/25724] New: Emits call to __cmpdi2 for long long comparison rguenth at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2006-01-09 15:48 ` pluto at agmk dot net
@ 2006-01-09 18:26 ` krebbel at gcc dot gnu dot org
  2006-01-10  9:27 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: krebbel at gcc dot gnu dot org @ 2006-01-09 18:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from krebbel at gcc dot gnu dot org  2006-01-09 18:26 -------
As far as I know the kernel guys rely on the fact that gcc can 
handle DImode operations without calling libgcc. As Richard pointed out 
this only fails in this case because the conditional jump is emitted
differently for case nodes.

A normal DImode compare (on 32bit) is split into SImode compares before 
emit_cmp_and_jump_insns is called. This is done by do_jump_by_parts_equality.

emit_case_nodes in turn calls do_jump_if_equal which calls 
emit_cmp_and_jump_insns with DImode operands.

So I think using the dojump.c machinery in emit_case_nodes should be the
way to go - right?!


-- 

krebbel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |krebbel at gcc dot gnu dot
                   |                            |org


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



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

* [Bug middle-end/25724] Emits call to __cmpdi2 for long long comparison
  2006-01-09 14:31 [Bug target/25724] New: Emits call to __cmpdi2 for long long comparison rguenth at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2006-01-09 18:26 ` krebbel at gcc dot gnu dot org
@ 2006-01-10  9:27 ` rguenth at gcc dot gnu dot org
  2006-02-13  1:55 ` [Bug middle-end/25724] Emits call to __cmpdi2 for long long comparison in switches sayle at gcc dot gnu dot org
  2006-02-13 18:51 ` roger at eyesopen dot com
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-01-10  9:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rguenth at gcc dot gnu dot org  2006-01-10 09:27 -------
Yes, this sounds like the way to go.


-- 


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



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

* [Bug middle-end/25724] Emits call to __cmpdi2 for long long comparison in switches
  2006-01-09 14:31 [Bug target/25724] New: Emits call to __cmpdi2 for long long comparison rguenth at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2006-01-10  9:27 ` rguenth at gcc dot gnu dot org
@ 2006-02-13  1:55 ` sayle at gcc dot gnu dot org
  2006-02-13 18:51 ` roger at eyesopen dot com
  9 siblings, 0 replies; 11+ messages in thread
From: sayle at gcc dot gnu dot org @ 2006-02-13  1:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from sayle at gcc dot gnu dot org  2006-02-13 01:55 -------
Subject: Bug 25724

Author: sayle
Date: Mon Feb 13 01:55:37 2006
New Revision: 110906

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110906
Log:

        PR middle-end/25724
        * dojump.c (do_jump): Call do_compare_rtx_and_jump.
        (do_jump_parts_zero_rtx): New function renamed from
        do_jump_parts_equality_rtx.  Made static.  Add a mode argument.
        (do_jump_parts_equality_rtx): New function split out from
        do_jump_parts_equality.  Old implementation renamed as above.
        Call do_jump_parts_zero_rtx if either operand is zero.
        (do_jump_parts_equality): Call do_jump_parts_equality_rtx to
        do all of the heavy lifting.
        (do_compare_rtx_and_jump): Handle multi-word comparisons by
        calling either do_jump_by_parts_greater_rtx or
        do_jump_by_parts_equality_rtx.
        * expr.h (do_jump_by_parts_equality_rtx): Remove prototype.
        * expmed.c (do_cmp_and_jump): Now multi-word optimization has
        moved to do_compare_rtx_and_jump, call it directly.
        * stmt.c (do_jump_if_equal): Remove static prototype.  Add a
        mode argument.  Call do_compare_rtx_and_jump.
        (emit_case_nodes): Update calls to do_jump_if_equal.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/dojump.c
    trunk/gcc/expmed.c
    trunk/gcc/expr.h
    trunk/gcc/stmt.c


-- 


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


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

* [Bug middle-end/25724] Emits call to __cmpdi2 for long long comparison in switches
  2006-01-09 14:31 [Bug target/25724] New: Emits call to __cmpdi2 for long long comparison rguenth at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2006-02-13  1:55 ` [Bug middle-end/25724] Emits call to __cmpdi2 for long long comparison in switches sayle at gcc dot gnu dot org
@ 2006-02-13 18:51 ` roger at eyesopen dot com
  9 siblings, 0 replies; 11+ messages in thread
From: roger at eyesopen dot com @ 2006-02-13 18:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from roger at eyesopen dot com  2006-02-13 18:51 -------
This has now been fixed on mainline.


-- 

roger at eyesopen dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.2.0


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


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

end of thread, other threads:[~2006-02-13 18:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-09 14:31 [Bug target/25724] New: Emits call to __cmpdi2 for long long comparison rguenth at gcc dot gnu dot org
2006-01-09 14:33 ` [Bug middle-end/25724] " pinskia at gcc dot gnu dot org
2006-01-09 14:38 ` pinskia at gcc dot gnu dot org
2006-01-09 14:41 ` rguenth at gcc dot gnu dot org
2006-01-09 15:14 ` pinskia at gcc dot gnu dot org
2006-01-09 15:46 ` pluto at agmk dot net
2006-01-09 15:48 ` pluto at agmk dot net
2006-01-09 18:26 ` krebbel at gcc dot gnu dot org
2006-01-10  9:27 ` rguenth at gcc dot gnu dot org
2006-02-13  1:55 ` [Bug middle-end/25724] Emits call to __cmpdi2 for long long comparison in switches sayle at gcc dot gnu dot org
2006-02-13 18:51 ` roger at eyesopen dot com

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).