<div dir="ltr">It should be movw. The segment registers are only 16-bits wide. We used to accept it because the Intel documentation sort of makes it look valid because you can use a 64-bit GPR as the destination, but it doesn't make any sense to use 64-bits when writing to memory. GNU assembler 2.30 feels the same way so it probably doesn't work in gcc either.<div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">~Craig</div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jun 5, 2018 at 8:39 AM Tobias Hahn via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Since clang 6, the following code produces `error: invalid operand for instruction`:<br>
<br>
```c++<br>
void f()<br>
{<br>
  asm("movq %cs, 160(%rsp);");<br>
  asm("movq %fs, 168(%rsp);");<br>
  asm("movq %gs, 176(%rsp);");<br>
}<br>
```<br>
(see <a href="https://godbolt.org/g/CgPBb9" rel="noreferrer" target="_blank">https://godbolt.org/g/CgPBb9</a>)<br>
<br>
Two questions: 1. Is this a bug or a feature? 2. Is this a clang bug/feature or an llvm one (a.k.a what is the right place to report this)?<br>
<br>
(Background: I ran into this while trying to roll clang to a new version in a project containing PLCrashReporter, which uses these instructions while capturing a thread context, see [1]. I'm now trying to figure out if this is a compiler bug or if PLCrashReporter needs to be patched.)<br>
<br>
Thanks!<br>
Tobias<br>
<br>
[1] <a href="https://github.com/plausiblelabs/plcrashreporter/blob/master/Source/PLCrashAsyncThread_current.S#L96" rel="noreferrer" target="_blank">https://github.com/plausiblelabs/plcrashreporter/blob/master/Source/PLCrashAsyncThread_current.S#L96</a><br>
<br>
Ableton AG, Schoenhauser Allee 6-7, 10119 Berlin, Germany<br>
Sitz (Registered Office) Berlin, Amtsgericht Berlin-Charlottenburg, HRB 72838<br>
Vorstand (Management Board): Gerhard Behles, Jan Bohl<br>
Vorsitzender des Aufsichtsrats (Chair of the Supervisory Board): Uwe Struck<br>
<br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>