[llvm-commits] patch: fix emission of npot vectors which need trailing padding

Eli Friedman eli.friedman at gmail.com
Tue Jun 21 16:31:02 PDT 2011


On Tue, Jun 21, 2011 at 4:19 PM, Nick Lewycky <nlewycky at google.com> wrote:
> Hi Renato! Sorry, but I don't understand your reply at all.
> The correctness of this patch is dependent on whether an LLVM vector should
> ever have trailing padding (not element padding). If the answer is no
> regardless of platform, then we should add an assertion in this spot instead
> of code to write out padding.
> There's nothing ARM-specific about this change, which is why it belongs in
> generic CodeGen and shouldn't be in the ARMAsmPrinter. It just so happens
> that <3 x float> on ARM provides a counter-example that would require this
> padding or trigger this assertion.

Take the following on x86:

typedef float float3 __attribute__((ext_vector_type(3)));
int printf(const char*,...);
struct Foo { float3 x, y; };
struct Foo foo = { {1,2,3}, {1, 2, 3} };
int main() { float3 y = foo.y; printf("%f\n", y[2]); return 0; }

It currently gets miscomputed because of this issue... so definitely
not ARM-specific.

-Eli




More information about the llvm-commits mailing list