This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Options of fixing biggest alignment in PR target/38736
On Fri, Jan 9, 2009 at 4:59 PM, Ian Lance Taylor <iant@google.com> wrote:
> "Richard Guenther" <richard.guenther@gmail.com> writes:
>
>> On Fri, Jan 9, 2009 at 4:31 PM, Ian Lance Taylor <iant@google.com> wrote:
>>> "Richard Guenther" <richard.guenther@gmail.com> writes:
>>>
>>>>> There are many ways to align data without exposing it in the
>>>>> ABI--e.g., the alignment of a global array is not part of the ABI, in
>>>>> that nothing breaks if the alignment is increased. Also, there are
>>>>> many programs which simply don't care about an external ABI.
>>>>
>>>> I'd say if programs want to use vectorization they should use
>>>> alignof (vector_type) instead of a magic attribute((aligned(max))).
>>>
>>> It's not that programs explicitly want to use vectorization. It's
>>> that auto-vectorization happens on ordinary scalar types, and programs
>>> want to permit that to happen without worrying about the details.
>>
>> Sure. The vectorizer increases alignment of variables for this reason.
>> But as people cannot adjust their memory allocator behavior they
>> cannot use attribute((aligned(max))) for that either. Or do you suggest
>> they should stick that on every decl? (which is what the autovectorizer
>> does)
>
> People can and do adjust their memory allocator. Doing that in
> portable code requires something like attribute((aligned)).
Well. As HJ says, an attribute((aligned)) is not the best way to
communicate this. You would need sth like
char a[] __attribute__((aligned));
and then query alignof (a) for your alignment bit-twiddling inside
your allocator. Certainly possible, but also "interesting" use
of attribute((aligned)) ;)
Richard.