public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/30967] Extra sign/zero extend with word comparison result
  2007-02-26 11:42 [Bug rtl-optimization/30967] New: Extra sign/zero extend with word comparison result pinskia at gcc dot gnu dot org
@ 2007-02-26 11:42 ` pinskia at gcc dot gnu dot org
  2007-02-26 23:21 ` pinskia at gcc dot gnu dot org
  2010-03-02 19:14 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-26 11:42 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


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


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

* [Bug rtl-optimization/30967]  New: Extra sign/zero extend with word comparison result
@ 2007-02-26 11:42 pinskia at gcc dot gnu dot org
  2007-02-26 11:42 ` [Bug rtl-optimization/30967] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-26 11:42 UTC (permalink / raw)
  To: gcc-bugs

Testcase:
int f1(int a, int b)
{
  return a == b;
}

------
We produce right now:
_f1:
        xor r4,r3,r4
        cntlzw r4,r4  <--- sign never 1
        srwi r4,r4,5  <--- upper bits defined as 0
        extsw r3,r4
        blr

The sign extend is incorrect as r4's sign will never be 1 and all the upper
bits will always be zero because of srwi.
we have the same issue if the return value is unsigned int also in that there
is an extra zero extend.

This is even with -fsee.


-- 
           Summary: Extra sign/zero extend with word comparison result
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
GCC target triplet: powerpc64-apple-darwin


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


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

* [Bug rtl-optimization/30967] Extra sign/zero extend with word comparison result
  2007-02-26 11:42 [Bug rtl-optimization/30967] New: Extra sign/zero extend with word comparison result pinskia at gcc dot gnu dot org
  2007-02-26 11:42 ` [Bug rtl-optimization/30967] " pinskia at gcc dot gnu dot org
@ 2007-02-26 23:21 ` pinskia at gcc dot gnu dot org
  2010-03-02 19:14 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-26 23:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2007-02-26 23:20 -------
I think this is a case where combine (and other passes) don't know that eq is
always signed extended (when the true is not -1):
(insn 9 8 10 2 (set (reg:SI 123)
        (eq:SI (reg:SI 3 3 [ a ])
            (reg:SI 4 4 [ b ]))) 471 {*eqsi} (nil)
    (expr_list:REG_DEAD (reg:DI 3 3 [ a ])
        (expr_list:REG_DEAD (reg:DI 4 4 [ b ])
            (nil))))

(note 10 9 16 2 NOTE_INSN_DELETED)

(insn 16 10 22 2 (set (reg/i:DI 3 3 [ <result> ])
        (sign_extend:DI (reg:SI 123))) 27 {*rs6000.md:393}
(insn_list:REG_DEP_TRUE 9 (nil))
    (expr_list:REG_DEAD (reg:SI 123)
        (nil)))


-- 


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


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

* [Bug rtl-optimization/30967] Extra sign/zero extend with word comparison result
  2007-02-26 11:42 [Bug rtl-optimization/30967] New: Extra sign/zero extend with word comparison result pinskia at gcc dot gnu dot org
  2007-02-26 11:42 ` [Bug rtl-optimization/30967] " pinskia at gcc dot gnu dot org
  2007-02-26 23:21 ` pinskia at gcc dot gnu dot org
@ 2010-03-02 19:14 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-03-02 19:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2010-03-02 19:14 -------
Still happens on the trunk as of today.


-- 


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


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

* [Bug rtl-optimization/30967] Extra sign/zero extend with word comparison result
       [not found] <bug-30967-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2015-05-13 19:52 ` segher at gcc dot gnu.org
@ 2015-05-16 17:57 ` segher at gcc dot gnu.org
  3 siblings, 0 replies; 8+ messages in thread
From: segher at gcc dot gnu.org @ 2015-05-16 17:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30967

--- Comment #6 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Author: segher
Date: Sat May 16 17:56:55 2015
New Revision: 223250

URL: https://gcc.gnu.org/viewcvs?rev=223250&root=gcc&view=rev
Log:
        Backport from mainline
        2015-05-13  Segher Boessenkool  <segher@kernel.crashing.org>

        PR rtl-optimization/30967
        * config/rs6000/rs6000.c (rs6000_rtx_costs): Don't consider
        destination mode for the cost of scc patterns.

Modified:
    branches/gcc-5-branch/gcc/ChangeLog
    branches/gcc-5-branch/gcc/config/rs6000/rs6000.c


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

* [Bug rtl-optimization/30967] Extra sign/zero extend with word comparison result
       [not found] <bug-30967-4@http.gcc.gnu.org/bugzilla/>
  2015-05-13 12:44 ` segher at gcc dot gnu.org
  2015-05-13 19:14 ` segher at gcc dot gnu.org
@ 2015-05-13 19:52 ` segher at gcc dot gnu.org
  2015-05-16 17:57 ` segher at gcc dot gnu.org
  3 siblings, 0 replies; 8+ messages in thread
From: segher at gcc dot gnu.org @ 2015-05-13 19:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30967

Segher Boessenkool <segher at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Fixed on trunk.  No backport planned.


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

* [Bug rtl-optimization/30967] Extra sign/zero extend with word comparison result
       [not found] <bug-30967-4@http.gcc.gnu.org/bugzilla/>
  2015-05-13 12:44 ` segher at gcc dot gnu.org
@ 2015-05-13 19:14 ` segher at gcc dot gnu.org
  2015-05-13 19:52 ` segher at gcc dot gnu.org
  2015-05-16 17:57 ` segher at gcc dot gnu.org
  3 siblings, 0 replies; 8+ messages in thread
From: segher at gcc dot gnu.org @ 2015-05-13 19:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30967

--- Comment #4 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Author: segher
Date: Wed May 13 19:14:07 2015
New Revision: 223174

URL: https://gcc.gnu.org/viewcvs?rev=223174&root=gcc&view=rev
Log:
        PR rtl-optimization/30967
        * config/rs6000/rs6000.c (rs6000_rtx_costs): Don't consider
        destination mode for the cost of scc patterns.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/rs6000/rs6000.c


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

* [Bug rtl-optimization/30967] Extra sign/zero extend with word comparison result
       [not found] <bug-30967-4@http.gcc.gnu.org/bugzilla/>
@ 2015-05-13 12:44 ` segher at gcc dot gnu.org
  2015-05-13 19:14 ` segher at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: segher at gcc dot gnu.org @ 2015-05-13 12:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30967

Segher Boessenkool <segher at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-05-13
                 CC|                            |segher at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |segher at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #3 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Still happening.  The problem now is that eq:SI is costed as one insn
(which it is not), but eq:DI as three.


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

end of thread, other threads:[~2015-05-16 17:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-26 11:42 [Bug rtl-optimization/30967] New: Extra sign/zero extend with word comparison result pinskia at gcc dot gnu dot org
2007-02-26 11:42 ` [Bug rtl-optimization/30967] " pinskia at gcc dot gnu dot org
2007-02-26 23:21 ` pinskia at gcc dot gnu dot org
2010-03-02 19:14 ` pinskia at gcc dot gnu dot org
     [not found] <bug-30967-4@http.gcc.gnu.org/bugzilla/>
2015-05-13 12:44 ` segher at gcc dot gnu.org
2015-05-13 19:14 ` segher at gcc dot gnu.org
2015-05-13 19:52 ` segher at gcc dot gnu.org
2015-05-16 17:57 ` segher at gcc dot gnu.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).