2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2007-07-05 06:17:37 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2007
|
|
|
|
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* This file is originally a part of the GCC testsuite.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
|
|
|
|
#include <post.h>
|
|
|
|
|
2008-12-20 11:54:21 +00:00
|
|
|
GNU_FPOST_ATTR
|
|
|
|
|
2022-12-04 15:14:17 +00:00
|
|
|
#if CFG_POST & CFG_SYS_POST_FPU
|
2011-01-25 09:00:08 +00:00
|
|
|
|
2007-07-05 06:17:37 +00:00
|
|
|
int fpu_post_test_math4 (void)
|
|
|
|
{
|
|
|
|
volatile float reale = 1.0f;
|
|
|
|
volatile float oneplus;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (sizeof (float) != 4)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
for (i = 0; ; i++)
|
|
|
|
{
|
|
|
|
oneplus = 1.0f + reale;
|
|
|
|
if (oneplus == 1.0f)
|
|
|
|
break;
|
|
|
|
reale = reale / 2.0f;
|
|
|
|
}
|
|
|
|
/* Assumes ieee754 accurate arithmetic above. */
|
|
|
|
if (i != 24) {
|
|
|
|
post_log ("Error in FPU math4 test\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-12-04 15:14:17 +00:00
|
|
|
#endif /* CFG_POST & CFG_SYS_POST_FPU */
|