public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/28232]  New: wrong movua.l  instruction combine  for sh4a
@ 2006-07-03 11:59 tyokota at k2 dot dion dot ne dot jp
  2006-07-03 22:49 ` [Bug target/28232] Wrong aligned load is generated with -m4a on sh-* kkojima at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: tyokota at k2 dot dion dot ne dot jp @ 2006-07-03 11:59 UTC (permalink / raw)
  To: gcc-bugs

union unaligned {
        void *ptr;
} __attribute__((__packed__));

void *foo(union unaligned *p) {
  return (p->ptr);
}

--------------------
sh-elf-gcc -V4.1.1 -S -O2 -m4a test2.c

combine optimize change movua.l to mov.l instruction.

        .file   "test2.c"
        .text
        .text
        .align 1
        .align 5
        .global _foo
        .type   _foo, @function
_foo:
        mov.l   @r4,r0
        mov.l   r14,@-r15
        mov     r15,r14
        mov     r14,r15
        mov.l   @r15+,r14
        rts
        nop
        .size   _foo, .-_foo
        .ident  "GCC: (GNU) 4.1.1"


-- 
           Summary: wrong movua.l  instruction combine  for sh4a
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tyokota at k2 dot dion dot ne dot jp
GCC target triplet: sh-elf


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/28232] Wrong aligned load is generated with -m4a on sh-*
  2006-07-03 11:59 [Bug target/28232] New: wrong movua.l instruction combine for sh4a tyokota at k2 dot dion dot ne dot jp
@ 2006-07-03 22:49 ` kkojima at gcc dot gnu dot org
  2006-07-06 22:35 ` patchapp at dberlin dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2006-07-03 22:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from kkojima at gcc dot gnu dot org  2006-07-03 22:49 -------
I've confirmed that 4.0 and 4.2 behave same as 4.1.  So all compilers
which support -m4a option have this issue.  It seems that the combine
is too smart and replaces the movua insn

(define_insn "movua"
  [(set (match_operand:SI 0 "register_operand" "=z")
        (sign_extract:SI (match_operand:SI 1 "unaligned_load_operand" "Sua>")
                         (const_int 32) (const_int 0)))]
  "TARGET_SH4A_ARCH"
  "movua.l      %1,%0"
  [(set_attr "type" "movua")])

with the usual load insn.  I'm testing the patch below.

--- ORIG/trunk/gcc/config/sh/sh.md      2006-06-14 06:15:09.000000000 +0900
+++ LOCAL/trunk/gcc/config/sh/sh.md     2006-07-03 16:43:56.000000000 +0900
@@ -152,6 +152,7 @@
   (UNSPEC_THUNK                36)
   (UNSPEC_SP_SET       40)
   (UNSPEC_SP_TEST      41)
+  (UNSPEC_MOVUA                42)

   ;; These are used with unspec_volatile.
   (UNSPECV_BLOCKAGE    0)
@@ -11121,8 +11122,8 @@ mov.l\\t1f,r0\\n\\

 (define_insn "movua"
   [(set (match_operand:SI 0 "register_operand" "=z")
-       (sign_extract:SI (match_operand:SI 1 "unaligned_load_operand" "Sua>")
-                        (const_int 32) (const_int 0)))]
+       (unspec:SI [(match_operand:SI 1 "unaligned_load_operand" "Sua>")]
+                  UNSPEC_MOVUA))]
   "TARGET_SH4A_ARCH"
   "movua.l     %1,%0"
   [(set_attr "type" "movua")])


-- 

kkojima at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
      Known to fail|                            |4.0.3 4.1.1 4.2.0
            Summary|wrong movua.l  instruction  |Wrong aligned load is
                   |combine  for sh4a           |generated with -m4a on sh-*


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/28232] Wrong aligned load is generated with -m4a on sh-*
  2006-07-03 11:59 [Bug target/28232] New: wrong movua.l instruction combine for sh4a tyokota at k2 dot dion dot ne dot jp
  2006-07-03 22:49 ` [Bug target/28232] Wrong aligned load is generated with -m4a on sh-* kkojima at gcc dot gnu dot org
@ 2006-07-06 22:35 ` patchapp at dberlin dot org
  2006-07-10 23:02 ` kkojima at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: patchapp at dberlin dot org @ 2006-07-06 22:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from patchapp at dberlin dot org  2006-07-06 22:35 -------
Subject: Bug number PR target/28232

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2006-07/msg00266.html


-- 


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/28232] Wrong aligned load is generated with -m4a on sh-*
  2006-07-03 11:59 [Bug target/28232] New: wrong movua.l instruction combine for sh4a tyokota at k2 dot dion dot ne dot jp
  2006-07-03 22:49 ` [Bug target/28232] Wrong aligned load is generated with -m4a on sh-* kkojima at gcc dot gnu dot org
  2006-07-06 22:35 ` patchapp at dberlin dot org
@ 2006-07-10 23:02 ` kkojima at gcc dot gnu dot org
  2006-10-23  0:14 ` kkojima at gcc dot gnu dot org
  2006-10-23  0:28 ` kkojima at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2006-07-10 23:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from kkojima at gcc dot gnu dot org  2006-07-10 23:02 -------
Richard Sandiford gave a more thorough patch in
http://gcc.gnu.org/ml/gcc-patches/2006-07/msg00335.html
and it's approved for the next stage1 of mainline.


-- 

kkojima at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |kkojima at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-07-10 23:02:25
               date|                            |
   Target Milestone|---                         |4.3.0


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/28232] Wrong aligned load is generated with -m4a on sh-*
  2006-07-03 11:59 [Bug target/28232] New: wrong movua.l instruction combine for sh4a tyokota at k2 dot dion dot ne dot jp
                   ` (2 preceding siblings ...)
  2006-07-10 23:02 ` kkojima at gcc dot gnu dot org
@ 2006-10-23  0:14 ` kkojima at gcc dot gnu dot org
  2006-10-23  0:28 ` kkojima at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2006-10-23  0:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from kkojima at gcc dot gnu dot org  2006-10-23 00:14 -------
Subject: Bug 28232

Author: kkojima
Date: Mon Oct 23 00:14:39 2006
New Revision: 117961

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117961
Log:
        PR target/28232
        * config/sh/sh.c (expand_block_move): Use a BLKmode rather than
        SImode memory reference for the source of a movua.
        * config/sh/sh.md (UNSPEC_MOVUA): New macro.
        (movua): Use an unspec instead of sign_extract.  Expect the source
        to have mode BLKmode.
        (extv, insv): Use a BLKmode rather than SImode memory reference
        for the source of a movua.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/sh/sh.c
    trunk/gcc/config/sh/sh.md


-- 


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/28232] Wrong aligned load is generated with -m4a on sh-*
  2006-07-03 11:59 [Bug target/28232] New: wrong movua.l instruction combine for sh4a tyokota at k2 dot dion dot ne dot jp
                   ` (3 preceding siblings ...)
  2006-10-23  0:14 ` kkojima at gcc dot gnu dot org
@ 2006-10-23  0:28 ` kkojima at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2006-10-23  0:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from kkojima at gcc dot gnu dot org  2006-10-23 00:28 -------
Fixed.


-- 

kkojima at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-10-23  0:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-03 11:59 [Bug target/28232] New: wrong movua.l instruction combine for sh4a tyokota at k2 dot dion dot ne dot jp
2006-07-03 22:49 ` [Bug target/28232] Wrong aligned load is generated with -m4a on sh-* kkojima at gcc dot gnu dot org
2006-07-06 22:35 ` patchapp at dberlin dot org
2006-07-10 23:02 ` kkojima at gcc dot gnu dot org
2006-10-23  0:14 ` kkojima at gcc dot gnu dot org
2006-10-23  0:28 ` kkojima at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).