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
#ifdef XDOUBLE
kusano 2b45e8
#define PREFETCH_SIZE ( 8 * 16 +  4)
kusano 2b45e8
#elif defined(DOUBLE)
kusano 2b45e8
#define PREFETCH_SIZE (16 * 16 +  8)
kusano 2b45e8
#else
kusano 2b45e8
#define PREFETCH_SIZE (32 * 16 + 16)
kusano 2b45e8
#endif
kusano 2b45e8
kusano 2b45e8
#ifndef COMPLEX
kusano 2b45e8
#define COMPADD	0
kusano 2b45e8
#define STRIDE INCX
kusano 2b45e8
#else
kusano 2b45e8
#define COMPADD	1
kusano 2b45e8
#define STRIDE SIZE
kusano 2b45e8
#endif
kusano 2b45e8
	
kusano 2b45e8
#define PRE1	r2
kusano 2b45e8
kusano 2b45e8
#define I	r17
kusano 2b45e8
#define J	r18
kusano 2b45e8
#define INCX16	r21
kusano 2b45e8
kusano 2b45e8
#define PR	r30
kusano 2b45e8
#define ARLC	r31
kusano 2b45e8
kusano 2b45e8
#define N	r32
kusano 2b45e8
#define X	r33
kusano 2b45e8
#define INCX	r34
kusano 2b45e8
kusano 2b45e8
kusano 2b45e8
	PROLOGUE
kusano 2b45e8
	.prologue
kusano 2b45e8
	PROFCODE
kusano 2b45e8
	{ .mfi
kusano 2b45e8
	adds	PRE1 = PREFETCH_SIZE * SIZE, X
kusano 2b45e8
	mov	f8   = f0
kusano 2b45e8
	.save ar.lc, ARLC
kusano 2b45e8
	mov	ARLC = ar.lc
kusano 2b45e8
	}
kusano 2b45e8
	;;
kusano 2b45e8
	.body
kusano 2b45e8
#ifdef F_INTERFACE
kusano 2b45e8
	{ .mmi
kusano 2b45e8
	LDINT	N    = [N]
kusano 2b45e8
	LDINT	INCX = [INCX]
kusano 2b45e8
	nop.i	0
kusano 2b45e8
	}
kusano 2b45e8
	;;
kusano 2b45e8
#ifndef USE64BITINT
kusano 2b45e8
	{ .mii
kusano 2b45e8
	nop.m	0
kusano 2b45e8
	sxt4	N = N
kusano 2b45e8
	sxt4	INCX = INCX
kusano 2b45e8
	}
kusano 2b45e8
	;;
kusano 2b45e8
#endif
kusano 2b45e8
#endif
kusano 2b45e8
	{ .mmi
kusano 2b45e8
	cmp.lt	p0, p6 = r0, INCX
kusano 2b45e8
	cmp.lt	p0, p7 = r0, N
kusano 2b45e8
	shr	I =  N, (4 - COMPADD)
kusano 2b45e8
	}
kusano 2b45e8
	{ .mbb
kusano 2b45e8
	and	J = ((1 << (4 - COMPADD)) - 1), N
kusano 2b45e8
	(p6) 	br.ret.sptk.many b0
kusano 2b45e8
	(p7) 	br.ret.sptk.many b0
kusano 2b45e8
	}
kusano 2b45e8
	;;
kusano 2b45e8
	{ .mfi
kusano 2b45e8
	adds	I = -1, I
kusano 2b45e8
	mov	f10 = f0
kusano 2b45e8
	mov	PR = pr
kusano 2b45e8
	}
kusano 2b45e8
	{ .mfi
kusano 2b45e8
	cmp.eq	p9, p0  =   r0, J
kusano 2b45e8
	mov	f9  = f0
kusano 2b45e8
	tbit.z	p0, p12 = N, 3 - COMPADD
kusano 2b45e8
	}
kusano 2b45e8
	;;
kusano 2b45e8
	{ .mmi
kusano 2b45e8
	cmp.eq	p16, p0 = r0, r0
kusano 2b45e8
	cmp.ne	p17, p0 = r0, r0
kusano 2b45e8
	mov	ar.ec= 3
kusano 2b45e8
	}
kusano 2b45e8
	{ .mfi
kusano 2b45e8
	cmp.ne	p18, p0 = r0, r0
kusano 2b45e8
	mov	f11 = f0
kusano 2b45e8
	shl	INCX = INCX, BASE_SHIFT + COMPADD
kusano 2b45e8
	}
kusano 2b45e8
	;;	
kusano 2b45e8
	{ .mmi
kusano 2b45e8
#ifdef XDOUBLE
kusano 2b45e8
	shladd	INCX16  = INCX, (3 - COMPADD), r0
kusano 2b45e8
#else
kusano 2b45e8
	shladd	INCX16  = INCX, (4 - COMPADD), r0
kusano 2b45e8
#endif
kusano 2b45e8
	cmp.ne	p19, p0 = r0, r0
kusano 2b45e8
	mov	ar.lc = I
kusano 2b45e8
	}
kusano 2b45e8
	{ .mmb
kusano 2b45e8
	cmp.gt	p8 ,p0  =   r0, I
kusano 2b45e8
#ifdef COMPLEX
kusano 2b45e8
       adds	INCX = - SIZE, INCX
kusano 2b45e8
#else
kusano 2b45e8
	nop.m	0
kusano 2b45e8
#endif
kusano 2b45e8
	(p8) br.cond.dpnt  .L55
kusano 2b45e8
	}
kusano 2b45e8
	;;
kusano 2b45e8
	.align 32
kusano 2b45e8
kusano 2b45e8
.L52:
kusano 2b45e8
	{ .mmf
kusano 2b45e8
	(p16) lfetch.nt1 [PRE1], INCX16
kusano 2b45e8
	(p16) LDFD	f32  = [X], STRIDE
kusano 2b45e8
	(p18) fabs	f34  = f34
kusano 2b45e8
	}
kusano 2b45e8
	{ .mfb
kusano 2b45e8
	(p19) FADD	f8  = f8,  f71
kusano 2b45e8
	}
kusano 2b45e8
	;;
kusano 2b45e8
	{ .mmf
kusano 2b45e8
	(p16) LDFD	f35  = [X], INCX
kusano 2b45e8
	(p18) fabs	f37  = f37
kusano 2b45e8
	}
kusano 2b45e8
	{ .mfb
kusano 2b45e8
	(p19) FADD	f9  = f9,  f74
kusano 2b45e8
	}
kusano 2b45e8
	;;
kusano 2b45e8
	{ .mmf
kusano 2b45e8
	(p16) LDFD	f38  = [X], STRIDE
kusano 2b45e8
	(p18) fabs	f40  = f40
kusano 2b45e8
	}
kusano 2b45e8
	{ .mfb
kusano 2b45e8
	(p19) FADD	f10 = f10, f77
kusano 2b45e8
	}
kusano 2b45e8
	;;
kusano 2b45e8
	{ .mmf
kusano 2b45e8
	(p16) LDFD	f41  = [X], INCX
kusano 2b45e8
	(p18) fabs	f43  = f43
kusano 2b45e8
	}
kusano 2b45e8
	{ .mfb
kusano 2b45e8
	(p19) FADD	f11 = f11, f80
kusano 2b45e8
	}
kusano 2b45e8
	;;
kusano 2b45e8
	{ .mmf
kusano 2b45e8
	(p16) LDFD	f44  = [X], STRIDE
kusano 2b45e8
	(p18) fabs	f46  = f46
kusano 2b45e8
	}
kusano 2b45e8
	{ .mfb
kusano 2b45e8
	(p18) FADD	f8  = f8,  f34
kusano 2b45e8
	}
kusano 2b45e8
	;;
kusano 2b45e8
	{ .mmf
kusano 2b45e8
	(p16) LDFD	f47  = [X], INCX
kusano 2b45e8
	(p18) fabs	f49  = f49
kusano 2b45e8
	}
kusano 2b45e8
	{ .mfb
kusano 2b45e8
	(p18) FADD	f9  = f9,  f37
kusano 2b45e8
	}
kusano 2b45e8
	;;
kusano 2b45e8
	{ .mmf
kusano 2b45e8
	(p16) LDFD	f50  = [X], STRIDE
kusano 2b45e8
	(p18) fabs	f52  = f52
kusano 2b45e8
	}
kusano 2b45e8
	{ .mfb
kusano 2b45e8
	(p18) FADD	f10 = f10, f40
kusano 2b45e8
	}
kusano 2b45e8
	;;
kusano 2b45e8
	{ .mmf
kusano 2b45e8
	(p16) LDFD	f53  = [X], INCX
kusano 2b45e8
	(p18) fabs	f55  = f55
kusano 2b45e8
	}
kusano 2b45e8
	{ .mfb
kusano 2b45e8
	(p18) FADD	f11 = f11, f43
kusano 2b45e8
	}
kusano 2b45e8
	;;
kusano 2b45e8
	{ .mmf
kusano 2b45e8
#ifdef XDOUBLE
kusano 2b45e8
	(p16) lfetch.nt1 [PRE1], INCX16
kusano 2b45e8
#endif
kusano 2b45e8
	(p16) LDFD	f56  = [X], STRIDE
kusano 2b45e8
	(p18) fabs	f58  = f58
kusano 2b45e8
	}
kusano 2b45e8
	{ .mfb
kusano 2b45e8
	(p18) FADD	f8  = f8,  f46
kusano 2b45e8
	}
kusano 2b45e8
	;;
kusano 2b45e8
	{ .mmf
kusano 2b45e8
	(p16) LDFD	f59  = [X], INCX
kusano 2b45e8
	(p18) fabs	f61  = f61
kusano 2b45e8
	}
kusano 2b45e8
	{ .mfb
kusano 2b45e8
	(p18) FADD	f9  = f9,  f49
kusano 2b45e8
	}
kusano 2b45e8
	;;
kusano 2b45e8
	{ .mmf
kusano 2b45e8
	(p16) LDFD	f62  = [X], STRIDE
kusano 2b45e8
	(p18) fabs	f64  = f64
kusano 2b45e8
	}
kusano 2b45e8
	{ .mfb
kusano 2b45e8
	(p18) FADD	f10 = f10, f52
kusano 2b45e8
	}
kusano 2b45e8
	;;
kusano 2b45e8
	{ .mmf
kusano 2b45e8
	(p16) LDFD	f65  = [X], INCX
kusano 2b45e8
	(p18) fabs	f67  = f67
kusano 2b45e8
	}
kusano 2b45e8
	{ .mfb
kusano 2b45e8
	(p18) FADD	f11 = f11, f55
kusano 2b45e8
	}
kusano 2b45e8
	;;
kusano 2b45e8
	{ .mmf
kusano 2b45e8
	(p16) LDFD	f68  = [X], STRIDE
kusano 2b45e8
	(p18) fabs	f70  = f70
kusano 2b45e8
	}
kusano 2b45e8
	{ .mfb
kusano 2b45e8
	(p18) FADD	f8  = f8,  f58
kusano 2b45e8
	}
kusano 2b45e8
	;;
kusano 2b45e8
	{ .mmf
kusano 2b45e8
	(p16) LDFD	f71  = [X], INCX	
kusano 2b45e8
	(p18) fabs	f73  = f73
kusano 2b45e8
	}
kusano 2b45e8
	{ .mfb
kusano 2b45e8
	(p18) FADD	f9  = f9,  f61
kusano 2b45e8
	}
kusano 2b45e8
	;;
kusano 2b45e8
	{ .mmf
kusano 2b45e8
	(p16) LDFD	f74  = [X], STRIDE
kusano 2b45e8
	(p18) fabs	f76  = f76
kusano 2b45e8
	}
kusano 2b45e8
	{ .mfb
kusano 2b45e8
	(p18) FADD	f10 = f10, f64
kusano 2b45e8
	}
kusano 2b45e8
	;;
kusano 2b45e8
	{ .mmf
kusano 2b45e8
	(p16) LDFD	f77  = [X], INCX
kusano 2b45e8
	(p18) fabs	f79  = f79
kusano 2b45e8
	}
kusano 2b45e8
	{ .mfb
kusano 2b45e8
	(p18) FADD	f11 = f11, f67
kusano 2b45e8
	br.ctop.sptk.few .L52
kusano 2b45e8
	}
kusano 2b45e8
	;;
kusano 2b45e8
	FADD	f8  = f8,  f71
kusano 2b45e8
	FADD	f9  = f9,  f74
kusano 2b45e8
	FADD	f10 = f10, f77
kusano 2b45e8
	FADD	f11 = f11, f80
kusano 2b45e8
	.align 32
kusano 2b45e8
	;;
kusano 2b45e8
.L55:
kusano 2b45e8
	(p12) LDFD	f32  = [X], STRIDE
kusano 2b45e8
	(p9) br.cond.dptk .L998
kusano 2b45e8
	;;
kusano 2b45e8
	(p12) LDFD	f33  = [X], INCX
kusano 2b45e8
	;;
kusano 2b45e8
	(p12) LDFD	f34  = [X], STRIDE
kusano 2b45e8
	;;
kusano 2b45e8
	(p12) LDFD	f35  = [X], INCX
kusano 2b45e8
	tbit.z	p0, p13 = N, (2 - COMPADD)
kusano 2b45e8
	;;
kusano 2b45e8
	(p12) LDFD	f36  = [X], STRIDE
kusano 2b45e8
	tbit.z	p0, p14 = N, (1 - COMPADD)
kusano 2b45e8
	;;
kusano 2b45e8
	(p12) LDFD	f37  = [X], INCX
kusano 2b45e8
#ifndef COMPLEX
kusano 2b45e8
	tbit.z	p0, p15 = N, 0
kusano 2b45e8
#endif
kusano 2b45e8
	;;
kusano 2b45e8
	(p12) LDFD	f38  = [X], STRIDE
kusano 2b45e8
	(p12) fabs	f32  = f32
kusano 2b45e8
	;;
kusano 2b45e8
	(p12) LDFD	f39  = [X], INCX
kusano 2b45e8
	(p12) fabs	f33  = f33
kusano 2b45e8
	;;
kusano 2b45e8
	(p13) LDFD	f40  = [X], STRIDE
kusano 2b45e8
	(p12) fabs	f34  = f34
kusano 2b45e8
	;;
kusano 2b45e8
	(p13) LDFD	f41  = [X], INCX
kusano 2b45e8
	(p12) fabs	f35  = f35
kusano 2b45e8
	;;
kusano 2b45e8
	(p13) LDFD	f42  = [X], STRIDE
kusano 2b45e8
	(p12) fabs	f36  = f36
kusano 2b45e8
	(p12) FADD	f8  = f8,  f32
kusano 2b45e8
	;;
kusano 2b45e8
	(p13) LDFD	f43  = [X], INCX
kusano 2b45e8
	(p12) fabs	f37  = f37
kusano 2b45e8
	(p12) FADD	f9  = f9,  f33
kusano 2b45e8
	;;
kusano 2b45e8
	(p14) LDFD	f44  = [X], STRIDE
kusano 2b45e8
	(p12) fabs	f38  = f38
kusano 2b45e8
	(p12) FADD	f10 = f10, f34
kusano 2b45e8
	;;
kusano 2b45e8
	(p14) LDFD	f45  = [X], INCX
kusano 2b45e8
	(p12) fabs	f39  = f39
kusano 2b45e8
	(p12) FADD	f11 = f11, f35
kusano 2b45e8
	;;
kusano 2b45e8
#ifndef COMPLEX
kusano 2b45e8
	(p15) LDFD	f46  = [X]
kusano 2b45e8
#endif
kusano 2b45e8
	(p13) fabs	f40 = f40
kusano 2b45e8
	(p12) FADD	f8  = f8,  f36
kusano 2b45e8
	;;
kusano 2b45e8
	(p13) fabs	f41 = f41
kusano 2b45e8
	(p12) FADD	f9  = f9,  f37
kusano 2b45e8
	(p13) fabs	f42 = f42
kusano 2b45e8
	(p12) FADD	f10 = f10, f38
kusano 2b45e8
	(p13) fabs	f43 = f43
kusano 2b45e8
	(p12) FADD	f11 = f11, f39
kusano 2b45e8
	;;
kusano 2b45e8
	(p14) fabs	f44 = f44
kusano 2b45e8
	(p13) FADD	f8  = f8,  f40
kusano 2b45e8
	(p14) fabs	f45 = f45
kusano 2b45e8
	(p13) FADD	f9  = f9,  f41
kusano 2b45e8
#ifndef COMPLEX
kusano 2b45e8
	(p15) fabs	f46 = f46
kusano 2b45e8
#endif
kusano 2b45e8
	(p13) FADD	f10 = f10, f42
kusano 2b45e8
	;;
kusano 2b45e8
	(p13) FADD	f11 = f11, f43
kusano 2b45e8
	(p14) FADD	f8  = f8,  f44
kusano 2b45e8
	(p14) FADD	f9  = f9,  f45
kusano 2b45e8
#ifndef COMPLEX
kusano 2b45e8
	(p15) FADD	f10 = f10, f46
kusano 2b45e8
#endif
kusano 2b45e8
	;;		      
kusano 2b45e8
	.align 32
kusano 2b45e8
kusano 2b45e8
.L998:
kusano 2b45e8
	{ .mfi
kusano 2b45e8
	FADD	f8  = f8,  f9
kusano 2b45e8
	mov	ar.lc  = ARLC
kusano 2b45e8
	}
kusano 2b45e8
	{ .mmf
kusano 2b45e8
	FADD	f10 = f10, f11
kusano 2b45e8
	}
kusano 2b45e8
	;;
kusano 2b45e8
	{ .mii
kusano 2b45e8
	mov	pr = PR, -65474
kusano 2b45e8
	}
kusano 2b45e8
	;;
kusano 2b45e8
	{ .mfb
kusano 2b45e8
	FADD	f8  = f8,  f10
kusano 2b45e8
	br.ret.sptk.many b0
kusano 2b45e8
	}
kusano 2b45e8
	EPILOGUE