Blame thirdparty/openblas/xianyi-OpenBLAS-e6e87a2/kernel/power/gemm_ncopy_4.S

kusano 2b45e8
/*********************************************************************/
kusano 2b45e8
/* Copyright 2009, 2010 The University of Texas at Austin.           */
kusano 2b45e8
/* All rights reserved.                                              */
kusano 2b45e8
/*                                                                   */
kusano 2b45e8
/* Redistribution and use in source and binary forms, with or        */
kusano 2b45e8
/* without modification, are permitted provided that the following   */
kusano 2b45e8
/* conditions are met:                                               */
kusano 2b45e8
/*                                                                   */
kusano 2b45e8
/*   1. Redistributions of source code must retain the above         */
kusano 2b45e8
/*      copyright notice, this list of conditions and the following  */
kusano 2b45e8
/*      disclaimer.                                                  */
kusano 2b45e8
/*                                                                   */
kusano 2b45e8
/*   2. Redistributions in binary form must reproduce the above      */
kusano 2b45e8
/*      copyright notice, this list of conditions and the following  */
kusano 2b45e8
/*      disclaimer in the documentation and/or other materials       */
kusano 2b45e8
/*      provided with the distribution.                              */
kusano 2b45e8
/*                                                                   */
kusano 2b45e8
/*    THIS  SOFTWARE IS PROVIDED  BY THE  UNIVERSITY OF  TEXAS AT    */
kusano 2b45e8
/*    AUSTIN  ``AS IS''  AND ANY  EXPRESS OR  IMPLIED WARRANTIES,    */
kusano 2b45e8
/*    INCLUDING, BUT  NOT LIMITED  TO, THE IMPLIED  WARRANTIES OF    */
kusano 2b45e8
/*    MERCHANTABILITY  AND FITNESS FOR  A PARTICULAR  PURPOSE ARE    */
kusano 2b45e8
/*    DISCLAIMED.  IN  NO EVENT SHALL THE UNIVERSITY  OF TEXAS AT    */
kusano 2b45e8
/*    AUSTIN OR CONTRIBUTORS BE  LIABLE FOR ANY DIRECT, INDIRECT,    */
kusano 2b45e8
/*    INCIDENTAL,  SPECIAL, EXEMPLARY,  OR  CONSEQUENTIAL DAMAGES    */
kusano 2b45e8
/*    (INCLUDING, BUT  NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE    */
kusano 2b45e8
/*    GOODS  OR  SERVICES; LOSS  OF  USE,  DATA,  OR PROFITS;  OR    */
kusano 2b45e8
/*    BUSINESS INTERRUPTION) HOWEVER CAUSED  AND ON ANY THEORY OF    */
kusano 2b45e8
/*    LIABILITY, WHETHER  IN CONTRACT, STRICT  LIABILITY, OR TORT    */
kusano 2b45e8
/*    (INCLUDING NEGLIGENCE OR OTHERWISE)  ARISING IN ANY WAY OUT    */
kusano 2b45e8
/*    OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF ADVISED  OF  THE    */
kusano 2b45e8
/*    POSSIBILITY OF SUCH DAMAGE.                                    */
kusano 2b45e8
/*                                                                   */
kusano 2b45e8
/* The views and conclusions contained in the software and           */
kusano 2b45e8
/* documentation are those of the authors and should not be          */
kusano 2b45e8
/* interpreted as representing official policies, either expressed   */
kusano 2b45e8
/* or implied, of The University of Texas at Austin.                 */
kusano 2b45e8
/*********************************************************************/
kusano 2b45e8
kusano 2b45e8
#define ASSEMBLER
kusano 2b45e8
#include "common.h"
kusano 2b45e8
	
kusano 2b45e8
#define	M	r3
kusano 2b45e8
#define	N	r4
kusano 2b45e8
#define	A	r5
kusano 2b45e8
#define	LDA	r6
kusano 2b45e8
#define B	r7
kusano 2b45e8
kusano 2b45e8
#define AO1	r8
kusano 2b45e8
#define AO2	r9
kusano 2b45e8
#define AO3	r10
kusano 2b45e8
#define AO4	r11
kusano 2b45e8
kusano 2b45e8
#define J	r12
kusano 2b45e8
kusano 2b45e8
#define PREA	r14
kusano 2b45e8
#define PREB1	r15
kusano 2b45e8
kusano 2b45e8
#define c01	f0
kusano 2b45e8
#define c02	f1
kusano 2b45e8
#define c03	f2
kusano 2b45e8
#define c04	f3
kusano 2b45e8
#define c05	f4
kusano 2b45e8
#define c06	f5
kusano 2b45e8
#define c07	f6
kusano 2b45e8
#define c08	f7
kusano 2b45e8
#define c09	f8
kusano 2b45e8
#define c10	f9
kusano 2b45e8
#define c11	f10
kusano 2b45e8
#define c12	f11
kusano 2b45e8
#define c13	f12
kusano 2b45e8
#define c14	f13
kusano 2b45e8
#define c15	f14
kusano 2b45e8
#define c16	f15
kusano 2b45e8
kusano 2b45e8
#define STACKSIZE 32
kusano 2b45e8
kusano 2b45e8
#ifdef CELL
kusano 2b45e8
#define PREFETCHSIZE   16
kusano 2b45e8
#define PREFETCHWSIZE  72
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
#ifdef PPC970
kusano 2b45e8
#define PREFETCHSIZE   16
kusano 2b45e8
#define PREFETCHWSIZE  72
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
#ifdef PPC440
kusano 2b45e8
#define PREFETCHSIZE   16
kusano 2b45e8
#define PREFETCHWSIZE  72
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
#ifdef POWER4
kusano 2b45e8
#define PREFETCHSIZE   16
kusano 2b45e8
#define PREFETCHWSIZE  72
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
#ifdef POWER5
kusano 2b45e8
#define PREFETCHSIZE   16
kusano 2b45e8
#define PREFETCHWSIZE  72
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
#ifdef POWER6
kusano 2b45e8
#define PREFETCHSIZE   16
kusano 2b45e8
#define PREFETCHWSIZE  72
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
#ifdef PPCG4
kusano 2b45e8
#define PREFETCHSIZE   16
kusano 2b45e8
#define PREFETCHWSIZE  72
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	PROLOGUE
kusano 2b45e8
	PROFCODE
kusano 2b45e8
kusano 2b45e8
	addi	SP, SP, -STACKSIZE
kusano 2b45e8
	li	r0, 0
kusano 2b45e8
kusano 2b45e8
	stfd	f14,    0(SP)
kusano 2b45e8
	stfd	f15,    8(SP)
kusano 2b45e8
kusano 2b45e8
#ifdef __64BIT__
kusano 2b45e8
	std	r14,   16(SP)
kusano 2b45e8
	std	r15,   24(SP)
kusano 2b45e8
#else
kusano 2b45e8
	stw	r14,   16(SP)
kusano 2b45e8
	stw	r15,   20(SP)
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	slwi	LDA, LDA, BASE_SHIFT
kusano 2b45e8
kusano 2b45e8
	li	PREA,  PREFETCHSIZE * SIZE
kusano 2b45e8
	li	PREB1, (PREFETCHWSIZE +  0) * SIZE
kusano 2b45e8
kusano 2b45e8
	cmpwi	cr0, M, 0
kusano 2b45e8
	ble-	LL(999)
kusano 2b45e8
	cmpwi	cr0, N, 0
kusano 2b45e8
	ble-	LL(999)
kusano 2b45e8
kusano 2b45e8
	srawi.	J,  N,  2
kusano 2b45e8
	ble	LL(20)
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
LL(10):
kusano 2b45e8
	mr	AO1, A
kusano 2b45e8
	add	AO2, A,   LDA
kusano 2b45e8
	add	AO3, AO2, LDA
kusano 2b45e8
	add	AO4, AO3, LDA
kusano 2b45e8
	add	A,   AO4, LDA
kusano 2b45e8
kusano 2b45e8
	srawi.	r0,  M,  2
kusano 2b45e8
	mtspr	CTR, r0
kusano 2b45e8
	ble	LL(15)
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
LL(12):
kusano 2b45e8
	LFD	c01,   0 * SIZE(AO1)
kusano 2b45e8
	LFD	c02,   1 * SIZE(AO1)
kusano 2b45e8
	LFD	c03,   2 * SIZE(AO1)
kusano 2b45e8
	LFD	c04,   3 * SIZE(AO1)
kusano 2b45e8
kusano 2b45e8
	LFD	c05,   0 * SIZE(AO2)
kusano 2b45e8
	LFD	c06,   1 * SIZE(AO2)
kusano 2b45e8
	LFD	c07,   2 * SIZE(AO2)
kusano 2b45e8
	LFD	c08,   3 * SIZE(AO2)
kusano 2b45e8
kusano 2b45e8
	LFD	c09,   0 * SIZE(AO3)
kusano 2b45e8
	LFD	c10,   1 * SIZE(AO3)
kusano 2b45e8
	LFD	c11,   2 * SIZE(AO3)
kusano 2b45e8
	LFD	c12,   3 * SIZE(AO3)
kusano 2b45e8
kusano 2b45e8
	LFD	c13,   0 * SIZE(AO4)
kusano 2b45e8
	LFD	c14,   1 * SIZE(AO4)
kusano 2b45e8
	LFD	c15,   2 * SIZE(AO4)
kusano 2b45e8
	LFD	c16,   3 * SIZE(AO4)
kusano 2b45e8
kusano 2b45e8
	STFD	c01,   0 * SIZE(B)
kusano 2b45e8
	STFD	c05,   1 * SIZE(B)
kusano 2b45e8
	STFD	c09,   2 * SIZE(B)
kusano 2b45e8
	STFD	c13,   3 * SIZE(B)
kusano 2b45e8
kusano 2b45e8
	STFD	c02,   4 * SIZE(B)
kusano 2b45e8
	STFD	c06,   5 * SIZE(B)
kusano 2b45e8
	STFD	c10,   6 * SIZE(B)
kusano 2b45e8
	STFD	c14,   7 * SIZE(B)
kusano 2b45e8
kusano 2b45e8
	STFD	c03,   8 * SIZE(B)
kusano 2b45e8
	STFD	c07,   9 * SIZE(B)
kusano 2b45e8
	STFD	c11,  10 * SIZE(B)
kusano 2b45e8
	STFD	c15,  11 * SIZE(B)
kusano 2b45e8
kusano 2b45e8
	STFD	c04,  12 * SIZE(B)
kusano 2b45e8
	STFD	c08,  13 * SIZE(B)
kusano 2b45e8
	STFD	c12,  14 * SIZE(B)
kusano 2b45e8
	STFD	c16,  15 * SIZE(B)
kusano 2b45e8
kusano 2b45e8
#ifdef POWER6
kusano 2b45e8
	dcbtst	PREA, AO1
kusano 2b45e8
	dcbtst	PREA, AO2
kusano 2b45e8
	dcbtst	PREA, AO3
kusano 2b45e8
	dcbtst	PREA, AO4
kusano 2b45e8
#else
kusano 2b45e8
	dcbt	PREA, AO1
kusano 2b45e8
	dcbt	PREA, AO2
kusano 2b45e8
	dcbt	PREA, AO3
kusano 2b45e8
	dcbt	PREA, AO4
kusano 2b45e8
#endif
kusano 2b45e8
	
kusano 2b45e8
	dcbtst	PREB1, B
kusano 2b45e8
kusano 2b45e8
	addi	AO1, AO1,  4 * SIZE
kusano 2b45e8
	addi	AO2, AO2,  4 * SIZE
kusano 2b45e8
	addi	AO3, AO3,  4 * SIZE
kusano 2b45e8
	addi	AO4, AO4,  4 * SIZE
kusano 2b45e8
	addi	B,   B,   16 * SIZE
kusano 2b45e8
	bdnz	LL(12)
kusano 2b45e8
	.align 4
kusano 2b45e8
	
kusano 2b45e8
LL(15):
kusano 2b45e8
	andi.	r0,  M,  3
kusano 2b45e8
	mtspr	CTR, r0
kusano 2b45e8
	ble	LL(17)
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
LL(16):
kusano 2b45e8
	LFD	c01,   0 * SIZE(AO1)
kusano 2b45e8
	LFD	c05,   0 * SIZE(AO2)
kusano 2b45e8
	LFD	c09,   0 * SIZE(AO3)
kusano 2b45e8
	LFD	c13,   0 * SIZE(AO4)
kusano 2b45e8
kusano 2b45e8
	STFD	c01,   0 * SIZE(B)
kusano 2b45e8
	STFD	c05,   1 * SIZE(B)
kusano 2b45e8
	STFD	c09,   2 * SIZE(B)
kusano 2b45e8
	STFD	c13,   3 * SIZE(B)
kusano 2b45e8
kusano 2b45e8
	addi	AO1, AO1,  1 * SIZE
kusano 2b45e8
	addi	AO2, AO2,  1 * SIZE
kusano 2b45e8
	addi	AO3, AO3,  1 * SIZE
kusano 2b45e8
	addi	AO4, AO4,  1 * SIZE
kusano 2b45e8
	addi	B,   B,    4 * SIZE
kusano 2b45e8
	bdnz	LL(16)
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
LL(17):
kusano 2b45e8
	addic.	J, J, -1
kusano 2b45e8
	bgt	LL(10)
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
LL(20):
kusano 2b45e8
	andi.	J,  N,  2
kusano 2b45e8
	ble	LL(30)
kusano 2b45e8
kusano 2b45e8
	mr	AO1, A
kusano 2b45e8
	add	AO2, A,   LDA
kusano 2b45e8
	add	A,   AO2, LDA
kusano 2b45e8
kusano 2b45e8
	srawi.	r0,  M,  2
kusano 2b45e8
	mtspr	CTR, r0
kusano 2b45e8
	ble	LL(25)
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
LL(22):
kusano 2b45e8
	LFD	c01,   0 * SIZE(AO1)
kusano 2b45e8
	LFD	c02,   1 * SIZE(AO1)
kusano 2b45e8
	LFD	c03,   2 * SIZE(AO1)
kusano 2b45e8
	LFD	c04,   3 * SIZE(AO1)
kusano 2b45e8
kusano 2b45e8
	LFD	c05,   0 * SIZE(AO2)
kusano 2b45e8
	LFD	c06,   1 * SIZE(AO2)
kusano 2b45e8
	LFD	c07,   2 * SIZE(AO2)
kusano 2b45e8
	LFD	c08,   3 * SIZE(AO2)
kusano 2b45e8
kusano 2b45e8
	STFD	c01,   0 * SIZE(B)
kusano 2b45e8
	STFD	c05,   1 * SIZE(B)
kusano 2b45e8
	STFD	c02,   2 * SIZE(B)
kusano 2b45e8
	STFD	c06,   3 * SIZE(B)
kusano 2b45e8
kusano 2b45e8
	STFD	c03,   4 * SIZE(B)
kusano 2b45e8
	STFD	c07,   5 * SIZE(B)
kusano 2b45e8
	STFD	c04,   6 * SIZE(B)
kusano 2b45e8
	STFD	c08,   7 * SIZE(B)
kusano 2b45e8
kusano 2b45e8
	addi	AO1, AO1,  4 * SIZE
kusano 2b45e8
	addi	AO2, AO2,  4 * SIZE
kusano 2b45e8
	addi	B,   B,    8 * SIZE
kusano 2b45e8
	bdnz	LL(22)
kusano 2b45e8
	.align 4
kusano 2b45e8
	
kusano 2b45e8
LL(25):
kusano 2b45e8
	andi.	r0,  M,  3
kusano 2b45e8
	mtspr	CTR, r0
kusano 2b45e8
	ble	LL(30)
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
LL(26):
kusano 2b45e8
	LFD	c01,   0 * SIZE(AO1)
kusano 2b45e8
	LFD	c05,   0 * SIZE(AO2)
kusano 2b45e8
kusano 2b45e8
	STFD	c01,   0 * SIZE(B)
kusano 2b45e8
	STFD	c05,   1 * SIZE(B)
kusano 2b45e8
kusano 2b45e8
	addi	AO1, AO1,  1 * SIZE
kusano 2b45e8
	addi	AO2, AO2,  1 * SIZE
kusano 2b45e8
	addi	B,   B,    2 * SIZE
kusano 2b45e8
	bdnz	LL(26)
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
LL(30):
kusano 2b45e8
	andi.	J,  N,  1
kusano 2b45e8
	ble	LL(999)
kusano 2b45e8
kusano 2b45e8
	mr	AO1, A
kusano 2b45e8
kusano 2b45e8
	srawi.	r0,  M,  2
kusano 2b45e8
	mtspr	CTR, r0
kusano 2b45e8
	ble	LL(35)
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
LL(32):
kusano 2b45e8
	LFD	c01,   0 * SIZE(AO1)
kusano 2b45e8
	LFD	c02,   1 * SIZE(AO1)
kusano 2b45e8
	LFD	c03,   2 * SIZE(AO1)
kusano 2b45e8
	LFD	c04,   3 * SIZE(AO1)
kusano 2b45e8
kusano 2b45e8
	STFD	c01,   0 * SIZE(B)
kusano 2b45e8
	STFD	c02,   1 * SIZE(B)
kusano 2b45e8
	STFD	c03,   2 * SIZE(B)
kusano 2b45e8
	STFD	c04,   3 * SIZE(B)
kusano 2b45e8
kusano 2b45e8
	addi	AO1, AO1,  4 * SIZE
kusano 2b45e8
	addi	B,   B,    4 * SIZE
kusano 2b45e8
	bdnz	LL(32)
kusano 2b45e8
	.align 4
kusano 2b45e8
	
kusano 2b45e8
LL(35):
kusano 2b45e8
	andi.	r0,  M,  3
kusano 2b45e8
	mtspr	CTR, r0
kusano 2b45e8
	ble	LL(999)
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
LL(36):
kusano 2b45e8
	LFD	c01,   0 * SIZE(AO1)
kusano 2b45e8
kusano 2b45e8
	STFD	c01,   0 * SIZE(B)
kusano 2b45e8
kusano 2b45e8
	addi	AO1, AO1,  1 * SIZE
kusano 2b45e8
	addi	B,   B,    1 * SIZE
kusano 2b45e8
	bdnz	LL(36)
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
LL(999):
kusano 2b45e8
	li	r3, 0
kusano 2b45e8
kusano 2b45e8
	lfd	f14,    0(SP)
kusano 2b45e8
	lfd	f15,    8(SP)
kusano 2b45e8
kusano 2b45e8
#ifdef __64BIT__
kusano 2b45e8
	ld	r14,   16(SP)
kusano 2b45e8
	ld	r15,   24(SP)
kusano 2b45e8
#else
kusano 2b45e8
	lwz	r14,   16(SP)
kusano 2b45e8
	lwz	r15,   20(SP)
kusano 2b45e8
#endif
kusano 2b45e8
	addi	SP, SP, STACKSIZE
kusano 2b45e8
kusano 2b45e8
	blr
kusano 2b45e8
	EPILOGUE