📄 rot_sse.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#if defined(CORE2) || defined(PENRYN)#define MOVSD movsd#endif#ifdef PENTIUM4#define PREFETCH prefetcht0#define PREFETCH_SIZE 144#define MOVSD movsd#endif#if defined(OPTERON) || defined(BARCELONA)#define PREFETCH prefetchw#define PREFETCH_SIZE (16 * 16)#ifdef OPTERON#define MOVSD movlps#else#define MOVSD movsd#endif#endif#define C %xmm14#define S %xmm15 PROLOGUE PROFCODE#ifdef WINDOWS_ABI movq 40(%rsp), INCY movss 48(%rsp), %xmm0 movss 56(%rsp), %xmm1#endif SAVEREGISTERS leaq (, INCX, SIZE), INCX leaq (, INCY, SIZE), INCY pshufd $0x0, %xmm0, C pshufd $0x0, %xmm1, S cmpq $0, N jle .L999 cmpq $SIZE, INCX jne .L50 cmpq $SIZE, INCY jne .L50 testq $SIZE, X je .L05 movss 0 * SIZE(Y), %xmm1 movss 0 * SIZE(X), %xmm0 movaps %xmm1, %xmm2 movaps %xmm0, %xmm3 mulss C, %xmm0 mulss S, %xmm1 mulss C, %xmm2 mulss S, %xmm3 addss %xmm1, %xmm0 subss %xmm3, %xmm2 movss %xmm0, 0 * SIZE(X) movss %xmm2, 0 * SIZE(Y) addq $1 * SIZE, X addq $1 * SIZE, Y decq N jle .L999.L05: testq $2 * SIZE, X je .L10 cmpq $1, N je .L17 movsd 0 * SIZE(Y), %xmm1 movsd 0 * SIZE(X), %xmm0 movaps %xmm1, %xmm2 movaps %xmm0, %xmm3 mulps C, %xmm0 mulps S, %xmm1 mulps C, %xmm2 mulps S, %xmm3 addps %xmm1, %xmm0 subps %xmm3, %xmm2 movlps %xmm0, 0 * SIZE(X) movlps %xmm2, 0 * SIZE(Y) addq $2 * SIZE, X addq $2 * SIZE, Y subq $2, N jle .L999 ALIGN_2.L10: testq $3 * SIZE, Y jne .L20 movq N, %rax sarq $5, %rax jle .L14 movaps 0 * SIZE(Y), %xmm1 movaps 4 * SIZE(Y), %xmm3 movaps 8 * SIZE(Y), %xmm9 movaps 12 * SIZE(Y), %xmm11 movaps 0 * SIZE(X), %xmm0 movaps 4 * SIZE(X), %xmm2 movaps 8 * SIZE(X), %xmm8 movaps 12 * SIZE(X), %xmm10 decq %rax jle .L12 ALIGN_3.L11:#ifdef PENTIUM4 PREFETCH (PREFETCH_SIZE + 0) * SIZE(X)#endif movaps %xmm1, %xmm4 mulps S, %xmm1#if defined(OPTERON) || defined(BARCELONA) PREFETCH (PREFETCH_SIZE + 0) * SIZE(X)#endif movaps %xmm3, %xmm6 mulps S, %xmm3 movaps %xmm0, %xmm5 mulps C, %xmm0 movaps %xmm2, %xmm7 mulps C, %xmm2 mulps C, %xmm4 mulps S, %xmm5 mulps C, %xmm6 mulps S, %xmm7 addps %xmm1, %xmm0 movaps 16 * SIZE(Y), %xmm1 addps %xmm3, %xmm2 movaps 20 * SIZE(Y), %xmm3 subps %xmm5, %xmm4 subps %xmm7, %xmm6 movaps %xmm0, 0 * SIZE(X) movaps 16 * SIZE(X), %xmm0#if defined(OPTERON) || defined(BARCELONA) PREFETCH (PREFETCH_SIZE + 0) * SIZE(Y)#endif movaps %xmm2, 4 * SIZE(X) movaps 20 * SIZE(X), %xmm2 movaps %xmm4, 0 * SIZE(Y) movaps %xmm6, 4 * SIZE(Y) movaps %xmm9, %xmm4 mulps S, %xmm9 movaps %xmm8, %xmm5 mulps C, %xmm8 movaps %xmm11, %xmm6 mulps S, %xmm11 movaps %xmm10, %xmm7 mulps C, %xmm10 mulps C, %xmm4 mulps S, %xmm5 mulps C, %xmm6 mulps S, %xmm7 addps %xmm9, %xmm8 movaps 24 * SIZE(Y), %xmm9 addps %xmm11, %xmm10 movaps 28 * SIZE(Y), %xmm11 subps %xmm5, %xmm4 subps %xmm7, %xmm6 movaps %xmm8, 8 * SIZE(X) movaps 24 * SIZE(X), %xmm8 movaps %xmm10,12 * SIZE(X) movaps 28 * SIZE(X), %xmm10 movaps %xmm4, 8 * SIZE(Y) movaps %xmm6, 12 * SIZE(Y)#ifdef PENTIUM4 PREFETCH (PREFETCH_SIZE + 0) * SIZE(Y)#endif#if defined(OPTERON) || defined(BARCELONA) PREFETCH (PREFETCH_SIZE + 16) * SIZE(X)#endif movaps %xmm1, %xmm4 mulps S, %xmm1 movaps %xmm3, %xmm6 mulps S, %xmm3 movaps %xmm0, %xmm5 mulps C, %xmm0 movaps %xmm2, %xmm7 mulps C, %xmm2 mulps C, %xmm4 mulps S, %xmm5 mulps C, %xmm6 mulps S, %xmm7 addps %xmm1, %xmm0 movaps 32 * SIZE(Y), %xmm1 addps %xmm3, %xmm2 movaps 36 * SIZE(Y), %xmm3 subps %xmm5, %xmm4 subps %xmm7, %xmm6 movaps %xmm0, 16 * SIZE(X) movaps 32 * SIZE(X), %xmm0 movaps %xmm2, 20 * SIZE(X) movaps 36 * SIZE(X), %xmm2 movaps %xmm4, 16 * SIZE(Y) movaps %xmm6, 20 * SIZE(Y)#if defined(OPTERON) || defined(BARCELONA) PREFETCH (PREFETCH_SIZE + 16) * SIZE(Y)#endif movaps %xmm9, %xmm4 mulps S, %xmm9 movaps %xmm8, %xmm5 mulps C, %xmm8 movaps %xmm11, %xmm6 mulps S, %xmm11 movaps %xmm10, %xmm7 mulps C, %xmm10 mulps C, %xmm4 mulps S, %xmm5 mulps C, %xmm6 mulps S, %xmm7 addps %xmm9, %xmm8 movaps 40 * SIZE(Y), %xmm9 addps %xmm11, %xmm10 movaps 44 * SIZE(Y), %xmm11 subps %xmm5, %xmm4 subps %xmm7, %xmm6 movaps %xmm8, 24 * SIZE(X) movaps 40 * SIZE(X), %xmm8 movaps %xmm10, 28 * SIZE(X) movaps 44 * SIZE(X), %xmm10 movaps %xmm4, 24 * SIZE(Y) movaps %xmm6, 28 * SIZE(Y) addq $32 * SIZE, X addq $32 * SIZE, Y decq %rax jg .L11 ALIGN_3.L12: movaps %xmm1, %xmm4 mulps S, %xmm1 movaps %xmm3, %xmm6 mulps S, %xmm3 movaps %xmm0, %xmm5 mulps C, %xmm0 movaps %xmm2, %xmm7 mulps C, %xmm2 mulps C, %xmm4 mulps S, %xmm5 mulps C, %xmm6 mulps S, %xmm7 addps %xmm1, %xmm0 movaps 16 * SIZE(Y), %xmm1 addps %xmm3, %xmm2 movaps 20 * SIZE(Y), %xmm3 subps %xmm5, %xmm4 subps %xmm7, %xmm6 movaps %xmm0, 0 * SIZE(X) movaps 16 * SIZE(X), %xmm0 movaps %xmm2, 4 * SIZE(X) movaps 20 * SIZE(X), %xmm2 movaps %xmm4, 0 * SIZE(Y) movaps %xmm6, 4 * SIZE(Y) movaps %xmm9, %xmm4 mulps S, %xmm9 movaps %xmm8, %xmm5 mulps C, %xmm8 movaps %xmm11, %xmm6 mulps S, %xmm11 movaps %xmm10, %xmm7 mulps C, %xmm10 mulps C, %xmm4 mulps S, %xmm5 mulps C, %xmm6 mulps S, %xmm7 addps %xmm9, %xmm8 movaps 24 * SIZE(Y), %xmm9 addps %xmm11, %xmm10 movaps 28 * SIZE(Y), %xmm11 subps %xmm5, %xmm4 subps %xmm7, %xmm6 movaps %xmm8, 8 * SIZE(X) movaps 24 * SIZE(X), %xmm8 movaps %xmm10,12 * SIZE(X) movaps 28 * SIZE(X), %xmm10 movaps %xmm4, 8 * SIZE(Y) movaps %xmm6, 12 * SIZE(Y) movaps %xmm1, %xmm4 mulps S, %xmm1 movaps %xmm3, %xmm6 mulps S, %xmm3 movaps %xmm0, %xmm5 mulps C, %xmm0 movaps %xmm2, %xmm7 mulps C, %xmm2 mulps C, %xmm4 mulps S, %xmm5 mulps C, %xmm6 mulps S, %xmm7 addps %xmm1, %xmm0 addps %xmm3, %xmm2 subps %xmm5, %xmm4 subps %xmm7, %xmm6 movaps %xmm0, 16 * SIZE(X) movaps %xmm2, 20 * SIZE(X) movaps %xmm4, 16 * SIZE(Y) movaps %xmm6, 20 * SIZE(Y) movaps %xmm9, %xmm4 mulps S, %xmm9 movaps %xmm8, %xmm5 mulps C, %xmm8 movaps %xmm11, %xmm6 mulps S, %xmm11 movaps %xmm10, %xmm7 mulps C, %xmm10 mulps C, %xmm4 mulps S, %xmm5 mulps C, %xmm6 mulps S, %xmm7 addps %xmm9, %xmm8 addps %xmm11, %xmm10 subps %xmm5, %xmm4 subps %xmm7, %xmm6 movaps %xmm8, 24 * SIZE(X) movaps %xmm10, 28 * SIZE(X) movaps %xmm4, 24 * SIZE(Y) movaps %xmm6, 28 * SIZE(Y) addq $32 * SIZE, X addq $32 * SIZE, Y ALIGN_3.L14: testq $31, N jle .L999 testq $16, N jle .L15 movaps 0 * SIZE(Y), %xmm1 movaps 0 * SIZE(X), %xmm0 movaps 4 * SIZE(Y), %xmm3 movaps 4 * SIZE(X), %xmm2 movaps %xmm1, %xmm4 movaps %xmm0, %xmm5 movaps %xmm3, %xmm6 movaps %xmm2, %xmm7 mulps C, %xmm0 mulps S, %xmm1 mulps C, %xmm2 mulps S, %xmm3 mulps C, %xmm4 mulps S, %xmm5 mulps C, %xmm6 mulps S, %xmm7 addps %xmm1, %xmm0 addps %xmm3, %xmm2 subps %xmm5, %xmm4 subps %xmm7, %xmm6 movaps %xmm0, 0 * SIZE(X) movaps %xmm2, 4 * SIZE(X) movaps %xmm4, 0 * SIZE(Y) movaps %xmm6, 4 * SIZE(Y) movaps 8 * SIZE(Y), %xmm1 movaps 8 * SIZE(X), %xmm0 movaps 12 * SIZE(Y), %xmm3 movaps 12 * SIZE(X), %xmm2 movaps %xmm1, %xmm4 movaps %xmm0, %xmm5 movaps %xmm3, %xmm6 movaps %xmm2, %xmm7 mulps C, %xmm0 mulps S, %xmm1 mulps C, %xmm2 mulps S, %xmm3 mulps C, %xmm4 mulps S, %xmm5 mulps C, %xmm6 mulps S, %xmm7 addps %xmm1, %xmm0 addps %xmm3, %xmm2 subps %xmm5, %xmm4 subps %xmm7, %xmm6 movaps %xmm0, 8 * SIZE(X) movaps %xmm2, 12 * SIZE(X) movaps %xmm4, 8 * SIZE(Y) movaps %xmm6, 12 * SIZE(Y) addq $16 * SIZE, X addq $16 * SIZE, Y ALIGN_3.L15: testq $8, N jle .L16 movaps 0 * SIZE(Y), %xmm1 movaps 0 * SIZE(X), %xmm0 movaps 4 * SIZE(Y), %xmm3 movaps 4 * SIZE(X), %xmm2 movaps %xmm1, %xmm4 movaps %xmm0, %xmm5 movaps %xmm3, %xmm6 movaps %xmm2, %xmm7 mulps C, %xmm0 mulps S, %xmm1 mulps C, %xmm2 mulps S, %xmm3 mulps C, %xmm4 mulps S, %xmm5 mulps C, %xmm6 mulps S, %xmm7 addps %xmm1, %xmm0 addps %xmm3, %xmm2 subps %xmm5, %xmm4 subps %xmm7, %xmm6 movaps %xmm0, 0 * SIZE(X) movaps %xmm2, 4 * SIZE(X) movaps %xmm4, 0 * SIZE(Y) movaps %xmm6, 4 * SIZE(Y) addq $8 * SIZE, X addq $8 * SIZE, Y ALIGN_3.L16: testq $4, N jle .L17 movaps 0 * SIZE(Y), %xmm1 movaps 0 * SIZE(X), %xmm0 movaps %xmm1, %xmm2 movaps %xmm0, %xmm3 mulps C, %xmm0 mulps S, %xmm1 mulps C, %xmm2 mulps S, %xmm3 addps %xmm1, %xmm0 subps %xmm3, %xmm2 movaps %xmm0, 0 * SIZE(X) movaps %xmm2, 0 * SIZE(Y) addq $4 * SIZE, X addq $4 * SIZE, Y ALIGN_3.L17: testq $2, N jle .L18
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -