[rs6000] Fix PR92760 by checking VECTOR_MEM_NONE_P instead

Message ID 6cf297d2-6462-d2b0-7b77-a94e14fafd0d@linux.ibm.com
State New
Headers show
Series
  • [rs6000] Fix PR92760 by checking VECTOR_MEM_NONE_P instead
Related show

Commit Message

Kewen.Lin Dec. 3, 2019, 9:38 a.m.
Hi,

PR92760 exposed one issue that VECTOR_UNIT_NONE_P (V2DImode) is true on Power7
then we won't return it as preferred_simd_mode but ISA 2.06 (Power7) does 
introduce partial support on vector doubleword (very limitted) and more basic
support origins from ISA 2.07 (Power8) though.  To make vectorizer still
leverage those few but available V2DImode related instructions, we need to
claim it's available on VSX (Power7 and up).

Instead of using VECTOR_UNIT_NONE_P, this fix is to use VECTOR_MEM_NONE_P
instead.  I was intended to use both VECTOR_UNIT_NONE_P and VECTOR_MEM_NONE_P
together but noticed that MEM is like a super set of UNIT in current
implementation, I think it would be enough.

Bootstrapped and tested on powerpc64le-linux-gnu (P8 LE) and ppc64-redhat-linux
(P7 BE).  Also verified the failures in the PR gone.

Is it ok for trunk?

BR,
Kewen
----
gcc/ChangeLog

2019-12-03  Kewen Lin  <linkw@gcc.gnu.org>

	PR target/92760
	* gcc/config/rs6000/rs6000.c (rs6000_preferred_simd_mode): Update
	VECTOR_UNIT_NONE_P by VECTOR_MEM_NONE_P.

Comments

Segher Boessenkool Dec. 3, 2019, 6:02 p.m. | #1
Hi!

On Tue, Dec 03, 2019 at 05:38:41PM +0800, Kewen.Lin wrote:
> PR92760 exposed one issue that VECTOR_UNIT_NONE_P (V2DImode) is true on Power7

> then we won't return it as preferred_simd_mode but ISA 2.06 (Power7) does 

> introduce partial support on vector doubleword (very limitted) and more basic

> support origins from ISA 2.07 (Power8) though.  To make vectorizer still

> leverage those few but available V2DImode related instructions, we need to

> claim it's available on VSX (Power7 and up).

> 

> Instead of using VECTOR_UNIT_NONE_P, this fix is to use VECTOR_MEM_NONE_P

> instead.  I was intended to use both VECTOR_UNIT_NONE_P and VECTOR_MEM_NONE_P

> together but noticed that MEM is like a super set of UNIT in current

> implementation, I think it would be enough.


Yes.  This hook should return what mode we want to use, and !MEM_NONE is
a better match to what we want there.

> 2019-12-03  Kewen Lin  <linkw@gcc.gnu.org>

> 

> 	PR target/92760

> 	* gcc/config/rs6000/rs6000.c (rs6000_preferred_simd_mode): Update

> 	VECTOR_UNIT_NONE_P by VECTOR_MEM_NONE_P.


(Maybe better is "Use VECTOR_MEM_NONE_P instead of VECTOR_UNIT_NONE_P."?)

Okay for trunk.  Thanks!


Segher

Patch

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 3c22f64..23b6d99 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -4917,7 +4917,7 @@  rs6000_preferred_simd_mode (scalar_mode mode)
 {
   opt_machine_mode vmode = mode_for_vector (mode, 16 / GET_MODE_SIZE (mode));
 
-  if (vmode.exists () && !VECTOR_UNIT_NONE_P (vmode.require ()))
+  if (vmode.exists () && !VECTOR_MEM_NONE_P (vmode.require ()))
     return vmode.require ();
 
   return word_mode;