|
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 RPREFETCHSIZE 12
|
|
kusano |
2b45e8 |
#define WPREFETCHSIZE (RPREFETCHSIZE * 4)
|
|
kusano |
2b45e8 |
#define PREFETCH prefetcht0
|
|
kusano |
2b45e8 |
#define PREFETCHW prefetcht2
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
#define STACK 16
|
|
kusano |
2b45e8 |
#define ARGS 0
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
#define M 4 + STACK + ARGS(%esp)
|
|
kusano |
2b45e8 |
#define N 8 + STACK + ARGS(%esp)
|
|
kusano |
2b45e8 |
#define ARG_A 12 + STACK + ARGS(%esp)
|
|
kusano |
2b45e8 |
#define ARG_LDA 16 + STACK + ARGS(%esp)
|
|
kusano |
2b45e8 |
#define ARG_B 20 + STACK + ARGS(%esp)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
#define A %eax
|
|
kusano |
2b45e8 |
#define B %ebx
|
|
kusano |
2b45e8 |
#define LDA %ebp
|
|
kusano |
2b45e8 |
#define A1 %ecx
|
|
kusano |
2b45e8 |
#define A2 %edx
|
|
kusano |
2b45e8 |
#define I %esi
|
|
kusano |
2b45e8 |
#define J %edi
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
PROLOGUE
|
|
kusano |
2b45e8 |
|
|
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 |
movl ARG_A, A
|
|
kusano |
2b45e8 |
movl ARG_B, B
|
|
kusano |
2b45e8 |
movl ARG_LDA, LDA
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
sall $BASE_SHIFT, LDA
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movl N, J
|
|
kusano |
2b45e8 |
sarl $2, J
|
|
kusano |
2b45e8 |
je .L20
|
|
kusano |
2b45e8 |
ALIGN_3
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L10:
|
|
kusano |
2b45e8 |
movl A, A1
|
|
kusano |
2b45e8 |
leal (A, LDA, 2), A2
|
|
kusano |
2b45e8 |
leal (A, LDA, 4), A
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movl M, I
|
|
kusano |
2b45e8 |
sarl $2, I
|
|
kusano |
2b45e8 |
je .L15
|
|
kusano |
2b45e8 |
ALIGN_3
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L12:
|
|
kusano |
2b45e8 |
PREFETCH RPREFETCHSIZE * SIZE(A1)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movsd 0 * SIZE(A1) , %xmm0
|
|
kusano |
2b45e8 |
movhps 0 * SIZE(A1, LDA), %xmm0
|
|
kusano |
2b45e8 |
movsd 0 * SIZE(A2) , %xmm1
|
|
kusano |
2b45e8 |
movhps 0 * SIZE(A2, LDA), %xmm1
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
PREFETCH RPREFETCHSIZE * SIZE(A1, LDA)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movsd 1 * SIZE(A1) , %xmm2
|
|
kusano |
2b45e8 |
movhps 1 * SIZE(A1, LDA), %xmm2
|
|
kusano |
2b45e8 |
movsd 1 * SIZE(A2) , %xmm3
|
|
kusano |
2b45e8 |
movhps 1 * SIZE(A2, LDA), %xmm3
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
PREFETCH RPREFETCHSIZE * SIZE(A2)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movsd 2 * SIZE(A1) , %xmm4
|
|
kusano |
2b45e8 |
movhps 2 * SIZE(A1, LDA), %xmm4
|
|
kusano |
2b45e8 |
movsd 2 * SIZE(A2) , %xmm5
|
|
kusano |
2b45e8 |
movhps 2 * SIZE(A2, LDA), %xmm5
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
PREFETCH RPREFETCHSIZE * SIZE(A2, LDA)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movsd 3 * SIZE(A1) , %xmm6
|
|
kusano |
2b45e8 |
movhps 3 * SIZE(A1, LDA), %xmm6
|
|
kusano |
2b45e8 |
movsd 3 * SIZE(A2) , %xmm7
|
|
kusano |
2b45e8 |
movhps 3 * SIZE(A2, LDA), %xmm7
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
PREFETCHW (RPREFETCHSIZE + 0) * SIZE(B)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movaps %xmm0, 0 * SIZE(B)
|
|
kusano |
2b45e8 |
movaps %xmm1, 2 * SIZE(B)
|
|
kusano |
2b45e8 |
movaps %xmm2, 4 * SIZE(B)
|
|
kusano |
2b45e8 |
movaps %xmm3, 6 * SIZE(B)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
PREFETCHW (RPREFETCHSIZE + 8) * SIZE(B)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movaps %xmm4, 8 * SIZE(B)
|
|
kusano |
2b45e8 |
movaps %xmm5, 10 * SIZE(B)
|
|
kusano |
2b45e8 |
movaps %xmm6, 12 * SIZE(B)
|
|
kusano |
2b45e8 |
movaps %xmm7, 14 * SIZE(B)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
addl $ 4 * SIZE, A1
|
|
kusano |
2b45e8 |
addl $ 4 * SIZE, A2
|
|
kusano |
2b45e8 |
subl $-16 * SIZE, B
|
|
kusano |
2b45e8 |
decl I
|
|
kusano |
2b45e8 |
jne .L12
|
|
kusano |
2b45e8 |
ALIGN_3
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L15:
|
|
kusano |
2b45e8 |
testl $2, M
|
|
kusano |
2b45e8 |
jle .L16
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movsd 0 * SIZE(A1) , %xmm0
|
|
kusano |
2b45e8 |
movhps 0 * SIZE(A1, LDA), %xmm0
|
|
kusano |
2b45e8 |
movsd 0 * SIZE(A2) , %xmm1
|
|
kusano |
2b45e8 |
movhps 0 * SIZE(A2, LDA), %xmm1
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movsd 1 * SIZE(A1) , %xmm2
|
|
kusano |
2b45e8 |
movhps 1 * SIZE(A1, LDA), %xmm2
|
|
kusano |
2b45e8 |
movsd 1 * SIZE(A2) , %xmm3
|
|
kusano |
2b45e8 |
movhps 1 * SIZE(A2, LDA), %xmm3
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movaps %xmm0, 0 * SIZE(B)
|
|
kusano |
2b45e8 |
movaps %xmm1, 2 * SIZE(B)
|
|
kusano |
2b45e8 |
movaps %xmm2, 4 * SIZE(B)
|
|
kusano |
2b45e8 |
movaps %xmm3, 6 * SIZE(B)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
addl $ 2 * SIZE, A1
|
|
kusano |
2b45e8 |
addl $ 2 * SIZE, A2
|
|
kusano |
2b45e8 |
subl $-8 * SIZE, B
|
|
kusano |
2b45e8 |
ALIGN_4
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L16:
|
|
kusano |
2b45e8 |
testl $1, M
|
|
kusano |
2b45e8 |
jle .L19
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movsd 0 * SIZE(A1) , %xmm0
|
|
kusano |
2b45e8 |
movhps 0 * SIZE(A1, LDA), %xmm0
|
|
kusano |
2b45e8 |
movsd 0 * SIZE(A2) , %xmm1
|
|
kusano |
2b45e8 |
movhps 0 * SIZE(A2, LDA), %xmm1
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movaps %xmm0, 0 * SIZE(B)
|
|
kusano |
2b45e8 |
movaps %xmm1, 2 * SIZE(B)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
subl $-4 * SIZE, B
|
|
kusano |
2b45e8 |
ALIGN_4
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L19:
|
|
kusano |
2b45e8 |
decl J
|
|
kusano |
2b45e8 |
jne .L10
|
|
kusano |
2b45e8 |
ALIGN_3
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L20:
|
|
kusano |
2b45e8 |
testl $2, N
|
|
kusano |
2b45e8 |
jle .L30
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movl A, A1
|
|
kusano |
2b45e8 |
leal (A, LDA, 2), A
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movl M, I
|
|
kusano |
2b45e8 |
sarl $2, I
|
|
kusano |
2b45e8 |
je .L25
|
|
kusano |
2b45e8 |
ALIGN_3
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L22:
|
|
kusano |
2b45e8 |
PREFETCH RPREFETCHSIZE * SIZE(A1)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movsd 0 * SIZE(A1) , %xmm0
|
|
kusano |
2b45e8 |
movhps 0 * SIZE(A1, LDA), %xmm0
|
|
kusano |
2b45e8 |
movsd 1 * SIZE(A1) , %xmm1
|
|
kusano |
2b45e8 |
movhps 1 * SIZE(A1, LDA), %xmm1
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
PREFETCH RPREFETCHSIZE * SIZE(A1, LDA)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movsd 2 * SIZE(A1) , %xmm2
|
|
kusano |
2b45e8 |
movhps 2 * SIZE(A1, LDA), %xmm2
|
|
kusano |
2b45e8 |
movsd 3 * SIZE(A1) , %xmm3
|
|
kusano |
2b45e8 |
movhps 3 * SIZE(A1, LDA), %xmm3
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
PREFETCHW (RPREFETCHSIZE + 0) * SIZE(B)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movaps %xmm0, 0 * SIZE(B)
|
|
kusano |
2b45e8 |
movaps %xmm1, 2 * SIZE(B)
|
|
kusano |
2b45e8 |
movaps %xmm2, 4 * SIZE(B)
|
|
kusano |
2b45e8 |
movaps %xmm3, 6 * SIZE(B)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
addl $ 4 * SIZE, A1
|
|
kusano |
2b45e8 |
subl $-8 * SIZE, B
|
|
kusano |
2b45e8 |
decl I
|
|
kusano |
2b45e8 |
jne .L22
|
|
kusano |
2b45e8 |
ALIGN_3
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L25:
|
|
kusano |
2b45e8 |
testl $2, M
|
|
kusano |
2b45e8 |
jle .L26
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movsd 0 * SIZE(A1) , %xmm0
|
|
kusano |
2b45e8 |
movhps 0 * SIZE(A1, LDA), %xmm0
|
|
kusano |
2b45e8 |
movsd 1 * SIZE(A1) , %xmm1
|
|
kusano |
2b45e8 |
movhps 1 * SIZE(A1, LDA), %xmm1
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movaps %xmm0, 0 * SIZE(B)
|
|
kusano |
2b45e8 |
movaps %xmm1, 2 * SIZE(B)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
addl $ 2 * SIZE, A1
|
|
kusano |
2b45e8 |
addl $ 2 * SIZE, A2
|
|
kusano |
2b45e8 |
subl $-4 * SIZE, B
|
|
kusano |
2b45e8 |
ALIGN_4
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L26:
|
|
kusano |
2b45e8 |
testl $1, M
|
|
kusano |
2b45e8 |
jle .L30
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movsd 0 * SIZE(A1) , %xmm0
|
|
kusano |
2b45e8 |
movhps 0 * SIZE(A1, LDA), %xmm0
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movaps %xmm0, 0 * SIZE(B)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
subl $-2 * SIZE, B
|
|
kusano |
2b45e8 |
ALIGN_4
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L30:
|
|
kusano |
2b45e8 |
testl $1, N
|
|
kusano |
2b45e8 |
jle .L999
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movl A, A1
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movl M, I
|
|
kusano |
2b45e8 |
sarl $2, I
|
|
kusano |
2b45e8 |
je .L35
|
|
kusano |
2b45e8 |
ALIGN_3
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L32:
|
|
kusano |
2b45e8 |
PREFETCH RPREFETCHSIZE * SIZE(A1)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movsd 0 * SIZE(A1), %xmm0
|
|
kusano |
2b45e8 |
movhps 1 * SIZE(A1), %xmm0
|
|
kusano |
2b45e8 |
movsd 2 * SIZE(A1), %xmm1
|
|
kusano |
2b45e8 |
movhps 3 * SIZE(A1), %xmm1
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
PREFETCHW (RPREFETCHSIZE + 0) * SIZE(B)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movaps %xmm0, 0 * SIZE(B)
|
|
kusano |
2b45e8 |
movaps %xmm1, 2 * SIZE(B)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
addl $ 4 * SIZE, A1
|
|
kusano |
2b45e8 |
subl $-4 * SIZE, B
|
|
kusano |
2b45e8 |
decl I
|
|
kusano |
2b45e8 |
jne .L32
|
|
kusano |
2b45e8 |
ALIGN_3
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L35:
|
|
kusano |
2b45e8 |
testl $2, M
|
|
kusano |
2b45e8 |
jle .L36
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movsd 0 * SIZE(A1), %xmm0
|
|
kusano |
2b45e8 |
movhps 1 * SIZE(A1), %xmm0
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movaps %xmm0, 0 * SIZE(B)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
addl $ 2 * SIZE, A1
|
|
kusano |
2b45e8 |
subl $-2 * SIZE, B
|
|
kusano |
2b45e8 |
ALIGN_4
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L36:
|
|
kusano |
2b45e8 |
testl $1, M
|
|
kusano |
2b45e8 |
jle .L999
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
movsd 0 * SIZE(A1), %xmm0
|
|
kusano |
2b45e8 |
movsd %xmm0, 0 * SIZE(B)
|
|
kusano |
2b45e8 |
ALIGN_4
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
.L999:
|
|
kusano |
2b45e8 |
popl %ebx
|
|
kusano |
2b45e8 |
popl %esi
|
|
kusano |
2b45e8 |
popl %edi
|
|
kusano |
2b45e8 |
popl %ebp
|
|
kusano |
2b45e8 |
ret
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
EPILOGUE
|