1*3527e1abSAlistair Popple/* SPDX-License-Identifier: GPL-2.0-or-later
2*3527e1abSAlistair Popple *
3*3527e1abSAlistair Popple * Test basic matrix multiply assist (MMA) functionality if available.
4*3527e1abSAlistair Popple *
5*3527e1abSAlistair Popple * Copyright 2020, Alistair Popple, IBM Corp.
6*3527e1abSAlistair Popple */
7*3527e1abSAlistair Popple	.global test_mma
8*3527e1abSAlistair Poppletest_mma:
9*3527e1abSAlistair Popple	/* Load accumulator via VSX registers from image passed in r3 */
10*3527e1abSAlistair Popple	lxvh8x	4,0,3
11*3527e1abSAlistair Popple	lxvh8x	5,0,4
12*3527e1abSAlistair Popple
13*3527e1abSAlistair Popple	/* Clear and prime the accumulator (xxsetaccz) */
14*3527e1abSAlistair Popple	.long	0x7c030162
15*3527e1abSAlistair Popple
16*3527e1abSAlistair Popple	/* Prime the accumulator with MMA VSX move to accumulator
17*3527e1abSAlistair Popple	* X-form (xxmtacc) (not needed due to above zeroing) */
18*3527e1abSAlistair Popple	//.long 0x7c010162
19*3527e1abSAlistair Popple
20*3527e1abSAlistair Popple	/* xvi16ger2s */
21*3527e1abSAlistair Popple	.long	0xec042958
22*3527e1abSAlistair Popple
23*3527e1abSAlistair Popple	/* Store result in image passed in r5 */
24*3527e1abSAlistair Popple	stxvw4x	0,0,5
25*3527e1abSAlistair Popple	addi	5,5,16
26*3527e1abSAlistair Popple	stxvw4x	1,0,5
27*3527e1abSAlistair Popple	addi	5,5,16
28*3527e1abSAlistair Popple	stxvw4x	2,0,5
29*3527e1abSAlistair Popple	addi	5,5,16
30*3527e1abSAlistair Popple	stxvw4x	3,0,5
31*3527e1abSAlistair Popple	addi	5,5,16
32*3527e1abSAlistair Popple
33*3527e1abSAlistair Popple	blr
34