From: Oleg Endo Date: Thu, 11 Feb 2016 09:15:26 +0000 (+0000) Subject: backport: re PR target/69713 (Invalid code of optimization in SH) X-Git-Tag: releases/gcc-4.9.4~337 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ca2c65d6e96e4474559d6eb265c93a55be4e559;p=thirdparty%2Fgcc.git backport: re PR target/69713 (Invalid code of optimization in SH) gcc/ Backport from mainline 2016-02-11 Oleg Endo PR target/69713 * config/sh/sh.md (casesi_worker_0): Add T_REG use. From-SVN: r233329 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5ac9db343a78..6c91448fb758 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2016-02-11 Oleg Endo + + Backport from mainline + 2016-02-11 Oleg Endo + + PR target/69713 + * config/sh/sh.md (casesi_worker_0): Add T_REG use. + 2016-02-11 Jakub Jelinek Backported from mainline diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md index c1caabd3a10f..906abb773652 100644 --- a/gcc/config/sh/sh.md +++ b/gcc/config/sh/sh.md @@ -10719,12 +10719,16 @@ label: ;; ??? reload might clobber r0 if we use it explicitly in the RTL before ;; reload; using a R0_REGS pseudo reg is likely to give poor code. ;; So we keep the use of r0 hidden in a R0_REGS clobber until after reload. +;; +;; The use on the T_REG in the casesi_worker* patterns links the bounds +;; checking insns and the table memory access. See also PR 69713. (define_insn "casesi_worker_0" [(set (match_operand:SI 0 "register_operand" "=r,r") (unspec:SI [(match_operand:SI 1 "register_operand" "0,r") (label_ref (match_operand 2 "" ""))] UNSPEC_CASESI)) (clobber (match_scratch:SI 3 "=X,1")) - (clobber (match_scratch:SI 4 "=&z,z"))] + (clobber (match_scratch:SI 4 "=&z,z")) + (use (reg:SI T_REG))] "TARGET_SH1" "#") @@ -10733,7 +10737,8 @@ label: (unspec:SI [(match_operand:SI 1 "register_operand" "") (label_ref (match_operand 2 "" ""))] UNSPEC_CASESI)) (clobber (match_scratch:SI 3 "")) - (clobber (match_scratch:SI 4 ""))] + (clobber (match_scratch:SI 4)) + (use (reg:SI T_REG))] "TARGET_SH1 && ! TARGET_SH2 && reload_completed" [(set (reg:SI R0_REG) (unspec:SI [(label_ref (match_dup 2))] UNSPEC_MOVA)) (parallel [(set (match_dup 0) @@ -10751,7 +10756,8 @@ label: (unspec:SI [(match_operand:SI 1 "register_operand" "") (label_ref (match_operand 2 "" ""))] UNSPEC_CASESI)) (clobber (match_scratch:SI 3 "")) - (clobber (match_scratch:SI 4 ""))] + (clobber (match_scratch:SI 4)) + (use (reg:SI T_REG))] "TARGET_SH2 && reload_completed" [(set (reg:SI R0_REG) (unspec:SI [(label_ref (match_dup 2))] UNSPEC_MOVA)) (parallel [(set (match_dup 0)