Patchwork [i386] : Simplify allocate_stack expander

login
register
mail settings
Submitter Uros Bizjak
Date March 19, 2012, 10:18 p.m.
Message ID <CAFULd4ZZ=rrMj9M2=NuBXaydFHyH44tEjMYyG_A3Pj6=Yc_oZw@mail.gmail.com>
Download mbox | patch
Permalink /patch/147660/
State New
Headers show

Comments

Uros Bizjak - March 19, 2012, 10:18 p.m.
Hello!

No functional change.

2012-03-19  Uros Bizjak  <ubizjak@gmail.com>

	* config/i386/i386.md (allocate_stack): Simplify.

Tested on x86_64-pc-linux-gnu, committed to mainline SVN.

Uros.

Patch

Index: i386/i386.md
===================================================================
--- i386/i386.md	(revision 185541)
+++ i386/i386.md	(working copy)
@@ -16729,25 +16729,26 @@ 
 
   if (CHECK_STACK_LIMIT && CONST_INT_P (operands[1])
       && INTVAL (operands[1]) < CHECK_STACK_LIMIT)
-    {
-      x = expand_simple_binop (Pmode, MINUS, stack_pointer_rtx, operands[1],
-			       stack_pointer_rtx, 0, OPTAB_DIRECT);
-      if (x != stack_pointer_rtx)
-	emit_move_insn (stack_pointer_rtx, x);
-    }
+    x = operands[1];
   else
     {
-      x = copy_addr_to_reg (operands[1]);
-      if (TARGET_64BIT)
-        emit_insn (gen_allocate_stack_worker_probe_di (x, x));
-      else
-        emit_insn (gen_allocate_stack_worker_probe_si (x, x));
-      x = expand_simple_binop (Pmode, MINUS, stack_pointer_rtx, x,
-			       stack_pointer_rtx, 0, OPTAB_DIRECT);
-      if (x != stack_pointer_rtx)
-	emit_move_insn (stack_pointer_rtx, x);
+      rtx (*insn) (rtx, rtx);
+
+      x = copy_to_mode_reg (Pmode, operands[1]);
+
+      insn = (TARGET_64BIT
+	      ? gen_allocate_stack_worker_probe_di
+	      : gen_allocate_stack_worker_probe_si);
+
+      emit_insn (insn (x, x));
     }
 
+  x = expand_simple_binop (Pmode, MINUS, stack_pointer_rtx, x,
+			   stack_pointer_rtx, 0, OPTAB_DIRECT);
+
+  if (x != stack_pointer_rtx)
+    emit_move_insn (stack_pointer_rtx, x);
+
   emit_move_insn (operands[0], virtual_stack_dynamic_rtx);
   DONE;
 })