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

            Bug ID: 109574
           Summary: RISC-V: gcc.dg/pr90838.c failing due to extra ANDI 127
                    on releases/gcc-13
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vineetg at gcc dot gnu.org
  Target Milestone: ---

int ctz3 (unsigned x)
{
  static int table[32] =
    {
      0, 1, 2,24, 3,19, 6,25, 22, 4,20,10,16, 7,12,26,
      31,23,18, 5,21, 9,15,11,30,17, 8,14,29,13,28,27
    };

  if (x == 0) return 32;
  x = (x & -x) * 0x04D7651F;
  return table[x >> 27];
}

riscv64-unknown-linux-gnu-gcc -O2 -march=rv64gc_zbb

Before

    ctz3:
        ctzw    a0,a0
        ret

Now

    ctz3:
        ctzw    a0,a0
        andi    a0,a0,127
        ret

Bisected this to c23a9c87cc62bd177 ("Some additional zero-extension related
optimizations in simplify-rtx.")

Reply via email to