|
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 |
#ifndef WINDOWS_ABI
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
#define M ARG1
|
|
kusano |
2b45e8 |
#define N ARG2
|
|
kusano |
2b45e8 |
#define C ARG3
|
|
kusano |
2b45e8 |
#define LDC ARG4
|
|
kusano |
2b45e8 |
#define C1 ARG5
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
#define STACK_C 16(%rsp)
|
|
kusano |
2b45e8 |
#define STACK_LDC 24(%rsp)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
#else
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
#define STACKSIZE 256
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
#define M ARG1
|
|
kusano |
2b45e8 |
#define N ARG2
|
|
kusano |
2b45e8 |
#define C ARG3
|
|
kusano |
2b45e8 |
#define LDC ARG4
|
|
kusano |
2b45e8 |
#define C1 %r10
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
#define STACK_ALPHA_I 40 + STACKSIZE(%rsp)
|
|
kusano |
2b45e8 |
#define STACK_C 80 + STACKSIZE(%rsp)
|
|
kusano |
2b45e8 |
#define STACK_LDC 88 + STACKSIZE(%rsp)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
#endif
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
#define I %rax
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
PROLOGUE
|
|
kusano |
2b45e8 |
PROFCODE
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
#ifdef WINDOWS_ABI
|
|
kusano |
2b45e8 |
subq $STACKSIZE, %rsp
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movups %xmm6, 0(%rsp)
|
|
kusano |
2b45e8 |
movups %xmm7, 16(%rsp)
|
|
kusano |
2b45e8 |
movups %xmm8, 32(%rsp)
|
|
kusano |
2b45e8 |
movups %xmm9, 48(%rsp)
|
|
kusano |
2b45e8 |
movups %xmm10, 64(%rsp)
|
|
kusano |
2b45e8 |
movups %xmm11, 80(%rsp)
|
|
kusano |
2b45e8 |
movups %xmm12, 96(%rsp)
|
|
kusano |
2b45e8 |
movups %xmm13, 112(%rsp)
|
|
kusano |
2b45e8 |
movups %xmm14, 128(%rsp)
|
|
kusano |
2b45e8 |
movups %xmm15, 144(%rsp)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movaps %xmm3, %xmm0
|
|
kusano |
2b45e8 |
movsd STACK_ALPHA_I, %xmm1
|
|
kusano |
2b45e8 |
#endif
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
pxor %xmm15, %xmm15
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movq STACK_C, C
|
|
kusano |
2b45e8 |
movq STACK_LDC, LDC
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
testq M, M
|
|
kusano |
2b45e8 |
jle .L999
|
|
kusano |
2b45e8 |
testq N, N
|
|
kusano |
2b45e8 |
jle .L999
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
salq $ZBASE_SHIFT, LDC
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
#ifdef DOUBLE
|
|
kusano |
2b45e8 |
ucomisd %xmm15, %xmm0
|
|
kusano |
2b45e8 |
jne .L71
|
|
kusano |
2b45e8 |
ucomisd %xmm15, %xmm1
|
|
kusano |
2b45e8 |
jne .L71
|
|
kusano |
2b45e8 |
#else
|
|
kusano |
2b45e8 |
ucomiss %xmm15, %xmm0
|
|
kusano |
2b45e8 |
jne .L71
|
|
kusano |
2b45e8 |
ucomiss %xmm15, %xmm1
|
|
kusano |
2b45e8 |
jne .L71
|
|
kusano |
2b45e8 |
#endif
|
|
kusano |
2b45e8 |
ALIGN_2
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L53:
|
|
kusano |
2b45e8 |
movq C, C1 # c_offset1 = c_offset
|
|
kusano |
2b45e8 |
addq LDC, C # c_offset += ldc
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movq M, I
|
|
kusano |
2b45e8 |
sarq $2, I
|
|
kusano |
2b45e8 |
jle .L56
|
|
kusano |
2b45e8 |
ALIGN_2
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L57:
|
|
kusano |
2b45e8 |
#ifdef OPTERON
|
|
kusano |
2b45e8 |
prefetchw 64 * SIZE(C1)
|
|
kusano |
2b45e8 |
#endif
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
MOVSD %xmm0, 0 * SIZE(C1) # c_offset1
|
|
kusano |
2b45e8 |
MOVSD %xmm0, 1 * SIZE(C1)
|
|
kusano |
2b45e8 |
MOVSD %xmm0, 2 * SIZE(C1)
|
|
kusano |
2b45e8 |
MOVSD %xmm0, 3 * SIZE(C1)
|
|
kusano |
2b45e8 |
MOVSD %xmm0, 4 * SIZE(C1)
|
|
kusano |
2b45e8 |
MOVSD %xmm0, 5 * SIZE(C1)
|
|
kusano |
2b45e8 |
MOVSD %xmm0, 6 * SIZE(C1)
|
|
kusano |
2b45e8 |
MOVSD %xmm0, 7 * SIZE(C1)
|
|
kusano |
2b45e8 |
addq $8 * SIZE, C1 # c_offset1 += 8
|
|
kusano |
2b45e8 |
decq I # i--
|
|
kusano |
2b45e8 |
jg .L57
|
|
kusano |
2b45e8 |
ALIGN_2
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L56:
|
|
kusano |
2b45e8 |
movq M, I
|
|
kusano |
2b45e8 |
andq $3, I
|
|
kusano |
2b45e8 |
jle .L62
|
|
kusano |
2b45e8 |
ALIGN_2
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L63:
|
|
kusano |
2b45e8 |
MOVSD %xmm0, 0 * SIZE(C1)
|
|
kusano |
2b45e8 |
MOVSD %xmm0, 1 * SIZE(C1)
|
|
kusano |
2b45e8 |
addq $2 * SIZE,C1
|
|
kusano |
2b45e8 |
decq I
|
|
kusano |
2b45e8 |
jg .L63
|
|
kusano |
2b45e8 |
ALIGN_2
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L62:
|
|
kusano |
2b45e8 |
decq N # j --
|
|
kusano |
2b45e8 |
jg .L53
|
|
kusano |
2b45e8 |
jmp .L999
|
|
kusano |
2b45e8 |
ALIGN_3
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L71:
|
|
kusano |
2b45e8 |
movq C, C1
|
|
kusano |
2b45e8 |
addq LDC, C # c_offset += ldc
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movq M, I
|
|
kusano |
2b45e8 |
sarq $1, I
|
|
kusano |
2b45e8 |
jle .L84
|
|
kusano |
2b45e8 |
ALIGN_3
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L85:
|
|
kusano |
2b45e8 |
#ifdef OPTERON
|
|
kusano |
2b45e8 |
prefetchw 16 * SIZE(C1)
|
|
kusano |
2b45e8 |
#endif
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
MOVSD 0 * SIZE(C1), %xmm2
|
|
kusano |
2b45e8 |
MOVSD 1 * SIZE(C1), %xmm3
|
|
kusano |
2b45e8 |
MOVSD 0 * SIZE(C1), %xmm4
|
|
kusano |
2b45e8 |
MOVSD 1 * SIZE(C1), %xmm5
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
MOVSD 2 * SIZE(C1), %xmm6
|
|
kusano |
2b45e8 |
MOVSD 3 * SIZE(C1), %xmm7
|
|
kusano |
2b45e8 |
MOVSD 2 * SIZE(C1), %xmm8
|
|
kusano |
2b45e8 |
MOVSD 3 * SIZE(C1), %xmm9
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
MULSD %xmm0, %xmm2
|
|
kusano |
2b45e8 |
MULSD %xmm1, %xmm3
|
|
kusano |
2b45e8 |
MULSD %xmm1, %xmm4
|
|
kusano |
2b45e8 |
MULSD %xmm0, %xmm5
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
MULSD %xmm0, %xmm6
|
|
kusano |
2b45e8 |
MULSD %xmm1, %xmm7
|
|
kusano |
2b45e8 |
MULSD %xmm1, %xmm8
|
|
kusano |
2b45e8 |
MULSD %xmm0, %xmm9
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
SUBSD %xmm3, %xmm2
|
|
kusano |
2b45e8 |
ADDPD %xmm5, %xmm4
|
|
kusano |
2b45e8 |
SUBSD %xmm7, %xmm6
|
|
kusano |
2b45e8 |
ADDPD %xmm9, %xmm8
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
MOVSD %xmm2, 0 * SIZE(C1)
|
|
kusano |
2b45e8 |
MOVSD %xmm4, 1 * SIZE(C1)
|
|
kusano |
2b45e8 |
MOVSD %xmm6, 2 * SIZE(C1)
|
|
kusano |
2b45e8 |
MOVSD %xmm8, 3 * SIZE(C1)
|
|
kusano |
2b45e8 |
addq $4 * SIZE, C1
|
|
kusano |
2b45e8 |
decq I
|
|
kusano |
2b45e8 |
jg .L85
|
|
kusano |
2b45e8 |
ALIGN_3
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L84:
|
|
kusano |
2b45e8 |
testq $1, M
|
|
kusano |
2b45e8 |
jle .L74
|
|
kusano |
2b45e8 |
ALIGN_3
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L75:
|
|
kusano |
2b45e8 |
prefetchnta 80 * SIZE(C1)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
MOVSD 0 * SIZE(C1), %xmm2
|
|
kusano |
2b45e8 |
MULSD %xmm0, %xmm2
|
|
kusano |
2b45e8 |
MOVSD 1 * SIZE(C1), %xmm3
|
|
kusano |
2b45e8 |
MULSD %xmm1, %xmm3
|
|
kusano |
2b45e8 |
MOVSD 0 * SIZE(C1), %xmm4
|
|
kusano |
2b45e8 |
MULSD %xmm1, %xmm4
|
|
kusano |
2b45e8 |
MOVSD 1 * SIZE(C1), %xmm5
|
|
kusano |
2b45e8 |
MULSD %xmm0, %xmm5
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
SUBSD %xmm3, %xmm2
|
|
kusano |
2b45e8 |
ADDPD %xmm5, %xmm4
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
MOVSD %xmm2, 0 * SIZE(C1)
|
|
kusano |
2b45e8 |
MOVSD %xmm4, 1 * SIZE(C1)
|
|
kusano |
2b45e8 |
ALIGN_2
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L74:
|
|
kusano |
2b45e8 |
decq N
|
|
kusano |
2b45e8 |
jg .L71
|
|
kusano |
2b45e8 |
ALIGN_2
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L999:
|
|
kusano |
2b45e8 |
#ifdef WINDOWS_ABI
|
|
kusano |
2b45e8 |
movups 0(%rsp), %xmm6
|
|
kusano |
2b45e8 |
movups 16(%rsp), %xmm7
|
|
kusano |
2b45e8 |
movups 32(%rsp), %xmm8
|
|
kusano |
2b45e8 |
movups 48(%rsp), %xmm9
|
|
kusano |
2b45e8 |
movups 64(%rsp), %xmm10
|
|
kusano |
2b45e8 |
movups 80(%rsp), %xmm11
|
|
kusano |
2b45e8 |
movups 96(%rsp), %xmm12
|
|
kusano |
2b45e8 |
movups 112(%rsp), %xmm13
|
|
kusano |
2b45e8 |
movups 128(%rsp), %xmm14
|
|
kusano |
2b45e8 |
movups 144(%rsp), %xmm15
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
addq $STACKSIZE, %rsp
|
|
kusano |
2b45e8 |
#endif
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
ret
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
EPILOGUE
|