mirror of
				https://github.com/libsdl-org/SDL.git
				synced 2025-11-04 01:34:38 +00:00 
			
		
		
		
	Support older GCC and clang that lack some intrinsics
This commit is contained in:
		
				
					committed by
					
						
						Sam Lantinga
					
				
			
			
				
	
			
			
			
						parent
						
							e8cba442c5
						
					
				
				
					commit
					c80c540be3
				
			@@ -4,6 +4,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#ifdef SDL_AVX2_INTRINSICS
 | 
					#ifdef SDL_AVX2_INTRINSICS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define SDL_blit_A_avx2_c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "SDL_blit.h"
 | 
					#include "SDL_blit.h"
 | 
				
			||||||
#include "SDL_blit_A_sse4_1.h"
 | 
					#include "SDL_blit_A_sse4_1.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,10 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#ifdef SDL_SSE4_1_INTRINSICS
 | 
					#ifdef SDL_SSE4_1_INTRINSICS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define SDL_blit_A_sse4_1_c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "SDL_blit.h"
 | 
					#include "SDL_blit.h"
 | 
				
			||||||
 | 
					#include "SDL_blit_A_sse4_1.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Using the SSE4.1 instruction set, blit four pixels with alpha blending
 | 
					 * Using the SSE4.1 instruction set, blit four pixels with alpha blending
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,4 +12,36 @@ void SDL_TARGETING("sse4.1") BlitNtoNPixelAlpha_SSE4_1(SDL_BlitInfo *info);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* for compatibility with older compilers: */
 | 
				
			||||||
 | 
					#if defined(SDL_blit_A_sse4_1_c) || defined(SDL_blit_A_avx2_c)
 | 
				
			||||||
 | 
					/* _mm_loadu_si64 : missing in clang < 3.9, missing in gcc < 9
 | 
				
			||||||
 | 
					 * _mm_storeu_si64: missing in clang < 8.0, missing in gcc < 9
 | 
				
			||||||
 | 
					 * __m128i_u type (to be used to define the missing two above):
 | 
				
			||||||
 | 
					 *		      missing in gcc < 7, missing in clang < 9
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					#if defined(__clang__)
 | 
				
			||||||
 | 
					#if (__clang_major__ < 9)
 | 
				
			||||||
 | 
					#define MISSING__m128i_u
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#if (__clang_major__ < 8)
 | 
				
			||||||
 | 
					#define MISSING__mm_storeu_si64
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#elif defined(__GNUC__)
 | 
				
			||||||
 | 
					#if (__GNUC__ < 7)
 | 
				
			||||||
 | 
					#define MISSING__m128i_u
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#if (__GNUC__ < 9)
 | 
				
			||||||
 | 
					#define MISSING__mm_storeu_si64
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef MISSING__m128i_u
 | 
				
			||||||
 | 
					typedef long long __m128i_u __attribute__((__vector_size__(16), __may_alias__, __aligned__(1)));
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifdef MISSING__mm_storeu_si64
 | 
				
			||||||
 | 
					#define _mm_loadu_si64(_x) _mm_loadl_epi64((__m128i_u*)(_x))
 | 
				
			||||||
 | 
					#define _mm_storeu_si64(_x,_y)  _mm_storel_epi64((__m128i_u*)(_x),(_y))
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#endif /**/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif //SDL_SDL_BLIT_A_SSE4_1_H
 | 
					#endif //SDL_SDL_BLIT_A_SSE4_1_H
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user