add simd id
This commit is contained in:
@@ -1,21 +1,20 @@
|
||||
#ifndef SN_TARGET
|
||||
#ifndef SN_TARGET
|
||||
#define SN_TARGET
|
||||
|
||||
typedef enum SN_OS_T {
|
||||
SN_OS_WINDOWS,
|
||||
SN_OS_LINUX,
|
||||
SN_OS_MACOS,
|
||||
SN_OS_IOS,
|
||||
SN_OS_ANDROID,
|
||||
SN_OS_UNKNOWN
|
||||
} SN_OS_T;
|
||||
#include "sn_internal.h"
|
||||
#include <stdint.h>
|
||||
|
||||
typedef enum SN_ARCH_T {
|
||||
SN_ARCH_X86_64,
|
||||
SN_ARCH_ARM64,
|
||||
SN_ARCH_RISCV64,
|
||||
SN_ARCH_PPC64le,
|
||||
} SN_ARCH_T;
|
||||
#define SN_OS_WINDOWS 0
|
||||
#define SN_OS_LINUX 1
|
||||
#define SN_OS_MACOS 2
|
||||
#define SN_OS_IOS 3
|
||||
#define SN_OS_ANDROID 4
|
||||
#define SN_OS_UNKNOWN 5
|
||||
|
||||
#define SN_ARCH_X86_64 0
|
||||
#define SN_ARCH_ARM64 1
|
||||
#define SN_ARCH_RISCV64 2
|
||||
#define SN_ARCH_PPC64le 3
|
||||
|
||||
/*
|
||||
* Target selection policy:
|
||||
@@ -38,24 +37,28 @@ typedef enum SN_ARCH_T {
|
||||
#endif
|
||||
|
||||
/* Validate externally supplied values are within known enum constants. */
|
||||
#if (SN_OS_TARGET != SN_OS_WINDOWS) && (SN_OS_TARGET != SN_OS_LINUX) && (SN_OS_TARGET != SN_OS_MACOS) && \
|
||||
(SN_OS_TARGET != SN_OS_IOS) && (SN_OS_TARGET != SN_OS_ANDROID) && (SN_OS_TARGET != SN_OS_UNKNOWN)
|
||||
#if (SN_OS_TARGET != SN_OS_WINDOWS) && (SN_OS_TARGET != SN_OS_LINUX) && \
|
||||
(SN_OS_TARGET != SN_OS_MACOS) && (SN_OS_TARGET != SN_OS_IOS) && \
|
||||
(SN_OS_TARGET != SN_OS_ANDROID) && (SN_OS_TARGET != SN_OS_UNKNOWN)
|
||||
#error "SN_OS has an invalid value. Use SN_OS_<...> enum constants."
|
||||
#endif
|
||||
|
||||
#if (SN_ARCH_TARGET != SN_ARCH_X86_64) && (SN_ARCH_TARGET != SN_ARCH_ARM64) && (SN_ARCH_TARGET != SN_ARCH_RISCV64) && \
|
||||
(SN_ARCH_TARGET != SN_ARCH_PPC64le)
|
||||
#if (SN_ARCH_TARGET != SN_ARCH_X86_64) && (SN_ARCH_TARGET != SN_ARCH_ARM64) && \
|
||||
(SN_ARCH_TARGET != SN_ARCH_RISCV64) && (SN_ARCH_TARGET != SN_ARCH_PPC64le)
|
||||
#error "SN_ARCH has an invalid value. Use SN_ARCH_<...> enum constants."
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef SN_IS_OS
|
||||
#define SN_IS_OS(os) ((SN_OS_TARGET) == (os))
|
||||
#endif
|
||||
|
||||
#ifndef SN_IS_ARCH
|
||||
#define SN_IS_ARCH(arch) ((SN_ARCH_TARGET) == (arch))
|
||||
#endif
|
||||
|
||||
typedef union SIMDID {
|
||||
uint64_t mask;
|
||||
char make_byte[];
|
||||
} SIMDID;
|
||||
|
||||
SN_API SIMDID SN_DECL sn_get_simd_level();
|
||||
|
||||
#endif // SN_TARGET
|
||||
|
||||
Reference in New Issue
Block a user