Re: Declaring x86_64 registers as input in gcc inline assembler



"Johannes Singler" <spamtrap@xxxxxxxxxx> wrote in message news:e0b988$b3b$1@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
the gcc inline assembler allows to declare input and output registers
with its extended syntax. Since I want to bind a variable to a specific
register, I have to use a constraint like "a", "b", "S" and so on. But
how can I constrain it to one of the new registers r8-r15. Is there any
new letter for those?

I can't find anything in the documentation* that mentions the possibility. This rather makes sense, since the main reason for register constraints is for instructions that implicitly use particular registers, and no instruction implicitly uses any of the high ones. You can get a low register with the "R" constraint, but there doesn't seem to be an opposite constraint.

If you don't need a particular low register, just use constraint "r" and let the compiler figure it out.

* http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Machine-Constraints.html#Machine-Constraints

S

--
Stephen Sprunk "Stupid people surround themselves with smart
CCIE #3723 people. Smart people surround themselves with
K5SSS smart people who disagree with them." --Aaron Sorkin

.



Relevant Pages

  • Re: assembly in future C standard
    ... assembly statements to the compiler. ... Actually, it is a pretty straightforward system, using a constraint ... model and gcc's internal "register transfer language" as the basic ... What you stick in a gcc "asm" statement is ...
    (comp.lang.c)
  • Re: Is this an error or undefined behaviour?
    ... a constraint violation, and the compiler is allowed to reject the ... The next example was more like what I expected: 6.5.3.2p1 - if an implementation chooses to translate and execute code which attempts to take the address of a variable declared with the 'register' keyword, I believe it is still bound by 6.5.3.2p1, which would essentially mean that it cannot place such a variable in a register. ... However, if violating a constraint always leaves the behavior undefined behavior, I think it would be clearer to say so explicitly. ...
    (comp.lang.c)
  • Re: [PATCH] [POWERPC] Improve (in|out)_beXX() asm code
    ... gcc doesn't have a constraint for an indexed memory ... It's the _le versions that have a problem, since we can't get gcc to just use ... the register indexed mode. ...
    (Linux-Kernel)
  • Re: [PATCH 1/1] X86: use explicit register name for get/put_user
    ... the input to an explicit register makes it cleaner in my eyes. ... I mean it doesn't refer only to the constraint but also to a concrete ... documentation), if one does ... output constraint of incompatible type! ...
    (Linux-Kernel)
  • Re: Xilinx timing constraint problem
    ... I place a timing constraint on a pair of registers either side of some logic. ... After I run the ISE 6.3 toolchain, I look at the actual delays for the constraint in Timing Analyzer. ... The constraint seems to have been applied from the source register which I specified as my destination, to a register or pad elsewhere in the design. ...
    (comp.arch.fpga)