1 // SPDX-License-Identifier: GPL-2.0+
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
7 * This file is originally a part of the GCC testsuite.
8 * Check that certain subnormal numbers (formerly known as denormalized
9 * numbers) are rounded to within 0.5 ulp. PR other/14354.
18 #if CONFIG_POST & CONFIG_SYS_POST_FPU
45 tstmul (unsigned int ux, unsigned int uy, unsigned int ur)
50 if (f2u (x * y) != ur)
51 /* Set a variable rather than aborting here, to simplify tracing when
52 several computations are wrong. */
56 /* We don't want to make this const and static, or else we risk inlining
57 causing the test to fold as constants at compile-time. */
60 unsigned int p1, p2, res;
61 } static volatile expected[] =
63 {0xfff, 0x3f800400, 0xfff},
64 {0xf, 0x3fc88888, 0x17},
65 {0xf, 0x3f844444, 0xf}
68 int fpu_post_test_math7 (void)
72 for (i = 0; i < ARRAY_SIZE(expected); i++)
74 tstmul (expected[i].p1, expected[i].p2, expected[i].res);
75 tstmul (expected[i].p2, expected[i].p1, expected[i].res);
79 post_log ("Error in FPU math7 test\n");
85 #endif /* CONFIG_POST & CONFIG_SYS_POST_FPU */