From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3E0623858D28; Wed, 27 Apr 2022 23:13:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3E0623858D28 From: "witold.baryluk+gcc at gmail dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: d X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: witold.baryluk+gcc at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ibuclaw at gdcproject dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2022 23:13:41 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105413 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 register= s 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 =3D 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: : "=3Da" (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 wh= en using GDC compiler"); }=20 } } private int openatdummy() @nogc nothrow { return cast(int)syscall!(SYSCALL.OPENAT)(0, 0, 0, 0); } } myio.d: In function =E2=80=98syscall=E2=80=99: myio.d:232:10: error: matching constraint references invalid operand number 232 | ; https://godbolt.org/z/xGzxa6orc=