<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:Monaco;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Menlo;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
span.apple-tab-span
        {mso-style-name:apple-tab-span;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi John,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The approach I took here was to deal with the intrinsics once they’re generated.  The hardware loop code tries to evaluate the iteration count, and when it fails to do so, it skips the loop.  The complication with unsigned overflow as a
 loop exit condition is that it makes calculating of the iteration count harder, and the current code for hardware loop doesn’t handle it.  It should be possible to expand it, but it would be a non-trivial amount of work.  Instead, I decided to rewrite the
 simple cases of unsigned add/sub, where the overflow condition can be rewritten in a way that is currently recognized.<o:p></o:p></p>
<p class="MsoNormal">Varying increments are not translatable into a hardware loop, but increments that are not 1 are, as long as we can calculate the iteration count (the hardware loop instruction takes a register containing the iteration count as an operand). 
 My guess is that if there was a loop with a non-unit increment, whose exit condition was an unsigned overflow, that loop would not have been handled by the hardware loop generation to begin with, so only dealing with +/-1 should be sufficient.  In the long
 term improving the hardware loop generation would be a better approach, but it’s more work.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">-- </span>
<span style="font-size:9.0pt;font-family:Consolas"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:8.0pt;font-family:Consolas">Krzysztof Parzyszek 
<a href="mailto:kparzysz@quicinc.com"><span style="color:#0563C1">kparzysz@quicinc.com</span></a>   LLVM compiler development<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Joan Lluch <joan.lluch@icloud.com> <br>
<b>Sent:</b> Tuesday, July 2, 2019 8:45 AM<br>
<b>To:</b> Krzysztof Parzyszek <kparzysz@quicinc.com><br>
<b>Cc:</b> llvm-dev@lists.llvm.org; Sanjay Patel <spatel@rotateright.com><br>
<b>Subject:</b> [EXT] Re: [llvm-dev] [hexagon][PowerPC] code regression (sub-optimal code) on LLVM 9 when generating hardware loops, and the "llvm.uadd" intrinsic.<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hi Krzysztof,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thank you very much for such a quick reaction. This is very much appreciated.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I have pulled your code from the main LLVM repo and found that it works fine!. However, after looking at it I have a question about it. My understanding is that your code only replaces uaddo, usubo with ‘1’ as the second operand. This certainly
 solves the hardware loop problem and I assume it’s enough, as there’s no possible loops with scalable increments?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I also want to mention that based on the reply I received from Sanjay, I also tried to override ‘shouldFormOverflowOp’ to always return false. This also solves the issue, but of course it prevents the ‘.with.overflow’ intrinsics to be generated
 at all. My understanding is that this fully mimics LLVM 7.0 behaviour, but I do not have the required knowledge on Hexagon to give an opinion about whether this is useful. I’m just posting this as a matter of information<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thanks again!<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">John<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">On 1 Jul 2019, at 17:51, Krzysztof Parzyszek <<a href="mailto:kparzysz@quicinc.com">kparzysz@quicinc.com</a>> wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">The Hexagon part is fixed in r364790.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:Consolas">--<span class="apple-converted-space"> </span></span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:8.0pt;font-family:Consolas">Krzysztof Parzyszek <span class="apple-converted-space"> </span><a href="mailto:kparzysz@quicinc.com"><span style="color:#0563C1">kparzysz@quicinc.com</span></a>   LLVM compiler development</span><o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<div>
<p class="MsoNormal"><b>From:</b><span class="apple-converted-space"> </span>llvm-dev <<a href="mailto:llvm-dev-bounces@lists.llvm.org">llvm-dev-bounces@lists.llvm.org</a>><span class="apple-converted-space"> </span><b>On Behalf Of<span class="apple-converted-space"> </span></b>Joan
 Lluch via llvm-dev<br>
<b>Sent:</b><span class="apple-converted-space"> </span>Sunday, June 30, 2019 2:04 PM<br>
<b>To:</b><span class="apple-converted-space"> </span>llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>><br>
<b>Subject:</b><span class="apple-converted-space"> </span>[EXT] [llvm-dev] [hexagon][PowerPC] code regression (sub-optimal code) on LLVM 9 when generating hardware loops, and the "llvm.uadd" intrinsic.<o:p></o:p></p>
</div>
</div>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Hi All,<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">The following code :<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif;color:#BA2DA2">void</span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">hexagon2(<span class="apple-converted-space"> </span><span style="color:#BA2DA2">int</span><span class="apple-converted-space"> </span>*a,<span class="apple-converted-space"> </span><span style="color:#BA2DA2">int</span><span class="apple-converted-space"> </span>*res
 )</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif">{</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif"> <span class="apple-converted-space"> </span><span style="color:#BA2DA2">int</span><span class="apple-converted-space"> </span>i =<span class="apple-converted-space"> </span><span style="color:#272AD8">100</span>; </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif"> <span class="apple-converted-space"> </span><span style="color:#BA2DA2">while</span><span class="apple-converted-space"> </span>( i-- ) {</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif">    *res++ = *a++;</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif">  }</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif">}</span><o:p></o:p></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">gets compiled as a sub-optimal Software loop on LLVM 9.0 instead of a Hardware loop, whereas it was compiled as a Hardware Loop in LLVM 7.0. <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">This is the final assembly code generated by LLVM 9.0 :<o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">.text</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">.file<span class="apple-tab-span">               </span><span class="apple-converted-space"> </span><span style="color:#D12F1B">"main.c"</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">.globl<span class="apple-tab-span">           </span><span class="apple-converted-space"> </span>hexagon2 
              <span class="apple-converted-space"> </span><span style="color:#008400">// -- Begin function hexagon2</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">.p2align<span class="apple-tab-span">     </span><span class="apple-converted-space"> </span><span style="color:#272AD8">2</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">.type<span class="apple-tab-span">            </span><span class="apple-converted-space"> </span>hexagon2,@function</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif">hexagon2:                              <span class="apple-converted-space"> </span><span style="color:#008400">// @hexagon2</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif;color:#008400">// %bb.0:                               // %entry.old</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">{</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">p0
 = cmp.gtu(r0,r1); if (p0.new) jump:nt .LBB0_<span style="color:#272AD8">5</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">r2
 = r0</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">allocframe(<span style="color:#008400">#0)</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">}
                              <span class="apple-converted-space"> </span><span style="color:#008400">// encoding: [A,0x41'A',A,0x15'A',0x00,0x3c,0x02,0x70]</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                       <span class="apple-converted-space"> </span><span style="color:#008400">//   fixup A - offset: 0, value: .LBB0_5, kind:
 fixup_Hexagon_B9_PCREL</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif;color:#008400">// %bb.1:                               // %entry.old</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">{</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">r0
 = sub(r1,r0)</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">}
                              <span class="apple-converted-space"> </span><span style="color:#008400">// encoding: [0x00,0xc1,0x20,0xf3]</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">{</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">if
 (p0.new) jump:nt .LBB0_<span style="color:#272AD8">5</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">p0
 = cmp.gt(r0,<span style="color:#008400">#399)</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">}
                              <span class="apple-converted-space"> </span><span style="color:#008400">// encoding: [A,0x48'A',A,0x5c'A',0xe0,0xf1,0x40,0x75]</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                       <span class="apple-converted-space"> </span><span style="color:#008400">//   fixup A - offset: 0, value: .LBB0_5, kind:
 fixup_Hexagon_B15_PCREL</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif;color:#008400">// %bb.2:</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">{</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">r0
 =<span class="apple-converted-space"> </span><span style="color:#008400">#-100</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">}
                              <span class="apple-converted-space"> </span><span style="color:#008400">// encoding: [0x80,0xf3,0xdf,0x78]</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif">.LBB0_<span style="color:#272AD8">3</span>:                               <span class="apple-converted-space"> </span><span style="color:#008400">// %while.body</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                       <span class="apple-converted-space"> </span><span style="color:#008400">// =>This Inner Loop Header: Depth=1</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">{</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">r3
 = add(r0,<span style="color:#008400">#1)</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">r4
 = memw(r2++<span style="color:#008400">#4)</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">memw(r1++<span style="color:#008400">#4)
 = r4.new</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">}
                              <span class="apple-converted-space"> </span><span style="color:#008400">// encoding: [0x23,0x40,0x00,0xb0,0x24,0x40,0x82,0x9b,0x08,0xd2,0xa1,0xab]</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">{</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">p0
 = cmp.gtu(r0,r3); if (!p0.new) jump:t .LBB0_<span style="color:#272AD8">3</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">r0
 = r3</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">}
                              <span class="apple-converted-space"> </span><span style="color:#008400">// encoding: [A,0x63'A',0x40'A',0x15'A',0x00,0xc0,0x63,0x70]</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                       <span class="apple-converted-space"> </span><span style="color:#008400">//   fixup A - offset: 0, value: .LBB0_3, kind:
 fixup_Hexagon_B9_PCREL</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif;color:#008400">// %bb.4:                               // %while.end</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">{</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">r31:<span style="color:#272AD8">30</span><span class="apple-converted-space"> </span>=
 dealloc_return(r30):raw</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">}
                              <span class="apple-converted-space"> </span><span style="color:#008400">// encoding: [0x1e,0xc0,0x1e,0x96]</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif">.LBB0_<span style="color:#272AD8">5</span>:                               <span class="apple-converted-space"> </span><span style="color:#008400">// %while.body.rtli</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">{</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">call
 memmove</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">r1:<span style="color:#272AD8">0</span><span class="apple-converted-space"> </span>=
 combine(r2,r1)</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">r2
 =<span class="apple-converted-space"> </span><span style="color:#008400">#400</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">}
                              <span class="apple-converted-space"> </span><span style="color:#008400">// encoding: [A,0x40'A',A,0x5a'A',0x00,0x41,0x02,0xf5,0x02,0xf2,0x00,0x78]</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                       <span class="apple-converted-space"> </span><span style="color:#008400">//   fixup A - offset: 0, value: memmove, kind:
 fixup_Hexagon_B22_PCREL</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">{</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">r31:<span style="color:#272AD8">30</span><span class="apple-converted-space"> </span>=
 dealloc_return(r30):raw</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">}
                              <span class="apple-converted-space"> </span><span style="color:#008400">// encoding: [0x1e,0xc0,0x1e,0x96]</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif">.Lfunc_end0:</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">.size<span class="apple-tab-span">             </span><span class="apple-converted-space"> </span>hexagon2,
 .Lfunc_end0-hexagon2</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                       <span class="apple-converted-space"> </span><span style="color:#008400">// -- End function</span></span><o:p></o:p></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">This is the assembly code generated by LLVM 7.0 :</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">.text</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">.file<span class="apple-tab-span">               </span><span class="apple-converted-space"> </span><span style="color:#D12F1B">"main.c"</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">.globl<span class="apple-tab-span">           </span><span class="apple-converted-space"> </span>hexagon2 
              <span class="apple-converted-space"> </span><span style="color:#008400">// -- Begin function hexagon2</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">.p2align<span class="apple-tab-span">     </span><span class="apple-converted-space"> </span><span style="color:#272AD8">2</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">.type<span class="apple-tab-span">            </span><span class="apple-converted-space"> </span>hexagon2,@function</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif">hexagon2:                              <span class="apple-converted-space"> </span><span style="color:#008400">// @hexagon2</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif;color:#008400">// %bb.0:                               // %entry.old</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">{</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">p0
 = cmp.gtu(r0,r1); if (p0.new) jump:nt .LBB0_<span style="color:#272AD8">5</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">r2
 = r0</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">allocframe(<span style="color:#008400">#0)</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">}
                              <span class="apple-converted-space"> </span><span style="color:#008400">// encoding: [A,0x41'A',A,0x15'A',0x00,0x3c,0x02,0x70]</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                       <span class="apple-converted-space"> </span><span style="color:#008400">//   fixup A - offset: 0, value: .LBB0_5, kind:
 fixup_Hexagon_B9_PCREL</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif;color:#008400">// %bb.1:                               // %entry.old</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">{</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">r0
 = sub(r1,r0)</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">}
                              <span class="apple-converted-space"> </span><span style="color:#008400">// encoding: [0x00,0xc1,0x20,0xf3]</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">{</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">if
 (p0.new) jump:nt .LBB0_<span style="color:#272AD8">5</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">p0
 = cmp.gt(r0,<span style="color:#008400">#399)</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">}
                              <span class="apple-converted-space"> </span><span style="color:#008400">// encoding: [A,0x48'A',A,0x5c'A',0xe0,0xf1,0x40,0x75]</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                       <span class="apple-converted-space"> </span><span style="color:#008400">//   fixup A - offset: 0, value: .LBB0_5, kind:
 fixup_Hexagon_B15_PCREL</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif;color:#008400">// %bb.2:                               // %while.body.preheader</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">{</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">loop0(.LBB0_<span style="color:#272AD8">3</span>,<span style="color:#008400">#100)</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">}
                              <span class="apple-converted-space"> </span><span style="color:#008400">// encoding: [0x20'A',0xc0'A',0x03'A',0x69'A']</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                       <span class="apple-converted-space"> </span><span style="color:#008400">//   fixup A - offset: 0, value: .LBB0_3, kind:
 fixup_Hexagon_B7_PCREL</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif">.Ltmp0:                                <span class="apple-converted-space"> </span><span style="color:#008400">// Block address taken</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif">.LBB0_<span style="color:#272AD8">3</span>:                               <span class="apple-converted-space"> </span><span style="color:#008400">// %while.body</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                       <span class="apple-converted-space"> </span><span style="color:#008400">// =>This Inner Loop Header: Depth=1</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">{</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">r0
 = memw(r2++<span style="color:#008400">#4)</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">memw(r1++<span style="color:#008400">#4)
 = r0.new</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">}
 :endloop0                    <span class="apple-converted-space"> </span><span style="color:#008400">// encoding: [0x20,0x80,0x82,0x9b,0x08,0xd2,0xa1,0xab]</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif;color:#008400">// %bb.4:                               // %while.end</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">{</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">r31:<span style="color:#272AD8">30</span><span class="apple-converted-space"> </span>=
 dealloc_return(r30):raw</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">}
                              <span class="apple-converted-space"> </span><span style="color:#008400">// encoding: [0x1e,0xc0,0x1e,0x96]</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif">.LBB0_<span style="color:#272AD8">5</span>:                               <span class="apple-converted-space"> </span><span style="color:#008400">// %while.body.rtli</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">{</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">call
 memmove</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">r1:<span style="color:#272AD8">0</span><span class="apple-converted-space"> </span>=
 combine(r2,r1)</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">r2
 =<span class="apple-converted-space"> </span><span style="color:#008400">#400</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">}
                              <span class="apple-converted-space"> </span><span style="color:#008400">// encoding: [A,0x40'A',A,0x5a'A',0x00,0x41,0x02,0xf5,0x02,0xf2,0x00,0x78]</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                       <span class="apple-converted-space"> </span><span style="color:#008400">//   fixup A - offset: 0, value: memmove, kind:
 fixup_Hexagon_B22_PCREL</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">{</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                               </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">r31:<span style="color:#272AD8">30</span><span class="apple-converted-space"> </span>=
 dealloc_return(r30):raw</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">}
                              <span class="apple-converted-space"> </span><span style="color:#008400">// encoding: [0x1e,0xc0,0x1e,0x96]</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif">.Lfunc_end0:</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="apple-tab-span"><span style="font-size:8.5pt;font-family:"Monaco",serif">                       </span></span><span class="apple-converted-space"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span></span><span style="font-size:8.5pt;font-family:"Monaco",serif">.size<span class="apple-tab-span">             </span><span class="apple-converted-space"> </span>hexagon2,
 .Lfunc_end0-hexagon2</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif">                                       <span class="apple-converted-space"> </span><span style="color:#008400">// -- End function</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Monaco",serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">The code generated by LLVM 7.0 is better than LLVM 9.0 because 9.0 did not made use of Hardware loops.  This is in my opinion a bad regression from
 some earlier version. This is not an isolated case, more cases of the same LLVM 9 ‘defect’ are easy to find.</span><o:p></o:p></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">I have investigated the issue and I identified the root cause of it, which is related with the initial use of the “llvm.uadd" intrinsic in LLVM 9.0
 to increment the loop Induction Variable, instead of an “add” instruction like LLVM 7.0. </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">This is the while.body excerpt after "CodeGen Prepare” in LLVM 9.0</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">while.body:                                       ; preds = %<span style="background:#D4EDF4">entry.old</span>, %while.body</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %lsr.iv = phi i32 [<span class="apple-converted-space"> </span><span style="background:#D4EDF4">%math</span>, %<span style="background:#D4EDF4">while.body</span><span class="apple-converted-space"> </span>],
 [<span class="apple-converted-space"> </span><span style="background:#D4EDF4">-100</span>, %<span style="background:#D4EDF4">entry.old</span><span class="apple-converted-space"> </span>]</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %res.addr.04 = phi i32* [ %cgep1, %while.body ], [ %res, %<span style="background:#D4EDF4">entry.old</span><span class="apple-converted-space"> </span>]</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %a.addr.03 = phi i32* [ %cgep, %while.body ], [ %a, %<span style="background:#D4EDF4">entry.old</span><span class="apple-converted-space"> </span>]</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %6 = load i32, i32* %a.addr.03, align 4, !tbaa !2</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  store i32 %6, i32* %res.addr.04, align 4, !tbaa !2</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %<span style="background:#D4EDF4">7</span><span class="apple-converted-space"> </span>=<span class="apple-converted-space"> </span><span style="background:#D4EDF4">call</span><span class="apple-converted-space"> </span><span style="background:#D4EDF4">{</span><span class="apple-converted-space"> </span>i32<span style="background:#D4EDF4">,</span><span class="apple-converted-space"> </span><span style="background:#D4EDF4">i1
 } @llvm.uadd.with.overflow.i32(i32<span class="apple-converted-space"> </span></span>%lsr.iv,<span class="apple-converted-space"> </span><span style="background:#D4EDF4">i32<span class="apple-converted-space"> </span></span>1<span style="background:#D4EDF4">)</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %<span style="background:#D4EDF4">math</span><span class="apple-converted-space"> </span>=<span class="apple-converted-space"> </span><span style="background:#D4EDF4">extractvalue</span><span class="apple-converted-space"> </span><span style="background:#D4EDF4">{</span><span class="apple-converted-space"> </span>i32<span style="background:#D4EDF4">,</span><span class="apple-converted-space"> </span><span style="background:#D4EDF4">i1
 }<span class="apple-converted-space"> </span></span>%<span style="background:#D4EDF4">7</span>, 0</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:#D4EDF4"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %ov = extractvalue { i32, i1 } %7, 1</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %cgep = getelementptr inbounds i32, i32* %a.addr.03, i32 1</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %cgep1 = getelementptr inbounds i32, i32* %res.addr.04, i32 1</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  br i1 %<span style="background:#D4EDF4">ov</span>, label %while.end, label %while.body</span><o:p></o:p></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">And this is the same excerpt on  LLVM 7.0</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">while.body:                                       ; preds = %<span style="background:#D4EDF4">while.body.preheader</span>, %while.body</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %lsr.iv = phi i32 [<span class="apple-converted-space"> </span><span style="background:#D4EDF4">-100</span>, %<span style="background:#D4EDF4">while.body.preheader</span><span class="apple-converted-space"> </span>],
 [<span class="apple-converted-space"> </span><span style="background:#D4EDF4">%lsr.iv.next</span>, %<span style="background:#D4EDF4">while.body</span><span class="apple-converted-space"> </span>]</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %res.addr.04 = phi i32* [ %cgep1, %while.body ], [ %res, %<span style="background:#D4EDF4">while.body.preheader</span><span class="apple-converted-space"> </span>]</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %a.addr.03 = phi i32* [ %cgep, %while.body ], [ %a, %<span style="background:#D4EDF4">while.body.preheader</span><span class="apple-converted-space"> </span>]</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %6 = load i32, i32* %a.addr.03, align 4, !tbaa !2</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  store i32 %6, i32* %res.addr.04, align 4, !tbaa !2</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %<span style="background:#D4EDF4">lsr.iv.next</span><span class="apple-converted-space"> </span>=<span class="apple-converted-space"> </span><span style="background:#D4EDF4">add</span><span class="apple-converted-space"> </span><span style="background:#D4EDF4">nsw</span><span class="apple-converted-space"> </span>i32
 %lsr.iv, 1</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %<span style="background:#D4EDF4">tobool</span><span class="apple-converted-space"> </span>=<span class="apple-converted-space"> </span><span style="background:#D4EDF4">icmp</span><span class="apple-converted-space"> </span><span style="background:#D4EDF4">eq</span><span class="apple-converted-space"> </span>i32
 %<span style="background:#D4EDF4">lsr.iv.next</span>, 0</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %cgep = getelementptr inbounds i32, i32* %a.addr.03, i32 1</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %cgep1 = getelementptr inbounds i32, i32* %res.addr.04, i32 1</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  br i1 %<span style="background:#D4EDF4">tobool</span>, label %while.end, label %while.body</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif"> </span><o:p></o:p></p>
</div>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">LLVM 9 uses “llvm.uadd”. This finally prevents the “Hexagon Hardware Loops” pass to recognise a hardware loop pattern, resulting in sub-optimal code,
 specially compared with what LLVM 7.0 produces.</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">The code (excerpt) just before the Hexagon Hardware Loops pass on LLVM 9 is this:</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">bb.<span style="background:#D4EDF4">5</span>:</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">; predecessors: %bb.1</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  successors: %bb.<span style="background:#D4EDF4">3</span>(0x80000000); %bb.<span style="background:#D4EDF4">3</span>(<span style="background:#D4EDF4">100.00</span>%)</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %<span style="background:#D4EDF4">8</span>:intregs = A2_tfrsi -100</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  J2_jump %bb.<span style="background:#D4EDF4">3</span>, implicit-def $pc</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif"><br>
<br>
<br>
</span><o:p></o:p></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">bb.<span style="background:#D4EDF4">3</span>.while.body:</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">; predecessors: %bb.<span style="background:#D4EDF4">3</span>, %bb.<span style="background:#D4EDF4">5</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  successors: %bb.<span style="background:#D4EDF4">4</span>(0x04000000), %bb.<span style="background:#D4EDF4">3</span>(0x7c000000); %bb.<span style="background:#D4EDF4">4</span>(3.12%),
 %bb.<span style="background:#D4EDF4">3</span>(96.88%)</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %0:intregs = PHI %<span style="background:#D4EDF4">8</span>:intregs, %bb.<span style="background:#D4EDF4">5</span>, %3:intregs, %bb.<span style="background:#D4EDF4">3</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %1:intregs = PHI %7:intregs, %bb.<span style="background:#D4EDF4">5</span>, %5:intregs, %bb.<span style="background:#D4EDF4">3</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %2:intregs = PHI %6:intregs, %bb.<span style="background:#D4EDF4">5</span>, %4:intregs, %bb.<span style="background:#D4EDF4">3</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %<span style="background:#D4EDF4">13</span>:intregs, %4:intregs = L2_loadri_pi %2:intregs<span style="background:#D4EDF4">(tied-def 1)</span>, 4 :: (load
 4 from %ir.a.addr.03, !tbaa !2)</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %5:intregs = S2_storeri_pi %1:intregs<span style="background:#D4EDF4">(tied-def 0)</span>, 4, %<span style="background:#D4EDF4">13</span>:intregs :: (store
 4 into %ir.res.addr.04, !tbaa !2)</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %3:intregs = A2_addi %0:intregs, 1</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %<span style="background:#D4EDF4">14</span>:predregs =<span class="apple-converted-space"> </span><span style="background:#D4EDF4">C2_cmpgtu</span><span class="apple-converted-space"> </span>%<span style="background:#D4EDF4">0</span>:intregs,<span class="apple-converted-space"> </span><span style="background:#D4EDF4">%3:intregs</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  J2_jumpf %<span style="background:#D4EDF4">14</span>:predregs, %bb.<span style="background:#D4EDF4">3</span>, implicit-def dead $pc</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  J2_jump %bb.<span style="background:#D4EDF4">4</span>, implicit-def dead $pc</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"><br>
<br>
<br>
</span><o:p></o:p></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">The same code on LLVM 7 is this:</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif"><br>
<br>
<br>
</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">bb.<span style="background:#D4EDF4">2.while.body.preheader</span>:</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">; predecessors: %bb.1</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  successors: %bb.<span style="background:#D4EDF4">4</span>(0x80000000); %bb.<span style="background:#D4EDF4">4</span>(<span style="background:#D4EDF4">200.00</span>%)</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %<span style="background:#D4EDF4">11</span>:intregs = A2_tfrsi -100</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  J2_jump %bb.<span style="background:#D4EDF4">4</span>, implicit-def<span class="apple-converted-space"> </span><span style="background:#D4EDF4">dead<span class="apple-converted-space"> </span></span>$pc</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif"><br>
<br>
<br>
</span><o:p></o:p></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">bb.<span style="background:#D4EDF4">4</span>.while.body:</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">; predecessors: %bb.<span style="background:#D4EDF4">2</span>, %bb.<span style="background:#D4EDF4">4</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  successors: %bb.<span style="background:#D4EDF4">5</span>(0x04000000), %bb.<span style="background:#D4EDF4">4</span>(0x7c000000); %bb.<span style="background:#D4EDF4">5</span>(3.12%),
 %bb.<span style="background:#D4EDF4">4</span>(96.88%)</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %0:intregs = PHI %<span style="background:#D4EDF4">11</span>:intregs, %bb.<span style="background:#D4EDF4">2</span>, %3:intregs, %bb.<span style="background:#D4EDF4">4</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %1:intregs = PHI %7:intregs, %bb.<span style="background:#D4EDF4">2</span>, %5:intregs, %bb.<span style="background:#D4EDF4">4</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %2:intregs = PHI %6:intregs, %bb.<span style="background:#D4EDF4">2</span>, %4:intregs, %bb.<span style="background:#D4EDF4">4</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %<span style="background:#D4EDF4">12</span>:intregs, %4:intregs = L2_loadri_pi %2:intregs, 4 :: (load 4 from %ir.a.addr.03, !tbaa !2)</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %5:intregs = S2_storeri_pi %1:intregs, 4, %<span style="background:#D4EDF4">12</span>:intregs :: (store 4 into %ir.res.addr.04, !tbaa !2)</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %3:intregs = A2_addi %0:intregs, 1</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  %<span style="background:#D4EDF4">13</span>:predregs =<span class="apple-converted-space"> </span><span style="background:#D4EDF4">C2_cmpeqi</span><span class="apple-converted-space"> </span>%<span style="background:#D4EDF4">3</span>:intregs,<span class="apple-converted-space"> </span><span style="background:#D4EDF4">0</span></span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  J2_jumpf %<span style="background:#D4EDF4">13</span>:predregs, %bb.<span style="background:#D4EDF4">4</span>, implicit-def dead $pc</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:"Menlo",serif">  J2_jump %bb.<span style="background:#D4EDF4">5</span>, implicit-def dead $pc</span><o:p></o:p></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">The differences above allow LLVM 7 to turn %13, %3, %11 into a hardware Loop as shown in the assembly code earlier in this message. However, LLVM
 9 can’t identify a Hardware loop pattern due to the odd C2_cmpgtu instruction that gets generated. This instruction is a consequence of the introduction of the “llvm.addu” intrinsic that I showed earlier.</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">I am presenting here the case of Hexagon, but I suspect the same sub-optimal code may happen for the PowerPC (not checked yet).</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">All the code excerpts were obtained with -Os flags</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">I’m highly interested in getting in contact with someone familiar with the Hexagon/PowerPC targets regarding this subject. Any pointers to the right
 persons would be appreciated. My interest comes from the fact that I am proposing an improvement on the LSR pass that affects all targets and I need hardware loops to be properly generated in LLVM 9 like they used to be in LLVM 7. </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">Thanks</span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"> </span><o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">John.</span><o:p></o:p></p>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</body>
</html>