From ba349144651bc5b0ebe28aa38ac802a75ecaa0bb Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Tue, 31 Aug 2021 11:45:57 +1000 Subject: [PATCH] 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 --- tests/misc/head.S | 23 +++++++++++++++++++++++ tests/misc/misc.c | 8 ++++++++ tests/test_misc.bin | Bin 5740 -> 5804 bytes tests/test_misc.console_out | 1 + 4 files changed, 32 insertions(+) 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 2264686c06a630733a71d56de90ea1a1f3925baf..648ab184ab362a9a3c1ba0c554df4f1ceb96bb3e 100755 GIT binary patch delta 549 zcmaE(vqpDA0%O33{|hY`7+7C0Fff4VA88B+EXo-k0ND%)3=B>{45AU3iQ(uBW`?IT zKzg1uAFFtB@Oedr_3@eji-Z~lh6caQiHre!lLSm$CzK{z2rw}IxcFc3hb}XN2gs0X zzyH-6Fw|RcG5nX`!k%0+kqIIm@S(oOfFaoeBvuO*vtmfFD4bj=V9e+_d98r7AO~ZU z>L;KHpJaqMixp_q+JFDOXTJaM4RR&} zgR)Kqn%cQgwFV4|78SoA*QWs0gPg+vbWQ@$IkixEjsFmFkXR;E%mE^1W&;uog$l+X zDRhL2RUnD!Ld7O*_7w7GWL&X%rm!{>