aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/pr89965.c
blob: db6382cbf803a52c443fd96387ea90581eab9a89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* PR rtl-optimization/89965 */
/* { dg-do run } */
/* { dg-options "-O -mtune=nano-x2 -fcaller-saves -fexpensive-optimizations -fno-tree-dce -fno-tree-ter" } */
/* { dg-additional-options "-march=i386" { target ia32 } } */

int a;

__attribute__ ((noipa)) unsigned long long
foo (unsigned char c, unsigned d, unsigned e, unsigned long long f,
     unsigned char g, unsigned h, unsigned long long i)
{
  (void) d;
  unsigned short j = __builtin_mul_overflow_p (~0, h, c);
  e <<= e;
  i >>= 7;
  c *= i;
  i /= 12;
  a = __builtin_popcount (c);
  __builtin_add_overflow (e, a, &f);
  return c + f + g + j + h;
}

__attribute__ ((noipa)) void
bar (void)
{
  char buf[64];
  __builtin_memset (buf, 0x55, sizeof buf);
  asm volatile ("" : : "r" (&buf[0]) : "memory");
}

int
main (void)
{
  bar ();
  unsigned long long x = foo (2, 0, 0, 0, 0, 0, 0);
  if (x != 0)
    __builtin_abort ();
  return 0;
}