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

--- Comment #2 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---
extern unsigned char b;

int
foo (void)
{
  return (unsigned char)(200 + b);
}

gcc -O2 -mapxf 

foo():
  subb $56, b(%rip), %al
  movzbl %al, %eax
  ret

And this can be optimzied to

foo():
  subb $56, b(%rip), %al
  ret

Note, if we want to optimize it in pass_combine, the pattern need to generate
explicit APX NDD instructions, since APX non-NDD will not clear upper bits.

Reply via email to