diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-08-07 23:02:44 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-08-07 23:02:44 +0000 |
commit | 51ece4aae5857052d224ce52277924c74685714e (patch) | |
tree | ca13cf9e2e8c2499f61f1246e455efd2804abd36 /test | |
parent | c192b3dcffd5e672a2b2e1730e2440febb4fb192 (diff) |
Diffstat (limited to 'test')
235 files changed, 5888 insertions, 516 deletions
diff --git a/test/ARCMT/check-with-pch.m b/test/ARCMT/check-with-pch.m index 1a94dda796b9..5e843ff08df7 100644 --- a/test/ARCMT/check-with-pch.m +++ b/test/ARCMT/check-with-pch.m @@ -1,5 +1,6 @@ // RUN: %clang_cc1 -x objective-c -triple x86_64-apple-darwin10 %S/Common.h -emit-pch -o %t.pch // RUN: %clang_cc1 -include-pch %t.pch -arcmt-check -verify -triple x86_64-apple-darwin10 -fblocks -Werror %s +// REQUIRES: x86-registered-target // rdar://9601437 @interface I9601437 { diff --git a/test/ARCMT/migrate-on-pch-and-module.m b/test/ARCMT/migrate-on-pch-and-module.m index 51babf6cf483..42e01ea91a9c 100644 --- a/test/ARCMT/migrate-on-pch-and-module.m +++ b/test/ARCMT/migrate-on-pch-and-module.m @@ -1,7 +1,7 @@ // RUN: rm -rf %t-mcp // RUN: %clang_cc1 -objcmt-migrate-subscripting -emit-pch -o %t.pch %s -isysroot %S/Inputs/System -triple x86_64-apple-darwin10 -F %S/Inputs -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-mcp -w // RUN: %clang_cc1 -objcmt-migrate-subscripting -include-pch %t.pch %s -migrate -o %t.remap -isysroot %S/Inputs/System -triple x86_64-apple-darwin10 -F %S/Inputs -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-mcp - +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER diff --git a/test/ARCMT/objcmt-with-pch.m b/test/ARCMT/objcmt-with-pch.m index fac42c851235..61c87a2b007d 100644 --- a/test/ARCMT/objcmt-with-pch.m +++ b/test/ARCMT/objcmt-with-pch.m @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target // RUN: rm -rf %t // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -x objective-c %S/Common.h -emit-pch -o %t.pch // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -objcmt-migrate-literals -objcmt-migrate-subscripting -mt-migrate-directory %t %s -x objective-c -include-pch %t.pch diff --git a/test/ARCMT/objcmt-with-pch.m.result b/test/ARCMT/objcmt-with-pch.m.result index 04eadc9d3fa4..7e2570cfc456 100644 --- a/test/ARCMT/objcmt-with-pch.m.result +++ b/test/ARCMT/objcmt-with-pch.m.result @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target // RUN: rm -rf %t // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -x objective-c %S/Common.h -emit-pch -o %t.pch // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -objcmt-migrate-literals -objcmt-migrate-subscripting -mt-migrate-directory %t %s -x objective-c -include-pch %t.pch diff --git a/test/Analysis/analyzer-checker-config.c b/test/Analysis/analyzer-checker-config.c new file mode 100644 index 000000000000..642c96c996d5 --- /dev/null +++ b/test/Analysis/analyzer-checker-config.c @@ -0,0 +1,12 @@ +// RUN: not %clang_cc1 -analyze -analyzer-checker=core,unix.Malloc -analyzer-config unix.mallo:Optimistic=true 2>&1 | FileCheck %s +// RUN: not %clang_cc1 -analyze -analyzer-checker=core,unix.Malloc -analyzer-config uni:Optimistic=true 2>&1 | FileCheck %s +// RUN: not %clang_cc1 -analyze -analyzer-checker=core,unix.Malloc -analyzer-config uni.:Optimistic=true 2>&1 | FileCheck %s +// RUN: not %clang_cc1 -analyze -analyzer-checker=core,unix.Malloc -analyzer-config ..:Optimistic=true 2>&1 | FileCheck %s +// RUN: not %clang_cc1 -analyze -analyzer-checker=core,unix.Malloc -analyzer-config unix.:Optimistic=true 2>&1 | FileCheck %s +// RUN: not %clang_cc1 -analyze -analyzer-checker=core,unix.Malloc -analyzer-config unrelated:Optimistic=true 2>&1 | FileCheck %s +// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix.Malloc -analyzer-config unix.Malloc:Optimistic=true + +// Just to test clang is working. +# foo + +// CHECK: error: diff --git a/test/Analysis/blocks.m b/test/Analysis/blocks.m index 62d53607b533..4dbe95172073 100644 --- a/test/Analysis/blocks.m +++ b/test/Analysis/blocks.m @@ -162,3 +162,51 @@ void blockCapturesItselfInTheLoop(int x, int m) { } assignData(x); } + +// Blocks that called the function they were contained in that also have +// static locals caused crashes. +// rdar://problem/21698099 +void takeNonnullBlock(void (^)(void)) __attribute__((nonnull)); +void takeNonnullIntBlock(int (^)(void)) __attribute__((nonnull)); + +void testCallContainingWithSignature1() +{ + takeNonnullBlock(^{ + static const char str[] = "Lost connection to sharingd"; + testCallContainingWithSignature1(); + }); +} + +void testCallContainingWithSignature2() +{ + takeNonnullBlock(^void{ + static const char str[] = "Lost connection to sharingd"; + testCallContainingWithSignature2(); + }); +} + +void testCallContainingWithSignature3() +{ + takeNonnullBlock(^void(){ + static const char str[] = "Lost connection to sharingd"; + testCallContainingWithSignature3(); + }); +} + +void testCallContainingWithSignature4() +{ + takeNonnullBlock(^void(void){ + static const char str[] = "Lost connection to sharingd"; + testCallContainingWithSignature4(); + }); +} + +void testCallContainingWithSignature5() +{ + takeNonnullIntBlock(^{ + static const char str[] = "Lost connection to sharingd"; + testCallContainingWithSignature5(); + return 0; + }); +} + diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 591a9272ae6d..526f129bab58 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -58,7 +58,7 @@ set(CLANG_TEST_PARAMS if( NOT CLANG_BUILT_STANDALONE ) list(APPEND CLANG_TEST_DEPS llvm-config - llc opt FileCheck count not llvm-symbolizer llvm-profdata + llc opt FileCheck count not llvm-symbolizer llvm-profdata llvm-objdump ) endif() diff --git a/test/CXX/class/class.mem/p13.cpp b/test/CXX/class/class.mem/p13.cpp index 84885848870e..1d7b9bc81551 100644 --- a/test/CXX/class/class.mem/p13.cpp +++ b/test/CXX/class/class.mem/p13.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++14 %s // If T is the name of a class, then each of the following shall have // a name different from T: @@ -9,23 +9,53 @@ struct X0 { }; // - every member function of class T -// (Cannot be tested) +struct Xa { + int Xa() {} // expected-error{{constructor cannot have a return type}} +}; // - every member of class T that is itself a type; -struct X1 { // expected-note{{previous use is here}} - enum X1 { }; // expected-error{{use of 'X1' with tag type that does not match previous declaration}} +struct X1 { + enum X1 { }; // expected-error{{member 'X1' has the same name as its class}} +}; + +struct X1a { + struct X1a; // expected-error{{member 'X1a' has the same name as its class}} }; struct X2 { typedef int X2; // expected-error{{member 'X2' has the same name as its class}} }; -// - every enumerator of every member of class T that is an enumerated type; and +struct X2a { + using X2a = int; // expected-error{{member 'X2a' has the same name as its class}} +}; + +// - every member template of class T + +struct X2b { + template<typename T> struct X2b; // expected-error{{member 'X2b' has the same name as its class}} +}; +struct X2c { + template<typename T> void X2c(); // expected-error{{constructor cannot have a return type}} +}; +struct X2d { + template<typename T> static int X2d; // expected-error{{member 'X2d' has the same name as its class}} +}; +struct X2e { + template<typename T> using X2e = int; // expected-error{{member 'X2e' has the same name as its class}} +}; + +// - every enumerator of every member of class T that is an unscoped enumerated type; and struct X3 { enum E { X3 // expected-error{{member 'X3' has the same name as its class}} }; }; +struct X3a { + enum class E { + X3a // ok + }; +}; // - every member of every anonymous union that is a member of class T. struct X4 { @@ -37,4 +67,3 @@ struct X4 { }; }; }; - diff --git a/test/CXX/class/class.mem/p2.cpp b/test/CXX/class/class.mem/p2.cpp index d45c03860654..1f0dfd05a20d 100644 --- a/test/CXX/class/class.mem/p2.cpp +++ b/test/CXX/class/class.mem/p2.cpp @@ -76,13 +76,10 @@ namespace PR12629 { namespace PR12688 { struct S { - // FIXME: Producing one error saying this can't have the same name - // as the class because it's not a constructor, then producing - // another error saying this can't have a return type because - // it is a constructor, is redundant and inconsistent. + // FIXME: Maybe suppress the "constructor cannot have a return type" error + // if the return type is invalid. nonsense S() throw (more_nonsense); // \ // expected-error {{'nonsense'}} \ - // expected-error {{has the same name as its class}} \ // expected-error {{constructor cannot have a return type}} }; } diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p2-0x.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p2-0x.cpp index 865abb081a44..20b5104f83be 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p2-0x.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p2-0x.cpp @@ -83,12 +83,10 @@ namespace InFunctions { namespace ClassNameRedecl { class C0 { - // FIXME: this diagnostic is pretty poor - using C0 = int; // expected-error {{name defined in alias declaration must be an identifier}} + using C0 = int; // expected-error {{member 'C0' has the same name as its class}} }; class C1 { - // FIXME: this diagnostic is pretty poor - using C1 = C1; // expected-error {{name defined in alias declaration must be an identifier}} + using C1 = C1; // expected-error {{member 'C1' has the same name as its class}} }; class C2 { using C0 = C1; // ok diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.array/p3.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.array/p3.cpp index e040d5b2642b..4686b1c961ec 100644 --- a/test/CXX/dcl.decl/dcl.meaning/dcl.array/p3.cpp +++ b/test/CXX/dcl.decl/dcl.meaning/dcl.array/p3.cpp @@ -158,7 +158,7 @@ namespace dependent { } template<typename T> void n() { - extern T n_var; // expected-error {{redefinition of 'n_var' with a different type: 'double' vs 'int'}} expected-note {{previous}} + extern T n_var; // expected-error {{redeclaration of 'n_var' with a different type: 'double' vs 'int'}} expected-note {{previous}} extern T n_fn(); // expected-error {{functions that differ only in their return type cannot be overloaded}} expected-note {{previous}} } template void n<int>(); diff --git a/test/CXX/drs/dr19xx.cpp b/test/CXX/drs/dr19xx.cpp index 9c2d3e7c1770..368e7b341652 100644 --- a/test/CXX/drs/dr19xx.cpp +++ b/test/CXX/drs/dr19xx.cpp @@ -39,6 +39,21 @@ namespace dr1902 { // dr1902: 3.7 #endif } +namespace dr1909 { // dr1909: yes + struct A { + template<typename T> struct A {}; // expected-error {{member 'A' has the same name as its class}} + }; + struct B { + template<typename T> void B() {} // expected-error {{constructor cannot have a return type}} + }; + struct C { + template<typename T> static int C; // expected-error {{member 'C' has the same name as its class}} expected-error 0-1{{extension}} + }; + struct D { + template<typename T> using D = int; // expected-error {{member 'D' has the same name as its class}} expected-error 0-1{{extension}} + }; +} + #if __cplusplus >= 201103L namespace dr1940 { // dr1940: yes static union { diff --git a/test/CXX/drs/dr1xx.cpp b/test/CXX/drs/dr1xx.cpp index cc6c5af81708..d8d9307a5ebb 100644 --- a/test/CXX/drs/dr1xx.cpp +++ b/test/CXX/drs/dr1xx.cpp @@ -943,10 +943,10 @@ namespace dr188 { // dr188: yes namespace dr194 { // dr194: yes struct A { A(); - void A(); // expected-error {{has the same name as its class}} expected-error {{constructor cannot have a return type}} + void A(); // expected-error {{constructor cannot have a return type}} }; struct B { - void B(); // expected-error {{has the same name as its class}} expected-error {{constructor cannot have a return type}} + void B(); // expected-error {{constructor cannot have a return type}} B(); }; struct C { diff --git a/test/CXX/drs/dr3xx.cpp b/test/CXX/drs/dr3xx.cpp index 5ac4f013b7fd..c438fccebd6b 100644 --- a/test/CXX/drs/dr3xx.cpp +++ b/test/CXX/drs/dr3xx.cpp @@ -110,18 +110,6 @@ namespace dr305 { // dr305: no x->~X<char>(); // expected-error {{no member named}} } - // FIXME: This appears to be valid (but allowing the nested types might be a - // defect). - template<typename> struct Nested { - template<typename> struct Nested {}; - }; - void testNested(Nested<int> n) { n.~Nested<int>(); } // expected-error {{no member named}} -#if __cplusplus < 201103L - // expected-error@-2 {{ambiguous}} - // expected-note@-6 {{here}} - // expected-note@-6 {{here}} -#endif - #if __cplusplus >= 201103L struct Y { template<typename T> using T1 = Y; diff --git a/test/CXX/expr/expr.const/p2-0x.cpp b/test/CXX/expr/expr.const/p2-0x.cpp index d027c7a388bb..2adefd928afb 100644 --- a/test/CXX/expr/expr.const/p2-0x.cpp +++ b/test/CXX/expr/expr.const/p2-0x.cpp @@ -157,7 +157,7 @@ namespace UndefinedBehavior { constexpr int shl_unsigned_negative = unsigned(-3) << 1; // ok constexpr int shl_unsigned_into_sign = 1u << 31; // ok constexpr int shl_unsigned_overflow = 1024u << 31; // ok - constexpr int shl_signed_negative = (-3) << 1; // expected-error {{constant expression}} expected-note {{left shift of negative value -3}} + constexpr int shl_signed_negative = (-3) << 1; // expected-warning {{shifting a negative signed value is undefined}} // expected-error {{constant expression}} expected-note {{left shift of negative value -3}} constexpr int shl_signed_ok = 1 << 30; // ok constexpr int shl_signed_into_sign = 1 << 31; // ok (DR1457) constexpr int shl_signed_into_sign_2 = 0x7fffffff << 1; // ok (DR1457) diff --git a/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp b/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp index 5c1029f1a3ff..e299705a4c11 100644 --- a/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp +++ b/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -triple x86_64-apple-darwin10 -S -emit-llvm -std=c++11 -include %S/ser.h %s -o - | FileCheck %s // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -triple x86_64-apple-darwin10 -emit-pch -o %t-ser.pch -std=c++11 -x c++ %S/ser.h // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -triple x86_64-apple-darwin10 -S -emit-llvm -std=c++11 -include-pch %t-ser.pch %s -o - | FileCheck %s diff --git a/test/CodeGen/align-systemz.c b/test/CodeGen/align-systemz.c index 68a21e39ab36..eaa1de64d344 100644 --- a/test/CodeGen/align-systemz.c +++ b/test/CodeGen/align-systemz.c @@ -25,3 +25,19 @@ void func (void) s = es; } + +// Alignment should be respected for coerced argument loads + +struct arg { long y __attribute__((packed, aligned(4))); }; + +extern struct arg x; +void f(struct arg); + +void test (void) +{ + f(x); +} + +// CHECK-LABEL: @test +// CHECK: load i64, i64* getelementptr inbounds (%struct.arg, %struct.arg* @x, i32 0, i32 0), align 4 + diff --git a/test/CodeGen/arm-long-calls.c b/test/CodeGen/arm-long-calls.c new file mode 100644 index 000000000000..fdd7babe9fe6 --- /dev/null +++ b/test/CodeGen/arm-long-calls.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -triple thumbv7-apple-ios5 -target-feature +long-calls -emit-llvm -o - %s | FileCheck -check-prefix=LONGCALL %s +// RUN: %clang_cc1 -triple thumbv7-apple-ios5 -emit-llvm -o - %s | FileCheck -check-prefix=NOLONGCALL %s + +// LONGCALL: attributes #0 = { {{.*}} "target-features"="+long-calls" +// NOLONGCALL-NOT: attributes #0 = { {{.*}} "target-features"="+long-calls" + +int foo1(int a) { return a; } diff --git a/test/CodeGen/arm64-abi-vector.c b/test/CodeGen/arm64-abi-vector.c index 4566c417909b..ebf7f5112659 100644 --- a/test/CodeGen/arm64-abi-vector.c +++ b/test/CodeGen/arm64-abi-vector.c @@ -309,7 +309,7 @@ __attribute__((noinline)) double args_vec_5c(int fixed, __char5 c5) { // CHECK: args_vec_5c // CHECK: [[C5:%.*]] = alloca <5 x i8>, align 8 // CHECK: [[TMP:%.*]] = bitcast <5 x i8>* [[C5]] to <2 x i32>* -// CHECK: store <2 x i32> {{%.*}}, <2 x i32>* [[TMP]], align 1 +// CHECK: store <2 x i32> {{%.*}}, <2 x i32>* [[TMP]], align 8 double sum = fixed; sum = sum + c5.x + c5.y; return sum; @@ -325,7 +325,7 @@ __attribute__((noinline)) double args_vec_9c(int fixed, __char9 c9) { // CHECK: args_vec_9c // CHECK: [[C9:%.*]] = alloca <9 x i8>, align 16 // CHECK: [[TMP:%.*]] = bitcast <9 x i8>* [[C9]] to <4 x i32>* -// CHECK: store <4 x i32> {{%.*}}, <4 x i32>* [[TMP]], align 1 +// CHECK: store <4 x i32> {{%.*}}, <4 x i32>* [[TMP]], align 16 double sum = fixed; sum = sum + c9.x + c9.y; return sum; @@ -355,7 +355,7 @@ __attribute__((noinline)) double args_vec_3s(int fixed, __short3 c3) { // CHECK: args_vec_3s // CHECK: [[C3:%.*]] = alloca <3 x i16>, align 8 // CHECK: [[TMP:%.*]] = bitcast <3 x i16>* [[C3]] to <2 x i32>* -// CHECK: store <2 x i32> {{%.*}}, <2 x i32>* [[TMP]], align 1 +// CHECK: store <2 x i32> {{%.*}}, <2 x i32>* [[TMP]], align 8 double sum = fixed; sum = sum + c3.x + c3.y; return sum; @@ -371,7 +371,7 @@ __attribute__((noinline)) double args_vec_5s(int fixed, __short5 c5) { // CHECK: args_vec_5s // CHECK: [[C5:%.*]] = alloca <5 x i16>, align 16 // CHECK: [[TMP:%.*]] = bitcast <5 x i16>* [[C5]] to <4 x i32>* -// CHECK: store <4 x i32> {{%.*}}, <4 x i32>* [[TMP]], align 1 +// CHECK: store <4 x i32> {{%.*}}, <4 x i32>* [[TMP]], align 16 double sum = fixed; sum = sum + c5.x + c5.y; return sum; @@ -387,7 +387,7 @@ __attribute__((noinline)) double args_vec_3i(int fixed, __int3 c3) { // CHECK: args_vec_3i // CHECK: [[C3:%.*]] = alloca <3 x i32>, align 16 // CHECK: [[TMP:%.*]] = bitcast <3 x i32>* [[C3]] to <4 x i32>* -// CHECK: store <4 x i32> {{%.*}}, <4 x i32>* [[TMP]], align 1 +// CHECK: store <4 x i32> {{%.*}}, <4 x i32>* [[TMP]], align 16 double sum = fixed; sum = sum + c3.x + c3.y; return sum; diff --git a/test/CodeGen/arm64-arguments.c b/test/CodeGen/arm64-arguments.c index 4486bb4b18e2..8b551c4af470 100644 --- a/test/CodeGen/arm64-arguments.c +++ b/test/CodeGen/arm64-arguments.c @@ -219,8 +219,8 @@ int32x4_t f36(int i, s36_with_align s1, s36_with_align s2) { // CHECK: define <4 x i32> @f36(i32 %i, i128 %s1.coerce, i128 %s2.coerce) // CHECK: %s1 = alloca %struct.s36, align 16 // CHECK: %s2 = alloca %struct.s36, align 16 -// CHECK: store i128 %s1.coerce, i128* %{{.*}}, align 1 -// CHECK: store i128 %s2.coerce, i128* %{{.*}}, align 1 +// CHECK: store i128 %s1.coerce, i128* %{{.*}}, align 16 +// CHECK: store i128 %s2.coerce, i128* %{{.*}}, align 16 // CHECK: %[[a:.*]] = bitcast %struct.s36* %s1 to <4 x i32>* // CHECK: load <4 x i32>, <4 x i32>* %[[a]], align 16 // CHECK: %[[b:.*]] = bitcast %struct.s36* %s2 to <4 x i32>* @@ -275,8 +275,8 @@ int f38(int i, s38_no_align s1, s38_no_align s2) { // CHECK: define i32 @f38(i32 %i, i64 %s1.coerce, i64 %s2.coerce) // CHECK: %s1 = alloca %struct.s38, align 8 // CHECK: %s2 = alloca %struct.s38, align 8 -// CHECK: store i64 %s1.coerce, i64* %{{.*}}, align 1 -// CHECK: store i64 %s2.coerce, i64* %{{.*}}, align 1 +// CHECK: store i64 %s1.coerce, i64* %{{.*}}, align 8 +// CHECK: store i64 %s2.coerce, i64* %{{.*}}, align 8 // CHECK: getelementptr inbounds %struct.s38, %struct.s38* %s1, i32 0, i32 0 // CHECK: getelementptr inbounds %struct.s38, %struct.s38* %s2, i32 0, i32 0 // CHECK: getelementptr inbounds %struct.s38, %struct.s38* %s1, i32 0, i32 1 @@ -287,8 +287,8 @@ s38_no_align g38; s38_no_align g38_2; int caller38() { // CHECK: define i32 @caller38() -// CHECK: %[[a:.*]] = load i64, i64* bitcast (%struct.s38* @g38 to i64*), align 1 -// CHECK: %[[b:.*]] = load i64, i64* bitcast (%struct.s38* @g38_2 to i64*), align 1 +// CHECK: %[[a:.*]] = load i64, i64* bitcast (%struct.s38* @g38 to i64*), align 4 +// CHECK: %[[b:.*]] = load i64, i64* bitcast (%struct.s38* @g38_2 to i64*), align 4 // CHECK: call i32 @f38(i32 3, i64 %[[a]], i64 %[[b]]) return f38(3, g38, g38_2); } @@ -299,8 +299,8 @@ int f38_stack(int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8, // CHECK: define i32 @f38_stack(i32 %i, i32 %i2, i32 %i3, i32 %i4, i32 %i5, i32 %i6, i32 %i7, i32 %i8, i32 %i9, i64 %s1.coerce, i64 %s2.coerce) // CHECK: %s1 = alloca %struct.s38, align 8 // CHECK: %s2 = alloca %struct.s38, align 8 -// CHECK: store i64 %s1.coerce, i64* %{{.*}}, align 1 -// CHECK: store i64 %s2.coerce, i64* %{{.*}}, align 1 +// CHECK: store i64 %s1.coerce, i64* %{{.*}}, align 8 +// CHECK: store i64 %s2.coerce, i64* %{{.*}}, align 8 // CHECK: getelementptr inbounds %struct.s38, %struct.s38* %s1, i32 0, i32 0 // CHECK: getelementptr inbounds %struct.s38, %struct.s38* %s2, i32 0, i32 0 // CHECK: getelementptr inbounds %struct.s38, %struct.s38* %s1, i32 0, i32 1 @@ -309,8 +309,8 @@ int f38_stack(int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8, } int caller38_stack() { // CHECK: define i32 @caller38_stack() -// CHECK: %[[a:.*]] = load i64, i64* bitcast (%struct.s38* @g38 to i64*), align 1 -// CHECK: %[[b:.*]] = load i64, i64* bitcast (%struct.s38* @g38_2 to i64*), align 1 +// CHECK: %[[a:.*]] = load i64, i64* bitcast (%struct.s38* @g38 to i64*), align 4 +// CHECK: %[[b:.*]] = load i64, i64* bitcast (%struct.s38* @g38_2 to i64*), align 4 // CHECK: call i32 @f38_stack(i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i64 %[[a]], i64 %[[b]]) return f38_stack(1, 2, 3, 4, 5, 6, 7, 8, 9, g38, g38_2); } @@ -328,8 +328,8 @@ int f39(int i, s39_with_align s1, s39_with_align s2) { // CHECK: define i32 @f39(i32 %i, i128 %s1.coerce, i128 %s2.coerce) // CHECK: %s1 = alloca %struct.s39, align 16 // CHECK: %s2 = alloca %struct.s39, align 16 -// CHECK: store i128 %s1.coerce, i128* %{{.*}}, align 1 -// CHECK: store i128 %s2.coerce, i128* %{{.*}}, align 1 +// CHECK: store i128 %s1.coerce, i128* %{{.*}}, align 16 +// CHECK: store i128 %s2.coerce, i128* %{{.*}}, align 16 // CHECK: getelementptr inbounds %struct.s39, %struct.s39* %s1, i32 0, i32 0 // CHECK: getelementptr inbounds %struct.s39, %struct.s39* %s2, i32 0, i32 0 // CHECK: getelementptr inbounds %struct.s39, %struct.s39* %s1, i32 0, i32 1 @@ -340,8 +340,8 @@ s39_with_align g39; s39_with_align g39_2; int caller39() { // CHECK: define i32 @caller39() -// CHECK: %[[a:.*]] = load i128, i128* bitcast (%struct.s39* @g39 to i128*), align 1 -// CHECK: %[[b:.*]] = load i128, i128* bitcast (%struct.s39* @g39_2 to i128*), align 1 +// CHECK: %[[a:.*]] = load i128, i128* bitcast (%struct.s39* @g39 to i128*), align 16 +// CHECK: %[[b:.*]] = load i128, i128* bitcast (%struct.s39* @g39_2 to i128*), align 16 // CHECK: call i32 @f39(i32 3, i128 %[[a]], i128 %[[b]]) return f39(3, g39, g39_2); } @@ -352,8 +352,8 @@ int f39_stack(int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8, // CHECK: define i32 @f39_stack(i32 %i, i32 %i2, i32 %i3, i32 %i4, i32 %i5, i32 %i6, i32 %i7, i32 %i8, i32 %i9, i128 %s1.coerce, i128 %s2.coerce) // CHECK: %s1 = alloca %struct.s39, align 16 // CHECK: %s2 = alloca %struct.s39, align 16 -// CHECK: store i128 %s1.coerce, i128* %{{.*}}, align 1 -// CHECK: store i128 %s2.coerce, i128* %{{.*}}, align 1 +// CHECK: store i128 %s1.coerce, i128* %{{.*}}, align 16 +// CHECK: store i128 %s2.coerce, i128* %{{.*}}, align 16 // CHECK: getelementptr inbounds %struct.s39, %struct.s39* %s1, i32 0, i32 0 // CHECK: getelementptr inbounds %struct.s39, %struct.s39* %s2, i32 0, i32 0 // CHECK: getelementptr inbounds %struct.s39, %struct.s39* %s1, i32 0, i32 1 @@ -362,8 +362,8 @@ int f39_stack(int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8, } int caller39_stack() { // CHECK: define i32 @caller39_stack() -// CHECK: %[[a:.*]] = load i128, i128* bitcast (%struct.s39* @g39 to i128*), align 1 -// CHECK: %[[b:.*]] = load i128, i128* bitcast (%struct.s39* @g39_2 to i128*), align 1 +// CHECK: %[[a:.*]] = load i128, i128* bitcast (%struct.s39* @g39 to i128*), align 16 +// CHECK: %[[b:.*]] = load i128, i128* bitcast (%struct.s39* @g39_2 to i128*), align 16 // CHECK: call i32 @f39_stack(i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i128 %[[a]], i128 %[[b]]) return f39_stack(1, 2, 3, 4, 5, 6, 7, 8, 9, g39, g39_2); } @@ -383,8 +383,8 @@ int f40(int i, s40_no_align s1, s40_no_align s2) { // CHECK: define i32 @f40(i32 %i, [2 x i64] %s1.coerce, [2 x i64] %s2.coerce) // CHECK: %s1 = alloca %struct.s40, align 8 // CHECK: %s2 = alloca %struct.s40, align 8 -// CHECK: store [2 x i64] %s1.coerce, [2 x i64]* %{{.*}}, align 1 -// CHECK: store [2 x i64] %s2.coerce, [2 x i64]* %{{.*}}, align 1 +// CHECK: store [2 x i64] %s1.coerce, [2 x i64]* %{{.*}}, align 8 +// CHECK: store [2 x i64] %s2.coerce, [2 x i64]* %{{.*}}, align 8 // CHECK: getelementptr inbounds %struct.s40, %struct.s40* %s1, i32 0, i32 0 // CHECK: getelementptr inbounds %struct.s40, %struct.s40* %s2, i32 0, i32 0 // CHECK: getelementptr inbounds %struct.s40, %struct.s40* %s1, i32 0, i32 1 @@ -395,8 +395,8 @@ s40_no_align g40; s40_no_align g40_2; int caller40() { // CHECK: define i32 @caller40() -// CHECK: %[[a:.*]] = load [2 x i64], [2 x i64]* bitcast (%struct.s40* @g40 to [2 x i64]*), align 1 -// CHECK: %[[b:.*]] = load [2 x i64], [2 x i64]* bitcast (%struct.s40* @g40_2 to [2 x i64]*), align 1 +// CHECK: %[[a:.*]] = load [2 x i64], [2 x i64]* bitcast (%struct.s40* @g40 to [2 x i64]*), align 4 +// CHECK: %[[b:.*]] = load [2 x i64], [2 x i64]* bitcast (%struct.s40* @g40_2 to [2 x i64]*), align 4 // CHECK: call i32 @f40(i32 3, [2 x i64] %[[a]], [2 x i64] %[[b]]) return f40(3, g40, g40_2); } @@ -407,8 +407,8 @@ int f40_stack(int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8, // CHECK: define i32 @f40_stack(i32 %i, i32 %i2, i32 %i3, i32 %i4, i32 %i5, i32 %i6, i32 %i7, i32 %i8, i32 %i9, [2 x i64] %s1.coerce, [2 x i64] %s2.coerce) // CHECK: %s1 = alloca %struct.s40, align 8 // CHECK: %s2 = alloca %struct.s40, align 8 -// CHECK: store [2 x i64] %s1.coerce, [2 x i64]* %{{.*}}, align 1 -// CHECK: store [2 x i64] %s2.coerce, [2 x i64]* %{{.*}}, align 1 +// CHECK: store [2 x i64] %s1.coerce, [2 x i64]* %{{.*}}, align 8 +// CHECK: store [2 x i64] %s2.coerce, [2 x i64]* %{{.*}}, align 8 // CHECK: getelementptr inbounds %struct.s40, %struct.s40* %s1, i32 0, i32 0 // CHECK: getelementptr inbounds %struct.s40, %struct.s40* %s2, i32 0, i32 0 // CHECK: getelementptr inbounds %struct.s40, %struct.s40* %s1, i32 0, i32 1 @@ -417,8 +417,8 @@ int f40_stack(int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8, } int caller40_stack() { // CHECK: define i32 @caller40_stack() -// CHECK: %[[a:.*]] = load [2 x i64], [2 x i64]* bitcast (%struct.s40* @g40 to [2 x i64]*), align 1 -// CHECK: %[[b:.*]] = load [2 x i64], [2 x i64]* bitcast (%struct.s40* @g40_2 to [2 x i64]*), align 1 +// CHECK: %[[a:.*]] = load [2 x i64], [2 x i64]* bitcast (%struct.s40* @g40 to [2 x i64]*), align 4 +// CHECK: %[[b:.*]] = load [2 x i64], [2 x i64]* bitcast (%struct.s40* @g40_2 to [2 x i64]*), align 4 // CHECK: call i32 @f40_stack(i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, [2 x i64] %[[a]], [2 x i64] %[[b]]) return f40_stack(1, 2, 3, 4, 5, 6, 7, 8, 9, g40, g40_2); } @@ -438,8 +438,8 @@ int f41(int i, s41_with_align s1, s41_with_align s2) { // CHECK: define i32 @f41(i32 %i, i128 %s1.coerce, i128 %s2.coerce) // CHECK: %s1 = alloca %struct.s41, align 16 // CHECK: %s2 = alloca %struct.s41, align 16 -// CHECK: store i128 %s1.coerce, i128* %{{.*}}, align 1 -// CHECK: store i128 %s2.coerce, i128* %{{.*}}, align 1 +// CHECK: store i128 %s1.coerce, i128* %{{.*}}, align 16 +// CHECK: store i128 %s2.coerce, i128* %{{.*}}, align 16 // CHECK: getelementptr inbounds %struct.s41, %struct.s41* %s1, i32 0, i32 0 // CHECK: getelementptr inbounds %struct.s41, %struct.s41* %s2, i32 0, i32 0 // CHECK: getelementptr inbounds %struct.s41, %struct.s41* %s1, i32 0, i32 1 @@ -450,8 +450,8 @@ s41_with_align g41; s41_with_align g41_2; int caller41() { // CHECK: define i32 @caller41() -// CHECK: %[[a:.*]] = load i128, i128* bitcast (%struct.s41* @g41 to i128*), align 1 -// CHECK: %[[b:.*]] = load i128, i128* bitcast (%struct.s41* @g41_2 to i128*), align 1 +// CHECK: %[[a:.*]] = load i128, i128* bitcast (%struct.s41* @g41 to i128*), align 16 +// CHECK: %[[b:.*]] = load i128, i128* bitcast (%struct.s41* @g41_2 to i128*), align 16 // CHECK: call i32 @f41(i32 3, i128 %[[a]], i128 %[[b]]) return f41(3, g41, g41_2); } @@ -462,8 +462,8 @@ int f41_stack(int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8, // CHECK: define i32 @f41_stack(i32 %i, i32 %i2, i32 %i3, i32 %i4, i32 %i5, i32 %i6, i32 %i7, i32 %i8, i32 %i9, i128 %s1.coerce, i128 %s2.coerce) // CHECK: %s1 = alloca %struct.s41, align 16 // CHECK: %s2 = alloca %struct.s41, align 16 -// CHECK: store i128 %s1.coerce, i128* %{{.*}}, align 1 -// CHECK: store i128 %s2.coerce, i128* %{{.*}}, align 1 +// CHECK: store i128 %s1.coerce, i128* %{{.*}}, align 16 +// CHECK: store i128 %s2.coerce, i128* %{{.*}}, align 16 // CHECK: getelementptr inbounds %struct.s41, %struct.s41* %s1, i32 0, i32 0 // CHECK: getelementptr inbounds %struct.s41, %struct.s41* %s2, i32 0, i32 0 // CHECK: getelementptr inbounds %struct.s41, %struct.s41* %s1, i32 0, i32 1 @@ -472,8 +472,8 @@ int f41_stack(int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8, } int caller41_stack() { // CHECK: define i32 @caller41_stack() -// CHECK: %[[a:.*]] = load i128, i128* bitcast (%struct.s41* @g41 to i128*), align 1 -// CHECK: %[[b:.*]] = load i128, i128* bitcast (%struct.s41* @g41_2 to i128*), align 1 +// CHECK: %[[a:.*]] = load i128, i128* bitcast (%struct.s41* @g41 to i128*), align 16 +// CHECK: %[[b:.*]] = load i128, i128* bitcast (%struct.s41* @g41_2 to i128*), align 16 // CHECK: call i32 @f41_stack(i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i128 %[[a]], i128 %[[b]]) return f41_stack(1, 2, 3, 4, 5, 6, 7, 8, 9, g41, g41_2); } diff --git a/test/CodeGen/arm64-be-bitfield.c b/test/CodeGen/arm64-be-bitfield.c index b8d497c5580d..132239ab8313 100644 --- a/test/CodeGen/arm64-be-bitfield.c +++ b/test/CodeGen/arm64-be-bitfield.c @@ -7,7 +7,7 @@ struct bt3 { signed b2:10; signed b3:10; } b16; // Get the high 32-bits and then shift appropriately for big-endian. signed callee_b0f(struct bt3 bp11) { // IR: callee_b0f(i64 [[ARG:%.*]]) -// IR: store i64 [[ARG]], i64* [[PTR:%.*]] +// IR: store i64 [[ARG]], i64* [[PTR:%.*]], align 8 // IR: [[BITCAST:%.*]] = bitcast i64* [[PTR]] to i8* // IR: call void @llvm.memcpy.p0i8.p0i8.i64(i8* {{.*}}, i8* [[BITCAST]], i64 4 // ARM: asr x0, x0, #54 diff --git a/test/CodeGen/asm-attrs.c b/test/CodeGen/asm-attrs.c new file mode 100644 index 000000000000..ae7287953e0c --- /dev/null +++ b/test/CodeGen/asm-attrs.c @@ -0,0 +1,33 @@ +// RUN: %clang_cc1 -triple armv7-apple-darwin -emit-llvm %s -o - | FileCheck %s + +// CHECK: call i32 asm "foo0", {{.*}} [[READNONE:#[0-9]+]] +// CHECK: call i32 asm "foo1", {{.*}} [[READNONE]] +// CHECK: call i32 asm "foo2", {{.*}} [[NOATTRS:#[0-9]+]] +// CHECK: call i32 asm sideeffect "foo3", {{.*}} [[NOATTRS]] +// CHECK: call i32 asm "foo4", {{.*}} [[READONLY:#[0-9]+]] +// CHECK: call i32 asm "foo5", {{.*}} [[READONLY]] +// CHECK: call i32 asm "foo6", {{.*}} [[NOATTRS]] +// CHECK: call void asm sideeffect "foo7", {{.*}} [[NOATTRS]] +// CHECK: call void asm "foo8", {{.*}} [[NOATTRS]] + +// CHECK: attributes [[READNONE]] = { nounwind readnone } +// CHECK: attributes [[NOATTRS]] = { nounwind } +// CHECK: attributes [[READONLY]] = { nounwind readonly } + +int g0, g1; + +struct S { + int i; +} g2; + +void test_attrs(int a) { + __asm__ ("foo0" : "=r"(g1) : "r"(a)); + __asm__ ("foo1" : "=r"(g1) : "r"(a) : "cc"); + __asm__ ("foo2" : "=r"(g1) : "r"(a) : "memory"); + __asm__ volatile("foo3" : "=r"(g1) : "r"(a)); + __asm__ ("foo4" : "=r"(g1) : "r"(a), "m"(g0)); + __asm__ ("foo5" : "=r"(g1) : "r"(a), "Q"(g0)); + __asm__ ("foo6" : "=r"(g1), "=m"(g0) : "r"(a)); + __asm__ ("foo7" : : "r"(a)); + __asm__ ("foo8" : "=r"(g2) : "r"(a)); +} diff --git a/test/CodeGen/atomic-ops.c b/test/CodeGen/atomic-ops.c index 13ab5f117f93..d8f7d28392a5 100644 --- a/test/CodeGen/atomic-ops.c +++ b/test/CodeGen/atomic-ops.c @@ -1,4 +1,5 @@ // RUN: %clang_cc1 %s -emit-llvm -o - -ffreestanding -triple=i686-apple-darwin9 | FileCheck %s +// REQUIRES: x86-registered-target // Also test serialization of atomic operations here, to avoid duplicating the // test. diff --git a/test/CodeGen/attr-target.c b/test/CodeGen/attr-target.c index 7ea5fe5a07a0..d805d133f365 100644 --- a/test/CodeGen/attr-target.c +++ b/test/CodeGen/attr-target.c @@ -13,6 +13,8 @@ int __attribute__((target("sse4"))) panda(int a) { return 4; } int bar(int a) { return baz(a) + foo(a); } +int __attribute__((target("avx, sse4.2, arch= ivybridge"))) qux(int a) { return 4; } + // Check that we emit the additional subtarget and cpu features for foo and not for baz or bar. // CHECK: baz{{.*}} #0 // CHECK: foo{{.*}} #1 @@ -22,6 +24,7 @@ int bar(int a) { return baz(a) + foo(a); } // CHECK: koala{{.*}} #0 // CHECK: echidna{{.*}} #2 // CHECK: bar{{.*}} #0 +// CHECK: qux{{.*}} #1 // CHECK: #0 = {{.*}}"target-cpu"="x86-64" "target-features"="+sse,+sse2" // CHECK: #1 = {{.*}}"target-cpu"="ivybridge" "target-features"="+avx,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3" // CHECK: #2 = {{.*}}"target-cpu"="x86-64" "target-features"="+sse,-aes,-avx,-avx2,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512pf,-avx512vl,-f16c,-fma,-fma4,-pclmul,-sha,-sse2,-sse3,-sse4.1,-sse4.2,-sse4a,-ssse3,-xop" diff --git a/test/CodeGen/available-externally-hidden.cpp b/test/CodeGen/available-externally-hidden.cpp new file mode 100644 index 000000000000..dc13f26b7526 --- /dev/null +++ b/test/CodeGen/available-externally-hidden.cpp @@ -0,0 +1,32 @@ +// RUN: %clang_cc1 -O2 -fvisibility hidden -std=c++11 -emit-llvm -o - -triple x86_64-apple-darwin10 %s | FileCheck %s + +// Ensure that available_externally functions eliminated at -O2 are now +// declarations, and are not emitted as hidden with -fvisibility=hidden, +// but rather with default visibility. +struct Filter { + virtual void Foo(); + int a; +}; + +class Message{}; +class Sender { + public: + virtual bool Send(Message* msg) = 0; + + protected: + virtual ~Sender() {} +}; + +// CHECK: declare zeroext i1 @_ZThn16_N17SyncMessageFilter4SendEP7Message +class SyncMessageFilter : public Filter, public Sender { + public: + bool Send(Message* message) override; +}; + +class TestSyncMessageFilter : public SyncMessageFilter { +}; + +int main() { +TestSyncMessageFilter* f = new TestSyncMessageFilter; + f->Send(new Message); +} diff --git a/test/CodeGen/available-externally-suppress.c b/test/CodeGen/available-externally-suppress.c index 390d2017884a..a25a28271277 100644 --- a/test/CodeGen/available-externally-suppress.c +++ b/test/CodeGen/available-externally-suppress.c @@ -1,12 +1,18 @@ // RUN: %clang_cc1 -emit-llvm -o - -triple x86_64-apple-darwin10 %s | FileCheck %s +// RUN: %clang_cc1 -O2 -fno-inline -emit-llvm -o - -triple x86_64-apple-darwin10 %s | FileCheck %s +// RUN: %clang_cc1 -flto -O2 -fno-inline -emit-llvm -o - -triple x86_64-apple-darwin10 %s | FileCheck %s -check-prefix=LTO // Ensure that we don't emit available_externally functions at -O0. +// Also should not emit them at -O2, unless -flto is present in which case +// we should preserve them for link-time inlining decisions. int x; inline void f0(int y) { x = y; } // CHECK-LABEL: define void @test() // CHECK: declare void @f0(i32) +// LTO-LABEL: define void @test() +// LTO: define available_externally void @f0 void test() { f0(17); } @@ -19,9 +25,13 @@ inline int __attribute__((always_inline)) f1(int x) { } // CHECK: @test1 +// LTO: @test1 int test1(int x) { // CHECK: br i1 // CHECK-NOT: call {{.*}} @f1 // CHECK: ret i32 + // LTO: br i1 + // LTO-NOT: call {{.*}} @f1 + // LTO: ret i32 return f1(x); } diff --git a/test/CodeGen/avx512vlbw-builtins.c b/test/CodeGen/avx512vlbw-builtins.c index a4a12440dc11..7aa8b873dc42 100644 --- a/test/CodeGen/avx512vlbw-builtins.c +++ b/test/CodeGen/avx512vlbw-builtins.c @@ -792,3 +792,588 @@ __m128i test_mm_maskz_mullo_epi16 (__mmask8 __U, __m128i __A, __m128i __B) { //CHECK: @llvm.x86.avx512.mask.pmull.w.128 return _mm_maskz_mullo_epi16(__U , __A, __B); } + + +__m128i test_mm_mask_blend_epi8(__mmask16 __U, __m128i __A, __m128i __W) { + // CHECK-LABEL: @test_mm_mask_blend_epi8 + // CHECK: @llvm.x86.avx512.mask.blend.b.128 + return _mm_mask_blend_epi8(__U,__A,__W); +} +__m256i test_mm256_mask_blend_epi8(__mmask32 __U, __m256i __A, __m256i __W) { + // CHECK-LABEL: @test_mm256_mask_blend_epi8 + // CHECK: @llvm.x86.avx512.mask.blend.b.256 + return _mm256_mask_blend_epi8(__U,__A,__W); +} + +__m128i test_mm_mask_blend_epi16(__mmask8 __U, __m128i __A, __m128i __W) { + // CHECK-LABEL: @test_mm_mask_blend_epi16 + // CHECK: @llvm.x86.avx512.mask.blend.w.128 + return _mm_mask_blend_epi16(__U,__A,__W); +} + +__m256i test_mm256_mask_blend_epi16(__mmask16 __U, __m256i __A, __m256i __W) { + // CHECK-LABEL: @test_mm256_mask_blend_epi16 + // CHECK: @llvm.x86.avx512.mask.blend.w.256 + return _mm256_mask_blend_epi16(__U,__A,__W); +} + +__m128i test_mm_mask_abs_epi8(__m128i __W, __mmask16 __U, __m128i __A) { + // CHECK-LABEL: @test_mm_mask_abs_epi8 + // CHECK: @llvm.x86.avx512.mask.pabs.b.128 + return _mm_mask_abs_epi8(__W,__U,__A); +} + +__m128i test_mm_maskz_abs_epi8(__mmask16 __U, __m128i __A) { + // CHECK-LABEL: @test_mm_maskz_abs_epi8 + // CHECK: @llvm.x86.avx512.mask.pabs.b.128 + return _mm_maskz_abs_epi8(__U,__A); +} + +__m256i test_mm256_mask_abs_epi8(__m256i __W, __mmask32 __U, __m256i __A) { + // CHECK-LABEL: @test_mm256_mask_abs_epi8 + // CHECK: @llvm.x86.avx512.mask.pabs.b.256 + return _mm256_mask_abs_epi8(__W,__U,__A); +} + +__m256i test_mm256_maskz_abs_epi8(__mmask32 __U, __m256i __A) { + // CHECK-LABEL: @test_mm256_maskz_abs_epi8 + // CHECK: @llvm.x86.avx512.mask.pabs.b.256 + return _mm256_maskz_abs_epi8(__U,__A); +} + +__m128i test_mm_mask_abs_epi16(__m128i __W, __mmask8 __U, __m128i __A) { + // CHECK-LABEL: @test_mm_mask_abs_epi16 + // CHECK: @llvm.x86.avx512.mask.pabs.w.128 + return _mm_mask_abs_epi16(__W,__U,__A); +} + +__m128i test_mm_maskz_abs_epi16(__mmask8 __U, __m128i __A) { + // CHECK-LABEL: @test_mm_maskz_abs_epi16 + // CHECK: @llvm.x86.avx512.mask.pabs.w.128 + return _mm_maskz_abs_epi16(__U,__A); +} + +__m256i test_mm256_mask_abs_epi16(__m256i __W, __mmask16 __U, __m256i __A) { + // CHECK-LABEL: @test_mm256_mask_abs_epi16 + // CHECK: @llvm.x86.avx512.mask.pabs.w.256 + return _mm256_mask_abs_epi16(__W,__U,__A); +} + +__m256i test_mm256_maskz_abs_epi16(__mmask16 __U, __m256i __A) { + // CHECK-LABEL: @test_mm256_maskz_abs_epi16 + // CHECK: @llvm.x86.avx512.mask.pabs.w.256 + return _mm256_maskz_abs_epi16(__U,__A); +} + +__m128i test_mm_maskz_packs_epi32(__mmask8 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_maskz_packs_epi32 + // CHECK: @llvm.x86.avx512.mask.packssdw.128 + return _mm_maskz_packs_epi32(__M,__A,__B); +} +__m128i test_mm_mask_packs_epi32(__m128i __W, __mmask16 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_mask_packs_epi32 + // CHECK: @llvm.x86.avx512.mask.packssdw.128 + return _mm_mask_packs_epi32(__W,__M,__A,__B); +} +__m256i test_mm256_maskz_packs_epi32(__mmask16 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_maskz_packs_epi32 + // CHECK: @llvm.x86.avx512.mask.packssdw.256 + return _mm256_maskz_packs_epi32(__M,__A,__B); +} +__m256i test_mm256_mask_packs_epi32(__m256i __W, __mmask16 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask_packs_epi32 + // CHECK: @llvm.x86.avx512.mask.packssdw.256 + return _mm256_mask_packs_epi32(__W,__M,__A,__B); +} +__m128i test_mm_maskz_packs_epi16(__mmask16 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_maskz_packs_epi16 + // CHECK: @llvm.x86.avx512.mask.packsswb.128 + return _mm_maskz_packs_epi16(__M,__A,__B); +} +__m128i test_mm_mask_packs_epi16(__m128i __W, __mmask16 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_mask_packs_epi16 + // CHECK: @llvm.x86.avx512.mask.packsswb.128 + return _mm_mask_packs_epi16(__W,__M,__A,__B); +} +__m256i test_mm256_maskz_packs_epi16(__mmask32 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_maskz_packs_epi16 + // CHECK: @llvm.x86.avx512.mask.packsswb.256 + return _mm256_maskz_packs_epi16(__M,__A,__B); +} +__m256i test_mm256_mask_packs_epi16(__m256i __W, __mmask32 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask_packs_epi16 + // CHECK: @llvm.x86.avx512.mask.packsswb.256 + return _mm256_mask_packs_epi16(__W,__M,__A,__B); +} + +__m128i test_mm_mask_packus_epi32(__m128i __W, __mmask16 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_mask_packus_epi32 + // CHECK: @llvm.x86.avx512.mask.packusdw.128 + return _mm_mask_packus_epi32(__W,__M,__A,__B); +} + +__m128i test_mm_maskz_packus_epi32(__mmask8 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_maskz_packus_epi32 + // CHECK: @llvm.x86.avx512.mask.packusdw.128 + return _mm_maskz_packus_epi32(__M,__A,__B); +} + +__m256i test_mm256_maskz_packus_epi32(__mmask16 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_maskz_packus_epi32 + // CHECK: @llvm.x86.avx512.mask.packusdw.256 + return _mm256_maskz_packus_epi32(__M,__A,__B); +} + +__m256i test_mm256_mask_packus_epi32(__m256i __W, __mmask16 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask_packus_epi32 + // CHECK: @llvm.x86.avx512.mask.packusdw.256 + return _mm256_mask_packus_epi32(__W,__M,__A,__B); +} + +__m128i test_mm_maskz_packus_epi16(__mmask16 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_maskz_packus_epi16 + // CHECK: @llvm.x86.avx512.mask.packuswb.128 + return _mm_maskz_packus_epi16(__M,__A,__B); +} + +__m128i test_mm_mask_packus_epi16(__m128i __W, __mmask16 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_mask_packus_epi16 + // CHECK: @llvm.x86.avx512.mask.packuswb.128 + return _mm_mask_packus_epi16(__W,__M,__A,__B); +} + +__m256i test_mm256_maskz_packus_epi16(__mmask32 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_maskz_packus_epi16 + // CHECK: @llvm.x86.avx512.mask.packuswb.256 + return _mm256_maskz_packus_epi16(__M,__A,__B); +} + +__m256i test_mm256_mask_packus_epi16(__m256i __W, __mmask32 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask_packus_epi16 + // CHECK: @llvm.x86.avx512.mask.packuswb.256 + return _mm256_mask_packus_epi16(__W,__M,__A,__B); +} + +__m128i test_mm_mask_adds_epi8(__m128i __W, __mmask16 __U, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_mask_adds_epi8 + // CHECK: @llvm.x86.avx512.mask.padds.b.128 + return _mm_mask_adds_epi8(__W,__U,__A,__B); +} +__m128i test_mm_maskz_adds_epi8(__mmask16 __U, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_maskz_adds_epi8 + // CHECK: @llvm.x86.avx512.mask.padds.b.128 + return _mm_maskz_adds_epi8(__U,__A,__B); +} +__m256i test_mm256_mask_adds_epi8(__m256i __W, __mmask32 __U, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask_adds_epi8 + // CHECK: @llvm.x86.avx512.mask.padds.b.256 + return _mm256_mask_adds_epi8(__W,__U,__A,__B); +} +__m256i test_mm256_maskz_adds_epi8(__mmask32 __U, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_maskz_adds_epi8 + // CHECK: @llvm.x86.avx512.mask.padds.b.256 + return _mm256_maskz_adds_epi8(__U,__A,__B); +} +__m128i test_mm_mask_adds_epi16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_mask_adds_epi16 + // CHECK: @llvm.x86.avx512.mask.padds.w.128 + return _mm_mask_adds_epi16(__W,__U,__A,__B); +} +__m128i test_mm_maskz_adds_epi16(__mmask8 __U, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_maskz_adds_epi16 + // CHECK: @llvm.x86.avx512.mask.padds.w.128 + return _mm_maskz_adds_epi16(__U,__A,__B); +} +__m256i test_mm256_mask_adds_epi16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask_adds_epi16 + // CHECK: @llvm.x86.avx512.mask.padds.w.256 + return _mm256_mask_adds_epi16(__W,__U,__A,__B); +} +__m256i test_mm256_maskz_adds_epi16(__mmask16 __U, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_maskz_adds_epi16 + // CHECK: @llvm.x86.avx512.mask.padds.w.256 + return _mm256_maskz_adds_epi16(__U,__A,__B); +} +__m128i test_mm_mask_adds_epu8(__m128i __W, __mmask16 __U, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_mask_adds_epu8 + // CHECK: @llvm.x86.avx512.mask.paddus.b.128 + return _mm_mask_adds_epu8(__W,__U,__A,__B); +} +__m128i test_mm_maskz_adds_epu8(__mmask16 __U, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_maskz_adds_epu8 + // CHECK: @llvm.x86.avx512.mask.paddus.b.128 + return _mm_maskz_adds_epu8(__U,__A,__B); +} +__m256i test_mm256_mask_adds_epu8(__m256i __W, __mmask32 __U, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask_adds_epu8 + // CHECK: @llvm.x86.avx512.mask.paddus.b.256 + return _mm256_mask_adds_epu8(__W,__U,__A,__B); +} +__m256i test_mm256_maskz_adds_epu8(__mmask32 __U, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_maskz_adds_epu8 + // CHECK: @llvm.x86.avx512.mask.paddus.b.256 + return _mm256_maskz_adds_epu8(__U,__A,__B); +} +__m128i test_mm_mask_adds_epu16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_mask_adds_epu16 + // CHECK: @llvm.x86.avx512.mask.paddus.w.128 + return _mm_mask_adds_epu16(__W,__U,__A,__B); +} +__m128i test_mm_maskz_adds_epu16(__mmask8 __U, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_maskz_adds_epu16 + // CHECK: @llvm.x86.avx512.mask.paddus.w.128 + return _mm_maskz_adds_epu16(__U,__A,__B); +} +__m256i test_mm256_mask_adds_epu16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask_adds_epu16 + // CHECK: @llvm.x86.avx512.mask.paddus.w.256 + return _mm256_mask_adds_epu16(__W,__U,__A,__B); +} +__m256i test_mm256_maskz_adds_epu16(__mmask16 __U, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_maskz_adds_epu16 + // CHECK: @llvm.x86.avx512.mask.paddus.w.256 + return _mm256_maskz_adds_epu16(__U,__A,__B); +} +__m128i test_mm_mask_avg_epu8(__m128i __W, __mmask16 __U, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_mask_avg_epu8 + // CHECK: @llvm.x86.avx512.mask.pavg.b.128 + return _mm_mask_avg_epu8(__W,__U,__A,__B); +} +__m128i test_mm_maskz_avg_epu8(__mmask16 __U, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_maskz_avg_epu8 + // CHECK: @llvm.x86.avx512.mask.pavg.b.128 + return _mm_maskz_avg_epu8(__U,__A,__B); +} +__m256i test_mm256_mask_avg_epu8(__m256i __W, __mmask32 __U, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask_avg_epu8 + // CHECK: @llvm.x86.avx512.mask.pavg.b.256 + return _mm256_mask_avg_epu8(__W,__U,__A,__B); +} +__m256i test_mm256_maskz_avg_epu8(__mmask32 __U, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_maskz_avg_epu8 + // CHECK: @llvm.x86.avx512.mask.pavg.b.256 + return _mm256_maskz_avg_epu8(__U,__A,__B); +} +__m128i test_mm_mask_avg_epu16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_mask_avg_epu16 + // CHECK: @llvm.x86.avx512.mask.pavg.w.128 + return _mm_mask_avg_epu16(__W,__U,__A,__B); +} +__m128i test_mm_maskz_avg_epu16(__mmask8 __U, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_maskz_avg_epu16 + // CHECK: @llvm.x86.avx512.mask.pavg.w.128 + return _mm_maskz_avg_epu16(__U,__A,__B); +} +__m256i test_mm256_mask_avg_epu16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask_avg_epu16 + // CHECK: @llvm.x86.avx512.mask.pavg.w.256 + return _mm256_mask_avg_epu16(__W,__U,__A,__B); +} +__m256i test_mm256_maskz_avg_epu16(__mmask16 __U, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_maskz_avg_epu16 + // CHECK: @llvm.x86.avx512.mask.pavg.w.256 + return _mm256_maskz_avg_epu16(__U,__A,__B); +} +__m128i test_mm_maskz_max_epi8(__mmask16 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_maskz_max_epi8 + // CHECK: @llvm.x86.avx512.mask.pmaxs.b.128 + return _mm_maskz_max_epi8(__M,__A,__B); +} +__m128i test_mm_mask_max_epi8(__m128i __W, __mmask16 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_mask_max_epi8 + // CHECK: @llvm.x86.avx512.mask.pmaxs.b.128 + return _mm_mask_max_epi8(__W,__M,__A,__B); +} +__m256i test_mm256_maskz_max_epi8(__mmask32 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_maskz_max_epi8 + // CHECK: @llvm.x86.avx512.mask.pmaxs.b.256 + return _mm256_maskz_max_epi8(__M,__A,__B); +} +__m256i test_mm256_mask_max_epi8(__m256i __W, __mmask32 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask_max_epi8 + // CHECK: @llvm.x86.avx512.mask.pmaxs.b.256 + return _mm256_mask_max_epi8(__W,__M,__A,__B); +} +__m128i test_mm_maskz_max_epi16(__mmask8 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_maskz_max_epi16 + // CHECK: @llvm.x86.avx512.mask.pmaxs.w.128 + return _mm_maskz_max_epi16(__M,__A,__B); +} +__m128i test_mm_mask_max_epi16(__m128i __W, __mmask8 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_mask_max_epi16 + // CHECK: @llvm.x86.avx512.mask.pmaxs.w.128 + return _mm_mask_max_epi16(__W,__M,__A,__B); +} +__m256i test_mm256_maskz_max_epi16(__mmask16 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_maskz_max_epi16 + // CHECK: @llvm.x86.avx512.mask.pmaxs.w.256 + return _mm256_maskz_max_epi16(__M,__A,__B); +} +__m256i test_mm256_mask_max_epi16(__m256i __W, __mmask16 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask_max_epi16 + // CHECK: @llvm.x86.avx512.mask.pmaxs.w.256 + return _mm256_mask_max_epi16(__W,__M,__A,__B); +} +__m128i test_mm_maskz_max_epu8(__mmask16 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_maskz_max_epu8 + // CHECK: @llvm.x86.avx512.mask.pmaxu.b.128 + return _mm_maskz_max_epu8(__M,__A,__B); +} +__m128i test_mm_mask_max_epu8(__m128i __W, __mmask16 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_mask_max_epu8 + // CHECK: @llvm.x86.avx512.mask.pmaxu.b.128 + return _mm_mask_max_epu8(__W,__M,__A,__B); +} +__m256i test_mm256_maskz_max_epu8(__mmask32 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_maskz_max_epu8 + // CHECK: @llvm.x86.avx512.mask.pmaxu.b.256 + return _mm256_maskz_max_epu8(__M,__A,__B); +} +__m256i test_mm256_mask_max_epu8(__m256i __W, __mmask32 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask_max_epu8 + // CHECK: @llvm.x86.avx512.mask.pmaxu.b.256 + return _mm256_mask_max_epu8(__W,__M,__A,__B); +} +__m128i test_mm_maskz_max_epu16(__mmask8 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_maskz_max_epu16 + // CHECK: @llvm.x86.avx512.mask.pmaxu.w.128 + return _mm_maskz_max_epu16(__M,__A,__B); +} +__m128i test_mm_mask_max_epu16(__m128i __W, __mmask8 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_mask_max_epu16 + // CHECK: @llvm.x86.avx512.mask.pmaxu.w.128 + return _mm_mask_max_epu16(__W,__M,__A,__B); +} +__m256i test_mm256_maskz_max_epu16(__mmask16 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_maskz_max_epu16 + // CHECK: @llvm.x86.avx512.mask.pmaxu.w.256 + return _mm256_maskz_max_epu16(__M,__A,__B); +} +__m256i test_mm256_mask_max_epu16(__m256i __W, __mmask16 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask_max_epu16 + // CHECK: @llvm.x86.avx512.mask.pmaxu.w.256 + return _mm256_mask_max_epu16(__W,__M,__A,__B); +} +__m128i test_mm_maskz_min_epi8(__mmask16 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_maskz_min_epi8 + // CHECK: @llvm.x86.avx512.mask.pmins.b.128 + return _mm_maskz_min_epi8(__M,__A,__B); +} +__m128i test_mm_mask_min_epi8(__m128i __W, __mmask16 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_mask_min_epi8 + // CHECK: @llvm.x86.avx512.mask.pmins.b.128 + return _mm_mask_min_epi8(__W,__M,__A,__B); +} +__m256i test_mm256_maskz_min_epi8(__mmask32 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_maskz_min_epi8 + // CHECK: @llvm.x86.avx512.mask.pmins.b.256 + return _mm256_maskz_min_epi8(__M,__A,__B); +} +__m256i test_mm256_mask_min_epi8(__m256i __W, __mmask32 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask_min_epi8 + // CHECK: @llvm.x86.avx512.mask.pmins.b.256 + return _mm256_mask_min_epi8(__W,__M,__A,__B); +} +__m128i test_mm_maskz_min_epi16(__mmask8 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_maskz_min_epi16 + // CHECK: @llvm.x86.avx512.mask.pmins.w.128 + return _mm_maskz_min_epi16(__M,__A,__B); +} +__m128i test_mm_mask_min_epi16(__m128i __W, __mmask8 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_mask_min_epi16 + // CHECK: @llvm.x86.avx512.mask.pmins.w.128 + return _mm_mask_min_epi16(__W,__M,__A,__B); +} +__m256i test_mm256_maskz_min_epi16(__mmask16 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_maskz_min_epi16 + // CHECK: @llvm.x86.avx512.mask.pmins.w.256 + return _mm256_maskz_min_epi16(__M,__A,__B); +} +__m256i test_mm256_mask_min_epi16(__m256i __W, __mmask16 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask_min_epi16 + // CHECK: @llvm.x86.avx512.mask.pmins.w.256 + return _mm256_mask_min_epi16(__W,__M,__A,__B); +} +__m128i test_mm_maskz_min_epu8(__mmask16 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_maskz_min_epu8 + // CHECK: @llvm.x86.avx512.mask.pminu.b.128 + return _mm_maskz_min_epu8(__M,__A,__B); +} +__m128i test_mm_mask_min_epu8(__m128i __W, __mmask16 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_mask_min_epu8 + // CHECK: @llvm.x86.avx512.mask.pminu.b.128 + return _mm_mask_min_epu8(__W,__M,__A,__B); +} +__m256i test_mm256_maskz_min_epu8(__mmask32 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_maskz_min_epu8 + // CHECK: @llvm.x86.avx512.mask.pminu.b.256 + return _mm256_maskz_min_epu8(__M,__A,__B); +} +__m256i test_mm256_mask_min_epu8(__m256i __W, __mmask32 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask_min_epu8 + // CHECK: @llvm.x86.avx512.mask.pminu.b.256 + return _mm256_mask_min_epu8(__W,__M,__A,__B); +} +__m128i test_mm_maskz_min_epu16(__mmask8 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_maskz_min_epu16 + // CHECK: @llvm.x86.avx512.mask.pminu.w.128 + return _mm_maskz_min_epu16(__M,__A,__B); +} +__m128i test_mm_mask_min_epu16(__m128i __W, __mmask8 __M, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_mask_min_epu16 + // CHECK: @llvm.x86.avx512.mask.pminu.w.128 + return _mm_mask_min_epu16(__W,__M,__A,__B); +} +__m256i test_mm256_maskz_min_epu16(__mmask16 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_maskz_min_epu16 + // CHECK: @llvm.x86.avx512.mask.pminu.w.256 + return _mm256_maskz_min_epu16(__M,__A,__B); +} +__m256i test_mm256_mask_min_epu16(__m256i __W, __mmask16 __M, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask_min_epu16 + // CHECK: @llvm.x86.avx512.mask.pminu.w.256 + return _mm256_mask_min_epu16(__W,__M,__A,__B); +} +__m128i test_mm_mask_shuffle_epi8(__m128i __W, __mmask16 __U, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_mask_shuffle_epi8 + // CHECK: @llvm.x86.avx512.mask.pshuf.b.128 + return _mm_mask_shuffle_epi8(__W,__U,__A,__B); +} +__m128i test_mm_maskz_shuffle_epi8(__mmask16 __U, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_maskz_shuffle_epi8 + // CHECK: @llvm.x86.avx512.mask.pshuf.b.128 + return _mm_maskz_shuffle_epi8(__U,__A,__B); +} +__m256i test_mm256_mask_shuffle_epi8(__m256i __W, __mmask32 __U, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask_shuffle_epi8 + // CHECK: @llvm.x86.avx512.mask.pshuf.b.256 + return _mm256_mask_shuffle_epi8(__W,__U,__A,__B); +} +__m256i test_mm256_maskz_shuffle_epi8(__mmask32 __U, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_maskz_shuffle_epi8 + // CHECK: @llvm.x86.avx512.mask.pshuf.b.256 + return _mm256_maskz_shuffle_epi8(__U,__A,__B); +} +__m128i test_mm_mask_subs_epi8(__m128i __W, __mmask16 __U, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_mask_subs_epi8 + // CHECK: @llvm.x86.avx512.mask.psubs.b.128 + return _mm_mask_subs_epi8(__W,__U,__A,__B); +} +__m128i test_mm_maskz_subs_epi8(__mmask16 __U, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_maskz_subs_epi8 + // CHECK: @llvm.x86.avx512.mask.psubs.b.128 + return _mm_maskz_subs_epi8(__U,__A,__B); +} +__m256i test_mm256_mask_subs_epi8(__m256i __W, __mmask32 __U, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask_subs_epi8 + // CHECK: @llvm.x86.avx512.mask.psubs.b.256 + return _mm256_mask_subs_epi8(__W,__U,__A,__B); +} +__m256i test_mm256_maskz_subs_epi8(__mmask32 __U, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_maskz_subs_epi8 + // CHECK: @llvm.x86.avx512.mask.psubs.b.256 + return _mm256_maskz_subs_epi8(__U,__A,__B); +} +__m128i test_mm_mask_subs_epi16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_mask_subs_epi16 + // CHECK: @llvm.x86.avx512.mask.psubs.w.128 + return _mm_mask_subs_epi16(__W,__U,__A,__B); +} +__m128i test_mm_maskz_subs_epi16(__mmask8 __U, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_maskz_subs_epi16 + // CHECK: @llvm.x86.avx512.mask.psubs.w.128 + return _mm_maskz_subs_epi16(__U,__A,__B); +} +__m256i test_mm256_mask_subs_epi16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask_subs_epi16 + // CHECK: @llvm.x86.avx512.mask.psubs.w.256 + return _mm256_mask_subs_epi16(__W,__U,__A,__B); +} +__m256i test_mm256_maskz_subs_epi16(__mmask16 __U, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_maskz_subs_epi16 + // CHECK: @llvm.x86.avx512.mask.psubs.w.256 + return _mm256_maskz_subs_epi16(__U,__A,__B); +} +__m128i test_mm_mask_subs_epu8(__m128i __W, __mmask16 __U, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_mask_subs_epu8 + // CHECK: @llvm.x86.avx512.mask.psubus.b.128 + return _mm_mask_subs_epu8(__W,__U,__A,__B); +} +__m128i test_mm_maskz_subs_epu8(__mmask16 __U, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_maskz_subs_epu8 + // CHECK: @llvm.x86.avx512.mask.psubus.b.128 + return _mm_maskz_subs_epu8(__U,__A,__B); +} +__m256i test_mm256_mask_subs_epu8(__m256i __W, __mmask32 __U, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask_subs_epu8 + // CHECK: @llvm.x86.avx512.mask.psubus.b.256 + return _mm256_mask_subs_epu8(__W,__U,__A,__B); +} +__m256i test_mm256_maskz_subs_epu8(__mmask32 __U, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_maskz_subs_epu8 + // CHECK: @llvm.x86.avx512.mask.psubus.b.256 + return _mm256_maskz_subs_epu8(__U,__A,__B); +} +__m128i test_mm_mask_subs_epu16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_mask_subs_epu16 + // CHECK: @llvm.x86.avx512.mask.psubus.w.128 + return _mm_mask_subs_epu16(__W,__U,__A,__B); +} +__m128i test_mm_maskz_subs_epu16(__mmask8 __U, __m128i __A, __m128i __B) { + // CHECK-LABEL: @test_mm_maskz_subs_epu16 + // CHECK: @llvm.x86.avx512.mask.psubus.w.128 + return _mm_maskz_subs_epu16(__U,__A,__B); +} +__m256i test_mm256_mask_subs_epu16(__m256i __W, __mmask16 __U, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask_subs_epu16 + // CHECK: @llvm.x86.avx512.mask.psubus.w.256 + return _mm256_mask_subs_epu16(__W,__U,__A,__B); +} +__m256i test_mm256_maskz_subs_epu16(__mmask16 __U, __m256i __A, __m256i __B) { + // CHECK-LABEL: @test_mm256_maskz_subs_epu16 + // CHECK: @llvm.x86.avx512.mask.psubus.w.256 + return _mm256_maskz_subs_epu16(__U,__A,__B); +} + + +__m128i test_mm_mask2_permutex2var_epi16(__m128i __A, __m128i __I, __mmask8 __U, __m128i __B) { + // CHECK-LABEL: @test_mm_mask2_permutex2var_epi16 + // CHECK: @llvm.x86.avx512.mask.vpermi2var.hi.128 + return _mm_mask2_permutex2var_epi16(__A,__I,__U,__B); +} +__m256i test_mm256_mask2_permutex2var_epi16(__m256i __A, __m256i __I, __mmask16 __U, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask2_permutex2var_epi16 + // CHECK: @llvm.x86.avx512.mask.vpermi2var.hi.256 + return _mm256_mask2_permutex2var_epi16(__A,__I,__U,__B); +} +__m128i test_mm_permutex2var_epi16(__m128i __A, __m128i __I, __m128i __B) { + // CHECK-LABEL: @test_mm_permutex2var_epi16 + // CHECK: @llvm.x86.avx512.mask.vpermt2var.hi.128 + return _mm_permutex2var_epi16(__A,__I,__B); +} +__m128i test_mm_mask_permutex2var_epi16(__m128i __A, __mmask8 __U, __m128i __I, __m128i __B) { + // CHECK-LABEL: @test_mm_mask_permutex2var_epi16 + // CHECK: @llvm.x86.avx512.mask.vpermt2var.hi.128 + return _mm_mask_permutex2var_epi16(__A,__U,__I,__B); +} +__m128i test_mm_maskz_permutex2var_epi16(__mmask8 __U, __m128i __A, __m128i __I, __m128i __B) { + // CHECK-LABEL: @test_mm_maskz_permutex2var_epi16 + // CHECK: @llvm.x86.avx512.maskz.vpermt2var.hi.128 + return _mm_maskz_permutex2var_epi16(__U,__A,__I,__B); +} + +__m256i test_mm256_permutex2var_epi16(__m256i __A, __m256i __I, __m256i __B) { + // CHECK-LABEL: @test_mm256_permutex2var_epi16 + // CHECK: @llvm.x86.avx512.mask.vpermt2var.hi.256 + return _mm256_permutex2var_epi16(__A,__I,__B); +} +__m256i test_mm256_mask_permutex2var_epi16(__m256i __A, __mmask16 __U, __m256i __I, __m256i __B) { + // CHECK-LABEL: @test_mm256_mask_permutex2var_epi16 + // CHECK: @llvm.x86.avx512.mask.vpermt2var.hi.256 + return _mm256_mask_permutex2var_epi16(__A,__U,__I,__B); +} +__m256i test_mm256_maskz_permutex2var_epi16(__mmask16 __U, __m256i __A, __m256i __I, __m256i __B) { + // CHECK-LABEL: @test_mm256_maskz_permutex2var_epi16 + // CHECK: @llvm.x86.avx512.maskz.vpermt2var.hi.256 + return _mm256_maskz_permutex2var_epi16(__U,__A,__I,__B); +} diff --git a/test/CodeGen/big-atomic-ops.c b/test/CodeGen/big-atomic-ops.c index 28b7b5d70822..6a7a7001f96d 100644 --- a/test/CodeGen/big-atomic-ops.c +++ b/test/CodeGen/big-atomic-ops.c @@ -1,5 +1,5 @@ // RUN: %clang_cc1 %s -emit-llvm -o - -triple=x86_64-apple-macosx10.9.0 | FileCheck %s - +// REQUIRES: x86-registered-target // Also test serialization of atomic operations here, to avoid duplicating the // test. // RUN: %clang_cc1 %s -emit-pch -o %t -triple=x86_64-apple-macosx10.9.0 diff --git a/test/CodeGen/bitfield-2.c b/test/CodeGen/bitfield-2.c index c5154fcb19e2..e4b1b0d9fd5c 100644 --- a/test/CodeGen/bitfield-2.c +++ b/test/CodeGen/bitfield-2.c @@ -14,7 +14,7 @@ // CHECK-RECORD: LLVMType:%struct.s0 = type { [3 x i8] } // CHECK-RECORD: IsZeroInitializable:1 // CHECK-RECORD: BitFields:[ -// CHECK-RECORD: <CGBitFieldInfo Offset:0 Size:24 IsSigned:1 StorageSize:24 StorageAlignment:1> +// CHECK-RECORD: <CGBitFieldInfo Offset:0 Size:24 IsSigned:1 StorageSize:24 StorageOffset:0> struct __attribute((packed)) s0 { int f0 : 24; }; @@ -54,8 +54,8 @@ unsigned long long test_0() { // CHECK-RECORD: LLVMType:%struct.s1 = type { [3 x i8] } // CHECK-RECORD: IsZeroInitializable:1 // CHECK-RECORD: BitFields:[ -// CHECK-RECORD: <CGBitFieldInfo Offset:0 Size:10 IsSigned:1 StorageSize:24 StorageAlignment:1> -// CHECK-RECORD: <CGBitFieldInfo Offset:10 Size:10 IsSigned:1 StorageSize:24 StorageAlignment:1> +// CHECK-RECORD: <CGBitFieldInfo Offset:0 Size:10 IsSigned:1 StorageSize:24 StorageOffset:0> +// CHECK-RECORD: <CGBitFieldInfo Offset:10 Size:10 IsSigned:1 StorageSize:24 StorageOffset:0> #pragma pack(push) #pragma pack(1) @@ -102,7 +102,7 @@ unsigned long long test_1() { // CHECK-RECORD: LLVMType:%union.u2 = type { i8 } // CHECK-RECORD: IsZeroInitializable:1 // CHECK-RECORD: BitFields:[ -// CHECK-RECORD: <CGBitFieldInfo Offset:0 Size:3 IsSigned:0 StorageSize:8 StorageAlignment:1> +// CHECK-RECORD: <CGBitFieldInfo Offset:0 Size:3 IsSigned:0 StorageSize:8 StorageOffset:0> union __attribute__((packed)) u2 { unsigned long long f0 : 3; @@ -274,8 +274,8 @@ _Bool test_6() { // CHECK-RECORD: LLVMType:%struct.s7 = type { i32, i32, i32, i8, i32, [12 x i8] } // CHECK-RECORD: IsZeroInitializable:1 // CHECK-RECORD: BitFields:[ -// CHECK-RECORD: <CGBitFieldInfo Offset:0 Size:5 IsSigned:1 StorageSize:8 StorageAlignment:4> -// CHECK-RECORD: <CGBitFieldInfo Offset:0 Size:29 IsSigned:1 StorageSize:32 StorageAlignment:16> +// CHECK-RECORD: <CGBitFieldInfo Offset:0 Size:5 IsSigned:1 StorageSize:8 StorageOffset:12> +// CHECK-RECORD: <CGBitFieldInfo Offset:0 Size:29 IsSigned:1 StorageSize:32 StorageOffset:16> struct __attribute__((aligned(16))) s7 { int a, b, c; diff --git a/test/CodeGen/builtins-ppc-altivec.c b/test/CodeGen/builtins-ppc-altivec.c index c6aa3c2faac2..8e8216b10111 100644 --- a/test/CodeGen/builtins-ppc-altivec.c +++ b/test/CodeGen/builtins-ppc-altivec.c @@ -1081,6 +1081,31 @@ void test6() { // CHECK: @llvm.ppc.altivec.vctuxs // CHECK-LE: @llvm.ppc.altivec.vctuxs + /* vec_div */ + res_vsc = vec_div(vsc, vsc); +// CHECK: sdiv <16 x i8> +// CHECK-LE: sdiv <16 x i8> + + res_vuc = vec_div(vuc, vuc); +// CHECK: udiv <16 x i8> +// CHECK-LE: udiv <16 x i8> + + res_vs = vec_div(vs, vs); +// CHECK: sdiv <8 x i16> +// CHECK-LE: sdiv <8 x i16> + + res_vus = vec_div(vus, vus); +// CHECK: udiv <8 x i16> +// CHECK-LE: udiv <8 x i16> + + res_vi = vec_div(vi, vi); +// CHECK: sdiv <4 x i32> +// CHECK-LE: sdiv <4 x i32> + + res_vui = vec_div(vui, vui); +// CHECK: udiv <4 x i32> +// CHECK-LE: udiv <4 x i32> + /* vec_dss */ vec_dss(0); // CHECK: @llvm.ppc.altivec.dss @@ -2127,6 +2152,31 @@ void test6() { // CHECK: @llvm.ppc.altivec.mtvscr // CHECK-LE: @llvm.ppc.altivec.mtvscr + /* vec_mul */ + res_vsc = vec_mul(vsc, vsc); +// CHECK: mul <16 x i8> +// CHECK-LE: mul <16 x i8> + + res_vuc = vec_mul(vuc, vuc); +// CHECK: mul <16 x i8> +// CHECK-LE: mul <16 x i8> + + res_vs = vec_mul(vs, vs); +// CHECK: mul <8 x i16> +// CHECK-LE: mul <8 x i16> + + res_vus = vec_mul(vus, vus); +// CHECK: mul <8 x i16> +// CHECK-LE: mul <8 x i16> + + res_vi = vec_mul(vi, vi); +// CHECK: mul <4 x i32> +// CHECK-LE: mul <4 x i32> + + res_vui = vec_mul(vui, vui); +// CHECK: mul <4 x i32> +// CHECK-LE: mul <4 x i32> + /* vec_mule */ res_vs = vec_mule(vsc, vsc); // CHECK: @llvm.ppc.altivec.vmulesb @@ -3272,6 +3322,15 @@ void test6() { // CHECK: @llvm.ppc.altivec.vperm // CHECK-LE: @llvm.ppc.altivec.vperm + res_vbs = vec_sld(vbs, vbs, 0); +// CHECK: [[T1:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK: [[T2:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK: call <4 x i32> @llvm.ppc.altivec.vperm(<4 x i32> [[T1]], <4 x i32> [[T2]], <16 x i8> +// CHECK-LE: xor <16 x i8> +// CHECK-LE: [[T1:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK-LE: [[T2:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK-LE: call <4 x i32> @llvm.ppc.altivec.vperm(<4 x i32> [[T1]], <4 x i32> [[T2]], <16 x i8> + res_vp = vec_sld(vp, vp, 0); // CHECK: @llvm.ppc.altivec.vperm // CHECK-LE: @llvm.ppc.altivec.vperm @@ -3284,6 +3343,11 @@ void test6() { // CHECK: @llvm.ppc.altivec.vperm // CHECK-LE: @llvm.ppc.altivec.vperm + res_vbi = vec_sld(vbi, vbi, 0); +// CHECK: call <4 x i32> @llvm.ppc.altivec.vperm(<4 x i32> {{.+}}, <4 x i32> {{.+}}, <16 x i8> +// CHECK-LE: xor <16 x i8> +// CHECK-LE: call <4 x i32> @llvm.ppc.altivec.vperm(<4 x i32> {{.+}}, <4 x i32> {{.+}}, <16 x i8> + res_vf = vec_sld(vf, vf, 0); // CHECK: @llvm.ppc.altivec.vperm // CHECK-LE: @llvm.ppc.altivec.vperm @@ -3802,28 +3866,28 @@ void test6() { /* vec_sr */ res_vsc = vec_sr(vsc, vuc); -// CHECK: shr <16 x i8> -// CHECK-LE: shr <16 x i8> +// CHECK: lshr <16 x i8> +// CHECK-LE: lshr <16 x i8> res_vuc = vec_sr(vuc, vuc); -// CHECK: shr <16 x i8> -// CHECK-LE: shr <16 x i8> +// CHECK: lshr <16 x i8> +// CHECK-LE: lshr <16 x i8> res_vs = vec_sr(vs, vus); -// CHECK: shr <8 x i16> -// CHECK-LE: shr <8 x i16> +// CHECK: lshr <8 x i16> +// CHECK-LE: lshr <8 x i16> res_vus = vec_sr(vus, vus); -// CHECK: shr <8 x i16> -// CHECK-LE: shr <8 x i16> +// CHECK: lshr <8 x i16> +// CHECK-LE: lshr <8 x i16> res_vi = vec_sr(vi, vui); -// CHECK: shr <4 x i32> -// CHECK-LE: shr <4 x i32> +// CHECK: lshr <4 x i32> +// CHECK-LE: lshr <4 x i32> res_vui = vec_sr(vui, vui); -// CHECK: shr <4 x i32> -// CHECK-LE: shr <4 x i32> +// CHECK: lshr <4 x i32> +// CHECK-LE: lshr <4 x i32> res_vsc = vec_vsrb(vsc, vuc); // CHECK: shr <16 x i8> diff --git a/test/CodeGen/builtins-ppc-p8vector.c b/test/CodeGen/builtins-ppc-p8vector.c index 61e14ba283d2..208dd4347f65 100644 --- a/test/CodeGen/builtins-ppc-p8vector.c +++ b/test/CodeGen/builtins-ppc-p8vector.c @@ -9,23 +9,41 @@ vector signed char vsc = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 }; vector unsigned char vuc = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 }; -vector int vi = { -1, 2, -3, 4 }; +vector bool char vbc = { 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1 }; + +vector signed short vss = { 0, 1, 2, 3, 4, 5, 6, 7 }; +vector unsigned short vus = { 0, 1, 2, 3, 4, 5, 6, 7 }; +vector bool short vbs = { 1, 1, 0, 0, 0, 0, 1, 1 }; + +vector signed int vsi = { -1, 2, -3, 4 }; vector unsigned int vui = { 1, 2, 3, 4 }; vector bool int vbi = {0, -1, -1, 0}; -vector bool long long vbll = { 1, 0 }; + vector signed long long vsll = { 1, 2 }; vector unsigned long long vull = { 1, 2 }; +vector bool long long vbll = { 1, 0 }; + +vector float vfa = { 1.e-4f, -132.23f, -22.1, 32.00f }; vector double vda = { 1.e-11, -132.23e10 }; int res_i; vector signed char res_vsc; vector unsigned char res_vuc; -vector int res_vi; +vector bool char res_vbc; + +vector signed short res_vss; +vector unsigned short res_vus; +vector bool short res_vbs; + +vector signed int res_vsi; vector unsigned int res_vui; vector bool int res_vbi; -vector bool long long res_vbll; + vector signed long long res_vsll; vector unsigned long long res_vull; +vector bool long long res_vbll; + +vector double res_vf; vector double res_vd; // CHECK-LABEL: define void @test1 @@ -60,7 +78,7 @@ void test1() { // CHECK: @llvm.ppc.altivec.vperm // CHECK-LE: @llvm.ppc.altivec.vperm - res_vi = vec_mergee(vi, vi); + res_vsi = vec_mergee(vsi, vsi); // CHECK: @llvm.ppc.altivec.vperm // CHECK-LE: @llvm.ppc.altivec.vperm @@ -74,7 +92,7 @@ void test1() { // CHECK: @llvm.ppc.altivec.vperm // CHECK-LE: @llvm.ppc.altivec.vperm - res_vi = vec_mergeo(vi, vi); + res_vsi = vec_mergeo(vsi, vsi); // CHECK: @llvm.ppc.altivec.vperm // CHECK-LE: @llvm.ppc.altivec.vperm @@ -138,6 +156,325 @@ void test1() { // CHECK-LE: call <2 x i64> @llvm.ppc.altivec.vcmpgtud(<2 x i64> %{{[0-9]*}}, <2 x i64> %{{[0-9]*}}) // CHECK-PPC: error: call to 'vec_cmplt' is ambiguous + /* vec_eqv */ + res_vsc = vec_eqv(vsc, vsc); +// CHECK: [[T1:%.+]] = bitcast <16 x i8> {{.+}} to <4 x i32> +// CHECK: [[T2:%.+]] = bitcast <16 x i8> {{.+}} to <4 x i32> +// CHECK: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK: bitcast <4 x i32> [[T3]] to <16 x i8> +// CHECK-LE: [[T1:%.+]] = bitcast <16 x i8> {{.+}} to <4 x i32> +// CHECK-LE: [[T2:%.+]] = bitcast <16 x i8> {{.+}} to <4 x i32> +// CHECK-LE: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK-LE: bitcast <4 x i32> [[T3]] to <16 x i8> +// CHECK-PPC: error: assigning to + + res_vsc = vec_eqv(vbc, vsc); +// CHECK: [[T1:%.+]] = bitcast <16 x i8> {{.+}} to <4 x i32> +// CHECK: [[T2:%.+]] = bitcast <16 x i8> {{.+}} to <4 x i32> +// CHECK: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK: bitcast <4 x i32> [[T3]] to <16 x i8> +// CHECK-LE: [[T1:%.+]] = bitcast <16 x i8> {{.+}} to <4 x i32> +// CHECK-LE: [[T2:%.+]] = bitcast <16 x i8> {{.+}} to <4 x i32> +// CHECK-LE: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK-LE: bitcast <4 x i32> [[T3]] to <16 x i8> +// CHECK-PPC: error: assigning to + + res_vsc = vec_eqv(vsc, vbc); +// CHECK: [[T1:%.+]] = bitcast <16 x i8> {{.+}} to <4 x i32> +// CHECK: [[T2:%.+]] = bitcast <16 x i8> {{.+}} to <4 x i32> +// CHECK: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK: bitcast <4 x i32> [[T3]] to <16 x i8> +// CHECK-LE: [[T1:%.+]] = bitcast <16 x i8> {{.+}} to <4 x i32> +// CHECK-LE: [[T2:%.+]] = bitcast <16 x i8> {{.+}} to <4 x i32> +// CHECK-LE: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK-LE: bitcast <4 x i32> [[T3]] to <16 x i8> +// CHECK-PPC: error: assigning to + + res_vuc = vec_eqv(vuc, vuc); +// CHECK: [[T1:%.+]] = bitcast <16 x i8> {{.+}} to <4 x i32> +// CHECK: [[T2:%.+]] = bitcast <16 x i8> {{.+}} to <4 x i32> +// CHECK: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK: bitcast <4 x i32> [[T3]] to <16 x i8> +// CHECK-LE: [[T1:%.+]] = bitcast <16 x i8> {{.+}} to <4 x i32> +// CHECK-LE: [[T2:%.+]] = bitcast <16 x i8> {{.+}} to <4 x i32> +// CHECK-LE: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK-LE: bitcast <4 x i32> [[T3]] to <16 x i8> +// CHECK-PPC: error: assigning to + + res_vuc = vec_eqv(vbc, vuc); +// CHECK: [[T1:%.+]] = bitcast <16 x i8> {{.+}} to <4 x i32> +// CHECK: [[T2:%.+]] = bitcast <16 x i8> {{.+}} to <4 x i32> +// CHECK: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK: bitcast <4 x i32> [[T3]] to <16 x i8> +// CHECK-LE: [[T1:%.+]] = bitcast <16 x i8> {{.+}} to <4 x i32> +// CHECK-LE: [[T2:%.+]] = bitcast <16 x i8> {{.+}} to <4 x i32> +// CHECK-LE: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK-LE: bitcast <4 x i32> [[T3]] to <16 x i8> +// CHECK-PPC: error: assigning to + + res_vuc = vec_eqv(vuc, vbc); +// CHECK: [[T1:%.+]] = bitcast <16 x i8> {{.+}} to <4 x i32> +// CHECK: [[T2:%.+]] = bitcast <16 x i8> {{.+}} to <4 x i32> +// CHECK: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK: bitcast <4 x i32> [[T3]] to <16 x i8> +// CHECK-LE: [[T1:%.+]] = bitcast <16 x i8> {{.+}} to <4 x i32> +// CHECK-LE: [[T2:%.+]] = bitcast <16 x i8> {{.+}} to <4 x i32> +// CHECK-LE: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK-LE: bitcast <4 x i32> [[T3]] to <16 x i8> +// CHECK-PPC: error: assigning to + + res_vss = vec_eqv(vss, vss); +// CHECK: [[T1:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK: [[T2:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK: bitcast <4 x i32> [[T3]] to <8 x i16> +// CHECK-LE: [[T1:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK-LE: [[T2:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK-LE: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK-LE: bitcast <4 x i32> [[T3]] to <8 x i16> +// CHECK-PPC: error: assigning to + + res_vss = vec_eqv(vbs, vss); +// CHECK: [[T1:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK: [[T2:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK: bitcast <4 x i32> [[T3]] to <8 x i16> +// CHECK-LE: [[T1:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK-LE: [[T2:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK-LE: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK-LE: bitcast <4 x i32> [[T3]] to <8 x i16> +// CHECK-PPC: error: assigning to + + res_vss = vec_eqv(vss, vbs); +// CHECK: [[T1:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK: [[T2:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK: bitcast <4 x i32> [[T3]] to <8 x i16> +// CHECK-LE: [[T1:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK-LE: [[T2:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK-LE: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK-LE: bitcast <4 x i32> [[T3]] to <8 x i16> +// CHECK-PPC: error: assigning to + + res_vus = vec_eqv(vus, vus); +// CHECK: [[T1:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK: [[T2:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK: bitcast <4 x i32> [[T3]] to <8 x i16> +// CHECK-LE: [[T1:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK-LE: [[T2:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK-LE: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK-LE: bitcast <4 x i32> [[T3]] to <8 x i16> +// CHECK-PPC: error: assigning to + + res_vus = vec_eqv(vbs, vus); +// CHECK: [[T1:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK: [[T2:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK: bitcast <4 x i32> [[T3]] to <8 x i16> +// CHECK-LE: [[T1:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK-LE: [[T2:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK-LE: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK-LE: bitcast <4 x i32> [[T3]] to <8 x i16> +// CHECK-PPC: error: assigning to + + res_vus = vec_eqv(vus, vbs); +// CHECK: [[T1:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK: [[T2:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK: bitcast <4 x i32> [[T3]] to <8 x i16> +// CHECK-LE: [[T1:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK-LE: [[T2:%.+]] = bitcast <8 x i16> {{.+}} to <4 x i32> +// CHECK-LE: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK-LE: bitcast <4 x i32> [[T3]] to <8 x i16> +// CHECK-PPC: error: assigning to + + res_vsi = vec_eqv(vsi, vsi); +// CHECK: call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> {{.*}}, <4 x i32> {{.+}}) +// CHECK-LE: call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> {{.*}}, <4 x i32> {{.+}}) +// CHECK-PPC: error: assigning to + + res_vsi = vec_eqv(vbi, vsi); +// CHECK: call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> {{.*}}, <4 x i32> {{.+}}) +// CHECK-LE: call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> {{.*}}, <4 x i32> {{.+}}) +// CHECK-PPC: error: assigning to + + res_vsi = vec_eqv(vsi, vbi); +// CHECK: call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> {{.*}}, <4 x i32> {{.+}}) +// CHECK-LE: call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> {{.*}}, <4 x i32> {{.+}}) +// CHECK-PPC: error: assigning to + + res_vui = vec_eqv(vui, vui); +// CHECK: call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> {{.*}}, <4 x i32> {{.+}}) +// CHECK-LE: call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> {{.*}}, <4 x i32> {{.+}}) +// CHECK-PPC: error: assigning to + + res_vui = vec_eqv(vbi, vui); +// CHECK: call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> {{.*}}, <4 x i32> {{.+}}) +// CHECK-LE: call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> {{.*}}, <4 x i32> {{.+}}) +// CHECK-PPC: error: assigning to + + res_vui = vec_eqv(vui, vbi); +// CHECK: call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> {{.*}}, <4 x i32> {{.+}}) +// CHECK-LE: call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> {{.*}}, <4 x i32> {{.+}}) +// CHECK-PPC: error: assigning to + + res_vsll = vec_eqv(vsll, vsll); +// CHECK: [[T1:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK: [[T2:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK: bitcast <4 x i32> [[T3]] to <2 x i64> +// CHECK-LE: [[T1:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK-LE: [[T2:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK-LE: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK-LE: bitcast <4 x i32> [[T3]] to <2 x i64> +// CHECK-PPC: error: assigning to + + res_vsll = vec_eqv(vbll, vsll); +// CHECK: [[T1:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK: [[T2:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK: bitcast <4 x i32> [[T3]] to <2 x i64> +// CHECK-LE: [[T1:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK-LE: [[T2:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK-LE: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK-LE: bitcast <4 x i32> [[T3]] to <2 x i64> +// CHECK-PPC: error: assigning to + + res_vsll = vec_eqv(vsll, vbll); +// CHECK: [[T1:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK: [[T2:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK: bitcast <4 x i32> [[T3]] to <2 x i64> +// CHECK-LE: [[T1:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK-LE: [[T2:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK-LE: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK-LE: bitcast <4 x i32> [[T3]] to <2 x i64> +// CHECK-PPC: error: assigning to + + res_vull = vec_eqv(vull, vull); +// CHECK: [[T1:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK: [[T2:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK: bitcast <4 x i32> [[T3]] to <2 x i64> +// CHECK-LE: [[T1:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK-LE: [[T2:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK-LE: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK-LE: bitcast <4 x i32> [[T3]] to <2 x i64> +// CHECK-PPC: error: assigning to + + res_vull = vec_eqv(vbll, vull); +// CHECK: [[T1:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK: [[T2:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK: bitcast <4 x i32> [[T3]] to <2 x i64> +// CHECK-LE: [[T1:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK-LE: [[T2:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK-LE: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK-LE: bitcast <4 x i32> [[T3]] to <2 x i64> +// CHECK-PPC: error: assigning to + + res_vull = vec_eqv(vull, vbll); +// CHECK: [[T1:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK: [[T2:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK: bitcast <4 x i32> [[T3]] to <2 x i64> +// CHECK-LE: [[T1:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK-LE: [[T2:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK-LE: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK-LE: bitcast <4 x i32> [[T3]] to <2 x i64> +// CHECK-PPC: error: assigning to + + res_vf = vec_eqv(vfa, vfa); +// CHECK: [[T1:%.+]] = bitcast <4 x float> {{.+}} to <4 x i32> +// CHECK: [[T2:%.+]] = bitcast <4 x float> {{.+}} to <4 x i32> +// CHECK: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK: bitcast <4 x i32> [[T3]] to <4 x float> +// CHECK-LE: [[T1:%.+]] = bitcast <4 x float> {{.+}} to <4 x i32> +// CHECK-LE: [[T2:%.+]] = bitcast <4 x float> {{.+}} to <4 x i32> +// CHECK-LE: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK-LE: bitcast <4 x i32> [[T3]] to <4 x float> +// CHECK-PPC: error: assigning to + + res_vf = vec_eqv(vbi, vfa); +// CHECK: [[T2:%.+]] = bitcast <4 x float> {{.+}} to <4 x i32> +// CHECK: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> {{.+}}, <4 x i32> [[T2]]) +// CHECK: bitcast <4 x i32> [[T3]] to <4 x float> +// CHECK-LE: [[T2:%.+]] = bitcast <4 x float> {{.+}} to <4 x i32> +// CHECK-LE: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> {{.+}}, <4 x i32> [[T2]]) +// CHECK-PPC: error: assigning to + + res_vf = vec_eqv(vfa, vbi); +// CHECK: [[T1:%.+]] = bitcast <4 x float> {{.+}} to <4 x i32> +// CHECK: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> +// CHECK: bitcast <4 x i32> [[T3]] to <4 x float> +// CHECK-LE: [[T1:%.+]] = bitcast <4 x float> {{.+}} to <4 x i32> +// CHECK-LE: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> +// CHECK-LE: bitcast <4 x i32> [[T3]] to <4 x float> +// CHECK-PPC: error: assigning to + + res_vd = vec_eqv(vda, vda); +// CHECK: [[T1:%.+]] = bitcast <2 x double> {{.+}} to <4 x i32> +// CHECK: [[T2:%.+]] = bitcast <2 x double> {{.+}} to <4 x i32> +// CHECK: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK: bitcast <4 x i32> [[T3]] to <2 x double> +// CHECK-LE: [[T1:%.+]] = bitcast <2 x double> {{.+}} to <4 x i32> +// CHECK-LE: [[T2:%.+]] = bitcast <2 x double> {{.+}} to <4 x i32> +// CHECK-LE: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> [[T2]]) +// CHECK-LE: bitcast <4 x i32> [[T3]] to <2 x double> +// CHECK-PPC: error: assigning to + + res_vd = vec_eqv(vbll, vda); +// CHECK: [[T2:%.+]] = bitcast <2 x double> {{.+}} to <4 x i32> +// CHECK: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> {{.+}}, <4 x i32> [[T2]]) +// CHECK: bitcast <4 x i32> [[T3]] to <2 x double> +// CHECK-LE: [[T2:%.+]] = bitcast <2 x double> {{.+}} to <4 x i32> +// CHECK-LE: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> {{.+}}, <4 x i32> [[T2]]) +// CHECK-LE: bitcast <4 x i32> [[T3]] to <2 x double> +// CHECK-PPC: error: assigning to + + res_vd = vec_eqv(vda, vbll); +// CHECK: [[T1:%.+]] = bitcast <2 x double> {{.+}} to <4 x i32> +// CHECK: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> +// CHECK: bitcast <4 x i32> [[T3]] to <2 x double> +// CHECK-LE: [[T1:%.+]] = bitcast <2 x double> {{.+}} to <4 x i32> +// CHECK-LE: [[T3:%.+]] = call <4 x i32> @llvm.ppc.vsx.xxleqv(<4 x i32> [[T1]], <4 x i32> +// CHECK-LE: bitcast <4 x i32> [[T3]] to <2 x double> +// CHECK-PPC: error: assigning to + + res_vsc = vec_cntlz(vsc); +// CHECK: call <16 x i8> @llvm.ctlz.v16i8(<16 x i8> %{{.+}}, i1 false) +// CHECK-LE: call <16 x i8> @llvm.ctlz.v16i8(<16 x i8> %{{.+}}, i1 false) +// CHECK-PPC: warning: implicit declaration of function 'vec_cntlz' is invalid in C99 + + res_vuc = vec_cntlz(vuc); +// CHECK: call <16 x i8> @llvm.ctlz.v16i8(<16 x i8> %{{.+}}, i1 false) +// CHECK-LE: call <16 x i8> @llvm.ctlz.v16i8(<16 x i8> %{{.+}}, i1 false) + + res_vss = vec_cntlz(vss); +// CHECK: call <8 x i16> @llvm.ctlz.v8i16(<8 x i16> %{{.+}}, i1 false) +// CHECK-LE: call <8 x i16> @llvm.ctlz.v8i16(<8 x i16> %{{.+}}, i1 false) + + res_vus = vec_cntlz(vus); +// CHECK: call <8 x i16> @llvm.ctlz.v8i16(<8 x i16> %{{.+}}, i1 false) +// CHECK-LE: call <8 x i16> @llvm.ctlz.v8i16(<8 x i16> %{{.+}}, i1 false) + + res_vsi = vec_cntlz(vsi); +// CHECK: call <4 x i32> @llvm.ctlz.v4i32(<4 x i32> %{{.+}}, i1 false) +// CHECK-LE: call <4 x i32> @llvm.ctlz.v4i32(<4 x i32> %{{.+}}, i1 false) + + res_vui = vec_cntlz(vui); +// CHECK: call <4 x i32> @llvm.ctlz.v4i32(<4 x i32> %{{.+}}, i1 false) +// CHECK-LE: call <4 x i32> @llvm.ctlz.v4i32(<4 x i32> %{{.+}}, i1 false) + + res_vsll = vec_cntlz(vsll); +// CHECK: call <2 x i64> @llvm.ctlz.v2i64(<2 x i64> %{{.+}}, i1 false) +// CHECK-LE: call <2 x i64> @llvm.ctlz.v2i64(<2 x i64> %{{.+}}, i1 false) + + res_vull = vec_cntlz(vull); +// CHECK: call <2 x i64> @llvm.ctlz.v2i64(<2 x i64> %{{.+}}, i1 false) +// CHECK-LE: call <2 x i64> @llvm.ctlz.v2i64(<2 x i64> %{{.+}}, i1 false) + /* ----------------------- predicates --------------------------- */ /* vec_all_eq */ res_i = vec_all_eq(vsll, vsll); @@ -634,7 +971,7 @@ void test1() { // CHECK-PPC: error: call to 'vec_min' is ambiguous /* vec_mule */ - res_vsll = vec_mule(vi, vi); + res_vsll = vec_mule(vsi, vsi); // CHECK: @llvm.ppc.altivec.vmulesw // CHECK-LE: @llvm.ppc.altivec.vmulosw // CHECK-PPC: error: call to 'vec_mule' is ambiguous @@ -645,7 +982,7 @@ void test1() { // CHECK-PPC: error: call to 'vec_mule' is ambiguous /* vec_mulo */ - res_vsll = vec_mulo(vi, vi); + res_vsll = vec_mulo(vsi, vsi); // CHECK: @llvm.ppc.altivec.vmulosw // CHECK-LE: @llvm.ppc.altivec.vmulesw // CHECK-PPC: error: call to 'vec_mulo' is ambiguous @@ -656,7 +993,7 @@ void test1() { // CHECK-PPC: error: call to 'vec_mulo' is ambiguous /* vec_packs */ - res_vi = vec_packs(vsll, vsll); + res_vsi = vec_packs(vsll, vsll); // CHECK: @llvm.ppc.altivec.vpksdss // CHECK-LE: @llvm.ppc.altivec.vpksdss // CHECK-PPC: error: call to 'vec_packs' is ambiguous @@ -701,8 +1038,8 @@ void test1() { /* vec_sr */ res_vsll = vec_sr(vsll, vull); -// CHECK: ashr <2 x i64> -// CHECK-LE: ashr <2 x i64> +// CHECK: lshr <2 x i64> +// CHECK-LE: lshr <2 x i64> // CHECK-PPC: error: call to 'vec_sr' is ambiguous res_vull = vec_sr(vull, vull); @@ -722,7 +1059,7 @@ void test1() { // CHECK-PPC: error: call to 'vec_sra' is ambiguous /* vec_unpackh */ - res_vsll = vec_unpackh(vi); + res_vsll = vec_unpackh(vsi); // CHECK: llvm.ppc.altivec.vupkhsw // CHECK-LE: llvm.ppc.altivec.vupklsw // CHECK-PPC: error: call to 'vec_unpackh' is ambiguous @@ -733,7 +1070,7 @@ void test1() { // CHECK-PPC: error: call to 'vec_unpackh' is ambiguous /* vec_unpackl */ - res_vsll = vec_unpackl(vi); + res_vsll = vec_unpackl(vsi); // CHECK: llvm.ppc.altivec.vupklsw // CHECK-LE: llvm.ppc.altivec.vupkhsw // CHECK-PPC: error: call to 'vec_unpackl' is ambiguous @@ -744,7 +1081,7 @@ void test1() { // CHECK-PPC: error: call to 'vec_unpackl' is ambiguous /* vec_vpksdss */ - res_vi = vec_vpksdss(vsll, vsll); + res_vsi = vec_vpksdss(vsll, vsll); // CHECK: llvm.ppc.altivec.vpksdss // CHECK-LE: llvm.ppc.altivec.vpksdss // CHECK-PPC: warning: implicit declaration of function 'vec_vpksdss' @@ -756,7 +1093,7 @@ void test1() { // CHECK-PPC: warning: implicit declaration of function 'vec_vpksdus' /* vec_vpkudum */ - res_vi = vec_vpkudum(vsll, vsll); + res_vsi = vec_vpkudum(vsll, vsll); // CHECK: vperm // CHECK-LE: vperm // CHECK-PPC: warning: implicit declaration of function 'vec_vpkudum' @@ -771,7 +1108,7 @@ void test1() { // CHECK-PPC: warning: implicit declaration of function 'vec_vpkudus' /* vec_vupkhsw */ - res_vsll = vec_vupkhsw(vi); + res_vsll = vec_vupkhsw(vsi); // CHECK: llvm.ppc.altivec.vupkhsw // CHECK-LE: llvm.ppc.altivec.vupklsw // CHECK-PPC: warning: implicit declaration of function 'vec_vupkhsw' @@ -781,7 +1118,7 @@ void test1() { // CHECK-LE: llvm.ppc.altivec.vupklsw /* vec_vupklsw */ - res_vsll = vec_vupklsw(vi); + res_vsll = vec_vupklsw(vsi); // CHECK: llvm.ppc.altivec.vupklsw // CHECK-LE: llvm.ppc.altivec.vupkhsw // CHECK-PPC: warning: implicit declaration of function 'vec_vupklsw' @@ -832,6 +1169,298 @@ void test1() { // CHECK: @llvm.ppc.altivec.vminud // CHECK-LE: @llvm.ppc.altivec.vminud + /* vec_nand */ + res_vsc = vec_nand(vsc, vsc); +// CHECK: [[T1:%.+]] = and <16 x i8> +// CHECK: xor <16 x i8> [[T1]], <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> +// CHECK-LE: [[T1:%.+]] = and <16 x i8> +// CHECK-LE: xor <16 x i8> [[T1]], <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> +// CHECK-PPC: warning: implicit declaration of function 'vec_nand' is invalid in C99 + + res_vsc = vec_nand(vsc, vbc); +// CHECK: [[T1:%.+]] = and <16 x i8> +// CHECK: xor <16 x i8> [[T1]], <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> +// CHECK-LE: [[T1:%.+]] = and <16 x i8> +// CHECK-LE: xor <16 x i8> [[T1]], <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> + + res_vsc = vec_nand(vbc, vsc); +// CHECK: [[T1:%.+]] = and <16 x i8> +// CHECK: xor <16 x i8> [[T1]], <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> +// CHECK-LE: [[T1:%.+]] = and <16 x i8> +// CHECK-LE: xor <16 x i8> [[T1]], <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> + + res_vuc = vec_nand(vuc, vuc); +// CHECK: [[T1:%.+]] = and <16 x i8> +// CHECK: xor <16 x i8> [[T1]], <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> +// CHECK-LE: [[T1:%.+]] = and <16 x i8> +// CHECK-LE: xor <16 x i8> [[T1]], <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> + + res_vuc = vec_nand(vuc, vbc); +// CHECK: [[T1:%.+]] = and <16 x i8> +// CHECK: xor <16 x i8> [[T1]], <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> +// CHECK-LE: [[T1:%.+]] = and <16 x i8> +// CHECK-LE: xor <16 x i8> [[T1]], <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> + + res_vuc = vec_nand(vbc, vuc); +// CHECK: [[T1:%.+]] = and <16 x i8> +// CHECK: xor <16 x i8> [[T1]], <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> +// CHECK-LE: [[T1:%.+]] = and <16 x i8> +// CHECK-LE: xor <16 x i8> [[T1]], <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> + + res_vss = vec_nand(vss, vss); +// CHECK: [[T1:%.+]] = and <8 x i16> +// CHECK: xor <8 x i16> [[T1]], <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> +// CHECK-LE: [[T1:%.+]] = and <8 x i16> +// CHECK-LE: xor <8 x i16> [[T1]], <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> + + res_vss = vec_nand(vss, vbs); +// CHECK: [[T1:%.+]] = and <8 x i16> +// CHECK: xor <8 x i16> [[T1]], <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> +// CHECK-LE: [[T1:%.+]] = and <8 x i16> +// CHECK-LE: xor <8 x i16> [[T1]], <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> + + res_vss = vec_nand(vbs, vss); +// CHECK: [[T1:%.+]] = and <8 x i16> +// CHECK: xor <8 x i16> [[T1]], <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> +// CHECK-LE: [[T1:%.+]] = and <8 x i16> +// CHECK-LE: xor <8 x i16> [[T1]], <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> + + res_vus = vec_nand(vus, vus); +// CHECK: [[T1:%.+]] = and <8 x i16> +// CHECK: xor <8 x i16> [[T1]], <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> +// CHECK-LE: [[T1:%.+]] = and <8 x i16> +// CHECK-LE: xor <8 x i16> [[T1]], <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> + + res_vus = vec_nand(vus, vbs); +// CHECK: [[T1:%.+]] = and <8 x i16> +// CHECK: xor <8 x i16> [[T1]], <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> +// CHECK-LE: [[T1:%.+]] = and <8 x i16> +// CHECK-LE: xor <8 x i16> [[T1]], <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> + + res_vus = vec_nand(vbs, vus); +// CHECK: [[T1:%.+]] = and <8 x i16> +// CHECK: xor <8 x i16> [[T1]], <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> +// CHECK-LE: [[T1:%.+]] = and <8 x i16> +// CHECK-LE: xor <8 x i16> [[T1]], <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> + + res_vsi = vec_nand(vsi, vsi); +// CHECK: [[T1:%.+]] = and <4 x i32> +// CHECK: xor <4 x i32> [[T1]], <i32 -1, i32 -1, i32 -1, i32 -1> +// CHECK-LE: [[T1:%.+]] = and <4 x i32> +// CHECK-LE: xor <4 x i32> [[T1]], <i32 -1, i32 -1, i32 -1, i32 -1> + + res_vsi = vec_nand(vsi, vbi); +// CHECK: [[T1:%.+]] = and <4 x i32> +// CHECK: xor <4 x i32> [[T1]], <i32 -1, i32 -1, i32 -1, i32 -1> +// CHECK-LE: [[T1:%.+]] = and <4 x i32> +// CHECK-LE: xor <4 x i32> [[T1]], <i32 -1, i32 -1, i32 -1, i32 -1> + + res_vsi = vec_nand(vbi, vsi); +// CHECK: [[T1:%.+]] = and <4 x i32> +// CHECK: xor <4 x i32> [[T1]], <i32 -1, i32 -1, i32 -1, i32 -1> +// CHECK-LE: [[T1:%.+]] = and <4 x i32> +// CHECK-LE: xor <4 x i32> [[T1]], <i32 -1, i32 -1, i32 -1, i32 -1> + + res_vui = vec_nand(vui, vui); +// CHECK: [[T1:%.+]] = and <4 x i32> +// CHECK: xor <4 x i32> [[T1]], <i32 -1, i32 -1, i32 -1, i32 -1> +// CHECK-LE: [[T1:%.+]] = and <4 x i32> +// CHECK-LE: xor <4 x i32> [[T1]], <i32 -1, i32 -1, i32 -1, i32 -1> + + res_vui = vec_nand(vui, vbi); +// CHECK: [[T1:%.+]] = and <4 x i32> +// CHECK: xor <4 x i32> [[T1]], <i32 -1, i32 -1, i32 -1, i32 -1> +// CHECK-LE: [[T1:%.+]] = and <4 x i32> +// CHECK-LE: xor <4 x i32> [[T1]], <i32 -1, i32 -1, i32 -1, i32 -1> + + res_vui = vec_nand(vbi, vui); +// CHECK: [[T1:%.+]] = and <4 x i32> +// CHECK: xor <4 x i32> [[T1]], <i32 -1, i32 -1, i32 -1, i32 -1> +// CHECK-LE: [[T1:%.+]] = and <4 x i32> +// CHECK-LE: xor <4 x i32> [[T1]], <i32 -1, i32 -1, i32 -1, i32 -1> + + res_vsll = vec_nand(vsll, vsll); +// CHECK: [[T1:%.+]] = and <2 x i64> +// CHECK: xor <2 x i64> [[T1]], <i64 -1, i64 -1> +// CHECK-LE: [[T1:%.+]] = and <2 x i64> +// CHECK-LE: xor <2 x i64> [[T1]], <i64 -1, i64 -1> + + res_vsll = vec_nand(vsll, vbll); +// CHECK: [[T1:%.+]] = and <2 x i64> +// CHECK: xor <2 x i64> [[T1]], <i64 -1, i64 -1> +// CHECK-LE: [[T1:%.+]] = and <2 x i64> +// CHECK-LE: xor <2 x i64> [[T1]], <i64 -1, i64 -1> + + res_vsll = vec_nand(vbll, vsll); +// CHECK: [[T1:%.+]] = and <2 x i64> +// CHECK: xor <2 x i64> [[T1]], <i64 -1, i64 -1> +// CHECK-LE: [[T1:%.+]] = and <2 x i64> +// CHECK-LE: xor <2 x i64> [[T1]], <i64 -1, i64 -1> + + res_vull = vec_nand(vull, vull); +// CHECK: [[T1:%.+]] = and <2 x i64> +// CHECK: xor <2 x i64> [[T1]], <i64 -1, i64 -1> +// CHECK-LE: [[T1:%.+]] = and <2 x i64> +// CHECK-LE: xor <2 x i64> [[T1]], <i64 -1, i64 -1> + + res_vull = vec_nand(vull, vbll); +// CHECK: [[T1:%.+]] = and <2 x i64> +// CHECK: xor <2 x i64> [[T1]], <i64 -1, i64 -1> +// CHECK-LE: [[T1:%.+]] = and <2 x i64> +// CHECK-LE: xor <2 x i64> [[T1]], <i64 -1, i64 -1> + + res_vull = vec_nand(vbll, vull); +// CHECK: [[T1:%.+]] = and <2 x i64> +// CHECK: xor <2 x i64> [[T1]], <i64 -1, i64 -1> +// CHECK-LE: [[T1:%.+]] = and <2 x i64> +// CHECK-LE: xor <2 x i64> [[T1]], <i64 -1, i64 -1> + + /* vec_orc */ + res_vsc = vec_orc(vsc, vsc); +// CHECK: [[T1:%.+]] = xor <16 x i8> {{%.+}}, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> +// CHECK: or <16 x i8> {{%.+}}, [[T1]] +// CHECK-LE: [[T1:%.+]] = xor <16 x i8> {{%.+}}, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> +// CHECK-LE: or <16 x i8> {{%.+}}, [[T1]] +// CHECK-PPC: warning: implicit declaration of function 'vec_orc' is invalid in C99 + + res_vsc = vec_orc(vsc, vbc); +// CHECK: [[T1:%.+]] = xor <16 x i8> {{%.+}}, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> +// CHECK: or <16 x i8> {{%.+}}, [[T1]] +// CHECK-LE: [[T1:%.+]] = xor <16 x i8> {{%.+}}, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> +// CHECK-LE: or <16 x i8> {{%.+}}, [[T1]] + + res_vsc = vec_orc(vbc, vsc); +// CHECK: [[T1:%.+]] = xor <16 x i8> {{%.+}}, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> +// CHECK: or <16 x i8> {{%.+}}, [[T1]] +// CHECK-LE: [[T1:%.+]] = xor <16 x i8> {{%.+}}, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> +// CHECK-LE: or <16 x i8> {{%.+}}, [[T1]] + + res_vuc = vec_orc(vuc, vuc); +// CHECK: [[T1:%.+]] = xor <16 x i8> {{%.+}}, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> +// CHECK: or <16 x i8> {{%.+}}, [[T1]] +// CHECK-LE: [[T1:%.+]] = xor <16 x i8> {{%.+}}, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> +// CHECK-LE: or <16 x i8> {{%.+}}, [[T1]] + + res_vuc = vec_orc(vuc, vbc); +// CHECK: [[T1:%.+]] = xor <16 x i8> {{%.+}}, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> +// CHECK: or <16 x i8> {{%.+}}, [[T1]] +// CHECK-LE: [[T1:%.+]] = xor <16 x i8> {{%.+}}, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> +// CHECK-LE: or <16 x i8> {{%.+}}, [[T1]] + + res_vuc = vec_orc(vbc, vuc); +// CHECK: [[T1:%.+]] = xor <16 x i8> {{%.+}}, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> +// CHECK: or <16 x i8> {{%.+}}, [[T1]] +// CHECK-LE: [[T1:%.+]] = xor <16 x i8> {{%.+}}, <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1> +// CHECK-LE: or <16 x i8> {{%.+}}, [[T1]] + + res_vss = vec_orc(vss, vss); +// CHECK: [[T1:%.+]] = xor <8 x i16> {{%.+}}, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> +// CHECK: or <8 x i16> {{%.+}}, [[T1]] +// CHECK-LE: [[T1:%.+]] = xor <8 x i16> {{%.+}}, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> +// CHECK-LE: or <8 x i16> {{%.+}}, [[T1]] + + res_vss = vec_orc(vss, vbs); +// CHECK: [[T1:%.+]] = xor <8 x i16> {{%.+}}, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> +// CHECK: or <8 x i16> {{%.+}}, [[T1]] +// CHECK-LE: [[T1:%.+]] = xor <8 x i16> {{%.+}}, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> +// CHECK-LE: or <8 x i16> {{%.+}}, [[T1]] + + res_vss = vec_orc(vbs, vss); +// CHECK: [[T1:%.+]] = xor <8 x i16> {{%.+}}, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> +// CHECK: or <8 x i16> {{%.+}}, [[T1]] +// CHECK-LE: [[T1:%.+]] = xor <8 x i16> {{%.+}}, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> +// CHECK-LE: or <8 x i16> {{%.+}}, [[T1]] + + res_vus = vec_orc(vus, vus); +// CHECK: [[T1:%.+]] = xor <8 x i16> {{%.+}}, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> +// CHECK: or <8 x i16> {{%.+}}, [[T1]] +// CHECK-LE: [[T1:%.+]] = xor <8 x i16> {{%.+}}, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> +// CHECK-LE: or <8 x i16> {{%.+}}, [[T1]] + + res_vus = vec_orc(vus, vbs); +// CHECK: [[T1:%.+]] = xor <8 x i16> {{%.+}}, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> +// CHECK: or <8 x i16> {{%.+}}, [[T1]] +// CHECK-LE: [[T1:%.+]] = xor <8 x i16> {{%.+}}, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> +// CHECK-LE: or <8 x i16> {{%.+}}, [[T1]] + + res_vus = vec_orc(vbs, vus); +// CHECK: [[T1:%.+]] = xor <8 x i16> {{%.+}}, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> +// CHECK: or <8 x i16> {{%.+}}, [[T1]] +// CHECK-LE: [[T1:%.+]] = xor <8 x i16> {{%.+}}, <i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1> +// CHECK-LE: or <8 x i16> {{%.+}}, [[T1]] + + res_vsi = vec_orc(vsi, vsi); +// CHECK: [[T1:%.+]] = xor <4 x i32> {{%.+}}, <i32 -1, i32 -1, i32 -1, i32 -1> +// CHECK: or <4 x i32> {{%.+}}, [[T1]] +// CHECK-LE: [[T1:%.+]] = xor <4 x i32> {{%.+}}, <i32 -1, i32 -1, i32 -1, i32 -1> +// CHECK-LE: or <4 x i32> {{%.+}}, [[T1]] + + res_vsi = vec_orc(vsi, vbi); +// CHECK: [[T1:%.+]] = xor <4 x i32> {{%.+}}, <i32 -1, i32 -1, i32 -1, i32 -1> +// CHECK: or <4 x i32> {{%.+}}, [[T1]] +// CHECK-LE: [[T1:%.+]] = xor <4 x i32> {{%.+}}, <i32 -1, i32 -1, i32 -1, i32 -1> +// CHECK-LE: or <4 x i32> {{%.+}}, [[T1]] + + res_vsi = vec_orc(vbi, vsi); +// CHECK: [[T1:%.+]] = xor <4 x i32> {{%.+}}, <i32 -1, i32 -1, i32 -1, i32 -1> +// CHECK: or <4 x i32> {{%.+}}, [[T1]] +// CHECK-LE: [[T1:%.+]] = xor <4 x i32> {{%.+}}, <i32 -1, i32 -1, i32 -1, i32 -1> +// CHECK-LE: or <4 x i32> {{%.+}}, [[T1]] + + res_vui = vec_orc(vui, vui); +// CHECK: [[T1:%.+]] = xor <4 x i32> {{%.+}}, <i32 -1, i32 -1, i32 -1, i32 -1> +// CHECK: or <4 x i32> {{%.+}}, [[T1]] +// CHECK-LE: [[T1:%.+]] = xor <4 x i32> {{%.+}}, <i32 -1, i32 -1, i32 -1, i32 -1> +// CHECK-LE: or <4 x i32> {{%.+}}, [[T1]] + + res_vui = vec_orc(vui, vbi); +// CHECK: [[T1:%.+]] = xor <4 x i32> {{%.+}}, <i32 -1, i32 -1, i32 -1, i32 -1> +// CHECK: or <4 x i32> {{%.+}}, [[T1]] +// CHECK-LE: [[T1:%.+]] = xor <4 x i32> {{%.+}}, <i32 -1, i32 -1, i32 -1, i32 -1> +// CHECK-LE: or <4 x i32> {{%.+}}, [[T1]] + + res_vui = vec_orc(vbi, vui); +// CHECK: [[T1:%.+]] = xor <4 x i32> {{%.+}}, <i32 -1, i32 -1, i32 -1, i32 -1> +// CHECK: or <4 x i32> {{%.+}}, [[T1]] +// CHECK-LE: [[T1:%.+]] = xor <4 x i32> {{%.+}}, <i32 -1, i32 -1, i32 -1, i32 -1> +// CHECK-LE: or <4 x i32> {{%.+}}, [[T1]] + + res_vsll = vec_orc(vsll, vsll); +// CHECK: [[T1:%.+]] = xor <2 x i64> {{%.+}}, <i64 -1, i64 -1> +// CHECK: or <2 x i64> {{%.+}}, [[T1]] +// CHECK-LE: [[T1:%.+]] = xor <2 x i64> {{%.+}}, <i64 -1, i64 -1> +// CHECK-LE: or <2 x i64> {{%.+}}, [[T1]] + + res_vsll = vec_orc(vsll, vbll); +// CHECK: [[T1:%.+]] = xor <2 x i64> {{%.+}}, <i64 -1, i64 -1> +// CHECK: or <2 x i64> {{%.+}}, [[T1]] +// CHECK-LE: [[T1:%.+]] = xor <2 x i64> {{%.+}}, <i64 -1, i64 -1> +// CHECK-LE: or <2 x i64> {{%.+}}, [[T1]] + + res_vsll = vec_orc(vbll, vsll); +// CHECK: [[T1:%.+]] = xor <2 x i64> {{%.+}}, <i64 -1, i64 -1> +// CHECK: or <2 x i64> {{%.+}}, [[T1]] +// CHECK-LE: [[T1:%.+]] = xor <2 x i64> {{%.+}}, <i64 -1, i64 -1> +// CHECK-LE: or <2 x i64> {{%.+}}, [[T1]] + + res_vull = vec_orc(vull, vull); +// CHECK: [[T1:%.+]] = xor <2 x i64> {{%.+}}, <i64 -1, i64 -1> +// CHECK: or <2 x i64> {{%.+}}, [[T1]] +// CHECK-LE: [[T1:%.+]] = xor <2 x i64> {{%.+}}, <i64 -1, i64 -1> +// CHECK-LE: or <2 x i64> {{%.+}}, [[T1]] + + res_vull = vec_orc(vull, vbll); +// CHECK: [[T1:%.+]] = xor <2 x i64> {{%.+}}, <i64 -1, i64 -1> +// CHECK: or <2 x i64> {{%.+}}, [[T1]] +// CHECK-LE: [[T1:%.+]] = xor <2 x i64> {{%.+}}, <i64 -1, i64 -1> +// CHECK-LE: or <2 x i64> {{%.+}}, [[T1]] + + res_vull = vec_orc(vbll, vull); +// CHECK: [[T1:%.+]] = xor <2 x i64> {{%.+}}, <i64 -1, i64 -1> +// CHECK: or <2 x i64> {{%.+}}, [[T1]] +// CHECK-LE: [[T1:%.+]] = xor <2 x i64> {{%.+}}, <i64 -1, i64 -1> +// CHECK-LE: or <2 x i64> {{%.+}}, [[T1]] + /* vec_vbpermq */ res_vsll = vec_vbpermq(vsc, vsc); // CHECK: llvm.ppc.altivec.vbpermq diff --git a/test/CodeGen/builtins-ppc-vsx.c b/test/CodeGen/builtins-ppc-vsx.c index 99362133dd9a..9a40d3041db1 100644 --- a/test/CodeGen/builtins-ppc-vsx.c +++ b/test/CodeGen/builtins-ppc-vsx.c @@ -1,6 +1,6 @@ // REQUIRES: powerpc-registered-target // RUN: %clang_cc1 -faltivec -target-feature +vsx -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s -// RUN: %clang_cc1 -faltivec -target-feature +vsx -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -faltivec -target-feature +vsx -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-LE vector unsigned char vuc = { 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7}; @@ -27,39 +27,57 @@ void dummy() { } void test1() { // CHECK-LABEL: define void @test1 +// CHECK-LE-LABEL: define void @test1 res_vd = vec_add(vd, vd); // CHECK: fadd <2 x double> +// CHECK-LE: fadd <2 x double> res_vd = vec_and(vbll, vd); // CHECK: and <2 x i64> // CHECK: bitcast <2 x i64> %{{[0-9]*}} to <2 x double> +// CHECK-LE: and <2 x i64> +// CHECK-LE: bitcast <2 x i64> %{{[0-9]*}} to <2 x double> res_vd = vec_and(vd, vbll); // CHECK: and <2 x i64> // CHECK: bitcast <2 x i64> %{{[0-9]*}} to <2 x double> +// CHECK-LE: and <2 x i64> +// CHECK-LE: bitcast <2 x i64> %{{[0-9]*}} to <2 x double> res_vd = vec_and(vd, vd); // CHECK: and <2 x i64> // CHECK: bitcast <2 x i64> %{{[0-9]*}} to <2 x double> +// CHECK-LE: and <2 x i64> +// CHECK-LE: bitcast <2 x i64> %{{[0-9]*}} to <2 x double> dummy(); // CHECK: call void @dummy() +// CHECK-LE: call void @dummy() res_vd = vec_andc(vbll, vd); // CHECK: bitcast <2 x double> %{{[0-9]*}} to <2 x i64> // CHECK: xor <2 x i64> %{{[0-9]*}}, <i64 -1, i64 -1> // CHECK: and <2 x i64> // CHECK: bitcast <2 x i64> %{{[0-9]*}} to <2 x double> +// CHECK-LE: bitcast <2 x double> %{{[0-9]*}} to <2 x i64> +// CHECK-LE: xor <2 x i64> %{{[0-9]*}}, <i64 -1, i64 -1> +// CHECK-LE: and <2 x i64> +// CHECK-LE: bitcast <2 x i64> %{{[0-9]*}} to <2 x double> dummy(); // CHECK: call void @dummy() +// CHECK-LE: call void @dummy() res_vd = vec_andc(vd, vbll); // CHECK: bitcast <2 x double> %{{[0-9]*}} to <2 x i64> // CHECK: xor <2 x i64> %{{[0-9]*}}, <i64 -1, i64 -1> // CHECK: and <2 x i64> // CHECK: bitcast <2 x i64> %{{[0-9]*}} to <2 x double> +// CHECK-LE: bitcast <2 x double> %{{[0-9]*}} to <2 x i64> +// CHECK-LE: xor <2 x i64> %{{[0-9]*}}, <i64 -1, i64 -1> +// CHECK-LE: and <2 x i64> +// CHECK-LE: bitcast <2 x i64> %{{[0-9]*}} to <2 x double> dummy(); // CHECK: call void @dummy() @@ -72,307 +90,759 @@ void test1() { dummy(); // CHECK: call void @dummy() +// CHECK-LE: call void @dummy() res_vd = vec_ceil(vd); // CHECK: call <2 x double> @llvm.ceil.v2f64(<2 x double> %{{[0-9]*}}) +// CHECK-LE: call <2 x double> @llvm.ceil.v2f64(<2 x double> %{{[0-9]*}}) res_vf = vec_ceil(vf); // CHECK: call <4 x float> @llvm.ceil.v4f32(<4 x float> %{{[0-9]*}}) +// CHECK-LE: call <4 x float> @llvm.ceil.v4f32(<4 x float> %{{[0-9]*}}) res_vbll = vec_cmpeq(vd, vd); // CHECK: call <2 x i64> @llvm.ppc.vsx.xvcmpeqdp(<2 x double> %{{[0-9]*}}, <2 x double> %{{[0-9]*}}) +// CHECK-LE: call <2 x i64> @llvm.ppc.vsx.xvcmpeqdp(<2 x double> %{{[0-9]*}}, <2 x double> %{{[0-9]*}}) res_vbi = vec_cmpeq(vf, vf); // CHECK: call <4 x i32> @llvm.ppc.vsx.xvcmpeqsp(<4 x float> %{{[0-9]*}}, <4 x float> %{{[0-9]*}}) +// CHECK-LE: call <4 x i32> @llvm.ppc.vsx.xvcmpeqsp(<4 x float> %{{[0-9]*}}, <4 x float> %{{[0-9]*}}) res_vbll = vec_cmpge(vd, vd); // CHECK: call <2 x i64> @llvm.ppc.vsx.xvcmpgedp(<2 x double> %{{[0-9]*}}, <2 x double> %{{[0-9]*}}) +// CHECK-LE: call <2 x i64> @llvm.ppc.vsx.xvcmpgedp(<2 x double> %{{[0-9]*}}, <2 x double> %{{[0-9]*}}) res_vbi = vec_cmpge(vf, vf); // CHECK: call <4 x i32> @llvm.ppc.vsx.xvcmpgesp(<4 x float> %{{[0-9]*}}, <4 x float> %{{[0-9]*}}) +// CHECK-LE: call <4 x i32> @llvm.ppc.vsx.xvcmpgesp(<4 x float> %{{[0-9]*}}, <4 x float> %{{[0-9]*}}) res_vbll = vec_cmpgt(vd, vd); // CHECK: call <2 x i64> @llvm.ppc.vsx.xvcmpgtdp(<2 x double> %{{[0-9]*}}, <2 x double> %{{[0-9]*}}) +// CHECK-LE: call <2 x i64> @llvm.ppc.vsx.xvcmpgtdp(<2 x double> %{{[0-9]*}}, <2 x double> %{{[0-9]*}}) res_vbi = vec_cmpgt(vf, vf); // CHECK: call <4 x i32> @llvm.ppc.vsx.xvcmpgtsp(<4 x float> %{{[0-9]*}}, <4 x float> %{{[0-9]*}}) +// CHECK-LE: call <4 x i32> @llvm.ppc.vsx.xvcmpgtsp(<4 x float> %{{[0-9]*}}, <4 x float> %{{[0-9]*}}) res_vbll = vec_cmple(vd, vd); // CHECK: call <2 x i64> @llvm.ppc.vsx.xvcmpgedp(<2 x double> %{{[0-9]*}}, <2 x double> %{{[0-9]*}}) +// CHECK-LE: call <2 x i64> @llvm.ppc.vsx.xvcmpgedp(<2 x double> %{{[0-9]*}}, <2 x double> %{{[0-9]*}}) res_vbi = vec_cmple(vf, vf); // CHECK: call <4 x i32> @llvm.ppc.vsx.xvcmpgesp(<4 x float> %{{[0-9]*}}, <4 x float> %{{[0-9]*}}) +// CHECK-LE: call <4 x i32> @llvm.ppc.vsx.xvcmpgesp(<4 x float> %{{[0-9]*}}, <4 x float> %{{[0-9]*}}) res_vbll = vec_cmplt(vd, vd); // CHECK: call <2 x i64> @llvm.ppc.vsx.xvcmpgtdp(<2 x double> %{{[0-9]*}}, <2 x double> %{{[0-9]*}}) +// CHECK-LE: call <2 x i64> @llvm.ppc.vsx.xvcmpgtdp(<2 x double> %{{[0-9]*}}, <2 x double> %{{[0-9]*}}) res_vbi = vec_cmplt(vf, vf); // CHECK: call <4 x i32> @llvm.ppc.vsx.xvcmpgtsp(<4 x float> %{{[0-9]*}}, <4 x float> %{{[0-9]*}}) +// CHECK-LE: call <4 x i32> @llvm.ppc.vsx.xvcmpgtsp(<4 x float> %{{[0-9]*}}, <4 x float> %{{[0-9]*}}) + + /* vec_cpsgn */ + res_vf = vec_cpsgn(vf, vf); +// CHECK: call <4 x float> @llvm.copysign.v4f32(<4 x float> %{{.+}}, <4 x float> %{{.+}}) +// CHECK-LE: call <4 x float> @llvm.copysign.v4f32(<4 x float> %{{.+}}, <4 x float> %{{.+}}) + + res_vd = vec_cpsgn(vd, vd); +// CHECK: call <2 x double> @llvm.copysign.v2f64(<2 x double> %{{.+}}, <2 x double> %{{.+}}) +// CHECK-LE: call <2 x double> @llvm.copysign.v2f64(<2 x double> %{{.+}}, <2 x double> %{{.+}}) /* vec_div */ + res_vsll = vec_div(vsll, vsll); +// CHECK: sdiv <2 x i64> +// CHECK-LE: sdiv <2 x i64> + + res_vull = vec_div(vull, vull); +// CHECK: udiv <2 x i64> +// CHECK-LE: udiv <2 x i64> + res_vf = vec_div(vf, vf); -// CHECK: @llvm.ppc.vsx.xvdivsp +// CHECK: fdiv <4 x float> +// CHECK-LE: fdiv <4 x float> res_vd = vec_div(vd, vd); -// CHECK: @llvm.ppc.vsx.xvdivdp +// CHECK: fdiv <2 x double> +// CHECK-LE: fdiv <2 x double> /* vec_max */ res_vf = vec_max(vf, vf); // CHECK: @llvm.ppc.vsx.xvmaxsp +// CHECK-LE: @llvm.ppc.vsx.xvmaxsp res_vd = vec_max(vd, vd); // CHECK: @llvm.ppc.vsx.xvmaxdp +// CHECK-LE: @llvm.ppc.vsx.xvmaxdp res_vf = vec_vmaxfp(vf, vf); // CHECK: @llvm.ppc.vsx.xvmaxsp +// CHECK-LE: @llvm.ppc.vsx.xvmaxsp /* vec_min */ res_vf = vec_min(vf, vf); // CHECK: @llvm.ppc.vsx.xvminsp +// CHECK-LE: @llvm.ppc.vsx.xvminsp res_vd = vec_min(vd, vd); // CHECK: @llvm.ppc.vsx.xvmindp +// CHECK-LE: @llvm.ppc.vsx.xvmindp res_vf = vec_vminfp(vf, vf); // CHECK: @llvm.ppc.vsx.xvminsp +// CHECK-LE: @llvm.ppc.vsx.xvminsp res_d = __builtin_vsx_xsmaxdp(d, d); // CHECK: @llvm.ppc.vsx.xsmaxdp +// CHECK-LE: @llvm.ppc.vsx.xsmaxdp res_d = __builtin_vsx_xsmindp(d, d); // CHECK: @llvm.ppc.vsx.xsmindp +// CHECK-LE: @llvm.ppc.vsx.xsmindp /* vec_perm */ res_vsll = vec_perm(vsll, vsll, vuc); // CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm res_vull = vec_perm(vull, vull, vuc); // CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm + + res_vbll = vec_perm(vbll, vbll, vuc); +// CHECK: [[T1:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK: [[T2:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK: call <4 x i32> @llvm.ppc.altivec.vperm(<4 x i32> [[T1]], <4 x i32> [[T2]], <16 x i8> +// CHECK-LE: xor <16 x i8> +// CHECK-LE: [[T1:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK-LE: [[T2:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK-LE: call <4 x i32> @llvm.ppc.altivec.vperm(<4 x i32> [[T1]], <4 x i32> [[T2]], <16 x i8> + + res_vf = vec_round(vf); +// CHECK: call <4 x float> @llvm.round.v4f32(<4 x float> +// CHECK-LE: call <4 x float> @llvm.round.v4f32(<4 x float> + + res_vd = vec_round(vd); +// CHECK: call <2 x double> @llvm.round.v2f64(<2 x double> +// CHECK-LE: call <2 x double> @llvm.round.v2f64(<2 x double> res_vd = vec_perm(vd, vd, vuc); // CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm + + res_vd = vec_splat(vd, 1); +// CHECK: [[T1:%.+]] = bitcast <2 x double> {{.+}} to <4 x i32> +// CHECK: [[T2:%.+]] = bitcast <2 x double> {{.+}} to <4 x i32> +// CHECK: call <4 x i32> @llvm.ppc.altivec.vperm(<4 x i32> [[T1]], <4 x i32> [[T2]], <16 x i8> +// CHECK-LE: xor <16 x i8> +// CHECK-LE: [[T1:%.+]] = bitcast <2 x double> {{.+}} to <4 x i32> +// CHECK-LE: [[T2:%.+]] = bitcast <2 x double> {{.+}} to <4 x i32> +// CHECK-LE: call <4 x i32> @llvm.ppc.altivec.vperm(<4 x i32> [[T1]], <4 x i32> [[T2]], <16 x i8> + + res_vbll = vec_splat(vbll, 1); +// CHECK: [[T1:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK: [[T2:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK: call <4 x i32> @llvm.ppc.altivec.vperm(<4 x i32> [[T1]], <4 x i32> [[T2]], <16 x i8> +// CHECK-LE: xor <16 x i8> +// CHECK-LE: [[T1:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK-LE: [[T2:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK-LE: call <4 x i32> @llvm.ppc.altivec.vperm(<4 x i32> [[T1]], <4 x i32> [[T2]], <16 x i8> + + res_vsll = vec_splat(vsll, 1); +// CHECK: [[T1:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK: [[T2:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK: call <4 x i32> @llvm.ppc.altivec.vperm(<4 x i32> [[T1]], <4 x i32> [[T2]], <16 x i8> +// CHECK-LE: xor <16 x i8> +// CHECK-LE: [[T1:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK-LE: [[T2:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK-LE: call <4 x i32> @llvm.ppc.altivec.vperm(<4 x i32> [[T1]], <4 x i32> [[T2]], <16 x i8> + + res_vull = vec_splat(vull, 1); +// CHECK: [[T1:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK: [[T2:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK: call <4 x i32> @llvm.ppc.altivec.vperm(<4 x i32> [[T1]], <4 x i32> [[T2]], <16 x i8> +// CHECK-LE: xor <16 x i8> +// CHECK-LE: [[T1:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK-LE: [[T2:%.+]] = bitcast <2 x i64> {{.+}} to <4 x i32> +// CHECK-LE: call <4 x i32> @llvm.ppc.altivec.vperm(<4 x i32> [[T1]], <4 x i32> [[T2]], <16 x i8> + + res_vsi = vec_pack(vsll, vsll); +// CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm + + res_vui = vec_pack(vull, vull); +// CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm + + res_vbi = vec_pack(vbll, vbll); +// CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm res_vsll = vec_vperm(vsll, vsll, vuc); // CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm res_vull = vec_vperm(vull, vull, vuc); // CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm res_vd = vec_vperm(vd, vd, vuc); // CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm /* vec_vsx_ld */ res_vsi = vec_vsx_ld(0, &vsi); // CHECK: @llvm.ppc.vsx.lxvw4x +// CHECK-LE: @llvm.ppc.vsx.lxvw4x res_vui = vec_vsx_ld(0, &vui); // CHECK: @llvm.ppc.vsx.lxvw4x +// CHECK-LE: @llvm.ppc.vsx.lxvw4x res_vf = vec_vsx_ld (0, &vf); // CHECK: @llvm.ppc.vsx.lxvw4x +// CHECK-LE: @llvm.ppc.vsx.lxvw4x res_vsll = vec_vsx_ld(0, &vsll); // CHECK: @llvm.ppc.vsx.lxvd2x +// CHECK-LE: @llvm.ppc.vsx.lxvd2x res_vull = vec_vsx_ld(0, &vull); // CHECK: @llvm.ppc.vsx.lxvd2x +// CHECK-LE: @llvm.ppc.vsx.lxvd2x res_vd = vec_vsx_ld(0, &vd); // CHECK: @llvm.ppc.vsx.lxvd2x +// CHECK-LE: @llvm.ppc.vsx.lxvd2x /* vec_vsx_st */ vec_vsx_st(vsi, 0, &res_vsi); // CHECK: @llvm.ppc.vsx.stxvw4x +// CHECK-LE: @llvm.ppc.vsx.stxvw4x vec_vsx_st(vui, 0, &res_vui); // CHECK: @llvm.ppc.vsx.stxvw4x +// CHECK-LE: @llvm.ppc.vsx.stxvw4x vec_vsx_st(vf, 0, &res_vf); // CHECK: @llvm.ppc.vsx.stxvw4x +// CHECK-LE: @llvm.ppc.vsx.stxvw4x vec_vsx_st(vsll, 0, &res_vsll); // CHECK: @llvm.ppc.vsx.stxvd2x +// CHECK-LE: @llvm.ppc.vsx.stxvd2x vec_vsx_st(vull, 0, &res_vull); // CHECK: @llvm.ppc.vsx.stxvd2x +// CHECK-LE: @llvm.ppc.vsx.stxvd2x vec_vsx_st(vd, 0, &res_vd); // CHECK: @llvm.ppc.vsx.stxvd2x +// CHECK-LE: @llvm.ppc.vsx.stxvd2x /* vec_and */ res_vsll = vec_and(vsll, vsll); // CHECK: and <2 x i64> +// CHECK-LE: and <2 x i64> res_vsll = vec_and(vbll, vsll); // CHECK: and <2 x i64> +// CHECK-LE: and <2 x i64> res_vsll = vec_and(vsll, vbll); // CHECK: and <2 x i64> +// CHECK-LE: and <2 x i64> res_vull = vec_and(vull, vull); // CHECK: and <2 x i64> +// CHECK-LE: and <2 x i64> res_vull = vec_and(vbll, vull); // CHECK: and <2 x i64> +// CHECK-LE: and <2 x i64> res_vull = vec_and(vull, vbll); // CHECK: and <2 x i64> +// CHECK-LE: and <2 x i64> res_vbll = vec_and(vbll, vbll); // CHECK: and <2 x i64> +// CHECK-LE: and <2 x i64> /* vec_vand */ res_vsll = vec_vand(vsll, vsll); // CHECK: and <2 x i64> +// CHECK-LE: and <2 x i64> res_vsll = vec_vand(vbll, vsll); // CHECK: and <2 x i64> +// CHECK-LE: and <2 x i64> res_vsll = vec_vand(vsll, vbll); // CHECK: and <2 x i64> +// CHECK-LE: and <2 x i64> res_vull = vec_vand(vull, vull); // CHECK: and <2 x i64> +// CHECK-LE: and <2 x i64> res_vull = vec_vand(vbll, vull); // CHECK: and <2 x i64> +// CHECK-LE: and <2 x i64> res_vull = vec_vand(vull, vbll); // CHECK: and <2 x i64> +// CHECK-LE: and <2 x i64> res_vbll = vec_vand(vbll, vbll); // CHECK: and <2 x i64> +// CHECK-LE: and <2 x i64> /* vec_andc */ res_vsll = vec_andc(vsll, vsll); // CHECK: xor <2 x i64> // CHECK: and <2 x i64> +// CHECK-LE: xor <2 x i64> +// CHECK-LE: and <2 x i64> res_vsll = vec_andc(vbll, vsll); // CHECK: xor <2 x i64> // CHECK: and <2 x i64> +// CHECK-LE: xor <2 x i64> +// CHECK-LE: and <2 x i64> res_vsll = vec_andc(vsll, vbll); // CHECK: xor <2 x i64> // CHECK: and <2 x i64> +// CHECK-LE: xor <2 x i64> +// CHECK-LE: and <2 x i64> res_vull = vec_andc(vull, vull); // CHECK: xor <2 x i64> // CHECK: and <2 x i64> +// CHECK-LE: xor <2 x i64> +// CHECK-LE: and <2 x i64> res_vull = vec_andc(vbll, vull); // CHECK: xor <2 x i64> // CHECK: and <2 x i64> +// CHECK-LE: xor <2 x i64> +// CHECK-LE: and <2 x i64> res_vull = vec_andc(vull, vbll); // CHECK: xor <2 x i64> // CHECK: and <2 x i64> +// CHECK-LE: xor <2 x i64> +// CHECK-LE: and <2 x i64> res_vbll = vec_andc(vbll, vbll); // CHECK: xor <2 x i64> // CHECK: and <2 x i64> +// CHECK-LE: xor <2 x i64> +// CHECK-LE: and <2 x i64> + + res_vf = vec_floor(vf); +// CHECK: call <4 x float> @llvm.floor.v4f32(<4 x float> %{{[0-9]+}}) +// CHECK-LE: call <4 x float> @llvm.floor.v4f32(<4 x float> %{{[0-9]+}}) + + res_vd = vec_floor(vd); +// CHECK: call <2 x double> @llvm.floor.v2f64(<2 x double> %{{[0-9]+}}) +// CHECK-LE: call <2 x double> @llvm.floor.v2f64(<2 x double> %{{[0-9]+}}) + + res_vf = vec_madd(vf, vf, vf); +// CHECK: call <4 x float> @llvm.fma.v4f32(<4 x float> %{{[0-9]+}}, <4 x float> %{{[0-9]+}}, <4 x float> %{{[0-9]+}}) +// CHECK-LE: call <4 x float> @llvm.fma.v4f32(<4 x float> %{{[0-9]+}}, <4 x float> %{{[0-9]+}}, <4 x float> %{{[0-9]+}}) + + res_vd = vec_madd(vd, vd, vd); +// CHECK: call <2 x double> @llvm.fma.v2f64(<2 x double> %{{[0-9]+}}, <2 x double> %{{[0-9]+}}, <2 x double> %{{[0-9]+}}) +// CHECK-LE: call <2 x double> @llvm.fma.v2f64(<2 x double> %{{[0-9]+}}, <2 x double> %{{[0-9]+}}, <2 x double> %{{[0-9]+}}) + + /* vec_mergeh */ + res_vsll = vec_mergeh(vsll, vsll); +// CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm + + res_vsll = vec_mergeh(vsll, vbll); +// CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm + + res_vsll = vec_mergeh(vbll, vsll); +// CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm + + res_vull = vec_mergeh(vull, vull); +// CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm + + res_vull = vec_mergeh(vull, vbll); +// CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm + + res_vull = vec_mergeh(vbll, vull); +// CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm + + /* vec_mergel */ + res_vsll = vec_mergel(vsll, vsll); +// CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm + + res_vsll = vec_mergel(vsll, vbll); +// CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm + + res_vsll = vec_mergel(vbll, vsll); +// CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm + + res_vull = vec_mergel(vull, vull); +// CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm + + res_vull = vec_mergel(vull, vbll); +// CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm + + res_vull = vec_mergel(vbll, vull); +// CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm + + /* vec_msub */ + res_vf = vec_msub(vf, vf, vf); +// CHECK: fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %{{[0-9]+}} +// CHECK-NEXT: call <4 x float> @llvm.fma.v4f32(<4 x float> %{{[0-9]+}}, <4 x float> %{{[0-9]+}}, <4 x float> +// CHECK-LE: fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %{{[0-9]+}} +// CHECK-LE-NEXT: call <4 x float> @llvm.fma.v4f32(<4 x float> %{{[0-9]+}}, <4 x float> %{{[0-9]+}}, <4 x float> + + res_vd = vec_msub(vd, vd, vd); +// CHECK: fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, %{{[0-9]+}} +// CHECK-NEXT: call <2 x double> @llvm.fma.v2f64(<2 x double> %{{[0-9]+}}, <2 x double> %{{[0-9]+}}, <2 x double> +// CHECK-LE: fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, %{{[0-9]+}} +// CHECK-LE-NEXT: call <2 x double> @llvm.fma.v2f64(<2 x double> %{{[0-9]+}}, <2 x double> %{{[0-9]+}}, <2 x double> + + res_vsll = vec_mul(vsll, vsll); +// CHECK: mul <2 x i64> +// CHECK-LE: mul <2 x i64> + + res_vull = vec_mul(vull, vull); +// CHECK: mul <2 x i64> +// CHECK-LE: mul <2 x i64> + + res_vf = vec_mul(vf, vf); +// CHECK: fmul <4 x float> %{{[0-9]+}}, %{{[0-9]+}} +// CHECK-LE: fmul <4 x float> %{{[0-9]+}}, %{{[0-9]+}} + + res_vd = vec_mul(vd, vd); +// CHECK: fmul <2 x double> %{{[0-9]+}}, %{{[0-9]+}} +// CHECK-LE: fmul <2 x double> %{{[0-9]+}}, %{{[0-9]+}} + + res_vf = vec_nearbyint(vf); +// CHECK: call <4 x float> @llvm.round.v4f32(<4 x float> %{{[0-9]+}}) +// CHECK-LE: call <4 x float> @llvm.round.v4f32(<4 x float> %{{[0-9]+}}) + + res_vd = vec_nearbyint(vd); +// CHECK: call <2 x double> @llvm.round.v2f64(<2 x double> %{{[0-9]+}}) +// CHECK-LE: call <2 x double> @llvm.round.v2f64(<2 x double> %{{[0-9]+}}) + + res_vf = vec_nmadd(vf, vf, vf); +// CHECK: [[FM:[0-9]+]] = call <4 x float> @llvm.fma.v4f32(<4 x float> %{{[0-9]+}}, <4 x float> %{{[0-9]+}}, <4 x float> %{{[0-9]+}}) +// CHECK-NEXT: fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %[[FM]] +// CHECK-LE: [[FM:[0-9]+]] = call <4 x float> @llvm.fma.v4f32(<4 x float> %{{[0-9]+}}, <4 x float> %{{[0-9]+}}, <4 x float> %{{[0-9]+}}) +// CHECK-LE-NEXT: fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %[[FM]] + + res_vd = vec_nmadd(vd, vd, vd); +// CHECK: [[FM:[0-9]+]] = call <2 x double> @llvm.fma.v2f64(<2 x double> %{{[0-9]+}}, <2 x double> %{{[0-9]+}}, <2 x double> %{{[0-9]+}}) +// CHECK-NEXT: fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, %[[FM]] +// CHECK-LE: [[FM:[0-9]+]] = call <2 x double> @llvm.fma.v2f64(<2 x double> %{{[0-9]+}}, <2 x double> %{{[0-9]+}}, <2 x double> %{{[0-9]+}}) +// CHECK-LE-NEXT: fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, %[[FM]] + + res_vf = vec_nmsub(vf, vf, vf); +// CHECK: fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %{{[0-9]+}} +// CHECK-NEXT: call <4 x float> @llvm.fma.v4f32(<4 x float> %{{[0-9]+}}, <4 x float> %{{[0-9]+}}, <4 x float> +// CHECK: fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %{{[0-9]+}} +// CHECK-LE: fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %{{[0-9]+}} +// CHECK-LE-NEXT: call <4 x float> @llvm.fma.v4f32(<4 x float> %{{[0-9]+}}, <4 x float> %{{[0-9]+}}, <4 x float> +// CHECK-LE: fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %{{[0-9]+}} + + res_vd = vec_nmsub(vd, vd, vd); +// CHECK: fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, %{{[0-9]+}} +// CHECK-NEXT: [[FM:[0-9]+]] = call <2 x double> @llvm.fma.v2f64(<2 x double> %{{[0-9]+}}, <2 x double> %{{[0-9]+}}, <2 x double> +// CHECK-NEXT: fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, %[[FM]] +// CHECK-LE: fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, %{{[0-9]+}} +// CHECK-LE-NEXT: [[FM:[0-9]+]] = call <2 x double> @llvm.fma.v2f64(<2 x double> %{{[0-9]+}}, <2 x double> %{{[0-9]+}}, <2 x double> +// CHECK-LE-NEXT: fsub <2 x double> <double -0.000000e+00, double -0.000000e+00>, %[[FM]] /* vec_nor */ res_vsll = vec_nor(vsll, vsll); // CHECK: or <2 x i64> // CHECK: xor <2 x i64> +// CHECK-LE: or <2 x i64> +// CHECK-LE: xor <2 x i64> res_vull = vec_nor(vull, vull); // CHECK: or <2 x i64> // CHECK: xor <2 x i64> +// CHECK-LE: or <2 x i64> +// CHECK-LE: xor <2 x i64> res_vull = vec_nor(vbll, vbll); // CHECK: or <2 x i64> // CHECK: xor <2 x i64> +// CHECK-LE: or <2 x i64> +// CHECK-LE: xor <2 x i64> + + res_vd = vec_nor(vd, vd); +// CHECK: bitcast <2 x double> %{{[0-9]+}} to <2 x i64> +// CHECK: [[OR:%.+]] = or <2 x i64> %{{[0-9]+}}, %{{[0-9]+}} +// CHECK-NEXT: xor <2 x i64> [[OR]], <i64 -1, i64 -1> +// CHECK-LE: bitcast <2 x double> %{{[0-9]+}} to <2 x i64> +// CHECK-LE: [[OR:%.+]] = or <2 x i64> %{{[0-9]+}}, %{{[0-9]+}} +// CHECK-LE-NEXT: xor <2 x i64> [[OR]], <i64 -1, i64 -1> /* vec_or */ res_vsll = vec_or(vsll, vsll); // CHECK: or <2 x i64> +// CHECK-LE: or <2 x i64> res_vsll = vec_or(vbll, vsll); // CHECK: or <2 x i64> +// CHECK-LE: or <2 x i64> res_vsll = vec_or(vsll, vbll); // CHECK: or <2 x i64> +// CHECK-LE: or <2 x i64> res_vull = vec_or(vull, vull); // CHECK: or <2 x i64> +// CHECK-LE: or <2 x i64> res_vull = vec_or(vbll, vull); // CHECK: or <2 x i64> +// CHECK-LE: or <2 x i64> res_vull = vec_or(vull, vbll); // CHECK: or <2 x i64> +// CHECK-LE: or <2 x i64> res_vbll = vec_or(vbll, vbll); // CHECK: or <2 x i64> +// CHECK-LE: or <2 x i64> + + res_vd = vec_or(vd, vd); +// CHECK: bitcast <2 x double> %{{[0-9]+}} to <2 x i64> +// CHECK: or <2 x i64> %{{[0-9]+}}, %{{[0-9]+}} +// CHECK-LE: bitcast <2 x double> %{{[0-9]+}} to <2 x i64> +// CHECK-LE: or <2 x i64> %{{[0-9]+}}, %{{[0-9]+}} + + res_vd = vec_or(vbll, vd); +// CHECK: [[T1:%.+]] = bitcast <2 x double> %{{[0-9]+}} to <2 x i64> +// CHECK: [[T2:%.+]] = or <2 x i64> %{{[0-9]+}}, [[T1]] +// CHECK: bitcast <2 x i64> [[T2]] to <2 x double> +// CHECK-LE: [[T1:%.+]] = bitcast <2 x double> %{{[0-9]+}} to <2 x i64> +// CHECK-LE: [[T2:%.+]] = or <2 x i64> %{{[0-9]+}}, [[T1]] +// CHECK-LE: bitcast <2 x i64> [[T2]] to <2 x double> + + res_vd = vec_or(vd, vbll); +// CHECK: [[T1:%.+]] = bitcast <2 x double> %{{[0-9]+}} to <2 x i64> +// CHECK: [[T2:%.+]] = or <2 x i64> [[T1]], %{{[0-9]+}} +// CHECK: bitcast <2 x i64> [[T2]] to <2 x double> +// CHECK-LE: [[T1:%.+]] = bitcast <2 x double> %{{[0-9]+}} to <2 x i64> +// CHECK-LE: [[T2:%.+]] = or <2 x i64> [[T1]], %{{[0-9]+}} +// CHECK-LE: bitcast <2 x i64> [[T2]] to <2 x double> + + res_vf = vec_re(vf); +// CHECK: call <4 x float> @llvm.ppc.vsx.xvresp(<4 x float> +// CHECK-LE: call <4 x float> @llvm.ppc.vsx.xvresp(<4 x float> + + res_vd = vec_re(vd); +// CHECK: call <2 x double> @llvm.ppc.vsx.xvredp(<2 x double> +// CHECK-LE: call <2 x double> @llvm.ppc.vsx.xvredp(<2 x double> + + res_vf = vec_rint(vf); +// CHECK: call <4 x float> @llvm.nearbyint.v4f32(<4 x float> %{{[0-9]+}}) +// CHECK-LE: call <4 x float> @llvm.nearbyint.v4f32(<4 x float> %{{[0-9]+}}) + + res_vd = vec_rint(vd); +// CHECK: call <2 x double> @llvm.nearbyint.v2f64(<2 x double> %{{[0-9]+}}) +// CHECK-LE: call <2 x double> @llvm.nearbyint.v2f64(<2 x double> %{{[0-9]+}}) + + res_vf = vec_rsqrte(vf); +// CHECK: call <4 x float> @llvm.ppc.vsx.xvrsqrtesp(<4 x float> %{{[0-9]+}}) +// CHECK-LE: call <4 x float> @llvm.ppc.vsx.xvrsqrtesp(<4 x float> %{{[0-9]+}}) + + res_vd = vec_rsqrte(vd); +// CHECK: call <2 x double> @llvm.ppc.vsx.xvrsqrtedp(<2 x double> %{{[0-9]+}}) +// CHECK-LE: call <2 x double> @llvm.ppc.vsx.xvrsqrtedp(<2 x double> %{{[0-9]+}}) + + dummy(); +// CHECK: call void @dummy() +// CHECK-LE: call void @dummy() + + res_vf = vec_sel(vd, vd, vbll); +// CHECK: xor <2 x i64> %{{[0-9]+}}, <i64 -1, i64 -1> +// CHECK: and <2 x i64> %{{[0-9]+}}, +// CHECK: and <2 x i64> %{{[0-9]+}}, %{{[0-9]+}} +// CHECK: or <2 x i64> +// CHECK: bitcast <2 x i64> %{{[0-9]+}} to <2 x double> +// CHECK-LE: xor <2 x i64> %{{[0-9]+}}, <i64 -1, i64 -1> +// CHECK-LE: and <2 x i64> %{{[0-9]+}}, +// CHECK-LE: and <2 x i64> %{{[0-9]+}}, %{{[0-9]+}} +// CHECK-LE: or <2 x i64> +// CHECK-LE: bitcast <2 x i64> %{{[0-9]+}} to <2 x double> + + dummy(); +// CHECK: call void @dummy() +// CHECK-LE: call void @dummy() + + res_vd = vec_sel(vd, vd, vull); +// CHECK: xor <2 x i64> %{{[0-9]+}}, <i64 -1, i64 -1> +// CHECK: and <2 x i64> %{{[0-9]+}}, +// CHECK: and <2 x i64> %{{[0-9]+}}, %{{[0-9]+}} +// CHECK: or <2 x i64> +// CHECK: bitcast <2 x i64> %{{[0-9]+}} to <2 x double> +// CHECK-LE: xor <2 x i64> %{{[0-9]+}}, <i64 -1, i64 -1> +// CHECK-LE: and <2 x i64> %{{[0-9]+}}, +// CHECK-LE: and <2 x i64> %{{[0-9]+}}, %{{[0-9]+}} +// CHECK-LE: or <2 x i64> +// CHECK-LE: bitcast <2 x i64> %{{[0-9]+}} to <2 x double> + + res_vf = vec_sqrt(vf); +// CHECK: call <4 x float> @llvm.sqrt.v4f32(<4 x float> %{{[0-9]+}}) +// CHECK-LE: call <4 x float> @llvm.sqrt.v4f32(<4 x float> %{{[0-9]+}}) + + res_vd = vec_sqrt(vd); +// CHECK: call <2 x double> @llvm.sqrt.v2f64(<2 x double> %{{[0-9]+}}) +// CHECK-LE: call <2 x double> @llvm.sqrt.v2f64(<2 x double> %{{[0-9]+}}) + + res_vd = vec_sub(vd, vd); +// CHECK: fsub <2 x double> %{{[0-9]+}}, %{{[0-9]+}} +// CHECK-LE: fsub <2 x double> %{{[0-9]+}}, %{{[0-9]+}} + + res_vf = vec_trunc(vf); +// CHECK: call <4 x float> @llvm.trunc.v4f32(<4 x float> %{{[0-9]+}}) +// CHECK-LE: call <4 x float> @llvm.trunc.v4f32(<4 x float> %{{[0-9]+}}) + + res_vd = vec_trunc(vd); +// CHECK: call <2 x double> @llvm.trunc.v2f64(<2 x double> %{{[0-9]+}}) +// CHECK-LE: call <2 x double> @llvm.trunc.v2f64(<2 x double> %{{[0-9]+}}) /* vec_vor */ res_vsll = vec_vor(vsll, vsll); // CHECK: or <2 x i64> +// CHECK-LE: or <2 x i64> res_vsll = vec_vor(vbll, vsll); // CHECK: or <2 x i64> +// CHECK-LE: or <2 x i64> res_vsll = vec_vor(vsll, vbll); // CHECK: or <2 x i64> +// CHECK-LE: or <2 x i64> res_vull = vec_vor(vull, vull); // CHECK: or <2 x i64> +// CHECK-LE: or <2 x i64> res_vull = vec_vor(vbll, vull); // CHECK: or <2 x i64> +// CHECK-LE: or <2 x i64> res_vull = vec_vor(vull, vbll); // CHECK: or <2 x i64> +// CHECK-LE: or <2 x i64> res_vbll = vec_vor(vbll, vbll); // CHECK: or <2 x i64> +// CHECK-LE: or <2 x i64> /* vec_xor */ res_vsll = vec_xor(vsll, vsll); // CHECK: xor <2 x i64> +// CHECK-LE: xor <2 x i64> res_vsll = vec_xor(vbll, vsll); // CHECK: xor <2 x i64> +// CHECK-LE: xor <2 x i64> res_vsll = vec_xor(vsll, vbll); // CHECK: xor <2 x i64> +// CHECK-LE: xor <2 x i64> res_vull = vec_xor(vull, vull); // CHECK: xor <2 x i64> +// CHECK-LE: xor <2 x i64> res_vull = vec_xor(vbll, vull); // CHECK: xor <2 x i64> +// CHECK-LE: xor <2 x i64> res_vull = vec_xor(vull, vbll); // CHECK: xor <2 x i64> +// CHECK-LE: xor <2 x i64> res_vbll = vec_xor(vbll, vbll); // CHECK: xor <2 x i64> +// CHECK-LE: xor <2 x i64> + + dummy(); +// CHECK: call void @dummy() +// CHECK-LE: call void @dummy() + + res_vd = vec_xor(vd, vd); +// CHECK: [[X1:%.+]] = xor <2 x i64> %{{[0-9]+}}, %{{[0-9]+}} +// CHECK: bitcast <2 x i64> [[X1]] to <2 x double> +// CHECK-LE: [[X1:%.+]] = xor <2 x i64> %{{[0-9]+}}, %{{[0-9]+}} +// CHECK-LE: bitcast <2 x i64> [[X1]] to <2 x double> + + dummy(); +// CHECK: call void @dummy() +// CHECK-LE: call void @dummy() + + res_vd = vec_xor(vd, vbll); +// CHECK: [[X1:%.+]] = xor <2 x i64> %{{[0-9]+}}, %{{[0-9]+}} +// CHECK: bitcast <2 x i64> [[X1]] to <2 x double> +// CHECK-LE: [[X1:%.+]] = xor <2 x i64> %{{[0-9]+}}, %{{[0-9]+}} +// CHECK-LE: bitcast <2 x i64> [[X1]] to <2 x double> + + dummy(); +// CHECK: call void @dummy() +// CHECK-LE: call void @dummy() + + res_vd = vec_xor(vbll, vd); +// CHECK: [[X1:%.+]] = xor <2 x i64> %{{[0-9]+}}, %{{[0-9]+}} +// CHECK: bitcast <2 x i64> [[X1]] to <2 x double> +// CHECK-LE: [[X1:%.+]] = xor <2 x i64> %{{[0-9]+}}, %{{[0-9]+}} +// CHECK-LE: bitcast <2 x i64> [[X1]] to <2 x double> /* vec_vxor */ res_vsll = vec_vxor(vsll, vsll); // CHECK: xor <2 x i64> +// CHECK-LE: xor <2 x i64> res_vsll = vec_vxor(vbll, vsll); // CHECK: xor <2 x i64> +// CHECK-LE: xor <2 x i64> res_vsll = vec_vxor(vsll, vbll); // CHECK: xor <2 x i64> +// CHECK-LE: xor <2 x i64> res_vull = vec_vxor(vull, vull); // CHECK: xor <2 x i64> +// CHECK-LE: xor <2 x i64> res_vull = vec_vxor(vbll, vull); // CHECK: xor <2 x i64> +// CHECK-LE: xor <2 x i64> res_vull = vec_vxor(vull, vbll); // CHECK: xor <2 x i64> +// CHECK-LE: xor <2 x i64> res_vbll = vec_vxor(vbll, vbll); // CHECK: xor <2 x i64> +// CHECK-LE: xor <2 x i64> } diff --git a/test/CodeGen/debug-info-block.c b/test/CodeGen/debug-info-block.c index c4930bfc3c86..48a9f66877e1 100644 --- a/test/CodeGen/debug-info-block.c +++ b/test/CodeGen/debug-info-block.c @@ -1,10 +1,29 @@ // RUN: %clang_cc1 -fblocks -g -emit-llvm -o - %s | FileCheck %s // Verify that the desired debugging type is generated for a structure -// member that is a pointer to a block. +// member that is a pointer to a block. -// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "__block_literal_generic" +// CHECK: !DICompositeType(tag: DW_TAG_structure_type, scope +// CHECK-NOT: line +// CHECK-SAME: elements: ![[ELEMS1:.*]]) +// CHECK: ![[ELEMS1]] = {{.*, .*, .*,}} ![[FPEL1:.*]], {{.*}} +// CHECK: ![[INT:.*]] = !DIBasicType(name: "int" +// CHECK: ![[FPEL1]] = {{.*}}"__FuncPtr", {{.*}}, baseType: ![[FPTY1:[0-9]+]] +// CHECK: ![[FPTY1]] = {{.*}}baseType: ![[FNTY1:[0-9]+]] +// CHECK: ![[FNTY1]] = !DISubroutineType(types: ![[VOIDVOID:[0-9]+]]) +// CHECK: ![[VOIDVOID]] = !{null, null} // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "__block_descriptor" +// CHECK-NOT: line +// CHECK-SAME: ) + +// CHECK: !DICompositeType(tag: DW_TAG_structure_type, scope +// CHECK-NOT: line +// CHECK-SAME: elements: ![[ELEMS2:.*]]) +// CHECK: ![[ELEMS2]] = {{.*,.*,.*}}, ![[FPEL2:.*]], {{.*}} +// CHECK: ![[FPEL2]] = {{.*}}"__FuncPtr", {{.*}}, baseType: ![[FPTY2:[0-9]+]] +// CHECK: ![[FPTY2]] = {{.*}}baseType: ![[FNTY2:[0-9]+]] +// CHECK: ![[FNTY2]] = !DISubroutineType(types: ![[INTINT:[0-9]+]]) +// CHECK: ![[INTINT]] = !{![[INT]], ![[INT]]} struct inStruct { - void (^genericBlockPtr)(); + void (^voidBlockPtr)(); + int (^intBlockPtr)(int); } is; - diff --git a/test/CodeGen/exceptions-seh-finally.c b/test/CodeGen/exceptions-seh-finally.c index 345d514611e3..772e28306b58 100644 --- a/test/CodeGen/exceptions-seh-finally.c +++ b/test/CodeGen/exceptions-seh-finally.c @@ -1,4 +1,5 @@ // RUN: %clang_cc1 %s -triple x86_64-pc-win32 -fms-extensions -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple i686-pc-win32 -fms-extensions -emit-llvm -o - | FileCheck %s void abort(void) __attribute__((noreturn)); void might_crash(void); @@ -17,18 +18,18 @@ void basic_finally(void) { // CHECK: to label %[[invoke_cont:[^ ]*]] unwind label %[[lpad:[^ ]*]] // // CHECK: [[invoke_cont]] -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) -// CHECK: call void @"\01?fin$0@0@basic_finally@@"(i8 0, i8* %[[fp]]) +// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() +// CHECK: call void @"\01?fin$0@0@basic_finally@@"({{i8( zeroext)?}} 0, i8* %[[fp]]) // CHECK-NEXT: ret void // // CHECK: [[lpad]] // CHECK-NEXT: landingpad // CHECK-NEXT: cleanup -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) -// CHECK: call void @"\01?fin$0@0@basic_finally@@"(i8 1, i8* %[[fp]]) +// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() +// CHECK: call void @"\01?fin$0@0@basic_finally@@"({{i8( zeroext)?}} 1, i8* %[[fp]]) // CHECK: resume { i8*, i32 } -// CHECK: define internal void @"\01?fin$0@0@basic_finally@@"(i8 %abnormal_termination, i8* %frame_pointer) +// CHECK: define internal void @"\01?fin$0@0@basic_finally@@"({{.*}}) // CHECK: call void @cleanup() // Mostly check that we don't double emit 'r' which would crash. @@ -57,11 +58,11 @@ l: // CHECK: to label %[[invoke_cont:[^ ]*]] unwind label %[[lpad:[^ ]*]] // // CHECK: [[invoke_cont]] -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) -// CHECK: call void @"\01?fin$0@0@label_in_finally@@"(i8 0, i8* %[[fp]]) +// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() +// CHECK: call void @"\01?fin$0@0@label_in_finally@@"({{i8( zeroext)?}} 0, i8* %[[fp]]) // CHECK: ret void -// CHECK: define internal void @"\01?fin$0@0@label_in_finally@@"(i8 %abnormal_termination, i8* %frame_pointer) +// CHECK: define internal void @"\01?fin$0@0@label_in_finally@@"({{.*}}) // CHECK: br label %[[l:[^ ]*]] // // CHECK: [[l]] @@ -84,19 +85,19 @@ void use_abnormal_termination(void) { // CHECK: to label %[[invoke_cont:[^ ]*]] unwind label %[[lpad:[^ ]*]] // // CHECK: [[invoke_cont]] -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) -// CHECK: call void @"\01?fin$0@0@use_abnormal_termination@@"(i8 0, i8* %[[fp]]) +// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() +// CHECK: call void @"\01?fin$0@0@use_abnormal_termination@@"({{i8( zeroext)?}} 0, i8* %[[fp]]) // CHECK: ret void // // CHECK: [[lpad]] // CHECK-NEXT: landingpad // CHECK-NEXT: cleanup -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) -// CHECK: call void @"\01?fin$0@0@use_abnormal_termination@@"(i8 1, i8* %[[fp]]) +// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() +// CHECK: call void @"\01?fin$0@0@use_abnormal_termination@@"({{i8( zeroext)?}} 1, i8* %[[fp]]) // CHECK: resume { i8*, i32 } -// CHECK: define internal void @"\01?fin$0@0@use_abnormal_termination@@"(i8 %abnormal_termination, i8* %frame_pointer) -// CHECK: %[[abnormal_zext:[^ ]*]] = zext i8 %abnormal_termination to i32 +// CHECK: define internal void @"\01?fin$0@0@use_abnormal_termination@@"({{i8( zeroext)?}} %[[abnormal:abnormal_termination]], i8* %frame_pointer) +// CHECK: %[[abnormal_zext:[^ ]*]] = zext i8 %[[abnormal]] to i32 // CHECK: store i32 %[[abnormal_zext]], i32* @crashed // CHECK-NEXT: ret void @@ -109,11 +110,10 @@ void noreturn_noop_finally() { } // CHECK-LABEL: define void @noreturn_noop_finally() -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) -// CHECK: call void @"\01?fin$0@0@noreturn_noop_finally@@"(i8 0, i8* %[[fp]]) +// CHECK: call void @"\01?fin$0@0@noreturn_noop_finally@@"({{.*}}) // CHECK: ret void -// CHECK: define internal void @"\01?fin$0@0@noreturn_noop_finally@@"(i8 %abnormal_termination, i8* %frame_pointer) +// CHECK: define internal void @"\01?fin$0@0@noreturn_noop_finally@@"({{.*}}) // CHECK: call void @abort() // CHECK: unreachable @@ -130,18 +130,16 @@ void noreturn_finally() { // CHECK: to label %[[cont:[^ ]*]] unwind label %[[lpad:[^ ]*]] // // CHECK: [[cont]] -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) -// CHECK: call void @"\01?fin$0@0@noreturn_finally@@"(i8 0, i8* %[[fp]]) +// CHECK: call void @"\01?fin$0@0@noreturn_finally@@"({{.*}}) // CHECK: ret void // // CHECK: [[lpad]] // CHECK: landingpad // CHECK-NEXT: cleanup -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) -// CHECK: call void @"\01?fin$0@0@noreturn_finally@@"(i8 1, i8* %[[fp]]) +// CHECK: call void @"\01?fin$0@0@noreturn_finally@@"({{.*}}) // CHECK: resume { i8*, i32 } -// CHECK: define internal void @"\01?fin$0@0@noreturn_finally@@"(i8 %abnormal_termination, i8* %frame_pointer) +// CHECK: define internal void @"\01?fin$0@0@noreturn_finally@@"({{.*}}) // CHECK: call void @abort() // CHECK: unreachable @@ -152,11 +150,10 @@ int finally_with_return() { } } // CHECK-LABEL: define i32 @finally_with_return() -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) -// CHECK-NEXT: call void @"\01?fin$0@0@finally_with_return@@"(i8 0, i8* %[[fp]]) +// CHECK: call void @"\01?fin$0@0@finally_with_return@@"({{.*}}) // CHECK-NEXT: ret i32 42 -// CHECK: define internal void @"\01?fin$0@0@finally_with_return@@"(i8 %abnormal_termination, i8* %frame_pointer) +// CHECK: define internal void @"\01?fin$0@0@finally_with_return@@"({{.*}}) // CHECK-NOT: br i1 // CHECK-NOT: br label // CHECK: ret void @@ -174,25 +171,22 @@ int nested___finally___finally() { } // CHECK-LABEL: define i32 @nested___finally___finally -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) -// CHECK: invoke void @"\01?fin$1@0@nested___finally___finally@@"(i8 0, i8* %[[fp]]) +// CHECK: invoke void @"\01?fin$1@0@nested___finally___finally@@"({{.*}}) // CHECK: to label %[[outercont:[^ ]*]] unwind label %[[lpad:[^ ]*]] // // CHECK: [[outercont]] -// CHECK-NEXT: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) -// CHECK-NEXT: call void @"\01?fin$0@0@nested___finally___finally@@"(i8 0, i8* %[[fp]]) +// CHECK: call void @"\01?fin$0@0@nested___finally___finally@@"({{.*}}) // CHECK-NEXT: ret i32 0 // // CHECK: [[lpad]] // CHECK-NEXT: landingpad // CHECK-NEXT: cleanup -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) -// CHECK-NEXT: call void @"\01?fin$0@0@nested___finally___finally@@"(i8 1, i8* %[[fp]]) +// CHECK: call void @"\01?fin$0@0@nested___finally___finally@@"({{.*}}) -// CHECK-LABEL: define internal void @"\01?fin$0@0@nested___finally___finally@@"(i8 %abnormal_termination, i8* %frame_pointer) +// CHECK-LABEL: define internal void @"\01?fin$0@0@nested___finally___finally@@"({{.*}}) // CHECK: ret void -// CHECK-LABEL: define internal void @"\01?fin$1@0@nested___finally___finally@@"(i8 %abnormal_termination, i8* %frame_pointer) +// CHECK-LABEL: define internal void @"\01?fin$1@0@nested___finally___finally@@"({{.*}}) // CHECK: unreachable int nested___finally___finally_with_eh_edge() { @@ -212,31 +206,27 @@ int nested___finally___finally_with_eh_edge() { // CHECK-NEXT: to label %[[invokecont:[^ ]*]] unwind label %[[lpad1:[^ ]*]] // // [[invokecont]] -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) -// CHECK: invoke void @"\01?fin$1@0@nested___finally___finally_with_eh_edge@@"(i8 0, i8* %[[fp]]) +// CHECK: invoke void @"\01?fin$1@0@nested___finally___finally_with_eh_edge@@"({{.*}}) // CHECK: to label %[[outercont:[^ ]*]] unwind label %[[lpad2:[^ ]*]] // // CHECK: [[outercont]] -// CHECK-NEXT: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) -// CHECK-NEXT: call void @"\01?fin$0@0@nested___finally___finally_with_eh_edge@@"(i8 0, i8* %[[fp]]) +// CHECK: call void @"\01?fin$0@0@nested___finally___finally_with_eh_edge@@"({{.*}}) // CHECK-NEXT: ret i32 912 // // CHECK: [[lpad1]] // CHECK-NEXT: landingpad // CHECK-NEXT: cleanup -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) -// CHECK: invoke void @"\01?fin$1@0@nested___finally___finally_with_eh_edge@@"(i8 1, i8* %[[fp]]) +// CHECK: invoke void @"\01?fin$1@0@nested___finally___finally_with_eh_edge@@"({{.*}}) // CHECK: to label %[[outercont:[^ ]*]] unwind label %[[lpad2]] // // CHECK: [[lpad2]] // CHECK-NEXT: landingpad // CHECK-NEXT: cleanup -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) -// CHECK: call void @"\01?fin$0@0@nested___finally___finally_with_eh_edge@@"(i8 1, i8* %[[fp]]) +// CHECK: call void @"\01?fin$0@0@nested___finally___finally_with_eh_edge@@"({{.*}}) // CHECK: resume -// CHECK-LABEL: define internal void @"\01?fin$0@0@nested___finally___finally_with_eh_edge@@"(i8 %abnormal_termination, i8* %frame_pointer) +// CHECK-LABEL: define internal void @"\01?fin$0@0@nested___finally___finally_with_eh_edge@@"({{.*}}) // CHECK: ret void -// CHECK-LABEL: define internal void @"\01?fin$1@0@nested___finally___finally_with_eh_edge@@"(i8 %abnormal_termination, i8* %frame_pointer) +// CHECK-LABEL: define internal void @"\01?fin$1@0@nested___finally___finally_with_eh_edge@@"({{.*}}) // CHECK: unreachable diff --git a/test/CodeGen/exceptions-seh-leave.c b/test/CodeGen/exceptions-seh-leave.c index 36b896d06240..e56da17d0a80 100644 --- a/test/CodeGen/exceptions-seh-leave.c +++ b/test/CodeGen/exceptions-seh-leave.c @@ -74,7 +74,7 @@ int __leave_with___finally_simple() { // CHECK-NEXT: br label %[[tryleave:[^ ]*]] // CHECK-NOT: store i32 23 // CHECK: [[tryleave]] -// CHECK-NEXT: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) +// CHECK-NEXT: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() // CHECK-NEXT: call void @"\01?fin$0@0@__leave_with___finally_simple@@"(i8 0, i8* %[[fp]]) // __finally block doesn't return, __finally.cont doesn't exist. @@ -94,7 +94,7 @@ int __leave_with___finally_noreturn() { // CHECK-NEXT: br label %[[tryleave:[^ ]*]] // CHECK-NOT: store i32 23 // CHECK: [[tryleave]] -// CHECK-NEXT: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) +// CHECK-NEXT: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() // CHECK-NEXT: call void @"\01?fin$0@0@__leave_with___finally_noreturn@@"(i8 0, i8* %[[fp]]) // The "normal" case. @@ -118,7 +118,7 @@ int __leave_with___finally() { // CHECK-NEXT: br label %[[tryleave:[^ ]*]] // CHECK-NOT: store i32 23 // CHECK: [[tryleave]] -// CHECK-NEXT: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) +// CHECK-NEXT: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() // CHECK-NEXT: call void @"\01?fin$0@0@__leave_with___finally@@"(i8 0, i8* %[[fp]]) @@ -148,7 +148,7 @@ int nested___except___finally() { // CHECK-NEXT: to label %[[g1_cont1:.*]] unwind label %[[g1_lpad:.*]] // CHECK: [[g1_cont1]] -// CHECK-NEXT: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) +// CHECK-NEXT: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() // CHECK-NEXT: invoke void @"\01?fin$0@0@nested___except___finally@@"(i8 0, i8* %[[fp]]) // CHECK-NEXT: to label %[[fin_cont:.*]] unwind label %[[g2_lpad:.*]] @@ -159,7 +159,7 @@ int nested___except___finally() { // CHECK: [[g1_lpad]] // CHECK-NEXT: landingpad // CHECK-NEXT: catch i8* null -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) +// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() // CHECK-NEXT: invoke void @"\01?fin$0@0@nested___except___finally@@"(i8 1, i8* %[[fp]]) // CHECK-NEXT: to label %[[g1_resume:.*]] unwind label %[[g2_lpad]] @@ -205,7 +205,7 @@ int nested___except___except() { // CHECK: br label %[[except:[^ ]*]] // CHECK: [[except]] -// CHECK-NEXT: invoke void @g() +// CHECK: invoke void @g() // CHECK-NEXT: to label %[[g2_cont:.*]] unwind label %[[g2_lpad:.*]] // CHECK: [[g2_cont]] @@ -216,7 +216,7 @@ int nested___except___except() { // CHECK: br label %[[outerexcept:[^ ]*]] // CHECK: [[outerexcept]] -// CHECK-NEXT: br label %[[trycont4:[^ ]*]] +// CHECK: br label %[[trycont4:[^ ]*]] // CHECK: [[trycont4]] // CHECK-NEXT: ret i32 1 @@ -258,15 +258,15 @@ int nested___finally___except() { // CHECK: br label %[[except:[^ ]*]] // CHECK: [[except]] -// CHECK-NEXT: invoke void @g() +// CHECK: invoke void @g() // CHECK-NEXT: to label %[[g2_cont:.*]] unwind label %[[g2_lpad:.*]] // CHECK: [[g2_cont]] -// CHECK-NEXT: br label %[[tryleave:[^ ]*]] +// CHECK: br label %[[tryleave:[^ ]*]] // CHECK-NOT: 23 // CHECK: [[g2_lpad]] -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) +// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() // CHECK-NEXT: call void @"\01?fin$0@0@nested___finally___except@@"(i8 1, i8* %[[fp]]) // CHECK-NEXT: br label %[[ehresume:[^ ]*]] @@ -275,7 +275,7 @@ int nested___finally___except() { // CHECK-NEXT: br label %[[tryleave]] // CHECK: [[tryleave]] -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) +// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() // CHECK-NEXT: call void @"\01?fin$0@0@nested___finally___except@@"(i8 0, i8* %[[fp]]) // CHECK-NEXT: ret i32 1 @@ -311,20 +311,20 @@ int nested___finally___finally() { // CHECK: [[g1_cont]] // CHECK: store i32 16, i32* %[[myres:[^ ]*]], -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) +// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() // CHECK-NEXT: invoke void @"\01?fin$1@0@nested___finally___finally@@"(i8 0, i8* %[[fp]]) // CHECK-NEXT: to label %[[finally_cont:.*]] unwind label %[[g2_lpad:.*]] // CHECK: [[finally_cont]] // CHECK: store i32 51, i32* %[[myres]] -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) +// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() // CHECK-NEXT: call void @"\01?fin$0@0@nested___finally___finally@@"(i8 0, i8* %[[fp]]) // CHECK-NEXT: ret i32 1 // CHECK: [[g1_lpad]] // CHECK-NEXT: landingpad // CHECK-NEXT: cleanup -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) +// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() // CHECK-NEXT: invoke void @"\01?fin$1@0@nested___finally___finally@@"(i8 1, i8* %[[fp]]) // CHECK-NEXT: to label %[[finally_cont2:.*]] unwind label %[[g2_lpad]] @@ -337,7 +337,7 @@ int nested___finally___finally() { // CHECK: br label %[[ehcleanup]] // CHECK: [[ehcleanup]] -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) +// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() // CHECK-NEXT: call void @"\01?fin$0@0@nested___finally___finally@@"(i8 1, i8* %[[fp]]) // CHECK: resume diff --git a/test/CodeGen/exceptions-seh.c b/test/CodeGen/exceptions-seh.c index 1b77ad616278..9707a9a31beb 100644 --- a/test/CodeGen/exceptions-seh.c +++ b/test/CodeGen/exceptions-seh.c @@ -1,4 +1,7 @@ -// RUN: %clang_cc1 %s -triple x86_64-pc-win32 -fms-extensions -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple x86_64-pc-win32 -fms-extensions -emit-llvm -o - \ +// RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=X64 +// RUN: %clang_cc1 %s -triple i686-pc-win32 -fms-extensions -emit-llvm -o - \ +// RUN: | FileCheck %s --check-prefix=CHECK --check-prefix=X86 void try_body(int numerator, int denominator, int *myres) { *myres = numerator / denominator; @@ -19,20 +22,46 @@ int safe_div(int numerator, int denominator, int *res) { *res = myres; return success; } -// CHECK-LABEL: define i32 @safe_div(i32 %numerator, i32 %denominator, i32* %res) {{.*}} personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) -// CHECK: invoke void @try_body(i32 %{{.*}}, i32 %{{.*}}, i32* %{{.*}}) #[[NOINLINE:[0-9]+]] -// CHECK: to label %{{.*}} unwind label %[[lpad:[^ ]*]] -// -// CHECK: [[lpad]] -// CHECK: landingpad { i8*, i32 } -// CHECK-NEXT: catch i8* null -// CHECK-NOT: br i1 -// CHECK: br label %[[except:[^ ]*]] -// CHECK: [[except]] -// CHECK-NEXT: store i32 -42, i32* %[[success:[^ ]*]] -// -// CHECK: %[[res:[^ ]*]] = load i32, i32* %[[success]] -// CHECK: ret i32 %[[res]] + +// X64-LABEL: define i32 @safe_div(i32 %numerator, i32 %denominator, i32* %res) {{.*}} personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) +// X64: invoke void @try_body(i32 %{{.*}}, i32 %{{.*}}, i32* %{{.*}}) #[[NOINLINE:[0-9]+]] +// X64: to label %{{.*}} unwind label %[[lpad:[^ ]*]] +// +// X64: [[lpad]] +// X64: landingpad { i8*, i32 } +// X64-NEXT: catch i8* null +// X64-NOT: br i1 +// X64: br label %[[except:[^ ]*]] +// X64: [[except]] +// X64: store i32 -42, i32* %[[success:[^ ]*]] +// +// X64: %[[res:[^ ]*]] = load i32, i32* %[[success]] +// X64: ret i32 %[[res]] + +// X86-LABEL: define i32 @safe_div(i32 %numerator, i32 %denominator, i32* %res) {{.*}} personality i8* bitcast (i32 (...)* @_except_handler3 to i8*) +// X86: invoke void @try_body(i32 %{{.*}}, i32 %{{.*}}, i32* %{{.*}}) #[[NOINLINE:[0-9]+]] +// X86: to label %{{.*}} unwind label %[[lpad:[^ ]*]] +// +// X86: [[lpad]] +// X86: landingpad { i8*, i32 } +// X86-NEXT: catch i8* bitcast (i32 ()* @"\01?filt$0@0@safe_div@@" to i8*) +// X86-NOT: br i1 +// X86: br label %[[except:[^ ]*]] +// X86: [[except]] +// X86: store i32 -42, i32* %[[success:[^ ]*]] +// +// X86: %[[res:[^ ]*]] = load i32, i32* %[[success]] +// X86: ret i32 %[[res]] + +// X86-LABEL: define internal i32 @"\01?filt$0@0@safe_div@@"() +// X86: %[[ebp:[^ ]*]] = call i8* @llvm.frameaddress(i32 1) +// X86: %[[fp:[^ ]*]] = call i8* @llvm.x86.seh.recoverfp(i8* bitcast (i32 (i32, i32, i32*)* @safe_div to i8*), i8* %[[ebp]]) +// X86: call i8* @llvm.localrecover(i8* bitcast (i32 (i32, i32, i32*)* @safe_div to i8*), i8* %[[fp]], i32 0) +// X86: load i8*, i8** +// X86: load i32*, i32** +// X86: load i32, i32* +// X86: store i32 %{{.*}}, i32* +// X86: ret i32 1 void j(void); @@ -46,20 +75,29 @@ int filter_expr_capture(void) { return r; } -// CHECK-LABEL: define i32 @filter_expr_capture() {{.*}} personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) -// CHECK: call void (...) @llvm.frameescape(i32* %[[r:[^ ,]*]]) +// CHECK-LABEL: define i32 @filter_expr_capture() +// X64-SAME: personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) +// X86-SAME: personality i8* bitcast (i32 (...)* @_except_handler3 to i8*) +// X64: call void (...) @llvm.localescape(i32* %[[r:[^ ,]*]]) +// X86: call void (...) @llvm.localescape(i32* %[[r:[^ ,]*]], i32* %[[code:[^ ,]*]]) // CHECK: store i32 42, i32* %[[r]] // CHECK: invoke void @j() #[[NOINLINE]] // // CHECK: landingpad -// CHECK-NEXT: catch i8* bitcast (i32 (i8*, i8*)* @"\01?filt$0@0@filter_expr_capture@@" to i8*) +// CHECK-NEXT: catch i8* bitcast (i32 ({{.*}})* @"\01?filt$0@0@filter_expr_capture@@" to i8*) // CHECK: store i32 13, i32* %[[r]] // // CHECK: %[[rv:[^ ]*]] = load i32, i32* %[[r]] // CHECK: ret i32 %[[rv]] -// CHECK-LABEL: define internal i32 @"\01?filt$0@0@filter_expr_capture@@"(i8* %exception_pointers, i8* %frame_pointer) -// CHECK: call i8* @llvm.framerecover(i8* bitcast (i32 ()* @filter_expr_capture to i8*), i8* %frame_pointer, i32 0) +// X64-LABEL: define internal i32 @"\01?filt$0@0@filter_expr_capture@@"(i8* %exception_pointers, i8* %frame_pointer) +// X64: call i8* @llvm.localrecover(i8* bitcast (i32 ()* @filter_expr_capture to i8*), i8* %frame_pointer, i32 0) +// +// X86-LABEL: define internal i32 @"\01?filt$0@0@filter_expr_capture@@"() +// X86: %[[ebp:[^ ]*]] = call i8* @llvm.frameaddress(i32 1) +// X86: %[[fp:[^ ]*]] = call i8* @llvm.x86.seh.recoverfp(i8* bitcast (i32 ()* @filter_expr_capture to i8*), i8* %[[ebp]]) +// X86: call i8* @llvm.localrecover(i8* bitcast (i32 ()* @filter_expr_capture to i8*), i8* %[[fp]], i32 0) +// // CHECK: store i32 -1, i32* %{{.*}} // CHECK: ret i32 -1 @@ -77,7 +115,9 @@ int nested_try(void) { } return r; } -// CHECK-LABEL: define i32 @nested_try() {{.*}} personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) +// CHECK-LABEL: define i32 @nested_try() +// X64-SAME: personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) +// X86-SAME: personality i8* bitcast (i32 (...)* @_except_handler3 to i8*) // CHECK: store i32 42, i32* %[[r:[^ ,]*]] // CHECK: invoke void @j() #[[NOINLINE]] // CHECK: to label %[[cont:[^ ]*]] unwind label %[[lpad:[^ ]*]] @@ -88,18 +128,18 @@ int nested_try(void) { // // CHECK: [[lpad]] // CHECK: landingpad { i8*, i32 } -// CHECK: catch i8* bitcast (i32 (i8*, i8*)* @"\01?filt$1@0@nested_try@@" to i8*) -// CHECK: catch i8* bitcast (i32 (i8*, i8*)* @"\01?filt$0@0@nested_try@@" to i8*) +// CHECK: catch i8* bitcast (i32 ({{.*}})* @"\01?filt$1@0@nested_try@@" to i8*) +// CHECK: catch i8* bitcast (i32 ({{.*}})* @"\01?filt$0@0@nested_try@@" to i8*) // CHECK: store i8* %{{.*}}, i8** %[[ehptr_slot:[^ ]*]] // CHECK: store i32 %{{.*}}, i32* %[[sel_slot:[^ ]*]] // // CHECK: load i32, i32* %[[sel_slot]] -// CHECK: call i32 @llvm.eh.typeid.for(i8* bitcast (i32 (i8*, i8*)* @"\01?filt$1@0@nested_try@@" to i8*)) +// CHECK: call i32 @llvm.eh.typeid.for(i8* bitcast (i32 ({{.*}})* @"\01?filt$1@0@nested_try@@" to i8*)) // CHECK: icmp eq i32 // CHECK: br i1 // // CHECK: load i32, i32* %[[sel_slot]] -// CHECK: call i32 @llvm.eh.typeid.for(i8* bitcast (i32 (i8*, i8*)* @"\01?filt$0@0@nested_try@@" to i8*)) +// CHECK: call i32 @llvm.eh.typeid.for(i8* bitcast (i32 ({{.*}})* @"\01?filt$0@0@nested_try@@" to i8*)) // CHECK: icmp eq i32 // CHECK: br i1 // @@ -115,40 +155,55 @@ int nested_try(void) { // // CHECK: [[inner_try_cont]] // CHECK: br label %[[outer_try_cont]] +// +// CHECK-LABEL: define internal i32 @"\01?filt$0@0@nested_try@@"({{.*}}) +// X86: call i8* @llvm.x86.seh.recoverfp({{.*}}) +// CHECK: load i32*, i32** +// CHECK: load i32, i32* +// CHECK: icmp eq i32 %{{.*}}, 456 +// +// CHECK-LABEL: define internal i32 @"\01?filt$1@0@nested_try@@"({{.*}}) +// X86: call i8* @llvm.x86.seh.recoverfp({{.*}}) +// CHECK: load i32*, i32** +// CHECK: load i32, i32* +// CHECK: icmp eq i32 %{{.*}}, 123 -static unsigned g = 0; -void basic_finally(void) { - ++g; +int basic_finally(int g) { __try { j(); } __finally { - --g; + ++g; } + return g; } -// CHECK-LABEL: define void @basic_finally() {{.*}} personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) -// CHECK: load i32, i32* @g -// CHECK: add i32 %{{.*}}, 1 -// CHECK: store i32 %{{.*}}, i32* @g +// CHECK-LABEL: define i32 @basic_finally(i32 %g) +// X64-SAME: personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) +// X86-SAME: personality i8* bitcast (i32 (...)* @_except_handler3 to i8*) +// CHECK: %[[g_addr:[^ ]*]] = alloca i32, align 4 +// CHECK: call void (...) @llvm.localescape(i32* %[[g_addr]]) +// CHECK: store i32 %g, i32* %[[g_addr]] // // CHECK: invoke void @j() // CHECK: to label %[[cont:[^ ]*]] unwind label %[[lpad:[^ ]*]] // // CHECK: [[cont]] -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) -// CHECK: call void @"\01?fin$0@0@basic_finally@@"(i8 0, i8* %[[fp]]) -// CHECK: ret void +// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() +// CHECK: call void @"\01?fin$0@0@basic_finally@@"({{i8( zeroext)?}} 0, i8* %[[fp]]) +// CHECK: load i32, i32* %[[g_addr]], align 4 +// CHECK: ret i32 // // CHECK: [[lpad]] // CHECK: landingpad { i8*, i32 } // CHECK-NEXT: cleanup -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) -// CHECK: call void @"\01?fin$0@0@basic_finally@@"(i8 1, i8* %[[fp]]) +// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() +// CHECK: call void @"\01?fin$0@0@basic_finally@@"({{i8( zeroext)?}} 1, i8* %[[fp]]) // CHECK: resume -// CHECK: define internal void @"\01?fin$0@0@basic_finally@@"(i8 %abnormal_termination, i8* %frame_pointer) -// CHECK: load i32, i32* @g, align 4 -// CHECK: add i32 %{{.*}}, -1 -// CHECK: store i32 %{{.*}}, i32* @g, align 4 +// CHECK: define internal void @"\01?fin$0@0@basic_finally@@"({{i8( zeroext)?}} %abnormal_termination, i8* %frame_pointer) +// CHECK: call i8* @llvm.localrecover(i8* bitcast (i32 (i32)* @basic_finally to i8*), i8* %frame_pointer, i32 0) +// CHECK: load i32, i32* %{{.*}}, align 4 +// CHECK: add nsw i32 %{{.*}}, 1 +// CHECK: store i32 %{{.*}}, i32* %{{.*}}, align 4 // CHECK: ret void int returns_int(void); diff --git a/test/CodeGen/inline.c b/test/CodeGen/inline.c index a45bccc51328..16e95c03c875 100644 --- a/test/CodeGen/inline.c +++ b/test/CodeGen/inline.c @@ -54,6 +54,7 @@ // RUN: echo "MS C Mode tests:" // RUN: %clang_cc1 %s -triple i386-unknown-unknown -O1 -disable-llvm-optzns -emit-llvm -o - -std=c99 -fms-compatibility | FileCheck %s --check-prefix=CHECK4 +// CHECK4-NOT: define weak_odr void @_Exit( // CHECK4-LABEL: define weak_odr i32 @ei() // CHECK4-LABEL: define i32 @bar() // CHECK4-NOT: unreferenced1 @@ -62,6 +63,9 @@ // CHECK4-LABEL: define linkonce_odr i32 @foo() // CHECK4-LABEL: define available_externally void @gnu_ei_inline() +__attribute__((noreturn)) void __cdecl _exit(int _Code); +__inline void __cdecl _Exit(int status) { _exit(status); } + extern __inline int ei() { return 123; } __inline int foo() { diff --git a/test/CodeGen/packed-nest-unpacked.c b/test/CodeGen/packed-nest-unpacked.c index 1dcd2ec468d7..e2bbd41a9daf 100644 --- a/test/CodeGen/packed-nest-unpacked.c +++ b/test/CodeGen/packed-nest-unpacked.c @@ -60,6 +60,35 @@ struct YBitfield gbitfield; unsigned test7() { // CHECK: @test7 - // CHECK: load i32, i32* getelementptr inbounds (%struct.YBitfield, %struct.YBitfield* @gbitfield, i32 0, i32 1, i32 0), align 4 + // CHECK: load i32, i32* getelementptr inbounds (%struct.YBitfield, %struct.YBitfield* @gbitfield, i32 0, i32 1, i32 0), align 1 return gbitfield.y.b2; } + +void test8(unsigned x) { + // CHECK: @test8 + // CHECK: load i32, i32* getelementptr inbounds (%struct.YBitfield, %struct.YBitfield* @gbitfield, i32 0, i32 1, i32 0), align 1 + // CHECK: store i32 {{.*}}, i32* getelementptr inbounds (%struct.YBitfield, %struct.YBitfield* @gbitfield, i32 0, i32 1, i32 0), align 1 + gbitfield.y.b2 = x; +} + +struct TBitfield +{ + long a; + char b; + unsigned c:15; +}; +struct TBitfield tbitfield; + +unsigned test9() { + // CHECK: @test9 + // CHECK: load i16, i16* getelementptr inbounds (%struct.TBitfield, %struct.TBitfield* @tbitfield, i32 0, i32 2), align 1 + return tbitfield.c; +} + +void test10(unsigned x) { + // CHECK: @test10 + // CHECK: load i16, i16* getelementptr inbounds (%struct.TBitfield, %struct.TBitfield* @tbitfield, i32 0, i32 2), align 1 + // CHECK: store i16 {{.*}}, i16* getelementptr inbounds (%struct.TBitfield, %struct.TBitfield* @tbitfield, i32 0, i32 2), align 1 + tbitfield.c = x; +} + diff --git a/test/CodeGen/ppc64-struct-onefloat.c b/test/CodeGen/ppc64-struct-onefloat.c index d0ccfbe34a44..534e5116f9b0 100644 --- a/test/CodeGen/ppc64-struct-onefloat.c +++ b/test/CodeGen/ppc64-struct-onefloat.c @@ -14,15 +14,15 @@ void bar(Sf a, Sd b, SSf d, SSd e) {} // CHECK: %d = alloca %struct.s4, align 4 // CHECK: %e = alloca %struct.s5, align 8 // CHECK: %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s1, %struct.s1* %a, i32 0, i32 0 -// CHECK: store float %a.coerce, float* %{{[a-zA-Z0-9.]+}}, align 1 +// CHECK: store float %a.coerce, float* %{{[a-zA-Z0-9.]+}}, align 4 // CHECK: %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s2, %struct.s2* %b, i32 0, i32 0 -// CHECK: store double %b.coerce, double* %{{[a-zA-Z0-9.]+}}, align 1 +// CHECK: store double %b.coerce, double* %{{[a-zA-Z0-9.]+}}, align 8 // CHECK: %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s4, %struct.s4* %d, i32 0, i32 0 // CHECK: %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s1, %struct.s1* %{{[a-zA-Z0-9.]+}}, i32 0, i32 0 -// CHECK: store float %d.coerce, float* %{{[a-zA-Z0-9.]+}}, align 1 +// CHECK: store float %d.coerce, float* %{{[a-zA-Z0-9.]+}}, align 4 // CHECK: %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s5, %struct.s5* %e, i32 0, i32 0 // CHECK: %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s2, %struct.s2* %{{[a-zA-Z0-9.]+}}, i32 0, i32 0 -// CHECK: store double %e.coerce, double* %{{[a-zA-Z0-9.]+}}, align 1 +// CHECK: store double %e.coerce, double* %{{[a-zA-Z0-9.]+}}, align 8 // CHECK: ret void void foo(void) @@ -36,14 +36,14 @@ void foo(void) // CHECK-LABEL: define void @foo // CHECK: %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s1, %struct.s1* %p1, i32 0, i32 0 -// CHECK: %{{[0-9]+}} = load float, float* %{{[a-zA-Z0-9.]+}}, align 1 +// CHECK: %{{[0-9]+}} = load float, float* %{{[a-zA-Z0-9.]+}}, align 4 // CHECK: %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s2, %struct.s2* %p2, i32 0, i32 0 -// CHECK: %{{[0-9]+}} = load double, double* %{{[a-zA-Z0-9.]+}}, align 1 +// CHECK: %{{[0-9]+}} = load double, double* %{{[a-zA-Z0-9.]+}}, align 8 // CHECK: %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s4, %struct.s4* %p4, i32 0, i32 0 // CHECK: %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s1, %struct.s1* %{{[a-zA-Z0-9.]+}}, i32 0, i32 0 -// CHECK: %{{[0-9]+}} = load float, float* %{{[a-zA-Z0-9.]+}}, align 1 +// CHECK: %{{[0-9]+}} = load float, float* %{{[a-zA-Z0-9.]+}}, align 4 // CHECK: %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s5, %struct.s5* %p5, i32 0, i32 0 // CHECK: %{{[a-zA-Z0-9.]+}} = getelementptr %struct.s2, %struct.s2* %{{[a-zA-Z0-9.]+}}, i32 0, i32 0 -// CHECK: %{{[0-9]+}} = load double, double* %{{[a-zA-Z0-9.]+}}, align 1 +// CHECK: %{{[0-9]+}} = load double, double* %{{[a-zA-Z0-9.]+}}, align 8 // CHECK: call void @bar(float inreg %{{[0-9]+}}, double inreg %{{[0-9]+}}, float inreg %{{[0-9]+}}, double inreg %{{[0-9]+}}) // CHECK: ret void diff --git a/test/CodeGen/ppc64le-aggregates.c b/test/CodeGen/ppc64le-aggregates.c index 76798c132734..3ad4b06c688a 100644 --- a/test/CodeGen/ppc64le-aggregates.c +++ b/test/CodeGen/ppc64le-aggregates.c @@ -54,49 +54,49 @@ struct fabc func_fabc(struct fabc x) { return x; } struct f2a2b func_f2a2b(struct f2a2b x) { return x; } // CHECK-LABEL: @call_f1 -// CHECK: %[[TMP:[^ ]+]] = load float, float* getelementptr inbounds (%struct.f1, %struct.f1* @global_f1, i32 0, i32 0, i32 0), align 1 +// CHECK: %[[TMP:[^ ]+]] = load float, float* getelementptr inbounds (%struct.f1, %struct.f1* @global_f1, i32 0, i32 0, i32 0), align 4 // CHECK: call [1 x float] @func_f1(float inreg %[[TMP]]) struct f1 global_f1; void call_f1(void) { global_f1 = func_f1(global_f1); } // CHECK-LABEL: @call_f2 -// CHECK: %[[TMP:[^ ]+]] = load [2 x float], [2 x float]* getelementptr inbounds (%struct.f2, %struct.f2* @global_f2, i32 0, i32 0), align 1 +// CHECK: %[[TMP:[^ ]+]] = load [2 x float], [2 x float]* getelementptr inbounds (%struct.f2, %struct.f2* @global_f2, i32 0, i32 0), align 4 // CHECK: call [2 x float] @func_f2([2 x float] %[[TMP]]) struct f2 global_f2; void call_f2(void) { global_f2 = func_f2(global_f2); } // CHECK-LABEL: @call_f3 -// CHECK: %[[TMP:[^ ]+]] = load [3 x float], [3 x float]* getelementptr inbounds (%struct.f3, %struct.f3* @global_f3, i32 0, i32 0), align 1 +// CHECK: %[[TMP:[^ ]+]] = load [3 x float], [3 x float]* getelementptr inbounds (%struct.f3, %struct.f3* @global_f3, i32 0, i32 0), align 4 // CHECK: call [3 x float] @func_f3([3 x float] %[[TMP]]) struct f3 global_f3; void call_f3(void) { global_f3 = func_f3(global_f3); } // CHECK-LABEL: @call_f4 -// CHECK: %[[TMP:[^ ]+]] = load [4 x float], [4 x float]* getelementptr inbounds (%struct.f4, %struct.f4* @global_f4, i32 0, i32 0), align 1 +// CHECK: %[[TMP:[^ ]+]] = load [4 x float], [4 x float]* getelementptr inbounds (%struct.f4, %struct.f4* @global_f4, i32 0, i32 0), align 4 // CHECK: call [4 x float] @func_f4([4 x float] %[[TMP]]) struct f4 global_f4; void call_f4(void) { global_f4 = func_f4(global_f4); } // CHECK-LABEL: @call_f5 -// CHECK: %[[TMP:[^ ]+]] = load [5 x float], [5 x float]* getelementptr inbounds (%struct.f5, %struct.f5* @global_f5, i32 0, i32 0), align 1 +// CHECK: %[[TMP:[^ ]+]] = load [5 x float], [5 x float]* getelementptr inbounds (%struct.f5, %struct.f5* @global_f5, i32 0, i32 0), align 4 // CHECK: call [5 x float] @func_f5([5 x float] %[[TMP]]) struct f5 global_f5; void call_f5(void) { global_f5 = func_f5(global_f5); } // CHECK-LABEL: @call_f6 -// CHECK: %[[TMP:[^ ]+]] = load [6 x float], [6 x float]* getelementptr inbounds (%struct.f6, %struct.f6* @global_f6, i32 0, i32 0), align 1 +// CHECK: %[[TMP:[^ ]+]] = load [6 x float], [6 x float]* getelementptr inbounds (%struct.f6, %struct.f6* @global_f6, i32 0, i32 0), align 4 // CHECK: call [6 x float] @func_f6([6 x float] %[[TMP]]) struct f6 global_f6; void call_f6(void) { global_f6 = func_f6(global_f6); } // CHECK-LABEL: @call_f7 -// CHECK: %[[TMP:[^ ]+]] = load [7 x float], [7 x float]* getelementptr inbounds (%struct.f7, %struct.f7* @global_f7, i32 0, i32 0), align 1 +// CHECK: %[[TMP:[^ ]+]] = load [7 x float], [7 x float]* getelementptr inbounds (%struct.f7, %struct.f7* @global_f7, i32 0, i32 0), align 4 // CHECK: call [7 x float] @func_f7([7 x float] %[[TMP]]) struct f7 global_f7; void call_f7(void) { global_f7 = func_f7(global_f7); } // CHECK-LABEL: @call_f8 -// CHECK: %[[TMP:[^ ]+]] = load [8 x float], [8 x float]* getelementptr inbounds (%struct.f8, %struct.f8* @global_f8, i32 0, i32 0), align 1 +// CHECK: %[[TMP:[^ ]+]] = load [8 x float], [8 x float]* getelementptr inbounds (%struct.f8, %struct.f8* @global_f8, i32 0, i32 0), align 4 // CHECK: call [8 x float] @func_f8([8 x float] %[[TMP]]) struct f8 global_f8; void call_f8(void) { global_f8 = func_f8(global_f8); } @@ -104,7 +104,7 @@ void call_f8(void) { global_f8 = func_f8(global_f8); } // CHECK-LABEL: @call_f9 // CHECK: %[[TMP1:[^ ]+]] = alloca [5 x i64] // CHECK: %[[TMP2:[^ ]+]] = bitcast [5 x i64]* %[[TMP1]] to i8* -// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %[[TMP2]], i8* bitcast (%struct.f9* @global_f9 to i8*), i64 36, i32 1, i1 false) +// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %[[TMP2]], i8* bitcast (%struct.f9* @global_f9 to i8*), i64 36, i32 4, i1 false) // CHECK: %[[TMP3:[^ ]+]] = load [5 x i64], [5 x i64]* %[[TMP1]] // CHECK: call void @func_f9(%struct.f9* sret %{{[^ ]+}}, [5 x i64] %[[TMP3]]) struct f9 global_f9; diff --git a/test/CodeGenCXX/2012-03-16-StoreAlign.cpp b/test/CodeGenCXX/2012-03-16-StoreAlign.cpp index 7e82ca544dc0..5f6189e2451b 100644 --- a/test/CodeGenCXX/2012-03-16-StoreAlign.cpp +++ b/test/CodeGenCXX/2012-03-16-StoreAlign.cpp @@ -28,7 +28,7 @@ struct Foo { }; // CHECK: @_ZZN3Foo19getPageSizeFromNameERK6LengthE10legalWidth = linkonce_odr global %struct.Length zeroinitializer, align 4 -// CHECK: store float %{{.*}}, float* getelementptr inbounds (%struct.Length, %struct.Length* @_ZZN3Foo19getPageSizeFromNameERK6LengthE10legalWidth, i32 0, i32 0), align 1 +// CHECK: store float %{{.*}}, float* getelementptr inbounds (%struct.Length, %struct.Length* @_ZZN3Foo19getPageSizeFromNameERK6LengthE10legalWidth, i32 0, i32 0), align 4 bool bar(Length &b) { Foo f; diff --git a/test/CodeGenCXX/cfi-ms-rtti.cpp b/test/CodeGenCXX/cfi-ms-rtti.cpp new file mode 100644 index 000000000000..5203a6bb0c8b --- /dev/null +++ b/test/CodeGenCXX/cfi-ms-rtti.cpp @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -emit-llvm -o - -triple=x86_64-pc-win32 %s -fsanitize=cfi-vcall | FileCheck --check-prefix=RTTI %s +// RUN: %clang_cc1 -emit-llvm -o - -triple=x86_64-pc-win32 %s -fsanitize=cfi-vcall -fno-rtti-data | FileCheck --check-prefix=NO-RTTI %s + +struct A { + A(); + virtual void f() {} +}; + +A::A() {} + +// RTTI: !{!"A@@", [2 x i8*]* {{.*}}, i64 8} +// NO-RTTI: !{!"A@@", [1 x i8*]* {{.*}}, i64 0} diff --git a/test/CodeGenCXX/cfi-vcall.cpp b/test/CodeGenCXX/cfi-vcall.cpp index 333c7bd1f160..5cb5e02cf585 100644 --- a/test/CodeGenCXX/cfi-vcall.cpp +++ b/test/CodeGenCXX/cfi-vcall.cpp @@ -134,6 +134,29 @@ void foo() { af(&fa); } +namespace test2 { + +struct A { + virtual void m_fn1(); +}; +struct B { + virtual void m_fn2(); +}; +struct C : B, A {}; +struct D : C { + void m_fn1(); +}; + +// ITANIUM: define void @_ZN5test21fEPNS_1DE +// MS: define void @"\01?f@test2@@YAXPEAUD@1@@Z" +void f(D *d) { + // ITANIUM: {{%[^ ]*}} = call i1 @llvm.bitset.test(i8* {{%[^ ]*}}, metadata !"N5test21DE") + // MS: {{%[^ ]*}} = call i1 @llvm.bitset.test(i8* {{%[^ ]*}}, metadata !"A@test2@@") + d->m_fn1(); +} + +} + // Check for the expected number of elements (9 or 15 respectively). // MS: !llvm.bitsets = !{[[X:[^,]*(,[^,]*){8}]]} // ITANIUM: !llvm.bitsets = !{[[X:[^,]*(,[^,]*){14}]]} diff --git a/test/CodeGenCXX/debug-info-namespace.cpp b/test/CodeGenCXX/debug-info-namespace.cpp index 35b371ec9c9d..8a00d9b4a5eb 100644 --- a/test/CodeGenCXX/debug-info-namespace.cpp +++ b/test/CodeGenCXX/debug-info-namespace.cpp @@ -104,8 +104,7 @@ void B::func_fwd() {} // CHECK-GMLT: [[CU:![0-9]+]] = distinct !DICompileUnit( // CHECK-GMLT-SAME: emissionKind: 2, -// CHECK-GMLT-SAME: imports: [[MODULES:![0-9]+]] -// CHECK-GMLT: [[MODULES]] = !{} +// CHECK-GMLT-NOT: imports: // CHECK-NOLIMIT: !DICompositeType(tag: DW_TAG_structure_type, name: "bar",{{.*}} line: 6, // CHECK-NOLIMIT-NOT: DIFlagFwdDecl diff --git a/test/CodeGenCXX/eh-aggregate-copy-destroy.cpp b/test/CodeGenCXX/eh-aggregate-copy-destroy.cpp new file mode 100644 index 000000000000..29fb5567fb1d --- /dev/null +++ b/test/CodeGenCXX/eh-aggregate-copy-destroy.cpp @@ -0,0 +1,37 @@ +// Check that in case of copying an array of memcpy-able objects, their +// destructors will be called if an exception is thrown. +// +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fexceptions -fcxx-exceptions -O0 -fno-elide-constructors -emit-llvm %s -o - | FileCheck %s + +struct ImplicitCopy { + int x; + ImplicitCopy() { x = 10; } + ~ImplicitCopy() { x = 20; } +}; + +struct ThrowCopy { + ThrowCopy() {} + ThrowCopy(const ThrowCopy &) { throw 1; } +}; + +struct Container { + ImplicitCopy b[2]; + ThrowCopy c; +}; + +int main () { + try { + Container c1; + // CHECK_LABEL: main + // CHECK-NOT: call void @_ZN9ThrowCopyC1ERKS_ + // CHECK: invoke void @_ZN9ThrowCopyC1ERKS_ + // CHECK: invoke void @_ZN12ImplicitCopyD1Ev + Container c2(c1); + } + catch (...) { + return 1; + } + + return 0; +} + diff --git a/test/CodeGenCXX/eh-aggregated-inits-unwind.cpp b/test/CodeGenCXX/eh-aggregated-inits-unwind.cpp new file mode 100644 index 000000000000..9772564b051c --- /dev/null +++ b/test/CodeGenCXX/eh-aggregated-inits-unwind.cpp @@ -0,0 +1,47 @@ +// Check that destructors of memcpy-able struct members are called properly +// during stack unwinding after an exception. +// +// Check that destructor's argument (address of member to be destroyed) is +// obtained by taking offset from struct, not by bitcasting pointers. +// +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -O0 -fno-elide-constructors -emit-llvm %s -o - | FileCheck %s + +struct ImplicitCopy { + int id; + ImplicitCopy() { id = 10; } + ~ImplicitCopy() { id = 20; } +}; + +struct ThrowCopy { + int id; + ThrowCopy() { id = 15; } + ThrowCopy(const ThrowCopy &x) { + id = 25; + throw 1; + } + ~ThrowCopy() { id = 35; } +}; + +struct Container { + int id; + ImplicitCopy o1; + ThrowCopy o2; + + Container() { id = 1000; } + ~Container() { id = 2000; } +}; + +int main() { + try { + Container c1; + // CHECK-LABEL: main + // CHECK: %{{.+}} = getelementptr inbounds %struct.Container, %struct.Container* %{{.+}}, i32 0, i32 1 + // CHECK-NOT: %{{.+}} = bitcast %struct.Container* %{{.+}} to %struct.ImplicitCopy* + Container c2(c1); + + return 2; + } catch (...) { + return 1; + } + return 0; +} diff --git a/test/CodeGenCXX/eh-aggregated-inits.cpp b/test/CodeGenCXX/eh-aggregated-inits.cpp new file mode 100644 index 000000000000..cb34b65dfe8e --- /dev/null +++ b/test/CodeGenCXX/eh-aggregated-inits.cpp @@ -0,0 +1,46 @@ +// Check that initialization of the only one memcpy-able struct member will not +// be performed twice after successful non-trivial initializtion of the second +// member. +// +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -O0 -fno-elide-constructors -emit-llvm %s -o - | FileCheck %s + +int globId = 0; + +struct ImplicitCopy { + int id; + + ImplicitCopy() { id = 10; } + ~ImplicitCopy() { id = 20; } +}; + +struct ExplicitCopy { + int id; + + ExplicitCopy() { id = 15; } + ExplicitCopy(const ExplicitCopy &x) { id = 25; } + ~ExplicitCopy() { id = 35; } +}; + +struct Container { + ImplicitCopy o1; // memcpy-able member. + ExplicitCopy o2; // non-trivial initialization. + + Container() { globId = 1000; } + ~Container() { globId = 2000; } +}; + +int main() { + try { + Container c1; + // CHECK-DAG: call void @llvm.memcpy + // CHECK-DAG: declare void @llvm.memcpy + // CHECK-NOT: @llvm.memcpy + Container c2(c1); + + return 2; + } + catch (...) { + return 1; + } + return 0; +} diff --git a/test/CodeGenCXX/exceptions-seh-filter-captures.cpp b/test/CodeGenCXX/exceptions-seh-filter-captures.cpp index 5df418a13ad8..26ef90f5a6f3 100644 --- a/test/CodeGenCXX/exceptions-seh-filter-captures.cpp +++ b/test/CodeGenCXX/exceptions-seh-filter-captures.cpp @@ -15,15 +15,15 @@ extern "C" void test_freefunc(int p1) { } // CHECK-LABEL: define void @test_freefunc(i32 %p1) -// CHECK: @llvm.frameescape(i32* %[[p1_ptr:[^, ]*]], i32* %[[l1_ptr:[^, ]*]]) +// CHECK: @llvm.localescape(i32* %[[p1_ptr:[^, ]*]], i32* %[[l1_ptr:[^, ]*]]) // CHECK: store i32 %p1, i32* %[[p1_ptr]], align 4 // CHECK: store i32 13, i32* %[[l1_ptr]], align 4 // CHECK: invoke void @might_crash() // CHECK-LABEL: define internal i32 @"\01?filt$0@0@test_freefunc@@"(i8* %exception_pointers, i8* %frame_pointer) -// CHECK: %[[p1_i8:[^ ]*]] = call i8* @llvm.framerecover(i8* bitcast (void (i32)* @test_freefunc to i8*), i8* %frame_pointer, i32 0) +// CHECK: %[[p1_i8:[^ ]*]] = call i8* @llvm.localrecover(i8* bitcast (void (i32)* @test_freefunc to i8*), i8* %frame_pointer, i32 0) // CHECK: %[[p1_ptr:[^ ]*]] = bitcast i8* %[[p1_i8]] to i32* -// CHECK: %[[l1_i8:[^ ]*]] = call i8* @llvm.framerecover(i8* bitcast (void (i32)* @test_freefunc to i8*), i8* %frame_pointer, i32 1) +// CHECK: %[[l1_i8:[^ ]*]] = call i8* @llvm.localrecover(i8* bitcast (void (i32)* @test_freefunc to i8*), i8* %frame_pointer, i32 1) // CHECK: %[[l1_ptr:[^ ]*]] = bitcast i8* %[[l1_i8]] to i32* // CHECK: %[[s1:[^ ]*]] = load i32, i32* @"\01?s1@?1??test_freefunc@@9@4HA", align 4 // CHECK: %[[l1:[^ ]*]] = load i32, i32* %[[l1_ptr]] @@ -45,12 +45,12 @@ void S::test_method() { } // CHECK-LABEL: define void @"\01?test_method@S@@QEAAXXZ"(%struct.S* %this) -// CHECK: @llvm.frameescape(i32* %[[l1_addr:[^, ]*]]) +// CHECK: @llvm.localescape(i32* %[[l1_addr:[^, ]*]]) // CHECK: store i32 13, i32* %[[l1_addr]], align 4 // CHECK: invoke void @might_crash() // CHECK-LABEL: define internal i32 @"\01?filt$0@0@test_method@S@@"(i8* %exception_pointers, i8* %frame_pointer) -// CHECK: %[[l1_i8:[^ ]*]] = call i8* @llvm.framerecover(i8* bitcast (void (%struct.S*)* @"\01?test_method@S@@QEAAXXZ" to i8*), i8* %frame_pointer, i32 0) +// CHECK: %[[l1_i8:[^ ]*]] = call i8* @llvm.localrecover(i8* bitcast (void (%struct.S*)* @"\01?test_method@S@@QEAAXXZ" to i8*), i8* %frame_pointer, i32 0) // CHECK: %[[l1_ptr:[^ ]*]] = bitcast i8* %[[l1_i8]] to i32* // CHECK: %[[l1:[^ ]*]] = load i32, i32* %[[l1_ptr]] // CHECK: call i32 (i32, ...) @basic_filter(i32 %[[l1]]) @@ -69,12 +69,12 @@ void test_lambda() { } // CHECK-LABEL: define internal void @"\01??R<lambda_0>@?test_lambda@@YAXXZ@QEBAXXZ"(%class.anon* %this) -// CHECK: @llvm.frameescape(i32* %[[l2_addr:[^, ]*]]) +// CHECK: @llvm.localescape(i32* %[[l2_addr:[^, ]*]]) // CHECK: store i32 42, i32* %[[l2_addr]], align 4 // CHECK: invoke void @might_crash() // CHECK-LABEL: define internal i32 @"\01?filt$0@0@?R<lambda_0>@?test_lambda@@YAXXZ@"(i8* %exception_pointers, i8* %frame_pointer) -// CHECK: %[[l2_i8:[^ ]*]] = call i8* @llvm.framerecover(i8* bitcast (void (%class.anon*)* @"\01??R<lambda_0>@?test_lambda@@YAXXZ@QEBAXXZ" to i8*), i8* %frame_pointer, i32 0) +// CHECK: %[[l2_i8:[^ ]*]] = call i8* @llvm.localrecover(i8* bitcast (void (%class.anon*)* @"\01??R<lambda_0>@?test_lambda@@YAXXZ@QEBAXXZ" to i8*), i8* %frame_pointer, i32 0) // CHECK: %[[l2_ptr:[^ ]*]] = bitcast i8* %[[l2_i8]] to i32* // CHECK: %[[l2:[^ ]*]] = load i32, i32* %[[l2_ptr]] // CHECK: call i32 (i32, ...) @basic_filter(i32 %[[l2]]) diff --git a/test/CodeGenCXX/exceptions-seh.cpp b/test/CodeGenCXX/exceptions-seh.cpp index 2cee4f77e5d4..187ad4bc710e 100644 --- a/test/CodeGenCXX/exceptions-seh.cpp +++ b/test/CodeGenCXX/exceptions-seh.cpp @@ -127,13 +127,13 @@ void use_inline() { // // CHECK: invoke void @might_throw() // -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) +// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() // CHECK: call void @"\01?fin$0@0@use_seh_in_inline_func@@"(i8 0, i8* %[[fp]]) // CHECK: ret void // // CHECK: landingpad { i8*, i32 } // CHECK-NEXT: cleanup -// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.frameaddress(i32 0) +// CHECK: %[[fp:[^ ]*]] = call i8* @llvm.localaddress() // CHECK: call void @"\01?fin$0@0@use_seh_in_inline_func@@"(i8 1, i8* %[[fp]]) // CHECK-LABEL: define internal i32 @"\01?filt$0@0@use_seh_in_inline_func@@"(i8* %exception_pointers, i8* %frame_pointer) #{{[0-9]+}} comdat($use_seh_in_inline_func) diff --git a/test/CodeGenCXX/pr24097.cpp b/test/CodeGenCXX/pr24097.cpp new file mode 100644 index 000000000000..122bf88506d3 --- /dev/null +++ b/test/CodeGenCXX/pr24097.cpp @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 %s -triple=x86_64-pc-linux -fvisibility hidden -emit-llvm -O1 -disable-llvm-optzns -o - | FileCheck %s + +struct Filter { + virtual void Foo(); +}; +struct Sender { + virtual bool Send(); +}; +struct SyncMessageFilter : public Filter, public Sender { + bool Send(); +}; +struct TestSyncMessageFilter : public SyncMessageFilter { +}; +void bar() { + TestSyncMessageFilter f; + f.Send(); +} + +// Test that it is not hidden +// CHECK: define available_externally zeroext i1 @_ZThn8_N17SyncMessageFilter4SendEv diff --git a/test/CodeGenCXX/sanitize-dtor-callback.cpp b/test/CodeGenCXX/sanitize-dtor-callback.cpp new file mode 100644 index 000000000000..4912a27229f9 --- /dev/null +++ b/test/CodeGenCXX/sanitize-dtor-callback.cpp @@ -0,0 +1,17 @@ +// Test -fsanitize-memory-use-after-dtor +// RUN: %clang_cc1 -fsanitize=memory -fsanitize-memory-use-after-dtor -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -fsanitize=memory -triple=x86_64-pc-linux -emit-llvm -o - %s | FileCheck %s -check-prefix=NO_DTOR_CHECK + +struct Simple { + ~Simple() {} +}; +Simple s; +// Simple internal member is poisoned by compiler-generated dtor +// CHECK-LABEL: @_ZN6SimpleD2Ev +// CHECK: call void @__sanitizer_dtor_callback +// CHECK: ret void + +// Compiling without the flag does not generate member-poisoning dtor +// NO_DTOR_CHECK-LABEL: @_ZN6SimpleD2Ev +// NO_DTOR_CHECK-NOT: call void @sanitizer_dtor_callback +// NO_DTOR_CHECK: ret void diff --git a/test/CodeGenCXX/varargs.cpp b/test/CodeGenCXX/varargs.cpp index 1ea072e2eb5a..e0165994d013 100644 --- a/test/CodeGenCXX/varargs.cpp +++ b/test/CodeGenCXX/varargs.cpp @@ -37,7 +37,7 @@ namespace test1 { // CHECK-NEXT: [[T1:%.*]] = bitcast [[A]]* [[X]] to i8* // CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[T0]], i8* [[T1]], i64 8, i32 4, i1 false) // CHECK-NEXT: [[T0:%.*]] = bitcast [[A]]* [[TMP]] to i64* - // CHECK-NEXT: [[T1:%.*]] = load i64, i64* [[T0]], align 1 + // CHECK-NEXT: [[T1:%.*]] = load i64, i64* [[T0]], align 4 // CHECK-NEXT: call void (...) @_ZN5test13fooEz(i64 [[T1]]) // CHECK-NEXT: ret void } diff --git a/test/CodeGenCXX/x86_64-arguments-avx.cpp b/test/CodeGenCXX/x86_64-arguments-avx.cpp index 29e693451d12..2933d9445b76 100644 --- a/test/CodeGenCXX/x86_64-arguments-avx.cpp +++ b/test/CodeGenCXX/x86_64-arguments-avx.cpp @@ -50,3 +50,12 @@ UU2 PR23082(UU2 x) { return x; } } + +namespace test3 { +union U { + __attribute__((__vector_size__(32))) float f1; + int f2; +}; +// CHECK: define i32 @_ZN5test31fENS_1UE({{.*}}* byval align 32 +int f(U u) { return u.f2; } +} diff --git a/test/CodeGenCXX/x86_64-arguments.cpp b/test/CodeGenCXX/x86_64-arguments.cpp index 815ef6111a9a..64202b4d02c6 100644 --- a/test/CodeGenCXX/x86_64-arguments.cpp +++ b/test/CodeGenCXX/x86_64-arguments.cpp @@ -196,3 +196,19 @@ namespace test9 { return sret; } } + +namespace test10 { +#pragma pack(1) +struct BasePacked { + char one; + short two; +}; +#pragma pack() +struct DerivedPacked : public BasePacked { + int three; +}; +// CHECK-LABEL: define i32 @_ZN6test1020FuncForDerivedPackedENS_13DerivedPackedE({{.*}}* byval align 8 +int FuncForDerivedPacked(DerivedPacked d) { + return d.three; +} +} diff --git a/test/CodeGenObjC/parameterized_classes.m b/test/CodeGenObjC/parameterized_classes.m new file mode 100644 index 000000000000..1d8e9a259934 --- /dev/null +++ b/test/CodeGenObjC/parameterized_classes.m @@ -0,0 +1,63 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fblocks -fobjc-arc -emit-llvm -o - %s | FileCheck %s + +// Parameterized classes have no effect on code generation; this test +// mainly verifies that CodeGen doesn't assert when substituted types +// in uses of methods don't line up exactly with the parameterized +// types in the method declarations due to type erasure. "Not crash" +// is the only interesting criteria here. + +@protocol NSObject +@end + +@protocol NSCopying +@end + +__attribute__((objc_root_class)) +@interface NSObject <NSObject> +@end + +@interface NSString : NSObject <NSCopying> +@end + +@interface NSMutableArray<T> : NSObject <NSCopying> +@property (copy,nonatomic) T firstObject; +- (void)addObject:(T)object; +- (void)sortWithFunction:(int (*)(T, T))function; +- (void)getObjects:(T __strong *)objects length:(unsigned*)length; +@end + +NSString *getFirstObjectProp(NSMutableArray<NSString *> *array) { + return array.firstObject; +} + +NSString *getFirstObjectMethod(NSMutableArray<NSString *> *array) { + return [array firstObject]; +} + +void addObject(NSMutableArray<NSString *> *array, NSString *obj) { + [array addObject: obj]; +} + +int compareStrings(NSString *x, NSString *y) { return 0; } +int compareBlocks(NSString * (^x)(NSString *), + NSString * (^y)(NSString *)) { return 0; } + +void sortTest(NSMutableArray<NSString *> *array, + NSMutableArray<NSString * (^)(NSString *)> *array2) { + [array sortWithFunction: &compareStrings]; + [array2 sortWithFunction: &compareBlocks]; +} + +void getObjectsTest(NSMutableArray<NSString *> *array) { + NSString * __strong *objects; + unsigned length; + [array getObjects: objects length: &length]; +} + +void printMe(NSString *name) { } + +// CHECK-LABEL: define void @blockTest +void blockTest(NSMutableArray<void (^)(void)> *array, NSString *name) { + // CHECK: call i8* @objc_retainBlock + [array addObject: ^ { printMe(name); }]; +} diff --git a/test/CodeGenObjCXX/mangle.mm b/test/CodeGenObjCXX/mangle.mm index 5b944caf1f41..bcb920ba1e91 100644 --- a/test/CodeGenObjCXX/mangle.mm +++ b/test/CodeGenObjCXX/mangle.mm @@ -98,3 +98,18 @@ template<> void X<A*>::f() {} // CHECK-LABEL: define void @_ZN1XIP1AE1fEv template<> void X<A<P>*>::f() {} // CHECK-LABEL: define void @_ZN1XIPU11objcproto1P1AE1fEv + +// CHECK-LABEL: define void @_Z12kindof_test2PU8__kindof5Test2 +void kindof_test2(__kindof Test2 *t2) { } + +@interface Parameterized<T, U> : A +@end + +// CHECK-LABEL: define void @_Z19parameterized_test1P13ParameterizedIP1AP4TestE +void parameterized_test1(Parameterized<A *, Test *> *p) {} + +// CHECK-LABEL: define void @_Z19parameterized_test2PU8__kindof13ParameterizedIP1AP4TestE +void parameterized_test2(__kindof Parameterized<A *, Test *> *p) {} + +// CHECK-LABEL: define void @_Z19parameterized_test3P13Parameterized +void parameterized_test3(Parameterized *p) {} diff --git a/test/Driver/apple-kext-mkernel.c b/test/Driver/apple-kext-mkernel.c index 8282c05dd8f1..5f4f52246155 100644 --- a/test/Driver/apple-kext-mkernel.c +++ b/test/Driver/apple-kext-mkernel.c @@ -11,7 +11,7 @@ // RUN: -arch armv7 -mkernel -mstrict-align -### -fsyntax-only %s 2> %t // RUN: FileCheck --check-prefix=CHECK-ARM < %t %s -// CHECK-ARM: "-backend-option" "-arm-long-calls" +// CHECK-ARM: "-target-feature" "+long-calls" // CHECK-ARM: "-backend-option" "-arm-strict-align" // CHECK-ARM-NOT: "-backend-option" "-arm-strict-align" // CHECK-ARM: "-fno-builtin" diff --git a/test/Driver/arm-long-calls.c b/test/Driver/arm-long-calls.c index 62294a09c22a..375b0f81c24f 100644 --- a/test/Driver/arm-long-calls.c +++ b/test/Driver/arm-long-calls.c @@ -7,9 +7,9 @@ // RUN: %clang -target armv7-eabi -### -mlong-calls -mno-long-calls %s 2>&1 \ // RUN: | FileCheck %s -check-prefix CHECK-NO-LONG-CALLS -// CHECK-DEFAULT-NOT: "-backend-option" "-arm-long-calls" +// CHECK-DEFAULT-NOT: "-target-feature" "+long-calls" -// CHECK-LONG-CALLS: "-backend-option" "-arm-long-calls" +// CHECK-LONG-CALLS: "-target-feature" "+long-calls" -// CHECK-NO-LONG-CALLS-NOT: "-backend-option" "-arm-long-calls" +// CHECK-NO-LONG-CALLS-NOT: "-target-feature" "+long-calls" diff --git a/test/Driver/cl-eh.cpp b/test/Driver/cl-eh.cpp index a71491edeaf3..b43f31f83fc7 100644 --- a/test/Driver/cl-eh.cpp +++ b/test/Driver/cl-eh.cpp @@ -4,9 +4,11 @@ // Note: %s must be preceded by --, otherwise it may be interpreted as a // command-line option, e.g. on Mac where %s is commonly under /Users. +// FIXME: When C++ EH works, we can make this flag turn things back on. + // RUN: %clang_cl /c /EHsc -### -- %s 2>&1 | FileCheck -check-prefix=EHsc %s -// EHsc: "-fcxx-exceptions" -// EHsc: "-fexceptions" +// EHsc-NOT: "-fcxx-exceptions" +// EHsc-NOT: "-fexceptions" // RUN: %clang_cl /c /EHs-c- -### -- %s 2>&1 | FileCheck -check-prefix=EHs_c_ %s // EHs_c_-NOT: "-fcxx-exceptions" @@ -17,12 +19,12 @@ // EHs_EHc_-NOT: "-fexceptions" // RUN: %clang_cl /c /EHs- /EHs -### -- %s 2>&1 | FileCheck -check-prefix=EHs_EHs %s -// EHs_EHs: "-fcxx-exceptions" -// EHs_EHs: "-fexceptions" +// EHs_EHs-NOT: "-fcxx-exceptions" +// EHs_EHs-NOT: "-fexceptions" // RUN: %clang_cl /c /EHs- /EHsa -### -- %s 2>&1 | FileCheck -check-prefix=EHs_EHa %s -// EHs_EHa: "-fcxx-exceptions" -// EHs_EHa: "-fexceptions" +// EHs_EHa-NOT: "-fcxx-exceptions" +// EHs_EHa-NOT: "-fexceptions" // RUN: %clang_cl /c /EHinvalid -### -- %s 2>&1 | FileCheck -check-prefix=EHinvalid %s // EHinvalid: error: invalid value 'invalid' in '/EH' diff --git a/test/Driver/clang_f_opts.c b/test/Driver/clang_f_opts.c index 68890a70bc52..003430174b61 100644 --- a/test/Driver/clang_f_opts.c +++ b/test/Driver/clang_f_opts.c @@ -66,6 +66,40 @@ // CHECK-PROFILE-ARCS: "-femit-coverage-data" // CHECK-NO-PROFILE-ARCS-NOT: "-femit-coverage-data" +// RUN: %clang -### -S -fprofile-generate %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE %s +// RUN: %clang -### -S -fprofile-instr-generate %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE %s +// RUN: %clang -### -S -fprofile-generate=/some/dir %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE-DIR %s +// RUN: %clang -### -S -fprofile-instr-generate=/tmp/somefile.profraw %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE-FILE %s +// RUN: %clang -### -S -fprofile-generate -fprofile-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s +// RUN: %clang -### -S -fprofile-generate -fprofile-use=dir %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s +// RUN: %clang -### -S -fprofile-generate -fprofile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s +// RUN: %clang -### -S -fprofile-generate -fprofile-instr-use=file %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s +// RUN: %clang -### -S -fprofile-instr-generate -fprofile-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s +// RUN: %clang -### -S -fprofile-instr-generate -fprofile-use=dir %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s +// RUN: %clang -### -S -fprofile-instr-generate -fprofile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s +// RUN: %clang -### -S -fprofile-instr-generate -fprofile-instr-use=file %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s +// RUN: %clang -### -S -fprofile-instr-generate=file -fprofile-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s +// RUN: %clang -### -S -fprofile-instr-generate=file -fprofile-use=dir %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s +// RUN: %clang -### -S -fprofile-instr-generate=file -fprofile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s +// RUN: %clang -### -S -fprofile-instr-generate=file -fprofile-instr-use=file %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s +// RUN: %clang -### -S -fprofile-generate=dir -fprofile-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s +// RUN: %clang -### -S -fprofile-generate=dir -fprofile-use=dir %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s +// RUN: %clang -### -S -fprofile-generate=dir -fprofile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s +// RUN: %clang -### -S -fprofile-generate=dir -fprofile-instr-use=file %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s +// CHECK-PROFILE-GENERATE: "-fprofile-instr-generate" +// CHECK-PROFILE-GENERATE-DIR: "-fprofile-instr-generate=/some/dir{{/|\\\\}}default.profraw" +// CHECK-PROFILE-GENERATE-FILE: "-fprofile-instr-generate=/tmp/somefile.profraw" +// CHECK-NO-MIX-GEN-USE: '{{[a-z=-]*}}' not allowed with '{{[a-z=-]*}}' + +// RUN: %clang -### -S -fprofile-use %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE %s +// RUN: %clang -### -S -fprofile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE %s +// RUN: mkdir -p %t.d/some/dir +// RUN: %clang -### -S -fprofile-use=%t.d/some/dir %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE-DIR %s +// RUN: %clang -### -S -fprofile-instr-use=/tmp/somefile.prof %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE-FILE %s +// CHECK-PROFILE-USE: "-fprofile-instr-use=default.profdata" +// CHECK-PROFILE-USE-DIR: "-fprofile-instr-use={{.*}}.d/some/dir{{/|\\\\}}default.profdata" +// CHECK-PROFILE-USE-FILE: "-fprofile-instr-use=/tmp/somefile.prof" + // RUN: %clang -### -S -fvectorize %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s // RUN: %clang -### -S -fno-vectorize -fvectorize %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s // RUN: %clang -### -S -fno-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s @@ -162,7 +196,6 @@ // RUN: -fprefetch-loop-arrays -fno-prefetch-loop-arrays \ // RUN: -fprofile-correction -fno-profile-correction \ // RUN: -fprofile-dir=bar \ -// RUN: -fprofile-use -fprofile-use=zed -fno-profile-use \ // RUN: -fprofile-values -fno-profile-values \ // RUN: -frounding-math -fno-rounding-math \ // RUN: -fsee -fno-see \ @@ -242,8 +275,6 @@ // RUN: -fno-keep-inline-functions \ // RUN: -freorder-blocks \ // RUN: -fprofile-dir=/rand/dir \ -// RUN: -fprofile-use \ -// RUN: -fprofile-use=/rand/dir \ // RUN: -falign-functions \ // RUN: -falign-functions=1 \ // RUN: -ffloat-store \ @@ -312,8 +343,6 @@ // CHECK-WARNING-DAG: optimization flag '-fno-keep-inline-functions' is not supported // CHECK-WARNING-DAG: optimization flag '-freorder-blocks' is not supported // CHECK-WARNING-DAG: optimization flag '-fprofile-dir=/rand/dir' is not supported -// CHECK-WARNING-DAG: optimization flag '-fprofile-use' is not supported -// CHECK-WARNING-DAG: optimization flag '-fprofile-use=/rand/dir' is not supported // CHECK-WARNING-DAG: optimization flag '-falign-functions' is not supported // CHECK-WARNING-DAG: optimization flag '-falign-functions=1' is not supported // CHECK-WARNING-DAG: optimization flag '-ffloat-store' is not supported diff --git a/test/Driver/crash-report-modules.m b/test/Driver/crash-report-modules.m index 66ebaa750ddc..0e1d81a1f340 100644 --- a/test/Driver/crash-report-modules.m +++ b/test/Driver/crash-report-modules.m @@ -26,6 +26,8 @@ const int x = MODULE_MACRO; // CHECKSRC: const int x = 10; // CHECKSH: # Crash reproducer +// CHECKSH-NEXT: # Driver args: "-fsyntax-only" +// CHECKSH-SAME: "-D" "FOO=BAR" // CHECKSH-NEXT: # Original command: {{.*$}} // CHECKSH-NEXT: "-cc1" // CHECKSH: "-isysroot" "/tmp/" diff --git a/test/Driver/crash-report.c b/test/Driver/crash-report.c index 5caad79f192b..2ff5b44f5e52 100644 --- a/test/Driver/crash-report.c +++ b/test/Driver/crash-report.c @@ -5,7 +5,7 @@ // RUN: -iprefix /the/prefix -iwithprefix /tmp -iwithprefixbefore /tmp/ \ // RUN: -Xclang -internal-isystem -Xclang /tmp/ \ // RUN: -Xclang -internal-externc-isystem -Xclang /tmp/ \ -// RUN: -DFOO=BAR 2>&1 | FileCheck %s +// RUN: -DFOO=BAR -DBAR="BAZ QUX" 2>&1 | FileCheck %s // RUN: cat %t/crash-report-*.c | FileCheck --check-prefix=CHECKSRC %s // RUN: cat %t/crash-report-*.sh | FileCheck --check-prefix=CHECKSH %s // REQUIRES: crash-recovery @@ -19,10 +19,14 @@ FOO // CHECKSRC: FOO // CHECKSH: # Crash reproducer +// CHECKSH-NEXT: # Driver args: "-fsyntax-only" +// CHECKSH-SAME: "-D" "FOO=BAR" +// CHECKSH-SAME: "-D" "BAR=BAZ QUX" // CHECKSH-NEXT: # Original command: {{.*$}} // CHECKSH-NEXT: "-cc1" // CHECKSH: "-main-file-name" "crash-report.c" // CHECKSH: "-D" "FOO=BAR" +// CHECKSH: "-D" "BAR=BAZ QUX" // CHECKSH-NOT: "-F/tmp/" // CHECKSH-NOT: "-I" "/tmp/" // CHECKSH-NOT: "-idirafter" "/tmp/" diff --git a/test/Driver/cuda-options.cu b/test/Driver/cuda-options.cu new file mode 100644 index 000000000000..90bdea4499c8 --- /dev/null +++ b/test/Driver/cuda-options.cu @@ -0,0 +1,111 @@ +// Tests CUDA compilation pipeline construction in Driver. +// REQUIRES: clang-driver +// REQUIRES: x86-registered-target +// REQUIRES: nvptx-registered-target + +// Simple compilation case: +// RUN: %clang -### -target=x86_64-linux-gnu -c %s 2>&1 \ +// Compile device-side to PTX assembly and make sure we use it on the host side. +// RUN: | FileCheck -check-prefix CUDA-D1 \ +// Then compile host side and incorporate device code. +// RUN: -check-prefix CUDA-H -check-prefix CUDA-H-I1 \ +// Make sure we don't link anything. +// RUN: -check-prefix CUDA-NL %s + +// Typical compilation + link case: +// RUN: %clang -### -target=x86_64-linux-gnu %s 2>&1 \ +// Compile device-side to PTX assembly and make sure we use it on the host side +// RUN: | FileCheck -check-prefix CUDA-D1 \ +// Then compile host side and incorporate device code. +// RUN: -check-prefix CUDA-H -check-prefix CUDA-H-I1 \ +// Then link things. +// RUN: -check-prefix CUDA-L %s + +// Verify that -cuda-no-device disables device-side compilation and linking +// RUN: %clang -### -target=x86_64-linux-gnu --cuda-host-only %s 2>&1 \ +// Make sure we didn't run device-side compilation. +// RUN: | FileCheck -check-prefix CUDA-ND \ +// Then compile host side and make sure we don't attempt to incorporate GPU code. +// RUN: -check-prefix CUDA-H -check-prefix CUDA-H-NI \ +// Make sure we don't link anything. +// RUN: -check-prefix CUDA-NL %s + +// Verify that -cuda-no-host disables host-side compilation and linking +// RUN: %clang -### -target=x86_64-linux-gnu --cuda-device-only %s 2>&1 \ +// Compile device-side to PTX assembly +// RUN: | FileCheck -check-prefix CUDA-D1 \ +// Make sure there are no host cmpilation or linking. +// RUN: -check-prefix CUDA-NH -check-prefix CUDA-NL %s + +// Verify that with -S we compile host and device sides to assembly +// and incorporate device code on the host side. +// RUN: %clang -### -target=x86_64-linux-gnu -S -c %s 2>&1 \ +// Compile device-side to PTX assembly +// RUN: | FileCheck -check-prefix CUDA-D1 \ +// Then compile host side and incorporate GPU code. +// RUN: -check-prefix CUDA-H -check-prefix CUDA-H-I1 \ +// Make sure we don't link anything. +// RUN: -check-prefix CUDA-NL %s + +// Verify that --cuda-gpu-arch option passes correct GPU +// archtecture info to device compilation. +// RUN: %clang -### -target=x86_64-linux-gnu --cuda-gpu-arch=sm_35 -c %s 2>&1 \ +// Compile device-side to PTX assembly. +// RUN: | FileCheck -check-prefix CUDA-D1 -check-prefix CUDA-D1-SM35 \ +// Then compile host side and incorporate GPU code. +// RUN: -check-prefix CUDA-H -check-prefix CUDA-H-I1 \ +// Make sure we don't link anything. +// RUN: -check-prefix CUDA-NL %s + +// Verify that there is device-side compilation per --cuda-gpu-arch args +// and that all results are included on the host side. +// RUN: %clang -### -target=x86_64-linux-gnu --cuda-gpu-arch=sm_35 --cuda-gpu-arch=sm_30 -c %s 2>&1 \ +// Compile both device-sides to PTX assembly +// RUN: | FileCheck \ +// RUN: -check-prefix CUDA-D1 -check-prefix CUDA-D1-SM35 \ +// RUN: -check-prefix CUDA-D2 -check-prefix CUDA-D2-SM30 \ +// Then compile host side and incorporate both device-side outputs +// RUN: -check-prefix CUDA-H -check-prefix CUDA-H-I1 -check-prefix CUDA-H-I2 \ +// Make sure we don't link anything. +// RUN: -check-prefix CUDA-NL %s + +// Match device-side compilation +// CUDA-D1: "-cc1" "-triple" "nvptx{{(64)?}}-nvidia-cuda" +// CUDA-D1-SAME: "-fcuda-is-device" +// CUDA-D1-SM35-SAME: "-target-cpu" "sm_35" +// CUDA-D1-SAME: "-o" "[[GPUBINARY1:[^"]*]]" +// CUDA-D1-SAME: "-x" "cuda" + +// Match anothe device-side compilation +// CUDA-D2: "-cc1" "-triple" "nvptx{{(64)?}}-nvidia-cuda" +// CUDA-D2-SAME: "-fcuda-is-device" +// CUDA-D2-SM30-SAME: "-target-cpu" "sm_30" +// CUDA-D2-SAME: "-o" "[[GPUBINARY2:[^"]*]]" +// CUDA-D2-SAME: "-x" "cuda" + +// Match no device-side compilation +// CUDA-ND-NOT: "-cc1" "-triple" "nvptx{{64?}}-nvidia-cuda" +// CUDA-ND-SAME-NOT: "-fcuda-is-device" + +// Match host-side compilation +// CUDA-H: "-cc1" "-triple" +// CUDA-H-SAME-NOT: "nvptx{{64?}}-nvidia-cuda" +// CUDA-H-SAME-NOT: "-fcuda-is-device" +// CUDA-H-SAME: "-o" "[[HOSTOBJ:[^"]*]]" +// CUDA-H-SAME: "-x" "cuda" +// CUDA-H-I1-SAME: "-fcuda-include-gpubinary" "[[GPUBINARY1]]" +// CUDA-H-I2-SAME: "-fcuda-include-gpubinary" "[[GPUBINARY2]]" + +// Match no GPU code inclusion. +// CUDA-H-NI-NOT: "-fcuda-include-gpubinary" + +// Match no CUDA compilation +// CUDA-NH-NOT: "-cc1" "-triple" +// CUDA-NH-SAME-NOT: "-x" "cuda" + +// Match linker +// CUDA-L: "{{.*}}{{ld|link}}{{(.exe)?}}" +// CUDA-L-SAME: "[[HOSTOBJ]]" + +// Match no linker +// CUDA-NL-NOT: "{{.*}}{{ld|link}}{{(.exe)?}}" diff --git a/test/Driver/fsanitize.c b/test/Driver/fsanitize.c index 96d078101695..15b438332730 100644 --- a/test/Driver/fsanitize.c +++ b/test/Driver/fsanitize.c @@ -122,6 +122,9 @@ // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-memory-track-origins=3 -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACK-ORIGINS-3 // CHECK-TRACK-ORIGINS-3: error: invalid value '3' in '-fsanitize-memory-track-origins=3' +// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-memory-use-after-dtor -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MSAN-USE-AFTER-DTOR +// CHECK-MSAN-USE-AFTER-DTOR: -cc1{{.*}}-fsanitize-memory-use-after-dtor + // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-address-field-padding=0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-FIELD-PADDING-0 // CHECK-ASAN-FIELD-PADDING-0-NOT: -fsanitize-address-field-padding // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-address-field-padding=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-FIELD-PADDING-1 @@ -246,6 +249,10 @@ // RUN: %clang -target x86_64-apple-darwin10 -mmacosx-version-min=10.7 -flto -fsanitize=cfi-vcall -fno-sanitize-trap=cfi -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-NOTRAP-OLD-MACOS // CHECK-CFI-NOTRAP-OLD-MACOS: error: unsupported option '-fno-sanitize-trap=cfi-vcall' for target 'x86_64-apple-darwin10' +// RUN: %clang -target x86_64-pc-win32 -flto -fsanitize=cfi-vcall -fno-sanitize-trap=cfi -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-NOTRAP-WIN +// CHECK-CFI-NOTRAP-WIN: -emit-llvm-bc +// CHECK-CFI-NOTRAP-WIN-NOT: -fsanitize-trap=cfi + // RUN: %clang_cl -fsanitize=address -c -MDd -### -- %s 2>&1 | FileCheck %s -check-prefix=CHECK-ASAN-DEBUGRTL // RUN: %clang_cl -fsanitize=address -c -MTd -### -- %s 2>&1 | FileCheck %s -check-prefix=CHECK-ASAN-DEBUGRTL // RUN: %clang_cl -fsanitize=address -c -LDd -### -- %s 2>&1 | FileCheck %s -check-prefix=CHECK-ASAN-DEBUGRTL diff --git a/test/Driver/nacl-direct.c b/test/Driver/nacl-direct.c index 9768eab24dce..5fe857622320 100644 --- a/test/Driver/nacl-direct.c +++ b/test/Driver/nacl-direct.c @@ -63,6 +63,29 @@ // CHECK-ARM: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}arm-nacl{{/|\\\\}}usr{{/|\\\\}}lib" // CHECK-ARM: "-Lfoo{{/|\\\\}}lib{{/|\\\\}}arm-nacl" // CHECK-ARM-NOT: -lpthread +// +// RUN: %clang -no-canonical-prefixes -### -o %t.o %s \ +// RUN: -target mipsel-unknown-nacl -resource-dir foo 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-MIPS %s +// CHECK-MIPS: {{.*}}clang{{.*}}" "-cc1" +// CHECK-MIPS: "-fuse-init-array" +// CHECK-MIPS: "-target-cpu" "mips32r2" +// CHECK-MIPS: "-target-abi" "o32" +// CHECK-MIPS: "-mfloat-abi" "hard" +// CHECK-MIPS: "-resource-dir" "foo" +// CHECK-MIPS: "-internal-isystem" "foo{{/|\\\\}}include" +// CHECK-MIPS: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}mipsel-nacl{{/|\\\\}}usr{{/|\\\\}}include" +// CHECK-MIPS: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}mipsel-nacl{{/|\\\\}}include" +// CHECK-MIPS-NOT: as{{(.exe)?}}" +// CHECK-MIPS: ld{{(.exe)?}}" +// CHECK-MIPS: "--build-id" +// CHECK-MIPS: "-m" "mipselelf_nacl" +// CHECK-MIPS: "-static" +// CHECK-MIPS: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}mipsel-nacl{{/|\\\\}}lib" +// CHECK-MIPS: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}mipsel-nacl{{/|\\\\}}usr{{/|\\\\}}lib" +// CHECK-MIPS: "-Lfoo{{/|\\\\}}lib{{/|\\\\}}mipsel-nacl" +// CHECK-MIPS: "-lpnacl_legacy" +// CHECK-MIPS-NOT: "-lpthread" // Check that even when the target arch is just "arm" (as will be the case when // it is inferred from the binary name) that we get the right ABI flags @@ -109,3 +132,15 @@ // CHECK-x86_64-CXX: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}x86_64-nacl{{/|\\\\}}usr{{/|\\\\}}include" // CHECK-x86_64-CXX: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}x86_64-nacl{{/|\\\\}}include" // CHECK-x86_64-CXX: "-lpthread" + +// RUN: %clangxx -no-canonical-prefixes -### -o %t.o %s \ +// RUN: -target mipsel-unknown-nacl -resource-dir foo 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-MIPS-CXX %s +// CHECK-MIPS-CXX: {{.*}}clang{{.*}}" "-cc1" +// CHECK-MIPS-CXX: "-resource-dir" "foo" +// CHECK-MIPS-CXX: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}mipsel-nacl{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1" +// CHECK-MIPS-CXX: "-internal-isystem" "foo{{/|\\\\}}include" +// CHECK-MIPS-CXX: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}mipsel-nacl{{/|\\\\}}usr{{/|\\\\}}include" +// CHECK-MIPS-CXX: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}mipsel-nacl{{/|\\\\}}include" +// CHECK-MIPS-CXX: "-lnacl" +// CHECK-MIPS-CXX: "-lpthread" diff --git a/test/Driver/ppc-abi.c b/test/Driver/ppc-abi.c index 3c7d7f136de7..958fd7741669 100644 --- a/test/Driver/ppc-abi.c +++ b/test/Driver/ppc-abi.c @@ -21,6 +21,8 @@ // RUN: -mabi=elfv1 | FileCheck -check-prefix=CHECK-ELFv1 %s // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 \ // RUN: -mabi=elfv2 | FileCheck -check-prefix=CHECK-ELFv2 %s +// RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 \ +// RUN: -mabi=altivec | FileCheck -check-prefix=CHECK-ELFv2 %s // CHECK-ELFv1: "-target-abi" "elfv1" // CHECK-ELFv1-QPX: "-target-abi" "elfv1-qpx" diff --git a/test/Driver/ppc-dependent-options.cpp b/test/Driver/ppc-dependent-options.cpp new file mode 100644 index 000000000000..b4dcaf6d9bf0 --- /dev/null +++ b/test/Driver/ppc-dependent-options.cpp @@ -0,0 +1,62 @@ +// REQUIRES: powerpc-registered-target +// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \ +// RUN: -mcpu=power8 -std=c++11 %s 2>&1 | FileCheck %s \ +// RUN: -check-prefix=CHECK-DEFAULT + +// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \ +// RUN: -mcpu=power8 -std=c++11 -mno-vsx -mpower8-vector %s 2>&1 | \ +// RUN: FileCheck %s -check-prefix=CHECK-NVSX-P8V + +// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \ +// RUN: -mcpu=power8 -std=c++11 -mno-vsx -mdirect-move %s 2>&1 | FileCheck %s \ +// RUN: -check-prefix=CHECK-NVSX-DMV + +// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \ +// RUN: -mcpu=power8 -std=c++11 -mno-vsx -mpower8-vector -mvsx %s 2>&1 | \ +// RUN: FileCheck %s -check-prefix=CHECK-DEFAULT + +// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \ +// RUN: -mcpu=power8 -std=c++11 -mno-vsx -mdirect-move -mvsx %s 2>&1 | \ +// RUN: FileCheck %s -check-prefix=CHECK-DEFAULT + +// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \ +// RUN: -mcpu=power8 -std=c++11 -mpower8-vector -mno-vsx %s 2>&1 | \ +// RUN: FileCheck %s -check-prefix=CHECK-NVSX-P8V + +// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \ +// RUN: -mcpu=power8 -std=c++11 -mdirect-move -mno-vsx %s 2>&1 | FileCheck %s \ +// RUN: -check-prefix=CHECK-NVSX-DMV + +// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \ +// RUN: -mcpu=power8 -std=c++11 -mno-vsx %s 2>&1 | FileCheck %s \ +// RUN: -check-prefix=CHECK-NVSX + +// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \ +// RUN: -mcpu=power6 -std=c++11 %s 2>&1 | FileCheck %s -check-prefix=CHECK-NVSX + +// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \ +// RUN: -mcpu=power6 -std=c++11 -mpower8-vector %s 2>&1 | FileCheck %s \ +// RUN: -check-prefix=CHECK-DEFAULT + +// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \ +// RUN: -mcpu=power6 -std=c++11 -mdirect-move %s 2>&1 | FileCheck %s \ +// RUN: -check-prefix=CHECK-VSX + +#ifdef __VSX__ +static_assert(false, "VSX enabled"); +#endif + +#ifdef __POWER8_VECTOR__ +static_assert(false, "P8V enabled"); +#endif + +#if !defined(__VSX__) && !defined(__POWER8_VECTOR__) +static_assert(false, "Neither enabled"); +#endif + +// CHECK-DEFAULT: VSX enabled +// CHECK-DEFAULT: P8V enabled +// CHECK-NVSX-P8V: error: option '-mpower8-vector' cannot be specified with '-mno-vsx' +// CHECK-NVSX-DMV: error: option '-mdirect-move' cannot be specified with '-mno-vsx' +// CHECK-NVSX: Neither enabled +// CHECK-VSX: VSX enabled diff --git a/test/Driver/ppc-endian.c b/test/Driver/ppc-endian.c new file mode 100644 index 000000000000..4d8db38943b2 --- /dev/null +++ b/test/Driver/ppc-endian.c @@ -0,0 +1,9 @@ +// RUN: %clang -target powerpc64le -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-LE %s +// RUN: %clang -target powerpc64le -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-LE %s +// RUN: %clang -target powerpc64 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-LE %s +// CHECK-LE: "-cc1"{{.*}} "-triple" "powerpc64le{{.*}}" + +// RUN: %clang -target powerpc64 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE %s +// RUN: %clang -target powerpc64 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE %s +// RUN: %clang -target powerpc64le -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE %s +// CHECK-BE: "-cc1"{{.*}} "-triple" "powerpc64{{.*}}" diff --git a/test/Driver/ppc-features.cpp b/test/Driver/ppc-features.cpp index 8ef83184693b..947183c61f70 100644 --- a/test/Driver/ppc-features.cpp +++ b/test/Driver/ppc-features.cpp @@ -142,4 +142,8 @@ // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK_LE_LD_ARGS %s // CHECK_LE_LD_ARGS: "elf64lppc" - +// OpenMP features +// RUN: %clang -target powerpc-unknown-linux-gnu %s -### -fopenmp=libomp -o %t.o 2>&1 | FileCheck -check-prefix=CHECK_OPENMP_TLS %s +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -fopenmp=libomp -o %t.o 2>&1 | FileCheck -check-prefix=CHECK_OPENMP_TLS %s +// RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -fopenmp=libomp -o %t.o 2>&1 | FileCheck -check-prefix=CHECK_OPENMP_TLS %s +// CHECK_OPENMP_TLS-NOT: "-fnoopenmp-use-tls" diff --git a/test/Frontend/ast-codegen.c b/test/Frontend/ast-codegen.c index b85c5dcf5085..4a3f8a3b79fd 100644 --- a/test/Frontend/ast-codegen.c +++ b/test/Frontend/ast-codegen.c @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target // RUN: %clang -target i386-unknown-unknown -emit-ast -o %t.ast %s // RUN: %clang -target i386-unknown-unknown -emit-llvm -S -o - %t.ast | FileCheck %s diff --git a/test/Headers/xmmintrin.c b/test/Headers/xmmintrin.c index 5bf5d4a56683..39743c96b783 100644 --- a/test/Headers/xmmintrin.c +++ b/test/Headers/xmmintrin.c @@ -4,7 +4,7 @@ // RUN: %clang_cc1 %s -ffreestanding -triple x86_64-apple-macosx10.9.0 -emit-llvm -o - \ // RUN: -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -isystem %S/Inputs/include \ // RUN: | FileCheck %s - +// REQUIRES: x86-registered-target #include <xmmintrin.h> // Make sure the last step of _mm_cvtps_pi16 converts <4 x i32> to <4 x i16> by diff --git a/test/Index/TestClassForwardDecl.m b/test/Index/TestClassForwardDecl.m index 9696a280661d..284406f6446f 100644 --- a/test/Index/TestClassForwardDecl.m +++ b/test/Index/TestClassForwardDecl.m @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fblocks -emit-pch -x objective-c %s -o %t.ast // RUN: c-index-test -test-file-scan %t.ast %s | FileCheck -check-prefix=CHECK-scan %s // RUN: c-index-test -test-load-tu %t.ast local | FileCheck -check-prefix=CHECK-load %s - +// REQUIRES: x86-registered-target // This test checks how the @class resolves as a cursor when the @interface is implicitly defined. // See TestClassDecl.m for the corresponding test case. (<rdar://problem/7383421>) diff --git a/test/Index/annotate-parameterized-classes.m b/test/Index/annotate-parameterized-classes.m new file mode 100644 index 000000000000..762ae2aece13 --- /dev/null +++ b/test/Index/annotate-parameterized-classes.m @@ -0,0 +1,38 @@ +@protocol NSObject +@end + +@interface NSObject +@end + +@interface A<T : id, U : NSObject *> : NSObject +@end + +@interface A<T : id, U : NSObject *> (Cat1) +@end + +typedef A<id<NSObject>, NSObject *> ASpecialization1; + +@interface B<T : id, U : NSObject *> : A<T, U> +@end + +// RUN: c-index-test -test-annotate-tokens=%s:7:1:9:1 %s -target x86_64-apple-macosx10.7.0 | FileCheck -check-prefix=CHECK-INTERFACE-DECL %s +// CHECK-INTERFACE-DECL: Identifier: "T" [7:14 - 7:15] TemplateTypeParameter=T:7:14 +// CHECK-INTERFACE-DECL: Identifier: "id" [7:18 - 7:20] TypeRef=id:0:0 +// CHECK-INTERFACE-DECL: Identifier: "U" [7:22 - 7:23] TemplateTypeParameter=U:7:22 +// CHECK-INTERFACE-DECL: Identifier: "NSObject" [7:26 - 7:34] ObjCClassRef=NSObject:4:12 + +// RUN: c-index-test -test-annotate-tokens=%s:10:1:12:1 %s -target x86_64-apple-macosx10.7.0 | FileCheck -check-prefix=CHECK-CATEGORY-DECL %s +// CHECK-CATEGORY-DECL: Identifier: "T" [10:14 - 10:15] TemplateTypeParameter=T:10:14 +// CHECK-CATEGORY-DECL: Identifier: "id" [10:18 - 10:20] TypeRef=id:0:0 +// CHECK-CATEGORY-DECL: Identifier: "U" [10:22 - 10:23] TemplateTypeParameter=U:10:22 +// CHECK-CATEGORY-DECL: Identifier: "NSObject" [10:26 - 10:34] ObjCClassRef=NSObject:4:12 + +// RUN: c-index-test -test-annotate-tokens=%s:13:1:14:1 %s -target x86_64-apple-macosx10.7.0 | FileCheck -check-prefix=CHECK-SPECIALIZATION %s +// CHECK-SPECIALIZATION: Identifier: "id" [13:11 - 13:13] TypeRef=id:0:0 +// CHECK-SPECIALIZATION: Identifier: "NSObject" [13:14 - 13:22] ObjCProtocolRef=NSObject:1:11 +// CHECK-SPECIALIZATION: Identifier: "NSObject" [13:25 - 13:33] ObjCClassRef=NSObject:4:12 + +// RUN: c-index-test -test-annotate-tokens=%s:15:1:16:1 %s -target x86_64-apple-macosx10.7.0 | FileCheck -check-prefix=CHECK-SUPER %s +// CHECK-SUPER: Identifier: "A" [15:40 - 15:41] ObjCSuperClassRef=A:7:12 +// CHECK-SUPER: Identifier: "T" [15:42 - 15:43] TypeRef=T:15:14 +// CHECK-SUPER: Identifier: "U" [15:45 - 15:46] TypeRef=U:15:22 diff --git a/test/Index/annotate-tokens.m b/test/Index/annotate-tokens.m index 9a7e28a666bf..0a76105a94d5 100644 --- a/test/Index/annotate-tokens.m +++ b/test/Index/annotate-tokens.m @@ -152,6 +152,7 @@ static Rdar8595462_A * Rdar8595462_staticVar; @property int extensionProperty; @end +typedef id<Proto> *proto_ptr; // RUN: c-index-test -test-annotate-tokens=%s:1:1:118:1 %s -DIBOutlet='__attribute__((iboutlet))' -DIBAction='void)__attribute__((ibaction)' | FileCheck %s // CHECK: Punctuation: "@" [1:1 - 1:2] ObjCInterfaceDecl=Foo:1:12 @@ -596,3 +597,9 @@ static Rdar8595462_A * Rdar8595462_staticVar; // CHECK-PROP: Keyword: "property" [152:4 - 152:12] ObjCPropertyDecl=extensionProperty:152:17 // CHECK-PROP: Keyword: "int" [152:13 - 152:16] ObjCPropertyDecl=extensionProperty:152:17 // CHECK-PROP: Identifier: "extensionProperty" [152:17 - 152:34] ObjCPropertyDecl=extensionProperty:152:17 + +// RUN: c-index-test -test-annotate-tokens=%s:155:1:156:1 %s -DIBOutlet='__attribute__((iboutlet))' -DIBAction='void)__attribute__((ibaction)' -target x86_64-apple-macosx10.7.0 | FileCheck -check-prefix=CHECK-ID-PROTO %s +// CHECK-ID-PROTO: Identifier: "id" [155:9 - 155:11] TypeRef=id:0:0 +// CHECK-ID-PROTO: Punctuation: "<" [155:11 - 155:12] TypedefDecl=proto_ptr:155:20 (Definition) +// CHECK-ID-PROTO: Identifier: "Proto" [155:12 - 155:17] ObjCProtocolRef=Proto +// CHECK-ID-PROTO: Punctuation: ">" [155:17 - 155:18] TypedefDecl=proto_ptr:155:20 (Definition) diff --git a/test/Index/attributes-cuda.cu b/test/Index/attributes-cuda.cu index 824bdb4c883f..51f4aedd198d 100644 --- a/test/Index/attributes-cuda.cu +++ b/test/Index/attributes-cuda.cu @@ -1,4 +1,6 @@ // RUN: c-index-test -test-load-source all -x cuda %s | FileCheck %s +// RUN: c-index-test -test-load-source all -x cuda --cuda-host-only %s | FileCheck %s +// RUN: c-index-test -test-load-source all -x cuda --cuda-device-only %s | FileCheck %s __attribute__((device)) void f_device(); __attribute__((global)) void f_global(); @@ -6,13 +8,13 @@ __attribute__((constant)) int* g_constant; __attribute__((shared)) float *g_shared; __attribute__((host)) void f_host(); -// CHECK: attributes-cuda.cu:3:30: FunctionDecl=f_device:3:30 -// CHECK-NEXT: attributes-cuda.cu:3:16: attribute(device) -// CHECK: attributes-cuda.cu:4:30: FunctionDecl=f_global:4:30 -// CHECK-NEXT: attributes-cuda.cu:4:16: attribute(global) -// CHECK: attributes-cuda.cu:5:32: VarDecl=g_constant:5:32 (Definition) -// CHECK-NEXT: attributes-cuda.cu:5:16: attribute(constant) -// CHECK: attributes-cuda.cu:6:32: VarDecl=g_shared:6:32 (Definition) -// CHECK-NEXT: attributes-cuda.cu:6:16: attribute(shared) -// CHECK: attributes-cuda.cu:7:28: FunctionDecl=f_host:7:28 -// CHECK-NEXT: attributes-cuda.cu:7:16: attribute(host) +// CHECK: attributes-cuda.cu:5:30: FunctionDecl=f_device:5:30 +// CHECK-NEXT: attributes-cuda.cu:5:16: attribute(device) +// CHECK: attributes-cuda.cu:6:30: FunctionDecl=f_global:6:30 +// CHECK-NEXT: attributes-cuda.cu:6:16: attribute(global) +// CHECK: attributes-cuda.cu:7:32: VarDecl=g_constant:7:32 (Definition) +// CHECK-NEXT: attributes-cuda.cu:7:16: attribute(constant) +// CHECK: attributes-cuda.cu:8:32: VarDecl=g_shared:8:32 (Definition) +// CHECK-NEXT: attributes-cuda.cu:8:16: attribute(shared) +// CHECK: attributes-cuda.cu:9:28: FunctionDecl=f_host:9:28 +// CHECK-NEXT: attributes-cuda.cu:9:16: attribute(host) diff --git a/test/Index/c-index-api-loadTU-test.m b/test/Index/c-index-api-loadTU-test.m index c75d5ac6814e..cbd742b240b5 100644 --- a/test/Index/c-index-api-loadTU-test.m +++ b/test/Index/c-index-api-loadTU-test.m @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fblocks -emit-pch -x objective-c %s -o %t.ast // RUN: c-index-test -test-load-tu %t.ast all > %t 2>&1 && FileCheck --input-file=%t %s - +// REQUIRES: x86-registered-target @interface Foo { __attribute__((iboutlet)) id myoutlet; diff --git a/test/Index/c-index-getCursor-test.m b/test/Index/c-index-getCursor-test.m index c1799026cec9..f368f1f07433 100644 --- a/test/Index/c-index-getCursor-test.m +++ b/test/Index/c-index-getCursor-test.m @@ -166,3 +166,4 @@ void f() { // CHECK: [57:1 - 57:10] FunctionDecl=f:57:6 (Definition) // CHECK: [58:4 - 58:8] VarDecl=my_var:58:8 (Definition) // CHECK: [58:8 - 58:15] macro expansion=CONCAT:55:9 +// REQUIRES: x86-registered-target diff --git a/test/Index/comment-objc-parameterized-classes.m b/test/Index/comment-objc-parameterized-classes.m new file mode 100644 index 000000000000..5a928509dfe6 --- /dev/null +++ b/test/Index/comment-objc-parameterized-classes.m @@ -0,0 +1,19 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng -target x86_64-apple-darwin10 %s > %t/out +// RUN: FileCheck %s < %t/out + +// Ensure that XML we generate is not invalid. +// RUN: FileCheck %s -check-prefix=WRONG < %t/out +// WRONG-NOT: CommentXMLInvalid + +@protocol NSObject +@end + +@interface NSObject +@end + +// CHECK: <Declaration>@interface A <__covariant T : id, U : NSObject *> : NSObject +/// A +@interface A<__covariant T : id, U : NSObject *> : NSObject +@end diff --git a/test/Index/complete-blocks.m b/test/Index/complete-blocks.m index cb507e2be34e..046a08695d08 100644 --- a/test/Index/complete-blocks.m +++ b/test/Index/complete-blocks.m @@ -42,6 +42,14 @@ void test_D(D *d) { [d method6:0]; } +@interface I1 +- method7:(int (^_Nullable)(int x, int y))b; +@end +void f2(int (^_Nullable block)(int x, int y)); +void test_f2(I1 *o) { + [o method7:0]; +} + // RUN: c-index-test -code-completion-at=%s:8:1 %s | FileCheck -check-prefix=CHECK-CC1 %s // CHECK-CC1: FunctionDecl:{ResultType void}{TypedText f}{LeftParen (}{Placeholder ^int(int x, int y)block}{RightParen )} (50) // CHECK-CC1: FunctionDecl:{ResultType void}{TypedText g}{LeftParen (}{Placeholder ^(float f, double d)b}{RightParen )} (50) @@ -62,3 +70,7 @@ void test_D(D *d) { // RUN: c-index-test -code-completion-at=%s:42:6 %s | FileCheck -check-prefix=CHECK-CC6 %s // CHECK-CC6: ObjCInstanceMethodDecl:{ResultType id}{TypedText method6:}{Placeholder ^(block_t block)arg} (35) +// RUN: c-index-test -code-completion-at=%s:50:1 %s | FileCheck -check-prefix=CHECK-CC7 %s +// CHECK-CC7: FunctionDecl:{ResultType void}{TypedText f2}{LeftParen (}{Placeholder ^int(int x, int y)block}{RightParen )} (50) +// RUN: c-index-test -code-completion-at=%s:50:6 %s | FileCheck -check-prefix=CHECK-CC8 %s +// CHECK-CC8: ObjCInstanceMethodDecl:{ResultType id}{TypedText method7:}{Placeholder ^int(int x, int y)b} (35) diff --git a/test/Index/complete-ctor-inits.cpp b/test/Index/complete-ctor-inits.cpp index f50621466f1e..96f36b65e3d0 100644 --- a/test/Index/complete-ctor-inits.cpp +++ b/test/Index/complete-ctor-inits.cpp @@ -17,6 +17,18 @@ struct Z : public X<int>, public Y { Z::Z() : ::X<int>(0), Virt(), b(), c() { } +struct PR23948 { + template<class size> PR23948() + : + {} + + template<class size> void invalid() + : + {} + + int a; +}; + // RUN: c-index-test -code-completion-at=%s:18:10 %s | FileCheck -check-prefix=CHECK-CC1 %s // CHECK-CC1: MemberRef:{TypedText a}{LeftParen (}{Placeholder args}{RightParen )} (35) // CHECK-CC1: MemberRef:{TypedText b}{LeftParen (}{Placeholder args}{RightParen )} (35) @@ -38,3 +50,7 @@ Z::Z() : ::X<int>(0), Virt(), b(), c() { } // CHECK-CC3: MemberRef:{TypedText c}{LeftParen (}{Placeholder args}{RightParen )} (7) // CHECK-CC3-NOT: NotImplemented:{TypedText Virt}{LeftParen (}{Placeholder args}{RightParen )} // CHECK-CC3: NotImplemented:{TypedText Y}{LeftParen (}{Placeholder args}{RightParen )} (35) + +// RUN: c-index-test -code-completion-at=%s:22:10 -target i386-apple-darwin %s | FileCheck -check-prefix=CHECK-CC4 %s +// CHECK-CC4: MemberRef:{TypedText a}{LeftParen (}{Placeholder args}{RightParen )} (7) +// RUN: c-index-test -code-completion-at=%s:26:10 %s diff --git a/test/Index/complete-method-decls.m b/test/Index/complete-method-decls.m index 0e3780ba3d5f..e45d68f97087 100644 --- a/test/Index/complete-method-decls.m +++ b/test/Index/complete-method-decls.m @@ -90,7 +90,18 @@ typedef A *MyObjectRef; @end @implementation I2 -- +-(void)foo {} +@end + +#pragma clang assume_nonnull begin +@interface I3 +-(I3 *)produceI3:(I3 *)i3; +-(instancetype)getI3; +@end +#pragma clang assume_nonnull end + +@implementation I3 +-(void)foo {} @end // RUN: c-index-test -code-completion-at=%s:17:3 %s | FileCheck -check-prefix=CHECK-CC1 %s @@ -208,9 +219,12 @@ typedef A *MyObjectRef; // RUN: c-index-test -code-completion-at=%s:85:2 %s | FileCheck -check-prefix=CHECK-CLASSTY %s // CHECK-CLASSTY: ObjCInstanceMethodDecl:{LeftParen (}{Text Class<P1>}{RightParen )}{TypedText meth} -// FIXME: It should be "MyObject <P1> *"" -// CHECK-CLASSTY: ObjCInstanceMethodDecl:{LeftParen (}{Text A<P1> *}{RightParen )}{TypedText meth2} +// CHECK-CLASSTY: ObjCInstanceMethodDecl:{LeftParen (}{Text MyObject<P1> *}{RightParen )}{TypedText meth2} // CHECK-CLASSTY: ObjCInstanceMethodDecl:{LeftParen (}{Text MyObjectRef}{RightParen )}{TypedText meth3} // RUN: c-index-test -code-completion-at=%s:93:2 %s | FileCheck -check-prefix=CHECK-NULLABILITY %s // CHECK-NULLABILITY: ObjCInstanceMethodDecl:{LeftParen (}{Text nonnull }{Text I2 *}{RightParen )}{TypedText produceI2}{TypedText :}{LeftParen (}{Text nullable }{Text I2 *}{RightParen )}{Text i2} (40) + +// RUN: c-index-test -code-completion-at=%s:104:2 %s | FileCheck -check-prefix=CHECK-NULLABILITY2 %s +// CHECK-NULLABILITY2: ObjCInstanceMethodDecl:{LeftParen (}{Text nonnull }{Text instancetype}{RightParen )}{TypedText getI3} (40) +// CHECK-NULLABILITY2: ObjCInstanceMethodDecl:{LeftParen (}{Text nonnull }{Text I3 *}{RightParen )}{TypedText produceI3}{TypedText :}{LeftParen (}{Text nonnull }{Text I3 *}{RightParen )}{Text i3} (40) diff --git a/test/Index/complete-parameterized-classes.m b/test/Index/complete-parameterized-classes.m new file mode 100644 index 000000000000..70d85885e3b7 --- /dev/null +++ b/test/Index/complete-parameterized-classes.m @@ -0,0 +1,79 @@ +@protocol NSObject +@end + +@interface NSObject +@end + +@interface Test<T : id, U : NSObject *> : NSObject +{ +@public + U myVar; +} +-(U)getit:(T)val; +-(void)apply:(void(^)(T, U))block; +-(void)apply2:(void(^_Nonnull)(T, U))block; + +@property (strong) T prop; +@end + +@interface MyClsA : NSObject +@end +@interface MyClsB : NSObject +@end + +void test1(Test<MyClsA*, MyClsB*> *obj) { + [obj ]; + obj.; + obj->; +} + +void test2(Test *obj) { + [obj ]; + obj.; + obj->; +} + +@implementation Test +-(id)getit:(id)val {} +@end + +void test3() { + Test<> t; + NSObject<> n; +} + +// RUN: c-index-test -code-completion-at=%s:25:8 %s | FileCheck -check-prefix=CHECK-CC0 %s +// CHECK-CC0: ObjCInstanceMethodDecl:{ResultType void}{TypedText apply2:}{Placeholder ^(MyClsA *, MyClsB *)block} (35) +// CHECK-CC0: ObjCInstanceMethodDecl:{ResultType void}{TypedText apply:}{Placeholder ^(MyClsA *, MyClsB *)block} (35) +// CHECK-CC0: ObjCInstanceMethodDecl:{ResultType MyClsB *}{TypedText getit:}{Placeholder (MyClsA *)} (35) + +// RUN: c-index-test -code-completion-at=%s:26:7 %s | FileCheck -check-prefix=CHECK-CC1 %s +// CHECK-CC1: ObjCPropertyDecl:{ResultType MyClsA *}{TypedText prop} (35) + +// RUN: c-index-test -code-completion-at=%s:27:8 %s | FileCheck -check-prefix=CHECK-CC2 %s +// CHECK-CC2: ObjCIvarDecl:{ResultType MyClsB *}{TypedText myVar} (35) + +// RUN: c-index-test -code-completion-at=%s:31:8 %s | FileCheck -check-prefix=CHECK-CC3 %s +// CHECK-CC3: ObjCInstanceMethodDecl:{ResultType void}{TypedText apply2:}{Placeholder ^(id, NSObject *)block} (35) +// CHECK-CC3: ObjCInstanceMethodDecl:{ResultType void}{TypedText apply:}{Placeholder ^(id, NSObject *)block} (35) +// CHECK-CC3: ObjCInstanceMethodDecl:{ResultType __kindof NSObject *}{TypedText getit:}{Placeholder (id)} (35) + +// RUN: c-index-test -code-completion-at=%s:32:7 %s | FileCheck -check-prefix=CHECK-CC4 %s +// CHECK-CC4: ObjCPropertyDecl:{ResultType id}{TypedText prop} (35) + +// RUN: c-index-test -code-completion-at=%s:33:8 %s | FileCheck -check-prefix=CHECK-CC5 %s +// CHECK-CC5: ObjCIvarDecl:{ResultType __kindof NSObject *}{TypedText myVar} (35) + +// RUN: c-index-test -code-completion-at=%s:37:2 %s | FileCheck -check-prefix=CHECK-CC6 %s +// CHECK-CC6: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText apply2}{TypedText :}{LeftParen (}{Text void (^ _Nonnull)(id, NSObject *)}{RightParen )}{Text block} (40) +// CHECK-CC6: ObjCInstanceMethodDecl:{LeftParen (}{Text void}{RightParen )}{TypedText apply}{TypedText :}{LeftParen (}{Text void (^)(id, NSObject *)}{RightParen )}{Text block} (40) +// CHECK-CC6: ObjCInstanceMethodDecl:{LeftParen (}{Text NSObject *}{RightParen )}{TypedText getit}{TypedText :}{LeftParen (}{Text id}{RightParen )}{Text val} (40) +// CHECK-CC6: ObjCInstanceMethodDecl:{LeftParen (}{Text id}{RightParen )}{TypedText prop} (40) + +// RUN: c-index-test -code-completion-at=%s:41:8 %s | FileCheck -check-prefix=CHECK-CC7 %s +// CHECK-CC7: ObjCInterfaceDecl:{TypedText MyClsA} +// RUN: c-index-test -code-completion-at=%s:42:12 %s > %t.out +// RUN: FileCheck -input-file=%t.out -check-prefix=CHECK-CC8 %s +// RUN: FileCheck -input-file=%t.out -check-prefix=CHECK-CC9 %s +// CHECK-CC8: ObjCProtocolDecl:{TypedText NSObject} +// CHECK-CC9-NOT: ObjCInterfaceDecl:{TypedText MyClsA} diff --git a/test/Index/index-file.cu b/test/Index/index-file.cu new file mode 100644 index 000000000000..26b93f069457 --- /dev/null +++ b/test/Index/index-file.cu @@ -0,0 +1,9 @@ +// Make sure we can process CUDA file even if driver creates multiple jobs +// RUN: c-index-test -test-load-source all %s | FileCheck %s -check-prefix=CHECK-ANY +// Make sure we process correct side of cuda compilation +// RUN: c-index-test -test-load-source all --cuda-host-only %s | FileCheck %s -check-prefix=CHECK-HOST +// RUN: c-index-test -test-load-source all --cuda-device-only %s | FileCheck %s -check-prefix=CHECK-DEVICE + +// CHECK-ANY: macro definition=__cplusplus +// CHECK-HOST-NOT: macro definition=__CUDA_ARCH__ +// CHECK-DEVICE: macro definition=__CUDA_ARCH__ diff --git a/test/Index/pch-with-module.m b/test/Index/pch-with-module.m index e839c811dab6..77262d5eb6d1 100644 --- a/test/Index/pch-with-module.m +++ b/test/Index/pch-with-module.m @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target // RUN: rm -rf %t.cache // RUN: c-index-test -write-pch %t.h.pch %s -target x86_64-apple-macosx10.7 -fobjc-arc -fmodules-cache-path=%t.cache -fmodules -F %S/../Modules/Inputs -Xclang -fdisable-module-hash // RUN: %clang -fsyntax-only %s -target x86_64-apple-macosx10.7 -include %t.h -fobjc-arc -fmodules-cache-path=%t.cache -fmodules -F %S/../Modules/Inputs \ diff --git a/test/Index/print-mangled-name.cpp b/test/Index/print-mangled-name.cpp index b7e79c3f6d65..d4edc5ff3921 100644 --- a/test/Index/print-mangled-name.cpp +++ b/test/Index/print-mangled-name.cpp @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target // RUN: %clang_cc1 -triple i686-pc-linux-gnu -emit-pch %s -o %t_linux.ast // RUN: c-index-test -test-print-mangle %t_linux.ast | FileCheck %s --check-prefix=ITANIUM diff --git a/test/Modules/Inputs/diagnostics-aux-2.modulemap b/test/Modules/Inputs/diagnostics-aux-2.modulemap new file mode 100644 index 000000000000..8ceeb8ebdfc9 --- /dev/null +++ b/test/Modules/Inputs/diagnostics-aux-2.modulemap @@ -0,0 +1,3 @@ +module external { + blahblah +} diff --git a/test/Modules/Inputs/diagnostics-aux.modulemap b/test/Modules/Inputs/diagnostics-aux.modulemap index d067d04d3d6a..2c6ecb93aa96 100644 --- a/test/Modules/Inputs/diagnostics-aux.modulemap +++ b/test/Modules/Inputs/diagnostics-aux.modulemap @@ -1 +1,3 @@ module foo {} + +extern module external "diagnostics-aux-2.modulemap" diff --git a/test/Modules/Inputs/explicit-build-prefer-self/map b/test/Modules/Inputs/explicit-build-prefer-self/map index 26be8e690736..042b2ae5b507 100644 --- a/test/Modules/Inputs/explicit-build-prefer-self/map +++ b/test/Modules/Inputs/explicit-build-prefer-self/map @@ -1,2 +1,2 @@ -module a { header "a.h" header "x.h" } -module b { header "b.h" header "x.h" } +module a { module h { header "a.h" } module x { header "x.h" } } +module b { module h { header "b.h" } module x { header "x.h" } } diff --git a/test/Modules/Inputs/merge-template-pattern-visibility/a.h b/test/Modules/Inputs/merge-template-pattern-visibility/a.h new file mode 100644 index 000000000000..7f9b6497e725 --- /dev/null +++ b/test/Modules/Inputs/merge-template-pattern-visibility/a.h @@ -0,0 +1,5 @@ +template<typename, typename = int> struct A; +template<typename T> struct B; + +template<typename, typename> struct A {}; +template<typename T> struct B : A<T> {}; diff --git a/test/Modules/Inputs/merge-template-pattern-visibility/b.h b/test/Modules/Inputs/merge-template-pattern-visibility/b.h new file mode 100644 index 000000000000..5ed18e7e7c5d --- /dev/null +++ b/test/Modules/Inputs/merge-template-pattern-visibility/b.h @@ -0,0 +1,9 @@ +template<typename, typename = int> struct A; +template<typename T> struct B; + +template<typename, typename> struct A {}; +template<typename T> struct B : A<T> {}; + +inline void f() { + B<int> bi; +} diff --git a/test/Modules/Inputs/merge-template-pattern-visibility/module.modulemap b/test/Modules/Inputs/merge-template-pattern-visibility/module.modulemap new file mode 100644 index 000000000000..ba97abbaa8ec --- /dev/null +++ b/test/Modules/Inputs/merge-template-pattern-visibility/module.modulemap @@ -0,0 +1,4 @@ +module X { + module A { header "a.h" } + module B { header "b.h" } +} diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map index ffaa53e18e28..904c65c2dbf4 100644 --- a/test/Modules/Inputs/module.map +++ b/test/Modules/Inputs/module.map @@ -336,3 +336,14 @@ module ImportNameInDir { header "ImportNameInDir.h" export * } + +module RequiresWithMissingHeader { + module HeaderBefore { + header "RequiresWithMissingHeader-Missing1.h" + requires missing + } + module HeaderAfter { + requires missing + header "RequiresWithMissingHeader-Missing2.h" + } +} diff --git a/test/Modules/Inputs/multiple-include/a.h b/test/Modules/Inputs/multiple-include/a.h new file mode 100644 index 000000000000..826619085888 --- /dev/null +++ b/test/Modules/Inputs/multiple-include/a.h @@ -0,0 +1 @@ +#include "x.h" diff --git a/test/Modules/Inputs/multiple-include/b.h b/test/Modules/Inputs/multiple-include/b.h new file mode 100644 index 000000000000..f56ab64da6b1 --- /dev/null +++ b/test/Modules/Inputs/multiple-include/b.h @@ -0,0 +1,3 @@ +#pragma clang __debug macro C_H +#include "c.h" +inline int get() { return c; } diff --git a/test/Modules/Inputs/multiple-include/c.h b/test/Modules/Inputs/multiple-include/c.h new file mode 100644 index 000000000000..4e7d4b742dc3 --- /dev/null +++ b/test/Modules/Inputs/multiple-include/c.h @@ -0,0 +1,4 @@ +#ifndef C_H +#define C_H +extern int c; +#endif diff --git a/test/Modules/Inputs/multiple-include/module.modulemap b/test/Modules/Inputs/multiple-include/module.modulemap new file mode 100644 index 000000000000..1228ae6cbb73 --- /dev/null +++ b/test/Modules/Inputs/multiple-include/module.modulemap @@ -0,0 +1,2 @@ +module A { module a { header "a.h" } module b { header "b.h" } module c { header "c.h" } } +module X { module x { header "x.h" } module c { header "c.h" } } diff --git a/test/Modules/Inputs/multiple-include/x.h b/test/Modules/Inputs/multiple-include/x.h new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/test/Modules/Inputs/multiple-include/x.h diff --git a/test/Modules/Inputs/namespaces-left.h b/test/Modules/Inputs/namespaces-left.h index 787fe753fba9..5badf62764b6 100644 --- a/test/Modules/Inputs/namespaces-left.h +++ b/test/Modules/Inputs/namespaces-left.h @@ -71,3 +71,5 @@ namespace N12 { } Foo *getFoo(); } + +namespace Empty {} diff --git a/test/Modules/Inputs/namespaces-right.h b/test/Modules/Inputs/namespaces-right.h index 77f54ead65ab..dd2ac33f9108 100644 --- a/test/Modules/Inputs/namespaces-right.h +++ b/test/Modules/Inputs/namespaces-right.h @@ -66,3 +66,5 @@ namespace N12 { } void consumeFoo(Foo*); } + +namespace Empty {} diff --git a/test/Modules/Inputs/namespaces-top.h b/test/Modules/Inputs/namespaces-top.h index 7bf5394f55be..006b53c8fd28 100644 --- a/test/Modules/Inputs/namespaces-top.h +++ b/test/Modules/Inputs/namespaces-top.h @@ -21,3 +21,5 @@ namespace N13 { namespace AddAndReexportBeforeImport { int S; } + +namespace Empty {} diff --git a/test/Modules/Inputs/submodules-merge-defs/defs.h b/test/Modules/Inputs/submodules-merge-defs/defs.h index bda0567c93a3..07dfac7ee657 100644 --- a/test/Modules/Inputs/submodules-merge-defs/defs.h +++ b/test/Modules/Inputs/submodules-merge-defs/defs.h @@ -94,3 +94,6 @@ namespace MergeFunctionTemplateSpecializations { }; using xiq = X<int>::Q<int>; } + +enum ScopedEnum : int; +enum ScopedEnum : int { a, b, c }; diff --git a/test/Modules/compiler_builtins_arm.m b/test/Modules/compiler_builtins_arm.m index ccfceaa93f88..23efa4608aa0 100644 --- a/test/Modules/compiler_builtins_arm.m +++ b/test/Modules/compiler_builtins_arm.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -fsyntax-only -triple thumbv7-none-linux-gnueabihf -target-abi aapcs -target-cpu cortex-a8 -mfloat-abi hard -std=c99 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -D__need_wint_t %s -verify // expected-no-diagnostics - +// REQUIRES: arm-registered-target @import _Builtin_intrinsics.arm.neon; diff --git a/test/Modules/dependency-gen-inferred-map.m b/test/Modules/dependency-gen-inferred-map.m index cebfeea4f40b..053a653d1748 100644 --- a/test/Modules/dependency-gen-inferred-map.m +++ b/test/Modules/dependency-gen-inferred-map.m @@ -1,5 +1,6 @@ // Test that the virtual file "__inferred_module.map" doesn't show up as dependency. +// REQUIRES: x86-registered-target // RUN: rm -rf %t-mcp // RUN: %clang_cc1 -isysroot %S/Inputs/System -triple x86_64-apple-darwin10 -dependency-file %t.d -MT %s.o -F %S/Inputs -fsyntax-only -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-mcp %s // RUN: FileCheck %s < %t.d diff --git a/test/Modules/dependency-gen-pch.m b/test/Modules/dependency-gen-pch.m index 697b42947afa..4da054ff7dc8 100644 --- a/test/Modules/dependency-gen-pch.m +++ b/test/Modules/dependency-gen-pch.m @@ -1,5 +1,6 @@ // RUN: rm -rf %t-mcp // RUN: mkdir -p %t-mcp +// REQUIRES: x86-registered-target // RUN: %clang_cc1 -isysroot %S/Inputs/System -triple x86_64-apple-darwin10 -module-file-deps -dependency-file %t.d -MT %s.o -I %S/Inputs -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t-mcp -emit-pch -o %t.pch %s // RUN: FileCheck %s < %t.d diff --git a/test/Modules/diagnostics.modulemap b/test/Modules/diagnostics.modulemap index aef094d3bf64..3b5b6a5c0396 100644 --- a/test/Modules/diagnostics.modulemap +++ b/test/Modules/diagnostics.modulemap @@ -1,5 +1,8 @@ // RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodule-map-file=%S/Inputs/diagnostics-aux.modulemap -fmodule-map-file=%s -fsyntax-only -x c++ /dev/null 2>&1 | FileCheck %s +// CHECK: In file included from {{.*}}diagnostics-aux.modulemap:3: +// CHECK: diagnostics-aux-2.modulemap:2:3: error: expected + // PR22299: Ensure we can produce diagnostics for duplicate modules from -fmodule-map-file=. // // CHECK: diagnostics.modulemap:[[@LINE+2]]:8: error: redefinition of module 'foo' diff --git a/test/Modules/irgen.c b/test/Modules/irgen.c index f09cc7b5388f..b2eb8b5ce09a 100644 --- a/test/Modules/irgen.c +++ b/test/Modules/irgen.c @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target // RUN: rm -rf %t // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -fmodules-cache-path=%t -emit-module -fmodule-name=irgen -triple x86_64-apple-darwin10 %S/Inputs/module.map // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -fmodules-cache-path=%t -I %S/Inputs -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s diff --git a/test/Modules/linkage-merge.m b/test/Modules/linkage-merge.m index 955eb1aa95ea..e7b9e5cec136 100644 --- a/test/Modules/linkage-merge.m +++ b/test/Modules/linkage-merge.m @@ -16,8 +16,8 @@ static int f2(float); // okay: considered distinct extern int f3(float); // okay: considered distinct extern float v0; -// expected-error@-1{{redefinition of 'v0' with a different type: 'float' vs 'int'}} -// expected-note@Inputs/linkage-merge-sub.h:6{{previous definition is here}} +// expected-error@-1{{redeclaration of 'v0' with a different type: 'float' vs 'int'}} +// expected-note@Inputs/linkage-merge-sub.h:6{{previous declaration is here}} static float v1; static float v2; diff --git a/test/Modules/merge-target-features.cpp b/test/Modules/merge-target-features.cpp index 8b82c8a9789b..938715dd6b11 100644 --- a/test/Modules/merge-target-features.cpp +++ b/test/Modules/merge-target-features.cpp @@ -1,6 +1,6 @@ // RUN: rm -rf %t // RUN: cd %S -// +// REQUIRES: x86-registered-target // RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \ // RUN: -iquote Inputs/merge-target-features \ // RUN: -fno-implicit-modules \ diff --git a/test/Modules/merge-template-pattern-visibility.cpp b/test/Modules/merge-template-pattern-visibility.cpp new file mode 100644 index 000000000000..db759b5a46a1 --- /dev/null +++ b/test/Modules/merge-template-pattern-visibility.cpp @@ -0,0 +1,4 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fno-modules-error-recovery \ +// RUN: -fmodule-name=X -emit-module %S/Inputs/merge-template-pattern-visibility/module.modulemap -x c++ \ +// RUN: -fmodules-local-submodule-visibility diff --git a/test/Modules/multiple-include.cpp b/test/Modules/multiple-include.cpp new file mode 100644 index 000000000000..7cbeefc81782 --- /dev/null +++ b/test/Modules/multiple-include.cpp @@ -0,0 +1,5 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -I%S/Inputs/multiple-include -fmodules-cache-path=%t -fimplicit-module-maps -verify %s -fmodules-local-submodule-visibility +// expected-no-diagnostics +#include "b.h" +int c = get(); diff --git a/test/Modules/pch_container.m b/test/Modules/pch_container.m new file mode 100644 index 000000000000..095245bdc3a4 --- /dev/null +++ b/test/Modules/pch_container.m @@ -0,0 +1,17 @@ +@import DependsOnModule; +// REQUIRES: x86-registered-target +// RUN: rm -rf %t-MachO %t-ELF %t-ELF_SPLIT %t-COFF +// RUN: %clang_cc1 -triple=x86_64-apple-darwin -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t-MachO -F %S/Inputs %s +// RUN: %clang_cc1 -triple=x86_64-linux-elf -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t-ELF -F %S/Inputs %s +// RUN: %clang_cc1 -triple=x86_64-windows-coff -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t-COFF -F %S/Inputs %s + +// RUN: llvm-objdump -section-headers %t-MachO/DependsOnModule.pcm %t-ELF/DependsOnModule.pcm %t-COFF/DependsOnModule.pcm | FileCheck %s +// CHECK: file format Mach-O 64-bit x86-64 +// CHECK: __clangast {{[0-9a-f]+}} {{[0-9a-f]+}} DATA +// CHECK: file format ELF64-x86-64 +// CHECK: __clangast {{[0-9a-f]+}} {{[0-9a-f]+}} DATA +// CHECK: file format COFF-x86-64 +// CHECK: clangast {{[0-9a-f]+}} {{[0-9a-f]+}} + + +// RUN: %clang_cc1 -split-dwarf-file t-split.dwo -triple=x86_64-linux-elf -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t-ELF_SPLIT -F %S/Inputs %s -o %t-split.o diff --git a/test/Modules/requires.m b/test/Modules/requires.m index 155c6aec5dc4..1a013727108b 100644 --- a/test/Modules/requires.m +++ b/test/Modules/requires.m @@ -6,3 +6,7 @@ @import DependsOnModule.NotObjC; // expected-error{{module 'DependsOnModule.NotObjC' is incompatible with feature 'objc'}} @import DependsOnModule.CustomReq1; // OK @import DependsOnModule.CustomReq2; // expected-error{{module 'DependsOnModule.CustomReq2' requires feature 'custom_req2'}} + +@import RequiresWithMissingHeader; // OK +@import RequiresWithMissingHeader.HeaderBefore; // expected-error{{module 'RequiresWithMissingHeader.HeaderBefore' requires feature 'missing'}} +@import RequiresWithMissingHeader.HeaderAfter; // expected-error{{module 'RequiresWithMissingHeader.HeaderAfter' requires feature 'missing'}} diff --git a/test/Modules/self-import-header.m b/test/Modules/self-import-header.m index 9b4bd5dee520..83e5c0104d25 100644 --- a/test/Modules/self-import-header.m +++ b/test/Modules/self-import-header.m @@ -1,5 +1,5 @@ // rdar://13840148 - +// REQUIRES: x86-registered-target // RUN: rm -rf %t // RUN: %clang -fsyntax-only -isysroot %S/Inputs/System/usr/include -fmodules -fmodules-cache-path=%t \ // RUN: -target x86_64-darwin \ diff --git a/test/Modules/signal.m b/test/Modules/signal.m index 30059e935113..37a35506447d 100644 --- a/test/Modules/signal.m +++ b/test/Modules/signal.m @@ -1,4 +1,4 @@ -// REQUIRES: shell +// REQUIRES: crash-recovery,shell // RUN: rm -rf %t // Crash building module. diff --git a/test/Modules/submodules-merge-defs.cpp b/test/Modules/submodules-merge-defs.cpp index 92c784440b9e..016b8a8f47a7 100644 --- a/test/Modules/submodules-merge-defs.cpp +++ b/test/Modules/submodules-merge-defs.cpp @@ -69,6 +69,11 @@ J<> pre_j; // expected-error {{declaration of 'J' must be imported}} #endif // expected-note@defs.h:51 +{{here}} +ScopedEnum pre_scopedenum; // expected-error {{must be imported}} expected-error {{must use 'enum'}} +// expected-note@defs.h:99 {{here}} +enum ScopedEnum : int; +ScopedEnum pre_scopedenum_declared; // ok + // Make definitions from second module visible. #ifdef TEXTUAL #include "import-and-redefine.h" diff --git a/test/Modules/templates-2.mm b/test/Modules/templates-2.mm index 78d203ab42b4..9385119679cf 100644 --- a/test/Modules/templates-2.mm +++ b/test/Modules/templates-2.mm @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++11 -x objective-c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -verify %s -Wno-objc-root-class // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++11 -x objective-c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -emit-llvm %s -o - -Wno-objc-root-class | FileCheck %s // expected-no-diagnostics - +// REQUIRES: x86-registered-target @import templates_top; struct TestEmitDefaultedSpecialMembers { diff --git a/test/Modules/templates.mm b/test/Modules/templates.mm index 503f4bb459e0..4c6e4723a3bb 100644 --- a/test/Modules/templates.mm +++ b/test/Modules/templates.mm @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++11 -x objective-c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -verify %s -Wno-objc-root-class // RUN: %clang_cc1 -triple x86_64-linux-gnu -std=c++11 -x objective-c++ -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -emit-llvm %s -o - -Wno-objc-root-class | FileCheck %s // expected-no-diagnostics - +// REQUIRES: x86-registered-target @import templates_left; void testInlineRedeclEarly() { diff --git a/test/Modules/va_list.m b/test/Modules/va_list.m index d13b39b48f4a..aa140fb45cd4 100644 --- a/test/Modules/va_list.m +++ b/test/Modules/va_list.m @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target // RUN: rm -rf %t // RUN: %clang_cc1 -triple x86_64-apple-macosx10 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \ // RUN: -fmodules-ignore-macro=PREFIX -DPREFIX -I %S/Inputs/va_list \ diff --git a/test/OpenMP/atomic_capture_codegen.cpp b/test/OpenMP/atomic_capture_codegen.cpp index 12f2f3ac4e81..6dd9f7ab2a41 100644 --- a/test/OpenMP/atomic_capture_codegen.cpp +++ b/test/OpenMP/atomic_capture_codegen.cpp @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -fopenmp -x c -triple x86_64-apple-darwin10 -emit-pch -o %t %s // RUN: %clang_cc1 -fopenmp -x c -triple x86_64-apple-darwin10 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s // expected-no-diagnostics - +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER diff --git a/test/OpenMP/atomic_read_codegen.c b/test/OpenMP/atomic_read_codegen.c index efeec0302d34..fc47c82d8913 100644 --- a/test/OpenMP/atomic_read_codegen.c +++ b/test/OpenMP/atomic_read_codegen.c @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -fopenmp -x c -triple x86_64-apple-darwin10 -emit-pch -o %t %s // RUN: %clang_cc1 -fopenmp -x c -triple x86_64-apple-darwin10 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s // expected-no-diagnostics - +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER diff --git a/test/OpenMP/atomic_update_codegen.cpp b/test/OpenMP/atomic_update_codegen.cpp index b619a07200dc..df8b538ee165 100644 --- a/test/OpenMP/atomic_update_codegen.cpp +++ b/test/OpenMP/atomic_update_codegen.cpp @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -fopenmp -x c -triple x86_64-apple-darwin10 -emit-pch -o %t %s // RUN: %clang_cc1 -fopenmp -x c -triple x86_64-apple-darwin10 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s // expected-no-diagnostics - +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER diff --git a/test/OpenMP/atomic_write_codegen.c b/test/OpenMP/atomic_write_codegen.c index 0016dc86c36a..1ee26b078212 100644 --- a/test/OpenMP/atomic_write_codegen.c +++ b/test/OpenMP/atomic_write_codegen.c @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -fopenmp -x c -triple x86_64-apple-darwin10 -emit-pch -o %t %s // RUN: %clang_cc1 -fopenmp -x c -triple x86_64-apple-darwin10 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s // expected-no-diagnostics - +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER diff --git a/test/OpenMP/barrier_codegen.cpp b/test/OpenMP/barrier_codegen.cpp index 9e393ac83360..398b96f44e8a 100644 --- a/test/OpenMP/barrier_codegen.cpp +++ b/test/OpenMP/barrier_codegen.cpp @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -emit-pch -o %t %s // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s // expected-no-diagnostics - +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER diff --git a/test/OpenMP/cancel_codegen.cpp b/test/OpenMP/cancel_codegen.cpp new file mode 100644 index 000000000000..4bd85a22b1d9 --- /dev/null +++ b/test/OpenMP/cancel_codegen.cpp @@ -0,0 +1,95 @@ +// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s +// expected-no-diagnostics +// REQUIRES: x86-registered-target +#ifndef HEADER +#define HEADER + +int main (int argc, char **argv) { +// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num( +#pragma omp parallel +{ +#pragma omp cancel parallel + argv[0][0] = argc; +} +// CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call( +#pragma omp sections +{ +#pragma omp cancel sections +} +// CHECK: call i32 @__kmpc_single( +// CHECK-NOT: @__kmpc_cancel +// CHECK: call void @__kmpc_end_single( +// CHECK: call void @__kmpc_barrier(%ident_t* +#pragma omp sections +{ +#pragma omp cancel sections +#pragma omp section + { +#pragma omp cancel sections + } +} +// CHECK: call void @__kmpc_for_static_init_4( +// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancel(%ident_t* {{[^,]+}}, i32 [[GTID]], i32 3) +// CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0 +// CHECK: br i1 [[CMP]], label %[[EXIT:[^,].+]], label %[[CONTINUE:.+]] +// CHECK: [[EXIT]] +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* +// CHECK: br label +// CHECK: [[CONTINUE]] +// CHECK: br label +// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancel(%ident_t* {{[^,]+}}, i32 [[GTID]], i32 3) +// CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0 +// CHECK: br i1 [[CMP]], label %[[EXIT:[^,].+]], label %[[CONTINUE:.+]] +// CHECK: [[EXIT]] +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* +// CHECK: br label +// CHECK: [[CONTINUE]] +// CHECK: br label +// CHECK: call void @__kmpc_for_static_fini( +#pragma omp for +for (int i = 0; i < argc; ++i) { +#pragma omp cancel for +} +// CHECK: call void @__kmpc_for_static_init_4( +// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancel(%ident_t* {{[^,]+}}, i32 [[GTID]], i32 2) +// CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0 +// CHECK: br i1 [[CMP]], label %[[EXIT:[^,].+]], label %[[CONTINUE:.+]] +// CHECK: [[EXIT]] +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* +// CHECK: br label +// CHECK: [[CONTINUE]] +// CHECK: br label +// CHECK: call void @__kmpc_for_static_fini( +// CHECK: call void @__kmpc_barrier(%ident_t* +#pragma omp task +{ +#pragma omp cancel taskgroup +} +// CHECK: call i8* @__kmpc_omp_task_alloc( +// CHECK: call i32 @__kmpc_omp_task( + return argc; +} + +// CHECK: define internal void @{{[^(]+}}(i32* {{[^,]+}}, i32* {{[^,]+}}, +// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancel(%ident_t* {{[^,]+}}, i32 {{[^,]+}}, i32 1) +// CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0 +// CHECK: br i1 [[CMP]], label %[[EXIT:[^,]+]], +// CHECK: [[EXIT]] +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* +// CHECK: br label %[[RETURN:.+]] +// CHECK: [[RETURN]] +// CHECK: ret void + +// CHECK: define internal i32 @{{[^(]+}}(i32 +// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancel(%ident_t* {{[^,]+}}, i32 {{[^,]+}}, i32 4) +// CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0 +// CHECK: br i1 [[CMP]], label %[[EXIT:[^,]+]], +// CHECK: [[EXIT]] +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* +// CHECK: br label %[[RETURN:.+]] +// CHECK: [[RETURN]] +// CHECK: ret i32 0 + +#endif diff --git a/test/OpenMP/cancellation_point_codegen.cpp b/test/OpenMP/cancellation_point_codegen.cpp index 47903c1f3277..453393082ce8 100644 --- a/test/OpenMP/cancellation_point_codegen.cpp +++ b/test/OpenMP/cancellation_point_codegen.cpp @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t %s // RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s // expected-no-diagnostics - +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER diff --git a/test/OpenMP/critical_codegen.cpp b/test/OpenMP/critical_codegen.cpp index 26f5edb38038..5cf3446d9f5f 100644 --- a/test/OpenMP/critical_codegen.cpp +++ b/test/OpenMP/critical_codegen.cpp @@ -3,7 +3,7 @@ // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -gline-tables-only -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG // expected-no-diagnostics - +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER diff --git a/test/OpenMP/flush_codegen.cpp b/test/OpenMP/flush_codegen.cpp index 4ebdf522c28c..cd411cea4573 100644 --- a/test/OpenMP/flush_codegen.cpp +++ b/test/OpenMP/flush_codegen.cpp @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -g -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s // expected-no-diagnostics - +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER diff --git a/test/OpenMP/for_codegen.cpp b/test/OpenMP/for_codegen.cpp index 30cf484f87a8..082a0d4d8841 100644 --- a/test/OpenMP/for_codegen.cpp +++ b/test/OpenMP/for_codegen.cpp @@ -4,9 +4,9 @@ // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -gline-tables-only -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG // // expected-no-diagnostics +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER - // CHECK: [[IDENT_T_TY:%.+]] = type { i32, i32, i32, i32, i8* } // CHECK-DAG: [[IMPLICIT_BARRIER_LOC:@.+]] = private unnamed_addr constant %{{.+}} { i32 0, i32 66, i32 0, i32 0, i8* // CHECK-DAG: [[I:@.+]] = global i8 1, diff --git a/test/OpenMP/for_firstprivate_codegen.cpp b/test/OpenMP/for_firstprivate_codegen.cpp index 1ef38661a46f..0d5f83ed4ec3 100644 --- a/test/OpenMP/for_firstprivate_codegen.cpp +++ b/test/OpenMP/for_firstprivate_codegen.cpp @@ -4,6 +4,7 @@ // RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -DLAMBDA -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=LAMBDA %s // RUN: %clang_cc1 -verify -fopenmp -x c++ -fblocks -DBLOCKS -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=BLOCKS %s // expected-no-diagnostics +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER @@ -85,7 +86,7 @@ int main() { // LAMBDA: call void @__kmpc_barrier( g = 1; // LAMBDA: call void @__kmpc_for_static_init_4( - // LAMBDA: store volatile i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], + // LAMBDA: store i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], // LAMBDA: [[G_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: store i{{[0-9]+}}* [[G_PRIVATE_ADDR]], i{{[0-9]+}}** [[G_PRIVATE_ADDR_REF]] // LAMBDA: call void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]]) @@ -98,7 +99,7 @@ int main() { // LAMBDA: [[ARG_PTR:%.+]] = load %{{.+}}*, %{{.+}}** [[ARG_PTR_REF]] // LAMBDA: [[G_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: [[G_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[G_PTR_REF]] - // LAMBDA: store volatile i{{[0-9]+}} 2, i{{[0-9]+}}* [[G_REF]] + // LAMBDA: store i{{[0-9]+}} 2, i{{[0-9]+}}* [[G_REF]] }(); } }(); @@ -126,7 +127,7 @@ int main() { // BLOCKS: call void @__kmpc_barrier( g = 1; // BLOCKS: call void @__kmpc_for_static_init_4( - // BLOCKS: store volatile i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], + // BLOCKS: store i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: i{{[0-9]+}}* [[G_PRIVATE_ADDR]] // BLOCKS-NOT: [[G]]{{[[^:word:]]}} @@ -137,7 +138,7 @@ int main() { // BLOCKS: define {{.+}} void {{@.+}}(i8* g = 2; // BLOCKS-NOT: [[G]]{{[[^:word:]]}} - // BLOCKS: store volatile i{{[0-9]+}} 2, i{{[0-9]+}}* + // BLOCKS: store i{{[0-9]+}} 2, i{{[0-9]+}}* // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: ret }(); diff --git a/test/OpenMP/for_lastprivate_codegen.cpp b/test/OpenMP/for_lastprivate_codegen.cpp index 90c40dde2e9a..880637ea8b94 100644 --- a/test/OpenMP/for_lastprivate_codegen.cpp +++ b/test/OpenMP/for_lastprivate_codegen.cpp @@ -4,6 +4,7 @@ // RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -DLAMBDA -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=LAMBDA %s // RUN: %clang_cc1 -verify -fopenmp -x c++ -fblocks -DBLOCKS -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=BLOCKS %s // expected-no-diagnostics +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER @@ -74,7 +75,7 @@ int main() { // LAMBDA: [[GTID_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** %{{.+}} // LAMBDA: [[GTID:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[GTID_REF]] // LAMBDA: call {{.+}} @__kmpc_for_static_init_4(%{{.+}}* @{{.+}}, i32 [[GTID]], i32 34, i32* [[IS_LAST_ADDR:%.+]], i32* %{{.+}}, i32* %{{.+}}, i32* %{{.+}}, i32 1, i32 1) - // LAMBDA: store volatile i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], + // LAMBDA: store i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], // LAMBDA: [[G_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: store i{{[0-9]+}}* [[G_PRIVATE_ADDR]], i{{[0-9]+}}** [[G_PRIVATE_ADDR_REF]] // LAMBDA: call void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]]) @@ -100,7 +101,7 @@ int main() { // LAMBDA: [[ARG_PTR:%.+]] = load %{{.+}}*, %{{.+}}** [[ARG_PTR_REF]] // LAMBDA: [[G_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: [[G_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[G_PTR_REF]] - // LAMBDA: store volatile i{{[0-9]+}} 2, i{{[0-9]+}}* [[G_REF]] + // LAMBDA: store i{{[0-9]+}} 2, i{{[0-9]+}}* [[G_REF]] }(); } }(); @@ -126,7 +127,7 @@ int main() { // BLOCKS: [[GTID_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** %{{.+}} // BLOCKS: [[GTID:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[GTID_REF]] // BLOCKS: call {{.+}} @__kmpc_for_static_init_4(%{{.+}}* @{{.+}}, i32 [[GTID]], i32 34, i32* [[IS_LAST_ADDR:%.+]], i32* %{{.+}}, i32* %{{.+}}, i32* %{{.+}}, i32 1, i32 1) - // BLOCKS: store volatile i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], + // BLOCKS: store i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: i{{[0-9]+}}* [[G_PRIVATE_ADDR]] // BLOCKS-NOT: [[G]]{{[[^:word:]]}} @@ -151,7 +152,7 @@ int main() { // BLOCKS: define {{.+}} void {{@.+}}(i8* g = 2; // BLOCKS-NOT: [[G]]{{[[^:word:]]}} - // BLOCKS: store volatile i{{[0-9]+}} 2, i{{[0-9]+}}* + // BLOCKS: store i{{[0-9]+}} 2, i{{[0-9]+}}* // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: ret }(); diff --git a/test/OpenMP/for_private_codegen.cpp b/test/OpenMP/for_private_codegen.cpp index 8172912d04ee..ed6d87bcbae0 100644 --- a/test/OpenMP/for_private_codegen.cpp +++ b/test/OpenMP/for_private_codegen.cpp @@ -4,6 +4,7 @@ // RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -DLAMBDA -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck -check-prefix=LAMBDA %s // RUN: %clang_cc1 -verify -fopenmp -x c++ -fblocks -DBLOCKS -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck -check-prefix=BLOCKS %s // expected-no-diagnostics +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER @@ -55,7 +56,7 @@ int main() { // LAMBDA: store %{{.+}}* [[ARG]], %{{.+}}** [[ARG_REF:%.+]], g = 1; // LAMBDA: call {{.*}}void @__kmpc_for_static_init_4( - // LAMBDA: store volatile double 1.0{{.+}}, double* [[G_PRIVATE_ADDR]], + // LAMBDA: store double 1.0{{.+}}, double* [[G_PRIVATE_ADDR]], // LAMBDA: [[G_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: store double* [[G_PRIVATE_ADDR]], double** [[G_PRIVATE_ADDR_REF]] // LAMBDA: call{{.*}} void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]]) @@ -67,7 +68,7 @@ int main() { // LAMBDA: [[ARG_PTR:%.+]] = load %{{.+}}*, %{{.+}}** [[ARG_PTR_REF]] // LAMBDA: [[G_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: [[G_REF:%.+]] = load double*, double** [[G_PTR_REF]] - // LAMBDA: store volatile double 2.0{{.+}}, double* [[G_REF]] + // LAMBDA: store double 2.0{{.+}}, double* [[G_REF]] }(); } }(); @@ -87,7 +88,7 @@ int main() { // BLOCKS: store %{{.+}}* [[ARG]], %{{.+}}** [[ARG_REF:%.+]], g = 1; // BLOCKS: call {{.*}}void @__kmpc_for_static_init_4( - // BLOCKS: store volatile double 1.0{{.+}}, double* [[G_PRIVATE_ADDR]], + // BLOCKS: store double 1.0{{.+}}, double* [[G_PRIVATE_ADDR]], // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: double* [[G_PRIVATE_ADDR]] // BLOCKS-NOT: [[G]]{{[[^:word:]]}} @@ -97,7 +98,7 @@ int main() { // BLOCKS: define {{.+}} void {{@.+}}(i8* g = 2; // BLOCKS-NOT: [[G]]{{[[^:word:]]}} - // BLOCKS: store volatile double 2.0{{.+}}, double* + // BLOCKS: store double 2.0{{.+}}, double* // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: ret }(); diff --git a/test/OpenMP/for_reduction_codegen.cpp b/test/OpenMP/for_reduction_codegen.cpp index 6763686dd0fc..7de8dff31c4c 100644 --- a/test/OpenMP/for_reduction_codegen.cpp +++ b/test/OpenMP/for_reduction_codegen.cpp @@ -4,6 +4,7 @@ // RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -DLAMBDA -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=LAMBDA %s // RUN: %clang_cc1 -verify -fopenmp -x c++ -fblocks -DBLOCKS -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=BLOCKS %s // expected-no-diagnostics +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER @@ -71,7 +72,7 @@ int main() { // LAMBDA: store double 0.0{{.+}}, double* [[G_PRIVATE_ADDR]] // LAMBDA: call void @__kmpc_for_static_init_4( g = 1; - // LAMBDA: store volatile double 1.0{{.+}}, double* [[G_PRIVATE_ADDR]], + // LAMBDA: store double 1.0{{.+}}, double* [[G_PRIVATE_ADDR]], // LAMBDA: [[G_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: store double* [[G_PRIVATE_ADDR]], double** [[G_PRIVATE_ADDR_REF]] // LAMBDA: call void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]]) @@ -106,7 +107,7 @@ int main() { // LAMBDA: [[ARG_PTR:%.+]] = load %{{.+}}*, %{{.+}}** [[ARG_PTR_REF]] // LAMBDA: [[G_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: [[G_REF:%.+]] = load double*, double** [[G_PTR_REF]] - // LAMBDA: store volatile double 2.0{{.+}}, double* [[G_REF]] + // LAMBDA: store double 2.0{{.+}}, double* [[G_REF]] }(); } }(); @@ -130,7 +131,7 @@ int main() { // BLOCKS: store double 0.0{{.+}}, double* [[G_PRIVATE_ADDR]] g = 1; // BLOCKS: call void @__kmpc_for_static_init_4( - // BLOCKS: store volatile double 1.0{{.+}}, double* [[G_PRIVATE_ADDR]], + // BLOCKS: store double 1.0{{.+}}, double* [[G_PRIVATE_ADDR]], // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: double* [[G_PRIVATE_ADDR]] // BLOCKS-NOT: [[G]]{{[[^:word:]]}} @@ -163,7 +164,7 @@ int main() { // BLOCKS: define {{.+}} void {{@.+}}(i8* g = 2; // BLOCKS-NOT: [[G]]{{[[^:word:]]}} - // BLOCKS: store volatile double 2.0{{.+}}, double* + // BLOCKS: store double 2.0{{.+}}, double* // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: ret }(); diff --git a/test/OpenMP/for_simd_codegen.cpp b/test/OpenMP/for_simd_codegen.cpp index 936119201695..a5644013868c 100644 --- a/test/OpenMP/for_simd_codegen.cpp +++ b/test/OpenMP/for_simd_codegen.cpp @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -g -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -gline-tables-only -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG -// +// REQUIRES: x86-registered-target // expected-no-diagnostics #ifndef HEADER #define HEADER diff --git a/test/OpenMP/master_codegen.cpp b/test/OpenMP/master_codegen.cpp index e6ea21a5cb7b..c364c5278baf 100644 --- a/test/OpenMP/master_codegen.cpp +++ b/test/OpenMP/master_codegen.cpp @@ -3,7 +3,7 @@ // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -gline-tables-only -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG // expected-no-diagnostics - +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER diff --git a/test/OpenMP/ordered_codegen.cpp b/test/OpenMP/ordered_codegen.cpp index 768462387a95..ff8a8047cae4 100644 --- a/test/OpenMP/ordered_codegen.cpp +++ b/test/OpenMP/ordered_codegen.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s -// +// REQUIRES: x86-registered-target // expected-no-diagnostics #ifndef HEADER #define HEADER diff --git a/test/OpenMP/parallel_codegen.cpp b/test/OpenMP/parallel_codegen.cpp index 907d1351356c..6486e44a9dac 100644 --- a/test/OpenMP/parallel_codegen.cpp +++ b/test/OpenMP/parallel_codegen.cpp @@ -2,9 +2,9 @@ // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -g -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix=CHECK-DEBUG %s // expected-no-diagnostics +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER - // CHECK-DAG: %ident_t = type { i32, i32, i32, i32, i8* } // CHECK-DAG: %struct.anon = type { i32* } // CHECK-DAG: %struct.anon.0 = type { i8*** } diff --git a/test/OpenMP/parallel_copyin_codegen.cpp b/test/OpenMP/parallel_copyin_codegen.cpp index dd0a9b621fca..281d82ce9705 100644 --- a/test/OpenMP/parallel_copyin_codegen.cpp +++ b/test/OpenMP/parallel_copyin_codegen.cpp @@ -1,9 +1,9 @@ -// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s -// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple %itanium_abi_triple -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -x c++ -triple %itanium_abi_triple -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s -// RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -DLAMBDA -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck -check-prefix=LAMBDA %s -// RUN: %clang_cc1 -verify -fopenmp -x c++ -fblocks -DBLOCKS -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck -check-prefix=BLOCKS %s -// RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -DARRAY -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=ARRAY %s +// RUN: %clang_cc1 -verify -fopenmp -fnoopenmp-use-tls -x c++ -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -x c++ -std=c++11 -triple %itanium_abi_triple -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -x c++ -triple %itanium_abi_triple -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -verify -fopenmp -fnoopenmp-use-tls -x c++ -std=c++11 -DLAMBDA -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck -check-prefix=LAMBDA %s +// RUN: %clang_cc1 -verify -fopenmp -fnoopenmp-use-tls -x c++ -fblocks -DBLOCKS -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck -check-prefix=BLOCKS %s +// RUN: %clang_cc1 -verify -fopenmp -fnoopenmp-use-tls -x c++ -std=c++11 -DARRAY -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=ARRAY %s // expected-no-diagnostics #ifndef ARRAY #ifndef HEADER diff --git a/test/OpenMP/parallel_firstprivate_codegen.cpp b/test/OpenMP/parallel_firstprivate_codegen.cpp index 760b96171abc..6e0f014f4d9e 100644 --- a/test/OpenMP/parallel_firstprivate_codegen.cpp +++ b/test/OpenMP/parallel_firstprivate_codegen.cpp @@ -75,7 +75,7 @@ int main() { // LAMBDA: store i{{[0-9]+}} [[G_VAL]], i{{[0-9]+}}* [[G_PRIVATE_ADDR]] // LAMBDA: call {{.*}}i32 @__kmpc_cancel_barrier( g = 1; - // LAMBDA: store volatile i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], + // LAMBDA: store i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], // LAMBDA: [[G_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: store i{{[0-9]+}}* [[G_PRIVATE_ADDR]], i{{[0-9]+}}** [[G_PRIVATE_ADDR_REF]] // LAMBDA: call{{.*}} void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]]) @@ -86,7 +86,7 @@ int main() { // LAMBDA: [[ARG_PTR:%.+]] = load %{{.+}}*, %{{.+}}** [[ARG_PTR_REF]] // LAMBDA: [[G_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: [[G_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[G_PTR_REF]] - // LAMBDA: store volatile i{{[0-9]+}} 2, i{{[0-9]+}}* [[G_REF]] + // LAMBDA: store i{{[0-9]+}} 2, i{{[0-9]+}}* [[G_REF]] }(); } }(); @@ -113,7 +113,7 @@ int main() { // BLOCKS: store i{{[0-9]+}} [[G_VAL]], i{{[0-9]+}}* [[G_PRIVATE_ADDR]] // BLOCKS: call {{.*}}i32 @__kmpc_cancel_barrier( g = 1; - // BLOCKS: store volatile i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], + // BLOCKS: store i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: i{{[0-9]+}}* [[G_PRIVATE_ADDR]] // BLOCKS-NOT: [[G]]{{[[^:word:]]}} @@ -122,7 +122,7 @@ int main() { // BLOCKS: define {{.+}} void {{@.+}}(i8* g = 2; // BLOCKS-NOT: [[G]]{{[[^:word:]]}} - // BLOCKS: store volatile i{{[0-9]+}} 2, i{{[0-9]+}}* + // BLOCKS: store i{{[0-9]+}} 2, i{{[0-9]+}}* // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: ret }(); diff --git a/test/OpenMP/parallel_for_codegen.cpp b/test/OpenMP/parallel_for_codegen.cpp index 2a387d9dc376..9fda8404c6e7 100644 --- a/test/OpenMP/parallel_for_codegen.cpp +++ b/test/OpenMP/parallel_for_codegen.cpp @@ -3,7 +3,7 @@ // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -gline-tables-only -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -O1 -fopenmp -emit-llvm %s -o - | FileCheck %s --check-prefix=CLEANUP -// +// REQUIRES: x86-registered-target // expected-no-diagnostics #ifndef HEADER #define HEADER diff --git a/test/OpenMP/parallel_for_simd_codegen.cpp b/test/OpenMP/parallel_for_simd_codegen.cpp index adde4242014f..eb1e493230e3 100644 --- a/test/OpenMP/parallel_for_simd_codegen.cpp +++ b/test/OpenMP/parallel_for_simd_codegen.cpp @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -g -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -gline-tables-only -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG -// +// REQUIRES: x86-registered-target // expected-no-diagnostics #ifndef HEADER #define HEADER diff --git a/test/OpenMP/parallel_private_codegen.cpp b/test/OpenMP/parallel_private_codegen.cpp index 55f25c67f063..d2d02a7c3d37 100644 --- a/test/OpenMP/parallel_private_codegen.cpp +++ b/test/OpenMP/parallel_private_codegen.cpp @@ -4,9 +4,9 @@ // RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -DLAMBDA -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck -check-prefix=LAMBDA %s // RUN: %clang_cc1 -verify -fopenmp -x c++ -fblocks -DBLOCKS -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck -check-prefix=BLOCKS %s // expected-no-diagnostics +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER - template <class T> struct S { T f; @@ -53,7 +53,7 @@ int main() { // LAMBDA: [[G_PRIVATE_ADDR:%.+]] = alloca i{{[0-9]+}}, // LAMBDA: store %{{.+}}* [[ARG]], %{{.+}}** [[ARG_REF:%.+]], g = 1; - // LAMBDA: store volatile i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], + // LAMBDA: store i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], // LAMBDA: [[G_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: store i{{[0-9]+}}* [[G_PRIVATE_ADDR]], i{{[0-9]+}}** [[G_PRIVATE_ADDR_REF]] // LAMBDA: call{{.*}} void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]]) @@ -64,7 +64,7 @@ int main() { // LAMBDA: [[ARG_PTR:%.+]] = load %{{.+}}*, %{{.+}}** [[ARG_PTR_REF]] // LAMBDA: [[G_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: [[G_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[G_PTR_REF]] - // LAMBDA: store volatile i{{[0-9]+}} 2, i{{[0-9]+}}* [[G_REF]] + // LAMBDA: store i{{[0-9]+}} 2, i{{[0-9]+}}* [[G_REF]] }(); } }(); @@ -84,7 +84,7 @@ int main() { // BLOCKS: [[G_PRIVATE_ADDR:%.+]] = alloca i{{[0-9]+}}, // BLOCKS: store %{{.+}}* [[ARG]], %{{.+}}** [[ARG_REF:%.+]], g = 1; - // BLOCKS: store volatile i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], + // BLOCKS: store i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: i{{[0-9]+}}* [[G_PRIVATE_ADDR]] // BLOCKS-NOT: [[G]]{{[[^:word:]]}} @@ -93,7 +93,7 @@ int main() { // BLOCKS: define {{.+}} void {{@.+}}(i8* g = 2; // BLOCKS-NOT: [[G]]{{[[^:word:]]}} - // BLOCKS: store volatile i{{[0-9]+}} 2, i{{[0-9]+}}* + // BLOCKS: store i{{[0-9]+}} 2, i{{[0-9]+}}* // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: ret }(); diff --git a/test/OpenMP/parallel_reduction_codegen.cpp b/test/OpenMP/parallel_reduction_codegen.cpp index 9ce16e919290..04d19ebea8c5 100644 --- a/test/OpenMP/parallel_reduction_codegen.cpp +++ b/test/OpenMP/parallel_reduction_codegen.cpp @@ -3,6 +3,7 @@ // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-apple-darwin10 -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s // RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -DLAMBDA -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=LAMBDA %s // RUN: %clang_cc1 -verify -fopenmp -x c++ -fblocks -DBLOCKS -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=BLOCKS %s +// REQUIRES: x86-registered-target // expected-no-diagnostics #ifndef HEADER #define HEADER @@ -68,7 +69,7 @@ int main() { // LAMBDA: [[G_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[G_REF_ADDR]] // LAMBDA: store i{{[0-9]+}} 0, i{{[0-9]+}}* [[G_PRIVATE_ADDR]] g = 1; - // LAMBDA: store volatile i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], + // LAMBDA: store i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], // LAMBDA: [[G_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: store i{{[0-9]+}}* [[G_PRIVATE_ADDR]], i{{[0-9]+}}** [[G_PRIVATE_ADDR_REF]] // LAMBDA: call void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]]) @@ -100,7 +101,7 @@ int main() { // LAMBDA: [[ARG_PTR:%.+]] = load %{{.+}}*, %{{.+}}** [[ARG_PTR_REF]] // LAMBDA: [[G_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: [[G_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[G_PTR_REF]] - // LAMBDA: store volatile i{{[0-9]+}} 2, i{{[0-9]+}}* [[G_REF]] + // LAMBDA: store i{{[0-9]+}} 2, i{{[0-9]+}}* [[G_REF]] }(); } }(); @@ -129,7 +130,7 @@ int main() { // BLOCKS: [[G_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[G_REF_ADDR]] // BLOCKS: store i{{[0-9]+}} 0, i{{[0-9]+}}* [[G_PRIVATE_ADDR]] g = 1; - // BLOCKS: store volatile i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], + // BLOCKS: store i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: i{{[0-9]+}}* [[G_PRIVATE_ADDR]] // BLOCKS-NOT: [[G]]{{[[^:word:]]}} @@ -159,7 +160,7 @@ int main() { // BLOCKS: define {{.+}} void {{@.+}}(i8* g = 2; // BLOCKS-NOT: [[G]]{{[[^:word:]]}} - // BLOCKS: store volatile i{{[0-9]+}} 2, i{{[0-9]+}}* + // BLOCKS: store i{{[0-9]+}} 2, i{{[0-9]+}}* // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: ret }(); diff --git a/test/OpenMP/parallel_sections_codegen.cpp b/test/OpenMP/parallel_sections_codegen.cpp index ba1bf6cc56a0..2e9e1f95aec5 100644 --- a/test/OpenMP/parallel_sections_codegen.cpp +++ b/test/OpenMP/parallel_sections_codegen.cpp @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -fexceptions -fcxx-exceptions -triple x86_64-unknown-unknown -emit-pch -o %t %s // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -include-pch %t -fsyntax-only -verify %s -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-llvm -o - | FileCheck %s // expected-no-diagnostics - +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER // CHECK: [[IMPLICIT_BARRIER_LOC:@.+]] = private unnamed_addr constant %{{.+}} { i32 0, i32 66, i32 0, i32 0, i8* diff --git a/test/OpenMP/sections_codegen.cpp b/test/OpenMP/sections_codegen.cpp index d25230a79907..2c257e83ae30 100644 --- a/test/OpenMP/sections_codegen.cpp +++ b/test/OpenMP/sections_codegen.cpp @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -fexceptions -fcxx-exceptions -triple x86_64-unknown-unknown -emit-pch -o %t %s // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -include-pch %t -fsyntax-only -verify %s -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-llvm -o - | FileCheck %s // expected-no-diagnostics - +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER // CHECK: [[IMPLICIT_BARRIER_SECTIONS_LOC:@.+]] = private unnamed_addr constant %{{.+}} { i32 0, i32 194, i32 0, i32 0, i8* diff --git a/test/OpenMP/sections_firstprivate_codegen.cpp b/test/OpenMP/sections_firstprivate_codegen.cpp index 4ec16ba02d9b..af9c1fe5fbda 100644 --- a/test/OpenMP/sections_firstprivate_codegen.cpp +++ b/test/OpenMP/sections_firstprivate_codegen.cpp @@ -4,6 +4,7 @@ // RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -DLAMBDA -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=LAMBDA %s // RUN: %clang_cc1 -verify -fopenmp -x c++ -fblocks -DBLOCKS -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=BLOCKS %s // expected-no-diagnostics +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER @@ -87,7 +88,7 @@ int main() { // LAMBDA: call void @__kmpc_barrier( g = 1; // LAMBDA: call void @__kmpc_for_static_init_4( - // LAMBDA: store volatile i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], + // LAMBDA: store i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], // LAMBDA: [[G_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: store i{{[0-9]+}}* [[G_PRIVATE_ADDR]], i{{[0-9]+}}** [[G_PRIVATE_ADDR_REF]] // LAMBDA: call void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]]) @@ -101,7 +102,7 @@ int main() { // LAMBDA: [[ARG_PTR:%.+]] = load %{{.+}}*, %{{.+}}** [[ARG_PTR_REF]] // LAMBDA: [[G_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: [[G_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[G_PTR_REF]] - // LAMBDA: store volatile i{{[0-9]+}} 2, i{{[0-9]+}}* [[G_REF]] + // LAMBDA: store i{{[0-9]+}} 2, i{{[0-9]+}}* [[G_REF]] }(); } }(); @@ -129,7 +130,7 @@ int main() { // BLOCKS: call void @__kmpc_barrier( g = 1; // BLOCKS: call void @__kmpc_for_static_init_4( - // BLOCKS: store volatile i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], + // BLOCKS: store i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: i{{[0-9]+}}* [[G_PRIVATE_ADDR]] // BLOCKS-NOT: [[G]]{{[[^:word:]]}} @@ -141,7 +142,7 @@ int main() { // BLOCKS: define {{.+}} void {{@.+}}(i8* g = 2; // BLOCKS-NOT: [[G]]{{[[^:word:]]}} - // BLOCKS: store volatile i{{[0-9]+}} 2, i{{[0-9]+}}* + // BLOCKS: store i{{[0-9]+}} 2, i{{[0-9]+}}* // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: ret }(); diff --git a/test/OpenMP/sections_lastprivate_codegen.cpp b/test/OpenMP/sections_lastprivate_codegen.cpp index b57f0b05c0c2..c2f68aa0fe7d 100644 --- a/test/OpenMP/sections_lastprivate_codegen.cpp +++ b/test/OpenMP/sections_lastprivate_codegen.cpp @@ -4,6 +4,7 @@ // RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -DLAMBDA -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=LAMBDA %s // RUN: %clang_cc1 -verify -fopenmp -x c++ -fblocks -DBLOCKS -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=BLOCKS %s // expected-no-diagnostics +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER @@ -73,7 +74,7 @@ int main() { // LAMBDA: [[GTID_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** %{{.+}} // LAMBDA: [[GTID:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[GTID_REF]] // LAMBDA: call {{.+}} @__kmpc_for_static_init_4(%{{.+}}* @{{.+}}, i32 [[GTID]], i32 34, i32* [[IS_LAST_ADDR:%.+]], i32* %{{.+}}, i32* %{{.+}}, i32* %{{.+}}, i32 1, i32 1) - // LAMBDA: store volatile i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], + // LAMBDA: store i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], // LAMBDA: [[G_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: store i{{[0-9]+}}* [[G_PRIVATE_ADDR]], i{{[0-9]+}}** [[G_PRIVATE_ADDR_REF]] // LAMBDA: call void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]]) @@ -100,7 +101,7 @@ int main() { // LAMBDA: [[ARG_PTR:%.+]] = load %{{.+}}*, %{{.+}}** [[ARG_PTR_REF]] // LAMBDA: [[G_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: [[G_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[G_PTR_REF]] - // LAMBDA: store volatile i{{[0-9]+}} 2, i{{[0-9]+}}* [[G_REF]] + // LAMBDA: store i{{[0-9]+}} 2, i{{[0-9]+}}* [[G_REF]] }(); } }(); @@ -126,7 +127,7 @@ int main() { // BLOCKS: [[GTID_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** %{{.+}} // BLOCKS: [[GTID:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[GTID_REF]] // BLOCKS: call {{.+}} @__kmpc_for_static_init_4(%{{.+}}* @{{.+}}, i32 [[GTID]], i32 34, i32* [[IS_LAST_ADDR:%.+]], i32* %{{.+}}, i32* %{{.+}}, i32* %{{.+}}, i32 1, i32 1) - // BLOCKS: store volatile i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], + // BLOCKS: store i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: i{{[0-9]+}}* [[G_PRIVATE_ADDR]] // BLOCKS-NOT: [[G]]{{[[^:word:]]}} @@ -151,7 +152,7 @@ int main() { // BLOCKS: define {{.+}} void {{@.+}}(i8* g = 2; // BLOCKS-NOT: [[G]]{{[[^:word:]]}} - // BLOCKS: store volatile i{{[0-9]+}} 2, i{{[0-9]+}}* + // BLOCKS: store i{{[0-9]+}} 2, i{{[0-9]+}}* // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: ret }(); diff --git a/test/OpenMP/sections_private_codegen.cpp b/test/OpenMP/sections_private_codegen.cpp index 90331cbd43a9..9b579a2aa661 100644 --- a/test/OpenMP/sections_private_codegen.cpp +++ b/test/OpenMP/sections_private_codegen.cpp @@ -4,6 +4,7 @@ // RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -DLAMBDA -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck -check-prefix=LAMBDA %s // RUN: %clang_cc1 -verify -fopenmp -x c++ -fblocks -DBLOCKS -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck -check-prefix=BLOCKS %s // expected-no-diagnostics +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER @@ -55,7 +56,7 @@ int main() { // LAMBDA: store %{{.+}}* [[ARG]], %{{.+}}** [[ARG_REF:%.+]], g = 1; // LAMBDA: call {{.*}}void @__kmpc_for_static_init_4( - // LAMBDA: store volatile double 1.0{{.+}}, double* [[G_PRIVATE_ADDR]], + // LAMBDA: store double 1.0{{.+}}, double* [[G_PRIVATE_ADDR]], // LAMBDA: [[G_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: store double* [[G_PRIVATE_ADDR]], double** [[G_PRIVATE_ADDR_REF]] // LAMBDA: call{{.*}} void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]]) @@ -68,7 +69,7 @@ int main() { // LAMBDA: [[ARG_PTR:%.+]] = load %{{.+}}*, %{{.+}}** [[ARG_PTR_REF]] // LAMBDA: [[G_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: [[G_REF:%.+]] = load double*, double** [[G_PTR_REF]] - // LAMBDA: store volatile double 2.0{{.+}}, double* [[G_REF]] + // LAMBDA: store double 2.0{{.+}}, double* [[G_REF]] }(); } }(); @@ -88,7 +89,7 @@ int main() { // BLOCKS: store %{{.+}}* [[ARG]], %{{.+}}** [[ARG_REF:%.+]], g = 1; // BLOCKS: call {{.*}}void @__kmpc_for_static_init_4( - // BLOCKS: store volatile double 1.0{{.+}}, double* [[G_PRIVATE_ADDR]], + // BLOCKS: store double 1.0{{.+}}, double* [[G_PRIVATE_ADDR]], // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: double* [[G_PRIVATE_ADDR]] // BLOCKS-NOT: [[G]]{{[[^:word:]]}} @@ -99,7 +100,7 @@ int main() { // BLOCKS: define {{.+}} void {{@.+}}(i8* g = 2; // BLOCKS-NOT: [[G]]{{[[^:word:]]}} - // BLOCKS: store volatile double 2.0{{.+}}, double* + // BLOCKS: store double 2.0{{.+}}, double* // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: ret }(); diff --git a/test/OpenMP/sections_reduction_codegen.cpp b/test/OpenMP/sections_reduction_codegen.cpp index a50f04983d4a..4d404dbcc6d1 100644 --- a/test/OpenMP/sections_reduction_codegen.cpp +++ b/test/OpenMP/sections_reduction_codegen.cpp @@ -4,6 +4,7 @@ // RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -DLAMBDA -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=LAMBDA %s // RUN: %clang_cc1 -verify -fopenmp -x c++ -fblocks -DBLOCKS -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=BLOCKS %s // expected-no-diagnostics +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER @@ -67,7 +68,7 @@ int main() { // LAMBDA: store double 0.0{{.+}}, double* [[G_PRIVATE_ADDR]] // LAMBDA: call void @__kmpc_for_static_init_4( g = 1; - // LAMBDA: store volatile double 1.0{{.+}}, double* [[G_PRIVATE_ADDR]], + // LAMBDA: store double 1.0{{.+}}, double* [[G_PRIVATE_ADDR]], // LAMBDA: [[G_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: store double* [[G_PRIVATE_ADDR]], double** [[G_PRIVATE_ADDR_REF]] // LAMBDA: call void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]]) @@ -103,7 +104,7 @@ int main() { // LAMBDA: [[ARG_PTR:%.+]] = load %{{.+}}*, %{{.+}}** [[ARG_PTR_REF]] // LAMBDA: [[G_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: [[G_REF:%.+]] = load double*, double** [[G_PTR_REF]] - // LAMBDA: store volatile double 2.0{{.+}}, double* [[G_REF]] + // LAMBDA: store double 2.0{{.+}}, double* [[G_REF]] }(); } }(); @@ -127,7 +128,7 @@ int main() { // BLOCKS: store double 0.0{{.+}}, double* [[G_PRIVATE_ADDR]] g = 1; // BLOCKS: call void @__kmpc_for_static_init_4( - // BLOCKS: store volatile double 1.0{{.+}}, double* [[G_PRIVATE_ADDR]], + // BLOCKS: store double 1.0{{.+}}, double* [[G_PRIVATE_ADDR]], // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: double* [[G_PRIVATE_ADDR]] // BLOCKS-NOT: [[G]]{{[[^:word:]]}} @@ -161,7 +162,7 @@ int main() { // BLOCKS: define {{.+}} void {{@.+}}(i8* g = 2; // BLOCKS-NOT: [[G]]{{[[^:word:]]}} - // BLOCKS: store volatile double 2.0{{.+}}, double* + // BLOCKS: store double 2.0{{.+}}, double* // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: ret }(); diff --git a/test/OpenMP/simd_codegen.cpp b/test/OpenMP/simd_codegen.cpp index ae649d8359a8..e67ad5d4c7e0 100644 --- a/test/OpenMP/simd_codegen.cpp +++ b/test/OpenMP/simd_codegen.cpp @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -g -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -gline-tables-only -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG -// +// REQUIRES: x86-registered-target // expected-no-diagnostics #ifndef HEADER #define HEADER diff --git a/test/OpenMP/single_codegen.cpp b/test/OpenMP/single_codegen.cpp index d81739ed9163..327f6fafa834 100644 --- a/test/OpenMP/single_codegen.cpp +++ b/test/OpenMP/single_codegen.cpp @@ -1,10 +1,10 @@ -// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s -// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s -// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -gline-tables-only -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG -// RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -DARRAY -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=ARRAY %s +// RUN: %clang_cc1 -verify -fopenmp -fnoopenmp-use-tls -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s +// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fnoopenmp-use-tls -fexceptions -fcxx-exceptions -gline-tables-only -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG +// RUN: %clang_cc1 -verify -fopenmp -fnoopenmp-use-tls -x c++ -std=c++11 -DARRAY -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=ARRAY %s // expected-no-diagnostics - +// REQUIRES: x86-registered-target #ifndef ARRAY #ifndef HEADER #define HEADER diff --git a/test/OpenMP/single_firstprivate_codegen.cpp b/test/OpenMP/single_firstprivate_codegen.cpp index 059108b37659..01eaea318119 100644 --- a/test/OpenMP/single_firstprivate_codegen.cpp +++ b/test/OpenMP/single_firstprivate_codegen.cpp @@ -4,6 +4,7 @@ // RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -DLAMBDA -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=LAMBDA %s // RUN: %clang_cc1 -verify -fopenmp -x c++ -fblocks -DBLOCKS -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=BLOCKS %s // expected-no-diagnostics +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER @@ -79,7 +80,7 @@ int main() { // LAMBDA: [[G_VAL:%.+]] = load volatile i{{[0-9]+}}, i{{[0-9]+}}* [[G]] // LAMBDA: store i{{[0-9]+}} [[G_VAL]], i{{[0-9]+}}* [[G_PRIVATE_ADDR]] g = 1; - // LAMBDA: store volatile i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], + // LAMBDA: store i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], // LAMBDA: [[G_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: store i{{[0-9]+}}* [[G_PRIVATE_ADDR]], i{{[0-9]+}}** [[G_PRIVATE_ADDR_REF]] // LAMBDA: call void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]]) @@ -92,7 +93,7 @@ int main() { // LAMBDA: [[ARG_PTR:%.+]] = load %{{.+}}*, %{{.+}}** [[ARG_PTR_REF]] // LAMBDA: [[G_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: [[G_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[G_PTR_REF]] - // LAMBDA: store volatile i{{[0-9]+}} 2, i{{[0-9]+}}* [[G_REF]] + // LAMBDA: store i{{[0-9]+}} 2, i{{[0-9]+}}* [[G_REF]] }(); } }(); @@ -113,7 +114,7 @@ int main() { // BLOCKS: [[G_VAL:%.+]] = load volatile i{{[0-9]+}}, i{{[0-9]+}}* [[G]] // BLOCKS: store i{{[0-9]+}} [[G_VAL]], i{{[0-9]+}}* [[G_PRIVATE_ADDR]] g = 1; - // BLOCKS: store volatile i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], + // BLOCKS: store i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: i{{[0-9]+}}* [[G_PRIVATE_ADDR]] // BLOCKS-NOT: [[G]]{{[[^:word:]]}} @@ -124,7 +125,7 @@ int main() { // BLOCKS: define {{.+}} void {{@.+}}(i8* g = 2; // BLOCKS-NOT: [[G]]{{[[^:word:]]}} - // BLOCKS: store volatile i{{[0-9]+}} 2, i{{[0-9]+}}* + // BLOCKS: store i{{[0-9]+}} 2, i{{[0-9]+}}* // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: ret }(); diff --git a/test/OpenMP/single_private_codegen.cpp b/test/OpenMP/single_private_codegen.cpp index a7fb2ed54937..e228b1b14887 100644 --- a/test/OpenMP/single_private_codegen.cpp +++ b/test/OpenMP/single_private_codegen.cpp @@ -4,6 +4,7 @@ // RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -DLAMBDA -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck -check-prefix=LAMBDA %s // RUN: %clang_cc1 -verify -fopenmp -x c++ -fblocks -DBLOCKS -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck -check-prefix=BLOCKS %s // expected-no-diagnostics +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER @@ -54,7 +55,7 @@ int main() { // LAMBDA: store %{{.+}}* [[ARG]], %{{.+}}** [[ARG_REF:%.+]], g = 1; // LAMBDA: call {{.*}}i32 @__kmpc_single( - // LAMBDA: store volatile double 1.0{{.+}}, double* [[G_PRIVATE_ADDR]], + // LAMBDA: store double 1.0{{.+}}, double* [[G_PRIVATE_ADDR]], // LAMBDA: [[G_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: store double* [[G_PRIVATE_ADDR]], double** [[G_PRIVATE_ADDR_REF]] // LAMBDA: call{{.*}} void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]]) @@ -66,7 +67,7 @@ int main() { // LAMBDA: [[ARG_PTR:%.+]] = load %{{.+}}*, %{{.+}}** [[ARG_PTR_REF]] // LAMBDA: [[G_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: [[G_REF:%.+]] = load double*, double** [[G_PTR_REF]] - // LAMBDA: store volatile double 2.0{{.+}}, double* [[G_REF]] + // LAMBDA: store double 2.0{{.+}}, double* [[G_REF]] }(); } }(); @@ -86,7 +87,7 @@ int main() { // BLOCKS: store %{{.+}}* [[ARG]], %{{.+}}** [[ARG_REF:%.+]], g = 1; // BLOCKS: call {{.*}}i32 @__kmpc_single( - // BLOCKS: store volatile double 1.0{{.+}}, double* [[G_PRIVATE_ADDR]], + // BLOCKS: store double 1.0{{.+}}, double* [[G_PRIVATE_ADDR]], // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: double* [[G_PRIVATE_ADDR]] // BLOCKS-NOT: [[G]]{{[[^:word:]]}} @@ -96,7 +97,7 @@ int main() { // BLOCKS: define {{.+}} void {{@.+}}(i8* g = 2; // BLOCKS-NOT: [[G]]{{[[^:word:]]}} - // BLOCKS: store volatile double 2.0{{.+}}, double* + // BLOCKS: store double 2.0{{.+}}, double* // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: ret }(); diff --git a/test/OpenMP/task_codegen.cpp b/test/OpenMP/task_codegen.cpp index cce0a13bc2e4..139ac505a9f6 100644 --- a/test/OpenMP/task_codegen.cpp +++ b/test/OpenMP/task_codegen.cpp @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-apple-darwin10 -emit-pch -o %t %s // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-apple-darwin10 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s // expected-no-diagnostics - +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER diff --git a/test/OpenMP/task_firstprivate_codegen.cpp b/test/OpenMP/task_firstprivate_codegen.cpp index e1358d9ecc6a..89aadbeb6a3f 100644 --- a/test/OpenMP/task_firstprivate_codegen.cpp +++ b/test/OpenMP/task_firstprivate_codegen.cpp @@ -5,7 +5,7 @@ // RUN: %clang_cc1 -verify -fopenmp -x c++ -fblocks -DBLOCKS -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=BLOCKS %s // RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -DARRAY -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=ARRAY %s // expected-no-diagnostics - +// REQUIRES: x86-registered-target // It doesn't pass on win32. // REQUIRES: shell #ifndef ARRAY @@ -72,12 +72,12 @@ int main() { // LAMBDA: [[ARG_PTR:%.+]] = load %{{.+}}*, %{{.+}}** [[ARG_PTR_REF]] // LAMBDA: [[G_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: [[G_REF:%.+]] = load double*, double** [[G_PTR_REF]] - // LAMBDA: store volatile double 2.0{{.+}}, double* [[G_REF]] + // LAMBDA: store double 2.0{{.+}}, double* [[G_REF]] // LAMBDA: store double* %{{.+}}, double** %{{.+}}, // LAMBDA: define internal i32 [[TASK_ENTRY]](i32, %{{.+}}*) g = 1; - // LAMBDA: store volatile double 1.0{{.+}}, double* %{{.+}}, + // LAMBDA: store double 1.0{{.+}}, double* %{{.+}}, // LAMBDA: call void [[INNER_LAMBDA]](% // LAMBDA: ret [&]() { @@ -105,14 +105,14 @@ int main() { { // BLOCKS: define {{.+}} void {{@.+}}(i8* // BLOCKS-NOT: [[G]]{{[[^:word:]]}} - // BLOCKS: store volatile double 2.0{{.+}}, double* + // BLOCKS: store double 2.0{{.+}}, double* // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: ret // BLOCKS: store double* %{{.+}}, double** %{{.+}}, // BLOCKS: define internal i32 [[TASK_ENTRY]](i32, %{{.+}}*) g = 1; - // BLOCKS: store volatile double 1.0{{.+}}, double* %{{.+}}, + // BLOCKS: store double 1.0{{.+}}, double* %{{.+}}, // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: call void {{%.+}}(i8 ^{ diff --git a/test/OpenMP/task_if_codegen.cpp b/test/OpenMP/task_if_codegen.cpp index be9b47b79a41..d08c27f5a408 100644 --- a/test/OpenMP/task_if_codegen.cpp +++ b/test/OpenMP/task_if_codegen.cpp @@ -1,6 +1,7 @@ // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck %s // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-apple-darwin10 -emit-pch -o %t %s // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-apple-darwin10 -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix=CHECK %s +// REQUIRES: x86-registered-target // expected-no-diagnostics #ifndef HEADER #define HEADER diff --git a/test/OpenMP/task_private_codegen.cpp b/test/OpenMP/task_private_codegen.cpp index 463913f926a4..b29d0d39a1e2 100644 --- a/test/OpenMP/task_private_codegen.cpp +++ b/test/OpenMP/task_private_codegen.cpp @@ -5,7 +5,7 @@ // RUN: %clang_cc1 -verify -fopenmp -x c++ -fblocks -DBLOCKS -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=BLOCKS %s // RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -DARRAY -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=ARRAY %s // expected-no-diagnostics - +// REQUIRES: x86-registered-target // It doesn't pass on win32. Investigating. // REQUIRES: shell @@ -67,11 +67,11 @@ int main() { // LAMBDA: [[ARG_PTR:%.+]] = load %{{.+}}*, %{{.+}}** [[ARG_PTR_REF]] // LAMBDA: [[G_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: [[G_REF:%.+]] = load double*, double** [[G_PTR_REF]] - // LAMBDA: store volatile double 2.0{{.+}}, double* [[G_REF]] + // LAMBDA: store double 2.0{{.+}}, double* [[G_REF]] // LAMBDA: define internal i32 [[TASK_ENTRY]](i32, %{{.+}}*) g = 1; - // LAMBDA: store volatile double 1.0{{.+}}, double* %{{.+}}, + // LAMBDA: store double 1.0{{.+}}, double* %{{.+}}, // LAMBDA: call void [[INNER_LAMBDA]](% // LAMBDA: ret [&]() { @@ -95,13 +95,13 @@ int main() { { // BLOCKS: define {{.+}} void {{@.+}}(i8* // BLOCKS-NOT: [[G]]{{[[^:word:]]}} - // BLOCKS: store volatile double 2.0{{.+}}, double* + // BLOCKS: store double 2.0{{.+}}, double* // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: ret // BLOCKS: define internal i32 [[TASK_ENTRY]](i32, %{{.+}}*) g = 1; - // BLOCKS: store volatile double 1.0{{.+}}, double* %{{.+}}, + // BLOCKS: store double 1.0{{.+}}, double* %{{.+}}, // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: call void {{%.+}}(i8 ^{ diff --git a/test/OpenMP/taskgroup_codegen.cpp b/test/OpenMP/taskgroup_codegen.cpp index eb45f3187fa5..c04e4c723b8d 100644 --- a/test/OpenMP/taskgroup_codegen.cpp +++ b/test/OpenMP/taskgroup_codegen.cpp @@ -3,7 +3,7 @@ // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -gline-tables-only -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG // expected-no-diagnostics - +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER diff --git a/test/OpenMP/taskwait_codegen.cpp b/test/OpenMP/taskwait_codegen.cpp index 85f20e80561f..7521709f01b6 100644 --- a/test/OpenMP/taskwait_codegen.cpp +++ b/test/OpenMP/taskwait_codegen.cpp @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-apple-darwin10 -emit-pch -o %t %s // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-apple-darwin10 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s // expected-no-diagnostics - +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER diff --git a/test/OpenMP/taskyield_codegen.cpp b/test/OpenMP/taskyield_codegen.cpp index 6815a0348e1c..759709c33d22 100644 --- a/test/OpenMP/taskyield_codegen.cpp +++ b/test/OpenMP/taskyield_codegen.cpp @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -emit-pch -o %t %s // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s // expected-no-diagnostics - +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER diff --git a/test/OpenMP/threadprivate_ast_print.cpp b/test/OpenMP/threadprivate_ast_print.cpp index be2a79c52cbc..2d876c1909fa 100644 --- a/test/OpenMP/threadprivate_ast_print.cpp +++ b/test/OpenMP/threadprivate_ast_print.cpp @@ -1,7 +1,11 @@ -// RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s -// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print +// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-apple-darwin10.6.0 -ast-print %s | FileCheck %s +// RUN: %clang_cc1 -fopenmp -triple x86_64-apple-darwin10.6.0 -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -triple x86_64-apple-darwin10.6.0 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print +// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-unknown-linux-gnu -ast-print %s | FileCheck %s +// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -triple x86_64-unknown-linux-gnu -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -triple x86_64-unknown-linux-gnu -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print // expected-no-diagnostics +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER diff --git a/test/OpenMP/threadprivate_codegen.cpp b/test/OpenMP/threadprivate_codegen.cpp index eea49443f8c9..7176e0499273 100644 --- a/test/OpenMP/threadprivate_codegen.cpp +++ b/test/OpenMP/threadprivate_codegen.cpp @@ -1,7 +1,13 @@ -// RUN: %clang_cc1 -verify -fopenmp -DBODY -triple x86_64-unknown-unknown -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s +// RUN: %clang_cc1 -verify -fopenmp -fnoopenmp-use-tls -DBODY -triple x86_64-unknown-unknown -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s +// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -DBODY -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -g -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix=CHECK-DEBUG %s + +// RUN: %clang_cc1 -verify -fopenmp -DBODY -triple x86_64-unknown-unknown -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s --check-prefix=CHECK-TLS // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -DBODY -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -g -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix=CHECK-DEBUG %s +// RUN: %clang_cc1 -fopenmp -DBODY -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -g -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix=CHECK-TLS %s + // expected-no-diagnostics +// REQUIRES: x86-registered-target #ifndef HEADER #define HEADER // CHECK-DAG: [[IDENT:%.+]] = type { i32, i32, i32, i32, i8* } @@ -18,6 +24,12 @@ // CHECK-DEBUG-DAG: [[S4:%.+]] = type { [[INT]], [[INT]] } // CHECK-DEBUG-DAG: [[S5:%.+]] = type { [[INT]], [[INT]], [[INT]] } // CHECK-DEBUG-DAG: [[SMAIN:%.+]] = type { [[INT]], double, double } +// CHECK-TLS-DAG: [[S1:%.+]] = type { [[INT:i[0-9]+]] } +// CHECK-TLS-DAG: [[S2:%.+]] = type { [[INT]], double } +// CHECK-TLS-DAG: [[S3:%.+]] = type { [[INT]], float } +// CHECK-TLS-DAG: [[S4:%.+]] = type { [[INT]], [[INT]] } +// CHECK-TLS-DAG: [[S5:%.+]] = type { [[INT]], [[INT]], [[INT]] } +// CHECK-TLS-DAG: [[SMAIN:%.+]] = type { [[INT]], double, double } struct S1 { int a; @@ -132,26 +144,44 @@ struct S5 { // CHECK-DEBUG-DAG: [[ST_INT_ST:@.+]] = linkonce_odr global i32 23 // CHECK-DEBUG-DAG: [[ST_FLOAT_ST:@.+]] = linkonce_odr global float 2.300000e+01 // CHECK-DEBUG-DAG: [[ST_S4_ST:@.+]] = linkonce_odr global %struct.S4 zeroinitializer -// CHECK-DEBUG-DAG: [[LOC1:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;;162;9;;\00" -// CHECK-DEBUG-DAG: [[LOC2:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;;217;9;;\00" -// CHECK-DEBUG-DAG: [[LOC3:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;;304;19;;\00" -// CHECK-DEBUG-DAG: [[LOC4:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;329;9;;\00" -// CHECK-DEBUG-DAG: [[LOC5:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;342;9;;\00" -// CHECK-DEBUG-DAG: [[LOC6:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;359;10;;\00" -// CHECK-DEBUG-DAG: [[LOC7:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;376;10;;\00" -// CHECK-DEBUG-DAG: [[LOC8:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;402;10;;\00" -// CHECK-DEBUG-DAG: [[LOC9:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;423;10;;\00" -// CHECK-DEBUG-DAG: [[LOC10:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;438;10;;\00" -// CHECK-DEBUG-DAG: [[LOC11:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;455;27;;\00" -// CHECK-DEBUG-DAG: [[LOC12:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;472;10;;\00" -// CHECK-DEBUG-DAG: [[LOC13:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;foobar;551;9;;\00" -// CHECK-DEBUG-DAG: [[LOC14:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;foobar;568;10;;\00" -// CHECK-DEBUG-DAG: [[LOC15:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;foobar;594;10;;\00" -// CHECK-DEBUG-DAG: [[LOC16:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;foobar;615;10;;\00" -// CHECK-DEBUG-DAG: [[LOC17:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;foobar;630;10;;\00" -// CHECK-DEBUG-DAG: [[LOC18:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;foobar;647;27;;\00" -// CHECK-DEBUG-DAG: [[LOC19:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;foobar;664;10;;\00" -// CHECK-DEBUG-DAG: [[LOC20:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;;276;9;;\00" +// CHECK-DEBUG-DAG: [[LOC1:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;;192;9;;\00" +// CHECK-DEBUG-DAG: [[LOC2:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;;247;9;;\00" +// CHECK-DEBUG-DAG: [[LOC3:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;;334;19;;\00" +// CHECK-DEBUG-DAG: [[LOC4:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;371;9;;\00" +// CHECK-DEBUG-DAG: [[LOC5:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;388;9;;\00" +// CHECK-DEBUG-DAG: [[LOC6:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;410;10;;\00" +// CHECK-DEBUG-DAG: [[LOC7:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;433;10;;\00" +// CHECK-DEBUG-DAG: [[LOC8:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;469;10;;\00" +// CHECK-DEBUG-DAG: [[LOC9:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;498;10;;\00" +// CHECK-DEBUG-DAG: [[LOC10:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;518;10;;\00" +// CHECK-DEBUG-DAG: [[LOC11:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;541;27;;\00" +// CHECK-DEBUG-DAG: [[LOC12:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;564;10;;\00" +// CHECK-DEBUG-DAG: [[LOC13:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;foobar;684;9;;\00" +// CHECK-DEBUG-DAG: [[LOC14:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;foobar;707;10;;\00" +// CHECK-DEBUG-DAG: [[LOC15:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;foobar;743;10;;\00" +// CHECK-DEBUG-DAG: [[LOC16:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;foobar;772;10;;\00" +// CHECK-DEBUG-DAG: [[LOC17:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;foobar;792;10;;\00" +// CHECK-DEBUG-DAG: [[LOC18:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;foobar;815;27;;\00" +// CHECK-DEBUG-DAG: [[LOC19:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;foobar;838;10;;\00" +// CHECK-DEBUG-DAG: [[LOC20:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;;306;9;;\00" +// CHECK-TLS-DAG: [[GS1:@.+]] = internal thread_local global [[S1]] zeroinitializer +// CHECK-TLS-DAG: [[GS2:@.+]] = internal global [[S2]] zeroinitializer +// CHECK-TLS-DAG: [[ARR_X:@.+]] = thread_local global [2 x [3 x [[S1]]]] zeroinitializer +// CHECK-TLS-DAG: [[SM:@.+]] = internal thread_local global [[SMAIN]] zeroinitializer +// CHECK-TLS-DAG: [[SM_GUARD:@_ZGVZ4mainE2sm]] = internal thread_local global i8 0 +// CHECK-TLS-DAG: [[STATIC_S:@.+]] = external thread_local global [[S3]] +// CHECK-TLS-DAG: [[GS3:@.+]] = external thread_local global [[S5]] +// CHECK-TLS-DAG: [[ST_INT_ST:@.+]] = linkonce_odr thread_local global i32 23 +// CHECK-TLS-DAG: [[ST_FLOAT_ST:@.+]] = linkonce_odr thread_local global float 2.300000e+01 +// CHECK-TLS-DAG: [[ST_S4_ST:@.+]] = linkonce_odr thread_local global %struct.S4 zeroinitializer +// CHECK-TLS-DAG: [[ST_S4_ST_GUARD:@_ZGVN2STI2S4E2stE]] = linkonce_odr thread_local global i64 0 +// CHECK-TLS-DAG: @__tls_guard = internal thread_local global i8 0 +// CHECK-TLS-DAG: @__dso_handle = external global i8 +// CHECK-TLS-DAG: [[GS1_TLS_INIT:@_ZTHL3gs1]] = internal alias void ()* @__tls_init +// CHECK-TLS-DAG: [[ARR_X_TLS_INIT:@_ZTH5arr_x]] = alias void ()* @__tls_init +// CHECK-TLS-DAG: [[ST_INT_ST_TLS_INIT:@_ZTHN2STIiE2stE]] = linkonce_odr alias void ()* @__tls_init +// CHECK-TLS-DAG: [[ST_FLOAT_ST_TLS_INIT:@_ZTHN2STIfE2stE]] = linkonce_odr alias void ()* @__tls_init +// CHECK-TLS-DAG: [[ST_S4_ST_TLS_INIT:@_ZTHN2STI2S4E2stE]] = linkonce_odr alias void ()* @__tls_init struct Static { static S3 s; @@ -326,6 +356,18 @@ int main() { // CHECK-DEBUG-NEXT: [[GS1_A:%.*]] = load [[INT]], [[INT]]* [[GS1_A_ADDR]] // CHECK-DEBUG-NEXT: invoke {{.*}} [[SMAIN_CTOR:.*]]([[SMAIN]]* [[SM]], [[INT]] {{.*}}[[GS1_A]]) // CHECK-DEBUG: call {{.*}}void @__cxa_guard_release +// CHECK-TLS: [[IS_INIT_INT:%.*]] = load i8, i8* [[SM_GUARD]] +// CHECK-TLS-NEXT: [[IS_INIT_BOOL:%.*]] = icmp eq i8 [[IS_INIT_INT]], 0 +// CHECK-TLS-NEXT: br i1 [[IS_INIT_BOOL]], label %[[INIT_LABEL:.*]], label %[[INIT_DONE:[^,]+]]{{.*}} +// CHECK-TLS: [[INIT_LABEL]] +// CHECK-TLS-NEXT: [[GS1_ADDR:%.*]] = call [[S1]]* [[GS1_TLS_INITD:@[^,]+]] +// CHECK-TLS-NEXT: [[GS1_A_ADDR:%.*]] = getelementptr inbounds [[S1]], [[S1]]* [[GS1_ADDR]], i32 0, i32 0 +// CHECK-TLS-NEXT: [[GS1_A_VAL:%.*]] = load i32, i32* [[GS1_A_ADDR]] +// CHECK-TLS-NEXT: call void [[SM_CTOR1:@.*]]([[SMAIN]]* [[SM]], i32 [[GS1_A_VAL]]) +// CHECK-TLS-NEXT: call i32 @__cxa_thread_atexit(void (i8*)* bitcast (void ([[SMAIN]]*)* [[SM_DTOR1:@.*]] to void (i8*)*), i8* bitcast ([[SMAIN]]* [[SM]] to i8*), i8* @__dso_handle) +// CHECK-TLS-NEXT: store i8 1, i8* [[SM_GUARD]] +// CHECK-TLS-NEXT: br label %[[INIT_DONE]] +// CHECK-TLS: [[INIT_DONE]] #pragma omp threadprivate(sm) // CHECK: [[STATIC_S_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([[S3]]* [[STATIC_S]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[STATIC_S]].cache.) // CHECK-NEXT: [[STATIC_S_ADDR:%.*]] = bitcast i8* [[STATIC_S_TEMP_ADDR]] to [[S3]]* @@ -339,6 +381,10 @@ int main() { // CHECK-DEBUG-NEXT: [[STATIC_S_A_ADDR:%.*]] = getelementptr inbounds [[S3]], [[S3]]* [[STATIC_S_ADDR]], i{{.*}} 0, i{{.*}} 0 // CHECK-DEBUG-NEXT: [[STATIC_S_A:%.*]] = load [[INT]], [[INT]]* [[STATIC_S_A_ADDR]] // CHECK-DEBUG-NEXT: store [[INT]] [[STATIC_S_A]], [[INT]]* [[RES_ADDR:[^,]+]] + // CHECK-TLS: [[STATIC_S_ADDR:%.*]] = call [[S3]]* [[STATIC_S_TLS_INITD:@[^,]+]] + // CHECK-TLS-NEXT: [[STATIC_S_A_ADDR:%.*]] = getelementptr inbounds [[S3]], [[S3]]* [[STATIC_S_ADDR]], i{{.*}} 0, i{{.*}} 0 + // CHECK-TLS-NEXT: [[STATIC_S_A:%.*]] = load i32, i32* [[STATIC_S_A_ADDR]] + // CHECK-TLS-NEXT: store i32 [[STATIC_S_A]], i32* [[RES_ADDR:[^,]+]] Res = Static::s.a; // CHECK: [[SM_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([[SMAIN]]* [[SM]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[SM]].cache.) // CHECK-NEXT: [[SM_ADDR:%.*]] = bitcast i8* [[SM_TEMP_ADDR]] to [[SMAIN]]* @@ -356,6 +402,11 @@ int main() { // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[SM_A]] // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]] + // [[SM]] was initialized already, so it can be used directly + // CHECK-TLS: [[SM_A:%.*]] = load i32, i32* getelementptr inbounds ([[SMAIN]], [[SMAIN]]* [[SM]], i{{.*}} 0, i{{.*}} 0) + // CHECK-TLS-NEXT: [[RES:%.*]] = load i32, i32* [[RES_ADDR]] + // CHECK-TLS-NEXT: [[ADD:%.*]] = add {{.*}} i32 [[RES]], [[SM_A]] + // CHECK-TLS-NEXT: store i32 [[ADD]], i32* [[RES_ADDR]] Res += sm.a; // CHECK: [[GS1_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([[S1]]* [[GS1]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[GS1]].cache.) // CHECK-NEXT: [[GS1_ADDR:%.*]] = bitcast i8* [[GS1_TEMP_ADDR]] to [[S1]]* @@ -373,6 +424,12 @@ int main() { // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[GS1_A]] // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]] + // CHECK-TLS: [[GS1_ADDR:%.*]] = call [[S1]]* [[GS1_TLS_INITD]] + // CHECK-TLS-NEXT: [[GS1_A_ADDR:%.*]] = getelementptr inbounds [[S1]], [[S1]]* [[GS1_ADDR]], i{{.*}} 0, i{{.*}} 0 + // CHECK-TLS-NEXT: [[GS1_A:%.*]] = load i32, i32* [[GS1_A_ADDR]] + // CHECK-TLS-NEXT: [[RES:%.*]] = load i32, i32* [[RES_ADDR]] + // CHECK-TLS-NEXT: [[ADD:%.*]] = add {{.*}} i32 [[RES]], [[GS1_A]] + // CHECK-TLS-NEXT: store i32 [[ADD]], i32* [[RES_ADDR]] Res += gs1.a; // CHECK: [[GS2_A:%.*]] = load [[INT]], [[INT]]* getelementptr inbounds ([[S2]], [[S2]]* [[GS2]], i{{.*}} 0, i{{.*}} 0) // CHECK-NEXT: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] @@ -382,6 +439,10 @@ int main() { // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[GS2_A]] // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]] + // CHECK-TLS: [[GS2_A:%.*]] = load [[INT]], [[INT]]* getelementptr inbounds ([[S2]], [[S2]]* [[GS2]], i{{.*}} 0, i{{.*}} 0) + // CHECK-TLS-NEXT: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] + // CHECK-TLS-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[GS2_A]] + // CHECK-TLS-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]] Res += gs2.a; // CHECK: [[GS3_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([[S5]]* [[GS3]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[GS3]].cache.) // CHECK-NEXT: [[GS3_ADDR:%.*]] = bitcast i8* [[GS3_TEMP_ADDR]] to [[S5]]* @@ -399,6 +460,12 @@ int main() { // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[GS3_A]] // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]] + // CHECK-TLS: [[GS3_ADDR:%.*]] = call [[S5]]* [[GS3_TLS_INITD:[^,]+]] + // CHECK-TLS-NEXT: [[GS3_A_ADDR:%.*]] = getelementptr inbounds [[S5]], [[S5]]* [[GS3_ADDR]], i{{.*}} 0, i{{.*}} 0 + // CHECK-TLS-NEXT: [[GS3_A:%.*]] = load i32, i32* [[GS3_A_ADDR]] + // CHECK-TLS-NEXT: [[RES:%.*]] = load i32, i32* [[RES_ADDR]] + // CHECK-TLS-NEXT: [[ADD:%.*]] = add nsw i32 [[RES]], [[GS3_A]] + // CHECK-TLS-NEXT: store i32 [[ADD]], i32* [[RES_ADDR]] Res += gs3.a; // CHECK: [[ARR_X_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([2 x [3 x [[S1]]]]* [[ARR_X]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[ARR_X]].cache.) // CHECK-NEXT: [[ARR_X_ADDR:%.*]] = bitcast i8* [[ARR_X_TEMP_ADDR]] to [2 x [3 x [[S1]]]]* @@ -420,6 +487,14 @@ int main() { // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[ARR_X_1_1_A]] // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]] + // CHECK-TLS: [[ARR_X_ADDR:%.*]] = call [2 x [3 x [[S1]]]]* [[ARR_X_TLS_INITD:[^,]+]] + // CHECK-TLS-NEXT: [[ARR_X_1_ADDR:%.*]] = getelementptr inbounds [2 x [3 x [[S1]]]], [2 x [3 x [[S1]]]]* [[ARR_X_ADDR]], i{{.*}} 0, i{{.*}} 1 + // CHECK-TLS-NEXT: [[ARR_X_1_1_ADDR:%.*]] = getelementptr inbounds [3 x [[S1]]], [3 x [[S1]]]* [[ARR_X_1_ADDR]], i{{.*}} 0, i{{.*}} 1 + // CHECK-TLS-NEXT: [[ARR_X_1_1_A_ADDR:%.*]] = getelementptr inbounds [[S1]], [[S1]]* [[ARR_X_1_1_ADDR]], i{{.*}} 0, i{{.*}} 0 + // CHECK-TLS-NEXT: [[ARR_X_1_1_A:%.*]] = load i32, i32* [[ARR_X_1_1_A_ADDR]] + // CHECK-TLS-NEXT: [[RES:%.*]] = load i32, i32* [[RES_ADDR]] + // CHECK-TLS-NEXT: [[ADD:%.*]] = add {{.*}} i32 [[RES]], [[ARR_X_1_1_A]] + // CHECK-TLS-NEXT: store i32 [[ADD]], i32* [[RES_ADDR]] Res += arr_x[1][1].a; // CHECK: [[ST_INT_ST_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([[INT]]* [[ST_INT_ST]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[ST_INT_ST]].cache.) // CHECK-NEXT: [[ST_INT_ST_ADDR:%.*]] = bitcast i8* [[ST_INT_ST_TEMP_ADDR]] to [[INT]]* @@ -435,6 +510,11 @@ int main() { // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[ST_INT_ST_VAL]] // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]] + // CHECK-TLS: [[ST_INT_ST_ADDR:%.*]] = call i32* [[ST_INT_ST_TLS_INITD:[^,]+]] + // CHECK-TLS-NEXT: [[ST_INT_ST_VAL:%.*]] = load i32, i32* [[ST_INT_ST_ADDR]] + // CHECK-TLS-NEXT: [[RES:%.*]] = load i32, i32* [[RES_ADDR]] + // CHECK-TLS-NEXT: [[ADD:%.*]] = add {{.*}} i32 [[RES]], [[ST_INT_ST_VAL]] + // CHECK-TLS-NEXT: store i32 [[ADD]], i32* [[RES_ADDR]] Res += ST<int>::st; // CHECK: [[ST_FLOAT_ST_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast (float* [[ST_FLOAT_ST]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[ST_FLOAT_ST]].cache.) // CHECK-NEXT: [[ST_FLOAT_ST_ADDR:%.*]] = bitcast i8* [[ST_FLOAT_ST_TEMP_ADDR]] to float* @@ -452,6 +532,12 @@ int main() { // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[FLOAT_TO_INT_CONV]] // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]] + // CHECK-TLS: [[ST_FLOAT_ST_ADDR:%.*]] = call float* [[ST_FLOAT_ST_TLS_INITD:[^,]+]] + // CHECK-TLS-NEXT: [[ST_FLOAT_ST_VAL:%.*]] = load float, float* [[ST_FLOAT_ST_ADDR]] + // CHECK-TLS-NEXT: [[FLOAT_TO_INT_CONV:%.*]] = fptosi float [[ST_FLOAT_ST_VAL]] to i32 + // CHECK-TLS-NEXT: [[RES:%.*]] = load i32, i32* [[RES_ADDR]] + // CHECK-TLS-NEXT: [[ADD:%.*]] = add {{.*}} i32 [[RES]], [[FLOAT_TO_INT_CONV]] + // CHECK-TLS-NEXT: store i32 [[ADD]], i32* [[RES_ADDR]] Res += static_cast<int>(ST<float>::st); // CHECK: [[ST_S4_ST_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([[S4]]* [[ST_S4_ST]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[ST_S4_ST]].cache.) // CHECK-NEXT: [[ST_S4_ST_ADDR:%.*]] = bitcast i8* [[ST_S4_ST_TEMP_ADDR]] to [[S4]]* @@ -469,11 +555,19 @@ int main() { // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[ST_S4_ST_A]] // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]] + // CHECK-TLS: [[ST_S4_ST_ADDR:%.*]] = call [[S4]]* [[ST_S4_ST_TLS_INITD:[^,]+]] + // CHECK-TLS-NEXT: [[ST_S4_ST_A_ADDR:%.*]] = getelementptr inbounds [[S4]], [[S4]]* [[ST_S4_ST_ADDR]], i{{.*}} 0, i{{.*}} 0 + // CHECK-TLS-NEXT: [[ST_S4_ST_A:%.*]] = load i32, i32* [[ST_S4_ST_A_ADDR]] + // CHECK-TLS-NEXT: [[RES:%.*]] = load i32, i32* [[RES_ADDR]] + // CHECK-TLS-NEXT: [[ADD:%.*]] = add {{.*}} i32 [[RES]], [[ST_S4_ST_A]] + // CHECK-TLS-NEXT: store i32 [[ADD]], i32* [[RES_ADDR]] Res += ST<S4>::st.a; // CHECK: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] // CHECK-NEXT: ret [[INT]] [[RES]] // CHECK-DEBUG: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] // CHECK-DEBUG-NEXT: ret [[INT]] [[RES]] + // CHECK-TLS: [[RES:%.*]] = load i32, i32* [[RES_ADDR]] + // CHECK-TLS-NEXT: ret i32 [[RES]] return Res; } // CHECK: } @@ -523,12 +617,47 @@ int main() { // CHECK-DEBUG: call {{.*}} [[SMAIN_DTOR:@.+]]([[SMAIN]]* // CHECK-DEBUG: } // CHECK-DEBUG: define {{.*}} [[SMAIN_DTOR]]([[SMAIN]]* {{.*}}) +// CHECK-TLS: define internal [[S1]]* [[GS1_TLS_INITD]] { +// CHECK-TLS-NEXT: call void [[GS1_TLS_INIT]] +// CHECK-TLS-NEXT: ret [[S1]]* [[GS1]] +// CHECK-TLS-NEXT: } +// CHECK-TLS: define internal void [[SM_CTOR1]]([[SMAIN]]* %this, i32 {{.*}}) {{.*}} { +// CHECK-TLS: void [[SM_CTOR2:@.*]]([[SMAIN]]* {{.*}}, i32 {{.*}}) +// CHECK-TLS: } +// CHECK-TLS: define internal void [[SM_DTOR1]]([[SMAIN]]* %this) {{.*}} { +// CHECK-TLS: void [[SM_DTOR2:@.*]]([[SMAIN]]* {{.*}}) +// CHECK-TLS: } +// CHECK-TLS: define {{.*}} [[S3]]* [[STATIC_S_TLS_INITD]] +// CHECK-TLS: call void [[STATIC_S_TLS_INIT:[^,]+]] +// CHECK-TLS: ret [[S3]]* [[STATIC_S]] +// CHECK-TLS: } +// CHECK-TLS: define {{.*}} [[S5]]* [[GS3_TLS_INITD]] +// CHECK-TLS: call void [[GS3_TLS_INIT:@[^,]+]] +// CHECK-TLS: ret [[S5]]* [[GS3]] +// CHECK-TLS: } +// CHECK-TLS: define {{.*}} [2 x [3 x [[S1]]]]* [[ARR_X_TLS_INITD]] +// CHECK-TLS: call void [[ARR_X_TLS_INIT]] +// CHECK-TLS: ret [2 x [3 x [[S1]]]]* [[ARR_X]] +// CHECK-TLS: } +// CHECK-TLS: define {{.*}} i32* [[ST_INT_ST_TLS_INITD]] { +// CHECK-TLS: call void [[ST_INT_ST_TLS_INIT]] +// CHECK-TLS: ret i32* [[ST_INT_ST]] +// CHECK-TLS: } +// CHECK-TLS: define {{.*}} float* [[ST_FLOAT_ST_TLS_INITD]] { +// CHECK-TLS: call void [[ST_FLOAT_ST_TLS_INIT]] +// CHECK-TLS: ret float* [[ST_FLOAT_ST]] +// CHECK-TLS: } +// CHECK-TLS: define {{.*}} [[S4]]* [[ST_S4_ST_TLS_INITD]] { +// CHECK-TLS: call void [[ST_S4_ST_TLS_INIT]] +// CHECK-TLS: ret [[S4]]* [[ST_S4_ST]] +// CHECK-TLS: } #endif #ifdef BODY // CHECK-LABEL: @{{.*}}foobar{{.*}}() // CHECK-DEBUG-LABEL: @{{.*}}foobar{{.*}}() +// CHECK-TLS: @{{.*}}foobar{{.*}}() int foobar() { // CHECK-DEBUG: [[KMPC_LOC_ADDR:%.*]] = alloca [[IDENT]] int Res; @@ -548,6 +677,10 @@ int foobar() { // CHECK-DEBUG-NEXT: [[STATIC_S_A_ADDR:%.*]] = getelementptr inbounds [[S3]], [[S3]]* [[STATIC_S_ADDR]], i{{.*}} 0, i{{.*}} 0 // CHECK-DEBUG-NEXT: [[STATIC_S_A:%.*]] = load [[INT]], [[INT]]* [[STATIC_S_A_ADDR]] // CHECK-DEBUG-NEXT: store [[INT]] [[STATIC_S_A]], [[INT]]* [[RES_ADDR:[^,]+]] + // CHECK-TLS: [[STATIC_S_ADDR:%.*]] = call [[S3]]* [[STATIC_S_TLS_INITD]] + // CHECK-TLS-NEXT: [[STATIC_S_A_ADDR:%.*]] = getelementptr inbounds [[S3]], [[S3]]* [[STATIC_S_ADDR]], i{{.*}} 0, i{{.*}} 0 + // CHECK-TLS-NEXT: [[STATIC_S_A:%.*]] = load i32, i32* [[STATIC_S_A_ADDR]] + // CHECK-TLS-NEXT: store i32 [[STATIC_S_A]], i32* [[RES_ADDR:[^,]+]] Res = Static::s.a; // CHECK: [[GS1_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([[S1]]* [[GS1]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[GS1]].cache.) // CHECK-NEXT: [[GS1_ADDR:%.*]] = bitcast i8* [[GS1_TEMP_ADDR]] to [[S1]]* @@ -565,6 +698,12 @@ int foobar() { // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[GS1_A]] // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]] + // CHECK-TLS: [[GS1_ADDR:%.*]] = call [[S1]]* [[GS1_TLS_INITD]] + // CHECK-TLS-NEXT: [[GS1_A_ADDR:%.*]] = getelementptr inbounds [[S1]], [[S1]]* [[GS1_ADDR]], i{{.*}} 0, i{{.*}} 0 + // CHECK-TLS-NEXT: [[GS1_A:%.*]] = load i32, i32* [[GS1_A_ADDR]] + // CHECK-TLS-NEXT: [[RES:%.*]] = load i32, i32* [[RES_ADDR]] + // CHECK-TLS-NEXT: [[ADD:%.*]] = add {{.*}} i32 [[RES]], [[GS1_A]] + // CHECK-TLS-NEXT: store i32 [[ADD]], i32* [[RES_ADDR]] Res += gs1.a; // CHECK: [[GS2_A:%.*]] = load [[INT]], [[INT]]* getelementptr inbounds ([[S2]], [[S2]]* [[GS2]], i{{.*}} 0, i{{.*}} 0) // CHECK-NEXT: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] @@ -574,6 +713,10 @@ int foobar() { // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[GS2_A]] // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]] + // CHECK-TLS: [[GS2_A:%.*]] = load i32, i32* getelementptr inbounds ([[S2]], [[S2]]* [[GS2]], i{{.*}} 0, i{{.*}} 0) + // CHECK-TLS-NEXT: [[RES:%.*]] = load i32, i32* [[RES_ADDR]] + // CHECK-TLS-NEXT: [[ADD:%.*]] = add {{.*}} i32 [[RES]], [[GS2_A]] + // CHECK-TLS-NEXT: store i32 [[ADD]], i32* [[RES:.+]] Res += gs2.a; // CHECK: [[GS3_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([[S5]]* [[GS3]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[GS3]].cache.) // CHECK-NEXT: [[GS3_ADDR:%.*]] = bitcast i8* [[GS3_TEMP_ADDR]] to [[S5]]* @@ -591,6 +734,12 @@ int foobar() { // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[GS3_A]] // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]] + // CHECK-TLS: [[GS3_ADDR:%.*]] = call [[S5]]* [[GS3_TLS_INITD]] + // CHECK-TLS-DEBUG: [[GS3_A_ADDR:%.*]] = getelementptr inbounds [[S5]], [[S5]]* [[GS3_ADDR]], i{{.*}} 0, i{{.*}} 0 + // CHECK-TLS-DEBUG: [[GS3_A:%.*]] = load i32, i32* [[GS3_A_ADDR]] + // CHECK-TLS-DEBUG: [[RES:%.*]] = load i32, i32* [[RES_ADDR]] + // CHECK-TLS-DEBUG: [[ADD:%.*]]= add nsw i32 [[RES]], [[GS3_A]] + // CHECK-TLS-DEBUG: store i32 [[ADD]], i32* [[RES_ADDR]] Res += gs3.a; // CHECK: [[ARR_X_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([2 x [3 x [[S1]]]]* [[ARR_X]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[ARR_X]].cache.) // CHECK-NEXT: [[ARR_X_ADDR:%.*]] = bitcast i8* [[ARR_X_TEMP_ADDR]] to [2 x [3 x [[S1]]]]* @@ -612,6 +761,14 @@ int foobar() { // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[ARR_X_1_1_A]] // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]] + // CHECK-TLS: [[ARR_X_ADDR:%.*]] = call [2 x [3 x [[S1]]]]* [[ARR_X_TLS_INITD]] + // CHECK-TLS-NEXT: [[ARR_X_1_ADDR:%.*]] = getelementptr inbounds [2 x [3 x [[S1]]]], [2 x [3 x [[S1]]]]* [[ARR_X_ADDR]], i{{.*}} 0, i{{.*}} 1 + // CHECK-TLS-NEXT: [[ARR_X_1_1_ADDR:%.*]] = getelementptr inbounds [3 x [[S1]]], [3 x [[S1]]]* [[ARR_X_1_ADDR]], i{{.*}} 0, i{{.*}} 1 + // CHECK-TLS-NEXT: [[ARR_X_1_1_A_ADDR:%.*]] = getelementptr inbounds [[S1]], [[S1]]* [[ARR_X_1_1_ADDR]], i{{.*}} 0, i{{.*}} 0 + // CHECK-TLS-NEXT: [[ARR_X_1_1_A:%.*]] = load [[INT]], [[INT]]* [[ARR_X_1_1_A_ADDR]] + // CHECK-TLS-NEXT: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] + // CHECK-TLS-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[ARR_X_1_1_A]] + // CHECK-TLS-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]] Res += arr_x[1][1].a; // CHECK: [[ST_INT_ST_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([[INT]]* [[ST_INT_ST]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[ST_INT_ST]].cache.) // CHECK-NEXT: [[ST_INT_ST_ADDR:%.*]] = bitcast i8* [[ST_INT_ST_TEMP_ADDR]] to [[INT]]* @@ -627,6 +784,11 @@ int foobar() { // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[ST_INT_ST_VAL]] // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]] + // CHECK-TLS: [[ST_INT_ST_ADDR:%.*]] = call i32* [[ST_INT_ST_TLS_INITD]] + // CHECK-TLS-NEXT: [[ST_INT_ST_VAL:%.*]] = load [[INT]], [[INT]]* [[ST_INT_ST_ADDR]] + // CHECK-TLS-NEXT: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] + // CHECK-TLS-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[ST_INT_ST_VAL]] + // CHECK-TLS-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]] Res += ST<int>::st; // CHECK: [[ST_FLOAT_ST_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast (float* [[ST_FLOAT_ST]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[ST_FLOAT_ST]].cache.) // CHECK-NEXT: [[ST_FLOAT_ST_ADDR:%.*]] = bitcast i8* [[ST_FLOAT_ST_TEMP_ADDR]] to float* @@ -644,6 +806,12 @@ int foobar() { // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[FLOAT_TO_INT_CONV]] // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]] + // CHECK-TLS: [[ST_FLOAT_ST_ADDR:%.*]] = call float* [[ST_FLOAT_ST_TLS_INITD]] + // CHECK-TLS-NEXT: [[ST_FLOAT_ST_VAL:%.*]] = load float, float* [[ST_FLOAT_ST_ADDR]] + // CHECK-TLS-NEXT: [[FLOAT_TO_INT_CONV:%.*]] = fptosi float [[ST_FLOAT_ST_VAL]] to [[INT]] + // CHECK-TLS-NEXT: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] + // CHECK-TLS-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[FLOAT_TO_INT_CONV]] + // CHECK-TLS-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]] Res += static_cast<int>(ST<float>::st); // CHECK: [[ST_S4_ST_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([[S4]]* [[ST_S4_ST]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[ST_S4_ST]].cache.) // CHECK-NEXT: [[ST_S4_ST_ADDR:%.*]] = bitcast i8* [[ST_S4_ST_TEMP_ADDR]] to [[S4]]* @@ -661,11 +829,19 @@ int foobar() { // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[ST_S4_ST_A]] // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]] + // CHECK-TLS: [[ST_S4_ST_ADDR:%.*]] = call [[S4]]* [[ST_S4_ST_TLS_INITD]] + // CHECK-TLS-NEXT: [[ST_S4_ST_A_ADDR:%.*]] = getelementptr inbounds [[S4]], [[S4]]* [[ST_S4_ST_ADDR]], i{{.*}} 0, i{{.*}} 0 + // CHECK-TLS-NEXT: [[ST_S4_ST_A:%.*]] = load [[INT]], [[INT]]* [[ST_S4_ST_A_ADDR]] + // CHECK-TLS-NEXT: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] + // CHECK-TLS-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[ST_S4_ST_A]] + // CHECK-TLS-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]] Res += ST<S4>::st.a; // CHECK: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] // CHECK-NEXT: ret [[INT]] [[RES]] // CHECK-DEBUG: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] // CHECK-DEBUG-NEXT: ret [[INT]] [[RES]] + // CHECK-TLS: [[RES:%.*]] = load [[INT]], [[INT]]* [[RES_ADDR]] + // CHECK-TLS-NEXT: ret [[INT]] [[RES]] return Res; } #endif @@ -706,3 +882,71 @@ int foobar() { // CHECK: ret void // CHECK-DEBUG: define internal {{.*}}void {{@.*}}() // CHECK-DEBUG: ret void + +// CHECK-TLS: define internal void [[GS1_CXX_INIT:@.*]]() +// CHECK-TLS: call void [[GS1_CTOR1:@.*]]([[S1]]* [[GS1]], i32 5) +// CHECK-TLS: call i32 @__cxa_thread_atexit(void (i8*)* bitcast (void ([[S1]]*)* [[GS1_DTOR1:.*]] to void (i8*)*), i8* bitcast ([[S1]]* [[GS1]] to i8*) +// CHECK-TLS: } +// CHECK-TLS: define {{.*}}void [[GS1_CTOR1]]([[S1]]* {{.*}}, i32 {{.*}}) +// CHECK-TLS: call void [[GS1_CTOR2:@.*]]([[S1]]* {{.*}}, i32 {{.*}}) +// CHECK-TLS: } +// CHECK-TLS: define {{.*}}void [[GS1_DTOR1]]([[S1]]* {{.*}}) +// CHECK-TLS: call void [[GS1_DTOR2:@.*]]([[S1]]* {{.*}}) +// CHECK-TLS: } +// CHECK-TLS: define {{.*}}void [[GS1_CTOR2]]([[S1]]* {{.*}}, i32 {{.*}}) +// CHECK-TLS: define {{.*}}void [[GS1_DTOR2]]([[S1]]* {{.*}}) + +// CHECK-TLS: define internal void [[GS2_CXX_INIT:@.*]]() +// CHECK-TLS: call void [[GS2_CTOR1:@.*]]([[S2]]* [[GS2]], i32 27) +// CHECK-TLS: call i32 @__cxa_atexit(void (i8*)* bitcast (void ([[S2]]*)* [[GS2_DTOR1:.*]] to void (i8*)*), i8* bitcast ([[S2]]* [[GS2]] to i8*) +// CHECK-TLS: } +// CHECK-TLS: define {{.*}}void [[GS2_CTOR1]]([[S2]]* {{.*}}, i32 {{.*}}) +// CHECK-TLS: call void [[GS2_CTOR2:@.*]]([[S2]]* {{.*}}, i32 {{.*}}) +// CHECK-TLS: } +// CHECK-TLS: define {{.*}}void [[GS2_DTOR1]]([[S2]]* {{.*}}) +// CHECK-TLS: call void [[GS2_DTOR2:@.*]]([[S2]]* {{.*}}) +// CHECK-TLS: } +// CHECK-TLS: define {{.*}}void [[GS2_CTOR2]]([[S2]]* {{.*}}, i32 {{.*}}) +// CHECK-TLS: define {{.*}}void [[GS2_DTOR2]]([[S2]]* {{.*}}) + +// CHECK-TLS: define internal void [[ARR_X_CXX_INIT:@.*]]() +// CHECK-TLS: invoke void [[GS1_CTOR1]]([[S1]]* getelementptr inbounds ([2 x [3 x [[S1]]]], [2 x [3 x [[S1]]]]* [[ARR_X]], i{{.*}} 0, i{{.*}} 0, i{{.*}} 0), i{{.*}} 1) +// CHECK-TLS: invoke void [[GS1_CTOR1]]([[S1]]* getelementptr inbounds ([2 x [3 x [[S1]]]], [2 x [3 x [[S1]]]]* [[ARR_X]], i{{.*}} 0, i{{.*}} 0, i{{.*}} 1), i{{.*}} 2) +// CHECK-TLS: invoke void [[GS1_CTOR1]]([[S1]]* getelementptr inbounds ([2 x [3 x [[S1]]]], [2 x [3 x [[S1]]]]* [[ARR_X]], i{{.*}} 0, i{{.*}} 0, i{{.*}} 2), i{{.*}} 3) +// CHECK-TLS: invoke void [[GS1_CTOR1]]([[S1]]* getelementptr inbounds ([2 x [3 x [[S1]]]], [2 x [3 x [[S1]]]]* [[ARR_X]], i{{.*}} 0, i{{.*}} 1, i{{.*}} 0), i{{.*}} 4) +// CHECK-TLS: invoke void [[GS1_CTOR1]]([[S1]]* getelementptr inbounds ([2 x [3 x [[S1]]]], [2 x [3 x [[S1]]]]* [[ARR_X]], i{{.*}} 0, i{{.*}} 1, i{{.*}} 1), i{{.*}} 5) +// CHECK-TLS: invoke void [[GS1_CTOR1]]([[S1]]* getelementptr inbounds ([2 x [3 x [[S1]]]], [2 x [3 x [[S1]]]]* [[ARR_X]], i{{.*}} 0, i{{.*}} 1, i{{.*}} 2), i{{.*}} 6) +// CHECK-TLS: call i32 @__cxa_thread_atexit(void (i8*)* [[ARR_X_CXX_DTOR:@[^,]+]] +// CHECK-TLS: define internal void [[ARR_X_CXX_DTOR]](i8*) +// CHECK-TLS: void [[GS1_DTOR1]]([[S1]]* {{.*}}) + +// CHECK-TLS: define {{.*}}void [[SM_CTOR2]]([[SMAIN]]* {{.*}}, i32 {{.*}}) +// CHECK-TLS: define {{.*}}void [[SM_DTOR2]]([[SMAIN]]* {{.*}}) + +// CHECK-TLS: define internal void [[ST_S4_ST_CXX_INIT:@.*]]() +// CHECK-TLS: call void [[ST_S4_ST_CTOR1:@.*]]([[S4]]* [[ST_S4_ST]], i32 23) +// CHECK-TLS: call i32 @__cxa_thread_atexit(void (i8*)* bitcast (void ([[S4]]*)* [[ST_S4_ST_DTOR1:.*]] to void (i8*)*), i8* bitcast ([[S4]]* [[ST_S4_ST]] to i8*) +// CHECK-TLS: } +// CHECK-TLS: define {{.*}}void [[ST_S4_ST_CTOR1]]([[S4]]* {{.*}}, i32 {{.*}}) +// CHECK-TLS: call void [[ST_S4_ST_CTOR2:@.*]]([[S4]]* {{.*}}, i32 {{.*}}) +// CHECK-TLS: } +// CHECK-TLS: define {{.*}}void [[ST_S4_ST_DTOR1]]([[S4]]* {{.*}}) +// CHECK-TLS: call void [[ST_S4_ST_DTOR2:@.*]]([[S4]]* {{.*}}) +// CHECK-TLS: } +// CHECK-TLS: define {{.*}}void [[ST_S4_ST_CTOR2]]([[S4]]* {{.*}}, i32 {{.*}}) +// CHECK-TLS: define {{.*}}void [[ST_S4_ST_DTOR2]]([[S4]]* {{.*}}) + +// CHECK-TLS: define internal void @__tls_init() +// CHECK-TLS: [[GRD:%.*]] = load i8, i8* @__tls_guard +// CHECK-TLS-NEXT: [[IS_INIT:%.*]] = icmp eq i8 [[GRD]], 0 +// CHECK-TLS-NEXT: store i8 1, i8* @__tls_guard +// CHECK-TLS-NEXT: br i1 [[IS_INIT]], label %[[INIT_LABEL:[^,]+]], label %[[DONE_LABEL:[^,]+]]{{.*}} +// CHECK-TLS: [[INIT_LABEL]] +// CHECK-TLS: call void [[GS1_CXX_INIT]] +// CHECK-TLS-NOT call void [[GS2_CXX_INIT]] +// CHECK-TLS: call void [[ARR_X_CXX_INIT]] +// CHECK-TLS: call void [[ST_S4_ST_CXX_INIT]] +// CHECK-TLS: [[DONE_LABEL]] + +// CHECK-TLS: declare {{.*}} void [[GS3_TLS_INIT]] +// CHECK-TLS: declare {{.*}} void [[STATIC_S_TLS_INIT]] diff --git a/test/OpenMP/threadprivate_messages.cpp b/test/OpenMP/threadprivate_messages.cpp index 70ab5441aba0..39a4431f0c5b 100644 --- a/test/OpenMP/threadprivate_messages.cpp +++ b/test/OpenMP/threadprivate_messages.cpp @@ -1,3 +1,4 @@ +// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp -fnoopenmp-use-tls -ferror-limit 100 -emit-llvm -o - %s // RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp -ferror-limit 100 -emit-llvm -o - %s #pragma omp threadprivate // expected-error {{expected '(' after 'threadprivate'}} diff --git a/test/PCH/__va_list_tag.c b/test/PCH/__va_list_tag.c index efe5c1b36630..81cda8963b23 100644 --- a/test/PCH/__va_list_tag.c +++ b/test/PCH/__va_list_tag.c @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target // PR13189 // rdar://problem/11741429 // Test this without pch. diff --git a/test/PCH/arc.m b/test/PCH/arc.m index 466b31705596..63c77778f40a 100644 --- a/test/PCH/arc.m +++ b/test/PCH/arc.m @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target // Test this without pch. // RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin11 -fobjc-arc -include %S/Inputs/arc.h -fsyntax-only -emit-llvm-only %s diff --git a/test/PCH/asm.c b/test/PCH/asm.c index 160829b7a6e7..cabd03cac9ae 100644 --- a/test/PCH/asm.c +++ b/test/PCH/asm.c @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target // Test this without pch. // RUN: %clang_cc1 -triple i386-unknown-unknown -include %S/asm.h -fsyntax-only -verify %s diff --git a/test/PCH/chain-external-defs.c b/test/PCH/chain-external-defs.c index 742229442865..f7c723338996 100644 --- a/test/PCH/chain-external-defs.c +++ b/test/PCH/chain-external-defs.c @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target // Test with pch. // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-pch -o %t1.pch %S/Inputs/chain-external-defs1.h // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-pch -o %t2.pch %S/Inputs/chain-external-defs2.h -include-pch %t1.pch diff --git a/test/PCH/chain-openmp-threadprivate.cpp b/test/PCH/chain-openmp-threadprivate.cpp index a2a885ae8cfd..c75b872ba2a0 100644 --- a/test/PCH/chain-openmp-threadprivate.cpp +++ b/test/PCH/chain-openmp-threadprivate.cpp @@ -1,7 +1,16 @@ // no PCH -// RUN: %clang_cc1 -fopenmp -emit-llvm -include %s -include %s %s -o - | FileCheck %s +// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -emit-llvm -include %s -include %s %s -o - | FileCheck %s // with PCH -// RUN: %clang_cc1 -fopenmp -emit-llvm -chain-include %s -chain-include %s %s -o - | FileCheck %s +// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -emit-llvm -chain-include %s -chain-include %s %s -o - | FileCheck %s +// no PCH +// RUN: %clang_cc1 -fopenmp -emit-llvm -include %s -include %s %s -o - | FileCheck %s -check-prefix=CHECK-TLS-1 +// RUN: %clang_cc1 -fopenmp -emit-llvm -include %s -include %s %s -o - | FileCheck %s -check-prefix=CHECK-TLS-2 +// with PCH +// RUN: %clang_cc1 -fopenmp -emit-llvm -chain-include %s -chain-include %s %s -o - | FileCheck %s -check-prefix=CHECK-TLS-1 +// RUN: %clang_cc1 -fopenmp -emit-llvm -chain-include %s -chain-include %s %s -o - | FileCheck %s -check-prefix=CHECK-TLS-2 + +// REQUIRES: tls + #if !defined(PASS1) #define PASS1 @@ -16,11 +25,17 @@ int *a = malloc(20); #else // CHECK: call {{.*}} @__kmpc_threadprivate_register( +// CHECK-TLS-1: @{{a|\"\\01\?a@@3PE?AHE?A\"}} = {{.*}}thread_local {{.*}}global {{.*}}i32* // CHECK-LABEL: foo +// CHECK-TLS-LABEL: foo int foo() { return *a; // CHECK: call {{.*}} @__kmpc_global_thread_num( // CHECK: call {{.*}} @__kmpc_threadprivate_cached( + // CHECK-TLS-1: call {{.*}} @{{_ZTW1a|\"\\01\?\?__Ea@@YAXXZ\"}}() } + +// CHECK-TLS-2: define {{.*}} @{{_ZTW1a|\"\\01\?\?__Ea@@YAXXZ\"}}() + #endif diff --git a/test/PCH/chain-trivial.c b/test/PCH/chain-trivial.c index a0f5827fb91d..4cc7890de04f 100644 --- a/test/PCH/chain-trivial.c +++ b/test/PCH/chain-trivial.c @@ -1,2 +1,3 @@ +// REQUIRES: x86-registered-target // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-pch -o %t1 %S/Inputs/chain-trivial1.h // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-pch -o %t2 -include-pch %t1 %S/Inputs/chain-trivial2.h diff --git a/test/PCH/cxx-ms-function-specialization-class-scope.cpp b/test/PCH/cxx-ms-function-specialization-class-scope.cpp index afbb80b7376e..f97a8d183c7a 100644 --- a/test/PCH/cxx-ms-function-specialization-class-scope.cpp +++ b/test/PCH/cxx-ms-function-specialization-class-scope.cpp @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target // RUN: %clang_cc1 -fms-extensions -triple i386-unknown-unknown -x c++-header -emit-pch -o %t %S/cxx-ms-function-specialization-class-scope.h // RUN: %clang_cc1 -fms-extensions -triple i386-unknown-unknown -include-pch %t -fsyntax-only -verify %s // expected-no-diagnostics diff --git a/test/PCH/cxx1y-variable-templates.cpp b/test/PCH/cxx1y-variable-templates.cpp index 77eeea22a23d..29b66a11e8ce 100644 --- a/test/PCH/cxx1y-variable-templates.cpp +++ b/test/PCH/cxx1y-variable-templates.cpp @@ -89,8 +89,8 @@ namespace join { namespace diff_types { #ifdef ERROR - template<typename T> extern T err0; // expected-error {{redefinition of 'err0' with a different type: 'T' vs 'float'}} // expected-note@42 {{previous definition is here}} - template<typename T> extern float err1; // expected-error {{redefinition of 'err1' with a different type: 'float' vs 'T'}} // expected-note@43 {{previous definition is here}} + template<typename T> extern T err0; // expected-error {{redeclaration of 'err0' with a different type: 'T' vs 'float'}} // expected-note@42 {{previous declaration is here}} + template<typename T> extern float err1; // expected-error {{redeclaration of 'err1' with a different type: 'float' vs 'T'}} // expected-note@43 {{previous declaration is here}} #endif template<typename T> extern T def; } diff --git a/test/PCH/external-defs.c b/test/PCH/external-defs.c index 5c2582a9c361..5e906b246bc7 100644 --- a/test/PCH/external-defs.c +++ b/test/PCH/external-defs.c @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target // Test with pch. // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-pch -o %t.pch %S/external-defs.h // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -include-pch %t.pch -emit-llvm -o %t %s diff --git a/test/PCH/floating-literal.c b/test/PCH/floating-literal.c index 738e45a41517..b5ff6fe84b88 100644 --- a/test/PCH/floating-literal.c +++ b/test/PCH/floating-literal.c @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -triple mips64-none-linux-gnu -emit-pch -o %t %s +// REQUIRES: mips-registered-target // RUN: %clang_cc1 -x ast -ast-print %t | FileCheck %s // Make sure the semantics of FloatingLiterals are stored correctly in diff --git a/test/PCH/local_static.cpp b/test/PCH/local_static.cpp index 1085d81d3175..b4131bffde22 100644 --- a/test/PCH/local_static.cpp +++ b/test/PCH/local_static.cpp @@ -1,3 +1,4 @@ +// REQUIRES: x86-registered-target // Test this without PCH. // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9.0 -include %S/local_static.h -fsyntax-only %s -emit-llvm -o %t.no_pch.ll %s // RUN: FileCheck --input-file %t.no_pch.ll %s diff --git a/test/PCH/objc_kindof.m b/test/PCH/objc_kindof.m new file mode 100644 index 000000000000..437c41710408 --- /dev/null +++ b/test/PCH/objc_kindof.m @@ -0,0 +1,33 @@ +// RUN: %clang_cc1 -emit-pch %s -o %t +// RUN: %clang_cc1 -include-pch %t -verify %s + +#ifndef HEADER_INCLUDED + +#define HEADER_INCLUDED +@protocol NSObject +@end + +@protocol NSCopying +@end + +__attribute__((objc_root_class)) +@interface NSObject <NSObject> +@end + +@interface NSString : NSObject <NSCopying> +@end + +@interface NSMutableString : NSString +@end + +@interface NSNumber : NSObject <NSCopying> +@end + +extern __kindof NSObject <NSCopying> *kindof_NSObject_NSCopying; + +#else +void testPrettyPrint(int *ip) { + ip = kindof_NSObject_NSCopying; // expected-warning{{from '__kindof NSObject<NSCopying> *'}} +} + +#endif diff --git a/test/PCH/objc_parameterized_classes.m b/test/PCH/objc_parameterized_classes.m new file mode 100644 index 000000000000..0c1885871045 --- /dev/null +++ b/test/PCH/objc_parameterized_classes.m @@ -0,0 +1,45 @@ +// RUN: %clang_cc1 -emit-pch %s -o %t +// RUN: %clang_cc1 -include-pch %t -verify %s + +#ifndef HEADER_INCLUDED + +#define HEADER_INCLUDED + +@protocol NSObject +@end + +__attribute__((objc_root_class)) +@interface NSObject +@end + +@interface PC1<__covariant T, U : NSObject *> : NSObject +// expected-note@-2{{type parameter 'U' declared here}} +@end + +@interface PC1<__covariant T, U : NSObject *> (Cat1) +@end + +typedef PC1<id, NSObject *> PC1Specialization1; + +typedef PC1Specialization1 <NSObject> PC1Specialization2; +#else + +@interface PC1<T : NSObject *, // expected-error{{type bound 'NSObject *' for type parameter 'T' conflicts with implicit bound 'id}} + // expected-note@15{{type parameter 'T' declared here}} + U : id> (Cat2) // expected-error{{type bound 'id' for type parameter 'U' conflicts with previous bound 'NSObject *'}} + // expected-note@15{{type parameter 'U' declared here}} +@end + +typedef PC1Specialization1<id, NSObject *> PC1Specialization3; // expected-error{{type arguments cannot be applied to already-specialized class type 'PC1Specialization1' (aka 'PC1<id,NSObject *>')}} + +typedef PC1Specialization2<id, NSObject *> PC1Specialization4; // expected-error{{already-specialized class type 'PC1Specialization2' (aka 'PC1Specialization1<NSObject>')}} + +@interface NSString : NSObject +@end + +void testCovariance(PC1<NSObject *, NSObject *> *pc1a, + PC1<NSString *, NSObject *> *pc1b) { + pc1a = pc1b; +} + +#endif diff --git a/test/PCH/pchpch.c b/test/PCH/pchpch.c index d68a6ad4aee6..5ea661abd555 100644 --- a/test/PCH/pchpch.c +++ b/test/PCH/pchpch.c @@ -1,6 +1,7 @@ // RUN: %clang_cc1 -triple i386-unknown-unknown -emit-pch -o %t1 %S/pchpch1.h // RUN: %clang_cc1 -triple i386-unknown-unknown -emit-pch -o %t2 %S/pchpch2.h -include-pch %t1 // RUN: %clang_cc1 -triple i386-unknown-unknown -fsyntax-only %s -include-pch %t2 +// REQUIRES: x86-registered-target // The purpose of this test is to make sure that a PCH created while including // an existing PCH can be loaded. diff --git a/test/PCH/reloc.c b/test/PCH/reloc.c index 8dabb8b03d0b..bf70ab6f6922 100644 --- a/test/PCH/reloc.c +++ b/test/PCH/reloc.c @@ -3,6 +3,7 @@ // RUN: %clang -target x86_64-apple-darwin10 -fsyntax-only \ // RUN: -include-pch %t -isysroot %S/libroot %s -Xclang -verify // RUN: not %clang -target x86_64-apple-darwin10 -include-pch %t %s +// REQUIRES: x86-registered-target #include <reloc.h> diff --git a/test/PCH/subscripting-literals.m b/test/PCH/subscripting-literals.m index 725e5802a5dd..52491dbc2008 100644 --- a/test/PCH/subscripting-literals.m +++ b/test/PCH/subscripting-literals.m @@ -1,6 +1,7 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o %t.nopch.ll %s // RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-pch -o %t.pch %s // RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o %t.pch.ll %s -include-pch %t.pch +// REQUIRES: x86-registered-target // RUN: diff %t.nopch.ll %t.pch.ll #ifndef HEADER diff --git a/test/PCH/target-options.c b/test/PCH/target-options.c index 2b85efe07abf..06a09502f9ab 100644 --- a/test/PCH/target-options.c +++ b/test/PCH/target-options.c @@ -1,5 +1,6 @@ // RUN: %clang_cc1 -triple=x86_64-apple-darwin9 -emit-pch -o %t.pch %S/target-options.h // RUN: not %clang_cc1 -triple=x86_64-unknown-freebsd7.0 -include-pch %t.pch %s -emit-llvm -o - > %t.err 2>&1 // RUN: FileCheck %s < %t.err +// REQUIRES: x86-registered-target // CHECK: for the target diff --git a/test/PCH/tentative-defs.c b/test/PCH/tentative-defs.c index 42882307dc73..7163316a93de 100644 --- a/test/PCH/tentative-defs.c +++ b/test/PCH/tentative-defs.c @@ -1,6 +1,7 @@ // Test with pch. // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-pch -o %t.pch %S/tentative-defs.h // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -include-pch %t.pch -verify -emit-llvm -o %t %s +// REQUIRES: x86-registered-target // RUN: grep "@variable = common global i32 0" %t | count 1 // RUN: grep "@incomplete_array = common global .*1 x i32" %t | count 1 diff --git a/test/PCH/thread-local.cpp b/test/PCH/thread-local.cpp index f65c12af0925..ab37f7b3f7ed 100644 --- a/test/PCH/thread-local.cpp +++ b/test/PCH/thread-local.cpp @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -pedantic-errors -std=c++11 -triple x86_64-linux-gnu -emit-pch %s -o %t // RUN: %clang_cc1 -pedantic-errors -std=c++11 -triple x86_64-linux-gnu -include-pch %t -verify %s - +// REQUIRES: x86-registered-target #ifndef HEADER_INCLUDED #define HEADER_INCLUDED diff --git a/test/PCH/va_arg.c b/test/PCH/va_arg.c index 1fb2a838e4f7..dba9eea8de42 100644 --- a/test/PCH/va_arg.c +++ b/test/PCH/va_arg.c @@ -1,5 +1,6 @@ // Test this without pch. // RUN: %clang_cc1 -triple=x86_64-unknown-freebsd7.0 -include %S/va_arg.h %s -emit-llvm -o - +// REQUIRES: x86-registered-target // Test with pch. // RUN: %clang_cc1 -triple=x86_64-unknown-freebsd7.0 -emit-pch -o %t %S/va_arg.h diff --git a/test/PCH/va_arg.cpp b/test/PCH/va_arg.cpp index 7c8dc6b316f3..0b3c3b107c06 100644 --- a/test/PCH/va_arg.cpp +++ b/test/PCH/va_arg.cpp @@ -1,5 +1,6 @@ // Test this without pch. // RUN: %clang_cc1 -triple=x86_64-unknown-freebsd7.0 -include %S/Inputs/va_arg.h %s -emit-llvm -o - +// REQUIRES: x86-registered-target // Test with pch. // RUN: %clang_cc1 -triple=x86_64-unknown-freebsd7.0 -emit-pch -x c++-header -o %t %S/Inputs/va_arg.h diff --git a/test/Parser/MicrosoftExtensions.c b/test/Parser/MicrosoftExtensions.c index 389cf6dfc03c..a29f6c0b5492 100644 --- a/test/Parser/MicrosoftExtensions.c +++ b/test/Parser/MicrosoftExtensions.c @@ -55,8 +55,6 @@ int foo1([SA_Post(attr=1)] void *param); [unbalanced(attribute) /* expected-note {{to match this '['}} */ void f(void); /* expected-error {{expected ']'}} */ -[] __interface I {}; /* expected-error {{Microsoft attribute block cannot be empty}} */ - void ms_intrinsics(int a) { __noop(); __assume(a); diff --git a/test/Parser/MicrosoftExtensions.cpp b/test/Parser/MicrosoftExtensions.cpp index 1686515d6881..e674d0101e97 100644 --- a/test/Parser/MicrosoftExtensions.cpp +++ b/test/Parser/MicrosoftExtensions.cpp @@ -400,3 +400,10 @@ static_assert(__alignof(struct align_before_key1) == 16, ""); static_assert(__alignof(struct align_before_key2) == 16, ""); static_assert(__alignof(struct align_before_key3) == 16, ""); } + +namespace PR24027 { +struct S { + template <typename T> + S(T); +} f([] {}); +} diff --git a/test/Parser/cxx-default-delete.cpp b/test/Parser/cxx-default-delete.cpp index df24b3d0075a..8766d861732e 100644 --- a/test/Parser/cxx-default-delete.cpp +++ b/test/Parser/cxx-default-delete.cpp @@ -19,5 +19,5 @@ struct foo { void baz() = delete; struct quux { - int quux() = default; // expected-error{{constructor cannot have a return type}} expected-error {{member 'quux' has the same name as its class}} + int quux() = default; // expected-error{{constructor cannot have a return type}} }; diff --git a/test/Parser/objc-error-qualified-implementation.m b/test/Parser/objc-error-qualified-implementation.m index 664737223e67..179e2d27479b 100644 --- a/test/Parser/objc-error-qualified-implementation.m +++ b/test/Parser/objc-error-qualified-implementation.m @@ -17,7 +17,7 @@ @interface K @end -@implementation K <P // expected-error {{@implementation declaration cannot be protocol qualified}} +@implementation K <P // expected-error {{@implementation declaration cannot be protocol qualified}} expected-note{{to match this '<'}} @end // expected-error {{expected '>'}} // rdar://13920026 diff --git a/test/Parser/objcxx11-protocol-in-template.mm b/test/Parser/objcxx11-protocol-in-template.mm index 8cb499396d42..c5c3b6c75a47 100644 --- a/test/Parser/objcxx11-protocol-in-template.mm +++ b/test/Parser/objcxx11-protocol-in-template.mm @@ -4,12 +4,7 @@ template<class T> class vector {}; @protocol P @end -#if __cplusplus >= 201103L - // expected-no-diagnostics -#else - // expected-error@14{{a space is required between consecutive right angle brackets}} - // expected-error@15{{a space is required between consecutive right angle brackets}} -#endif +// expected-no-diagnostics vector<id<P>> v; vector<vector<id<P>>> v2; diff --git a/test/Parser/placeholder-recovery.m b/test/Parser/placeholder-recovery.m index 3fe1d62c3042..b43b0e4a57cb 100644 --- a/test/Parser/placeholder-recovery.m +++ b/test/Parser/placeholder-recovery.m @@ -3,10 +3,9 @@ // FIXME: We could do much better with this, if we recognized // placeholders somehow. However, we're content with not generating // bogus 'archaic' warnings with bad location info. -@protocol <#protocol name#> <NSObject> // expected-error 2{{expected identifier}} \ -// expected-error{{cannot find protocol declaration for 'NSObject'}} \ +@protocol <#protocol name#> <NSObject> // expected-error {{expected identifier or '('}} \ +// expected-error 2{{expected identifier}} \ // expected-warning{{protocol has no object type specified; defaults to qualified 'id'}} +<#methods#> -<#methods#> // expected-error{{expected identifier}} - -@end // expected-error{{prefix attribute}} +@end diff --git a/test/Profile/Inputs/gcc-flag-compatibility.proftext b/test/Profile/Inputs/gcc-flag-compatibility.proftext new file mode 100644 index 000000000000..99d41bb03f39 --- /dev/null +++ b/test/Profile/Inputs/gcc-flag-compatibility.proftext @@ -0,0 +1,5 @@ +main +4 +2 +1 +100 diff --git a/test/Profile/gcc-flag-compatibility.c b/test/Profile/gcc-flag-compatibility.c new file mode 100644 index 000000000000..5f76c62483f4 --- /dev/null +++ b/test/Profile/gcc-flag-compatibility.c @@ -0,0 +1,43 @@ +// Tests for -fprofile-generate and -fprofile-use flag compatibility. These two +// flags behave similarly to their GCC counterparts: +// +// -fprofile-generate Generates the profile file ./default.profraw +// -fprofile-generate=<dir> Generates the profile file <dir>/default.profraw +// -fprofile-use Uses the profile file ./default.profdata +// -fprofile-use=<dir> Uses the profile file <dir>/default.profdata +// -fprofile-use=<dir>/file Uses the profile file <dir>/file + +// Check that -fprofile-generate uses the runtime default profile file. +// RUN: %clang %s -c -S -o - -emit-llvm -fprofile-generate | FileCheck -check-prefix=PROFILE-GEN %s +// PROFILE-GEN: @__llvm_profile_runtime = external global i32 +// PROFILE-GEN-NOT: call void @__llvm_profile_override_default_filename +// PROFILE-GEN-NOT: declare void @__llvm_profile_override_default_filename(i8*) + +// Check that -fprofile-generate=/path/to generates /path/to/default.profraw +// RUN: %clang %s -c -S -o - -emit-llvm -fprofile-generate=/path/to | FileCheck -check-prefix=PROFILE-GEN-EQ %s +// PROFILE-GEN-EQ: private constant [25 x i8] c"/path/to{{/|\\5C}}default.profraw\00" +// PROFILE-GEN-EQ: call void @__llvm_profile_override_default_filename(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @0, i32 0, i32 0)) +// PROFILE-GEN-EQ: declare void @__llvm_profile_override_default_filename(i8*) + +// Check that -fprofile-use=some/path reads some/path/default.profdata +// RUN: rm -rf %t.dir +// RUN: mkdir -p %t.dir/some/path +// RUN: llvm-profdata merge %S/Inputs/gcc-flag-compatibility.proftext -o %t.dir/some/path/default.profdata +// RUN: %clang %s -o - -mllvm -disable-llvm-optzns -emit-llvm -S -fprofile-use=%t.dir/some/path | FileCheck -check-prefix=PROFILE-USE-2 %s +// PROFILE-USE-2: = !{!"branch_weights", i32 101, i32 2} + +// Check that -fprofile-use=some/path/file.prof reads some/path/file.prof +// RUN: rm -rf %t.dir +// RUN: mkdir -p %t.dir/some/path +// RUN: llvm-profdata merge %S/Inputs/gcc-flag-compatibility.proftext -o %t.dir/some/path/file.prof +// RUN: %clang %s -o - -mllvm -disable-llvm-optzns -emit-llvm -S -fprofile-use=%t.dir/some/path/file.prof | FileCheck -check-prefix=PROFILE-USE-3 %s +// PROFILE-USE-3: = !{!"branch_weights", i32 101, i32 2} + +int X = 0; + +int main() { + int i; + for (i = 0; i < 100; i++) + X += i; + return 0; +} diff --git a/test/Sema/array-declared-as-incorrect-type.c b/test/Sema/array-declared-as-incorrect-type.c index b93fa9a0edf7..0ff9e949085c 100644 --- a/test/Sema/array-declared-as-incorrect-type.c +++ b/test/Sema/array-declared-as-incorrect-type.c @@ -3,14 +3,14 @@ extern int a1[]; int a1[1]; -extern int a2[]; // expected-note {{previous definition is here}} +extern int a2[]; // expected-note {{previous declaration is here}} float a2[1]; // expected-error {{redefinition of 'a2'}} extern int a3[][2]; int a3[1][2]; -extern int a4[][2]; // expected-note {{previous definition is here}} +extern int a4[][2]; // expected-note {{previous declaration is here}} int a4[2]; // expected-error {{redefinition of 'a4'}} -extern int a5[1][2][3]; // expected-note {{previous definition is here}} +extern int a5[1][2][3]; // expected-note {{previous declaration is here}} int a5[3][2][1]; // expected-error {{redefinition of 'a5'}} diff --git a/test/Sema/dllimport.c b/test/Sema/dllimport.c index e066abdb72d3..3ca1baa299c1 100644 --- a/test/Sema/dllimport.c +++ b/test/Sema/dllimport.c @@ -81,14 +81,14 @@ __declspec(dllimport) static int StaticGlobal; // expected-error{{'StaticGlobal' __declspec(dllimport) __thread int ThreadLocalGlobal; // expected-error{{'ThreadLocalGlobal' cannot be thread local when declared 'dllimport'}} // Import in local scope. -__declspec(dllimport) float LocalRedecl1; // expected-note{{previous definition is here}} -__declspec(dllimport) float LocalRedecl2; // expected-note{{previous definition is here}} -__declspec(dllimport) float LocalRedecl3; // expected-note{{previous definition is here}} +__declspec(dllimport) float LocalRedecl1; // expected-note{{previous declaration is here}} +__declspec(dllimport) float LocalRedecl2; // expected-note{{previous declaration is here}} +__declspec(dllimport) float LocalRedecl3; // expected-note{{previous declaration is here}} __declspec(dllimport) float LocalRedecl4; void functionScope() { - __declspec(dllimport) int LocalRedecl1; // expected-error{{redefinition of 'LocalRedecl1' with a different type: 'int' vs 'float'}} - int *__attribute__((dllimport)) LocalRedecl2; // expected-error{{redefinition of 'LocalRedecl2' with a different type: 'int *' vs 'float'}} - int LocalRedecl3 __attribute__((dllimport)); // expected-error{{redefinition of 'LocalRedecl3' with a different type: 'int' vs 'float'}} + __declspec(dllimport) int LocalRedecl1; // expected-error{{redeclaration of 'LocalRedecl1' with a different type: 'int' vs 'float'}} + int *__attribute__((dllimport)) LocalRedecl2; // expected-error{{redeclaration of 'LocalRedecl2' with a different type: 'int *' vs 'float'}} + int LocalRedecl3 __attribute__((dllimport)); // expected-error{{redeclaration of 'LocalRedecl3' with a different type: 'int' vs 'float'}} __declspec(dllimport) int LocalVarDecl; __declspec(dllimport) int LocalVarDef = 1; // expected-error{{definition of dllimport data}} diff --git a/test/Sema/enable_if.c b/test/Sema/enable_if.c index 4644858593d6..7faae43b577e 100644 --- a/test/Sema/enable_if.c +++ b/test/Sema/enable_if.c @@ -77,6 +77,21 @@ void test3(int c) { #endif } +// Verify that the alternate spelling __enable_if__ works as well. +int isdigit2(int c) __attribute__((overloadable)); // expected-note{{candidate function}} +int isdigit2(int c) __attribute__((overloadable)) // expected-note{{candidate function has been explicitly made unavailable}} + __attribute__((__enable_if__(c <= -1 || c > 255, "'c' must have the value of an unsigned char or EOF"))) + __attribute__((unavailable("'c' must have the value of an unsigned char or EOF"))); + +void test4(int c) { + isdigit2(c); + isdigit2(10); +#ifndef CODEGEN + isdigit2(-10); // expected-error{{call to unavailable function 'isdigit2': 'c' must have the value of an unsigned char or EOF}} +#endif +} + + #ifndef CODEGEN __attribute__((enable_if(n == 0, "chosen when 'n' is zero"))) void f1(int n); // expected-error{{use of undeclared identifier 'n'}} diff --git a/test/Sema/inline-asm-validate-tmpl.cpp b/test/Sema/inline-asm-validate-tmpl.cpp new file mode 100644 index 000000000000..cf7eac3d83d4 --- /dev/null +++ b/test/Sema/inline-asm-validate-tmpl.cpp @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -triple i686 -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple x86_64 -fsyntax-only -verify %s + + +// this template, when instantiated with 300, violates the range contraint +template <int N> void test(int value) +{ + asm("rol %1, %0" :"=r"(value): "I"(N + 1)); // expected-error{{value '301' out of range for constraint 'I'}} +} + +int main() { test<300>(10); } // expected-note{{in instantiation of function template specialization 'test<300>' requested here}} + + +// this template is not used, but the error is detectable +template <int N> void testb(int value) +{ + asm("rol %1, %0" :"=r"(value): "I"(301)); // expected-error{{value '301' out of range for constraint 'I'}} +} + +// these should compile without error +template <int N> void testc(int value) +{ + asm("rol %1, %0" :"=r"(value): "I"(N + 1)); +} +int foo() { testc<2>(10); } diff --git a/test/Sema/mrtd.c b/test/Sema/mrtd.c index ba1720e8d7dc..7bdeb27293b7 100644 --- a/test/Sema/mrtd.c +++ b/test/Sema/mrtd.c @@ -17,8 +17,8 @@ void variadic(int a, ...); void __attribute__((stdcall)) variadic(int a, ...); #ifdef MRTD -// expected-note@+3 {{previous definition is here}} -// expected-error@+3 {{redefinition of 'a' with a different type: 'void ((*))(int, int) __attribute__((cdecl))' vs 'void (*)(int, int) __attribute__((stdcall))'}} +// expected-note@+3 {{previous declaration is here}} +// expected-error@+3 {{redeclaration of 'a' with a different type: 'void ((*))(int, int) __attribute__((cdecl))' vs 'void (*)(int, int) __attribute__((stdcall))'}} #endif extern void (*a)(int, int); __attribute__((cdecl)) extern void (*a)(int, int); @@ -27,8 +27,8 @@ extern void (*b)(int, ...); __attribute__((cdecl)) extern void (*b)(int, ...); #ifndef MRTD -// expected-note@+3 {{previous definition is here}} -// expected-error@+3 {{redefinition of 'c' with a different type: 'void ((*))(int, int) __attribute__((stdcall))' vs 'void (*)(int, int)'}} +// expected-note@+3 {{previous declaration is here}} +// expected-error@+3 {{redeclaration of 'c' with a different type: 'void ((*))(int, int) __attribute__((stdcall))' vs 'void (*)(int, int)'}} #endif extern void (*c)(int, int); __attribute__((stdcall)) extern void (*c)(int, int); diff --git a/test/Sema/shift.c b/test/Sema/shift.c index d35554488513..07c5fe5280ed 100644 --- a/test/Sema/shift.c +++ b/test/Sema/shift.c @@ -39,7 +39,8 @@ void test() { i = 1 << (WORD_BIT - 2); i = 2 << (WORD_BIT - 1); // expected-warning {{bits to represent, but 'int' only has}} i = 1 << (WORD_BIT - 1); // expected-warning {{sets the sign bit of the shift expression}} - i = -1 << (WORD_BIT - 1); + i = -1 << (WORD_BIT - 1); // expected-warning {{shifting a negative signed value is undefined}} + i = -1 << 0; // expected-warning {{shifting a negative signed value is undefined}} i = 0 << (WORD_BIT - 1); i = (char)1 << (WORD_BIT - 2); @@ -48,7 +49,7 @@ void test() { u = 5U << (WORD_BIT - 1); long long int lli; - lli = INT_MIN << 2; // expected-warning {{bits to represent, but 'int' only has}} + lli = INT_MIN << 2; // expected-warning {{shifting a negative signed value is undefined}} lli = 1LL << (sizeof(long long) * CHAR_BIT - 2); } diff --git a/test/Sema/struct-compat.c b/test/Sema/struct-compat.c index 65bef9f60555..68bb2cad45e1 100644 --- a/test/Sema/struct-compat.c +++ b/test/Sema/struct-compat.c @@ -1,8 +1,8 @@ /* RUN: %clang_cc1 %s -fsyntax-only -pedantic -verify */ -extern struct {int a;} x; // expected-note {{previous definition is here}} -extern struct {int a;} x; // expected-error {{redefinition of 'x'}} +extern struct {int a;} x; // expected-note {{previous declaration is here}} +extern struct {int a;} x; // expected-error {{redeclaration of 'x'}} struct x; int a(struct x* b) { diff --git a/test/Sema/tls_alignment.cpp b/test/Sema/tls_alignment.cpp new file mode 100644 index 000000000000..5a7bb2c463f3 --- /dev/null +++ b/test/Sema/tls_alignment.cpp @@ -0,0 +1,75 @@ +// TLS variable cannot be aligned to more than 32 bytes on PS4. + +// RUN: %clang_cc1 -triple x86_64-scei-ps4 -fsyntax-only -verify %s + + +// A non-aligned type. +struct non_aligned_struct { + int some_data[16]; // 64 bytes of stuff, non aligned. +}; + +// An aligned type. +struct __attribute__(( aligned(64) )) aligned_struct { + int some_data[12]; // 48 bytes of stuff, aligned to 64. +}; + +// A type with an aligned field. +struct struct_with_aligned_field { + int some_aligned_data[12] __attribute__(( aligned(64) )); // 48 bytes of stuff, aligned to 64. +}; + +// A typedef of the aligned struct. +typedef aligned_struct another_aligned_struct; + +// A typedef to redefine a non-aligned struct as aligned. +typedef __attribute__(( aligned(64) )) non_aligned_struct yet_another_aligned_struct; + +// Non aligned variable doesn't cause an error. +__thread non_aligned_struct foo; + +// Variable aligned because of its type should cause an error. +__thread aligned_struct bar; // expected-error{{alignment (64) of thread-local variable}} + +// Variable explicitly aligned in the declaration should cause an error. +__thread non_aligned_struct bar2 __attribute__(( aligned(64) )); // expected-error{{alignment (64) of thread-local variable}} + +// Variable aligned because of one of its fields should cause an error. +__thread struct_with_aligned_field bar3; // expected-error{{alignment (64) of thread-local variable}} + +// Variable aligned because of typedef, first case. +__thread another_aligned_struct bar4; // expected-error{{alignment (64) of thread-local variable}} + +// Variable aligned because of typedef, second case. +__thread yet_another_aligned_struct bar5; // expected-error{{alignment (64) of thread-local variable}} + +int baz () +{ + return foo.some_data[0] + bar.some_data[1] + bar2.some_data[2] + + bar3.some_aligned_data[3] + bar4.some_data[4] + + bar5.some_data[5]; +} + + +// Verify alignment check where a dependent type is involved. +// The check is (correctly) not performed on "t", but the check still is +// performed on the structure as a whole once it has been instantiated. + +template<class T> struct templated_tls { + static __thread T t; + T other_t __attribute__(( aligned(64) )); +}; +__thread templated_tls<int> blah; // expected-error{{alignment (64) of thread-local variable}} + +int blag() { + return blah.other_t * 2; +} + + +// Verify alignment check where the alignment is a template parameter. +// The check is only performed during instantiation. +template <int N> +struct S { + static int __thread __attribute__((aligned(N))) x; // expected-error{{alignment (64) of thread-local variable}} +}; + +S<64> s_instance; // expected-note{{in instantiation of template class 'S<64>' requested here}} diff --git a/test/Sema/types.c b/test/Sema/types.c index 5614d164a5f4..9981be50ad4f 100644 --- a/test/Sema/types.c +++ b/test/Sema/types.c @@ -45,7 +45,7 @@ extern int i[1LL]; int i[(short)1]; enum e { e_1 }; -extern int j[sizeof(enum e)]; // expected-note {{previous definition}} +extern int j[sizeof(enum e)]; // expected-note {{previous declaration}} int j[42]; // expected-error {{redefinition of 'j' with a different type: 'int [42]' vs 'int [4]'}} // rdar://6880104 diff --git a/test/Sema/var-redecl.c b/test/Sema/var-redecl.c index 811e9f10bf20..024bfd436a42 100644 --- a/test/Sema/var-redecl.c +++ b/test/Sema/var-redecl.c @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s int outer1; // expected-note{{previous definition is here}} -extern int outer2; // expected-note{{previous definition is here}} +extern int outer2; // expected-note{{previous declaration is here}} int outer4; int outer4; // expected-note{{previous definition is here}} int outer5; @@ -9,17 +9,17 @@ int outer6(float); // expected-note{{previous definition is here}} int outer7(float); void outer_test() { - extern float outer1; // expected-error{{redefinition of 'outer1' with a different type}} - extern float outer2; // expected-error{{redefinition of 'outer2' with a different type}} - extern float outer3; // expected-note{{previous definition is here}} + extern float outer1; // expected-error{{redeclaration of 'outer1' with a different type}} + extern float outer2; // expected-error{{redeclaration of 'outer2' with a different type}} + extern float outer3; // expected-note{{previous declaration is here}} double outer4; - extern int outer5; // expected-note{{previous definition is here}} + extern int outer5; // expected-note{{previous declaration is here}} extern int outer6; // expected-error{{redefinition of 'outer6' as different kind of symbol}} int outer7; extern int outer8; // expected-note{{previous definition is here}} extern int outer9; { - extern int outer9; // expected-note{{previous definition is here}} + extern int outer9; // expected-note{{previous declaration is here}} } } @@ -29,22 +29,22 @@ float outer5; // expected-error{{redefinition of 'outer5' with a different type int outer8(int); // expected-error{{redefinition of 'outer8' as different kind of symbol}} float outer9; // expected-error{{redefinition of 'outer9' with a different type}} -extern int outer13; // expected-note{{previous definition is here}} +extern int outer13; // expected-note{{previous declaration is here}} void outer_shadowing_test() { extern int outer10; - extern int outer11; // expected-note{{previous definition is here}} - extern int outer12; // expected-note{{previous definition is here}} + extern int outer11; // expected-note{{previous declaration is here}} + extern int outer12; // expected-note{{previous declaration is here}} { float outer10; float outer11; float outer12; { extern int outer10; // okay - extern float outer11; // expected-error{{redefinition of 'outer11' with a different type}} + extern float outer11; // expected-error{{redeclaration of 'outer11' with a different type}} static double outer12; { - extern float outer12; // expected-error{{redefinition of 'outer12' with a different type}} - extern float outer13; // expected-error{{redefinition of 'outer13' with a different type}} + extern float outer12; // expected-error{{redeclaration of 'outer12' with a different type}} + extern float outer13; // expected-error{{redeclaration of 'outer13' with a different type}} } } } @@ -66,5 +66,5 @@ void f(int x) { // expected-note {{previous definition is here}} } extern int b[]; -void g20() { extern int b[3]; } // expected-note{{previous definition is here}} -void g21() { extern int b[4]; } // expected-error{{redefinition of 'b' with a different type: 'int [4]' vs 'int [3]'}} +void g20() { extern int b[3]; } // expected-note{{previous declaration is here}} +void g21() { extern int b[4]; } // expected-error{{redeclaration of 'b' with a different type: 'int [4]' vs 'int [3]'}} diff --git a/test/Sema/x86_64-linux-android.c b/test/Sema/x86_64-linux-android.c index e09d50ca079c..252570579f60 100644 --- a/test/Sema/x86_64-linux-android.c +++ b/test/Sema/x86_64-linux-android.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -triple x86_64-linux-android -emit-pch -o %t %s // RUN: %clang_cc1 -x ast -ast-print %t | FileCheck %s - +// REQUIRES: x86-registered-target extern int a1_0[sizeof(long double) == 16 ? 1 : -1]; extern int a1_i[__alignof(long double) == 16 ? 1 : -1]; diff --git a/test/SemaCXX/alias-template.cpp b/test/SemaCXX/alias-template.cpp index 89efc501d82c..d5eb27a66132 100644 --- a/test/SemaCXX/alias-template.cpp +++ b/test/SemaCXX/alias-template.cpp @@ -68,12 +68,10 @@ namespace InFunctions { namespace ClassNameRedecl { class C0 { - // FIXME: this diagnostic is pretty poor - template<typename U> using C0 = int; // expected-error {{name defined in alias declaration must be an identifier}} + template<typename U> using C0 = int; // expected-error {{member 'C0' has the same name as its class}} }; class C1 { - // FIXME: this diagnostic is pretty poor - template<typename U> using C1 = C1; // expected-error {{name defined in alias declaration must be an identifier}} + template<typename U> using C1 = C1; // expected-error {{member 'C1' has the same name as its class}} }; class C2 { template<typename U> using C0 = C1; // ok diff --git a/test/SemaCXX/array-bound-merge.cpp b/test/SemaCXX/array-bound-merge.cpp index c6085fb0a965..a360d007c3b7 100644 --- a/test/SemaCXX/array-bound-merge.cpp +++ b/test/SemaCXX/array-bound-merge.cpp @@ -10,5 +10,5 @@ int c[] = {1,2}; // expected-error {{excess elements in array initializer}} int d[1][]; // expected-error {{array has incomplete element type 'int []'}} -extern const int e[2]; // expected-note {{previous definition is here}} +extern const int e[2]; // expected-note {{previous declaration is here}} int e[] = { 1 }; // expected-error {{redefinition of 'e' with a different type: 'int []' vs 'const int [2]'}} diff --git a/test/SemaCXX/cast-lvalue-to-rvalue-reference.cpp b/test/SemaCXX/cast-lvalue-to-rvalue-reference.cpp new file mode 100644 index 000000000000..45e72d2924fe --- /dev/null +++ b/test/SemaCXX/cast-lvalue-to-rvalue-reference.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 +// expected-no-diagnostics + +struct S {}; +int x; +S&& y1 = (S&&)x; +S&& y2 = reinterpret_cast<S&&>(x); +S& z1 = (S&)x; diff --git a/test/SemaCXX/constructor.cpp b/test/SemaCXX/constructor.cpp index fa930bdb95dc..105605c6e37b 100644 --- a/test/SemaCXX/constructor.cpp +++ b/test/SemaCXX/constructor.cpp @@ -15,8 +15,7 @@ class Foo { virtual Foo(double); // expected-error{{constructor cannot be declared 'virtual'}} Foo(long) const; // expected-error{{'const' qualifier is not allowed on a constructor}} - int Foo(int, int); // expected-error{{constructor cannot have a return type}} \ - // expected-error{{member 'Foo' has the same name as its class}} + int Foo(int, int); // expected-error{{constructor cannot have a return type}} volatile Foo(float); // expected-error{{constructor cannot have a return type}} }; diff --git a/test/SemaCXX/cxx11-thread-local.cpp b/test/SemaCXX/cxx11-thread-local.cpp index f1dddc1c3bf7..a974d8198561 100644 --- a/test/SemaCXX/cxx11-thread-local.cpp +++ b/test/SemaCXX/cxx11-thread-local.cpp @@ -19,5 +19,5 @@ thread_local int z[3]; // expected-note {{previous}} void f() { thread_local int x; static thread_local int y; - extern thread_local int z; // expected-error {{redefinition of 'z' with a different type}} + extern thread_local int z; // expected-error {{redeclaration of 'z' with a different type}} } diff --git a/test/SemaCXX/cxx1y-generic-lambdas.cpp b/test/SemaCXX/cxx1y-generic-lambdas.cpp index b49a6418ea85..c937c6728c2b 100644 --- a/test/SemaCXX/cxx1y-generic-lambdas.cpp +++ b/test/SemaCXX/cxx1y-generic-lambdas.cpp @@ -948,3 +948,41 @@ auto f(T x) { auto x = f(0)(); } + +namespace PR13987 { +class Enclosing { + void Method(char c = []()->char { + int d = [](auto x)->int { + struct LocalClass { + int Method() { return 0; } + }; + return 0; + }(0); + return d; }() + ); +}; + +class Enclosing2 { + void Method(char c = [](auto x)->char { + int d = []()->int { + struct LocalClass { + int Method() { return 0; } + }; + return 0; + }(); + return d; }(0) + ); +}; + +class Enclosing3 { + void Method(char c = [](auto x)->char { + int d = [](auto y)->int { + struct LocalClass { + int Method() { return 0; } + }; + return 0; + }(0); + return d; }(0) + ); +}; +} diff --git a/test/SemaCXX/cxx1y-variable-templates_in_class.cpp b/test/SemaCXX/cxx1y-variable-templates_in_class.cpp index 9ff73daa82d4..123fcfff7f7a 100644 --- a/test/SemaCXX/cxx1y-variable-templates_in_class.cpp +++ b/test/SemaCXX/cxx1y-variable-templates_in_class.cpp @@ -214,7 +214,7 @@ namespace in_class_template { template<typename T> class D0a { template<typename U> static U Data; - template<typename U> static CONST U Data<U*> = U(10); // expected-note {{previous definition is here}} + template<typename U> static CONST U Data<U*> = U(10); // expected-note {{previous declaration is here}} }; template<> template<typename U> U D0a<float>::Data<U*> = U(100); // expected-error {{redefinition of 'Data'}} @@ -228,7 +228,7 @@ namespace in_class_template { template<typename T> class D1 { template<typename U> static U Data; - template<typename U> static CONST U Data<U*> = U(10); // expected-note {{previous definition is here}} + template<typename U> static CONST U Data<U*> = U(10); // expected-note {{previous declaration is here}} }; template<> template<typename U> U D1<float>::Data = U(10); diff --git a/test/SemaCXX/cxx1y-variable-templates_top_level.cpp b/test/SemaCXX/cxx1y-variable-templates_top_level.cpp index 4e62941e6818..145bc49fff1f 100644 --- a/test/SemaCXX/cxx1y-variable-templates_top_level.cpp +++ b/test/SemaCXX/cxx1y-variable-templates_top_level.cpp @@ -98,8 +98,8 @@ namespace odr_tmpl { namespace pvt_extern { template<typename T> T v = T(); template<typename T> extern T v; // redeclaration is allowed \ - // expected-note {{previous definition is here}} - template<typename T> extern int v; // expected-error {{redefinition of 'v' with a different type: 'int' vs 'T'}} + // expected-note {{previous declaration is here}} + template<typename T> extern int v; // expected-error {{redeclaration of 'v' with a different type: 'int' vs 'T'}} #ifndef PRECXX11 template<typename T> extern auto v; // expected-error {{declaration of variable 'v' with type 'auto' requires an initializer}} @@ -117,7 +117,7 @@ namespace odr_tmpl { template<typename T> auto v2 = T(); // expected-note {{previous definition is here}} template<typename T> T v2; // expected-error {{redefinition of 'v2'}} template<typename T> auto v3 = T(); // expected-note {{previous definition is here}} - template<typename T> extern T v3; // expected-error {{redefinition of 'v3' with a different type: 'T' vs 'auto'}} + template<typename T> extern T v3; // expected-error {{redeclaration of 'v3' with a different type: 'T' vs 'auto'}} template<typename T> auto v4 = T(); template<typename T> extern auto v4; // expected-error {{declaration of variable 'v4' with type 'auto' requires an initializer}} } diff --git a/test/SemaCXX/dllimport.cpp b/test/SemaCXX/dllimport.cpp index 0f616d43c89d..2fa10756da48 100644 --- a/test/SemaCXX/dllimport.cpp +++ b/test/SemaCXX/dllimport.cpp @@ -95,13 +95,13 @@ __declspec(dllimport) auto InternalAutoTypeGlobal = Internal(); // expected-erro __declspec(dllimport) __thread int ThreadLocalGlobal; // expected-error{{'ThreadLocalGlobal' cannot be thread local when declared 'dllimport'}} // Import in local scope. -__declspec(dllimport) float LocalRedecl1; // expected-note{{previous definition is here}} -__declspec(dllimport) float LocalRedecl2; // expected-note{{previous definition is here}} -__declspec(dllimport) float LocalRedecl3; // expected-note{{previous definition is here}} +__declspec(dllimport) float LocalRedecl1; // expected-note{{previous declaration is here}} +__declspec(dllimport) float LocalRedecl2; // expected-note{{previous declaration is here}} +__declspec(dllimport) float LocalRedecl3; // expected-note{{previous declaration is here}} void functionScope() { - __declspec(dllimport) int LocalRedecl1; // expected-error{{redefinition of 'LocalRedecl1' with a different type: 'int' vs 'float'}} - int *__attribute__((dllimport)) LocalRedecl2; // expected-error{{redefinition of 'LocalRedecl2' with a different type: 'int *' vs 'float'}} - int LocalRedecl3 __attribute__((dllimport)); // expected-error{{redefinition of 'LocalRedecl3' with a different type: 'int' vs 'float'}} + __declspec(dllimport) int LocalRedecl1; // expected-error{{redeclaration of 'LocalRedecl1' with a different type: 'int' vs 'float'}} + int *__attribute__((dllimport)) LocalRedecl2; // expected-error{{redeclaration of 'LocalRedecl2' with a different type: 'int *' vs 'float'}} + int LocalRedecl3 __attribute__((dllimport)); // expected-error{{redeclaration of 'LocalRedecl3' with a different type: 'int' vs 'float'}} __declspec(dllimport) int LocalVarDecl; __declspec(dllimport) int LocalVarDef = 1; // expected-error{{definition of dllimport data}} diff --git a/test/SemaCXX/extern-c.cpp b/test/SemaCXX/extern-c.cpp index dfbf38667c5e..295d1f305ee2 100644 --- a/test/SemaCXX/extern-c.cpp +++ b/test/SemaCXX/extern-c.cpp @@ -21,7 +21,7 @@ float test2_x; // expected-error {{declaration of 'test2_x' in global scope conf namespace test3 { extern "C" { void test3_f() { - extern int test3_b; // expected-note {{previous definition is here}} + extern int test3_b; // expected-note {{previous declaration is here}} } } extern "C" { diff --git a/test/SemaCXX/lambda-expressions.cpp b/test/SemaCXX/lambda-expressions.cpp index 7911c1b7cc53..72adcdbce2fe 100644 --- a/test/SemaCXX/lambda-expressions.cpp +++ b/test/SemaCXX/lambda-expressions.cpp @@ -446,3 +446,33 @@ namespace PR21857 { template<typename Fn> fun<Fn> wrap(Fn fn); auto x = wrap([](){}); } + +namespace PR13987 { +class Enclosing { + void Method(char c = []()->char { + int d = []()->int { + struct LocalClass { + int Method() { return 0; } + }; + return 0; + }(); + return d; }() + ); +}; +} + +namespace PR23860 { +template <class> struct A { + void f(int x = []() { + struct B { + void g() {} + }; + return 0; + }()); +}; + +int main() { +} + +A<int> a; +} diff --git a/test/SemaCXX/lookup-member.cpp b/test/SemaCXX/lookup-member.cpp index 39f5a15d0811..a2256a89d11c 100644 --- a/test/SemaCXX/lookup-member.cpp +++ b/test/SemaCXX/lookup-member.cpp @@ -1,12 +1,11 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -// expected-no-diagnostics namespace A { - class String; + class String; // expected-note {{target of using declaration}} }; -using A::String; -class String; +using A::String; // expected-note {{using declaration}} +class String; // expected-error {{conflicts with target of using declaration}} // rdar://8603569 union value { diff --git a/test/SemaCXX/struct-class-redecl.cpp b/test/SemaCXX/struct-class-redecl.cpp index 706ec5688ba5..7375319186a1 100644 --- a/test/SemaCXX/struct-class-redecl.cpp +++ b/test/SemaCXX/struct-class-redecl.cpp @@ -8,8 +8,8 @@ template<typename T> struct Y; // expected-note{{did you mean class here?}} template<class U> class Y { }; // expected-warning{{previously declared}} template <typename> -struct Z { // expected-note{{previous definition is here}} - struct Z { // expected-error{{nested redefinition of 'Z'}} +struct Z { + struct Z { // expected-error{{member 'Z' has the same name as its class}} }; }; diff --git a/test/SemaCXX/using-decl-1.cpp b/test/SemaCXX/using-decl-1.cpp index e730c9d63a20..ca532692c1cb 100644 --- a/test/SemaCXX/using-decl-1.cpp +++ b/test/SemaCXX/using-decl-1.cpp @@ -263,3 +263,67 @@ struct B : A { static int f() { return n; } // expected-error {{invalid use of member 'n' in static member function}} }; } + +namespace PR24030 { + namespace X { + class A; // expected-note {{target}} + int i; // expected-note {{target}} + } + namespace Y { + using X::A; // expected-note {{using}} + using X::i; // expected-note {{using}} + class A {}; // expected-error {{conflicts}} + int i; // expected-error {{conflicts}} + } +} + +namespace PR24033 { + extern int a; // expected-note 2{{target of using declaration}} + void f(); // expected-note 2{{target of using declaration}} + struct s; // expected-note 2{{target of using declaration}} + enum e {}; // expected-note 2{{target of using declaration}} + + template<typename> extern int vt; // expected-note 2{{target of using declaration}} expected-warning 0-1{{extension}} + template<typename> void ft(); // expected-note 2{{target of using declaration}} + template<typename> struct st; // expected-note 2{{target of using declaration}} + + namespace X { + using PR24033::a; // expected-note {{using declaration}} + using PR24033::f; // expected-note {{using declaration}} + using PR24033::s; // expected-note {{using declaration}} + using PR24033::e; // expected-note {{using declaration}} + + using PR24033::vt; // expected-note {{using declaration}} + using PR24033::ft; // expected-note {{using declaration}} + using PR24033::st; // expected-note {{using declaration}} + + extern int a; // expected-error {{declaration conflicts with target of using declaration already in scope}} + void f(); // expected-error {{declaration conflicts with target of using declaration already in scope}} + struct s; // expected-error {{declaration conflicts with target of using declaration already in scope}} + enum e {}; // expected-error {{declaration conflicts with target of using declaration already in scope}} + + template<typename> extern int vt; // expected-error {{declaration conflicts with target of using declaration already in scope}} expected-warning 0-1{{extension}} + template<typename> void ft(); // expected-error {{declaration conflicts with target of using declaration already in scope}} + template<typename> struct st; // expected-error {{declaration conflicts with target of using declaration already in scope}} + } + + namespace Y { + extern int a; // expected-note {{conflicting declaration}} + void f(); // expected-note {{conflicting declaration}} + struct s; // expected-note {{conflicting declaration}} + enum e {}; // expected-note {{conflicting declaration}} + + template<typename> extern int vt; // expected-note {{conflicting declaration}} expected-warning 0-1{{extension}} + template<typename> void ft(); // expected-note {{conflicting declaration}} + template<typename> struct st; // expected-note {{conflicting declaration}} + + using PR24033::a; // expected-error {{target of using declaration conflicts with declaration already in scope}} + using PR24033::f; // expected-error {{target of using declaration conflicts with declaration already in scope}} + using PR24033::s; // expected-error {{target of using declaration conflicts with declaration already in scope}} + using PR24033::e; // expected-error {{target of using declaration conflicts with declaration already in scope}} + + using PR24033::vt; // expected-error {{target of using declaration conflicts with declaration already in scope}} + using PR24033::ft; // expected-error {{target of using declaration conflicts with declaration already in scope}} + using PR24033::st; // expected-error {{target of using declaration conflicts with declaration already in scope}} + } +} diff --git a/test/SemaObjC/block-type-safety.m b/test/SemaObjC/block-type-safety.m index b2c4398dc3c5..96c781b6a561 100644 --- a/test/SemaObjC/block-type-safety.m +++ b/test/SemaObjC/block-type-safety.m @@ -198,3 +198,11 @@ void Test3() { NSObject<NSObject, P1, NSCopying> *NSO5 = aBlock; // expected-error {{initializing 'NSObject<NSObject,P1,NSCopying> *' with an expression of incompatible type 'void (^)()'}} NSObject<NSCopying> *NSO6 = aBlock; // Ok } + +// rdar://problem/19420731 +typedef NSObject<P1> NSObject_P1; +typedef NSObject_P1<P2> NSObject_P1_P2; + +void Test4(void (^handler)(NSObject_P1_P2 *p)) { + Test4(^(NSObject<P2> *p) { }); +} diff --git a/test/SemaObjC/conditional-expr-8.m b/test/SemaObjC/conditional-expr-8.m index beddd205a907..35f4e75314bd 100644 --- a/test/SemaObjC/conditional-expr-8.m +++ b/test/SemaObjC/conditional-expr-8.m @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s // expected-no-diagnostics -// rdar://9296866 +// rdar://9296866 @interface NSResponder @end @@ -24,3 +24,34 @@ } @end +// rdar://problem/19572837 +@protocol NSObject +@end + +__attribute__((objc_root_class)) +@interface NSObject <NSObject> +@end + +@protocol Goable <NSObject> +- (void)go; +@end + +@protocol Drivable <Goable> +- (void)drive; +@end + +@interface Car : NSObject +- (NSObject <Goable> *)bestGoable:(NSObject <Goable> *)drivable; +@end + +@interface Car(Category) <Drivable> +@end + +@interface Truck : Car +@end + +@implementation Truck +- (NSObject <Goable> *)bestGoable:(NSObject <Goable> *)drivable value:(int)value{ + return value > 0 ? self : drivable; +} +@end diff --git a/test/SemaObjC/conditional-expr.m b/test/SemaObjC/conditional-expr.m index 71e108cce673..71bdb1b2d341 100644 --- a/test/SemaObjC/conditional-expr.m +++ b/test/SemaObjC/conditional-expr.m @@ -51,6 +51,10 @@ @end @protocol P2 @end +@protocol P3 <P1> +@end +@protocol P4 <P1> +@end @interface A <P0> @end @@ -64,6 +68,9 @@ @interface D @end +@interface E : A +@end + void f0(id<P0> x) { x.intProp = 1; } @@ -118,3 +125,7 @@ void f11(int a, id<P0> x, id<P1> y) { void f12(int a, A<P0> *x, A<P1> *y) { A<P1>* l0 = (a ? x : y ); // expected-warning {{incompatible pointer types initializing 'A<P1> *' with an expression of type 'A<P0> *'}} } + +void f13(int a, B<P3, P0> *x, E<P0, P4> *y) { + int *ip = a ? x : y; // expected-warning{{expression of type 'A<P1> *'}} +} diff --git a/test/SemaObjC/interface-1.m b/test/SemaObjC/interface-1.m index 79fbad8ba4bf..0e47fa08bd77 100644 --- a/test/SemaObjC/interface-1.m +++ b/test/SemaObjC/interface-1.m @@ -3,7 +3,7 @@ @interface NSWhatever : NSObject // expected-error {{cannot find interface declaration for 'NSObject'}} -<NSCopying> // expected-error {{cannot find protocol declaration for 'NSCopying'}} +<NSCopying> // expected-error {{no type or protocol named 'NSCopying'}} @end diff --git a/test/SemaObjC/kindof.m b/test/SemaObjC/kindof.m new file mode 100644 index 000000000000..b19e42372078 --- /dev/null +++ b/test/SemaObjC/kindof.m @@ -0,0 +1,304 @@ +// RUN: %clang_cc1 -fblocks -fsyntax-only %s -verify + +// Tests Objective-C 'kindof' types. + +#if !__has_feature(objc_kindof) +#error does not support __kindof +#endif + +@protocol NSObject +@end + +@protocol NSCopying +- (id)copy; ++ (Class)classCopy; +@end + +@protocol NSRandomProto +- (void)randomMethod; ++ (void)randomClassMethod; +@end + +__attribute__((objc_root_class)) +@interface NSObject <NSObject> +- (NSObject *)retain; +@end + +@interface NSString : NSObject <NSCopying> +- (NSString *)stringByAppendingString:(NSString *)string; ++ (instancetype)string; +@end + +@interface NSMutableString : NSString +- (void)appendString:(NSString *)string; +@end + +@interface NSNumber : NSObject <NSCopying> +- (NSNumber *)numberByAddingNumber:(NSNumber *)number; +@end + +// --------------------------------------------------------------------------- +// Parsing and semantic analysis for __kindof +// --------------------------------------------------------------------------- + +// Test proper application of __kindof. +typedef __kindof NSObject *typedef1; +typedef NSObject __kindof *typedef2; +typedef __kindof NSObject<NSCopying> typedef3; +typedef NSObject<NSCopying> __kindof *typedef4; +typedef __kindof id<NSCopying> typedef5; +typedef __kindof Class<NSCopying> typedef6; + +// Test redundancy of __kindof. +typedef __kindof id __kindof redundant_typedef1; +typedef __kindof NSObject __kindof *redundant_typedef2; + +// Test application of __kindof to typedefs. +typedef NSObject *NSObject_ptr_typedef; +typedef NSObject NSObject_typedef; +typedef __kindof NSObject_ptr_typedef typedef_typedef1; +typedef __kindof NSObject_typedef typedef_typedef2; + +// Test application of __kindof to non-object types. +typedef __kindof int nonobject_typedef1; // expected-error{{'__kindof' specifier cannot be applied to non-object type 'int'}} +typedef NSObject **NSObject_ptr_ptr; +typedef __kindof NSObject_ptr_ptr nonobject_typedef2; // expected-error{{'__kindof' specifier cannot be applied to non-object type 'NSObject_ptr_ptr' (aka 'NSObject **')}} + +// Test application of __kindof outside of the decl-specifiers. +typedef NSObject * __kindof bad_specifier_location1; // expected-error{{'__kindof' type specifier must precede the declarator}} +typedef NSObject bad_specifier_location2 __kindof; // expected-error{{expected ';' after top level declarator}} +// expected-warning@-1{{declaration does not declare anything}} + +// --------------------------------------------------------------------------- +// Pretty printing of __kindof +// --------------------------------------------------------------------------- +void test_pretty_print(int *ip) { + __kindof NSObject *kindof_NSObject; + ip = kindof_NSObject; // expected-warning{{from '__kindof NSObject *'}} + + __kindof NSObject_ptr_typedef kindof_NSObject_ptr; + ip = kindof_NSObject_ptr; // expected-warning{{from '__kindof NSObject_ptr_typedef'}} + + __kindof id <NSCopying> *kindof_NSCopying; + ip = kindof_NSCopying; // expected-warning{{from '__kindof id<NSCopying> *'}} + + __kindof NSObject_ptr_typedef *kindof_NSObject_ptr_typedef; + ip = kindof_NSObject_ptr_typedef; // expected-warning{{from '__kindof NSObject_ptr_typedef *'}} +} + +// --------------------------------------------------------------------------- +// Basic implicit conversions (dropping __kindof, upcasts, etc.) +// --------------------------------------------------------------------------- +void test_add_remove_kindof_conversions(void) { + __kindof NSObject *kindof_NSObject_obj; + NSObject *NSObject_obj; + + // Conversion back and forth + kindof_NSObject_obj = NSObject_obj; + NSObject_obj = kindof_NSObject_obj; + + // Qualified-id conversion back and forth. + __kindof id <NSCopying> kindof_id_NSCopying_obj; + id <NSCopying> id_NSCopying_obj; + kindof_id_NSCopying_obj = id_NSCopying_obj; + id_NSCopying_obj = kindof_id_NSCopying_obj; +} + +void test_upcast_conversions(void) { + __kindof NSObject *kindof_NSObject_obj; + NSObject *NSObject_obj; + + // Upcasts + __kindof NSString *kindof_NSString_obj; + NSString *NSString_obj; + kindof_NSObject_obj = kindof_NSString_obj; + kindof_NSObject_obj = NSString_obj; + NSObject_obj = kindof_NSString_obj; + NSObject_obj = NSString_obj; + + // "Upcasts" with qualified-id. + __kindof id <NSCopying> kindof_id_NSCopying_obj; + id <NSCopying> id_NSCopying_obj; + kindof_id_NSCopying_obj = kindof_NSString_obj; + kindof_id_NSCopying_obj = NSString_obj; + id_NSCopying_obj = kindof_NSString_obj; + id_NSCopying_obj = NSString_obj; +} + + +void test_ptr_object_conversions(void) { + __kindof NSObject **ptr_kindof_NSObject_obj; + NSObject **ptr_NSObject_obj; + + // Conversions back and forth. + ptr_kindof_NSObject_obj = ptr_NSObject_obj; + ptr_NSObject_obj = ptr_kindof_NSObject_obj; + + // Conversions back and forth with qualified-id. + __kindof id <NSCopying> *ptr_kindof_id_NSCopying_obj; + id <NSCopying> *ptr_id_NSCopying_obj; + ptr_kindof_id_NSCopying_obj = ptr_id_NSCopying_obj; + ptr_id_NSCopying_obj = ptr_kindof_id_NSCopying_obj; + + // Upcasts. + __kindof NSString **ptr_kindof_NSString_obj; + NSString **ptr_NSString_obj; + ptr_kindof_NSObject_obj = ptr_kindof_NSString_obj; + ptr_kindof_NSObject_obj = ptr_NSString_obj; + ptr_NSObject_obj = ptr_kindof_NSString_obj; + ptr_NSObject_obj = ptr_NSString_obj; +} + +// --------------------------------------------------------------------------- +// Implicit downcasting +// --------------------------------------------------------------------------- +void test_downcast_conversions(void) { + __kindof NSObject *kindof_NSObject_obj; + NSObject *NSObject_obj; + __kindof NSString *kindof_NSString_obj; + NSString *NSString_obj; + + // Implicit downcasting. + kindof_NSString_obj = kindof_NSObject_obj; + kindof_NSString_obj = NSObject_obj; // expected-warning{{assigning to '__kindof NSString *' from 'NSObject *'}} + NSString_obj = kindof_NSObject_obj; + NSString_obj = NSObject_obj; // expected-warning{{assigning to 'NSString *' from 'NSObject *'}} + + // Implicit downcasting with qualified id. + __kindof id <NSCopying> kindof_NSCopying_obj; + id <NSCopying> NSCopying_obj; + kindof_NSString_obj = kindof_NSCopying_obj; + kindof_NSString_obj = NSCopying_obj; // expected-warning{{from incompatible type 'id<NSCopying>'}} + NSString_obj = kindof_NSCopying_obj; + NSString_obj = NSCopying_obj; // expected-warning{{from incompatible type 'id<NSCopying>'}} + kindof_NSObject_obj = kindof_NSCopying_obj; + kindof_NSObject_obj = NSCopying_obj; // expected-warning{{from incompatible type 'id<NSCopying>'}} + NSObject_obj = kindof_NSCopying_obj; + NSObject_obj = NSCopying_obj; // expected-warning{{from incompatible type 'id<NSCopying>'}} +} + +void test_crosscast_conversions(void) { + __kindof NSString *kindof_NSString_obj; + NSString *NSString_obj; + __kindof NSNumber *kindof_NSNumber_obj; + NSNumber *NSNumber_obj; + + NSString_obj = kindof_NSNumber_obj; // expected-warning{{from '__kindof NSNumber *'}} +} + +// --------------------------------------------------------------------------- +// Blocks +// --------------------------------------------------------------------------- +void test_block_conversions(void) { + // Adding/removing __kindof from return type. + __kindof NSString *(^kindof_NSString_void_block)(void); + NSString *(^NSString_void_block)(void); + kindof_NSString_void_block = NSString_void_block; + NSString_void_block = kindof_NSString_void_block; + + // Covariant return type. + __kindof NSMutableString *(^kindof_NSMutableString_void_block)(void); + NSMutableString *(^NSMutableString_void_block)(void); + kindof_NSString_void_block = NSMutableString_void_block; + NSString_void_block = kindof_NSMutableString_void_block; + kindof_NSString_void_block = NSMutableString_void_block; + NSString_void_block = kindof_NSMutableString_void_block; + + // "Covariant" return type via downcasting rule. + kindof_NSMutableString_void_block = NSString_void_block; // expected-error{{from 'NSString *(^)(void)'}} + NSMutableString_void_block = kindof_NSString_void_block; + kindof_NSMutableString_void_block = NSString_void_block; // expected-error{{from 'NSString *(^)(void)'}} + NSMutableString_void_block = kindof_NSString_void_block; + + // Cross-casted return type. + __kindof NSNumber *(^kindof_NSNumber_void_block)(void); + NSNumber *(^NSNumber_void_block)(void); + kindof_NSString_void_block = NSNumber_void_block; // expected-error{{from 'NSNumber *(^)(void)'}} + NSString_void_block = kindof_NSNumber_void_block; // expected-error{{'__kindof NSNumber *(^)(void)'}} + kindof_NSString_void_block = NSNumber_void_block; // expected-error{{from 'NSNumber *(^)(void)'}} + NSString_void_block = kindof_NSNumber_void_block; // expected-error{{'__kindof NSNumber *(^)(void)'}} + + // Adding/removing __kindof from argument type. + void (^void_kindof_NSString_block)(__kindof NSString *); + void (^void_NSString_block)(NSString *); + void_kindof_NSString_block = void_NSString_block; + void_NSString_block = void_kindof_NSString_block; + + // Contravariant argument type. + void (^void_kindof_NSMutableString_block)(__kindof NSMutableString *); + void (^void_NSMutableString_block)(NSMutableString *); + void_kindof_NSMutableString_block = void_kindof_NSString_block; + void_kindof_NSMutableString_block = void_NSString_block; + void_NSMutableString_block = void_kindof_NSString_block; + void_NSMutableString_block = void_NSString_block; + + // "Contravariant" argument type via downcasting rule. + void_kindof_NSString_block = void_kindof_NSMutableString_block; + void_kindof_NSString_block = void_NSMutableString_block; + void_NSString_block = void_kindof_NSMutableString_block; // expected-error{{from 'void (^)(__kindof NSMutableString *)'}} + void_NSString_block = void_NSMutableString_block; // expected-error{{from 'void (^)(NSMutableString *)'}} +} + +// --------------------------------------------------------------------------- +// Messaging __kindof types. +// --------------------------------------------------------------------------- +void message_kindof_object(__kindof NSString *kindof_NSString) { + [kindof_NSString retain]; // in superclass + [kindof_NSString stringByAppendingString:0]; // in class + [kindof_NSString appendString:0]; // in subclass + [kindof_NSString numberByAddingNumber: 0]; // FIXME: in unrelated class + [kindof_NSString randomMethod]; // in protocol +} + +void message_kindof_qualified_id(__kindof id <NSCopying> kindof_NSCopying) { + [kindof_NSCopying copy]; // in protocol + [kindof_NSCopying stringByAppendingString:0]; // in some class + [kindof_NSCopying randomMethod]; // in unrelated protocol +} + +void message_kindof_qualified_class( + __kindof Class <NSCopying> kindof_NSCopying) { + [kindof_NSCopying classCopy]; // in protocol + [kindof_NSCopying string]; // in some class + [kindof_NSCopying randomClassMethod]; // in unrelated protocol +} + +// --------------------------------------------------------------------------- +// __kindof within specialized types +// --------------------------------------------------------------------------- +@interface NSArray<T> : NSObject +@end + +void implicit_convert_array(NSArray<__kindof NSString *> *kindofStringsArray, + NSArray<NSString *> *stringsArray, + NSArray<__kindof NSMutableString *> + *kindofMutStringsArray, + NSArray<NSMutableString *> *mutStringsArray) { + // Adding/removing __kindof is okay. + kindofStringsArray = stringsArray; + stringsArray = kindofStringsArray; + + // Other covariant and contravariant conversions still not permitted. + kindofStringsArray = mutStringsArray; // expected-warning{{incompatible pointer types}} + stringsArray = kindofMutStringsArray; // expected-warning{{incompatible pointer types}} + mutStringsArray = kindofStringsArray; // expected-warning{{incompatible pointer types}} + + // Adding/removing nested __kindof is okay. + NSArray<NSArray<__kindof NSString *> *> *kindofStringsArrayArray; + NSArray<NSArray<NSString *> *> *stringsArrayArray; + kindofStringsArrayArray = stringsArrayArray; + stringsArrayArray = kindofStringsArrayArray; +} + +// --------------------------------------------------------------------------- +// __kindof + nullability +// --------------------------------------------------------------------------- + +void testNullability() { + // The base type being a pointer type tickles the bug. + extern __kindof id <NSCopying> _Nonnull getSomeCopyable(); + NSString *string = getSomeCopyable(); // no-warning + + void processCopyable(__typeof(getSomeCopyable()) string); + processCopyable(0); // expected-warning{{null passed to a callee that requires a non-null argument}} +} diff --git a/test/SemaObjC/objc2-merge-gc-attribue-decl.m b/test/SemaObjC/objc2-merge-gc-attribue-decl.m index 673a7417e384..232f8dd794d6 100644 --- a/test/SemaObjC/objc2-merge-gc-attribue-decl.m +++ b/test/SemaObjC/objc2-merge-gc-attribue-decl.m @@ -13,17 +13,17 @@ extern __strong id CFRunLoopGetMain(); extern __weak id WLoopGetMain(); // expected-note {{previous declaration is here}} extern id WLoopGetMain(); // expected-error {{conflicting types for 'WLoopGetMain'}} -extern id p3; // expected-note {{previous definition is here}} -extern __weak id p3; // expected-error {{redefinition of 'p3' with a different type}} +extern id p3; // expected-note {{previous declaration is here}} +extern __weak id p3; // expected-error {{redeclaration of 'p3' with a different type}} -extern void *p4; // expected-note {{previous definition is here}} -extern void * __strong p4; // expected-error {{redefinition of 'p4' with a different type}} +extern void *p4; // expected-note {{previous declaration is here}} +extern void * __strong p4; // expected-error {{redeclaration of 'p4' with a different type}} extern id p5; extern __strong id p5; -extern char* __strong p6; // expected-note {{previous definition is here}} -extern char* p6; // expected-error {{redefinition of 'p6' with a different type}} +extern char* __strong p6; // expected-note {{previous declaration is here}} +extern char* p6; // expected-error {{redeclaration of 'p6' with a different type}} -extern __strong char* p7; // expected-note {{previous definition is here}} -extern char* p7; // expected-error {{redefinition of 'p7' with a different type}} +extern __strong char* p7; // expected-note {{previous declaration is here}} +extern char* p7; // expected-error {{redeclaration of 'p7' with a different type}} diff --git a/test/SemaObjC/parameterized_classes.m b/test/SemaObjC/parameterized_classes.m new file mode 100644 index 000000000000..644fe3a329af --- /dev/null +++ b/test/SemaObjC/parameterized_classes.m @@ -0,0 +1,357 @@ +// RUN: %clang_cc1 -fblocks %s -verify + +#if !__has_feature(objc_generics) +# error Compiler does not support Objective-C generics? +#endif + +#if !__has_feature(objc_generics_variance) +# error Compiler does not support co- and contr-variance? +#endif + +@protocol NSObject // expected-note{{'NSObject' declared here}} +@end + +@protocol NSCopying // expected-note{{'NSCopying' declared here}} +@end + +__attribute__((objc_root_class)) +@interface NSObject <NSObject> // expected-note{{'NSObject' defined here}} +@end + +@interface NSString : NSObject <NSCopying> +@end + +// -------------------------------------------------------------------------- +// Parsing parameterized classes. +// -------------------------------------------------------------------------- + +// Parse type parameters with a bound +@interface PC1<T, U : NSObject*> : NSObject // expected-note{{'PC1' declared here}} +// expected-note@-1{{type parameter 'T' declared here}} +// expected-note@-2{{type parameter 'U' declared here}} +// expected-note@-3{{type parameter 'U' declared here}} +@end + +// Parse a type parameter with a bound that terminates in '>>'. +@interface PC2<T : id<NSObject>> : NSObject +@end + +// Parse multiple type parameters. +@interface PC3<T, U : id> : NSObject +@end + +// Parse multiple type parameters--grammatically ambiguous with protocol refs. +@interface PC4<T, U, V> : NSObject // expected-note 2{{'PC4' declared here}} +@end + +// Parse a type parameter list without a superclass. +@interface PC5<T : id> +@end + +// Parse a type parameter with name conflicts. +@interface PC6<T, U, + T> : NSObject // expected-error{{redeclaration of type parameter 'T'}} +@end + +// Parse Objective-C protocol references. +@interface PC7<T> // expected-error{{cannot find protocol declaration for 'T'}} +@end + +// Parse both type parameters and protocol references. +@interface PC8<T> : NSObject <NSObject> +@end + +// Type parameters with improper bounds. +@interface PC9<T : int, // expected-error{{type bound 'int' for type parameter 'T' is not an Objective-C pointer type}} + U : NSString> : NSObject // expected-error{{missing '*' in type bound 'NSString' for type parameter 'U'}} +@end + +// -------------------------------------------------------------------------- +// Parsing parameterized forward declarations classes. +// -------------------------------------------------------------------------- + +// Okay: forward declaration without type parameters. +@class PC10; + +// Okay: forward declarations with type parameters. +@class PC10<T, U : NSObject *>, PC11<T : NSObject *, U : id>; // expected-note{{type parameter 'T' declared here}} + +// Okay: forward declaration without type parameters following ones +// with type parameters. +@class PC10, PC11; + +// Okay: definition of class with type parameters that was formerly +// declared with the same type parameters. +@interface PC10<T, U : NSObject *> : NSObject +@end + +// Mismatched parameters in declaration of @interface following @class. +@interface PC11<T, U> : NSObject // expected-error{{missing type bound 'NSObject *' for type parameter 'T' in @interface}} +@end + +@interface PC12<T : NSObject *> : NSObject // expected-note{{type parameter 'T' declared here}} +@end + +@class PC12; + +// Mismatched parameters in subsequent forward declarations. +@class PC13<T : NSObject *>; // expected-note{{type parameter 'T' declared here}} +@class PC13; +@class PC13<U>; // expected-error{{missing type bound 'NSObject *' for type parameter 'U' in @class}} + +// Mismatch parameters in declaration of @class following @interface. +@class PC12<T>; // expected-error{{missing type bound 'NSObject *' for type parameter 'T' in @class}} + +// Parameterized forward declaration a class that is not parameterized. +@class NSObject<T>; // expected-error{{forward declaration of non-parameterized class 'NSObject' cannot have type parameters}} +// expected-note@-1{{'NSObject' declared here}} + +// Parameterized forward declaration preceding the definition (that is +// not parameterized). +@class NSNumber<T : NSObject *>; // expected-note{{'NSNumber' declared here}} +@interface NSNumber : NSObject // expected-error{{class 'NSNumber' previously declared with type parameters}} +@end + +@class PC14; + +// Okay: definition of class with type parameters that was formerly +// declared without type parameters. +@interface PC14<T, U : NSObject *> : NSObject +@end + +// -------------------------------------------------------------------------- +// Parsing parameterized categories and extensions. +// -------------------------------------------------------------------------- + +// Inferring type bounds +@interface PC1<T, U> (Cat1) <NSObject> +@end + +// Matching type bounds +@interface PC1<T : id, U : NSObject *> (Cat2) <NSObject> +@end + +// Inferring type bounds +@interface PC1<T, U> () <NSObject> +@end + +// Matching type bounds +@interface PC1<T : id, U : NSObject *> () <NSObject> +@end + +// Missing type parameters. +@interface PC1<T> () // expected-error{{extension has too few type parameters (expected 2, have 1)}} +@end + +// Extra type parameters. +@interface PC1<T, U, V> (Cat3) // expected-error{{category has too many type parameters (expected 2, have 3)}} +@end + +// Mismatched bounds. +@interface PC1<T : NSObject *, // expected-error{{type bound 'NSObject *' for type parameter 'T' conflicts with implicit bound 'id'}} + X : id> () // expected-error{{type bound 'id' for type parameter 'X' conflicts with previous bound 'NSObject *'for type parameter 'U'}} +@end + +// Parameterized category/extension of non-parameterized class. +@interface NSObject<T> (Cat1) // expected-error{{category of non-parameterized class 'NSObject' cannot have type parameters}} +@end + +@interface NSObject<T> () // expected-error{{extension of non-parameterized class 'NSObject' cannot have type parameters}} +@end + +// -------------------------------------------------------------------------- +// @implementations cannot have type parameters +// -------------------------------------------------------------------------- +@implementation PC1<T : id> // expected-error{{@implementation cannot have type parameters}} +@end + +@implementation PC2<T> // expected-error{{@implementation declaration cannot be protocol qualified}} +@end + +@implementation PC1<T> (Cat1) // expected-error{{@implementation cannot have type parameters}} +@end + +@implementation PC1<T : id> (Cat2) // expected-error{{@implementation cannot have type parameters}} +@end + +// -------------------------------------------------------------------------- +// Interfaces involving type parameters +// -------------------------------------------------------------------------- +@interface PC20<T : id, U : NSObject *, V : NSString *> : NSObject { + T object; +} + +- (U)method:(V)param; +@end + +@interface PC20<T, U, V> (Cat1) +- (U)catMethod:(V)param; +@end + +@interface PC20<X, Y, Z>() +- (X)extMethod:(Y)param; +@end + +// -------------------------------------------------------------------------- +// Parsing type arguments. +// -------------------------------------------------------------------------- + +typedef NSString * ObjCStringRef; // expected-note{{'ObjCStringRef' declared here}} + +// Type arguments with a mix of identifiers and type-names. +typedef PC4<id, NSObject *, NSString *> typeArgs1; + +// Type arguments with only identifiers. +typedef PC4<id, id, id> typeArgs2; + +// Type arguments with only identifiers; one is ambiguous (resolved as +// types). +typedef PC4<NSObject, id, id> typeArgs3; // expected-error{{type argument 'NSObject' must be a pointer (requires a '*')}} + +// Type arguments with only identifiers; one is ambiguous (resolved as +// protocol qualifiers). +typedef PC4<NSObject, NSCopying> protocolQuals1; + +// Type arguments and protocol qualifiers. +typedef PC4<id, NSObject *, id><NSObject, NSCopying> typeArgsAndProtocolQuals1; + +// Type arguments and protocol qualifiers in the wrong order. +typedef PC4<NSObject, NSCopying><id, NSObject *, id> typeArgsAndProtocolQuals2; // expected-error{{protocol qualifiers must precede type arguments}} + +// Type arguments and protocol qualifiers (identifiers). +typedef PC4<id, NSObject, id><NSObject, NSCopying> typeArgsAndProtocolQuals3; // expected-error{{type argument 'NSObject' must be a pointer (requires a '*')}} + +// Typo correction: protocol bias. +typedef PC4<NSCopying, NSObjec> protocolQuals2; // expected-error{{cannot find protocol declaration for 'NSObjec'; did you mean 'NSObject'?}} + +// Typo correction: type bias. +typedef PC4<id, id, NSObjec> typeArgs4; // expected-error{{unknown class name 'NSObjec'; did you mean 'NSObject'?}} +// expected-error@-1{{type argument 'NSObject' must be a pointer (requires a '*')}} + +// Typo correction: bias set by correction itself to a protocol. +typedef PC4<NSObject, NSObject, NSCopyin> protocolQuals3; // expected-error{{cannot find protocol declaration for 'NSCopyin'; did you mean 'NSCopying'?}} + +// Typo correction: bias set by correction itself to a type. +typedef PC4<NSObject, NSObject, ObjCStringref> typeArgs5; // expected-error{{unknown type name 'ObjCStringref'; did you mean 'ObjCStringRef'?}} +// expected-error@-1{{type argument 'NSObject' must be a pointer (requires a '*')}} +// expected-error@-2{{type argument 'NSObject' must be a pointer (requires a '*')}} + +// Type/protocol conflict. +typedef PC4<NSCopying, ObjCStringRef> typeArgsProtocolQualsConflict1; // expected-error{{angle brackets contain both a type ('ObjCStringRef') and a protocol ('NSCopying')}} + +// Handling the '>>' in type argument lists. +typedef PC4<id<NSCopying>, NSObject *, id<NSObject>> typeArgs6; + +// -------------------------------------------------------------------------- +// Checking type arguments. +// -------------------------------------------------------------------------- + +@interface PC15<T : id, U : NSObject *, V : id<NSCopying>> : NSObject +// expected-note@-1{{type parameter 'V' declared here}} +// expected-note@-2{{type parameter 'V' declared here}} +// expected-note@-3{{type parameter 'U' declared here}} +@end + +typedef PC4<NSString *> tooFewTypeArgs1; // expected-error{{too few type arguments for class 'PC4' (have 1, expected 3)}} + +typedef PC4<NSString *, NSString *, NSString *, NSString *> tooManyTypeArgs1; // expected-error{{too many type arguments for class 'PC4' (have 4, expected 3)}} + +typedef PC15<int (^)(int, int), // block pointers as 'id' + NSString *, // subclass + NSString *> typeArgs7; // class that conforms to the protocol + +typedef PC15<NSObject *, NSObject *, id<NSCopying>> typeArgs8; + +typedef PC15<NSObject *, NSObject *, + NSObject *> typeArgs8b; // expected-error{{type argument 'NSObject *' does not satisfy the bound ('id<NSCopying>') of type parameter 'V'}} + +typedef PC15<id, + id, // expected-error{{type argument 'id' does not satisfy the bound ('NSObject *') of type parameter 'U'}} + id> typeArgs9; + +typedef PC15<id, NSObject *, + id> typeArgs10; // expected-error{{type argument 'id' does not satisfy the bound ('id<NSCopying>') of type parameter 'V'}} + +typedef PC15<id, + int (^)(int, int), // okay + id<NSCopying, NSObject>> typeArgs11; + +typedef PC15<id, NSString *, int (^)(int, int)> typeArgs12; // okay + +typedef NSObject<id, id> typeArgs13; // expected-error{{type arguments cannot be applied to non-parameterized class 'NSObject'}} + +typedef id<id, id> typeArgs14; // expected-error{{type arguments cannot be applied to non-class type 'id'}} + +typedef PC1<NSObject *, NSString *> typeArgs15; + +typedef PC1<NSObject *, NSString *><NSCopying> typeArgsAndProtocolQuals4; + +typedef typeArgs15<NSCopying> typeArgsAndProtocolQuals5; + +typedef typeArgs15<NSObject *, NSString *> typeArgs16; // expected-error{{type arguments cannot be applied to already-specialized class type 'typeArgs15' (aka 'PC1<NSObject *,NSString *>')}} + +typedef typeArgs15<NSObject> typeArgsAndProtocolQuals6; + +void testSpecializedTypePrinting() { + int *ip; + + ip = (typeArgs15*)0; // expected-warning{{'typeArgs15 *' (aka 'PC1<NSObject *,NSString *> *')}} + ip = (typeArgsAndProtocolQuals4*)0; // expected-warning{{'typeArgsAndProtocolQuals4 *' (aka 'PC1<NSObject *,NSString *><NSCopying> *')}} + ip = (typeArgsAndProtocolQuals5*)0; // expected-warning{{'typeArgsAndProtocolQuals5 *' (aka 'typeArgs15<NSCopying> *')}} + ip = (typeArgsAndProtocolQuals6)0; // expected-error{{used type 'typeArgsAndProtocolQuals6' (aka 'typeArgs15<NSObject>')}} + ip = (typeArgsAndProtocolQuals6*)0;// expected-warning{{'typeArgsAndProtocolQuals6 *' (aka 'typeArgs15<NSObject> *')}} +} + +// -------------------------------------------------------------------------- +// Specialized superclasses +// -------------------------------------------------------------------------- +@interface PC21<T : NSObject *> : PC1<T, T> +@end + +@interface PC22<T : NSObject *> : PC1<T> // expected-error{{too few type arguments for class 'PC1' (have 1, expected 2)}} +@end + +@interface PC23<T : NSObject *> : PC1<T, U> // expected-error{{unknown type name 'U'}} +@end + +@interface PC24<T> : PC1<T, T> // expected-error{{type argument 'T' (aka 'id') does not satisfy the bound ('NSObject *') of type parameter 'U'}} +@end + +@interface NSFoo : PC1<NSObject *, NSObject *> // okay +@end + +// -------------------------------------------------------------------------- +// Co- and contra-variance. +// -------------------------------------------------------------------------- +@class Variance1<T, U>; + +@class Variance1<__covariant T, __contravariant U>; + +@interface Variance1<__covariant T, __contravariant U> : NSObject // expected-note 2{{declared here}} +@end + +@interface Variance1<T, U> () // okay, inferred +@end + +@interface Variance1<T, U> (Cat1) // okay, inferred +@end + +@class Variance1<T, U>; // okay, inferred + +@interface Variance1<__covariant T, __contravariant U> () // okay, matches +@end + +@interface Variance1<__covariant T, __contravariant U> (Cat2) // okay, matches +@end + +@class Variance1<__covariant T, __contravariant U>; // okay, matches + +@interface Variance1<__contravariant X, // expected-error{{contravariant type parameter 'X' conflicts with previous covariant type parameter 'T'}} + __covariant Y> () // expected-error{{covariant type parameter 'Y' conflicts with previous contravariant type parameter 'U'}} +@end + +@class Variance2<__covariant T, __contravariant U>; // expected-note 2{{declared here}} + +@interface Variance2<__contravariant T, // expected-error{{contravariant type parameter 'T' conflicts with previous covariant type parameter 'T'}} + U> : NSObject // expected-error{{invariant type parameter 'U' conflicts with previous contravariant type parameter 'U'}} +@end diff --git a/test/SemaObjC/parameterized_classes_collection_literal.m b/test/SemaObjC/parameterized_classes_collection_literal.m new file mode 100644 index 000000000000..472746e09db9 --- /dev/null +++ b/test/SemaObjC/parameterized_classes_collection_literal.m @@ -0,0 +1,52 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -verify %s + +#if __LP64__ || (TARGET_OS_EMBEDDED && !TARGET_OS_IPHONE) || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64 +typedef unsigned long NSUInteger; +#else +typedef unsigned int NSUInteger; +#endif + +@protocol NSObject +@end + +@protocol NSCopying +@end + +__attribute__((objc_root_class)) +@interface NSObject <NSObject> +@end + +@interface NSString : NSObject <NSCopying> +@end + +@interface NSNumber : NSObject <NSCopying> ++ (NSNumber *)numberWithInt:(int)value; +@end + +@interface NSArray<T> : NSObject <NSCopying> ++ (instancetype)arrayWithObjects:(const T [])objects count:(NSUInteger)cnt; +@end + +@interface NSDictionary<K, V> : NSObject <NSCopying> ++ (instancetype)dictionaryWithObjects:(const V [])objects forKeys:(const K [])keys count:(NSUInteger)cnt; +@end + +void testArrayLiteral(void) { + NSArray<NSString *> *array1 = @[@"hello", + @1, // expected-warning{{of type 'NSNumber *' is not compatible with array element type 'NSString *'}} + @"world", + @[@1, @2]]; // expected-warning{{of type 'NSArray *' is not compatible with array element type 'NSString *'}} + + NSArray<NSArray<NSString *> *> *array2 = @[@[@"hello", @"world"], + @"blah", // expected-warning{{object of type 'NSString *' is not compatible with array element type 'NSArray<NSString *> *'}} + @[@1]]; // expected-warning{{object of type 'NSNumber *' is not compatible with array element type 'NSString *'}} +} + +void testDictionaryLiteral(void) { + NSDictionary<NSString *, NSNumber *> *dict1 = @{ + @"hello" : @17, + @18 : @18, // expected-warning{{object of type 'NSNumber *' is not compatible with dictionary key type 'NSString *'}} + @"world" : @"blah" // expected-warning{{object of type 'NSString *' is not compatible with dictionary value type 'NSNumber *'}} + }; +} diff --git a/test/SemaObjC/parameterized_classes_subst.m b/test/SemaObjC/parameterized_classes_subst.m new file mode 100644 index 000000000000..f90ee9093592 --- /dev/null +++ b/test/SemaObjC/parameterized_classes_subst.m @@ -0,0 +1,428 @@ +// RUN: %clang_cc1 -fblocks -fsyntax-only -Wnullable-to-nonnull-conversion %s -verify +// +// Test the substitution of type arguments for type parameters when +// using parameterized classes in Objective-C. + +@protocol NSObject +@end + +__attribute__((objc_root_class)) +@interface NSObject <NSObject> ++ (instancetype)alloc; +- (instancetype)init; +@end + +@protocol NSCopying +@end + +@interface NSString : NSObject <NSCopying> +@end + +@interface NSMutableString : NSString +@end + +@interface NSNumber : NSObject <NSCopying> +@end + +@interface NSArray<T> : NSObject <NSCopying> { +@public + T *data; // don't try this at home +} +- (T)objectAtIndexedSubscript:(int)index; ++ (NSArray<T> *)array; ++ (void)setArray:(NSArray <T> *)array; +@property (copy,nonatomic) T lastObject; +@end + +@interface NSMutableArray<T> : NSArray<T> +-(instancetype)initWithArray:(NSArray<T> *)array; // expected-note{{passing argument}} +- (void)setObject:(T)object atIndexedSubscript:(int)index; // expected-note 2{{passing argument to parameter 'object' here}} +@end + +@interface NSStringArray : NSArray<NSString *> +@end + +@interface NSSet<T> : NSObject <NSCopying> +- (T)firstObject; +@property (nonatomic, copy) NSArray<T> *allObjects; +@end + +// Parameterized inheritance (simple case) +@interface NSMutableSet<U : id<NSCopying>> : NSSet<U> +- (void)addObject:(U)object; // expected-note 7{{passing argument to parameter 'object' here}} +@end + +@interface Widget : NSObject <NSCopying> +@end + +// Non-parameterized class inheriting from a specialization of a +// parameterized class. +@interface WidgetSet : NSMutableSet<Widget *> +@end + +// Parameterized inheritance with a more interesting transformation in +// the specialization. +@interface MutableSetOfArrays<T> : NSMutableSet<NSArray<T>*> +@end + +// Inheriting from an unspecialized form of a parameterized type. +@interface UntypedMutableSet : NSMutableSet +@end + +@interface Window : NSObject +@end + +@interface NSDictionary<K, V> : NSObject <NSCopying> +- (V)objectForKeyedSubscript:(K)key; // expected-note 2{{parameter 'key'}} +@end + +@interface NSMutableDictionary<K : id<NSCopying>, V> : NSDictionary<K, V> +- (void)setObject:(V)object forKeyedSubscript:(K)key; +// expected-note@-1 {{parameter 'object' here}} +// expected-note@-2 {{parameter 'object' here}} +// expected-note@-3 {{parameter 'key' here}} +// expected-note@-4 {{parameter 'key' here}} + +@property (strong) K someRandomKey; +@end + +@interface WindowArray : NSArray<Window *> +@end + +@interface NSSet<T> (Searching) +- (T)findObject:(T)object; +@end + +@interface NSView : NSObject +@end + +@interface NSControl : NSView +- (void)toggle; +@end + +@interface NSViewController<ViewType : NSView *> : NSObject +@property (nonatomic,retain) ViewType view; +@end + +// -------------------------------------------------------------------------- +// Nullability +// -------------------------------------------------------------------------- +typedef NSControl * _Nonnull Nonnull_NSControl; + +@interface NSNullableTest<ViewType : NSView *> : NSObject +- (ViewType)view; +- (nullable ViewType)maybeView; +@end + +@interface NSNullableTest2<ViewType : NSView * _Nullable> : NSObject // expected-error{{type parameter 'ViewType' bound 'NSView * _Nullable' cannot explicitly specify nullability}} +@end + +void test_nullability(void) { + NSControl * _Nonnull nonnull_NSControl; + + // Nullability introduced by substitution. + NSNullableTest<NSControl *> *unspecifiedControl; + nonnull_NSControl = [unspecifiedControl view]; + nonnull_NSControl = [unspecifiedControl maybeView]; // expected-warning{{from nullable pointer 'NSControl * _Nullable' to non-nullable pointer type 'NSControl * _Nonnull'}} + + // Nullability overridden by substitution. + NSNullableTest<Nonnull_NSControl> *nonnullControl; + nonnull_NSControl = [nonnullControl view]; + nonnull_NSControl = [nonnullControl maybeView]; // expected-warning{{from nullable pointer 'Nonnull_NSControl _Nullable' (aka 'NSControl *') to non-nullable pointer type 'NSControl * _Nonnull'}} + + // Nullability cannot be specified directly on a type argument. + NSNullableTest<NSControl * _Nonnull> *nonnullControl2; // expected-error{{type argument 'NSControl *' cannot explicitly specify nullability}} +} + +// -------------------------------------------------------------------------- +// Message sends. +// -------------------------------------------------------------------------- +void test_message_send_result( + NSSet<NSString *> *stringSet, + NSMutableSet<NSString *> *mutStringSet, + WidgetSet *widgetSet, + UntypedMutableSet *untypedMutSet, + MutableSetOfArrays<NSString *> *mutStringArraySet, + NSSet *set, + NSMutableSet *mutSet, + MutableSetOfArrays *mutArraySet, + NSArray<NSString *> *stringArray, + NSArray<__kindof NSString *> *kindofStringArray, + void (^block)(void)) { + int *ip; + ip = [stringSet firstObject]; // expected-warning{{from 'NSString *'}} + ip = [mutStringSet firstObject]; // expected-warning{{from 'NSString *'}} + ip = [widgetSet firstObject]; // expected-warning{{from 'Widget *'}} + ip = [untypedMutSet firstObject]; // expected-warning{{from 'id'}} + ip = [mutStringArraySet firstObject]; // expected-warning{{from 'NSArray<NSString *> *'}} + ip = [set firstObject]; // expected-warning{{from 'id'}} + ip = [mutSet firstObject]; // expected-warning{{from 'id'}} + ip = [mutArraySet firstObject]; // expected-warning{{from 'id'}} + ip = [block firstObject]; // expected-warning{{from 'id'}} + + ip = [stringSet findObject:@"blah"]; // expected-warning{{from 'NSString *'}} + + // Class messages. + ip = [NSSet<NSString *> alloc]; // expected-warning{{from 'NSSet<NSString *> *'}} + ip = [NSSet alloc]; // expected-warning{{from 'NSSet *'}} + ip = [MutableSetOfArrays<NSString *> alloc]; // expected-warning{{from 'MutableSetOfArrays<NSString *> *'}} + ip = [MutableSetOfArrays alloc]; // expected-warning{{from 'MutableSetOfArrays *'}} + ip = [NSArray<NSString *> array]; // expected-warning{{from 'NSArray<NSString *> *'}} + ip = [NSArray<NSString *><NSCopying> array]; // expected-warning{{from 'NSArray<NSString *> *'}} + + ip = [[NSMutableArray<NSString *> alloc] init]; // expected-warning{{from 'NSMutableArray<NSString *> *'}} + + [[NSMutableArray alloc] initWithArray: stringArray]; // okay + [[NSMutableArray<NSString *> alloc] initWithArray: stringArray]; // okay + [[NSMutableArray<NSNumber *> alloc] initWithArray: stringArray]; // expected-warning{{sending 'NSArray<NSString *> *' to parameter of type 'NSArray<NSNumber *> *'}} + + ip = [[[NSViewController alloc] init] view]; // expected-warning{{from '__kindof NSView *'}} + [[[[NSViewController alloc] init] view] toggle]; + + NSMutableString *mutStr = kindofStringArray[0]; + NSNumber *number = kindofStringArray[0]; // expected-warning{{of type '__kindof NSString *'}} +} + +void test_message_send_param( + NSMutableSet<NSString *> *mutStringSet, + WidgetSet *widgetSet, + UntypedMutableSet *untypedMutSet, + MutableSetOfArrays<NSString *> *mutStringArraySet, + NSMutableSet *mutSet, + MutableSetOfArrays *mutArraySet, + void (^block)(void)) { + Window *window; + + [mutStringSet addObject: window]; // expected-warning{{parameter of type 'NSString *'}} + [widgetSet addObject: window]; // expected-warning{{parameter of type 'Widget *'}} + [untypedMutSet addObject: window]; // expected-warning{{parameter of incompatible type 'id<NSCopying>'}} + [mutStringArraySet addObject: window]; // expected-warning{{parameter of type 'NSArray<NSString *> *'}} + [mutSet addObject: window]; // expected-warning{{parameter of incompatible type 'id<NSCopying>'}} + [mutArraySet addObject: window]; // expected-warning{{parameter of incompatible type 'id<NSCopying>'}} + [block addObject: window]; // expected-warning{{parameter of incompatible type 'id<NSCopying>'}} +} + +// -------------------------------------------------------------------------- +// Property accesses. +// -------------------------------------------------------------------------- +void test_property_read( + NSSet<NSString *> *stringSet, + NSMutableSet<NSString *> *mutStringSet, + WidgetSet *widgetSet, + UntypedMutableSet *untypedMutSet, + MutableSetOfArrays<NSString *> *mutStringArraySet, + NSSet *set, + NSMutableSet *mutSet, + MutableSetOfArrays *mutArraySet, + NSMutableDictionary *mutDict) { + int *ip; + ip = stringSet.allObjects; // expected-warning{{from 'NSArray<NSString *> *'}} + ip = mutStringSet.allObjects; // expected-warning{{from 'NSArray<NSString *> *'}} + ip = widgetSet.allObjects; // expected-warning{{from 'NSArray<Widget *> *'}} + ip = untypedMutSet.allObjects; // expected-warning{{from 'NSArray *'}} + ip = mutStringArraySet.allObjects; // expected-warning{{from 'NSArray<NSArray<NSString *> *> *'}} + ip = set.allObjects; // expected-warning{{from 'NSArray *'}} + ip = mutSet.allObjects; // expected-warning{{from 'NSArray *'}} + ip = mutArraySet.allObjects; // expected-warning{{from 'NSArray *'}} + + ip = mutDict.someRandomKey; // expected-warning{{from '__kindof id<NSCopying>'}} + + ip = [[NSViewController alloc] init].view; // expected-warning{{from '__kindof NSView *'}} +} + +void test_property_write( + NSMutableSet<NSString *> *mutStringSet, + WidgetSet *widgetSet, + UntypedMutableSet *untypedMutSet, + MutableSetOfArrays<NSString *> *mutStringArraySet, + NSMutableSet *mutSet, + MutableSetOfArrays *mutArraySet, + NSMutableDictionary *mutDict) { + int *ip; + + mutStringSet.allObjects = ip; // expected-warning{{to 'NSArray<NSString *> *'}} + widgetSet.allObjects = ip; // expected-warning{{to 'NSArray<Widget *> *'}} + untypedMutSet.allObjects = ip; // expected-warning{{to 'NSArray *'}} + mutStringArraySet.allObjects = ip; // expected-warning{{to 'NSArray<NSArray<NSString *> *> *'}} + mutSet.allObjects = ip; // expected-warning{{to 'NSArray *'}} + mutArraySet.allObjects = ip; // expected-warning{{to 'NSArray *'}} + + mutDict.someRandomKey = ip; // expected-warning{{to 'id<NSCopying>'}} +} + +// -------------------------------------------------------------------------- +// Subscripting +// -------------------------------------------------------------------------- +void test_subscripting( + NSArray<NSString *> *stringArray, + NSMutableArray<NSString *> *mutStringArray, + NSArray *array, + NSMutableArray *mutArray, + NSDictionary<NSString *, Widget *> *stringWidgetDict, + NSMutableDictionary<NSString *, Widget *> *mutStringWidgetDict, + NSDictionary *dict, + NSMutableDictionary *mutDict) { + int *ip; + NSString *string; + Widget *widget; + Window *window; + + ip = stringArray[0]; // expected-warning{{from 'NSString *'}} + + ip = mutStringArray[0]; // expected-warning{{from 'NSString *'}} + mutStringArray[0] = ip; // expected-warning{{parameter of type 'NSString *'}} + + ip = array[0]; // expected-warning{{from 'id'}} + + ip = mutArray[0]; // expected-warning{{from 'id'}} + mutArray[0] = ip; // expected-warning{{parameter of type 'id'}} + + ip = stringWidgetDict[string]; // expected-warning{{from 'Widget *'}} + widget = stringWidgetDict[widget]; // expected-warning{{to parameter of type 'NSString *'}} + + ip = mutStringWidgetDict[string]; // expected-warning{{from 'Widget *'}} + widget = mutStringWidgetDict[widget]; // expected-warning{{to parameter of type 'NSString *'}} + mutStringWidgetDict[string] = ip; // expected-warning{{to parameter of type 'Widget *'}} + mutStringWidgetDict[widget] = widget; // expected-warning{{to parameter of type 'NSString *'}} + + ip = dict[string]; // expected-warning{{from 'id'}} + + ip = mutDict[string]; // expected-warning{{from 'id'}} + mutDict[string] = ip; // expected-warning{{to parameter of type 'id'}} + + widget = mutDict[window]; + mutDict[window] = widget; // expected-warning{{parameter of incompatible type 'id<NSCopying>'}} +} + +// -------------------------------------------------------------------------- +// Instance variable access. +// -------------------------------------------------------------------------- +void test_instance_variable(NSArray<NSString *> *stringArray, + NSArray *array) { + int *ip; + + ip = stringArray->data; // expected-warning{{from 'NSString **'}} + ip = array->data; // expected-warning{{from 'id *'}} +} + +@implementation WindowArray +- (void)testInstanceVariable { + int *ip; + + ip = data; // expected-warning{{from 'Window **'}} +} +@end + +// -------------------------------------------------------------------------- +// Implicit conversions. +// -------------------------------------------------------------------------- +void test_implicit_conversions(NSArray<NSString *> *stringArray, + NSArray<NSNumber *> *numberArray, + NSMutableArray<NSString *> *mutStringArray, + NSArray *array, + NSMutableArray *mutArray) { + // Specialized -> unspecialized (same level) + array = stringArray; + + // Unspecialized -> specialized (same level) + stringArray = array; + + // Specialized -> specialized failure (same level). + stringArray = numberArray; // expected-warning{{incompatible pointer types assigning to 'NSArray<NSString *> *' from 'NSArray<NSNumber *> *'}} + + // Specialized -> specialized (different levels). + stringArray = mutStringArray; + + // Specialized -> specialized failure (different levels). + numberArray = mutStringArray; // expected-warning{{incompatible pointer types assigning to 'NSArray<NSNumber *> *' from 'NSMutableArray<NSString *> *'}} + + // Unspecialized -> specialized (different levels). + stringArray = mutArray; + + // Specialized -> unspecialized (different levels). + array = mutStringArray; +} + +@interface NSCovariant1<__covariant T> +@end + +@interface NSContravariant1<__contravariant T> +@end + +void test_variance(NSCovariant1<NSString *> *covariant1, + NSCovariant1<NSMutableString *> *covariant2, + NSCovariant1<NSString *(^)(void)> *covariant3, + NSCovariant1<NSMutableString *(^)(void)> *covariant4, + NSCovariant1<id> *covariant5, + NSCovariant1<id<NSCopying>> *covariant6, + NSContravariant1<NSString *> *contravariant1, + NSContravariant1<NSMutableString *> *contravariant2) { + covariant1 = covariant2; // okay + covariant2 = covariant1; // expected-warning{{incompatible pointer types assigning to 'NSCovariant1<NSMutableString *> *' from 'NSCovariant1<NSString *> *'}} + + covariant3 = covariant4; // okay + covariant4 = covariant3; // expected-warning{{incompatible pointer types assigning to 'NSCovariant1<NSMutableString *(^)(void)> *' from 'NSCovariant1<NSString *(^)(void)> *'}} + + covariant5 = covariant1; // okay + covariant1 = covariant5; // okay: id is promiscuous + + covariant5 = covariant3; // okay + covariant3 = covariant5; // okay + + contravariant1 = contravariant2; // expected-warning{{incompatible pointer types assigning to 'NSContravariant1<NSString *> *' from 'NSContravariant1<NSMutableString *> *'}} + contravariant2 = contravariant1; // okay +} + +// -------------------------------------------------------------------------- +// Ternary operator +// -------------------------------------------------------------------------- +void test_ternary_operator(NSArray<NSString *> *stringArray, + NSArray<NSNumber *> *numberArray, + NSMutableArray<NSString *> *mutStringArray, + NSStringArray *stringArray2, + NSArray *array, + NSMutableArray *mutArray, + int cond) { + int *ip; + id object; + + ip = cond ? stringArray : mutStringArray; // expected-warning{{from 'NSArray<NSString *> *'}} + ip = cond ? mutStringArray : stringArray; // expected-warning{{from 'NSArray<NSString *> *'}} + + ip = cond ? stringArray2 : mutStringArray; // expected-warning{{from 'NSArray<NSString *> *'}} + ip = cond ? mutStringArray : stringArray2; // expected-warning{{from 'NSArray<NSString *> *'}} + + ip = cond ? stringArray : mutArray; // expected-warning{{from 'NSArray *'}} + + ip = cond ? stringArray2 : mutArray; // expected-warning{{from 'NSArray *'}} + + ip = cond ? mutArray : stringArray; // expected-warning{{from 'NSArray *'}} + + ip = cond ? mutArray : stringArray2; // expected-warning{{from 'NSArray *'}} + + object = cond ? stringArray : numberArray; // expected-warning{{incompatible operand types ('NSArray<NSString *> *' and 'NSArray<NSNumber *> *')}} +} + +// -------------------------------------------------------------------------- +// super +// -------------------------------------------------------------------------- +@implementation NSStringArray +- (void)useSuperMethod { + int *ip; + ip = super.lastObject; // expected-warning{{from 'NSString *'}} + super.lastObject = ip; // expected-warning{{to 'NSString *'}} + ip = [super objectAtIndexedSubscript:0]; // expected-warning{{from 'NSString *'}} +} + ++ (void)useSuperMethod { + int *ip; + ip = super.array; // expected-warning{{from 'NSArray<NSString *> *'}} + super.array = ip; // expected-warning{{to 'NSArray<NSString *> *'}} + ip = [super array]; // expected-warning{{from 'NSArray<NSString *> *'}} +} +@end + +// -------------------------------------------------------------------------- +// warning about likely protocol/class name typos. +// -------------------------------------------------------------------------- +typedef NSArray<NSObject> ArrayOfNSObjectWarning; // expected-warning{{parameterized class 'NSArray' already conforms to the protocols listed; did you forget a '*'?}} diff --git a/test/SemaObjC/protocol-archane.m b/test/SemaObjC/protocol-archane.m index 788edf276d7b..f2f6025a5ad6 100644 --- a/test/SemaObjC/protocol-archane.m +++ b/test/SemaObjC/protocol-archane.m @@ -40,3 +40,7 @@ Class <SomeProtocol> UnfortunateGCCExtension; - (void)crashWith:(<Broken>)a { // expected-warning {{protocol has no object type specified; defaults to qualified 'id'}} } @end + +typedef <SomeProtocol> id TwoTypeSpecs; // expected-warning{{no object type specified}} +// expected-error@-1{{typedef redefinition with different types ('id<SomeProtocol>' vs 'id')}} +// expected-error@-2{{expected ';' after top level declarator}} diff --git a/test/SemaObjC/protocol-warn.m b/test/SemaObjC/protocol-warn.m index 2d042380582e..04df5031ab47 100644 --- a/test/SemaObjC/protocol-warn.m +++ b/test/SemaObjC/protocol-warn.m @@ -51,5 +51,5 @@ UIWebPDFView *getView() { UIWebBrowserView *browserView; UIWebPDFView *pdfView; - return pdfView ? pdfView : browserView; // expected-warning {{incompatible pointer types returning 'UIView<NSObject> *' from a function with result type 'UIWebPDFView *'}} + return pdfView ? pdfView : browserView; // expected-warning {{incompatible pointer types returning 'UIView *' from a function with result type 'UIWebPDFView *'}} } diff --git a/test/SemaObjCXX/Inputs/nullability-pragmas-generics-1.h b/test/SemaObjCXX/Inputs/nullability-pragmas-generics-1.h new file mode 100644 index 000000000000..9a51fa1e9903 --- /dev/null +++ b/test/SemaObjCXX/Inputs/nullability-pragmas-generics-1.h @@ -0,0 +1,21 @@ +#pragma clang assume_nonnull begin + +__attribute__((objc_root_class)) +@interface B +@end + +@interface C : B +@end + +__attribute__((objc_root_class)) +@interface NSGeneric<T : B *> // expected-note{{type parameter 'T' declared here}} +- (T)tee; +- (nullable T)maybeTee; +@end + +typedef NSGeneric<C *> *Generic_with_C; + +#pragma clang assume_nonnull end + +@interface NSGeneric<T : C *>(Blah) // expected-error{{type bound 'C *' for type parameter 'T' conflicts with previous bound 'B *'}} +@end diff --git a/test/SemaObjCXX/nullability-pragmas.mm b/test/SemaObjCXX/nullability-pragmas.mm index dbf4f37f4019..817d056a14ac 100644 --- a/test/SemaObjCXX/nullability-pragmas.mm +++ b/test/SemaObjCXX/nullability-pragmas.mm @@ -2,6 +2,7 @@ #include "nullability-pragmas-1.h" #include "nullability-pragmas-2.h" +#include "nullability-pragmas-generics-1.h" #if !__has_feature(assume_nonnull) # error assume_nonnull feature is not set @@ -43,3 +44,14 @@ void test_pragmas_1(A * _Nonnull a, AA * _Nonnull aa) { ptr = aa->ivar1; // expected-error{{from incompatible type 'id'}} ptr = aa->ivar2; // expected-error{{from incompatible type 'id _Nonnull'}} } + +void test_pragmas_generics(void) { + float *fp; + + NSGeneric<C *> *genC; + fp = [genC tee]; // expected-error{{from incompatible type 'C *'}} + fp = [genC maybeTee]; // expected-error{{from incompatible type 'C * _Nullable'}} + + Generic_with_C genC2; + fp = genC2; // expected-error{{from incompatible type 'Generic_with_C' (aka 'NSGeneric<C *> *')}} +} diff --git a/test/SemaObjCXX/objc2-merge-gc-attribue-decl.mm b/test/SemaObjCXX/objc2-merge-gc-attribue-decl.mm index 7be5f17daa80..9166ba65b9fa 100644 --- a/test/SemaObjCXX/objc2-merge-gc-attribue-decl.mm +++ b/test/SemaObjCXX/objc2-merge-gc-attribue-decl.mm @@ -35,17 +35,17 @@ extern ID CFRunLoopGetMain8(); extern __weak id WLoopGetMain(); // expected-note {{previous declaration is here}} extern id WLoopGetMain(); // expected-error {{functions that differ only in their return type cannot be overloaded}} -extern id p3; // expected-note {{previous definition is here}} -extern __weak id p3; // expected-error {{redefinition of 'p3' with a different type}} +extern id p3; // expected-note {{previous declaration is here}} +extern __weak id p3; // expected-error {{redeclaration of 'p3' with a different type}} -extern void *p4; // expected-note {{previous definition is here}} -extern void * __strong p4; // expected-error {{redefinition of 'p4' with a different type}} +extern void *p4; // expected-note {{previous declaration is here}} +extern void * __strong p4; // expected-error {{redeclaration of 'p4' with a different type}} extern id p5; extern __strong id p5; -extern char* __strong p6; // expected-note {{previous definition is here}} -extern char* p6; // expected-error {{redefinition of 'p6' with a different type}} +extern char* __strong p6; // expected-note {{previous declaration is here}} +extern char* p6; // expected-error {{redeclaration of 'p6' with a different type}} -extern __strong char* p7; // expected-note {{previous definition is here}} -extern char* p7; // expected-error {{redefinition of 'p7' with a different type}} +extern __strong char* p7; // expected-note {{previous declaration is here}} +extern char* p7; // expected-error {{redeclaration of 'p7' with a different type}} diff --git a/test/SemaObjCXX/parameterized_classes.mm b/test/SemaObjCXX/parameterized_classes.mm new file mode 100644 index 000000000000..48542634bdd9 --- /dev/null +++ b/test/SemaObjCXX/parameterized_classes.mm @@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -std=c++11 %s -verify + +// expected-no-diagnostics +@protocol NSObject +@end + +@protocol NSCopying +@end + +__attribute__((objc_root_class)) +@interface NSObject <NSObject> +@end + +@interface NSString : NSObject +@end + +// -------------------------------------------------------------------------- +// Parsing parameterized classes. +// -------------------------------------------------------------------------- +@interface PC1<T, U, V> : NSObject +@end + +// -------------------------------------------------------------------------- +// Parsing type arguments. +// -------------------------------------------------------------------------- +typedef PC1<::NSString *, NSString *, id<NSCopying>> typeArgs1; diff --git a/test/SemaObjCXX/parameterized_classes_subst.mm b/test/SemaObjCXX/parameterized_classes_subst.mm new file mode 100644 index 000000000000..f342ac0224ce --- /dev/null +++ b/test/SemaObjCXX/parameterized_classes_subst.mm @@ -0,0 +1,440 @@ +// RUN: %clang_cc1 -fblocks -fsyntax-only -std=c++11 %s -verify +// +// Test the substitution of type arguments for type parameters when +// using parameterized classes in Objective-C. + +__attribute__((objc_root_class)) +@interface NSObject ++ (instancetype)alloc; +- (instancetype)init; +@end + +@protocol NSCopying +@end + +@interface NSString : NSObject <NSCopying> +@end + +@interface NSMutableString : NSString +@end + +@interface NSNumber : NSObject <NSCopying> +@end + +@interface NSArray<T> : NSObject <NSCopying> { +@public + T *data; // don't try this at home +} +- (T)objectAtIndexedSubscript:(int)index; ++ (NSArray<T> *)array; +@property (copy,nonatomic) T lastObject; +@end + +@interface NSMutableArray<T> : NSArray<T> +-(instancetype)initWithArray:(NSArray<T> *)array; // expected-note{{passing argument}} +- (void)setObject:(T)object atIndexedSubscript:(int)index; // expected-note 2{{passing argument to parameter 'object' here}} +@end + +@interface NSStringArray : NSArray<NSString *> +@end + +@interface NSSet<T> : NSObject <NSCopying> +- (T)firstObject; +@property (nonatomic, copy) NSArray<T> *allObjects; +@end + +// Parameterized inheritance (simple case) +@interface NSMutableSet<U : id<NSCopying>> : NSSet<U> +- (void)addObject:(U)object; // expected-note 7{{passing argument to parameter 'object' here}} +@end + +@interface Widget : NSObject <NSCopying> +@end + +// Non-parameterized class inheriting from a specialization of a +// parameterized class. +@interface WidgetSet : NSMutableSet<Widget *> +@end + +// Parameterized inheritance with a more interesting transformation in +// the specialization. +@interface MutableSetOfArrays<T> : NSMutableSet<NSArray<T>*> +@end + +// Inheriting from an unspecialized form of a parameterized type. +@interface UntypedMutableSet : NSMutableSet +@end + +@interface Window : NSObject +@end + +@interface NSDictionary<K, V> : NSObject <NSCopying> +- (V)objectForKeyedSubscript:(K)key; // expected-note 2{{parameter 'key'}} +@end + +@interface NSMutableDictionary<K : id<NSCopying>, V> : NSDictionary<K, V> // expected-note 2{{type parameter 'K' declared here}} \ +// expected-note 2{{'NSMutableDictionary' declared here}} +- (void)setObject:(V)object forKeyedSubscript:(K)key; +// expected-note@-1 {{parameter 'object' here}} +// expected-note@-2 {{parameter 'object' here}} +// expected-note@-3 {{parameter 'key' here}} +// expected-note@-4 {{parameter 'key' here}} + +@property (strong) K someRandomKey; +@end + +@interface WindowArray : NSArray<Window *> +@end + +@interface NSSet<T> (Searching) +- (T)findObject:(T)object; +@end + + +// -------------------------------------------------------------------------- +// Message sends. +// -------------------------------------------------------------------------- +void test_message_send_result( + NSSet<NSString *> *stringSet, + NSMutableSet<NSString *> *mutStringSet, + WidgetSet *widgetSet, + UntypedMutableSet *untypedMutSet, + MutableSetOfArrays<NSString *> *mutStringArraySet, + NSSet *set, + NSMutableSet *mutSet, + MutableSetOfArrays *mutArraySet, + NSArray<NSString *> *stringArray, + void (^block)(void)) { + int *ip; + ip = [stringSet firstObject]; // expected-error{{from incompatible type 'NSString *'}} + ip = [mutStringSet firstObject]; // expected-error{{from incompatible type 'NSString *'}} + ip = [widgetSet firstObject]; // expected-error{{from incompatible type 'Widget *'}} + ip = [untypedMutSet firstObject]; // expected-error{{from incompatible type 'id'}} + ip = [mutStringArraySet firstObject]; // expected-error{{from incompatible type 'NSArray<NSString *> *'}} + ip = [set firstObject]; // expected-error{{from incompatible type 'id'}} + ip = [mutSet firstObject]; // expected-error{{from incompatible type 'id'}} + ip = [mutArraySet firstObject]; // expected-error{{from incompatible type 'id'}} + ip = [block firstObject]; // expected-error{{from incompatible type 'id'}} + + ip = [stringSet findObject:@"blah"]; // expected-error{{from incompatible type 'NSString *'}} + + // Class messages. + ip = [NSSet<NSString *> alloc]; // expected-error{{from incompatible type 'NSSet<NSString *> *'}} + ip = [NSSet alloc]; // expected-error{{from incompatible type 'NSSet *'}} + ip = [MutableSetOfArrays<NSString *> alloc]; // expected-error{{from incompatible type 'MutableSetOfArrays<NSString *> *'}} + ip = [MutableSetOfArrays alloc]; // expected-error{{from incompatible type 'MutableSetOfArrays *'}} + ip = [NSArray<NSString *> array]; // expected-error{{from incompatible type 'NSArray<NSString *> *'}} + ip = [NSArray<NSString *><NSCopying> array]; // expected-error{{from incompatible type 'NSArray<NSString *> *'}} + + ip = [[NSMutableArray<NSString *> alloc] init]; // expected-error{{from incompatible type 'NSMutableArray<NSString *> *'}} + + [[NSMutableArray alloc] initWithArray: stringArray]; // okay + [[NSMutableArray<NSString *> alloc] initWithArray: stringArray]; // okay + [[NSMutableArray<NSNumber *> alloc] initWithArray: stringArray]; // expected-error{{parameter of type 'NSArray<NSNumber *> *' with an lvalue of type 'NSArray<NSString *> *'}} +} + +void test_message_send_param( + NSMutableSet<NSString *> *mutStringSet, + WidgetSet *widgetSet, + UntypedMutableSet *untypedMutSet, + MutableSetOfArrays<NSString *> *mutStringArraySet, + NSMutableSet *mutSet, + MutableSetOfArrays *mutArraySet, + void (^block)(void)) { + Window *window; + + [mutStringSet addObject: window]; // expected-error{{parameter of type 'NSString *'}} + [widgetSet addObject: window]; // expected-error{{parameter of type 'Widget *'}} + [untypedMutSet addObject: window]; // expected-error{{parameter of type 'id<NSCopying>'}} + [mutStringArraySet addObject: window]; // expected-error{{parameter of type 'NSArray<NSString *> *'}} + [mutSet addObject: window]; // expected-error{{parameter of type 'id<NSCopying>'}} + [mutArraySet addObject: window]; // expected-error{{parameter of type 'id<NSCopying>'}} + [block addObject: window]; // expected-error{{parameter of type 'id<NSCopying>'}} +} + +// -------------------------------------------------------------------------- +// Property accesses. +// -------------------------------------------------------------------------- +void test_property_read( + NSSet<NSString *> *stringSet, + NSMutableSet<NSString *> *mutStringSet, + WidgetSet *widgetSet, + UntypedMutableSet *untypedMutSet, + MutableSetOfArrays<NSString *> *mutStringArraySet, + NSSet *set, + NSMutableSet *mutSet, + MutableSetOfArrays *mutArraySet, + NSMutableDictionary *mutDict) { + int *ip; + ip = stringSet.allObjects; // expected-error{{from incompatible type 'NSArray<NSString *> *'}} + ip = mutStringSet.allObjects; // expected-error{{from incompatible type 'NSArray<NSString *> *'}} + ip = widgetSet.allObjects; // expected-error{{from incompatible type 'NSArray<Widget *> *'}} + ip = untypedMutSet.allObjects; // expected-error{{from incompatible type 'NSArray *'}} + ip = mutStringArraySet.allObjects; // expected-error{{from incompatible type 'NSArray<NSArray<NSString *> *> *'}} + ip = set.allObjects; // expected-error{{from incompatible type 'NSArray *'}} + ip = mutSet.allObjects; // expected-error{{from incompatible type 'NSArray *'}} + ip = mutArraySet.allObjects; // expected-error{{from incompatible type 'NSArray *'}} + + ip = mutDict.someRandomKey; // expected-error{{from incompatible type '__kindof id<NSCopying>'}} +} + +void test_property_write( + NSMutableSet<NSString *> *mutStringSet, + WidgetSet *widgetSet, + UntypedMutableSet *untypedMutSet, + MutableSetOfArrays<NSString *> *mutStringArraySet, + NSMutableSet *mutSet, + MutableSetOfArrays *mutArraySet, + NSMutableDictionary *mutDict) { + int *ip; + + mutStringSet.allObjects = ip; // expected-error{{to 'NSArray<NSString *> *'}} + widgetSet.allObjects = ip; // expected-error{{to 'NSArray<Widget *> *'}} + untypedMutSet.allObjects = ip; // expected-error{{to 'NSArray *'}} + mutStringArraySet.allObjects = ip; // expected-error{{to 'NSArray<NSArray<NSString *> *> *'}} + mutSet.allObjects = ip; // expected-error{{to 'NSArray *'}} + mutArraySet.allObjects = ip; // expected-error{{to 'NSArray *'}} + + mutDict.someRandomKey = ip; // expected-error{{to 'id<NSCopying>'}} +} + +// -------------------------------------------------------------------------- +// Subscripting +// -------------------------------------------------------------------------- +void test_subscripting( + NSArray<NSString *> *stringArray, + NSMutableArray<NSString *> *mutStringArray, + NSArray *array, + NSMutableArray *mutArray, + NSDictionary<NSString *, Widget *> *stringWidgetDict, + NSMutableDictionary<NSString *, Widget *> *mutStringWidgetDict, + NSDictionary *dict, + NSMutableDictionary *mutDict) { + int *ip; + NSString *string; + Widget *widget; + Window *window; + + ip = stringArray[0]; // expected-error{{from incompatible type 'NSString *'}} + + ip = mutStringArray[0]; // expected-error{{from incompatible type 'NSString *'}} + mutStringArray[0] = ip; // expected-error{{parameter of type 'NSString *'}} + + ip = array[0]; // expected-error{{from incompatible type 'id'}} + + ip = mutArray[0]; // expected-error{{from incompatible type 'id'}} + mutArray[0] = ip; // expected-error{{parameter of type 'id'}} + + ip = stringWidgetDict[string]; // expected-error{{from incompatible type 'Widget *'}} + widget = stringWidgetDict[widget]; // expected-error{{parameter of type 'NSString *'}} + + ip = mutStringWidgetDict[string]; // expected-error{{from incompatible type 'Widget *'}} + widget = mutStringWidgetDict[widget]; // expected-error{{parameter of type 'NSString *'}} + mutStringWidgetDict[string] = ip; // expected-error{{parameter of type 'Widget *'}} + mutStringWidgetDict[widget] = widget; // expected-error{{parameter of type 'NSString *'}} + + ip = dict[string]; // expected-error{{from incompatible type 'id'}} + + ip = mutDict[string]; // expected-error{{incompatible type 'id'}} + mutDict[string] = ip; // expected-error{{parameter of type 'id'}} + + widget = mutDict[window]; + mutDict[window] = widget; // expected-error{{parameter of type 'id<NSCopying>'}} +} + +// -------------------------------------------------------------------------- +// Instance variable access. +// -------------------------------------------------------------------------- +void test_instance_variable(NSArray<NSString *> *stringArray, + NSArray *array) { + int *ip; + + ip = stringArray->data; // expected-error{{from incompatible type 'NSString **'}} + ip = array->data; // expected-error{{from incompatible type 'id *'}} +} + +@implementation WindowArray +- (void)testInstanceVariable { + int *ip; + + ip = data; // expected-error{{from incompatible type 'Window **'}} +} +@end + +// -------------------------------------------------------------------------- +// Implicit conversions. +// -------------------------------------------------------------------------- +void test_implicit_conversions(NSArray<NSString *> *stringArray, + NSArray<NSNumber *> *numberArray, + NSMutableArray<NSString *> *mutStringArray, + NSArray *array, + NSMutableArray *mutArray) { + // Specialized -> unspecialized (same level) + array = stringArray; + + // Unspecialized -> specialized (same level) + stringArray = array; + + // Specialized -> specialized failure (same level). + stringArray = numberArray; // expected-error{{assigning to 'NSArray<NSString *> *' from incompatible type 'NSArray<NSNumber *> *'}} + + // Specialized -> specialized (different levels). + stringArray = mutStringArray; + + // Specialized -> specialized failure (different levels). + numberArray = mutStringArray; // expected-error{{assigning to 'NSArray<NSNumber *> *' from incompatible type 'NSMutableArray<NSString *> *'}} + + // Unspecialized -> specialized (different levels). + stringArray = mutArray; + + // Specialized -> unspecialized (different levels). + array = mutStringArray; +} + +@interface NSCovariant1<__covariant T> +@end + +@interface NSContravariant1<__contravariant T> +@end + +void test_variance(NSCovariant1<NSString *> *covariant1, + NSCovariant1<NSMutableString *> *covariant2, + NSCovariant1<NSString *(^)(void)> *covariant3, + NSCovariant1<NSMutableString *(^)(void)> *covariant4, + NSCovariant1<id> *covariant5, + NSCovariant1<id<NSCopying>> *covariant6, + NSContravariant1<NSString *> *contravariant1, + NSContravariant1<NSMutableString *> *contravariant2) { + covariant1 = covariant2; // okay + covariant2 = covariant1; // expected-warning{{incompatible pointer types assigning to 'NSCovariant1<NSMutableString *> *' from 'NSCovariant1<NSString *> *'}} + + covariant3 = covariant4; // okay + covariant4 = covariant3; // expected-warning{{incompatible pointer types assigning to 'NSCovariant1<NSMutableString *(^)()> *' from 'NSCovariant1<NSString *(^)()> *'}} + + covariant5 = covariant1; // okay + covariant1 = covariant5; // okay: id is promiscuous + + covariant5 = covariant3; // okay + covariant3 = covariant5; // okay + + contravariant1 = contravariant2; // expected-warning{{incompatible pointer types assigning to 'NSContravariant1<NSString *> *' from 'NSContravariant1<NSMutableString *> *'}} + contravariant2 = contravariant1; // okay +} + +// -------------------------------------------------------------------------- +// Ternary operator +// -------------------------------------------------------------------------- +void test_ternary_operator(NSArray<NSString *> *stringArray, + NSArray<NSNumber *> *numberArray, + NSMutableArray<NSString *> *mutStringArray, + NSStringArray *stringArray2, + NSArray *array, + NSMutableArray *mutArray, + int cond) { + int *ip; + id object; + + ip = cond ? stringArray : mutStringArray; // expected-error{{from incompatible type 'NSArray<NSString *> *'}} + ip = cond ? mutStringArray : stringArray; // expected-error{{from incompatible type 'NSArray<NSString *> *'}} + + ip = cond ? stringArray2 : mutStringArray; // expected-error{{from incompatible type 'NSArray<NSString *> *'}} + ip = cond ? mutStringArray : stringArray2; // expected-error{{from incompatible type 'NSArray<NSString *> *'}} + + ip = cond ? stringArray : mutArray; // expected-error{{from incompatible type 'NSArray *'}} + + ip = cond ? stringArray2 : mutArray; // expected-error{{from incompatible type 'NSArray *'}} + + ip = cond ? mutArray : stringArray; // expected-error{{from incompatible type 'NSArray *'}} + + ip = cond ? mutArray : stringArray2; // expected-error{{from incompatible type 'NSArray *'}} + + object = cond ? stringArray : numberArray; // expected-warning{{incompatible operand types ('NSArray<NSString *> *' and 'NSArray<NSNumber *> *')}} +} + +// -------------------------------------------------------------------------- +// super +// -------------------------------------------------------------------------- +@implementation NSStringArray +- (void)useSuperMethod { + int *ip; + ip = super.lastObject; // expected-error{{from incompatible type 'NSString *'}} + ip = [super objectAtIndexedSubscript:0]; // expected-error{{from incompatible type 'NSString *'}} +} + ++ (void)useSuperMethod { + int *ip; + ip = super.array; // expected-error{{from incompatible type 'NSArray<NSString *> *'}} + ip = [super array]; // expected-error{{from incompatible type 'NSArray<NSString *> *'}} +} +@end + +// -------------------------------------------------------------------------- +// Template instantiation +// -------------------------------------------------------------------------- +template<typename K, typename V> +struct NSMutableDictionaryOf { + typedef NSMutableDictionary<K, V> *type; // expected-error{{type argument 'NSObject *' does not satisfy the bound ('id<NSCopying>') of type parameter 'K'}} +}; + +template<typename ...Args> +struct VariadicNSMutableDictionaryOf { + typedef NSMutableDictionary<Args...> *type; // expected-error{{type argument 'NSObject *' does not satisfy the bound ('id<NSCopying>') of type parameter 'K'}} + // expected-error@-1{{too many type arguments for class 'NSMutableDictionary' (have 3, expected 2)}} + // expected-error@-2{{too few type arguments for class 'NSMutableDictionary' (have 1, expected 2)}} +}; + +void testInstantiation() { + int *ip; + + typedef NSMutableDictionaryOf<NSString *, NSObject *>::type Dict1; + Dict1 d1 = ip; // expected-error{{cannot initialize a variable of type 'Dict1' (aka 'NSMutableDictionary<NSString *,NSObject *> *')}} + + typedef NSMutableDictionaryOf<NSObject *, NSString *>::type Dict2; // expected-note{{in instantiation of template}} +} + +void testVariadicInstantiation() { + int *ip; + + typedef VariadicNSMutableDictionaryOf<NSString *, NSObject *>::type Dict1; + Dict1 d1 = ip; // expected-error{{cannot initialize a variable of type 'Dict1' (aka 'NSMutableDictionary<NSString *,NSObject *> *')}} + + typedef VariadicNSMutableDictionaryOf<NSObject *, NSString *>::type Dict2; // expected-note{{in instantiation of template}} + + typedef VariadicNSMutableDictionaryOf<NSString *, NSObject *, NSObject *>::type Dict3; // expected-note{{in instantiation of template}} + + typedef VariadicNSMutableDictionaryOf<NSString *>::type Dict3; // expected-note{{in instantiation of template}} +} + +// -------------------------------------------------------------------------- +// Parameterized classes are not templates +// -------------------------------------------------------------------------- +template<template<typename T, typename U> class TT> +struct AcceptsTemplateTemplate { }; + +typedef AcceptsTemplateTemplate<NSMutableDictionary> TemplateTemplateFail1; // expected-error{{template argument for template template parameter must be a class template or type alias template}} + +template<typename T> +struct DependentTemplate { + typedef typename T::template apply<NSString *, NSObject *> type; // expected-error{{'apply' following the 'template' keyword does not refer to a template}} +}; + +struct NSMutableDictionaryBuilder { + typedef NSMutableDictionary apply; +}; + +typedef DependentTemplate<NSMutableDictionaryBuilder>::type DependentTemplateFail1; // expected-note{{in instantiation of template class}} + +template<typename K, typename V> +struct NonDependentTemplate { + typedef NSMutableDictionaryBuilder::template apply<NSString *, NSObject *> type; // expected-error{{'apply' following the 'template' keyword does not refer to a template}} + // expected-error@-1{{expected member name or }} +}; + +// However, one can use an alias template to turn a parameterized +// class into a template. +template<typename K, typename V> +using NSMutableDictionaryAlias = NSMutableDictionary<K, V>; + +typedef AcceptsTemplateTemplate<NSMutableDictionaryAlias> TemplateTemplateAlias1; // okay + + diff --git a/test/SemaTemplate/injected-class-name.cpp b/test/SemaTemplate/injected-class-name.cpp index 4c21d2585d32..7349fdf392d4 100644 --- a/test/SemaTemplate/injected-class-name.cpp +++ b/test/SemaTemplate/injected-class-name.cpp @@ -60,3 +60,9 @@ namespace ForwardDecls { typename xt::foo *t; }; } + +namespace ConflictingRedecl { + template<typename> struct Nested { + template<typename> struct Nested; // expected-error {{member 'Nested' has the same name as its class}} + }; +} diff --git a/test/Tooling/ms-asm-no-target.cpp b/test/Tooling/ms-asm-no-target.cpp index 68930b159680..9041ad37b75e 100644 --- a/test/Tooling/ms-asm-no-target.cpp +++ b/test/Tooling/ms-asm-no-target.cpp @@ -1,13 +1,13 @@ -// RUN: not clang-check "%s" -- -fasm-blocks -target x86_64-apple-darwin10 2>&1 | FileCheck -check-prefix=CHECK-X86 %s +// RUN: clang-check "%s" -- -fasm-blocks -target x86_64-apple-darwin10 2>&1 | FileCheck -check-prefix=CHECK-X86 %s -allow-empty // RUN: not clang-check "%s" -- -fasm-blocks -target powerpc-apple-darwin10 2>&1 | FileCheck -check-prefix=CHECK-PPC %s - -// Test that we diagnose instead of crashing when the application hasn't -// initialized LLVM targets supporting the MS-style inline asm parser. -// Also test that the ordinary error is emitted on unsupported architectures. +// REQUIRES: x86-registered-target void Break() { __asm { int 3 } } -// CHECK-X86: error: MS-style inline assembly is not available +// clang-check should initialize the x86 target, so x86 should work. +// CHECK-X86-NOT: error: MS-style inline assembly is not available + +// Test that the ordinary error is emitted on unsupported architectures. // CHECK-PPC: error: Unsupported architecture 'powerpc' for MS-style inline assembly diff --git a/test/lit.cfg b/test/lit.cfg index 0e947dd437bb..f853b3f7db4f 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -421,6 +421,10 @@ if not re.match(r'.*-(cygwin|mingw32|windows-gnu)$', config.target_triple): if platform.system() not in ['Windows']: config.available_features.add('can-remove-opened-file') +# Not set for targeting tls-incapable targets. +if not re.match(r'.*-cygwin$', config.target_triple): + config.available_features.add('tls') + # Returns set of available features, registered-target(s) and asserts. def get_llvm_config_props(): set_of_features = set() |