• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
fpu_post_test_math1(void)18 int fpu_post_test_math1 (void)
19 {
20 	volatile double a;
21 	double c, d;
22 	volatile double b;
23 
24 	d = 1.0;
25 
26 	do
27 	{
28 		c = d;
29 		d = c * 0.5;
30 		b = 1 + d;
31 	} while (b != 1.0);
32 
33 	a = 1.0 + c;
34 
35 	if (a == 1.0) {
36 		post_log ("Error in FPU math1 test\n");
37 		return -1;
38 	}
39 
40 	return 0;
41 }
42 
43 #endif /* CONFIG_POST & CONFIG_SYS_POST_FPU */
44