public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug d/105413] New: gdc extended assembler cannot constraints r8 - r15
@ 2022-04-27 23:13 witold.baryluk+gcc at gmail dot com
  2022-06-24 18:55 ` [Bug d/105413] " cvs-commit at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: witold.baryluk+gcc at gmail dot com @ 2022-04-27 23:13 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-08 20:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-27 23:13 [Bug d/105413] New: gdc extended assembler cannot constraints r8 - r15 witold.baryluk+gcc at gmail dot com
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

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).