Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add attributes to inline ASM blocks #50

Closed
todayman opened this issue Apr 5, 2015 · 4 comments
Closed

Add attributes to inline ASM blocks #50

todayman opened this issue Apr 5, 2015 · 4 comments
Milestone

Comments

@todayman
Copy link
Contributor

todayman commented Apr 5, 2015

DMD 2.067 deprecates the assumption that inline ASM blocks are pure, @nogc, etc. There are 3 blocks that spew several deprecation messages each. Unfortunately, I'm not sure enough with my assembly to manually verify them

The blocks are at lines 2296, 2324, 2240 in lexer.d as of 617b7c6 .

@Hackerpilot
Copy link
Collaborator

dlang-community/DCD#207

@timotheecour
Copy link
Contributor

So this hasn't been pushed to Dscanner yet right?
if you're worried about compatibility with 2.066 there's always version(...) depending on which compiler version.

@Hackerpilot
Copy link
Collaborator

I don't really want to copy/paste entire ASM blocks just for this. I have the change pushed to a branch. I'll merge that branch as soon as LDC and GDC support 2.067.

@timotheecour
Copy link
Contributor

For LDC/GDC this could take a while.

No need to copy/paste anything, how about this (I tried, it works):

// TODO:remove this when LDC/GDC supports 2.067
static if(__VERSION__<2067) enum asm_att=``;
else enum asm_att=`pure nothrow @nogc`;

ushort newlineMask(const ubyte*) pure nothrow @trusted @nogc
    {
      mixin(`asm `~asm_att~`
        {
            naked;
            movdqu XMM1, [RDI];
            mov RAX, 3;
            mov RDX, 16;
            mov R8, 0x0d0d0d0d0d0d0d0dL;
            movq XMM2, R8;
            shufpd XMM2, XMM2, 0;
            pcmpeqb XMM2, XMM1;
            mov R9, 0x0a0a0a0a0a0a0a0aL;
            movq XMM3, R9;
            shufpd XMM3, XMM3, 0;
            pcmpeqb XMM3, XMM1;
            mov R10, 0xe280a8L;
            movq XMM4, R10;
            pcmpestrm XMM4, XMM1, 0b01001100;
            movdqa XMM4, XMM0;
            mov R11, 0xe280a9L;
            movq XMM5, R11;
            pcmpestrm XMM5, XMM1, 0b01001100;
            movdqa XMM5, XMM0;
            mov RCX, 0x0a0d;
            dec RAX;
            movq XMM6, RCX;
            pcmpestrm XMM6, XMM1, 0b01001100;
            movdqa XMM6, XMM0;
            movdqa XMM7, XMM6;
            pslldq XMM7, 1;
            movdqa XMM0, XMM4;
            por XMM0, XMM5;
            por XMM7, XMM6;
            movdqa XMM1, XMM2;
            por XMM1, XMM3;
            pxor XMM7, XMM1;
            por XMM7, XMM0;
            por XMM7, XMM6;
            pmovmskb RAX, XMM7;
            and RAX, 0b0011_1111_1111_1111;
            ret;
        }
        `);
    }

@Hackerpilot Hackerpilot added this to the v0.3.0 milestone Jan 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants