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 OLD_M	%rdi
kusano 2b45e8
#define OLD_N	%rsi
kusano 2b45e8
#define M	%r13
kusano 2b45e8
#define N	%r14
kusano 2b45e8
#define K	%rdx
kusano 2b45e8
kusano 2b45e8
#define A	%rcx
kusano 2b45e8
#define B	%r8
kusano 2b45e8
#define C	%r9
kusano 2b45e8
#define LDC	%r10
kusano 2b45e8
#define I	%r11
kusano 2b45e8
#define AO	%rdi
kusano 2b45e8
#define BO	%rsi
kusano 2b45e8
#define	CO1	%r15
kusano 2b45e8
#define CO2	%rbp
kusano 2b45e8
#define BB	%r12
kusano 2b45e8
kusano 2b45e8
#ifndef WINDOWS_ABI
kusano 2b45e8
kusano 2b45e8
#define STACKSIZE 64
kusano 2b45e8
kusano 2b45e8
#else
kusano 2b45e8
kusano 2b45e8
#define STACKSIZE 256
kusano 2b45e8
kusano 2b45e8
#define OLD_ALPHA_I	40 + STACKSIZE(%rsp)
kusano 2b45e8
#define OLD_A		48 + STACKSIZE(%rsp)
kusano 2b45e8
#define OLD_B		56 + STACKSIZE(%rsp)
kusano 2b45e8
#define OLD_C		64 + STACKSIZE(%rsp)
kusano 2b45e8
#define OLD_LDC		72 + STACKSIZE(%rsp)
kusano 2b45e8
#define OLD_OFFSET	80 + STACKSIZE(%rsp)
kusano 2b45e8
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
#define POSINV	  0(%rsp)
kusano 2b45e8
#define ALPHA_R	 16(%rsp)
kusano 2b45e8
#define ALPHA_I	 32(%rsp)
kusano 2b45e8
#define J	 48(%rsp)
kusano 2b45e8
#define OFFSET	 56(%rsp)
kusano 2b45e8
#define KK	 64(%rsp)
kusano 2b45e8
#define KKK	 72(%rsp)
kusano 2b45e8
#define BUFFER	256(%rsp)
kusano 2b45e8
kusano 2b45e8
#ifdef OPTERON
kusano 2b45e8
#define PREFETCH     prefetch
kusano 2b45e8
#define PREFETCHW    prefetchw
kusano 2b45e8
#define PREFETCHSIZE (8 * 9 + 4)
kusano 2b45e8
kusano 2b45e8
#define RPREFETCHSIZE (8 *  7 + 4)
kusano 2b45e8
#define WPREFETCHSIZE (8 *  8 + 4)
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
#ifdef GENERIC
kusano 2b45e8
#define PREFETCH     prefetcht0
kusano 2b45e8
#define PREFETCHW    prefetcht0
kusano 2b45e8
#define PREFETCHSIZE (8 * 5 + 4)
kusano 2b45e8
kusano 2b45e8
#define RPREFETCHSIZE (8 *  7 + 4)
kusano 2b45e8
#define WPREFETCHSIZE (8 *  8 + 4)
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
#ifndef GENERIC
kusano 2b45e8
#define KERNEL1(xx) \
kusano 2b45e8
	mulpd	%xmm0, %xmm1 ;\
kusano 2b45e8
	addpd	%xmm1, %xmm8 ;\
kusano 2b45e8
	movapd	-16 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm1 ;\
kusano 2b45e8
	mulpd	%xmm0, %xmm3 ;\
kusano 2b45e8
	addpd	%xmm3, %xmm9 ;\
kusano 2b45e8
	movapd	-14 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm3 ;\
kusano 2b45e8
	mulpd	%xmm0, %xmm5 ;\
kusano 2b45e8
	PREFETCH	(PREFETCHSIZE     +  0) * SIZE + 1 * (xx) * SIZE(AO, %rax, 4) ;\
kusano 2b45e8
	mulpd	-10 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm0 ;\
kusano 2b45e8
	addpd	%xmm5, %xmm10 ;\
kusano 2b45e8
	movapd	-12 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm5 ;\
kusano 2b45e8
	addpd	%xmm0, %xmm11 ;\
kusano 2b45e8
	movapd	-8 * SIZE + 1 * (xx) * SIZE(AO, %rax, 4), %xmm0
kusano 2b45e8
kusano 2b45e8
#define KERNEL2(xx) \
kusano 2b45e8
	mulpd	%xmm2, %xmm1 ;\
kusano 2b45e8
	addpd	%xmm1, %xmm12 ;\
kusano 2b45e8
	movapd	 0 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm1 ;\
kusano 2b45e8
	mulpd	%xmm2, %xmm3 ;\
kusano 2b45e8
	addpd	%xmm3, %xmm13 ;\
kusano 2b45e8
	movapd	-6 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm3 ;\
kusano 2b45e8
	mulpd	%xmm2, %xmm5 ;\
kusano 2b45e8
	mulpd	-10 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm2 ;\
kusano 2b45e8
	addpd	%xmm5, %xmm14 ;\
kusano 2b45e8
	movapd	 -4 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm5 ;\
kusano 2b45e8
	addpd	%xmm2, %xmm15 ;\
kusano 2b45e8
	movapd	-6 * SIZE + 1 * (xx) * SIZE(AO, %rax, 4), %xmm2
kusano 2b45e8
kusano 2b45e8
#define KERNEL3(xx) \
kusano 2b45e8
	mulpd	%xmm4, %xmm7 ;\
kusano 2b45e8
	addpd	%xmm7, %xmm8 ;\
kusano 2b45e8
	movapd	-8 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm7 ;\
kusano 2b45e8
	mulpd	%xmm4, %xmm3 ;\
kusano 2b45e8
	addpd	%xmm3, %xmm9 ;\
kusano 2b45e8
	movapd	-6 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm3 ;\
kusano 2b45e8
	mulpd	%xmm4, %xmm5 ;\
kusano 2b45e8
	mulpd	-2 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm4 ;\
kusano 2b45e8
	addpd	%xmm5, %xmm10 ;\
kusano 2b45e8
	movapd	-4 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm5 ;\
kusano 2b45e8
	addpd	%xmm4, %xmm11 ;\
kusano 2b45e8
	movapd	-4 * SIZE + 1 * (xx) * SIZE(AO, %rax, 4), %xmm4
kusano 2b45e8
kusano 2b45e8
#define KERNEL4(xx) \
kusano 2b45e8
	mulpd	%xmm6, %xmm7 ;\
kusano 2b45e8
	addpd	%xmm7, %xmm12 ;\
kusano 2b45e8
	movapd	 8 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm7 ;\
kusano 2b45e8
	mulpd	%xmm6, %xmm3 ;\
kusano 2b45e8
	addpd	%xmm3, %xmm13 ;\
kusano 2b45e8
	movapd	 2 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm3 ;\
kusano 2b45e8
	mulpd	%xmm6, %xmm5 ;\
kusano 2b45e8
	mulpd	-2 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm6 ;\
kusano 2b45e8
	addpd	%xmm5, %xmm14 ;\
kusano 2b45e8
	movapd	 4 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm5 ;\
kusano 2b45e8
 	PREFETCH	(PREFETCHSIZE     +  8) * SIZE + 1 * (xx) * SIZE(AO, %rax, 4) ;\
kusano 2b45e8
	addpd	%xmm6, %xmm15 ;\
kusano 2b45e8
	movapd	-2 * SIZE + 1 * (xx) * SIZE(AO, %rax, 4), %xmm6
kusano 2b45e8
kusano 2b45e8
#define KERNEL5(xx) \
kusano 2b45e8
	mulpd	%xmm0, %xmm1 ;\
kusano 2b45e8
	addpd	%xmm1, %xmm8 ;\
kusano 2b45e8
	movapd	 0 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm1 ;\
kusano 2b45e8
	mulpd	%xmm0, %xmm3 ;\
kusano 2b45e8
	addpd	%xmm3, %xmm9 ;\
kusano 2b45e8
	movapd	 2 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm3 ;\
kusano 2b45e8
	mulpd	%xmm0, %xmm5 ;\
kusano 2b45e8
	mulpd	 6 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm0 ;\
kusano 2b45e8
	addpd	%xmm5, %xmm10 ;\
kusano 2b45e8
	movapd	 4 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm5 ;\
kusano 2b45e8
	addpd	%xmm0, %xmm11 ;\
kusano 2b45e8
	movapd	 0 * SIZE + 1 * (xx) * SIZE(AO, %rax, 4), %xmm0
kusano 2b45e8
kusano 2b45e8
#define KERNEL6(xx) \
kusano 2b45e8
	mulpd	%xmm2, %xmm1 ;\
kusano 2b45e8
	addpd	%xmm1, %xmm12 ;\
kusano 2b45e8
	movapd	16 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm1 ;\
kusano 2b45e8
	mulpd	%xmm2, %xmm3 ;\
kusano 2b45e8
	addpd	%xmm3, %xmm13 ;\
kusano 2b45e8
	movapd	10 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm3 ;\
kusano 2b45e8
	mulpd	%xmm2, %xmm5 ;\
kusano 2b45e8
	mulpd	 6 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm2 ;\
kusano 2b45e8
	addpd	%xmm5, %xmm14 ;\
kusano 2b45e8
	movapd	12 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm5 ;\
kusano 2b45e8
	addpd	%xmm2, %xmm15 ;\
kusano 2b45e8
	movapd	 2 * SIZE + 1 * (xx) * SIZE(AO, %rax, 4), %xmm2
kusano 2b45e8
kusano 2b45e8
#define KERNEL7(xx) \
kusano 2b45e8
	mulpd	%xmm4, %xmm7 ;\
kusano 2b45e8
	addpd	%xmm7, %xmm8 ;\
kusano 2b45e8
	movapd	 8 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm7 ;\
kusano 2b45e8
	mulpd	%xmm4, %xmm3 ;\
kusano 2b45e8
	addpd	%xmm3, %xmm9 ;\
kusano 2b45e8
	movapd	10 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm3 ;\
kusano 2b45e8
	mulpd	%xmm4, %xmm5 ;\
kusano 2b45e8
	mulpd	14 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm4 ;\
kusano 2b45e8
	addpd	%xmm5, %xmm10 ;\
kusano 2b45e8
	movapd	12 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm5 ;\
kusano 2b45e8
	addpd	%xmm4, %xmm11 ;\
kusano 2b45e8
	movapd	 4 * SIZE + 1 * (xx) * SIZE(AO, %rax, 4), %xmm4
kusano 2b45e8
kusano 2b45e8
#define KERNEL8(xx) \
kusano 2b45e8
	mulpd	%xmm6, %xmm7 ;\
kusano 2b45e8
	addpd	%xmm7, %xmm12 ;\
kusano 2b45e8
	movapd	24 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm7 ;\
kusano 2b45e8
	mulpd	%xmm6, %xmm3 ;\
kusano 2b45e8
	addpd	%xmm3, %xmm13 ;\
kusano 2b45e8
	movapd	18 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm3 ;\
kusano 2b45e8
	mulpd	%xmm6, %xmm5 ;\
kusano 2b45e8
	mulpd	14 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm6 ;\
kusano 2b45e8
	addpd	%xmm5, %xmm14 ;\
kusano 2b45e8
	movapd	20 * SIZE + 2 * (xx) * SIZE(BO, %rax, 8), %xmm5 ;\
kusano 2b45e8
	addpd	%xmm6, %xmm15 ;\
kusano 2b45e8
	movapd	 6 * SIZE + 1 * (xx) * SIZE(AO, %rax, 4), %xmm6
kusano 2b45e8
kusano 2b45e8
#else
kusano 2b45e8
#define KERNEL1(xx) \
kusano 2b45e8
	mulpd	%xmm0, %xmm1 ;\
kusano 2b45e8
	addpd	%xmm1, %xmm8 ;\
kusano 2b45e8
	movapd	-16 * SIZE + 2 * (xx) * SIZE(BO), %xmm1 ;\
kusano 2b45e8
	mulpd	%xmm0, %xmm3 ;\
kusano 2b45e8
	addpd	%xmm3, %xmm9 ;\
kusano 2b45e8
	movapd	-14 * SIZE + 2 * (xx) * SIZE(BO), %xmm3 ;\
kusano 2b45e8
	mulpd	%xmm0, %xmm5 ;\
kusano 2b45e8
	PREFETCH	(PREFETCHSIZE     +  0) * SIZE + 1 * (xx) * SIZE(AO) ;\
kusano 2b45e8
	mulpd	-10 * SIZE + 2 * (xx) * SIZE(BO), %xmm0 ;\
kusano 2b45e8
	addpd	%xmm5, %xmm10 ;\
kusano 2b45e8
	movapd	-12 * SIZE + 2 * (xx) * SIZE(BO), %xmm5 ;\
kusano 2b45e8
	addpd	%xmm0, %xmm11 ;\
kusano 2b45e8
	movapd	-8 * SIZE + 1 * (xx) * SIZE(AO), %xmm0
kusano 2b45e8
kusano 2b45e8
#define KERNEL2(xx) \
kusano 2b45e8
	mulpd	%xmm2, %xmm1 ;\
kusano 2b45e8
	addpd	%xmm1, %xmm12 ;\
kusano 2b45e8
	movapd	 0 * SIZE + 2 * (xx) * SIZE(BO), %xmm1 ;\
kusano 2b45e8
	mulpd	%xmm2, %xmm3 ;\
kusano 2b45e8
	addpd	%xmm3, %xmm13 ;\
kusano 2b45e8
	movapd	-6 * SIZE + 2 * (xx) * SIZE(BO), %xmm3 ;\
kusano 2b45e8
	mulpd	%xmm2, %xmm5 ;\
kusano 2b45e8
	mulpd	-10 * SIZE + 2 * (xx) * SIZE(BO), %xmm2 ;\
kusano 2b45e8
	addpd	%xmm5, %xmm14 ;\
kusano 2b45e8
	movapd	 -4 * SIZE + 2 * (xx) * SIZE(BO), %xmm5 ;\
kusano 2b45e8
	addpd	%xmm2, %xmm15 ;\
kusano 2b45e8
	movapd	-6 * SIZE + 1 * (xx) * SIZE(AO), %xmm2
kusano 2b45e8
kusano 2b45e8
#define KERNEL3(xx) \
kusano 2b45e8
	mulpd	%xmm4, %xmm7 ;\
kusano 2b45e8
	addpd	%xmm7, %xmm8 ;\
kusano 2b45e8
	movapd	-8 * SIZE + 2 * (xx) * SIZE(BO), %xmm7 ;\
kusano 2b45e8
	mulpd	%xmm4, %xmm3 ;\
kusano 2b45e8
	addpd	%xmm3, %xmm9 ;\
kusano 2b45e8
	movapd	-6 * SIZE + 2 * (xx) * SIZE(BO), %xmm3 ;\
kusano 2b45e8
	mulpd	%xmm4, %xmm5 ;\
kusano 2b45e8
	mulpd	-2 * SIZE + 2 * (xx) * SIZE(BO), %xmm4 ;\
kusano 2b45e8
	addpd	%xmm5, %xmm10 ;\
kusano 2b45e8
	movapd	-4 * SIZE + 2 * (xx) * SIZE(BO), %xmm5 ;\
kusano 2b45e8
	addpd	%xmm4, %xmm11 ;\
kusano 2b45e8
	movapd	-4 * SIZE + 1 * (xx) * SIZE(AO), %xmm4
kusano 2b45e8
kusano 2b45e8
#define KERNEL4(xx) \
kusano 2b45e8
	mulpd	%xmm6, %xmm7 ;\
kusano 2b45e8
	addpd	%xmm7, %xmm12 ;\
kusano 2b45e8
	movapd	 8 * SIZE + 2 * (xx) * SIZE(BO), %xmm7 ;\
kusano 2b45e8
	mulpd	%xmm6, %xmm3 ;\
kusano 2b45e8
	addpd	%xmm3, %xmm13 ;\
kusano 2b45e8
	movapd	 2 * SIZE + 2 * (xx) * SIZE(BO), %xmm3 ;\
kusano 2b45e8
	mulpd	%xmm6, %xmm5 ;\
kusano 2b45e8
	mulpd	-2 * SIZE + 2 * (xx) * SIZE(BO), %xmm6 ;\
kusano 2b45e8
	addpd	%xmm5, %xmm14 ;\
kusano 2b45e8
	movapd	 4 * SIZE + 2 * (xx) * SIZE(BO), %xmm5 ;\
kusano 2b45e8
 	PREFETCH	(PREFETCHSIZE     +  8) * SIZE + 1 * (xx) * SIZE(AO) ;\
kusano 2b45e8
	addpd	%xmm6, %xmm15 ;\
kusano 2b45e8
	movapd	-2 * SIZE + 1 * (xx) * SIZE(AO), %xmm6
kusano 2b45e8
kusano 2b45e8
#define KERNEL5(xx) \
kusano 2b45e8
	mulpd	%xmm0, %xmm1 ;\
kusano 2b45e8
	addpd	%xmm1, %xmm8 ;\
kusano 2b45e8
	movapd	 0 * SIZE + 2 * (xx) * SIZE(BO), %xmm1 ;\
kusano 2b45e8
	mulpd	%xmm0, %xmm3 ;\
kusano 2b45e8
	addpd	%xmm3, %xmm9 ;\
kusano 2b45e8
	movapd	 2 * SIZE + 2 * (xx) * SIZE(BO), %xmm3 ;\
kusano 2b45e8
	mulpd	%xmm0, %xmm5 ;\
kusano 2b45e8
	mulpd	 6 * SIZE + 2 * (xx) * SIZE(BO), %xmm0 ;\
kusano 2b45e8
	addpd	%xmm5, %xmm10 ;\
kusano 2b45e8
	movapd	 4 * SIZE + 2 * (xx) * SIZE(BO), %xmm5 ;\
kusano 2b45e8
	addpd	%xmm0, %xmm11 ;\
kusano 2b45e8
	movapd	 0 * SIZE + 1 * (xx) * SIZE(AO), %xmm0
kusano 2b45e8
kusano 2b45e8
#define KERNEL6(xx) \
kusano 2b45e8
	mulpd	%xmm2, %xmm1 ;\
kusano 2b45e8
	addpd	%xmm1, %xmm12 ;\
kusano 2b45e8
	movapd	16 * SIZE + 2 * (xx) * SIZE(BO), %xmm1 ;\
kusano 2b45e8
	mulpd	%xmm2, %xmm3 ;\
kusano 2b45e8
	addpd	%xmm3, %xmm13 ;\
kusano 2b45e8
	movapd	10 * SIZE + 2 * (xx) * SIZE(BO), %xmm3 ;\
kusano 2b45e8
	mulpd	%xmm2, %xmm5 ;\
kusano 2b45e8
	mulpd	 6 * SIZE + 2 * (xx) * SIZE(BO), %xmm2 ;\
kusano 2b45e8
	addpd	%xmm5, %xmm14 ;\
kusano 2b45e8
	movapd	12 * SIZE + 2 * (xx) * SIZE(BO), %xmm5 ;\
kusano 2b45e8
	addpd	%xmm2, %xmm15 ;\
kusano 2b45e8
	movapd	 2 * SIZE + 1 * (xx) * SIZE(AO), %xmm2
kusano 2b45e8
kusano 2b45e8
#define KERNEL7(xx) \
kusano 2b45e8
	mulpd	%xmm4, %xmm7 ;\
kusano 2b45e8
	addpd	%xmm7, %xmm8 ;\
kusano 2b45e8
	movapd	 8 * SIZE + 2 * (xx) * SIZE(BO), %xmm7 ;\
kusano 2b45e8
	mulpd	%xmm4, %xmm3 ;\
kusano 2b45e8
	addpd	%xmm3, %xmm9 ;\
kusano 2b45e8
	movapd	10 * SIZE + 2 * (xx) * SIZE(BO), %xmm3 ;\
kusano 2b45e8
	mulpd	%xmm4, %xmm5 ;\
kusano 2b45e8
	mulpd	14 * SIZE + 2 * (xx) * SIZE(BO), %xmm4 ;\
kusano 2b45e8
	addpd	%xmm5, %xmm10 ;\
kusano 2b45e8
	movapd	12 * SIZE + 2 * (xx) * SIZE(BO), %xmm5 ;\
kusano 2b45e8
	addpd	%xmm4, %xmm11 ;\
kusano 2b45e8
	movapd	 4 * SIZE + 1 * (xx) * SIZE(AO), %xmm4
kusano 2b45e8
kusano 2b45e8
#define KERNEL8(xx) \
kusano 2b45e8
	mulpd	%xmm6, %xmm7 ;\
kusano 2b45e8
	addpd	%xmm7, %xmm12 ;\
kusano 2b45e8
	movapd	24 * SIZE + 2 * (xx) * SIZE(BO), %xmm7 ;\
kusano 2b45e8
	mulpd	%xmm6, %xmm3 ;\
kusano 2b45e8
	addpd	%xmm3, %xmm13 ;\
kusano 2b45e8
	movapd	18 * SIZE + 2 * (xx) * SIZE(BO), %xmm3 ;\
kusano 2b45e8
	mulpd	%xmm6, %xmm5 ;\
kusano 2b45e8
	mulpd	14 * SIZE + 2 * (xx) * SIZE(BO), %xmm6 ;\
kusano 2b45e8
	addpd	%xmm5, %xmm14 ;\
kusano 2b45e8
	movapd	20 * SIZE + 2 * (xx) * SIZE(BO), %xmm5 ;\
kusano 2b45e8
	addpd	%xmm6, %xmm15 ;\
kusano 2b45e8
	movapd	 6 * SIZE + 1 * (xx) * SIZE(AO), %xmm6
kusano 2b45e8
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	PROLOGUE
kusano 2b45e8
	PROFCODE
kusano 2b45e8
	
kusano 2b45e8
	subq	$STACKSIZE, %rsp
kusano 2b45e8
	
kusano 2b45e8
	movq	%rbx,  0(%rsp)
kusano 2b45e8
	movq	%rbp,  8(%rsp)
kusano 2b45e8
	movq	%r12, 16(%rsp)
kusano 2b45e8
	movq	%r13, 24(%rsp)
kusano 2b45e8
	movq	%r14, 32(%rsp)
kusano 2b45e8
	movq	%r15, 40(%rsp)
kusano 2b45e8
kusano 2b45e8
#ifdef WINDOWS_ABI
kusano 2b45e8
	movq	%rdi,    48(%rsp)
kusano 2b45e8
	movq	%rsi,    56(%rsp)
kusano 2b45e8
	movups	%xmm6,   64(%rsp)
kusano 2b45e8
	movups	%xmm7,   80(%rsp)
kusano 2b45e8
	movups	%xmm8,   96(%rsp)
kusano 2b45e8
	movups	%xmm9,  112(%rsp)
kusano 2b45e8
	movups	%xmm10, 128(%rsp)
kusano 2b45e8
	movups	%xmm11, 144(%rsp)
kusano 2b45e8
	movups	%xmm12, 160(%rsp)
kusano 2b45e8
	movups	%xmm13, 176(%rsp)
kusano 2b45e8
	movups	%xmm14, 192(%rsp)
kusano 2b45e8
	movups	%xmm15, 208(%rsp)
kusano 2b45e8
kusano 2b45e8
	movq	ARG1,      OLD_M
kusano 2b45e8
	movq	ARG2,      OLD_N
kusano 2b45e8
	movq	ARG3,      K
kusano 2b45e8
	movq	OLD_A,     A
kusano 2b45e8
	movq	OLD_B,     B
kusano 2b45e8
	movq	OLD_C,     C
kusano 2b45e8
	movq	OLD_LDC,   LDC
kusano 2b45e8
#ifdef TRMMKERNEL
kusano 2b45e8
	movsd	OLD_OFFSET, %xmm12
kusano 2b45e8
#endif
kusano 2b45e8
	movaps	%xmm3,       %xmm0
kusano 2b45e8
	movsd	OLD_ALPHA_I, %xmm1
kusano 2b45e8
#else
kusano 2b45e8
	movq	72(%rsp), LDC
kusano 2b45e8
#ifdef TRMMKERNEL
kusano 2b45e8
	movsd	80(%rsp), %xmm12
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	EMMS
kusano 2b45e8
kusano 2b45e8
	movq	%rsp, %rbx	# save old stack
kusano 2b45e8
	subq	$256 + LOCAL_BUFFER_SIZE, %rsp
kusano 2b45e8
	andq	$-4096, %rsp	# align stack
kusano 2b45e8
kusano 2b45e8
	STACK_TOUCHING
kusano 2b45e8
		
kusano 2b45e8
	movq	OLD_M, M
kusano 2b45e8
	movq	OLD_N, N
kusano 2b45e8
kusano 2b45e8
	pcmpeqb	%xmm7, %xmm7
kusano 2b45e8
	psllq	$63, %xmm7	# Generate mask
kusano 2b45e8
	pxor	%xmm10, %xmm10
kusano 2b45e8
kusano 2b45e8
	movlpd	 %xmm0, 0 + ALPHA_R
kusano 2b45e8
	movlpd	 %xmm0, 8 + ALPHA_R
kusano 2b45e8
	
kusano 2b45e8
	movlpd	 %xmm1, 8 + ALPHA_I
kusano 2b45e8
	xorpd	 %xmm7, %xmm1
kusano 2b45e8
	movlpd	 %xmm1, 0 + ALPHA_I
kusano 2b45e8
kusano 2b45e8
	movlpd	  %xmm10,  0 + POSINV
kusano 2b45e8
	movlpd	  %xmm7, 8 + POSINV
kusano 2b45e8
kusano 2b45e8
#ifdef TRMMKERNEL
kusano 2b45e8
	movlpd	%xmm12, OFFSET
kusano 2b45e8
	movlpd	%xmm12, KK
kusano 2b45e8
#ifndef LEFT
kusano 2b45e8
	negq	KK
kusano 2b45e8
#endif	
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	subq	$-16 * SIZE, A
kusano 2b45e8
kusano 2b45e8
	salq	$ZBASE_SHIFT, LDC
kusano 2b45e8
	
kusano 2b45e8
	movq	N,  J
kusano 2b45e8
	sarq	$1, J		# j = (n >> 2)
kusano 2b45e8
	jle	.L100
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
kusano 2b45e8
.L01:
kusano 2b45e8
	movq	C, CO1			# coffset1 = c
kusano 2b45e8
	leaq	(C, LDC, 1), CO2	# coffset2 = c + ldc
kusano 2b45e8
kusano 2b45e8
#if defined(TRMMKERNEL) && defined(LEFT)
kusano 2b45e8
	movq	OFFSET, %rax
kusano 2b45e8
	movq	%rax, KK
kusano 2b45e8
#endif	
kusano 2b45e8
kusano 2b45e8
	leaq	16 * SIZE + BUFFER, BO
kusano 2b45e8
kusano 2b45e8
	movq	K, %rax
kusano 2b45e8
	sarq	$2, %rax
kusano 2b45e8
	jle	.L03
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
	
kusano 2b45e8
.L02:
kusano 2b45e8
	PREFETCH	 (RPREFETCHSIZE +  0)  * SIZE(B)
kusano 2b45e8
kusano 2b45e8
	movq	 0 * SIZE(B), %mm0
kusano 2b45e8
	movq	%mm0,  -16 * SIZE(BO)
kusano 2b45e8
	movq	%mm0,  -15 * SIZE(BO)
kusano 2b45e8
	movq	 1 * SIZE(B), %mm1
kusano 2b45e8
	movq	%mm1,  -14 * SIZE(BO)
kusano 2b45e8
	movq	%mm1,  -13 * SIZE(BO)
kusano 2b45e8
kusano 2b45e8
	movq	 2 * SIZE(B), %mm2
kusano 2b45e8
	movq	%mm2,  -12 * SIZE(BO)
kusano 2b45e8
	movq	%mm2,  -11 * SIZE(BO)
kusano 2b45e8
	movq	 3 * SIZE(B), %mm3
kusano 2b45e8
	movq	%mm3,  -10 * SIZE(BO)
kusano 2b45e8
	movq	%mm3,   -9 * SIZE(BO)
kusano 2b45e8
kusano 2b45e8
	PREFETCHW	 (WPREFETCHSIZE +  0)  * SIZE(BO)
kusano 2b45e8
kusano 2b45e8
	movq	 4 * SIZE(B), %mm4
kusano 2b45e8
	movq	%mm4,   -8 * SIZE(BO)
kusano 2b45e8
	movq	%mm4,   -7 * SIZE(BO)
kusano 2b45e8
	movq	 5 * SIZE(B), %mm5
kusano 2b45e8
	movq	%mm5,   -6 * SIZE(BO)
kusano 2b45e8
	movq	%mm5,   -5 * SIZE(BO)
kusano 2b45e8
kusano 2b45e8
	PREFETCHW	 (WPREFETCHSIZE +  8)  * SIZE(BO)
kusano 2b45e8
kusano 2b45e8
	movq	 6 * SIZE(B), %mm6
kusano 2b45e8
	movq	%mm6,   -4 * SIZE(BO)
kusano 2b45e8
	movq	%mm6,   -3 * SIZE(BO)
kusano 2b45e8
	movq	 7 * SIZE(B), %mm7
kusano 2b45e8
	movq	%mm7,   -2 * SIZE(BO)
kusano 2b45e8
	movq	%mm7,   -1 * SIZE(BO)
kusano 2b45e8
kusano 2b45e8
	PREFETCH	 (RPREFETCHSIZE +  8)  * SIZE(B)
kusano 2b45e8
kusano 2b45e8
	movq	 8 * SIZE(B), %mm0
kusano 2b45e8
	movq	%mm0,   0 * SIZE(BO)
kusano 2b45e8
	movq	%mm0,   1 * SIZE(BO)
kusano 2b45e8
	movq	 9 * SIZE(B), %mm1
kusano 2b45e8
	movq	%mm1,   2 * SIZE(BO)
kusano 2b45e8
	movq	%mm1,   3 * SIZE(BO)
kusano 2b45e8
kusano 2b45e8
	movq	10 * SIZE(B), %mm2
kusano 2b45e8
	movq	%mm2,   4 * SIZE(BO)
kusano 2b45e8
	movq	%mm2,   5 * SIZE(BO)
kusano 2b45e8
	movq	11 * SIZE(B), %mm3
kusano 2b45e8
	movq	%mm3,   6 * SIZE(BO)
kusano 2b45e8
	movq	%mm3,   7 * SIZE(BO)
kusano 2b45e8
kusano 2b45e8
	PREFETCHW	 (WPREFETCHSIZE + 16)  * SIZE(BO)
kusano 2b45e8
kusano 2b45e8
	movq	12 * SIZE(B), %mm4
kusano 2b45e8
	movq	%mm4,   8 * SIZE(BO)
kusano 2b45e8
	movq	%mm4,   9 * SIZE(BO)
kusano 2b45e8
	movq	13 * SIZE(B), %mm5
kusano 2b45e8
	movq	%mm5,  10 * SIZE(BO)
kusano 2b45e8
	movq	%mm5,  11 * SIZE(BO)
kusano 2b45e8
kusano 2b45e8
	PREFETCHW	 (WPREFETCHSIZE + 24)  * SIZE(BO)
kusano 2b45e8
kusano 2b45e8
	movq	14 * SIZE(B), %mm6
kusano 2b45e8
	movq	%mm6,  12 * SIZE(BO)
kusano 2b45e8
	movq	%mm6,  13 * SIZE(BO)
kusano 2b45e8
	movq	15 * SIZE(B), %mm7
kusano 2b45e8
	movq	%mm7,  14 * SIZE(BO)
kusano 2b45e8
	movq	%mm7,  15 * SIZE(BO)
kusano 2b45e8
kusano 2b45e8
	addq	$ 32 * SIZE, BO
kusano 2b45e8
	subq	$-16 * SIZE, B
kusano 2b45e8
	decq	%rax
kusano 2b45e8
	jne	.L02
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
kusano 2b45e8
.L03:
kusano 2b45e8
	movq	K, %rax
kusano 2b45e8
	andq	$3, %rax
kusano 2b45e8
	BRANCH
kusano 2b45e8
	jle	.L05
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
kusano 2b45e8
.L04:
kusano 2b45e8
	movq	 0 * SIZE(B), %mm0
kusano 2b45e8
	movq	%mm0, -16 * SIZE(BO)
kusano 2b45e8
	movq	%mm0, -15 * SIZE(BO)
kusano 2b45e8
	movq	 1 * SIZE(B), %mm1
kusano 2b45e8
	movq	%mm1, -14 * SIZE(BO)
kusano 2b45e8
	movq	%mm1, -13 * SIZE(BO)
kusano 2b45e8
kusano 2b45e8
	movq	 2 * SIZE(B), %mm2
kusano 2b45e8
	movq	%mm2, -12 * SIZE(BO)
kusano 2b45e8
	movq	%mm2, -11 * SIZE(BO)
kusano 2b45e8
	movq	 3 * SIZE(B), %mm3
kusano 2b45e8
	movq	%mm3, -10 * SIZE(BO)
kusano 2b45e8
	movq	%mm3,  -9 * SIZE(BO)
kusano 2b45e8
kusano 2b45e8
	addq	$ 4 * SIZE, B
kusano 2b45e8
	addq	$ 8 * SIZE, BO
kusano 2b45e8
kusano 2b45e8
	decq	%rax
kusano 2b45e8
	jne	.L04
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
	
kusano 2b45e8
.L05:
kusano 2b45e8
	movq	A, AO		# aoffset = a
kusano 2b45e8
kusano 2b45e8
	leaq	 (RPREFETCHSIZE +  0)  * SIZE(B), BB
kusano 2b45e8
kusano 2b45e8
	movq	M,  I
kusano 2b45e8
	sarq	$1, I		# i = (m >> 2)
kusano 2b45e8
	jle	.L30
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
	leaq	16 * SIZE + BUFFER, BO
kusano 2b45e8
#else
kusano 2b45e8
	leaq	16 * SIZE + BUFFER, BO
kusano 2b45e8
	movq	KK, %rax
kusano 2b45e8
	leaq	(, %rax, SIZE), %rax
kusano 2b45e8
	leaq	(AO, %rax, 4), AO
kusano 2b45e8
	leaq	(BO, %rax, 8), BO
kusano 2b45e8
#endif	
kusano 2b45e8
kusano 2b45e8
	movapd	-16 * SIZE(AO), %xmm0
kusano 2b45e8
	movapd	-16 * SIZE(BO), %xmm1
kusano 2b45e8
	pxor	%xmm8, %xmm8
kusano 2b45e8
	PREFETCH	  0  * SIZE(BB)
kusano 2b45e8
	movapd	-14 * SIZE(AO), %xmm2
kusano 2b45e8
	movapd	-14 * SIZE(BO), %xmm3
kusano 2b45e8
	pxor	%xmm9, %xmm9
kusano 2b45e8
	movapd	-12 * SIZE(AO), %xmm4
kusano 2b45e8
	movapd	-12 * SIZE(BO), %xmm5
kusano 2b45e8
	pxor	%xmm10, %xmm10
kusano 2b45e8
	movapd	-10 * SIZE(AO), %xmm6
kusano 2b45e8
	movapd	 -8 * SIZE(BO), %xmm7
kusano 2b45e8
	pxor	%xmm11, %xmm11
kusano 2b45e8
kusano 2b45e8
	pxor	%xmm12, %xmm12
kusano 2b45e8
	PREFETCHW      3 * SIZE(CO1)
kusano 2b45e8
	pxor	%xmm13, %xmm13
kusano 2b45e8
	PREFETCHW      3 * SIZE(CO2)
kusano 2b45e8
	pxor	%xmm14, %xmm14
kusano 2b45e8
	pxor	%xmm15, %xmm15
kusano 2b45e8
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	movq	K, %rax
kusano 2b45e8
#elif (defined(LEFT) && !defined(TRANSA)) || (!defined(LEFT) && defined(TRANSA))
kusano 2b45e8
	movq	K, %rax
kusano 2b45e8
	subq	KK, %rax
kusano 2b45e8
	movq	%rax, KKK	
kusano 2b45e8
#else
kusano 2b45e8
	movq	KK, %rax
kusano 2b45e8
#ifdef LEFT
kusano 2b45e8
	addq	$2, %rax
kusano 2b45e8
#else
kusano 2b45e8
	addq	$2, %rax
kusano 2b45e8
#endif
kusano 2b45e8
	movq	%rax, KKK
kusano 2b45e8
#endif
kusano 2b45e8
#ifndef GENERIC
kusano 2b45e8
	andq	$-8, %rax
kusano 2b45e8
kusano 2b45e8
	leaq	(, %rax, SIZE), %rax
kusano 2b45e8
	leaq	(AO, %rax, 4), AO
kusano 2b45e8
	leaq	(BO, %rax, 8), BO
kusano 2b45e8
	negq	%rax
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
kusano 2b45e8
	KERNEL1(16 *  1)
kusano 2b45e8
	KERNEL2(16 *  1)
kusano 2b45e8
	KERNEL3(16 *  1)
kusano 2b45e8
	KERNEL4(16 *  1)
kusano 2b45e8
	KERNEL5(16 *  1)
kusano 2b45e8
	KERNEL6(16 *  1)
kusano 2b45e8
	KERNEL7(16 *  1)
kusano 2b45e8
	KERNEL8(16 *  1)
kusano 2b45e8
kusano 2b45e8
	addq	$8 * SIZE, %rax
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
kusano 2b45e8
	KERNEL1(16 *  1)
kusano 2b45e8
	KERNEL2(16 *  1)
kusano 2b45e8
	KERNEL3(16 *  1)
kusano 2b45e8
	KERNEL4(16 *  1)
kusano 2b45e8
	KERNEL5(16 *  1)
kusano 2b45e8
	KERNEL6(16 *  1)
kusano 2b45e8
	KERNEL7(16 *  1)
kusano 2b45e8
	KERNEL8(16 *  1)
kusano 2b45e8
kusano 2b45e8
	addq	$8 * SIZE, %rax
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
kusano 2b45e8
	KERNEL1(16 *  1)
kusano 2b45e8
	KERNEL2(16 *  1)
kusano 2b45e8
	KERNEL3(16 *  1)
kusano 2b45e8
	KERNEL4(16 *  1)
kusano 2b45e8
	KERNEL5(16 *  1)
kusano 2b45e8
	KERNEL6(16 *  1)
kusano 2b45e8
	KERNEL7(16 *  1)
kusano 2b45e8
	KERNEL8(16 *  1)
kusano 2b45e8
kusano 2b45e8
	addq	$8 * SIZE, %rax
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
kusano 2b45e8
	KERNEL1(16 *  1)
kusano 2b45e8
	KERNEL2(16 *  1)
kusano 2b45e8
	KERNEL3(16 *  1)
kusano 2b45e8
	KERNEL4(16 *  1)
kusano 2b45e8
	KERNEL5(16 *  1)
kusano 2b45e8
	KERNEL6(16 *  1)
kusano 2b45e8
	KERNEL7(16 *  1)
kusano 2b45e8
	KERNEL8(16 *  1)
kusano 2b45e8
kusano 2b45e8
	addq	$8 * SIZE, %rax
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
kusano 2b45e8
	KERNEL1(16 *  1)
kusano 2b45e8
	KERNEL2(16 *  1)
kusano 2b45e8
	KERNEL3(16 *  1)
kusano 2b45e8
	KERNEL4(16 *  1)
kusano 2b45e8
	KERNEL5(16 *  1)
kusano 2b45e8
	KERNEL6(16 *  1)
kusano 2b45e8
	KERNEL7(16 *  1)
kusano 2b45e8
	KERNEL8(16 *  1)
kusano 2b45e8
kusano 2b45e8
	addq	$8 * SIZE, %rax
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
kusano 2b45e8
	KERNEL1(16 *  1)
kusano 2b45e8
	KERNEL2(16 *  1)
kusano 2b45e8
	KERNEL3(16 *  1)
kusano 2b45e8
	KERNEL4(16 *  1)
kusano 2b45e8
	KERNEL5(16 *  1)
kusano 2b45e8
	KERNEL6(16 *  1)
kusano 2b45e8
	KERNEL7(16 *  1)
kusano 2b45e8
	KERNEL8(16 *  1)
kusano 2b45e8
kusano 2b45e8
	addq	$8 * SIZE, %rax
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
kusano 2b45e8
	KERNEL1(16 *  1)
kusano 2b45e8
	KERNEL2(16 *  1)
kusano 2b45e8
	KERNEL3(16 *  1)
kusano 2b45e8
	KERNEL4(16 *  1)
kusano 2b45e8
	KERNEL5(16 *  1)
kusano 2b45e8
	KERNEL6(16 *  1)
kusano 2b45e8
	KERNEL7(16 *  1)
kusano 2b45e8
	KERNEL8(16 *  1)
kusano 2b45e8
kusano 2b45e8
	addq	$8 * SIZE, %rax
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
kusano 2b45e8
	KERNEL1(16 *  1)
kusano 2b45e8
	KERNEL2(16 *  1)
kusano 2b45e8
	KERNEL3(16 *  1)
kusano 2b45e8
	KERNEL4(16 *  1)
kusano 2b45e8
	KERNEL5(16 *  1)
kusano 2b45e8
	KERNEL6(16 *  1)
kusano 2b45e8
	KERNEL7(16 *  1)
kusano 2b45e8
	KERNEL8(16 *  1)
kusano 2b45e8
kusano 2b45e8
	addq	$8 * SIZE, %rax
kusano 2b45e8
	BRANCH
kusano 2b45e8
	jl	.L12
kusano 2b45e8
	ALIGN_3
kusano 2b45e8
kusano 2b45e8
.L15:
kusano 2b45e8
	PREFETCH	  8  * SIZE(BB)
kusano 2b45e8
	subq	 $-16 * SIZE, BB
kusano 2b45e8
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	movq	K, %rax
kusano 2b45e8
#else
kusano 2b45e8
	movq	KKK, %rax
kusano 2b45e8
#endif
kusano 2b45e8
	testq	$4, %rax
kusano 2b45e8
	je .L16
kusano 2b45e8
	xorq	%rax, %rax
kusano 2b45e8
	ALIGN_3
kusano 2b45e8
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
kusano 2b45e8
	addq	$32 * SIZE, BO
kusano 2b45e8
	addq	$16 * SIZE, AO
kusano 2b45e8
	ALIGN_3
kusano 2b45e8
#else
kusano 2b45e8
	sarq	$2, %rax
kusano 2b45e8
	NOBRANCH
kusano 2b45e8
	jle	.L16
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
kusano 2b45e8
	addq	$ 32 * SIZE, BO
kusano 2b45e8
	subq	$-16 * SIZE, AO
kusano 2b45e8
	decq	%rax
kusano 2b45e8
	BRANCH
kusano 2b45e8
	jg	.L12
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
.L16:
kusano 2b45e8
	movapd	POSINV,  %xmm5
kusano 2b45e8
	movapd	ALPHA_R, %xmm6
kusano 2b45e8
	movapd	ALPHA_I, %xmm7
kusano 2b45e8
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	movq	K, %rax
kusano 2b45e8
#else
kusano 2b45e8
	movq	KKK, %rax
kusano 2b45e8
#endif
kusano 2b45e8
	andq	$3, %rax		# if (k & 1)
kusano 2b45e8
	je .L19
kusano 2b45e8
kusano 2b45e8
	leaq	(, %rax, SIZE), %rax
kusano 2b45e8
	leaq	(AO, %rax, 4), AO
kusano 2b45e8
	leaq	(BO, %rax, 8), BO
kusano 2b45e8
	negq	%rax
kusano 2b45e8
	ALIGN_3
kusano 2b45e8
kusano 2b45e8
.L17:
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	addpd	%xmm1, %xmm8
kusano 2b45e8
	movapd	-14 * SIZE(BO, %rax, 8), %xmm1
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	addpd	%xmm1, %xmm9
kusano 2b45e8
	movapd	-12 * SIZE(BO, %rax, 8), %xmm1
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	mulpd	-10 * SIZE(BO, %rax, 8), %xmm0
kusano 2b45e8
	addpd	%xmm1, %xmm10
kusano 2b45e8
	movapd	-16 * SIZE(BO, %rax, 8), %xmm1
kusano 2b45e8
	addpd	%xmm0, %xmm11
kusano 2b45e8
	movapd	-12 * SIZE(AO, %rax, 4), %xmm0
kusano 2b45e8
	mulpd	%xmm2, %xmm1
kusano 2b45e8
	addpd	%xmm1, %xmm12
kusano 2b45e8
	movapd	-14 * SIZE(BO, %rax, 8), %xmm1
kusano 2b45e8
	mulpd	%xmm2, %xmm1
kusano 2b45e8
	addpd	%xmm1, %xmm13
kusano 2b45e8
	movapd	-12 * SIZE(BO, %rax, 8), %xmm1
kusano 2b45e8
	mulpd	%xmm2, %xmm1
kusano 2b45e8
	mulpd	-10 * SIZE(BO, %rax, 8), %xmm2
kusano 2b45e8
	addpd	%xmm1, %xmm14
kusano 2b45e8
	movapd	 -8 * SIZE(BO, %rax, 8), %xmm1
kusano 2b45e8
	addpd	%xmm2, %xmm15
kusano 2b45e8
	movapd	-10 * SIZE(AO, %rax, 4), %xmm2
kusano 2b45e8
kusano 2b45e8
	addq	$SIZE, %rax
kusano 2b45e8
	jl	.L17
kusano 2b45e8
	ALIGN_3
kusano 2b45e8
kusano 2b45e8
.L19:
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	movlpd	0 * SIZE(CO1), %xmm0
kusano 2b45e8
	movhpd	1 * SIZE(CO1), %xmm0
kusano 2b45e8
	movlpd	2 * SIZE(CO1), %xmm2
kusano 2b45e8
	movhpd	3 * SIZE(CO1), %xmm2
kusano 2b45e8
kusano 2b45e8
	movlpd	0 * SIZE(CO2), %xmm1
kusano 2b45e8
	movhpd	1 * SIZE(CO2), %xmm1
kusano 2b45e8
	movlpd	2 * SIZE(CO2), %xmm3
kusano 2b45e8
	movhpd	3 * SIZE(CO2), %xmm3
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	SHUFPD_1 %xmm9, %xmm9
kusano 2b45e8
	SHUFPD_1 %xmm11, %xmm11
kusano 2b45e8
	SHUFPD_1 %xmm13, %xmm13
kusano 2b45e8
	SHUFPD_1 %xmm15, %xmm15
kusano 2b45e8
kusano 2b45e8
#if defined(NN) || defined(NT) || defined(TN) || defined(TT) || \
kusano 2b45e8
    defined(NR) || defined(NC) || defined(TR) || defined(TC)
kusano 2b45e8
	xorpd	%xmm5, %xmm9
kusano 2b45e8
	xorpd	%xmm5, %xmm11
kusano 2b45e8
	xorpd	%xmm5, %xmm13
kusano 2b45e8
	xorpd	%xmm5, %xmm15
kusano 2b45e8
#else
kusano 2b45e8
	xorpd	%xmm5, %xmm8
kusano 2b45e8
	xorpd	%xmm5, %xmm10
kusano 2b45e8
	xorpd	%xmm5, %xmm12
kusano 2b45e8
	xorpd	%xmm5, %xmm14
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
#if defined(NN) || defined(NT) || defined(TN) || defined(TT) || \
kusano 2b45e8
    defined(RR) || defined(RC) || defined(CR) || defined(CC)
kusano 2b45e8
	subpd	%xmm9, %xmm8
kusano 2b45e8
	subpd	%xmm11, %xmm10
kusano 2b45e8
	subpd	%xmm13, %xmm12
kusano 2b45e8
	subpd	%xmm15, %xmm14
kusano 2b45e8
#else
kusano 2b45e8
	addpd	%xmm9, %xmm8
kusano 2b45e8
	addpd	%xmm11, %xmm10
kusano 2b45e8
	addpd	%xmm13, %xmm12
kusano 2b45e8
	addpd	%xmm15, %xmm14
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	pshufd	$0x4e, %xmm8, %xmm9
kusano 2b45e8
	pshufd	$0x4e, %xmm10, %xmm11
kusano 2b45e8
	pshufd	$0x4e, %xmm12, %xmm13
kusano 2b45e8
	pshufd	$0x4e, %xmm14, %xmm15
kusano 2b45e8
	
kusano 2b45e8
	mulpd	%xmm6, %xmm8
kusano 2b45e8
	mulpd	%xmm7, %xmm9
kusano 2b45e8
	mulpd	%xmm6, %xmm10
kusano 2b45e8
	mulpd	%xmm7, %xmm11
kusano 2b45e8
kusano 2b45e8
	mulpd	%xmm6, %xmm12
kusano 2b45e8
	mulpd	%xmm7, %xmm13
kusano 2b45e8
	mulpd	%xmm6, %xmm14
kusano 2b45e8
	mulpd	%xmm7, %xmm15
kusano 2b45e8
kusano 2b45e8
	addpd	%xmm9, %xmm8
kusano 2b45e8
	addpd	%xmm11, %xmm10
kusano 2b45e8
	addpd	%xmm13, %xmm12
kusano 2b45e8
	addpd	%xmm15, %xmm14
kusano 2b45e8
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	addpd	%xmm0,  %xmm8
kusano 2b45e8
	addpd	%xmm2, %xmm12
kusano 2b45e8
	addpd	%xmm1,  %xmm10
kusano 2b45e8
	addpd	%xmm3, %xmm14
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	movlpd	%xmm8, 0 * SIZE(CO1)
kusano 2b45e8
	movhpd	%xmm8, 1 * SIZE(CO1)
kusano 2b45e8
	movlpd	%xmm12, 2 * SIZE(CO1)
kusano 2b45e8
	movhpd	%xmm12, 3 * SIZE(CO1)
kusano 2b45e8
kusano 2b45e8
	movlpd	%xmm10, 0 * SIZE(CO2)
kusano 2b45e8
	movhpd	%xmm10, 1 * SIZE(CO2)
kusano 2b45e8
	movlpd	%xmm14, 2 * SIZE(CO2)
kusano 2b45e8
	movhpd	%xmm14, 3 * SIZE(CO2)
kusano 2b45e8
kusano 2b45e8
#if (defined(TRMMKERNEL) &&  defined(LEFT) &&  defined(TRANSA)) || \
kusano 2b45e8
    (defined(TRMMKERNEL) && !defined(LEFT) && !defined(TRANSA))
kusano 2b45e8
	movq	K, %rax
kusano 2b45e8
	subq	KKK, %rax
kusano 2b45e8
	leaq	(,%rax, SIZE), %rax
kusano 2b45e8
	leaq	(AO, %rax, 4), AO
kusano 2b45e8
	leaq	(BO, %rax, 8), BO
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
#if defined(TRMMKERNEL) && defined(LEFT)
kusano 2b45e8
	addq	$2, KK
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	addq	$4 * SIZE, CO1		# coffset += 4
kusano 2b45e8
	addq	$4 * SIZE, CO2		# coffset += 4
kusano 2b45e8
	decq	I			# i --
kusano 2b45e8
	jg	.L10
kusano 2b45e8
	ALIGN_4	
kusano 2b45e8
kusano 2b45e8
.L30:
kusano 2b45e8
	testq	$1, M
kusano 2b45e8
	jle	.L99
kusano 2b45e8
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
	leaq	16 * SIZE + BUFFER, BO
kusano 2b45e8
#else
kusano 2b45e8
	leaq	16 * SIZE + BUFFER, BO
kusano 2b45e8
	movq	KK, %rax
kusano 2b45e8
	leaq	(, %rax, SIZE), %rax
kusano 2b45e8
	leaq	(AO, %rax, 2), AO
kusano 2b45e8
	leaq	(BO, %rax, 8), BO
kusano 2b45e8
#endif	
kusano 2b45e8
kusano 2b45e8
	movapd	-16 * SIZE(AO), %xmm0
kusano 2b45e8
	pxor	%xmm8, %xmm8
kusano 2b45e8
	movapd	 -8 * SIZE(AO), %xmm2
kusano 2b45e8
	pxor	%xmm9, %xmm9
kusano 2b45e8
	movapd	-16 * SIZE(BO), %xmm1
kusano 2b45e8
	pxor	%xmm10, %xmm10
kusano 2b45e8
	movapd	 -8 * SIZE(BO), %xmm3
kusano 2b45e8
	pxor	%xmm11, %xmm11
kusano 2b45e8
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	movq	K, %rax
kusano 2b45e8
#elif (defined(LEFT) && !defined(TRANSA)) || (!defined(LEFT) && defined(TRANSA))
kusano 2b45e8
	movq	K, %rax
kusano 2b45e8
	subq	KK, %rax
kusano 2b45e8
	movq	%rax, KKK	
kusano 2b45e8
#else
kusano 2b45e8
	movq	KK, %rax
kusano 2b45e8
#ifdef LEFT
kusano 2b45e8
	addq	$1, %rax
kusano 2b45e8
#else
kusano 2b45e8
	addq	$2, %rax
kusano 2b45e8
#endif
kusano 2b45e8
	movq	%rax, KKK
kusano 2b45e8
#endif
kusano 2b45e8
	sarq	$3, %rax
kusano 2b45e8
	je	.L44
kusano 2b45e8
	ALIGN_4	
kusano 2b45e8
kusano 2b45e8
.L41:
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	addpd	%xmm1, %xmm8
kusano 2b45e8
	movapd	-14 * SIZE(BO), %xmm1
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	PREFETCH	(PREFETCHSIZE     +  0) * SIZE(AO)
kusano 2b45e8
	addpd	%xmm1, %xmm9
kusano 2b45e8
	movapd	-12 * SIZE(BO), %xmm1
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	mulpd	-10 * SIZE(BO), %xmm0
kusano 2b45e8
	addpd	%xmm1, %xmm10
kusano 2b45e8
	movapd	  0 * SIZE(BO), %xmm1
kusano 2b45e8
	addpd	%xmm0, %xmm11
kusano 2b45e8
	movapd	-14 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	%xmm0, %xmm3
kusano 2b45e8
	addpd	%xmm3, %xmm8
kusano 2b45e8
	movapd	 -6 * SIZE(BO), %xmm3
kusano 2b45e8
	mulpd	%xmm0, %xmm3
kusano 2b45e8
	addpd	%xmm3, %xmm9
kusano 2b45e8
	movapd	 -4 * SIZE(BO), %xmm3
kusano 2b45e8
	mulpd	%xmm0, %xmm3
kusano 2b45e8
	mulpd	 -2 * SIZE(BO), %xmm0
kusano 2b45e8
	addpd	%xmm3, %xmm10
kusano 2b45e8
	movapd	  8 * SIZE(BO), %xmm3
kusano 2b45e8
	addpd	%xmm0, %xmm11
kusano 2b45e8
	movapd	-12 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	addpd	%xmm1, %xmm8
kusano 2b45e8
	movapd	  2 * SIZE(BO), %xmm1
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	PREFETCH	(PREFETCHSIZE     +  8) * SIZE(AO)
kusano 2b45e8
	addpd	%xmm1, %xmm9
kusano 2b45e8
	movapd	  4 * SIZE(BO), %xmm1
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	mulpd	  6 * SIZE(BO), %xmm0
kusano 2b45e8
	addpd	%xmm1, %xmm10
kusano 2b45e8
	movapd	 16 * SIZE(BO), %xmm1
kusano 2b45e8
	addpd	%xmm0, %xmm11
kusano 2b45e8
	movapd	-10 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	%xmm0, %xmm3
kusano 2b45e8
	addpd	%xmm3, %xmm8
kusano 2b45e8
	movapd	 10 * SIZE(BO), %xmm3
kusano 2b45e8
	mulpd	%xmm0, %xmm3
kusano 2b45e8
	addpd	%xmm3, %xmm9
kusano 2b45e8
	movapd	 12 * SIZE(BO), %xmm3
kusano 2b45e8
	mulpd	%xmm0, %xmm3
kusano 2b45e8
	mulpd	 14 * SIZE(BO), %xmm0
kusano 2b45e8
	addpd	%xmm3, %xmm10
kusano 2b45e8
	movapd	 24 * SIZE(BO), %xmm3
kusano 2b45e8
	addpd	%xmm0, %xmm11
kusano 2b45e8
	movapd	  0 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	%xmm2, %xmm1
kusano 2b45e8
	addpd	%xmm1, %xmm8
kusano 2b45e8
	movapd	 18 * SIZE(BO), %xmm1
kusano 2b45e8
	mulpd	%xmm2, %xmm1
kusano 2b45e8
	addpd	%xmm1, %xmm9
kusano 2b45e8
	movapd	 20 * SIZE(BO), %xmm1
kusano 2b45e8
	mulpd	%xmm2, %xmm1
kusano 2b45e8
	mulpd	 22 * SIZE(BO), %xmm2
kusano 2b45e8
	addpd	%xmm1, %xmm10
kusano 2b45e8
	movapd	 32 * SIZE(BO), %xmm1
kusano 2b45e8
	addpd	%xmm2, %xmm11
kusano 2b45e8
	movapd	 -6 * SIZE(AO), %xmm2
kusano 2b45e8
	mulpd	%xmm2, %xmm3
kusano 2b45e8
	addpd	%xmm3, %xmm8
kusano 2b45e8
	movapd	 26 * SIZE(BO), %xmm3
kusano 2b45e8
	mulpd	%xmm2, %xmm3
kusano 2b45e8
	addpd	%xmm3, %xmm9
kusano 2b45e8
	movapd	 28 * SIZE(BO), %xmm3
kusano 2b45e8
	mulpd	%xmm2, %xmm3
kusano 2b45e8
	mulpd	 30 * SIZE(BO), %xmm2
kusano 2b45e8
	addpd	%xmm3, %xmm10
kusano 2b45e8
	movapd	 40 * SIZE(BO), %xmm3
kusano 2b45e8
	addpd	%xmm2, %xmm11
kusano 2b45e8
	movapd	 -4 * SIZE(AO), %xmm2
kusano 2b45e8
	mulpd	%xmm2, %xmm1
kusano 2b45e8
	addpd	%xmm1, %xmm8
kusano 2b45e8
	movapd	 34 * SIZE(BO), %xmm1
kusano 2b45e8
	mulpd	%xmm2, %xmm1
kusano 2b45e8
	addpd	%xmm1, %xmm9
kusano 2b45e8
	movapd	 36 * SIZE(BO), %xmm1
kusano 2b45e8
	mulpd	%xmm2, %xmm1
kusano 2b45e8
	mulpd	 38 * SIZE(BO), %xmm2
kusano 2b45e8
	addpd	%xmm1, %xmm10
kusano 2b45e8
	movapd	 48 * SIZE(BO), %xmm1
kusano 2b45e8
	addpd	%xmm2, %xmm11
kusano 2b45e8
	movapd	 -2 * SIZE(AO), %xmm2
kusano 2b45e8
	mulpd	%xmm2, %xmm3
kusano 2b45e8
	addpd	%xmm3, %xmm8
kusano 2b45e8
	movapd	 42 * SIZE(BO), %xmm3
kusano 2b45e8
	mulpd	%xmm2, %xmm3
kusano 2b45e8
	addpd	%xmm3, %xmm9
kusano 2b45e8
	movapd	 44 * SIZE(BO), %xmm3
kusano 2b45e8
	mulpd	%xmm2, %xmm3
kusano 2b45e8
	mulpd	 46 * SIZE(BO), %xmm2
kusano 2b45e8
	addpd	%xmm3, %xmm10
kusano 2b45e8
	movapd	 56 * SIZE(BO), %xmm3
kusano 2b45e8
	addpd	%xmm2, %xmm11
kusano 2b45e8
	movapd	  8 * SIZE(AO), %xmm2
kusano 2b45e8
kusano 2b45e8
	subq   $-16 * SIZE, AO
kusano 2b45e8
	addq   $64 * SIZE, BO
kusano 2b45e8
	decq   %rax
kusano 2b45e8
	jne    .L41
kusano 2b45e8
	ALIGN_4	
kusano 2b45e8
kusano 2b45e8
.L44:
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	movq	K, %rax
kusano 2b45e8
#else
kusano 2b45e8
	movq	KKK, %rax
kusano 2b45e8
#endif
kusano 2b45e8
	andq	$4, %rax
kusano 2b45e8
	BRANCH
kusano 2b45e8
	jle .L45
kusano 2b45e8
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	addpd	%xmm1, %xmm8
kusano 2b45e8
	movapd	-14 * SIZE(BO), %xmm1
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	addpd	%xmm1, %xmm9
kusano 2b45e8
	movapd	-12 * SIZE(BO), %xmm1
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	mulpd	-10 * SIZE(BO), %xmm0
kusano 2b45e8
	addpd	%xmm1, %xmm10
kusano 2b45e8
	movapd	  0 * SIZE(BO), %xmm1
kusano 2b45e8
	addpd	%xmm0, %xmm11
kusano 2b45e8
	movapd	-14 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	%xmm0, %xmm3
kusano 2b45e8
	addpd	%xmm3, %xmm8
kusano 2b45e8
	movapd	 -6 * SIZE(BO), %xmm3
kusano 2b45e8
	mulpd	%xmm0, %xmm3
kusano 2b45e8
	addpd	%xmm3, %xmm9
kusano 2b45e8
	movapd	 -4 * SIZE(BO), %xmm3
kusano 2b45e8
	mulpd	%xmm0, %xmm3
kusano 2b45e8
	mulpd	 -2 * SIZE(BO), %xmm0
kusano 2b45e8
	addpd	%xmm3, %xmm10
kusano 2b45e8
	movapd	  8 * SIZE(BO), %xmm3
kusano 2b45e8
	addpd	%xmm0, %xmm11
kusano 2b45e8
	movapd	-12 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	addpd	%xmm1, %xmm8
kusano 2b45e8
	movapd	  2 * SIZE(BO), %xmm1
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	addpd	%xmm1, %xmm9
kusano 2b45e8
	movapd	  4 * SIZE(BO), %xmm1
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	mulpd	  6 * SIZE(BO), %xmm0
kusano 2b45e8
	addpd	%xmm1, %xmm10
kusano 2b45e8
	movapd	 16 * SIZE(BO), %xmm1
kusano 2b45e8
	addpd	%xmm0, %xmm11
kusano 2b45e8
	movapd	-10 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	%xmm0, %xmm3
kusano 2b45e8
	addpd	%xmm3, %xmm8
kusano 2b45e8
	movapd	 10 * SIZE(BO), %xmm3
kusano 2b45e8
	mulpd	%xmm0, %xmm3
kusano 2b45e8
	addpd	%xmm3, %xmm9
kusano 2b45e8
	movapd	 12 * SIZE(BO), %xmm3
kusano 2b45e8
	mulpd	%xmm0, %xmm3
kusano 2b45e8
	mulpd	 14 * SIZE(BO), %xmm0
kusano 2b45e8
	addpd	%xmm3, %xmm10
kusano 2b45e8
	movapd	 24 * SIZE(BO), %xmm3
kusano 2b45e8
	addpd	%xmm0, %xmm11
kusano 2b45e8
	movapd	 -8 * SIZE(AO), %xmm0
kusano 2b45e8
kusano 2b45e8
	addq   $ 8 * SIZE, AO
kusano 2b45e8
	addq   $32 * SIZE, BO
kusano 2b45e8
	ALIGN_4	
kusano 2b45e8
kusano 2b45e8
.L45:
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	movq	K, %rax
kusano 2b45e8
#else
kusano 2b45e8
	movq	KKK, %rax
kusano 2b45e8
#endif
kusano 2b45e8
	movapd	POSINV,  %xmm5
kusano 2b45e8
	movapd	ALPHA_R, %xmm6
kusano 2b45e8
	movapd	ALPHA_I, %xmm7
kusano 2b45e8
	andq	$3, %rax		# if (k & 1)
kusano 2b45e8
	BRANCH
kusano 2b45e8
	jle .L47
kusano 2b45e8
	ALIGN_4	
kusano 2b45e8
kusano 2b45e8
.L46:
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	addpd	%xmm1, %xmm8
kusano 2b45e8
	movapd	-14 * SIZE(BO), %xmm1
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	addpd	%xmm1, %xmm9
kusano 2b45e8
	movapd	-12 * SIZE(BO), %xmm1
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	mulpd	-10 * SIZE(BO), %xmm0
kusano 2b45e8
	addpd	%xmm1, %xmm10
kusano 2b45e8
	movapd	 -8 * SIZE(BO), %xmm1
kusano 2b45e8
	addpd	%xmm0, %xmm11
kusano 2b45e8
	movapd	-14 * SIZE(AO), %xmm0
kusano 2b45e8
kusano 2b45e8
	addq	$2 * SIZE, AO
kusano 2b45e8
	addq	$8 * SIZE, BO
kusano 2b45e8
kusano 2b45e8
	decq	%rax
kusano 2b45e8
	jg	.L46
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
kusano 2b45e8
.L47:
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	movlpd	0 * SIZE(CO1), %xmm0
kusano 2b45e8
	movhpd	1 * SIZE(CO1), %xmm0
kusano 2b45e8
	movlpd	0 * SIZE(CO2), %xmm1
kusano 2b45e8
	movhpd	1 * SIZE(CO2), %xmm1
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	SHUFPD_1 %xmm9, %xmm9
kusano 2b45e8
	SHUFPD_1 %xmm11, %xmm11
kusano 2b45e8
kusano 2b45e8
#if defined(NN) || defined(NT) || defined(TN) || defined(TT) || \
kusano 2b45e8
    defined(NR) || defined(NC) || defined(TR) || defined(TC)
kusano 2b45e8
	xorpd	%xmm5, %xmm9
kusano 2b45e8
	xorpd	%xmm5, %xmm11
kusano 2b45e8
#else
kusano 2b45e8
	xorpd	%xmm5, %xmm8
kusano 2b45e8
	xorpd	%xmm5, %xmm10
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
#if defined(NN) || defined(NT) || defined(TN) || defined(TT) || \
kusano 2b45e8
    defined(RR) || defined(RC) || defined(CR) || defined(CC)
kusano 2b45e8
	subpd	%xmm9, %xmm8
kusano 2b45e8
	subpd	%xmm11, %xmm10
kusano 2b45e8
#else
kusano 2b45e8
	addpd	%xmm9, %xmm8
kusano 2b45e8
	addpd	%xmm11, %xmm10
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	pshufd	$0x4e, %xmm8, %xmm9
kusano 2b45e8
	pshufd	$0x4e, %xmm10, %xmm11
kusano 2b45e8
	
kusano 2b45e8
	mulpd	%xmm6, %xmm8
kusano 2b45e8
	mulpd	%xmm7, %xmm9
kusano 2b45e8
	mulpd	%xmm6, %xmm10
kusano 2b45e8
	mulpd	%xmm7, %xmm11
kusano 2b45e8
kusano 2b45e8
	addpd	%xmm9, %xmm8
kusano 2b45e8
	addpd	%xmm11, %xmm10
kusano 2b45e8
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	addpd	%xmm0,  %xmm8
kusano 2b45e8
	addpd	%xmm1,  %xmm10
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	movlpd	%xmm8, 0 * SIZE(CO1)
kusano 2b45e8
	movhpd	%xmm8, 1 * SIZE(CO1)
kusano 2b45e8
	movlpd	%xmm10, 0 * SIZE(CO2)
kusano 2b45e8
	movhpd	%xmm10, 1 * SIZE(CO2)
kusano 2b45e8
kusano 2b45e8
#if (defined(TRMMKERNEL) &&  defined(LEFT) &&  defined(TRANSA)) || \
kusano 2b45e8
    (defined(TRMMKERNEL) && !defined(LEFT) && !defined(TRANSA))
kusano 2b45e8
	movq	K, %rax
kusano 2b45e8
	subq	KKK, %rax
kusano 2b45e8
	leaq	(,%rax, SIZE), %rax
kusano 2b45e8
	leaq	(AO, %rax, 2), AO
kusano 2b45e8
	leaq	(BO, %rax, 8), BO
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
#if defined(TRMMKERNEL) && defined(LEFT)
kusano 2b45e8
	addq	$1, KK
kusano 2b45e8
#endif
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
	leaq	(C, LDC, 2), C		# c += 2 * ldc
kusano 2b45e8
	decq	J			# j --
kusano 2b45e8
	jg	.L01
kusano 2b45e8
kusano 2b45e8
.L100:
kusano 2b45e8
	testq	$1, N
kusano 2b45e8
	jle	.L999
kusano 2b45e8
kusano 2b45e8
.L101:
kusano 2b45e8
#if defined(TRMMKERNEL) && defined(LEFT)
kusano 2b45e8
	movq	OFFSET, %rax
kusano 2b45e8
	movq	%rax, KK
kusano 2b45e8
#endif	
kusano 2b45e8
kusano 2b45e8
/* Copying to Sub Buffer */
kusano 2b45e8
	leaq	BUFFER, BO
kusano 2b45e8
kusano 2b45e8
	movq	K, %rax
kusano 2b45e8
	sarq	$2, %rax
kusano 2b45e8
	jle	.L103
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
	
kusano 2b45e8
.L102:
kusano 2b45e8
	movlpd	 0 * SIZE(B), %xmm8
kusano 2b45e8
	movlpd	 1 * SIZE(B), %xmm9
kusano 2b45e8
	movlpd	 2 * SIZE(B), %xmm10
kusano 2b45e8
	movlpd	 3 * SIZE(B), %xmm11
kusano 2b45e8
	movlpd	 4 * SIZE(B), %xmm12
kusano 2b45e8
	movlpd	 5 * SIZE(B), %xmm13
kusano 2b45e8
	movlpd	 6 * SIZE(B), %xmm14
kusano 2b45e8
	movlpd	 7 * SIZE(B), %xmm15
kusano 2b45e8
kusano 2b45e8
	movlpd	%xmm8,  0 * SIZE(BO)
kusano 2b45e8
	movlpd	%xmm8,  1 * SIZE(BO)
kusano 2b45e8
	movlpd	%xmm9,  2 * SIZE(BO)
kusano 2b45e8
	movlpd	%xmm9,  3 * SIZE(BO)
kusano 2b45e8
	movlpd	%xmm10,  4 * SIZE(BO)
kusano 2b45e8
	movlpd	%xmm10,  5 * SIZE(BO)
kusano 2b45e8
	movlpd	%xmm11,  6 * SIZE(BO)
kusano 2b45e8
	movlpd	%xmm11,  7 * SIZE(BO)
kusano 2b45e8
	movlpd	%xmm12,  8 * SIZE(BO)
kusano 2b45e8
	movlpd	%xmm12,  9 * SIZE(BO)
kusano 2b45e8
	movlpd	%xmm13, 10 * SIZE(BO)
kusano 2b45e8
	movlpd	%xmm13, 11 * SIZE(BO)
kusano 2b45e8
	movlpd	%xmm14, 12 * SIZE(BO)
kusano 2b45e8
	movlpd	%xmm14, 13 * SIZE(BO)
kusano 2b45e8
	movlpd	%xmm15, 14 * SIZE(BO)
kusano 2b45e8
	movlpd	%xmm15, 15 * SIZE(BO)
kusano 2b45e8
kusano 2b45e8
	subq	$-16 * SIZE, BO
kusano 2b45e8
	addq	$ 8 * SIZE, B
kusano 2b45e8
	decq	%rax
kusano 2b45e8
	jne	.L102
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
kusano 2b45e8
.L103:
kusano 2b45e8
	movq	K, %rax
kusano 2b45e8
	andq	$3, %rax
kusano 2b45e8
	BRANCH
kusano 2b45e8
	jle	.L105
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
kusano 2b45e8
.L104:
kusano 2b45e8
	movlpd	 0 * SIZE(B), %xmm8
kusano 2b45e8
	movlpd	 1 * SIZE(B), %xmm9
kusano 2b45e8
kusano 2b45e8
	movlpd	%xmm8,  0 * SIZE(BO)
kusano 2b45e8
	movlpd	%xmm8,  1 * SIZE(BO)
kusano 2b45e8
	movlpd	%xmm9,  2 * SIZE(BO)
kusano 2b45e8
	movlpd	%xmm9,  3 * SIZE(BO)
kusano 2b45e8
kusano 2b45e8
	addq	$4 * SIZE, BO
kusano 2b45e8
	addq	$2 * SIZE, B
kusano 2b45e8
	decq	%rax
kusano 2b45e8
	jne	.L104
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
	
kusano 2b45e8
.L105:
kusano 2b45e8
	movq	C, CO1		# coffset1 = c
kusano 2b45e8
	movq	A, AO		# aoffset = a
kusano 2b45e8
kusano 2b45e8
	movq	M,  I
kusano 2b45e8
	sarq	$1, I		# i = (m >> 2)
kusano 2b45e8
	jle	.L130
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
	leaq	16 * SIZE + BUFFER, BO
kusano 2b45e8
#else
kusano 2b45e8
	leaq	16 * SIZE + BUFFER, BO
kusano 2b45e8
	movq	KK, %rax
kusano 2b45e8
	leaq	(, %rax, SIZE), %rax
kusano 2b45e8
	leaq	(AO, %rax, 4), AO
kusano 2b45e8
	leaq	(BO, %rax, 4), BO
kusano 2b45e8
#endif	
kusano 2b45e8
kusano 2b45e8
	movapd	-16 * SIZE(AO), %xmm0
kusano 2b45e8
	pxor	%xmm8, %xmm8
kusano 2b45e8
	movapd	-16 * SIZE(BO), %xmm1
kusano 2b45e8
	pxor	%xmm9, %xmm9
kusano 2b45e8
	movapd	 -8 * SIZE(AO), %xmm2
kusano 2b45e8
	pxor	%xmm12, %xmm12
kusano 2b45e8
	movapd	 -8 * SIZE(BO), %xmm3
kusano 2b45e8
	pxor	%xmm13, %xmm13
kusano 2b45e8
	PREFETCHW      3 * SIZE(CO1)
kusano 2b45e8
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	movq	K, %rax
kusano 2b45e8
#elif (defined(LEFT) && !defined(TRANSA)) || (!defined(LEFT) && defined(TRANSA))
kusano 2b45e8
	movq	K, %rax
kusano 2b45e8
	subq	KK, %rax
kusano 2b45e8
	movq	%rax, KKK	
kusano 2b45e8
#else
kusano 2b45e8
	movq	KK, %rax
kusano 2b45e8
#ifdef LEFT
kusano 2b45e8
	addq	$2, %rax
kusano 2b45e8
#else
kusano 2b45e8
	addq	$1, %rax
kusano 2b45e8
#endif
kusano 2b45e8
	movq	%rax, KKK
kusano 2b45e8
#endif
kusano 2b45e8
	sarq	$2, %rax
kusano 2b45e8
	je	.L112
kusano 2b45e8
kusano 2b45e8
.L111:
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	PREFETCH	(PREFETCHSIZE     +  0) * SIZE(AO)
kusano 2b45e8
	mulpd	-14 * SIZE(BO), %xmm0
kusano 2b45e8
	addpd	%xmm1, %xmm8
kusano 2b45e8
	movapd	-16 * SIZE(BO), %xmm1
kusano 2b45e8
	addpd	%xmm0, %xmm9
kusano 2b45e8
	movapd	-14 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	mulpd	-14 * SIZE(BO), %xmm0
kusano 2b45e8
	addpd	%xmm1, %xmm12
kusano 2b45e8
	movapd	-12 * SIZE(BO), %xmm1
kusano 2b45e8
	addpd	%xmm0, %xmm13
kusano 2b45e8
	movapd	-12 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	mulpd	-10 * SIZE(BO), %xmm0
kusano 2b45e8
	addpd	%xmm1, %xmm8
kusano 2b45e8
	movapd	-12 * SIZE(BO), %xmm1
kusano 2b45e8
	addpd	%xmm0, %xmm9
kusano 2b45e8
	movapd	-10 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	mulpd	-10 * SIZE(BO), %xmm0
kusano 2b45e8
	addpd	%xmm1, %xmm12
kusano 2b45e8
	movapd	  0 * SIZE(BO), %xmm1
kusano 2b45e8
	addpd	%xmm0, %xmm13
kusano 2b45e8
	movapd	  0 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	%xmm2, %xmm3
kusano 2b45e8
	PREFETCH	(PREFETCHSIZE     +  8) * SIZE(AO)
kusano 2b45e8
	mulpd	 -6 * SIZE(BO), %xmm2
kusano 2b45e8
	addpd	%xmm3, %xmm8
kusano 2b45e8
	movapd	 -8 * SIZE(BO), %xmm3
kusano 2b45e8
	addpd	%xmm2, %xmm9
kusano 2b45e8
	movapd	 -6 * SIZE(AO), %xmm2
kusano 2b45e8
	mulpd	%xmm2, %xmm3
kusano 2b45e8
	mulpd	 -6 * SIZE(BO), %xmm2
kusano 2b45e8
	addpd	%xmm3, %xmm12
kusano 2b45e8
	movapd	 -4 * SIZE(BO), %xmm3
kusano 2b45e8
	addpd	%xmm2, %xmm13
kusano 2b45e8
	movapd	 -4 * SIZE(AO), %xmm2
kusano 2b45e8
	mulpd	%xmm2, %xmm3
kusano 2b45e8
	mulpd	 -2 * SIZE(BO), %xmm2
kusano 2b45e8
	addpd	%xmm3, %xmm8
kusano 2b45e8
	movapd	 -4 * SIZE(BO), %xmm3
kusano 2b45e8
	addpd	%xmm2, %xmm9
kusano 2b45e8
	movapd	 -2 * SIZE(AO), %xmm2
kusano 2b45e8
	mulpd	%xmm2, %xmm3
kusano 2b45e8
	mulpd	 -2 * SIZE(BO), %xmm2
kusano 2b45e8
	addpd	%xmm3, %xmm12
kusano 2b45e8
	movapd	  8 * SIZE(BO), %xmm3
kusano 2b45e8
	addpd	%xmm2, %xmm13
kusano 2b45e8
	movapd	  8 * SIZE(AO), %xmm2
kusano 2b45e8
kusano 2b45e8
	subq   $-16 * SIZE, AO
kusano 2b45e8
	subq   $-16 * SIZE, BO
kusano 2b45e8
	decq   %rax
kusano 2b45e8
	jne    .L111
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
kusano 2b45e8
.L112:
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	movq	K, %rax
kusano 2b45e8
#else
kusano 2b45e8
	movq	KKK, %rax
kusano 2b45e8
#endif
kusano 2b45e8
	movapd	POSINV,  %xmm5
kusano 2b45e8
	movapd	ALPHA_R, %xmm6
kusano 2b45e8
	movapd	ALPHA_I, %xmm7
kusano 2b45e8
	andq	$3, %rax		# if (k & 1)
kusano 2b45e8
	BRANCH
kusano 2b45e8
	jle .L114
kusano 2b45e8
kusano 2b45e8
.L113:
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	mulpd	 -14 * SIZE(BO), %xmm0
kusano 2b45e8
	addpd	%xmm1, %xmm8
kusano 2b45e8
	movapd	 -16 * SIZE(BO), %xmm1
kusano 2b45e8
	addpd	%xmm0, %xmm9
kusano 2b45e8
	movapd	 -14 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	mulpd	 -14 * SIZE(BO), %xmm0
kusano 2b45e8
	addpd	%xmm1, %xmm12
kusano 2b45e8
	movapd	 -12 * SIZE(BO), %xmm1
kusano 2b45e8
	addpd	%xmm0, %xmm13
kusano 2b45e8
	movapd	 -12 * SIZE(AO), %xmm0
kusano 2b45e8
kusano 2b45e8
	addq	$4 * SIZE, AO		# aoffset  += 4
kusano 2b45e8
	addq	$4 * SIZE, BO		# boffset1 += 8
kusano 2b45e8
	decq	%rax
kusano 2b45e8
	jg	.L113
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
kusano 2b45e8
.L114:
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	movlpd	0 * SIZE(CO1), %xmm0
kusano 2b45e8
	movhpd	1 * SIZE(CO1), %xmm0
kusano 2b45e8
	movlpd	2 * SIZE(CO1), %xmm2
kusano 2b45e8
	movhpd	3 * SIZE(CO1), %xmm2
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	SHUFPD_1 %xmm9, %xmm9
kusano 2b45e8
	SHUFPD_1 %xmm13, %xmm13
kusano 2b45e8
kusano 2b45e8
#if defined(NN) || defined(NT) || defined(TN) || defined(TT) || \
kusano 2b45e8
    defined(NR) || defined(NC) || defined(TR) || defined(TC)
kusano 2b45e8
	xorpd	%xmm5, %xmm9
kusano 2b45e8
	xorpd	%xmm5, %xmm13
kusano 2b45e8
#else
kusano 2b45e8
	xorpd	%xmm5, %xmm8
kusano 2b45e8
	xorpd	%xmm5, %xmm12
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
#if defined(NN) || defined(NT) || defined(TN) || defined(TT) || \
kusano 2b45e8
    defined(RR) || defined(RC) || defined(CR) || defined(CC)
kusano 2b45e8
	subpd	%xmm9, %xmm8
kusano 2b45e8
	subpd	%xmm13, %xmm12
kusano 2b45e8
#else
kusano 2b45e8
	addpd	%xmm9, %xmm8
kusano 2b45e8
	addpd	%xmm13, %xmm12
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	pshufd	$0x4e, %xmm8, %xmm9
kusano 2b45e8
	pshufd	$0x4e, %xmm12, %xmm13
kusano 2b45e8
	
kusano 2b45e8
	mulpd	%xmm6, %xmm8
kusano 2b45e8
	mulpd	%xmm7, %xmm9
kusano 2b45e8
	mulpd	%xmm6, %xmm12
kusano 2b45e8
	mulpd	%xmm7, %xmm13
kusano 2b45e8
kusano 2b45e8
	addpd	%xmm9, %xmm8
kusano 2b45e8
	addpd	%xmm13, %xmm12
kusano 2b45e8
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	addpd	%xmm0,  %xmm8
kusano 2b45e8
	addpd	%xmm2, %xmm12
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	movlpd	%xmm8, 0 * SIZE(CO1)
kusano 2b45e8
	movhpd	%xmm8, 1 * SIZE(CO1)
kusano 2b45e8
	movlpd	%xmm12, 2 * SIZE(CO1)
kusano 2b45e8
	movhpd	%xmm12, 3 * SIZE(CO1)
kusano 2b45e8
kusano 2b45e8
#if (defined(TRMMKERNEL) &&  defined(LEFT) &&  defined(TRANSA)) || \
kusano 2b45e8
    (defined(TRMMKERNEL) && !defined(LEFT) && !defined(TRANSA))
kusano 2b45e8
	movq	K, %rax
kusano 2b45e8
	subq	KKK, %rax
kusano 2b45e8
	leaq	(,%rax, SIZE), %rax
kusano 2b45e8
	leaq	(AO, %rax, 4), AO
kusano 2b45e8
	leaq	(BO, %rax, 4), BO
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
#if defined(TRMMKERNEL) && defined(LEFT)
kusano 2b45e8
	addq	$2, KK
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	addq	$4 * SIZE, CO1		# coffset += 4
kusano 2b45e8
	decq	I			# i --
kusano 2b45e8
	jg	.L110
kusano 2b45e8
	ALIGN_4	
kusano 2b45e8
kusano 2b45e8
.L130:
kusano 2b45e8
	testq	$1, M
kusano 2b45e8
	jle	.L999
kusano 2b45e8
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
	leaq	16 * SIZE + BUFFER, BO
kusano 2b45e8
#else
kusano 2b45e8
	leaq	16 * SIZE + BUFFER, BO
kusano 2b45e8
	movq	KK, %rax
kusano 2b45e8
	leaq	(, %rax, SIZE), %rax
kusano 2b45e8
	leaq	(AO, %rax, 2), AO
kusano 2b45e8
	leaq	(BO, %rax, 4), BO
kusano 2b45e8
#endif	
kusano 2b45e8
kusano 2b45e8
	movapd	-16 * SIZE(AO), %xmm0
kusano 2b45e8
	movapd	-16 * SIZE(BO), %xmm1
kusano 2b45e8
	movapd	 -8 * SIZE(AO), %xmm2
kusano 2b45e8
	movapd	 -8 * SIZE(BO), %xmm3
kusano 2b45e8
kusano 2b45e8
	pxor	%xmm8, %xmm8
kusano 2b45e8
	pxor	%xmm9, %xmm9
kusano 2b45e8
	pxor	%xmm10, %xmm10
kusano 2b45e8
	pxor	%xmm11, %xmm11
kusano 2b45e8
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	movq	K, %rax
kusano 2b45e8
#elif (defined(LEFT) && !defined(TRANSA)) || (!defined(LEFT) && defined(TRANSA))
kusano 2b45e8
	movq	K, %rax
kusano 2b45e8
	subq	KK, %rax
kusano 2b45e8
	movq	%rax, KKK	
kusano 2b45e8
#else
kusano 2b45e8
	movq	KK, %rax
kusano 2b45e8
#ifdef LEFT
kusano 2b45e8
	addq	$1, %rax
kusano 2b45e8
#else
kusano 2b45e8
	addq	$1, %rax
kusano 2b45e8
#endif
kusano 2b45e8
	movq	%rax, KKK
kusano 2b45e8
#endif
kusano 2b45e8
	sarq	$3, %rax
kusano 2b45e8
	je	.L144
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
kusano 2b45e8
.L141:
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	PREFETCH	(PREFETCHSIZE     +  0) * SIZE(AO)
kusano 2b45e8
	mulpd	-14 * SIZE(BO), %xmm0
kusano 2b45e8
	addpd	%xmm1, %xmm8
kusano 2b45e8
	movapd	-12 * SIZE(BO), %xmm1
kusano 2b45e8
	addpd	%xmm0, %xmm9
kusano 2b45e8
	movapd	-14 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	mulpd	-10 * SIZE(BO), %xmm0
kusano 2b45e8
	addpd	%xmm1, %xmm10
kusano 2b45e8
	movapd	  0 * SIZE(BO), %xmm1
kusano 2b45e8
	addpd	%xmm0, %xmm11
kusano 2b45e8
	movapd	-12 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	%xmm0, %xmm3
kusano 2b45e8
	mulpd	 -6 * SIZE(BO), %xmm0
kusano 2b45e8
	addpd	%xmm3, %xmm8
kusano 2b45e8
	movapd	 -4 * SIZE(BO), %xmm3
kusano 2b45e8
	addpd	%xmm0, %xmm9
kusano 2b45e8
	movapd	-10 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	%xmm0, %xmm3
kusano 2b45e8
	mulpd	 -2 * SIZE(BO), %xmm0
kusano 2b45e8
	addpd	%xmm3, %xmm10
kusano 2b45e8
	movapd	  8 * SIZE(BO), %xmm3
kusano 2b45e8
	addpd	%xmm0, %xmm11
kusano 2b45e8
	movapd	  0 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	%xmm2, %xmm1
kusano 2b45e8
	PREFETCH	(PREFETCHSIZE     +  8) * SIZE(AO)
kusano 2b45e8
	mulpd	  2 * SIZE(BO), %xmm2
kusano 2b45e8
	addpd	%xmm1, %xmm8
kusano 2b45e8
	movapd	  4 * SIZE(BO), %xmm1
kusano 2b45e8
	addpd	%xmm2, %xmm9
kusano 2b45e8
	movapd	 -6 * SIZE(AO), %xmm2
kusano 2b45e8
	mulpd	%xmm2, %xmm1
kusano 2b45e8
	mulpd	  6 * SIZE(BO), %xmm2
kusano 2b45e8
	addpd	%xmm1, %xmm10
kusano 2b45e8
	movapd	 16 * SIZE(BO), %xmm1
kusano 2b45e8
	addpd	%xmm2, %xmm11
kusano 2b45e8
	movapd	 -4 * SIZE(AO), %xmm2
kusano 2b45e8
	mulpd	%xmm2, %xmm3
kusano 2b45e8
	mulpd	 10 * SIZE(BO), %xmm2
kusano 2b45e8
	addpd	%xmm3, %xmm8
kusano 2b45e8
	movapd	 12 * SIZE(BO), %xmm3
kusano 2b45e8
	addpd	%xmm2, %xmm9
kusano 2b45e8
	movapd	 -2 * SIZE(AO), %xmm2
kusano 2b45e8
	mulpd	%xmm2, %xmm3
kusano 2b45e8
	mulpd	 14 * SIZE(BO), %xmm2
kusano 2b45e8
	addpd	%xmm3, %xmm10
kusano 2b45e8
	movapd	 24 * SIZE(BO), %xmm3
kusano 2b45e8
	addpd	%xmm2, %xmm11
kusano 2b45e8
	movapd	  8 * SIZE(AO), %xmm2
kusano 2b45e8
kusano 2b45e8
	subq   $-16 * SIZE, AO
kusano 2b45e8
	subq   $-32 * SIZE, BO
kusano 2b45e8
	decq   %rax
kusano 2b45e8
	jne    .L141
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
kusano 2b45e8
kusano 2b45e8
.L144:
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	movq	K, %rax
kusano 2b45e8
#else
kusano 2b45e8
	movq	KKK, %rax
kusano 2b45e8
#endif
kusano 2b45e8
	andq	$4, %rax		# if (k & 1)
kusano 2b45e8
	BRANCH
kusano 2b45e8
	jle .L145
kusano 2b45e8
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	mulpd	-14 * SIZE(BO), %xmm0
kusano 2b45e8
	addpd	%xmm1, %xmm8
kusano 2b45e8
	movapd	-12 * SIZE(BO), %xmm1
kusano 2b45e8
	addpd	%xmm0, %xmm9
kusano 2b45e8
	movapd	-14 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	mulpd	-10 * SIZE(BO), %xmm0
kusano 2b45e8
	addpd	%xmm1, %xmm10
kusano 2b45e8
	movapd	  0 * SIZE(BO), %xmm1
kusano 2b45e8
	addpd	%xmm0, %xmm11
kusano 2b45e8
	movapd	-12 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	%xmm0, %xmm3
kusano 2b45e8
	mulpd	 -6 * SIZE(BO), %xmm0
kusano 2b45e8
	addpd	%xmm3, %xmm8
kusano 2b45e8
	movapd	 -4 * SIZE(BO), %xmm3
kusano 2b45e8
	addpd	%xmm0, %xmm9
kusano 2b45e8
	movapd	-10 * SIZE(AO), %xmm0
kusano 2b45e8
	mulpd	%xmm0, %xmm3
kusano 2b45e8
	mulpd	 -2 * SIZE(BO), %xmm0
kusano 2b45e8
	addpd	%xmm3, %xmm10
kusano 2b45e8
	addpd	%xmm0, %xmm11
kusano 2b45e8
	movapd	 -8 * SIZE(AO), %xmm0
kusano 2b45e8
kusano 2b45e8
	addq   $8   * SIZE, AO
kusano 2b45e8
	subq   $-16 * SIZE, BO
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
kusano 2b45e8
.L145:
kusano 2b45e8
	movapd	POSINV, %xmm5
kusano 2b45e8
	movapd	ALPHA_R, %xmm6
kusano 2b45e8
	movapd	ALPHA_I, %xmm7
kusano 2b45e8
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	movq	K, %rax
kusano 2b45e8
#else
kusano 2b45e8
	movq	KKK, %rax
kusano 2b45e8
#endif
kusano 2b45e8
	andq	$3, %rax		# if (k & 1)
kusano 2b45e8
	BRANCH
kusano 2b45e8
	jle .L148
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
kusano 2b45e8
.L146:
kusano 2b45e8
	mulpd	%xmm0, %xmm1
kusano 2b45e8
	mulpd	-14 * SIZE(BO), %xmm0
kusano 2b45e8
	addpd	%xmm1, %xmm8
kusano 2b45e8
	movapd	-12 * SIZE(BO), %xmm1
kusano 2b45e8
	addpd	%xmm0, %xmm9
kusano 2b45e8
	movapd	-14 * SIZE(AO), %xmm0
kusano 2b45e8
kusano 2b45e8
	addq	$2 * SIZE, AO		# aoffset  += 4
kusano 2b45e8
	addq	$4 * SIZE, BO		# boffset1 += 8
kusano 2b45e8
	decq	%rax
kusano 2b45e8
	jg	.L146
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
kusano 2b45e8
.L148:
kusano 2b45e8
	addpd	%xmm10, %xmm8
kusano 2b45e8
	addpd	%xmm11, %xmm9
kusano 2b45e8
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	movlpd	0 * SIZE(CO1), %xmm0
kusano 2b45e8
	movhpd	1 * SIZE(CO1), %xmm0
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	SHUFPD_1 %xmm9, %xmm9
kusano 2b45e8
kusano 2b45e8
#if defined(NN) || defined(NT) || defined(TN) || defined(TT) || \
kusano 2b45e8
    defined(NR) || defined(NC) || defined(TR) || defined(TC)
kusano 2b45e8
	xorpd	%xmm5, %xmm9
kusano 2b45e8
#else
kusano 2b45e8
	xorpd	%xmm5, %xmm8
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
#if defined(NN) || defined(NT) || defined(TN) || defined(TT) || \
kusano 2b45e8
    defined(RR) || defined(RC) || defined(CR) || defined(CC)
kusano 2b45e8
	subpd	%xmm9, %xmm8
kusano 2b45e8
#else
kusano 2b45e8
	addpd	%xmm9, %xmm8
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	pshufd	$0x4e, %xmm8, %xmm9
kusano 2b45e8
	
kusano 2b45e8
	mulpd	%xmm6, %xmm8
kusano 2b45e8
	mulpd	%xmm7, %xmm9
kusano 2b45e8
kusano 2b45e8
	addpd	%xmm9, %xmm8
kusano 2b45e8
kusano 2b45e8
#ifndef TRMMKERNEL
kusano 2b45e8
	addpd	%xmm0,  %xmm8
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	movlpd	%xmm8, 0 * SIZE(CO1)
kusano 2b45e8
	movhpd	%xmm8, 1 * SIZE(CO1)
kusano 2b45e8
	ALIGN_4
kusano 2b45e8
	
kusano 2b45e8
.L999:
kusano 2b45e8
	movq	%rbx, %rsp
kusano 2b45e8
	EMMS
kusano 2b45e8
	
kusano 2b45e8
	movq	  0(%rsp), %rbx
kusano 2b45e8
	movq	  8(%rsp), %rbp
kusano 2b45e8
	movq	 16(%rsp), %r12
kusano 2b45e8
	movq	 24(%rsp), %r13
kusano 2b45e8
	movq	 32(%rsp), %r14
kusano 2b45e8
	movq	 40(%rsp), %r15
kusano 2b45e8
kusano 2b45e8
#ifdef WINDOWS_ABI
kusano 2b45e8
	movq	 48(%rsp), %rdi
kusano 2b45e8
	movq	 56(%rsp), %rsi
kusano 2b45e8
	movups	 64(%rsp), %xmm6
kusano 2b45e8
	movups	 80(%rsp), %xmm7
kusano 2b45e8
	movups	 96(%rsp), %xmm8
kusano 2b45e8
	movups	112(%rsp), %xmm9
kusano 2b45e8
	movups	128(%rsp), %xmm10
kusano 2b45e8
	movups	144(%rsp), %xmm11
kusano 2b45e8
	movups	160(%rsp), %xmm12
kusano 2b45e8
	movups	176(%rsp), %xmm13
kusano 2b45e8
	movups	192(%rsp), %xmm14
kusano 2b45e8
	movups	208(%rsp), %xmm15
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	addq	$STACKSIZE, %rsp
kusano 2b45e8
	ret
kusano 2b45e8
kusano 2b45e8
	EPILOGUE