[Bug c/90181] Feature request: provide a way to explicitly select specific named registers in constraints
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90181 Petr Skocik changed: What|Removed |Added CC||pskocik at gmail dot com --- Comment #16 from Petr Skocik --- 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
[Bug c/90181] Feature request: provide a way to explicitly select specific named registers in constraints
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90181 --- Comment #15 from Andrew Pinski --- https://gcc.gnu.org/pipermail/gcc-patches/2024-March/647832.html
[Bug c/90181] Feature request: provide a way to explicitly select specific named registers in constraints
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90181 --- Comment #14 from Segher Boessenkool --- 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.
[Bug c/90181] Feature request: provide a way to explicitly select specific named registers in constraints
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90181 --- Comment #13 from Elliott M --- (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)
[Bug c/90181] Feature request: provide a way to explicitly select specific named registers in constraints
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90181 --- Comment #12 from Andrew Pinski --- (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.
[Bug c/90181] Feature request: provide a way to explicitly select specific named registers in constraints
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90181 --- Comment #11 from Elliott M --- (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...
[Bug c/90181] Feature request: provide a way to explicitly select specific named registers in constraints
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90181 --- Comment #10 from Elliott M --- Eyes must have glazed over when trying to find other reports. 105048 is indeed a duplicate. Another option might be "R" 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?
[Bug c/90181] Feature request: provide a way to explicitly select specific named registers in constraints
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90181 Andrew Pinski changed: What|Removed |Added CC||ehem+gccbugs at m5p dot com --- Comment #9 from Andrew Pinski --- *** Bug 105048 has been marked as a duplicate of this bug. ***
[Bug c/90181] Feature request: provide a way to explicitly select specific named registers in constraints
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90181 --- Comment #8 from Andrew Pinski --- 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.
[Bug c/90181] Feature request: provide a way to explicitly select specific named registers in constraints
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90181 Andrew Pinski changed: What|Removed |Added Component|inline-asm |c Severity|normal |enhancement