mirror of
				https://github.com/PurpleI2P/i2pd.git
				synced 2025-11-04 00:20:46 +00:00 
			
		
		
		
	CPU: remove AVX code, switch to __builtin for AES detection (#1959)
* [cpu] remove avx detect and code blocks, try to switch to __builtin * [cpu] use __builtin_* only on x86 systems * [cpu] perform check in separate function * [cpu] set AES definition on MSVC * update x86 and aes support checks at compile time * [cmake] update comment about AES on MSVC
This commit is contained in:
		
							parent
							
								
									32c5ff23a6
								
							
						
					
					
						commit
						7b6aa41ca8
					
				
					 11 changed files with 222 additions and 232 deletions
				
			
		| 
						 | 
				
			
			@ -803,29 +803,12 @@ namespace data
 | 
			
		|||
	XORMetric operator^(const IdentHash& key1, const IdentHash& key2)
 | 
			
		||||
	{
 | 
			
		||||
		XORMetric m;
 | 
			
		||||
#if (defined(__x86_64__) || defined(__i386__)) && defined(__AVX__) // not all X86 targets supports AVX (like old Pentium, see #1600)
 | 
			
		||||
		if(i2p::cpu::avx)
 | 
			
		||||
		{
 | 
			
		||||
			__asm__
 | 
			
		||||
			(
 | 
			
		||||
				"vmovups %1, %%ymm0 \n"
 | 
			
		||||
				"vmovups %2, %%ymm1 \n"
 | 
			
		||||
				"vxorps %%ymm0, %%ymm1, %%ymm1 \n"
 | 
			
		||||
				"vmovups %%ymm1, %0 \n"
 | 
			
		||||
				: "=m"(*m.metric)
 | 
			
		||||
				: "m"(*key1), "m"(*key2)
 | 
			
		||||
				: "memory", "%xmm0", "%xmm1" // should be replaced by %ymm0/1 once supported by compiler
 | 
			
		||||
			);
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
#endif
 | 
			
		||||
		{
 | 
			
		||||
			const uint64_t * hash1 = key1.GetLL (), * hash2 = key2.GetLL ();
 | 
			
		||||
			m.metric_ll[0] = hash1[0] ^ hash2[0];
 | 
			
		||||
			m.metric_ll[1] = hash1[1] ^ hash2[1];
 | 
			
		||||
			m.metric_ll[2] = hash1[2] ^ hash2[2];
 | 
			
		||||
			m.metric_ll[3] = hash1[3] ^ hash2[3];
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		const uint64_t * hash1 = key1.GetLL (), * hash2 = key2.GetLL ();
 | 
			
		||||
		m.metric_ll[0] = hash1[0] ^ hash2[0];
 | 
			
		||||
		m.metric_ll[1] = hash1[1] ^ hash2[1];
 | 
			
		||||
		m.metric_ll[2] = hash1[2] ^ hash2[2];
 | 
			
		||||
		m.metric_ll[3] = hash1[3] ^ hash2[3];
 | 
			
		||||
 | 
			
		||||
		return m;
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue