From 34b7ae1dd5f0c01036b2a9308baf15329280733e Mon Sep 17 00:00:00 2001 From: Kewen Lin Date: Thu, 28 Nov 2019 06:34:31 +0000 Subject: [PATCH] [rs6000] Fix PR92566 by checking VECTOR_UNIT_NONE_P As Segher pointed out in PR92566, we shouldn't offer some vector modes which aren't supported under current setting. This patch is to make it check by VECTOR_UNIT_NONE_P which is initialized as current architecture masks. 2019-11-28 Kewen Lin PR target/92566 * gcc/config/rs6000/rs6000.c (rs6000_preferred_simd_mode): Check by VECTOR_UNIT_NONE_P instead. From-SVN: r278800 --- gcc/ChangeLog | 6 ++++++ gcc/config/rs6000/rs6000.c | 29 +++++------------------------ 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3061b9e7600..7c7ff3f0300 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-11-28 Kewen Lin + + PR target/92566 + * gcc/config/rs6000/rs6000.c (rs6000_preferred_simd_mode): Check + by VECTOR_UNIT_NONE_P instead. + 2019-11-28 Hongtao Liu * gcc/config/i386/sse.md (avx512f_maskcmp3): diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 2995348f3ce..3c22f64c139 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -4915,30 +4915,11 @@ rs6000_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost, static machine_mode rs6000_preferred_simd_mode (scalar_mode mode) { - if (TARGET_VSX) - switch (mode) - { - case E_DFmode: - return V2DFmode; - default:; - } - if (TARGET_ALTIVEC || TARGET_VSX) - switch (mode) - { - case E_SFmode: - return V4SFmode; - case E_TImode: - return V1TImode; - case E_DImode: - return V2DImode; - case E_SImode: - return V4SImode; - case E_HImode: - return V8HImode; - case E_QImode: - return V16QImode; - default:; - } + opt_machine_mode vmode = mode_for_vector (mode, 16 / GET_MODE_SIZE (mode)); + + if (vmode.exists () && !VECTOR_UNIT_NONE_P (vmode.require ())) + return vmode.require (); + return word_mode; } -- 2.30.2