mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	cpu: use intrinsics to modify status register
For better portability. Also only use the code when we can compile with SSE is available.
This commit is contained in:
		
							parent
							
								
									027dd25980
								
							
						
					
					
						commit
						14fd5425af
					
				
					 2 changed files with 17 additions and 2 deletions
				
			
		| 
						 | 
					@ -177,14 +177,22 @@ x86_init(struct impl *impl)
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if defined(HAVE_SSE)
 | 
				
			||||||
 | 
					#include <xmmintrin.h>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int x86_zero_denormals(void *object, bool enable)
 | 
					static int x86_zero_denormals(void *object, bool enable)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					#if defined(HAVE_SSE)
 | 
				
			||||||
	unsigned int mxcsr;
 | 
						unsigned int mxcsr;
 | 
				
			||||||
	mxcsr = __builtin_ia32_stmxcsr();
 | 
						mxcsr = _mm_getcsr();
 | 
				
			||||||
	if (enable)
 | 
						if (enable)
 | 
				
			||||||
		mxcsr |= 0x8040;
 | 
							mxcsr |= 0x8040;
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		mxcsr &= ~0x8040;
 | 
							mxcsr &= ~0x8040;
 | 
				
			||||||
	__builtin_ia32_ldmxcsr(mxcsr);
 | 
						_mm_setcsr(mxcsr);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
						return -ENOTSUP;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,9 +9,16 @@ spa_support_sources = [
 | 
				
			||||||
  'system.c'
 | 
					  'system.c'
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					simd_cargs = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if have_sse
 | 
				
			||||||
 | 
					  simd_cargs += ['-DHAVE_SSE']
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
spa_support_lib = shared_library('spa-support',
 | 
					spa_support_lib = shared_library('spa-support',
 | 
				
			||||||
  spa_support_sources,
 | 
					  spa_support_sources,
 | 
				
			||||||
  include_directories : [ spa_inc ],
 | 
					  include_directories : [ spa_inc ],
 | 
				
			||||||
 | 
					  c_args : [ simd_cargs ],
 | 
				
			||||||
  dependencies : [ pthread_lib, epoll_shim_dep ],
 | 
					  dependencies : [ pthread_lib, epoll_shim_dep ],
 | 
				
			||||||
  install : true,
 | 
					  install : true,
 | 
				
			||||||
  install_dir : spa_plugindir / 'support')
 | 
					  install_dir : spa_plugindir / 'support')
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue