|
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 M r3
|
|
kusano |
2b45e8 |
#define N r4
|
|
kusano |
2b45e8 |
#define C r10
|
|
kusano |
2b45e8 |
#define LDC r11
|
|
kusano |
2b45e8 |
#define J r5
|
|
kusano |
2b45e8 |
#define PRE r6
|
|
kusano |
2b45e8 |
#define CO1 r7
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
#define ALPHA_R f30
|
|
kusano |
2b45e8 |
#define ALPHA_I f31
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
#define STACKSIZE 32
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
PROLOGUE
|
|
kusano |
2b45e8 |
PROFCODE
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
addi SP, SP, -STACKSIZE
|
|
kusano |
2b45e8 |
li r0, 0
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
stfd f30, 0(SP)
|
|
kusano |
2b45e8 |
stfd f31, 8(SP)
|
|
kusano |
2b45e8 |
stw r0, 16(SP)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
#ifdef linux
|
|
kusano |
2b45e8 |
#ifndef __64BIT__
|
|
kusano |
2b45e8 |
lwz LDC, 8 + STACKSIZE(SP)
|
|
kusano |
2b45e8 |
#else
|
|
kusano |
2b45e8 |
ld C, 120 + STACKSIZE(SP)
|
|
kusano |
2b45e8 |
ld LDC, 128 + STACKSIZE(SP)
|
|
kusano |
2b45e8 |
#endif
|
|
kusano |
2b45e8 |
#endif
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
#if defined(_AIX) || defined(__APPLE__)
|
|
kusano |
2b45e8 |
#ifdef __64BIT__
|
|
kusano |
2b45e8 |
ld C, 120 + STACKSIZE(SP)
|
|
kusano |
2b45e8 |
ld LDC, 128 + STACKSIZE(SP)
|
|
kusano |
2b45e8 |
#else
|
|
kusano |
2b45e8 |
#ifdef DOUBLE
|
|
kusano |
2b45e8 |
lwz C, 68 + STACKSIZE(SP)
|
|
kusano |
2b45e8 |
lwz LDC, 72 + STACKSIZE(SP)
|
|
kusano |
2b45e8 |
#else
|
|
kusano |
2b45e8 |
lwz C, 60 + STACKSIZE(SP)
|
|
kusano |
2b45e8 |
lwz LDC, 64 + STACKSIZE(SP)
|
|
kusano |
2b45e8 |
#endif
|
|
kusano |
2b45e8 |
#endif
|
|
kusano |
2b45e8 |
#endif
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
slwi LDC, LDC, ZBASE_SHIFT
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
lfs f0, 16(SP)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
fmr ALPHA_R, f1
|
|
kusano |
2b45e8 |
fmr ALPHA_I, f2
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
cmpwi cr0, M, 0
|
|
kusano |
2b45e8 |
ble- LL(999)
|
|
kusano |
2b45e8 |
cmpwi cr0, N, 0
|
|
kusano |
2b45e8 |
ble- LL(999)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
mr J, N
|
|
kusano |
2b45e8 |
fcmpu cr7, f1, f0
|
|
kusano |
2b45e8 |
bne cr7, LL(20)
|
|
kusano |
2b45e8 |
fcmpu cr7, f2, f0
|
|
kusano |
2b45e8 |
bne cr7, LL(20)
|
|
kusano |
2b45e8 |
.align 4
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
LL(10):
|
|
kusano |
2b45e8 |
mr CO1, C
|
|
kusano |
2b45e8 |
add C, C, LDC
|
|
kusano |
2b45e8 |
addi PRE, 0, 32 * SIZE
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
srawi. r0, M, 3
|
|
kusano |
2b45e8 |
mtspr CTR, r0
|
|
kusano |
2b45e8 |
ble LL(15)
|
|
kusano |
2b45e8 |
.align 4
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
LL(12):
|
|
kusano |
2b45e8 |
STFD f0, 0 * SIZE(CO1)
|
|
kusano |
2b45e8 |
STFD f0, 1 * SIZE(CO1)
|
|
kusano |
2b45e8 |
STFD f0, 2 * SIZE(CO1)
|
|
kusano |
2b45e8 |
STFD f0, 3 * SIZE(CO1)
|
|
kusano |
2b45e8 |
STFD f0, 4 * SIZE(CO1)
|
|
kusano |
2b45e8 |
STFD f0, 5 * SIZE(CO1)
|
|
kusano |
2b45e8 |
STFD f0, 6 * SIZE(CO1)
|
|
kusano |
2b45e8 |
STFD f0, 7 * SIZE(CO1)
|
|
kusano |
2b45e8 |
STFD f0, 8 * SIZE(CO1)
|
|
kusano |
2b45e8 |
STFD f0, 9 * SIZE(CO1)
|
|
kusano |
2b45e8 |
STFD f0, 10 * SIZE(CO1)
|
|
kusano |
2b45e8 |
STFD f0, 11 * SIZE(CO1)
|
|
kusano |
2b45e8 |
STFD f0, 12 * SIZE(CO1)
|
|
kusano |
2b45e8 |
STFD f0, 13 * SIZE(CO1)
|
|
kusano |
2b45e8 |
STFD f0, 14 * SIZE(CO1)
|
|
kusano |
2b45e8 |
STFD f0, 15 * SIZE(CO1)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
dcbst PRE, CO1
|
|
kusano |
2b45e8 |
addi CO1, CO1, 16 * SIZE
|
|
kusano |
2b45e8 |
bdnz LL(12)
|
|
kusano |
2b45e8 |
.align 4
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
LL(15):
|
|
kusano |
2b45e8 |
andi. r0, M, 7
|
|
kusano |
2b45e8 |
mtspr CTR, r0
|
|
kusano |
2b45e8 |
beq LL(19)
|
|
kusano |
2b45e8 |
.align 4
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
LL(16):
|
|
kusano |
2b45e8 |
STFD f0, 0 * SIZE(CO1)
|
|
kusano |
2b45e8 |
STFD f0, 1 * SIZE(CO1)
|
|
kusano |
2b45e8 |
addi CO1, CO1, 2 * SIZE
|
|
kusano |
2b45e8 |
bdnz LL(16)
|
|
kusano |
2b45e8 |
.align 4
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
LL(19):
|
|
kusano |
2b45e8 |
addic. J, J, -1
|
|
kusano |
2b45e8 |
bgt LL(10)
|
|
kusano |
2b45e8 |
b LL(999)
|
|
kusano |
2b45e8 |
.align 4
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
LL(20):
|
|
kusano |
2b45e8 |
mr CO1, C
|
|
kusano |
2b45e8 |
add C, C, LDC
|
|
kusano |
2b45e8 |
addi PRE, 0, 16 * SIZE
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
srawi. r0, M, 2
|
|
kusano |
2b45e8 |
mtspr CTR, r0
|
|
kusano |
2b45e8 |
ble LL(25)
|
|
kusano |
2b45e8 |
.align 4
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
LL(22):
|
|
kusano |
2b45e8 |
LFD f3, 0 * SIZE(CO1)
|
|
kusano |
2b45e8 |
LFD f4, 1 * SIZE(CO1)
|
|
kusano |
2b45e8 |
LFD f5, 2 * SIZE(CO1)
|
|
kusano |
2b45e8 |
LFD f6, 3 * SIZE(CO1)
|
|
kusano |
2b45e8 |
LFD f7, 4 * SIZE(CO1)
|
|
kusano |
2b45e8 |
LFD f8, 5 * SIZE(CO1)
|
|
kusano |
2b45e8 |
LFD f9, 6 * SIZE(CO1)
|
|
kusano |
2b45e8 |
LFD f10, 7 * SIZE(CO1)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
FMUL f0, ALPHA_I, f4
|
|
kusano |
2b45e8 |
FMUL f4, ALPHA_R, f4
|
|
kusano |
2b45e8 |
FMUL f11, ALPHA_I, f6
|
|
kusano |
2b45e8 |
FMUL f6, ALPHA_R, f6
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
FMUL f12, ALPHA_I, f8
|
|
kusano |
2b45e8 |
FMUL f8, ALPHA_R, f8
|
|
kusano |
2b45e8 |
FMUL f13, ALPHA_I, f10
|
|
kusano |
2b45e8 |
FMUL f10, ALPHA_R, f10
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
FMADD f4, ALPHA_I, f3, f4
|
|
kusano |
2b45e8 |
FMSUB f3, ALPHA_R, f3, f0
|
|
kusano |
2b45e8 |
FMADD f6, ALPHA_I, f5, f6
|
|
kusano |
2b45e8 |
FMSUB f5, ALPHA_R, f5, f11
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
FMADD f8, ALPHA_I, f7, f8
|
|
kusano |
2b45e8 |
FMSUB f7, ALPHA_R, f7, f12
|
|
kusano |
2b45e8 |
FMADD f10, ALPHA_I, f9, f10
|
|
kusano |
2b45e8 |
FMSUB f9, ALPHA_R, f9, f13
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
STFD f3, 0 * SIZE(CO1)
|
|
kusano |
2b45e8 |
STFD f4, 1 * SIZE(CO1)
|
|
kusano |
2b45e8 |
STFD f5, 2 * SIZE(CO1)
|
|
kusano |
2b45e8 |
STFD f6, 3 * SIZE(CO1)
|
|
kusano |
2b45e8 |
STFD f7, 4 * SIZE(CO1)
|
|
kusano |
2b45e8 |
STFD f8, 5 * SIZE(CO1)
|
|
kusano |
2b45e8 |
STFD f9, 6 * SIZE(CO1)
|
|
kusano |
2b45e8 |
STFD f10, 7 * SIZE(CO1)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
addi CO1, CO1, 8 * SIZE
|
|
kusano |
2b45e8 |
dcbtst PRE, CO1
|
|
kusano |
2b45e8 |
bdnz LL(22)
|
|
kusano |
2b45e8 |
.align 4
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
LL(25):
|
|
kusano |
2b45e8 |
andi. r0, M, 3
|
|
kusano |
2b45e8 |
mtspr CTR, r0
|
|
kusano |
2b45e8 |
ble LL(29)
|
|
kusano |
2b45e8 |
.align 4
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
LL(26):
|
|
kusano |
2b45e8 |
LFD f0, 0 * SIZE(CO1)
|
|
kusano |
2b45e8 |
LFD f1, 1 * SIZE(CO1)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
FMUL f5, ALPHA_I, f1
|
|
kusano |
2b45e8 |
FMUL f1, ALPHA_R, f1
|
|
kusano |
2b45e8 |
FMADD f1, ALPHA_I, f0, f1
|
|
kusano |
2b45e8 |
FMSUB f0, ALPHA_R, f0, f5
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
STFD f0, 0 * SIZE(CO1)
|
|
kusano |
2b45e8 |
STFD f1, 1 * SIZE(CO1)
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
addi CO1, CO1, 2 * SIZE
|
|
kusano |
2b45e8 |
bdnz LL(26)
|
|
kusano |
2b45e8 |
.align 4
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
LL(29):
|
|
kusano |
2b45e8 |
addic. J, J, -1
|
|
kusano |
2b45e8 |
bgt LL(20)
|
|
kusano |
2b45e8 |
.align 4
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
LL(999):
|
|
kusano |
2b45e8 |
li r3, 0
|
|
kusano |
2b45e8 |
lfd f30, 0(SP)
|
|
kusano |
2b45e8 |
lfd f31, 8(SP)
|
|
kusano |
2b45e8 |
addi SP, SP, STACKSIZE
|
|
kusano |
2b45e8 |
|
|
kusano |
2b45e8 |
blr
|
|
kusano |
2b45e8 |
EPILOGUE
|