| 
									
										
										
										
											2013-04-17 23:09:55 -04:00
										 |  |  | // Copyright 2013 Dolphin Emulator Project
 | 
					
						
							|  |  |  | // Licensed under GPLv2
 | 
					
						
							|  |  |  | // Refer to the license.txt file included.
 | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-13 21:28:27 -05:00
										 |  |  | // Detect the CPU, so we'll know which optimizations to use
 | 
					
						
							| 
									
										
										
										
											2014-02-10 13:54:46 -05:00
										 |  |  | #pragma once
 | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <string>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | enum CPUVendor | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	VENDOR_INTEL = 0, | 
					
						
							|  |  |  | 	VENDOR_AMD = 1, | 
					
						
							| 
									
										
										
										
											2013-02-26 13:49:00 -06:00
										 |  |  | 	VENDOR_ARM = 2, | 
					
						
							|  |  |  | 	VENDOR_OTHER = 3, | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct CPUInfo | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	CPUVendor vendor; | 
					
						
							| 
									
										
										
										
											2013-03-19 21:51:12 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-20 14:01:50 -04:00
										 |  |  | 	char cpu_string[0x41]; | 
					
						
							|  |  |  | 	char brand_string[0x21]; | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 	bool OS64bit; | 
					
						
							|  |  |  | 	bool CPU64bit; | 
					
						
							|  |  |  | 	bool Mode64bit; | 
					
						
							| 
									
										
										
										
											2013-03-19 21:51:12 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-29 21:13:56 +00:00
										 |  |  | 	bool HTT; | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 	int num_cores; | 
					
						
							| 
									
										
										
										
											2010-12-18 18:23:22 +00:00
										 |  |  | 	int logical_cpu_count; | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	bool bSSE; | 
					
						
							|  |  |  | 	bool bSSE2; | 
					
						
							|  |  |  | 	bool bSSE3; | 
					
						
							|  |  |  | 	bool bSSSE3; | 
					
						
							|  |  |  | 	bool bPOPCNT; | 
					
						
							|  |  |  | 	bool bSSE4_1; | 
					
						
							|  |  |  | 	bool bSSE4_2; | 
					
						
							|  |  |  | 	bool bLZCNT; | 
					
						
							|  |  |  | 	bool bSSE4A; | 
					
						
							| 
									
										
										
										
											2011-01-26 21:27:26 +00:00
										 |  |  | 	bool bAVX; | 
					
						
							| 
									
										
										
										
											2014-08-24 09:14:54 -07:00
										 |  |  | 	bool bAVX2; | 
					
						
							|  |  |  | 	bool bBMI1; | 
					
						
							|  |  |  | 	bool bBMI2; | 
					
						
							| 
									
										
										
										
											2013-11-13 04:46:34 +01:00
										 |  |  | 	bool bFMA; | 
					
						
							| 
									
										
										
										
											2011-01-26 21:27:26 +00:00
										 |  |  | 	bool bAES; | 
					
						
							| 
									
										
										
										
											2013-10-24 13:52:22 +02:00
										 |  |  | 	// FXSAVE/FXRSTOR
 | 
					
						
							|  |  |  | 	bool bFXSR; | 
					
						
							| 
									
										
										
										
											2014-03-16 01:41:37 +01:00
										 |  |  | 	bool bMOVBE; | 
					
						
							| 
									
										
										
										
											2013-10-24 22:05:53 +02:00
										 |  |  | 	// This flag indicates that the hardware supports some mode
 | 
					
						
							|  |  |  | 	// in which denormal inputs _and_ outputs are automatically set to (signed) zero.
 | 
					
						
							|  |  |  | 	// TODO: ARM
 | 
					
						
							|  |  |  | 	bool bFlushToZero; | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 	bool bLAHFSAHF64; | 
					
						
							|  |  |  | 	bool bLongMode; | 
					
						
							| 
									
										
										
										
											2013-03-19 21:51:12 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-26 13:49:00 -06:00
										 |  |  | 	// ARM specific CPUInfo
 | 
					
						
							|  |  |  | 	bool bSwp; | 
					
						
							|  |  |  | 	bool bHalf; | 
					
						
							|  |  |  | 	bool bThumb; | 
					
						
							|  |  |  | 	bool bFastMult; | 
					
						
							|  |  |  | 	bool bVFP; | 
					
						
							|  |  |  | 	bool bEDSP; | 
					
						
							|  |  |  | 	bool bThumbEE; | 
					
						
							|  |  |  | 	bool bNEON; | 
					
						
							|  |  |  | 	bool bVFPv3; | 
					
						
							|  |  |  | 	bool bTLS; | 
					
						
							|  |  |  | 	bool bVFPv4; | 
					
						
							|  |  |  | 	bool bIDIVa; | 
					
						
							|  |  |  | 	bool bIDIVt; | 
					
						
							|  |  |  | 	bool bArmV7;  // enable MOVT, MOVW etc
 | 
					
						
							| 
									
										
										
										
											2013-03-19 21:51:12 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-26 13:49:00 -06:00
										 |  |  | 	// ARMv8 specific
 | 
					
						
							|  |  |  | 	bool bFP; | 
					
						
							|  |  |  | 	bool bASIMD; | 
					
						
							| 
									
										
										
										
											2009-02-28 01:26:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-24 10:10:48 +00:00
										 |  |  | 	// Call Detect()
 | 
					
						
							|  |  |  | 	explicit CPUInfo(); | 
					
						
							| 
									
										
										
										
											2013-03-19 21:51:12 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-13 21:28:27 -05:00
										 |  |  | 	// Turn the CPU info into a string we can show
 | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 	std::string Summarize(); | 
					
						
							| 
									
										
										
										
											2010-02-24 10:10:48 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2014-11-13 21:28:27 -05:00
										 |  |  | 	// Detects the various CPU features
 | 
					
						
							| 
									
										
										
										
											2010-02-24 10:10:48 +00:00
										 |  |  | 	void Detect(); | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extern CPUInfo cpu_info; |