]> git.ipfire.org Git - thirdparty/u-boot.git/blame - post/lib_powerpc/fpu/20010114-2.c
Add GPL-2.0+ SPDX-License-Identifier to source files
[thirdparty/u-boot.git] / post / lib_powerpc / fpu / 20010114-2.c
CommitLineData
b4489621
SP
1/*
2 * Copyright (C) 2007
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
1a459660 5 * SPDX-License-Identifier: GPL-2.0+
b4489621
SP
6 */
7/*
8 * This file is originally a part of the GCC testsuite.
9 */
10
11#include <common.h>
12
b4489621
SP
13#include <post.h>
14
ce82ff05
YT
15GNU_FPOST_ATTR
16
e009cdeb
KG
17#if CONFIG_POST & CONFIG_SYS_POST_FPU
18
b4489621
SP
19static float rintf (float x)
20{
21 volatile float TWO23 = 8388608.0;
22
23 if (__builtin_fabs (x) < TWO23)
24 {
25 if (x > 0.0)
26 {
27 x += TWO23;
28 x -= TWO23;
29 }
30 else if (x < 0.0)
31 {
32 x = TWO23 - x;
33 x = -(x - TWO23);
34 }
35 }
36
37 return x;
38}
39
40int fpu_post_test_math2 (void)
41{
42 if (rintf (-1.5) != -2.0) {
43 post_log ("Error in FPU math2 test\n");
44 return -1;
45 }
46 return 0;
47}
48
6d0f6bcf 49#endif /* CONFIG_POST & CONFIG_SYS_POST_FPU */