By: Gabriele Svelto (gabriele.svelto.delete@this.gmail.com), November 6, 2006 4:10 am
Room: Moderated Discussions
Wilco (Wilco.Dijkstra@ntlworld.com) on 11/4/06 wrote:
---------------------------
>Unaligned accesses are used a lot in the embedded space. Most, if not all, embedded
>compilers have extensions that allow you to specify the alignment of all types,
>including over and underalignment. In the compiler I used to work on we implemented
>a __packed type qualifier which basically changes the natural aligment of a type
>to 1. Very simple and effective (much better than the #pragma pack hack).
Yeah, I know that but I tend to let the compiler handle properly the unaligned stuff as I marked it as clearly unaligned. Unless you've got that kind of accesses all over the place the compiler does a good job usually when handling them both from a code-size and performance POV. Anyway I've not worked on embedded OS-level stuff (luckily) so I might not know how troublesome it can be there.
>Unaligned accesses are used a lot to access data that comes in via peripherals,
>to squeeze as much data into small memories, to enable old code (x86/68k) to run
>correctly, and to speed up byte oriented routines (eg. string functions). It is
>very useful when doing compression, and can dramatically speed up motion compensation.
>Hardware unaligned support is essential when doing SIMD. Not allowing unaligned
>access was the single biggest mistake of Altivec.
Do you think it was? After all AltiVec provides a way of loading unaligned data which is essentially free for any implementation out there provided you're not bottlenecked by AltiVec dispatch bandwidth (which is quite hard in my experience, the bottleneck is way more often sheer memory bandwidth).
>From my compiler experience I would say unaligned access is at least as important
>in the embedded space as on desktop. It was so popular in software that it was beneficial
>for ARM to add hardware support.
I might also say that you cannot rely on that unfortunately, for our ARM code we always go down the ARM-doesn't-support-unaligned-stuff route. Since there are so many offerings out there you can never be sure. BTW I heard the fab guys saying all the worst they can about the latest ARM offerings, not sure why however.
Gabriele
---------------------------
>Unaligned accesses are used a lot in the embedded space. Most, if not all, embedded
>compilers have extensions that allow you to specify the alignment of all types,
>including over and underalignment. In the compiler I used to work on we implemented
>a __packed type qualifier which basically changes the natural aligment of a type
>to 1. Very simple and effective (much better than the #pragma pack hack).
Yeah, I know that but I tend to let the compiler handle properly the unaligned stuff as I marked it as clearly unaligned. Unless you've got that kind of accesses all over the place the compiler does a good job usually when handling them both from a code-size and performance POV. Anyway I've not worked on embedded OS-level stuff (luckily) so I might not know how troublesome it can be there.
>Unaligned accesses are used a lot to access data that comes in via peripherals,
>to squeeze as much data into small memories, to enable old code (x86/68k) to run
>correctly, and to speed up byte oriented routines (eg. string functions). It is
>very useful when doing compression, and can dramatically speed up motion compensation.
>Hardware unaligned support is essential when doing SIMD. Not allowing unaligned
>access was the single biggest mistake of Altivec.
Do you think it was? After all AltiVec provides a way of loading unaligned data which is essentially free for any implementation out there provided you're not bottlenecked by AltiVec dispatch bandwidth (which is quite hard in my experience, the bottleneck is way more often sheer memory bandwidth).
>From my compiler experience I would say unaligned access is at least as important
>in the embedded space as on desktop. It was so popular in software that it was beneficial
>for ARM to add hardware support.
I might also say that you cannot rely on that unfortunately, for our ARM code we always go down the ARM-doesn't-support-unaligned-stuff route. Since there are so many offerings out there you can never be sure. BTW I heard the fab guys saying all the worst they can about the latest ARM offerings, not sure why however.
Gabriele