base: restrict x86_avx2 to 64-bit (not 32-bit) x86

32-bit C/C++ compilers don't always compile the AVX intrinsics. Per the
60773 bug below,
> clang++ -m32 etc etc fuzz/c/std/jpeg_fuzzer.c
> undefined reference to `_mm_cvtsi128_si64'
> undefined reference to `_mm256_extract_epi64'

See also the "#ifdef __x86_64__" guards in
https://github.com/gcc-mirror/gcc/blob/4a3895903c29ed85da6fcb886f31ff23d4c6e935/gcc/config/i386/emmintrin.h#L228-L231
https://github.com/llvm/llvm-project/blob/08fab9ebecf72a682279d75489dc2460121cbeed/clang/lib/Headers/emmintrin.h#L3502-L3515

Note that -m32 is not the same as -mx32
> $ touch empty.c
> $ gcc       -dM -E empty.c | grep -E '__i386__|__x86_64__'
> #define __x86_64__ 1
> $ gcc -m32  -dM -E empty.c | grep -E '__i386__|__x86_64__'
> #define __i386__ 1
> $ gcc -mx32 -dM -E empty.c | grep -E '__i386__|__x86_64__'
> #define __x86_64__ 1

Updates https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60773
This commit is contained in:
Nigel Tao committed 2023-07-23 21:20:35 +10:00
1 parent 605b10a492
commit e2b9566fc5
7 files changed
+44 -32

No files matched your search

@@ -15,7 +15,7 @@
// --------
// ‼ WUFFS MULTI-FILE SECTION +x86_avx2
#if defined(WUFFS_BASE__CPU_ARCH__X86_FAMILY)
#if defined(WUFFS_BASE__CPU_ARCH__X86_64)
WUFFS_BASE__MAYBE_ATTRIBUTE_TARGET("pclmul,popcnt,sse4.2,avx2")
static void //
wuffs_base__pixel_swizzler__swizzle_ycc__convert_bgrx_x86_avx2(
@@ -632,5 +632,5 @@ wuffs_base__pixel_swizzler__swizzle_ycc__upsample_inv_h2v2_triangle_x86_avx2(
return dst_ptr;
}
#endif // defined(WUFFS_BASE__CPU_ARCH__X86_FAMILY)
#endif // defined(WUFFS_BASE__CPU_ARCH__X86_64)
// ‼ WUFFS MULTI-FILE SECTION -x86_avx2