summaryrefslogtreecommitdiffhomepage
path: root/include/ocl/simd/basic_simd.hpp
blob: a401dbd811f9c9bb85e46cd5a769be42102ea585 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
 * File: simd/basic_simd.hpp
 * Purpose: Basic SIMD backend C++ library.
 * Author: Amlal El Mahrouss (amlal@nekernel.org)
 * Copyright 2025, Amlal El Mahrouss, licensed under the BSL 1.0 license.
 */

#pragma once

#include <core/includes.hpp>

#ifdef __x86_64__
#include <immintrin.h>
using simd_type = __m256;
#endif

#ifdef __aarch64__
#include <arm_neon.h>
using simd_type = float32x4_t;
#endif

namespace ocl::simd
{
	struct basic_simd final
	{
		struct simd_traits final
		{
			simd_type __val;

		private:
			static bool bad;
			friend class basic_simd;
		};

		using register_type = simd_traits;

		const bool& is_bad() noexcept
		{
			return register_type::bad;
		}

		std::basic_string<char> isa()
		{
			return "basic_simd";
		}
	};
} // namespace ocl::simd