Skip to content

Commit

Permalink
Merge pull request #4250 from facebook/x86_32_avx2
Browse files Browse the repository at this point in the history
added a CI test for x86 32-bit + avx2 combination
  • Loading branch information
Cyan4973 authored Jan 19, 2025
2 parents a469e7c + d2d7461 commit e475dc4
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 9 deletions.
23 changes: 22 additions & 1 deletion .github/workflows/dev-short-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,17 @@ jobs:
make clean
bash tests/libzstd_builds.sh
gcc-make-tests-32bit:
gcc-make-all-avx2:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
- name: Make all, with AVX2
run: |
sudo apt-get -qqq update
make libc6install
CFLAGS="-Werror -mavx2" make -j all
gcc-make-all-32bit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
Expand All @@ -174,6 +184,17 @@ jobs:
make libc6install
CFLAGS="-Werror -m32" make -j all32
gcc-make-all-32bit-avx2:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
- name: Make all, 32bit + AVX2 mode
run: |
sudo apt-get -qqq update
make libc6install
CPPFLAGS="-DSTATIC_BMI2=1" CFLAGS="-Werror -m32 -mavx2 -mbmi2" make -j all32
gcc-8-make:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion lib/common/bitstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ MEM_STATIC size_t BIT_closeCStream(BIT_CStream_t* bitC)
BIT_addBitsFast(bitC, 1, 1); /* endMark */
BIT_flushBits(bitC);
if (bitC->ptr >= bitC->endPtr) return 0; /* overflow detected */
return (bitC->ptr - bitC->startPtr) + (bitC->bitPos > 0);
return (size_t)(bitC->ptr - bitC->startPtr) + (bitC->bitPos > 0);
}


Expand Down
6 changes: 3 additions & 3 deletions lib/common/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,10 @@
# pragma warning(disable : 4324) /* disable: C4324: padded structure */
#endif

/*Like DYNAMIC_BMI2 but for compile time determination of BMI2 support*/
/* Like DYNAMIC_BMI2 but for compile time determination of BMI2 support */
#ifndef STATIC_BMI2
# if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_I86))
# ifdef __AVX2__ //MSVC does not have a BMI2 specific flag, but every CPU that supports AVX2 also supports BMI2
# ifdef __AVX2__ /* MSVC does not have a BMI2 specific flag, but every CPU that supports AVX2 also supports BMI2 */
# define STATIC_BMI2 1
# endif
# elif defined(__BMI2__) && defined(__x86_64__) && defined(__GNUC__)
Expand All @@ -219,7 +219,7 @@
#endif

#ifndef STATIC_BMI2
#define STATIC_BMI2 0
# define STATIC_BMI2 0
#endif

/* compile time determination of SIMD support */
Expand Down
9 changes: 5 additions & 4 deletions lib/compress/zstd_compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -7125,7 +7125,7 @@ size_t ZSTD_compressSequences(ZSTD_CCtx* cctx,
* @returns > 0 if there is one long length (> 65535),
* indicating the position, and type.
*/
size_t convertSequences_noRepcodes(
static size_t convertSequences_noRepcodes(
SeqDef* dstSeqs,
const ZSTD_Sequence* inSeqs,
size_t nbSequences)
Expand Down Expand Up @@ -7277,9 +7277,10 @@ size_t convertSequences_noRepcodes(

#else /* no AVX2 */

static size_t
convertSequences_noRepcodes(SeqDef* dstSeqs,
const ZSTD_Sequence* const inSeqs, size_t nbSequences)
static size_t convertSequences_noRepcodes(
SeqDef* dstSeqs,
const ZSTD_Sequence* inSeqs,
size_t nbSequences)
{
size_t longLen = 0;
size_t n;
Expand Down

0 comments on commit e475dc4

Please sign in to comment.