<html 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:"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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:12.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:12.0pt;
        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>
</head>
<body lang="EN-GB" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt">Hey all,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">I'm looking to extend the current clang loop pragmas to also support hardware loops and allow a user to insert (or completely disable) hardware loop intrinsics on a per-loop basis.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">One of the questions I have regarding this is how to go about incorporating the different hardware loop intrinsics in the pragma. A few options we came up with:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">1. The pragma incorporates which intrinsic to use for a loop:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">#pragma loop hwloop(set_loop_i32)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">or<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">#pragma loop hwloop(/*LivesInReg=*/ true, /*AddTestGuard=*/ true, /*NumBits=*/ 32)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">2. The pragma adds some target specific info (string?) to use in the hwloop TTI hook/new hwloop TTI hook:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">#pragma loop hwloop(target="bdnz") // PPC example<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">#pragma loop hwloop(target="bdz")  // PPC example<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">or<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">#pragma loop hwloop(max-count=42, ...)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Option 1 requires the user to know about llvm's hardware loops internals so I'm leaning more towards option 2 as users are more likely to be aware of target specific information (such as PPC's bdnz/bdz).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">These are just some options we came up with, we would love to hear about other (better) options, if any.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Kind regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Janek van Oirschot<o:p></o:p></span></p>
</div>
</body>
</html>