2 * Copyright (C) 2024 Mikulas Patocka
4 * This file is part of Ajla.
6 * Ajla is free software: you can redistribute it and/or modify it under the
7 * terms of the GNU General Public License as published by the Free Software
8 * Foundation, either version 3 of the License, or (at your option) any later
11 * Ajla is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along with
16 * Ajla. If not, see <https://www.gnu.org/licenses/>.
19 #if INT_DEFAULT_BITS == 8
21 #elif INT_DEFAULT_BITS == 16
23 #elif INT_DEFAULT_BITS == 32
25 #elif INT_DEFAULT_BITS == 64
29 #if defined(INLINE_ASM_GCC_X86) && defined(HAVE_X86_ASSEMBLER_F16C) && TYPE_MASK == 0x1
30 #define REAL16_ALT1_FEATURES (cpu_feature_mask(CPU_FEATURE_f16c))
31 #define REAL16_ALT1_TYPES 0x1
34 #if defined(INLINE_ASM_GCC_X86) && defined(HAVE_X86_ASSEMBLER_SSE) && TYPE_MASK == 0x2
35 #define REAL32_ALT1_FEATURES (cpu_feature_mask(CPU_FEATURE_sse))
36 #define REAL32_ALT1_TYPES 0x2
37 gen_sse_ops(type, s, z)
39 #if defined(INLINE_ASM_GCC_X86) && defined(HAVE_X86_ASSEMBLER_SSE2) && TYPE_MASK == 0x4
40 #define REAL64_ALT1_FEATURES (cpu_feature_mask(CPU_FEATURE_sse2))
41 #define REAL64_ALT1_TYPES 0x4
42 gen_sse_ops(type, d, z)
44 #if defined(INLINE_ASM_GCC_X86) && defined(HAVE_X86_ASSEMBLER_AVX) && TYPE_MASK == 0x2
45 #define REAL32_ALT2_FEATURES (cpu_feature_mask(CPU_FEATURE_avx))
46 #define REAL32_ALT2_TYPES 0x2
47 gen_avx_ops(type, s, z)
49 #if defined(INLINE_ASM_GCC_X86) && defined(HAVE_X86_ASSEMBLER_AVX) && TYPE_MASK == 0x4
50 #define REAL64_ALT2_FEATURES (cpu_feature_mask(CPU_FEATURE_avx))
51 #define REAL64_ALT2_TYPES 0x4
52 gen_avx_ops(type, d, z)
55 #if defined(INLINE_ASM_GCC_ARM) && defined(HAVE_ARM_ASSEMBLER_HALF_PRECISION) && TYPE_MASK == 0x1
56 #define REAL16_ALT1_FEATURES (cpu_feature_mask(CPU_FEATURE_half) | cpu_feature_mask(CPU_FEATURE_neon))
57 #define REAL16_ALT1_TYPES 0x1
61 #if defined(INLINE_ASM_GCC_ARM) && defined(HAVE_ARM_ASSEMBLER_VFP) && TYPE_MASK == 0x2
62 #define REAL32_ALT1_FEATURES (cpu_feature_mask(CPU_FEATURE_vfp))
63 #define REAL32_ALT1_TYPES 0x2
64 gen_vfp_ops(type, "f32", "s")
67 #if defined(INLINE_ASM_GCC_ARM) && defined(HAVE_ARM_ASSEMBLER_VFP) && TYPE_MASK == 0x4
68 #define REAL64_ALT1_FEATURES (cpu_feature_mask(CPU_FEATURE_vfp))
69 #define REAL64_ALT1_TYPES 0x4
70 gen_vfp_ops(type, "f64", "d")