From: Theo Buehler Subject: [sparc64] fix build of devel/highway To: ports@openbsd.org Cc: jca@openbsd.org Date: Sat, 6 Jun 2026 22:38:40 +0200 The below makes devel/highway build on sparc64. I don't know what the correct value for HWY_ARCH_MAX_BYTES would be. I tried 64 and 16 and the tests look the same on the M3000. 99% tests passed, 3 tests failed out of 459 Total Test time (real) = 111.15 sec The following tests FAILED: 391 - HwyMathTestGroup/HwyMathTest.TestAllExpm1/SCALAR (Subprocess aborted) 405 - HwyMathHyperTestGroup/HwyMathHyperTest.TestAllAsinh/SCALAR (Subprocess aborted) 407 - HwyMathHyperTestGroup/HwyMathHyperTest.TestAllSinh/SCALAR (Subprocess aborted) Errors while running CTest Index: Makefile =================================================================== RCS file: /cvs/ports/devel/highway/Makefile,v diff -u -p -r1.9 Makefile --- Makefile 5 Jun 2026 17:57:49 -0000 1.9 +++ Makefile 6 Jun 2026 19:47:49 -0000 @@ -1,5 +1,3 @@ -BROKEN-sparc64 = error "Missing case for HWY_ARCH_*" - COMMENT = length-agnostic SIMD with runtime dispatch GH_ACCOUNT = google Index: patches/patch-hwy_detect_compiler_arch_h =================================================================== RCS file: patches/patch-hwy_detect_compiler_arch_h diff -N patches/patch-hwy_detect_compiler_arch_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-hwy_detect_compiler_arch_h 6 Jun 2026 20:32:24 -0000 @@ -0,0 +1,34 @@ +Index: hwy/detect_compiler_arch.h +--- hwy/detect_compiler_arch.h.orig ++++ hwy/detect_compiler_arch.h +@@ -390,6 +390,12 @@ + #error "Cannot have both RISCV_32 and RISCV_64" + #endif + ++#if defined(__sparc64__) ++#define HWY_ARCH_SPARC64 1 ++#else ++#define HWY_ARCH_SPARC64 0 ++#endif ++ + #if defined(__s390x__) + #define HWY_ARCH_S390X 1 + #else +@@ -425,7 +431,7 @@ + // detect none of the above. + #if (HWY_ARCH_X86 + HWY_ARCH_PPC + HWY_ARCH_ARM + HWY_ARCH_ARM_OLD + \ + HWY_ARCH_WASM + HWY_ARCH_RISCV + HWY_ARCH_S390X + HWY_ARCH_LOONGARCH + \ +- HWY_ARCH_HEXAGON) > 1 ++ HWY_ARCH_HEXAGON + HWY_ARCH_SPARC64) > 1 + #error "Must not detect more than one architecture" + #endif + +@@ -439,7 +445,7 @@ + #define HWY_ARCH_MAX_BYTES 64 + #elif HWY_ARCH_WASM || HWY_ARCH_LOONGARCH + #define HWY_ARCH_MAX_BYTES 32 +-#elif HWY_ARCH_PPC || HWY_ARCH_S390X || HWY_ARCH_ARM_V7 || HWY_ARCH_ARM_OLD ++#elif HWY_ARCH_PPC || HWY_ARCH_S390X || HWY_ARCH_SPARC64 || HWY_ARCH_ARM_V7 || HWY_ARCH_ARM_OLD + #define HWY_ARCH_MAX_BYTES 16 + #else + #error "Missing case for HWY_ARCH_*" Index: patches/patch-hwy_targets_cc =================================================================== RCS file: /cvs/ports/devel/highway/patches/patch-hwy_targets_cc,v diff -u -p -r1.2 patch-hwy_targets_cc --- patches/patch-hwy_targets_cc 6 Jun 2026 12:11:10 -0000 1.2 +++ patches/patch-hwy_targets_cc 6 Jun 2026 19:48:54 -0000 @@ -1,11 +1,13 @@ Index: hwy/targets.cc --- hwy/targets.cc.orig +++ hwy/targets.cc -@@ -29,7 +29,7 @@ +@@ -28,8 +28,8 @@ + #include #elif (HWY_ARCH_ARM || HWY_ARCH_PPC || HWY_ARCH_S390X || HWY_ARCH_RISCV || \ - HWY_ARCH_LOONGARCH) && \ +- HWY_ARCH_LOONGARCH) && \ - HWY_OS_LINUX ++ HWY_ARCH_LOONGARCH || HWY_ARCH_SPARC64) && \ + (HWY_OS_LINUX || HWY_OS_FREEBSD || defined(__OpenBSD__)) // sys/auxv.h does not always include asm/hwcap.h, or define HWCAP*, hence we // still include this directly. See #1199. @@ -16,7 +18,7 @@ Index: hwy/targets.cc namespace hwy { + +#if (HWY_ARCH_ARM || HWY_ARCH_PPC || HWY_ARCH_S390X || HWY_ARCH_RISCV || \ -+ HWY_ARCH_LOONGARCH) && \ ++ HWY_ARCH_LOONGARCH || HWY_ARCH_SPARC64) && \ + (HWY_OS_FREEBSD || defined(__OpenBSD__)) +#if HWY_HAVE_AUXV +// Implement getauxval using elf_aux_info