xref: /original-bsd/lib/libc/tahoe/fpe/negf.s (revision 05dfbb6f)
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 "@(#)negf.s	1.2 (Berkeley) 02/17/89"
23#endif /* SYSLIBC_SCCS and not lint */
24
25#include <tahoemath/fp.h>
26#include "DEFS.h"
27
28XENTRY(negf, 0)
29	clrl	r1
30	andl3	$EXPMASK,4(fp),r0	/* check for reserved operand,zero. */
31	beql	isreserved
32	movl	4(fp),r0		/* fetch operand. */
33	bbc	$31,r0,seton
34	andl2	$(0!SIGNBIT),r0		/* turn it off. */
35	ret
36seton:	orl2	$SIGNBIT,r0		/* turn it on. */
37	ret
38isreserved:
39	bbc	$31,4(fp),retzero
40	callf	$4,sfpresop
41	ret
42retzero:
43	clrl	r0
44	ret
45