[clang] [llvm] RFC: Implementing new mechanism for hard register operands to inline asm as a constraint. (PR #85846)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 9 14:52:14 PST 2025


efriedma-quic wrote:

An example that might be helpful (using x86 asm):

```
int shift(int x, char amt) {
    asm("shll %0, %1" : "+r"(x) : "{cl}i"(amt));
    return x;
}
int a(int x) {
    return shift(x, 1);
}
```

Here, you want one of two choices: either an immediate, or the register "cl".

I can't think of any cases where you'd want to specify both a specific register and a generic register class, though.

https://github.com/llvm/llvm-project/pull/85846


More information about the llvm-commits mailing list