vXf_begin.h (2190B)
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 18 /* This file can be included once */ 19 #ifdef VXF_BEGIN_H 20 #error "The vXf_begin.h header is already included" 21 #endif 22 #define VXF_BEGIN_H 23 24 /* Check parameter */ 25 #if !defined(RSIMD_WIDTH__) 26 #error "Undefined RSIMD_WIDTH__ macro" 27 #endif 28 #if RSIMD_WIDTH__ != 4 && RSIMD_WIDTH__ != 8 29 #error "Unexpected RSIMD_WIDTH__ value of "STR(RSIMD_WIDTH__) 30 #endif 31 32 /* Check that internal macros are not already defined */ 33 #if defined(RSIMD_vXf__) \ 34 || defined(RSIMD_vXf_T__) \ 35 || defined(RSIMD_Sleef__) \ 36 || defined(RSIMD_Sleef_ULP__) \ 37 || defined(RSIMD_Sleef_vecf__) 38 #error "Unexpected macro definition" 39 #endif 40 41 /* Macros generic to RSIMD_WIDTH__ */ 42 #define RSIMD_vXf__(Func) \ 43 CONCAT(CONCAT(CONCAT(CONCAT(v, RSIMD_WIDTH__), f), _), Func) 44 #define RSIMD_vXf_T__ CONCAT(CONCAT(v, RSIMD_WIDTH__), f_T) 45 46 /* Sleef macros */ 47 #define RSIMD_Sleef__(Func) CONCAT(CONCAT(Sleef_, Func), RSIMD_WIDTH__) 48 #define RSIMD_Sleef_ULP__(Func, Suffix) \ 49 CONCAT(CONCAT(CONCAT(CONCAT(Sleef_, Func), RSIMD_WIDTH__), _), Suffix) 50 51 /* Vector types of the Sleef library */ 52 #if RSIMD_WIDTH__ == 4 53 #define RSIMD_Sleef_vecf__(Dim) CONCAT(Sleef___m128_, Dim) 54 #elif RSIMD_WIDTH__ == 8 55 #define RSIMD_Sleef_vecf__(Dim) CONCAT(Sleef___m256_, Dim) 56 #endif 57