]> gcc.gnu.org Git - gcc.git/commitdiff
common.opt: Introduced a new option -fsimd-cost-model.
authorSergey Ostanevich <sergos.gnu@gmail.com>
Thu, 28 Nov 2013 07:54:58 +0000 (07:54 +0000)
committerKirill Yukhin <kyukhin@gcc.gnu.org>
Thu, 28 Nov 2013 07:54:58 +0000 (07:54 +0000)
gcc/
* common.opt: Introduced a new option -fsimd-cost-model.
* doc/invoke.texi: Introduced a new openmp-simd warning and
a new -fsimd-cost-model option.
* tree-vectorizer.h (unlimited_cost_model): Interface updated
to rely on the particular loop info.
* tree-vect-data-refs.c (vect_peeling_hash_insert): Ditto.
(vect_peeling_hash_choose_best_peeling): Ditto.
(vect_enhance_data_refs_alignment): Ditto.
* tree-vect-slp.c (vect_slp_analyze_bb_1): Ditto.
* tree-vect-loop.c (vect_estimate_min_profitable_iters): Ditto
plus added openmp-simd warining.

gcc/c-family/
* c.opt (Wopenmp-simd): New.

gcc/fortran/
* lang.opt (Wopenmp-simd): New.

From-SVN: r205475

gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c.opt
gcc/common.opt
gcc/doc/invoke.texi
gcc/fortran/ChangeLog
gcc/fortran/lang.opt
gcc/tree-vect-data-refs.c
gcc/tree-vect-loop.c
gcc/tree-vect-slp.c
gcc/tree-vectorizer.h

index 037335e661cd7b1cd811a7071aa60dd6dcce50df..e280c2484f59274311e1864d3a144ecca6ca5513 100644 (file)
@@ -1,3 +1,17 @@
+2013-11-28  Sergey Ostanevich  <sergos.gnu@gmail.com>
+
+       * common.opt: Introduced a new option -fsimd-cost-model.
+       * doc/invoke.texi: Introduced a new openmp-simd warning and
+       a new -fsimd-cost-model option.
+       * tree-vectorizer.h (unlimited_cost_model): Interface updated
+       to rely on the particular loop info.
+       * tree-vect-data-refs.c (vect_peeling_hash_insert): Ditto.
+       (vect_peeling_hash_choose_best_peeling): Ditto.
+       (vect_enhance_data_refs_alignment): Ditto.
+       * tree-vect-slp.c (vect_slp_analyze_bb_1): Ditto.
+       * tree-vect-loop.c (vect_estimate_min_profitable_iters): Ditto
+       plus added openmp-simd warining.
+
 2013-11-27   H.J. Lu  <hongjiu.lu@intel.com>
 
        PR rtl-optimization/59311
index 43c4dad09458ba62134772b71ea5744d711aed7c..f4e09381e72f306d7da7a8993acbcebfe98763bf 100644 (file)
@@ -1,3 +1,7 @@
+2013-11-28  Sergey Ostanevich  <sergos.gnu@gmail.com>
+
+       * c.opt (Wopenmp-simd): New.
+
 2013-11-22  Jakub Jelinek  <jakub@redhat.com>
 
        * c-ubsan.h (ubsan_instrument_return): New prototype.
index ac6788554148961596b52bba32bdf1da70be8075..2e9a3df0a874092f978d3d02990234a38e3f3841 100644 (file)
@@ -596,6 +596,10 @@ Wold-style-definition
 C ObjC Var(warn_old_style_definition) Warning
 Warn if an old-style parameter definition is used
 
+Wopenmp-simd
+C C++ Var(warn_openmp_simd) Warning LangEnabledBy(C C++,Wall)
+Warn if a simd directive is overridden by the vectorizer cost model
+
 Woverlength-strings
 C ObjC C++ ObjC++ Var(warn_overlength_strings) Warning LangEnabledBy(C ObjC C++ ObjC++,Wpedantic)
 Warn if a string is longer than the maximum portable length specified by the standard
index a7af6369103cfe94c1a0e1d9c20994539188e9b8..9ece68324672c816096cda94402b63c5556bf2fb 100644 (file)
@@ -2300,6 +2300,10 @@ fvect-cost-model=
 Common Joined RejectNegative Enum(vect_cost_model) Var(flag_vect_cost_model) Init(VECT_COST_MODEL_DEFAULT)
 Specifies the cost model for vectorization
  
+fsimd-cost-model=
+Common Joined RejectNegative Enum(vect_cost_model) Var(flag_simd_cost_model) Init(VECT_COST_MODEL_UNLIMITED)
+Specifies the vectorization cost model for code marked with a simd directive
+
 Enum
 Name(vect_cost_model) Type(enum vect_cost_model) UnknownError(unknown vectorizer cost model %qs)
 
index 466eee0a91c3078997f0d5b4c16014e738123fbd..2d074a2d52a6ab647801f6f264de2a252ffafbc3 100644 (file)
@@ -256,7 +256,7 @@ Objective-C and Objective-C++ Dialects}.
 -Wlogical-op -Wlong-long @gol
 -Wmain -Wmaybe-uninitialized -Wmissing-braces  -Wmissing-field-initializers @gol
 -Wmissing-include-dirs @gol
--Wno-multichar  -Wnonnull  -Wno-overflow @gol
+-Wno-multichar  -Wnonnull  -Wno-overflow -Wopenmp-simd @gol
 -Woverlength-strings  -Wpacked  -Wpacked-bitfield-compat  -Wpadded @gol
 -Wparentheses  -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
 -Wpointer-arith  -Wno-pointer-to-int-cast @gol
@@ -3321,6 +3321,7 @@ Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
 -Wmaybe-uninitialized @gol
 -Wmissing-braces @r{(only for C/ObjC)} @gol
 -Wnonnull  @gol
+-Wopenmp-simd @gol
 -Wparentheses  @gol
 -Wpointer-sign  @gol
 -Wreorder   @gol
@@ -4815,6 +4816,12 @@ attribute.
 @opindex Woverflow
 Do not warn about compile-time overflow in constant expressions.
 
+@item -Wopenmp-simd
+@opindex Wopenm-simd
+Warn if the vectorizer cost model overrides the OpenMP or the Cilk Plus
+simd directive set by user.  The @option{-fsimd-cost-model=unlimited} can
+be used to relax the cost model.
+
 @item -Woverride-init @r{(C and Objective-C only)}
 @opindex Woverride-init
 @opindex Wno-override-init
@@ -8071,6 +8078,14 @@ is equal to the @code{dynamic} model.
 The default cost model depends on other optimization flags and is
 either @code{dynamic} or @code{cheap}.
 
+@item -fsimd-cost-model=@var{model}
+@opindex fsimd-cost-model
+Alter the cost model used for vectorization of loops marked with the OpenMP
+or Cilk Plus simd directive.  The @var{model} argument should be one of
+@code{unlimited}, @code{dynamic}, @code{cheap}.  All values of @var{model}
+have the same meaning as described in @option{-fvect-cost-model} and by
+default a cost model defined with @option{-fvect-cost-model} is used.
+
 @item -ftree-vrp
 @opindex ftree-vrp
 Perform Value Range Propagation on trees.  This is similar to the
index 4ac92423102d2e7c6f4102621af0913c577227e2..124a45894f09f6da75a102143680d4b0ef3cfce8 100644 (file)
@@ -1,3 +1,7 @@
+2013-11-28  Sergey Ostanevich  <sergos.gnu@gmail.com>
+
+       * lang.opt (Wopenmp-simd): New.
+
 2013-11-25  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/59143
index 5e09cbd1459223c71044256e2e35d30eaca6d735..0d328c84a6359e00208aa7ce597402c75f1a3273 100644 (file)
@@ -257,6 +257,10 @@ Wintrinsics-std
 Fortran Warning
 Warn on intrinsics not part of the selected standard
 
+Wopenmp-simd
+Fortran
+; Documented in C
+
 Wreal-q-constant
 Fortran Warning
 Warn about real-literal-constants with 'q' exponent-letter
index 76a3563f397dc43d02707963d6f386b37bbb075b..87d151f836dfc2c11971c8955fb11fee7dd43777 100644 (file)
@@ -1097,7 +1097,8 @@ vect_peeling_hash_insert (loop_vec_info loop_vinfo, struct data_reference *dr,
       *new_slot = slot;
     }
 
-  if (!supportable_dr_alignment && unlimited_cost_model ())
+  if (!supportable_dr_alignment
+      && unlimited_cost_model (LOOP_VINFO_LOOP (loop_vinfo)))
     slot->count += VECT_MAX_COST;
 }
 
@@ -1207,7 +1208,7 @@ vect_peeling_hash_choose_best_peeling (loop_vec_info loop_vinfo,
    res.peel_info.dr = NULL;
    res.body_cost_vec = stmt_vector_for_cost ();
 
-   if (!unlimited_cost_model ())
+   if (!unlimited_cost_model (LOOP_VINFO_LOOP (loop_vinfo)))
      {
        res.inside_cost = INT_MAX;
        res.outside_cost = INT_MAX;
@@ -1436,7 +1437,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
                  vectorization factor.
                  We do this automtically for cost model, since we calculate cost
                  for every peeling option.  */
-              if (unlimited_cost_model ())
+              if (unlimited_cost_model (LOOP_VINFO_LOOP (loop_vinfo)))
                 possible_npeel_number = vf /nelements;
 
               /* Handle the aligned case. We may decide to align some other
@@ -1444,7 +1445,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
               if (DR_MISALIGNMENT (dr) == 0)
                 {
                   npeel_tmp = 0;
-                  if (unlimited_cost_model ())
+                  if (unlimited_cost_model (LOOP_VINFO_LOOP (loop_vinfo)))
                     possible_npeel_number++;
                 }
 
index 42a78de326521f83aba92a8fd747f5108beca7c6..25bf334edf807c217b070427cf20bbd6abb4f135 100644 (file)
@@ -2716,7 +2716,7 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo,
   void *target_cost_data = LOOP_VINFO_TARGET_COST_DATA (loop_vinfo);
 
   /* Cost model disabled.  */
-  if (unlimited_cost_model ())
+  if (unlimited_cost_model (LOOP_VINFO_LOOP (loop_vinfo)))
     {
       dump_printf_loc (MSG_NOTE, vect_location, "cost model disabled.\n");
       *ret_min_profitable_niters = 0;
@@ -2949,6 +2949,10 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo,
   /* vector version will never be profitable.  */
   else
     {
+      if (LOOP_VINFO_LOOP (loop_vinfo)->force_vect)
+       warning_at (vect_location, OPT_Wopenmp_simd, "vectorization "
+                   "did not happen for a simd loop");
+
       if (dump_enabled_p ())
         dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
                         "cost model: the vector iteration cost = %d "
index 680a6d8e54791c683e79ca60afd032aeace63a85..2387c0d9dfc39c9e7e395dfeb6c5238ca8510bb7 100644 (file)
@@ -2176,7 +2176,7 @@ vect_slp_analyze_bb_1 (basic_block bb)
     }
 
   /* Cost model: check if the vectorization is worthwhile.  */
-  if (!unlimited_cost_model ()
+  if (!unlimited_cost_model (NULL)
       && !vect_bb_vectorization_profitable_p (bb_vinfo))
     {
       if (dump_enabled_p ())
index 39d7d41c65e0f713b99f08731a81d1ab9d772b74..4427d6a7b335049441ca889e19149a022f29d5b0 100644 (file)
@@ -915,9 +915,12 @@ known_alignment_for_access_p (struct data_reference *data_ref_info)
 
 /* Return true if the vect cost model is unlimited.  */
 static inline bool
-unlimited_cost_model ()
+unlimited_cost_model (loop_p loop)
 {
-  return flag_vect_cost_model == VECT_COST_MODEL_UNLIMITED;
+  if (loop != NULL && loop->force_vect
+      && flag_simd_cost_model != VECT_COST_MODEL_DEFAULT)
+    return flag_simd_cost_model == VECT_COST_MODEL_UNLIMITED;
+  return (flag_vect_cost_model == VECT_COST_MODEL_UNLIMITED);
 }
 
 /* Source location */
This page took 0.158393 seconds and 5 git commands to generate.