Anders Cedronius
Anders Cedronius

Reputation: 2076

GCC inline SSE code

Something bugs me regarding the vector extensions.

The document: Intel® Advanced Vector Extensions Programming Reference

States:

VPSRLD ymm1, ymm2, imm8

So I went ahead and:

__asm__ (
    "vpsrld %ymm0, %ymm0, $0x4"
);

GCC 4.8.2-19ubuntu1 spits out:

Error: operand type mismatch for `vpsrld'

Then after googling without any findings I started changing stuff around and this compiles:

__asm__ (
    "vpsrld  $0x4, %ymm0, %ymm0"
);

Anyone has any idea why anyone would change order compared to the reference guide?

Thank you for any help.

Upvotes: 0

Views: 312

Answers (1)

Dirk
Dirk

Reputation: 10968

I think that's because the GNU Assembler that's being used most often in the GCC toolchain uses the AT&T assembler syntax, which has a different operand order than the Intel one.

For example mov eax, 5 in Intel format becomes mov $5, %eax in AT&T.

You can find some information about those two version on Wikipedia.

Upvotes: 2

Related Questions