Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Sergei Poselenov | 3190dbe | 2007-07-05 08:17:37 +0200 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2007 |
| 4 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
Sergei Poselenov | 3190dbe | 2007-07-05 08:17:37 +0200 | [diff] [blame] | 5 | */ |
| 6 | /* |
| 7 | * This file is originally a part of the GCC testsuite. |
| 8 | */ |
| 9 | |
Tom Rini | 150c3bc | 2024-04-27 08:11:06 -0600 | [diff] [blame] | 10 | #include <config.h> |
Sergei Poselenov | 3190dbe | 2007-07-05 08:17:37 +0200 | [diff] [blame] | 11 | |
Sergei Poselenov | 3190dbe | 2007-07-05 08:17:37 +0200 | [diff] [blame] | 12 | #include <post.h> |
| 13 | |
Yuri Tikhonov | 7ed66f7 | 2008-12-20 14:54:21 +0300 | [diff] [blame] | 14 | GNU_FPOST_ATTR |
| 15 | |
Tom Rini | 3dd5d4a | 2022-12-04 10:14:17 -0500 | [diff] [blame] | 16 | #if CFG_POST & CFG_SYS_POST_FPU |
Kumar Gala | fe6555b | 2011-01-25 03:00:08 -0600 | [diff] [blame] | 17 | |
Sergei Poselenov | 3190dbe | 2007-07-05 08:17:37 +0200 | [diff] [blame] | 18 | static 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 | |
| 28 | int 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 Rini | 3dd5d4a | 2022-12-04 10:14:17 -0500 | [diff] [blame] | 39 | #endif /* CFG_POST & CFG_SYS_POST_FPU */ |