diff --git a/clang/test/AST/Interp/floats.cpp b/clang/test/AST/Interp/floats.cpp index b3c4dd4c19a8..7b9328c4d118 100644 --- a/clang/test/AST/Interp/floats.cpp +++ b/clang/test/AST/Interp/floats.cpp @@ -78,94 +78,3 @@ namespace compound { } static_assert(f2() == __FLT_MAX__, ""); } - - -namespace FP16 { - constexpr int i = 2; - constexpr __fp16 f = 1.0f; - static_assert(f == 1.0f, ""); - - constexpr __fp16 f2 = 1u * f; - static_assert(f2 == 1.0f, ""); - - constexpr __fp16 f3 = 1.5; - constexpr int i3 = f3; - static_assert(i3 == 1, ""); - - constexpr bool b3 = f3; - static_assert(b3, ""); - - - static_assert(1.0f16 + 3u == 4, ""); - static_assert(4.0f16 / 1.0f16 == 4, ""); - static_assert(10.0f16 * false == 0, ""); - - constexpr __fp16 __fp16s[] = {1.0f16, 2.0f16, 3.0f16, 4.0f16}; - - constexpr __fp16 m = 5.0f16 / 0.0f16; // ref-error {{must be initialized by a constant expression}} \ - // ref-note {{division by zero}} \ - // expected-error {{must be initialized by a constant expression}} \ - // expected-note {{division by zero}} - - static_assert(~2.0f16 == 3, ""); // ref-error {{invalid argument type '_Float16' to unary expression}} \ - // expected-error {{invalid argument type '_Float16' to unary expression}} - - /// Initialized by a double. - constexpr __fp16 df = 0.0; - /// The other way around. - constexpr double fd = 0.0f16; - - static_assert(0.0f == -0.0f, ""); - - const int k = 3 * (1.0f16 / 3.0f16); - static_assert(k == 1, ""); - - constexpr bool b = 1.0f16; - static_assert(b, ""); - - constexpr double db = true; - static_assert(db == 1.0f16, ""); - - constexpr __fp16 fa[] = {1.0f, 2.0, 1, false}; - constexpr double da[] = {1.0f, 2.0, 1, false}; - - constexpr __fp16 fm = __FLT16_MAX__; - constexpr int someInt = fm; - - constexpr float SomeFloat = __FLT_MAX__; - constexpr __fp16 halfFloat = SomeFloat; - - constexpr float fp16ptr() { - __fp16 f1 = 1.0f16; - __fp16 *f2 = &f1; - - *f2 = 3.0; - return f1; - } - static_assert(fp16ptr() == 3.0, ""); - - namespace compound { - constexpr float f1() { - __fp16 f = 0; - f += 3.0; - f -= 3.0f; - - f += 1; - f /= 1; - f /= 1.0; - f *= f; - - f *= 2.0; - return f; - } - static_assert(f1() == 2, ""); - - constexpr float f2() { - __fp16 f = __FLT16_MAX__; - f += 1.0; - return f; - } - static_assert(f2() == __FLT16_MAX__, ""); - } - -}