1 --- liboil-0.3.16/configure.ac-orig 2010-03-31 16:27:48.050482382 -0500
2 +++ liboil-0.3.16/configure.ac 2010-03-31 16:47:06.074555274 -0500
3 @@ -241,6 +241,31 @@ if test "x$HAVE_SSSE3_ASM" = xyes ; then
4 AC_DEFINE(HAVE_SSSE3_ASM, 1, [Defined if compiler/assembler can handle SSSE3 instructions])
7 +# Checks for Sun Studio compilers
8 +AC_CHECK_DECL([__SUNPRO_C], [HAVE_SUNCC="yes"], [HAVE_SUNCC="no"])
9 +if test x$HAVE_SUNCC="xyes" ; then
12 + # When building binaries, apply a mapfile to ensure that the
13 + # binaries are not flagged as only able to run on MMX+SSE capable CPUs
14 + # since they check at runtime before using those instructions.
15 + # Not all linkers grok the mapfile format so we check for that first.
17 + use_hwcap_mapfile=no
18 + AC_MSG_CHECKING(whether to use a hardware capability map file)
19 + hwcap_save_LDFLAGS="$LDFLAGS"
20 + LIBOIL_HWCAP_LDFLAGS='-Wl,-M,$(srcdir)/solaris-hwcap.mapfile'
21 + LDFLAGS="$LDFLAGS -Wl,-M,liboil/solaris-hwcap.mapfile"
22 + AC_LINK_IFELSE([int main() { return 0; }],
23 + use_hwcap_mapfile=yes,
24 + LIBOIL_HWCAP_LDFLAGS="")
25 + LDFLAGS="$hwcap_save_LDFLAGS"
26 + AC_SUBST(LIBOIL_HWCAP_LDFLAGS)
27 + AC_MSG_RESULT($use_hwcap_mapfile)
32 AC_DEFINE(OIL_EXPORTS, 1, [Defined for compiling internal code])
34 LIBOIL_CFLAGS="$LIBOIL_CFLAGS -D_BSD_SOURCE -D_GNU_SOURCE -I\$(top_srcdir) -DOIL_ENABLE_UNSTABLE_API"
35 --- liboil-0.3.16/liboil/Makefile.am-orig 2010-03-31 16:28:32.687722289 -0500
36 +++ liboil-0.3.16/liboil/Makefile.am 2010-03-31 16:34:50.756904945 -0500
37 @@ -105,13 +105,15 @@ liboilfunctions_la_LIBADD += \
38 deprecated/libdeprecated.la
40 liboilfunctions_la_LDFLAGS = \
43 + $(LIBOIL_HWCAP_LDFLAGS)
45 liboiltmp1_la_SOURCES = \
47 liboiltmp1_la_LDFLAGS = \
49 - -export-symbols-regex 'oil_'
50 + -export-symbols-regex 'oil_' \
51 + $(LIBOIL_HWCAP_LDFLAGS)
52 liboiltmp1_la_LIBADD = \
55 @@ -172,7 +174,8 @@ liboil_@LIBOIL_MAJORMINOR@_la_CFLAGS = $
56 liboil_@LIBOIL_MAJORMINOR@_la_LDFLAGS = \
58 -version-info $(LIBOIL_LIBVERSION) \
59 - -export-symbols-regex '^oil_'
60 + -export-symbols-regex '^oil_' \
61 + $(LIBOIL_HWCAP_LDFLAGS)
63 # This is required to use 'make -j2'. Automake doesn't seem to notice
64 # that one of the dependencies is in this directory.
65 @@ -252,6 +255,7 @@ liboil_@LIBOIL_OLD_MAJORMINOR@_la_LIBADD
66 liboil_@LIBOIL_OLD_MAJORMINOR@_la_LDFLAGS = \
68 -version-info $(LIBOIL_LIBVERSION) \
69 - -export-symbols-regex '^oil_'
70 + -export-symbols-regex '^oil_' \
71 + $(LIBOIL_HWCAP_LDFLAGS)
74 --- liboil-0.3.16/m4/as-host-defines.m4-orig 2010-04-02 18:00:05.109471540 -0500
75 +++ liboil-0.3.16/m4/as-host-defines.m4 2010-04-02 17:55:02.467785745 -0500
76 @@ -10,22 +10,38 @@ dnl AS_HOST_DEFINES()
78 AC_DEFUN([AS_HOST_DEFINES],
80 - case "x${host_cpu}" in
83 - AC_DEFINE(HAVE_I386, 1, [Defined if host is i386])
87 - AC_DEFINE(HAVE_AMD64, 1, [Defined if host is amd64])
89 - xpowerpc|xppc|xpowerpc64|xppc64)
91 - AC_DEFINE(HAVE_POWERPC, 1, [Defined if host is powerpc])
95 - AC_DEFINE(HAVE_ARM, 1, [Defined if host is arm])
98 + AC_CHECK_DECL([__amd64], [AMD64_ABI="yes"], [AMD64_ABI="no"])
99 + AC_CHECK_DECL([__i386], [I386_ABI="yes"], [I386_ABI="no"])
100 + if test "x$I386_ABI" = "xyes" ; then
102 + AC_DEFINE(HAVE_I386, 1, [Defined if host is i386])
104 + if test "x$AMD64_ABI" = "xyes" ; then
106 + AC_DEFINE(HAVE_AMD64, 1, [Defined if host is amd64])
110 + case "x${host_cpu}" in
113 + AC_DEFINE(HAVE_I386, 1, [Defined if host is i386])
117 + AC_DEFINE(HAVE_AMD64, 1, [Defined if host is amd64])
119 + xpowerpc|xppc|xpowerpc64|xppc64)
121 + AC_DEFINE(HAVE_POWERPC, 1, [Defined if host is powerpc])
125 + AC_DEFINE(HAVE_ARM, 1, [Defined if host is arm])
131 --- liboil-0.3.16/m4/as-gcc-inline-assembly.m4-orig 2010-03-30 15:11:24.758367535 -0500
132 +++ liboil-0.3.16/m4/as-gcc-inline-assembly.m4 2010-03-30 19:09:25.330976472 -0500
133 @@ -16,6 +16,7 @@ AC_DEFUN([AS_GCC_INLINE_ASSEMBLY],
134 AC_MSG_CHECKING([if compiler supports gcc-style inline assembly])
141 @@ -24,6 +25,7 @@ AC_DEFUN([AS_GCC_INLINE_ASSEMBLY],
142 #error GCC before 3.4 has critical bugs compiling inline assembly
146 __asm__ (""::) ], [flag_ok=yes], [flag_ok=no])
148 if test "X$flag_ok" = Xyes ; then
149 @@ -58,6 +60,7 @@ AC_DEFUN([AS_GCC_INLINE_ASM_INSTRUCTION]
150 AC_MSG_CHECKING([if compiler supports '$1' asm instruction])
157 @@ -66,6 +69,7 @@ AC_DEFUN([AS_GCC_INLINE_ASM_INSTRUCTION]
158 #error GCC before 3.4 has critical bugs compiling inline assembly
162 __asm__ ("$1"::) ], [flag_ok=yes], [flag_ok=no])
164 if test "X$flag_ok" = Xyes ; then
165 --- liboil-0.3.16/m4/as-intrinsics.m4-orig 2010-03-31 16:28:18.254915354 -0500
166 +++ liboil-0.3.16/m4/as-intrinsics.m4 2010-03-31 16:35:32.424331700 -0500
167 @@ -15,12 +15,35 @@ AC_DEFUN([AS_MMX_INTRINSICS],
169 AC_MSG_CHECKING([if compiler supports MMX intrinsics])
171 - save_CFLAGS="$CFLAGS"
172 - CFLAGS="$CFLAGS -mmmx"
173 - AC_TRY_COMPILE([#include <mmintrin.h>], [_mm_empty()], [flag_ok=yes], [flag_ok=no])
174 - CFLAGS="$save_CFLAGS"
177 + dnl Note Sun Studio does not have -xarch=mmx, so only support MMX if SSE is
178 + dnl also supported.
180 + AC_CHECK_DECL([__amd64], [AMD64_ABI="yes"], [AMD64_ABI="no"])
181 + AC_CHECK_DECL([__i386], [I386_ABI="yes"], [I386_ABI="no"])
184 + if test "x$AMD64_ABI" = "xyes" ; then
188 + if test "x$I386_ABI" = "xyes" ; then
195 + save_CFLAGS="$CFLAGS"
196 + CFLAGS="$CFLAGS -mmmx"
197 + AC_TRY_COMPILE([#include <mmintrin.h>], [_mm_empty()], [flag_ok=yes], [flag_ok=no])
198 + CFLAGS="$save_CFLAGS"
205 if test "X$flag_ok" = Xyes ; then
208 @@ -41,18 +64,38 @@ AC_DEFUN([AS_SSE_INTRINSICS],
210 AC_MSG_CHECKING([if compiler supports SSE intrinsics])
212 - save_CFLAGS="$CFLAGS"
213 - CFLAGS="$CFLAGS -msse"
214 - AC_TRY_COMPILE([#include <xmmintrin.h>], [
217 + AC_CHECK_DECL([__amd64], [AMD64_ABI="yes"], [AMD64_ABI="no"])
218 + AC_CHECK_DECL([__i386], [I386_ABI="yes"], [I386_ABI="no"])
221 + if test "x$AMD64_ABI" = "xyes" ; then
225 + if test "x$I386_ABI" = "xyes" ; then
232 + save_CFLAGS="$CFLAGS"
233 + CFLAGS="$CFLAGS -msse"
234 + AC_TRY_COMPILE([#include <xmmintrin.h>], [
235 #ifdef __GNUC_MINOR__
236 #if (__GNUC__ * 1000 + __GNUC_MINOR__) < 4002
237 #error GCC before 4.2 has critical bugs compiling SSE intrinsics
240 __m128 a; a = _mm_or_ps(a,a)], [flag_ok=yes], [flag_ok=no])
241 - CFLAGS="$save_CFLAGS"
242 + CFLAGS="$save_CFLAGS"
249 if test "X$flag_ok" = Xyes ; then
252 @@ -73,18 +116,39 @@ AC_DEFUN([AS_SSE2_INTRINSICS],
254 AC_MSG_CHECKING([if compiler supports SSE2 intrinsics])
256 - save_CFLAGS="$CFLAGS"
257 - CFLAGS="$CFLAGS -msse2"
258 - AC_TRY_COMPILE([#include <emmintrin.h>], [
261 + AC_CHECK_DECL([__amd64], [AMD64_ABI="yes"], [AMD64_ABI="no"])
262 + AC_CHECK_DECL([__i386], [I386_ABI="yes"], [I386_ABI="no"])
265 + if test "x$AMD64_ABI" = "xyes" ; then
269 + if test "x$I386_ABI" = "xyes" ; then
277 + save_CFLAGS="$CFLAGS"
278 + CFLAGS="$CFLAGS -msse2"
279 + AC_TRY_COMPILE([#include <emmintrin.h>], [
280 #ifdef __GNUC_MINOR__
281 #if (__GNUC__ * 1000 + __GNUC_MINOR__) < 4002
282 #error GCC before 4.2 has critical bugs compiling SSE2 intrinsics
285 __m128i a; a = _mm_setzero_si128(); a = _mm_srli_epi16(a,8)], [flag_ok=yes], [flag_ok=no])
286 - CFLAGS="$save_CFLAGS"
287 + CFLAGS="$save_CFLAGS"
294 if test "X$flag_ok" = Xyes ; then
297 @@ -105,18 +169,38 @@ AC_DEFUN([AS_SSE3_INTRINSICS],
299 AC_MSG_CHECKING([if compiler supports SSE3 intrinsics])
301 - save_CFLAGS="$CFLAGS"
302 - CFLAGS="$CFLAGS -msse3"
303 - AC_TRY_COMPILE([#include <pmmintrin.h>], [
306 + AC_CHECK_DECL([__amd64], [AMD64_ABI="yes"], [AMD64_ABI="no"])
307 + AC_CHECK_DECL([__i386], [I386_ABI="yes"], [I386_ABI="no"])
310 + if test "x$AMD64_ABI" = "xyes" ; then
314 + if test "x$I386_ABI" = "xyes" ; then
321 + save_CFLAGS="$CFLAGS"
322 + CFLAGS="$CFLAGS -msse3"
323 + AC_TRY_COMPILE([#include <pmmintrin.h>], [
324 #ifdef __GNUC_MINOR__
325 #if (__GNUC__ * 1000 + __GNUC_MINOR__) < 4002
326 #error GCC before 4.2 has critical bugs compiling SSE2 intrinsics
329 __m128 a; a = _mm_addsub_ps(a,a)], [flag_ok=yes], [flag_ok=no])
330 - CFLAGS="$save_CFLAGS"
331 + CFLAGS="$save_CFLAGS"
338 if test "X$flag_ok" = Xyes ; then
341 @@ -137,12 +221,26 @@ AC_DEFUN([AS_3DNOW_INTRINSICS],
343 AC_MSG_CHECKING([if compiler supports 3DNOW intrinsics])
345 - save_CFLAGS="$CFLAGS"
346 - CFLAGS="$CFLAGS -m3dnow"
347 - AC_TRY_COMPILE([#include <mm3dnow.h>], [_m_femms()], [flag_ok=yes], [flag_ok=no])
348 - CFLAGS="$save_CFLAGS"
351 + AC_CHECK_DECL([__amd64], [AMD64_ABI="yes"], [AMD64_ABI="no"])
352 + AC_CHECK_DECL([__i386], [I386_ABI="yes"], [I386_ABI="no"])
355 + if test "x$AMD64_ABI" = "xyes" ; then
360 + save_CFLAGS="$CFLAGS"
361 + CFLAGS="$CFLAGS -m3dnow"
362 + AC_TRY_COMPILE([#include <mm3dnow.h>], [_m_femms()], [flag_ok=yes], [flag_ok=no])
363 + CFLAGS="$save_CFLAGS"
370 if test "X$flag_ok" = Xyes ; then
373 @@ -163,12 +261,26 @@ AC_DEFUN([AS_3DNOWEXT_INTRINSICS],
375 AC_MSG_CHECKING([if compiler supports 3DNOWEXT intrinsics])
377 - save_CFLAGS="$CFLAGS"
378 - CFLAGS="$CFLAGS -m3dnow -march=athlon"
379 - AC_TRY_COMPILE([#include <mm3dnow.h>], [__m64 a;a=_m_pf2iw(a)], [flag_ok=yes], [flag_ok=no])
380 - CFLAGS="$save_CFLAGS"
383 + AC_CHECK_DECL([__amd64], [AMD64_ABI="yes"], [AMD64_ABI="no"])
384 + AC_CHECK_DECL([__i386], [I386_ABI="yes"], [I386_ABI="no"])
386 + if test "x$AMD64_ABI" = "xyes" ; then
392 + save_CFLAGS="$CFLAGS"
393 + CFLAGS="$CFLAGS -m3dnow -march=athlon"
394 + AC_TRY_COMPILE([#include <mm3dnow.h>], [__m64 a;a=_m_pf2iw(a)], [flag_ok=yes], [flag_ok=no])
395 + CFLAGS="$save_CFLAGS"
397 + $1="-m3dnow -march=athlon"
401 - $1="-m3dnow -march=athlon"
402 if test "X$flag_ok" = Xyes ; then
405 @@ -189,12 +301,21 @@ AC_DEFUN([AS_ALTIVEC_INTRINSICS],
407 AC_MSG_CHECKING([if compiler supports ALTIVEC intrinsics])
409 - save_CFLAGS="$CFLAGS"
410 - CFLAGS="$CFLAGS -maltivec"
411 - AC_TRY_COMPILE([#include <altivec.h>], [__vector a; a = vec_or(a,a)], [flag_ok=yes], [flag_ok=no])
412 - CFLAGS="$save_CFLAGS"
419 + save_CFLAGS="$CFLAGS"
420 + CFLAGS="$CFLAGS -maltivec"
421 + AC_TRY_COMPILE([#include <altivec.h>], [__vector a; a = vec_or(a,a)], [flag_ok=yes], [flag_ok=no])
422 + CFLAGS="$save_CFLAGS"
429 if test "X$flag_ok" = Xyes ; then
432 --- liboil-0.3.16/liboil/i386_amd64/multiply_and_acc.c-orig 2010-03-31 16:40:26.975957343 -0500
433 +++ liboil-0.3.16/liboil/i386_amd64/multiply_and_acc.c 2010-03-31 16:46:04.547795614 -0500
434 @@ -29,7 +29,7 @@ multiply_and_acc_6xn_s16_u8_mmx (int16_t
437 : "+r" (i1), "+r" (s1), "+r" (s2), "+m" (n)
439 +#if defined(__i386__) || defined(__i386)
440 : "m" (is1), "m" (ss1), "m" (ss2)
442 : "r" ((long)is1), "r" ((long)ss1), "r" ((long)ss2)
443 @@ -65,7 +65,7 @@ multiply_and_acc_8xn_s16_u8_mmx (int16_t
446 : "+r" (i1), "+r" (s1), "+r" (s2), "+m" (n)
448 +#if defined(__i386__) || defined(__i386)
449 : "m" (is1), "m" (ss1), "m" (ss2)
451 : "r" ((long)is1), "r" ((long)ss1), "r" ((long)ss2)
452 @@ -111,7 +111,7 @@ multiply_and_acc_16xn_s16_u8_mmx (int16_
455 : "+r" (i1), "+r" (s1), "+r" (s2), "+m" (n)
457 +#if defined(__i386__) || defined(__i386)
458 : "m" (is1), "m" (ss1), "m" (ss2)
460 : "r" ((long)is1), "r" ((long)ss1), "r" ((long)ss2)
461 @@ -167,7 +167,7 @@ multiply_and_acc_24xn_s16_u8_mmx (int16_
464 : "+r" (i1), "+r" (s1), "+r" (s2), "+m" (n)
466 +#if defined(__i386__) || defined(__i386)
467 : "m" (is1), "m" (ss1), "m" (ss2)
469 : "r" ((long)is1), "r" ((long)ss1), "r" ((long)ss2)
470 --- liboil-0.3.16/liboil/i386_amd64/copy.c-orig 2010-03-31 16:39:11.299623785 -0500
471 +++ liboil-0.3.16/liboil/i386_amd64/copy.c 2010-03-31 16:40:06.764215022 -0500
472 @@ -327,7 +327,7 @@ static void splat_u8_ns_mmx2a (uint8_t *
473 " punpcklbw %%mm0, %%mm0\n"
474 " movq %%mm0, (%0)\n"
475 " movq %%mm0, 8(%0)\n"
477 +#if defined(__i386__) || defined(__i386)
479 #elif defined(__amd64__)
480 /* ugh this is gross */
481 --- liboil-0.3.16/liboil/fb/fbmmx.c-orig 2010-03-30 14:54:10.754703273 -0500
482 +++ liboil-0.3.16/liboil/fb/fbmmx.c 2010-03-30 14:54:18.144142149 -0500
483 @@ -662,10 +662,15 @@ void fbComposeSetupMMX(void)
485 /* ------------------ MMX code paths called from fbpict.c ----------------------- */
487 +#if defined(__SUNPRO_C)
488 +typedef __m64 m64_ull;
489 +typedef m64_ull mmxdatafield;
499 @@ -688,6 +693,23 @@ typedef struct
501 static const MMXData c =
503 +#if defined(__SUNPRO_C)
504 + .mmx_4x00ff = 0x00ff00ff00ff00ffULL,
505 + .mmx_4x0080 = 0x0080008000800080ULL,
506 + .mmx_565_rgb = 0x000001f0003f001fULL,
507 + .mmx_565_r = 0x000000f800000000ULL,
508 + .mmx_565_g = 0x0000000000fc0000ULL,
509 + .mmx_565_b = 0x00000000000000f8ULL,
510 + .mmx_mask_0 = 0xffffffffffff0000ULL,
511 + .mmx_mask_1 = 0xffffffff0000ffffULL,
512 + .mmx_mask_2 = 0xffff0000ffffffffULL,
513 + .mmx_mask_3 = 0x0000ffffffffffffULL,
514 + .mmx_full_alpha = 0x00ff000000000000ULL,
515 + .mmx_565_unpack_multiplier = 0x0000008404100840ULL,
516 + .mmx_ffff0000ffff0000 = 0xffff0000ffff0000ULL,
517 + .mmx_0000ffff00000000 = 0x0000ffff00000000ULL,
518 + .mmx_000000000000ffff = 0x000000000000ffffULL,
520 .mmx_4x00ff.ull = 0x00ff00ff00ff00ffULL,
521 .mmx_4x0080.ull = 0x0080008000800080ULL,
522 .mmx_565_rgb.ull = 0x000001f0003f001fULL,
523 @@ -703,9 +725,16 @@ static const MMXData c =
524 .mmx_ffff0000ffff0000.ull = 0xffff0000ffff0000ULL,
525 .mmx_0000ffff00000000.ull = 0x0000ffff00000000ULL,
526 .mmx_000000000000ffff.ull = 0x000000000000ffffULL,
530 +#if defined(__GNUC__)
531 #define MC(x) ((__m64) c.mmx_##x.m64)
532 +#elif defined(__SUNPRO_C)
533 +#define MC(x) c.mmx_##x
535 +#error "Unsupported compiler."
538 static __inline__ __m64
539 shift (__m64 v, int s)
540 --- liboil-0.3.16/liboil/liboiltest.c-orig 2010-04-05 22:31:02.739988219 -0500
541 +++ liboil-0.3.16/liboil/liboiltest.c 2010-04-05 22:35:47.292816790 -0500
542 @@ -327,6 +327,10 @@ check_guard (uint8_t *data, int n, int g
546 +#if defined(__SUNPRO_C)
547 +#define LCAST(d) ((unsigned long long *) &d)[0]
551 * oil_test_check_impl:
553 @@ -396,7 +400,11 @@ oil_test_check_impl (OilTest *test, OilF
557 +#if defined(__SUNPRO_C)
558 + OIL_DEBUG("sum of absolute differences %g for %d values", LCAST(x), n);
560 OIL_DEBUG("sum of absolute differences %g for %d values", x, n);
562 test->sum_abs_diff = x;
565 --- /dev/null 2010-03-31 17:48:49.000000000 -0500
566 +++ liboil-0.3.16/liboil/solaris-hwcap.mapfile 2010-03-31 17:52:00.993460669 -0500
568 +# Override the linker's detection of CMOV/MMX/SSE instructions so this
569 +# library isn't flagged as only usable on CPU's with those ISA's, since it
570 +# checks at runtime for availability before calling them
572 +hwcap_1 = V0x0 FPU OVERRIDE;