xry111 wrote:

I have a C test case:

```c
unsigned long
test (unsigned long x, unsigned long y)
{
  register unsigned long ra asm ("ra");
  asm("" : "+r"(ra));

  unsigned long t = ra;
  asm ("csrxchg %0, %1, 0" : "+r" (x) : "r" (t));

  return x;
}
```

clang-20.1.4 errors out:

```
t.c:8:8: error: must not be $r0 or $r1
    8 |   asm ("csrxchg %0, %1, 0" : "+r" (x) : "r" (t));
      |        ^
<inline asm>:1:16: note: instantiated into assembly here
    1 |         csrxchg $a0, $ra, 0
      |                       ^
1 error generated.
```

And I suppose it should work after this PR and changing the second `"r"` to 
`"q"`.

https://github.com/llvm/llvm-project/pull/141037
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to