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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |rtl-optimization

--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
For the original testcase here is what other compilers do:
LLVM trunk:

        movzbl  (%rdi), %eax
        shrq    %rax
        andl    $120, %eax
        movq    table(%rax), %rax
        retq

ICC 2021.3.0:
        movzbl    (%rdi), %eax                                  #5.29
        shrq      $4, %rax                                      #6.23
        movq      table(,%rax,8), %rax                          #6.10
        ret 

MSVC:
        movzx   eax, BYTE PTR [rcx]
        lea     rcx, OFFSET FLAT:unsigned long * table            ; table
        shr     rax, 4
        mov     eax, DWORD PTR [rcx+rax*4]
        ret     0


GCC trunk:
        movzbl  (%rdi), %eax
        shrq    $4, %rax
        movq    table(,%rax,8), %rax



Trying 7 -> 8:
    7: r89:DI=zero_extend([r92:DI])
      REG_DEAD r92:DI
    8: {r90:DI=r89:DI 0>>0x4;clobber flags:CC;}
      REG_DEAD r89:DI
      REG_UNUSED flags:CC
Failed to match this instruction:
(parallel [
        (set (reg:DI 90)
            (zero_extract:DI (mem:QI (reg:DI 92) [0 *p_4(D)+0 S1 A8])
                (const_int 4 [0x4])
                (const_int 4 [0x4])))
        (clobber (reg:CC 17 flags))
    ])
Failed to match this instruction:
(set (reg:DI 90)
    (zero_extract:DI (mem:QI (reg:DI 92) [0 *p_4(D)+0 S1 A8])
        (const_int 4 [0x4])
        (const_int 4 [0x4])))
Failed to match this instruction:
(set (reg:DI 90)
    (and:DI (subreg:DI (lshiftrt:QI (mem:QI (reg:DI 92) [0 *p_4(D)+0 S1 A8])
                (const_int 4 [0x4])) 0)
        (const_int 15 [0xf])))

Reply via email to