I have two Arrays and I want to get the dot product. How do I get the values of vek and vec into xmm0 and xmm1? And how do I get the Value standing in xmm1 (??) so that I can use it for "printf"?
#include <stdio.h>
main(){
float vek[4] = {4.0, 3.0, 2.0, 1.0};
float vec[4] = {1.0, 2.0, 3.0, 4.0};
asm(
"DPPS $0xFF, %xmm0, %xmm1"
??
);
printf( "Result: %f\n, ??)
}
As
@Mysticial
rightly says, use intrinsics rather than raw assembler:Note that not all compilers support the
%v
format specifier for SIMD values - if your compiler doesn't then you'll need to implement a suitable method for printing the result, e.g. use a union.