public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/17108] New: Missed opportunity for strength reduction
@ 2004-08-19 14:59 gcc-bugzilla at gcc dot gnu dot org
  2004-08-19 15:25 ` [Bug other/17108] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ 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 -m64 -c test.c


Testcase:
void foo(float *data, float d) {
   long i;

   for (i = 0; i < 8; i++)
      data[i] = d;
}

Assembly:
Code generated by gcc 3.5:

.foo:
      li 0,8
      li 9,0
      mtctr 0
.L2:
      sldi 0,9,2
      addi 9,9,1
      stfsx 1,3,0
      bdnz .L2
      blr

We can eliminate the multiply(shift) as well as the increment of "i" and
use
a store with update form to simplify the loop to this:

.foo:
      ai 3,3,-4
      li 0,8
      mtctr 0
.L2:
      stfsu 1,3,4
      bdnz .L2
      blr




-- 
           Summary: Missed opportunity for strength reduction
           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=17108


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

* [Bug other/17108] Missed opportunity for strength reduction
  2004-08-19 14:59 [Bug other/17108] New: Missed opportunity for strength reduction gcc-bugzilla at gcc dot gnu dot org
@ 2004-08-19 15:25 ` pinskia at gcc dot gnu dot org
  2004-11-03 10:39 ` nathan at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-19 15:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-19 15:25 -------
Confirmed, I thought I saw another bug asking for the store with update being used more but I cannot 
find it right now, it might have just been to the gcc@ mailing list though.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |missed-optimization
   Last reconfirmed|0000-00-00 00:00:00         |2004-08-19 15:25:53
               date|                            |


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


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

* [Bug other/17108] Missed opportunity for strength reduction
  2004-08-19 14:59 [Bug other/17108] New: Missed opportunity for strength reduction gcc-bugzilla at gcc dot gnu dot org
  2004-08-19 15:25 ` [Bug other/17108] " pinskia at gcc dot gnu dot org
@ 2004-11-03 10:39 ` nathan at gcc dot gnu dot org
  2004-11-03 11:25 ` nathan at gcc dot gnu dot org
  2004-11-03 15:33 ` [Bug target/17108] " pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: nathan at gcc dot gnu dot org @ 2004-11-03 10:39 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |nathan at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


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


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

* [Bug other/17108] Missed opportunity for strength reduction
  2004-08-19 14:59 [Bug other/17108] New: Missed opportunity for strength reduction gcc-bugzilla at gcc dot gnu dot org
  2004-08-19 15:25 ` [Bug other/17108] " pinskia at gcc dot gnu dot org
  2004-11-03 10:39 ` nathan at gcc dot gnu dot org
@ 2004-11-03 11:25 ` nathan at gcc dot gnu dot org
  2004-11-03 15:33 ` [Bug target/17108] " pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: nathan at gcc dot gnu dot org @ 2004-11-03 11:25 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From nathan at gcc dot gnu dot org  2004-11-03 11:25 -------
The situation has improved, as the biv has now been spotted, and the loop
turned into,
.foo:
        li 0,8
        mtctr 0
        .align 4
.L2:
        stfs 1,0(3)
        addi 3,3,4
        bdnz .L2
        blr

Unfortunately this has placed the increment after the load, and so
cannot be merged into it.  If the loop optimizer knew the target had
pre-inc, it might be able to swap them round by biasing the pointer
before the loop. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|nathan at gcc dot gnu dot   |unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


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


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

* [Bug target/17108] Missed opportunity for strength reduction
  2004-08-19 14:59 [Bug other/17108] New: Missed opportunity for strength reduction gcc-bugzilla at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-11-03 11:25 ` nathan at gcc dot gnu dot org
@ 2004-11-03 15:33 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-03 15:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-03 15:33 -------
Corresponding code which gives what is wantted here is:
void foo(float *data, float d) {
   long i;

   data--;
   for (i = 0; i < 8; i++)
     {
      data[1] = d;
      data++;
     }
}

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2004-08-19 15:25:53         |2004-11-03 15:33:17
               date|                            |


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


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

end of thread, other threads:[~2004-11-03 15:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-19 14:59 [Bug other/17108] New: Missed opportunity for strength reduction gcc-bugzilla at gcc dot gnu dot org
2004-08-19 15:25 ` [Bug other/17108] " pinskia at gcc dot gnu dot org
2004-11-03 10:39 ` nathan at gcc dot gnu dot org
2004-11-03 11:25 ` nathan at gcc dot gnu dot org
2004-11-03 15:33 ` [Bug target/17108] " 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).