All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ondrej Mosnáček" <omosnacek@gmail.com>
To: Eric Biggers <ebiggers3@gmail.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	linux-crypto@vger.kernel.org, Jeffrey Walton <noloader@gmail.com>,
	Milan Broz <gmazyland@gmail.com>,
	Eric Biggers <ebiggers@google.com>
Subject: Re: [PATCH v3] crypto: gf128mul - define gf128mul_x_* in gf128mul.h
Date: Sat, 1 Apr 2017 17:13:51 +0200	[thread overview]
Message-ID: <CAAUqJDuaLaAp5JUtekzKTur09SGj1LR0JhWrERg_AbAjAzFxNA@mail.gmail.com> (raw)
In-Reply-To: <20170401034407.GA598@zzz>

2017-04-01 5:44 GMT+02:00 Eric Biggers <ebiggers3@gmail.com>:
> Also, I realized that for gf128mul_x_lle() now that we aren't using the table we
> don't need to shift '_tt' but rather can use the constant 0xe100000000000000:
>
>         /* equivalent to (u64)gf128mul_table_le[(b << 7) & 0xff] << 48
>          * (see crypto/gf128mul.c): */
>         u64 _tt = gf128mul_mask_from_bit(b, 0) & 0xe100000000000000;
>
>         r->b = cpu_to_be64((b >> 1) | (a << 63));
>         r->a = cpu_to_be64((a >> 1) ^ _tt);
>
> I think that would be better and you could send a v4 to do it that way if you
> want.  It's not a huge deal though.

Yes, I was hoping the compiler would be wise enough to fold the shift
into the constant, but I didn't actually check the assembly output...
I took the time to write a quick benchmark and the version without
shift is indeed notably faster.

That said, I'll go the extra mile and send a v4.

Thanks for the review!

O.M.

      reply	other threads:[~2017-04-01 15:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31  9:27 [PATCH v3] crypto: gf128mul - define gf128mul_x_* in gf128mul.h Ondrej Mosnacek
2017-04-01  3:44 ` Eric Biggers
2017-04-01 15:13   ` Ondrej Mosnáček [this message]

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=CAAUqJDuaLaAp5JUtekzKTur09SGj1LR0JhWrERg_AbAjAzFxNA@mail.gmail.com \
    --to=omosnacek@gmail.com \
    --cc=davem@davemloft.net \
    --cc=ebiggers3@gmail.com \
    --cc=ebiggers@google.com \
    --cc=gmazyland@gmail.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=noloader@gmail.com \
    /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.