From: David S. Miller Date: Fri, 28 Oct 2011 05:08:10 +0000 (+0000) Subject: Fix illegal register substitutions on big-endian during cprop_reg. X-Git-Tag: releases/gcc-4.7.0~2753 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26689420afc4cbc1d22e7e4ba09ee80b1bf7d5f4;p=thirdparty%2Fgcc.git Fix illegal register substitutions on big-endian during cprop_reg. * regcprop.c (copyprop_hardreg_forward_1): Reject the transformation when we narrow the mode on big endian. From-SVN: r180600 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 403fb604d283..54e059e51977 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2011-10-27 David S. Miller + + * regcprop.c (copyprop_hardreg_forward_1): Reject the + transformation when we narrow the mode on big endian. + 2011-10-27 Jakub Jelinek * config/i386/sse.md (avx_cvtpd2dq256_2, avx_cvttpd2dq256_2, diff --git a/gcc/regcprop.c b/gcc/regcprop.c index ad92a64cc298..b0f03434b36c 100644 --- a/gcc/regcprop.c +++ b/gcc/regcprop.c @@ -824,6 +824,14 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd) if (hard_regno_nregs[regno][mode] > hard_regno_nregs[regno][vd->e[regno].mode]) goto no_move_special_case; + + /* And likewise, if we are narrowing on big endian the transformation + is also invalid. */ + if (hard_regno_nregs[regno][mode] + < hard_regno_nregs[regno][vd->e[regno].mode] + && (GET_MODE_SIZE (vd->e[regno].mode) > UNITS_PER_WORD + ? WORDS_BIG_ENDIAN : BYTES_BIG_ENDIAN)) + goto no_move_special_case; } /* If the destination is also a register, try to find a source