forked from OSchip/llvm-project
				
			[Support] Include the intrisics header and check for definition properly.
llvm-svn: 172655
This commit is contained in:
		
							parent
							
								
									bd7c169664
								
							
						
					
					
						commit
						a6285243b2
					
				| 
						 | 
					@ -16,6 +16,10 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "llvm/Support/SwapByteOrder.h"
 | 
					#include "llvm/Support/SwapByteOrder.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef _MSC_VER
 | 
				
			||||||
 | 
					# include <intrin.h>
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace llvm {
 | 
					namespace llvm {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// NOTE: The following support functions use the _32/_64 extensions instead of
 | 
					// NOTE: The following support functions use the _32/_64 extensions instead of
 | 
				
			||||||
| 
						 | 
					@ -299,7 +303,7 @@ inline unsigned CountTrailingOnes_64(uint64_t Value) {
 | 
				
			||||||
inline unsigned CountPopulation_32(uint32_t Value) {
 | 
					inline unsigned CountPopulation_32(uint32_t Value) {
 | 
				
			||||||
#if __GNUC__ >= 4
 | 
					#if __GNUC__ >= 4
 | 
				
			||||||
  return __builtin_popcount(Value);
 | 
					  return __builtin_popcount(Value);
 | 
				
			||||||
#elif _MSC_VER
 | 
					#elif defined(_MSC_VER)
 | 
				
			||||||
  return __popcnt(Value);
 | 
					  return __popcnt(Value);
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
  uint32_t v = Value - ((Value >> 1) & 0x55555555);
 | 
					  uint32_t v = Value - ((Value >> 1) & 0x55555555);
 | 
				
			||||||
| 
						 | 
					@ -313,7 +317,7 @@ inline unsigned CountPopulation_32(uint32_t Value) {
 | 
				
			||||||
inline unsigned CountPopulation_64(uint64_t Value) {
 | 
					inline unsigned CountPopulation_64(uint64_t Value) {
 | 
				
			||||||
#if __GNUC__ >= 4
 | 
					#if __GNUC__ >= 4
 | 
				
			||||||
  return __builtin_popcountll(Value);
 | 
					  return __builtin_popcountll(Value);
 | 
				
			||||||
#elif _MSC_VER
 | 
					#elif defined(_MSC_VER)
 | 
				
			||||||
  return __popcnt64(Value);
 | 
					  return __popcnt64(Value);
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
  uint64_t v = Value - ((Value >> 1) & 0x5555555555555555ULL);
 | 
					  uint64_t v = Value - ((Value >> 1) & 0x5555555555555555ULL);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue