diff options
Diffstat (limited to 'gdb/testsuite/gdb.dwarf2/clztest.c')
-rw-r--r-- | gdb/testsuite/gdb.dwarf2/clztest.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.dwarf2/clztest.c b/gdb/testsuite/gdb.dwarf2/clztest.c new file mode 100644 index 0000000..5fad7ec --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/clztest.c @@ -0,0 +1,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; +} |