From 42101c23d5c364cd509d8024853e342e4317027d Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Thu, 22 Dec 2005 19:06:09 +0000 Subject: [PATCH] sse.md (sse_movhlps): Reverse operands for 2nd and 3rd alternatives. 2005-12-22 Dale Johannesen * config/i386/sse.md (sse_movhlps): Reverse operands for 2nd and 3rd alternatives. 2005-12-22 Dale Johannesen * gcc.target/i386/sse-17.c: New. From-SVN: r108966 --- gcc/ChangeLog | 5 +++++ gcc/config/i386/sse.md | 8 +++---- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.target/i386/sse-17.c | 30 ++++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/sse-17.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8004d01dcc4..8e265ab25e0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2005-12-22 Dale Johannesen + + * config/i386/sse.md (sse_movhlps): Reverse operands for + 2nd and 3rd alternatives. + 2005-12-22 Andrew Pinski PR tree-opt/25513 diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 8fc3da069e2..b444491138e 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -1044,8 +1044,8 @@ [(set (match_operand:V4SF 0 "nonimmediate_operand" "=x,x,m") (vec_select:V4SF (vec_concat:V8SF - (match_operand:V4SF 1 "nonimmediate_operand" " 0,o,x") - (match_operand:V4SF 2 "nonimmediate_operand" " x,0,0")) + (match_operand:V4SF 1 "nonimmediate_operand" " 0,0,0") + (match_operand:V4SF 2 "nonimmediate_operand" " x,o,x")) (parallel [(const_int 6) (const_int 7) (const_int 2) @@ -1053,8 +1053,8 @@ "TARGET_SSE && !(MEM_P (operands[1]) && MEM_P (operands[2]))" "@ movhlps\t{%2, %0|%0, %2} - movlps\t{%H1, %0|%0, %H1} - movhps\t{%1, %0|%0, %1}" + movlps\t{%H2, %0|%0, %H2} + movhps\t{%2, %0|%0, %2}" [(set_attr "type" "ssemov") (set_attr "mode" "V4SF,V2SF,V2SF")]) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7bfb7cdb52c..ebeb40a6401 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2005-12-22 Dale Johannesen + + * gcc.target/i386/sse-17.c: New. + 2005-12-22 Paul Brook * gcc.dg/tree-ssa/loop-1.c: Look for jump/branch on m68k. diff --git a/gcc/testsuite/gcc.target/i386/sse-17.c b/gcc/testsuite/gcc.target/i386/sse-17.c new file mode 100644 index 00000000000..86d22c42c53 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/sse-17.c @@ -0,0 +1,30 @@ +/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -msse2" } */ +#include +extern void abort(); +int untrue = 0; +typedef union { + __v4sf v; + float f[4]; +} u; +void foo (u, u) __attribute__((noinline)); +void foo (u a, u b) { + if (b.f[0] != 7.0 || b.f[1] != 8.0 || b.f[2] != 3.0 || b.f[3] != 4.0) + abort(); +} +void bar (__v4sf, __v4sf) __attribute__((noinline)); +void bar (__v4sf a __attribute((unused)), __v4sf b __attribute((unused))) { untrue = 0;} +__v4sf setupa () __attribute((noinline)); +__v4sf setupa () { __v4sf t = { 1.0, 2.0, 3.0, 4.0 }; return t; } +__v4sf setupb () __attribute((noinline)); +__v4sf setupb () { __v4sf t = { 5.0, 6.0, 7.0, 8.0 }; return t; } +main() { + u a, b; + a.v = setupa (); + b.v = setupb (); + if (untrue) + bar(a.v, b.v); + b.v = (__v4sf) _mm_movehl_ps ((__m128)a.v, (__m128)b.v); + foo (a, b); + return 0; +}