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 | |
| 10 | #include <common.h> |
| 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 | |
Kumar Gala | fe6555b | 2011-01-25 03:00:08 -0600 | [diff] [blame] | 16 | #if CONFIG_POST & CONFIG_SYS_POST_FPU |
| 17 | |
Sergei Poselenov | 3190dbe | 2007-07-05 08:17:37 +0200 | [diff] [blame] | 18 | int fpu_post_test_math1 (void) |
| 19 | { |
Stefan Roese | fa3308c | 2011-11-15 08:02:43 +0000 | [diff] [blame] | 20 | volatile double a; |
Sergei Poselenov | 3190dbe | 2007-07-05 08:17:37 +0200 | [diff] [blame] | 21 | double c, d; |
| 22 | volatile double b; |
| 23 | |
| 24 | d = 1.0; |
Sergei Poselenov | 3190dbe | 2007-07-05 08:17:37 +0200 | [diff] [blame] | 25 | |
| 26 | do |
| 27 | { |
| 28 | c = d; |
| 29 | d = c * 0.5; |
| 30 | b = 1 + d; |
| 31 | } while (b != 1.0); |
| 32 | |
| 33 | a = 1.0 + c; |
| 34 | |
| 35 | if (a == 1.0) { |
| 36 | post_log ("Error in FPU math1 test\n"); |
| 37 | return -1; |
| 38 | } |
| 39 | |
| 40 | return 0; |
| 41 | } |
| 42 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 43 | #endif /* CONFIG_POST & CONFIG_SYS_POST_FPU */ |