|
|
@@ -53,7 +53,7 @@ struct Vector<float, 4> { |
|
|
|
|
|
|
|
/** Constructs a vector from four values. */ |
|
|
|
Vector(float x1, float x2, float x3, float x4) { |
|
|
|
v = _mm_set_ps(x1, x2, x3, x4); |
|
|
|
v = _mm_setr_ps(x1, x2, x3, x4); |
|
|
|
} |
|
|
|
|
|
|
|
/** Returns a vector initialized to zero. */ |
|
|
@@ -66,11 +66,6 @@ struct Vector<float, 4> { |
|
|
|
return _mm_castsi128_ps(_mm_cmpeq_epi32(_mm_setzero_si128(), _mm_setzero_si128())); |
|
|
|
} |
|
|
|
|
|
|
|
/** Constructs a vector from four values in reverse. */ |
|
|
|
static Vector setr(float x1, float x2, float x3, float x4) { |
|
|
|
return Vector(_mm_setr_ps(x1, x2, x3, x4)); |
|
|
|
} |
|
|
|
|
|
|
|
/** Reads an array of 4 values. |
|
|
|
On little-endian machines (e.g. x86), the order is reversed, so `x[0]` corresponds to `vector.s[3]`. |
|
|
|
*/ |
|
|
@@ -113,7 +108,7 @@ struct Vector<int32_t, 4> { |
|
|
|
v = _mm_set1_epi32(x); |
|
|
|
} |
|
|
|
Vector(int32_t x1, int32_t x2, int32_t x3, int32_t x4) { |
|
|
|
v = _mm_set_epi32(x1, x2, x3, x4); |
|
|
|
v = _mm_setr_epi32(x1, x2, x3, x4); |
|
|
|
} |
|
|
|
static Vector zero() { |
|
|
|
return Vector(_mm_setzero_si128()); |
|
|
@@ -121,9 +116,6 @@ struct Vector<int32_t, 4> { |
|
|
|
static Vector mask() { |
|
|
|
return Vector(_mm_cmpeq_epi32(_mm_setzero_si128(), _mm_setzero_si128())); |
|
|
|
} |
|
|
|
static Vector setr(int32_t x1, int32_t x2, int32_t x3, int32_t x4) { |
|
|
|
return Vector(_mm_setr_epi32(x1, x2, x3, x4)); |
|
|
|
} |
|
|
|
static Vector load(const int32_t *x) { |
|
|
|
// HACK |
|
|
|
// Use _mm_loadu_si128() because GCC doesn't support _mm_loadu_si32() |
|
|
|