xref: /openbmc/u-boot/post/lib_powerpc/fpu/acc1.c (revision 12308b12)
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2007
4  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5  */
6 /*
7  * This file is originally a part of the GCC testsuite.
8  */
9 
10 #include <common.h>
11 
12 #include <post.h>
13 
14 GNU_FPOST_ATTR
15 
16 #if CONFIG_POST & CONFIG_SYS_POST_FPU
17 
18 static double func (const double *array)
19 {
20 	double d = *array;
21 
22 	if (d == 0.0)
23 		return d;
24 	else
25 		return d + func (array + 1);
26 }
27 
28 int fpu_post_test_math5 (void)
29 {
30 	double values[] = { 0.1e-100, 1.0, -1.0, 0.0 };
31 
32 	if (func (values) != 0.1e-100) {
33 		post_log ("Error in FPU math5 test\n");
34 		return -1;
35 	}
36 	return 0;
37 }
38 
39 #endif /* CONFIG_POST & CONFIG_SYS_POST_FPU */
40