summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2005-03-17 17:17:03 +0000
committerDavid Schleef <ds@schleef.org>2005-03-17 17:17:03 +0000
commit9796a98974e72d7fa347cbb0de855c00500d2de4 (patch)
tree6c2a38382c9958244a3ba671fc7be5451c468ec8
parent17e92d7f66d1a4848dca67979cbc62d8966f12cf (diff)
downloadliboil-9796a98974e72d7fa347cbb0de855c00500d2de4.tar.gz
* liboil/simdpack/vectoradd_s_i386.c: need this too. part of
the patch below.
-rw-r--r--ChangeLog5
-rw-r--r--liboil/simdpack/vectoradd_s_i386.c61
2 files changed, 66 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index f9d5947..6a8b066 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-03-17 David Schleef <ds@schleef.org>
+
+ * liboil/simdpack/vectoradd_s_i386.c: need this too. part of
+ the patch below.
+
2005-03-16 David Schleef <ds@schleef.org>
* gtk-doc.make: add me
diff --git a/liboil/simdpack/vectoradd_s_i386.c b/liboil/simdpack/vectoradd_s_i386.c
new file mode 100644
index 0000000..1ceb659
--- /dev/null
+++ b/liboil/simdpack/vectoradd_s_i386.c
@@ -0,0 +1,61 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <liboil/liboilfunction.h>
+#include <liboil/simdpack/simdpack.h>
+#include <liboil/liboilgcc.h>
+
+#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
+#define type_min_f32 -1.0
+#define type_max_f32 1.0
+#define type_min_f64 -1.0
+#define type_max_f64 1.0
+
+#define __padd_s8 __builtin_ia32_paddsb
+#define __padd_u8 __builtin_ia32_paddusb
+#define __padd_s16 __builtin_ia32_paddsw
+#define __padd_u16 __builtin_ia32_paddusw
+
+#define vec_u8 vec_s8
+#define vec_u16 vec_s16
+
+#define VECTORADD_MMX_IMPL(type,bigger,pad) \
+static void \
+vectoradd_s_ ## type ## _mmx (type_ ## type *dest, int dstr, type_ ## type *src1, int sstr1, type_ ## type *src2, int sstr2, int n) \
+{ \
+ vec_ ## type *vdest; \
+ vec_ ## type *vsrc1; \
+ vec_ ## type *vsrc2; \
+ \
+ while (n & (pad-1)) { \
+ *dest = CLAMP((type_ ## bigger)(*src1)+(type_ ## bigger)(*src2),type_min_ ## bigger,type_max_ ## bigger); \
+ OIL_INCREMENT (dest, dstr); \
+ OIL_INCREMENT (src1, sstr1); \
+ OIL_INCREMENT (src2, sstr2); \
+ n--; \
+ } \
+ n /= pad; \
+ vsrc1=(vec_ ## type*)src1; \
+ vsrc2=(vec_ ## type*)src2; \
+ vdest=(vec_ ## type*)dest; \
+ \
+ while (n>0) \
+ { \
+ *vdest=__padd_ ##type (*vsrc1,*vsrc2); \
+ OIL_INCREMENT (vdest, 8); \
+ OIL_INCREMENT (vsrc1, 8); \
+ OIL_INCREMENT (vsrc2, 8); \
+ n--; \
+ } \
+} \
+ \
+OIL_DEFINE_IMPL_FULL(vectoradd_s_ ## type ## _mmx,vectoradd_s_ ## type,OIL_IMPL_FLAG_MMX);
+
+#ifdef ENABLE_BROKEN_IMPLS
+VECTORADD_MMX_IMPL(s8,s16,8)
+VECTORADD_MMX_IMPL(u8,s16,8)
+VECTORADD_MMX_IMPL(s16,s32,4)
+VECTORADD_MMX_IMPL(u16,s32,4)
+#endif
+