Merge pull request #322 from mmp/vector-constants

Vector constants
This commit is contained in:
Jean-Luc Duprat
2012-07-09 09:28:26 -07:00
6 changed files with 89 additions and 23 deletions

View File

@@ -287,7 +287,7 @@ static FORCEINLINE void __insert_element(__vec4_i1 *v, int index, bool val) {
((int32_t *)v)[index] = val ? -1 : 0;
}
template <int ALIGN> static FORCEINLINE __vec4_i1 __load(__vec4_i1 *v) {
template <int ALIGN> static FORCEINLINE __vec4_i1 __load(const __vec4_i1 *v) {
// FIXME: handle align of 16...
return _mm_loadu_ps((float *)(&v->v));
}
@@ -573,7 +573,7 @@ static FORCEINLINE __vec4_i8 __shuffle2_i8(__vec4_i8 v0, __vec4_i8 v1,
return __vec4_i8(r[0], r[1], r[2], r[3]);
}
template <int ALIGN> static FORCEINLINE __vec4_i8 __load(__vec4_i8 *v) {
template <int ALIGN> static FORCEINLINE __vec4_i8 __load(const __vec4_i8 *v) {
uint8_t *ptr = (uint8_t *)(&v->v);
return __vec4_i8(ptr[0], ptr[1], ptr[2], ptr[3]);
}
@@ -840,7 +840,7 @@ static FORCEINLINE __vec4_i16 __shuffle2_i16(__vec4_i16 v0, __vec4_i16 v1,
return __vec4_i16(r[0], r[1], r[2], r[3]);
}
template <int ALIGN> static FORCEINLINE __vec4_i16 __load(__vec4_i16 *v) {
template <int ALIGN> static FORCEINLINE __vec4_i16 __load(const __vec4_i16 *v) {
uint16_t *ptr = (uint16_t *)(&v->v);
return __vec4_i16(ptr[0], ptr[1], ptr[2], ptr[3]);
}
@@ -1093,7 +1093,7 @@ static FORCEINLINE __vec4_i32 __shuffle2_i32(__vec4_i32 v0, __vec4_i32 v1,
return __vec4_i32(r[0], r[1], r[2], r[3]);
}
template <int ALIGN> static FORCEINLINE __vec4_i32 __load(__vec4_i32 *v) {
template <int ALIGN> static FORCEINLINE __vec4_i32 __load(const __vec4_i32 *v) {
// FIXME: handle align of 16...
return _mm_loadu_si128((__m128i *)(&v->v));
}
@@ -1363,7 +1363,7 @@ static FORCEINLINE __vec4_i64 __shuffle2_i64(__vec4_i64 v0, __vec4_i64 v1,
return __vec4_i64(r[0], r[1], r[2], r[3]);
}
template <int ALIGN> static FORCEINLINE __vec4_i64 __load(__vec4_i64 *v) {
template <int ALIGN> static FORCEINLINE __vec4_i64 __load(const __vec4_i64 *v) {
// FIXME: handle align of 16...
return __vec4_i64(_mm_loadu_si128((__m128i *)(&v->v[0])),
_mm_loadu_si128((__m128i *)(&v->v[1])));
@@ -1474,7 +1474,7 @@ static FORCEINLINE __vec4_f __shuffle2_float(__vec4_f v0, __vec4_f v1,
return __vec4_f(r[0], r[1], r[2], r[3]);
}
template <int ALIGN> static FORCEINLINE __vec4_f __load(__vec4_f *v) {
template <int ALIGN> static FORCEINLINE __vec4_f __load(const __vec4_f *v) {
// FIXME: handle align of 16...
return _mm_loadu_ps((float *)(&v->v));
}
@@ -1615,7 +1615,7 @@ static FORCEINLINE __vec4_d __shuffle2_double(__vec4_d v0, __vec4_d v1,
return __vec4_d(r[0], r[1], r[2], r[3]);
}
template <int ALIGN> static FORCEINLINE __vec4_d __load(__vec4_d *v) {
template <int ALIGN> static FORCEINLINE __vec4_d __load(const __vec4_d *v) {
// FIXME: handle align of 16...
return __vec4_d(_mm_loadu_pd((double *)(&v->v[0])),
_mm_loadu_pd((double *)(&v->v[1])));