From: Eric Biggers <ebiggers@kernel.org>
To: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Stefan Kanthak <stefan.kanthak@nexgo.de>
Subject: [PATCH v2 4/4] crypto: x86/sha256-ni - simplify do_4rounds
Date: Thu, 11 Apr 2024 09:23:59 -0700 [thread overview]
Message-ID: <20240411162359.39073-5-ebiggers@kernel.org> (raw)
In-Reply-To: <20240411162359.39073-1-ebiggers@kernel.org>
From: Eric Biggers <ebiggers@google.com>
Instead of loading the message words into both MSG and \m0 and then
adding the round constants to MSG, load the message words into \m0 and
the round constants into MSG and then add \m0 to MSG. This shortens the
source code slightly. It changes the instructions slightly, but it
doesn't affect binary code size and doesn't seem to affect performance.
Suggested-by: Stefan Kanthak <stefan.kanthak@nexgo.de>
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
arch/x86/crypto/sha256_ni_asm.S | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/arch/x86/crypto/sha256_ni_asm.S b/arch/x86/crypto/sha256_ni_asm.S
index ffc9f1c75c15..d515a55a3bc1 100644
--- a/arch/x86/crypto/sha256_ni_asm.S
+++ b/arch/x86/crypto/sha256_ni_asm.S
@@ -76,17 +76,15 @@
#define ABEF_SAVE %xmm9
#define CDGH_SAVE %xmm10
.macro do_4rounds i, m0, m1, m2, m3
.if \i < 16
- movdqu \i*4(DATA_PTR), MSG
- pshufb SHUF_MASK, MSG
- movdqa MSG, \m0
-.else
- movdqa \m0, MSG
+ movdqu \i*4(DATA_PTR), \m0
+ pshufb SHUF_MASK, \m0
.endif
- paddd (\i-32)*4(SHA256CONSTANTS), MSG
+ movdqa (\i-32)*4(SHA256CONSTANTS), MSG
+ paddd \m0, MSG
sha256rnds2 STATE0, STATE1
.if \i >= 12 && \i < 60
movdqa \m0, TMP
palignr $4, \m3, TMP
paddd TMP, \m1
--
2.44.0
next prev parent reply other threads:[~2024-04-11 16:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-11 16:23 [PATCH v2 0/4] crypto: x86/sha256-ni - cleanup and optimization Eric Biggers
2024-04-11 16:23 ` [PATCH v2 1/4] crypto: x86/sha256-ni - convert to use rounds macros Eric Biggers
2024-04-11 16:23 ` [PATCH v2 2/4] crypto: x86/sha256-ni - rename some register aliases Eric Biggers
2024-04-11 16:23 ` [PATCH v2 3/4] crypto: x86/sha256-ni - optimize code size Eric Biggers
2024-04-11 16:23 ` Eric Biggers [this message]
2024-04-15 20:41 ` [PATCH v2 4/4] crypto: x86/sha256-ni - simplify do_4rounds Stefan Kanthak
2024-04-15 21:21 ` Eric Biggers
2024-04-15 22:04 ` Stefan Kanthak
2024-04-15 22:46 ` Eric Biggers
2024-04-16 0:17 ` Stefan Kanthak
2024-04-19 11:00 ` [PATCH v2 0/4] crypto: x86/sha256-ni - cleanup and optimization Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240411162359.39073-5-ebiggers@kernel.org \
--to=ebiggers@kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stefan.kanthak@nexgo.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.