Commit f0923257 by Dorit Naishlos Committed by Dorit Nuzman

tree-vectorizer.c (get_vectype_for_scalar_type): Added debug prinouts.

        * tree-vectorizer.c (get_vectype_for_scalar_type): Added debug prinouts.
        Added check that vectype is VECTOR_MODE_P, instead of check for BLKmode.
        (vect_analyze_operations): Make sure the vectorization factor > 1. Add
        gcc_assert under ENABLE_CHECKING.
        (vectorizable_operation): Remove check for VECTOR_MODE_P (moved to
        get_vectype_for_scalar_type).

        (vect_get_vec_def_for_operand): Remove redundant variables.
        (vect_transform_loop): Likewise.

From-SVN: r89032
parent a2503645
2004-10-14 Dorit Naishlos <dorit@il.bim.com>
* tree-vectorizer.c (get_vectype_for_scalar_type): Added debug prinouts.
Added check that vectype is VECTOR_MODE_P, instead of check for BLKmode.
(vect_analyze_operations): Make sure the vectorization factor > 1. Add
gcc_assert under ENABLE_CHECKING.
(vectorizable_operation): Remove check for VECTOR_MODE_P (moved to
get_vectype_for_scalar_type).
(vect_get_vec_def_for_operand): Remove redundant variables.
(vect_transform_loop): Likewise.
2004-10-14 Richard Sandiford <rsandifo@redhat.com> 2004-10-14 Richard Sandiford <rsandifo@redhat.com>
* config/arm/arm.h (CONDITIONAL_REGISTER_USAGE): Make r11 fixed and * config/arm/arm.h (CONDITIONAL_REGISTER_USAGE): Make r11 fixed and
......
2004-10-14 Dorit Naishlos <dorit@il.ibm.com>
* gcc.dg/vect/vect-82.c: New testcase.
* gcc.dg/vect/vect-82_64.c: New testcase.
* gcc.dg/vect/vect-83.c: New testcase.
* gcc.dg/vect/vect-83_64.c: New testcase.
2004-10-14 Joseph S. Myers <jsm@polyomino.org.uk> 2004-10-14 Joseph S. Myers <jsm@polyomino.org.uk>
* gcc.dg/cpp/error-1.c: New test. * gcc.dg/cpp/error-1.c: New test.
......
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
int main1 ()
{
long long unsigned int ca[N];
int i;
for (i = 0; i < N; i++)
{
ca[i] = 0;
}
/* check results: */
for (i = 0; i < N; i++)
{
if (ca[i] != 0)
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -mpowerpc64 -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
int main1 ()
{
long long unsigned int ca[N];
int i;
for (i = 0; i < N; i++)
{
ca[i] = 0;
}
/* check results: */
for (i = 0; i < N; i++)
{
if (ca[i] != 0)
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
int main1 ()
{
long long unsigned int ca[N];
int i;
for (i = 0; i < N; i++)
{
ca[i] = 2;
}
/* check results: */
for (i = 0; i < N; i++)
{
if (ca[i] != 2)
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */
/* { dg-do run { target powerpc*-*-* } } */
/* { dg-options "-O2 -ftree-vectorize -mpowerpc64 -fdump-tree-vect-stats -maltivec" { target powerpc*-*-* } } */
#include <stdarg.h>
#include "tree-vect.h"
#define N 16
int main1 ()
{
long long unsigned int ca[N];
int i;
for (i = 0; i < N; i++)
{
ca[i] = 2;
}
/* check results: */
for (i = 0; i < N; i++)
{
if (ca[i] != 2)
abort ();
}
return 0;
}
int main (void)
{
check_vect ();
return main1 ();
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */
...@@ -848,8 +848,31 @@ get_vectype_for_scalar_type (tree scalar_type) ...@@ -848,8 +848,31 @@ get_vectype_for_scalar_type (tree scalar_type)
nunits = UNITS_PER_SIMD_WORD / nbytes; nunits = UNITS_PER_SIMD_WORD / nbytes;
vectype = build_vector_type (scalar_type, nunits); vectype = build_vector_type (scalar_type, nunits);
if (TYPE_MODE (vectype) == BLKmode) if (vect_debug_details (NULL))
{
fprintf (dump_file, "get vectype with %d units of type ", nunits);
print_generic_expr (dump_file, scalar_type, TDF_SLIM);
}
if (!vectype)
return NULL_TREE; return NULL_TREE;
if (vect_debug_details (NULL))
{
fprintf (dump_file, "vectype: ");
print_generic_expr (dump_file, vectype, TDF_SLIM);
}
if (!VECTOR_MODE_P (TYPE_MODE (vectype)))
{
/* TODO: tree-complex.c sometimes can parallelize operations
on generic vectors. We can vectorize the loop in that case,
but then we should re-run the lowering pass. */
if (vect_debug_details (NULL))
fprintf (dump_file, "mode not supported by target.");
return NULL_TREE;
}
return vectype; return vectype;
} }
...@@ -1157,11 +1180,6 @@ vect_get_vec_def_for_operand (tree op, tree stmt) ...@@ -1157,11 +1180,6 @@ vect_get_vec_def_for_operand (tree op, tree stmt)
/* Create 'vect_cst_ = {cst,cst,...,cst}' */ /* Create 'vect_cst_ = {cst,cst,...,cst}' */
tree vec_cst; tree vec_cst;
stmt_vec_info stmt_vinfo = vinfo_for_stmt (stmt);
tree vectype = STMT_VINFO_VECTYPE (stmt_vinfo);
int nunits = GET_MODE_NUNITS (TYPE_MODE (vectype));
tree t = NULL_TREE;
int i;
/* Build a tree with vector elements. */ /* Build a tree with vector elements. */
if (vect_debug_details (NULL)) if (vect_debug_details (NULL))
...@@ -1408,16 +1426,6 @@ vectorizable_operation (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt) ...@@ -1408,16 +1426,6 @@ vectorizable_operation (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
return false; return false;
} }
vec_mode = TYPE_MODE (vectype); vec_mode = TYPE_MODE (vectype);
if (!VECTOR_MODE_P (vec_mode))
{
/* TODO: tree-complex.c sometimes can parallelize operations
on generic vectors. We can vectorize the loop in that case,
but then we should re-run the lowering pass. */
if (vect_debug_details (NULL))
fprintf (dump_file, "mode not supported by target.");
return false;
}
if (optab->handlers[(int) vec_mode].insn_code == CODE_FOR_nothing) if (optab->handlers[(int) vec_mode].insn_code == CODE_FOR_nothing)
{ {
if (vect_debug_details (NULL)) if (vect_debug_details (NULL))
...@@ -1905,9 +1913,6 @@ vect_transform_loop (loop_vec_info loop_vinfo, ...@@ -1905,9 +1913,6 @@ vect_transform_loop (loop_vec_info loop_vinfo,
tree stmt = bsi_stmt (si); tree stmt = bsi_stmt (si);
stmt_vec_info stmt_info; stmt_vec_info stmt_info;
bool is_store; bool is_store;
#ifdef ENABLE_CHECKING
tree vectype;
#endif
if (vect_debug_details (NULL)) if (vect_debug_details (NULL))
{ {
...@@ -1924,8 +1929,7 @@ vect_transform_loop (loop_vec_info loop_vinfo, ...@@ -1924,8 +1929,7 @@ vect_transform_loop (loop_vec_info loop_vinfo,
#ifdef ENABLE_CHECKING #ifdef ENABLE_CHECKING
/* FORNOW: Verify that all stmts operate on the same number of /* FORNOW: Verify that all stmts operate on the same number of
units and no inner unrolling is necessary. */ units and no inner unrolling is necessary. */
vectype = STMT_VINFO_VECTYPE (stmt_info); gcc_assert (GET_MODE_NUNITS (TYPE_MODE (STMT_VINFO_VECTYPE (stmt_info)))
gcc_assert (GET_MODE_NUNITS (TYPE_MODE (vectype))
== vectorization_factor); == vectorization_factor);
#endif #endif
/* -------- vectorize statement ------------ */ /* -------- vectorize statement ------------ */
...@@ -2155,11 +2159,17 @@ vect_analyze_operations (loop_vec_info loop_vinfo) ...@@ -2155,11 +2159,17 @@ vect_analyze_operations (loop_vec_info loop_vinfo)
} }
else else
vectorization_factor = nunits; vectorization_factor = nunits;
#ifdef ENABLE_CHECKING
gcc_assert (GET_MODE_SIZE (TYPE_MODE (scalar_type))
* vectorization_factor == UNITS_PER_SIMD_WORD);
#endif
} }
} }
/* TODO: Analyze cost. Decide if worth while to vectorize. */ /* TODO: Analyze cost. Decide if worth while to vectorize. */
if (!vectorization_factor)
if (vectorization_factor <= 1)
{ {
if (vect_debug_stats (loop) || vect_debug_details (loop)) if (vect_debug_stats (loop) || vect_debug_details (loop))
fprintf (dump_file, "not vectorized: unsupported data-type"); fprintf (dump_file, "not vectorized: unsupported data-type");
......
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