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/19/2017 03:37 AM, Richard Earnshaw (lists) wrote:
On 18/01/17 21:07, Jeff Law wrote:
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



Thanks, Jeff.  I made some minor tweaks to the comments (adding a bit
more about signed vs unsigned) and committed the following.

What about gcc-6?
I'd think it should be fine for gcc-6 as well. I don't think that code has changed since it first went in. So the analysis and patch should both still apply.

jeff


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