All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: x86/poly1305-intel: Use TEST %reg,%reg instead of CMP $0,%reg
@ 2020-11-27 10:18 Uros Bizjak
  2020-12-04  7:15 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Uros Bizjak @ 2020-11-27 10:18 UTC (permalink / raw)
  To: linux-crypto, x86
  Cc: Uros Bizjak, Herbert Xu, Borislav Petkov, H. Peter Anvin

CMP $0,%reg can't set overflow flag, so we can use shorter TEST %reg,%reg
instruction when only zero and sign flags are checked (E,L,LE,G,GE conditions).

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Borislav Petkov <bp@alien8.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
---
 arch/x86/crypto/poly1305-x86_64-cryptogams.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/crypto/poly1305-x86_64-cryptogams.pl b/arch/x86/crypto/poly1305-x86_64-cryptogams.pl
index 7d568012cc15..71fae5a09e56 100644
--- a/arch/x86/crypto/poly1305-x86_64-cryptogams.pl
+++ b/arch/x86/crypto/poly1305-x86_64-cryptogams.pl
@@ -251,7 +251,7 @@ $code.=<<___;
 	mov	%rax,8($ctx)
 	mov	%rax,16($ctx)
 
-	cmp	\$0,$inp
+	test	$inp,$inp
 	je	.Lno_key
 ___
 $code.=<<___ if (!$kernel);
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] crypto: x86/poly1305-intel: Use TEST %reg,%reg instead of CMP $0,%reg
  2020-11-27 10:18 [PATCH] crypto: x86/poly1305-intel: Use TEST %reg,%reg instead of CMP $0,%reg Uros Bizjak
@ 2020-12-04  7:15 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2020-12-04  7:15 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: linux-crypto, x86, Borislav Petkov, H. Peter Anvin

On Fri, Nov 27, 2020 at 11:18:12AM +0100, Uros Bizjak wrote:
> CMP $0,%reg can't set overflow flag, so we can use shorter TEST %reg,%reg
> instruction when only zero and sign flags are checked (E,L,LE,G,GE conditions).
> 
> Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> ---
>  arch/x86/crypto/poly1305-x86_64-cryptogams.pl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-04  7:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-27 10:18 [PATCH] crypto: x86/poly1305-intel: Use TEST %reg,%reg instead of CMP $0,%reg Uros Bizjak
2020-12-04  7:15 ` Herbert Xu

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.