xref: /netbsd-src/lib/libc/arch/m68k/hardfloat/cmpdf2.S (revision 6cb10275d08f045e872662c371fe2f2724f2f6e6)
1*6cb10275Sriastradh/*	$NetBSD: cmpdf2.S,v 1.3 2014/03/18 18:20:37 riastradh Exp $	*/
2d35c3886Smatt
3d35c3886Smatt/*-
4d35c3886Smatt * Copyright (c) 1990 The Regents of the University of California.
5d35c3886Smatt * All rights reserved.
6d35c3886Smatt *
7d35c3886Smatt * This code is derived from software contributed to Berkeley by
8d35c3886Smatt * the Systems Programming Group of the University of Utah Computer
9d35c3886Smatt * Science Department.
10d35c3886Smatt *
11d35c3886Smatt * Redistribution and use in source and binary forms, with or without
12d35c3886Smatt * modification, are permitted provided that the following conditions
13d35c3886Smatt * are met:
14d35c3886Smatt * 1. Redistributions of source code must retain the above copyright
15d35c3886Smatt *    notice, this list of conditions and the following disclaimer.
16d35c3886Smatt * 2. Redistributions in binary form must reproduce the above copyright
17d35c3886Smatt *    notice, this list of conditions and the following disclaimer in the
18d35c3886Smatt *    documentation and/or other materials provided with the distribution.
19d35c3886Smatt * 3. Neither the name of the University nor the names of its contributors
20d35c3886Smatt *    may be used to endorse or promote products derived from this software
21d35c3886Smatt *    without specific prior written permission.
22d35c3886Smatt *
23d35c3886Smatt * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24d35c3886Smatt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25d35c3886Smatt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26d35c3886Smatt * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27d35c3886Smatt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28d35c3886Smatt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29d35c3886Smatt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30d35c3886Smatt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31d35c3886Smatt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32d35c3886Smatt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33d35c3886Smatt * SUCH DAMAGE.
34d35c3886Smatt */
35d35c3886Smatt
36d35c3886Smatt#include <machine/asm.h>
37d35c3886Smatt
38d35c3886Smatt#if defined(LIBC_SCCS) && !defined(lint)
39d35c3886Smatt#if 0
40d35c3886Smatt	RCSID("from: @(#)cmpdf2.s	5.1 (Berkeley) 6/7/90")
41d35c3886Smatt#else
42*6cb10275Sriastradh	RCSID("$NetBSD: cmpdf2.S,v 1.3 2014/03/18 18:20:37 riastradh Exp $")
43d35c3886Smatt#endif
44d35c3886Smatt#endif /* LIBC_SCCS and not lint */
45d35c3886Smatt
46d35c3886Smatt/* double > double: 1 */
47d35c3886Smatt/* double < double: -1 */
48d35c3886Smatt/* double == double: 0 */
49d35c3886SmattENTRY(__cmpdf2)
50d35c3886Smatt	fmoved	4(%sp),%fp0
51d35c3886Smatt	fcmpd	12(%sp),%fp0
526125de07Smatt	fbgt	Lbgt
536125de07Smatt#ifdef __mcoldfire__
546125de07Smatt	fbeq	Lbeq
556125de07Smatt	movql	#-1,%d0
566125de07Smatt#else
57d35c3886Smatt	fslt	%d0
58d35c3886Smatt	extbl	%d0
596125de07Smatt#endif
60d35c3886Smatt	rts
616125de07SmattLbgt:
62d35c3886Smatt	moveq	#1,%d0
63d35c3886Smatt	rts
646125de07Smatt#ifdef __mcoldfire__
656125de07SmattLbeq:
666125de07Smatt	clrl	%d0
676125de07Smatt	rts
686125de07Smatt#endif
69d35c3886SmattEND(__cmpdf2)
70