From 52a81b3b9d2620c193d7c76eb4312a941efc5460 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Wed, 17 Apr 2024 18:16:58 -0700 Subject: [PATCH] Improved check [skip ci] --- src/halfutils.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/halfutils.c b/src/halfutils.c index 9d2fd97..a540168 100644 --- a/src/halfutils.c +++ b/src/halfutils.c @@ -19,6 +19,7 @@ #endif #endif + float (*HalfvecL2SquaredDistance) (int dim, half * ax, half * bx); float (*HalfvecInnerProduct) (int dim, half * ax, half * bx); double (*HalfvecCosineSimilarity) (int dim, half * ax, half * bx); @@ -196,7 +197,13 @@ HalfvecCosineSimilarityF16cFma(int dim, half * ax, half * bx) #define CPU_FEATURE_OSXSAVE (1 << 27) #define CPU_FEATURE_F16C (1 << 29) -static bool +#ifdef _MSC_VER +#define TARGET_XSAVE +#else +#define TARGET_XSAVE __attribute__((target("xsave"))) +#endif + +TARGET_XSAVE static bool SupportsCpuFeature(unsigned int feature) { unsigned int exx[4] = {0, 0, 0, 0};