[PATCH] Fix expansion of comparisons into signed type with 1-bit precision (PR middle-end/48973)
H.J. Lu
hjl.tools@gmail.com
Mon May 23 14:34:00 GMT 2011
On Thu, May 12, 2011 at 7:36 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> The read from a 1-bit signed bitfield initialized by a comparison
> is optimized into the comparison, which has that 1-bit signed bitfield
> comparison. Unfortunately that is still expanded as setting the result
> to 0 resp. 1 instead of this case 0 resp. -1 QImode pseudo, which is then
> sign extended into SImode for the comparison.
>
> Fixed by special casing expansion in that case. I think it is rare enough
> we can just ignore the fold_single_bit_test optimization in that case,
> rather than having two versions thereof.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk/4.6?
>
> 2011-05-12 Jakub Jelinek <jakub@redhat.com>
>
> PR middle-end/48973
> * expr.c (expand_expr_real_2) <case LT_EXPR>: If do_store_flag
> failed and the comparison has a single bit signed type, use
> constm1_rtx instead of const1_rtx for true value.
> (do_store_flag): If ops->type is single bit signed type, disable
> signel bit test optimization and pass -1 instead of 1 as last
> parameter to emit_store_flag_force.
>
> * gcc.c-torture/execute/pr48973-1.c: New test.
> * gcc.c-torture/execute/pr48973-2.c: New test.
>
This caused:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49123
H.J.
More information about the Gcc-patches
mailing list