[Issue 15144] New: Bad operand size in asm { movdqa ... } produces bogus ubyte16 initializer error elsewhere.

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Oct 3 09:34:41 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=15144

          Issue ID: 15144
           Summary: Bad operand size in asm { movdqa ... } produces bogus
                    ubyte16 initializer error elsewhere.
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: diagnostic
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: Marco.Leise at gmx.de

--- CODE ---

void foo()
{
    version (D_InlineAsm_X86_64)
    {
        alias csXMM = SSEFromString!`abc`;
        asm @nogc nothrow
        {
            movdqa      XMM0, [csXMM];
        }
    }
    else static assert(0, "Not implemented");
}


template SSEFromString(string str)
{
    import core.simd, std.algorithm, std.range;
    enum ubyte16 SSEFromString = chain(str, '\0'.repeat(ubyte16.sizeof -
str.length)).array;
}

--- ---- ---

Prints:
  Error: integer constant expression expected instead of
cast(__vector(ubyte[16]))[cast(ubyte)97u, cast(ubyte)98u, cast(ubyte)99u,
cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u,
cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u,
cast(ubyte)0u, cast(ubyte)0u, cast(ubyte)0u]
  Error: bad type/size of operands 'movdqa'

The nature of the message (hinting at incorrect initializer syntax) makes you
think only integer constants are allowed in DMD as SIMD initializers, while in
fact, fixing the asm-block will make the primary error go away and the code
compile.
(Does this message still make any sense at all with SIMD? DMD accepts other
things than integer constants for a while now.)

--


More information about the Digitalmars-d-bugs mailing list