|
Line
Link Here
|
| 0 |
-- a/include/QF/simd/types.h |
0 |
++ b/include/QF/simd/types.h |
|
Lines 39-45
Link Here
|
| 39 |
*/ |
39 |
*/ |
| 40 |
typedef double vec3d_t[3]; |
40 |
typedef double vec3d_t[3]; |
| 41 |
|
41 |
|
| 42 |
#ifdef __AVX__ |
42 |
#ifdef __AVX2__ |
| 43 |
/** Four element vector type for horizontal (AOS) vector data. |
43 |
/** Four element vector type for horizontal (AOS) vector data. |
| 44 |
* |
44 |
* |
| 45 |
* This is used for both vectors (3D and 4D) and quaternions. 3D vectors |
45 |
* This is used for both vectors (3D and 4D) and quaternions. 3D vectors |
| 46 |
-- a/include/QF/simd/vec4d.h |
46 |
++ b/include/QF/simd/vec4d.h |
|
Lines 28-34
Link Here
|
| 28 |
#ifndef __QF_simd_vec4d_h |
28 |
#ifndef __QF_simd_vec4d_h |
| 29 |
#define __QF_simd_vec4d_h |
29 |
#define __QF_simd_vec4d_h |
| 30 |
|
30 |
|
| 31 |
#ifdef __AVX__ |
31 |
#ifdef __AVX2__ |
| 32 |
#include <immintrin.h> |
32 |
#include <immintrin.h> |
| 33 |
|
33 |
|
| 34 |
#include "QF/simd/types.h" |
34 |
#include "QF/simd/types.h" |
| 35 |
-- a/libs/util/test/test-simd.c |
35 |
++ b/libs/util/test/test-simd.c |
|
Lines 48-54
Link Here
|
| 48 |
|
48 |
|
| 49 |
#define s05 0.70710678118654757 |
49 |
#define s05 0.70710678118654757 |
| 50 |
|
50 |
|
| 51 |
#ifdef __AVX__ |
51 |
#ifdef __AVX2__ |
| 52 |
typedef struct { |
52 |
typedef struct { |
| 53 |
int line; |
53 |
int line; |
| 54 |
vec4d_t (*op) (vec4d_t a, vec4d_t b); |
54 |
vec4d_t (*op) (vec4d_t a, vec4d_t b); |
|
Lines 94-100
Link Here
|
| 94 |
mat4f_t ulp_errors; |
94 |
mat4f_t ulp_errors; |
| 95 |
} mq4f_test_t; |
95 |
} mq4f_test_t; |
| 96 |
|
96 |
|
| 97 |
#ifdef __AVX__ |
97 |
#ifdef __AVX2__ |
| 98 |
static vec4d_t tvtruncd (vec4d_t v, vec4d_t ignore) |
98 |
static vec4d_t tvtruncd (vec4d_t v, vec4d_t ignore) |
| 99 |
{ |
99 |
{ |
| 100 |
return vtruncd (v); |
100 |
return vtruncd (v); |
|
Lines 158-164
Link Here
|
| 158 |
|
158 |
|
| 159 |
#define T(t...) { __LINE__, t } |
159 |
#define T(t...) { __LINE__, t } |
| 160 |
|
160 |
|
| 161 |
#ifdef __AVX__ |
161 |
#ifdef __AVX2__ |
| 162 |
static vec4d_test_t vec4d_tests[] = { |
162 |
static vec4d_test_t vec4d_tests[] = { |
| 163 |
// 3D dot products |
163 |
// 3D dot products |
| 164 |
T(dotd, right, right, one ), |
164 |
T(dotd, right, right, one ), |
|
Lines 487-493
Link Here
|
| 487 |
}; |
487 |
}; |
| 488 |
#define num_mq4f_tests (sizeof (mq4f_tests) / (sizeof (mq4f_tests[0]))) |
488 |
#define num_mq4f_tests (sizeof (mq4f_tests) / (sizeof (mq4f_tests[0]))) |
| 489 |
|
489 |
|
| 490 |
#ifdef __AVX__ |
490 |
#ifdef __AVX2__ |
| 491 |
static int |
491 |
static int |
| 492 |
run_vec4d_tests (void) |
492 |
run_vec4d_tests (void) |
| 493 |
{ |
493 |
{ |
|
Lines 684-690
Link Here
|
| 684 |
main (void) |
684 |
main (void) |
| 685 |
{ |
685 |
{ |
| 686 |
int ret = 0; |
686 |
int ret = 0; |
| 687 |
#ifdef __AVX__ |
687 |
#ifdef __AVX2__ |
| 688 |
ret |= run_vec4d_tests (); |
688 |
ret |= run_vec4d_tests (); |
| 689 |
#endif |
689 |
#endif |
| 690 |
ret |= run_vec4f_tests (); |
690 |
ret |= run_vec4f_tests (); |