mirror of
https://github.com/antonblanchard/microwatt.git
synced 2026-03-26 18:13:10 +00:00
tests/misc: Add a test for correct CTR and LR updating by branches
This adds a test with a bdnzl followed immediately by a bdnz, to check that CTR and LR both get evaluated and written back correctly in this situation. Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
This commit is contained in:
@@ -137,3 +137,28 @@ test_mtpvr:
|
||||
mtlr %r0
|
||||
|
||||
blr
|
||||
|
||||
/* Test that bdnz and bdnzl update CTR and LR correctly */
|
||||
.global test_bdnzl
|
||||
test_bdnzl:
|
||||
mflr %r10
|
||||
mfcr %r11
|
||||
li %r0,0xf8
|
||||
mtctr %r0
|
||||
lis %r0,0x2000
|
||||
mtcr %r0
|
||||
addpcis %r9,0
|
||||
1: bdnztl 27,3f
|
||||
2: bdnzt 14,4f
|
||||
3: nop
|
||||
4: li %r3,1
|
||||
addi %r9,%r9,2b-1b
|
||||
mflr %r8
|
||||
cmpd %r8,%r9
|
||||
bne 9f
|
||||
mfctr %r7
|
||||
cmpdi %r7,0xf6
|
||||
bne 9f
|
||||
li %r3,0
|
||||
9: mtlr %r10
|
||||
blr
|
||||
|
||||
@@ -14,6 +14,7 @@ extern long test_addpcis_1(void);
|
||||
extern long test_addpcis_2(void);
|
||||
extern long test_mfpvr(void);
|
||||
extern long test_mtpvr(void);
|
||||
extern long test_bdnzl(void);
|
||||
|
||||
// i < 100
|
||||
void print_test_number(int i)
|
||||
@@ -58,5 +59,12 @@ int main(void)
|
||||
} else
|
||||
puts(PASS);
|
||||
|
||||
print_test_number(5);
|
||||
if (test_bdnzl() != 0) {
|
||||
fail = 1;
|
||||
puts(FAIL);
|
||||
} else
|
||||
puts(PASS);
|
||||
|
||||
return fail;
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -2,3 +2,4 @@ Test 01:PASS
|
||||
Test 02:PASS
|
||||
Test 03:PASS
|
||||
Test 04:PASS
|
||||
Test 05:PASS
|
||||
|
||||
Reference in New Issue
Block a user