Skip to content

Commit

Permalink
Merge pull request #4232 from facebook/convertSequences_SSE
Browse files Browse the repository at this point in the history
Improve speed of ZSTD_compressSequencesAndLiterals() using AVX2
  • Loading branch information
Cyan4973 authored Jan 16, 2025
2 parents 7227707 + 87f0a4f commit 33747e2
Show file tree
Hide file tree
Showing 6 changed files with 392 additions and 53 deletions.
21 changes: 20 additions & 1 deletion lib/common/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,19 @@

/* compile time determination of SIMD support */
#if !defined(ZSTD_NO_INTRINSICS)
# if defined(__AVX2__)
# define ZSTD_ARCH_X86_AVX2
# endif
# if defined(__SSE2__) || defined(_M_AMD64) || (defined (_M_IX86) && defined(_M_IX86_FP) && (_M_IX86_FP >= 2))
# define ZSTD_ARCH_X86_SSE2
# endif
# if defined(__ARM_NEON) || defined(_M_ARM64)
# define ZSTD_ARCH_ARM_NEON
# endif
#
# if defined(ZSTD_ARCH_X86_AVX2)
# include <immintrin.h>
# endif
# if defined(ZSTD_ARCH_X86_SSE2)
# include <emmintrin.h>
# elif defined(ZSTD_ARCH_ARM_NEON)
Expand Down Expand Up @@ -275,7 +281,7 @@
#endif

/*-**************************************************************
* Alignment check
* Alignment
*****************************************************************/

/* @return 1 if @u is a 2^n value, 0 otherwise
Expand Down Expand Up @@ -309,6 +315,19 @@ MEM_STATIC int ZSTD_isPower2(size_t u) {
# endif
#endif /* ZSTD_ALIGNOF */

#ifndef ZSTD_ALIGNED
/* C90-compatible alignment macro (GCC/Clang). Adjust for other compilers if needed. */
# if defined(__GNUC__)
# define ZSTD_ALIGNED(a) __attribute__((aligned(a)))
# elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */
# define ZSTD_ALIGNED(a) alignas(a)
# else
/* this compiler will require its own alignment instruction */
# define ZSTD_ALIGNED(...)
# endif
#endif /* ZSTD_ALIGNED */


/*-**************************************************************
* Sanitizer
*****************************************************************/
Expand Down
Loading

0 comments on commit 33747e2

Please sign in to comment.