diff mbox

[i386] : Cleanup ix86_emit_swsqrtsf a bit

Message ID CAFULd4ba6FjgmnZUu8T+Ume4VK=1e8ky9JJbC7=s67ZWo+vcvA@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Dec. 8, 2015, 8:58 a.m. UTC
No functional changes.

2015-12-08  Uros Bizjak  <ubizjak@gmail.com>

    * config/i386/i386.c (ix86_emit_swsqrtsf): Cleanup
    infinity filterning code.

Bootstrapped and regression tested on x86_64-linux-gnu, committed to
mainline SVN.

Uros.
diff mbox

Patch

Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 231355)
+++ config/i386/i386.c	(working copy)
@@ -47827,8 +47827,7 @@  void ix86_emit_swdivsf (rtx res, rtx a, rtx b, mac
 /* Output code to perform a Newton-Rhapson approximation of a
    single precision floating point [reciprocal] square root.  */
 
-void ix86_emit_swsqrtsf (rtx res, rtx a, machine_mode mode,
-			 bool recip)
+void ix86_emit_swsqrtsf (rtx res, rtx a, machine_mode mode, bool recip)
 {
   rtx x0, e0, e1, e2, e3, mthree, mhalf;
   REAL_VALUE_TYPE r;
@@ -47868,13 +47867,9 @@  void ix86_emit_swdivsf (rtx res, rtx a, rtx b, mac
   /* If (a == 0.0) Filter out infinity to prevent NaN for sqrt(0.0).  */
   if (!recip)
     {
-      rtx zero, mask;
+      rtx zero = force_reg (mode, CONST0_RTX(mode));
+      rtx mask;
 
-      zero = gen_reg_rtx (mode);
-      mask = gen_reg_rtx (mode);
-
-      zero = force_reg (mode, CONST0_RTX(mode));
-
       /* Handle masked compare.  */
       if (VECTOR_MODE_P (mode) && GET_MODE_SIZE (mode) == 64)
 	{
@@ -47885,8 +47880,8 @@  void ix86_emit_swdivsf (rtx res, rtx a, rtx b, mac
 	}
       else
 	{
+	  mask = gen_reg_rtx (mode);
 	  emit_insn (gen_rtx_SET (mask, gen_rtx_NE (mode, zero, a)));
-
 	  emit_insn (gen_rtx_SET (x0, gen_rtx_AND (mode, x0, mask)));
 	}
     }