Skip to content

Commit 0b837f1

Browse files
ubizjakherbertx
authored andcommitted
crypto: x86/sha512 - Use TEST %reg,%reg instead of CMP $0,%reg
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> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 032d049 commit 0b837f1

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

arch/x86/crypto/sha512-avx-asm.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ frame_size = frame_GPRSAVE + GPRSAVE_SIZE
278278
# "blocks" is the message length in SHA512 blocks
279279
########################################################################
280280
SYM_FUNC_START(sha512_transform_avx)
281-
cmp $0, msglen
281+
test msglen, msglen
282282
je nowork
283283

284284
# Allocate Stack Space

arch/x86/crypto/sha512-ssse3-asm.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ frame_size = frame_GPRSAVE + GPRSAVE_SIZE
280280
########################################################################
281281
SYM_FUNC_START(sha512_transform_ssse3)
282282

283-
cmp $0, msglen
283+
test msglen, msglen
284284
je nowork
285285

286286
# Allocate Stack Space

0 commit comments

Comments
 (0)