OSDN Git Service

gcc/
authorhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 19 Aug 2008 12:49:28 +0000 (12:49 +0000)
committerhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 19 Aug 2008 12:49:28 +0000 (12:49 +0000)
2008-08-19  H.J. Lu  <hongjiu.lu@intel.com>

PR target/37157
* config/i386/sse.md (sse2_punpckhqdq, sse2_punpcklqdq): Moved
before (sse2_shufpd_<mode>).

gcc/testsuite/

2008-08-19  H.J. Lu  <hongjiu.lu@intel.com>

PR target/37157
* gcc.target/i386/sse2-unpack-1.c: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139232 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/i386/sse.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/sse2-unpack-1.c [new file with mode: 0644]

index a170704..8d30516 100644 (file)
@@ -1,3 +1,9 @@
+2008-08-19  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/37157
+       * config/i386/sse.md (sse2_punpckhqdq, sse2_punpcklqdq): Moved
+       before (sse2_shufpd_<mode>).
+
 2008-08-19  Jakub Jelinek  <jakub@redhat.com>
 
        PR debug/37156
index c8bf42d..e7e4140 100644 (file)
                     (const_int 3)])))]
   "TARGET_SSE2")
 
+;; punpcklqdq and punpckhqdq are shorter than shufpd.
+(define_insn "sse2_punpckhqdq"
+  [(set (match_operand:V2DI 0 "register_operand" "=x")
+       (vec_select:V2DI
+         (vec_concat:V4DI
+           (match_operand:V2DI 1 "register_operand" "0")
+           (match_operand:V2DI 2 "nonimmediate_operand" "xm"))
+         (parallel [(const_int 1)
+                    (const_int 3)])))]
+  "TARGET_SSE2"
+  "punpckhqdq\t{%2, %0|%0, %2}"
+  [(set_attr "type" "sselog")
+   (set_attr "prefix_data16" "1")
+   (set_attr "mode" "TI")])
+
+(define_insn "sse2_punpcklqdq"
+  [(set (match_operand:V2DI 0 "register_operand" "=x")
+       (vec_select:V2DI
+         (vec_concat:V4DI
+           (match_operand:V2DI 1 "register_operand" "0")
+           (match_operand:V2DI 2 "nonimmediate_operand" "xm"))
+         (parallel [(const_int 0)
+                    (const_int 2)])))]
+  "TARGET_SSE2"
+  "punpcklqdq\t{%2, %0|%0, %2}"
+  [(set_attr "type" "sselog")
+   (set_attr "prefix_data16" "1")
+   (set_attr "mode" "TI")])
+
 (define_insn "sse2_shufpd_<mode>"
   [(set (match_operand:SSEMODE2D 0 "register_operand" "=x")
        (vec_select:SSEMODE2D
    (set_attr "prefix_data16" "1")
    (set_attr "mode" "TI")])
 
-(define_insn "sse2_punpckhqdq"
-  [(set (match_operand:V2DI 0 "register_operand" "=x")
-       (vec_select:V2DI
-         (vec_concat:V4DI
-           (match_operand:V2DI 1 "register_operand" "0")
-           (match_operand:V2DI 2 "nonimmediate_operand" "xm"))
-         (parallel [(const_int 1)
-                    (const_int 3)])))]
-  "TARGET_SSE2"
-  "punpckhqdq\t{%2, %0|%0, %2}"
-  [(set_attr "type" "sselog")
-   (set_attr "prefix_data16" "1")
-   (set_attr "mode" "TI")])
-
-(define_insn "sse2_punpcklqdq"
-  [(set (match_operand:V2DI 0 "register_operand" "=x")
-       (vec_select:V2DI
-         (vec_concat:V4DI
-           (match_operand:V2DI 1 "register_operand" "0")
-           (match_operand:V2DI 2 "nonimmediate_operand" "xm"))
-         (parallel [(const_int 0)
-                    (const_int 2)])))]
-  "TARGET_SSE2"
-  "punpcklqdq\t{%2, %0|%0, %2}"
-  [(set_attr "type" "sselog")
-   (set_attr "prefix_data16" "1")
-   (set_attr "mode" "TI")])
-
 (define_insn "*sse4_1_pinsrb"
   [(set (match_operand:V16QI 0 "register_operand" "=x")
        (vec_merge:V16QI
index 7499840..ac05d1f 100644 (file)
@@ -1,3 +1,8 @@
+2008-08-19  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/37157
+       * gcc.target/i386/sse2-unpack-1.c: New.
+
 2008-08-19  Jakub Jelinek  <jakub@redhat.com>
 
        PR debug/37156
diff --git a/gcc/testsuite/gcc.target/i386/sse2-unpack-1.c b/gcc/testsuite/gcc.target/i386/sse2-unpack-1.c
new file mode 100644 (file)
index 0000000..a267639
--- /dev/null
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2" } */
+
+#include <emmintrin.h>
+
+__m128i
+foo1 (__m128i s1, __m128i s2)
+{
+  return _mm_unpackhi_epi64 (s1, s2); 
+}
+
+__m128i
+foo2 (__m128i s1, __m128i s2)
+{
+  return _mm_unpacklo_epi64 (s1, s2); 
+}
+
+/* { dg-final { scan-assembler "punpcklqdq" } } */
+/* { dg-final { scan-assembler "punpckhqdq" } } */