This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] SSA expand: Convert mode when copying between partition base vars


Hi,

here is a revised version.

Bootstrapped on s390x. x86_64 and s390 still running.

Ok for mainline in case the other bootstraps succeed as well?

Bye,

-Andreas-

2009-04-28  Andreas Krebbel  <krebbel1@de.ibm.com>

	* gcc/tree-outof-ssa.c (do_partition_copy): New function.
	(insert_partition_copy_on_edge, insert_rtx_to_part_on_edge,
	insert_part_to_rtx_on_edge): Perform the partition base var copy
	using do_partition_copy.
	(insert_rtx_to_part_on_edge): Add UNSIGNEDSRCP parameter.
	(elim_create): Pass the sign of the src to
	insert_rtx_to_part_on_edge.


Index: gcc/tree-outof-ssa.c
===================================================================
--- gcc/tree-outof-ssa.c.orig	2009-04-28 10:33:29.000000000 +0200
+++ gcc/tree-outof-ssa.c	2009-04-28 15:06:59.000000000 +0200
@@ -128,6 +128,16 @@ set_location_for_edge (edge e)
     }
 }
 
+/* Emit insns to copy SRC into DEST converting SRC if necessary.  */
+
+static inline void
+do_partition_copy (rtx dest, rtx src, int unsignedsrcp)
+{
+  if (GET_MODE (src) != GET_MODE (dest))
+    src = convert_to_mode (GET_MODE (dest), src, unsignedsrcp);
+  emit_move_insn (dest, src);
+}
+
 /* Insert a copy instruction from partition SRC to DEST onto edge E.  */
 
 static void
@@ -149,10 +159,11 @@ insert_partition_copy_on_edge (edge e, i
 
   set_location_for_edge (e);
 
-  /* Partition copy between same base variables only, so it's the same mode,
-     hence we can use emit_move_insn.  */
   start_sequence ();
-  emit_move_insn (SA.partition_to_pseudo[dest], SA.partition_to_pseudo[src]);
+  do_partition_copy (SA.partition_to_pseudo[dest],
+		     SA.partition_to_pseudo[src],
+		     TYPE_UNSIGNED (TREE_TYPE (
+		       partition_to_var (SA.map, src))));
   seq = get_insns ();
   end_sequence ();
 
@@ -198,7 +209,7 @@ insert_value_copy_on_edge (edge e, int d
    onto edge E.  */
 
 static void
-insert_rtx_to_part_on_edge (edge e, int dest, rtx src)
+insert_rtx_to_part_on_edge (edge e, int dest, rtx src, int unsignedsrcp)
 {
   rtx seq;
   if (dump_file && (dump_flags & TDF_DETAILS))
@@ -215,8 +226,9 @@ insert_rtx_to_part_on_edge (edge e, int 
   set_location_for_edge (e);
 
   start_sequence ();
-  gcc_assert (GET_MODE (src) == GET_MODE (SA.partition_to_pseudo[dest]));
-  emit_move_insn (SA.partition_to_pseudo[dest], src);
+  do_partition_copy (SA.partition_to_pseudo[dest],
+		     src,
+		     unsignedsrcp);
   seq = get_insns ();
   end_sequence ();
 
@@ -244,8 +256,10 @@ insert_part_to_rtx_on_edge (edge e, rtx 
   set_location_for_edge (e);
 
   start_sequence ();
-  gcc_assert (GET_MODE (dest) == GET_MODE (SA.partition_to_pseudo[src]));
-  emit_move_insn (dest, SA.partition_to_pseudo[src]);
+  do_partition_copy (dest,
+		     SA.partition_to_pseudo[src],
+		     TYPE_UNSIGNED (TREE_TYPE (
+		       partition_to_var (SA.map, src))));
   seq = get_insns ();
   end_sequence ();
 
@@ -522,14 +536,17 @@ elim_create (elim_graph g, int T)
 
   if (elim_unvisited_predecessor (g, T))
     {
-      rtx U = get_temp_reg (partition_to_var (g->map, T));
+      tree var = partition_to_var (g->map, T);
+      rtx U = get_temp_reg (var);
+      int unsignedsrcp = TYPE_UNSIGNED (TREE_TYPE (var));
+
       insert_part_to_rtx_on_edge (g->e, U, T);
       FOR_EACH_ELIM_GRAPH_PRED (g, T, P, 
 	{
 	  if (!TEST_BIT (g->visited, P))
 	    {
 	      elim_backward (g, P);
-	      insert_rtx_to_part_on_edge (g->e, P, U);
+	      insert_rtx_to_part_on_edge (g->e, P, U, unsignedsrcp);
 	    }
 	});
     }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]