Commit a0d5cf71 authored by bonzini's avatar bonzini
Browse files

gcc:

2004-04-27  Paolo Bonzini  <bonzini@gnu.org>

	* tree-complex.c (expand_vector_operation): New, extracted from
	expand_vector_operations_1.
	(tree_vec_extract): Build a NOP_EXPR.
	(expand_vec_parallel): Do not care about returning the correct type.
	(expand_vector_operations_1): Call expand_vector_operation.
	Build the VIEW_CONVERT_EXPR on the left side of MODIFY_EXPRs.

	* tree-complex.c (gate_expand_vector_operations): New.
	(pass_lower_vector_ssa): Use it.
	* tree-optimize.c (init_tree_optimization_passes): Include
	pass_lower_vector_ssa.
	* tree-vect-transform.c (vect_min_worthwhile_factor): New.
	(vectorizable_operation): Use it.
	* tree-vectorizer.c (get_vectype_for_scalar_type): Accept
	integer modes for the vector type.

	* defaults.h (UNITS_PER_SIMD_WORD): Default to UNITS_PER_WORD.
	* tree-vect-analyze.c (vect_enhance_data_refs_alignment):
	Do not cope with UNITS_PER_SIMD_WORD == 0.
	* tree-vectorizer.c (get_vectype_for_scalar_type): Check
	if the scalar type is not bigger than UNITS_PER_SIMD_WORD.
	(vectorize_loops): Do not check that UNITS_PER_SIMD_WORD > 0.
	* config/i386/i386.h (UNITS_PER_SIMD_WORD): Default to UNITS_PER_WORD.
	* config/mips/mips.h (UNITS_PER_SIMD_WORD): Likewise.
	* config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Likewise.
	* config/sparc/sparc.h (UNITS_PER_SIMD_WORD): Likewise.

	* config/alpha/alpha.h (UNITS_PER_SIMD_WORD): Remove.
	* config/bfin/bfin.h (UNITS_PER_SIMD_WORD): Remove.
	* config/ia64/ia64.h (UNITS_PER_SIMD_WORD): Remove.

	* doc/tm.texi (UNITS_PER_WORD): Rephrase more accurately.
	(UNITS_PER_SIMD_WORD): New.

gcc/testsuite:
2004-04-27  Paolo Bonzini  <bonzini@gnu.org>

        * gcc.dg/tree-ssa/gen-vect-11.c, gcc.dg/tree-ssa/gen-vect-11a.c,
        gcc.dg/tree-ssa/gen-vect-11b.c, gcc.dg/tree-ssa/gen-vect-11c.c,
        gcc.dg/tree-ssa/gen-vect-2.c, gcc.dg/tree-ssa/gen-vect-25.c,
        gcc.dg/tree-ssa/gen-vect-26.c, gcc.dg/tree-ssa/gen-vect-28.c,
        gcc.dg/tree-ssa/gen-vect-32.c: New.
        * gcc.dg/vect/vect-82.c, gcc.dg/vect/vect-83.c: Fix dg-final.
        * gcc.dg/vect/vect-82_64.c, gcc.dg/vect/vect-83_64.c: Remove xfail,
        don't run on PPC32.

CVS: Enter Log.  Lines beginning with `CVS:' are removed automatically
CVS:
CVS: Committing in .
CVS:
CVS: Modified Files:
CVS: 	tree-complex.c tree-optimize.c tree-vect-analyze.c defaults.h
CVS: 	tree-vect-transform.c tree-vectorizer.c ChangeLog
CVS: 	testsuite/ChangeLog config/alpha/alpha.h config/bfin/bfin.h
CVS: 	config/i386/i386.h config/ia64/ia64.h config/mips/mips.h
CVS: 	config/rs6000/rs6000.h
CVS: 	config/sparc/sparc.h doc/tm.texi
CVS: 	testsuite/gcc.dg/vect/vect-82.c
CVS: 	testsuite/gcc.dg/vect/vect-82_64.c
CVS: 	testsuite/gcc.dg/vect/vect-83.c
CVS: 	testsuite/gcc.dg/vect/vect-83_64.c
CVS: Added Files:
CVS: 	testsuite/gcc.dg/tree-ssa/gen-vect-11.c
CVS: 	testsuite/gcc.dg/tree-ssa/gen-vect-11a.c
CVS: 	testsuite/gcc.dg/tree-ssa/gen-vect-11b.c
CVS: 	testsuite/gcc.dg/tree-ssa/gen-vect-11c.c
CVS: 	testsuite/gcc.dg/tree-ssa/gen-vect-2.c
CVS: 	testsuite/gcc.dg/tree-ssa/gen-vect-25.c
CVS: 	testsuite/gcc.dg/tree-ssa/gen-vect-26.c
CVS: 	testsuite/gcc.dg/tree-ssa/gen-vect-28.c
CVS: 	testsuite/gcc.dg/tree-ssa/gen-vect-32.c
CVS: ----------------------------------------------------------------------


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98818 138bc75d-0d04-0410-961f-82ee72b054a4
parent c5c17bca
2004-04-27 Paolo Bonzini <bonzini@gnu.org>
* tree-complex.c (expand_vector_operation): New, extracted from
expand_vector_operations_1.
(tree_vec_extract): Build a NOP_EXPR.
(expand_vec_parallel): Do not care about returning the correct type.
(expand_vector_operations_1): Call expand_vector_operation.
Build the VIEW_CONVERT_EXPR on the left side of MODIFY_EXPRs.
* tree-complex.c (gate_expand_vector_operations): New.
(pass_lower_vector_ssa): Use it.
* tree-optimize.c (init_tree_optimization_passes): Include
pass_lower_vector_ssa.
* tree-vect-transform.c (vect_min_worthwhile_factor): New.
(vectorizable_operation): Use it.
* tree-vectorizer.c (get_vectype_for_scalar_type): Accept
integer modes for the vector type.
* defaults.h (UNITS_PER_SIMD_WORD): Default to UNITS_PER_WORD.
* tree-vect-analyze.c (vect_enhance_data_refs_alignment):
Do not cope with UNITS_PER_SIMD_WORD == 0.
* tree-vectorizer.c (get_vectype_for_scalar_type): Check
if the scalar type is not bigger than UNITS_PER_SIMD_WORD.
(vectorize_loops): Do not check that UNITS_PER_SIMD_WORD > 0.
* config/i386/i386.h (UNITS_PER_SIMD_WORD): Default to UNITS_PER_WORD.
* config/mips/mips.h (UNITS_PER_SIMD_WORD): Likewise.
* config/rs6000/rs6000.h (UNITS_PER_SIMD_WORD): Likewise.
* config/sparc/sparc.h (UNITS_PER_SIMD_WORD): Likewise.
* config/alpha/alpha.h (UNITS_PER_SIMD_WORD): Remove.
* config/bfin/bfin.h (UNITS_PER_SIMD_WORD): Remove.
* config/ia64/ia64.h (UNITS_PER_SIMD_WORD): Remove.
* doc/tm.texi (UNITS_PER_WORD): Rephrase more accurately.
(UNITS_PER_SIMD_WORD): New.
2005-04-27 Nathan Sidwell <nathan@codesourcery.com>
 
* config/ia64/ia64.c (ia64_encode_addr_area): Use gcc_assert and
......@@ -29,17 +65,38 @@
(INDEX_REGISTER_P): New.
(BASE_REGISTER_P): New.
(indirectable_constant_address_p): New. Adapted from
<<<<<<< ChangeLog
INDIRECTABLE_CONSTANT_ADDRESS_P in vax.h.
Use SYMBOL_REF_LOCAL_P.
=======
INDIRECTABLE_CONSTANT_ADDRESS_P in vax.h. Use SYMBOL_REF_LOCAL_P.
>>>>>>> 2.8478
(indirectable_address_p): New. Adapted from
INDIRECTABLE_ADDRESS_P in vax.h.
(nonindexed_address_p): New. Adapted from
<<<<<<< ChangeLog
GO_IF_NONINDEXED_ADDRESS in vax.h.
(index_temp_p): New. Adapted from
INDEX_TERM_P in vax.h.
(reg_plus_index_p): New. Adapted from
GO_IF_REG_PLUS_INDEX in vax.h.
=======
GO_IF_NONINDEXED_ADDRESS in vax.h.
(index_temp_p): New. Adapted from INDEX_TERM_P in vax.h.
(reg_plus_index_p): New. Adapted from GO_IF_REG_PLUS_INDEX in vax.h.
>>>>>>> 2.8478
(legitimate_address_p): New. Adapted from
<<<<<<< ChangeLog
GO_IF_LEGITIMATE_ADDRESS in vax.h
=======
GO_IF_LEGITIMATE_ADDRESS in vax.h.
>>>>>>> 2.8478
(vax_mode_dependent_address_p): New. Adapted from
<<<<<<< ChangeLog
GO_IF_MODE_DEPENDENT_ADDRESS in vax.h
=======
GO_IF_MODE_DEPENDENT_ADDRESS in vax.h.
>>>>>>> 2.8478
* config/vax/vax.h (CONSTANT_ADDRESS_P): Use
legitimate_constant_address_p.
(CONSTANT_P): Use legitimate_constant_p.
......@@ -48,8 +105,13 @@
(GO_IF_NONINDEXED_ADDRESS): Removed.
(INDEX_TEMP_P): Removed.
(GO_IF_REG_PLUS_INDEX): Removed.
<<<<<<< ChangeLog
(GO_IF_LEGITIMATE_ADDRESS): Use legitimate_address_p.
Two definitions, depending on whether REG_OK_STRICT is defined.
=======
(GO_IF_LEGITIMATE_ADDRESS): Use legitimate_address_p. Two
definitions, depending on whether REG_OK_STRICT is defined.
>>>>>>> 2.8478
(GO_IF_MODE_DEPENDENT_ADDRESS): Use vax_mode_dependent_address_p.
Two definitions, depending on whether REG_OK_STRICT is defined.
* config/vax/vax-protos.h (legitimate_constant_address_p): Prototype
......
......@@ -394,9 +394,6 @@ extern int alpha_tls_size;
#define SLOW_UNALIGNED_ACCESS(MODE, ALIGN) 1
/* Our SIMD is all done on single integer registers. */
#define UNITS_PER_SIMD_WORD UNITS_PER_WORD
/* Standard register usage. */
/* Number of actual hardware registers.
......
......@@ -773,9 +773,6 @@ do { \
/* Width of a word, in units (bytes). */
#define UNITS_PER_WORD 4
/* Size of a vector for autovectorization. */
#define UNITS_PER_SIMD_WORD 4
/* Width in bits of a pointer.
See also the macro `Pmode1' defined below. */
#define POINTER_SIZE 32
......
......@@ -836,7 +836,7 @@ do { \
/* ??? No autovectorization into MMX or 3DNOW until we can reliably
place emms and femms instructions. */
#define UNITS_PER_SIMD_WORD (TARGET_SSE ? 16 : 0)
#define UNITS_PER_SIMD_WORD (TARGET_SSE ? 16 : UNITS_PER_WORD)
#define VALID_FP_MODE_P(MODE) \
((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode \
......
......@@ -168,8 +168,6 @@ extern enum processor_type ia64_tune;
#define UNITS_PER_WORD 8
#define UNITS_PER_SIMD_WORD UNITS_PER_WORD
#define POINTER_SIZE (TARGET_ILP32 ? 32 : 64)
/* A C expression whose value is zero if pointers that need to be extended
......
......@@ -966,7 +966,7 @@ extern const struct mips_cpu_info *mips_tune_info;
/* The number of bytes in a double. */
#define UNITS_PER_DOUBLE (TYPE_PRECISION (double_type_node) / BITS_PER_UNIT)
#define UNITS_PER_SIMD_WORD (TARGET_PAIRED_SINGLE_FLOAT ? 8 : 0)
#define UNITS_PER_SIMD_WORD (TARGET_PAIRED_SINGLE_FLOAT ? 8 : UNITS_PER_WORD)
/* Set the sizes of the core types. */
#define SHORT_TYPE_SIZE 16
......
......@@ -1043,8 +1043,9 @@ extern const char *rs6000_warn_altivec_long_switch;
|| (MODE) == V1DImode \
|| (MODE) == V2SImode)
#define UNITS_PER_SIMD_WORD \
(TARGET_ALTIVEC ? 16 : (TARGET_SPE ? 8 : 0) )
#define UNITS_PER_SIMD_WORD \
(TARGET_ALTIVEC ? UNITS_PER_ALTIVEC_WORD \
: (TARGET_SPE ? UNITS_PER_SPE_WORD : UNITS_PER_WORD))
/* Value is TRUE if hard register REGNO can hold a value of
machine-mode MODE. */
......
......@@ -588,7 +588,7 @@ extern struct sparc_cpu_select sparc_select[];
#define MIN_UNITS_PER_WORD 4
#endif
#define UNITS_PER_SIMD_WORD (TARGET_VIS ? 8 : 0)
#define UNITS_PER_SIMD_WORD (TARGET_VIS ? 8 : UNITS_PER_WORD)
/* Now define the sizes of the C data types. */
......
......@@ -702,8 +702,10 @@ do { fputs (integer_asm_op (POINTER_SIZE / BITS_PER_UNIT, TRUE), FILE); \
#define HAS_LONG_UNCOND_BRANCH 0
#endif
/* By default, only attempt to parallelize bitwise operations, and
possibly adds/subtracts using bit-twiddling. */
#ifndef UNITS_PER_SIMD_WORD
#define UNITS_PER_SIMD_WORD 0
#define UNITS_PER_SIMD_WORD UNITS_PER_WORD
#endif
/* Determine whether __cxa_atexit, rather than atexit, is used to
......
......@@ -1076,7 +1076,8 @@ largest value that @code{BITS_PER_WORD} can have at run-time.
@end defmac
@defmac UNITS_PER_WORD
Number of storage units in a word; normally 4.
Number of storage units in a word; normally the size of a general-purpose
register, a power of two from 1 or 8.
@end defmac
@defmac MIN_UNITS_PER_WORD
......@@ -1085,6 +1086,13 @@ Minimum number of units in a word. If this is undefined, the default is
smallest value that @code{UNITS_PER_WORD} can have at run-time.
@end defmac
@defmac UNITS_PER_SIMD_WORD
Number of units in the vectors that the vectorizer can produce.
The default is equal to @code{UNITS_PER_WORD}, because the vectorizer
can do some transformations even in absence of specialized @acronym{SIMD}
hardware.
@end defmac
@defmac POINTER_SIZE
Width of a pointer, in bits. You must specify a value no wider than the
width of @code{Pmode}. If it is not equal to the width of @code{Pmode},
......
2004-04-27 Paolo Bonzini <bonzini@gnu.org>
* gcc.dg/tree-ssa/gen-vect-11.c, gcc.dg/tree-ssa/gen-vect-11a.c,
gcc.dg/tree-ssa/gen-vect-11b.c, gcc.dg/tree-ssa/gen-vect-11c.c,
gcc.dg/tree-ssa/gen-vect-2.c, gcc.dg/tree-ssa/gen-vect-25.c,
gcc.dg/tree-ssa/gen-vect-26.c, gcc.dg/tree-ssa/gen-vect-28.c,
gcc.dg/tree-ssa/gen-vect-32.c: New.
* gcc.dg/vect/vect-82.c, gcc.dg/vect/vect-83.c: Fix dg-final.
* gcc.dg/vect/vect-82_64.c, gcc.dg/vect/vect-83_64.c: Remove xfail,
don't run on PPC32.
2005-04-27 Joseph S. Myers <joseph@codesourcery.com>
 
PR c/21213
......
/* { dg-do run } */
/* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=3 -fdump-tree-vect-stats" } */
#include <stdlib.h>
#define N 16
int main ()
{
int i;
char ia[N];
char ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
char ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
for (i = 0; i < N; i++)
{
ia[i] = ib[i] + ic[i];
}
/* check results: */
for (i = 0; i < N; i++)
{
if (ia[i] != ib[i] + ic[i])
abort ();
}
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
/* { dg-do run } */
/* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=3 -fdump-tree-vect-stats" } */
#include <stdlib.h>
#define N 16
#if __LONG_MAX__ == 2147483647
typedef short half_word;
#else
typedef int half_word;
#endif
int main ()
{
int i;
half_word ia[N];
half_word ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
half_word ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
for (i = 0; i < N; i++)
{
ia[i] = ib[i] & ic[i];
}
/* check results: */
for (i = 0; i < N; i++)
{
if (ia[i] != ib[i] & ic[i])
abort ();
}
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
/* { dg-do run } */
/* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=3 -fdump-tree-vect-stats" } */
#include <stdlib.h>
#define N 16
int main ()
{
int i;
char ia[N];
char ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
char ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
/* Not vectorizable, multiplication */
for (i = 0; i < N; i++)
{
ia[i] = ib[i] * ic[i];
}
/* check results: */
for (i = 0; i < N; i++)
{
if (ia[i] != (char) (ib[i] * ic[i]))
abort ();
}
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
/* { dg-do run } */
/* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=3 -fdump-tree-vect-stats" } */
#include <stdlib.h>
#define N 16
#if LONG_MAX == 2147483647
typedef short half_word;
#else
typedef int half_word;
#endif
int main ()
{
int i;
half_word ia[N];
half_word ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
half_word ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
/* Not worthwhile, only 2 parts per int */
for (i = 0; i < N; i++)
{
ia[i] = ib[i] + ic[i];
}
/* check results: */
for (i = 0; i < N; i++)
{
if (ia[i] != ib[i] + ic[i])
abort ();
}
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
/* { dg-do run } */
/* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=3 -fdump-tree-vect-stats" } */
#include <stdlib.h>
#define N 16
#if __LONG_MAX__ == 2147483647
typedef short half_word;
#else
typedef int half_word;
#endif
int main ()
{
half_word cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
half_word ca[N];
int i;
for (i = 0; i < N; i++)
{
ca[i] = cb[i];
}
/* check results: */
for (i = 0; i < N; i++)
{
if (ca[i] != cb[i])
abort ();
}
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
/* { dg-do run } */
/* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=3 -fdump-tree-vect-stats" } */
#include <stdlib.h>
#define N 128
#if __LONG_MAX__ == 2147483647
typedef short half_word;
#else
typedef int half_word;
#endif
int main (int n, int *p)
{
int i;
half_word ib[N];
half_word ia[N];
int k;
for (i = 0; i < N; i++)
{
ia[i] = n;
}
/* check results: */
for (i = 0; i < N; i++)
{
if (ia[i] != n)
abort ();
}
k = *p;
for (i = 0; i < N; i++)
{
ib[i] = k;
}
/* check results: */
for (i = 0; i < N; i++)
{
if (ib[i] != k)
abort ();
}
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
/* { dg-do run } */
/* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=3 -fdump-tree-vect-stats" } */
#include <stdlib.h>
#define N 128
/* unaligned store. */
int main ()
{
int i;
char ia[N+1];
for (i = 1; i <= N; i++)
{
ia[i] = 5;
}
/* check results: */
for (i = 1; i <= N; i++)
{
if (ia[i] != 5)
abort ();
}
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
/* { dg-do run } */
/* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=3 -fdump-tree-vect-stats" } */
#include <stdlib.h>
#define N 128
#define OFF 3
/* unaligned store. */
int main (int off)
{
int i;
char ia[N+OFF];
for (i = 0; i < N; i++)
{
ia[i+off] = 5;
}
/* check results: */
for (i = 0; i < N; i++)
{
if (ia[i+off] != 5)
abort ();
}
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
/* { dg-do run } */
/* { dg-options "-O2 -ftree-vectorize -ftree-vectorizer-verbose=3 -fdump-tree-vect-stats" } */
#include <stdlib.h>
#define N 16
int main ()
{
struct {
char ca[N];
} s;
int i;
for (i = 0; i < N; i++)
{
s.ca[i] = 5;
}
/* check results: */
for (i = 0; i < N; i++)
{
if (s.ca[i] != 5)
abort ();
}
return 0;
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
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