Issue 127580
Summary [X86][InlineAsm] Unsupported operand in inline asm
Labels backend:X86, rejects-valid, inline-asm
Assignees
Reporter dtcxzyw
    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
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to