libbb/sha256: code shrink in x86 assembly

function                                             old     new   delta
sha256_process_block64_shaNI 32-bit                  676     673      -3
sha256_process_block64_shaNI 64-bit                  680     677      -3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2022-02-09 01:50:22 +01:00
parent 11bcea7ac0
commit caa9c4f707
2 changed files with 10 additions and 12 deletions

View File

@ -39,13 +39,12 @@
.balign 8 # allow decoders to fetch at least 2 first insns .balign 8 # allow decoders to fetch at least 2 first insns
sha256_process_block64_shaNI: sha256_process_block64_shaNI:
movu128 76+0*16(%eax), STATE1 /* DCBA (msb-to-lsb: 3,2,1,0) */ movu128 76+0*16(%eax), XMMTMP /* DCBA (msb-to-lsb: 3,2,1,0) */
movu128 76+1*16(%eax), STATE0 /* HGFE */ movu128 76+1*16(%eax), STATE1 /* HGFE */
/* shufps takes dwords 0,1 from *2nd* operand, and dwords 2,3 from 1st one */ /* shufps takes dwords 0,1 from *2nd* operand, and dwords 2,3 from 1st one */
mova128 STATE0, XMMTMP mova128 STATE1, STATE0
shufps SHUF(1,0,1,0), STATE1, STATE0 /* ABEF */ shufps SHUF(1,0,1,0), XMMTMP, STATE0 /* ABEF */
shufps SHUF(3,2,3,2), STATE1, XMMTMP /* CDGH */ shufps SHUF(3,2,3,2), XMMTMP, STATE1 /* CDGH */
mova128 XMMTMP, STATE1
/* XMMTMP holds flip mask from here... */ /* XMMTMP holds flip mask from here... */
mova128 PSHUFFLE_BSWAP32_FLIP_MASK, XMMTMP mova128 PSHUFFLE_BSWAP32_FLIP_MASK, XMMTMP

View File

@ -42,13 +42,12 @@
.balign 8 # allow decoders to fetch at least 2 first insns .balign 8 # allow decoders to fetch at least 2 first insns
sha256_process_block64_shaNI: sha256_process_block64_shaNI:
movu128 80+0*16(%rdi), STATE1 /* DCBA (msb-to-lsb: 3,2,1,0) */ movu128 80+0*16(%rdi), XMMTMP /* DCBA (msb-to-lsb: 3,2,1,0) */
movu128 80+1*16(%rdi), STATE0 /* HGFE */ movu128 80+1*16(%rdi), STATE1 /* HGFE */
/* shufps takes dwords 0,1 from *2nd* operand, and dwords 2,3 from 1st one */ /* shufps takes dwords 0,1 from *2nd* operand, and dwords 2,3 from 1st one */
mova128 STATE0, XMMTMP mova128 STATE1, STATE0
shufps SHUF(1,0,1,0), STATE1, STATE0 /* ABEF */ shufps SHUF(1,0,1,0), XMMTMP, STATE0 /* ABEF */
shufps SHUF(3,2,3,2), STATE1, XMMTMP /* CDGH */ shufps SHUF(3,2,3,2), XMMTMP, STATE1 /* CDGH */
mova128 XMMTMP, STATE1
/* XMMTMP holds flip mask from here... */ /* XMMTMP holds flip mask from here... */
mova128 PSHUFFLE_BSWAP32_FLIP_MASK(%rip), XMMTMP mova128 PSHUFFLE_BSWAP32_FLIP_MASK(%rip), XMMTMP