From 0df28e68fd126d9c3356a3d314be383a877b74a7 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 20 Feb 2020 15:04:19 +0000 Subject: [PATCH] aarch64: Avoid creating an unused register The rsqrt path of aarch64_emit_approx_sqrt created a pseudo register that it never used. 2020-02-21 Richard Sandiford gcc/ * config/aarch64/aarch64.c (aarch64_emit_approx_sqrt): Don't create an unused xmsk register when handling approximate rsqrt. --- gcc/ChangeLog | 5 +++++ gcc/config/aarch64/aarch64.c | 17 ++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 16a23d00944..8241af4fbef 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2020-02-21 Richard Sandiford + + * config/aarch64/aarch64.c (aarch64_emit_approx_sqrt): Don't create + an unused xmsk register when handling approximate rsqrt. + 2020-02-21 Richard Sandiford * config/aarch64/aarch64.c (aarch64_emit_approx_sqrt): Fix inverted 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); -- 2.30.2