Fix intrinsics that may be missing on some systems

Create a header to collect all the workarounds for missing intrinsics
in one place
This commit is contained in:
Pauli Oikkonen 2019-05-23 19:59:40 +03:00
parent 87a9208db8
commit 081d16fc33
3 changed files with 24 additions and 11 deletions

View file

@ -26,18 +26,9 @@
#include "context.h"
#include "encode_coding_tree-avx2.h"
#include "encode_coding_tree.h"
#include "strategies/missing-intel-intrinsics.h"
#include <immintrin.h>
// GCC headers apparently won't have this at all.. sigh
#ifndef _andn_u32
// VS2015 headers apparently won't have this at all.. sigh
#ifdef __andn_u32
#define _andn_u32(x, y) (__andn_u32((x), (y)))
#else
#define _andn_u32(x, y) ((~(x)) & (y))
#endif // __andn_u32
#endif // _andn_u32
/*
* NOTE: Unlike SSE/AVX comparisons that would return 11 or 00 for gt/lte,
* this'll use 1x and 0x as bit patterns (x: garbage). A couple extra

View file

@ -0,0 +1,21 @@
#ifndef MISSING_INTEL_INTRINSICS_H_
#define MISSING_INTEL_INTRINSICS_H_
#include <immintrin.h>
// Old Visual Studio headers lack the bsrli variant
#ifndef _mm_bsrli_si128
#define _mm_bsrli_si128(a, imm8) _mm_srli_si128((a), (imm8))
#endif
// GCC headers apparently won't have this at all.. sigh
#ifndef _andn_u32
// VS2015 headers apparently won't have this at all.. sigh
#ifdef __andn_u32
#define _andn_u32(x, y) (__andn_u32((x), (y)))
#else
#define _andn_u32(x, y) ((~(x)) & (y))
#endif // __andn_u32
#endif // _andn_u32
#endif

View file

@ -21,8 +21,9 @@
#ifndef REG_SAD_POW2_WIDTHS_SSE41_H_
#define REG_SAD_POW2_WIDTHS_SSE41_H_
#include <immintrin.h>
#include "kvazaar.h"
#include "strategies/missing-intel-intrinsics.h"
#include <immintrin.h>
static INLINE uint32_t reg_sad_w0(const kvz_pixel * const data1, const kvz_pixel * const data2,
const int32_t height, const uint32_t stride1,