tests/misc: Add a test for a load that hits two preceding stores

This checks that the store forwarding machinery in the dcache
correctly combines forwarded stores when they are partial stores
(i.e. only writing part of the doubleword, as for a byte store).

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
dcache-nc-fix
Paul Mackerras 3 years ago
parent 0b23a5e760
commit ba34914465

@ -162,3 +162,26 @@ test_bdnzl:
li %r3,0
9: mtlr %r10
blr

/* Test that a load that hits stores gets the correct data */
.global test_loadhitstore
test_loadhitstore:
addi %r5,%r1,-16
ld %r0,0(%r5)
li %r0,0
std %r0,0(%r5)
li %r6,0x66
li %r7,0x77
.balign 64
nop
nop
nop
nop
stb %r6,2(%r5)
stb %r7,3(%r5)
ld %r0,0(%r5)
sldi %r6,%r6,16
sldi %r7,%r7,24
or %r7,%r6,%r7
subf %r3,%r0,%r7
blr

@ -15,6 +15,7 @@ extern long test_addpcis_2(void);
extern long test_mfpvr(void);
extern long test_mtpvr(void);
extern long test_bdnzl(void);
extern long test_loadhitstore(void);

// i < 100
void print_test_number(int i)
@ -66,5 +67,12 @@ int main(void)
} else
puts(PASS);

print_test_number(6);
if (test_loadhitstore() != 0) {
fail = 1;
puts(FAIL);
} else
puts(PASS);

return fail;
}

Binary file not shown.

@ -3,3 +3,4 @@ Test 02:PASS
Test 03:PASS
Test 04:PASS
Test 05:PASS
Test 06:PASS

Loading…
Cancel
Save