target.def (autovectorize_vector_sizes): New target hook.

2010-10-07  Richard Guenther  <rguenther@suse.de>

	* target.def (autovectorize_vector_sizes): New target hook.
	* targhooks.c (default_autovectorize_vector_sizes): New function.
	* targhooks.h (default_autovectorize_vector_sizes): Declare.
	* doc/tm.texi.in (TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES):
	Document.
	* doc/tm.texi: Update.
	* config/i386/i386.c (ix86_autovectorize_vector_sizes): New function.
	(TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES): Define.

From-SVN: r165115
This commit is contained in:
Richard Guenther 2010-10-07 14:35:38 +00:00 committed by Richard Biener
parent cc4b517087
commit 767f865fb8
7 changed files with 56 additions and 0 deletions

View file

@ -1,3 +1,14 @@
2010-10-07 Richard Guenther <rguenther@suse.de>
* target.def (autovectorize_vector_sizes): New target hook.
* targhooks.c (default_autovectorize_vector_sizes): New function.
* targhooks.h (default_autovectorize_vector_sizes): Declare.
* doc/tm.texi.in (TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES):
Document.
* doc/tm.texi: Update.
* config/i386/i386.c (ix86_autovectorize_vector_sizes): New function.
(TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES): Define.
2010-10-07 Richard Guenther <rguenther@suse.de>
* target.def (units_per_simd_word): Rename to ...

View file

@ -32993,6 +32993,15 @@ ix86_preferred_simd_mode (enum machine_mode mode)
return word_mode;
}
/* If AVX is enabled then try vectorizing with both 256bit and 128bit
vectors. */
static unsigned int
ix86_autovectorize_vector_sizes (void)
{
return TARGET_AVX ? 32 | 16 : 0;
}
/* Initialize the GCC target structure. */
#undef TARGET_RETURN_IN_MEMORY
#define TARGET_RETURN_IN_MEMORY ix86_return_in_memory
@ -33253,6 +33262,9 @@ ix86_preferred_simd_mode (enum machine_mode mode)
#undef TARGET_VECTORIZE_PREFERRED_SIMD_MODE
#define TARGET_VECTORIZE_PREFERRED_SIMD_MODE \
ix86_preferred_simd_mode
#undef TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES
#define TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES \
ix86_autovectorize_vector_sizes
#undef TARGET_SET_CURRENT_FUNCTION
#define TARGET_SET_CURRENT_FUNCTION ix86_set_current_function

View file

@ -5750,6 +5750,13 @@ equal to @code{word_mode}, because the vectorizer can do some
transformations even in absence of specialized @acronym{SIMD} hardware.
@end deftypefn
@deftypefn {Target Hook} {unsigned int} TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES (void)
This hook should return a mask of sizes that should be iterated over
after trying to autovectorize using the vector size derived from the
mode returned by @code{TARGET_VECTORIZE_PREFERRED_SIMD_MODE}.
The default is zero which means to not iterate over other vector sizes.
@end deftypefn
@node Anchored Addresses
@section Anchored Addresses
@cindex anchored addresses

View file

@ -5748,6 +5748,13 @@ equal to @code{word_mode}, because the vectorizer can do some
transformations even in absence of specialized @acronym{SIMD} hardware.
@end deftypefn
@hook TARGET_VECTORIZE_AUTOVECTORIZE_VECTOR_SIZES
This hook should return a mask of sizes that should be iterated over
after trying to autovectorize using the vector size derived from the
mode returned by @code{TARGET_VECTORIZE_PREFERRED_SIMD_MODE}.
The default is zero which means to not iterate over other vector sizes.
@end deftypefn
@node Anchored Addresses
@section Anchored Addresses
@cindex anchored addresses

View file

@ -889,6 +889,15 @@ DEFHOOK
(enum machine_mode mode),
default_preferred_simd_mode)
/* Returns a mask of vector sizes to iterate over when auto-vectorizing
after processing the preferred one derived from preferred_simd_mode. */
DEFHOOK
(autovectorize_vector_sizes,
"",
unsigned int,
(void),
default_autovectorize_vector_sizes)
HOOK_VECTOR_END (vectorize)
#undef HOOK_PREFIX

View file

@ -985,6 +985,15 @@ default_preferred_simd_mode (enum machine_mode mode ATTRIBUTE_UNUSED)
return word_mode;
}
/* By default only the size derived from the preferred vector mode
is tried. */
unsigned int
default_autovectorize_vector_sizes (void)
{
return 0;
}
/* Determine whether or not a pointer mode is valid. Assume defaults
of ptr_mode or Pmode - can be overridden. */
bool

View file

@ -87,6 +87,7 @@ default_builtin_support_vector_misalignment (enum machine_mode mode,
const_tree,
int, bool);
extern enum machine_mode default_preferred_simd_mode (enum machine_mode mode);
extern unsigned int default_autovectorize_vector_sizes (void);
/* These are here, and not in hooks.[ch], because not all users of
hooks.h include tm.h, and thus we don't have CUMULATIVE_ARGS. */