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