1 // SPDX-License-Identifier: GPL-2.0+
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
11 * Complex calculations
13 * The calculations in this test are just a combination of simpler
14 * calculations, but probably under different timing conditions, etc.
20 #if CONFIG_POST & CONFIG_SYS_POST_CPU
22 extern int cpu_post_complex_1_asm (int a1, int a2, int a3, int a4, int n);
23 extern int cpu_post_complex_2_asm (int x, int n);
27 * SUM (a1 * a2 - a3) / a4 = n * result
30 static int cpu_post_test_complex_1 (void)
37 int result = 6720; /* (a1 * a2 - a3) / a4 */
39 if (cpu_post_complex_1_asm(a1, a2, a3, a4, n) != n * result)
47 /* (1 + x + x^2 + ... + x^n) * (1 - x) = 1 - x^(n+1)
49 static int cpu_post_test_complex_2 (void)
58 for (x = -8; x <= 8; x ++)
62 left = cpu_post_complex_2_asm(x, n);
66 for (k = 0; k <= n; k ++)
84 int cpu_post_test_complex (void)
87 int flag = disable_interrupts();
91 ret = cpu_post_test_complex_1();
96 ret = cpu_post_test_complex_2();
101 post_log ("Error at complex test !\n");