Blame thirdparty/openblas/xianyi-OpenBLAS-e6e87a2/kernel/power/gemm_beta.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	C	r10
kusano 2b45e8
#define	LDC	r11
kusano 2b45e8
#define	J	r5
kusano 2b45e8
#define PRE	r6
kusano 2b45e8
#define	CO1	r7
kusano 2b45e8
kusano 2b45e8
#define ALPHA	f31
kusano 2b45e8
kusano 2b45e8
#define STACKSIZE 32
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
	stfd	f31,   16(SP)
kusano 2b45e8
	stw	r0,    24(SP)
kusano 2b45e8
kusano 2b45e8
#ifdef linux
kusano 2b45e8
#ifndef __64BIT__
kusano 2b45e8
	lwz	LDC,      8 + STACKSIZE(SP)
kusano 2b45e8
#else
kusano 2b45e8
	ld	C,      112 + STACKSIZE(SP)
kusano 2b45e8
	ld	LDC,    120 + STACKSIZE(SP)
kusano 2b45e8
#endif
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
#if defined(_AIX) || defined(__APPLE__)
kusano 2b45e8
#ifdef __64BIT__
kusano 2b45e8
	ld	C,      112 + STACKSIZE(SP)
kusano 2b45e8
	ld	LDC,    120 + STACKSIZE(SP)
kusano 2b45e8
#else
kusano 2b45e8
#ifdef DOUBLE
kusano 2b45e8
	lwz	C,       60 + STACKSIZE(SP)
kusano 2b45e8
	lwz	LDC,     64 + STACKSIZE(SP)
kusano 2b45e8
#else
kusano 2b45e8
	lwz	C,       56 + STACKSIZE(SP)
kusano 2b45e8
	lwz	LDC,     60 + STACKSIZE(SP)
kusano 2b45e8
#endif
kusano 2b45e8
#endif
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	slwi	LDC, LDC, BASE_SHIFT
kusano 2b45e8
kusano 2b45e8
	fmr	ALPHA, f1
kusano 2b45e8
	lfs	f0,    24(SP)
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
	mr	J, N
kusano 2b45e8
	fcmpu	cr7, f1, f0
kusano 2b45e8
	bne	cr7, LL(20)
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
LL(10):
kusano 2b45e8
	mr	CO1, C
kusano 2b45e8
	add	C,  C, LDC
kusano 2b45e8
	addi	PRE, 0, 32 * SIZE
kusano 2b45e8
kusano 2b45e8
	srawi.	r0,  M,  4
kusano 2b45e8
	mtspr	CTR, r0
kusano 2b45e8
	ble	LL(15)
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
LL(12):
kusano 2b45e8
	STFD	f0,   0 * SIZE(CO1)
kusano 2b45e8
	STFD	f0,   1 * SIZE(CO1)
kusano 2b45e8
	STFD	f0,   2 * SIZE(CO1)
kusano 2b45e8
	STFD	f0,   3 * SIZE(CO1)
kusano 2b45e8
	STFD	f0,   4 * SIZE(CO1)
kusano 2b45e8
	STFD	f0,   5 * SIZE(CO1)
kusano 2b45e8
	STFD	f0,   6 * SIZE(CO1)
kusano 2b45e8
	STFD	f0,   7 * SIZE(CO1)
kusano 2b45e8
	STFD	f0,   8 * SIZE(CO1)
kusano 2b45e8
	STFD	f0,   9 * SIZE(CO1)
kusano 2b45e8
	STFD	f0,  10 * SIZE(CO1)
kusano 2b45e8
	STFD	f0,  11 * SIZE(CO1)
kusano 2b45e8
	STFD	f0,  12 * SIZE(CO1)
kusano 2b45e8
	STFD	f0,  13 * SIZE(CO1)
kusano 2b45e8
	STFD	f0,  14 * SIZE(CO1)
kusano 2b45e8
	STFD	f0,  15 * SIZE(CO1)
kusano 2b45e8
kusano 2b45e8
	dcbst	PRE, CO1
kusano 2b45e8
	addi	CO1, CO1,  16 * SIZE
kusano 2b45e8
	bdnz	LL(12)
kusano 2b45e8
	.align 4
kusano 2b45e8
	
kusano 2b45e8
LL(15):
kusano 2b45e8
	andi.	r0,  M,  15
kusano 2b45e8
	mtspr	CTR, r0
kusano 2b45e8
	beq	LL(19)
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
LL(16):
kusano 2b45e8
	STFD	f0,  0 * SIZE(CO1)
kusano 2b45e8
	addi	CO1, CO1, 1 * SIZE
kusano 2b45e8
	bdnz	LL(16)
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
LL(19):
kusano 2b45e8
	addic.	J,  J,  -1
kusano 2b45e8
	bgt	LL(10)
kusano 2b45e8
	b	LL(999)
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
LL(20):
kusano 2b45e8
	mr	CO1, C
kusano 2b45e8
	add	C,  C, LDC
kusano 2b45e8
	addi	PRE, 0, 16 * SIZE
kusano 2b45e8
kusano 2b45e8
	srawi.	r0,  M,  4
kusano 2b45e8
	mtspr	CTR, r0
kusano 2b45e8
	ble	LL(25)
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
LL(22):
kusano 2b45e8
	LFD	f0,    0 * SIZE(CO1)
kusano 2b45e8
	LFD	f1,    1 * SIZE(CO1)
kusano 2b45e8
	LFD	f2,    2 * SIZE(CO1)
kusano 2b45e8
	LFD	f3,    3 * SIZE(CO1)
kusano 2b45e8
	LFD	f4,    4 * SIZE(CO1)
kusano 2b45e8
	LFD	f5,    5 * SIZE(CO1)
kusano 2b45e8
	LFD	f6,    6 * SIZE(CO1)
kusano 2b45e8
	LFD	f7,    7 * SIZE(CO1)
kusano 2b45e8
kusano 2b45e8
	LFD	f8,    8 * SIZE(CO1)
kusano 2b45e8
	LFD	f9,    9 * SIZE(CO1)
kusano 2b45e8
	LFD	f10,  10 * SIZE(CO1)
kusano 2b45e8
	LFD	f11,  11 * SIZE(CO1)
kusano 2b45e8
	LFD	f12,  12 * SIZE(CO1)
kusano 2b45e8
	LFD	f13,  13 * SIZE(CO1)
kusano 2b45e8
	LFD	f14,  14 * SIZE(CO1)
kusano 2b45e8
	LFD	f15,  15 * SIZE(CO1)
kusano 2b45e8
kusano 2b45e8
	FMUL	f0,   ALPHA, f0
kusano 2b45e8
	FMUL	f1,   ALPHA, f1
kusano 2b45e8
	FMUL	f2,   ALPHA, f2
kusano 2b45e8
	FMUL	f3,   ALPHA, f3
kusano 2b45e8
	FMUL	f4,   ALPHA, f4
kusano 2b45e8
	FMUL	f5,   ALPHA, f5
kusano 2b45e8
	FMUL	f6,   ALPHA, f6
kusano 2b45e8
	FMUL	f7,   ALPHA, f7
kusano 2b45e8
kusano 2b45e8
	FMUL	f8,   ALPHA, f8
kusano 2b45e8
	FMUL	f9,   ALPHA, f9
kusano 2b45e8
	FMUL	f10,  ALPHA, f10
kusano 2b45e8
	FMUL	f11,  ALPHA, f11
kusano 2b45e8
	FMUL	f12,  ALPHA, f12
kusano 2b45e8
	FMUL	f13,  ALPHA, f13
kusano 2b45e8
	FMUL	f14,  ALPHA, f14
kusano 2b45e8
	FMUL	f15,  ALPHA, f15
kusano 2b45e8
kusano 2b45e8
	STFD	f0,    0 * SIZE(CO1)
kusano 2b45e8
	STFD	f1,    1 * SIZE(CO1)
kusano 2b45e8
	STFD	f2,    2 * SIZE(CO1)
kusano 2b45e8
	STFD	f3,    3 * SIZE(CO1)
kusano 2b45e8
	STFD	f4,    4 * SIZE(CO1)
kusano 2b45e8
	STFD	f5,    5 * SIZE(CO1)
kusano 2b45e8
	STFD	f6,    6 * SIZE(CO1)
kusano 2b45e8
	STFD	f7,    7 * SIZE(CO1)
kusano 2b45e8
kusano 2b45e8
	STFD	f8,    8 * SIZE(CO1)
kusano 2b45e8
	STFD	f9,    9 * SIZE(CO1)
kusano 2b45e8
	STFD	f10,  10 * SIZE(CO1)
kusano 2b45e8
	STFD	f11,  11 * SIZE(CO1)
kusano 2b45e8
	STFD	f12,  12 * SIZE(CO1)
kusano 2b45e8
	STFD	f13,  13 * SIZE(CO1)
kusano 2b45e8
	STFD	f14,  14 * SIZE(CO1)
kusano 2b45e8
	STFD	f15,  15 * SIZE(CO1)
kusano 2b45e8
kusano 2b45e8
	addi	CO1, CO1,  16 * SIZE
kusano 2b45e8
	dcbtst	PRE, CO1
kusano 2b45e8
	bdnz	LL(22)
kusano 2b45e8
	.align 4
kusano 2b45e8
	
kusano 2b45e8
LL(25):
kusano 2b45e8
	andi.	r0,  M,  15
kusano 2b45e8
	mtspr	CTR, r0
kusano 2b45e8
	ble	LL(29)
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
LL(26):
kusano 2b45e8
	LFD	f0,  0 * SIZE(CO1)
kusano 2b45e8
	FMUL	f0, f0, ALPHA
kusano 2b45e8
	STFD	f0,  0 * SIZE(CO1)
kusano 2b45e8
	addi	CO1, CO1, 1 * SIZE
kusano 2b45e8
	bdnz	LL(26)
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
LL(29):
kusano 2b45e8
	addic.	J,  J,  -1
kusano 2b45e8
	bgt	LL(20)
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
	lfd	f31,   16(SP)
kusano 2b45e8
	addi	SP, SP, STACKSIZE
kusano 2b45e8
kusano 2b45e8
	blr
kusano 2b45e8
	EPILOGUE