<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/127580>127580</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[X86][InlineAsm] Unsupported operand in inline asm
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:X86,
rejects-valid,
inline-asm
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dtcxzyw
</td>
</tr>
</table>
<pre>
Reproducer from nuttx: https://godbolt.org/z/eh9z5W4Kr
https://github.com/apache/nuttx/blob/954081cdd87c7b58bd2da2134c7f2eb112eef67f/arch/x86_64/include/irq.h#L142-L150
```
bool up_interrupt_context(void)
{
bool flag;
__asm__ volatile("movb %%gs:(%c1), %0"
: "=qm" (flag)
: "i" (7));
return flag;
}
```
GCC output:
```
up_interrupt_context():
movb %gs:(7), al
ret
```
Clang output:
```
<source>:4:20: error: invalid operand for instruction
4 | __asm__ volatile("movb %%gs:(%c1), %0"
| ^
<inline asm>:1:16: note: instantiated into assembly here
1 | movb %gs:(7), -1(%rbp)
| ^~~~~~~~
1 error generated.
Compiler returned: 1
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyslM2O47YShZ-mvCFsiCVTPwst1Pbo4iKzChAkO4MSSzYTitSQlNPdizx7QMmd6cygZxXBhg2xeM5Xh0TJEPTVEjUgnkCcd3KJN-cbFYfn15c_d71TL83PNHunloE8G72bmF1ifIa8ZbcY5wB5C9gBdlenemfiwfkrYPcK2NGtfhW_Hn_ykLXf1Op4W_rD4CbATs5yuBFgtwlj1xvXA3a1OGYVH5SqyqHsRdUrVBJ5fhzKEannHInGohyThB9ugN1zVVyKI2Cn7WAWlTS1_3K4Aeaf-RH3n7nIIGuhyB6frO2dM2yZL9pG8n6Z42VwNtJzBKzuTivAOu0onyBrGVurRyOvkG8vLhcZpsuF3Z2RURsCrABxcveeAQpAcd2argDFwJMYntJKBoirwHdPCjYt5ucvEyAywGo1XDk-rteP2nL1qN_4PMXF23fIUJ6_SQCy9n-nE3NLnJeYYP-9_EE2q0f7Dumt57eGy0ez0qQiT_F725OR9vqhMeSn4BY_EOSfIG-PkLeYpW7Je-fTH23v0mjF3ExeWsVG55m2IfpliNrZB9yRQXli_9FRJSkQnzY8bY22xGSYNkSevkUisy7SRhiitFHLSIppGx2TIdDUmxd2I09Jlj_wfpzinm9gvp_f34QHzl_bA1nLt3TYlSz55HpIObtp1ob84zaQSmj8fdw71eSqzmu5o4aXeV0VvBbl7tZUvahGKoZRKs5xJBroSIVS4zj0gpf1TjeYociQV1khal4eeqQ8HzhVqhoRSwHHjCapzcGY-5SGw06HsFDDsRRVtjOyJxPW8YPYy-EPsgnvt6pIseMJED39TkMM-_Ww_3m7hb9P4SOm0eWb5LDvl2uAY2Z0iOGrZ9TRrEMuCYsziKf_r_vbMIE4s19sWObZ-XRMb7dJW_b1gHeLN80PZlgyevzsZ-8ScBo-qdMA2D2avTf4dwAAAP__XOCQMA">