cOMS/stdlib/Simd.h
Dennis Eichhorn 39fbcf4300
Some checks are pending
CodeQL / Analyze (${{ matrix.language }}) (autobuild, c-cpp) (push) Waiting to run
Microsoft C++ Code Analysis / Analyze (push) Waiting to run
linux bug fixes
2025-03-22 01:10:19 +00:00

45 lines
1.3 KiB
C
Executable File

/**
* Jingga
*
* @copyright Jingga
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
#ifndef COMS_STDLIB_SIMD_H
#define COMS_STDLIB_SIMD_H
#include "../utils/TestUtils.h"
// Adjusts the step size based on the memory alignment
inline
int32 intrin_validate_steps(const byte* mem, int32 steps) {
// During development we want to spot invalid alignment
ASSERT_SIMPLE(steps < 16 || (steps >= 16 && ((uintptr_t) mem & 63) == 0));
ASSERT_SIMPLE(steps < 8 || (steps >= 8 && ((uintptr_t) mem & 31) == 0));
ASSERT_SIMPLE(steps < 4 || (steps >= 4 && ((uintptr_t) mem & 15) == 0));
if (steps >= 16 && ((uintptr_t) mem & 63) == 0) {
return 16;
} else if (steps >= 8 && ((uintptr_t) mem & 31) == 0) {
return 8;
} else if (steps >= 4 && ((uintptr_t) mem & 15) == 0) {
return 4;
} else {
return 1;
}
}
#if __aarch64__
#include <arm_neon.h>
#else
#include "../architecture/x86/simd/SIMD_F32.h"
#include "../architecture/x86/simd/SIMD_F64.h"
#include "../architecture/x86/simd/SIMD_I8.h"
#include "../architecture/x86/simd/SIMD_I16.h"
#include "../architecture/x86/simd/SIMD_I32.h"
#include "../architecture/x86/simd/SIMD_I64.h"
#include "../architecture/x86/simd/SIMD_SVML.h"
#endif
#endif