[committed] aarch64: Avoid creating an unused register

Message ID mpt4kvkxmke.fsf@arm.com
State New
Headers show
Series
  • [committed] aarch64: Avoid creating an unused register
Related show

Commit Message

Richard Sandiford Feb. 21, 2020, 10:27 a.m.
The rsqrt path of aarch64_emit_approx_sqrt created a pseudo
register that it never used.

Tested on aarch64-linux-gnu and aarch64_be-elf, pushed.

Richard


2020-02-21  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* config/aarch64/aarch64.c (aarch64_emit_approx_sqrt): Don't create
	an unused xmsk register when handling approximate rsqrt.
---
 gcc/config/aarch64/aarch64.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

Patch

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 6fb567ae4bf..0acaa06b91c 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -12774,14 +12774,17 @@  aarch64_emit_approx_sqrt (rtx dst, rtx src, bool recp)
   machine_mode mmsk = (VECTOR_MODE_P (mode)
 		       ? related_int_vector_mode (mode).require ()
 		       : int_mode_for_mode (mode).require ());
-  rtx xmsk = gen_reg_rtx (mmsk);
+  rtx xmsk = NULL_RTX;
   if (!recp)
-    /* When calculating the approximate square root, compare the
-       argument with 0.0 and create a mask.  */
-    emit_insn (gen_rtx_SET (xmsk,
-			    gen_rtx_NEG (mmsk,
-					 gen_rtx_EQ (mmsk, src,
-						     CONST0_RTX (mode)))));
+    {
+      /* When calculating the approximate square root, compare the
+	 argument with 0.0 and create a mask.  */
+      xmsk = gen_reg_rtx (mmsk);
+      emit_insn (gen_rtx_SET (xmsk,
+			      gen_rtx_NEG (mmsk,
+					   gen_rtx_EQ (mmsk, src,
+						       CONST0_RTX (mode)))));
+    }
 
   /* Estimate the approximate reciprocal square root.  */
   rtx xdst = gen_reg_rtx (mode);