]>
git.ipfire.org Git - thirdparty/u-boot.git/blob - post/lib_powerpc/cmpi.c
1 // SPDX-License-Identifier: GPL-2.0+
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
11 * Integer compare instructions: cmpwi, cmplwi
13 * To verify these instructions the test runs them with
14 * different combinations of operands, reads the condition
15 * register value and compares it with the expected one.
16 * The test contains a pre-built table
17 * containing the description of each test case: the instruction,
18 * the values of the operands, the condition field to save
19 * the result in and the expected result.
25 #if CONFIG_POST & CONFIG_SYS_POST_CPU
27 extern void cpu_post_exec_11 (ulong
*code
, ulong
*res
, ulong op1
);
29 static struct cpu_post_cmpi_s
36 } cpu_post_cmpi_table
[] =
81 static unsigned int cpu_post_cmpi_size
= ARRAY_SIZE(cpu_post_cmpi_table
);
83 int cpu_post_test_cmpi (void)
87 int flag
= disable_interrupts();
89 for (i
= 0; i
< cpu_post_cmpi_size
&& ret
== 0; i
++)
91 struct cpu_post_cmpi_s
*test
= cpu_post_cmpi_table
+ i
;
92 unsigned long code
[] =
94 ASM_1IC(test
->cmd
, test
->cr
, 3, test
->op2
),
100 cpu_post_exec_11 (code
, & res
, test
->op1
);
102 ret
= ((res
>> (28 - 4 * test
->cr
)) & 0xe) == test
->res
? 0 : -1;
106 post_log ("Error at cmpi test %d !\n", i
);