summaryrefslogtreecommitdiffhomepage
path: root/dev/lib/simd/basic_simd.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'dev/lib/simd/basic_simd.hpp')
-rw-r--r--dev/lib/simd/basic_simd.hpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/dev/lib/simd/basic_simd.hpp b/dev/lib/simd/basic_simd.hpp
new file mode 100644
index 0000000..f14d977
--- /dev/null
+++ b/dev/lib/simd/basic_simd.hpp
@@ -0,0 +1,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 <lib/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::snu::simd
+{
+ struct basic_simd_backend final
+ {
+ struct simd_traits final
+ {
+ simd_type __val;
+
+ private:
+ static bool bad;
+ friend class basic_simd_backend;
+ };
+
+ using register_type = simd_traits;
+
+ const bool& is_bad() noexcept
+ {
+ return register_type::bad;
+ }
+
+ std::basic_string<char> isa()
+ {
+ return "basic_simd_backend";
+ }
+ };
+} // namespace ocl::snu::simd