<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/97673>97673</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[assemble] clang doesn't accept the operand %1
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
vfdff
</td>
</tr>
</table>
<pre>
* test: https://gcc.godbolt.org/z/e1c1qMTTM
```
void _mcount(uint64_t caller_ra){
uint64_t rbp=0;
uint64_t rsp=0;
__asm__ __volatile__("mov x0, fp\n"
"mov %1, sp \n"
:"=g"(rbp),"=g"(rsp)
:);
printf("rbp = 0x%llx , rsp=0x%llx\n" , rbp , rsp);
}
```
I except the register value **sp** will be saved in local variable **rsp**. But it is only accept by gcc
* error reported by clang:
```
<source>:9:27: error: invalid operand for instruction
9 | "mov %1, sp \n"
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVE2v4yYU_TXXm6uJ8MUf8cILv6SRupjd7C2MsUNFjAvYfa-_vsJ2Mv14o04UBQLnHA7nAsJ7PU5K1ZC_QX5NxBLu1tXr0A9D0tn-owZqMCgfgDd4D2H2wBugG9BtlPI02r6zJpysG4FufwLdVCrT379--_YV2BVYAwU7vtvf1eoe24e0yxSAzoueQpG1AaUwRrnWCaAKyreDy6oXwHUz8CsD_tmc_89c2wr_aFts29UaEbRRbQt0BqKHXfGdAV1wmCG_TEC0s_BHn4MElKeR5mf8SV4MioBfx9jQOW6BKqDLP0d9HH1SdsWNWQF_w9eGXp3Z6SkM-15cNyPwK7J3oNyYd4z-jjSOocPqPhPhB2KTP0TL66e12n9_RfUu1Rww3BU6NWoflMNVmEUhUAPURLXY4h_aGOwUerGqHvWExkphcBVOi8484e6JP-HbElAH1B7tZD5QyG2h7gNHKf_uIYor56xDp2brguojSBoxjTGqT83zi7eLkwr4L8CbCnhDZTzDm07s6GkVRvdoZ-XE1ONgHerJB7fIoO30vbgVQnn5YZX_73i8fCV9zfuKVyJRdVoSY0XOzmlyr5XIUt4VVLFUZcM5L6RIs5SKc0Z5nw55omtilLGSZYznKaWnjDp5LnnfZx0VfSUgY-ohtDkZsz7iXUy094uqq7IoeWJEp4zfbjjRHhpRvOyujvgv3TJ6yJjRPvjvCkEHsz0Lwnv16IyC_LpHjr1VfgIqw7Ni8Wg8Y4w5JIsz9b8eCx3uS3eS9gF0i4sczZfZ2d-UDEC3zbMHuu2215r-CgAA__-i0Ujq">