llvm.org GIT mirror llvm / 729c194
Rolling back the AVX support patch due to breaking a gcc 4.6 build bot that doesn't understand the xgetbv instruction for some reason. Will revisit when time permits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178614 91177308-0d34-0410-b5e6-96231b3b80d8 Aaron Ballman 7 years ago
1 changed file(s) with 2 addition(s) and 23 deletion(s). Raw diff Collapse all Expand all
111111 #endif
112112 }
113113
114 static bool OSHasAVXSupport() {
115 #if defined( __GNUC__ ) && \
116 (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4)
117 int rEAX, rEDX;
118 __asm__ ("xgetbv" : "=a" (rEAX), "=d" (rEDX) : "c" (0));
119 #elif defined(_MSC_VER)
120 unsigned long long rEAX = _xgetbv(_XCR_XFEATURE_ENABLED_MASK);
121 #else
122 int rEAX = 0; // Ensures we return false
123 #endif
124 return (rEAX & 6) == 6;
125 }
126
127114 static void DetectX86FamilyModel(unsigned EAX, unsigned &Family,
128115 unsigned &Model) {
129116 Family = (EAX >> 8) & 0xf; // Bits 8 - 11
146133 DetectX86FamilyModel(EAX, Family, Model);
147134
148135 bool HasSSE3 = (ECX & 0x1);
149 // If CPUID indicates support for XSAVE, XRESTORE and AVX, and XGETBV
150 // indicates that the AVX registers will be saved and restored on context
151 // switch, when we have full AVX support.
152 bool HasAVX = (ECX & ((1 << 28) | (1 << 27))) != 0 && OSHasAVXSupport();
153136 GetX86CpuIDAndInfo(0x80000001, &EAX, &EBX, &ECX, &EDX);
154137 bool Em64T = (EDX >> 29) & 0x1;
155138
259242 case 42: // Intel Core i7 processor. All processors are manufactured
260243 // using the 32 nm process.
261244 case 45:
262 // Not all Sandy Bridge processors support AVX (such as the Pentium
263 // versions instead of the i7 versions).
264 return HasAVX ? "corei7-avx" : "corei7";
245 return "corei7-avx";
265246
266247 // Ivy Bridge:
267248 case 58:
268 // Not all Ivy Bridge processors support AVX (such as the Pentium
269 // versions instead of the i7 versions).
270 return HasAVX ? "core-avx-i" : "corei7";
249 return "core-avx-i";
271250
272251 case 28: // Most 45 nm Intel Atom processors
273252 case 38: // 45 nm Atom Lincroft