1/*********************************************************************/
2/* Copyright 2009, 2010 The University of Texas at Austin.           */
3/* All rights reserved.                                              */
4/*                                                                   */
5/* Redistribution and use in source and binary forms, with or        */
6/* without modification, are permitted provided that the following   */
7/* conditions are met:                                               */
8/*                                                                   */
9/*   1. Redistributions of source code must retain the above         */
10/*      copyright notice, this list of conditions and the following  */
11/*      disclaimer.                                                  */
12/*                                                                   */
13/*   2. Redistributions in binary form must reproduce the above      */
14/*      copyright notice, this list of conditions and the following  */
15/*      disclaimer in the documentation and/or other materials       */
16/*      provided with the distribution.                              */
17/*                                                                   */
18/*    THIS  SOFTWARE IS PROVIDED  BY THE  UNIVERSITY OF  TEXAS AT    */
19/*    AUSTIN  ``AS IS''  AND ANY  EXPRESS OR  IMPLIED WARRANTIES,    */
20/*    INCLUDING, BUT  NOT LIMITED  TO, THE IMPLIED  WARRANTIES OF    */
21/*    MERCHANTABILITY  AND FITNESS FOR  A PARTICULAR  PURPOSE ARE    */
22/*    DISCLAIMED.  IN  NO EVENT SHALL THE UNIVERSITY  OF TEXAS AT    */
23/*    AUSTIN OR CONTRIBUTORS BE  LIABLE FOR ANY DIRECT, INDIRECT,    */
24/*    INCIDENTAL,  SPECIAL, EXEMPLARY,  OR  CONSEQUENTIAL DAMAGES    */
25/*    (INCLUDING, BUT  NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE    */
26/*    GOODS  OR  SERVICES; LOSS  OF  USE,  DATA,  OR PROFITS;  OR    */
27/*    BUSINESS INTERRUPTION) HOWEVER CAUSED  AND ON ANY THEORY OF    */
28/*    LIABILITY, WHETHER  IN CONTRACT, STRICT  LIABILITY, OR TORT    */
29/*    (INCLUDING NEGLIGENCE OR OTHERWISE)  ARISING IN ANY WAY OUT    */
30/*    OF  THE  USE OF  THIS  SOFTWARE,  EVEN  IF ADVISED  OF  THE    */
31/*    POSSIBILITY OF SUCH DAMAGE.                                    */
32/*                                                                   */
33/* The views and conclusions contained in the software and           */
34/* documentation are those of the authors and should not be          */
35/* interpreted as representing official policies, either expressed   */
36/* or implied, of The University of Texas at Austin.                 */
37/*********************************************************************/
38
39#define ASSEMBLER
40#include "common.h"
41
42#define M	ARG1
43#define X	ARG2
44#define INCX	ARG3
45
46#define I	%rax
47
48#include "l1param.h"
49
50	PROLOGUE
51	PROFCODE
52
53#ifdef WINDOWS_ABI
54	emms
55#endif
56
57	fldz
58	testq	M, M
59	jle	.L999
60	testq	INCX, INCX
61	jle	.L999
62
63	salq	$ZBASE_SHIFT, INCX
64
65	fldz
66	fldz
67	fldz
68	cmpq	$SIZE * 2, INCX
69	jne	.L40
70
71	movq	M, I
72	sarq	$2,   I
73	jle	.L20
74	ALIGN_4
75
76.L10:
77#ifdef PREFETCH
78	PREFETCH (PREFETCHSIZE +  0) - PREOFFSET(X)
79#endif
80
81	FLD	0 * SIZE(X)
82	fabs
83	FLD	1 * SIZE(X)
84	fabs
85	FLD	2 * SIZE(X)
86	fabs
87	FLD	3 * SIZE(X)
88	fabs
89
90	faddp	%st, %st(7)
91	faddp	%st, %st(5)
92	faddp	%st, %st(3)
93	faddp	%st, %st(1)
94
95	FLD	4 * SIZE(X)
96	fabs
97	FLD	5 * SIZE(X)
98	fabs
99	FLD	6 * SIZE(X)
100	fabs
101	FLD	7 * SIZE(X)
102	fabs
103
104	addq	$8 * SIZE, X
105
106	faddp	%st, %st(7)
107	faddp	%st, %st(5)
108	faddp	%st, %st(3)
109	faddp	%st, %st(1)
110
111	decq	I
112	jg	.L10
113	ALIGN_4
114
115.L20:
116	andq	$3,  M
117	jle	.L998
118	ALIGN_4
119
120
121.L21:
122	FLD	0 * SIZE(X)
123	fabs
124	FLD	1 * SIZE(X)
125	fabs
126	faddp	%st,%st(3)
127	faddp	%st,%st(1)
128	addq	$2 * SIZE, X
129	decq	M
130	jg	.L21
131	jmp	.L998
132	ALIGN_4
133
134.L40:
135	movq	M, I
136	sarq	$2,   I
137	jle	.L60
138	ALIGN_4
139
140.L50:
141	FLD	0 * SIZE(X)
142	fabs
143	FLD	1 * SIZE(X)
144	addq	INCX, X
145	fabs
146	FLD	0 * SIZE(X)
147	fabs
148	FLD	1 * SIZE(X)
149	addq	INCX, X
150	fabs
151
152	faddp	%st, %st(7)
153	faddp	%st, %st(5)
154	faddp	%st, %st(3)
155	faddp	%st, %st(1)
156
157	FLD	0 * SIZE(X)
158	fabs
159	FLD	1 * SIZE(X)
160	addq	INCX, X
161	fabs
162	FLD	0 * SIZE(X)
163	fabs
164	FLD	1 * SIZE(X)
165	addq	INCX, X
166	fabs
167
168	faddp	%st, %st(7)
169	faddp	%st, %st(5)
170	faddp	%st, %st(3)
171	faddp	%st, %st(1)
172
173	decq	I
174	jg	.L50
175	ALIGN_4
176
177.L60:
178	andq	$3,  M
179	jle	.L998
180	ALIGN_4
181
182
183.L61:
184	FLD	0 * SIZE(X)
185	fabs
186	FLD	1 * SIZE(X)
187	addq	INCX, X
188	fabs
189	faddp	%st,%st(3)
190	faddp	%st,%st(1)
191	decq	M
192	jg	.L61
193	ALIGN_4
194
195.L998:
196	faddp	%st,%st(2)
197	faddp	%st,%st(1)
198	faddp	%st,%st(1)
199	ALIGN_4
200
201.L999:
202	ret
203
204	EPILOGUE
205