3
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5
* See file CREDITS for list of people who contributed to this
8
* This program is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU General Public License as
10
* published by the Free Software Foundation; either version 2 of
11
* the License, or (at your option) any later version.
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28
* Complex calculations
30
* The calculations in this test are just a combination of simpler
31
* calculations, but probably under different timing conditions, etc.
37
#if CONFIG_POST & CONFIG_SYS_POST_CPU
39
extern int cpu_post_complex_1_asm (int a1, int a2, int a3, int a4, int n);
40
extern int cpu_post_complex_2_asm (int x, int n);
44
* SUM (a1 * a2 - a3) / a4 = n * result
47
static int cpu_post_test_complex_1 (void)
54
int result = 6720; /* (a1 * a2 - a3) / a4 */
56
if (cpu_post_complex_1_asm(a1, a2, a3, a4, n) != n * result)
64
/* (1 + x + x^2 + ... + x^n) * (1 - x) = 1 - x^(n+1)
66
static int cpu_post_test_complex_2 (void)
75
for (x = -8; x <= 8; x ++)
79
left = cpu_post_complex_2_asm(x, n);
83
for (k = 0; k <= n; k ++)
101
int cpu_post_test_complex (void)
104
int flag = disable_interrupts();
108
ret = cpu_post_test_complex_1();
113
ret = cpu_post_test_complex_2();
118
post_log ("Error at complex test !\n");