diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/gcc.dg/gomp/simd-2.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/gomp/simd-3.c | 2 | ||||
-rw-r--r-- | gcc/tree-vect-data-refs.c | 10 | ||||
-rw-r--r-- | gcc/tree-vect-loop.c | 4 | ||||
-rw-r--r-- | gcc/tree-vectorizer.h | 16 |
5 files changed, 22 insertions, 12 deletions
diff --git a/gcc/testsuite/gcc.dg/gomp/simd-2.c b/gcc/testsuite/gcc.dg/gomp/simd-2.c index f491212..85acb98 100644 --- a/gcc/testsuite/gcc.dg/gomp/simd-2.c +++ b/gcc/testsuite/gcc.dg/gomp/simd-2.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */ +/* { dg-options "-O2 -fopenmp -fdump-tree-vect-details" } */ /* { dg-additional-options "-msse2" { target { i?86-*-* x86_64-*-* } } } */ /* { dg-additional-options "-mavx" { target avx } } */ /* { dg-final { scan-tree-dump-times "vectorized \[1-9]\[0-9]* loops in function" 5 "vect" { target i?86-*-* x86_64-*-* aarch64-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/gomp/simd-3.c b/gcc/testsuite/gcc.dg/gomp/simd-3.c index c75060c..86fee85 100644 --- a/gcc/testsuite/gcc.dg/gomp/simd-3.c +++ b/gcc/testsuite/gcc.dg/gomp/simd-3.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fopenmp -fvect-cost-model=cheap -fdump-tree-vect-details" } */ +/* { dg-options "-O2 -fopenmp -fdump-tree-vect-details" } */ /* { dg-additional-options "-msse2" { target { i?86-*-* x86_64-*-* } } } */ /* { dg-additional-options "-mavx" { target avx } } */ /* { dg-final { scan-tree-dump-times "vectorized \[1-9]\[0-9]* loops in function" 5 "vect" { target i?86-*-* x86_64-*-* aarch64-*-* } } } */ diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 07b5ba1..1e13148 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -2236,7 +2236,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) { unsigned max_allowed_peel = param_vect_max_peeling_for_alignment; - if (flag_vect_cost_model <= VECT_COST_MODEL_CHEAP) + if (loop_cost_model (loop) <= VECT_COST_MODEL_CHEAP) max_allowed_peel = 0; if (max_allowed_peel != (unsigned)-1) { @@ -2334,7 +2334,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) do_versioning = (optimize_loop_nest_for_speed_p (loop) && !loop->inner /* FORNOW */ - && flag_vect_cost_model > VECT_COST_MODEL_CHEAP); + && loop_cost_model (loop) > VECT_COST_MODEL_CHEAP); if (do_versioning) { @@ -3751,7 +3751,9 @@ vect_prune_runtime_alias_test_list (loop_vec_info loop_vinfo) unsigned int count = (comp_alias_ddrs.length () + check_unequal_addrs.length ()); - if (count && flag_vect_cost_model == VECT_COST_MODEL_VERY_CHEAP) + if (count + && (loop_cost_model (LOOP_VINFO_LOOP (loop_vinfo)) + == VECT_COST_MODEL_VERY_CHEAP)) return opt_result::failure_at (vect_location, "would need a runtime alias check\n"); @@ -3760,7 +3762,7 @@ vect_prune_runtime_alias_test_list (loop_vec_info loop_vinfo) "improved number of alias checks from %d to %d\n", may_alias_ddrs.length (), count); unsigned limit = param_vect_max_version_for_alias_checks; - if (flag_simd_cost_model == VECT_COST_MODEL_CHEAP) + if (loop_cost_model (LOOP_VINFO_LOOP (loop_vinfo)) == VECT_COST_MODEL_CHEAP) limit = param_vect_max_version_for_alias_checks * 6 / 10; if (count > limit) return opt_result::failure_at diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index e94356d..961c162 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -1850,7 +1850,7 @@ vect_analyze_loop_costing (loop_vec_info loop_vinfo) /* If using the "very cheap" model. reject cases in which we'd keep a copy of the scalar code (even if we might be able to vectorize it). */ - if (flag_vect_cost_model == VECT_COST_MODEL_VERY_CHEAP + if (loop_cost_model (loop) == VECT_COST_MODEL_VERY_CHEAP && (LOOP_VINFO_PEELING_FOR_ALIGNMENT (loop_vinfo) || LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo) || LOOP_VINFO_PEELING_FOR_NITER (loop_vinfo))) @@ -1922,7 +1922,7 @@ vect_analyze_loop_costing (loop_vec_info loop_vinfo) /* If the vector loop needs multiple iterations to be beneficial then things are probably too close to call, and the conservative thing would be to stick with the scalar code. */ - if (flag_vect_cost_model == VECT_COST_MODEL_VERY_CHEAP + if (loop_cost_model (loop) == VECT_COST_MODEL_VERY_CHEAP && min_profitable_estimate > (int) vect_vf_for_cost (loop_vinfo)) { if (dump_enabled_p ()) diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index ed4a7ff..4aa84ac 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -1701,14 +1701,22 @@ get_dr_vinfo_offset (vec_info *vinfo, } +/* Return the vect cost model for LOOP. */ +static inline enum vect_cost_model +loop_cost_model (loop_p loop) +{ + if (loop != NULL + && loop->force_vectorize + && flag_simd_cost_model != VECT_COST_MODEL_DEFAULT) + return flag_simd_cost_model; + return flag_vect_cost_model; +} + /* Return true if the vect cost model is unlimited. */ static inline bool unlimited_cost_model (loop_p loop) { - if (loop != NULL && loop->force_vectorize - && 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); + return loop_cost_model (loop) == VECT_COST_MODEL_UNLIMITED; } /* Return true if the loop described by LOOP_VINFO is fully-masked and |