3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24 * This file is originally a part of the GCC testsuite.
25 * Check that certain subnormal numbers (formerly known as denormalized
26 * numbers) are rounded to within 0.5 ulp. PR other/14354.
33 #if CONFIG_POST & CONFIG_SYS_POST_FPU
62 tstmul (unsigned int ux, unsigned int uy, unsigned int ur)
67 if (f2u (x * y) != ur)
68 /* Set a variable rather than aborting here, to simplify tracing when
69 several computations are wrong. */
73 /* We don't want to make this const and static, or else we risk inlining
74 causing the test to fold as constants at compile-time. */
77 unsigned int p1, p2, res;
78 } static volatile expected[] =
80 {0xfff, 0x3f800400, 0xfff},
81 {0xf, 0x3fc88888, 0x17},
82 {0xf, 0x3f844444, 0xf}
85 int fpu_post_test_math7 (void)
89 for (i = 0; i < sizeof (expected) / sizeof (expected[0]); i++)
91 tstmul (expected[i].p1, expected[i].p2, expected[i].res);
92 tstmul (expected[i].p2, expected[i].p1, expected[i].res);
96 post_log ("Error in FPU math7 test\n");
102 #endif /* CONFIG_POST & CONFIG_SYS_POST_FPU */