Commit 9297ebb2 authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[assembler] Fix _xgetbv definition in ia32

Port the fix from https://crrev.com/c/1414858 to ia32. TL;DR, _xgetbv is
a reserved name.

Change-Id: I97cb90ea7d244c02326432cfbfd55419a0a9854a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2543933
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71229}
parent 9235f258
......@@ -81,9 +81,10 @@ Immediate Immediate::EmbeddedStringConstant(const StringConstantBase* str) {
namespace {
#if !V8_LIBC_MSVCRT
V8_INLINE uint64_t _xgetbv(unsigned int xcr) {
V8_INLINE uint64_t xgetbv(unsigned int xcr) {
#if V8_LIBC_MSVCRT
return _xgetbv(xcr);
#else
unsigned eax, edx;
// Check xgetbv; this uses a .byte sequence instead of the instruction
// directly because older assemblers do not include support for xgetbv and
......@@ -91,12 +92,9 @@ V8_INLINE uint64_t _xgetbv(unsigned int xcr) {
// used.
__asm__ volatile(".byte 0x0F, 0x01, 0xD0" : "=a"(eax), "=d"(edx) : "c"(xcr));
return static_cast<uint64_t>(eax) | (static_cast<uint64_t>(edx) << 32);
#endif
}
#define _XCR_XFEATURE_ENABLED_MASK 0
#endif // !V8_LIBC_MSVCRT
bool OSHasAVXSupport() {
#if V8_OS_MACOSX
// Mac OS X up to 10.9 has a bug where AVX transitions were indeed being
......@@ -116,7 +114,7 @@ bool OSHasAVXSupport() {
if (kernel_version_major <= 13) return false;
#endif // V8_OS_MACOSX
// Check whether OS claims to support AVX.
uint64_t feature_mask = _xgetbv(_XCR_XFEATURE_ENABLED_MASK);
uint64_t feature_mask = xgetbv(0); // XCR_XFEATURE_ENABLED_MASK
return (feature_mask & 0x6) == 0x6;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment