[PATCH 1/2] Fix building AVX512 Intel-syntax assembly with x86-64 clang

Jussi Kivilinna jussi.kivilinna at iki.fi
Wed Dec 14 18:49:08 CET 2022


* cipher/asm-common-amd64.h (spec_stop_avx512_intel_syntax): New.
* cipher/poly1305-amd64-avx512.S: Use spec_stop_avx512_intel_syntax
instead of spec_stop_avx512.
* cipher/sha512-avx512-amd64.S: Likewise.
--

Reported-by: Clemens Lang <cllang at redhat.com>
Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
 cipher/asm-common-amd64.h      | 4 ++++
 cipher/poly1305-amd64-avx512.S | 2 +-
 cipher/sha512-avx512-amd64.S   | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/cipher/asm-common-amd64.h b/cipher/asm-common-amd64.h
index dc2c4d2f..cd93abc3 100644
--- a/cipher/asm-common-amd64.h
+++ b/cipher/asm-common-amd64.h
@@ -198,4 +198,8 @@
 	vpxord %xmm16, %xmm16, %xmm16; \
 	vpopcntb %xmm16, %xmm16; /* Supported only by newer AVX512 CPUs. */
 
+#define spec_stop_avx512_intel_syntax \
+	vpxord xmm16, xmm16, xmm16; \
+	vpopcntb xmm16, xmm16; /* Supported only by newer AVX512 CPUs. */
+
 #endif /* GCRY_ASM_COMMON_AMD64_H */
diff --git a/cipher/poly1305-amd64-avx512.S b/cipher/poly1305-amd64-avx512.S
index 5c8f838f..6622861f 100644
--- a/cipher/poly1305-amd64-avx512.S
+++ b/cipher/poly1305-amd64-avx512.S
@@ -1580,7 +1580,7 @@ ELF(.size _gcry_poly1305_avx512_consts,.-_gcry_poly1305_avx512_consts)
 ELF(.type _gcry_poly1305_amd64_avx512_blocks, at function;)
 _gcry_poly1305_amd64_avx512_blocks:
 	CFI_STARTPROC()
-	spec_stop_avx512;
+	spec_stop_avx512_intel_syntax;
 	FUNC_ENTRY()
 
 #define _a0 gp3
diff --git a/cipher/sha512-avx512-amd64.S b/cipher/sha512-avx512-amd64.S
index 145c8667..65475422 100644
--- a/cipher/sha512-avx512-amd64.S
+++ b/cipher/sha512-avx512-amd64.S
@@ -264,7 +264,7 @@ _gcry_sha512_transform_amd64_avx512:
 	cmp	rdx, 0
 	je	.Lnowork
 
-	spec_stop_avx512;
+	spec_stop_avx512_intel_syntax;
 
 	/* Setup mask register for DC:BA merging. */
 	mov	eax, 0b1100
-- 
2.37.2




More information about the Gcrypt-devel mailing list