From: Paul Mackerras Date: Tue, 31 Aug 2021 01:45:57 +0000 (+1000) Subject: tests/misc: Add a test for a load that hits two preceding stores X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ba349144651bc5b0ebe28aa38ac802a75ecaa0bb;p=microwatt.git 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 --- diff --git a/tests/misc/head.S b/tests/misc/head.S index d490a61..9044c51 100644 --- a/tests/misc/head.S +++ b/tests/misc/head.S @@ -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 diff --git a/tests/misc/misc.c b/tests/misc/misc.c index 73745d9..3cc0300 100644 --- a/tests/misc/misc.c +++ b/tests/misc/misc.c @@ -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; } diff --git a/tests/test_misc.bin b/tests/test_misc.bin index 2264686..648ab18 100755 Binary files a/tests/test_misc.bin and b/tests/test_misc.bin differ diff --git a/tests/test_misc.console_out b/tests/test_misc.console_out index e59c03f..5296101 100644 --- a/tests/test_misc.console_out +++ b/tests/test_misc.console_out @@ -3,3 +3,4 @@ Test 02:PASS Test 03:PASS Test 04:PASS Test 05:PASS +Test 06:PASS