diff options
Diffstat (limited to 'clang/test/ASTMerge/asm')
-rw-r--r-- | clang/test/ASTMerge/asm/Inputs/asm-function.cpp | 21 | ||||
-rw-r--r-- | clang/test/ASTMerge/asm/test.cpp | 8 |
2 files changed, 29 insertions, 0 deletions
diff --git a/clang/test/ASTMerge/asm/Inputs/asm-function.cpp b/clang/test/ASTMerge/asm/Inputs/asm-function.cpp new file mode 100644 index 00000000000..1b8783354fc --- /dev/null +++ b/clang/test/ASTMerge/asm/Inputs/asm-function.cpp @@ -0,0 +1,21 @@ + +unsigned char asmFunc(unsigned char a, unsigned char b) { + unsigned int la = a; + unsigned int lb = b; + unsigned int bigres; + unsigned char res; + __asm__ ("0:\n1:\n" : [bigres] "=la"(bigres) : [la] "0"(la), [lb] "c"(lb) : + "edx", "cc"); + res = bigres; + return res; +} + +int asmFunc2(int i) { + int res; + asm ("mov %1, %0 \t\n" + "inc %0 " + : "=r" (res) + : "r" (i) + : "cc"); + return res; +} diff --git a/clang/test/ASTMerge/asm/test.cpp b/clang/test/ASTMerge/asm/test.cpp new file mode 100644 index 00000000000..8c3bdfe17b7 --- /dev/null +++ b/clang/test/ASTMerge/asm/test.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -triple i386-unknown-unknown -fcxx-exceptions -emit-pch -o %t.1.ast %S/Inputs/asm-function.cpp +// RUN: %clang_cc1 -triple i386-unknown-unknown -fcxx-exceptions -ast-merge %t.1.ast -fsyntax-only -verify %s +// expected-no-diagnostics + +void testAsmImport() { + asmFunc(12, 42); + asmFunc2(42); +} |