Re: [Pixman] [PATCH] Make pixman-mmx.c compile on x86-32 without optimization

2012-07-11 Thread Matt Turner
On Mon, Jul 9, 2012 at 10:19 PM, Matt Turner matts...@gmail.com wrote:
 Works for me.

On second glance, did I just make a mistake in b87cd1f and write ifdef
instead of ifndef?
___
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman


[Pixman] [PATCH] Make pixman-mmx.c compile on x86-32 without optimization

2012-07-09 Thread Søren Sandmann
From: Søren Sandmann Pedersen s...@redhat.com

When not optimizing, write _mm_shuffle_pi16() as a statement
expression with inline assembly. That way we avoid
__builtin_ia32_pshufw(), which is only available when compiling with
-msse, while still allowing the non-optimizing gcc to understand that
the second argument is a compile time constant.

Cc: matts...@gmail.com
---
 pixman/pixman-mmx.c |   13 +++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index 5441d6b..74a5e87 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -105,8 +105,17 @@ _mm_shuffle_pi16 (__m64 __A, int8_t const __N)
 return ret;
 }
 #  else
-#   define _mm_shuffle_pi16(A, N) \
-((__m64) __builtin_ia32_pshufw ((__v4hi)(__m64)(A), (int)(N)))
+#   define _mm_shuffle_pi16(A, N)  \
+({ \
+   __m64 ret;  \
+   \
+   asm (pshufw %2, %1, %0\n\t\
+: =y (ret)   \
+: y (A), K ((const int8_t)N)   \
+   );  \
+   \
+   ret;\
+})
 #  endif
 # endif
 #endif
-- 
1.7.4

___
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman


Re: [Pixman] [PATCH] Make pixman-mmx.c compile on x86-32 without optimization

2012-07-09 Thread Knut Petersen

That compiles cleanly here.

Tested-by: Knut Petersen knut_peter...@t-online.de


From: Søren Sandmann Pedersen s...@redhat.com

When not optimizing, write _mm_shuffle_pi16() as a statement
expression with inline assembly. That way we avoid
__builtin_ia32_pshufw(), which is only available when compiling with
-msse, while still allowing the non-optimizing gcc to understand that
the second argument is a compile time constant.

Cc: matts...@gmail.com
---
  pixman/pixman-mmx.c |   13 +++--
  1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index 5441d6b..74a5e87 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -105,8 +105,17 @@ _mm_shuffle_pi16 (__m64 __A, int8_t const __N)
  return ret;
  }
  #  else
-#   define _mm_shuffle_pi16(A, N) \
-((__m64) __builtin_ia32_pshufw ((__v4hi)(__m64)(A), (int)(N)))
+#   define _mm_shuffle_pi16(A, N)  \
+({ \
+   __m64 ret;  \
+   \
+   asm (pshufw %2, %1, %0\n\t  \
+: =y (ret) \
+: y (A), K ((const int8_t)N)   \
+   );  \
+   \
+   ret;\
+})
  #  endif
  # endif
  #endif



___
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman


Re: [Pixman] [PATCH] Make pixman-mmx.c compile on x86-32 without optimization

2012-07-09 Thread Matt Turner
On Mon, Jul 9, 2012 at 7:31 AM, Søren Sandmann sandm...@cs.au.dk wrote:
 From: Søren Sandmann Pedersen s...@redhat.com

 When not optimizing, write _mm_shuffle_pi16() as a statement
 expression with inline assembly. That way we avoid
 __builtin_ia32_pshufw(), which is only available when compiling with
 -msse, while still allowing the non-optimizing gcc to understand that
 the second argument is a compile time constant.

 Cc: matts...@gmail.com
 ---
  pixman/pixman-mmx.c |   13 +++--
  1 files changed, 11 insertions(+), 2 deletions(-)

 diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
 index 5441d6b..74a5e87 100644
 --- a/pixman/pixman-mmx.c
 +++ b/pixman/pixman-mmx.c
 @@ -105,8 +105,17 @@ _mm_shuffle_pi16 (__m64 __A, int8_t const __N)
  return ret;
  }
  #  else
 -#   define _mm_shuffle_pi16(A, N) \
 -((__m64) __builtin_ia32_pshufw ((__v4hi)(__m64)(A), (int)(N)))
 +#   define _mm_shuffle_pi16(A, N)  \
 +({ \
 +   __m64 ret;  \
 +   \
 +   asm (pshufw %2, %1, %0\n\t\
 +: =y (ret)   \
 +: y (A), K ((const int8_t)N)   \
 +   );  \
 +   \
 +   ret;\
 +})
  #  endif
  # endif
  #endif
 --
 1.7.4

Works for me.
___
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman