diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/Analysis/asm-goto.cpp | 52 | ||||
-rw-r--r-- | clang/test/CodeGen/asm-goto.c | 19 | ||||
-rw-r--r-- | clang/test/CodeGen/asm.c | 12 | ||||
-rw-r--r-- | clang/test/CodeGen/inline-asm-mixed-style.c | 10 | ||||
-rw-r--r-- | clang/test/Coverage/c-language-features.inc | 4 | ||||
-rw-r--r-- | clang/test/PCH/asm.h | 6 | ||||
-rw-r--r-- | clang/test/Parser/asm.c | 50 | ||||
-rw-r--r-- | clang/test/Parser/asm.cpp | 51 | ||||
-rw-r--r-- | clang/test/Sema/asm-goto.cpp | 45 | ||||
-rw-r--r-- | clang/test/Sema/asm.c | 21 | ||||
-rw-r--r-- | clang/test/Sema/inline-asm-validate-tmpl.cpp | 10 | ||||
-rw-r--r-- | clang/test/Sema/scope-check.c | 16 |
12 files changed, 7 insertions, 289 deletions
diff --git a/clang/test/Analysis/asm-goto.cpp b/clang/test/Analysis/asm-goto.cpp deleted file mode 100644 index 3d4babc57bd..00000000000 --- a/clang/test/Analysis/asm-goto.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// RUN: %clang_analyze_cc1 -analyzer-checker=debug.DumpCFG %s 2>&1 | FileCheck %s - -int foo(int cond) -{ -label_true: - asm goto("testl %0, %0; jne %l1;" :: "r"(cond)::label_true, loop); - return 0; -loop: - return 0; -} - -// CHECK-LABEL: loop -// CHECK-NEXT: 0 -// CHECK-NEXT: return -// CHECK-NEXT: Preds (1): B3 -// CHECK-NEXT: Succs (1): B0 - -// CHECK-LABEL: label_true -// CHECK-NEXT: asm goto -// CHECK-NEXT: Preds (2): B3 B4 -// CHECK-NEXT: Succs (3): B2 B3 B1 - - -int bar(int cond) -{ - asm goto("testl %0, %0; jne %l1;" :: "r"(cond)::L1, L2); - return 0; -L1: -L2: - return 0; -} - -// CHECK: [B4] -// CHECK-NEXT: asm goto -// CHECK-NEXT: Preds (1): B5 -// CHECK-NEXT: Succs (3): B3 B2 B1 - -int zoo(int n) -{ -A5: -A1: - asm goto("testl %0, %0; jne %l1;" :: "r"(n)::A1, A2, A3, A4, A5); -A2: -A3: -A4: - return 0; -} - -// CHECK-LABEL: A1 -// CHECK-NEXT: asm goto -// CHECK-NEXT: Preds (2): B5 B4 -// CHECK-NEXT: Succs (5): B3 B4 B2 B1 B5 diff --git a/clang/test/CodeGen/asm-goto.c b/clang/test/CodeGen/asm-goto.c deleted file mode 100644 index 99e97f2a41e..00000000000 --- a/clang/test/CodeGen/asm-goto.c +++ /dev/null @@ -1,19 +0,0 @@ -// REQUIRES: x86-registered-target -// RUN: %clang_cc1 -triple x86_64 -O0 -emit-llvm %s -o - | FileCheck %s - -int foo(int cond) -{ - // CHECK: callbr void asm sideeffect - // CHECK: to label %asm.fallthrough [label %label_true, label %loop], !srcloc !2 - // CHECK: asm.fallthrough: - asm volatile goto("testl %0, %0; jne %l1;" :: "r"(cond)::label_true, loop); - asm volatile goto("testl %0, %0; jne %l1;" :: "r"(cond)::label_true, loop); - // CHECK: callbr void asm sideeffect - // CHECK: to label %asm.fallthrough1 [label %label_true, label %loop], !srcloc !3 - // CHECK: asm.fallthrough1: - return 0; -loop: - return 0; -label_true: - return 1; -} diff --git a/clang/test/CodeGen/asm.c b/clang/test/CodeGen/asm.c index 7de79639bfd..038d346e999 100644 --- a/clang/test/CodeGen/asm.c +++ b/clang/test/CodeGen/asm.c @@ -262,15 +262,3 @@ void t31(int len) { // CHECK: @t31 // CHECK: call void asm sideeffect "", "=*%rm,=*rm,0,1,~{dirflag},~{fpsr},~{flags}" } - -// CHECK: @t32 -int t32(int cond) -{ - asm goto("testl %0, %0; jne %l1;" :: "r"(cond)::label_true, loop); - // CHECK: callbr void asm sideeffect "testl $0, $0; jne ${1:l};", "r,X,X,~{dirflag},~{fpsr},~{flags}"(i32 %0, i8* blockaddress(@t32, %label_true), i8* blockaddress(@t32, %loop)) #1 - return 0; -loop: - return 0; -label_true: - return 1; -} diff --git a/clang/test/CodeGen/inline-asm-mixed-style.c b/clang/test/CodeGen/inline-asm-mixed-style.c index a9e111cd5dd..6b830d9fa7a 100644 --- a/clang/test/CodeGen/inline-asm-mixed-style.c +++ b/clang/test/CodeGen/inline-asm-mixed-style.c @@ -1,3 +1,4 @@ +// 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 // REQUIRES: x86-registered-target @@ -19,11 +20,10 @@ void f() { // CHECK: movl %ebx, %eax // CHECK: movl %ecx, %edx - __asm volatile goto ("movl %ecx, %edx"); - // 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"); - // CHECK: movl %ebx, %eax - // CHECK: movl %ecx, %edx + __asm goto ("movl %ecx, %edx"); // expected-error {{'asm goto' constructs are not supported yet}} +#endif } diff --git a/clang/test/Coverage/c-language-features.inc b/clang/test/Coverage/c-language-features.inc index ea3b96f6005..356687907d9 100644 --- a/clang/test/Coverage/c-language-features.inc +++ b/clang/test/Coverage/c-language-features.inc @@ -71,9 +71,7 @@ theif: } asm ("nop"); - int cond; - asm goto("testl %0, %0; jne %l1;" :: "r"(cond)::label_true); -label_true: + return; } diff --git a/clang/test/PCH/asm.h b/clang/test/PCH/asm.h index 5a7268eff6e..a568058d58f 100644 --- a/clang/test/PCH/asm.h +++ b/clang/test/PCH/asm.h @@ -1,14 +1,10 @@ // Header for the PCH test asm.c void f() { - int i,cond; + int i; asm ("foo\n" : : "a" (i + 2)); asm ("foo\n" : [symbolic_name] "=a" (i) : "[symbolic_name]" (i)); - asm volatile goto("testl %0, %0; jne %l1;" :: "r"(cond)::label_true, loop); -label_true: -loop: - return; } void clobbers() { diff --git a/clang/test/Parser/asm.c b/clang/test/Parser/asm.c index 489b545ebed..637f9d7ed42 100644 --- a/clang/test/Parser/asm.c +++ b/clang/test/Parser/asm.c @@ -21,56 +21,6 @@ void f2() { } -int a, b, c, d, e, f, g, h, i, j, k, l; - -void -fgoto1 (void) -{ - __asm__ volatile goto ("" - :: [a] "r" (a), [b] "r" (b), [c] "r" (c), [d] "r" (d), - [e] "r" (e), [f] "r" (f), [g] "r" (g), [h] "r" (h), - [i] "r" (i), [j] "r" (j), [k] "r" (k), [l] "r" (l) - ::lab1,lab2); -lab1: return; -lab2: return; -} - -void -fgoto2 (void) -{ - __asm__ volatile goto ("" - :: [a] "r,m" (a), [b] "r,m" (b), [c] "r,m" (c), [d] "r,m" (d), - [e] "r,m" (e), [f] "r,m" (f), [g] "r,m" (g), [h] "r,m" (h), - [i] "r,m" (i), [j] "r,m" (j), [k] "r,m" (k), [l] "r,m" (l) - :: lab); - lab: return; -} - -int zoo () -{ - int x,cond,*e; - // expected-error@+1 {{expected ')'}} - asm ("mov %[e], %[e]" : : [e] "rm" (*e)::a) - // expected-error@+1 {{'asm goto' cannot have output constraints}} - asm goto ("decl %0; jnz %l[a]" :"=r"(x): "m"(x) : "memory" : a); - // expected-error@+1 {{expected identifie}} - asm goto ("decl %0;" :: "m"(x) : "memory" : ); - // expected-error@+1 {{expected ':'}} - asm goto ("decl %0;" :: "m"(x) : "memory" ); - // expected-error@+1 {{use of undeclared label 'x'}} - asm goto ("decl %0;" :: "m"(x) : "memory" :x); - // expected-error@+1 {{use of undeclared label 'b'}} - asm goto ("decl %0;" :: "m"(x) : "memory" :b); - // expected-error@+1 {{invalid operand number in inline asm string}} - asm goto ("testl %0, %0; jne %l3;" :: "r"(cond)::label_true, loop); - // expected-error@+1 {{unknown symbolic operand name in inline assembly string}} - asm goto ("decl %0; jnz %l[b]" :: "m"(x) : "memory" : a); -a: -label_true: -loop: - return 0; -} - // rdar://5952468 __asm ; // expected-error {{expected '(' after 'asm'}} diff --git a/clang/test/Parser/asm.cpp b/clang/test/Parser/asm.cpp index 9c4d62a2552..9f64dfea476 100644 --- a/clang/test/Parser/asm.cpp +++ b/clang/test/Parser/asm.cpp @@ -7,54 +7,3 @@ int foo4 asm (u"bar4"); // expected-error {{cannot use unicode string literal in int foo5 asm (U"bar5"); // expected-error {{cannot use unicode string literal in 'asm'}} int foo6 asm ("bar6"_x); // expected-error {{string literal with user-defined suffix cannot be used here}} int foo6 asm ("" L"bar7"); // expected-error {{cannot use wide string literal in 'asm'}} - -int zoo () -{ - int x,cond,*e; - // expected-error@+1 {{expected ')'}} - asm ("mov %[e], %[e]" : : [e] "rm" (*e)::a) - // expected-error@+1 {{'asm goto' cannot have output constraints}} - asm goto ("decl %0; jnz %l[a]" :"=r"(x): "m"(x) : "memory" : a); - // expected-error@+1 {{expected identifie}} - asm goto ("decl %0;" :: "m"(x) : "memory" : ); - // expected-error@+1 {{expected ':'}} - asm goto ("decl %0;" :: "m"(x) : "memory" ); - // expected-error@+1 {{use of undeclared label 'x'}} - asm goto ("decl %0;" :: "m"(x) : "memory" :x); - // expected-error@+1 {{use of undeclared label 'b'}} - asm goto ("decl %0;" :: "m"(x) : "memory" :b); - // expected-error@+1 {{invalid operand number in inline asm string}} - asm goto ("testl %0, %0; jne %l3;" :: "r"(cond)::label_true, loop); - // expected-error@+1 {{unknown symbolic operand name in inline assembly string}} - asm goto ("decl %0; jnz %l[b]" :: "m"(x) : "memory" : a); -label_true: -loop: -a: - return 0; -} - - -int a, b, c, d, e, f, g, h, i, j, k, l; - -void -fgoto1 (void) -{ - __asm__ volatile goto ("" - :: [a] "r" (a), [b] "r" (b), [c] "r" (c), [d] "r" (d), - [e] "r" (e), [f] "r" (f), [g] "r" (g), [h] "r" (h), - [i] "r" (i), [j] "r" (j), [k] "r" (k), [l] "r" (l) - ::lab1,lab2); -lab1: return; -lab2: return; -} - -void -fgoto2 (void) -{ - __asm__ volatile goto ("" - :: [a] "r,m" (a), [b] "r,m" (b), [c] "r,m" (c), [d] "r,m" (d), - [e] "r,m" (e), [f] "r,m" (f), [g] "r,m" (g), [h] "r,m" (h), - [i] "r,m" (i), [j] "r,m" (j), [k] "r,m" (k), [l] "r,m" (l) - :: lab); - lab: return; -} diff --git a/clang/test/Sema/asm-goto.cpp b/clang/test/Sema/asm-goto.cpp deleted file mode 100644 index f61a8096b83..00000000000 --- a/clang/test/Sema/asm-goto.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// RUN: %clang_cc1 %s -triple i386-pc-linux-gnu -verify -fsyntax-only - -struct NonTrivial { - ~NonTrivial(); - int f(int); -private: - int k; -}; -void JumpDiagnostics(int n) { -// expected-error@+1 {{cannot jump from this goto statement to its label}} - goto DirectJump; -// expected-note@+1 {{jump bypasses variable with a non-trivial destructor}} - NonTrivial tnp1; - -DirectJump: -// expected-error@+1 {{cannot jump from this asm goto statement to one of its possible targets}} - asm goto("jmp %l0;" ::::Later); -// expected-note@+1 {{jump bypasses variable with a non-trivial destructor}} - NonTrivial tnp2; -// expected-note@+1 {{possible target of asm goto statement}} -Later: - return; -} - -struct S { ~S(); }; -void foo(int a) { - if (a) { -FOO: -// expected-note@+2 {{jump exits scope of variable with non-trivial destructor}} -// expected-note@+1 {{jump exits scope of variable with non-trivial destructor}} - S s; - void *p = &&BAR; -// expected-error@+1 {{cannot jump from this asm goto statement to one of its possible targets}} - asm goto("jmp %l0;" ::::BAR); -// expected-error@+1 {{cannot jump from this indirect goto statement to one of its possible targets}} - goto *p; - p = &&FOO; - goto *p; - return; - } -// expected-note@+2 {{possible target of asm goto statement}} -// expected-note@+1 {{possible target of indirect goto statement}} -BAR: - return; -} diff --git a/clang/test/Sema/asm.c b/clang/test/Sema/asm.c index 29a55c610de..67da197426c 100644 --- a/clang/test/Sema/asm.c +++ b/clang/test/Sema/asm.c @@ -295,24 +295,3 @@ int test17(int t0) return r0 + r1; } -void test18() -{ - // expected-error@+2 {{duplicate use of asm operand name "lab"}} - // expected-note@+1 {{asm operand name "lab" first referenced here}} - asm goto ("" : : : : lab, lab, lab2, lab); - // expected-error@+2 {{duplicate use of asm operand name "lab"}} - // expected-note@+1 {{asm operand name "lab" first referenced here}} - asm goto ("xorw %[lab], %[lab]; je %l[lab]" : : [lab] "i" (0) : : lab); -lab:; -lab2:; - int x,x1; - // expected-error@+2 {{duplicate use of asm operand name "lab"}} - // expected-note@+1 {{asm operand name "lab" first referenced here}} - asm ("" : [lab] "=r" (x),[lab] "+r" (x) : [lab1] "r" (x)); - // expected-error@+2 {{duplicate use of asm operand name "lab"}} - // expected-note@+1 {{asm operand name "lab" first referenced here}} - asm ("" : [lab] "=r" (x1) : [lab] "r" (x)); - // expected-error@+1 {{invalid operand number in inline asm string}} - asm ("jne %l0":::); - asm goto ("jne %l0"::::lab); -} diff --git a/clang/test/Sema/inline-asm-validate-tmpl.cpp b/clang/test/Sema/inline-asm-validate-tmpl.cpp index 9e234caa9c8..cf7eac3d83d 100644 --- a/clang/test/Sema/inline-asm-validate-tmpl.cpp +++ b/clang/test/Sema/inline-asm-validate-tmpl.cpp @@ -23,13 +23,3 @@ template <int N> void testc(int value) asm("rol %1, %0" :"=r"(value): "I"(N + 1)); } int foo() { testc<2>(10); } - -// these should compile without error -template <int N> bool testd() -{ - __asm goto ("" : : : : lab); - return true; -lab: - return false; -} -bool foox() { return testd<0> (); } diff --git a/clang/test/Sema/scope-check.c b/clang/test/Sema/scope-check.c index 0622450e2e7..fa37d10d070 100644 --- a/clang/test/Sema/scope-check.c +++ b/clang/test/Sema/scope-check.c @@ -232,19 +232,3 @@ void test15(int n, void *pc) { // rdar://9024687 int test16(int [sizeof &&z]); // expected-error {{use of address-of-label extension outside of a function body}} - -//Asm goto: -int test16(int n) -{ - // expected-error@+2 {{cannot jump from this asm goto statement to one of its possible targets}} - // expected-error@+1 {{cannot jump from this asm goto statement to one of its possible targets}} - asm volatile goto("testl %0, %0; jne %l1;" :: "r"(n)::label_true, loop); - // expected-note@+2 {{jump bypasses initialization of variable length array}} - // expected-note@+1 {{possible target of asm goto statement}} - return ({int a[n];label_true: 2;}); - // expected-note@+1 {{jump bypasses initialization of variable length array}} - int b[n]; -// expected-note@+1 {{possible target of asm goto statement}} -loop: - return 0; -} |