<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:"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:"Book Antiqua";
panose-1:2 4 6 2 5 3 5 3 3 4;}
@font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 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;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Book Antiqua","serif";
color:#1F497D;
font-weight:normal;
font-style:normal;
text-decoration:none none;}
.MsoChpDefault
{mso-style-type:export-only;
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-IE link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D;mso-fareast-language:EN-US'>Hi James and thanks for pointing out the existence of this transformation, we were quite unaware of it.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D;mso-fareast-language:EN-US'>As it happens, I am highly allergic to re-invention and avoid doing so whenever possible; the only reason an already overburdened team of 2 developers will re-invent is because they are unaware of an existing solution which is not difficult given the scope and complexity of LLVM.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D;mso-fareast-language:EN-US'>So far as I can tell, ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>truncateToMinimalBitwidths</span><span style='font-family:"Book Antiqua","serif";color:#1F497D;mso-fareast-language:EN-US'>’ is always enabled, so it is not a target specific selection and our target should automatically reap the rewards of this optimisation pass. I certainly cannot find a switch to enable or disable it. But in fact we are not seeing anywhere near the benefits we would expect.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>void InnerLoopVectorizer::truncateToMinimalBitwidths() {<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'> // For every instruction `I` in MinBWs, truncate the operands, create a<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'> // truncated version of `I` and reextend its result. InstCombine runs<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'> // later and will remove any ext/trunc pairs.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D;mso-fareast-language:EN-US'>This appears to only run on inner-loops, and it appear to insert narrowings/truncations and subsequent widenings/extendings into the IR chains.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D;mso-fareast-language:EN-US'>The DataLayout for our target includes “</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>-n8:16:32</span><span style='font-family:"Book Antiqua","serif";color:#1F497D;mso-fareast-language:EN-US'>”, so it should see the benefits of optimisations for multiple native integer support. We also provide both 32-bit SIMD and 128-bit SIMD native support.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D;mso-fareast-language:EN-US'>The pass that we wrote is quite different. It is run as a machine pass prior to loop-unrolling and vectorisation, and instead of pre-truncating and post-extending IR chains, it removes the existing pre-extending and post-truncating that brackets a sequence of IR operations if it can prove that the outcome is the same. The results are actually very good and match what our expectations are from such a transformation, which makes me wonder “why does ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>truncateToMinimalBitwidths</span><span style='font-family:"Book Antiqua","serif";color:#1F497D;mso-fareast-language:EN-US'>’ not already produce comparable results?”.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D;mso-fareast-language:EN-US'>Our observations are that with the new pass, a significant majority of vectorised code showed some improvement, with results as high as 40X faster than without. Of the small number of tests that regressed in performance, adding a ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>#pragma clang unroll_count(N)</span><span style='font-family:"Book Antiqua","serif";color:#1F497D;mso-fareast-language:EN-US'>’ eliminated the loss. This could probably be eliminate too by better tuning of the cost-models.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D;mso-fareast-language:EN-US'>The re-invention is inadvertent, but in any event our new pass appears to provide considerable additional performance improvements that are not currently happening with the stock LLVM transformations.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D;mso-fareast-language:EN-US'>I will have to contrive some tests to see why ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>truncateToMinimalBitwidths</span><span style='font-family:"Book Antiqua","serif";color:#1F497D;mso-fareast-language:EN-US'>’ is not already doing this, and if there is something that we have done wrong in our target that is breaking it, I will happily revert to an existing solution.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D;mso-fareast-language:EN-US'> MartinO<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua","serif";color:#1F497D;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif"'> James Molloy [mailto:james@jamesmolloy.co.uk] <br><b>Sent:</b> 28 May 2016 19:58<br><b>To:</b> Martin.ORiordan@movidius.com; David Majnemer; Dilan Manatunga<br><b>Cc:</b> Clang Dev; Norman Rink<br><b>Subject:</b> Re: [cfe-dev] Disable integer promotion (Dilan Manatunga via cfe-dev)<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Hi,<br><br>X86 has native support for i8 and i16. Aarch64 and ARM have native i8 and i16 vector operations that are lowered and analysed using truncateToMinimalBitwidths in LoopVectorize. Similarly for scalar code on x86 truncation is done in instcombine. <br><br>Why do you need to reinvent this?<br><br>Cheers,<br><br>James<o:p></o:p></p><div><div><p class=MsoNormal>On Sat, 28 May 2016 at 19:02, Martin J. O'Riordan via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<o:p></o:p></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm'><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-family:"Book Antiqua","serif";color:#943634'>Instead of suppressing the integer promotion rules which are part of the ISO C/C++ Standards, we wrote a new pass that analyses the IR to see if the input values and output value were of an integer type that was narrower than the promoted types used in the IR, and if we could prove that the outcome would be identical if the type was unpromoted, then we reduced the IR to use the narrower form.</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-family:"Book Antiqua","serif";color:#943634'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-family:"Book Antiqua","serif";color:#943634'>In our case the motive was to enhance vectorisation because our vector ALU can work with 8-, 16- and 32-bit integers natively, and handling ‘</span><span style='font-family:"Courier New";color:black'>vXi8</span><span style='font-family:"Book Antiqua","serif";color:#943634'>’ vectors ended was actually being promoted to multiple ‘</span><span style='font-family:"Courier New";color:black'>v4i32</span><span style='font-family:"Book Antiqua","serif";color:#943634'>’ vectors requiring 4 times as many instructions as were necessary, or worse still, fully scalarized.</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-family:"Book Antiqua","serif";color:#943634'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-family:"Book Antiqua","serif";color:#943634'>This pass was presented by my colleague Stephen Rogers in a “Lighting Talk” at the October 2015 LLVM Conference in San Jose and titled “</span><span style='font-family:"Book Antiqua","serif";color:black'>Integer Vector Optimizations and “Usual Arithmetic Conversions”</span><span style='font-family:"Book Antiqua","serif";color:#943634'>”. I can’t find the paper or slides on the LLVM Meetings page, perhaps these are not archived for Lightning Talks (?), but as they are not large I have attached them here.</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-family:"Book Antiqua","serif";color:#943634'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-family:"Book Antiqua","serif";color:#943634'>This approach allowed us to gain the optimisations that are possible with our architecture which supports 8-, 16- and 32-bit native integer computations (scalar and vector), while also respecting the ISO C and C++ Standards. I am a lot more nervous of a front-end switch for this, as it will lead to non-compliant programs, and in the presence of overloading and template-instantiation it could also lead to very different programs, and would recommend that we do not add a front-end switch which alters the semantics of the language in this way.</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-family:"Book Antiqua","serif";color:#943634'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-family:"Book Antiqua","serif";color:#943634'>It is my intention to publish this pass if it is of general interest, and since it is target independent there are no particular blocking issue for me (Patents, IP, etc.) to doing so. I do have to catch-up on the HEAD revision to ensure that it still works correctly, but it was working perfectly at SVN #262824 and it will be a month before I have enough time to catch up on the HEAD revision as we are busy with a product release that takes precedence.</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-family:"Book Antiqua","serif";color:#943634'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-family:"Book Antiqua","serif";color:#943634'>All the best,</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-family:"Book Antiqua","serif";color:#943634'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-family:"Book Antiqua","serif";color:#943634'> MartinO</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-family:"Book Antiqua","serif";color:#943634'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif"'> cfe-dev [mailto:<a href="mailto:cfe-dev-bounces@lists.llvm.org" target="_blank">cfe-dev-bounces@lists.llvm.org</a>] <b>On Behalf Of </b>David Majnemer via cfe-dev<br><b>Sent:</b> 27 May 2016 19:55<br><b>To:</b> Dilan Manatunga <<a href="mailto:manatunga@gmail.com" target="_blank">manatunga@gmail.com</a>><br><b>Cc:</b> clang developer list <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>>; Norman Rink <<a href="mailto:norman.rink@tu-dresden.de" target="_blank">norman.rink@tu-dresden.de</a>>; <a href="mailto:cfe-dev-request@lists.llvm.org" target="_blank">cfe-dev-request@lists.llvm.org</a><br><b>Subject:</b> Re: [cfe-dev] Disable integer promotion (Dilan Manatunga via cfe-dev)</span><o:p></o:p></p></div></div><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>You could set IntWidth to 16 or 8 in clang, not unlike what MSP430 does:<o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><a href="https://github.com/llvm-mirror/clang/blob/3317d0fa0bd1f5c5adc14bcc6adc2a38acc9064b/lib/Basic/Targets.cpp#L6823" target="_blank">https://github.com/llvm-mirror/clang/blob/3317d0fa0bd1f5c5adc14bcc6adc2a38acc9064b/lib/Basic/Targets.cpp#L6823</a><o:p></o:p></p></div></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>On Fri, May 27, 2016 at 10:32 AM, Dilan Manatunga via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<o:p></o:p></p><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt'><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>I need disabling this feature because I am researching architectures where 8-bit or 16-bit adds are preferred to 32-bit. So, integer promotion kinda mucks everything up. I was hoping there was a way in clang to disable it, instead of having to implement an LLVM pass to coalesce unnecessary promotions. <o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Thanks for catching the IR mistake. Should have double checked that. This should be the correct version:<o:p></o:p></p></div><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>nt8_t a = 1;</span><o:p></o:p></p></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>int8_t b = 2;</span><o:p></o:p></p></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>int8_t c = a + b</span><o:p></o:p></p></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'> </span><o:p></o:p></p></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>The LLVM IR will be:</span><o:p></o:p></p></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>%x = sext i8 %a to i32</span><o:p></o:p></p></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>%y = sext i8 %b to i32</span><o:p></o:p></p></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>%z = add nsw i32 %x, %y</span><o:p></o:p></p></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>%c = trunc i32 %z to i8</span><o:p></o:p></p></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'> </span><o:p></o:p></p></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>Instead, it would simply compile to:</span><o:p></o:p></p></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>$c = add nsw i8 %z, $y</span><o:p></o:p></p></div></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'> </span><o:p></o:p></p></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>-Dilan</span><o:p></o:p></p></div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'> </span><o:p></o:p></p></div></div><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>On Fri, May 27, 2016 at 5:30 AM Norman Rink via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<o:p></o:p></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt'><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>Hi Dilan,<br><br>I would like to second your request for an option to disable integer<br>promotion. What do you need it for?<br><br>As far as I am aware, there is no such option and the code that implements<br>integer promotion is somewhat scattered across ³SemaExpr.cpp².<br><br>Also, I think your example code snippet contains a few ³i32²s too many. It<br>will be clearer to people what you are looking for if your code example is<br>consistent with your question.<br><br>Best,<br><br>Norman<br><br><br>>Message: 1<br>>Date: Fri, 27 May 2016 01:50:12 +0000<br>>From: Dilan Manatunga via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>><br>>To: <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>>Subject: [cfe-dev] Disable integer promotion<br>>Message-ID:<br>> <CAHpgGu4=<a href="mailto:jFC9ohQQZZMp2NMG3Hw0sE5U4-Lqrgb%2B6gcXv9SEtQ@mail.gmail.com" target="_blank">jFC9ohQQZZMp2NMG3Hw0sE5U4-Lqrgb+6gcXv9SEtQ@mail.gmail.com</a>><br>>Content-Type: text/plain; charset="utf-8"<br>><br>>Is there a way to disable integer promotion when performing math<br>>operations. For example, when compiling a statement such as this:<br>>int8_t a = 1;<br>>int8_t b = 2;<br>>int8_t c = a + b<br>><br>>The LLVM IR will be:<br>>%x = sext i32 %a to i32<br>>%y = sext i32 %b to i32<br>>%z = add nsw i32 %x, %y<br>>%c = trunc i32 %z to i16<br>><br>>Instead, it would simply compile to:<br>>$c = add nsw i32 %z, $y<br>><br>>-Dilan Manatunga<br>>-------------- next part --------------<br>>An HTML attachment was scrubbed...<br>>URL:<br>><<a href="http://lists.llvm.org/pipermail/cfe-dev/attachments/20160527/4a7920ab/att" target="_blank">http://lists.llvm.org/pipermail/cfe-dev/attachments/20160527/4a7920ab/att</a><br>>achment-0001.html><br>><br>>------------------------------<br><br><br>_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><o:p></o:p></p></blockquote></div></div></div><p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt'><br>_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><o:p></o:p></p></blockquote></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p></div></div></div><p class=MsoNormal>_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><o:p></o:p></p></blockquote></div></div></body></html>