public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "witold.baryluk+gcc at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug d/105413] New: gdc extended assembler cannot constraints r8 - r15
Date: Wed, 27 Apr 2022 23:13:41 +0000	[thread overview]
Message-ID: <bug-105413-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105413

            Bug ID: 105413
           Summary: gdc extended assembler cannot constraints r8 - r15
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: d
          Assignee: ibuclaw at gdcproject dot org
          Reporter: witold.baryluk+gcc at gmail dot com
  Target Milestone: ---

gcc in C does not support directly register constraints for x86_64 registers r8
- r15.

In C this can be done however using local register variables and asm
attributes.

https://gcc.gnu.org/onlinedocs/gcc/Local-Register-Variables.html

There is no way to use this in GDC extended assembler.

version (linux) {
version (GNU) {

enum SYSCALL {
  OPENAT = 56,
}

@nogc:
nothrow:

size_t syscall(SYSCALL ident)(size_t arg1, size_t arg2, size_t arg3, size_t
arg4) {
    version (X86_64) {
       asm @nogc nothrow {
         "syscall"
         // output:
         : "=a" (arg1)
         // inputs:
         : "a" (ident),  // rax - syscall number
           "D" (arg1),   // rdi - arg1
           "S" (arg2),   // rsi - arg2
           "d" (arg3),   // rdx - arg3
           "r10" (arg4),  // r10 - arg4
           "m"( *cast(ubyte*)arg1)   // "dummy" input instead of full memory
clobber
         // clobers
         : "c", "r11";  // Clobers rax, and rcx and r11.
       }
       return arg1;
   } else {
       static assert(false, "This platform/architecture is not supported when
using GDC compiler");
   } 
}

}

private int openatdummy() @nogc nothrow {
  return cast(int)syscall!(SYSCALL.OPENAT)(0, 0, 0, 0);
}

}



myio.d: In function ‘syscall’:
myio.d:232:10: error: matching constraint references invalid operand number
  232 |          ;



https://godbolt.org/z/xGzxa6orc

             reply	other threads:[~2022-04-27 23:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-27 23:13 witold.baryluk+gcc at gmail dot com [this message]
2022-06-24 18:55 ` [Bug d/105413] " cvs-commit at gcc dot gnu.org
2022-06-24 19:19 ` ibuclaw at gdcproject dot org
2022-10-08 20:08 ` witold.baryluk+gcc at gmail dot com

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=bug-105413-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).