[sleef] Use SEH on Windows while checking for CPU extensions (#48143)

This commit is contained in:
Mikhail Titov
2025-11-06 16:52:05 -06:00
committed by GitHub
parent 78a40c4503
commit c4e4a719ed
5 changed files with 34 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ vcpkg_from_github(
exclude-testerutil.diff
export-link-libs.diff
sleefdft.pc.diff
seh-cpu-ext.diff
)
vcpkg_check_features(OUT_FEATURE_OPTIONS options

View File

@@ -0,0 +1,26 @@
diff --git a/src/libm/dispatcher.h b/src/libm/dispatcher.h
index 41b69d9..4d395c3 100644
--- a/src/libm/dispatcher.h
+++ b/src/libm/dispatcher.h
@@ -27,6 +27,14 @@ NOEXPORT int Sleef_internal_cpuSupportsExt(void (*tryExt)(), int *cache) {
static int cache = -1;
if (cache != -1) return cache;
+#ifdef _MSC_VER
+ __try {
+ (*tryExt)();
+ cache = 1;
+ } __except(1) {
+ cache = 0;
+ }
+#else
void (*org);
org = signal(SIGILL, sighandler);
@@ -38,5 +46,6 @@ NOEXPORT int Sleef_internal_cpuSupportsExt(void (*tryExt)(), int *cache) {
}
signal(SIGILL, org);
+#endif
return cache;
}

View File

@@ -1,6 +1,7 @@
{
"name": "sleef",
"version": "3.9.0",
"port-version": 1,
"description": "SIMD Library for Evaluating Elementary Functions, vectorized libm and DFT",
"homepage": "https://sleef.org/",
"license": "BSL-1.0",

View File

@@ -9046,7 +9046,7 @@
},
"sleef": {
"baseline": "3.9.0",
"port-version": 0
"port-version": 1
},
"sleepy-discord": {
"baseline": "2025-02-08",

View File

@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "c20095f0ab0040ddf9f28377e35d670fbc720daa",
"version": "3.9.0",
"port-version": 1
},
{
"git-tree": "afcb099ce882dcb1b316af9efa306b6d9ec3ba69",
"version": "3.9.0",