[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.2406281713040.43454@angie.orcam.me.uk>
Date: Fri, 28 Jun 2024 17:42:51 +0100 (BST)
From: "Maciej W. Rozycki" <macro@...am.me.uk>
To: WangYuli <wangyuli@...ontech.com>
cc: herbert@...dor.apana.org.au, linux-crypto@...r.kernel.org,
linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org,
Guan Wentao <guanwentao@...ontech.com>,
"David S. Miller" <davem@...emloft.net>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>
Subject: Re: [PATCH] MIPS: crypto: Clean up useless assignment operations
On Fri, 28 Jun 2024, WangYuli wrote:
> As you can see, regardless of the Clang or GCC version, this redundant
> operation affects the generated
>
> assembly code.
Boy, this code is horribly structured!
Anyway, rather than making it yet worse with another #ifdef I'd suggest
replacing both `while' loops with equivalent `for' ones with `len' being
the worker variable, which will then make the code structure a little bit
better and as a side effect address the missed optimisation automagically.
You might also consider Herbert's suggestion to use IS_ENABLED, however
in the current shape of code I find it kind of pointless anyway. Instead
I think that it would make more sense to factor out the block bodies to
small static inline helpers and then restructure the call sites so that
IS_ENABLED controls the loops, the conditionals, and the choice between
them as applicable.
Maciej
Powered by blists - more mailing lists