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