FAQ
The assembly syntax is not really platform-independent. It is,
however, somewhat unified to make things look more regular across
different architectures, primarily for our own sanity. For example,
instruction arguments are always src, dst, regardless of what the
manufacturer's assembler does.

The specific instructions you are looking for already exist. Look in
math/big/arith_amd64.s for DX:AX to find examples. I fully admit you'd
never have guessed that syntax: the assembler is woefully
underdocumented. However, this is also a bit of a special case. Most
of the instructions are easier to find.

Russ

Search Discussions

  • Daniel Liden at Nov 26, 2012 at 3:28 pm
    Hi Ross.

    The SHLD instruction ("SHLD-Double Precision Shift Left") [1] was simply
    an example of a platform specific instruction which is to my knowledge
    only available on x86 processors.

    I was unable to locate it in the assembly lexer:
    http://golang.org/src/cmd/6a/lex.c

    Based on the current naming convention it should probably have been
    named something along the lines of "SHLDQ", "SHLDL" and "SHLDW".

    Having a unified format for src, dst operands makes sence. Are there any
    plans to provide any documentation of the assembly syntax? That would be
    very valuable.

    [1]: http://download.intel.com/products/processor/manual/253666.pdf
    (page: 530)

    /Daniel and Robin
    On 11/26/2012 04:02 PM, Russ Cox wrote:
    The assembly syntax is not really platform-independent. It is,
    however, somewhat unified to make things look more regular across
    different architectures, primarily for our own sanity. For example,
    instruction arguments are always src, dst, regardless of what the
    manufacturer's assembler does.

    The specific instructions you are looking for already exist. Look in
    math/big/arith_amd64.s for DX:AX to find examples. I fully admit you'd
    never have guessed that syntax: the assembler is woefully
    underdocumented. However, this is also a bit of a special case. Most
    of the instructions are easier to find.

    Russ
  • Ron minnich at Nov 26, 2012 at 4:23 pm
    Maybe I'm missing something but can't the standard as do what you
    need? You can write the function entry/exit to conform to what go
    expects and then just use it. Or not?

    ron
  • Ian Lance Taylor at Nov 26, 2012 at 4:24 pm

    On Mon, Nov 26, 2012 at 7:28 AM, Daniel Liden wrote:
    The SHLD instruction ("SHLD-Double Precision Shift Left") [1] was simply an
    example of a platform specific instruction which is to my knowledge only
    available on x86 processors.

    I was unable to locate it in the assembly lexer:
    http://golang.org/src/cmd/6a/lex.c

    Based on the current naming convention it should probably have been named
    something along the lines of "SHLDQ", "SHLDL" and "SHLDW".
    It's simply called SHLQ. The instruction changes based on the
    operands. To get Intel SHLD from 6a, use a DX:AX operand.

    In general processor-specific instructions are added as needed.

    Ian
  • Daniel Liden at Nov 26, 2012 at 4:55 pm
    Thank you, this helped me out a lot.
    I got the right instruction by using the previously mentioned syntax:
    SHLQ $8, AX:BX

    It would be great if this was documented in the future.

    Cheers
    /Daniel and Robin
    On 11/26/2012 05:24 PM, Ian Lance Taylor wrote:
    On Mon, Nov 26, 2012 at 7:28 AM, Daniel Liden wrote:
    The SHLD instruction ("SHLD-Double Precision Shift Left") [1] was simply an
    example of a platform specific instruction which is to my knowledge only
    available on x86 processors.

    I was unable to locate it in the assembly lexer:
    http://golang.org/src/cmd/6a/lex.c

    Based on the current naming convention it should probably have been named
    something along the lines of "SHLDQ", "SHLDL" and "SHLDW".
    It's simply called SHLQ. The instruction changes based on the
    operands. To get Intel SHLD from 6a, use a DX:AX operand.

    In general processor-specific instructions are added as needed.

    Ian

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedNov 26, '12 at 3:02p
activeNov 26, '12 at 4:55p
posts5
users4
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase