3
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5
* SPDX-License-Identifier: GPL-2.0+
12
* Ternary instructions instr rA,rS,rB
14
* Logic instructions: or, orc, xor, nand, nor, eqv
15
* Shift instructions: slw, srw, sraw
17
* The test contains a pre-built table of instructions, operands and
18
* expected results. For each table entry, the test will cyclically use
19
* different sets of operand registers and result registers.
25
#if CONFIG_POST & CONFIG_SYS_POST_CPU
27
extern void cpu_post_exec_22 (ulong *code, ulong *cr, ulong *res, ulong op1,
29
extern ulong cpu_post_makecr (long v);
31
static struct cpu_post_threex_s
37
} cpu_post_threex_table[] =
112
static unsigned int cpu_post_threex_size = ARRAY_SIZE(cpu_post_threex_table);
114
int cpu_post_test_threex (void)
118
int flag = disable_interrupts();
120
for (i = 0; i < cpu_post_threex_size && ret == 0; i++)
122
struct cpu_post_threex_s *test = cpu_post_threex_table + i;
124
for (reg = 0; reg < 32 && ret == 0; reg++)
126
unsigned int reg0 = (reg + 0) % 32;
127
unsigned int reg1 = (reg + 1) % 32;
128
unsigned int reg2 = (reg + 2) % 32;
129
unsigned int stk = reg < 16 ? 31 : 15;
130
unsigned long code[] =
133
ASM_ADDI(stk, 1, -24),
136
ASM_STW(reg0, stk, 8),
137
ASM_STW(reg1, stk, 4),
138
ASM_STW(reg2, stk, 0),
139
ASM_LWZ(reg1, stk, 12),
140
ASM_LWZ(reg0, stk, 16),
141
ASM_12X(test->cmd, reg2, reg1, reg0),
142
ASM_STW(reg2, stk, 12),
143
ASM_LWZ(reg2, stk, 0),
144
ASM_LWZ(reg1, stk, 4),
145
ASM_LWZ(reg0, stk, 8),
147
ASM_ADDI(1, stk, 24),
151
unsigned long codecr[] =
154
ASM_ADDI(stk, 1, -24),
157
ASM_STW(reg0, stk, 8),
158
ASM_STW(reg1, stk, 4),
159
ASM_STW(reg2, stk, 0),
160
ASM_LWZ(reg1, stk, 12),
161
ASM_LWZ(reg0, stk, 16),
162
ASM_12X(test->cmd, reg2, reg1, reg0) | BIT_C,
163
ASM_STW(reg2, stk, 12),
164
ASM_LWZ(reg2, stk, 0),
165
ASM_LWZ(reg1, stk, 4),
166
ASM_LWZ(reg0, stk, 8),
168
ASM_ADDI(1, stk, 24),
178
cpu_post_exec_22 (code, & cr, & res, test->op1, test->op2);
180
ret = res == test->res && cr == 0 ? 0 : -1;
184
post_log ("Error at threex test %d !\n", i);
190
cpu_post_exec_22 (codecr, & cr, & res, test->op1, test->op2);
192
ret = res == test->res &&
193
(cr & 0xe0000000) == cpu_post_makecr (res) ? 0 : -1;
197
post_log ("Error at threex test %d !\n", i);