Top Level Namespace

Defined Under Namespace

Modules: SinFastBlank Classes: String

Constant Summary collapse

AVX2_RUNTIME_DISPATCH_PROBE =

Compile-wide -mavx2 bakes AVX2 into the binary and crashes with SIGILL on CPUs without it (pre-Haswell, QEMU defaults, some VPS), so probe for per-function AVX2 + runtime detection and let Init_sin_fast_blank choose. try_link, not try_compile: __builtin_cpu_supports needs link-time runtime support.

<<~SRC
  #include <immintrin.h>
  __attribute__((target("avx2"))) static int avx2_probe(void) {
    __m256i zero = _mm256_setzero_si256();
    return _mm256_movemask_epi8(_mm256_cmpeq_epi8(zero, zero));
  }
  int main(void) {
    return __builtin_cpu_supports("avx2") ? avx2_probe() : 0;
  }
SRC