Bug 30186 - accessing an element via a "pointer" on a vector does not cause vec_extract to be used (non-zero index)
Summary: accessing an element via a "pointer" on a vector does not cause vec_extract t...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.3.0
: P3 enhancement
Target Milestone: 4.4.0
Assignee: Andrew Pinski
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: missed-optimization, patch
Depends on:
Blocks: 4.4pending
  Show dependency treegraph
 
Reported: 2006-12-12 22:35 UTC by Andrew Pinski
Modified: 2008-03-31 18:22 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-09-29 02:08:41


Attachments
Patch which should fix it (851 bytes, patch)
2008-03-29 19:14 UTC, Andrew Pinski
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2006-12-12 22:35:04 UTC
#define vector __attribute__((vector_size(16)))
float f(vector float t)
{
  return ((float*)&t)[1];
}
Comment 1 Andrew Pinski 2007-07-01 00:52:52 UTC
Confirmed.
Comment 2 Andrew Pinski 2007-09-29 02:08:41 UTC
I have a fix.
Comment 3 Andrew Pinski 2008-03-29 19:14:05 UTC
Created attachment 15397 [details]
Patch which should fix it
Comment 4 Andrew Pinski 2008-03-31 18:22:50 UTC
Subject: Bug 30186

Author: pinskia
Date: Mon Mar 31 18:22:05 2008
New Revision: 133766

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133766
Log:
2008-03-31  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR middle-end/30186
        * fold-const.c (fold_indirect_ref_1): Support accessing non first
        element of the vector via a pointer.

2008-03-31  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR middle-end/30186
        * gcc.dg/tree-ssa/vector-1.c: New testcase.
        * gcc.c-torture/execute/vector-1.c: New testcase.
        * gcc.c-torture/execute/vector-2.c: New testcase.


Added:
    trunk/gcc/testsuite/gcc.c-torture/execute/vector-1.c
    trunk/gcc/testsuite/gcc.c-torture/execute/vector-2.c
    trunk/gcc/testsuite/gcc.dg/tree-ssa/vector-1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog

Comment 5 Andrew Pinski 2008-03-31 18:22:57 UTC
Fixed.