Commit 5150b85b authored by Roel Aaij's avatar Roel Aaij
Browse files

Remove bundled QuantStack stuff in favour of external projects.

parent c05d0651
......@@ -10,6 +10,8 @@ option(ENABLE_TESTS "Enable tests" TRUE)
include(ExternalProject)
include(FindPackageHandleStandardArgs)
set(EXTERNAL_DIR "external")
if (ENABLE_VC)
find_package(Vc)
......@@ -17,7 +19,6 @@ if (NOT Vc_FOUND OR "${Vc_VERSION}" VERSION_LESS "1.3.2")
message(STATUS "Using builtin Vc")
set(EXTERNAL_DIR "external")
set(Vc_VERSION "1.4.1")
set(Vc_PROJECT "Vc-${Vc_VERSION}")
set(Vc_SRC_URI "https://github.com/VcDevel/Vc/archive/${Vc_VERSION}.tar.gz")
......@@ -47,14 +48,6 @@ set(Vc_LIBRARIES Vc)
set(Vc_INCLUDE_DIR "${Vc_DESTDIR}/include")
set(Vc_CMAKE_MODULES_DIR "${Vc_DESTDIR}/lib/cmake/Vc")
# add_library(VcExt STATIC IMPORTED)
# set_property(TARGET VcExt PROPERTY IMPORTED_LOCATION ${Vc_LIBRARY})
# add_dependencies(VcExt VC)
# add_library(Vc INTERFACE)
# target_include_directories(Vc SYSTEM BEFORE INTERFACE $<BUILD_INTERFACE:${Vc_INCLUDE_DIR}>)
# target_link_libraries(Vc INTERFACE VcExt)
find_package_handle_standard_args(Vc
FOUND_VAR Vc_FOUND
REQUIRED_VARS Vc_INCLUDE_DIR Vc_LIBRARIES Vc_CMAKE_MODULES_DIR
......@@ -76,6 +69,7 @@ ExternalProject_Add(vectorclass
URL_HASH SHA256=f9cb70a3e865dd019b58f449d11f90147ce8ba5f2c60410389ec0ead92944b97
SOURCE_DIR vectorclass
INSTALL_DIR ${vectorclass_ROOTDIR}
LOG_DOWNLOAD 1 LOG_BUILD 1 LOG_INSTALL 1
CONFIGURE_COMMAND ""
BUILD_COMMAND unzip -d <SOURCE_DIR> -o <SOURCE_DIR>/special.zip
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR> <INSTALL_DIR>
......@@ -145,15 +139,29 @@ target_compile_definitions(generate PUBLIC "-DVc_IMPL=AVX2")
endif()
if(ENABLE_PYTHON)
include(XTensor)
include(pybind11Tools)
pybind11_add_module(k40gen "src/k40gen/bindings.cpp")
target_link_libraries(k40gen PUBLIC generate)
if (xtp_BUILTIN)
add_dependencies(k40gen xtp-install)
target_include_directories(k40gen PRIVATE ${CMAKE_BINARY_DIR}/external/include)
endif()
# xtensor external dependencies
if (USE_AVX2)
target_compile_definitions(k40gen PRIVATE "-DXTENSOR_ENABLE_XSIMD")
endif()
# pybind11 headers
if("${PYBIND11_INCLUDE_DIR}" STREQUAL "")
find_package(pybind11 QUIET)
if (NOT pybind11_FOUND)
message(FAILURE "PYBIND11_INCLUDE_DIR is not set and pybind11 cannot be found")
else()
target_include_directories(k40gen PRIVATE ${PYBIND11_INCLUDE_DIR})
endif()
else()
endif()
......
# - Find the NumPy libraries
# This module finds if Pybind11 is installed, and sets the following variables
# indicating where it is.
#
# TODO: Update to provide the libraries and paths for linking npymath lib.
#
# PYBIND11_FOUND - was Pybind11 found
# PYBIND11_VERSION - the version of Pybind11 found as a string
# PYBIND11_VERSION_MAJOR - the major version number of Pybind11
# PYBIND11_VERSION_MINOR - the minor version number of Pybind11
# PYBIND11_VERSION_PATCH - the patch version number of Pybind11
# PYBIND11_VERSION_DECIMAL - e.g. version 1.6.1 is 10601
# PYBIND11_INCLUDE_DIRS - path to the Pybind11 include files
#============================================================================
# Copyright 2012 Continuum Analytics, Inc.
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
#============================================================================
# Finding Pybind11 involves calling the Python interpreter
if(Pybind11_FIND_REQUIRED)
find_package(PythonInterp REQUIRED)
else()
find_package(PythonInterp)
endif()
if(NOT PYTHONINTERP_FOUND)
set(PYBIND11_FOUND FALSE)
endif()
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
"import pybind11 as pb; print(pb.__version__); print(pb.get_include());"
RESULT_VARIABLE _PYBIND11_SEARCH_SUCCESS
OUTPUT_VARIABLE _PYBIND11_VALUES
ERROR_VARIABLE _PYBIND11_ERROR_VALUE
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT _PYBIND11_SEARCH_SUCCESS MATCHES 0)
if(Pybind11_FIND_REQUIRED)
message(FATAL_ERROR
"pybind11 import failure:\n${_PYBIND11_ERROR_VALUE}")
endif()
set(PYBIND11_FOUND FALSE)
endif()
# Convert the process output into a list
string(REGEX REPLACE ";" "\\\\;" _PYBIND11_VALUES ${_PYBIND11_VALUES})
string(REGEX REPLACE "\n" ";" _PYBIND11_VALUES ${_PYBIND11_VALUES})
list(GET _PYBIND11_VALUES 0 PYBIND11_VERSION)
list(GET _PYBIND11_VALUES 1 PYBIND11_INCLUDE_DIRS)
# Make sure all directory separators are '/'
string(REGEX REPLACE "\\\\" "/" PYBIND11_INCLUDE_DIRS ${PYBIND11_INCLUDE_DIRS})
# Get the major and minor version numbers
string(REGEX REPLACE "\\." ";" _PYBIND11_VERSION_LIST ${PYBIND11_VERSION})
list(GET _PYBIND11_VERSION_LIST 0 PYBIND11_VERSION_MAJOR)
list(GET _PYBIND11_VERSION_LIST 1 PYBIND11_VERSION_MINOR)
list(GET _PYBIND11_VERSION_LIST 2 PYBIND11_VERSION_PATCH)
string(REGEX MATCH "[0-9]*" PYBIND11_VERSION_PATCH ${PYBIND11_VERSION_PATCH})
math(EXPR PYBIND11_VERSION_DECIMAL
"(${PYBIND11_VERSION_MAJOR} * 10000) + (${PYBIND11_VERSION_MINOR} * 100) + ${PYBIND11_VERSION_PATCH}")
find_package_message(PYBIND11
"Found Pybind11: version \"${PYBIND11_VERSION}\" ${PYBIND11_INCLUDE_DIRS}"
"${PYBIND11_INCLUDE_DIRS}${PYBIND11_VERSION}")
set(PYBIND11_FOUND TRUE)
# xtl
set(XTL_VERSION 0.5.4)
find_package(xtl ${XTL_VERSION} QUIET)
if (xtl_FOUND)
message(STATUS "Found xtl: ${xtl_INCLUDE_DIRS}/xtl")
set(xtl_BUILTIN FALSE)
else()
set(xtl_BUILTIN TRUE)
message(STATUS "Building internal xtl version ${XTL_VERSION}")
set(XTL_DESTDIR "${CMAKE_BINARY_DIR}/${EXTERNAL_DIR}")
ExternalProject_Add(xtl
URL "https://github.com/QuantStack/xtl/archive/${XTL_VERSION}.tar.gz"
URL_HASH SHA256=35478bb08949d0c36d4cf24cabbaa8322c507f8247cc69e017bddb2e28ffaf15
BUILD_IN_SOURCE 0
INSTALL_DIR ${XTL_DESTDIR}
LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1
CMAKE_ARGS -G ${CMAKE_GENERATOR}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
STEP_TARGETS install)
endif()
# xsimd
if (USE_AVX2)
set(XSIMD_VERSION 7.1.3)
find_package(xsimd ${XSIMD_VERSION} QUIET)
if (xsimd_FOUND)
message(STATUS "Found xsimd: ${xsimd_INCLUDE_DIRS}/xsimd")
set(xsimd_BUILTIN FALSE)
else()
set(xsimd_BUILTIN TRUE)
message(STATUS "Building internal xsimd version ${XSIMD_VERSION}")
set(XSIMD_DESTDIR "${CMAKE_BINARY_DIR}/${EXTERNAL_DIR}")
ExternalProject_Add(xsimd
URL "https://github.com/QuantStack/xsimd/archive/${XSIMD_VERSION}.tar.gz"
URL_HASH SHA256=faf98c4a29883a33ef844a2eac364762e35098aacc29bb9e255f799caf81a38e
BUILD_IN_SOURCE 0
INSTALL_DIR ${XSIMD_DESTDIR}
LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1
CMAKE_ARGS -G ${CMAKE_GENERATOR}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>)
if (xtl_BUILTIN)
ExternalProject_Add_StepDependencies(xsimd configure xtl)
endif()
endif()
endif()
# xtensor
set(XTENSOR_VERSION 0.19.4)
find_package(xtensor ${XTENSOR_VERSION} QUIET)
if (xtensor_FOUND)
message(STATUS "Found xtensor: ${xtensor_INCLUDE_DIRS}/xtensor")
set(xtensor_BUILTIN FALSE)
else()
set(xtensor_BUILTIN TRUE)
message(STATUS "Building internal xtensor version ${XTENSOR_VERSION}")
set(XTENSOR_DESTDIR "${CMAKE_BINARY_DIR}/${EXTERNAL_DIR}")
ExternalProject_Add(xtensor
URL "https://github.com/QuantStack/xtensor/archive/${XTENSOR_VERSION}.tar.gz"
URL_HASH SHA256=ea0ed42ac27888f4e4acaf99367fbef714373fa586f204e8bc22b8e5335ecf06
BUILD_IN_SOURCE 0
INSTALL_DIR ${XTENSOR_DESTDIR}
LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1
CMAKE_ARGS -G ${CMAKE_GENERATOR}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DXTENSOR_ENABLE_XSIMD=$<BOOL:USE_AVX2>)
if (xtl_BUILTIN)
ExternalProject_Add_StepDependencies(xtensor configure xtl)
endif()
if (USE_AVX2 AND xsimd_BUILTIN)
ExternalProject_Add_StepDependencies(xtensor configure xsimd)
endif()
endif()
# xtensor-python
set(XTENSOR_PYTHON_VERSION 0.22.1)
find_package(xtensor-python ${XTENSOR_PYTHON_VERSION} QUIET)
if (xtensor-python_FOUND)
message(STATUS "Found xtensor-python: ${xtensor-python_INCLUDE_DIRS}/xtensor-python")
set(xtp_BUILTIN FALSE)
else()
message(STATUS "Building internal xtensor-python version ${XTENSOR_PYTHON_VERSION}")
set(xtp_BUILTIN TRUE)
set(XTENSOR_PYTHON_DESTDIR "${CMAKE_BINARY_DIR}/${EXTERNAL_DIR}")
ExternalProject_Add(xtp
URL "https://github.com/QuantStack/xtensor-python/archive/${XTENSOR_PYTHON_VERSION}.tar.gz"
URL_HASH SHA256=b92ce8979d54bd88e3613920208a13046f5944df6ada38711f4a89636c55304d
BUILD_IN_SOURCE 0
INSTALL_DIR ${XTENSOR_PYTHON_DESTDIR}
LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1
CMAKE_ARGS -G ${CMAKE_GENERATOR}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
-DCMAKE_MODULE_PATH=${PROJECT_SOURCE_DIR}/cmake
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
STEP_TARGETS install)
if (xtensor_BUILTIN)
ExternalProject_Add_StepDependencies(xtp configure xtensor)
endif()
endif()
/***************************************************************************
* Copyright (c) 2016, Johan Mabille and Sylvain Corlay *
* *
* Distributed under the terms of the BSD 3-Clause License. *
* *
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/
#ifndef XSIMD_ALIGN_HPP
#define XSIMD_ALIGN_HPP
#include "xsimd_instruction_set.hpp"
/************************************************
* Platform checks for aligned malloc functions *
************************************************/
#if ((defined __QNXNTO__) || (defined _GNU_SOURCE) || ((defined _XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600))) \
&& (defined _POSIX_ADVISORY_INFO) && (_POSIX_ADVISORY_INFO > 0)
#define XSIMD_HAS_POSIX_MEMALIGN 1
#else
#define XSIMD_HAS_POSIX_MEMALIGN 0
#endif
#if defined(XSIMD_X86_INSTR_SET_AVAILABLE)
#define XSIMD_HAS_MM_MALLOC 1
#else
#define XSIMD_HAS_MM_MALLOC 0
#endif
/********************
* Stack allocation *
********************/
#ifndef XSIMD_ALLOCA
#if defined(__linux__)
#define XSIMD_ALLOCA alloca
#elif defined(_MSC_VER)
#define XSIMD_ALLOCA _alloca
#endif
#endif
/*********************
* Default alignment *
*********************/
#if XSIMD_X86_INSTR_SET >= XSIMD_X86_AVX512_VERSION
#define XSIMD_DEFAULT_ALIGNMENT 64
#elif XSIMD_X86_INSTR_SET >= XSIMD_X86_AVX_VERSION
#define XSIMD_DEFAULT_ALIGNMENT 32
#elif XSIMD_X86_INSTR_SET >= XSIMD_X86_SSE2_VERSION
#define XSIMD_DEFAULT_ALIGNMENT 16
#elif XSIMD_ARM_INSTR_SET >= XSIMD_ARM8_64_NEON_VERSION
#define XSIMD_DEFAULT_ALIGNMENT 32
#elif XSIMD_ARM_INSTR_SET >= XSIMD_ARM7_NEON_VERSION
#define XSIMD_DEFAULT_ALIGNMENT 16
#endif
#endif
/***************************************************************************
* Copyright (c) 2016, Johan Mabille and Sylvain Corlay *
* *
* Distributed under the terms of the BSD 3-Clause License. *
* *
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/
#ifndef XSIMD_CONFIG_HPP
#define XSIMD_CONFIG_HPP
#include "xsimd_align.hpp"
#define XSIMD_VERSION_MAJOR 7
#define XSIMD_VERSION_MINOR 1
#define XSIMD_VERSION_PATCH 2
#ifndef XSIMD_DEFAULT_ALLOCATOR
#if XSIMD_X86_INSTR_SET_AVAILABLE
#define XSIMD_DEFAULT_ALLOCATOR(T) xsimd::aligned_allocator<T, XSIMD_DEFAULT_ALIGNMENT>
#else
#define XSIMD_DEFAULT_ALLOCATOR(T) std::allocator<T>
#endif
#endif
#ifndef XSIMD_STACK_ALLOCATION_LIMIT
#define XSIMD_STACK_ALLOCATION_LIMIT 20000
#endif
#if defined(__LP64__) || defined(_WIN64)
#define XSIMD_64_BIT_ABI
#else
#define XSIMD_32_BIT_ABI
#endif
#endif
/***************************************************************************
* Copyright (c) 2016, Johan Mabille and Sylvain Corlay *
* *
* Distributed under the terms of the BSD 3-Clause License. *
* *
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/
#ifndef XSIMD_INCLUDE_HPP
#define XSIMD_INCLUDE_HPP
#include "xsimd_instruction_set.hpp"
// X86 intruction sets
#if XSIMD_X86_INSTR_SET >= XSIMD_X86_FMA3_VERSION // FMA3 and later
#ifdef __GNUC__
#include <x86intrin.h> // x86intrin.h includes header files for whatever instruction
// sets are specified on the compiler command line, such as:
// xopintrin.h, fma4intrin.h
#else
#include <immintrin.h> // MS version of immintrin.h covers AVX, AVX2 and FMA3
#endif // __GNUC__
#elif XSIMD_X86_INSTR_SET == XSIMD_X86_AVX_VERSION
#include <immintrin.h> // AVX
#elif XSIMD_X86_INSTR_SET == XSIMD_X86_SSE4_2_VERSION
#include <nmmintrin.h> // SSE4.2
#elif XSIMD_X86_INSTR_SET == XSIMD_X86_SSE4_1_VERSION
#include <smmintrin.h> // SSE4.1
#elif XSIMD_X86_INSTR_SET == XSIMD_X86_SSSE3_VERSION
#include <tmmintrin.h> // SSSE3
#elif XSIMD_X86_INSTR_SET == XSIMD_X86_SSE3_VERSION
#include <pmmintrin.h> // SSE3
#elif XSIMD_X86_INSTR_SET == XSIMD_X86_SSE2_VERSION
#include <emmintrin.h> // SSE2
#elif XSIMD_X8_INSTR_SET == XSIMD_X86_SSE_VERSION
#include <xmmintrin.h> // SSE
#endif // XSIMD_X86_INSTR_SET
// AMD instruction sets
#if XSIMD_X86_AMD_INSTR_SET >= XSIMD_X86_AMD_FMA4_VERSION
#ifdef _MSC_VER
#include <intrin.h>
#else
#include <x86intrin.h>
#if XSIMD_X86_AMD_INSTR_SET >= XSIMD_X86_AMD_XOP_VERSION
#include <xopintrin.h>
#else
#include <fma4intrin.h>
#endif
#endif // _MSC_VER
#elif XSIMD_X86_AMD_INSTR_SET == XSIMD_X86_AMD_SSE4A_VERSION
#include <ammintrin.h>
#endif // XSIMD_X86_AMD_INSTR_SET
#if XSIMD_ARM_INSTR_SET >= XSIMD_ARM7_NEON_VERSION
#include <arm_neon.h>
#endif
// TODO: add ALTIVEC instruction set
#endif
/***************************************************************************
* Copyright (c) 2016, Johan Mabille and Sylvain Corlay *
* *
* Distributed under the terms of the BSD 3-Clause License. *
* *
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/
// Simplified version of boost.predef
#ifndef XSIMD_INSTRUCTION_SET_HPP
#define XSIMD_INSTRUCTION_SET_HPP
/******************
* VERSION NUMBER *
******************/
// major number can be in [0, 99]
// minor number can be in [0, 99]
// patch number can be in [0, 999999]
#define XSIMD_VERSION_NUMBER(major, minor, patch) \
((((major) % 100) * 10000000) + (((minor) % 100) * 100000) + ((patch) % 100000))
#define XSIMD_VERSION_NUMBER_NOT_AVAILABLE \
XSIMD_VERSION_NUMBER(0, 0, 0)
#define XSIMD_VERSION_NUMBER_AVAILABLE \
XSIMD_VERSION_NUMBER(0, 0, 1)
/***********************
* X86 INSTRUCTION SET *
***********************/
#define XSIMD_X86_SSE_VERSION XSIMD_VERSION_NUMBER(1, 0, 0)
#define XSIMD_X86_SSE2_VERSION XSIMD_VERSION_NUMBER(2, 0, 0)
#define XSIMD_X86_SSE3_VERSION XSIMD_VERSION_NUMBER(3, 0, 0)
#define XSIMD_X86_SSSE3_VERSION XSIMD_VERSION_NUMBER(3, 1, 0)
#define XSIMD_X86_SSE4_1_VERSION XSIMD_VERSION_NUMBER(4, 1, 0)
#define XSIMD_X86_SSE4_2_VERSION XSIMD_VERSION_NUMBER(4, 2, 0)
#define XSIMD_X86_AVX_VERSION XSIMD_VERSION_NUMBER(5, 0, 0)
#define XSIMD_X86_FMA3_VERSION XSIMD_VERSION_NUMBER(5, 2, 0)
#define XSIMD_X86_AVX2_VERSION XSIMD_VERSION_NUMBER(5, 3, 0)
#define XSIMD_X86_AVX512_VERSION XSIMD_VERSION_NUMBER(6, 0, 0)
#define XSIMD_X86_MIC_VERSION XSIMD_VERSION_NUMBER(9, 0, 0)
#undef XSIMD_X86_INSTR_SET
#undef XSIMD_X86_INSTR_SET_AVAILABLE
#if !defined(XSIMD_X86_INSTR_SET) && defined(__MIC__)
#define XSIMD_X86_INSTR_SET XSIMD_X86_MIC_VERSION
#endif
#if !defined(XSIMD_X86_INSTR_SET) && defined(__AVX512__) || defined(__KNCNI__) || defined(__AVX512F__)
#define XSIMD_X86_INSTR_SET XSIMD_X86_AVX512_VERSION
#endif
#if defined(__AVX512BW__)
#define XSIMD_AVX512BW_AVAILABLE 1
#endif
#if !defined(XSIMD_X86_INSTR_SET) && defined(__AVX2__)
#define XSIMD_X86_INSTR_SET XSIMD_X86_AVX2_VERSION
#endif
#if !defined(XSIMD_X86_INSTR_SET) && defined(__FMA__)
#define XSIMD_X86_INSTR_SET XSIMD_X86_FMA3_VERSION
#endif
#if !defined(XSIMD_X86_INSTR_SET) && defined(__AVX__)
#define XSIMD_X86_INSTR_SET XSIMD_X86_AVX_VERSION
#endif
#if !defined(XSIMD_X86_INSTR_SET) && defined(__SSE4_2__)
#define XSIMD_X86_INSTR_SET XSIMD_X86_SSE4_2_VERSION
#endif
#if !defined(XSIMD_X86_INSTR_SET) && defined(__SSE4_1__)
#define XSIMD_X86_INSTR_SET XSIMD_X86_SSE4_1_VERSION
#endif
#if !defined(XSIMD_X86_INSTR_SET) && defined(__SSSE3__)
#define XSIMD_X86_INSTR_SET XSIMD_X86_SSSE3_VERSION
#endif
#if !defined(XSIMD_X86_INSTR_SET) && defined(__SSE3__)
#define XSIMD_X86_INSTR_SET XSIMD_X86_SSE3_VERSION
#endif
#if !defined(XSIMD_X86_INSTR_SET) && (defined(__SSE2__) || defined(__x86_64__) || defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 2))
#define XSIMD_X86_INSTR_SET XSIMD_X86_SSE2_VERSION
#endif
#if !defined(XSIMD_X86_INSTR_SET) && (defined(__SSE__) || defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 1))
#define XSIMD_X86_INSTR_SET XSIMD_X86_SSE_VERSION
#endif
#if !(defined XSIMD_X86_INSTR_SET)
#define XSIMD_X86_INSTR_SET XSIMD_VERSION_NUMBER_NOT_AVAILABLE
#else
#define XSIMD_X86_INSTR_SET_AVAILABLE XSIMD_VERSION_NUMBER_AVAILABLE
#endif
/***************************
* X86_AMD INSTRUCTION SET *
***************************/
#define XSIMD_X86_AMD_SSE4A_VERSION XSIMD_VERSION_NUMBER(4, 0, 0)
#define XSIMD_X86_AMD_FMA4_VERSION XSIMD_VERSION_NUMBER(5, 1, 0)
#define XSIMD_X86_AMD_XOP_VERSION XSIMD_VERSION_NUMBER(5, 1, 1)
#undef XSIMD_X86_AMD_INSTR_SET
#undef XSIMD_X86_AMD_INSTR_SET_AVAILABLE
#if !defined(XSIMD_X86_AMD_INSTR_SET) && defined(__XOP__)
#define XSIMD_X86_AMD_INSTR_SET XSIMD_X86_AMD_XOP_VERSION
#endif
#if !defined(XSIMD_X86_AMD_INSTR_SET) && defined(__FMA4__)
#define XSIMD_X86_AMD_INSTR_SET XSIMD_X86_AMD_FMA4_VERSION
#endif
#if !defined(XSIMD_X86_AMD_INSTR_SET) && defined(__SSE4A__)
#define XSIMD_X86_AMD_INSTR_SET XSIMD_X86_AMD_SSE4A_VERSION
#endif
#if !defined(XSIMD_X86_AMD_INSTR_SET)
#define XSIMD_X86_AMD_INSTR_SET XSIMD_VERSION_NUMBER_NOT_AVAILABLE
#else
// X86_AMD implies X86
#if XSIMD_X86_INSTR_SET > XSIMD_X86_AMD_INSTR_SET
#undef XSIMD_X86_AMD_INSTR_SET
#define XSIMD_X86_AMD_INSTR_SET XSIMD_X86_INSTR_SET
#endif
#define XSIMD_X86_AMD_INSTR_SET_AVAILABLE XSIMD_VERSION_NUMBER_AVAILABLE
#endif
/***********************
* PPC INSTRUCTION SET *
***********************/
#define XSIMD_PPC_VMX_VERSION XSIMD_VERSION_NUMBER(1, 0, 0)
#define XSIMD_PPC_VSX_VERSION XSIMD_VERSION_NUMBER(1, 1, 0)
#define XSIMD_PPC_QPX_VERSION XSIMD_VERSION_NUMBER(2, 0, 0)
#undef XSIMD_PPC_INSTR_SET
#undef XSIMD_PPC_INSTR_SET_AVAILABLE
#if !defined(XSIMD_PPC_INSTR_SET) && defined(__VECTOR4DOUBLE__)
#define XSIMD_PPC_INSTR_SET XSIMD_PPC_QPX_VERSION
#endif
#if !defined(XSIMD_PPC_INSTR_SET) && defined(__VSX__)
#define XSIMD_PPC_INSTR_SET XSIMD_PPC_VSX_VERSION
#endif
#if !defined(XSIMD_PPC_INSTR_SET) && (defined(__ALTIVEC__) || defined(__VEC__))
#define XSIMD_PPC_INSTR_SET XSIMD_PPC_VMX_VERSION
#endif