From 5340d6a94c3ca71e51af15461a4f6052eb160546 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 25 Feb 2026 14:29:07 -0800
Subject: [PATCH] Fixed definition of builtin function '_m_prefetch'
Fixes https://github.com/libsdl-org/SDL/issues/15116
---
include/SDL3/SDL_endian.h | 2 +-
include/SDL3/SDL_intrin.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/SDL3/SDL_endian.h b/include/SDL3/SDL_endian.h
index 854da60d7780b..69f097edd8863 100644
--- a/include/SDL3/SDL_endian.h
+++ b/include/SDL3/SDL_endian.h
@@ -46,7 +46,7 @@
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
/* As of Clang 11, '_m_prefetchw' is conflicting with the winnt.h's version,
so we define the needed '_m_prefetch' here as a pseudo-header, until the issue is fixed. */
-#if defined(__clang__) && !SDL_HAS_BUILTIN(_m_prefetch)
+#if defined(__clang__) && !SDL_HAS_BUILTIN(_m_prefetch)
#ifndef __PRFCHWINTRIN_H
#define __PRFCHWINTRIN_H
static __inline__ void __attribute__((__always_inline__, __nodebug__))
diff --git a/include/SDL3/SDL_intrin.h b/include/SDL3/SDL_intrin.h
index 59a3831e217f2..a2e968080cf6e 100644
--- a/include/SDL3/SDL_intrin.h
+++ b/include/SDL3/SDL_intrin.h
@@ -217,9 +217,9 @@
/* Need to do this here because intrin.h has C++ code in it */
/* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
#if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64))
-#ifdef __clang__
/* As of Clang 11, '_m_prefetchw' is conflicting with the winnt.h's version,
so we define the needed '_m_prefetch' here as a pseudo-header, until the issue is fixed. */
+#if defined(__clang__) && !SDL_HAS_BUILTIN(_m_prefetch)
#ifndef __PRFCHWINTRIN_H
#define __PRFCHWINTRIN_H
static __inline__ void __attribute__((__always_inline__, __nodebug__))