rsimd

Make SIMD instruction sets easier to use
git clone git://git.meso-star.fr/rsimd.git
Log | Files | Refs | README | LICENSE

soaXfY_begin.h (1976B)


      1 /* Copyright (C) 2014-2019, 2021, 2023, 2025 Vincent Forest (vaplv@free.fr)
      2  *
      3  * The RSIMD library is free software: you can redistribute it and/or modify
      4  * it under the terms of the GNU General Public License as published
      5  * by the Free Software Foundation, either version 3 of the License, or
      6  * (at your option) any later version.
      7  *
      8  * The RSIMD library is distributed in the hope that it will be useful,
      9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     11  * GNU General Public License for more details.
     12  *
     13  * You should have received a copy of the GNU General Public License
     14  * along with the RSIMD library. If not, see <http://www.gnu.org/licenses/>. */
     15 
     16 #include "rsimd.h"
     17 #include "vXf_begin.h"
     18 
     19 /* This file can be included once */
     20 #ifdef SOAXFY_BEGIN_H
     21   #error "The soaXfY_begin.h header is already included"
     22 #endif
     23 #define SOAXFY_BEGIN_H
     24 
     25 /* Check parameters */
     26 #if !defined(RSIMD_SOA_DIMENSION__)
     27   #error "Undefined RSIMD_SOA_DIMENSION__ macro"
     28 #endif
     29 #if !defined(RSIMD_WIDTH__)
     30   #error "Undefined RSIMD_WIDTH__ macro"
     31 #endif
     32 #if RSIMD_SOA_DIMENSION__ < 1 || RSIMD_SOA_DIMENSION__ > 4
     33   #error "Unexpected RSIMD_SOA_DIMENSION__ value"
     34 #endif
     35 #if RSIMD_WIDTH__ != 4 && RSIMD_WIDTH__ != 8
     36   #error "Unexpected RSIMD_WIDTH__ value of "STR(RSIMD_WIDTH__)
     37 #endif
     38 
     39 /* Check that internal macros are not already defined */
     40 #if defined(RSIMD_soaXfY_PREFIX__)                                             \
     41  || defined(RSIMD_soaXfY__)                                                    \
     42  || defined(SIZEOF_RSIMD_soaXfY__)
     43   #error "Unexpected macro definition"
     44 #endif
     45 
     46 /* Macros generic to RSIMD_WIDTH__ and RSIMD_SOA_DIMENSION__ */
     47 #define RSIMD_soaXfY_PREFIX__ \
     48   CONCAT(CONCAT(CONCAT(soa, RSIMD_WIDTH__), f), RSIMD_SOA_DIMENSION__)
     49 #define RSIMD_soaXfY__(Func) CONCAT(CONCAT(RSIMD_soaXfY_PREFIX__, _), Func)
     50 #define SIZEOF_RSIMD_soaXfY__ sizeof(RSIMD_vXf_T__[RSIMD_SOA_DIMENSION__])
     51