OSDN Git Service

swr: Refactor checks for compiler feature flags
authorChuck Atkins <chuck.atkins@kitware.com>
Tue, 28 Jun 2016 19:50:47 +0000 (15:50 -0400)
committerEmil Velikov <emil.l.velikov@gmail.com>
Wed, 27 Jul 2016 14:15:34 +0000 (15:15 +0100)
commitd70f97784b86ef41049153f5d8a859901f1ca09c
tree30ee4c247ea5298142b35fd55cecd0c79e4716d3
parentcd10b86026b0ee8b502ca89d9e807356b3e417ac
swr: Refactor checks for compiler feature flags

Encapsulate the test for which flags are needed to get a compiler to
support certain features.  Along with this, give various options to try
for AVX and AVX2 support.  Ideally we want to use specific instruction
set feature flags, like -mavx2 for instance instead of -march=haswell,
but the flags required for certain compilers are different.  This
allows, for AVX2 for instance, GCC to use -mavx2 -mfma -mbmi2 -mf16c
while the Intel compiler which doesn't support those flags can fall
back to using -march=core-avx2.

This addresses a bug where the Intel compiler will silently ignore the
AVX2 instruction feature flags and then potentially fail to build.

v2: Pass preprocessor-check argument as true-state instead of
    false-state for clarity.
v3: Reduce AVX2 define test to just __AVX2__.  Additional defines suchas
    __FMA__, __BMI2__, and __F16C__ appear to be inconsistently defined
    w.r.t thier availability.
v4: Fix C++11 flags being added globally and add more logic to
    swr_require_cxx_feature_flags

Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
Tested-by: Tim Rowley <timothy.o.rowley@Intel.com>
Signed-off-by: Chuck Atkins <chuck.atkins@kitware.com>
(cherry picked from commit c1bf6692beb662e5749e5680e0ebd15af2cd032a)
configure.ac
src/gallium/drivers/swr/Makefile.am