Hi,

Since we don't have movmisaligntf pattern, we need to handle misaligned
load/store in *movtf_internal, similar to *movti_internal_*.  OK for
trunk?

Thanks.


H.J.
---
gcc/

2011-05-26  H.J. Lu  <hongjiu...@intel.com>

        PR target/49168
        * config/i386/i386.md (*movtf_internal): Handle misaligned
        load/store.

gcc/testsuite/

2011-05-26  H.J. Lu  <hongjiu...@intel.com>

        PR target/49168
         * gcc.target/i386/pr49168-1.c: New.

diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 13a1cde..034cda8 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -2805,10 +2805,23 @@
     {
     case 0:
     case 1:
-      if (get_attr_mode (insn) == MODE_V4SF)
-       return "%vmovaps\t{%1, %0|%0, %1}";
+      /* Handle misaligned load/store since we don't have movmisaligntf
+        pattern. */
+      if (misaligned_operand (operands[0], TFmode)
+         || misaligned_operand (operands[1], TFmode))
+       {
+         if (get_attr_mode (insn) == MODE_V4SF)
+           return "%vmovups\t{%1, %0|%0, %1}";
+         else
+           return "%vmovdqu\t{%1, %0|%0, %1}";
+       }
       else
-       return "%vmovdqa\t{%1, %0|%0, %1}";
+       {
+         if (get_attr_mode (insn) == MODE_V4SF)
+           return "%vmovaps\t{%1, %0|%0, %1}";
+         else
+           return "%vmovdqa\t{%1, %0|%0, %1}";
+       }
 
     case 2:
       return standard_sse_constant_opcode (insn, operands[1]);
diff --git a/gcc/testsuite/gcc.target/i386/pr49168-1.c 
b/gcc/testsuite/gcc.target/i386/pr49168-1.c
new file mode 100644
index 0000000..9676dc8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr49168-1.c
@@ -0,0 +1,11 @@
+/* PR target/49168  */
+/* { dg-do compile } */
+/* { dg-options "-O2 -msse2 -mtune=generic" } */
+/* { dg-final { scan-assembler-not "movdqa\[\t \]*%xmm\[0-9\]\+,\[^,\]*" } } */
+/* { dg-final { scan-assembler "movdqu\[\t \]*%xmm\[0-9\]\+,\[^,\]*" } } */
+
+void
+flt128_va (void *mem, __float128 d)
+{ 
+  __builtin_memcpy (mem, &d, sizeof (d));
+}

Reply via email to