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

--- Comment #6 from Andrew Cooper <andrew.cooper3 at citrix dot com> ---
(In reply to David Malcolm from comment #5)
> Minimal reproducer: https://godbolt.org/z/E6EEY1WT6
> 
> Am I right in understanding that:
>     register unsigned long sp asm("rsp");
> is intended as a way to read the %rsp register?

Ultimately, yes.

More generally, this just creates a way to access the specific register.

It is the only way for example to create an asm constraint on e.g. %r8, so the
following is common to see for MSABI:

  register unsigned long param asm ("%r8");

  param = 4;
  asm ("tdcall/whatever"
       : "+r" (param) ...);

(Example here is from Intel's new TDX technology, but the actual asm
instruction isn't important.)

Reply via email to