Commit 7fc9c2e5 by Ian Lance Taylor

libgo: use inline assembly in favor of call to _xgetbv()

    
    Use inline assembly in the implementation of internal_cpu.xgetbv as
    opposed to a call to the intrinsic _xgetbv(), since non-gcc compilers
    (e.g. clang) may or may not have support for it.
    
    Reviewed-on: https://go-review.googlesource.com/c/140137

From-SVN: r264882
parent d5a98955
9f4cf23e716bcf65e071260afa032a64acd3fdde d0739c13ca3686df1f8d0fae7c6c5caaed058503
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the gofrontend repository. merge done from the gofrontend repository.
...@@ -52,12 +52,18 @@ struct xgetbv_ret xgetbv(void) ...@@ -52,12 +52,18 @@ struct xgetbv_ret xgetbv(void)
#pragma GCC target("xsave") #pragma GCC target("xsave")
struct xgetbv_ret xgetbv(void) { struct xgetbv_ret xgetbv(void) {
long long r;
struct xgetbv_ret ret; struct xgetbv_ret ret;
r = _xgetbv(0); // At some point, use call to _xgetbv() instead:
ret.eax = r & 0xffffffff; //
ret.edx = r >> 32; // long long r = _xgetbv(0);
// ret.eax = r & 0xffffffff;
// ret.edx = r >> 32;
//
unsigned int __eax, __edx, __xcr_no = 0;
__asm__ ("xgetbv" : "=a" (__eax), "=d" (__edx) : "c" (__xcr_no));
ret.eax = __eax;
ret.edx = __edx;
return ret; return ret;
} }
......
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