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 | int fpu_post_test_math4 (void) |
| 19 | { |
| 20 | volatile float reale = 1.0f; |
| 21 | volatile float oneplus; |
| 22 | int i; |
| 23 | |
| 24 | if (sizeof (float) != 4) |
| 25 | return 0; |
| 26 | |
| 27 | for (i = 0; ; i++) |
| 28 | { |
| 29 | oneplus = 1.0f + reale; |
| 30 | if (oneplus == 1.0f) |
| 31 | break; |
| 32 | reale = reale / 2.0f; |
| 33 | } |
| 34 | /* Assumes ieee754 accurate arithmetic above. */ |
| 35 | if (i != 24) { |
| 36 | post_log ("Error in FPU math4 test\n"); |
| 37 | return -1; |
| 38 | } |
| 39 | return 0; |
| 40 | } |
| 41 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 42 | #endif /* CONFIG_POST & CONFIG_SYS_POST_FPU */ |