public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/40049]  New: Incorrect tree made for vector shifted by constant on powerpc, spu
@ 2009-05-06 19:06 meissner at linux dot vnet dot ibm dot com
  2009-05-06 19:09 ` [Bug tree-optimization/40049] " meissner at linux dot vnet dot ibm dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: meissner at linux dot vnet dot ibm dot com @ 2009-05-06 19:06 UTC (permalink / raw)
  To: gcc-bugs

On machines with only a vector/vector shift like the powerpc and spu, the wrong
type is generated for the tree vector that is created with the constant
splat'ed to fill the vector.  The problem is the code uses
get_vectype_for_scalar_type, and integer constants don't have a type.  So
get_vectype_for_scalar_type returns V4SI, even if the vector in question is
V8HI or V16QI.  Before the added type validation was added on April 27th, this
appeared to work because nothing looked at the type field.  With the current
code, this can lead to incorrect code being generated, and for larger programs
the compiler will die due to garbage collection failure.


-- 
           Summary: Incorrect tree made for vector shifted by constant on
                    powerpc, spu
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: meissner at linux dot vnet dot ibm dot com
 GCC build triplet: powerpc64-unknown-linux-gnu
  GCC host triplet: powerpc64-unknown-linux-gnu
GCC target triplet: powerpc64-unknown-linux-gnu


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


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

* [Bug tree-optimization/40049] Incorrect tree made for vector shifted by constant on powerpc, spu
  2009-05-06 19:06 [Bug tree-optimization/40049] New: Incorrect tree made for vector shifted by constant on powerpc, spu meissner at linux dot vnet dot ibm dot com
@ 2009-05-06 19:09 ` meissner at linux dot vnet dot ibm dot com
  2009-05-06 19:20 ` meissner at linux dot vnet dot ibm dot com
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: meissner at linux dot vnet dot ibm dot com @ 2009-05-06 19:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from meissner at linux dot vnet dot ibm dot com  2009-05-06 19:08 -------
Created an attachment (id=17811)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17811&action=view)
Patch to fix vector shift by constant on machines with vector/vector shift

This patch fixes the problem in the small case.  While there, I fixed the FIXME
in the next section to use build_constructor instead of
build_constructor_from_list.


-- 


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


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

* [Bug tree-optimization/40049] Incorrect tree made for vector shifted by constant on powerpc, spu
  2009-05-06 19:06 [Bug tree-optimization/40049] New: Incorrect tree made for vector shifted by constant on powerpc, spu meissner at linux dot vnet dot ibm dot com
  2009-05-06 19:09 ` [Bug tree-optimization/40049] " meissner at linux dot vnet dot ibm dot com
@ 2009-05-06 19:20 ` meissner at linux dot vnet dot ibm dot com
  2009-05-06 19:21 ` rguenth at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: meissner at linux dot vnet dot ibm dot com @ 2009-05-06 19:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from meissner at linux dot vnet dot ibm dot com  2009-05-06 19:19 -------
Created an attachment (id=17812)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17812&action=view)
Simplified test case

This testcase shows the problem.  Without the patch, it generates a vspltiw
(vector splat immediate word) when it should generate vspltish.  Using vsplitw
means that every other vector element will be shifted by 0 instead of 2.


-- 


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


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

* [Bug tree-optimization/40049] Incorrect tree made for vector shifted by constant on powerpc, spu
  2009-05-06 19:06 [Bug tree-optimization/40049] New: Incorrect tree made for vector shifted by constant on powerpc, spu meissner at linux dot vnet dot ibm dot com
  2009-05-06 19:09 ` [Bug tree-optimization/40049] " meissner at linux dot vnet dot ibm dot com
  2009-05-06 19:20 ` meissner at linux dot vnet dot ibm dot com
@ 2009-05-06 19:21 ` rguenth at gcc dot gnu dot org
  2009-05-06 19:23 ` rguenth at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-05-06 19:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2009-05-06 19:20 -------
Wait - I patched this area exactly to avoid type verification issues on x86_64
...

(what do you mean by integer constants do not have a type?  They definitely
do on the tree level)


-- 


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


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

* [Bug tree-optimization/40049] Incorrect tree made for vector shifted by constant on powerpc, spu
  2009-05-06 19:06 [Bug tree-optimization/40049] New: Incorrect tree made for vector shifted by constant on powerpc, spu meissner at linux dot vnet dot ibm dot com
                   ` (2 preceding siblings ...)
  2009-05-06 19:21 ` rguenth at gcc dot gnu dot org
@ 2009-05-06 19:23 ` rguenth at gcc dot gnu dot org
  2009-05-06 19:36 ` meissner at linux dot vnet dot ibm dot com
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-05-06 19:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2009-05-06 19:22 -------
See http://gcc.gnu.org/ml/gcc-cvs/2009-04/msg01532.html


-- 


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


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

* [Bug tree-optimization/40049] Incorrect tree made for vector shifted by constant on powerpc, spu
  2009-05-06 19:06 [Bug tree-optimization/40049] New: Incorrect tree made for vector shifted by constant on powerpc, spu meissner at linux dot vnet dot ibm dot com
                   ` (3 preceding siblings ...)
  2009-05-06 19:23 ` rguenth at gcc dot gnu dot org
@ 2009-05-06 19:36 ` meissner at linux dot vnet dot ibm dot com
  2009-05-06 20:00 ` meissner at linux dot vnet dot ibm dot com
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: meissner at linux dot vnet dot ibm dot com @ 2009-05-06 19:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from meissner at linux dot vnet dot ibm dot com  2009-05-06 19:35 -------
Subject: Re:  Incorrect tree made for vector shifted by constant on powerpc,
spu

On Wed, May 06, 2009 at 07:22:25PM -0000, rguenth at gcc dot gnu dot org wrote:
> 
> 
> ------- Comment #4 from rguenth at gcc dot gnu dot org  2009-05-06 19:22 -------
> See http://gcc.gnu.org/ml/gcc-cvs/2009-04/msg01532.html
> 
> 
> -- 
> 
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40049
> 
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.

The integer constants might have the correct types elsewhere, but in the
specific case of vector shifts, the type is SImode and not HImode.  Perphaps, I
need to make the patch more specific for just shifts.

Powerpc and spu would be the only machines that this shows up on.  X86_64 has
vector/vector shifts for SSE5 mode, but it is unlikely many people would notice
at this stage (also, the x86 has vector shift by constant, in addition to the
vector/vector shift of SSE5).


-- 


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


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

* [Bug tree-optimization/40049] Incorrect tree made for vector shifted by constant on powerpc, spu
  2009-05-06 19:06 [Bug tree-optimization/40049] New: Incorrect tree made for vector shifted by constant on powerpc, spu meissner at linux dot vnet dot ibm dot com
                   ` (4 preceding siblings ...)
  2009-05-06 19:36 ` meissner at linux dot vnet dot ibm dot com
@ 2009-05-06 20:00 ` meissner at linux dot vnet dot ibm dot com
  2009-05-06 20:16 ` rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: meissner at linux dot vnet dot ibm dot com @ 2009-05-06 20:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from meissner at linux dot vnet dot ibm dot com  2009-05-06 20:00 -------
Created an attachment (id=17813)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17813&action=view)
More targetted patch to fix the problem

This patch is much more targeted to just make sure vector shifts by constant or
loop invarients have the correct type on machines with vector/vector shifts,
and not vector/scalar shifts.


-- 

meissner at linux dot vnet dot ibm dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #17811|0                           |1
        is obsolete|                            |


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


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

* [Bug tree-optimization/40049] Incorrect tree made for vector shifted by constant on powerpc, spu
  2009-05-06 19:06 [Bug tree-optimization/40049] New: Incorrect tree made for vector shifted by constant on powerpc, spu meissner at linux dot vnet dot ibm dot com
                   ` (5 preceding siblings ...)
  2009-05-06 20:00 ` meissner at linux dot vnet dot ibm dot com
@ 2009-05-06 20:16 ` rguenth at gcc dot gnu dot org
  2009-05-07 21:19 ` meissner at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-05-06 20:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rguenth at gcc dot gnu dot org  2009-05-06 20:15 -------
Yep, that patch makes more sense.  Please make sure to also test x86_64. 
Thanks.


-- 


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


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

* [Bug tree-optimization/40049] Incorrect tree made for vector shifted by constant on powerpc, spu
  2009-05-06 19:06 [Bug tree-optimization/40049] New: Incorrect tree made for vector shifted by constant on powerpc, spu meissner at linux dot vnet dot ibm dot com
                   ` (6 preceding siblings ...)
  2009-05-06 20:16 ` rguenth at gcc dot gnu dot org
@ 2009-05-07 21:19 ` meissner at gcc dot gnu dot org
  2009-05-07 21:33 ` meissner at linux dot vnet dot ibm dot com
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: meissner at gcc dot gnu dot org @ 2009-05-07 21:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from meissner at gcc dot gnu dot org  2009-05-07 21:19 -------
Subject: Bug 40049

Author: meissner
Date: Thu May  7 21:18:54 2009
New Revision: 147252

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147252
Log:
Support vector rotates; Fix bug 40049 which caused runtime corruption; Allow
xxpermdi for all vector types; Fix xscvdpsp/xscvspdp; Optimize initialization
of float vectors

Modified:
    branches/ibm/power7-meissner/gcc/ChangeLog.power7
    branches/ibm/power7-meissner/gcc/config/rs6000/altivec.md
    branches/ibm/power7-meissner/gcc/config/rs6000/rs6000-c.c
    branches/ibm/power7-meissner/gcc/config/rs6000/rs6000.c
    branches/ibm/power7-meissner/gcc/config/rs6000/rs6000.h
    branches/ibm/power7-meissner/gcc/config/rs6000/vector.md
    branches/ibm/power7-meissner/gcc/config/rs6000/vsx.md
    branches/ibm/power7-meissner/gcc/tree-vect-stmts.c


-- 


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


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

* [Bug tree-optimization/40049] Incorrect tree made for vector shifted by constant on powerpc, spu
  2009-05-06 19:06 [Bug tree-optimization/40049] New: Incorrect tree made for vector shifted by constant on powerpc, spu meissner at linux dot vnet dot ibm dot com
                   ` (7 preceding siblings ...)
  2009-05-07 21:19 ` meissner at gcc dot gnu dot org
@ 2009-05-07 21:33 ` meissner at linux dot vnet dot ibm dot com
  2009-05-08 22:39 ` meissner at gcc dot gnu dot org
  2009-05-12 22:21 ` bje at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: meissner at linux dot vnet dot ibm dot com @ 2009-05-07 21:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from meissner at linux dot vnet dot ibm dot com  2009-05-07 21:33 -------
Created an attachment (id=17824)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17824&action=view)
Updated patch that fixes some internal compiler errors

I discovered in further testing, that vect_get_vec_def_for_operand didn't like
when a scalar had been converted, so I built a constructor for the op in the
non-scalar case.


-- 

meissner at linux dot vnet dot ibm dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #17813|0                           |1
        is obsolete|                            |


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


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

* [Bug tree-optimization/40049] Incorrect tree made for vector shifted by constant on powerpc, spu
  2009-05-06 19:06 [Bug tree-optimization/40049] New: Incorrect tree made for vector shifted by constant on powerpc, spu meissner at linux dot vnet dot ibm dot com
                   ` (8 preceding siblings ...)
  2009-05-07 21:33 ` meissner at linux dot vnet dot ibm dot com
@ 2009-05-08 22:39 ` meissner at gcc dot gnu dot org
  2009-05-12 22:21 ` bje at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: meissner at gcc dot gnu dot org @ 2009-05-08 22:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from meissner at gcc dot gnu dot org  2009-05-08 22:39 -------
Subject: Bug 40049

Author: meissner
Date: Fri May  8 22:38:49 2009
New Revision: 147298

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147298
Log:
Fix PR 40049

Added:
    trunk/gcc/testsuite/gcc.dg/vect/vect-shift-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vect-stmts.c


-- 


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


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

* [Bug tree-optimization/40049] Incorrect tree made for vector shifted by constant on powerpc, spu
  2009-05-06 19:06 [Bug tree-optimization/40049] New: Incorrect tree made for vector shifted by constant on powerpc, spu meissner at linux dot vnet dot ibm dot com
                   ` (9 preceding siblings ...)
  2009-05-08 22:39 ` meissner at gcc dot gnu dot org
@ 2009-05-12 22:21 ` bje at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: bje at gcc dot gnu dot org @ 2009-05-12 22:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from bje at gcc dot gnu dot org  2009-05-12 22:21 -------
Fixed.


-- 

bje at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2009-05-12 22:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-06 19:06 [Bug tree-optimization/40049] New: Incorrect tree made for vector shifted by constant on powerpc, spu meissner at linux dot vnet dot ibm dot com
2009-05-06 19:09 ` [Bug tree-optimization/40049] " meissner at linux dot vnet dot ibm dot com
2009-05-06 19:20 ` meissner at linux dot vnet dot ibm dot com
2009-05-06 19:21 ` rguenth at gcc dot gnu dot org
2009-05-06 19:23 ` rguenth at gcc dot gnu dot org
2009-05-06 19:36 ` meissner at linux dot vnet dot ibm dot com
2009-05-06 20:00 ` meissner at linux dot vnet dot ibm dot com
2009-05-06 20:16 ` rguenth at gcc dot gnu dot org
2009-05-07 21:19 ` meissner at gcc dot gnu dot org
2009-05-07 21:33 ` meissner at linux dot vnet dot ibm dot com
2009-05-08 22:39 ` meissner at gcc dot gnu dot org
2009-05-12 22:21 ` bje 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).