diff mbox series

x86: crypto: fix building crc32c with clang ias

Message ID 20200527141754.1850968-1-arnd@arndb.de (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series x86: crypto: fix building crc32c with clang ias | expand

Commit Message

Arnd Bergmann May 27, 2020, 2:17 p.m. UTC
The clang integrated assembler complains about movzxw:

arch/x86/crypto/crc32c-pcl-intel-asm_64.S:173:2: error: invalid instruction mnemonic 'movzxw'

It seems that movzwq is the mnemonic that it expects instead,
and this is what objdump prints when disassembling the file.

Fixes: 6a8ce1ef3940 ("crypto: crc32c - Optimize CRC32C calculation with PCLMULQDQ instruction")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/crypto/crc32c-pcl-intel-asm_64.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nathan Chancellor May 27, 2020, 4:42 p.m. UTC | #1
On Wed, May 27, 2020 at 04:17:40PM +0200, Arnd Bergmann wrote:
> The clang integrated assembler complains about movzxw:
> 
> arch/x86/crypto/crc32c-pcl-intel-asm_64.S:173:2: error: invalid instruction mnemonic 'movzxw'
> 
> It seems that movzwq is the mnemonic that it expects instead,
> and this is what objdump prints when disassembling the file.
> 
> Fixes: 6a8ce1ef3940 ("crypto: crc32c - Optimize CRC32C calculation with PCLMULQDQ instruction")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

We had an identical patch pending from another contributor, see the
discussion and result in the issue below.

https://github.com/ClangBuiltLinux/linux/issues/1010

Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>

> ---
>  arch/x86/crypto/crc32c-pcl-intel-asm_64.S | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/crypto/crc32c-pcl-intel-asm_64.S b/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
> index 8501ec4532f4..442599cbe796 100644
> --- a/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
> +++ b/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
> @@ -170,7 +170,7 @@ continue_block:
>  
>  	## branch into array
>  	lea	jump_table(%rip), %bufp
> -	movzxw  (%bufp, %rax, 2), len
> +	movzwq  (%bufp, %rax, 2), len
>  	lea	crc_array(%rip), %bufp
>  	lea     (%bufp, len, 1), %bufp
>  	JMP_NOSPEC bufp
> -- 
> 2.26.2
>
Arnd Bergmann May 27, 2020, 6:24 p.m. UTC | #2
On Wed, May 27, 2020 at 6:42 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> On Wed, May 27, 2020 at 04:17:40PM +0200, Arnd Bergmann wrote:
> > The clang integrated assembler complains about movzxw:
> >
> > arch/x86/crypto/crc32c-pcl-intel-asm_64.S:173:2: error: invalid instruction mnemonic 'movzxw'
> >
> > It seems that movzwq is the mnemonic that it expects instead,
> > and this is what objdump prints when disassembling the file.
> >
> > Fixes: 6a8ce1ef3940 ("crypto: crc32c - Optimize CRC32C calculation with PCLMULQDQ instruction")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> We had an identical patch pending from another contributor, see the
> discussion and result in the issue below.
>
> https://github.com/ClangBuiltLinux/linux/issues/1010
>
> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
>

Was the other one submitted upstream? If yes, let's use that one.

     Arnd
Nathan Chancellor May 27, 2020, 7:34 p.m. UTC | #3
On Wed, May 27, 2020 at 08:24:35PM +0200, Arnd Bergmann wrote:
> On Wed, May 27, 2020 at 6:42 PM Nathan Chancellor
> <natechancellor@gmail.com> wrote:
> >
> > On Wed, May 27, 2020 at 04:17:40PM +0200, Arnd Bergmann wrote:
> > > The clang integrated assembler complains about movzxw:
> > >
> > > arch/x86/crypto/crc32c-pcl-intel-asm_64.S:173:2: error: invalid instruction mnemonic 'movzxw'
> > >
> > > It seems that movzwq is the mnemonic that it expects instead,
> > > and this is what objdump prints when disassembling the file.
> > >
> > > Fixes: 6a8ce1ef3940 ("crypto: crc32c - Optimize CRC32C calculation with PCLMULQDQ instruction")
> > > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> >
> > We had an identical patch pending from another contributor, see the
> > discussion and result in the issue below.
> >
> > https://github.com/ClangBuiltLinux/linux/issues/1010
> >
> > Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
> >
> 
> Was the other one submitted upstream? If yes, let's use that one.
> 
>      Arnd

No, at least not that I saw. I've added Diab to CC now though to
confirm.

Cheers,
Nathan
Herbert Xu July 23, 2020, 7:56 a.m. UTC | #4
On Wed, May 27, 2020 at 04:17:40PM +0200, Arnd Bergmann wrote:
> The clang integrated assembler complains about movzxw:
> 
> arch/x86/crypto/crc32c-pcl-intel-asm_64.S:173:2: error: invalid instruction mnemonic 'movzxw'
> 
> It seems that movzwq is the mnemonic that it expects instead,
> and this is what objdump prints when disassembling the file.
> 
> Fixes: 6a8ce1ef3940 ("crypto: crc32c - Optimize CRC32C calculation with PCLMULQDQ instruction")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  arch/x86/crypto/crc32c-pcl-intel-asm_64.S | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied.  Thanks.
Sedat Dilek July 23, 2020, 8:18 a.m. UTC | #5
On Thu, Jul 23, 2020 at 9:57 AM Herbert Xu <herbert@gondor.apana.org.au> wrote:
>
> On Wed, May 27, 2020 at 04:17:40PM +0200, Arnd Bergmann wrote:
> > The clang integrated assembler complains about movzxw:
> >
> > arch/x86/crypto/crc32c-pcl-intel-asm_64.S:173:2: error: invalid instruction mnemonic 'movzxw'
> >
> > It seems that movzwq is the mnemonic that it expects instead,
> > and this is what objdump prints when disassembling the file.
> >
> > Fixes: 6a8ce1ef3940 ("crypto: crc32c - Optimize CRC32C calculation with PCLMULQDQ instruction")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> >  arch/x86/crypto/crc32c-pcl-intel-asm_64.S | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Patch applied.  Thanks.
>

Thanks you very much.

Now we have all x86/crypto patches to be able to use Clang's
Integrated Assembler (IAS) and build with `make LLVM_IAS=1`.

- Sedat -

[1] https://github.com/ClangBuiltLinux/linux/issues/1049#issuecomment-662609378
diff mbox series

Patch

diff --git a/arch/x86/crypto/crc32c-pcl-intel-asm_64.S b/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
index 8501ec4532f4..442599cbe796 100644
--- a/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
+++ b/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
@@ -170,7 +170,7 @@  continue_block:
 
 	## branch into array
 	lea	jump_table(%rip), %bufp
-	movzxw  (%bufp, %rax, 2), len
+	movzwq  (%bufp, %rax, 2), len
 	lea	crc_array(%rip), %bufp
 	lea     (%bufp, len, 1), %bufp
 	JMP_NOSPEC bufp