------- 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

Reply via email to