Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes for non-avx targets #239

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/vec_avx.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ typedef struct {
__m128i lo;
__m128i hi;
} mm256i_emu;

#ifndef __AVX__
typedef long long __m256i __attribute__((__vector_size__(32), __aligned__(32)));
#endif

typedef __m256i real_m256i;
#define __m256i mm256i_emu

Expand Down Expand Up @@ -237,6 +242,8 @@ static inline mm256i_emu mm256_madd_epi16(mm256i_emu a, mm256i_emu b) {
}
#define _mm256_madd_epi16(a,b) mm256_madd_epi16(a,b)

#if defined(__AVX2__) || defined(__SSSE3__)

static inline mm256i_emu mm256_maddubs_epi16(mm256i_emu a, mm256i_emu b) {
mm256i_emu ret;
ret.lo = _mm_maddubs_epi16(a.lo, b.lo);
Expand All @@ -245,7 +252,7 @@ static inline mm256i_emu mm256_maddubs_epi16(mm256i_emu a, mm256i_emu b) {
}
#define _mm256_maddubs_epi16(a,b) mm256_maddubs_epi16(a,b)


#endif

/* Emulating the conversion functions is tricky because they use __m256i but are defined in AVX.
So we need to make a special when only AVX is available. */
Expand Down