public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
From: "Stefan Kanthak" <stefan.kanthak@nexgo.de>
To: "Eric Biggers" <ebiggers@kernel.org>, <linux-crypto@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <ardb@kernel.org>
Subject: Re: [PATCH 1/2] crypto: x86/sha256-ni - convert to use rounds macros
Date: Tue, 9 Apr 2024 18:52:02 +0200	[thread overview]
Message-ID: <C0FA88ECA90F43B1BF9E7849C53440D7@H270> (raw)
In-Reply-To: <20240409124216.9261-2-ebiggers@kernel.org>

"Eric Biggers" <ebiggers@kernel.org> wrote:

> +.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
> +.endif
> +        paddd   \i*4(SHA256CONSTANTS), MSG

To load the round constant independent from and parallel to the previous
instructions which use \m0 I recommend to change the first lines of the
do_4rounds macro as follows (this might save 1+ cycle per macro invocation,
and most obviously 2 lines):

.macro do_4rounds i, m0, m1, m2, m3
.if \i < 16
        movdqu  \i*4(DATA_PTR), \m0
        pshufb  SHUF_MASK, \m0
.endif
        movdqa  \i*4(SHA256CONSTANTS), MSG
        paddd   \m0, MSG
...

regards
Stefan

  reply	other threads:[~2024-04-09 16:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-09 12:42 [PATCH 0/2] crypto: x86/sha256-ni - cleanup and optimization Eric Biggers
2024-04-09 12:42 ` [PATCH 1/2] crypto: x86/sha256-ni - convert to use rounds macros Eric Biggers
2024-04-09 16:52   ` Stefan Kanthak [this message]
2024-04-09 23:36     ` Eric Biggers
2024-04-11  7:42       ` Stefan Kanthak
2024-04-11 16:16         ` Eric Biggers
2024-04-09 12:42 ` [PATCH 2/2] crypto: x86/sha256-ni - optimize code size Eric Biggers

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=C0FA88ECA90F43B1BF9E7849C53440D7@H270 \
    --to=stefan.kanthak@nexgo.de \
    --cc=ardb@kernel.org \
    --cc=ebiggers@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox