xref: /openbmc/u-boot/post/lib_powerpc/fpu/20010226-1.c (revision 83d290c56fab2d38cd1ab4c4cc7099559c1d5046)
1*83d290c5STom Rini // SPDX-License-Identifier: GPL-2.0+
2a47a12beSStefan Roese /*
3a47a12beSStefan Roese  * Copyright (C) 2007
4a47a12beSStefan Roese  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5a47a12beSStefan Roese  */
6a47a12beSStefan Roese /*
7a47a12beSStefan Roese  * This file is originally a part of the GCC testsuite.
8a47a12beSStefan Roese  */
9a47a12beSStefan Roese 
10a47a12beSStefan Roese #include <common.h>
11a47a12beSStefan Roese 
12a47a12beSStefan Roese #include <post.h>
13a47a12beSStefan Roese 
14a47a12beSStefan Roese GNU_FPOST_ATTR
15a47a12beSStefan Roese 
16e009cdebSKumar Gala #if CONFIG_POST & CONFIG_SYS_POST_FPU
17e009cdebSKumar Gala 
fpu_post_test_math3(void)18a47a12beSStefan Roese int fpu_post_test_math3 (void)
19a47a12beSStefan Roese {
20a47a12beSStefan Roese 	volatile long double dfrom = 1.1;
21a47a12beSStefan Roese 	volatile long double m1;
22a47a12beSStefan Roese 	volatile long double m2;
23a47a12beSStefan Roese 	volatile unsigned long mant_long;
24a47a12beSStefan Roese 
25a47a12beSStefan Roese 	m1 = dfrom / 2.0;
26a47a12beSStefan Roese 	m2 = m1 * 4294967296.0;
27a47a12beSStefan Roese 	mant_long = ((unsigned long) m2) & 0xffffffff;
28a47a12beSStefan Roese 
29a47a12beSStefan Roese 	if (mant_long != 0x8ccccccc) {
30a47a12beSStefan Roese 		post_log ("Error in FPU math3 test\n");
31a47a12beSStefan Roese 		return -1;
32a47a12beSStefan Roese 	}
33a47a12beSStefan Roese 	return 0;
34a47a12beSStefan Roese }
35a47a12beSStefan Roese 
36a47a12beSStefan Roese #endif /* CONFIG_POST & CONFIG_SYS_POST_FPU */
37