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