summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/inline-asm-mixed-style.c
diff options
context:
space:
mode:
authorDenis Zobnin <d.zobnin.bugzilla@gmail.com>2016-04-21 10:59:18 +0000
committerDenis Zobnin <d.zobnin.bugzilla@gmail.com>2016-04-21 10:59:18 +0000
commit628b022a0eb63ca8445783140bc8389ff80ebe1a (patch)
tree24ff49d4634e4396121e6276cce9aa2252f45c6c /clang/test/CodeGen/inline-asm-mixed-style.c
parent023ef1bd13b10cd9e673f7c24c21d3e0f1f569db (diff)
downloadbcm5719-llvm-628b022a0eb63ca8445783140bc8389ff80ebe1a.tar.gz
bcm5719-llvm-628b022a0eb63ca8445783140bc8389ff80ebe1a.zip
Correctly parse GCC-style asm line following MS-style asm line.
Quit parsing MS-style inline assembly if the following statement has GCC style. Enables compilation of code like void f() { __asm mov ebx, ecx __asm__("movl %ecx, %edx"); } Differential Revision: http://reviews.llvm.org/D18652 llvm-svn: 266976
Diffstat (limited to 'clang/test/CodeGen/inline-asm-mixed-style.c')
-rw-r--r--clang/test/CodeGen/inline-asm-mixed-style.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/clang/test/CodeGen/inline-asm-mixed-style.c b/clang/test/CodeGen/inline-asm-mixed-style.c
new file mode 100644
index 00000000000..914a11d3512
--- /dev/null
+++ b/clang/test/CodeGen/inline-asm-mixed-style.c
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -triple i386-unknown-unknown -fasm-blocks -fsyntax-only -verify %s -DCHECK_ASM_GOTO
+// RUN: %clang_cc1 -triple i386-unknown-unknown -fasm-blocks -O0 -emit-llvm -S %s -o - | FileCheck %s
+
+void f() {
+ __asm mov eax, ebx
+ __asm mov ebx, ecx
+ __asm__("movl %ecx, %edx");
+ // CHECK: movl %ebx, %eax
+ // CHECK: movl %ecx, %ebx
+ // CHECK: movl %ecx, %edx
+
+ __asm mov eax, ebx
+ __asm volatile ("movl %ecx, %edx");
+ // CHECK: movl %ebx, %eax
+ // CHECK: movl %ecx, %edx
+
+ __asm mov eax, ebx
+ __asm const ("movl %ecx, %edx"); // expected-warning {{ignored const qualifier on asm}}
+ // CHECK: movl %ebx, %eax
+ // CHECK: movl %ecx, %edx
+
+#ifdef CHECK_ASM_GOTO
+ __asm volatile goto ("movl %ecx, %edx"); // expected-error {{'asm goto' constructs are not supported yet}}
+
+ __asm mov eax, ebx
+ __asm goto ("movl %ecx, %edx"); // expected-error {{'asm goto' constructs are not supported yet}}
+#endif
+}
OpenPOWER on IntegriCloud