blob: caf529701bdd55a94813bdf18631d3b9a838523e [file] [log] [blame]
Sergei Poselenov3190dbe2007-07-05 08:17:37 +02001/*
2 * Copyright (C) 2007
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Sergei Poselenov3190dbe2007-07-05 08:17:37 +02006 */
7/*
8 * This file is originally a part of the GCC testsuite.
9 */
10
11#include <common.h>
12
Sergei Poselenov3190dbe2007-07-05 08:17:37 +020013#include <post.h>
14
Yuri Tikhonov7ed66f72008-12-20 14:54:21 +030015GNU_FPOST_ATTR
16
Kumar Galafe6555b2011-01-25 03:00:08 -060017#if CONFIG_POST & CONFIG_SYS_POST_FPU
18
Sergei Poselenov3190dbe2007-07-05 08:17:37 +020019int fpu_post_test_math1 (void)
20{
Stefan Roesefa3308c2011-11-15 08:02:43 +000021 volatile double a;
Sergei Poselenov3190dbe2007-07-05 08:17:37 +020022 double c, d;
23 volatile double b;
24
25 d = 1.0;
Sergei Poselenov3190dbe2007-07-05 08:17:37 +020026
27 do
28 {
29 c = d;
30 d = c * 0.5;
31 b = 1 + d;
32 } while (b != 1.0);
33
34 a = 1.0 + c;
35
36 if (a == 1.0) {
37 post_log ("Error in FPU math1 test\n");
38 return -1;
39 }
40
41 return 0;
42}
43
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020044#endif /* CONFIG_POST & CONFIG_SYS_POST_FPU */