Align ivars to 16 byte boundaries when they are larger than a pointer. This is
currently overly defensive. Add a test case for this realignment.main
parent
317e951b0c
commit
16bfdc8ee6
@ -0,0 +1,42 @@
|
||||
#include "stdio.h"
|
||||
#include "Test.h"
|
||||
|
||||
// This is a large vector type, which the compiler will lower to some sequence
|
||||
// of vector ops on the target, or scalar ops if there is no vector FPU.
|
||||
typedef double __attribute__((vector_size(32))) v4d;
|
||||
|
||||
@interface X : Test
|
||||
{
|
||||
id f;
|
||||
id g;
|
||||
}
|
||||
@end
|
||||
@implementation X @end
|
||||
|
||||
@interface Vector : X
|
||||
{
|
||||
v4d x;
|
||||
}
|
||||
@end
|
||||
@implementation Vector
|
||||
+ (Vector*)alloc
|
||||
{
|
||||
Vector *v = class_createInstance(self, 0);
|
||||
// The initialisation might be done with memset, but will probably be a
|
||||
// vector load / store and so will likely fail if x is incorrectly aligned.
|
||||
v->x = (v4d){1,2,3,4};
|
||||
return v;
|
||||
}
|
||||
- (void)permute
|
||||
{
|
||||
// This will become a sequence of one or more vector operations. We must
|
||||
// have the correct alignment for x, even after the instance variable
|
||||
// munging, or this will break.
|
||||
x *= (v4d){2,3,4,5};
|
||||
}
|
||||
@end
|
||||
|
||||
int main(void)
|
||||
{
|
||||
[[Vector alloc] permute];
|
||||
}
|
||||
Loading…
Reference in New Issue