public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/90181] Feature request: provide a way to explicitly select specific named registers in constraints
       [not found] <bug-90181-4@http.gcc.gnu.org/bugzilla/>
@ 2021-09-14 19:43 ` pinskia at gcc dot gnu.org
  2021-09-14 19:44 ` pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-14 19:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|inline-asm                  |c
           Severity|normal                      |enhancement

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

* [Bug c/90181] Feature request: provide a way to explicitly select specific named registers in constraints
       [not found] <bug-90181-4@http.gcc.gnu.org/bugzilla/>
  2021-09-14 19:43 ` [Bug c/90181] Feature request: provide a way to explicitly select specific named registers in constraints pinskia at gcc dot gnu.org
@ 2021-09-14 19:44 ` pinskia at gcc dot gnu.org
  2022-03-24 21:54 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-14 19:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I thought there was another bug which was asking for something similar that I
did not link here yet.  It had a reference to a syntax something like {"r1"}. 
But I can't find it right now.

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

* [Bug c/90181] Feature request: provide a way to explicitly select specific named registers in constraints
       [not found] <bug-90181-4@http.gcc.gnu.org/bugzilla/>
  2021-09-14 19:43 ` [Bug c/90181] Feature request: provide a way to explicitly select specific named registers in constraints pinskia at gcc dot gnu.org
  2021-09-14 19:44 ` pinskia at gcc dot gnu.org
@ 2022-03-24 21:54 ` pinskia at gcc dot gnu.org
  2022-03-24 22:18 ` ehem+gccbugs at m5p dot com
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 10+ 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=90181

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ehem+gccbugs at m5p dot com

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 105048 has been marked as a duplicate of this bug. ***

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

* [Bug c/90181] Feature request: provide a way to explicitly select specific named registers in constraints
       [not found] <bug-90181-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2022-03-24 21:54 ` pinskia at gcc dot gnu.org
@ 2022-03-24 22:18 ` ehem+gccbugs at m5p dot com
  2022-04-23  4:36 ` ehem+gccbugs at m5p dot com
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: ehem+gccbugs at m5p dot com @ 2022-03-24 22:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Elliott M <ehem+gccbugs at m5p dot com> ---
Eyes must have glazed over when trying to find other reports.  105048 is indeed
a duplicate.

Another option might be "R<register_name>" for architectures which haven't
already grabbed "R" for something else.  I notice Clang though doesn't appear
to have "R" implemented which seems to suggest actual uses of the current
definition of "R" are rare.

There are multiple calls for this feature, any chance of an implementation?

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

* [Bug c/90181] Feature request: provide a way to explicitly select specific named registers in constraints
       [not found] <bug-90181-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2022-03-24 22:18 ` ehem+gccbugs at m5p dot com
@ 2022-04-23  4:36 ` ehem+gccbugs at m5p dot com
  2022-04-23  4:58 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: ehem+gccbugs at m5p dot com @ 2022-04-23  4:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Elliott M <ehem+gccbugs at m5p dot com> ---
(In reply to Andreas Schwab from comment #1)
> x86 doesn't support this either.  It just happens to have a few register
> classes that consist of a single register, but only because of ISA
> constraints.

That is a *gross* mischaracterization.  Constraint list for x86 includes: 'a',
'b', 'c', 'd', 'S', 'D'.  Indeed, that doesn't include bp or sp, but does
include *all* the registers which get used for interesting purposes
(register-passing calling conventions).

Perhaps people writing GCC haven't felt pressure to implement this since
they're primarily dealing with x86 and x86 effectively already has this?

I'm tempted to propose this to people involved with Clang, then come back here
and suggest GCC should copy the feature...

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

* [Bug c/90181] Feature request: provide a way to explicitly select specific named registers in constraints
       [not found] <bug-90181-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2022-04-23  4:36 ` ehem+gccbugs at m5p dot com
@ 2022-04-23  4:58 ` pinskia at gcc dot gnu.org
  2022-04-24  1:53 ` ehem+gccbugs at m5p dot com
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-04-23  4:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Elliott M from comment #11)
> (In reply to Andreas Schwab from comment #1)
> > x86 doesn't support this either.  It just happens to have a few register
> > classes that consist of a single register, but only because of ISA
> > constraints.
> 
> That is a *gross* mischaracterization.  Constraint list for x86 includes:
> 'a', 'b', 'c', 'd', 'S', 'D'.  Indeed, that doesn't include bp or sp, but
> does include *all* the registers which get used for interesting purposes
> (register-passing calling conventions).

Actually this is NOT a gross mischaracterization of GCC's x86 inline-asm and
not understanding that is misrepresenting the history of GCC's inline-asm and
how it just exposes internal details of GCC to the user. GCC's x86 constraints
are exactly this way because of instructions requirements (ISA constraints) and
all of these constraints are used internally too.

It just happens that x86_64 register calling convention matches up with the
instruction requirements.

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

* [Bug c/90181] Feature request: provide a way to explicitly select specific named registers in constraints
       [not found] <bug-90181-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2022-04-23  4:58 ` pinskia at gcc dot gnu.org
@ 2022-04-24  1:53 ` ehem+gccbugs at m5p dot com
  2022-04-24 14:34 ` segher at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 10+ messages in thread
From: ehem+gccbugs at m5p dot com @ 2022-04-24  1:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Elliott M <ehem+gccbugs at m5p dot com> ---
(In reply to Andrew Pinski from comment #12)
> Actually this is NOT a gross mischaracterization of GCC's x86 inline-asm and
Making the 6 registers most likely to be needed on x86 available as
machine-specific constraints makes the spirit of this request available for
x86.  It doesn't /quite/ fully implement the request, but does cover 95% of use
cases, for x86.  Whereas for modern architectures it is unavailable.

> not understanding that is misrepresenting the history of GCC's inline-asm
> and how it just exposes internal details of GCC to the user. GCC's x86
> constraints are exactly this way because of instructions requirements (ISA
> constraints) and all of these constraints are used internally too.
The documented limitations of GCC's extended inline assembly language were most
readily explained by it exposing GCC's internals.  As such I had already
guessed this was the case.  Unfortunately these limitations makes it extremely
painful to use for actual benefit.

(I see why most cases use full assembly language .S files, instead of inline
assembly language)

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

* [Bug c/90181] Feature request: provide a way to explicitly select specific named registers in constraints
       [not found] <bug-90181-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2022-04-24  1:53 ` ehem+gccbugs at m5p dot com
@ 2022-04-24 14:34 ` segher at gcc dot gnu.org
  2024-03-30 22:06 ` pinskia at gcc dot gnu.org
  2024-04-17 12:12 ` pskocik at gmail dot com
  9 siblings, 0 replies; 10+ messages in thread
From: segher at gcc dot gnu.org @ 2022-04-24 14:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Segher Boessenkool <segher at gcc dot gnu.org> ---
It is *impossible* to have the stack registers as inputs to an inline asm, and
reliably generate correct code for it that does what the writer of that code
expected: loading up the operands to the asm may modify the stack registers, so
which of the values does the asm expect, the old or the new value?

It is *impossible* to have stack registers as output (or scratch) from an
inline asm, always.  This violates basic requirements.

"Stack registers" here are those used by the ABI to address the stack, which
are required to be valid at all times, for example.  Stack pointer, (hard)
frame pointer, that kind of thing.  Most archs have register classes that
include such registers, like x86's "R", but crucially always other registers
are allowed there as well.

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

* [Bug c/90181] Feature request: provide a way to explicitly select specific named registers in constraints
       [not found] <bug-90181-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2022-04-24 14:34 ` segher at gcc dot gnu.org
@ 2024-03-30 22:06 ` pinskia at gcc dot gnu.org
  2024-04-17 12:12 ` pskocik at gmail dot com
  9 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-30 22:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
https://gcc.gnu.org/pipermail/gcc-patches/2024-March/647832.html

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

* [Bug c/90181] Feature request: provide a way to explicitly select specific named registers in constraints
       [not found] <bug-90181-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2024-03-30 22:06 ` pinskia at gcc dot gnu.org
@ 2024-04-17 12:12 ` pskocik at gmail dot com
  9 siblings, 0 replies; 10+ messages in thread
From: pskocik at gmail dot com @ 2024-04-17 12:12 UTC (permalink / raw)
  To: gcc-bugs

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

Petr Skocik <pskocik at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pskocik at gmail dot com

--- Comment #16 from Petr Skocik <pskocik at gmail dot com> ---
The current way of loading stuff into regs that don't have a specific
constraint for them also breaks on gcc (but not on clang) if the variable is
marked const.
https://godbolt.org/z/1PvYsrqG9

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

end of thread, other threads:[~2024-04-17 12:13 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-90181-4@http.gcc.gnu.org/bugzilla/>
2021-09-14 19:43 ` [Bug c/90181] Feature request: provide a way to explicitly select specific named registers in constraints pinskia at gcc dot gnu.org
2021-09-14 19:44 ` pinskia at gcc dot gnu.org
2022-03-24 21:54 ` pinskia at gcc dot gnu.org
2022-03-24 22:18 ` ehem+gccbugs at m5p dot com
2022-04-23  4:36 ` ehem+gccbugs at m5p dot com
2022-04-23  4:58 ` pinskia at gcc dot gnu.org
2022-04-24  1:53 ` ehem+gccbugs at m5p dot com
2022-04-24 14:34 ` segher at gcc dot gnu.org
2024-03-30 22:06 ` pinskia at gcc dot gnu.org
2024-04-17 12:12 ` pskocik 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).