public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [gimplefe] change dump format of realpart_expr and imagpart_expr with TDF_GIMPLE
@ 2016-12-22 11:50 Prathamesh Kulkarni
  2016-12-22 13:32 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Prathamesh Kulkarni @ 2016-12-22 11:50 UTC (permalink / raw)
  To: gcc Patches, Richard Biener

[-- Attachment #1: Type: text/plain, Size: 244 bytes --]

Hi,
For TDF_GIMPLE, the attached patch changes dump
format of realpart_expr from REALPART_EXPR<var> to __real var
since the latter form is accepted by gimplefe. Similarly for imagpart_expr.
Is this OK after bootstrap+test ?

Thanks,
Prathamesh

[-- Attachment #2: real_imag.diff --]
[-- Type: text/plain, Size: 1802 bytes --]

diff --git a/gcc/testsuite/gcc.dg/gimplefe-20.c b/gcc/testsuite/gcc.dg/gimplefe-20.c
new file mode 100644
index 0000000..99b3180
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gimplefe-20.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fgimple -fdump-tree-ssa-gimple" } */
+
+_Complex a;
+
+double __GIMPLE() f()
+{
+  double t1;
+  double t2;
+  double _1;
+
+bb1:
+  t1_2 = __real a;
+  t2_3 = __imag a;
+  _1 = t1_2 + t2_3;
+  return _1;
+}
+
+/* { dg-final { scan-tree-dump "__real a" "ssa" } } */
+/* { dg-final { scan-tree-dump "__imag a" "ssa" } } */
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index 5b3e23e..40c0bc6 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -2451,15 +2451,31 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, int flags,
       break;
 
     case REALPART_EXPR:
-      pp_string (pp, "REALPART_EXPR <");
-      dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
-      pp_greater (pp);
+      if (flags & TDF_GIMPLE)
+	{
+	  pp_string (pp, "__real ");
+	  dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
+	}
+      else
+	{
+	  pp_string (pp, "REALPART_EXPR <");
+	  dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
+	  pp_greater (pp);
+	}
       break;
 
     case IMAGPART_EXPR:
-      pp_string (pp, "IMAGPART_EXPR <");
-      dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
-      pp_greater (pp);
+      if (flags & TDF_GIMPLE)
+	{
+	  pp_string (pp, "__imag ");
+	  dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
+	}
+      else
+	{
+	  pp_string (pp, "IMAGPART_EXPR <");
+	  dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
+	  pp_greater (pp);
+	}
       break;
 
     case VA_ARG_EXPR:

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [gimplefe] change dump format of realpart_expr and imagpart_expr with TDF_GIMPLE
  2016-12-22 11:50 [gimplefe] change dump format of realpart_expr and imagpart_expr with TDF_GIMPLE Prathamesh Kulkarni
@ 2016-12-22 13:32 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2016-12-22 13:32 UTC (permalink / raw)
  To: Prathamesh Kulkarni, gcc Patches

On December 22, 2016 12:27:38 PM GMT+01:00, Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> wrote:
>Hi,
>For TDF_GIMPLE, the attached patch changes dump
>format of realpart_expr from REALPART_EXPR<var> to __real var
>since the latter form is accepted by gimplefe. Similarly for
>imagpart_expr.
>Is this OK after bootstrap+test ?

OK.

Richard.

>Thanks,
>Prathamesh


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-22 13:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-22 11:50 [gimplefe] change dump format of realpart_expr and imagpart_expr with TDF_GIMPLE Prathamesh Kulkarni
2016-12-22 13:32 ` 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).