public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/105048] New: [enhancement] Allow specific register constraints
@ 2022-03-24 21:37 ehem+gccbugs at m5p dot com
  2022-03-24 21:38 ` [Bug c/105048] " ehem+gccbugs at m5p dot com
  2022-03-24 21:54 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: ehem+gccbugs at m5p dot com @ 2022-03-24 21:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105048
           Summary: [enhancement] Allow specific register constraints
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: inline-asm
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ehem+gccbugs at m5p dot com
  Target Milestone: ---

Using local register variables to constrain assembly-language inputs and
outputs to particular registers is really ugly.  Better to have explicit syntax
for this.  I would suggesting using "R<register>" for this.

Using "R" conflicts with x86, but x86 effectively already has this since "a",
"b", "c", "d", "S", "D" covers most of the registers used for calling
conventions.  I though also note Clang doesn't appear to have implemented "R"
which suggests this has rarely, if ever, been used. (another letter could be
used on x86, or it might be possible to repurpose)

This is particularly valuable for interfacing with systems using foreign
calling conventions.

The example is how one might interface with a hypervisor on ARM64.  This seems
valuable as the register specification is a feature of the
inline-assembly-language, not a feature of the variable.

This could result in superior output, by avoiding copies.  In particular
`hypercall_inline()` might well end up with 5 extra `mov` instructions (plus a
call and return) which are never optimized out, whereas `hypercall_macro()` is
rather likely to produce a single instruction.

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

* [Bug c/105048] [enhancement] Allow specific register constraints
  2022-03-24 21:37 [Bug c/105048] New: [enhancement] Allow specific register constraints ehem+gccbugs at m5p dot com
@ 2022-03-24 21:38 ` ehem+gccbugs at m5p dot com
  2022-03-24 21:54 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: ehem+gccbugs at m5p dot com @ 2022-03-24 21:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Elliott M <ehem+gccbugs at m5p dot com> ---
Created attachment 52684
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52684&action=edit
Sample of with and without this feature

Hmm, Bugzilla attachment during initial submission failed.

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

* [Bug c/105048] [enhancement] Allow specific register constraints
  2022-03-24 21:37 [Bug c/105048] New: [enhancement] Allow specific register constraints ehem+gccbugs at m5p dot com
  2022-03-24 21:38 ` [Bug c/105048] " ehem+gccbugs at m5p dot com
@ 2022-03-24 21:54 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-03-24 21:54 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 90181.

*** This bug has been marked as a duplicate of bug 90181 ***

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

end of thread, other threads:[~2022-03-24 21:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-24 21:37 [Bug c/105048] New: [enhancement] Allow specific register constraints ehem+gccbugs at m5p dot com
2022-03-24 21:38 ` [Bug c/105048] " ehem+gccbugs at m5p dot com
2022-03-24 21:54 ` pinskia at gcc dot gnu.org

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