Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-07 10:37:14

0001 /***************************************************************************
0002  * Copyright (c) Johan Mabille, Sylvain Corlay, Wolf Vollprecht and         *
0003  * Martin Renou                                                             *
0004  * Copyright (c) QuantStack                                                 *
0005  * Copyright (c) Serge Guelton                                              *
0006  *                                                                          *
0007  * Distributed under the terms of the BSD 3-Clause License.                 *
0008  *                                                                          *
0009  * The full license is in the file LICENSE, distributed with this software. *
0010  ***************************************************************************/
0011 
0012 #ifndef XSIMD_CPU_FEATURES_PPC_HPP
0013 #define XSIMD_CPU_FEATURES_PPC_HPP
0014 
0015 #include "./xsimd_config.hpp"
0016 #include "./xsimd_getauxval.hpp"
0017 
0018 namespace xsimd
0019 {
0020     /**
0021      * An opinionated CPU feature detection utility for PowerPC.
0022      *
0023      * On Linux, runtime detection uses getauxval to query the auxiliary vector.
0024      * On other platforms, only compile-time information is used.
0025      *
0026      * This is well defined on all architectures.
0027      * It will always return false on non-PowerPC architectures.
0028      */
0029     class ppc_cpu_features : private linux_hwcap_backend_default
0030     {
0031     public:
0032         inline bool vsx() const noexcept;
0033     };
0034 
0035     /********************
0036      *  Implementation  *
0037      ********************/
0038 
0039     inline bool ppc_cpu_features::vsx() const noexcept
0040     {
0041 #if XSIMD_TARGET_PPC && XSIMD_HAVE_LINUX_GETAUXVAL
0042 #ifdef PPC_FEATURE_HAS_VSX
0043         return hwcap().has_feature(PPC_FEATURE_HAS_VSX);
0044 #else
0045         // Possibly missing on older Linux distributions
0046         return hwcap().has_feature(0x00000080);
0047 #endif
0048 #else
0049         return XSIMD_WITH_VSX;
0050 #endif
0051     }
0052 }
0053 
0054 #endif