3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * SPDX-License-Identifier: GPL-2.0+
12 * Complex calculations
14 * The calculations in this test are just a combination of simpler
15 * calculations, but probably under different timing conditions, etc.
21 #if CONFIG_POST & CONFIG_SYS_POST_CPU
23 extern int cpu_post_complex_1_asm (int a1, int a2, int a3, int a4, int n);
24 extern int cpu_post_complex_2_asm (int x, int n);
28 * SUM (a1 * a2 - a3) / a4 = n * result
31 static int cpu_post_test_complex_1 (void)
38 int result = 6720; /* (a1 * a2 - a3) / a4 */
40 if (cpu_post_complex_1_asm(a1, a2, a3, a4, n) != n * result)
48 /* (1 + x + x^2 + ... + x^n) * (1 - x) = 1 - x^(n+1)
50 static int cpu_post_test_complex_2 (void)
59 for (x = -8; x <= 8; x ++)
63 left = cpu_post_complex_2_asm(x, n);
67 for (k = 0; k <= n; k ++)
85 int cpu_post_test_complex (void)
88 int flag = disable_interrupts();
92 ret = cpu_post_test_complex_1();
97 ret = cpu_post_test_complex_2();
102 post_log ("Error at complex test !\n");