[Bug target/49305] SH Target: internal compiler error: in reload_cse_simplify_operands, at postreload.c:403
kkojima at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jun 7 14:04:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49305
Kazumoto Kojima <kkojima at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
Target| |sh2a-*-*
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011.06.07 14:03:19
CC| |kkojima at gcc dot gnu.org
Ever Confirmed|0 |1
--- Comment #1 from Kazumoto Kojima <kkojima at gcc dot gnu.org> 2011-06-07 14:03:19 UTC ---
It seems that my recent patch
r174586 | kkojima | 2011-06-03 07:26:42 +0900 (Fri, 03 Jun 2011) | 7 lines
* config/sh/predicates.md (general_movsrc_operand): Return 0
for memory and memory subreg of which address is an invalid
indexed address for QI and HImode.
(general_movdst_operand): Likewise.
reveals a latent bug. The insn
(insn 2358 4549 2359 471 (set (reg:SI 0 r0 [1023])
(sign_extend:SI (mem/s:HI (plus:SI (reg:SI 2 r2)
(const_int 12 [0xc])) [5 fp_167(D)->_flags+0 S2 A32])))
../../../../../../newlib-1.19.0/newlib/libc/stdio/vfwscanf.c:1447 164
{*extendqisi2_compact}
(nil))
has the pattern of *extendhisi2_compact but is strangely handled
as *extendqisi2_compact. It looks the combined pass does this.
BTW, when looking into the PR, I've noticed that SH backend forgot
to use 32-bit mov.w instruction with 12-bit display for SH2A.
The patch below will work around this PR, though we should see
what is going on in the combined pass first.
diff -up ORIG/trunk/gcc/config/sh/sh.c trunk/gcc/config/sh/sh.c
--- ORIG/trunk/gcc/config/sh/sh.c 2011-06-02 09:41:16.000000000 +0900
+++ trunk/gcc/config/sh/sh.c 2011-06-07 20:25:49.000000000 +0900
@@ -9736,8 +9736,11 @@ sh_legitimate_index_p (enum machine_mode
if (TARGET_SH2A)
{
- if (GET_MODE_SIZE (mode) == 1
- && (unsigned) INTVAL (op) < 4096)
+ if ((GET_MODE_SIZE (mode) == 1
+ && (unsigned) INTVAL (op) < 4096)
+ || (GET_MODE_SIZE (mode) == 2
+ && (unsigned) INTVAL (op) < 8192
+ && !(INTVAL (op) & 1)))
return true;
}
diff -up ORIG/trunk/gcc/config/sh/sh.md trunk/gcc/config/sh/sh.md
--- ORIG/trunk/gcc/config/sh/sh.md 2010-08-28 13:32:01.000000000 +0900
+++ trunk/gcc/config/sh/sh.md 2011-06-07 20:33:58.000000000 +0900
@@ -4585,7 +4585,12 @@ label:
"@
exts.w %1,%0
mov.w %1,%0"
- [(set_attr "type" "arith,load")])
+ [(set_attr "type" "arith,load")
+ (set_attr_alternative "length"
+ [(const_int 2)
+ (if_then_else
+ (ne (symbol_ref "TARGET_SH2A") (const_int 0))
+ (const_int 4) (const_int 2))])])
(define_insn "*extendhisi2_media"
[(set (match_operand:SI 0 "register_operand" "=r,r")
@@ -5308,7 +5313,20 @@ label:
sts %1,%0
lds %1,%0
fake %1,%0"
- [(set_attr "type" "pcload,move,load,move,store,move,move,pcload")])
+ [(set_attr "type" "pcload,move,load,move,store,move,move,pcload")
+ (set_attr_alternative "length"
+ [(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)
+ (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)])])
(define_insn "*movhi_media"
[(set (match_operand:HI 0 "general_movdst_operand" "=r,r,r,r,m")
More information about the Gcc-bugs
mailing list