Bug 109574 - RISC-V: gcc.dg/pr90838.c failing due to extra ANDI 127 on releases/gcc-13
Summary: RISC-V: gcc.dg/pr90838.c failing due to extra ANDI 127 on releases/gcc-13
Status: RESOLVED DUPLICATE of bug 106888
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 13.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-20 18:59 UTC by Vineet Gupta
Modified: 2023-04-20 19:00 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vineet Gupta 2023-04-20 18:59:00 UTC
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.")
Comment 1 Andrew Pinski 2023-04-20 19:00:50 UTC
Dup of bug 106888.

*** This bug has been marked as a duplicate of bug 106888 ***