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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|switch expansion produces a |[9/10 Regression] switch
                   |jump table with trivial     |expansion produces a jump
                   |entries                     |table with trivial entries
   Target Milestone|---                         |10.4

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
In GCC 11, we do the right thing again.

On the trunk we even do even better by using btq:
        cmpb    $18, %dil
        ja      .L3
        movl    $348018, %eax
        btq     %rdi, %rax
        setc    %al
        ret
.L3:
        xorl    %eax, %eax
        ret

Note clang does not so good job:
        addb    $-1, %dil
        cmpb    $18, %dil
        setb    %cl
        movzbl  %dil, %eax
        movl    $174009, %edx                   # imm = 0x2A7B9
        btl     %eax, %edx
        setb    %al
        andb    %cl, %al
        retq

Reply via email to