Vecmat 0.2.3
C math and linear algebra library for 2D/3D graphics, physics, and science.
Loading...
Searching...
No Matches
cpu.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2025-2026 Igal Alkon
2// SPDX-FileCopyrightText: 2026 ALKONTEK <git@alkontek.com>
3// SPDX-License-Identifier: BSD-3-Clause
4
5#ifndef VECMAT_CPU_H
6#define VECMAT_CPU_H
7
8#include <vecmat.h>
9#include "dispatch_list.h"
10
11/*
12 * Scalar kernel linkage. When dispatch is off the _scalar body is static and
13 * inlined into the public function in the same TU. When dispatch is on it has
14 * external linkage so dispatch.c can take its address.
15 */
16#ifdef VECMAT_RUNTIME_DISPATCH
17#define VECMAT_SCALAR_API
18#else
19#define VECMAT_SCALAR_API static
20#endif
21
22#ifdef VECMAT_RUNTIME_DISPATCH
23
24#define VECMAT_FN_TYPE(name, params, args) typedef void (*name##_fn) params;
26#undef VECMAT_FN_TYPE
27
28#define VECMAT_FN_PTR_DECL(name, params, args) extern name##_fn name##_;
30#undef VECMAT_FN_PTR_DECL
31
32#define VECMAT_DECL_SCALAR(name, params, args) void name##_scalar params;
33#define VECMAT_DECL_AVX(name, params, args) void name##_avx params;
34#define VECMAT_DECL_AVX2(name, params, args) void name##_avx2 params;
35#define VECMAT_DECL_AVX512(name, params, args) void name##_avx512 params;
36#define VECMAT_DECL_SVE(name, params, args) void name##_sve params;
37#define VECMAT_DECL_SVE2(name, params, args) void name##_sve2 params;
38
40
41#if defined(VECMAT_ENABLE_AVX)
43#endif
44
45#if defined(VECMAT_ENABLE_AVX2)
47#endif
48
49#if defined(VECMAT_ENABLE_AVX512)
51#endif
52
53#if defined(VECMAT_ENABLE_SVE)
55#endif
56
57#if defined(VECMAT_ENABLE_SVE2)
59#endif
60
61#undef VECMAT_DECL_SCALAR
62#undef VECMAT_DECL_AVX
63#undef VECMAT_DECL_AVX2
64#undef VECMAT_DECL_AVX512
65#undef VECMAT_DECL_SVE
66#undef VECMAT_DECL_SVE2
67
68#endif /* VECMAT_RUNTIME_DISPATCH */
69
70#endif /* VECMAT_CPU_H */
#define VECMAT_FN_PTR_DECL(name, params, args)
Definition cpu.h:28
#define VECMAT_DECL_AVX512(name, params, args)
Definition cpu.h:35
#define VECMAT_DECL_SVE2(name, params, args)
Definition cpu.h:37
#define VECMAT_FN_TYPE(name, params, args)
Definition cpu.h:24
#define VECMAT_DECL_SCALAR(name, params, args)
Definition cpu.h:32
#define VECMAT_DECL_SVE(name, params, args)
Definition cpu.h:36
#define VECMAT_DECL_AVX(name, params, args)
Definition cpu.h:33
#define VECMAT_DECL_AVX2(name, params, args)
Definition cpu.h:34
#define VECMAT_DISPATCH_LIST(X)