2010-10-07 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 7 Oct 2010 14:35:38 +0000 (14:35 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 7 Oct 2010 14:35:38 +0000 (14:35 +0000)
* 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

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/doc/tm.texi
gcc/doc/tm.texi.in
gcc/target.def
gcc/targhooks.c
gcc/targhooks.h

index 20df6bb..94eada1 100644 (file)
@@ -1,5 +1,16 @@
 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 ...
index 74ded78..39308cf 100644 (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
index afa1971..faa7250 100644 (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
index 8489027..cdd9a22 100644 (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
index f104ae8..266870a 100644 (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
index 0a65b2a..9d7ebc0 100644 (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
index a705d7e..920c918 100644 (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.  */