xref: /freebsd/lib/msun/amd64/e_fmod.S (revision 1d386b48a555f61cb7325543adbbb5c3f3407a66)
1*83e449a4SBruce Evans/*
2*83e449a4SBruce Evans * Copyright (c) 1993,94 Winning Strategies, Inc.
3*83e449a4SBruce Evans * All rights reserved.
4*83e449a4SBruce Evans *
5*83e449a4SBruce Evans * Redistribution and use in source and binary forms, with or without
6*83e449a4SBruce Evans * modification, are permitted provided that the following conditions
7*83e449a4SBruce Evans * are met:
8*83e449a4SBruce Evans * 1. Redistributions of source code must retain the above copyright
9*83e449a4SBruce Evans *    notice, this list of conditions and the following disclaimer.
10*83e449a4SBruce Evans * 2. Redistributions in binary form must reproduce the above copyright
11*83e449a4SBruce Evans *    notice, this list of conditions and the following disclaimer in the
12*83e449a4SBruce Evans *    documentation and/or other materials provided with the distribution.
13*83e449a4SBruce Evans * 3. All advertising materials mentioning features or use of this software
14*83e449a4SBruce Evans *    must display the following acknowledgement:
15*83e449a4SBruce Evans *      This product includes software developed by Winning Strategies, Inc.
16*83e449a4SBruce Evans * 4. The name of the author may not be used to endorse or promote products
17*83e449a4SBruce Evans *    derived from this software without specific prior written permission.
18*83e449a4SBruce Evans *
19*83e449a4SBruce Evans * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20*83e449a4SBruce Evans * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21*83e449a4SBruce Evans * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22*83e449a4SBruce Evans * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23*83e449a4SBruce Evans * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24*83e449a4SBruce Evans * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25*83e449a4SBruce Evans * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26*83e449a4SBruce Evans * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27*83e449a4SBruce Evans * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28*83e449a4SBruce Evans * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29*83e449a4SBruce Evans */
30*83e449a4SBruce Evans
31*83e449a4SBruce Evans/*
32*83e449a4SBruce Evans * Based on the i387 version written by:
33*83e449a4SBruce Evans *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
34*83e449a4SBruce Evans */
35*83e449a4SBruce Evans
36*83e449a4SBruce Evans#include <machine/asm.h>
37*83e449a4SBruce EvansENTRY(fmod)
38*83e449a4SBruce Evans	movsd	%xmm0,-8(%rsp)
39*83e449a4SBruce Evans	movsd	%xmm1,-16(%rsp)
40*83e449a4SBruce Evans	fldl	-16(%rsp)
41*83e449a4SBruce Evans	fldl	-8(%rsp)
42*83e449a4SBruce Evans1:	fprem
43*83e449a4SBruce Evans	fstsw	%ax
44*83e449a4SBruce Evans	testw	$0x400,%ax
45*83e449a4SBruce Evans	jne	1b
46*83e449a4SBruce Evans	fstpl	-8(%rsp)
47*83e449a4SBruce Evans	movsd	-8(%rsp),%xmm0
48*83e449a4SBruce Evans	fstp	%st
49*83e449a4SBruce Evans	ret
50*83e449a4SBruce EvansEND(fmod)
51*83e449a4SBruce Evans
52*83e449a4SBruce Evans	.section .note.GNU-stack,"",%progbits
53