public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/meissner/heads/work044)] Use XXSPLTIW to load up V4SF constants.
@ 2021-04-02 17:25 Michael Meissner
  0 siblings, 0 replies; only message in thread
From: Michael Meissner @ 2021-04-02 17:25 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:640a6913db7a4429659a709b83c75da55401a197

commit 640a6913db7a4429659a709b83c75da55401a197
Author: Michael Meissner <meissner@linux.ibm.com>
Date:   Fri Apr 2 13:24:52 2021 -0400

    Use XXSPLTIW to load up V4SF constants.
    
    This patch adds support to use the ISA 3.1 XXSPLTIW instruction to load up
    V4SF constants.
    
    gcc/
    2021-04-02  Michael Meissner  <meissner@linux.ibm.com>
    
            * config/rs6000/rs6000.c (xxspltiw_constant_p): Add V4SFmode
            support.
            * config/rs6000/vsx.md (XXSPLTIW): Add V4SFmode.

Diff:
---
 gcc/config/rs6000/rs6000.c | 29 ++++++++++++++++++-----------
 gcc/config/rs6000/vsx.md   |  2 +-
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index a4f83b06727..9f3f270281a 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -6491,7 +6491,7 @@ xxspltiw_constant_p (rtx op,
   if (mode == VOIDmode)
     mode = GET_MODE (op);
 
-  if (mode != V8HImode && mode != V4SImode)
+  if (mode != V8HImode && mode != V4SImode && mode != V4SFmode)
     return false;
 
   rtx element = op;
@@ -6508,19 +6508,26 @@ xxspltiw_constant_p (rtx op,
 	  return false;
     }
 
-  if (!CONST_INT_P (element))
-    return false;
-
-  HOST_WIDE_INT value = INTVAL (element);
-  if (!SIGNED_INTEGER_NBIT_P (value, 32))
-    return false;
-
-  if (mode == V8HImode)
+  HOST_WIDE_INT value;
+  if (CONST_INT_P (element))
     {
-      value &= 0xffff;
-      value |= value << 16;
+      value = INTVAL (element);
+      if (!SIGNED_INTEGER_NBIT_P (value, 32))
+	return false;
+
+      if (mode == V8HImode)
+	{
+	  value &= 0xffff;
+	  value |= value << 16;
+	}
     }
 
+  else if (CONST_DOUBLE_P (element))
+    value = rs6000_const_f32_to_i32 (element);
+
+  else
+    return false;
+
   *constant_ptr = value;
   return true;
 }
diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md
index 9ec0ef9ecb1..2b855c7428c 100644
--- a/gcc/config/rs6000/vsx.md
+++ b/gcc/config/rs6000/vsx.md
@@ -210,7 +210,7 @@
 (define_mode_iterator VSINT_842 [V8HI V4SI V2DI])
 
 ;; Iterator for loading constants with xxspltiw
-(define_mode_iterator XXSPLTIW [V8HI V4SI])
+(define_mode_iterator XXSPLTIW [V8HI V4SI V4SF])
 
 ;; Vector reverse byte modes
 (define_mode_iterator VEC_REVB [V8HI V4SI V2DI V4SF V2DF V1TI])


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-02 17:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-02 17:25 [gcc(refs/users/meissner/heads/work044)] Use XXSPLTIW to load up V4SF constants Michael Meissner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).