xref: /linux/tools/testing/selftests/powerpc/include/vmx_asm.h (revision 75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37)
1*2874c5fdSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
215ec3997SSimon Guo /*
315ec3997SSimon Guo  * Copyright 2015, Cyril Bur, IBM Corp.
415ec3997SSimon Guo  */
515ec3997SSimon Guo 
615ec3997SSimon Guo #include "basic_asm.h"
715ec3997SSimon Guo 
815ec3997SSimon Guo /* POS MUST BE 16 ALIGNED! */
915ec3997SSimon Guo #define PUSH_VMX(pos,reg) \
1015ec3997SSimon Guo 	li	reg,pos; \
1115ec3997SSimon Guo 	stvx	v20,reg,%r1; \
1215ec3997SSimon Guo 	addi	reg,reg,16; \
1315ec3997SSimon Guo 	stvx	v21,reg,%r1; \
1415ec3997SSimon Guo 	addi	reg,reg,16; \
1515ec3997SSimon Guo 	stvx	v22,reg,%r1; \
1615ec3997SSimon Guo 	addi	reg,reg,16; \
1715ec3997SSimon Guo 	stvx	v23,reg,%r1; \
1815ec3997SSimon Guo 	addi	reg,reg,16; \
1915ec3997SSimon Guo 	stvx	v24,reg,%r1; \
2015ec3997SSimon Guo 	addi	reg,reg,16; \
2115ec3997SSimon Guo 	stvx	v25,reg,%r1; \
2215ec3997SSimon Guo 	addi	reg,reg,16; \
2315ec3997SSimon Guo 	stvx	v26,reg,%r1; \
2415ec3997SSimon Guo 	addi	reg,reg,16; \
2515ec3997SSimon Guo 	stvx	v27,reg,%r1; \
2615ec3997SSimon Guo 	addi	reg,reg,16; \
2715ec3997SSimon Guo 	stvx	v28,reg,%r1; \
2815ec3997SSimon Guo 	addi	reg,reg,16; \
2915ec3997SSimon Guo 	stvx	v29,reg,%r1; \
3015ec3997SSimon Guo 	addi	reg,reg,16; \
3115ec3997SSimon Guo 	stvx	v30,reg,%r1; \
3215ec3997SSimon Guo 	addi	reg,reg,16; \
3315ec3997SSimon Guo 	stvx	v31,reg,%r1;
3415ec3997SSimon Guo 
3515ec3997SSimon Guo /* POS MUST BE 16 ALIGNED! */
3615ec3997SSimon Guo #define POP_VMX(pos,reg) \
3715ec3997SSimon Guo 	li	reg,pos; \
3815ec3997SSimon Guo 	lvx	v20,reg,%r1; \
3915ec3997SSimon Guo 	addi	reg,reg,16; \
4015ec3997SSimon Guo 	lvx	v21,reg,%r1; \
4115ec3997SSimon Guo 	addi	reg,reg,16; \
4215ec3997SSimon Guo 	lvx	v22,reg,%r1; \
4315ec3997SSimon Guo 	addi	reg,reg,16; \
4415ec3997SSimon Guo 	lvx	v23,reg,%r1; \
4515ec3997SSimon Guo 	addi	reg,reg,16; \
4615ec3997SSimon Guo 	lvx	v24,reg,%r1; \
4715ec3997SSimon Guo 	addi	reg,reg,16; \
4815ec3997SSimon Guo 	lvx	v25,reg,%r1; \
4915ec3997SSimon Guo 	addi	reg,reg,16; \
5015ec3997SSimon Guo 	lvx	v26,reg,%r1; \
5115ec3997SSimon Guo 	addi	reg,reg,16; \
5215ec3997SSimon Guo 	lvx	v27,reg,%r1; \
5315ec3997SSimon Guo 	addi	reg,reg,16; \
5415ec3997SSimon Guo 	lvx	v28,reg,%r1; \
5515ec3997SSimon Guo 	addi	reg,reg,16; \
5615ec3997SSimon Guo 	lvx	v29,reg,%r1; \
5715ec3997SSimon Guo 	addi	reg,reg,16; \
5815ec3997SSimon Guo 	lvx	v30,reg,%r1; \
5915ec3997SSimon Guo 	addi	reg,reg,16; \
6015ec3997SSimon Guo 	lvx	v31,reg,%r1;
6115ec3997SSimon Guo 
6215ec3997SSimon Guo /*
6315ec3997SSimon Guo  * Careful this will 'clobber' vmx (by design)
6415ec3997SSimon Guo  * Don't call this from C
6515ec3997SSimon Guo  */
6615ec3997SSimon Guo FUNC_START(load_vmx)
6715ec3997SSimon Guo 	li	r5,0
6815ec3997SSimon Guo 	lvx	v20,r5,r3
6915ec3997SSimon Guo 	addi	r5,r5,16
7015ec3997SSimon Guo 	lvx	v21,r5,r3
7115ec3997SSimon Guo 	addi	r5,r5,16
7215ec3997SSimon Guo 	lvx	v22,r5,r3
7315ec3997SSimon Guo 	addi	r5,r5,16
7415ec3997SSimon Guo 	lvx	v23,r5,r3
7515ec3997SSimon Guo 	addi	r5,r5,16
7615ec3997SSimon Guo 	lvx	v24,r5,r3
7715ec3997SSimon Guo 	addi	r5,r5,16
7815ec3997SSimon Guo 	lvx	v25,r5,r3
7915ec3997SSimon Guo 	addi	r5,r5,16
8015ec3997SSimon Guo 	lvx	v26,r5,r3
8115ec3997SSimon Guo 	addi	r5,r5,16
8215ec3997SSimon Guo 	lvx	v27,r5,r3
8315ec3997SSimon Guo 	addi	r5,r5,16
8415ec3997SSimon Guo 	lvx	v28,r5,r3
8515ec3997SSimon Guo 	addi	r5,r5,16
8615ec3997SSimon Guo 	lvx	v29,r5,r3
8715ec3997SSimon Guo 	addi	r5,r5,16
8815ec3997SSimon Guo 	lvx	v30,r5,r3
8915ec3997SSimon Guo 	addi	r5,r5,16
9015ec3997SSimon Guo 	lvx	v31,r5,r3
9115ec3997SSimon Guo 	blr
9215ec3997SSimon Guo FUNC_END(load_vmx)
93