<div dir="ltr"><div><div><div><div><div>Wider-than-legal types are not necessarily handled as vectors.<br><br></div>On x86, something like i128 is handled, within limitations, using multiple non-vector instructions. e.g. adding i128 lowers to ADD followed by ADC.<br><br></div>Things I've noticed:<br></div>- The x86 lowering does not generate loops even in cases where they might be reasonable. If you add two i2048 values, then you'll get 32 64-bit adds, unrolled.<br></div>- Some ops are not supported, e.g. multiplying two i128 will result in a crash. However, i128 x i128 seems to work.<br><br></div>In general, you can probably rely on the DAG legalization to generate correct code for values twice as wide as your processor can reasonably handle (e.g. i128 for x64_64) and you're best to steer clear of anything larger.  Use GMP or roll your own for those cases.<br> <br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 2, 2015 at 9:30 AM, Jaak Randmets <span dir="ltr"><<a href="mailto:jaak.ra@gmail.com" target="_blank">jaak.ra@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">For 64-bit X86 code we have had good success with using up-to 128-bit<br>
integers (this includes say 36-bit or even 2-bit integers).<br>
<br>
On Mon, Feb 2, 2015 at 4:03 PM, Alejandro Velasco<br>
<<a href="mailto:gollumdelperdiguero@gmail.com">gollumdelperdiguero@gmail.com</a>> wrote:<br>
> I asked a similar question last year here. Operations on types iN with no<br>
> direct translation into one assembly instruction seem to be translated into<br>
> several ones correctly.<br>
><br>
<br>
In my experience this is *definitely* not true in practise, at least<br>
on x86. Using larger than 128-bit integers we have hit assertion<br>
failures, crashes and miscompiles. Things are even worse for vectors<br>
of non-legal(?) types (say <2 x i2>).<br>
<br>
Some of the issue that we hit after giving up on vectorized code and<br>
relying directly on LLVM for wider-than-legal types:<br>
<br>
<a href="http://llvm.org/bugs/show_bug.cgi?id=20011" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=20011</a> (crash with <2 x i2>)<br>
<a href="http://llvm.org/bugs/show_bug.cgi?id=20012" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=20012</a> (error when storing <2 x i4>)<br>
<a href="http://llvm.org/bugs/show_bug.cgi?id=19797" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=19797</a> (assert failure on<br>
multiplication of i192)<br>
<a href="http://llvm.org/bugs/show_bug.cgi?id=20921" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=20921</a> (assert failure on stores<br>
and loads of i193)<br>
<a href="http://llvm.org/bugs/show_bug.cgi?id=21184" target="_blank">http://llvm.org/bugs/show_bug.cgi?id=21184</a> (miscompilation of<br>
wider-than-legal types)<br>
<br>
I would *really* wish that the documentation made sure to mention,<br>
that wider-than-legal types are not expected to work.<br>
<br>
<br>
- Jaak<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div><br></div>