⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zgemm_kernel_4x2_penryn.s

📁 Optimized GotoBLAS libraries
💻 S
📖 第 1 页 / 共 3 页
字号:
/*********************************************************************//*                                                                   *//*             Optimized BLAS libraries                              *//*                     By Kazushige Goto <kgoto@tacc.utexas.edu>     *//*                                                                   *//* Copyright (c) The University of Texas, 2005. All rights reserved. *//* UNIVERSITY EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES CONCERNING  *//* THIS SOFTWARE AND DOCUMENTATION, INCLUDING ANY WARRANTIES OF      *//* MERCHANTABILITY, FITNESS FOR ANY PARTICULAR PURPOSE,              *//* NON-INFRINGEMENT AND WARRANTIES OF PERFORMANCE, AND ANY WARRANTY  *//* THAT MIGHT OTHERWISE ARISE FROM COURSE OF DEALING OR USAGE OF     *//* TRADE. NO WARRANTY IS EITHER EXPRESS OR IMPLIED WITH RESPECT TO   *//* THE USE OF THE SOFTWARE OR DOCUMENTATION.                         *//* Under no circumstances shall University be liable for incidental, *//* special, indirect, direct or consequential damages or loss of     *//* profits, interruption of business, or related expenses which may  *//* arise from use of Software or Documentation, including but not    *//* limited to those resulting from defects in Software and/or        *//* Documentation, or loss or inaccuracy of data of any kind.         *//*********************************************************************/#define ASSEMBLER#include "common.h" #define OLD_M	%rdi#define OLD_N	%rsi#define OLD_K	%rdx#define M	%r13#define N	%r14#define K	%r15#define A	%rcx#define B	%r8#define C	%r9#define LDC	%r10	#define I	%r11#define AO	%rdi#define BO	%rsi#define	CO1	%rbx#define CO2	%rbp#define BB	%r12#define PREA	%rdx#ifndef WINDOWS_ABI#define STACKSIZE 128#define OLD_LDC		 8 + STACKSIZE(%rsp)#define OLD_OFFSET	16 + STACKSIZE(%rsp)#define ALPHA_R	   48(%rsp)#define ALPHA_I	   56(%rsp)#define J	   64(%rsp)#define OFFSET	   72(%rsp)#define KK	   80(%rsp)#define KKK	   88(%rsp)#else#define STACKSIZE 512#define OLD_ALPHA_I	40 + STACKSIZE(%rsp)#define OLD_A		48 + STACKSIZE(%rsp)#define OLD_B		56 + STACKSIZE(%rsp)#define OLD_C		64 + STACKSIZE(%rsp)#define OLD_LDC		72 + STACKSIZE(%rsp)#define OLD_OFFSET	80 + STACKSIZE(%rsp)#define ALPHA_R	  224(%rsp)#define ALPHA_I	  232(%rsp)#define J	  240(%rsp)#define OFFSET	  248(%rsp)#define KK	  256(%rsp)#define KKK	  264(%rsp)#endif#define PREFETCH_R    (16 *  4 + 0)#define PREFETCHSIZE  (16 * 21 + 6)#define PREFETCH     prefetcht0#if   defined(NN) || defined(NT) || defined(TN) || defined(TT)#define ADD1	  addps#define ADD2	  addps#elif defined(NR) || defined(NC) || defined(TR) || defined(TC)#define ADD1	  addps#define ADD2	  addps#elif  defined(RN) || defined(RT) || defined(CN) || defined(CT)#define ADD1	  addps#define ADD2	  addps#else#define ADD1	  addps#define ADD2	  subps#endif	PROLOGUE	PROFCODE		subq	$STACKSIZE, %rsp	movq	%rbx,  0(%rsp)	movq	%rbp,  8(%rsp)	movq	%r12, 16(%rsp)	movq	%r13, 24(%rsp)	movq	%r14, 32(%rsp)	movq	%r15, 40(%rsp)#ifdef WINDOWS_ABI	movq	%rdi,    48(%rsp)	movq	%rsi,    56(%rsp)	movups	%xmm6,   64(%rsp)	movups	%xmm7,   80(%rsp)	movups	%xmm8,   96(%rsp)	movups	%xmm9,  112(%rsp)	movups	%xmm10, 128(%rsp)	movups	%xmm11, 144(%rsp)	movups	%xmm12, 160(%rsp)	movups	%xmm13, 176(%rsp)	movups	%xmm14, 192(%rsp)	movups	%xmm15, 208(%rsp)	movq	ARG1,      OLD_M	movq	ARG2,      OLD_N	movq	ARG3,      OLD_K	movq	OLD_A,     A	movq	OLD_B,     B	movq	OLD_C,     C	movq	OLD_LDC,   LDC#ifdef TRMMKERNEL	movq	OLD_OFFSET, %r11#endif	movaps	%xmm3, %xmm0	movss	OLD_ALPHA_I, %xmm1#else	movq	OLD_LDC,   LDC#ifdef TRMMKERNEL	movq	OLD_OFFSET, %r11#endif#endif	unpcklps %xmm0, %xmm0	unpcklps %xmm1, %xmm1	movlps	 %xmm0, ALPHA_R	movlps	 %xmm1, ALPHA_I		subq	$-32 * SIZE, A	subq	$-32 * SIZE, B	movq	OLD_M, M	movq	OLD_N, N	movq	OLD_K, K	salq	$ZBASE_SHIFT, LDC#ifdef TRMMKERNEL	movq	%r11, OFFSET#ifndef LEFT	negq	%r11#endif		movq	%r11, KK#endif	movq	N,  J	sarq	$1, J	jle,pn	.L40	ALIGN_4.L01:#if defined(TRMMKERNEL) && defined(LEFT)        movq    OFFSET, %rax	movq    %rax, KK#endif	movq	C, CO1	leaq	(C, LDC, 1), CO2	movq	A, AO	movq	K, %rax	salq	$ZBASE_SHIFT + 1, %rax	leaq	(B, %rax), BB	movq	M,  I	sarq	$2, I	jle,pn	.L20	ALIGN_4.L11:#if !defined(TRMMKERNEL) || \	(defined(TRMMKERNEL) &&  defined(LEFT) &&  defined(TRANSA)) || \	(defined(TRMMKERNEL) && !defined(LEFT) && !defined(TRANSA))	movq	B, BO#else	movq	B, BO	movq	KK, %rax	salq	$ZBASE_SHIFT, %rax	leaq	(AO, %rax, 4), AO	leaq	(BO, %rax, 2), BO#endif		prefetcht2	 -32 * SIZE(BB)	subq		$-16 * SIZE, BB	movaps	-32 * SIZE(AO), %xmm0	pxor	%xmm3, %xmm3	movaps	-28 * SIZE(AO), %xmm1	pxor	%xmm4, %xmm4	movaps	-32 * SIZE(BO), %xmm2	pxor	%xmm5, %xmm5	pxor	%xmm6, %xmm6	prefetcht0     7 * SIZE(CO1)	movapd	%xmm4, %xmm8	movapd	%xmm4, %xmm9	prefetcht0     7 * SIZE(CO2)	movapd	%xmm4, %xmm10	movapd	%xmm4, %xmm11	movapd	%xmm4, %xmm12	movapd	%xmm4, %xmm13	movapd	%xmm4, %xmm14	movapd	%xmm4, %xmm15	leaq		(PREFETCHSIZE +  0) * SIZE(AO), PREA#ifndef TRMMKERNEL	movq	K, %rax#elif (defined(LEFT) && !defined(TRANSA)) || (!defined(LEFT) && defined(TRANSA))	movq	K, %rax	subq	KK, %rax	movq	%rax, KKK	#else	movq	KK, %rax#ifdef LEFT	addq	$4, %rax#else	addq	$2, %rax#endif	movq	%rax, KKK#endif	sarq	$3, %rax	jle,pn	.L15	ALIGN_3.L12:		ADD1	%xmm6, %xmm10	PREFETCH -32 * SIZE(PREA)	ADD1	%xmm3, %xmm14	movaps	%xmm2, %xmm3	pshufd	$0xb1, %xmm2, %xmm7	mulps	%xmm0, %xmm2	mulps	%xmm1, %xmm3	ADD2	%xmm4, %xmm11	ADD2	%xmm5, %xmm15	movaps	%xmm7, %xmm5	pshufd	$0x1b, %xmm7, %xmm6	mulps	%xmm0, %xmm7	mulps	%xmm1, %xmm5	ADD1	%xmm2, %xmm8	movaps	-28 * SIZE(BO), %xmm2	ADD1	%xmm3, %xmm12	movaps	%xmm6, %xmm3	pshufd	$0xb1, %xmm6, %xmm4	mulps	%xmm0, %xmm6	mulps	%xmm1, %xmm3	ADD2	%xmm7, %xmm9	ADD2	%xmm5, %xmm13	movaps	%xmm4, %xmm5	mulps	%xmm0, %xmm4	movaps	-24 * SIZE(AO), %xmm0	mulps	%xmm1, %xmm5	movaps	-20 * SIZE(AO), %xmm1	ADD1	%xmm6, %xmm10	ADD1	%xmm3, %xmm14	movaps	%xmm2, %xmm3	pshufd	$0xb1, %xmm2, %xmm7	mulps	%xmm0, %xmm2	mulps	%xmm1, %xmm3	ADD2	%xmm4, %xmm11	ADD2	%xmm5, %xmm15	movaps	%xmm7, %xmm5	pshufd	$0x1b, %xmm7, %xmm6	mulps	%xmm0, %xmm7	mulps	%xmm1, %xmm5	ADD1	%xmm2, %xmm8	movaps	-24 * SIZE(BO), %xmm2	ADD1	%xmm3, %xmm12	movaps	%xmm6, %xmm3	pshufd	$0xb1, %xmm6, %xmm4	mulps	%xmm0, %xmm6	mulps	%xmm1, %xmm3	ADD2	%xmm7, %xmm9	ADD2	%xmm5, %xmm13	movaps	%xmm4, %xmm5	mulps	%xmm0, %xmm4	movaps	-16 * SIZE(AO), %xmm0	mulps	%xmm1, %xmm5	movaps	-12 * SIZE(AO), %xmm1	ADD1	%xmm6, %xmm10	ADD1	%xmm3, %xmm14	PREFETCH -16 * SIZE(PREA)	movaps	%xmm2, %xmm3	pshufd	$0xb1, %xmm2, %xmm7	mulps	%xmm0, %xmm2	mulps	%xmm1, %xmm3	ADD2	%xmm4, %xmm11	ADD2	%xmm5, %xmm15	movaps	%xmm7, %xmm5	pshufd	$0x1b, %xmm7, %xmm6	mulps	%xmm0, %xmm7	mulps	%xmm1, %xmm5	ADD1	%xmm2, %xmm8	movaps	-20 * SIZE(BO), %xmm2	ADD1	%xmm3, %xmm12	movaps	%xmm6, %xmm3	pshufd	$0xb1, %xmm6, %xmm4	mulps	%xmm0, %xmm6	mulps	%xmm1, %xmm3	ADD2	%xmm7, %xmm9	ADD2	%xmm5, %xmm13	movaps	%xmm4, %xmm5	mulps	%xmm0, %xmm4	movaps	 -8 * SIZE(AO), %xmm0	mulps	%xmm1, %xmm5	movaps	 -4 * SIZE(AO), %xmm1	ADD1	%xmm6, %xmm10	ADD1	%xmm3, %xmm14	movaps	%xmm2, %xmm3	pshufd	$0xb1, %xmm2, %xmm7	mulps	%xmm0, %xmm2	mulps	%xmm1, %xmm3	ADD2	%xmm4, %xmm11	ADD2	%xmm5, %xmm15	movaps	%xmm7, %xmm5	pshufd	$0x1b, %xmm7, %xmm6	mulps	%xmm0, %xmm7	mulps	%xmm1, %xmm5	ADD1	%xmm2, %xmm8	movaps	-16 * SIZE(BO), %xmm2	ADD1	%xmm3, %xmm12	movaps	%xmm6, %xmm3	pshufd	$0xb1, %xmm6, %xmm4	mulps	%xmm0, %xmm6	mulps	%xmm1, %xmm3	ADD2	%xmm7, %xmm9	ADD2	%xmm5, %xmm13	movaps	%xmm4, %xmm5	mulps	%xmm0, %xmm4	movaps	  0 * SIZE(AO), %xmm0	mulps	%xmm1, %xmm5	movaps	  4 * SIZE(AO), %xmm1	ADD1	%xmm6, %xmm10	ADD1	%xmm3, %xmm14	PREFETCH  0 * SIZE(PREA)	movaps	%xmm2, %xmm3	pshufd	$0xb1, %xmm2, %xmm7	mulps	%xmm0, %xmm2	mulps	%xmm1, %xmm3	ADD2	%xmm4, %xmm11	ADD2	%xmm5, %xmm15	movaps	%xmm7, %xmm5	pshufd	$0x1b, %xmm7, %xmm6	mulps	%xmm0, %xmm7	mulps	%xmm1, %xmm5	ADD1	%xmm2, %xmm8	movaps	-12 * SIZE(BO), %xmm2	ADD1	%xmm3, %xmm12	movaps	%xmm6, %xmm3	pshufd	$0xb1, %xmm6, %xmm4	mulps	%xmm0, %xmm6	mulps	%xmm1, %xmm3	ADD2	%xmm7, %xmm9	ADD2	%xmm5, %xmm13	movaps	%xmm4, %xmm5	mulps	%xmm0, %xmm4	movaps	  8 * SIZE(AO), %xmm0	mulps	%xmm1, %xmm5	movaps	 12 * SIZE(AO), %xmm1	ADD1	%xmm6, %xmm10	ADD1	%xmm3, %xmm14	movaps	%xmm2, %xmm3	pshufd	$0xb1, %xmm2, %xmm7	mulps	%xmm0, %xmm2	mulps	%xmm1, %xmm3	ADD2	%xmm4, %xmm11	ADD2	%xmm5, %xmm15	movaps	%xmm7, %xmm5	pshufd	$0x1b, %xmm7, %xmm6	mulps	%xmm0, %xmm7	mulps	%xmm1, %xmm5	ADD1	%xmm2, %xmm8	movaps	 -8 * SIZE(BO), %xmm2	ADD1	%xmm3, %xmm12	movaps	%xmm6, %xmm3	pshufd	$0xb1, %xmm6, %xmm4	mulps	%xmm0, %xmm6	mulps	%xmm1, %xmm3	ADD2	%xmm7, %xmm9	ADD2	%xmm5, %xmm13	movaps	%xmm4, %xmm5	mulps	%xmm0, %xmm4	movaps	 16 * SIZE(AO), %xmm0	mulps	%xmm1, %xmm5	movaps	 20 * SIZE(AO), %xmm1	ADD1	%xmm6, %xmm10	ADD1	%xmm3, %xmm14	PREFETCH  16 * SIZE(PREA)	movaps	%xmm2, %xmm3	pshufd	$0xb1, %xmm2, %xmm7	mulps	%xmm0, %xmm2	mulps	%xmm1, %xmm3	ADD2	%xmm4, %xmm11	ADD2	%xmm5, %xmm15	movaps	%xmm7, %xmm5	pshufd	$0x1b, %xmm7, %xmm6	mulps	%xmm0, %xmm7	mulps	%xmm1, %xmm5	ADD1	%xmm2, %xmm8	movaps	 -4 * SIZE(BO), %xmm2	ADD1	%xmm3, %xmm12	movaps	%xmm6, %xmm3	pshufd	$0xb1, %xmm6, %xmm4	mulps	%xmm0, %xmm6	mulps	%xmm1, %xmm3	ADD2	%xmm7, %xmm9	ADD2	%xmm5, %xmm13	movaps	%xmm4, %xmm5	mulps	%xmm0, %xmm4	movaps	 24 * SIZE(AO), %xmm0	mulps	%xmm1, %xmm5	movaps	 28 * SIZE(AO), %xmm1	ADD1	%xmm6, %xmm10	ADD1	%xmm3, %xmm14	movaps	%xmm2, %xmm3	pshufd	$0xb1, %xmm2, %xmm7	mulps	%xmm0, %xmm2	mulps	%xmm1, %xmm3	ADD2	%xmm4, %xmm11	ADD2	%xmm5, %xmm15	movaps	%xmm7, %xmm5	pshufd	$0x1b, %xmm7, %xmm6	mulps	%xmm0, %xmm7	mulps	%xmm1, %xmm5	ADD1	%xmm2, %xmm8	movaps	 0 * SIZE(BO), %xmm2	ADD1	%xmm3, %xmm12	movaps	%xmm6, %xmm3	pshufd	$0xb1, %xmm6, %xmm4	mulps	%xmm0, %xmm6	mulps	%xmm1, %xmm3	ADD2	%xmm7, %xmm9	subq	$-64 * SIZE, AO	ADD2	%xmm5, %xmm13	movaps	%xmm4, %xmm5	mulps	%xmm0, %xmm4	movaps  -32 * SIZE(AO), %xmm0	mulps	%xmm1, %xmm5	movaps	-28 * SIZE(AO), %xmm1	subq	$-32 * SIZE, BO	subq	$-64 * SIZE, PREA	subq	$1, %rax	jg,pt	.L12	ALIGN_3.L15:#ifndef TRMMKERNEL	movq	K, %rax#else	movq	KKK, %rax#endif	andq	$7, %rax		# if (k & 1)	je,pt	.L18	ALIGN_3.L16:	ADD1	%xmm6, %xmm10	ADD1	%xmm3, %xmm14	movaps	%xmm2, %xmm3	pshufd	$0xb1, %xmm2, %xmm7	mulps	%xmm0, %xmm2	mulps	%xmm1, %xmm3	ADD2	%xmm4, %xmm11	ADD2	%xmm5, %xmm15	movaps	%xmm7, %xmm5	pshufd	$0x1b, %xmm7, %xmm6	mulps	%xmm0, %xmm7	mulps	%xmm1, %xmm5	ADD1	%xmm2, %xmm8	movaps	-28 * SIZE(BO), %xmm2	ADD1	%xmm3, %xmm12	movaps	%xmm6, %xmm3	pshufd	$0xb1, %xmm6, %xmm4	mulps	%xmm0, %xmm6	mulps	%xmm1, %xmm3	ADD2	%xmm7, %xmm9	ADD2	%xmm5, %xmm13	movaps	%xmm4, %xmm5	mulps	%xmm0, %xmm4	movaps	-24 * SIZE(AO), %xmm0	mulps	%xmm1, %xmm5	movaps	-20 * SIZE(AO), %xmm1	addq	$8 * SIZE, AO	addq	$4 * SIZE, BO	subq	$1, %rax	jg,pt	.L16	ALIGN_3.L18:	ADD1	%xmm6, %xmm10	ADD1	%xmm3, %xmm14	ADD2	%xmm4, %xmm11	ADD2	%xmm5, %xmm15	pcmpeqb	%xmm0, %xmm0	psllq	$63,   %xmm0	movddup	ALPHA_R, %xmm2	movddup	ALPHA_I, %xmm3#if   defined(NN) || defined(NT) || defined(TN) || defined(TT) || \      defined(RR) || defined(RC) || defined(CR) || defined(CC)	pxor	%xmm0, %xmm8	pxor	%xmm0, %xmm10	pxor	%xmm0, %xmm12	pxor	%xmm0, %xmm14#elif defined(NR) || defined(NC) || defined(TR) || defined(TC)	pshufd	$0xb1, %xmm0, %xmm0	pxor	%xmm0, %xmm9	pxor	%xmm0, %xmm11	pxor	%xmm0, %xmm13	pxor	%xmm0, %xmm15#elif defined(RN) || defined(RT) || defined(CN) || defined(CT)	pxor	%xmm0, %xmm9	pxor	%xmm0, %xmm11

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -