Back to home page

EIC code displayed by LXR

 
 

    


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

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