https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101955

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is also the sign extend for loading one bit.
That is take
struct g
{
    int a:1;
    int b0:1;
    int b1:1;
    int b2:1;
    int b:1;
};

int h(struct g *a)
{
    return a->a;
}

Currently on x86_64 -O2 GCC does:

        movzbl  (%rdi), %eax
        sall    $31, %eax
        sarl    $31, %eax
        ret

While we should do (and llvm does):
        movzbl  (%rdi), %eax
        andl    $1, %eax
        negl    %eax
        retq

This helps really on targets like avr more than any really.

Reply via email to