Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Sergei Poselenov | b448962 | 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 | b448962 | 2007-07-05 08:17:37 +0200 | [diff] [blame] | 5 | */ |
| 6 | /* |
| 7 | * This file is originally a part of the GCC testsuite. |
| 8 | */ |
| 9 | |
| 10 | #include <common.h> |
| 11 | |
Sergei Poselenov | b448962 | 2007-07-05 08:17:37 +0200 | [diff] [blame] | 12 | #include <post.h> |
| 13 | |
Yuri Tikhonov | ce82ff0 | 2008-12-20 14:54:21 +0300 | [diff] [blame] | 14 | GNU_FPOST_ATTR |
| 15 | |
Kumar Gala | e009cde | 2011-01-25 03:00:08 -0600 | [diff] [blame] | 16 | #if CONFIG_POST & CONFIG_SYS_POST_FPU |
| 17 | |
Sergei Poselenov | b448962 | 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 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 39 | #endif /* CONFIG_POST & CONFIG_SYS_POST_FPU */ |