xref: /openbmc/u-boot/post/lib_powerpc/fpu/20010226-1.c (revision e009cdeb63308f291c54b173484401aab4a3fe54)
1a47a12beSStefan Roese /*
2a47a12beSStefan Roese  * Copyright (C) 2007
3a47a12beSStefan Roese  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4a47a12beSStefan Roese  *
5a47a12beSStefan Roese  * See file CREDITS for list of people who contributed to this
6a47a12beSStefan Roese  * project.
7a47a12beSStefan Roese  *
8a47a12beSStefan Roese  * This program is free software; you can redistribute it and/or
9a47a12beSStefan Roese  * modify it under the terms of the GNU General Public License as
10a47a12beSStefan Roese  * published by the Free Software Foundation; either version 2 of
11a47a12beSStefan Roese  * the License, or (at your option) any later version.
12a47a12beSStefan Roese  *
13a47a12beSStefan Roese  * This program is distributed in the hope that it will be useful,
14a47a12beSStefan Roese  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15a47a12beSStefan Roese  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16a47a12beSStefan Roese  * GNU General Public License for more details.
17a47a12beSStefan Roese  *
18a47a12beSStefan Roese  * You should have received a copy of the GNU General Public License
19a47a12beSStefan Roese  * along with this program; if not, write to the Free Software
20a47a12beSStefan Roese  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21a47a12beSStefan Roese  * MA 02111-1307 USA
22a47a12beSStefan Roese  */
23a47a12beSStefan Roese /*
24a47a12beSStefan Roese  * This file is originally a part of the GCC testsuite.
25a47a12beSStefan Roese  */
26a47a12beSStefan Roese 
27a47a12beSStefan Roese #include <common.h>
28a47a12beSStefan Roese 
29a47a12beSStefan Roese #include <post.h>
30a47a12beSStefan Roese 
31a47a12beSStefan Roese GNU_FPOST_ATTR
32a47a12beSStefan Roese 
33*e009cdebSKumar Gala #if CONFIG_POST & CONFIG_SYS_POST_FPU
34*e009cdebSKumar Gala 
35a47a12beSStefan Roese int fpu_post_test_math3 (void)
36a47a12beSStefan Roese {
37a47a12beSStefan Roese 	volatile long double dfrom = 1.1;
38a47a12beSStefan Roese 	volatile long double m1;
39a47a12beSStefan Roese 	volatile long double m2;
40a47a12beSStefan Roese 	volatile unsigned long mant_long;
41a47a12beSStefan Roese 
42a47a12beSStefan Roese 	m1 = dfrom / 2.0;
43a47a12beSStefan Roese 	m2 = m1 * 4294967296.0;
44a47a12beSStefan Roese 	mant_long = ((unsigned long) m2) & 0xffffffff;
45a47a12beSStefan Roese 
46a47a12beSStefan Roese 	if (mant_long != 0x8ccccccc) {
47a47a12beSStefan Roese 		post_log ("Error in FPU math3 test\n");
48a47a12beSStefan Roese 		return -1;
49a47a12beSStefan Roese 	}
50a47a12beSStefan Roese 	return 0;
51a47a12beSStefan Roese }
52a47a12beSStefan Roese 
53a47a12beSStefan Roese #endif /* CONFIG_POST & CONFIG_SYS_POST_FPU */
54