xref: /openbsd/sys/arch/hppa/spmath/quad_float.h (revision 3d8817e4)
1 /*	$OpenBSD: quad_float.h,v 1.8 2003/04/10 17:27:58 mickey Exp $	*/
2 /*
3   (c) Copyright 1986 HEWLETT-PACKARD COMPANY
4   To anyone who acknowledges that this file is provided "AS IS"
5   without any express or implied warranty:
6       permission to use, copy, modify, and distribute this file
7   for any purpose is hereby granted without fee, provided that
8   the above copyright notice and this notice appears in all
9   copies, and that the name of Hewlett-Packard Company not be
10   used in advertising or publicity pertaining to distribution
11   of the software without specific, written prior permission.
12   Hewlett-Packard Company makes no representations about the
13   suitability of this software for any purpose.
14 */
15 /* @(#)quad_float.h: Revision: 1.7.88.1 Date: 93/12/07 15:06:55 */
16 
17 /******************************
18  *  Quad precision functions  *
19  ******************************/
20 
21 /* 32-bit word grabing functions */
22 #define Quad_firstword(value) Qallp1(value)
23 #define Quad_secondword(value) Qallp2(value)
24 #define Quad_thirdword(value)  Qallp3(value)
25 #define Quad_fourthword(value)  Qallp4(value)
26 
27 
28 /* This magnitude comparison uses the signless first words and
29  * the regular part2 words.  The comparison is graphically:
30  *
31  *       1st greater?  ----------->|
32  *                                 |
33  *       1st less?-----------------+------->|
34  *                                 |        |
35  *       2nd greater?------------->|        |
36  *                                 |        |
37  *       2nd less?-----------------+------->|
38  *                                 |        |
39  *       3rd greater?------------->|        |
40  *                                 |        |
41  *       3rd less?-----------------+------->|
42  *                                 |        |
43  *       4th greater or equal?---->|        |
44  *                                 |        |
45  *                               False     True
46  */
47 #define Quad_ismagnitudeless(leftp3,leftp4,rightp1,rightp2,rightp3,rightp4,signlessleft,signlessright) \
48 /*  Quad_floating_point left, right;          *				\
49  *  unsigned int signlessleft, signlessright; */			\
50       ( signlessleft<=signlessright &&					\
51        (signlessleft<signlessright || (Qallp2(leftp2)<=Qallp2(rightp2) && \
52 	(Qallp2(leftp2)<Qallp2(rightp2) || (Qallp3(leftp3)<=Qallp3(rightp3) && \
53 	 (Qallp3(leftp3)<Qallp3(rightp3) || Qallp4(leftp4)<Qallp4(rightp4)))))))
54 
55 #define Quad_xor_to_intp1(leftp1,rightp1,result)		\
56     /* quad_floating_point left, right;				\
57      * unsigned int result; */					\
58     result = Qallp1(leftp1) XOR Qallp1(rightp1);
59 
60 #define Quad_xor_from_intp1(leftp1,rightp1,result)		\
61     /* quad_floating_point right, result;			\
62      * unsigned int left; */					\
63     Qallp1(resultp1) = left XOR Qallp1(rightp1)
64 
65 #define Quad_swap_lower(leftp1,leftp2,leftp3,leftp4,rightp1,rightp2,rightp3,rightp4)  \
66     /* quad_floating_point left, right; */			\
67     Qallp2(leftp2)  = Qallp2(leftp2) XOR Qallp2(rightp2)	\
68     Qallp2(rightp2) = Qallp2(leftp2) XOR Qallp2(rightp2)	\
69     Qallp2(leftp2)  = Qallp2(leftp2) XOR Qallp2(rightp2)	\
70     Qallp3(leftp3)  = Qallp3(leftp3) XOR Qallp3(rightp3)	\
71     Qallp3(rightp3) = Qallp3(leftp3) XOR Qallp3(rightp3)	\
72     Qallp3(leftp3)  = Qallp3(leftp3) XOR Qallp3(rightp3)	\
73     Qallp4(leftp4)  = Qallp4(leftp4) XOR Qallp4(rightp4)	\
74     Qallp4(rightp4) = Qallp4(leftp4) XOR Qallp4(rightp4)	\
75     Qallp4(leftp4)  = Qallp4(leftp4) XOR Qallp4(rightp4)
76 
77 int quad_frnd(quad_floating_point *, quad_floating_point *, quad_floating_point *, unsigned int *);
78