<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 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","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;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        mso-fareast-language:EN-GB;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
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-GB" link="blue" vlink="purple">
<div class="WordSection1">
<pre>> beqz  s4,1f<o:p></o:p></pre>
<pre>> li    at,8704 ; **DELAY SLOT**<o:p></o:p></pre>
<pre>> j     2f<o:p></o:p></pre>
<pre>> udi   VPU,vpu_find_first_neg_from_reduction_4_mcs05,1,zero ; **DELAY SLOT**<o:p></o:p></pre>
<pre>> 1:<o:p></o:p></pre>
<pre>> udi   VPU,vpu_find_first_neg_from_reduction_4,1,zero<o:p></o:p></pre>
<pre>> 2:<o:p></o:p></pre>
<pre>> udi   VPU,wait_req_pending,1,s1,0,0<o:p></o:p></pre>
<pre style="margin-bottom:12.0pt">><br>> Is there something I could try to exploit delay slots in branch instructions or are there any recent patch which deals with this?<o:p></o:p></pre>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">It looks like you're pulling instructions from the successor blocks into the delay slot. This is valid (with some exceptions like branches) and there is code in our backend
 to do it. However, it's not enabled by default at the moment because it has some problems.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">The feature is guarded by -disable-mips-df-forward-search and -disable-mips-df-succbb-search (which both default to true) if you want to try it.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">Also relevant: If you're on the trunk then you'll already have this Vasileios noticed an issue recently with KILL instructions preventing opportunities to fill the delay
 slot. This was fixed in r235183 (<a href="http://reviews.llvm.org/rL235183">http://reviews.llvm.org/rL235183</a>).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Ambuj Agrawal [mailto:ambujbwt@gmail.com]
<br>
<b>Sent:</b> 24 April 2015 17:14<br>
<b>To:</b> Daniel Sanders; llvmdev@cs.uiuc.edu<br>
<b>Subject:</b> MIPS - Filling delay slots<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<pre>Hi Daniel,<o:p></o:p></pre>
<pre style="margin-bottom:12.0pt">The Clang with LLVM backend seems to be missing some opportunities to fill branch delay slots for the MIPS M14K processor.<o:p></o:p></pre>
<pre>Example:<br>static inline void LOCAL(encode_position)(VARS)<o:p></o:p></pre>
<pre>{<o:p></o:p></pre>
<pre>  if (vars->is_mcs05) {<o:p></o:p></pre>
<pre>    udi(vpu_find_first_neg_from_reduction_4_mcs05, 1, 0);<o:p></o:p></pre>
<pre>  } else {<o:p></o:p></pre>
<pre>    udi(vpu_find_first_neg_from_reduction_4, 1, 0);<o:p></o:p></pre>
<pre>  }<o:p></o:p></pre>
<pre>}<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>is giving<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>bfc03394:     12800004       beqz    s4,bfc033a8 <rx4_eostf+0x4a4><o:p></o:p></pre>
<pre>bfc03398:     00000000       nop<o:p></o:p></pre>
<pre>bfc0339c:     70016450       udi     VPU,vpu_find_first_neg_from_reduction_4_mcs05,1,zero<o:p></o:p></pre>
<pre>bfc033a0:     0bf00ceb       j       bfc033ac <rx4_eostf+0x4a8><o:p></o:p></pre>
<pre>bfc033a4:     00000000       nop<o:p></o:p></pre>
<pre>bfc033a8:     70016350       udi     VPU,vpu_find_first_neg_from_reduction_4,1,zero<o:p></o:p></pre>
<pre>bfc033ac:     24012200       li      at,8704<o:p></o:p></pre>
<pre>bfc033b0:     72201bd0       udi     VPU,wait_req_pending,1,s1,0,0<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>I think the following is possible<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>beqz   s4,1f<o:p></o:p></pre>
<pre>li     at,8704 ; **DELAY SLOT**<o:p></o:p></pre>
<pre>j      2f<o:p></o:p></pre>
<pre>udi    VPU,vpu_find_first_neg_from_reduction_4_mcs05,1,zero ; **DELAY SLOT**<o:p></o:p></pre>
<pre>1:<o:p></o:p></pre>
<pre>udi    VPU,vpu_find_first_neg_from_reduction_4,1,zero<o:p></o:p></pre>
<pre>2:<o:p></o:p></pre>
<pre>udi    VPU,wait_req_pending,1,s1,0,0<o:p></o:p></pre>
<pre style="margin-bottom:12.0pt"><br>Is there something I could try to exploit delay slots in branch instructions or are there any recent patch which deals with this?<o:p></o:p></pre>
<pre>Thanks,<o:p></o:p></pre>
<pre>Ambuj<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
</div>
</div>
</div>
</body>
</html>