This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/44490] X86 memory mismatch stall



------- Comment #1 from hjl dot tools at gmail dot com  2010-06-10 05:23 -------
This patch

---
iff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
index a33d3af..6f569cc 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -820,7 +820,10 @@

   /* All patterns using aligned_operand on memory operands ends up
      in promoting memory operand to 64bit and thus causing memory mismatch. 
*/
-  if (TARGET_MEMORY_MISMATCH_STALL && !optimize_insn_for_size_p ())
+  if (TARGET_MEMORY_MISMATCH_STALL
+      && !optimize_insn_for_size_p ()
+      && (!MEM_EXPR (op)
+         || TREE_CODE (MEM_EXPR (op)) != PARM_DECL))
     return 0;

   /* Don't even try to do any aligned optimizations with volatiles.  */
----

helps. I got

        .file   "call-1.c"
        .text
        .p2align 4,,15
.globl foo
        .type   foo, @function
foo:
        pushl   %ebp
        movl    %esp, %ebp
        movl    12(%ebp), %eax
        addl    8(%ebp), %eax
        addl    16(%ebp), %eax
        popl    %ebp
        ret
        .size   foo, .-foo
        .p2align 4,,15
.globl bar
        .type   bar, @function
bar:
        pushl   %ebp
        movl    %esp, %ebp
        movswl  12(%ebp), %eax << still read 2 bytes.
        movswl  16(%ebp), %edx
        movswl  8(%ebp), %ecx
        movl    %edx, 12(%ebp)
        movl    %ecx, 16(%ebp)
        movl    %eax, 8(%ebp)
        popl    %ebp
        jmp     foo


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44490


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]