<div dir="ltr">Pay closer attention to the instruction descriptions on the page you linked above:<div><br></div><div><a id="id4884741" style="color:rgb(0,0,0);font-family:Verdana,Tahoma,Arial,Helvetica,sans-serif;font-size:small;line-height:normal;margin-top:0.4em!important;margin-bottom:0.2em!important"><div id="id4884741_contents"><pre class="synopsis" style="color:rgb(51,51,153);font-family:'Lucida Sans Typewriter','Courier New',Courier,monospace;font-size:0.9em;margin-top:0.8em;margin-bottom:0.2em;margin-left:0.5em"><code style="font-family:'Lucida Sans Typewriter','Courier New',Courier,monospace;font-size:11.6999998092651px">LDR{<em class="replaceable"><code style="color:inherit;font-family:inherit;font-size:11.6999998092651px">type</code></em>}{<em class="replaceable"><code style="color:inherit;font-family:inherit;font-size:11.6999998092651px">cond</code></em>} <em class="replaceable"><code style="color:inherit;font-family:inherit;font-size:11.6999998092651px">Rt</code></em>, [<em class="replaceable"><code style="color:inherit;font-family:inherit;font-size:11.6999998092651px">Rn</code></em> {, #<em class="replaceable"><code style="color:inherit;font-family:inherit;font-size:11.6999998092651px">offset</code></em>}]        ; immediate offset
</code></pre><code style="color:rgb(51,51,153);font-family:'Lucida Sans Typewriter','Courier New',Courier,monospace;font-size:0.9em"><pre class="synopsis" style="font-family:'Lucida Sans Typewriter','Courier New',Courier,monospace;font-size:11.6999998092651px;margin-top:0.8em;margin-bottom:0.2em;margin-left:0.5em"><em class="replaceable"><code style="color:inherit;font-family:inherit;font-size:11.6999998092651px"></code></em><code style="font-family:'Lucida Sans Typewriter','Courier New',Courier,monospace;font-size:11.6999998092651px">LDR{<em class="replaceable"><code style="color:inherit;font-family:inherit;font-size:11.6999998092651px">type</code></em>}{<em class="replaceable"><code style="color:inherit;font-family:inherit;font-size:11.6999998092651px">cond</code></em>} <em class="replaceable"><code style="color:inherit;font-family:inherit;font-size:11.6999998092651px">Rt</code></em>, [<em class="replaceable"><code style="color:inherit;font-family:inherit;font-size:11.6999998092651px">Rn</code></em>, #<em class="replaceable"><code style="color:inherit;font-family:inherit;font-size:11.6999998092651px">offset</code></em>]!          ; pre-indexed</code></pre></code></div></a></div><div><br></div><div>The pre-indexed form is always specified with an offset, and<b> follows the brackets with an exclamation mark</b>. You have an immediate offset load, for which Rt==Rn is permitted.</div><div><br></div><div>A possible reason for an illegal instruction exception is that you have generated some ARM code and tried to execute it as Thumb or vise-versa.</div></div><br><div class="gmail_quote"><div dir="ltr">On Sun, Sep 6, 2015 at 5:40 AM Erik de Castro Lopo via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-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">Hi all,<br>
<br>
I do a little work on the Glasgow Haskell Compiler (GHC) which uses<br>
LLVM for the backend when compiling for Arm and some other targets.<br>
<br>
The reason I am posting to this list is that a GHC compiled program<br>
(using the LLVM backend) is getting an illegal instruction exception<br>
on the this instruction:<br>
<br>
     ldr     r0, [r0]<br>
<br>
According to the Arm archtecture manual:<br>
<br>
    <a href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0489i/CIHGJHED.html" rel="noreferrer" target="_blank">http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0489i/CIHGJHED.html</a><br>
<br>
this is pre-indexed load instruction of the form:<br>
<br>
    LDR{type}{cond} Rt, [Rn, #offset]<br>
<br>
but is illegal because the pre-indexed form of this instruction does<br>
not allow 'Rt' and 'Rn' to be the same register.<br>
<br>
The above all makes sense, but I find it a little hard to believe that<br>
I am the first person to find this.<br>
<br>
I'm using llvm-3.6.2 from a Debian package.<br>
<br>
Clues? Comments?<br>
<br>
Cheers,<br>
Erik<br>
--<br>
----------------------------------------------------------------------<br>
Erik de Castro Lopo<br>
<a href="http://www.mega-nerd.com/" rel="noreferrer" target="_blank">http://www.mega-nerd.com/</a><br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>