public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-8142] tree-optimization/105263 - reassoc and DFP
@ 2022-04-13 13:59 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2022-04-13 13:59 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:ca145c6306f19272ac8756d88c4eba0bfdf01dfb

commit r12-8142-gca145c6306f19272ac8756d88c4eba0bfdf01dfb
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Apr 13 14:53:40 2022 +0200

    tree-optimization/105263 - reassoc and DFP
    
    reassoc has certain tricks which in the end depend on the ability
    to undo them.  For DFP creating a -1. constant is easy but
    re-identifying is appearantly not - real_minus_onep rejects those
    outright for DFP.  So we have to disable (at least) this one trick.
    
    2022-04-13  Richard Biener  <rguenther@suse.de>
    
            PR tree-optimization/105263
            * tree-ssa-reassoc.cc (try_special_add_to_ops): Do not consume
            negates in multiplication chains with DFP.
    
            * gcc.dg/pr105263.c: New testcase.

Diff:
---
 gcc/testsuite/gcc.dg/pr105263.c | 15 +++++++++++++++
 gcc/tree-ssa-reassoc.cc         |  4 +++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.dg/pr105263.c b/gcc/testsuite/gcc.dg/pr105263.c
new file mode 100644
index 00000000000..5cb7fcd09a2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr105263.c
@@ -0,0 +1,15 @@
+/* { dg-do compile { target dfp } } */
+/* { dg-options "-O -ffast-math -w -Wno-psabi" } */
+
+typedef _Decimal64 __attribute__((__vector_size__ (8))) U;
+typedef _Decimal64 __attribute__((__vector_size__ (16))) V;
+
+V v;
+
+U
+foo (U u)
+{
+  u *= u;
+  u *= -(U){ v[1] };
+  return u;
+}
diff --git a/gcc/tree-ssa-reassoc.cc b/gcc/tree-ssa-reassoc.cc
index 4ab3c3361f9..f41b3c9a004 100644
--- a/gcc/tree-ssa-reassoc.cc
+++ b/gcc/tree-ssa-reassoc.cc
@@ -5857,7 +5857,9 @@ try_special_add_to_ops (vec<operand_entry *> *ops,
 	   && gimple_assign_rhs_code (def_stmt) == NEGATE_EXPR
 	   && !HONOR_SNANS (TREE_TYPE (op))
 	   && (!HONOR_SIGNED_ZEROS (TREE_TYPE (op))
-	       || !COMPLEX_FLOAT_TYPE_P (TREE_TYPE (op))))
+	       || !COMPLEX_FLOAT_TYPE_P (TREE_TYPE (op)))
+	   && (!FLOAT_TYPE_P (TREE_TYPE (op))
+	       || !DECIMAL_FLOAT_MODE_P (element_mode (op))))
     {
       tree rhs1 = gimple_assign_rhs1 (def_stmt);
       tree cst = build_minus_one_cst (TREE_TYPE (op));


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

only message in thread, other threads:[~2022-04-13 13:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-13 13:59 [gcc r12-8142] tree-optimization/105263 - reassoc and DFP Richard Biener

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).