📄 rot_sse2.s
字号:
/*********************************************************************//* *//* 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 N ARG1 /* rdi */#define X ARG2 /* rsi */#define INCX ARG3 /* rdx */#define Y ARG4 /* rcx */#ifndef WINDOWS_ABI#define INCY ARG5 /* r8 */#else#define INCY %r10#endif#undef MOVSD#ifdef PENTIUM4#define PREFETCH prefetcht0#define PREFETCH_SIZE 144#define MOVSD movsd#endif#if defined(OPTERON) || defined(BARCELONA)#define PREFETCH prefetchw#define PREFETCH_SIZE (8 * 16)#ifdef OPTERON#define MOVSD movlpd#else#define MOVSD movsd#endif#endif#define C %xmm14#define S %xmm15 PROLOGUE PROFCODE#ifdef WINDOWS_ABI movq 40(%rsp), INCY movsd 48(%rsp), %xmm0 movsd 56(%rsp), %xmm1#endif SAVEREGISTERS leaq (, INCX, SIZE), INCX leaq (, INCY, SIZE), INCY pshufd $0x44, %xmm0, C pshufd $0x44, %xmm1, S cmpq $0, N jle .L999 cmpq $SIZE, INCX jne .L50 cmpq $SIZE, INCY jne .L50 testq $SIZE, X je .L10 movsd 0 * SIZE(Y), %xmm1 movsd 0 * SIZE(X), %xmm0 movapd %xmm1, %xmm2 movapd %xmm0, %xmm3 mulsd C, %xmm0 mulsd S, %xmm1 mulsd C, %xmm2 mulsd S, %xmm3 addsd %xmm1, %xmm0 subsd %xmm3, %xmm2 movsd %xmm0, 0 * SIZE(X) movsd %xmm2, 0 * SIZE(Y) addq $1 * SIZE, X addq $1 * SIZE, Y decq N jle .L999 ALIGN_2.L10: testq $SIZE, Y jne .L20 movq N, %rax sarq $4, %rax jle .L14 movapd 0 * SIZE(Y), %xmm1 movapd 2 * SIZE(Y), %xmm3 movapd 4 * SIZE(Y), %xmm9 movapd 6 * SIZE(Y), %xmm11 movapd 0 * SIZE(X), %xmm0 movapd 2 * SIZE(X), %xmm2 movapd 4 * SIZE(X), %xmm8 movapd 6 * SIZE(X), %xmm10 decq %rax jle .L12 ALIGN_3.L11:#ifdef PENTIUM4 PREFETCH (PREFETCH_SIZE + 0) * SIZE(X)#endif movapd %xmm1, %xmm4 mulpd S, %xmm1#if defined(OPTERON) || defined(BARCELONA) PREFETCH (PREFETCH_SIZE + 0) * SIZE(X)#endif movapd %xmm3, %xmm6 mulpd S, %xmm3 movapd %xmm0, %xmm5 mulpd C, %xmm0 movapd %xmm2, %xmm7 mulpd C, %xmm2 mulpd C, %xmm4 mulpd S, %xmm5 mulpd C, %xmm6 mulpd S, %xmm7 addpd %xmm1, %xmm0 movapd 8 * SIZE(Y), %xmm1 addpd %xmm3, %xmm2 movapd 10 * SIZE(Y), %xmm3 subpd %xmm5, %xmm4 subpd %xmm7, %xmm6 movapd %xmm0, 0 * SIZE(X) movapd 8 * SIZE(X), %xmm0#if defined(OPTERON) || defined(BARCELONA) PREFETCH (PREFETCH_SIZE + 0) * SIZE(Y)#endif movapd %xmm2, 2 * SIZE(X) movapd 10 * SIZE(X), %xmm2 movapd %xmm4, 0 * SIZE(Y) movapd %xmm6, 2 * SIZE(Y) movapd %xmm9, %xmm4 mulpd S, %xmm9 movapd %xmm8, %xmm5 mulpd C, %xmm8 movapd %xmm11, %xmm6 mulpd S, %xmm11 movapd %xmm10, %xmm7 mulpd C, %xmm10 mulpd C, %xmm4 mulpd S, %xmm5 mulpd C, %xmm6 mulpd S, %xmm7 addpd %xmm9, %xmm8 movapd 12 * SIZE(Y), %xmm9 addpd %xmm11, %xmm10 movapd 14 * SIZE(Y), %xmm11 subpd %xmm5, %xmm4 subpd %xmm7, %xmm6 movapd %xmm8, 4 * SIZE(X) movapd 12 * SIZE(X), %xmm8 movapd %xmm10,6 * SIZE(X) movapd 14 * SIZE(X), %xmm10 movapd %xmm4, 4 * SIZE(Y) movapd %xmm6, 6 * SIZE(Y)#ifdef PENTIUM4 PREFETCH (PREFETCH_SIZE + 0) * SIZE(Y)#endif#if defined(OPTERON) || defined(BARCELONA) PREFETCH (PREFETCH_SIZE + 8) * SIZE(X)#endif movapd %xmm1, %xmm4 mulpd S, %xmm1 movapd %xmm3, %xmm6 mulpd S, %xmm3 movapd %xmm0, %xmm5 mulpd C, %xmm0 movapd %xmm2, %xmm7 mulpd C, %xmm2 mulpd C, %xmm4 mulpd S, %xmm5 mulpd C, %xmm6 mulpd S, %xmm7 addpd %xmm1, %xmm0 movapd 16 * SIZE(Y), %xmm1 addpd %xmm3, %xmm2 movapd 18 * SIZE(Y), %xmm3 subpd %xmm5, %xmm4 subpd %xmm7, %xmm6 movapd %xmm0, 8 * SIZE(X) movapd 16 * SIZE(X), %xmm0 movapd %xmm2, 10 * SIZE(X) movapd 18 * SIZE(X), %xmm2 movapd %xmm4, 8 * SIZE(Y) movapd %xmm6, 10 * SIZE(Y)#if defined(OPTERON) || defined(BARCELONA) PREFETCH (PREFETCH_SIZE + 8) * SIZE(Y)#endif movapd %xmm9, %xmm4 mulpd S, %xmm9 movapd %xmm8, %xmm5 mulpd C, %xmm8 movapd %xmm11, %xmm6 mulpd S, %xmm11 movapd %xmm10, %xmm7 mulpd C, %xmm10 mulpd C, %xmm4 mulpd S, %xmm5 mulpd C, %xmm6 mulpd S, %xmm7 addpd %xmm9, %xmm8 movapd 20 * SIZE(Y), %xmm9 addpd %xmm11, %xmm10 movapd 22 * SIZE(Y), %xmm11 subpd %xmm5, %xmm4 subpd %xmm7, %xmm6 movapd %xmm8, 12 * SIZE(X) movapd 20 * SIZE(X), %xmm8 movapd %xmm10, 14 * SIZE(X) movapd 22 * SIZE(X), %xmm10 movapd %xmm4, 12 * SIZE(Y) movapd %xmm6, 14 * SIZE(Y) addq $16 * SIZE, X addq $16 * SIZE, Y decq %rax jg .L11 ALIGN_3.L12: movapd %xmm1, %xmm4 mulpd S, %xmm1 movapd %xmm3, %xmm6 mulpd S, %xmm3 movapd %xmm0, %xmm5 mulpd C, %xmm0 movapd %xmm2, %xmm7 mulpd C, %xmm2 mulpd C, %xmm4 mulpd S, %xmm5 mulpd C, %xmm6 mulpd S, %xmm7 addpd %xmm1, %xmm0 movapd 8 * SIZE(Y), %xmm1 addpd %xmm3, %xmm2 movapd 10 * SIZE(Y), %xmm3 subpd %xmm5, %xmm4 subpd %xmm7, %xmm6 movapd %xmm0, 0 * SIZE(X) movapd 8 * SIZE(X), %xmm0 movapd %xmm2, 2 * SIZE(X) movapd 10 * SIZE(X), %xmm2 movapd %xmm4, 0 * SIZE(Y) movapd %xmm6, 2 * SIZE(Y) movapd %xmm9, %xmm4 mulpd S, %xmm9 movapd %xmm8, %xmm5 mulpd C, %xmm8 movapd %xmm11, %xmm6 mulpd S, %xmm11 movapd %xmm10, %xmm7 mulpd C, %xmm10 mulpd C, %xmm4 mulpd S, %xmm5 mulpd C, %xmm6 mulpd S, %xmm7 addpd %xmm9, %xmm8 movapd 12 * SIZE(Y), %xmm9 addpd %xmm11, %xmm10 movapd 14 * SIZE(Y), %xmm11 subpd %xmm5, %xmm4 subpd %xmm7, %xmm6 movapd %xmm8, 4 * SIZE(X) movapd 12 * SIZE(X), %xmm8 movapd %xmm10,6 * SIZE(X) movapd 14 * SIZE(X), %xmm10 movapd %xmm4, 4 * SIZE(Y) movapd %xmm6, 6 * SIZE(Y) movapd %xmm1, %xmm4 mulpd S, %xmm1 movapd %xmm3, %xmm6 mulpd S, %xmm3 movapd %xmm0, %xmm5 mulpd C, %xmm0 movapd %xmm2, %xmm7 mulpd C, %xmm2 mulpd C, %xmm4 mulpd S, %xmm5 mulpd C, %xmm6 mulpd S, %xmm7 addpd %xmm1, %xmm0 addpd %xmm3, %xmm2 subpd %xmm5, %xmm4 subpd %xmm7, %xmm6 movapd %xmm0, 8 * SIZE(X) movapd %xmm2, 10 * SIZE(X) movapd %xmm4, 8 * SIZE(Y) movapd %xmm6, 10 * SIZE(Y) movapd %xmm9, %xmm4 mulpd S, %xmm9 movapd %xmm8, %xmm5 mulpd C, %xmm8 movapd %xmm11, %xmm6 mulpd S, %xmm11 movapd %xmm10, %xmm7 mulpd C, %xmm10 mulpd C, %xmm4 mulpd S, %xmm5 mulpd C, %xmm6 mulpd S, %xmm7 addpd %xmm9, %xmm8 addpd %xmm11, %xmm10 subpd %xmm5, %xmm4 subpd %xmm7, %xmm6 movapd %xmm8, 12 * SIZE(X) movapd %xmm10, 14 * SIZE(X) movapd %xmm4, 12 * SIZE(Y) movapd %xmm6, 14 * SIZE(Y) addq $16 * SIZE, X addq $16 * SIZE, Y ALIGN_3.L14: testq $15, N jle .L999 testq $8, N jle .L15 movapd 0 * SIZE(Y), %xmm1 movapd 0 * SIZE(X), %xmm0 movapd 2 * SIZE(Y), %xmm3 movapd 2 * SIZE(X), %xmm2 movapd %xmm1, %xmm4 movapd %xmm0, %xmm5 movapd %xmm3, %xmm6 movapd %xmm2, %xmm7 mulpd C, %xmm0 mulpd S, %xmm1 mulpd C, %xmm2 mulpd S, %xmm3 mulpd C, %xmm4 mulpd S, %xmm5 mulpd C, %xmm6 mulpd S, %xmm7 addpd %xmm1, %xmm0 addpd %xmm3, %xmm2 subpd %xmm5, %xmm4 subpd %xmm7, %xmm6 movapd %xmm0, 0 * SIZE(X) movapd %xmm2, 2 * SIZE(X) movapd %xmm4, 0 * SIZE(Y) movapd %xmm6, 2 * SIZE(Y) movapd 4 * SIZE(Y), %xmm1 movapd 4 * SIZE(X), %xmm0 movapd 6 * SIZE(Y), %xmm3 movapd 6 * SIZE(X), %xmm2 movapd %xmm1, %xmm4 movapd %xmm0, %xmm5 movapd %xmm3, %xmm6 movapd %xmm2, %xmm7 mulpd C, %xmm0 mulpd S, %xmm1 mulpd C, %xmm2 mulpd S, %xmm3 mulpd C, %xmm4 mulpd S, %xmm5 mulpd C, %xmm6 mulpd S, %xmm7 addpd %xmm1, %xmm0 addpd %xmm3, %xmm2 subpd %xmm5, %xmm4 subpd %xmm7, %xmm6 movapd %xmm0, 4 * SIZE(X) movapd %xmm2, 6 * SIZE(X) movapd %xmm4, 4 * SIZE(Y) movapd %xmm6, 6 * SIZE(Y) addq $8 * SIZE, X addq $8 * SIZE, Y ALIGN_3.L15: testq $4, N jle .L16 movapd 0 * SIZE(Y), %xmm1 movapd 0 * SIZE(X), %xmm0 movapd 2 * SIZE(Y), %xmm3 movapd 2 * SIZE(X), %xmm2 movapd %xmm1, %xmm4 movapd %xmm0, %xmm5 movapd %xmm3, %xmm6 movapd %xmm2, %xmm7 mulpd C, %xmm0 mulpd S, %xmm1 mulpd C, %xmm2 mulpd S, %xmm3 mulpd C, %xmm4 mulpd S, %xmm5 mulpd C, %xmm6 mulpd S, %xmm7 addpd %xmm1, %xmm0 addpd %xmm3, %xmm2 subpd %xmm5, %xmm4 subpd %xmm7, %xmm6 movapd %xmm0, 0 * SIZE(X) movapd %xmm2, 2 * SIZE(X) movapd %xmm4, 0 * SIZE(Y) movapd %xmm6, 2 * SIZE(Y) addq $4 * SIZE, X addq $4 * SIZE, Y ALIGN_3.L16: testq $2, N jle .L17 movapd 0 * SIZE(Y), %xmm1 movapd 0 * SIZE(X), %xmm0 movapd %xmm1, %xmm2 movapd %xmm0, %xmm3
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -