]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/gcc-tumbl.git/commitdiff
Backported from mainline
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 1 Feb 2013 14:08:32 +0000 (14:08 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 1 Feb 2013 14:08:32 +0000 (14:08 +0000)
2013-01-10  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/55921
* tree-complex.c (expand_complex_asm): New function.
(expand_complex_operations_1): Call it for GIMPLE_ASM.

* gcc.c-torture/compile/pr55921.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@195655 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr55921.c [new file with mode: 0644]
gcc/tree-complex.c

index fc7abd3e01724bdf27b9215fa6dbcc51ca49ccd0..6a32dd9cf609d623d82c2f7f690741be32cda454 100644 (file)
@@ -1,6 +1,12 @@
 2013-02-01  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2013-01-10  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/55921
+       * tree-complex.c (expand_complex_asm): New function.
+       (expand_complex_operations_1): Call it for GIMPLE_ASM.
+
        2013-01-03  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/55838
index 75d70ee7102a6a42d09189216a2f077635ea48f7..3b7f4dc310d0d7f205eea16b5cc08301d34b7fd4 100644 (file)
@@ -1,6 +1,11 @@
 2013-02-01  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2013-01-10  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/55921
+       * gcc.c-torture/compile/pr55921.c: New test.
+
        2013-01-03  Jakub Jelinek  <jakub@redhat.com>
 
        PR rtl-optimization/55838
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr55921.c b/gcc/testsuite/gcc.c-torture/compile/pr55921.c
new file mode 100644 (file)
index 0000000..39af43c
--- /dev/null
@@ -0,0 +1,22 @@
+/* PR tree-optimization/55921 */
+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+
+typedef union
+{
+  _Complex float cf;
+  long long ll;
+} ucf;
+
+void
+foo (ucf *in, ucf *out, _Complex float r)
+{
+  int i;
+  ucf ucf1;
+  _Complex float cf;
+
+  ucf1.ll = in[i].ll;
+  __asm ("" : "=r" (cf) : "0" (ucf1.ll));
+  cf *= r;
+  __asm ("" : "=r" (ucf1.ll) : "0" (cf));
+  out[i].ll = ucf1.ll;
+}
index 0547fcf147fd74aa5e58607a7089bdc470a1b551..c45ba190d1e2d7e39c374dd3fa04494bb1327fe9 100644 (file)
@@ -1400,6 +1400,36 @@ expand_complex_comparison (gimple_stmt_iterator *gsi, tree ar, tree ai,
   update_stmt (stmt);
 }
 
+/* Expand inline asm that sets some complex SSA_NAMEs.  */
+
+static void
+expand_complex_asm (gimple_stmt_iterator *gsi)
+{
+  gimple stmt = gsi_stmt (*gsi);
+  unsigned int i;
+
+  for (i = 0; i < gimple_asm_noutputs (stmt); ++i)
+    {
+      tree link = gimple_asm_output_op (stmt, i);
+      tree op = TREE_VALUE (link);
+      if (TREE_CODE (op) == SSA_NAME
+         && TREE_CODE (TREE_TYPE (op)) == COMPLEX_TYPE)
+       {
+         tree type = TREE_TYPE (op);
+         tree inner_type = TREE_TYPE (type);
+         tree r = build1 (REALPART_EXPR, inner_type, op);
+         tree i = build1 (IMAGPART_EXPR, inner_type, op);
+         gimple_seq list = set_component_ssa_name (op, false, r);
+
+         if (list)
+           gsi_insert_seq_after (gsi, list, GSI_CONTINUE_LINKING);
+
+         list = set_component_ssa_name (op, true, i);
+         if (list)
+           gsi_insert_seq_after (gsi, list, GSI_CONTINUE_LINKING);
+       }
+    }
+}
 
 /* Process one statement.  If we identify a complex operation, expand it.  */
 
@@ -1412,6 +1442,12 @@ expand_complex_operations_1 (gimple_stmt_iterator *gsi)
   complex_lattice_t al, bl;
   enum tree_code code;
 
+  if (gimple_code (stmt) == GIMPLE_ASM)
+    {
+      expand_complex_asm (gsi);
+      return;
+    }
+
   lhs = gimple_get_lhs (stmt);
   if (!lhs && gimple_code (stmt) != GIMPLE_COND)
     return;