From 76e5cff6a10c1f2c1fd613ba8313078b20a18a36 Mon Sep 17 00:00:00 2001 From: Mineplay Date: Sun, 13 Apr 2025 08:48:09 -0500 Subject: [PATCH] feat(simd): added type for specifying simd version supported --- Include/Hallocy/Utils/Simd.h | 37 ++++++++++++++++++++++++++++++++++++ Src/Utils/Simd.c | 24 +++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 Include/Hallocy/Utils/Simd.h create mode 100644 Src/Utils/Simd.c diff --git a/Include/Hallocy/Utils/Simd.h b/Include/Hallocy/Utils/Simd.h new file mode 100644 index 0000000..d7ba37d --- /dev/null +++ b/Include/Hallocy/Utils/Simd.h @@ -0,0 +1,37 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ----------------------------------------------------------------------------- + * File: Simd.h + * Description: + * This file implements the functions for detecting SIMD support and defines the + * enum for specifing the SIMD type. + * + * Author: Mineplay + * ----------------------------------------------------------------------------- + */ +#ifndef HALLOCY_SIMD +#define HALLOCY_SIMD + +typedef enum { + HALLOCY_SIMD_UNDEFINED = 0, + HALLOCY_SIMD_NONE = 1, + HALLOCY_SIMD_SSE = 2, + HALLOCY_SIMD_SSE2 = 3, + HALLOCY_SIMD_AVX = 4, + HALLOCY_SIMD_AVX2 = 5, + HALLOCY_SIMD_AVX512 = 6, + HALLOCY_SIMD_NEON = 7 +} HallocySimdType; + +#endif \ No newline at end of file diff --git a/Src/Utils/Simd.c b/Src/Utils/Simd.c new file mode 100644 index 0000000..8309e77 --- /dev/null +++ b/Src/Utils/Simd.c @@ -0,0 +1,24 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ----------------------------------------------------------------------------- + * File: Simd.h + * Description: + * This file implements the function for detecting SIMD support. + * + * Author: Mineplay + * ----------------------------------------------------------------------------- + */ +#include "../../Include/Hallocy/Utils/Simd.h" + +static HallocySimdType supported_simd = HALLOCY_SIMD_UNDEFINED; \ No newline at end of file