Skip to content

Commit

Permalink
crypto: x86/sha512 - Use TEST %reg,%reg instead of CMP $0,%reg
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Uros Bizjak authored and Herbert Xu committed Dec 4, 2020
1 parent 032d049 commit 0b837f1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arch/x86/crypto/sha512-avx-asm.S
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ frame_size = frame_GPRSAVE + GPRSAVE_SIZE
# "blocks" is the message length in SHA512 blocks
########################################################################
SYM_FUNC_START(sha512_transform_avx)
cmp $0, msglen
test msglen, msglen
je nowork

# Allocate Stack Space
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/crypto/sha512-ssse3-asm.S
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ frame_size = frame_GPRSAVE + GPRSAVE_SIZE
########################################################################
SYM_FUNC_START(sha512_transform_ssse3)

cmp $0, msglen
test msglen, msglen
je nowork

# Allocate Stack Space
Expand Down

0 comments on commit 0b837f1

Please sign in to comment.