Skip to contentSkip to conversation

x86: crypto: fix building crc32c with clang ias

PATCH In review Arnd Bergmann 4 participants 6 messages May 27, 2020 – Jul 23, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: crypto: fix building crc32c with clang ias

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")
---
 arch/x86/crypto/crc32c-pcl-intel-asm_64.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/crypto/crc32c-pcl-intel-asm_64.S +1 -1
index 8501ec4532f4..442599cbe796 100644
@@ -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
Signature · 1 line
2.26.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Arnd Bergmann

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")

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

Quoted 20 lines
---
 arch/x86/crypto/crc32c-pcl-intel-asm_64.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/crypto/crc32c-pcl-intel-asm_64.S +1 -1
index 8501ec4532f4..442599cbe796 100644
@@ -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
Signature · 1 line
2.26.2
#2 lore raw
Quoted 12 lines · Nathan Chancellor
Quoted 9 lines · Arnd Bergmann

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")
Quoted 7 lines

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

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

Arnd

#3 lore raw
Quoted 17 lines · Arnd Bergmann
Quoted 15 lines · Nathan Chancellor
Quoted 9 lines · Arnd Bergmann

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")

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

Quoted 8 lines
Quoted 4 lines

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

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

maintainer
#4 lore raw
In reply to Arnd Bergmann
Quoted 4 lines · Arnd Bergmann

The clang integrated assembler complains about movzxw:

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

Quoted 8 lines

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")
---
 arch/x86/crypto/crc32c-pcl-intel-asm_64.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#5 lore raw
Quoted 9 lines · Herbert Xu
Quoted 7 lines · Arnd Bergmann

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.

Quoted 8 lines
Quoted 5 lines
Fixes 6a8ce1ef3940 ("crypto: crc32c - Optimize CRC32C calculation with PCLMULQDQ instruction")
---
 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