xref: /original-bsd/lib/libc/tahoe/fpe/cmpf.s (revision b218b2ee)
1/*
2 * Copyright (c) 1986 Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Computer Consoles Inc.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the University of California, Berkeley.  The name of the
14 * University may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 */
20
21#if defined(SYSLIBC_SCCS) && !defined(lint)
22	.asciz "@(#)cmpf.s	1.2 (Berkeley) 02/17/89"
23#endif /* SYSLIBC_SCCS and not lint */
24
25/*
26 * cmpf(f1, f2)
27 *	float f1, f2;
28 * return -1, 0, 1 as f1 <, ==, > f2
29 */
30#include "DEFS.h"
31
32XENTRY(cmpf, 0)
33	cmpl	4(fp),12(fp)
34	jneq	1f
35	clrl	r0
36	ret
371:
38	movl	4(fp),r0
39	jgeq	1f
40	xorl2	$0x80000000,r0
41	mnegl	r0,r0
421:
43	movl	12(fp),r1
44	jgeq	1f
45	xorl2	$0x80000000,r1
46	mnegl	r1,r1
471:
48	cmpl	r0,r1
49	jleq	1f
50	movl	$1,r0
51	ret
521:
53	mnegl	$1,r0
54	ret
55