Sergei Poselenov | b448962 | 2007-07-05 08:17:37 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 |
| 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Sergei Poselenov | b448962 | 2007-07-05 08:17:37 +0200 | [diff] [blame] | 6 | */ |
| 7 | /* |
| 8 | * This file is originally a part of the GCC testsuite. |
| 9 | */ |
| 10 | |
| 11 | #include <common.h> |
| 12 | |
Sergei Poselenov | b448962 | 2007-07-05 08:17:37 +0200 | [diff] [blame] | 13 | #include <post.h> |
| 14 | |
Yuri Tikhonov | ce82ff0 | 2008-12-20 14:54:21 +0300 | [diff] [blame] | 15 | GNU_FPOST_ATTR |
| 16 | |
Kumar Gala | e009cde | 2011-01-25 03:00:08 -0600 | [diff] [blame] | 17 | #if CONFIG_POST & CONFIG_SYS_POST_FPU |
| 18 | |
Sergei Poselenov | b448962 | 2007-07-05 08:17:37 +0200 | [diff] [blame] | 19 | static double func (const double *array) |
| 20 | { |
| 21 | double d = *array; |
| 22 | |
| 23 | if (d == 0.0) |
| 24 | return d; |
| 25 | else |
| 26 | return d + func (array + 1); |
| 27 | } |
| 28 | |
| 29 | int fpu_post_test_math5 (void) |
| 30 | { |
| 31 | double values[] = { 0.1e-100, 1.0, -1.0, 0.0 }; |
| 32 | |
| 33 | if (func (values) != 0.1e-100) { |
| 34 | post_log ("Error in FPU math5 test\n"); |
| 35 | return -1; |
| 36 | } |
| 37 | return 0; |
| 38 | } |
| 39 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 40 | #endif /* CONFIG_POST & CONFIG_SYS_POST_FPU */ |