mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
[simd] Fix some portability issues
Use [u]int64_t instead of long, and fix some incorrect attribute usage (I had misread the gcc docs at the time).
This commit is contained in:
parent
99f0cde080
commit
8309e1852a
3 changed files with 7 additions and 4 deletions
|
@ -28,6 +28,8 @@
|
||||||
#ifndef __QF_simd_types_h
|
#ifndef __QF_simd_types_h
|
||||||
#define __QF_simd_types_h
|
#define __QF_simd_types_h
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#define VEC_TYPE(t,n) typedef t n __attribute__ ((vector_size (4*sizeof (t))))
|
#define VEC_TYPE(t,n) typedef t n __attribute__ ((vector_size (4*sizeof (t))))
|
||||||
|
|
||||||
/** Three element vector type for interfacing with compact data.
|
/** Three element vector type for interfacing with compact data.
|
||||||
|
@ -51,7 +53,7 @@ VEC_TYPE (double, vec4d_t);
|
||||||
|
|
||||||
/** Used mostly for __builtin_shuffle.
|
/** Used mostly for __builtin_shuffle.
|
||||||
*/
|
*/
|
||||||
VEC_TYPE (long, vec4l_t);
|
VEC_TYPE (int64_t, vec4l_t);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** Three element vector type for interfacing with compact data.
|
/** Three element vector type for interfacing with compact data.
|
||||||
|
|
|
@ -258,7 +258,8 @@ VISIBLE
|
||||||
vec4d_t
|
vec4d_t
|
||||||
qconjd (vec4d_t q)
|
qconjd (vec4d_t q)
|
||||||
{
|
{
|
||||||
const vec4l_t neg = { 1lu << 63, 1lu << 63, 1lu << 63, 0 };
|
const uint64_t sign = UINT64_C(1) << 63;
|
||||||
|
const vec4l_t neg = { sign, sign, sign, 0 };
|
||||||
return _mm256_xor_pd (q, (__m256d) neg);
|
return _mm256_xor_pd (q, (__m256d) neg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,8 +91,8 @@ GNU89INLINE inline vec4f_t qrotf (vec4f_t a, vec4f_t b) __attribute__((const));
|
||||||
* That is, [-x, -y, -z, w].
|
* That is, [-x, -y, -z, w].
|
||||||
*/
|
*/
|
||||||
GNU89INLINE inline vec4f_t qconjf (vec4f_t q) __attribute__((const));
|
GNU89INLINE inline vec4f_t qconjf (vec4f_t q) __attribute__((const));
|
||||||
GNU89INLINE inline vec4f_t loadvec3f (const float v3[3]) __attribute__((pure, access(read_only, 1)));
|
GNU89INLINE inline vec4f_t loadvec3f (const float *v3) __attribute__((pure));
|
||||||
GNU89INLINE inline void storevec3f (float v3[3], vec4f_t v4) __attribute__((access (write_only, 1)));
|
GNU89INLINE inline void storevec3f (float *v3, vec4f_t v4);
|
||||||
GNU89INLINE inline vec4f_t normalf (vec4f_t v) __attribute__((pure));
|
GNU89INLINE inline vec4f_t normalf (vec4f_t v) __attribute__((pure));
|
||||||
GNU89INLINE inline vec4f_t magnitudef (vec4f_t v) __attribute__((pure));
|
GNU89INLINE inline vec4f_t magnitudef (vec4f_t v) __attribute__((pure));
|
||||||
GNU89INLINE inline vec4f_t magnitude3f (vec4f_t v) __attribute__((pure));
|
GNU89INLINE inline vec4f_t magnitude3f (vec4f_t v) __attribute__((pure));
|
||||||
|
|
Loading…
Reference in a new issue