public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Iain Buclaw <ibuclaw@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/ibuclaw/heads/darwin)] libphobos: Use raw byte sequence instead of xgetbv
Date: Sat,  5 Dec 2020 23:47:33 +0000 (GMT)	[thread overview]
Message-ID: <20201205234733.1CE71385DC2E@sourceware.org> (raw)

https://gcc.gnu.org/g:5c171092c78b616f22412720dc68259d541383e0

commit 5c171092c78b616f22412720dc68259d541383e0
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Thu Dec 3 23:52:11 2020 +0100

    libphobos: Use raw byte sequence instead of xgetbv

Diff:
---
 libphobos/libdruntime/core/cpuid.d | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libphobos/libdruntime/core/cpuid.d b/libphobos/libdruntime/core/cpuid.d
index 2ba13b55bf1..109fd3b9efc 100644
--- a/libphobos/libdruntime/core/cpuid.d
+++ b/libphobos/libdruntime/core/cpuid.d
@@ -771,7 +771,10 @@ void cpuidX86()
     if (cf.miscfeatures & OSXSAVE_BIT)
     {
         version (GNU) asm pure nothrow @nogc {
-            "xgetbv" : "=a" (a), "=d" (d) : "c" (0);
+            /* Old assemblers do not recognize xgetbv, and there is no easy way
+             * to conditionally compile based on the assembler used, so use the
+             * raw .byte sequence instead.  */
+            ".byte 0x0f, 0x01, 0xd0" : "=a" (a), "=d" (d) : "c" (0);
         } else asm pure nothrow @nogc {
             mov ECX, 0;
             xgetbv;


             reply	other threads:[~2020-12-05 23:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-05 23:47 Iain Buclaw [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-01-30 19:08 Iain Buclaw
2021-01-28 17:31 Iain Buclaw
2021-01-11 11:39 Iain Buclaw
2020-12-22 13:40 Iain Buclaw
2020-12-09  9:50 Iain Buclaw
2020-12-03 22:57 Iain Buclaw

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201205234733.1CE71385DC2E@sourceware.org \
    --to=ibuclaw@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).