public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/32396]  New: [PPC/Altivec, regression?] gcc uses 0 as altivec load/store index
@ 2007-06-18 21:03 sparky at pld-linux dot org
  2007-06-18 21:11 ` [Bug middle-end/32396] " sparky at pld-linux dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: sparky at pld-linux dot org @ 2007-06-18 21:03 UTC (permalink / raw)
  To: gcc-bugs

In altivec load/store instructions (lvx, stvx, ...) and lsvl/lsvr, when address
is supplied as pointer + well-known constant, gcc always calculates the actual
address in scalar unit and does not use sum in those instructions (puts 0 as
index). This slows-down some simple altivec loops.

Sample code:
        vector unsigned char *vDst = dst;
        vector unsigned char vSetTo = {}; /* zero */

        do {
                vec_st( vSetTo,  0, vDst );
                vec_st( vSetTo, 16, vDst );
                vDst += 2;
        } while (--len);

gcc 4.1.2, 4.2.0, 4.3-20070615 produces:

.L3:
        addi %r11,%r9,16
        stvx %v0,0,%r9
        addi %r9,%r9,32
        stvx %v0,0,%r11
        bdnz .L3

while, ideally, it should be:
        li %r11,16
.L3:
        stvx %v0,0,%r9
        stvx %v0,%r11,%r9
        addi %r9,%r9,32
        bdnz .L3

gcc 3.3, with -O2, behaves quite well in this case (should use 0 instead of
r10):
        li %r10,0
        li %r11,16
.L13:
        stvx %v0,%r10,%r9
        stvx %v0,%r11,%r9
        addi %r9,%r9,32
        bdnz .L13


-- 
           Summary: [PPC/Altivec, regression?] gcc uses 0 as altivec
                    load/store index
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sparky at pld-linux dot org


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


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

* [Bug middle-end/32396] [PPC/Altivec, regression?] gcc uses 0 as altivec load/store index
  2007-06-18 21:03 [Bug middle-end/32396] New: [PPC/Altivec, regression?] gcc uses 0 as altivec load/store index sparky at pld-linux dot org
@ 2007-06-18 21:11 ` sparky at pld-linux dot org
  2007-12-26  1:25 ` [Bug middle-end/32396] [4.1/4.2/4.3 Regression] " pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: sparky at pld-linux dot org @ 2007-06-18 21:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from sparky at pld-linux dot org  2007-06-18 21:11 -------
Created an attachment (id=13732)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13732&action=view)
simple testcase and benchmark

on 1.3GHz iBook built without USE_ASM runs in 2.335s, with USE_ASM runs in
1.815s


-- 


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


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

* [Bug middle-end/32396] [4.1/4.2/4.3 Regression]  gcc uses 0 as altivec load/store index
  2007-06-18 21:03 [Bug middle-end/32396] New: [PPC/Altivec, regression?] gcc uses 0 as altivec load/store index sparky at pld-linux dot org
  2007-06-18 21:11 ` [Bug middle-end/32396] " sparky at pld-linux dot org
@ 2007-12-26  1:25 ` pinskia at gcc dot gnu dot org
  2008-03-24 19:03 ` [Bug middle-end/32396] [4.1/4.2 " pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-12-26  1:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2007-12-26 01:25 -------
Hmm, This looks related to PR 34529.  Since we allow base+const before reload
for vector moves, we then prop that into the move instruction.  After reload,
we use an extra register to store the base+const but never move that add into
the move instruction with using the register for the constant.  Also we never
do loop code motion after reload also so we never move the li instruction
outside of the loop.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
  BugsThisDependsOn|                            |34529
           Severity|enhancement                 |minor
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |missed-optimization
   Last reconfirmed|0000-00-00 00:00:00         |2007-12-26 01:25:35
               date|                            |
            Summary|[PPC/Altivec, regression?]  |[4.1/4.2/4.3 Regression]
                   |gcc uses 0 as altivec       |gcc uses 0 as altivec
                   |load/store index            |load/store index
   Target Milestone|---                         |4.1.3


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


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

* [Bug middle-end/32396] [4.1/4.2 Regression]  gcc uses 0 as altivec load/store index
  2007-06-18 21:03 [Bug middle-end/32396] New: [PPC/Altivec, regression?] gcc uses 0 as altivec load/store index sparky at pld-linux dot org
  2007-06-18 21:11 ` [Bug middle-end/32396] " sparky at pld-linux dot org
  2007-12-26  1:25 ` [Bug middle-end/32396] [4.1/4.2/4.3 Regression] " pinskia at gcc dot gnu dot org
@ 2008-03-24 19:03 ` pinskia at gcc dot gnu dot org
  2008-07-04 22:15 ` [Bug middle-end/32396] [4.2 " jsm28 at gcc dot gnu dot org
  2009-03-30 22:09 ` jsm28 at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-03-24 19:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2008-03-24 19:02 -------
This was indeed fixed by PR 34529:

.L3:
        stvx 0,0,9
        stvx 0,9,0
        addi 9,9,32
        bdnz .L3

-- Pinski


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.3.0 4.4.0
            Summary|[4.1/4.2/4.3/4.4 Regression]|[4.1/4.2 Regression]  gcc
                   |gcc uses 0 as altivec       |uses 0 as altivec load/store
                   |load/store index            |index


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


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

* [Bug middle-end/32396] [4.2 Regression]  gcc uses 0 as altivec load/store index
  2007-06-18 21:03 [Bug middle-end/32396] New: [PPC/Altivec, regression?] gcc uses 0 as altivec load/store index sparky at pld-linux dot org
                   ` (2 preceding siblings ...)
  2008-03-24 19:03 ` [Bug middle-end/32396] [4.1/4.2 " pinskia at gcc dot gnu dot org
@ 2008-07-04 22:15 ` jsm28 at gcc dot gnu dot org
  2009-03-30 22:09 ` jsm28 at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 22:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jsm28 at gcc dot gnu dot org  2008-07-04 22:14 -------
Closing 4.1 branch.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.1/4.2 Regression]  gcc   |[4.2 Regression]  gcc uses 0
                   |uses 0 as altivec load/store|as altivec load/store index
                   |index                       |
   Target Milestone|4.1.3                       |4.2.5


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


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

* [Bug middle-end/32396] [4.2 Regression]  gcc uses 0 as altivec load/store index
  2007-06-18 21:03 [Bug middle-end/32396] New: [PPC/Altivec, regression?] gcc uses 0 as altivec load/store index sparky at pld-linux dot org
                   ` (3 preceding siblings ...)
  2008-07-04 22:15 ` [Bug middle-end/32396] [4.2 " jsm28 at gcc dot gnu dot org
@ 2009-03-30 22:09 ` jsm28 at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-30 22:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jsm28 at gcc dot gnu dot org  2009-03-30 22:08 -------
Closing 4.2 branch, fixed in 4.3.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to fail|4.1.2 4.2.0                 |4.1.2 4.2.0 4.2.5
         Resolution|                            |FIXED
   Target Milestone|4.2.5                       |4.3.0


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


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

end of thread, other threads:[~2009-03-30 22:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-18 21:03 [Bug middle-end/32396] New: [PPC/Altivec, regression?] gcc uses 0 as altivec load/store index sparky at pld-linux dot org
2007-06-18 21:11 ` [Bug middle-end/32396] " sparky at pld-linux dot org
2007-12-26  1:25 ` [Bug middle-end/32396] [4.1/4.2/4.3 Regression] " pinskia at gcc dot gnu dot org
2008-03-24 19:03 ` [Bug middle-end/32396] [4.1/4.2 " pinskia at gcc dot gnu dot org
2008-07-04 22:15 ` [Bug middle-end/32396] [4.2 " jsm28 at gcc dot gnu dot org
2009-03-30 22:09 ` jsm28 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).