Sean Callanan c4ffe37cf1 Added support for dynamic detection of AVX, and
fixed a few bugs that revealed.  Now the "register
read" command should show AVX registers
(ymm0-ymm15) on Mac OS X platforms that support
them.

When testing this on Mac OS X, run debugserver
manually, like this:

debugserver --native-regs localhost:1111 /path/to/executable

Then

lldb /path/to/executable
...
(lldb) process connect connect://localhost:1111

llvm-svn: 135331
2011-07-16 00:49:19 +00:00

32 lines
757 B
ArmAsm

//===-- HasAVX.s ---------------------------------------*- x86 Assembly -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#if defined (__i386__) || defined (__x86_64__)
.globl _HasAVX
_HasAVX:
mov $1, %eax
cpuid
and $0x018000000, %ecx
cmp $0x018000000, %ecx
jne not_supported
mov $0, %ecx
.byte 0x0f, 0x01, 0xd0 // xgetbv, for those assemblers that don't know it
and $0x06, %eax
cmp $0x06, %eax
jne not_supported
mov $1, %eax
jmp done
not_supported:
mov $0, %eax
done:
ret
#endif