<div dir="ltr">Do you have a simple test case you can send?  I'm having trouble replicating this on x86-64 with the simplest possible test.<div><br></div><div><div>unsigned short foo(unsigned short a, unsigned short b) {</div><div>  return a + b;</div><div>}</div></div><div><br></div><div>This gives IR with no mention of i32. Maybe there's somethings misconfigured for your target or I need a more complex test case.</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature">~Craig</div></div>
<br><div class="gmail_quote">On Sun, May 21, 2017 at 1:22 AM, Alex Susu via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">  Hello.<br>
    My target architecture supports natively 16 bit integers (i16).<br>
<br>
    Whenever I write in C programs using only short types, clang compiles the program to LLVM and converts the i16 data to i32 to perform arithmetic operations and then truncates the results to i16. Then, the InstructionCombining (INSTCOMBINE or IC) pass removes these conversions back and forth from i16, except for the (s)div LLVM IR operation.<br>
<br>
    Is there a way to avoid these conversion made by clang back and forth from i16 to i32, if my source program uses only short types?<br>
    Otherwise, how can I make the IC pass handle sdiv the way it does with add (sub), mul? (that is, if the input operands are i16, the add/mul operation will eventually be i16, with any unnecessary conversion back and forth from i32 removed).<br>
<br>
  Thank you,<br>
    Alex<br>
______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
</blockquote></div><br></div>