[cairo] [PATCH]es for pixman 0.16.0 on Solaris

M Joonas Pihlaja jpihlaja at cc.helsinki.fi
Mon Aug 31 14:30:00 PDT 2009


Gack.. Apologies for sending the previous mail without the actual 
patches attached!

Joonas
-------------- next part --------------
From b14cbebaa1f800502fadfc332885cabab8868024 Mon Sep 17 00:00:00 2001
From: M Joonas Pihlaja <jpihlaja at cc.helsinki.fi>
Date: Mon, 31 Aug 2009 20:24:04 +0100
Subject: [PATCH] Work around differing _mm_prefetch() prototypes on Solaris.

Sun Studio 12 expects the address to prefetch to be
a const char pointer rather than a __m128i pointer or
void pointer.
---
 pixman/pixman-sse2.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c
index 727ad42..1d4f02b 100644
--- a/pixman/pixman-sse2.c
+++ b/pixman/pixman-sse2.c
@@ -359,13 +359,13 @@ in_over_2x128 (__m128i* src_lo,
 static force_inline void
 cache_prefetch (__m128i* addr)
 {
-    _mm_prefetch (addr, _MM_HINT_T0);
+    _mm_prefetch ((void const*)addr, _MM_HINT_T0);
 }
 
 static force_inline void
 cache_prefetch_next (__m128i* addr)
 {
-    _mm_prefetch (addr + 4, _MM_HINT_T0); /* 64 bytes ahead */
+    _mm_prefetch ((void const *)(addr + 4), _MM_HINT_T0); /* 64 bytes ahead */
 }
 
 /* load 4 pixels from a 16-byte boundary aligned address */
-- 
1.5.6.5

-------------- next part --------------
From e7ce976f4dc7946aa9f8bdd796de311e6fc47e69 Mon Sep 17 00:00:00 2001
From: M Joonas Pihlaja <jpihlaja at cc.helsinki.fi>
Date: Mon, 31 Aug 2009 20:27:32 +0100
Subject: [PATCH] Work around a Sun Studio 12 code generation bug involving _mm_set_epi32().

Calling a static function wrapper around _mm_set_epi32() when not
using optimisation causes Sun Studio 12's cc to emit a spurious
floating point load which confuses the assembler.  Using a macro wrapper
rather than a function steps around the problem.
---
 pixman/pixman-sse2.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c
index 1d4f02b..a5fcf21 100644
--- a/pixman/pixman-sse2.c
+++ b/pixman/pixman-sse2.c
@@ -2628,12 +2628,18 @@ create_mask_2x32_64 (uint32_t mask0,
     return _mm_set_pi32 (mask0, mask1);
 }
 
+/* Work around a code generation bug in Sun Studio 12. */
+#if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
+# define create_mask_2x32_128(mask0, mask1) \
+	(_mm_set_epi32 ((mask0), (mask1), (mask0), (mask1)))
+#else
 static force_inline __m128i
 create_mask_2x32_128 (uint32_t mask0,
                       uint32_t mask1)
 {
     return _mm_set_epi32 (mask0, mask1, mask0, mask1);
 }
+#endif
 
 /* SSE2 code patch for fbcompose.c */
 
-- 
1.5.6.5

-------------- next part --------------
From 03c9f1f49652ef2ad074b362e16f34ab04f650a0 Mon Sep 17 00:00:00 2001
From: M Joonas Pihlaja <jpihlaja at cc.helsinki.fi>
Date: Mon, 31 Aug 2009 23:02:53 +0100
Subject: [PATCH] Default to optimised builds when using a Sun Studio compiler.

Autoconf's AC_PROG_CC sets the default CFLAGS to -O2 -g for
gcc and -g for every other compiler.  This patch defaults
CFLAGS to the equivalent -O -g when we're using Sun Studio's cc
if the user or site admin hasn't already set CFLAGS.
---
 configure.ac |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 20c9e7a..832ed8b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,6 +65,8 @@ AM_CONFIG_HEADER(config.h)
 
 AC_CANONICAL_HOST
 
+test_CFLAGS=${CFLAGS+set} # We may override autoconf default CFLAGS.
+
 AC_PROG_CC
 AC_PROG_LIBTOOL
 AC_CHECK_FUNCS([getisax])
@@ -75,6 +77,16 @@ AC_C_INLINE
 AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
 AC_CHECK_DECL([__amd64], [AMD64_ABI="yes"], [AMD64_ABI="no"])
 
+# Default CFLAGS to -O -g rather than just the -g from AC_PROG_CC
+# if we're using Sun Studio and neither the user nor a config.site
+# has set CFLAGS.
+if test $SUNCC = yes &&			\
+   test "$test_CFLAGS" == "" &&		\
+   test "$CFLAGS" = "-g"
+then
+  CFLAGS="-O -g"
+fi
+
 # 
 # We ignore pixman_major in the version here because the major version should
 # always be encoded in the actual library name. Ie., the soname is:
-- 
1.5.6.5



More information about the cairo mailing list