Commit 06cb4f79 by Jan Sjodin Committed by Jan Sjodin

2007-07-30 Jan Sjodin <jan.sjodin@amd.com>

        * tree-data-ref.c
        (split_constant_offset): Enable split_constant_offset to extract
        constants from other statements.
        * tree-vect-transform.c
        (vect_create_addr_base_for_vector_ref): Generate data_ref_base
        to a temp var. Force base_offset to be simple.

2007-07-30  Jan Sjodin  <jan.sjodin@amd.com>

        * gcc.dg/vect/vect-117.c: New test.
        * gcc.dg/vect/vect-74.c: Enabled test
        * gcc.dg/vect/vect-81.c: Enabled test

From-SVN: r127080
parent a3f91844
2007-07-30 Jan Sjodin <jan.sjodin@amd.com>
* tree-data-ref.c
(split_constant_offset): Enable split_constant_offset to extract
constants from other statements.
* tree-vect-transform.c
(vect_create_addr_base_for_vector_ref): Generate data_ref_base
to a temp var. Force base_offset to be simple.
2007-07-30 Seongbae Park <seongbae.park@gmail.com> 2007-07-30 Seongbae Park <seongbae.park@gmail.com>
* df-scan.c (df_scan_verify): Remove artificial limit on * df-scan.c (df_scan_verify): Remove artificial limit on
......
2007-07-30 Jan Sjodin <jan.sjodin@amd.com>
* gcc.dg/vect/vect-117.c: New test.
* gcc.dg/vect/vect-74.c: Enabled test
* gcc.dg/vect/vect-81.c: Enabled test
2007-07-30 Andrew Pinski <pinskia@gmail.com> 2007-07-30 Andrew Pinski <pinskia@gmail.com>
* gcc.dg/pragma-darwin.c: Run on all *-*-darwin* targets. * gcc.dg/pragma-darwin.c: Run on all *-*-darwin* targets.
/* { dg-require-effective-target vect_int } */
#include <stdlib.h>
#include <stdarg.h>
#include "tree-vect.h"
#define N 5
static int a[N][N] = {{ 1, 2, 3, 4, 5},
{ 6, 7, 8, 9,10},
{11,12,13,14,15},
{16,17,18,19,20},
{21,22,23,24,25}};
static int c[N][N] = {{ 1, 2, 3, 4, 5},
{ 7, 9,11, 13,15},
{18,21,24,27,30},
{34,38,42,46,50},
{55,60,65,70,75}};
volatile int foo;
int main1 (int A[N][N])
{
int i,j;
/* vectorizable */
for (i = 1; i < N; i++)
{
for (j = 0; j < N; j++)
{
A[i][j] = A[i-1][j] + A[i][j];
}
}
return 0;
}
int main (void)
{
int i,j;
foo = 0;
main1 (a);
/* check results: */
for (i = 0; i < N; i++)
{
for (j = 0; j < N; j++)
{
if (a[i][j] != c[i][j])
abort();
}
}
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
/* { dg-final { scan-tree-dump-times "possible dependence between data-refs" 0 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
...@@ -43,7 +43,7 @@ int main (void) ...@@ -43,7 +43,7 @@ int main (void)
} }
/* Xfail until handling restrict is refined. See pr29145 */ /* Xfail until handling restrict is refined. See pr29145 */
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */ /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
/* Uncomment when this testcase gets vectorized again: /* Uncomment when this testcase gets vectorized again:
dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" { target vect_no_align } } dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" { target vect_no_align } }
dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail vect_no_align } } dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail vect_no_align } }
......
...@@ -47,7 +47,7 @@ int main (void) ...@@ -47,7 +47,7 @@ int main (void)
all three accesses (peeling to align the store will not force the all three accesses (peeling to align the store will not force the
two loads to be aligned). */ two loads to be aligned). */
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */ /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
/* Uncomment when this testcase gets vectorized again: /* Uncomment when this testcase gets vectorized again:
dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail vect_no_align } } dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail vect_no_align } }
dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_no_align } } dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_no_align } }
......
...@@ -565,6 +565,27 @@ split_constant_offset (tree exp, tree *var, tree *off) ...@@ -565,6 +565,27 @@ split_constant_offset (tree exp, tree *var, tree *off)
return; return;
} }
case SSA_NAME:
{
tree def_stmt = SSA_NAME_DEF_STMT (exp);
if (TREE_CODE (def_stmt) == GIMPLE_MODIFY_STMT)
{
tree def_stmt_rhs = GIMPLE_STMT_OPERAND (def_stmt, 1);
if (!TREE_SIDE_EFFECTS (def_stmt_rhs)
&& EXPR_P (def_stmt_rhs)
&& !REFERENCE_CLASS_P (def_stmt_rhs))
{
split_constant_offset (def_stmt_rhs, &var0, &off0);
var0 = fold_convert (type, var0);
*var = var0;
*off = off0;
return;
}
}
break;
}
default: default:
break; break;
} }
......
...@@ -711,21 +711,32 @@ vect_create_addr_base_for_vector_ref (tree stmt, ...@@ -711,21 +711,32 @@ vect_create_addr_base_for_vector_ref (tree stmt,
{ {
stmt_vec_info stmt_info = vinfo_for_stmt (stmt); stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info); struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info);
tree data_ref_base = unshare_expr (DR_BASE_ADDRESS (dr)); tree data_ref_base_expr = unshare_expr (DR_BASE_ADDRESS (dr));
tree base_name = build_fold_indirect_ref (data_ref_base); tree base_name = build_fold_indirect_ref (data_ref_base_expr);
tree data_ref_base_var;
tree data_ref_base;
tree new_base_stmt;
tree vec_stmt; tree vec_stmt;
tree addr_base, addr_expr; tree addr_base, addr_expr;
tree dest, new_stmt; tree dest, new_stmt;
tree base_offset = unshare_expr (DR_OFFSET (dr)); tree base_offset = unshare_expr (DR_OFFSET (dr));
tree init = unshare_expr (DR_INIT (dr)); tree init = unshare_expr (DR_INIT (dr));
tree vect_ptr_type, addr_expr2; tree vect_ptr_type, addr_expr2;
/* Create data_ref_base */
data_ref_base_var = create_tmp_var (TREE_TYPE (data_ref_base_expr), "batmp");
add_referenced_var (data_ref_base_var);
data_ref_base = force_gimple_operand (data_ref_base_expr, &new_base_stmt,
true, data_ref_base_var);
append_to_statement_list_force(new_base_stmt, new_stmt_list);
/* Create base_offset */ /* Create base_offset */
base_offset = size_binop (PLUS_EXPR, base_offset, init); base_offset = size_binop (PLUS_EXPR, base_offset, init);
base_offset = fold_convert (sizetype, base_offset); base_offset = fold_convert (sizetype, base_offset);
dest = create_tmp_var (TREE_TYPE (base_offset), "base_off"); dest = create_tmp_var (TREE_TYPE (base_offset), "base_off");
add_referenced_var (dest); add_referenced_var (dest);
base_offset = force_gimple_operand (base_offset, &new_stmt, false, dest); base_offset = force_gimple_operand (base_offset, &new_stmt, true, dest);
append_to_statement_list_force (new_stmt, new_stmt_list); append_to_statement_list_force (new_stmt, new_stmt_list);
if (offset) if (offset)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment