[Bug target/31403] wrong branch instructions generated with -m2a on sh-elf

kkojima at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Apr 20 07:46:00 GMT 2007



------- Comment #2 from kkojima at gcc dot gnu dot org  2007-04-20 08:45 -------
A binary search shows that this started to fail from
the revision 123295

        * config/sh/sh.md (movsi_ie): Fix memory constraints attribute length.

I'd like to add Christian to the cc list because he must be interested
in this issue.  movsi_ie is used also for SH2A and I didn't know that
SH2A has 4-byte move instructions like mov.l reg,@(12-bit_disp,reg').
An easy fix would be the patch below, though I can't test it until
the other bootstrap/regtest cycles end up.

--- ORIG/trunk/gcc/config/sh/sh.md      2007-03-29 08:44:33.000000000 +0900
+++ LOCAL/trunk/gcc/config/sh/sh.md     2007-04-19 20:36:20.000000000 +0900
@@ -4968,7 +4968,36 @@ label:
        ! move optimized away"
   [(set_attr "type"
"pcload_si,move,movi8,move,*,load_si,mac_gp,prget,arith,store,mac_mem,pstore,gp_mac,prset,mem_mac,pload,load,fstore,pcload_si,gp_fpul,fpul_gp,fmove,fmove,fmove,nil")
    (set_attr "late_fp_use"
"*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,yes,*,*,yes,*,*,*,*")
-   (set_attr "length" "*,*,*,4,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,*,0")])
+   (set_attr_alternative "length"
+     [(const_int 2)
+      (const_int 2)
+      (const_int 2)
+      (const_int 4)
+      (const_int 2)
+      (if_then_else
+       (ne (symbol_ref "TARGET_SH2A") (const_int 0))
+       (const_int 4) (const_int 2))
+      (const_int 2)
+      (const_int 2)
+      (const_int 2)
+      (if_then_else
+       (ne (symbol_ref "TARGET_SH2A") (const_int 0))
+       (const_int 4) (const_int 2))
+      (const_int 2)
+      (const_int 2)
+      (const_int 2)
+      (const_int 2)
+      (const_int 2)
+      (const_int 2)
+      (const_int 2)
+      (const_int 2)
+      (const_int 2)
+      (const_int 2)
+      (const_int 2)
+      (const_int 2)
+      (const_int 2)
+      (const_int 2)
+      (const_int 0)])])

 (define_insn "movsi_i_lowpart"
   [(set (strict_low_part (match_operand:SI 0 "general_movdst_operand"
"+r,r,r,r,r,r,r,m,r"))


-- 

kkojima at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kkojima at gcc dot gnu dot
                   |                            |org, christian dot bruel at
                   |                            |st dot com
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-04-20 08:45:54
               date|                            |
            Summary|Problem while compiling gcc |wrong branch instructions
                   |for sh-elf                  |generated with -m2a on sh-
                   |                            |elf


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



More information about the Gcc-bugs mailing list