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
#include "version.h"
kusano 2b45e8
kusano 2b45e8
	PROLOGUE
kusano 2b45e8
	PROFCODE
kusano 2b45e8
	.frame	$sp, 0, $26, 0
kusano 2b45e8
kusano 2b45e8
	mov	$21, $17
kusano 2b45e8
	ldl	$18,   0($sp)
kusano 2b45e8
	ldq	$19,   8($sp)
kusano 2b45e8
	ldl	$20,  16($sp)
kusano 2b45e8
#ifndef PROFILE
kusano 2b45e8
	.prologue 0
kusano 2b45e8
#else
kusano 2b45e8
	.prologue 1
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
	ble	$16,  $SubEnd		# if n <= 0 goto $End
kusano 2b45e8
kusano 2b45e8
	cmpeq	$18, 1, $1
kusano 2b45e8
	addq	$18, $18, $18
kusano 2b45e8
	cmpeq	$20, 1, $2
kusano 2b45e8
	addq	$20, $20, $20
kusano 2b45e8
kusano 2b45e8
	sra	$16, 2, $21
kusano 2b45e8
	and	$1,  $2, $1
kusano 2b45e8
	and	$16, 3, $22
kusano 2b45e8
	beq	$1,  $Sub
kusano 2b45e8
kusano 2b45e8
	ble	$21, $MainRemain
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
$MainLoop:
kusano 2b45e8
	LD	$f10,   0*SIZE($19)
kusano 2b45e8
	LD	$f11,   1*SIZE($19)
kusano 2b45e8
	LD	$f12,   2*SIZE($19)
kusano 2b45e8
	LD	$f13,   3*SIZE($19)
kusano 2b45e8
	LD	$f14,   4*SIZE($19)
kusano 2b45e8
	LD	$f15,   5*SIZE($19)
kusano 2b45e8
	LD	$f16,   6*SIZE($19)
kusano 2b45e8
	LD	$f17,   7*SIZE($19)
kusano 2b45e8
kusano 2b45e8
	LD	$f20,   0*SIZE($17)
kusano 2b45e8
	LD	$f21,   1*SIZE($17)
kusano 2b45e8
	LD	$f22,   2*SIZE($17)
kusano 2b45e8
	LD	$f23,   3*SIZE($17)
kusano 2b45e8
	LD	$f24,   4*SIZE($17)
kusano 2b45e8
	LD	$f25,   5*SIZE($17)
kusano 2b45e8
	LD	$f26,   6*SIZE($17)
kusano 2b45e8
	LD	$f27,   7*SIZE($17)
kusano 2b45e8
kusano 2b45e8
	lds	$f31,  16*SIZE($17)
kusano 2b45e8
	unop
kusano 2b45e8
	lds	$f31,  16*SIZE($19)
kusano 2b45e8
	subl	$21, 1, $21
kusano 2b45e8
kusano 2b45e8
	ST	$f10,   0*SIZE($17)
kusano 2b45e8
	ST	$f11,   1*SIZE($17)
kusano 2b45e8
	ST	$f12,   2*SIZE($17)
kusano 2b45e8
	ST	$f13,   3*SIZE($17)
kusano 2b45e8
	ST	$f14,   4*SIZE($17)
kusano 2b45e8
	ST	$f15,   5*SIZE($17)
kusano 2b45e8
	ST	$f16,   6*SIZE($17)
kusano 2b45e8
	ST	$f17,   7*SIZE($17)
kusano 2b45e8
kusano 2b45e8
	ST	$f20,   0*SIZE($19)
kusano 2b45e8
	ST	$f21,   1*SIZE($19)
kusano 2b45e8
	ST	$f22,   2*SIZE($19)
kusano 2b45e8
	ST	$f23,   3*SIZE($19)
kusano 2b45e8
	ST	$f24,   4*SIZE($19)
kusano 2b45e8
	ST	$f25,   5*SIZE($19)
kusano 2b45e8
	ST	$f26,   6*SIZE($19)
kusano 2b45e8
	ST	$f27,   7*SIZE($19)
kusano 2b45e8
kusano 2b45e8
	lda	$17,   8*SIZE($17)
kusano 2b45e8
	lda	$19,   8*SIZE($19)
kusano 2b45e8
	bgt	$21, $MainLoop
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
$MainRemain:
kusano 2b45e8
	ble	$22, $MainEnd
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
$MainRemainLoop:
kusano 2b45e8
	LD	$f10,   0*SIZE($19)
kusano 2b45e8
	LD	$f11,   1*SIZE($19)
kusano 2b45e8
	LD	$f20,   0*SIZE($17)
kusano 2b45e8
	LD	$f21,   1*SIZE($17)
kusano 2b45e8
kusano 2b45e8
	lda	$17,    2*SIZE($17)
kusano 2b45e8
	lda	$19,    2*SIZE($19)
kusano 2b45e8
	subl	$22, 1, $22
kusano 2b45e8
	ST	$f10,  -2*SIZE($17)
kusano 2b45e8
	ST	$f11,  -1*SIZE($17)
kusano 2b45e8
	ST	$f20,  -2*SIZE($19)
kusano 2b45e8
	ST	$f21,  -1*SIZE($19)
kusano 2b45e8
	bgt	$22, $MainRemainLoop
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
$MainEnd:
kusano 2b45e8
	clr	$0
kusano 2b45e8
	ret
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
$Sub:
kusano 2b45e8
	mov	$17, $23
kusano 2b45e8
	mov	$19, $24
kusano 2b45e8
	ble	$21, $SubRemain
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
$SubLoop:
kusano 2b45e8
	LD	$f10,   0*SIZE($19)
kusano 2b45e8
	LD	$f11,   1*SIZE($19)
kusano 2b45e8
	SXADDQ	$20, $19, $19
kusano 2b45e8
kusano 2b45e8
	LD	$f12,   0*SIZE($19)
kusano 2b45e8
	LD	$f13,   1*SIZE($19)
kusano 2b45e8
	SXADDQ	$20, $19, $19
kusano 2b45e8
kusano 2b45e8
	LD	$f14,   0*SIZE($19)
kusano 2b45e8
	LD	$f15,   1*SIZE($19)
kusano 2b45e8
	SXADDQ	$20, $19, $19
kusano 2b45e8
kusano 2b45e8
	LD	$f16,   0*SIZE($19)
kusano 2b45e8
	LD	$f17,   1*SIZE($19)
kusano 2b45e8
	SXADDQ	$20, $19, $19
kusano 2b45e8
kusano 2b45e8
	LD	$f20,   0*SIZE($17)
kusano 2b45e8
	LD	$f21,   1*SIZE($17)
kusano 2b45e8
	SXADDQ	$18, $17, $17
kusano 2b45e8
kusano 2b45e8
	LD	$f22,   0*SIZE($17)
kusano 2b45e8
	LD	$f23,   1*SIZE($17)
kusano 2b45e8
	SXADDQ	$18, $17, $17
kusano 2b45e8
kusano 2b45e8
	LD	$f24,   0*SIZE($17)
kusano 2b45e8
	LD	$f25,   1*SIZE($17)
kusano 2b45e8
	SXADDQ	$18, $17, $17
kusano 2b45e8
kusano 2b45e8
	LD	$f26,   0*SIZE($17)
kusano 2b45e8
	LD	$f27,   1*SIZE($17)
kusano 2b45e8
	SXADDQ	$18, $17, $17
kusano 2b45e8
kusano 2b45e8
	ST	$f10,   0*SIZE($23)
kusano 2b45e8
	ST	$f11,   1*SIZE($23)
kusano 2b45e8
	SXADDQ	$18, $23, $23
kusano 2b45e8
kusano 2b45e8
	ST	$f12,   0*SIZE($23)
kusano 2b45e8
	ST	$f13,   1*SIZE($23)
kusano 2b45e8
	SXADDQ	$18, $23, $23
kusano 2b45e8
kusano 2b45e8
	ST	$f14,   0*SIZE($23)
kusano 2b45e8
	ST	$f15,   1*SIZE($23)
kusano 2b45e8
	SXADDQ	$18, $23, $23
kusano 2b45e8
kusano 2b45e8
	ST	$f16,   0*SIZE($23)
kusano 2b45e8
	ST	$f17,   1*SIZE($23)
kusano 2b45e8
	SXADDQ	$18, $23, $23
kusano 2b45e8
kusano 2b45e8
	ST	$f20,   0*SIZE($24)
kusano 2b45e8
	ST	$f21,   1*SIZE($24)
kusano 2b45e8
	SXADDQ	$20, $24, $24
kusano 2b45e8
kusano 2b45e8
	ST	$f22,   0*SIZE($24)
kusano 2b45e8
	ST	$f23,   1*SIZE($24)
kusano 2b45e8
	SXADDQ	$20, $24, $24
kusano 2b45e8
kusano 2b45e8
	ST	$f24,   0*SIZE($24)
kusano 2b45e8
	ST	$f25,   1*SIZE($24)
kusano 2b45e8
	SXADDQ	$20, $24, $24
kusano 2b45e8
kusano 2b45e8
	ST	$f26,   0*SIZE($24)
kusano 2b45e8
	ST	$f27,   1*SIZE($24)
kusano 2b45e8
	SXADDQ	$20, $24, $24
kusano 2b45e8
kusano 2b45e8
	subl	$21, 1, $21
kusano 2b45e8
	bgt	$21, $SubLoop
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
$SubRemain:
kusano 2b45e8
	ble	$22, $SubEnd
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
$SubRemainLoop:
kusano 2b45e8
	LD	$f10,   0*SIZE($19)
kusano 2b45e8
	LD	$f11,   1*SIZE($19)
kusano 2b45e8
	LD	$f20,   0*SIZE($17)
kusano 2b45e8
	LD	$f21,   1*SIZE($17)
kusano 2b45e8
kusano 2b45e8
	subl	$22, 1, $22
kusano 2b45e8
kusano 2b45e8
	ST	$f10,   0*SIZE($17)
kusano 2b45e8
	ST	$f11,   1*SIZE($17)
kusano 2b45e8
	ST	$f20,   0*SIZE($19)
kusano 2b45e8
	ST	$f21,   1*SIZE($19)
kusano 2b45e8
kusano 2b45e8
	SXADDQ	$18, $17, $17
kusano 2b45e8
	SXADDQ	$20, $19, $19
kusano 2b45e8
	bgt	$22, $SubRemainLoop
kusano 2b45e8
	.align 4
kusano 2b45e8
kusano 2b45e8
$SubEnd:
kusano 2b45e8
	clr	$0
kusano 2b45e8
	ret
kusano 2b45e8
	EPILOGUE