blob: eddd3f915eed27bce2b8a651291b6ce42d985db3 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Sergei Poselenovb4489622007-07-05 08:17:37 +02002/*
3 * Copyright (C) 2007
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
Sergei Poselenovb4489622007-07-05 08:17:37 +02005 */
6/*
7 * This file is originally a part of the GCC testsuite.
8 */
9
10#include <common.h>
11
Sergei Poselenovb4489622007-07-05 08:17:37 +020012#include <post.h>
13
Yuri Tikhonovce82ff02008-12-20 14:54:21 +030014GNU_FPOST_ATTR
15
Tom Rini9cebc4a2022-11-19 18:45:44 -050016#if CFG_POST & CONFIG_SYS_POST_FPU
Kumar Galae009cde2011-01-25 03:00:08 -060017
Sergei Poselenovb4489622007-07-05 08:17:37 +020018int fpu_post_test_math1 (void)
19{
Stefan Roese944416e2011-11-15 08:02:43 +000020 volatile double a;
Sergei Poselenovb4489622007-07-05 08:17:37 +020021 double c, d;
22 volatile double b;
23
24 d = 1.0;
Sergei Poselenovb4489622007-07-05 08:17:37 +020025
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
Tom Rini9cebc4a2022-11-19 18:45:44 -050043#endif /* CFG_POST & CONFIG_SYS_POST_FPU */