From 522a29057102ab853e5b0bb47602e787cd5ff65a Mon Sep 17 00:00:00 2001
From: Jean-Marc Valin <jmvalin@jmvalin.ca>
Date: Sat, 24 Feb 2024 03:41:47 -0500
Subject: [PATCH] _mm_loadu_si23() needs immintrin.h on MSVC

---
 celt/x86/x86cpu.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/celt/x86/x86cpu.h b/celt/x86/x86cpu.h
index d2240f12d..8ae9be8d8 100644
--- a/celt/x86/x86cpu.h
+++ b/celt/x86/x86cpu.h
@@ -73,12 +73,18 @@ int opus_select_arch(void);
 #   include <string.h>
 #   include <emmintrin.h>
 
+#   ifdef _mm_loadu_si32
+#    undef _mm_loadu_si32
+#   endif
 #   define _mm_loadu_si32 WORKAROUND_mm_loadu_si32
 static inline __m128i WORKAROUND_mm_loadu_si32(void const* mem_addr) {
   int val;
   memcpy(&val, mem_addr, sizeof(val));
   return _mm_cvtsi32_si128(val);
 }
+#  elif defined(_MSC_VER)
+    /* MSVC needs this for _mm_loadu_si32 */
+#   include <immintrin.h>
 #  endif
 
 #  define OP_CVTEPI8_EPI32_M32(x) \
-- 
GitLab