xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.dwarf2/clztest.c (revision a5a4af3bd380a7b58b758d9b311cef9f7c34aeb4)
1*a5a4af3bSchristos /* { dg-do run { target { x86_64-*-* && lp64 } } } */
2*a5a4af3bSchristos /* { dg-options "-g" } */
3*a5a4af3bSchristos 
4*a5a4af3bSchristos volatile int vv;
5*a5a4af3bSchristos 
6*a5a4af3bSchristos __attribute__((noinline, noclone)) long
foo(long x)7*a5a4af3bSchristos foo (long x)
8*a5a4af3bSchristos {
9*a5a4af3bSchristos   long f = __builtin_clzl (x);
10*a5a4af3bSchristos   long g = f;
11*a5a4af3bSchristos   asm volatile ("" : "+r" (f));
12*a5a4af3bSchristos   vv++;		/* { dg-final { gdb-test 12 "g" "43" } } */
13*a5a4af3bSchristos   return f;	/* { dg-final { gdb-test 12 "f" "43" } } */
14*a5a4af3bSchristos }
15*a5a4af3bSchristos 
16*a5a4af3bSchristos __attribute__((noinline, noclone)) long
bar(long x)17*a5a4af3bSchristos bar (long x)
18*a5a4af3bSchristos {
19*a5a4af3bSchristos   long f = __builtin_clzl (x);
20*a5a4af3bSchristos   long g = f;
21*a5a4af3bSchristos   asm volatile ("" : "+r" (f));
22*a5a4af3bSchristos   vv++;		/* { dg-final { gdb-test 22 "g" "33" } } */
23*a5a4af3bSchristos   return f;	/* { dg-final { gdb-test 22 "f" "33" } } */
24*a5a4af3bSchristos }
25*a5a4af3bSchristos 
26*a5a4af3bSchristos int
main()27*a5a4af3bSchristos main ()
28*a5a4af3bSchristos {
29*a5a4af3bSchristos   long x = vv;
30*a5a4af3bSchristos   foo (x + 0x123456UL);
31*a5a4af3bSchristos   bar (x + 0x7fffffffUL);
32*a5a4af3bSchristos   return 0;
33*a5a4af3bSchristos }
34