[cfe-commits] [llvm-commits] [PATCH] __builtin_assume_aligned for Clang and LLVM
Chandler Carruth
chandlerc at google.com
Sat Dec 1 02:18:17 PST 2012
Thanks Richard!
On Sat, Dec 1, 2012 at 1:53 AM, Richard Smith <richard at metafoo.co.uk> wrote:
> Note that these are actually very different, and Clang currently gets the
>> C++11 one wrong.
>> GCC alignment attribute: makes the *type* be aligned to the specified
>> amount.
>> C++11 alignment attribute: makes the *storage* be aligned to the
>> specified amount. (I think.. I'll check w/ Richard on Monday)
>>
>
> The C++11 attribute can be used in two ways (neither is what you want
> here):
> * On the declaration of a variable or data member, to overalign the
> storage of that entity
> * On the definition of a tag type, to overalign all objects of that type
>
Ok, so it can impact a tag type, not a typedef. Cool.
Anyways, I agree it doesn't really help...
> I suppose you could do this:
>
> template<typename T, size_t Align> struct alignas(Align) overaligned { T
> value; };
> void foo(overaligned<double, 16> *a, overaligned<double, 16>) {
> // ...
> }
>
I think this suffers from the same problem as the typedef and GCC attribute.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121201/f6e3fa77/attachment.html>
More information about the cfe-commits
mailing list