<div dir="ltr"><div>Hi Pawel,</div><div><br></div><div dir="ltr">There is the _mulx_u64 intrinsic, but it currently requires the hardware flag "-mbmi2".</div><div dir="ltr"><div><a href="https://github.com/Quuxplusone/WideIntProofOfConcept/blob/master/wider.h#L89-L99">https://github.com/Quuxplusone/WideIntProofOfConcept/blob/master/wider.h#L89-L99</a><br></div><div><br></div><div>On Clang 3.8.1 and earlier, the _addcarry_u64 and _subborrow_u64 intrinsics required the hardware flag `-madx`, even though they didn't use the hardware ADX/ADOX instructions. Modern GCC and Clang permit the use of these intrinsics (to generate ADC) even in the absence of `-madx`.</div><div><br></div><div>I think it would be a very good idea for Clang to support _mulx_u64 (to generate MUL) even in the absence of `-mbmi2`.</div><div><br></div><div>–Arthur</div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Sat, Dec 29, 2018 at 6:03 PM Paweł Bylica via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>For some maybe dumb reasons I try to write a portable version of int128.</div><div><br></div><div>What is very valuable for this implementation is access to MUL instruction on x86 which provides full 64 x 64 -> 128 bit multiplication. An equally useful on ARM would be UMULH instruction.</div><div><br></div><div>Well, the way you can access this on clang / GCC is to use __int128 type or use inline assembly. MSVC provides an intrinsic for this instruction. This defeats the idea of portable int128 reimplementation and makes constexpr implementation of multiplication at least inconvenient.</div><div><br></div><div>Maybe there is a hope for me in LLVM. Is there any pattern matcher that is producing MUL instruction of bigger type?</div><div>If not, would it be good idea to teach LLVM about it?</div><div><br></div><div>Bests,</div><div>Paweł</div></div>
_______________________________________________<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" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>