Hi there,

I'm trying to educate myself about the operation of some of the AVX instructions and to that end cobble together small apps to step through in GDB. I usually write assembler for Linux, but since the VM in which I run it (on my Sandybridge laptop) doesn't support AVX instructions, I've had to put it together in Windows instead. I've been using GAS since I started learning assembler, and have persisted with this approach on Windows. I'm running a 64-bit Windows 7 OS.

Unfortunately, even though I've been staring at the code for a good few hours, I still seem to be getting something wrong. When I step over the VGATHER instruction in GDB, I get a SIGILL signal; when I execute the binary from the command line, Windows tells me that the app has "stopped working" and that its searching for a solution (good luck with that).

The code looks like this:

.section .data
.align 0x10
values:
.double 10.0, 20.0, 30.0, 40.0
mask:
.quad -1, -1, -1, -1
vindices:
.quad 0, 1, 2, 3

.section .text
.globl main
main:
nop
subq $0x40, %rsp

call __main

vmovdqa      mask, %ymm3
vmovdqa      vindices, %ymm4
movq        $values, %r13
vgatherqpd  %ymm3, (%r13,%ymm4,8), %ymm5

addq $0x40, %rsp
movq $0x00, %rax
ret


My "make.bat" script looks like this:

@echo off
gcc -gstabs -o avxmul.exe -m64 avxmul.s


gcc -v emits the slightly shortened output:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/users/michaelg/applications/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/4.6.3/lto-wrapper.exe
Target: x86_64-w64-mingw32
...
Thread model: posix
gcc version 4.6.3 20111208 (prerelease) (GCC)


If anyone can spot an obvious issue, please let me know. I've not yet written a CPUID test, but will do that after as soon as I hit "post" (and put the curry in the microwave). It's a Sandybridge CPU (4-core, 2.7GHz i7-2620M), so AVX (and AVX2) should be supported, right?

Cheers guys,

Michael
Posted on 2012-02-05 15:31:57 by michaelg
Apologies... you know what they say about assumption? http://en.wikipedia.org/wiki/Advanced_Vector_Extensions#Advanced_Vector_Extensions_2 : due in 2013/14.

Still, if you can see anything wrong with what I've written, it would be good to know. Cheers.
Posted on 2012-02-05 15:37:46 by michaelg