This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/64718] Bad 16-bit bswap replacement


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

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
A run-time testcase:

[hjl@gnu-mic-2 gcc-regression]$ cat pr64718.c
int
__attribute__ ((noinline, noclone))
swap(int x)
{
  return (unsigned short)((unsigned short)x << 8 | (unsigned short)x >> 8);
}

int a = 0x1234;

int
main()
{
  int b = 0x1234;
  if (swap (a) != 0x3412)
    __builtin_abort ();
  if (swap (b) != 0x3412)
    __builtin_abort ();
  return 0;
}
[hjl@gnu-mic-2 gcc-regression]$


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]