3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * SPDX-License-Identifier: GPL-2.0+
12 * Integer compare instructions: cmpw, cmplw
14 * To verify these instructions the test runs them with
15 * different combinations of operands, reads the condition
16 * register value and compares it with the expected one.
17 * The test contains a pre-built table
18 * containing the description of each test case: the instruction,
19 * the values of the operands, the condition field to save
20 * the result in and the expected result.
26 #if CONFIG_POST & CONFIG_SYS_POST_CPU
28 extern void cpu_post_exec_12 (ulong *code, ulong *res, ulong op1, ulong op2);
30 static struct cpu_post_cmp_s
37 } cpu_post_cmp_table[] =
82 static unsigned int cpu_post_cmp_size = ARRAY_SIZE(cpu_post_cmp_table);
84 int cpu_post_test_cmp (void)
88 int flag = disable_interrupts();
90 for (i = 0; i < cpu_post_cmp_size && ret == 0; i++)
92 struct cpu_post_cmp_s *test = cpu_post_cmp_table + i;
93 unsigned long code[] =
95 ASM_2C(test->cmd, test->cr, 3, 4),
101 cpu_post_exec_12 (code, & res, test->op1, test->op2);
103 ret = ((res >> (28 - 4 * test->cr)) & 0xe) == test->res ? 0 : -1;
107 post_log ("Error at cmp test %d !\n", i);