blob: 408c391ce42b84a6164aa91633cb605c295decba [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Sergei Poselenov3190dbe2007-07-05 08:17:37 +02002/*
3 * Copyright (C) 2007
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
Sergei Poselenov3190dbe2007-07-05 08:17:37 +02005 */
6/*
7 * This file is originally a part of the GCC testsuite.
8 */
9
Tom Rinidec7ea02024-05-20 13:35:03 -060010#include <config.h>
Sergei Poselenov3190dbe2007-07-05 08:17:37 +020011
Sergei Poselenov3190dbe2007-07-05 08:17:37 +020012#include <post.h>
13
Yuri Tikhonov7ed66f72008-12-20 14:54:21 +030014GNU_FPOST_ATTR
15
Tom Rini3dd5d4a2022-12-04 10:14:17 -050016#if CFG_POST & CFG_SYS_POST_FPU
Kumar Galafe6555b2011-01-25 03:00:08 -060017
Sergei Poselenov3190dbe2007-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
Tom Rini3dd5d4a2022-12-04 10:14:17 -050039#endif /* CFG_POST & CFG_SYS_POST_FPU */