summaryrefslogtreecommitdiffhomepage
path: root/include/ocl/simd/simd.hpp
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-11-24 02:13:48 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-11-24 02:13:48 +0100
commit65a8349aa5526d071b18cd4d42586c46faaa3823 (patch)
treef6e2063319ceaaa02f523fb5c289e4f37411a2df /include/ocl/simd/simd.hpp
parentdf4ec096491ded6d58b9ee094d6942e3188c2d4a (diff)
feat! breaking changes for OCL v1.0.48.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'include/ocl/simd/simd.hpp')
-rw-r--r--include/ocl/simd/simd.hpp61
1 files changed, 61 insertions, 0 deletions
diff --git a/include/ocl/simd/simd.hpp b/include/ocl/simd/simd.hpp
new file mode 100644
index 0000000..711bf31
--- /dev/null
+++ b/include/ocl/simd/simd.hpp
@@ -0,0 +1,61 @@
+/*
+ * File: simd/simd.hpp
+ * Purpose: SIMD 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>
+
+/// @author Amlal El Mahrouss
+/// @brief Basic SIMD processor.
+
+namespace ocl::simd
+{
+ template <typename backend_type>
+ class real_type
+ {
+ private:
+ backend_type backend_;
+
+ enum opcode
+ {
+ bad = 0,
+ add,
+ mul,
+ div,
+ invalid = 0xfff,
+ };
+
+ public:
+ real_type() = default;
+ virtual ~real_type() = default;
+
+ real_type& operator=(const real_type&) = delete;
+ real_type(const real_type&) = delete;
+
+ typename backend_type::register_type& call(const opcode& op, typename backend_type::register_type& lhs, typename backend_type::register_type& rhs)
+ {
+ switch (op)
+ {
+ case add:
+ return backend_.add(lhs, rhs);
+ case mul:
+ return backend_.mul(lhs, rhs);
+ case div:
+ return backend_.div(lhs, rhs);
+ default:
+ break;
+ }
+
+ return backend_.is_bad();
+ }
+
+ std::basic_string<char> isa()
+ {
+ return backend_.isa();
+ }
+ };
+} // namespace ocl::simd