This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [expand] Fix for PR rtl-optimization/79121 incorrect expansion of extend plus left shift


On 01/18/2017 11:08 AM, Richard Earnshaw (lists) wrote:
PR 79121 is a silent wrong code regression where, when generating a
shift from an extended value moving from one to two machine registers,
the type of the right shift is for the most significant word should be
determined by the signedness of the inner type, not the signedness of
the result type.

gcc:
	PR rtl-optimization/79121
	* expr.c (expand_expr_real_2, case LSHIFT_EXPR): Look at the signedness
	of the inner type when shifting an extended value.

testsuite:
	* gcc.c-torture/execute/pr79121.c: New test.

Bootstrapped on x86_64 and cross-tested on ARM.
I had to refamiliarize myself with this code and nearly got the analysis wrong (again).

Due to the copying of the low word into the high word we have to select the type of shift based on the type of the object that was the source of the NOP conversion. The code currently makes that determination based on the signedness of the shift, which is wrong.


OK for the trunk.

jeff



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]