mirror of
				https://sourceware.org/git/glibc.git
				synced 2025-11-03 20:53:13 +03:00 
			
		
		
		
	Hardware ctz instructions are available in the RISC-V Zbb and XTheadBb extension. With special `-march` flags defined, we can generate more simplified code compared to the generic implementation of `ffs`/`ffsll`. Signed-off-by: Julian Zhu <julian.oerv@isrc.iscas.ac.cn> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
		
			
				
	
	
		
			11 lines
		
	
	
		
			292 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			11 lines
		
	
	
		
			292 B
		
	
	
	
		
			C
		
	
	
	
	
	
#if __GNUC_PREREQ (12, 0) && defined __riscv_zbb
 | 
						|
#  define USE_FFS_BUILTIN 1
 | 
						|
#  define USE_FFSLL_BUILTIN 1
 | 
						|
#elif __GNUC_PREREQ (13, 0) && defined __riscv_xtheadbb
 | 
						|
#  define USE_FFS_BUILTIN 0
 | 
						|
#  define USE_FFSLL_BUILTIN 1
 | 
						|
#else
 | 
						|
#  define USE_FFS_BUILTIN 0
 | 
						|
#  define USE_FFSLL_BUILTIN 0
 | 
						|
#endif
 |