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>
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
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)
} else
puts(PASS);
+ print_test_number(5);
+ if (test_bdnzl() != 0) {
+ fail = 1;
+ puts(FAIL);
+ } else
+ puts(PASS);
+
return fail;
}
Test 02:PASS\r
Test 03:PASS\r
Test 04:PASS\r
+Test 05:PASS\r