Remove unused SSE vector from compressonator

This commit is contained in:
baldurk
2020-10-26 10:19:53 +00:00
parent e8f6156df3
commit 985ce847e4
-164
View File
@@ -395,170 +395,6 @@ public:
#include <float.h>
#include <math.h>
#include <stdio.h>
#include "xmmintrin.h"
// SSE Vec4
#ifdef _LINUX
class CMP_SSEVec4f
#else
#include "intrin.h"
class __declspec(align(16)) CMP_SSEVec4f
#endif
{
public:
union
{
__m128 vec128; // float Vector 128 bits in total (16 Bytes) = array of 4 floats
#ifdef _LINUX
float f32[4];
#endif
};
// constructors
inline CMP_SSEVec4f(){};
inline CMP_SSEVec4f(float x, float y, float z, float w) : vec128(_mm_setr_ps(x, y, z, w)){};
inline CMP_SSEVec4f(__m128 vec) : vec128(vec) {}
inline CMP_SSEVec4f(const float *data) : vec128(_mm_load_ps(data)){};
inline CMP_SSEVec4f(float scalar) : vec128(_mm_load1_ps(&scalar)){};
// copy and assignment
inline CMP_SSEVec4f(const CMP_SSEVec4f &init) : vec128(init.vec128){};
inline const CMP_SSEVec4f &operator=(const CMP_SSEVec4f &lhs)
{
vec128 = lhs.vec128;
return *this;
};
// conversion to m128 type for direct use in _mm intrinsics
inline operator __m128() { return vec128; };
inline operator const __m128() const { return vec128; };
// indexing
#ifdef _LINUX
inline const float &operator[](int i) const { return f32[i]; };
inline float &operator[](int i) { return f32[i]; };
#else
inline const float &operator[](int i) const { return vec128.m128_f32[i]; };
inline float &operator[](int i) { return vec128.m128_f32[i]; };
#endif
// addition
inline CMP_SSEVec4f operator+(const CMP_SSEVec4f &rhs) const
{
return CMP_SSEVec4f(_mm_add_ps(vec128, rhs.vec128));
};
inline CMP_SSEVec4f &operator+=(const CMP_SSEVec4f &rhs)
{
vec128 = _mm_add_ps(vec128, rhs.vec128);
return *this;
};
// multiplication
inline CMP_SSEVec4f operator*(const CMP_SSEVec4f &rhs) const
{
return CMP_SSEVec4f(_mm_mul_ps(vec128, rhs.vec128));
};
inline CMP_SSEVec4f &operator*=(const CMP_SSEVec4f &rhs)
{
vec128 = _mm_mul_ps(vec128, rhs.vec128);
return *this;
};
// scalar multiplication
// inline CMP_SSEVec4f operator*( float rhs ) const { return CMP_SSEVec4f( _mm_mul_ps(vec128,
// _mm_load1_ps(&rhs)) ); };
// inline CMP_SSEVec4f& operator*=( float rhs ) { vec128 = _mm_mul_ps(vec128,
// _mm_load1_ps(&rhs)); return *this; };
// subtraction
inline CMP_SSEVec4f operator-(const CMP_SSEVec4f &rhs) const
{
return CMP_SSEVec4f(_mm_sub_ps(vec128, rhs.vec128));
};
inline CMP_SSEVec4f &operator-=(const CMP_SSEVec4f &rhs)
{
vec128 = _mm_sub_ps(vec128, rhs.vec128);
return *this;
};
// division
inline CMP_SSEVec4f operator/(const CMP_SSEVec4f &rhs) const
{
return CMP_SSEVec4f(_mm_div_ps(vec128, rhs.vec128));
};
inline CMP_SSEVec4f &operator/=(const CMP_SSEVec4f &rhs)
{
vec128 = _mm_div_ps(vec128, rhs.vec128);
return *this;
};
// scalar division
inline CMP_SSEVec4f operator/(float rhs) const
{
return CMP_SSEVec4f(_mm_div_ps(vec128, _mm_load1_ps(&rhs)));
};
inline CMP_SSEVec4f &operator/=(float rhs)
{
vec128 = _mm_div_ps(vec128, _mm_load1_ps(&rhs));
return *this;
};
// comparison
// these return 0 or 0xffffffff in each component
inline CMP_SSEVec4f operator<(const CMP_SSEVec4f &rhs) const
{
return CMP_SSEVec4f(_mm_cmplt_ps(vec128, rhs.vec128));
};
inline CMP_SSEVec4f operator>(const CMP_SSEVec4f &rhs) const
{
return CMP_SSEVec4f(_mm_cmpgt_ps(vec128, rhs.vec128));
};
inline CMP_SSEVec4f operator<=(const CMP_SSEVec4f &rhs) const
{
return CMP_SSEVec4f(_mm_cmple_ps(vec128, rhs.vec128));
};
inline CMP_SSEVec4f operator>=(const CMP_SSEVec4f &rhs) const
{
return CMP_SSEVec4f(_mm_cmpge_ps(vec128, rhs.vec128));
};
inline CMP_SSEVec4f operator==(const CMP_SSEVec4f &rhs) const
{
return CMP_SSEVec4f(_mm_cmpeq_ps(vec128, rhs.vec128));
};
// bitwise operators
inline CMP_SSEVec4f operator|(const CMP_SSEVec4f &rhs) const
{
return CMP_SSEVec4f(_mm_or_ps(vec128, rhs.vec128));
};
inline CMP_SSEVec4f operator&(const CMP_SSEVec4f &rhs) const
{
return CMP_SSEVec4f(_mm_and_ps(vec128, rhs.vec128));
};
inline CMP_SSEVec4f operator^(const CMP_SSEVec4f &rhs) const
{
return CMP_SSEVec4f(_mm_xor_ps(vec128, rhs.vec128));
};
inline const CMP_SSEVec4f &operator|=(const CMP_SSEVec4f &rhs)
{
vec128 = _mm_or_ps(vec128, rhs.vec128);
return *this;
};
inline const CMP_SSEVec4f &operator&=(const CMP_SSEVec4f &rhs)
{
vec128 = _mm_and_ps(vec128, rhs.vec128);
return *this;
};
// for some horrible reason,there's no bitwise not instruction for SSE,
// so we have to do xor with 0xfffffff in order to fake it.
// TO get a 0xffffffff, we execute 0=0
inline CMP_SSEVec4f operator~() const
{
__m128 zero = _mm_setzero_ps();
__m128 is_true = _mm_cmpeq_ps(zero, zero);
return _mm_xor_ps(is_true, vec128);
};
};
typedef Vec4<float> CMP_Vec4f;
typedef Vec4<double> CMP_Vec4d;