INLINE int equal(f4vector v1, f4vector v2) { #if defined(__SSE__) #if (__GNUC__ == 4) && (__GNUC_MINOR__ < 4) v4si compare = __builtin_ia32_cmpeqps( v1.v, v2.v ); return __builtin_ia32_movmskps( (v4sf)compare ) == 0x0f; #else v4sf compare = __builtin_ia32_cmpeqps( v1.v, v2.v ); return __builtin_ia32_movmskps( compare ) == 0x0f; #endif #else return ( v1.f[0] == v2.f[0] && v1.f[1] == v2.f[1] && v1.f[2] == v2.f[2] && v1.f[3] == v2.f[3] ); #endif }
/*! <em>Pointwise Equality</em> of vA and vB. */ inline int vec4f_eq(vec4f vA, vec4f vB) { #if defined(__SSE__) /* SSE */ vec4i compare = __builtin_ia32_cmpeqps((vec4f)vA, (vec4f)vB); return __builtin_ia32_movmskps((vec4f)compare); #else /* Scalar */ float * s1 = (float*)&vA; float * s2 = (float*)&vB; return (s1[0] == s2[0] and s1[1] == s2[1] and s1[2] == s2[2] and s1[3] == s2[3]); #endif }
void cmpeqps(float * arg1,float * arg2,float * retval) { v4sf x = __builtin_ia32_loadups(arg1); v4sf y = __builtin_ia32_loadups(arg2); __builtin_ia32_storeups(retval,__builtin_ia32_cmpeqps(x,y)); }