public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r10-10500] tree-optimization/104511 - avoid FP to DFP conversion for VEC_PACK_TRUNC
Date: Wed, 16 Mar 2022 09:22:44 +0000 (GMT)	[thread overview]
Message-ID: <20220316092244.79DE03846418@sourceware.org> (raw)

https://gcc.gnu.org/g:2cd7683cdbccf5d3fce58aa279e77c8baa48e4bd

commit r10-10500-g2cd7683cdbccf5d3fce58aa279e77c8baa48e4bd
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Feb 14 10:09:10 2022 +0100

    tree-optimization/104511 - avoid FP to DFP conversion for VEC_PACK_TRUNC
    
    This avoids forwprop from matching DFP <-> FP vector conversions
    using VEC_[UN]PACK{_TRUNC,_LO,_HI}.  Maybe DFP vectors shouldn't be
    a thing, but they appearantly are.  Re-using CONVERT/NOP_EXPR for
    DFP <-> FP conversions was probably a mistake.
    
    2022-02-14  Richard Biener  <rguenther@suse.de>
    
            PR tree-optimization/104511
            * tree-ssa-forwprop.c (simplify_vector_constructor): Avoid
            touching DFP <-> FP conversions.
    
            * gcc.dg/pr104511.c: New testcase.
    
    (cherry picked from commit f320197c8b495324dc6997a99d53e7f45ecf5840)

Diff:
---
 gcc/testsuite/gcc.dg/pr104511.c | 16 ++++++++++++++++
 gcc/tree-ssa-forwprop.c         |  9 +++++++++
 2 files changed, 25 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/pr104511.c b/gcc/testsuite/gcc.dg/pr104511.c
new file mode 100644
index 00000000000..ad5430c67c8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr104511.c
@@ -0,0 +1,16 @@
+/* { dg-do compile { target dfp } } */
+/* { dg-options "-O -Wno-psabi" } */
+
+typedef _Float64 __attribute__((__vector_size__ (32))) F;
+typedef _Decimal32 __attribute__((__vector_size__ (16))) D;
+
+extern void bar (void);
+
+D g;
+void
+foo (F f)
+{
+  D d = __builtin_convertvector (f, D);
+  bar ();
+  g = d;
+}
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index 3161d2e39ff..2a671b95f67 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -2403,6 +2403,15 @@ simplify_vector_constructor (gimple_stmt_iterator *gsi)
 			 ? VEC_UNPACK_FLOAT_HI_EXPR
 			 : VEC_UNPACK_HI_EXPR);
 
+	  /* Conversions between DFP and FP have no special tree code
+	     but we cannot handle those since all relevant vector conversion
+	     optabs only have a single mode.  */
+	  if (CONVERT_EXPR_CODE_P (conv_code)
+	      && FLOAT_TYPE_P (TREE_TYPE (type))
+	      && (DECIMAL_FLOAT_TYPE_P (TREE_TYPE (type))
+		  != DECIMAL_FLOAT_TYPE_P (TREE_TYPE (conv_src_type))))
+	    return false;
+
 	  if (CONVERT_EXPR_CODE_P (conv_code)
 	      && (2 * TYPE_PRECISION (TREE_TYPE (TREE_TYPE (orig[0])))
 		  == TYPE_PRECISION (TREE_TYPE (type)))


                 reply	other threads:[~2022-03-16  9:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220316092244.79DE03846418@sourceware.org \
    --to=rguenth@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).