diff options
author | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2016-07-19 13:20:53 +0300 |
---|---|---|
committer | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2016-07-19 13:42:21 +0300 |
commit | f38199dbc290003898a1799adc367265267784c2 (patch) | |
tree | db8853c670c074e3196537dc5ef5b20532185fd1 /cipher/crc-intel-pclmul.c | |
parent | a4d1595a2638db63ac4c73e722c8ba95fdd85ff7 (diff) | |
download | libgcrypt-f38199dbc290003898a1799adc367265267784c2.tar.gz |
crc-intel-pclmul: split assembly block to ease register pressure
* cipher/crc-intel-pclmul.c (crc32_less_than_16): Split inline
assembly block handling 4 byte input into multiple blocks.
--
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'cipher/crc-intel-pclmul.c')
-rw-r--r-- | cipher/crc-intel-pclmul.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/cipher/crc-intel-pclmul.c b/cipher/crc-intel-pclmul.c index 2972fb4d..7a344e29 100644 --- a/cipher/crc-intel-pclmul.c +++ b/cipher/crc-intel-pclmul.c @@ -747,22 +747,28 @@ crc32_less_than_16 (u32 *pcrc, const byte *inbuf, size_t inlen, asm volatile ("movd %[crc], %%xmm0\n\t" "movd %[in], %%xmm1\n\t" "movdqa %[my_p], %%xmm5\n\t" - "pxor %%xmm1, %%xmm0\n\t" + : + : [in] "m" (*inbuf), + [crc] "m" (*pcrc), + [my_p] "m" (consts->my_p[0]) + : "cc" ); + + asm volatile ("pxor %%xmm1, %%xmm0\n\t" "pshufb %[bswap], %%xmm0\n\t" /* [xx][00][00][00] */ "pclmulqdq $0x01, %%xmm5, %%xmm0\n\t" /* [00][xx][xx][00] */ "pclmulqdq $0x11, %%xmm5, %%xmm0\n\t" /* [00][00][xx][xx] */ + : + : [bswap] "m" (*crc32_bswap_shuf) + : "cc" ); - /* store CRC in input endian */ + asm volatile (/* store CRC in input endian */ "movd %%xmm0, %%eax\n\t" "bswapl %%eax\n\t" "movl %%eax, %[out]\n\t" : [out] "=m" (*pcrc) - : [in] "m" (*inbuf), - [crc] "m" (*pcrc), - [my_p] "m" (consts->my_p[0]), - [bswap] "m" (*crc32_bswap_shuf) - : "eax" ); + : + : "eax", "cc" ); } else { |