]>
git.ipfire.org Git - thirdparty/u-boot.git/blob - post/lib_powerpc/cmpi.c
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * SPDX-License-Identifier: GPL-2.0+
12 * Integer compare instructions: cmpwi, cmplwi
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_11 (ulong
*code
, ulong
*res
, ulong op1
);
30 static struct cpu_post_cmpi_s
37 } cpu_post_cmpi_table
[] =
82 static unsigned int cpu_post_cmpi_size
= ARRAY_SIZE(cpu_post_cmpi_table
);
84 int cpu_post_test_cmpi (void)
88 int flag
= disable_interrupts();
90 for (i
= 0; i
< cpu_post_cmpi_size
&& ret
== 0; i
++)
92 struct cpu_post_cmpi_s
*test
= cpu_post_cmpi_table
+ i
;
93 unsigned long code
[] =
95 ASM_1IC(test
->cmd
, test
->cr
, 3, test
->op2
),
101 cpu_post_exec_11 (code
, & res
, test
->op1
);
103 ret
= ((res
>> (28 - 4 * test
->cr
)) & 0xe) == test
->res
? 0 : -1;
107 post_log ("Error at cmpi test %d !\n", i
);