From 0f3dfb85d440e20d290a0f0db801bdf0289e1125 Mon Sep 17 00:00:00 2001 From: Ilan Schnell Date: Wed, 16 Jan 2013 19:56:42 -0600 Subject: [PATCH] simplified avx detection on Linux --- llvm/ee.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/llvm/ee.py b/llvm/ee.py index 8ca24d2..15ede87 100644 --- a/llvm/ee.py +++ b/llvm/ee.py @@ -56,14 +56,12 @@ def _detect_avx_support(): return True # force disable AVX # auto-detect avx try: - lines = open('/proc/cpuinfo').read().splitlines() + for line in open('/proc/cpuinfo'): + if line.lstrip().startswith('flags') and 'avx' in line.split(): + # enable AVX if flags contain AVX + return False except IOError: - return True # disable AVX if no /proc/cpuinfo is found - flags = [l for l in lines if l.lstrip().startswith('flags')] - if not flags: - return True # disable AVX if flags are empty - if 'avx' in flags[0]: - return False # enable AVX if flags contain AVX + pass # disable AVX if no /proc/cpuinfo is found return True # disable AVX if flags does not have AVX FORCE_DISABLE_AVX = _detect_avx_support()