* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165115
138bc75d-0d04-0410-961f-
82ee72b054a4
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 ...
(preferred_simd_mode): ... this. Return mode instead of size.
* targhooks.c (default_units_per_simd_word): Rename to ...
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
#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
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
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
(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
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
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. */