gcc/testsuite/g++.old-deja/g++.pt/asm2.C
raw| 1 | // { dg-do assemble { target { { i?86-*-* x86_64-*-* } && ia32 } } } |
| 2 | // We'd use ebx with 32-bit pic code, so require nonpic. |
| 3 | // { dg-require-effective-target nonpic } |
| 4 | // Origin: "Weidmann, Nicholas" <[email protected]> |
| 5 | |
| 6 | typedef void (function_ptr)(int); |
| 7 | |
| 8 | void foo(int) |
| 9 | { |
| 10 | } |
| 11 | |
| 12 | template<function_ptr ptr> void doit(int i) |
| 13 | { |
| 14 | __asm__("pushl %0\n\t" |
| 15 | "call *%1\n\t" |
| 16 | "popl %0" |
| 17 | : |
| 18 | : "a" (i), "b" (ptr)); |
| 19 | } |
| 20 | |
| 21 | void bar() |
| 22 | { |
| 23 | doit<foo>(123); |
| 24 | } |