public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/17103] New: Opportunity to replace multiply with shift/add sequence
@ 2004-08-19 14:59 gcc-bugzilla at gcc dot gnu dot org
  2004-08-19 15:34 ` [Bug middle-end/17103] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: gcc-bugzilla at gcc dot gnu dot org @ 2004-08-19 14:59 UTC (permalink / raw)
  To: gcc-bugs

Description:
A non-optimal code sequence is illustraded.    Duplicate using gcc 3.5 and
command line:

gcc -O3 -m32 -c test.c


Testcase:
long foo(long x)
{
 return (x * 258);
}

Assembly:
Currently, gcc 3.5 generates the following:

foo:
      mulli 3,3,258
      blr

It would be more efficient to use a shift/add sequence:

foo:
      or 0,3,3
      rlwinm 3,3,8
      add 0,0,0
      add 3,3,0
      blr




-- 
           Summary: Opportunity to replace multiply with shift/add sequence
           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=17103


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

* [Bug middle-end/17103] Opportunity to replace multiply with shift/add sequence
  2004-08-19 14:59 [Bug other/17103] New: Opportunity to replace multiply with shift/add sequence gcc-bugzilla at gcc dot gnu dot org
@ 2004-08-19 15:34 ` pinskia at gcc dot gnu dot org
  2004-08-19 15:46 ` [Bug target/17103] " falk at debian dot org
  2004-09-12 20:37 ` dje at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-19 15:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-19 15:34 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|other                       |middle-end
     Ever Confirmed|                            |1
           Keywords|                            |missed-optimization
   Last reconfirmed|0000-00-00 00:00:00         |2004-08-19 15:34:29
               date|                            |


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


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

* [Bug target/17103] Opportunity to replace multiply with shift/add sequence
  2004-08-19 14:59 [Bug other/17103] New: Opportunity to replace multiply with shift/add sequence gcc-bugzilla at gcc dot gnu dot org
  2004-08-19 15:34 ` [Bug middle-end/17103] " pinskia at gcc dot gnu dot org
@ 2004-08-19 15:46 ` falk at debian dot org
  2004-09-12 20:37 ` dje at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: falk at debian dot org @ 2004-08-19 15:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From falk at debian dot org  2004-08-19 15:46 -------
This works on Alpha, so I guess it is something target specific, like
imprecise insn costs.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|middle-end                  |target


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


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

* [Bug target/17103] Opportunity to replace multiply with shift/add sequence
  2004-08-19 14:59 [Bug other/17103] New: Opportunity to replace multiply with shift/add sequence gcc-bugzilla at gcc dot gnu dot org
  2004-08-19 15:34 ` [Bug middle-end/17103] " pinskia at gcc dot gnu dot org
  2004-08-19 15:46 ` [Bug target/17103] " falk at debian dot org
@ 2004-09-12 20:37 ` dje at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: dje at gcc dot gnu dot org @ 2004-09-12 20:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dje at gcc dot gnu dot org  2004-09-12 20:37 -------
On POWER4, the default processor, the latency of mulli relative to shifts and
adds makes mulli a better choice than synthesizing the multiply by constant. 
When tuning for other PowerPC processors, such as POWER3, the synthesized
sequence is generated.

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


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


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

end of thread, other threads:[~2004-09-12 20:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-19 14:59 [Bug other/17103] New: Opportunity to replace multiply with shift/add sequence gcc-bugzilla at gcc dot gnu dot org
2004-08-19 15:34 ` [Bug middle-end/17103] " pinskia at gcc dot gnu dot org
2004-08-19 15:46 ` [Bug target/17103] " falk at debian dot org
2004-09-12 20:37 ` dje 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).