aom: avg_intrin_sse2: use xx_loadl_32() for unaligned int loads

From c319f69f9c4a69850654d4934cc339a0b5c01ceb Mon Sep 17 00:00:00 2001
From: James Zern <[EMAIL REDACTED]>
Date: Thu, 9 May 2024 11:45:21 -0700
Subject: [PATCH] avg_intrin_sse2: use xx_loadl_32() for unaligned int loads

This quiets some undefined sanitizer warnings related to unaligned
loads; no change in assembly with gcc-13.

Change-Id: I770e5b9aab77cf91280fd6608efe922a21f382c3
---
 aom_dsp/x86/avg_intrin_sse2.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/aom_dsp/x86/avg_intrin_sse2.c b/aom_dsp/x86/avg_intrin_sse2.c
index 0b552b704..7ff280102 100644
--- a/aom_dsp/x86/avg_intrin_sse2.c
+++ b/aom_dsp/x86/avg_intrin_sse2.c
@@ -15,6 +15,7 @@
 #include "aom/aom_integer.h"
 #include "aom_dsp/x86/bitdepth_conversion_sse2.h"
 #include "aom_dsp/x86/mem_sse2.h"
+#include "aom_dsp/x86/synonyms.h"
 #include "aom_ports/mem.h"
 
 static INLINE void sign_extend_16bit_to_32bit_sse2(__m128i in, __m128i zero,
@@ -171,10 +172,8 @@ unsigned int aom_avg_4x4_sse2(const uint8_t *s, int p) {
   __m128i s0, s1, u0;
   unsigned int avg = 0;
   u0 = _mm_setzero_si128();
-  s0 = _mm_unpacklo_epi32(_mm_cvtsi32_si128(*(const int *)(s)),
-                          _mm_cvtsi32_si128(*(const int *)(s + p)));
-  s1 = _mm_unpacklo_epi32(_mm_cvtsi32_si128(*(const int *)(s + p * 2)),
-                          _mm_cvtsi32_si128(*(const int *)(s + p * 3)));
+  s0 = _mm_unpacklo_epi32(xx_loadl_32(s), xx_loadl_32(s + p));
+  s1 = _mm_unpacklo_epi32(xx_loadl_32(s + p * 2), xx_loadl_32(s + p * 3));
   s0 = _mm_sad_epu8(s0, u0);
   s1 = _mm_sad_epu8(s1, u0);
   s0 = _mm_add_epi16(s0, s1);