<div dir="ltr"><div><div>Hi,<br></div>thank you for the answer, great that this is possible, I will try to come up with some solution.<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-07-28 14:58 GMT+02:00 Michael Zolotukhin <span dir="ltr"><<a href="mailto:mzolotukhin@apple.com" target="_blank">mzolotukhin@apple.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi,<div><br></div><div>LLVM allows to work with arbitrary bit sizes (see <a href="https://llvm.org/docs/LangRef.html#integer-type" target="_blank">https://llvm.org/docs/LangRef.<wbr>html#integer-type</a>), but please bear in mind that working with unusual sizes might expose bugs, as the corresponding code paths are less tested.</div><div><br></div><div>Answering your specific question: yes, it’s definitely possible, however you need to define how to add 3-bit operand to 5-bit operand in terms of operations supported by LLVM. One way is to, for instance, zero-extend both operands to 6-bits and then add:</div><div><div><div><br></div><div>define i6 @foo(i5 %a, i3 %b) {</div><div>entry:</div><div>  %a_zext = zext i5 %a to i6</div><div>  %b_zext = zext i3 %b to i6</div><div>  %c = add i6 %a_zext, %b_zext</div><div>  ret i6 %c</div><div>}</div></div></div><div><br></div><div>Thanks,</div><div>Michael</div><div><br><div><blockquote type="cite"><div><div class="h5"><div>On Jul 28, 2017, at 1:32 PM, Anastasiya Ruzhanskaya via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="m_-3016113999053440871Apple-interchange-newline"></div></div><div><div><div class="h5"><div dir="ltr"><div><div>Hello,<br></div>I wanted to ask one general question ( for now it is hard to check it manually, maybe there is a fast answer):<br></div>can I construct an operation, say, addition, from operand_0 - 5 bits size and operand_1 - 3 bit size -> receive result as 6 bit size . I am basically reducing these sizes in the whole IR, so I want that all operands can have arbitrary sizes ( llvm pass is not really good because it converts sizes only to some predefined sizes). However , I am not sure if there will be internal checks on these sizes after I will transform the tree. Or is it better to create some my own attributes, that can describe the sizes? <br></div></div></div>
______________________________<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" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br></div></blockquote></div><br></div></div></blockquote></div><br></div>