Hi, Recently we are revisiting vectorization cost setting in rs6000_builtin_vectorization_cost, and found the current cost of vec_perm on VSX looks overpriced for Power8 and Power9. The high cost was set for Power7 single VSU pipe, but Power8 and Power9 have supported more VSX units, the performance evaluation on SPEC2017 Power9 shows 2%+ gain on 538.imagick_r, while SPEC2006/ SPEC2017 Power8 evaluations show ~2% gains on 453.povray/ 511.povray_r, all don't have any remarkable degradations.
This patch is to lower vec_perm vectorization cost for all non Power7 VSX architecture (currently Power8 and Power9). Bootstrapped and regress tested on powerpc64le-linux-gnu. Is OK for trunk? Thanks, Kewen gcc/ChangeLog 2019-09-29 Kewen Lin <li...@gcc.gnu.org> * config/rs6000/rs6000.c (rs6000_builtin_vectorization_cost): Lower vec_perm cost to 1 for non-Power7 VSX architectures. ---- diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index c2834bd..6b2c6fa 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -4774,7 +4774,8 @@ rs6000_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost, return 1; case vec_perm: - if (TARGET_VSX) + /* Power7 has only one VSU pipe, make it a bit expensive. */ + if (TARGET_VSX && rs6000_tune == PROCESSOR_POWER7) return 3; else return 1;