summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.dwarf2/clztest.c
blob: 5fad7ec31b228b2ff7102079dde55f0e89fa4bd0 (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
/* { dg-do run { target { x86_64-*-* && lp64 } } } */
/* { dg-options "-g" } */

volatile int vv;

__attribute__((noinline, noclone)) long
foo (long x)
{
  long f = __builtin_clzl (x);
  long g = f;
  asm volatile ("" : "+r" (f));
  vv++;		/* { dg-final { gdb-test 12 "g" "43" } } */
  return f;	/* { dg-final { gdb-test 12 "f" "43" } } */
}

__attribute__((noinline, noclone)) long
bar (long x)
{
  long f = __builtin_clzl (x);
  long g = f;
  asm volatile ("" : "+r" (f));
  vv++;		/* { dg-final { gdb-test 22 "g" "33" } } */
  return f;	/* { dg-final { gdb-test 22 "f" "33" } } */
}

int
main ()
{
  long x = vv;
  foo (x + 0x123456UL);
  bar (x + 0x7fffffffUL);
  return 0;
}