From 7e03b1dec651058f4bc3f135f372e0b01a6d15fa Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Mon, 15 Sep 2025 08:29:13 -0700 Subject: [PATCH 1/5] [compiler-rt] Disable tests for unavailable builtins The builtins `__fixunstfdi` and `__multc3` may be removed by the preprocessor depending on configuration flags. When this happens, the corresponding tests fail at link time due to missing definitions. Disable these tests when the builtins are not available. rdar://159705803 rdar://159705705 --- compiler-rt/test/builtins/Unit/fixunstfdi_test.c | 4 ++-- compiler-rt/test/builtins/Unit/multc3_test.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler-rt/test/builtins/Unit/fixunstfdi_test.c b/compiler-rt/test/builtins/Unit/fixunstfdi_test.c index 982f3a4629dbd..c78b187bf2fd1 100644 --- a/compiler-rt/test/builtins/Unit/fixunstfdi_test.c +++ b/compiler-rt/test/builtins/Unit/fixunstfdi_test.c @@ -4,7 +4,7 @@ #include -#if _ARCH_PPC || __aarch64__ || __arm64ec__ +#if (_ARCH_PPC || __aarch64__ || __arm64ec__) && defined(CRT_HAS_TF_MODE) #include "int_lib.h" @@ -35,7 +35,7 @@ char assumption_3[sizeof(long double)*CHAR_BIT == 128] = {0}; int main() { -#if _ARCH_PPC || __aarch64__ || __arm64ec__ +#if (_ARCH_PPC || __aarch64__ || __arm64ec__) && defined(CRT_HAS_TF_MODE) if (test__fixunstfdi(0.0, 0)) return 1; diff --git a/compiler-rt/test/builtins/Unit/multc3_test.c b/compiler-rt/test/builtins/Unit/multc3_test.c index e9c99a72be35e..98373efc7259e 100644 --- a/compiler-rt/test/builtins/Unit/multc3_test.c +++ b/compiler-rt/test/builtins/Unit/multc3_test.c @@ -4,7 +4,7 @@ #include -#if _ARCH_PPC || __aarch64__ || __arm64ec__ +#if (_ARCH_PPC || __aarch64__ || __arm64ec__) && defined(CRT_HAS_128BIT) && defined(CRT_HAS_F128) #include "int_lib.h" #include @@ -348,7 +348,7 @@ long double x[][2] = int main() { -#if _ARCH_PPC || __aarch64__ || __arm64ec__ +#if (_ARCH_PPC || __aarch64__ || __arm64ec__) && defined(CRT_HAS_128BIT) && defined(CRT_HAS_F128) const unsigned N = sizeof(x) / sizeof(x[0]); unsigned i, j; for (i = 0; i < N; ++i) From a642476464bd939f0516a8c1eed84f2cc268eafd Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Mon, 15 Sep 2025 13:31:20 -0700 Subject: [PATCH 2/5] Drop the architecture checks --- compiler-rt/test/builtins/Unit/fixunstfdi_test.c | 4 ++-- compiler-rt/test/builtins/Unit/multc3_test.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler-rt/test/builtins/Unit/fixunstfdi_test.c b/compiler-rt/test/builtins/Unit/fixunstfdi_test.c index c78b187bf2fd1..cfe1a87b0a5df 100644 --- a/compiler-rt/test/builtins/Unit/fixunstfdi_test.c +++ b/compiler-rt/test/builtins/Unit/fixunstfdi_test.c @@ -4,7 +4,7 @@ #include -#if (_ARCH_PPC || __aarch64__ || __arm64ec__) && defined(CRT_HAS_TF_MODE) +#if defined(CRT_HAS_TF_MODE) #include "int_lib.h" @@ -35,7 +35,7 @@ char assumption_3[sizeof(long double)*CHAR_BIT == 128] = {0}; int main() { -#if (_ARCH_PPC || __aarch64__ || __arm64ec__) && defined(CRT_HAS_TF_MODE) +#if defined(CRT_HAS_TF_MODE) if (test__fixunstfdi(0.0, 0)) return 1; diff --git a/compiler-rt/test/builtins/Unit/multc3_test.c b/compiler-rt/test/builtins/Unit/multc3_test.c index 98373efc7259e..7ae4cb5b710a7 100644 --- a/compiler-rt/test/builtins/Unit/multc3_test.c +++ b/compiler-rt/test/builtins/Unit/multc3_test.c @@ -4,7 +4,7 @@ #include -#if (_ARCH_PPC || __aarch64__ || __arm64ec__) && defined(CRT_HAS_128BIT) && defined(CRT_HAS_F128) +#if defined(CRT_HAS_128BIT) && defined(CRT_HAS_F128) #include "int_lib.h" #include @@ -348,7 +348,7 @@ long double x[][2] = int main() { -#if (_ARCH_PPC || __aarch64__ || __arm64ec__) && defined(CRT_HAS_128BIT) && defined(CRT_HAS_F128) +#if defined(CRT_HAS_128BIT) && defined(CRT_HAS_F128) const unsigned N = sizeof(x) / sizeof(x[0]); unsigned i, j; for (i = 0; i < N; ++i) From 1dec064b0adbc5f7080d1285990a96fe00d0ea5e Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Wed, 24 Sep 2025 11:55:16 -0700 Subject: [PATCH 3/5] Fix formatting error --- .../test/builtins/Unit/fixunstfdi_test.c | 144 +++++++++--------- compiler-rt/test/builtins/Unit/multc3_test.c | 22 ++- 2 files changed, 82 insertions(+), 84 deletions(-) diff --git a/compiler-rt/test/builtins/Unit/fixunstfdi_test.c b/compiler-rt/test/builtins/Unit/fixunstfdi_test.c index cfe1a87b0a5df..75b72f92fb2e6 100644 --- a/compiler-rt/test/builtins/Unit/fixunstfdi_test.c +++ b/compiler-rt/test/builtins/Unit/fixunstfdi_test.c @@ -6,7 +6,7 @@ #if defined(CRT_HAS_TF_MODE) -#include "int_lib.h" +# include "int_lib.h" // Returns: convert a to a unsigned long long, rounding toward zero. // Negative values all become zero. @@ -36,77 +36,77 @@ char assumption_3[sizeof(long double)*CHAR_BIT == 128] = {0}; int main() { #if defined(CRT_HAS_TF_MODE) - if (test__fixunstfdi(0.0, 0)) - return 1; - - if (test__fixunstfdi(0.5, 0)) - return 1; - if (test__fixunstfdi(0.99, 0)) - return 1; - if (test__fixunstfdi(1.0, 1)) - return 1; - if (test__fixunstfdi(1.5, 1)) - return 1; - if (test__fixunstfdi(1.99, 1)) - return 1; - if (test__fixunstfdi(2.0, 2)) - return 1; - if (test__fixunstfdi(2.01, 2)) - return 1; - if (test__fixunstfdi(-0.5, 0)) - return 1; - if (test__fixunstfdi(-0.99, 0)) - return 1; - if (test__fixunstfdi(-1.0, 0)) - return 1; - if (test__fixunstfdi(-1.5, 0)) - return 1; - if (test__fixunstfdi(-1.99, 0)) - return 1; - if (test__fixunstfdi(-2.0, 0)) - return 1; - if (test__fixunstfdi(-2.01, 0)) - return 1; - - if (test__fixunstfdi(0x1.FFFFFEp+62, 0x7FFFFF8000000000LL)) - return 1; - if (test__fixunstfdi(0x1.FFFFFCp+62, 0x7FFFFF0000000000LL)) - return 1; - - if (test__fixunstfdi(-0x1.FFFFFEp+62, 0)) - return 1; - if (test__fixunstfdi(-0x1.FFFFFCp+62, 0)) - return 1; - - if (test__fixunstfdi(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFFFFFFFC00LL)) - return 1; - if (test__fixunstfdi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFFFFFFF800LL)) - return 1; - - if (test__fixunstfdi(-0x1.FFFFFFFFFFFFFp+62, 0)) - return 1; - if (test__fixunstfdi(-0x1.FFFFFFFFFFFFEp+62, 0)) - return 1; - - if (test__fixunstfdi(0x1.FFFFFFFFFFFFFFFEp+63L, 0xFFFFFFFFFFFFFFFFLL)) - return 1; - if (test__fixunstfdi(0x1.0000000000000002p+63L, 0x8000000000000001LL)) - return 1; - if (test__fixunstfdi(0x1.0000000000000000p+63L, 0x8000000000000000LL)) - return 1; - if (test__fixunstfdi(0x1.FFFFFFFFFFFFFFFCp+62L, 0x7FFFFFFFFFFFFFFFLL)) - return 1; - if (test__fixunstfdi(0x1.FFFFFFFFFFFFFFF8p+62L, 0x7FFFFFFFFFFFFFFELL)) - return 1; - if (test__fixunstfdi(0x1.p+64L, 0xFFFFFFFFFFFFFFFFLL)) - return 1; - - if (test__fixunstfdi(-0x1.0000000000000000p+63L, 0)) - return 1; - if (test__fixunstfdi(-0x1.FFFFFFFFFFFFFFFCp+62L, 0)) - return 1; - if (test__fixunstfdi(-0x1.FFFFFFFFFFFFFFF8p+62L, 0)) - return 1; + if (test__fixunstfdi(0.0, 0)) + return 1; + + if (test__fixunstfdi(0.5, 0)) + return 1; + if (test__fixunstfdi(0.99, 0)) + return 1; + if (test__fixunstfdi(1.0, 1)) + return 1; + if (test__fixunstfdi(1.5, 1)) + return 1; + if (test__fixunstfdi(1.99, 1)) + return 1; + if (test__fixunstfdi(2.0, 2)) + return 1; + if (test__fixunstfdi(2.01, 2)) + return 1; + if (test__fixunstfdi(-0.5, 0)) + return 1; + if (test__fixunstfdi(-0.99, 0)) + return 1; + if (test__fixunstfdi(-1.0, 0)) + return 1; + if (test__fixunstfdi(-1.5, 0)) + return 1; + if (test__fixunstfdi(-1.99, 0)) + return 1; + if (test__fixunstfdi(-2.0, 0)) + return 1; + if (test__fixunstfdi(-2.01, 0)) + return 1; + + if (test__fixunstfdi(0x1.FFFFFEp+62, 0x7FFFFF8000000000LL)) + return 1; + if (test__fixunstfdi(0x1.FFFFFCp+62, 0x7FFFFF0000000000LL)) + return 1; + + if (test__fixunstfdi(-0x1.FFFFFEp+62, 0)) + return 1; + if (test__fixunstfdi(-0x1.FFFFFCp+62, 0)) + return 1; + + if (test__fixunstfdi(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFFFFFFFC00LL)) + return 1; + if (test__fixunstfdi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFFFFFFF800LL)) + return 1; + + if (test__fixunstfdi(-0x1.FFFFFFFFFFFFFp+62, 0)) + return 1; + if (test__fixunstfdi(-0x1.FFFFFFFFFFFFEp+62, 0)) + return 1; + + if (test__fixunstfdi(0x1.FFFFFFFFFFFFFFFEp+63L, 0xFFFFFFFFFFFFFFFFLL)) + return 1; + if (test__fixunstfdi(0x1.0000000000000002p+63L, 0x8000000000000001LL)) + return 1; + if (test__fixunstfdi(0x1.0000000000000000p+63L, 0x8000000000000000LL)) + return 1; + if (test__fixunstfdi(0x1.FFFFFFFFFFFFFFFCp+62L, 0x7FFFFFFFFFFFFFFFLL)) + return 1; + if (test__fixunstfdi(0x1.FFFFFFFFFFFFFFF8p+62L, 0x7FFFFFFFFFFFFFFELL)) + return 1; + if (test__fixunstfdi(0x1.p+64L, 0xFFFFFFFFFFFFFFFFLL)) + return 1; + + if (test__fixunstfdi(-0x1.0000000000000000p+63L, 0)) + return 1; + if (test__fixunstfdi(-0x1.FFFFFFFFFFFFFFFCp+62L, 0)) + return 1; + if (test__fixunstfdi(-0x1.FFFFFFFFFFFFFFF8p+62L, 0)) + return 1; #else printf("skipped\n"); diff --git a/compiler-rt/test/builtins/Unit/multc3_test.c b/compiler-rt/test/builtins/Unit/multc3_test.c index 7ae4cb5b710a7..dedd7fb6737ac 100644 --- a/compiler-rt/test/builtins/Unit/multc3_test.c +++ b/compiler-rt/test/builtins/Unit/multc3_test.c @@ -6,9 +6,9 @@ #if defined(CRT_HAS_128BIT) && defined(CRT_HAS_F128) -#include "int_lib.h" -#include -#include +# include "int_lib.h" +# include +# include // Returns: the product of a + ib and c + id @@ -349,16 +349,14 @@ long double x[][2] = int main() { #if defined(CRT_HAS_128BIT) && defined(CRT_HAS_F128) - const unsigned N = sizeof(x) / sizeof(x[0]); - unsigned i, j; - for (i = 0; i < N; ++i) - { - for (j = 0; j < N; ++j) - { - if (test__multc3(x[i][0], x[i][1], x[j][0], x[j][1])) - return 1; - } + const unsigned N = sizeof(x) / sizeof(x[0]); + unsigned i, j; + for (i = 0; i < N; ++i) { + for (j = 0; j < N; ++j) { + if (test__multc3(x[i][0], x[i][1], x[j][0], x[j][1])) + return 1; } + } #else printf("skipped\n"); #endif From a99367dabf50d6934d6ae9eb644cf6a7a877716e Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Wed, 24 Sep 2025 12:05:58 -0700 Subject: [PATCH 4/5] Fix formatting error --- compiler-rt/test/builtins/Unit/multc3_test.c | 602 +++++++++---------- 1 file changed, 294 insertions(+), 308 deletions(-) diff --git a/compiler-rt/test/builtins/Unit/multc3_test.c b/compiler-rt/test/builtins/Unit/multc3_test.c index dedd7fb6737ac..bddea9af66970 100644 --- a/compiler-rt/test/builtins/Unit/multc3_test.c +++ b/compiler-rt/test/builtins/Unit/multc3_test.c @@ -7,347 +7,333 @@ #if defined(CRT_HAS_128BIT) && defined(CRT_HAS_F128) # include "int_lib.h" -# include # include +# include // Returns: the product of a + ib and c + id -COMPILER_RT_ABI long double _Complex -__multc3(long double __a, long double __b, long double __c, long double __d); +COMPILER_RT_ABI long double _Complex __multc3(long double __a, long double __b, + long double __c, long double __d); -enum {zero, non_zero, inf, NaN, non_zero_nan}; +enum { zero, non_zero, inf, NaN, non_zero_nan }; -int -classify(long double _Complex x) -{ - if (x == 0) - return zero; - if (isinf(creall(x)) || isinf(cimagl(x))) - return inf; - if (isnan(creall(x)) && isnan(cimagl(x))) - return NaN; - if (isnan(creall(x))) - { - if (cimagl(x) == 0) - return NaN; - return non_zero_nan; - } - if (isnan(cimagl(x))) - { - if (creall(x) == 0) - return NaN; - return non_zero_nan; - } - return non_zero; +int classify(long double _Complex x) { + if (x == 0) + return zero; + if (isinf(creall(x)) || isinf(cimagl(x))) + return inf; + if (isnan(creall(x)) && isnan(cimagl(x))) + return NaN; + if (isnan(creall(x))) { + if (cimagl(x) == 0) + return NaN; + return non_zero_nan; + } + if (isnan(cimagl(x))) { + if (creall(x) == 0) + return NaN; + return non_zero_nan; + } + return non_zero; } -int test__multc3(long double a, long double b, long double c, long double d) -{ - long double _Complex r = __multc3(a, b, c, d); -// printf("test__multc3(%Lf, %Lf, %Lf, %Lf) = %Lf + I%Lf\n", -// a, b, c, d, creall(r), cimagl(r)); - long double _Complex dividend; - long double _Complex divisor; - - __real__ dividend = a; - __imag__ dividend = b; - __real__ divisor = c; - __imag__ divisor = d; - - switch (classify(dividend)) - { +int test__multc3(long double a, long double b, long double c, long double d) { + long double _Complex r = __multc3(a, b, c, d); + // printf("test__multc3(%Lf, %Lf, %Lf, %Lf) = %Lf + I%Lf\n", + // a, b, c, d, creall(r), cimagl(r)); + long double _Complex dividend; + long double _Complex divisor; + + __real__ dividend = a; + __imag__ dividend = b; + __real__ divisor = c; + __imag__ divisor = d; + + switch (classify(dividend)) { + case zero: + switch (classify(divisor)) { + case zero: + if (classify(r) != zero) + return 1; + break; + case non_zero: + if (classify(r) != zero) + return 1; + break; + case inf: + if (classify(r) != NaN) + return 1; + break; + case NaN: + if (classify(r) != NaN) + return 1; + break; + case non_zero_nan: + if (classify(r) != NaN) + return 1; + break; + } + break; + case non_zero: + switch (classify(divisor)) { + case zero: + if (classify(r) != zero) + return 1; + break; + case non_zero: + if (classify(r) != non_zero) + return 1; + if (r != a * c - b * d + _Complex_I * (a * d + b * c)) + return 1; + break; + case inf: + if (classify(r) != inf) + return 1; + break; + case NaN: + if (classify(r) != NaN) + return 1; + break; + case non_zero_nan: + if (classify(r) != NaN) + return 1; + break; + } + break; + case inf: + switch (classify(divisor)) { + case zero: + if (classify(r) != NaN) + return 1; + break; + case non_zero: + if (classify(r) != inf) + return 1; + break; + case inf: + if (classify(r) != inf) + return 1; + break; + case NaN: + if (classify(r) != NaN) + return 1; + break; + case non_zero_nan: + if (classify(r) != inf) + return 1; + break; + } + break; + case NaN: + switch (classify(divisor)) { + case zero: + if (classify(r) != NaN) + return 1; + break; + case non_zero: + if (classify(r) != NaN) + return 1; + break; + case inf: + if (classify(r) != NaN) + return 1; + break; + case NaN: + if (classify(r) != NaN) + return 1; + break; + case non_zero_nan: + if (classify(r) != NaN) + return 1; + break; + } + break; + case non_zero_nan: + switch (classify(divisor)) { case zero: - switch (classify(divisor)) - { - case zero: - if (classify(r) != zero) - return 1; - break; - case non_zero: - if (classify(r) != zero) - return 1; - break; - case inf: - if (classify(r) != NaN) - return 1; - break; - case NaN: - if (classify(r) != NaN) - return 1; - break; - case non_zero_nan: - if (classify(r) != NaN) - return 1; - break; - } - break; + if (classify(r) != NaN) + return 1; + break; case non_zero: - switch (classify(divisor)) - { - case zero: - if (classify(r) != zero) - return 1; - break; - case non_zero: - if (classify(r) != non_zero) - return 1; - if (r != a * c - b * d + _Complex_I*(a * d + b * c)) - return 1; - break; - case inf: - if (classify(r) != inf) - return 1; - break; - case NaN: - if (classify(r) != NaN) - return 1; - break; - case non_zero_nan: - if (classify(r) != NaN) - return 1; - break; - } - break; + if (classify(r) != NaN) + return 1; + break; case inf: - switch (classify(divisor)) - { - case zero: - if (classify(r) != NaN) - return 1; - break; - case non_zero: - if (classify(r) != inf) - return 1; - break; - case inf: - if (classify(r) != inf) - return 1; - break; - case NaN: - if (classify(r) != NaN) - return 1; - break; - case non_zero_nan: - if (classify(r) != inf) - return 1; - break; - } - break; + if (classify(r) != inf) + return 1; + break; case NaN: - switch (classify(divisor)) - { - case zero: - if (classify(r) != NaN) - return 1; - break; - case non_zero: - if (classify(r) != NaN) - return 1; - break; - case inf: - if (classify(r) != NaN) - return 1; - break; - case NaN: - if (classify(r) != NaN) - return 1; - break; - case non_zero_nan: - if (classify(r) != NaN) - return 1; - break; - } - break; + if (classify(r) != NaN) + return 1; + break; case non_zero_nan: - switch (classify(divisor)) - { - case zero: - if (classify(r) != NaN) - return 1; - break; - case non_zero: - if (classify(r) != NaN) - return 1; - break; - case inf: - if (classify(r) != inf) - return 1; - break; - case NaN: - if (classify(r) != NaN) - return 1; - break; - case non_zero_nan: - if (classify(r) != NaN) - return 1; - break; - } - break; + if (classify(r) != NaN) + return 1; + break; } - - return 0; + break; + } + + return 0; } -long double x[][2] = -{ - { 1.e-6, 1.e-6}, - {-1.e-6, 1.e-6}, - {-1.e-6, -1.e-6}, - { 1.e-6, -1.e-6}, +long double x[][2] = {{1.e-6, 1.e-6}, + {-1.e-6, 1.e-6}, + {-1.e-6, -1.e-6}, + {1.e-6, -1.e-6}, - { 1.e+6, 1.e-6}, - {-1.e+6, 1.e-6}, - {-1.e+6, -1.e-6}, - { 1.e+6, -1.e-6}, + {1.e+6, 1.e-6}, + {-1.e+6, 1.e-6}, + {-1.e+6, -1.e-6}, + {1.e+6, -1.e-6}, - { 1.e-6, 1.e+6}, - {-1.e-6, 1.e+6}, - {-1.e-6, -1.e+6}, - { 1.e-6, -1.e+6}, + {1.e-6, 1.e+6}, + {-1.e-6, 1.e+6}, + {-1.e-6, -1.e+6}, + {1.e-6, -1.e+6}, - { 1.e+6, 1.e+6}, - {-1.e+6, 1.e+6}, - {-1.e+6, -1.e+6}, - { 1.e+6, -1.e+6}, + {1.e+6, 1.e+6}, + {-1.e+6, 1.e+6}, + {-1.e+6, -1.e+6}, + {1.e+6, -1.e+6}, - {NAN, NAN}, - {-INFINITY, NAN}, - {-2, NAN}, - {-1, NAN}, - {-0.5, NAN}, - {-0., NAN}, - {+0., NAN}, - {0.5, NAN}, - {1, NAN}, - {2, NAN}, - {INFINITY, NAN}, + {NAN, NAN}, + {-INFINITY, NAN}, + {-2, NAN}, + {-1, NAN}, + {-0.5, NAN}, + {-0., NAN}, + {+0., NAN}, + {0.5, NAN}, + {1, NAN}, + {2, NAN}, + {INFINITY, NAN}, - {NAN, -INFINITY}, - {-INFINITY, -INFINITY}, - {-2, -INFINITY}, - {-1, -INFINITY}, - {-0.5, -INFINITY}, - {-0., -INFINITY}, - {+0., -INFINITY}, - {0.5, -INFINITY}, - {1, -INFINITY}, - {2, -INFINITY}, - {INFINITY, -INFINITY}, + {NAN, -INFINITY}, + {-INFINITY, -INFINITY}, + {-2, -INFINITY}, + {-1, -INFINITY}, + {-0.5, -INFINITY}, + {-0., -INFINITY}, + {+0., -INFINITY}, + {0.5, -INFINITY}, + {1, -INFINITY}, + {2, -INFINITY}, + {INFINITY, -INFINITY}, - {NAN, -2}, - {-INFINITY, -2}, - {-2, -2}, - {-1, -2}, - {-0.5, -2}, - {-0., -2}, - {+0., -2}, - {0.5, -2}, - {1, -2}, - {2, -2}, - {INFINITY, -2}, + {NAN, -2}, + {-INFINITY, -2}, + {-2, -2}, + {-1, -2}, + {-0.5, -2}, + {-0., -2}, + {+0., -2}, + {0.5, -2}, + {1, -2}, + {2, -2}, + {INFINITY, -2}, - {NAN, -1}, - {-INFINITY, -1}, - {-2, -1}, - {-1, -1}, - {-0.5, -1}, - {-0., -1}, - {+0., -1}, - {0.5, -1}, - {1, -1}, - {2, -1}, - {INFINITY, -1}, + {NAN, -1}, + {-INFINITY, -1}, + {-2, -1}, + {-1, -1}, + {-0.5, -1}, + {-0., -1}, + {+0., -1}, + {0.5, -1}, + {1, -1}, + {2, -1}, + {INFINITY, -1}, - {NAN, -0.5}, - {-INFINITY, -0.5}, - {-2, -0.5}, - {-1, -0.5}, - {-0.5, -0.5}, - {-0., -0.5}, - {+0., -0.5}, - {0.5, -0.5}, - {1, -0.5}, - {2, -0.5}, - {INFINITY, -0.5}, + {NAN, -0.5}, + {-INFINITY, -0.5}, + {-2, -0.5}, + {-1, -0.5}, + {-0.5, -0.5}, + {-0., -0.5}, + {+0., -0.5}, + {0.5, -0.5}, + {1, -0.5}, + {2, -0.5}, + {INFINITY, -0.5}, - {NAN, -0.}, - {-INFINITY, -0.}, - {-2, -0.}, - {-1, -0.}, - {-0.5, -0.}, - {-0., -0.}, - {+0., -0.}, - {0.5, -0.}, - {1, -0.}, - {2, -0.}, - {INFINITY, -0.}, + {NAN, -0.}, + {-INFINITY, -0.}, + {-2, -0.}, + {-1, -0.}, + {-0.5, -0.}, + {-0., -0.}, + {+0., -0.}, + {0.5, -0.}, + {1, -0.}, + {2, -0.}, + {INFINITY, -0.}, - {NAN, 0.}, - {-INFINITY, 0.}, - {-2, 0.}, - {-1, 0.}, - {-0.5, 0.}, - {-0., 0.}, - {+0., 0.}, - {0.5, 0.}, - {1, 0.}, - {2, 0.}, - {INFINITY, 0.}, + {NAN, 0.}, + {-INFINITY, 0.}, + {-2, 0.}, + {-1, 0.}, + {-0.5, 0.}, + {-0., 0.}, + {+0., 0.}, + {0.5, 0.}, + {1, 0.}, + {2, 0.}, + {INFINITY, 0.}, - {NAN, 0.5}, - {-INFINITY, 0.5}, - {-2, 0.5}, - {-1, 0.5}, - {-0.5, 0.5}, - {-0., 0.5}, - {+0., 0.5}, - {0.5, 0.5}, - {1, 0.5}, - {2, 0.5}, - {INFINITY, 0.5}, + {NAN, 0.5}, + {-INFINITY, 0.5}, + {-2, 0.5}, + {-1, 0.5}, + {-0.5, 0.5}, + {-0., 0.5}, + {+0., 0.5}, + {0.5, 0.5}, + {1, 0.5}, + {2, 0.5}, + {INFINITY, 0.5}, - {NAN, 1}, - {-INFINITY, 1}, - {-2, 1}, - {-1, 1}, - {-0.5, 1}, - {-0., 1}, - {+0., 1}, - {0.5, 1}, - {1, 1}, - {2, 1}, - {INFINITY, 1}, + {NAN, 1}, + {-INFINITY, 1}, + {-2, 1}, + {-1, 1}, + {-0.5, 1}, + {-0., 1}, + {+0., 1}, + {0.5, 1}, + {1, 1}, + {2, 1}, + {INFINITY, 1}, - {NAN, 2}, - {-INFINITY, 2}, - {-2, 2}, - {-1, 2}, - {-0.5, 2}, - {-0., 2}, - {+0., 2}, - {0.5, 2}, - {1, 2}, - {2, 2}, - {INFINITY, 2}, + {NAN, 2}, + {-INFINITY, 2}, + {-2, 2}, + {-1, 2}, + {-0.5, 2}, + {-0., 2}, + {+0., 2}, + {0.5, 2}, + {1, 2}, + {2, 2}, + {INFINITY, 2}, - {NAN, INFINITY}, - {-INFINITY, INFINITY}, - {-2, INFINITY}, - {-1, INFINITY}, - {-0.5, INFINITY}, - {-0., INFINITY}, - {+0., INFINITY}, - {0.5, INFINITY}, - {1, INFINITY}, - {2, INFINITY}, - {INFINITY, INFINITY} + {NAN, INFINITY}, + {-INFINITY, INFINITY}, + {-2, INFINITY}, + {-1, INFINITY}, + {-0.5, INFINITY}, + {-0., INFINITY}, + {+0., INFINITY}, + {0.5, INFINITY}, + {1, INFINITY}, + {2, INFINITY}, + {INFINITY, INFINITY} }; #endif -int main() -{ +int main() { #if defined(CRT_HAS_128BIT) && defined(CRT_HAS_F128) const unsigned N = sizeof(x) / sizeof(x[0]); unsigned i, j; @@ -358,7 +344,7 @@ int main() } } #else - printf("skipped\n"); + printf("skipped\n"); #endif - return 0; + return 0; } From 834f64a03e994b05c96419a3d6a4729a40788875 Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Wed, 24 Sep 2025 13:01:10 -0700 Subject: [PATCH 5/5] Revert formatting changes --- .../test/builtins/Unit/fixunstfdi_test.c | 144 ++-- compiler-rt/test/builtins/Unit/multc3_test.c | 622 +++++++++--------- 2 files changed, 391 insertions(+), 375 deletions(-) diff --git a/compiler-rt/test/builtins/Unit/fixunstfdi_test.c b/compiler-rt/test/builtins/Unit/fixunstfdi_test.c index 75b72f92fb2e6..cfe1a87b0a5df 100644 --- a/compiler-rt/test/builtins/Unit/fixunstfdi_test.c +++ b/compiler-rt/test/builtins/Unit/fixunstfdi_test.c @@ -6,7 +6,7 @@ #if defined(CRT_HAS_TF_MODE) -# include "int_lib.h" +#include "int_lib.h" // Returns: convert a to a unsigned long long, rounding toward zero. // Negative values all become zero. @@ -36,77 +36,77 @@ char assumption_3[sizeof(long double)*CHAR_BIT == 128] = {0}; int main() { #if defined(CRT_HAS_TF_MODE) - if (test__fixunstfdi(0.0, 0)) - return 1; - - if (test__fixunstfdi(0.5, 0)) - return 1; - if (test__fixunstfdi(0.99, 0)) - return 1; - if (test__fixunstfdi(1.0, 1)) - return 1; - if (test__fixunstfdi(1.5, 1)) - return 1; - if (test__fixunstfdi(1.99, 1)) - return 1; - if (test__fixunstfdi(2.0, 2)) - return 1; - if (test__fixunstfdi(2.01, 2)) - return 1; - if (test__fixunstfdi(-0.5, 0)) - return 1; - if (test__fixunstfdi(-0.99, 0)) - return 1; - if (test__fixunstfdi(-1.0, 0)) - return 1; - if (test__fixunstfdi(-1.5, 0)) - return 1; - if (test__fixunstfdi(-1.99, 0)) - return 1; - if (test__fixunstfdi(-2.0, 0)) - return 1; - if (test__fixunstfdi(-2.01, 0)) - return 1; - - if (test__fixunstfdi(0x1.FFFFFEp+62, 0x7FFFFF8000000000LL)) - return 1; - if (test__fixunstfdi(0x1.FFFFFCp+62, 0x7FFFFF0000000000LL)) - return 1; - - if (test__fixunstfdi(-0x1.FFFFFEp+62, 0)) - return 1; - if (test__fixunstfdi(-0x1.FFFFFCp+62, 0)) - return 1; - - if (test__fixunstfdi(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFFFFFFFC00LL)) - return 1; - if (test__fixunstfdi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFFFFFFF800LL)) - return 1; - - if (test__fixunstfdi(-0x1.FFFFFFFFFFFFFp+62, 0)) - return 1; - if (test__fixunstfdi(-0x1.FFFFFFFFFFFFEp+62, 0)) - return 1; - - if (test__fixunstfdi(0x1.FFFFFFFFFFFFFFFEp+63L, 0xFFFFFFFFFFFFFFFFLL)) - return 1; - if (test__fixunstfdi(0x1.0000000000000002p+63L, 0x8000000000000001LL)) - return 1; - if (test__fixunstfdi(0x1.0000000000000000p+63L, 0x8000000000000000LL)) - return 1; - if (test__fixunstfdi(0x1.FFFFFFFFFFFFFFFCp+62L, 0x7FFFFFFFFFFFFFFFLL)) - return 1; - if (test__fixunstfdi(0x1.FFFFFFFFFFFFFFF8p+62L, 0x7FFFFFFFFFFFFFFELL)) - return 1; - if (test__fixunstfdi(0x1.p+64L, 0xFFFFFFFFFFFFFFFFLL)) - return 1; - - if (test__fixunstfdi(-0x1.0000000000000000p+63L, 0)) - return 1; - if (test__fixunstfdi(-0x1.FFFFFFFFFFFFFFFCp+62L, 0)) - return 1; - if (test__fixunstfdi(-0x1.FFFFFFFFFFFFFFF8p+62L, 0)) - return 1; + if (test__fixunstfdi(0.0, 0)) + return 1; + + if (test__fixunstfdi(0.5, 0)) + return 1; + if (test__fixunstfdi(0.99, 0)) + return 1; + if (test__fixunstfdi(1.0, 1)) + return 1; + if (test__fixunstfdi(1.5, 1)) + return 1; + if (test__fixunstfdi(1.99, 1)) + return 1; + if (test__fixunstfdi(2.0, 2)) + return 1; + if (test__fixunstfdi(2.01, 2)) + return 1; + if (test__fixunstfdi(-0.5, 0)) + return 1; + if (test__fixunstfdi(-0.99, 0)) + return 1; + if (test__fixunstfdi(-1.0, 0)) + return 1; + if (test__fixunstfdi(-1.5, 0)) + return 1; + if (test__fixunstfdi(-1.99, 0)) + return 1; + if (test__fixunstfdi(-2.0, 0)) + return 1; + if (test__fixunstfdi(-2.01, 0)) + return 1; + + if (test__fixunstfdi(0x1.FFFFFEp+62, 0x7FFFFF8000000000LL)) + return 1; + if (test__fixunstfdi(0x1.FFFFFCp+62, 0x7FFFFF0000000000LL)) + return 1; + + if (test__fixunstfdi(-0x1.FFFFFEp+62, 0)) + return 1; + if (test__fixunstfdi(-0x1.FFFFFCp+62, 0)) + return 1; + + if (test__fixunstfdi(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFFFFFFFC00LL)) + return 1; + if (test__fixunstfdi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFFFFFFF800LL)) + return 1; + + if (test__fixunstfdi(-0x1.FFFFFFFFFFFFFp+62, 0)) + return 1; + if (test__fixunstfdi(-0x1.FFFFFFFFFFFFEp+62, 0)) + return 1; + + if (test__fixunstfdi(0x1.FFFFFFFFFFFFFFFEp+63L, 0xFFFFFFFFFFFFFFFFLL)) + return 1; + if (test__fixunstfdi(0x1.0000000000000002p+63L, 0x8000000000000001LL)) + return 1; + if (test__fixunstfdi(0x1.0000000000000000p+63L, 0x8000000000000000LL)) + return 1; + if (test__fixunstfdi(0x1.FFFFFFFFFFFFFFFCp+62L, 0x7FFFFFFFFFFFFFFFLL)) + return 1; + if (test__fixunstfdi(0x1.FFFFFFFFFFFFFFF8p+62L, 0x7FFFFFFFFFFFFFFELL)) + return 1; + if (test__fixunstfdi(0x1.p+64L, 0xFFFFFFFFFFFFFFFFLL)) + return 1; + + if (test__fixunstfdi(-0x1.0000000000000000p+63L, 0)) + return 1; + if (test__fixunstfdi(-0x1.FFFFFFFFFFFFFFFCp+62L, 0)) + return 1; + if (test__fixunstfdi(-0x1.FFFFFFFFFFFFFFF8p+62L, 0)) + return 1; #else printf("skipped\n"); diff --git a/compiler-rt/test/builtins/Unit/multc3_test.c b/compiler-rt/test/builtins/Unit/multc3_test.c index bddea9af66970..7ae4cb5b710a7 100644 --- a/compiler-rt/test/builtins/Unit/multc3_test.c +++ b/compiler-rt/test/builtins/Unit/multc3_test.c @@ -6,345 +6,361 @@ #if defined(CRT_HAS_128BIT) && defined(CRT_HAS_F128) -# include "int_lib.h" -# include -# include +#include "int_lib.h" +#include +#include // Returns: the product of a + ib and c + id -COMPILER_RT_ABI long double _Complex __multc3(long double __a, long double __b, - long double __c, long double __d); +COMPILER_RT_ABI long double _Complex +__multc3(long double __a, long double __b, long double __c, long double __d); -enum { zero, non_zero, inf, NaN, non_zero_nan }; +enum {zero, non_zero, inf, NaN, non_zero_nan}; -int classify(long double _Complex x) { - if (x == 0) - return zero; - if (isinf(creall(x)) || isinf(cimagl(x))) - return inf; - if (isnan(creall(x)) && isnan(cimagl(x))) - return NaN; - if (isnan(creall(x))) { - if (cimagl(x) == 0) - return NaN; - return non_zero_nan; - } - if (isnan(cimagl(x))) { - if (creall(x) == 0) - return NaN; - return non_zero_nan; - } - return non_zero; -} - -int test__multc3(long double a, long double b, long double c, long double d) { - long double _Complex r = __multc3(a, b, c, d); - // printf("test__multc3(%Lf, %Lf, %Lf, %Lf) = %Lf + I%Lf\n", - // a, b, c, d, creall(r), cimagl(r)); - long double _Complex dividend; - long double _Complex divisor; - - __real__ dividend = a; - __imag__ dividend = b; - __real__ divisor = c; - __imag__ divisor = d; - - switch (classify(dividend)) { - case zero: - switch (classify(divisor)) { - case zero: - if (classify(r) != zero) - return 1; - break; - case non_zero: - if (classify(r) != zero) - return 1; - break; - case inf: - if (classify(r) != NaN) - return 1; - break; - case NaN: - if (classify(r) != NaN) - return 1; - break; - case non_zero_nan: - if (classify(r) != NaN) - return 1; - break; +int +classify(long double _Complex x) +{ + if (x == 0) + return zero; + if (isinf(creall(x)) || isinf(cimagl(x))) + return inf; + if (isnan(creall(x)) && isnan(cimagl(x))) + return NaN; + if (isnan(creall(x))) + { + if (cimagl(x) == 0) + return NaN; + return non_zero_nan; } - break; - case non_zero: - switch (classify(divisor)) { - case zero: - if (classify(r) != zero) - return 1; - break; - case non_zero: - if (classify(r) != non_zero) - return 1; - if (r != a * c - b * d + _Complex_I * (a * d + b * c)) - return 1; - break; - case inf: - if (classify(r) != inf) - return 1; - break; - case NaN: - if (classify(r) != NaN) - return 1; - break; - case non_zero_nan: - if (classify(r) != NaN) - return 1; - break; + if (isnan(cimagl(x))) + { + if (creall(x) == 0) + return NaN; + return non_zero_nan; } - break; - case inf: - switch (classify(divisor)) { - case zero: - if (classify(r) != NaN) - return 1; - break; - case non_zero: - if (classify(r) != inf) - return 1; - break; - case inf: - if (classify(r) != inf) - return 1; - break; - case NaN: - if (classify(r) != NaN) - return 1; - break; - case non_zero_nan: - if (classify(r) != inf) - return 1; - break; - } - break; - case NaN: - switch (classify(divisor)) { - case zero: - if (classify(r) != NaN) - return 1; - break; - case non_zero: - if (classify(r) != NaN) - return 1; - break; - case inf: - if (classify(r) != NaN) - return 1; - break; - case NaN: - if (classify(r) != NaN) - return 1; - break; - case non_zero_nan: - if (classify(r) != NaN) - return 1; - break; - } - break; - case non_zero_nan: - switch (classify(divisor)) { + return non_zero; +} + +int test__multc3(long double a, long double b, long double c, long double d) +{ + long double _Complex r = __multc3(a, b, c, d); +// printf("test__multc3(%Lf, %Lf, %Lf, %Lf) = %Lf + I%Lf\n", +// a, b, c, d, creall(r), cimagl(r)); + long double _Complex dividend; + long double _Complex divisor; + + __real__ dividend = a; + __imag__ dividend = b; + __real__ divisor = c; + __imag__ divisor = d; + + switch (classify(dividend)) + { case zero: - if (classify(r) != NaN) - return 1; - break; + switch (classify(divisor)) + { + case zero: + if (classify(r) != zero) + return 1; + break; + case non_zero: + if (classify(r) != zero) + return 1; + break; + case inf: + if (classify(r) != NaN) + return 1; + break; + case NaN: + if (classify(r) != NaN) + return 1; + break; + case non_zero_nan: + if (classify(r) != NaN) + return 1; + break; + } + break; case non_zero: - if (classify(r) != NaN) - return 1; - break; + switch (classify(divisor)) + { + case zero: + if (classify(r) != zero) + return 1; + break; + case non_zero: + if (classify(r) != non_zero) + return 1; + if (r != a * c - b * d + _Complex_I*(a * d + b * c)) + return 1; + break; + case inf: + if (classify(r) != inf) + return 1; + break; + case NaN: + if (classify(r) != NaN) + return 1; + break; + case non_zero_nan: + if (classify(r) != NaN) + return 1; + break; + } + break; case inf: - if (classify(r) != inf) - return 1; - break; + switch (classify(divisor)) + { + case zero: + if (classify(r) != NaN) + return 1; + break; + case non_zero: + if (classify(r) != inf) + return 1; + break; + case inf: + if (classify(r) != inf) + return 1; + break; + case NaN: + if (classify(r) != NaN) + return 1; + break; + case non_zero_nan: + if (classify(r) != inf) + return 1; + break; + } + break; case NaN: - if (classify(r) != NaN) - return 1; - break; + switch (classify(divisor)) + { + case zero: + if (classify(r) != NaN) + return 1; + break; + case non_zero: + if (classify(r) != NaN) + return 1; + break; + case inf: + if (classify(r) != NaN) + return 1; + break; + case NaN: + if (classify(r) != NaN) + return 1; + break; + case non_zero_nan: + if (classify(r) != NaN) + return 1; + break; + } + break; case non_zero_nan: - if (classify(r) != NaN) - return 1; - break; + switch (classify(divisor)) + { + case zero: + if (classify(r) != NaN) + return 1; + break; + case non_zero: + if (classify(r) != NaN) + return 1; + break; + case inf: + if (classify(r) != inf) + return 1; + break; + case NaN: + if (classify(r) != NaN) + return 1; + break; + case non_zero_nan: + if (classify(r) != NaN) + return 1; + break; + } + break; } - break; - } - - return 0; + + return 0; } -long double x[][2] = {{1.e-6, 1.e-6}, - {-1.e-6, 1.e-6}, - {-1.e-6, -1.e-6}, - {1.e-6, -1.e-6}, +long double x[][2] = +{ + { 1.e-6, 1.e-6}, + {-1.e-6, 1.e-6}, + {-1.e-6, -1.e-6}, + { 1.e-6, -1.e-6}, - {1.e+6, 1.e-6}, - {-1.e+6, 1.e-6}, - {-1.e+6, -1.e-6}, - {1.e+6, -1.e-6}, + { 1.e+6, 1.e-6}, + {-1.e+6, 1.e-6}, + {-1.e+6, -1.e-6}, + { 1.e+6, -1.e-6}, - {1.e-6, 1.e+6}, - {-1.e-6, 1.e+6}, - {-1.e-6, -1.e+6}, - {1.e-6, -1.e+6}, + { 1.e-6, 1.e+6}, + {-1.e-6, 1.e+6}, + {-1.e-6, -1.e+6}, + { 1.e-6, -1.e+6}, - {1.e+6, 1.e+6}, - {-1.e+6, 1.e+6}, - {-1.e+6, -1.e+6}, - {1.e+6, -1.e+6}, + { 1.e+6, 1.e+6}, + {-1.e+6, 1.e+6}, + {-1.e+6, -1.e+6}, + { 1.e+6, -1.e+6}, - {NAN, NAN}, - {-INFINITY, NAN}, - {-2, NAN}, - {-1, NAN}, - {-0.5, NAN}, - {-0., NAN}, - {+0., NAN}, - {0.5, NAN}, - {1, NAN}, - {2, NAN}, - {INFINITY, NAN}, + {NAN, NAN}, + {-INFINITY, NAN}, + {-2, NAN}, + {-1, NAN}, + {-0.5, NAN}, + {-0., NAN}, + {+0., NAN}, + {0.5, NAN}, + {1, NAN}, + {2, NAN}, + {INFINITY, NAN}, - {NAN, -INFINITY}, - {-INFINITY, -INFINITY}, - {-2, -INFINITY}, - {-1, -INFINITY}, - {-0.5, -INFINITY}, - {-0., -INFINITY}, - {+0., -INFINITY}, - {0.5, -INFINITY}, - {1, -INFINITY}, - {2, -INFINITY}, - {INFINITY, -INFINITY}, + {NAN, -INFINITY}, + {-INFINITY, -INFINITY}, + {-2, -INFINITY}, + {-1, -INFINITY}, + {-0.5, -INFINITY}, + {-0., -INFINITY}, + {+0., -INFINITY}, + {0.5, -INFINITY}, + {1, -INFINITY}, + {2, -INFINITY}, + {INFINITY, -INFINITY}, - {NAN, -2}, - {-INFINITY, -2}, - {-2, -2}, - {-1, -2}, - {-0.5, -2}, - {-0., -2}, - {+0., -2}, - {0.5, -2}, - {1, -2}, - {2, -2}, - {INFINITY, -2}, + {NAN, -2}, + {-INFINITY, -2}, + {-2, -2}, + {-1, -2}, + {-0.5, -2}, + {-0., -2}, + {+0., -2}, + {0.5, -2}, + {1, -2}, + {2, -2}, + {INFINITY, -2}, - {NAN, -1}, - {-INFINITY, -1}, - {-2, -1}, - {-1, -1}, - {-0.5, -1}, - {-0., -1}, - {+0., -1}, - {0.5, -1}, - {1, -1}, - {2, -1}, - {INFINITY, -1}, + {NAN, -1}, + {-INFINITY, -1}, + {-2, -1}, + {-1, -1}, + {-0.5, -1}, + {-0., -1}, + {+0., -1}, + {0.5, -1}, + {1, -1}, + {2, -1}, + {INFINITY, -1}, - {NAN, -0.5}, - {-INFINITY, -0.5}, - {-2, -0.5}, - {-1, -0.5}, - {-0.5, -0.5}, - {-0., -0.5}, - {+0., -0.5}, - {0.5, -0.5}, - {1, -0.5}, - {2, -0.5}, - {INFINITY, -0.5}, + {NAN, -0.5}, + {-INFINITY, -0.5}, + {-2, -0.5}, + {-1, -0.5}, + {-0.5, -0.5}, + {-0., -0.5}, + {+0., -0.5}, + {0.5, -0.5}, + {1, -0.5}, + {2, -0.5}, + {INFINITY, -0.5}, - {NAN, -0.}, - {-INFINITY, -0.}, - {-2, -0.}, - {-1, -0.}, - {-0.5, -0.}, - {-0., -0.}, - {+0., -0.}, - {0.5, -0.}, - {1, -0.}, - {2, -0.}, - {INFINITY, -0.}, + {NAN, -0.}, + {-INFINITY, -0.}, + {-2, -0.}, + {-1, -0.}, + {-0.5, -0.}, + {-0., -0.}, + {+0., -0.}, + {0.5, -0.}, + {1, -0.}, + {2, -0.}, + {INFINITY, -0.}, - {NAN, 0.}, - {-INFINITY, 0.}, - {-2, 0.}, - {-1, 0.}, - {-0.5, 0.}, - {-0., 0.}, - {+0., 0.}, - {0.5, 0.}, - {1, 0.}, - {2, 0.}, - {INFINITY, 0.}, + {NAN, 0.}, + {-INFINITY, 0.}, + {-2, 0.}, + {-1, 0.}, + {-0.5, 0.}, + {-0., 0.}, + {+0., 0.}, + {0.5, 0.}, + {1, 0.}, + {2, 0.}, + {INFINITY, 0.}, - {NAN, 0.5}, - {-INFINITY, 0.5}, - {-2, 0.5}, - {-1, 0.5}, - {-0.5, 0.5}, - {-0., 0.5}, - {+0., 0.5}, - {0.5, 0.5}, - {1, 0.5}, - {2, 0.5}, - {INFINITY, 0.5}, + {NAN, 0.5}, + {-INFINITY, 0.5}, + {-2, 0.5}, + {-1, 0.5}, + {-0.5, 0.5}, + {-0., 0.5}, + {+0., 0.5}, + {0.5, 0.5}, + {1, 0.5}, + {2, 0.5}, + {INFINITY, 0.5}, - {NAN, 1}, - {-INFINITY, 1}, - {-2, 1}, - {-1, 1}, - {-0.5, 1}, - {-0., 1}, - {+0., 1}, - {0.5, 1}, - {1, 1}, - {2, 1}, - {INFINITY, 1}, + {NAN, 1}, + {-INFINITY, 1}, + {-2, 1}, + {-1, 1}, + {-0.5, 1}, + {-0., 1}, + {+0., 1}, + {0.5, 1}, + {1, 1}, + {2, 1}, + {INFINITY, 1}, - {NAN, 2}, - {-INFINITY, 2}, - {-2, 2}, - {-1, 2}, - {-0.5, 2}, - {-0., 2}, - {+0., 2}, - {0.5, 2}, - {1, 2}, - {2, 2}, - {INFINITY, 2}, + {NAN, 2}, + {-INFINITY, 2}, + {-2, 2}, + {-1, 2}, + {-0.5, 2}, + {-0., 2}, + {+0., 2}, + {0.5, 2}, + {1, 2}, + {2, 2}, + {INFINITY, 2}, - {NAN, INFINITY}, - {-INFINITY, INFINITY}, - {-2, INFINITY}, - {-1, INFINITY}, - {-0.5, INFINITY}, - {-0., INFINITY}, - {+0., INFINITY}, - {0.5, INFINITY}, - {1, INFINITY}, - {2, INFINITY}, - {INFINITY, INFINITY} + {NAN, INFINITY}, + {-INFINITY, INFINITY}, + {-2, INFINITY}, + {-1, INFINITY}, + {-0.5, INFINITY}, + {-0., INFINITY}, + {+0., INFINITY}, + {0.5, INFINITY}, + {1, INFINITY}, + {2, INFINITY}, + {INFINITY, INFINITY} }; #endif -int main() { +int main() +{ #if defined(CRT_HAS_128BIT) && defined(CRT_HAS_F128) - const unsigned N = sizeof(x) / sizeof(x[0]); - unsigned i, j; - for (i = 0; i < N; ++i) { - for (j = 0; j < N; ++j) { - if (test__multc3(x[i][0], x[i][1], x[j][0], x[j][1])) - return 1; + const unsigned N = sizeof(x) / sizeof(x[0]); + unsigned i, j; + for (i = 0; i < N; ++i) + { + for (j = 0; j < N; ++j) + { + if (test__multc3(x[i][0], x[i][1], x[j][0], x[j][1])) + return 1; + } } - } #else - printf("skipped\n"); + printf("skipped\n"); #endif - return 0; + return 0; }