From: Richard Henderson Date: Thu, 26 Mar 1998 00:20:08 +0000 (-0800) Subject: * combine.c (make_compound_operation): Simplify (subreg (*_extend) 0). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6f28d3e98257593850baca079e60a59eae47bc9f;p=gcc.git * combine.c (make_compound_operation): Simplify (subreg (*_extend) 0). From-SVN: r18836 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dddc848c105..028e157752c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +Thu Mar 26 00:19:47 1998 Richard Henderson + + * combine.c (make_compound_operation): Simplify (subreg (*_extend) 0). + Wed Mar 25 23:53:11 1998 Jeffrey A Law (law@cygnus.com) * pa.c (pa_adjust_cost): Avoid redundant calls to get_attr_type. diff --git a/gcc/combine.c b/gcc/combine.c index 8cb32dc67c6..4bef563f1b8 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -6038,6 +6038,23 @@ make_compound_operation (x, in_code) return newer; } + + /* If this is a paradoxical subreg, and the new code is a sign or + zero extension, omit the subreg and widen the extension. If it + is a regular subreg, we can still get rid of the subreg by not + widening so much, or in fact removing the extension entirely. */ + if ((GET_CODE (tem) == SIGN_EXTEND + || GET_CODE (tem) == ZERO_EXTEND) + && subreg_lowpart_p (x)) + { + if (GET_MODE_SIZE (mode) > GET_MODE_SIZE (GET_MODE (tem)) + || (GET_MODE_SIZE (mode) > + GET_MODE_SIZE (GET_MODE (XEXP (tem, 0))))) + tem = gen_rtx_combine (GET_CODE (tem), mode, XEXP (tem, 0)); + else + tem = gen_lowpart_for_combine (mode, XEXP (tem, 0)); + return tem; + } break; default: