<div dir="ltr">On 6 February 2013 18:02, David Given <span dir="ltr"><<a href="mailto:dg@cowlark.com" target="_blank">dg@cowlark.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I have actually been reading up on the vectorizer. I'm using LLVM 3.2,<br>
so the vectorizer isn't turned on by default. </blockquote><div><br></div><div style>Not just that, but there is also a lot more coverage since last release (including floating points).</div><div><br></div><div><br></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Would it be feasible to<br>
explicitly *not* use vectors --- switching to aggregates instead --- and<br>
then rely on the vectorizer to autovectorize the code where appropriate?<br></blockquote><div><br></div><div><br></div><div style>It depends. If you use vectors that are within the boundaries of the target's vector sizes, than you can possibly generate better code directly. For instance, if your array has only 3 elements <3 x float>, the vectorizer could think it's not worth to change it. But if you generated all in vector types all the way through, the cost of using vector engines is reduced, and it may be worth even if the vectorizer thinks otherwise. As usual, this is not always true, as sometimes the vectorizer sees patterns you don't, or can add run-time checks to do selective vectorization and so on.</div>
<div style><br></div><div style>In the long term, I think it's best to expect the compiler to do the hard work for you, and teach the compiler to recognize such cases, than add special cases on your own programs. As of now, though, you may have to balance.</div>
<div style><br></div><div style>It'd be interesting to see a comparison of IRs and benchmarks for programs running with long vectors vs. arrays, and short non-power-of-two vectors vs. arrays.</div><div style><br></div>
<div style>cheers,</div><div style>--renato</div></div></div></div>