mirror of
				https://git.ffmpeg.org/ffmpeg.git
				synced 2025-10-31 15:50:55 +00:00 
			
		
		
		
	x86/cpu: implement get/set_eflags using intrinsics
Signed-off-by: Diego Biurrun <diego@biurrun.de> Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
		
							parent
							
								
									c0ee695bd7
								
							
						
					
					
						commit
						358d854df8
					
				
					 2 changed files with 16 additions and 0 deletions
				
			
		
							
								
								
									
										2
									
								
								configure
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								configure
									
										
									
									
										vendored
									
									
								
							|  | @ -1126,6 +1126,7 @@ HAVE_LIST=" | ||||||
|     rdtsc |     rdtsc | ||||||
|     round |     round | ||||||
|     roundf |     roundf | ||||||
|  |     rweflags | ||||||
|     sched_getaffinity |     sched_getaffinity | ||||||
|     sdl |     sdl | ||||||
|     sdl_video_size |     sdl_video_size | ||||||
|  | @ -2747,6 +2748,7 @@ elif enabled x86; then | ||||||
|     check_code ld immintrin.h "__xgetbv(0)" && enable xgetbv |     check_code ld immintrin.h "__xgetbv(0)" && enable xgetbv | ||||||
|     check_code ld intrin.h "int info[4]; __cpuid(info, 0)" && enable cpuid |     check_code ld intrin.h "int info[4]; __cpuid(info, 0)" && enable cpuid | ||||||
|     check_code ld intrin.h "__rdtsc()" && enable rdtsc |     check_code ld intrin.h "__rdtsc()" && enable rdtsc | ||||||
|  |     check_code ld intrin.h "unsigned int x = __readeflags()" && enable rweflags | ||||||
| 
 | 
 | ||||||
|     check_code ld mmintrin.h "_mm_empty()" && enable mm_empty |     check_code ld mmintrin.h "_mm_empty()" && enable mm_empty | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -62,6 +62,8 @@ | ||||||
|     } while (0) |     } while (0) | ||||||
| #endif /* HAVE_XGETBV */ | #endif /* HAVE_XGETBV */ | ||||||
| 
 | 
 | ||||||
|  | #if HAVE_INLINE_ASM | ||||||
|  | 
 | ||||||
| #define get_eflags(x)                           \ | #define get_eflags(x)                           \ | ||||||
|     __asm__ volatile ("pushfl     \n"           \ |     __asm__ volatile ("pushfl     \n"           \ | ||||||
|                       "pop    %0  \n"           \ |                       "pop    %0  \n"           \ | ||||||
|  | @ -72,6 +74,18 @@ | ||||||
|                       "popfl      \n"           \ |                       "popfl      \n"           \ | ||||||
|                       :: "r"(x)) |                       :: "r"(x)) | ||||||
| 
 | 
 | ||||||
|  | #elif HAVE_RWEFLAGS | ||||||
|  | 
 | ||||||
|  | #include <intrin.h> | ||||||
|  | 
 | ||||||
|  | #define get_eflags(x)                           \ | ||||||
|  |     x = __readeflags() | ||||||
|  | 
 | ||||||
|  | #define set_eflags(x)                           \ | ||||||
|  |     __writeeflags(x) | ||||||
|  | 
 | ||||||
|  | #endif /* HAVE_INLINE_ASM */ | ||||||
|  | 
 | ||||||
| /* Function to test if multimedia instructions are supported...  */ | /* Function to test if multimedia instructions are supported...  */ | ||||||
| int ff_get_cpu_flags_x86(void) | int ff_get_cpu_flags_x86(void) | ||||||
| { | { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Ronald S. Bultje
						Ronald S. Bultje