summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-08-08 16:53:22 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-08-08 16:53:22 +0000
commitffe56ea4c355b82c6fdbed4befc7fe3b956e35a2 (patch)
tree5cf1c5e9dcf25a5774d7a5c693d056f63e855ffa /test
parent104a02fb6c96111ce06b53e282adfb2b4a59eeb6 (diff)
Notes
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/mips-madd4.c87
-rw-r--r--test/CodeGen/pause.c11
-rw-r--r--test/CodeGen/x86-nontemporal.c93
-rw-r--r--test/Driver/openbsd.c5
-rw-r--r--test/Misc/caret-diags-multiline.cpp5
-rw-r--r--test/PCH/coroutines.cpp77
-rw-r--r--test/Preprocessor/init.c10
-rw-r--r--test/Sema/vector-cast.c8
-rw-r--r--test/SemaCXX/cxx1z-class-template-argument-deduction.cpp25
9 files changed, 222 insertions, 99 deletions
diff --git a/test/CodeGen/mips-madd4.c b/test/CodeGen/mips-madd4.c
deleted file mode 100644
index bc7bb593f95d..000000000000
--- a/test/CodeGen/mips-madd4.c
+++ /dev/null
@@ -1,87 +0,0 @@
-// REQUIRES: mips-registered-target
-// RUN: %clang --target=mips64-unknown-linux -S -mmadd4 %s -o -| FileCheck %s -check-prefix=MADD4
-// RUN: %clang --target=mips64-unknown-linux -S -mno-madd4 %s -o -| FileCheck %s -check-prefix=NOMADD4
-// RUN: %clang --target=mips64-unknown-linux -S -mmadd4 -fno-honor-nans %s -o -| FileCheck %s -check-prefix=MADD4-NONAN
-// RUN: %clang --target=mips64-unknown-linux -S -mno-madd4 -fno-honor-nans %s -o -| FileCheck %s -check-prefix=NOMADD4-NONAN
-
-float madd_s (float f, float g, float h)
-{
- return (f * g) + h;
-}
-// MADD4: madd.s
-// NOMADD4: mul.s
-// NOMADD4: add.s
-
-float msub_s (float f, float g, float h)
-{
- return (f * g) - h;
-}
-// MADD4: msub.s
-// NOMADD4: mul.s
-// NOMADD4: sub.s
-
-double madd_d (double f, double g, double h)
-{
- return (f * g) + h;
-}
-// MADD4: madd.d
-// NOMADD4: mul.d
-// NOMADD4: add.d
-
-double msub_d (double f, double g, double h)
-{
- return (f * g) - h;
-}
-// MADD4: msub.d
-// NOMADD4: mul.d
-// NOMADD4: sub.d
-
-
-float nmadd_s (float f, float g, float h)
-{
- // FIXME: Zero has been explicitly placed to force generation of a positive
- // zero in IR until pattern used to match this instruction is changed to
- // comply with negative zero as well.
- return 0-((f * g) + h);
-}
-// MADD4-NONAN: nmadd.s
-// NOMADD4-NONAN: mul.s
-// NOMADD4-NONAN: add.s
-// NOMADD4-NONAN: sub.s
-
-float nmsub_s (float f, float g, float h)
-{
- // FIXME: Zero has been explicitly placed to force generation of a positive
- // zero in IR until pattern used to match this instruction is changed to
- // comply with negative zero as well.
- return 0-((f * g) - h);
-}
-// MADD4-NONAN: nmsub.s
-// NOMADD4-NONAN: mul.s
-// NOMADD4-NONAN: sub.s
-// NOMADD4-NONAN: sub.s
-
-double nmadd_d (double f, double g, double h)
-{
- // FIXME: Zero has been explicitly placed to force generation of a positive
- // zero in IR until pattern used to match this instruction is changed to
- // comply with negative zero as well.
- return 0-((f * g) + h);
-}
-// MADD4-NONAN: nmadd.d
-// NOMADD4-NONAN: mul.d
-// NOMADD4-NONAN: add.d
-// NOMADD4-NONAN: sub.d
-
-double nmsub_d (double f, double g, double h)
-{
- // FIXME: Zero has been explicitly placed to force generation of a positive
- // zero in IR until pattern used to match this instruction is changed to
- // comply with negative zero as well.
- return 0-((f * g) - h);
-}
-// MADD4-NONAN: nmsub.d
-// NOMADD4-NONAN: mul.d
-// NOMADD4-NONAN: sub.d
-// NOMADD4-NONAN: sub.d
-
diff --git a/test/CodeGen/pause.c b/test/CodeGen/pause.c
new file mode 100644
index 000000000000..1a8e10aec043
--- /dev/null
+++ b/test/CodeGen/pause.c
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -ffreestanding %s -triple=i386-pc-win32 -target-feature -sse2 -emit-llvm -o - -Wall -Werror | FileCheck %s
+// RUN: %clang_cc1 -ffreestanding %s -triple=i386-pc-win32 -target-feature +sse2 -emit-llvm -o - -Wall -Werror | FileCheck %s
+
+
+#include <x86intrin.h>
+
+void test_mm_pause() {
+ // CHECK-LABEL: test_mm_pause
+ // CHECK: call void @llvm.x86.sse2.pause()
+ return _mm_pause();
+}
diff --git a/test/CodeGen/x86-nontemporal.c b/test/CodeGen/x86-nontemporal.c
new file mode 100644
index 000000000000..5e9e42c9f204
--- /dev/null
+++ b/test/CodeGen/x86-nontemporal.c
@@ -0,0 +1,93 @@
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -target-feature +avx -target-feature +avx2 -target-feature +avx512f -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefix=CHECK
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -target-feature +avx -target-feature +avx2 -target-feature +avx512f -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefix=CHECK
+
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -target-feature +avx -target-feature +avx2 -target-feature +avx512f -emit-llvm -o - -Wall -Werror -fmax-type-align=16 | FileCheck %s --check-prefix=CHECK
+// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -target-feature +avx -target-feature +avx2 -target-feature +avx512f -fno-signed-char -emit-llvm -o - -Wall -Werror -fmax-type-align=16 | FileCheck %s --check-prefix=CHECK
+
+#include <x86intrin.h>
+
+// (PR33830) Tests ensure the correct alignment of non-temporal load/stores on darwin targets where fmax-type-align is set to 16.
+
+//
+// 128-bit vectors
+//
+
+void test_mm_stream_pd(double* A, __m128d B) {
+ // CHECK-LABEL: test_mm_stream_pd
+ // CHECK: store <2 x double> %{{.*}}, <2 x double>* %{{.*}}, align 16, !nontemporal
+ _mm_stream_pd(A, B);
+}
+
+void test_mm_stream_ps(float* A, __m128 B) {
+ // CHECK16-LABEL: test_mm_stream_ps
+ // CHECK16: store <4 x float> %{{.*}}, <4 x float>* %{{.*}}, align 16, !nontemporal
+ _mm_stream_ps(A, B);
+}
+
+void test_mm_stream_si128(__m128i* A, __m128i B) {
+ // CHECK-LABEL: test_mm_stream_si128
+ // CHECK: store <2 x i64> %{{.*}}, <2 x i64>* %{{.*}}, align 16, !nontemporal
+ _mm_stream_si128(A, B);
+}
+
+__m128i test_mm_stream_load_si128(__m128i const *A) {
+ // CHECK-LABEL: test_mm_stream_load_si128
+ // CHECK: load <2 x i64>, <2 x i64>* %{{.*}}, align 16, !nontemporal
+ return _mm_stream_load_si128(A);
+}
+
+//
+// 256-bit vectors
+//
+
+void test_mm256_stream_pd(double* A, __m256d B) {
+ // CHECK-LABEL: test_mm256_stream_pd
+ // CHECK: store <4 x double> %{{.*}}, <4 x double>* %{{.*}}, align 32, !nontemporal
+ _mm256_stream_pd(A, B);
+}
+
+void test_mm256_stream_ps(float* A, __m256 B) {
+ // CHECK-LABEL: test_mm256_stream_ps
+ // CHECK: store <8 x float> %{{.*}}, <8 x float>* %{{.*}}, align 32, !nontemporal
+ _mm256_stream_ps(A, B);
+}
+
+void test_mm256_stream_si256(__m256i* A, __m256i B) {
+ // CHECK-LABEL: test_mm256_stream_si256
+ // CHECK: store <4 x i64> %{{.*}}, <4 x i64>* %{{.*}}, align 32, !nontemporal
+ _mm256_stream_si256(A, B);
+}
+
+__m256i test_mm256_stream_load_si256(__m256i const *A) {
+ // CHECK-LABEL: test_mm256_stream_load_si256
+ // CHECK: load <4 x i64>, <4 x i64>* %{{.*}}, align 32, !nontemporal
+ return _mm256_stream_load_si256(A);
+}
+
+//
+// 512-bit vectors
+//
+
+void test_mm512_stream_pd(double* A, __m512d B) {
+ // CHECK-LABEL: test_mm512_stream_pd
+ // CHECK: store <8 x double> %{{.*}}, <8 x double>* %{{.*}}, align 64, !nontemporal
+ _mm512_stream_pd(A, B);
+}
+
+void test_mm512_stream_ps(float* A, __m512 B) {
+ // CHECK-LABEL: test_mm512_stream_ps
+ // CHECK: store <16 x float> %{{.*}}, <16 x float>* %{{.*}}, align 64, !nontemporal
+ _mm512_stream_ps(A, B);
+}
+
+void test_mm512_stream_si512(__m512i* A, __m512i B) {
+ // CHECK-LABEL: test_mm512_stream_si512
+ // CHECK: store <8 x i64> %{{.*}}, <8 x i64>* %{{.*}}, align 64, !nontemporal
+ _mm512_stream_si512(A, B);
+}
+
+__m512i test_mm512_stream_load_si512(void *A) {
+ // CHECK-LABEL: test_mm512_stream_load_si512
+ // CHECK: load <8 x i64>, <8 x i64>* %{{.*}}, align 64, !nontemporal
+ return _mm512_stream_load_si512(A);
+}
diff --git a/test/Driver/openbsd.c b/test/Driver/openbsd.c
index b4e2796c5d24..2bcd70377033 100644
--- a/test/Driver/openbsd.c
+++ b/test/Driver/openbsd.c
@@ -77,7 +77,9 @@
// Check linking against correct startup code when (not) using PIE
// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -### 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-PIE %s
-// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd %s -fno-pie %s -### 2>&1 \
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -pie %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-PIE-FLAG %s
+// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -fno-pie %s -### 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-PIE %s
// RUN: %clang -no-canonical-prefixes -target i686-pc-openbsd -static %s -### 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-STATIC-PIE %s
@@ -93,6 +95,7 @@
// RUN: | FileCheck -check-prefix=CHECK-NOPIE %s
// CHECK-PIE: "{{.*}}crt0.o"
// CHECK-PIE-NOT: "-nopie"
+// CHECK-PIE-FLAG: "-pie"
// CHECK-STATIC-PIE: "{{.*}}rcrt0.o"
// CHECK-STATIC-PIE-NOT: "-nopie"
// CHECK-NOPIE: "-nopie" "{{.*}}crt0.o"
diff --git a/test/Misc/caret-diags-multiline.cpp b/test/Misc/caret-diags-multiline.cpp
index 4826d9beaa3f..90b50ff398ac 100644
--- a/test/Misc/caret-diags-multiline.cpp
+++ b/test/Misc/caret-diags-multiline.cpp
@@ -232,3 +232,8 @@ void multiple_ranges(int a, int b) {
b
);
}
+
+#define pr33902_a(b) #b
+#define pr33902_c(d) _Pragma(pr33902_a(d))
+#define pr33902_e(f) pr33902_c(GCC warning #f)
+pr33902_e() pr33902_e()
diff --git a/test/PCH/coroutines.cpp b/test/PCH/coroutines.cpp
new file mode 100644
index 000000000000..46a2872420bf
--- /dev/null
+++ b/test/PCH/coroutines.cpp
@@ -0,0 +1,77 @@
+// Test this without pch.
+// RUN: %clang_cc1 -include %s -verify -std=c++1z -fcoroutines-ts %s
+
+// Test with pch.
+// RUN: %clang_cc1 -std=c++1z -fcoroutines-ts -emit-pch -o %t %s
+// RUN: %clang_cc1 -include-pch %t -verify -std=c++1z -fcoroutines-ts %s
+
+#ifndef HEADER
+#define HEADER
+
+namespace std::experimental {
+template <typename... T> struct coroutine_traits;
+
+template <class Promise = void> struct coroutine_handle {
+ coroutine_handle() = default;
+ static coroutine_handle from_address(void *) noexcept;
+};
+template <> struct coroutine_handle<void> {
+ static coroutine_handle from_address(void *) noexcept;
+ coroutine_handle() = default;
+ template <class PromiseType>
+ coroutine_handle(coroutine_handle<PromiseType>) noexcept;
+};
+}
+
+struct suspend_always {
+ bool await_ready() noexcept;
+ void await_suspend(std::experimental::coroutine_handle<>) noexcept;
+ void await_resume() noexcept;
+};
+
+template <typename... Args> struct std::experimental::coroutine_traits<void, Args...> {
+ struct promise_type {
+ void get_return_object() noexcept;
+ suspend_always initial_suspend() noexcept;
+ suspend_always final_suspend() noexcept;
+ void return_void() noexcept;
+ suspend_always yield_value(int) noexcept;
+ promise_type();
+ ~promise_type() noexcept;
+ void unhandled_exception() noexcept;
+ };
+};
+
+template <typename... Args> struct std::experimental::coroutine_traits<int, Args...> {
+ struct promise_type {
+ int get_return_object() noexcept;
+ suspend_always initial_suspend() noexcept;
+ suspend_always final_suspend() noexcept;
+ void return_value(int) noexcept;
+ promise_type();
+ ~promise_type() noexcept;
+ void unhandled_exception() noexcept;
+ };
+};
+
+template <typename T>
+void f(T x) { // checks coawait_expr and coroutine_body_stmt
+ co_yield 42; // checks coyield_expr
+ co_await x; // checks dependent_coawait
+ co_return; // checks coreturn_stmt
+}
+
+template <typename T>
+int f2(T x) { // checks coawait_expr and coroutine_body_stmt
+ co_return x; // checks coreturn_stmt with expr
+}
+
+#else
+
+// expected-no-diagnostics
+void g() {
+ f(suspend_always{});
+ f2(42);
+}
+
+#endif
diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c
index 5a77d06d2403..3a8e5dbd3fd8 100644
--- a/test/Preprocessor/init.c
+++ b/test/Preprocessor/init.c
@@ -4686,16 +4686,6 @@
// RUN: | FileCheck -match-full-lines -check-prefix MIPS-MSA %s
// MIPS-MSA:#define __mips_msa 1
//
-// RUN: %clang_cc1 -target-feature +nomadd4 \
-// RUN: -E -dM -triple=mips-none-none < /dev/null \
-// RUN: | FileCheck -match-full-lines -check-prefix MIPS-NOMADD4 %s
-// MIPS-NOMADD4:#define __mips_no_madd4 1
-//
-// RUN: %clang_cc1 \
-// RUN: -E -dM -triple=mips-none-none < /dev/null \
-// RUN: | FileCheck -match-full-lines -check-prefix MIPS-MADD4 %s
-// MIPS-MADD4-NOT:#define __mips_no_madd4 1
-//
// RUN: %clang_cc1 -target-cpu mips32r3 -target-feature +nan2008 \
// RUN: -E -dM -triple=mips-none-none < /dev/null \
// RUN: | FileCheck -match-full-lines -check-prefix MIPS-NAN2008 %s
diff --git a/test/Sema/vector-cast.c b/test/Sema/vector-cast.c
index cf23eb2742c4..2bdc00707d4c 100644
--- a/test/Sema/vector-cast.c
+++ b/test/Sema/vector-cast.c
@@ -48,6 +48,9 @@ typedef float float2 __attribute__ ((vector_size (8)));
typedef __attribute__((vector_size(8))) double float64x1_t;
typedef __attribute__((vector_size(16))) double float64x2_t;
float64x1_t vget_low_f64(float64x2_t __p0);
+typedef float float16 __attribute__((__vector_size__(16)));
+typedef signed int vSInt32 __attribute__((__vector_size__(16)));
+typedef unsigned int vUInt32 __attribute__((__vector_size__(16)));
void f4() {
float2 f2;
@@ -73,3 +76,8 @@ void f5() {
v = ptr; // expected-error-re {{assigning to 'short_sizeof_pointer' (vector of {{[0-9]+}} 'short' values) from incompatible type 'void *'}}
ptr = v; // expected-error {{assigning to 'void *' from incompatible type 'short_sizeof_pointer'}}
}
+
+void f6(vSInt32 a0) {
+ vUInt32 counter = (float16){0.0f, 0.0f, 0.0f, 0.0f}; // expected-warning {{incompatible vector types initializing 'vUInt32' (vector of 4 'unsigned int' values) with an expression of type 'float16' (vector of 4 'float' values)}}
+ counter -= a0;
+}
diff --git a/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp b/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
index 159b7072e61e..668c24280258 100644
--- a/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
+++ b/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
@@ -1,4 +1,9 @@
-// RUN: %clang_cc1 -std=c++1z -verify %s
+// RUN: %clang_cc1 -std=c++1z -verify %s -DERRORS
+// RUN: %clang_cc1 -std=c++1z -verify %s -UERRORS
+
+// This test is split into two because we only produce "undefined internal"
+// warnings if we didn't produce any errors.
+#if ERRORS
namespace std {
using size_t = decltype(sizeof(0));
@@ -280,3 +285,21 @@ namespace tuple_tests {
scoped_lock l = {};
}
}
+
+#else
+
+// expected-no-diagnostics
+namespace undefined_warnings {
+ // Make sure we don't get an "undefined but used internal symbol" warning for the deduction guide here.
+ namespace {
+ template <typename T>
+ struct TemplDObj {
+ explicit TemplDObj(T func) noexcept {}
+ };
+ auto test1 = TemplDObj(0);
+
+ TemplDObj(float) -> TemplDObj<double>;
+ auto test2 = TemplDObj(.0f);
+ }
+}
+#endif