<div dir="ltr"><div><font color="#000000" face="arial, FreeSans, Helvetica, sans-serif"><span style="font-size:14px;line-height:22.21875px">Hello.</span></font></div><div><font color="#000000" face="arial, FreeSans, Helvetica, sans-serif"><span style="font-size:14px;line-height:22.21875px"><br>
</span></font></div><div><p style="margin:0px 0px 1em;padding:0px;color:rgb(0,0,0);font-family:arial,FreeSans,Helvetica,sans-serif;font-size:14.44444465637207px;line-height:22.22222328186035px">The long encoding for Thumb2 unconditional branches is broken.<br>
Additionally, there is no range checking for target operands; as such <br>for instructions originating in assembly code, only short Thumb encodings<br>are generated, regardless of the bitsize needed for the offset.</p><p style="margin:0px 0px 1em;padding:0px;color:rgb(0,0,0);font-family:arial,FreeSans,Helvetica,sans-serif;font-size:14.44444465637207px;line-height:22.22222328186035px">
Adding range checking is non trivial due to the representation of Thumb<br>branch instructions. There is no true difference between conditional and<br>unconditional branches in terms of operands and syntax - even unconditional<br>
branches have a predicate which is expected to match that of the IT block<br>they are in. Yet, the encodings and the permitted size of the offset differ.</p><p style="margin:0px 0px 1em;padding:0px;color:rgb(0,0,0);font-family:arial,FreeSans,Helvetica,sans-serif;font-size:14.44444465637207px;line-height:22.22222328186035px">
Due to this, for any mnemonic there are really 4 encodings to choose for.</p><p style="margin:0px 0px 1em;padding:0px;color:rgb(0,0,0);font-family:arial,FreeSans,Helvetica,sans-serif;font-size:14.44444465637207px;line-height:22.22222328186035px">
The problem cannot be handled in the parser alone or by manipulating td files.<br>Because the parser builds first a set of match candidates and then checks them<br>one by one, whatever tablegen-only solution might be found will ultimately be<br>
dependent of the parser's evaluation order. What's worse is that due to the fact<br>that all branches have the same syntax and the same kinds of operands, that <br>order is governed by the lexicographical ordering of the names of operand <br>
classes...</p><p style="margin:0px 0px 1em;padding:0px;color:rgb(0,0,0);font-family:arial,FreeSans,Helvetica,sans-serif;font-size:14.44444465637207px;line-height:22.22222328186035px">To circumvent all this, any necessary disambiguation is added to the instruction<br>
validation pass.</p><p style="margin:0px 0px 1em;padding:0px;color:rgb(0,0,0);font-family:arial,FreeSans,Helvetica,sans-serif;font-size:14.44444465637207px;line-height:22.22222328186035px">Please review the attached patch.</p>
<p style="margin:0px 0px 1em;padding:0px;color:rgb(0,0,0);font-family:arial,FreeSans,Helvetica,sans-serif;font-size:14.44444465637207px;line-height:22.22222328186035px">Thanks,</p><p style="margin:0px 0px 1em;padding:0px;color:rgb(0,0,0);font-family:arial,FreeSans,Helvetica,sans-serif;font-size:14.44444465637207px;line-height:22.22222328186035px">
Mihai</p><div><div><br></div></div></div></div>