How do you do inline assembly with vector types in GCC?

From: michael (michael.moy.1995_at_alum.bu.edu)
Date: 05/18/04


Date: Tue, 18 May 2004 20:13:26 +0000 (UTC)

I'm trying to port some MSVC++ SSE2 inline assembler to GCC and am playing
with a code fragment to see if I can move stuff in and out of vectors as
follows:

#include <stdio.h>

int main() {
char sse2_array[16] __attribute__((aligned(16)));
unsigned long p;
  p = 10;
  printf("%d \n", p);
  sse2_array[0] = 1;
  sse2_array[2] = 2;
  printf("%d %d\n", sse2_array[0], sse2_array[1]);
  asm("pxor %xmm0, %xmm0");
  asm("movdqa %xmm0, %0;"
      :"=r"(sse2_array));
  printf("%d \n", p);
  return 0;

}

I get the following message when I try to do this:

gcc mike.c
mike.c: In function `main':
mike.c:12: incompatible types in assignment

Anyone have an easy way to do this?



Relevant Pages

  • Re: Nasm 0.99.01 available
    ... I would suggest that you try using the file from gcc. ... have a handy source, let me know where I can email it to you. ... from the previously mentioned link. ... It's time to get back to playing with the compiler switches. ...
    (alt.lang.asm)
  • Re: PAR error
    ... > No compiler found, won't generate 'cript/parl' ... > I do 'which gcc' it can locate to my new gcc. ... and see if *that* compiler exists. ... We do not stop playing because we grow old; ...
    (comp.lang.perl.misc)
  • Re: How do you do inline assembly with vector types in GCC?
    ... >> with a code fragment to see if I can move stuff in and out of vectors as ... and it informs gcc that you're modifying the %xmm0 register. ...
    (comp.lang.asm.x86)
  • Re: How do you do inline assembly with vector types in GCC?
    ... >> with a code fragment to see if I can move stuff in and out of vectors as ... >> gcc mike.c ... to compile. ...
    (comp.lang.asm.x86)
  • Re: How do you do inline assembly with vector types in GCC?
    ... "michael" wrote in message ... > with a code fragment to see if I can move stuff in and out of vectors as ... > gcc mike.c ... Use GCC's vector types instead of char. ...
    (comp.lang.asm.x86)