views:

164

answers:

1

I'm trying to break into SSE2 and tried the following example program:

#include "stdafx.h"    
#include <emmintrin.h>

int main(int argc, char* argv[])
{
__declspec(align(16)) long mul; // multiply variable
__declspec(align(16)) int t1[100000]; // temporary variable
__declspec(align(16)) int t2[100000]; // temporary variable
__m128i mul1, mul2;
 for (int j = 0; j < 100000; j++)
 {
 t1[j] = j;
 t2[j] = j+1;
 } // set temporary variables to random values
 _asm
 {
  mov eax, 0
  label: movdqa xmm0, xmmword ptr [t1+eax]
  movdqa xmm1, xmmword ptr [t2+eax]
  pmuludq xmm0, xmm1
  movdqa mul1, xmm0
  movdqa xmm0, xmmword ptr [t1+eax]
  pshufd xmm0, xmm0, 05fh
  pshufd xmm1, xmm1, 05fh
  muludq xmm0, xmm1
  movdqa mul2, xmm0
  add eax, 16
  cmp eax, 100000
  jnge label
 }
 return 0;
 }

And get the following warnings and errors:

warning C4405: 'xmm0' : identifier is reserved word

error C2400: inline assembler syntax error in 'opcode'; found 'xmm0'

I tried searching for possible causes but most of the people who share my issues used Visual C++ 6.0, whereas I use Visual C++ 8.0.

Any suggestions?

+2  A: 

Well the error goes away if you change

muludq xmm0, xmm1

to

pmuludq xmm0, xmm1

Are you sure you didn't just miss a p there?

Edit: In fact im pretty definite you did because I've never heard of muludq. In fact i replaced it with mcow (which i KNOW doesn't exist) and got the same error.

Goz
You're completely right - I guess the author of that tutorial missed the 'p' although he didn't forget in a preceding instruction, thanks!
Jacob