[PATCH 3/3] Add SSSE3 fast path skeleton

Liu Xinyun xinyun.liu at intel.com
Wed Dec 8 02:51:27 PST 2010


Signed-off-by: Liu Xinyun <xinyun.liu at intel.com>
Signed-off-by: Xu Samuel <samuel.xu at intel.com>
Signed-off-by: Ma Ling <ling.ma at intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao at intel.com>
---
 pixman/Makefile.am      |   12 +++++++++
 pixman/pixman-cpu.c     |    5 ++++
 pixman/pixman-private.h |    5 ++++
 pixman/pixman-ssse3.c   |   58 +++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 80 insertions(+), 0 deletions(-)
 create mode 100644 pixman/pixman-ssse3.c

diff --git a/pixman/Makefile.am b/pixman/Makefile.am
index ca31301..ba6810c 100644
--- a/pixman/Makefile.am
+++ b/pixman/Makefile.am
@@ -94,6 +94,18 @@ libpixman_1_la_LIBADD += libpixman-sse2.la
 ASM_CFLAGS_sse2=$(SSE2_CFLAGS)
 endif
 
+# ssse3 code
+if USE_SSSE3
+noinst_LTLIBRARIES += libpixman-ssse3.la
+libpixman_ssse3_la_SOURCES = \
+	pixman-ssse3.c
+libpixman_ssse3_la_CFLAGS = $(DEP_CFLAGS) $(SSSE3_CFLAGS)
+libpixman_ssse3_la_LIBADD = $(DEP_LIBS)
+libpixman_1_la_LDFLAGS += $(SSSE3_LDFLAGS)
+libpixman_1_la_LIBADD += libpixman-ssse3.la
+
+ASM_CFLAGS_ssse3=$(SSSE3_CFLAGS)
+endif
 # arm simd code
 if USE_ARM_SIMD
 noinst_LTLIBRARIES += libpixman-arm-simd.la
diff --git a/pixman/pixman-cpu.c b/pixman/pixman-cpu.c
index 389c6e5..9be0d06 100644
--- a/pixman/pixman-cpu.c
+++ b/pixman/pixman-cpu.c
@@ -657,6 +657,11 @@ pixman_have_ssse3 (void)
 pixman_implementation_t *
 _pixman_choose_implementation (void)
 {
+#if defined(USE_SSSE3) && defined(__GNUC__)
+/* not for MSVC and SUN Studio (Macro expanding issue) */
+    if (pixman_have_ssse3())
+	return _pixman_implementation_create_ssse3();
+#endif
 #ifdef USE_SSE2
     if (pixman_have_sse2 ())
 	return _pixman_implementation_create_sse2 ();
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 383748a..026c57f 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -503,6 +503,11 @@ pixman_implementation_t *
 _pixman_implementation_create_sse2 (void);
 #endif
 
+#ifdef USE_SSSE3
+pixman_implementation_t *
+_pixman_implementation_create_ssse3(void);
+#endif
+
 #ifdef USE_ARM_SIMD
 pixman_implementation_t *
 _pixman_implementation_create_arm_simd (void);
diff --git a/pixman/pixman-ssse3.c b/pixman/pixman-ssse3.c
new file mode 100644
index 0000000..8025ced
--- /dev/null
+++ b/pixman/pixman-ssse3.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright © 2010 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Author:  Xu Samuel (samuel.xu at intel.com)
+ *
+ * Based on work by Rodrigo Kumpera and André Tupinambá
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "pixman-private.h"
+
+#ifdef USE_SSSE3
+static const pixman_fast_path_t ssse3_fast_paths[] = {
+    { PIXMAN_OP_NONE },
+};
+
+#if defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__)
+__attribute__((__force_align_arg_pointer__))
+#endif
+
+pixman_implementation_t *
+_pixman_implementation_create_ssse3 (void)
+{
+#ifdef USE_SSE2
+    pixman_implementation_t *fallback = _pixman_implementation_create_sse2();
+#elif defined(USE_MMX)
+    pixman_implementation_t *fallback = _pixman_implementation_create_mmx();
+#else
+    pixman_implementation_t *fallback = _pixman_implementation_create_fast_path();
+#endif
+    pixman_implementation_t *imp = _pixman_implementation_create(fallback, ssse3_fast_paths);
+
+    return imp;
+}
+
+#endif /* USE_SSSE3 */
-- 
1.7.0.4


--d6Gm4EdcadzBjdND--


More information about the Pixman mailing list