public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/16802] New: PowerPC - Unnecessary extsw
@ 2004-07-28 17:01 gcc-bugzilla at gcc dot gnu dot org
  2004-07-28 17:39 ` [Bug target/16802] " bangerth at dealii dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2004-07-28 17:01 UTC (permalink / raw)
  To: gcc-bugs

Description:
A non-optimal code sequence is illustrated.  The extsw prior to the branch to return from the procedure is not necessary.  Duplicate using gcc 3.5 and command line:

gcc -O3 -m64 -c test.c

Testcase:
int b,d;

int logic_func1() {
  return (d< b);
}

Assembly:
.logic_func1:
	ld 9,.LC1@toc(2)
	li 3,1
	ld 11,.LC0@toc(2)
	lwz 10,0(9)
	lwz 0,0(11)
	cmpw 7,0,10
	blt- 7,.L2
	li 3,0
.L2:
	extsw 3,3 <-- Unnecessary.
	blr



-- 
           Summary: PowerPC - Unnecessary extsw
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P1
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: steinmtz at us dot ibm dot com
                CC: gcc-bugs at gcc dot gnu dot org,steinmtz at us dot ibm
                    dot com
 GCC build triplet: powerpc64-linux
  GCC host triplet: powerpc64-linux
GCC target triplet: powerpc64-linux


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


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

* [Bug target/16802] PowerPC - Unnecessary extsw
  2004-07-28 17:01 [Bug other/16802] New: PowerPC - Unnecessary extsw gcc-bugzilla at gcc dot gnu dot org
@ 2004-07-28 17:39 ` bangerth at dealii dot org
  2004-08-02  0:57 ` [Bug rtl-optimization/16802] " pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2004-07-28 17:39 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|other                       |target


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


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

* [Bug rtl-optimization/16802] PowerPC - Unnecessary extsw
  2004-07-28 17:01 [Bug other/16802] New: PowerPC - Unnecessary extsw gcc-bugzilla at gcc dot gnu dot org
  2004-07-28 17:39 ` [Bug target/16802] " bangerth at dealii dot org
@ 2004-08-02  0:57 ` pinskia at gcc dot gnu dot org
  2004-11-03 11:29 ` nathan at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-02  0:57 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-02 00:57 -------
Confirmed, this is a missed optimization on the RTL level with respect with sign_exending.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|target                      |rtl-optimization
     Ever Confirmed|                            |1
           Keywords|                            |missed-optimization
   Last reconfirmed|0000-00-00 00:00:00         |2004-08-02 00:57:42
               date|                            |


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


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

* [Bug rtl-optimization/16802] PowerPC - Unnecessary extsw
  2004-07-28 17:01 [Bug other/16802] New: PowerPC - Unnecessary extsw gcc-bugzilla at gcc dot gnu dot org
  2004-07-28 17:39 ` [Bug target/16802] " bangerth at dealii dot org
  2004-08-02  0:57 ` [Bug rtl-optimization/16802] " pinskia at gcc dot gnu dot org
@ 2004-11-03 11:29 ` nathan at gcc dot gnu dot org
  2004-11-08 14:10 ` [Bug middle-end/16802] " pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: nathan at gcc dot gnu dot org @ 2004-11-03 11:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From nathan at gcc dot gnu dot org  2004-11-03 11:29 -------
I believe this is a problem with the tree optimizers being ABI blind. on 64bit
ppc integral parameters and return values are correctly extended to 64 bits.  This
sign extension is inserted during the tree->rtl translation, and therefore
cannot leverage any ssa-vrp information.  Unfortunately RTL does not have VRP
itself, but only condition-code propagation.  Combine does not track values
across basic blocks, so it too is blind in this case, as the register is
written in two blocks.

-- 


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


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

* [Bug middle-end/16802] PowerPC - Unnecessary extsw
  2004-07-28 17:01 [Bug other/16802] New: PowerPC - Unnecessary extsw gcc-bugzilla at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-11-03 11:29 ` nathan at gcc dot gnu dot org
@ 2004-11-08 14:10 ` pinskia at gcc dot gnu dot org
  2005-02-08 19:06 ` pinskia at gcc dot gnu dot org
  2005-09-10 18:11 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-08 14:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-08 14:09 -------
This is a bug in expand, there is no reason why the ABI issue be fixed up in expand where we know 
about the ABI.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|rtl-optimization            |middle-end


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


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

* [Bug middle-end/16802] PowerPC - Unnecessary extsw
  2004-07-28 17:01 [Bug other/16802] New: PowerPC - Unnecessary extsw gcc-bugzilla at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-11-08 14:10 ` [Bug middle-end/16802] " pinskia at gcc dot gnu dot org
@ 2005-02-08 19:06 ` pinskia at gcc dot gnu dot org
  2005-09-10 18:11 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-08 19:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-08 13:49 -------
Fixed on the mainline.
We now combine the following RTL to fix the problem:
(insn 16 15 17 0 (set (reg:SI 126)
        (lt:SI (reg:CC 127)
            (const_int 0 [0x0]))) 382 {*rs6000.md:11380} (insn_list:REG_DEP_TRUE 15 (nil))
    (expr_list:REG_DEAD (reg:CC 127)
        (nil)))

(insn 17 16 21 0 (set (reg:DI 128)
        (sign_extend:DI (reg:SI 126))) 43 {*rs6000.md:446} (insn_list:REG_DEP_TRUE 16 (nil))
    (expr_list:REG_DEAD (reg:SI 126)
        (nil)))
(insn 24 21 30 0 (set (reg/i:DI 3 r3 [ <result> ])
        (reg:DI 128)) 312 {*movdi_internal64} (insn_list:REG_DEP_TRUE 17 (nil))
    (expr_list:REG_DEAD (reg:DI 128)
        (nil)))
Into:
(insn 24 21 30 0 (set (reg/i:DI 3 r3 [ <result> ])
        (lt:DI (reg:CC 127)
            (const_int 0 [0x0]))) 383 {*rs6000.md:11412} (insn_list:REG_DEP_TRUE 15 (nil))
    (expr_list:REG_DEAD (reg:CC 127)
        (nil)))


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


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


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

* [Bug middle-end/16802] PowerPC - Unnecessary extsw
  2004-07-28 17:01 [Bug other/16802] New: PowerPC - Unnecessary extsw gcc-bugzilla at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2005-02-08 19:06 ` pinskia at gcc dot gnu dot org
@ 2005-09-10 18:11 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-10 18:11 UTC (permalink / raw)
  To: gcc-bugs



-- 
Bug 16802 depends on bug 18373, which changed state.

Bug 18373 Summary: [meta-bug] VRP Value Range Propagation
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18373

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

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


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

end of thread, other threads:[~2005-09-10 18:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-28 17:01 [Bug other/16802] New: PowerPC - Unnecessary extsw gcc-bugzilla at gcc dot gnu dot org
2004-07-28 17:39 ` [Bug target/16802] " bangerth at dealii dot org
2004-08-02  0:57 ` [Bug rtl-optimization/16802] " pinskia at gcc dot gnu dot org
2004-11-03 11:29 ` nathan at gcc dot gnu dot org
2004-11-08 14:10 ` [Bug middle-end/16802] " pinskia at gcc dot gnu dot org
2005-02-08 19:06 ` pinskia at gcc dot gnu dot org
2005-09-10 18:11 ` pinskia 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).