On 6 January 2012 21:34, Walter Bright <newshound2@digitalmars.com> wrote:
On 1/6/2012 11:08 AM, Manu wrote:
I think we should take this conversation to IRC, or a separate thread?
I'll generate some examples from VC for you in various situations. If you can
write me a short list of trouble cases as you see them, I'll make sure to
address them specifically...
Have you tested the code that GCC produces? I'm sure it'll be identical to VC...

What I'm going to do is make the SIMD stuff work on 64 bits for now. The alignment problem is solved for it, and is an orthogonal issue.

...I'm using DMD on windows... x32. So this isn't ideal ;)
Although with this change, Iain should be able to expose the vector types in GDC, and I can work from there, and hopefully even build an ARM/PPC toolchain to experiment with the library in a cross platform environment.

That said, how do you currently support ANY aligned type? I thought align(n) was
a defined keyword in D?

Yes, but the alignment is only as good as the alignment underlying it. For example, anything in segments can be aligned to 16 bytes or less, because the segments are aligned to 16 bytes. Anything allocated with new can be aligned to 16 bytes or less.

The stack, however, is aligned to 4, so trying to align things on the stack by 8 or 16 will not work.

... this sounds bad. Shall I start another thread? ;)
So you're saying it's impossible to align a stack based buffer to, say, 128 bytes... ?
This is another fairly important daily requirement of mine (that I assumed was currently supported). Aligning buffers to cache lines is common, and is required for many optimisations.

Hopefully the work you do to support 16byte alignment on x86 will also support arbitrary alignment of any buffer...
Will arbitrary alignment be supported on x64?
What about GCC? Will/does it support arbitrary alignment?