Jump to page: 1 2
Thread overview
align(16) struct member throws an exception with movdqa
Jun 11, 2012
ixid
Jun 11, 2012
jerro
Jun 11, 2012
ixid
Jun 11, 2012
Trass3r
Jun 11, 2012
ixid
Jun 11, 2012
Trass3r
Jun 11, 2012
ixid
Jun 11, 2012
Trass3r
Jun 14, 2012
Sean Cavanaugh
Jun 14, 2012
Jonathan M Davis
Jun 14, 2012
Trass3r
Jun 14, 2012
Kagamin
Jun 17, 2012
Kapps
June 11, 2012
    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?
June 11, 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;
June 11, 2012
That doesn't work for me, hence using assembler. I get:
Internal error: ..\ztc\cgcod.c 1447
June 11, 2012
test code please
June 11, 2012
import std.stdio, core.simd;

void main()
{   int4 v;
}

Internal error: ..\ztc\cgcod.c 1447
Building Debug\dtest1.exe failed!

June 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
June 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?

June 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.
June 14, 2012
On 6/11/2012 7:15 AM, Trass3r wrote:
>> 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.

The language align keyword can only reduce the alignment from the platform default (typically 8).  A serious flaw if you ask me . . . .
June 14, 2012
On Thursday, June 14, 2012 00:17:25 Sean Cavanaugh wrote:
> On 6/11/2012 7:15 AM, Trass3r wrote:
> >> 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.
> 
> The language align keyword can only reduce the alignment from the platform default (typically 8).  A serious flaw if you ask me . . . .

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 Davis
« First   ‹ Prev
1 2