From 7020e9b66af87140c4132fec5f16316af8588ec3 Mon Sep 17 00:00:00 2001 From: Yawning Angel Date: Sun, 18 Aug 2024 20:06:06 +0900 Subject: [PATCH] core/simd: Add `IS_EMULTATED` so there is one place to look for potatos --- core/simd/simd.odin | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/simd/simd.odin b/core/simd/simd.odin index 1f3c67b72..e7b1803c4 100644 --- a/core/simd/simd.odin +++ b/core/simd/simd.odin @@ -3,6 +3,13 @@ package simd import "base:builtin" import "base:intrinsics" +// IS_EMULATED is true iff the compile-time target lacks hardware support +// for at least 128-bit SIMD. +IS_EMULATED :: true when (ODIN_ARCH == .amd64 || ODIN_ARCH == .i386) && !intrinsics.has_target_feature("sse2") else + true when (ODIN_ARCH == .arm64 || ODIN_ARCH == .arm32) && !intrinsics.has_target_feature("neon") else + true when (ODIN_ARCH == .wasm64p32 || ODIN_ARCH == .wasm32) && !intrinsics.has_target_feature("simd128") else + false + // 128-bit vector aliases u8x16 :: #simd[16]u8 i8x16 :: #simd[16]i8