From 00c904c9279aefe1bdb04c44aab76979e0e0cd22 Mon Sep 17 00:00:00 2001 From: Ken Cooke Date: Wed, 21 Jun 2017 09:34:02 -0700 Subject: [PATCH] Detect compiler support for SIMD intrinsics in conditional compilation --- libraries/audio/src/avx2/AudioFOA_avx2.cpp | 8 ++------ libraries/audio/src/avx2/AudioHRTF_avx2.cpp | 8 ++------ libraries/audio/src/avx2/AudioSRC_avx2.cpp | 6 +----- libraries/audio/src/avx512/AudioHRTF_avx512.cpp | 6 +----- 4 files changed, 6 insertions(+), 22 deletions(-) diff --git a/libraries/audio/src/avx2/AudioFOA_avx2.cpp b/libraries/audio/src/avx2/AudioFOA_avx2.cpp index de5dfcd0b5..880f40b185 100644 --- a/libraries/audio/src/avx2/AudioFOA_avx2.cpp +++ b/libraries/audio/src/avx2/AudioFOA_avx2.cpp @@ -9,15 +9,11 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__x86_64__) +#ifdef __AVX2__ #include #include -#include // AVX2 - -#ifndef __AVX2__ -#error Must be compiled with /arch:AVX2 or -mavx2 -mfma. -#endif +#include #define _mm256_permute4x64_ps(ymm, imm) _mm256_castpd_ps(_mm256_permute4x64_pd(_mm256_castps_pd(ymm), imm)); diff --git a/libraries/audio/src/avx2/AudioHRTF_avx2.cpp b/libraries/audio/src/avx2/AudioHRTF_avx2.cpp index 452ceb7f4c..e89128b173 100644 --- a/libraries/audio/src/avx2/AudioHRTF_avx2.cpp +++ b/libraries/audio/src/avx2/AudioHRTF_avx2.cpp @@ -9,17 +9,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__x86_64__) +#ifdef __AVX2__ #include -#include // AVX2 +#include #include "../AudioHRTF.h" -#ifndef __AVX2__ -#error Must be compiled with /arch:AVX2 or -mavx2 -mfma. -#endif - #if defined(__GNUC__) && !defined(__clang__) // for some reason, GCC -O2 results in poorly optimized code #pragma GCC optimize("Os") diff --git a/libraries/audio/src/avx2/AudioSRC_avx2.cpp b/libraries/audio/src/avx2/AudioSRC_avx2.cpp index 693bad7fc6..0e31a58ce7 100644 --- a/libraries/audio/src/avx2/AudioSRC_avx2.cpp +++ b/libraries/audio/src/avx2/AudioSRC_avx2.cpp @@ -9,17 +9,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__x86_64__) +#ifdef __AVX2__ #include #include #include "../AudioSRC.h" -#ifndef __AVX2__ -#error Must be compiled with /arch:AVX2 or -mavx2 -mfma. -#endif - // high/low part of int64_t #define LO32(a) ((uint32_t)(a)) #define HI32(a) ((int32_t)((a) >> 32)) diff --git a/libraries/audio/src/avx512/AudioHRTF_avx512.cpp b/libraries/audio/src/avx512/AudioHRTF_avx512.cpp index 08a1389e57..a8bb62be35 100644 --- a/libraries/audio/src/avx512/AudioHRTF_avx512.cpp +++ b/libraries/audio/src/avx512/AudioHRTF_avx512.cpp @@ -9,17 +9,13 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__x86_64__) +#ifdef __AVX512F__ #include #include #include "../AudioHRTF.h" -#ifndef __AVX512F__ -#error Must be compiled with /arch:AVX512 or -mavx512f. -#endif - #if defined(__GNUC__) && !defined(__clang__) // for some reason, GCC -O2 results in poorly optimized code #pragma GCC optimize("Os")