xref: /linux/tools/testing/selftests/powerpc/math/mma.S (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
13527e1abSAlistair Popple/* SPDX-License-Identifier: GPL-2.0-or-later
23527e1abSAlistair Popple *
33527e1abSAlistair Popple * Test basic matrix multiply assist (MMA) functionality if available.
43527e1abSAlistair Popple *
53527e1abSAlistair Popple * Copyright 2020, Alistair Popple, IBM Corp.
63527e1abSAlistair Popple */
73527e1abSAlistair Popple	.global test_mma
83527e1abSAlistair Poppletest_mma:
93527e1abSAlistair Popple	/* Load accumulator via VSX registers from image passed in r3 */
103527e1abSAlistair Popple	lxvh8x	4,0,3
113527e1abSAlistair Popple	lxvh8x	5,0,4
123527e1abSAlistair Popple
133527e1abSAlistair Popple	/* Clear and prime the accumulator (xxsetaccz) */
143527e1abSAlistair Popple	.long	0x7c030162
153527e1abSAlistair Popple
163527e1abSAlistair Popple	/* Prime the accumulator with MMA VSX move to accumulator
173527e1abSAlistair Popple	* X-form (xxmtacc) (not needed due to above zeroing) */
183527e1abSAlistair Popple	//.long 0x7c010162
193527e1abSAlistair Popple
203527e1abSAlistair Popple	/* xvi16ger2s */
213527e1abSAlistair Popple	.long	0xec042958
223527e1abSAlistair Popple
23*cd1e6493SRashmica Gupta	/* Deprime the accumulator - xxmfacc 0 */
24*cd1e6493SRashmica Gupta	.long 0x7c000162
25*cd1e6493SRashmica Gupta
263527e1abSAlistair Popple	/* Store result in image passed in r5 */
273527e1abSAlistair Popple	stxvw4x	0,0,5
283527e1abSAlistair Popple	addi	5,5,16
293527e1abSAlistair Popple	stxvw4x	1,0,5
303527e1abSAlistair Popple	addi	5,5,16
313527e1abSAlistair Popple	stxvw4x	2,0,5
323527e1abSAlistair Popple	addi	5,5,16
333527e1abSAlistair Popple	stxvw4x	3,0,5
343527e1abSAlistair Popple	addi	5,5,16
353527e1abSAlistair Popple
363527e1abSAlistair Popple	blr
37