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.
39 #if CONFIG_POST & CFG_POST_CPU
41 extern int cpu_post_complex_1_asm (int a1, int a2, int a3, int a4, int n);
42 extern int cpu_post_complex_2_asm (int x, int n);
46 * SUM (a1 * a2 - a3) / a4 = n * result
49 static int cpu_post_test_complex_1 (void)
56 int result = 6720; /* (a1 * a2 - a3) / a4 */
58 if (cpu_post_complex_1_asm(a1, a2, a3, a4, n) != n * result)
66 /* (1 + x + x^2 + ... + x^n) * (1 - x) = 1 - x^(n+1)
68 static int cpu_post_test_complex_2 (void)
77 for (x = -8; x <= 8; x ++)
81 left = cpu_post_complex_2_asm(x, n);
85 for (k = 0; k <= n; k ++)
103 int cpu_post_test_complex (void)
109 ret = cpu_post_test_complex_1();
114 ret = cpu_post_test_complex_2();
119 post_log ("Error at complex test !\n");