public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Marek Polacek <polacek@redhat.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: [committed] Improve reassoc-39.c test
Date: Wed, 14 Oct 2015 14:07:00 -0000	[thread overview]
Message-ID: <20151014140737.GI13672@redhat.com> (raw)

Jakub suggested that I improve a testcase I've added a while ago.
Done in the following.

Tested on x86_64-linux, applying to trunk.

2015-10-14  Marek Polacek  <polacek@redhat.com>

	* gcc.dg/tree-ssa/reassoc-39.c: Use -g.  Adjust dg-final.
	(f6): New.
	(f7): New.
	(f8): New.
	(f9): New.
	(f10): New.
	(f11): New.
	(f12): New.
	(f13): New.

diff --git gcc/testsuite/gcc.dg/tree-ssa/reassoc-39.c gcc/testsuite/gcc.dg/tree-ssa/reassoc-39.c
index 589d06b..9befe18 100644
--- gcc/testsuite/gcc.dg/tree-ssa/reassoc-39.c
+++ gcc/testsuite/gcc.dg/tree-ssa/reassoc-39.c
@@ -1,6 +1,9 @@
 /* PR tree-optimization/67815 */
 /* { dg-do compile } */
-/* { dg-options "-Ofast -fdump-tree-reassoc1-details" } */
+/* { dg-options "-Ofast -g -fdump-tree-reassoc1-details" } */
+
+extern float barf (float, float);
+extern double bar (double, double);
 
 float
 f0 (float x)
@@ -38,4 +41,67 @@ f5 (double x, double y, double z)
   return (x * (-1.0/12)) * z * __builtin_copysign (2.0, y);
 }
 
-/* { dg-final { scan-tree-dump-times "Optimizing copysign" 6 "reassoc1"} }*/
+float
+f6 (float x, float y)
+{
+  return 7.5f * y * __builtin_copysignf (2.0f, x);
+}
+
+float
+f7 (float x, float y)
+{
+  return -7.5f * y * __builtin_copysignf (2.0f, x);
+}
+
+float
+f8 (float x)
+{
+  float tmp1 = 7.5f;
+  float tmp2 = __builtin_copysignf (2.0f, x);
+  return tmp1 * tmp2;
+}
+
+double
+f9 (double x)
+{
+  double tmp1 = 7.5;
+  double tmp2 = __builtin_copysign (2.0, x);
+  return tmp1 * tmp2;
+}
+
+float
+f10 (float x)
+{
+  float tmp1 = 7.5f;
+  float tmp2 = __builtin_copysignf (2.0f, x);
+  float tmp3 = tmp2 * 24.0f;
+  return tmp1 * tmp2;
+}
+
+double
+f11 (double x)
+{
+  double tmp1 = 7.5;
+  double tmp2 = __builtin_copysign (2.0, x);
+  double tmp3 = tmp2 * 24.0;
+  return tmp1 * tmp2;
+}
+
+float
+f12 (float x)
+{
+  float tmp1 = 7.5f;
+  float tmp2 = __builtin_copysignf (2.0f, x);
+  /* Can't reassoc here.  */
+  return barf (tmp1 * tmp2, tmp2);
+}
+
+double
+f13 (double x)
+{
+  double tmp1 = 7.5;
+  double tmp2 = __builtin_copysign (2.0, x);
+  /* Can't reassoc here.  */
+  return bar (tmp1 * tmp2, tmp2);
+}
+/* { dg-final { scan-tree-dump-times "Optimizing copysign" 12 "reassoc1"} }*/

	Marek

                 reply	other threads:[~2015-10-14 14:07 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=20151014140737.GI13672@redhat.com \
    --to=polacek@redhat.com \
    --cc=gcc-patches@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).