CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
196 lines
7.6 KiB
C++
196 lines
7.6 KiB
C++
// RUN: %clang_cc1 -std=c++20 -ffreestanding -fexperimental-new-constant-interpreter -triple x86_64-unknown-unknown -target-feature +sse2 -verify %s
|
|
|
|
#include <immintrin.h>
|
|
#include "../CodeGen/X86/builtin_test_helpers.h"
|
|
|
|
namespace Test_mm_cvtsd_ss {
|
|
namespace OK {
|
|
constexpr __m128 a = { 9.0f, 5.0f, 6.0f, 7.0f };
|
|
constexpr __m128d b = { -1.0, 42.0 };
|
|
TEST_CONSTEXPR(match_m128(_mm_cvtsd_ss(a, b), -1.0f, 5.0f, 6.0f, 7.0f));
|
|
}
|
|
namespace Inexact {
|
|
constexpr __m128 a = { 0.0f, 1.0f, 2.0f, 3.0f };
|
|
constexpr __m128d b = { 1.0000000000000002, 0.0 };
|
|
constexpr __m128 r = _mm_cvtsd_ss(a, b);
|
|
// expected-error@-1 {{must be initialized by a constant expression}}
|
|
// expected-note@emmintrin.h:* {{compile time floating point arithmetic suppressed in strict evaluation modes}}
|
|
// expected-note@-3 {{in call to '_mm_cvtsd_ss({0.000000e+00, 1.000000e+00, 2.000000e+00, 3.000000e+00}, {1.000000e+00, 0.000000e+00})'}}
|
|
}
|
|
namespace Inf {
|
|
constexpr __m128 a = { 0.0f, 1.0f, 2.0f, 3.0f };
|
|
constexpr __m128d b = { __builtin_huge_val(), 0.0 };
|
|
constexpr __m128 r = _mm_cvtsd_ss(a, b);
|
|
// expected-error@-1 {{must be initialized by a constant expression}}
|
|
// expected-note@emmintrin.h:* {{floating point arithmetic produces an infinity}}
|
|
// expected-note@-3 {{in call to '_mm_cvtsd_ss({0.000000e+00, 1.000000e+00, 2.000000e+00, 3.000000e+00}, {INF, 0.000000e+00})'}}
|
|
}
|
|
namespace NaN {
|
|
constexpr __m128 a = { 0.0f, 1.0f, 2.0f, 3.0f };
|
|
constexpr __m128d b = { __builtin_nan(""), 0.0 };
|
|
constexpr __m128 r = _mm_cvtsd_ss(a, b);
|
|
// expected-error@-1 {{must be initialized by a constant expression}}
|
|
// expected-note@emmintrin.h:* {{floating point arithmetic produces a NaN}}
|
|
// expected-note@-3 {{in call to '_mm_cvtsd_ss({0.000000e+00, 1.000000e+00, 2.000000e+00, 3.000000e+00}, {nan, 0.000000e+00})'}}
|
|
}
|
|
namespace Subnormal {
|
|
constexpr __m128 a = { 0.0f, 1.0f, 2.0f, 3.0f };
|
|
constexpr __m128d b = { 1e-310, 0.0 };
|
|
constexpr __m128 r = _mm_cvtsd_ss(a, b);
|
|
// expected-error@-1 {{must be initialized by a constant expression}}
|
|
// expected-note@emmintrin.h:* {{compile time floating point arithmetic suppressed in strict evaluation modes}}
|
|
// expected-note@-3 {{in call to '_mm_cvtsd_ss({0.000000e+00, 1.000000e+00, 2.000000e+00, 3.000000e+00}, {1.000000e-310, 0.000000e+00})'}}
|
|
}
|
|
}
|
|
|
|
namespace Test_mm_cvtpd_ps {
|
|
namespace OK {
|
|
constexpr __m128d a = { -1.0, +2.0 };
|
|
TEST_CONSTEXPR(match_m128(_mm_cvtpd_ps(a), -1.0f, +2.0f, 0.0f, 0.0f));
|
|
}
|
|
namespace Inexact {
|
|
constexpr __m128d a = { 1.0000000000000002, 0.0 };
|
|
constexpr __m128 r = _mm_cvtpd_ps(a);
|
|
// expected-error@-1 {{must be initialized by a constant expression}}
|
|
// expected-note@emmintrin.h:* {{compile time floating point arithmetic suppressed in strict evaluation modes}}
|
|
// expected-note@-3 {{in call to '_mm_cvtpd_ps({1.000000e+00, 0.000000e+00})'}}
|
|
}
|
|
namespace Inf {
|
|
constexpr __m128d a = { __builtin_huge_val(), 0.0 };
|
|
constexpr __m128 r = _mm_cvtpd_ps(a);
|
|
// expected-error@-1 {{must be initialized by a constant expression}}
|
|
// expected-note@emmintrin.h:* {{floating point arithmetic produces an infinity}}
|
|
// expected-note@-3 {{in call to '_mm_cvtpd_ps({INF, 0.000000e+00})'}}
|
|
}
|
|
namespace NaN {
|
|
constexpr __m128d a = { __builtin_nan(""), 0.0 };
|
|
constexpr __m128 r = _mm_cvtpd_ps(a);
|
|
// expected-error@-1 {{must be initialized by a constant expression}}
|
|
// expected-note@emmintrin.h:* {{floating point arithmetic produces a NaN}}
|
|
// expected-note@-3 {{in call to '_mm_cvtpd_ps({nan, 0.000000e+00})'}}
|
|
}
|
|
namespace Subnormal {
|
|
constexpr __m128d a = { 1e-310, 0.0 };
|
|
constexpr __m128 r = _mm_cvtpd_ps(a);
|
|
// expected-error@-1 {{must be initialized by a constant expression}}
|
|
// expected-note@emmintrin.h:* {{compile time floating point arithmetic suppressed in strict evaluation modes}}
|
|
// expected-note@-3 {{in call to '_mm_cvtpd_ps({1.000000e-310, 0.000000e+00})'}}
|
|
}
|
|
}
|
|
|
|
namespace Test_mm_min_ps {
|
|
namespace OK {
|
|
constexpr __m128 a = { 1.0f, 2.0f, 3.0f, 4.0f };
|
|
constexpr __m128 b = { 4.0f, 3.0f, 2.0f, 1.0f };
|
|
TEST_CONSTEXPR(match_m128(_mm_min_ps(a, b), 1.0f, 2.0f, 2.0f, 1.0f));
|
|
}
|
|
namespace NaN_A {
|
|
constexpr __m128 a = { __builtin_nanf(""), 2.0f, 3.0f, 4.0f };
|
|
constexpr __m128 b = { 4.0f, 3.0f, 2.0f, 1.0f };
|
|
constexpr __m128 r = _mm_min_ps(a, b);
|
|
// expected-error@-1 {{must be initialized by a constant expression}}
|
|
}
|
|
namespace Inf_B {
|
|
constexpr __m128 a = { 1.0f, 2.0f, 3.0f, 4.0f };
|
|
constexpr __m128 b = { 4.0f, 3.0f, -__builtin_huge_valf(), 1.0f };
|
|
constexpr __m128 r = _mm_min_ps(a, b);
|
|
// expected-error@-1 {{must be initialized by a constant expression}}
|
|
}
|
|
namespace Denormal_A {
|
|
constexpr __m128 a = { 1e-40f, 2.0f, 3.0f, 4.0f };
|
|
constexpr __m128 b = { 4.0f, 3.0f, 2.0f, 1.0f };
|
|
constexpr __m128 r = _mm_min_ps(a, b);
|
|
// expected-error@-1 {{must be initialized by a constant expression}}
|
|
}
|
|
}
|
|
|
|
namespace Test_mm_max_ps {
|
|
namespace OK {
|
|
constexpr __m128 a = { 1.0f, 2.0f, 3.0f, 4.0f };
|
|
constexpr __m128 b = { 4.0f, 3.0f, 2.0f, 1.0f };
|
|
TEST_CONSTEXPR(match_m128(_mm_max_ps(a, b), 4.0f, 3.0f, 3.0f, 4.0f));
|
|
}
|
|
namespace NaN_B {
|
|
constexpr __m128 a = { 1.0f, 2.0f, 3.0f, 4.0f };
|
|
constexpr __m128 b = { 4.0f, __builtin_nanf(""), 2.0f, 1.0f };
|
|
constexpr __m128 r = _mm_max_ps(a, b);
|
|
// expected-error@-1 {{must be initialized by a constant expression}}
|
|
}
|
|
namespace Inf_A {
|
|
constexpr __m128 a = { __builtin_huge_valf(), 2.0f, 3.0f, 4.0f };
|
|
constexpr __m128 b = { 4.0f, 3.0f, 2.0f, 1.0f };
|
|
constexpr __m128 r = _mm_max_ps(a, b);
|
|
// expected-error@-1 {{must be initialized by a constant expression}}
|
|
}
|
|
}
|
|
|
|
namespace Test_mm_min_pd {
|
|
namespace OK {
|
|
constexpr __m128d a = { 1.0, 2.0 };
|
|
constexpr __m128d b = { 2.0, 1.0 };
|
|
TEST_CONSTEXPR(match_m128d(_mm_min_pd(a, b), 1.0, 1.0));
|
|
}
|
|
namespace NaN_A {
|
|
constexpr __m128d a = { __builtin_nan(""), 2.0 };
|
|
constexpr __m128d b = { 2.0, 1.0 };
|
|
constexpr __m128d r = _mm_min_pd(a, b);
|
|
// expected-error@-1 {{must be initialized by a constant expression}}
|
|
}
|
|
namespace NaN_B {
|
|
constexpr __m128d a = { 1.0, 2.0 };
|
|
constexpr __m128d b = { 2.0, __builtin_nan("") };
|
|
constexpr __m128d r = _mm_min_pd(a, b);
|
|
// expected-error@-1 {{must be initialized by a constant expression}}
|
|
}
|
|
namespace Inf_A {
|
|
constexpr __m128d a = { __builtin_huge_val(), 2.0 };
|
|
constexpr __m128d b = { 2.0, 1.0 };
|
|
constexpr __m128d r = _mm_min_pd(a, b);
|
|
// expected-error@-1 {{must be initialized by a constant expression}}
|
|
}
|
|
namespace Inf_B {
|
|
constexpr __m128d a = { 1.0, 2.0 };
|
|
constexpr __m128d b = { 2.0, -__builtin_huge_val() };
|
|
constexpr __m128d r = _mm_min_pd(a, b);
|
|
// expected-error@-1 {{must be initialized by a constant expression}}
|
|
}
|
|
namespace Denormal_A {
|
|
constexpr __m128d a = { 1e-310, 2.0 };
|
|
constexpr __m128d b = { 2.0, 1.0 };
|
|
constexpr __m128d r = _mm_min_pd(a, b);
|
|
// expected-error@-1 {{must be initialized by a constant expression}}
|
|
}
|
|
namespace Denormal_B {
|
|
constexpr __m128d a = { 1.0, 2.0 };
|
|
constexpr __m128d b = { 2.0, -1e-310 };
|
|
constexpr __m128d r = _mm_min_pd(a, b);
|
|
// expected-error@-1 {{must be initialized by a constant expression}}
|
|
}
|
|
}
|
|
|
|
namespace Test_mm_max_pd {
|
|
namespace OK {
|
|
constexpr __m128d a = { 1.0, 2.0 };
|
|
constexpr __m128d b = { 2.0, 1.0 };
|
|
TEST_CONSTEXPR(match_m128d(_mm_max_pd(a, b), 2.0, 2.0));
|
|
}
|
|
namespace NaN_A {
|
|
constexpr __m128d a = { __builtin_nan(""), 2.0 };
|
|
constexpr __m128d b = { 2.0, 1.0 };
|
|
constexpr __m128d r = _mm_max_pd(a, b);
|
|
// expected-error@-1 {{must be initialized by a constant expression}}
|
|
}
|
|
namespace Inf_A {
|
|
constexpr __m128d a = { __builtin_huge_val(), 2.0 };
|
|
constexpr __m128d b = { 2.0, 1.0 };
|
|
constexpr __m128d r = _mm_max_pd(a, b);
|
|
// expected-error@-1 {{must be initialized by a constant expression}}
|
|
}
|
|
namespace Denormal_A {
|
|
constexpr __m128d a = { 1e-310, 2.0 };
|
|
constexpr __m128d b = { 2.0, 1.0 };
|
|
constexpr __m128d r = _mm_max_pd(a, b);
|
|
// expected-error@-1 {{must be initialized by a constant expression}}
|
|
}
|
|
}
|