aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-10-29 12:12:30 -0600
committerBrian Paul <[email protected]>2008-10-29 12:12:30 -0600
commit8b3af5c5d6fe100707da0d9dcc42500921792638 (patch)
treed31f81117dcdda90830f5bf8edbb7f7fcb267c35 /src
parent4e1c33700d8885c91d8a1db4cbaefa1ff9f1b5fc (diff)
cell: use simd utilities for pow, exp2, log2
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/cell/spu/spu_funcs.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/src/gallium/drivers/cell/spu/spu_funcs.c b/src/gallium/drivers/cell/spu/spu_funcs.c
index 3534b35000d..ff3d609d258 100644
--- a/src/gallium/drivers/cell/spu/spu_funcs.c
+++ b/src/gallium/drivers/cell/spu/spu_funcs.c
@@ -38,7 +38,9 @@
#include <math.h>
#include <cos14_v.h>
#include <sin14_v.h>
-#include <transpose_matrix4x4.h>
+#include <simdmath/exp2f4.h>
+#include <simdmath/log2f4.h>
+#include <simdmath/powf4.h>
#include "cell/common.h"
#include "spu_main.h"
@@ -68,37 +70,19 @@ spu_sin(vector float x)
static vector float
spu_pow(vector float x, vector float y)
{
- float z0 = powf(spu_extract(x,0), spu_extract(y,0));
- float z1 = powf(spu_extract(x,1), spu_extract(y,1));
- float z2 = powf(spu_extract(x,2), spu_extract(y,2));
- float z3 = powf(spu_extract(x,3), spu_extract(y,3));
- return (vector float) {z0, z1, z2, z3};
+ return _powf4(x, y);
}
static vector float
spu_exp2(vector float x)
{
- float z0 = powf(2.0f, spu_extract(x,0));
- float z1 = powf(2.0f, spu_extract(x,1));
- float z2 = powf(2.0f, spu_extract(x,2));
- float z3 = powf(2.0f, spu_extract(x,3));
- return (vector float) {z0, z1, z2, z3};
+ return _exp2f4(x);
}
static vector float
spu_log2(vector float x)
{
- /*
- * log_base_2(x) = log(x) / log(2)
- * 1.442695 = 1/log(2).
- */
- static const vector float k = {1.442695F, 1.442695F, 1.442695F, 1.442695F};
- float z0 = logf(spu_extract(x,0));
- float z1 = logf(spu_extract(x,1));
- float z2 = logf(spu_extract(x,2));
- float z3 = logf(spu_extract(x,3));
- vector float v = (vector float) {z0, z1, z2, z3};
- return spu_mul(v, k);
+ return _log2f4(x);
}