Blame thirdparty/openblas/xianyi-OpenBLAS-e6e87a2/kernel/x86/zgemm_kernel_1x2_barcelona.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 STACK	16
kusano 2b45e8
#define ARGS	16
kusano 2b45e8
	
kusano 2b45e8
#define M	 4 + STACK + ARGS(%esp)
kusano 2b45e8
#define N	 8 + STACK + ARGS(%esp)
kusano 2b45e8
#define K	12 + STACK + ARGS(%esp)
kusano 2b45e8
#define ALPHA_R	16 + STACK + ARGS(%esp)
kusano 2b45e8
#define ALPHA_I	24 + STACK + ARGS(%esp)
kusano 2b45e8
#define A	32 + STACK + ARGS(%esp)
kusano 2b45e8
#define OLD_B	36 + STACK + ARGS(%esp)
kusano 2b45e8
#define C	40 + STACK + ARGS(%esp)
kusano 2b45e8
#define OLD_LDC	44 + STACK + ARGS(%esp)
kusano 2b45e8
#define OFFSET	48 + STACK + ARGS(%esp)
kusano 2b45e8
kusano 2b45e8
#define J	 0 + STACK(%esp)
kusano 2b45e8
#define BX	 4 + STACK(%esp)
kusano 2b45e8
#define KK	 8 + STACK(%esp)
kusano 2b45e8
#define KKK	12 + STACK(%esp)
kusano 2b45e8
kusano 2b45e8
#define B	%edi
kusano 2b45e8
#define LDC	%ebp
kusano 2b45e8
#define AO	%edx
kusano 2b45e8
#define BO	%ecx
kusano 2b45e8
#define CO	%esi
kusano 2b45e8
#define	I	%ebx
kusano 2b45e8
kusano 2b45e8
#define movsd  movlps
kusano 2b45e8
#define movapd movups
kusano 2b45e8
#define movlpd movlps
kusano 2b45e8
#define movhpd movhps
kusano 2b45e8
kusano 2b45e8
#define PREFETCH     prefetch
kusano 2b45e8
#define PREFETCHSIZE  (8 *  7 + 0)
kusano 2b45e8
kusano 2b45e8
#if   defined(NN) || defined(NT) || defined(TN) || defined(TT)
kusano 2b45e8
#define ADD1	addpd
kusano 2b45e8
#define ADD2	addpd
kusano 2b45e8
#elif defined(RN) || defined(RT) || defined(CN) || defined(CT)
kusano 2b45e8
#define ADD1	addpd
kusano 2b45e8
#define ADD2	subpd
kusano 2b45e8
#elif defined(NR) || defined(NC) || defined(TR) || defined(TC)
kusano 2b45e8
#define ADD1	subpd
kusano 2b45e8
#define ADD2	addpd
kusano 2b45e8
#else
kusano 2b45e8
#define ADD1	subpd
kusano 2b45e8
#define ADD2	subpd
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
#define KERNEL1(address) \
kusano 2b45e8
	mulpd	%xmm0, %xmm1; \
kusano 2b45e8
	PREFETCH (PREFETCHSIZE +  0) * SIZE(AO, %eax, 2); \
kusano 2b45e8
	mulpd	-14 * SIZE(BO, %eax, 4), %xmm0; \
kusano 2b45e8
	ADD1	%xmm1, %xmm4; \
kusano 2b45e8
	movapd	-12 * SIZE(BO, %eax, 4), %xmm1; \
kusano 2b45e8
	ADD1	%xmm0, %xmm6; \
kusano 2b45e8
	movddup	-15 * SIZE(AO, %eax, 2), %xmm0; \
kusano 2b45e8
	mulpd	%xmm0, %xmm2; \
kusano 2b45e8
	mulpd	-14 * SIZE(BO, %eax, 4), %xmm0; \
kusano 2b45e8
	ADD2	%xmm0, %xmm7; \
kusano 2b45e8
	movddup	-14 * SIZE(AO, %eax, 2), %xmm0
kusano 2b45e8
kusano 2b45e8
#define KERNEL2(address) \
kusano 2b45e8
	ADD2	%xmm2, %xmm5; \
kusano 2b45e8
	movapd	%xmm1, %xmm2; \
kusano 2b45e8
	mulpd	%xmm0, %xmm1; \
kusano 2b45e8
	mulpd	-10 * SIZE(BO, %eax, 4), %xmm0; \
kusano 2b45e8
	ADD1	%xmm1, %xmm4; \
kusano 2b45e8
	movapd	 -8 * SIZE(BO, %eax, 4), %xmm1; \
kusano 2b45e8
	ADD1	%xmm0, %xmm6; \
kusano 2b45e8
	movddup	-13 * SIZE(AO, %eax, 2), %xmm0; \
kusano 2b45e8
	mulpd	%xmm0, %xmm2; \
kusano 2b45e8
	mulpd	-10 * SIZE(BO, %eax, 4), %xmm0; \
kusano 2b45e8
	ADD2	%xmm0, %xmm7; \
kusano 2b45e8
	movddup	-12 * SIZE(AO, %eax, 2), %xmm0
kusano 2b45e8
kusano 2b45e8
#define KERNEL3(address) \
kusano 2b45e8
	ADD2	%xmm2, %xmm5; \
kusano 2b45e8
	movapd	%xmm1, %xmm2; \
kusano 2b45e8
	mulpd	%xmm0, %xmm1; \
kusano 2b45e8
	mulpd	 -6 * SIZE(BO, %eax, 4), %xmm0; \
kusano 2b45e8
	ADD1	%xmm1, %xmm4; \
kusano 2b45e8
	movapd	 -4 * SIZE(BO, %eax, 4), %xmm1; \
kusano 2b45e8
	ADD1	%xmm0, %xmm6; \
kusano 2b45e8
	movddup	-11 * SIZE(AO, %eax, 2), %xmm0; \
kusano 2b45e8
	mulpd	%xmm0, %xmm2; \
kusano 2b45e8
	mulpd	 -6 * SIZE(BO, %eax, 4), %xmm0; \
kusano 2b45e8
	ADD2	%xmm0, %xmm7; \
kusano 2b45e8
	movddup	-10 * SIZE(AO, %eax, 2), %xmm0
kusano 2b45e8
kusano 2b45e8
#define KERNEL4(address) \
kusano 2b45e8
	ADD2	%xmm2, %xmm5; \
kusano 2b45e8
	movapd	%xmm1, %xmm2; \
kusano 2b45e8
	mulpd	%xmm0, %xmm1; \
kusano 2b45e8
	mulpd	 -2 * SIZE(BO, %eax, 4), %xmm0; \
kusano 2b45e8
	ADD1	%xmm1, %xmm4; \
kusano 2b45e8
	movapd	          (BO, %eax, 4), %xmm1; \
kusano 2b45e8
	ADD1	%xmm0, %xmm6; \
kusano 2b45e8
	movddup	 -9 * SIZE(AO, %eax, 2), %xmm0; \
kusano 2b45e8
	mulpd	%xmm0, %xmm2; \
kusano 2b45e8
	mulpd	 -2 * SIZE(BO, %eax, 4), %xmm0; \
kusano 2b45e8
	ADD2	%xmm0, %xmm7; \
kusano 2b45e8
	movddup	          (AO, %eax, 2), %xmm0
kusano 2b45e8
kusano 2b45e8
#define KERNEL5(address) \
kusano 2b45e8
	ADD2	%xmm2, %xmm5; \
kusano 2b45e8
	movapd	%xmm1, %xmm2; \
kusano 2b45e8
	mulpd	%xmm3, %xmm1; \
kusano 2b45e8
	mulpd	  2 * SIZE(BO, %eax, 4), %xmm3; \
kusano 2b45e8
	ADD1	%xmm1, %xmm4; \
kusano 2b45e8
	movapd	  4 * SIZE(BO, %eax, 4), %xmm1; \
kusano 2b45e8
	ADD1	%xmm3, %xmm6; \
kusano 2b45e8
	movddup	 -7 * SIZE(AO, %eax, 2), %xmm3; \
kusano 2b45e8
	mulpd	%xmm3, %xmm2; \
kusano 2b45e8
	mulpd	  2 * SIZE(BO, %eax, 4), %xmm3; \
kusano 2b45e8
	ADD2	%xmm3, %xmm7; \
kusano 2b45e8
	movddup	 -6 * SIZE(AO, %eax, 2), %xmm3
kusano 2b45e8
kusano 2b45e8
#define KERNEL6(address) \
kusano 2b45e8
	ADD2	%xmm2, %xmm5; \
kusano 2b45e8
	movapd	%xmm1, %xmm2; \
kusano 2b45e8
	mulpd	%xmm3, %xmm1; \
kusano 2b45e8
	mulpd	  6 * SIZE(BO, %eax, 4), %xmm3; \
kusano 2b45e8
	ADD1	%xmm1, %xmm4; \
kusano 2b45e8
	movapd	  8 * SIZE(BO, %eax, 4), %xmm1; \
kusano 2b45e8
	ADD1	%xmm3, %xmm6; \
kusano 2b45e8
	movddup	 -5 * SIZE(AO, %eax, 2), %xmm3; \
kusano 2b45e8
	mulpd	%xmm3, %xmm2; \
kusano 2b45e8
	mulpd	  6 * SIZE(BO, %eax, 4), %xmm3; \
kusano 2b45e8
	ADD2	%xmm3, %xmm7; \
kusano 2b45e8
	movddup	 -4 * SIZE(AO, %eax, 2), %xmm3
kusano 2b45e8
kusano 2b45e8
#define KERNEL7(address) \
kusano 2b45e8
	ADD2	%xmm2, %xmm5; \
kusano 2b45e8
	movapd	%xmm1, %xmm2; \
kusano 2b45e8
	mulpd	%xmm3, %xmm1; \
kusano 2b45e8
	mulpd	 10 * SIZE(BO, %eax, 4), %xmm3; \
kusano 2b45e8
	ADD1	%xmm1, %xmm4; \
kusano 2b45e8
	movapd	 12 * SIZE(BO, %eax, 4), %xmm1; \
kusano 2b45e8
	ADD1	%xmm3, %xmm6; \
kusano 2b45e8
	movddup	 -3 * SIZE(AO, %eax, 2), %xmm3; \
kusano 2b45e8
	mulpd	%xmm3, %xmm2; \
kusano 2b45e8
	mulpd	 10 * SIZE(BO, %eax, 4), %xmm3; \
kusano 2b45e8
	ADD2	%xmm3, %xmm7; \
kusano 2b45e8
	movddup	 -2 * SIZE(AO, %eax, 2), %xmm3
kusano 2b45e8
kusano 2b45e8
#define KERNEL8(address) \
kusano 2b45e8
	ADD2	%xmm2, %xmm5; \
kusano 2b45e8
	movapd	%xmm1, %xmm2; \
kusano 2b45e8
	mulpd	%xmm3, %xmm1; \
kusano 2b45e8
	mulpd	 14 * SIZE(BO, %eax, 4), %xmm3; \
kusano 2b45e8
	ADD1	%xmm1, %xmm4; \
kusano 2b45e8
	movapd	 16 * SIZE(BO, %eax, 4), %xmm1; \
kusano 2b45e8
	ADD1	%xmm3, %xmm6; \
kusano 2b45e8
	movddup	 -1 * SIZE(AO, %eax, 2), %xmm3; \
kusano 2b45e8
	mulpd	%xmm3, %xmm2; \
kusano 2b45e8
	mulpd	 14 * SIZE(BO, %eax, 4), %xmm3; \
kusano 2b45e8
	ADD2	%xmm3, %xmm7; \
kusano 2b45e8
	movddup	  8 * SIZE(AO, %eax, 2), %xmm3; \
kusano 2b45e8
	ADD2	%xmm2, %xmm5; \
kusano 2b45e8
	movapd	%xmm1, %xmm2
kusano 2b45e8
kusano 2b45e8
	PROLOGUE
kusano 2b45e8
kusano 2b45e8
	subl	$ARGS, %esp
kusano 2b45e8
kusano 2b45e8
	pushl	%ebp
kusano 2b45e8
	pushl	%edi
kusano 2b45e8
	pushl	%esi
kusano 2b45e8
	pushl	%ebx
kusano 2b45e8
kusano 2b45e8
	PROFCODE
kusano 2b45e8
kusano 2b45e8
	movl	OLD_B,   B
kusano 2b45e8
	movl	OLD_LDC, LDC
kusano 2b45e8
kusano 2b45e8
#ifdef TRMMKERNEL
kusano 2b45e8
	movl	OFFSET, %eax
kusano 2b45e8
kusano 2b45e8
#ifndef LEFT
kusano 2b45e8
	negl	%eax
kusano 2b45e8
#endif	
kusano 2b45e8
kusano 2b45e8
	movl	%eax, KK
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	subl	$-16 * SIZE, A
kusano 2b45e8
	subl	$-16 * SIZE, B
kusano 2b45e8
kusano 2b45e8
	sall	$ZBASE_SHIFT, LDC
kusano 2b45e8
kusano 2b45e8
	movl	N,  %eax
kusano 2b45e8
	sarl	$1, %eax
kusano 2b45e8
	movl	%eax, J			# j = n
kusano 2b45e8
	jle	.L100
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
kusano 2b45e8
.L01:
kusano 2b45e8
#if defined(TRMMKERNEL) && defined(LEFT)
kusano 2b45e8
	movl	OFFSET, %eax
kusano 2b45e8
	movl	%eax, KK
kusano 2b45e8
#endif	
kusano 2b45e8
kusano 2b45e8
	leal	GEMM_DEFAULT_Q * GEMM_DEFAULT_UNROLL_N * SIZE(B), %eax
kusano 2b45e8
	movl	%eax, BX
kusano 2b45e8
kusano 2b45e8
	movl	C, CO
kusano 2b45e8
	movl	A, AO
kusano 2b45e8
	movl	M,  I
kusano 2b45e8
	testl	I,  I
kusano 2b45e8
	jle	.L100
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
kusano 2b45e8
.L10:
kusano 2b45e8
#if !defined(TRMMKERNEL) || \
kusano 2b45e8
	(defined(TRMMKERNEL) &&  defined(LEFT) &&  defined(TRANSA)) || \
kusano 2b45e8
	(defined(TRMMKERNEL) && !defined(LEFT) && !defined(TRANSA))
kusano 2b45e8
kusano 2b45e8
	movl	B, BO
kusano 2b45e8
#else
kusano 2b45e8
	movl	KK, %eax
kusano 2b45e8
	leal	(, %eax, SIZE), %eax
kusano 2b45e8
	leal	(AO, %eax, 2), AO
kusano 2b45e8
	leal	(B,  %eax, 4), BO
kusano 2b45e8
#endif	
kusano 2b45e8
kusano 2b45e8
	movl	BX, %eax
kusano 2b45e8
kusano 2b45e8
	prefetcht2  0 * SIZE(%eax)
kusano 2b45e8
kusano 2b45e8
	subl	$-8 * SIZE, BX
kusano 2b45e8
kusano 2b45e8
	movddup	-16 * SIZE(AO), %xmm0
kusano 2b45e8
	movapd	-16 * SIZE(BO), %xmm1
kusano 2b45e8
	pxor	%xmm4, %xmm4
kusano 2b45e8
	movddup	 -8 * SIZE(AO), %xmm3
kusano 2b45e8
	pxor	%xmm5, %xmm5
kusano 2b45e8
kusano 2b45e8
	prefetchw 1 * SIZE(CO)
kusano 2b45e8
	pxor	%xmm6, %xmm6
kusano 2b45e8
	prefetchw 1 * SIZE(CO, LDC)
kusano 2b45e8
	pxor	%xmm7, %xmm7
kusano 2b45e8
	movapd	%xmm1, %xmm2
kusano 2b45e8
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	movl	K, %eax
kusano 2b45e8
#elif (defined(LEFT) && !defined(TRANSA)) || (!defined(LEFT) && defined(TRANSA))
kusano 2b45e8
	movl	K, %eax
kusano 2b45e8
	subl	KK, %eax
kusano 2b45e8
	movl	%eax, KKK	
kusano 2b45e8
#else
kusano 2b45e8
	movl	KK, %eax
kusano 2b45e8
#ifdef LEFT
kusano 2b45e8
	addl	$1, %eax
kusano 2b45e8
#else
kusano 2b45e8
	addl	$2, %eax
kusano 2b45e8
#endif
kusano 2b45e8
	movl	%eax, KKK
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	andl	$-8, %eax
kusano 2b45e8
kusano 2b45e8
	leal	(, %eax, SIZE), %eax
kusano 2b45e8
	leal	(AO, %eax, 2), AO
kusano 2b45e8
	leal	(BO, %eax, 4), BO
kusano 2b45e8
	negl	%eax
kusano 2b45e8
	NOBRANCH
kusano 2b45e8
	je	.L15
kusano 2b45e8
	ALIGN_3
kusano 2b45e8
kusano 2b45e8
.L12:
kusano 2b45e8
	KERNEL1(16 *  0)
kusano 2b45e8
	KERNEL2(16 *  0)
kusano 2b45e8
	KERNEL3(16 *  0)
kusano 2b45e8
	KERNEL4(16 *  0)
kusano 2b45e8
	KERNEL5(16 *  0)
kusano 2b45e8
	KERNEL6(16 *  0)
kusano 2b45e8
	KERNEL7(16 *  0)
kusano 2b45e8
	KERNEL8(16 *  0)
kusano 2b45e8
	addl	$8 * SIZE, %eax
kusano 2b45e8
	NOBRANCH
kusano 2b45e8
	je	.L15
kusano 2b45e8
	KERNEL1(16 *  0)
kusano 2b45e8
	KERNEL2(16 *  0)
kusano 2b45e8
	KERNEL3(16 *  0)
kusano 2b45e8
	KERNEL4(16 *  0)
kusano 2b45e8
	KERNEL5(16 *  0)
kusano 2b45e8
	KERNEL6(16 *  0)
kusano 2b45e8
	KERNEL7(16 *  0)
kusano 2b45e8
	KERNEL8(16 *  0)
kusano 2b45e8
	addl	$8 * SIZE, %eax
kusano 2b45e8
	NOBRANCH
kusano 2b45e8
	je	.L15
kusano 2b45e8
	KERNEL1(16 *  0)
kusano 2b45e8
	KERNEL2(16 *  0)
kusano 2b45e8
	KERNEL3(16 *  0)
kusano 2b45e8
	KERNEL4(16 *  0)
kusano 2b45e8
	KERNEL5(16 *  0)
kusano 2b45e8
	KERNEL6(16 *  0)
kusano 2b45e8
	KERNEL7(16 *  0)
kusano 2b45e8
	KERNEL8(16 *  0)
kusano 2b45e8
	addl	$8 * SIZE, %eax
kusano 2b45e8
	NOBRANCH
kusano 2b45e8
	je	.L15
kusano 2b45e8
	KERNEL1(16 *  0)
kusano 2b45e8
	KERNEL2(16 *  0)
kusano 2b45e8
	KERNEL3(16 *  0)
kusano 2b45e8
	KERNEL4(16 *  0)
kusano 2b45e8
	KERNEL5(16 *  0)
kusano 2b45e8
	KERNEL6(16 *  0)
kusano 2b45e8
	KERNEL7(16 *  0)
kusano 2b45e8
	KERNEL8(16 *  0)
kusano 2b45e8
	addl	$8 * SIZE, %eax
kusano 2b45e8
	NOBRANCH
kusano 2b45e8
	je	.L15
kusano 2b45e8
	KERNEL1(16 *  0)
kusano 2b45e8
	KERNEL2(16 *  0)
kusano 2b45e8
	KERNEL3(16 *  0)
kusano 2b45e8
	KERNEL4(16 *  0)
kusano 2b45e8
	KERNEL5(16 *  0)
kusano 2b45e8
	KERNEL6(16 *  0)
kusano 2b45e8
	KERNEL7(16 *  0)
kusano 2b45e8
	KERNEL8(16 *  0)
kusano 2b45e8
	addl	$8 * SIZE, %eax
kusano 2b45e8
	NOBRANCH
kusano 2b45e8
	je	.L15
kusano 2b45e8
	KERNEL1(16 *  0)
kusano 2b45e8
	KERNEL2(16 *  0)
kusano 2b45e8
	KERNEL3(16 *  0)
kusano 2b45e8
	KERNEL4(16 *  0)
kusano 2b45e8
	KERNEL5(16 *  0)
kusano 2b45e8
	KERNEL6(16 *  0)
kusano 2b45e8
	KERNEL7(16 *  0)
kusano 2b45e8
	KERNEL8(16 *  0)
kusano 2b45e8
	addl	$8 * SIZE, %eax
kusano 2b45e8
	NOBRANCH
kusano 2b45e8
	je	.L15
kusano 2b45e8
	KERNEL1(16 *  0)
kusano 2b45e8
	KERNEL2(16 *  0)
kusano 2b45e8
	KERNEL3(16 *  0)
kusano 2b45e8
	KERNEL4(16 *  0)
kusano 2b45e8
	KERNEL5(16 *  0)
kusano 2b45e8
	KERNEL6(16 *  0)
kusano 2b45e8
	KERNEL7(16 *  0)
kusano 2b45e8
	KERNEL8(16 *  0)
kusano 2b45e8
	addl	$8 * SIZE, %eax
kusano 2b45e8
	NOBRANCH
kusano 2b45e8
	je	.L15
kusano 2b45e8
	KERNEL1(16 *  0)
kusano 2b45e8
	KERNEL2(16 *  0)
kusano 2b45e8
	KERNEL3(16 *  0)
kusano 2b45e8
	KERNEL4(16 *  0)
kusano 2b45e8
	KERNEL5(16 *  0)
kusano 2b45e8
	KERNEL6(16 *  0)
kusano 2b45e8
	KERNEL7(16 *  0)
kusano 2b45e8
	KERNEL8(16 *  0)
kusano 2b45e8
	addl	$8 * SIZE, %eax
kusano 2b45e8
	BRANCH
kusano 2b45e8
	jl	.L12
kusano 2b45e8
	ALIGN_3
kusano 2b45e8
kusano 2b45e8
.L15:
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	movl	K, %eax
kusano 2b45e8
#else
kusano 2b45e8
	movl	KKK, %eax
kusano 2b45e8
#endif
kusano 2b45e8
	andl	$7, %eax		# if (k & 1)
kusano 2b45e8
	BRANCH
kusano 2b45e8
	je .L14
kusano 2b45e8
kusano 2b45e8
	leal	(, %eax, SIZE), %eax
kusano 2b45e8
	leal	(AO, %eax, 2), AO
kusano 2b45e8
	leal	(BO, %eax, 4), BO
kusano 2b45e8
	negl	%eax
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
kusano 2b45e8
.L16:
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	mulpd	-14 * SIZE(BO, %eax, 4), %xmm0
kusano 2b45e8
	ADD1	%xmm1, %xmm4
kusano 2b45e8
	movapd	-12 * SIZE(BO, %eax, 4), %xmm1
kusano 2b45e8
	ADD1	%xmm0, %xmm6
kusano 2b45e8
	movddup	-15 * SIZE(AO, %eax, 2), %xmm0
kusano 2b45e8
	mulpd	%xmm0, %xmm2
kusano 2b45e8
	mulpd	-14 * SIZE(BO, %eax, 4), %xmm0
kusano 2b45e8
	ADD2	%xmm0, %xmm7
kusano 2b45e8
	movddup	-14 * SIZE(AO, %eax, 2), %xmm0
kusano 2b45e8
	ADD2	%xmm2, %xmm5
kusano 2b45e8
	movapd	%xmm1, %xmm2
kusano 2b45e8
kusano 2b45e8
	addl	$SIZE, %eax
kusano 2b45e8
	jl	.L16
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
kusano 2b45e8
.L14:
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	movupd	0 * SIZE(CO), %xmm0
kusano 2b45e8
	movupd	0 * SIZE(CO, LDC), %xmm1
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	movddup	ALPHA_R, %xmm2
kusano 2b45e8
	movddup	ALPHA_I, %xmm3
kusano 2b45e8
kusano 2b45e8
	SHUFPD_1 %xmm5, %xmm5
kusano 2b45e8
	SHUFPD_1 %xmm7, %xmm7
kusano 2b45e8
kusano 2b45e8
#if defined(NN) || defined(NT) || defined(TN) || defined(TT) || \
kusano 2b45e8
    defined(RN) || defined(RT) || defined(CN) || defined(CT)
kusano 2b45e8
	addsubpd %xmm5,  %xmm4
kusano 2b45e8
	addsubpd %xmm7,  %xmm6
kusano 2b45e8
kusano 2b45e8
	pshufd	$0x4e, %xmm4, %xmm5
kusano 2b45e8
	pshufd	$0x4e, %xmm6, %xmm7
kusano 2b45e8
#else
kusano 2b45e8
	addsubpd %xmm4,  %xmm5
kusano 2b45e8
	addsubpd %xmm6,  %xmm7
kusano 2b45e8
kusano 2b45e8
	movapd	 %xmm5,  %xmm4
kusano 2b45e8
	pshufd	$0x4e, %xmm5,  %xmm5
kusano 2b45e8
	movapd	 %xmm7,  %xmm6
kusano 2b45e8
	pshufd	$0x4e, %xmm7,  %xmm7
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	mulpd	%xmm2, %xmm4
kusano 2b45e8
	mulpd	%xmm3, %xmm5
kusano 2b45e8
	mulpd	%xmm2, %xmm6
kusano 2b45e8
	mulpd	%xmm3, %xmm7
kusano 2b45e8
kusano 2b45e8
	addsubpd %xmm5, %xmm4
kusano 2b45e8
	addsubpd %xmm7, %xmm6
kusano 2b45e8
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	addpd	%xmm0, %xmm4
kusano 2b45e8
	addpd	%xmm1, %xmm6
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	movlpd	%xmm4, 0 * SIZE(CO)
kusano 2b45e8
	movhpd	%xmm4, 1 * SIZE(CO)
kusano 2b45e8
	movlpd	%xmm6, 0 * SIZE(CO, LDC)
kusano 2b45e8
	movhpd	%xmm6, 1 * SIZE(CO, LDC)
kusano 2b45e8
kusano 2b45e8
#if (defined(TRMMKERNEL) &&  defined(LEFT) &&  defined(TRANSA)) || \
kusano 2b45e8
    (defined(TRMMKERNEL) && !defined(LEFT) && !defined(TRANSA))
kusano 2b45e8
	movl	K, %eax
kusano 2b45e8
	subl	KKK, %eax
kusano 2b45e8
	leal	(,%eax, SIZE), %eax
kusano 2b45e8
	leal	(AO, %eax, 2), AO
kusano 2b45e8
	leal	(BO, %eax, 4), BO
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
#if defined(TRMMKERNEL) && defined(LEFT)
kusano 2b45e8
	addl	$1, KK
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	addl	$2 * SIZE, CO		# coffset += 4
kusano 2b45e8
	decl	I			# i --
kusano 2b45e8
	jg	.L10
kusano 2b45e8
	ALIGN_4	
kusano 2b45e8
kusano 2b45e8
.L99:
kusano 2b45e8
#if defined(TRMMKERNEL) && !defined(LEFT)
kusano 2b45e8
	addl	$2, KK
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	movl	BO, B
kusano 2b45e8
kusano 2b45e8
	leal	(, LDC, 2), %eax
kusano 2b45e8
	addl	%eax, C			# c += ldc
kusano 2b45e8
	decl	J			# j --
kusano 2b45e8
	jg	.L01
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
kusano 2b45e8
.L100:
kusano 2b45e8
	movl	N, %eax
kusano 2b45e8
	andl	$1, %eax
kusano 2b45e8
	jle	.L500
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
kusano 2b45e8
.L101:
kusano 2b45e8
#if defined(TRMMKERNEL) && defined(LEFT)
kusano 2b45e8
	movl	OFFSET, %eax
kusano 2b45e8
	movl	%eax, KK
kusano 2b45e8
#endif	
kusano 2b45e8
kusano 2b45e8
	movl	C, CO
kusano 2b45e8
	movl	A, AO
kusano 2b45e8
kusano 2b45e8
	movl	M,    I
kusano 2b45e8
	testl	%ebx, I
kusano 2b45e8
	jle	.L500
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
kusano 2b45e8
.L110:
kusano 2b45e8
#if !defined(TRMMKERNEL) || \
kusano 2b45e8
	(defined(TRMMKERNEL) &&  defined(LEFT) &&  defined(TRANSA)) || \
kusano 2b45e8
	(defined(TRMMKERNEL) && !defined(LEFT) && !defined(TRANSA))
kusano 2b45e8
kusano 2b45e8
	movl	B, BO
kusano 2b45e8
#else
kusano 2b45e8
	movl	KK, %eax
kusano 2b45e8
	leal	(, %eax, SIZE), %eax
kusano 2b45e8
	leal	(AO, %eax, 2), AO
kusano 2b45e8
	leal	(B,  %eax, 2), BO
kusano 2b45e8
#endif	
kusano 2b45e8
kusano 2b45e8
	movddup	-16 * SIZE(AO), %xmm0
kusano 2b45e8
	pxor	%xmm4, %xmm4
kusano 2b45e8
	movddup	-15 * SIZE(AO), %xmm1
kusano 2b45e8
	pxor	%xmm5, %xmm5
kusano 2b45e8
	pxor	%xmm6, %xmm6
kusano 2b45e8
	pxor	%xmm7, %xmm7
kusano 2b45e8
kusano 2b45e8
	prefetchw 1 * SIZE(CO)
kusano 2b45e8
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	movl	K, %eax
kusano 2b45e8
#elif (defined(LEFT) && !defined(TRANSA)) || (!defined(LEFT) && defined(TRANSA))
kusano 2b45e8
	movl	K, %eax
kusano 2b45e8
	subl	KK, %eax
kusano 2b45e8
	movl	%eax, KKK	
kusano 2b45e8
#else
kusano 2b45e8
	movl	KK, %eax
kusano 2b45e8
#ifdef LEFT
kusano 2b45e8
	addl	$1, %eax
kusano 2b45e8
#else
kusano 2b45e8
	addl	$1, %eax
kusano 2b45e8
#endif
kusano 2b45e8
	movl	%eax, KKK
kusano 2b45e8
#endif
kusano 2b45e8
	sarl	$3, %eax
kusano 2b45e8
	je	.L112
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
kusano 2b45e8
.L111:
kusano 2b45e8
	PREFETCH  (PREFETCHSIZE + 0) * SIZE(AO)
kusano 2b45e8
kusano 2b45e8
	mulpd	-16 * SIZE(BO), %xmm0
kusano 2b45e8
	ADD1	%xmm0, %xmm4
kusano 2b45e8
	movddup	-14 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	-16 * SIZE(BO), %xmm1
kusano 2b45e8
	ADD2	%xmm1, %xmm5
kusano 2b45e8
	movddup	-13 * SIZE(AO), %xmm1
kusano 2b45e8
kusano 2b45e8
	mulpd	-14 * SIZE(BO), %xmm0
kusano 2b45e8
	ADD1	%xmm0, %xmm6
kusano 2b45e8
	movddup	-12 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	-14 * SIZE(BO), %xmm1
kusano 2b45e8
	ADD2	%xmm1, %xmm7
kusano 2b45e8
	movddup	-11 * SIZE(AO), %xmm1
kusano 2b45e8
kusano 2b45e8
	mulpd	-12 * SIZE(BO), %xmm0
kusano 2b45e8
	ADD1	%xmm0, %xmm4
kusano 2b45e8
	movddup	-10 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	-12 * SIZE(BO), %xmm1
kusano 2b45e8
	ADD2	%xmm1, %xmm5
kusano 2b45e8
	movddup	 -9 * SIZE(AO), %xmm1
kusano 2b45e8
kusano 2b45e8
	mulpd	-10 * SIZE(BO), %xmm0
kusano 2b45e8
	ADD1	%xmm0, %xmm6
kusano 2b45e8
	movddup	 -8 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	-10 * SIZE(BO), %xmm1
kusano 2b45e8
	ADD2	%xmm1, %xmm7
kusano 2b45e8
	movddup	 -7 * SIZE(AO), %xmm1
kusano 2b45e8
kusano 2b45e8
	mulpd	 -8 * SIZE(BO), %xmm0
kusano 2b45e8
	ADD1	%xmm0, %xmm4
kusano 2b45e8
	movddup	 -6 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	 -8 * SIZE(BO), %xmm1
kusano 2b45e8
	ADD2	%xmm1, %xmm5
kusano 2b45e8
	movddup	 -5 * SIZE(AO), %xmm1
kusano 2b45e8
kusano 2b45e8
	mulpd	 -6 * SIZE(BO), %xmm0
kusano 2b45e8
	ADD1	%xmm0, %xmm6
kusano 2b45e8
	movddup	 -4 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	 -6 * SIZE(BO), %xmm1
kusano 2b45e8
	ADD2	%xmm1, %xmm7
kusano 2b45e8
	movddup	 -3 * SIZE(AO), %xmm1
kusano 2b45e8
kusano 2b45e8
	mulpd	 -4 * SIZE(BO), %xmm0
kusano 2b45e8
	ADD1	%xmm0, %xmm4
kusano 2b45e8
	movddup	 -2 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	 -4 * SIZE(BO), %xmm1
kusano 2b45e8
	ADD2	%xmm1, %xmm5
kusano 2b45e8
	movddup	 -1 * SIZE(AO), %xmm1
kusano 2b45e8
kusano 2b45e8
	mulpd	 -2 * SIZE(BO), %xmm0
kusano 2b45e8
	ADD1	%xmm0, %xmm6
kusano 2b45e8
	movddup	  0 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	 -2 * SIZE(BO), %xmm1
kusano 2b45e8
	ADD2	%xmm1, %xmm7
kusano 2b45e8
	movddup	  1 * SIZE(AO), %xmm1
kusano 2b45e8
kusano 2b45e8
	subl   $-16 * SIZE, AO
kusano 2b45e8
	subl   $-16 * SIZE, BO
kusano 2b45e8
	decl   %eax
kusano 2b45e8
	jne    .L111
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
kusano 2b45e8
.L112:
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	movl	K, %eax
kusano 2b45e8
#else
kusano 2b45e8
	movl	KKK, %eax
kusano 2b45e8
#endif
kusano 2b45e8
	andl	$7, %eax		# if (k & 1)
kusano 2b45e8
	BRANCH
kusano 2b45e8
	je .L114
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
kusano 2b45e8
.L113:
kusano 2b45e8
	mulpd	-16 * SIZE(BO), %xmm0
kusano 2b45e8
	ADD1	%xmm0, %xmm4
kusano 2b45e8
	movddup	-14 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	-16 * SIZE(BO), %xmm1
kusano 2b45e8
	ADD2	%xmm1, %xmm5
kusano 2b45e8
	movddup	-13 * SIZE(AO), %xmm1
kusano 2b45e8
kusano 2b45e8
	addl	$2 * SIZE, AO
kusano 2b45e8
	addl	$2 * SIZE, BO
kusano 2b45e8
	decl	%eax
kusano 2b45e8
	jg	.L113
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
kusano 2b45e8
.L114:
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	movupd	0 * SIZE(CO), %xmm0
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	movddup	ALPHA_R, %xmm2
kusano 2b45e8
	movddup ALPHA_I, %xmm3
kusano 2b45e8
kusano 2b45e8
	addpd	%xmm6, %xmm4
kusano 2b45e8
	addpd	%xmm7, %xmm5
kusano 2b45e8
kusano 2b45e8
	SHUFPD_1 %xmm5, %xmm5
kusano 2b45e8
kusano 2b45e8
#if defined(NN) || defined(NT) || defined(TN) || defined(TT) || \
kusano 2b45e8
    defined(RN) || defined(RT) || defined(CN) || defined(CT)
kusano 2b45e8
	addsubpd %xmm5,  %xmm4
kusano 2b45e8
	pshufd	$0x4e, %xmm4, %xmm5
kusano 2b45e8
#else
kusano 2b45e8
	addsubpd %xmm4,  %xmm5
kusano 2b45e8
	movapd	 %xmm5,  %xmm4
kusano 2b45e8
	pshufd	$0x4e, %xmm5,  %xmm5
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	mulpd	%xmm2, %xmm4
kusano 2b45e8
	mulpd	%xmm3, %xmm5
kusano 2b45e8
kusano 2b45e8
	addsubpd %xmm5, %xmm4
kusano 2b45e8
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	addpd	%xmm0, %xmm4
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	movlpd	%xmm4, 0 * SIZE(CO)
kusano 2b45e8
	movhpd	%xmm4, 1 * SIZE(CO)
kusano 2b45e8
kusano 2b45e8
#if (defined(TRMMKERNEL) &&  defined(LEFT) &&  defined(TRANSA)) || \
kusano 2b45e8
    (defined(TRMMKERNEL) && !defined(LEFT) && !defined(TRANSA))
kusano 2b45e8
	movl	K, %eax
kusano 2b45e8
	subl	KKK, %eax
kusano 2b45e8
	leal	(,%eax, SIZE), %eax
kusano 2b45e8
	leal	(AO, %eax, 2), AO
kusano 2b45e8
	leal	(BO, %eax, 2), BO
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
#if defined(TRMMKERNEL) && defined(LEFT)
kusano 2b45e8
	addl	$1, KK
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	addl	$2 * SIZE, CO		# coffset += 4
kusano 2b45e8
	decl	I			# i --
kusano 2b45e8
	jg	.L110
kusano 2b45e8
	ALIGN_4	
kusano 2b45e8
kusano 2b45e8
.L500:
kusano 2b45e8
	popl	%ebx
kusano 2b45e8
	popl	%esi
kusano 2b45e8
	popl	%edi
kusano 2b45e8
	popl	%ebp
kusano 2b45e8
kusano 2b45e8
	addl	$ARGS, %esp
kusano 2b45e8
kusano 2b45e8
	ret
kusano 2b45e8
kusano 2b45e8
	EPILOGUE