diff mbox series

[FFmpeg-devel] x86/intreadwrite: add missing casts to pointer arguments

Message ID 20240711165419.62214-1-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel] x86/intreadwrite: add missing casts to pointer arguments | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

James Almer July 11, 2024, 4:54 p.m. UTC
Should make strict compilers happy.
Also, make AV_COPY128 use integer operations while at it.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavutil/x86/intreadwrite.h | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

Comments

Martin Storsjö July 11, 2024, 9:02 p.m. UTC | #1
On Thu, 11 Jul 2024, James Almer wrote:

> Should make strict compilers happy.
> Also, make AV_COPY128 use integer operations while at it.
>
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
> libavutil/x86/intreadwrite.h | 15 ++++-----------
> 1 file changed, 4 insertions(+), 11 deletions(-)
>
> diff --git a/libavutil/x86/intreadwrite.h b/libavutil/x86/intreadwrite.h
> index d916410e14..65cc6b39a1 100644
> --- a/libavutil/x86/intreadwrite.h
> +++ b/libavutil/x86/intreadwrite.h
> @@ -23,32 +23,25 @@
>
> #include <stdint.h>
> #include "config.h"
> -#if HAVE_INTRINSICS_SSE && defined(__SSE__)
> -#include <immintrin.h>
> -#endif

If we no longer use HAVE_INTRINSICS_SSE, should we remove the 
corresponding check in configure too?

Thanks, this patch seems to avoid the issue discussed in the other thread. 
(I'm not familiar enough with these intrinsics to be able to comment 
meaningfully on the patch itself though.)

// Martin
diff mbox series

Patch

diff --git a/libavutil/x86/intreadwrite.h b/libavutil/x86/intreadwrite.h
index d916410e14..65cc6b39a1 100644
--- a/libavutil/x86/intreadwrite.h
+++ b/libavutil/x86/intreadwrite.h
@@ -23,32 +23,25 @@ 
 
 #include <stdint.h>
 #include "config.h"
-#if HAVE_INTRINSICS_SSE && defined(__SSE__)
-#include <immintrin.h>
-#endif
 #if HAVE_INTRINSICS_SSE2 && defined(__SSE2__)
 #include <emmintrin.h>
 #endif
 #include "libavutil/attributes.h"
 
-#if HAVE_INTRINSICS_SSE && defined(__SSE__)
+#if HAVE_INTRINSICS_SSE2 && defined(__SSE2__)
 
 #define AV_COPY128 AV_COPY128
 static av_always_inline void AV_COPY128(void *d, const void *s)
 {
-    __m128 tmp = _mm_load_ps(s);
-    _mm_store_ps(d, tmp);
+    __m128i tmp = _mm_load_si128((const __m128i *)s);
+    _mm_store_si128((__m128i *)d, tmp);
 }
 
-#endif /* HAVE_INTRINSICS_SSE && defined(__SSE__) */
-
-#if HAVE_INTRINSICS_SSE2 && defined(__SSE2__)
-
 #define AV_ZERO128 AV_ZERO128
 static av_always_inline void AV_ZERO128(void *d)
 {
     __m128i zero = _mm_setzero_si128();
-    _mm_store_si128(d, zero);
+    _mm_store_si128((__m128i *)d, zero);
 }
 
 #endif /* HAVE_INTRINSICS_SSE2 && defined(__SSE2__) */