diff mbox series

selftests/powerpc: Fix matrix multiply assist test

Message ID 20220617043935.428083-1-rashmica@linux.ibm.com (mailing list archive)
State Accepted
Headers show
Series selftests/powerpc: Fix matrix multiply assist test | expand

Checks

Context Check Description
snowpatch_ozlabs/github-powerpc_ppctests success Successfully ran 10 jobs.
snowpatch_ozlabs/github-powerpc_selftests success Successfully ran 10 jobs.
snowpatch_ozlabs/github-powerpc_clang warning kernel (ppc44x, ubuntu-21.10, ppc64) found 2 issues.
snowpatch_ozlabs/github-powerpc_sparse success Successfully ran 4 jobs.
snowpatch_ozlabs/github-powerpc_kernel_qemu success Successfully ran 23 jobs.

Commit Message

Rashmica Gupta June 17, 2022, 4:39 a.m. UTC
The ISA states: "when ACC[i] contains defined data, the contents of VSRs
4×i to 4×i+3 are undefined until either a VSX Move From ACC instruction
is used to copy the contents of ACC[i] to VSRs 4×i to 4×i+3 or some other
instruction directly writes to one of these VSRs." We aren't doing this.

This test only works on Power10 because the hardware implementation
happens to map ACC0 to VSRs 0-3, but will fail on any other implementation
that doesn't do this. So add xxmfacc between writing to the accumulator
and accessing the VSRs.

Fixes commit 3527e1ab9a79 ("selftests/powerpc: Add matrix multiply assist
(MMA) test")

Signed-off-by: Rashmica Gupta <rashmica@linux.ibm.com>
---
 tools/testing/selftests/powerpc/math/mma.S | 3 +++
 1 file changed, 3 insertions(+)

Comments

Michael Ellerman July 29, 2022, 1:03 p.m. UTC | #1
On Fri, 17 Jun 2022 14:39:35 +1000, Rashmica Gupta wrote:
> The ISA states: "when ACC[i] contains defined data, the contents of VSRs
> 4×i to 4×i+3 are undefined until either a VSX Move From ACC instruction
> is used to copy the contents of ACC[i] to VSRs 4×i to 4×i+3 or some other
> instruction directly writes to one of these VSRs." We aren't doing this.
> 
> This test only works on Power10 because the hardware implementation
> happens to map ACC0 to VSRs 0-3, but will fail on any other implementation
> that doesn't do this. So add xxmfacc between writing to the accumulator
> and accessing the VSRs.
> 
> [...]

Applied to powerpc/next.

[1/1] selftests/powerpc: Fix matrix multiply assist test
      https://git.kernel.org/powerpc/c/cd1e64935f79e31d666172c52c951ca97152b783

cheers
diff mbox series

Patch

diff --git a/tools/testing/selftests/powerpc/math/mma.S b/tools/testing/selftests/powerpc/math/mma.S
index 8528c9849565..61cc88b1b26b 100644
--- a/tools/testing/selftests/powerpc/math/mma.S
+++ b/tools/testing/selftests/powerpc/math/mma.S
@@ -20,6 +20,9 @@  test_mma:
 	/* xvi16ger2s */
 	.long	0xec042958
 
+	/* Deprime the accumulator - xxmfacc 0 */
+	.long 0x7c000162
+
 	/* Store result in image passed in r5 */
 	stxvw4x	0,0,5
 	addi	5,5,16