seeker010
New member
Code:
#include <iostream>
using namespace std;
typedef float v2sf __attribute__ ((vector_size (2*sizeof(float))));
union f2vector{
v2sf v;
float f[2];
};
const f2vector operator*(const f2vector &a, const f2vector &b){
f2vector tmp;
tmp.v = __builtin_ia32_pfmul (a.v,b.v);
return tmp;
}
int main(){
union f2vector a, b, c;
a.f[0] = 1; a.f[1] = 2;
b.f[0] = 5; b.f[1] = 6;
c = a * b;
cout << c.f[0] << ' ' << c.f[1] << endl;
return 0;
}
Code:
#include <iostream>
using namespace std;
typedef float v2sf __attribute__ ((vector_size (2*sizeof(float))));
union f2vector{
v2sf v;
float f[2];
};
const f2vector operator*(const f2vector &a, const f2vector &b){
__builtin_ia32_femms();
f2vector tmp;
tmp.v = __builtin_ia32_pfmul (a.v,b.v);
__builtin_ia32_femms();
return tmp;
}
int main(){
union f2vector a, b, c;
a.f[0] = 1; a.f[1] = 2;
b.f[0] = 5; b.f[1] = 6;
c = a * b;
cout << c.f[0] << ' ' << c.f[1] << endl;
return 0;
}
I thought FEMMS was optional on athlon hardware because 3dnow no longer maps on to the fpu registers?