digitalmars.D.learn - align(16) struct member throws an exception with movdqa
- ixid (13/13) Jun 10 2012 struct a
- jerro (4/17) Jun 10 2012 One way would be to a vector type:
- ixid (2/2) Jun 10 2012 That doesn't work for me, hence using assembler. I get:
- Trass3r (1/1) Jun 11 2012 test code please
- ixid (6/6) Jun 11 2012 import std.stdio, core.simd;
- Trass3r (4/10) Jun 11 2012 Works fine on Linux.
- ixid (2/2) Jun 11 2012 I think it has been fixed for the next version of DMD already.
- Trass3r (2/4) Jun 11 2012 Cause align doesn't work the way you think it does.
- Sean Cavanaugh (3/7) Jun 13 2012 The language align keyword can only reduce the alignment from the
- Jonathan M Davis (6/15) Jun 13 2012 Then open an enhancement request. If there's a good enough reason that a...
- Trass3r (9/13) Jun 14 2012 The doc page doesn't even clearly state this, it is incomprehensible imo...
- Kagamin (3/6) Jun 14 2012 It means it works like C's _Alignas ( constant-expression ) (C11,
- Kapps (5/18) Jun 16 2012 IIRC, you're supposed to be able to do something like align(16)
struct a { align(16) int[4] test = [1,2,3,4]; } a test; asm { movdqa XMM0, test ; addps XMM0, XMM0 ; movdpa test, XMM0 ; } This works fine with unaligned movdqu but throws an access violation exception with movdqa. Why isn't align letting me do an aligned read? How should I do an aligned read?
Jun 10 2012
On Monday, 11 June 2012 at 03:19:08 UTC, ixid wrote:struct a { align(16) int[4] test = [1,2,3,4]; } a test; asm { movdqa XMM0, test ; addps XMM0, XMM0 ; movdpa test, XMM0 ; } This works fine with unaligned movdqu but throws an access violation exception with movdqa. Why isn't align letting me do an aligned read? How should I do an aligned read?One way would be to a vector type: import core.simd; int4 test;
Jun 10 2012
That doesn't work for me, hence using assembler. I get: Internal error: ..\ztc\cgcod.c 1447
Jun 10 2012
import std.stdio, core.simd; void main() { int4 v; } Internal error: ..\ztc\cgcod.c 1447 Building Debug\dtest1.exe failed!
Jun 11 2012
import std.stdio, core.simd; void main() { int4 v; } Internal error: ..\ztc\cgcod.c 1447 Building Debug\dtest1.exe failed!Works fine on Linux. Maybe the 32Bit check doesn't work for Windoze? -m32 on Linux yields Error: SIMD vector types not supported on this platform
Jun 11 2012
I think it has been fixed for the next version of DMD already. Any idea why align isn't letting me use movdqa?
Jun 11 2012
I think it has been fixed for the next version of DMD already. Any idea why align isn't letting me use movdqa?Cause align doesn't work the way you think it does. In fact I still don't understand how it works at all.
Jun 11 2012
On 6/11/2012 7:15 AM, Trass3r wrote:The language align keyword can only reduce the alignment from the platform default (typically 8). A serious flaw if you ask me . . . .I think it has been fixed for the next version of DMD already. Any idea why align isn't letting me use movdqa?Cause align doesn't work the way you think it does. In fact I still don't understand how it works at all.
Jun 13 2012
On Thursday, June 14, 2012 00:17:25 Sean Cavanaugh wrote:On 6/11/2012 7:15 AM, Trass3r wrote:Then open an enhancement request. If there's a good enough reason that align should work the way that you want it to and not a sufficiently good reason why it shouldn't, then Walter may be willing to make the change. It may be that nothing will change, but it doesn't hurt to ask. - Jonathan M DavisThe language align keyword can only reduce the alignment from the platform default (typically 8). A serious flaw if you ask me . . . .I think it has been fixed for the next version of DMD already. Any idea why align isn't letting me use movdqa?Cause align doesn't work the way you think it does. In fact I still don't understand how it works at all.
Jun 13 2012
The doc page doesn't even clearly state this, it is incomprehensible imo: http://dlang.org/attribute.html#align "align by itself sets it to the default, which matches the default member alignment of the companion C compiler. Integer specifies the alignment which matches the behavior of the companion C compiler when non-default alignments are used." What the heck is this supposed to mean? It sounds like in any case the C compiler's value is used and the attribute is completely superfluous/useless.Cause align doesn't work the way you think it does. In fact I still don't understand how it works at all.The language align keyword can only reduce the alignment from the platform default (typically 8). A serious flaw if you ask me . . . .
Jun 14 2012
On Thursday, 14 June 2012 at 12:02:02 UTC, Trass3r wrote:What the heck is this supposed to mean? It sounds like in any case the C compiler's value is used and the attribute is completely superfluous/useless.It means it works like C's _Alignas ( constant-expression ) (C11, 6.7.5).
Jun 14 2012
On Monday, 11 June 2012 at 03:19:08 UTC, ixid wrote:struct a { align(16) int[4] test = [1,2,3,4]; } a test; asm { movdqa XMM0, test ; addps XMM0, XMM0 ; movdpa test, XMM0 ; } This works fine with unaligned movdqu but throws an access violation exception with movdqa. Why isn't align letting me do an aligned read? How should I do an aligned read?IIRC, you're supposed to be able to do something like align(16) struct a, but it doesn't work when a is created on the stack. That was the conclusion I found when trying to implement my own vector type a year ago anyways.
Jun 16 2012