|
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 STACK 16
|
|
kusano |
2b45e8 |
#define ARGS 8
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
#define J 0 + STACK(%esp)
|
|
kusano |
2b45e8 |
#define BOFFSET2 4 + STACK(%esp)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
#define STACK_M 4 + STACK + ARGS(%esp)
|
|
kusano |
2b45e8 |
#define STACK_N 8 + STACK + ARGS(%esp)
|
|
kusano |
2b45e8 |
#define STACK_A 12 + STACK + ARGS(%esp)
|
|
kusano |
2b45e8 |
#define STACK_LDA 16 + STACK + ARGS(%esp)
|
|
kusano |
2b45e8 |
#define STACK_B 20 + STACK + ARGS(%esp)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
PROLOGUE
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
subl $ARGS, %esp
|
|
kusano |
2b45e8 |
pushl %ebp
|
|
kusano |
2b45e8 |
pushl %edi
|
|
kusano |
2b45e8 |
pushl %esi
|
|
kusano |
2b45e8 |
pushl %ebx
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
PROFCODE
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
#define A %ebp
|
|
kusano |
2b45e8 |
#define A1 %edx
|
|
kusano |
2b45e8 |
#define LDA %ecx
|
|
kusano |
2b45e8 |
#define B %edi
|
|
kusano |
2b45e8 |
#define I %ebx
|
|
kusano |
2b45e8 |
#define B1 %eax
|
|
kusano |
2b45e8 |
#define M4 %esi
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
EMMS
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movl STACK_A, A
|
|
kusano |
2b45e8 |
movl STACK_B, B
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movl STACK_M, %ebx
|
|
kusano |
2b45e8 |
movl STACK_N, %eax
|
|
kusano |
2b45e8 |
movl STACK_LDA, LDA
|
|
kusano |
2b45e8 |
sall $ZBASE_SHIFT, LDA
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
andl $-2, %eax
|
|
kusano |
2b45e8 |
addl %eax, %eax
|
|
kusano |
2b45e8 |
imull %ebx, %eax # m * ( n & ~1)
|
|
kusano |
2b45e8 |
leal (B, %eax, SIZE), %eax # boffset2 = b + m * (n & ~1)
|
|
kusano |
2b45e8 |
movl %eax, BOFFSET2
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movl STACK_M, M4
|
|
kusano |
2b45e8 |
sall $ZBASE_SHIFT + 1, M4
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
testl %ebx, %ebx # if !(m & 1) goto L28
|
|
kusano |
2b45e8 |
movl %ebx, J
|
|
kusano |
2b45e8 |
jle .L999
|
|
kusano |
2b45e8 |
ALIGN_4
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L39:
|
|
kusano |
2b45e8 |
movl A, A1
|
|
kusano |
2b45e8 |
addl LDA, A
|
|
kusano |
2b45e8 |
movl B, B1
|
|
kusano |
2b45e8 |
addl $4 * SIZE, B
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movl STACK_N, I
|
|
kusano |
2b45e8 |
sarl $1, I
|
|
kusano |
2b45e8 |
jle .L32
|
|
kusano |
2b45e8 |
ALIGN_4
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L36:
|
|
kusano |
2b45e8 |
#ifdef HAVE_MMX
|
|
kusano |
2b45e8 |
MMXLOAD 0 * SIZE(A1), %mm0
|
|
kusano |
2b45e8 |
MMXLOAD 1 * SIZE(A1), %mm1
|
|
kusano |
2b45e8 |
MMXLOAD 2 * SIZE(A1), %mm2
|
|
kusano |
2b45e8 |
MMXLOAD 3 * SIZE(A1), %mm3
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
MMXSTORE %mm0, 0 * SIZE(B1)
|
|
kusano |
2b45e8 |
MMXSTORE %mm1, 1 * SIZE(B1)
|
|
kusano |
2b45e8 |
MMXSTORE %mm2, 2 * SIZE(B1)
|
|
kusano |
2b45e8 |
MMXSTORE %mm3, 3 * SIZE(B1)
|
|
kusano |
2b45e8 |
#else
|
|
kusano |
2b45e8 |
FLD 3 * SIZE(A1)
|
|
kusano |
2b45e8 |
FLD 2 * SIZE(A1)
|
|
kusano |
2b45e8 |
FLD 1 * SIZE(A1)
|
|
kusano |
2b45e8 |
FLD 0 * SIZE(A1)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
FST 0 * SIZE(B1)
|
|
kusano |
2b45e8 |
FST 1 * SIZE(B1)
|
|
kusano |
2b45e8 |
FST 2 * SIZE(B1)
|
|
kusano |
2b45e8 |
FST 3 * SIZE(B1)
|
|
kusano |
2b45e8 |
#endif
|
|
kusano |
2b45e8 |
addl $4 * SIZE, A1
|
|
kusano |
2b45e8 |
addl M4, B1
|
|
kusano |
2b45e8 |
decl I
|
|
kusano |
2b45e8 |
jne .L36
|
|
kusano |
2b45e8 |
ALIGN_4
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L32:
|
|
kusano |
2b45e8 |
movl STACK_N, I
|
|
kusano |
2b45e8 |
andl $1, I
|
|
kusano |
2b45e8 |
jle .L99
|
|
kusano |
2b45e8 |
ALIGN_4
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movl BOFFSET2, B1
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
#ifdef HAVE_MMX
|
|
kusano |
2b45e8 |
MMXLOAD 0 * SIZE(A1), %mm0
|
|
kusano |
2b45e8 |
MMXLOAD 1 * SIZE(A1), %mm1
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
MMXSTORE %mm0, 0 * SIZE(B1)
|
|
kusano |
2b45e8 |
MMXSTORE %mm1, 1 * SIZE(B1)
|
|
kusano |
2b45e8 |
#else
|
|
kusano |
2b45e8 |
FLD 1 * SIZE(A1)
|
|
kusano |
2b45e8 |
FLD 0 * SIZE(A1)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
FST 0 * SIZE(B1)
|
|
kusano |
2b45e8 |
FST 1 * SIZE(B1)
|
|
kusano |
2b45e8 |
#endif
|
|
kusano |
2b45e8 |
addl $2 * SIZE, BOFFSET2
|
|
kusano |
2b45e8 |
ALIGN_4
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L99:
|
|
kusano |
2b45e8 |
decl J
|
|
kusano |
2b45e8 |
jne .L39
|
|
kusano |
2b45e8 |
ALIGN_4
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L999:
|
|
kusano |
2b45e8 |
EMMS
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
popl %ebx
|
|
kusano |
2b45e8 |
popl %esi
|
|
kusano |
2b45e8 |
popl %edi
|
|
kusano |
2b45e8 |
popl %ebp
|
|
kusano |
2b45e8 |
addl $ARGS,%esp
|
|
kusano |
2b45e8 |
ret
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
EPILOGUE
|