view gcc/testsuite/gcc.dg/torture/pr75964.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* { dg-do run } */

typedef __UINT8_TYPE__ uint8_t;

uint8_t __attribute__ ((noinline, noclone))
abs8 (uint8_t x)
{
  if (x & 0x80)
    x = -x;

  if (x & 0x80)
    x = 0x7f;

  return x;
}

int
main (void)
{
  if (abs8 (0) != 0
      || abs8 (1) != 1
      || abs8 (127) != 127
      || abs8 (128) != 127
      || abs8 (129) != 127
      || abs8 (255) != 1)
    __builtin_abort ();
  return 0;
}