Alignment instruction ZSTD_ALIGNED() in common/compiler.h

This commit is contained in:
Yann Collet
2025-01-15 17:11:27 -08:00
committed by Yann Collet
parent 2f3ee8b530
commit 8bff69af86
2 changed files with 15 additions and 12 deletions
+1 -11
View File
@@ -7386,22 +7386,12 @@ size_t ZSTD_convertBlockSequences(ZSTD_CCtx* cctx,
#if defined(ZSTD_ARCH_X86_AVX2)
/* C90-compatible alignment macro (GCC/Clang). Adjust for other compilers if needed. */
#if defined(__GNUC__)
# define ALIGNED32 __attribute__((aligned(32)))
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */
# define ALIGNED32 alignas(32)
#else
/* this compiler will require its own alignment instruction */
# define ALIGNED32
#endif
BlockSummary ZSTD_get1BlockSummary(const ZSTD_Sequence* seqs, size_t nbSeqs)
{
size_t i;
__m256i const zeroVec = _mm256_setzero_si256();
__m256i sumVec = zeroVec; /* accumulates match+lit in 32-bit lanes */
ALIGNED32 U32 tmp[8]; /* temporary buffer for reduction */
ZSTD_ALIGNED(32) U32 tmp[8]; /* temporary buffer for reduction */
size_t mSum = 0, lSum = 0;
ZSTD_STATIC_ASSERT(sizeof(ZSTD_Sequence) == 16);