public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/meissner/heads/work043)] Convert xxspltidp built-in to use normal vec_duplicate.
@ 2021-03-30 20:30 Michael Meissner
  0 siblings, 0 replies; only message in thread
From: Michael Meissner @ 2021-03-30 20:30 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:1290fd0ea948ddbc835d53e183186fb21e7676d9

commit 1290fd0ea948ddbc835d53e183186fb21e7676d9
Author: Michael Meissner <meissner@linux.ibm.com>
Date:   Tue Mar 30 16:29:36 2021 -0400

    Convert xxspltidp built-in to use normal vec_duplicate.
    
    If the vec_splatid built-in function is given a normal number that is not
    a denormal, convert the insn into a normal vec_duplicate.
    
    gcc/
    2021-03-30  Michael Meissner  <meissner@linux.ibm.com>
    
            * config/rs6000/altivec.md (xxspltidp_v2df): Use vec_duplicate for
            normal inputs.  Handle denormal inputs specially.
            (xxspltidp_v2df_denormal): Rename fromxxspltidp_v2df_inst.

Diff:
---
 gcc/config/rs6000/altivec.md | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md
index 228d88210bf..ed5c19afa52 100644
--- a/gcc/config/rs6000/altivec.md
+++ b/gcc/config/rs6000/altivec.md
@@ -880,12 +880,30 @@
 		     UNSPEC_XXSPLTID))]
  "TARGET_POWER10"
 {
-  long value = rs6000_const_f32_to_i32 (operands[1]);
-  emit_insn (gen_xxspltidp_v2df_inst (operands[0], GEN_INT (value)));
+  rtx op0 = operands[0];
+  rtx op1 = operands[1];
+  const struct real_value *rv = CONST_DOUBLE_REAL_VALUE (op1);
+
+  /* If the value is not denormal, convert it to DFmode and generate a
+     vec_duplicate.  */
+  if (xxspltidp_operand (op1, SFmode))
+    {
+      rtx op1_df = const_double_from_real_value (*rv, DFmode);
+      rtx dup = gen_rtx_VEC_DUPLICATE (V2DFmode, op1_df);
+      emit_insn (gen_rtx_SET (op0, dup));
+      DONE;
+    }
+
+  /* If the value is denormal, create an insn with the int value.  There is a
+     warning for this condition when the built-in was expanded in
+     rs6000_expand_unop_builtin.  */
+  long value;
+  REAL_VALUE_TO_TARGET_SINGLE (*rv, value);
+  emit_insn (gen_xxspltidp_v2df_denormal (op0, GEN_INT (value)));
   DONE;
 })
 
-(define_insn "xxspltidp_v2df_inst"
+(define_insn "xxspltidp_v2df_denormal"
   [(set (match_operand:V2DF 0 "register_operand" "=wa")
 	(unspec:V2DF [(match_operand:SI 1 "c32bit_cint_operand" "n")]
 		     UNSPEC_XXSPLTID))]


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

only message in thread, other threads:[~2021-03-30 20:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-30 20:30 [gcc(refs/users/meissner/heads/work043)] Convert xxspltidp built-in to use normal vec_duplicate 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).