blob: 9e5783b25792bca36d397e1f4449926faf00aed7 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Sergei Poselenovb4489622007-07-05 08:17:37 +02002/*
3 * Copyright (C) 2007
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
Sergei Poselenovb4489622007-07-05 08:17:37 +02005 */
6/*
7 * This file is originally a part of the GCC testsuite.
8 */
9
10#include <common.h>
11
Sergei Poselenovb4489622007-07-05 08:17:37 +020012#include <post.h>
13
Yuri Tikhonovce82ff02008-12-20 14:54:21 +030014GNU_FPOST_ATTR
15
Kumar Galae009cde2011-01-25 03:00:08 -060016#if CONFIG_POST & CONFIG_SYS_POST_FPU
17
Sergei Poselenovb4489622007-07-05 08:17:37 +020018static double func (const double *array)
19{
20 double d = *array;
21
22 if (d == 0.0)
23 return d;
24 else
25 return d + func (array + 1);
26}
27
28int fpu_post_test_math5 (void)
29{
30 double values[] = { 0.1e-100, 1.0, -1.0, 0.0 };
31
32 if (func (values) != 0.1e-100) {
33 post_log ("Error in FPU math5 test\n");
34 return -1;
35 }
36 return 0;
37}
38
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020039#endif /* CONFIG_POST & CONFIG_SYS_POST_FPU */