[med-svn] [Git][med-team/libdozeu][master] Pre-include immintrin.h before the SIMDe native aliases

Andreas Tille (@tille) gitlab at salsa.debian.org
Sat Nov 7 06:39:56 GMT 2026



Andreas Tille pushed to branch master at Debian Med / libdozeu


Commits:
71e35f6b by Andreas Tille at 2026-11-07T07:36:14+01:00
Pre-include immintrin.h before the SIMDe native aliases

Extend the existing SSE2 fix in dozeu.h.  Below -msse4.1 SIMDe defines the
missing SSE3/SSSE3/SSE4.1 intrinsics as macros for the native-looking _mm_*
names.  GCC's smmintrin.h and the AVX/AVX-512 headers reached through
immintrin.h declare those same names, so any translation unit that includes
dozeu.h first and a native intrinsic header later still fails once the
aliases are expanded inside the compiler's declarations.

Pre-include the complete <immintrin.h> before enabling the aliases when only
SSE2 is available.  Its include guards make every later native header
inclusion a no-op, while SIMDe still supplies the emulated code and keeps
the SSE2 baseline.  This lets reverse dependencies such as vg build without
forcing -msse4.1 on every SIMD variant.

Assisted-By: deepseek-v4.1-flash-free

- - - - -


2 changed files:

- debian/changelog
- debian/patches/use_native_smmintrin_on_sse4_1_x86.patch


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+libdozeu (0.0~git20260825.d0e9ba6-3) unstable; urgency=medium
+
+  * Extend the SSE2 intrinsics fix: pre-include the complete <immintrin.h>
+    before enabling the SIMDe native aliases
+
+ -- Andreas Tille <tille at debian.org>  Sat, 07 Nov 2026 04:54:30 +0100
+
 libdozeu (0.0~git20260825.d0e9ba6-2) unstable; urgency=medium
 
   * Use the compiler's own <smmintrin.h> on SSE4.1-capable x86 instead of


=====================================
debian/patches/use_native_smmintrin_on_sse4_1_x86.patch
=====================================
@@ -1,22 +1,28 @@
-Description: Use native SSE4.1 intrinsics on x86 instead of forcing SIMDe aliases
+Description: Use native x86 intrinsics instead of colliding SIMDe aliases
  dozeu.h unconditionally defined SIMDE_ENABLE_NATIVE_ALIASES and included
- simde/x86/sse4.1.h. GCC 16 now defines those SSE intrinsics natively in its
- own headers (avx512vlintrin.h/smmintrin.h/tmmintrin.h), so any translation
- unit including dozeu.h that later pulls in a native intrinsic header fails
+ simde/x86/sse4.1.h. GCC 16 defines those SSE intrinsics natively in its own
+ headers (avx512vlintrin.h/smmintrin.h/tmmintrin.h), so any translation unit
+ that includes dozeu.h and later pulls in a native intrinsic header fails
  with redefinition errors, breaking reverse dependencies such as vg on
- unstable. On SSE4.1-capable x86 include the compiler's own <smmintrin.h>
- instead and keep the SIMDe fallback elsewhere. Also include <stdio.h>
- explicitly because the header uses fprintf(stderr, ...) and previously
- relied on SIMDe providing it transitively.
+ unstable.
+ .
+ On SSE4.1-capable x86 include the compiler's own <smmintrin.h> instead.
+ Where only SSE2 is enabled, pre-include the complete <immintrin.h> before
+ enabling the SIMDe native aliases: its include guards then make any later
+ native header inclusion a no-op, so the aliases cannot be expanded inside
+ the compiler's declarations. SIMDe still supplies the emulated SSE3/SSSE3/
+ SSE4.1 code, preserving the SSE2 baseline.
+ .
+ Keep the SIMDe fallback for architectures without SSE2. Also include
+ <stdio.h> explicitly because the header uses fprintf(stderr, ...) and
+ previously relied on SIMDe providing it transitively.
 Author: Andreas Tille <tille at debian.org>
-Last-Update: 2026-11-04
+Last-Update: 2026-11-07
 Assisted-By: deepseek-v4.1-flash-free
 
-diff --git a/dozeu.h b/dozeu.h
-index b851419..98eb0c7 100644
 --- a/dozeu.h
 +++ b/dozeu.h
-@@ -42,8 +42,13 @@
+@@ -42,8 +42,30 @@
  #  define _BSD_SOURCE
  #endif
  
@@ -25,6 +31,23 @@ index b851419..98eb0c7 100644
 +#include <stdio.h>
 +#if defined(__SSE4_1__)
 +#  include <smmintrin.h>
++#elif defined(__SSE2__)
++/*
++ * Without -msse4.1 SIMDe provides the missing SSE3/SSSE3/SSE4.1 intrinsics
++ * under the native-looking _mm_* names as macros.  GCC's own intrinsic
++ * headers (smmintrin.h, and via immintrin.h also the AVX/AVX-512 headers
++ * such as avx512vlintrin.h) declare or define those same names.  If a
++ * translation unit includes dozeu.h first and a native header later, the
++ * macros get expanded inside the compiler's declarations and break the
++ * build.  Include the complete set of native headers first so that their
++ * include guards turn any later inclusion into a no-op; SIMDe still
++ * provides the emulated code for the ISA the compiler was not told to
++ * enable.  immintrin.h contains all the x86 intrinsic headers, so a later
++ * include of smmintrin.h, x86intrin.h or immintrin.h cannot clash.
++ */
++#  include <immintrin.h>
++#  define SIMDE_ENABLE_NATIVE_ALIASES
++#  include "simde/x86/sse4.1.h"
 +#else
 +#  define SIMDE_ENABLE_NATIVE_ALIASES
 +#  include "simde/x86/sse4.1.h"



View it on GitLab: https://salsa.debian.org/med-team/libdozeu/-/commit/71e35f6b51d60f67002821e4ad89ac2cb00d14f9

-- 
View it on GitLab: https://salsa.debian.org/med-team/libdozeu/-/commit/71e35f6b51d60f67002821e4ad89ac2cb00d14f9
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20261107/6b6a280d/attachment-0001.htm>


More information about the debian-med-commit mailing list