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