View | Details | Raw Unified | Return to bug 3268 | Differences between
and this patch

Collapse All | Expand All

(-)libc24-cvstip-20060920/soft-fp/Makefile (-2 / +3 lines)
Lines 24-35 Link Here
24
24
25
gcc-single-routines := negsf2 addsf3 subsf3 mulsf3 divsf3 eqsf2 \
25
gcc-single-routines := negsf2 addsf3 subsf3 mulsf3 divsf3 eqsf2 \
26
	lesf2 gesf2 unordsf2 fixsfsi fixunssfsi floatsisf fixsfdi        \
26
	lesf2 gesf2 unordsf2 fixsfsi fixunssfsi floatsisf fixsfdi        \
27
	fixunssfdi floatdisf sqrtsf2 floatunsisf floatundisf
27
	fixunssfdi floatdisf sqrtsf2 floatunsisf floatundisf \
28
	fmasf4
28
29
29
gcc-double-routines := negdf2 adddf3 subdf3 muldf3 divdf3 eqdf2 \
30
gcc-double-routines := negdf2 adddf3 subdf3 muldf3 divdf3 eqdf2 \
30
	ledf2 gedf2 unorddf2 fixdfsi fixunsdfsi floatsidf fixdfdi        \
31
	ledf2 gedf2 unorddf2 fixdfsi fixunsdfsi floatsidf fixdfdi        \
31
	fixunsdfdi floatdidf extendsfdf2 truncdfsf2 sqrtdf2 floatunsidf \
32
	fixunsdfdi floatdidf extendsfdf2 truncdfsf2 sqrtdf2 floatunsidf \
32
	floatundidf
33
	floatundidf fmadf4
33
34
34
gcc-quad-routines := negtf2 addtf3 subtf3 multf3 divtf3 eqtf2 \
35
gcc-quad-routines := negtf2 addtf3 subtf3 multf3 divtf3 eqtf2 \
35
	letf2 getf2 unordtf2 fixtfsi fixunstfsi floatsitf fixtfdi      \
36
	letf2 getf2 unordtf2 fixtfsi fixunstfsi floatsitf fixtfdi      \
(-)libc24-cvstip-20060920/soft-fp/fmadf4.c (+97 lines)
Line 0 Link Here
1
/* soft-fp x * y + z as ternary operation.
2
   Copyright (C) 2006 Free Software Foundation, Inc.
3
   This file is part of the GNU C Library.
4
   Contributed by Steven Munroe <sjmunroe@us.ibm.com>, 2006.
5
6
   The GNU C Library is free software; you can redistribute it and/or
7
   modify it under the terms of the GNU Lesser General Public
8
   License as published by the Free Software Foundation; either
9
   version 2.1 of the License, or (at your option) any later version.
10
11
   The GNU C Library is distributed in the hope that it will be useful,
12
   but WITHOUT ANY WARRANTY; without even the implied warranty of
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
   Lesser General Public License for more details.
15
16
   In addition to the permissions in the GNU Lesser General Public
17
   License, the Free Software Foundation gives you unlimited
18
   permission to link the compiled version of this file into
19
   combinations with other programs, and to distribute those
20
   combinations without any restriction coming from the use of this
21
   file.  (The Lesser General Public License restrictions do apply in
22
   other respects; for example, they cover modification of the file,
23
   and distribution when not linked into a combine executable.)
24
25
   You should have received a copy of the GNU Lesser General Public
26
   License along with the GNU C Library; if not, write to the Free
27
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
28
   02111-1307 USA.  */
29
30
#include "soft-fp.h"
31
#include "double.h"
32
#include "quad.h"
33
34
/* Compute floating point multiply-add with higher (quad) precision.  */
35
DFtype
36
__fmadf4 (DFtype a, DFtype b, DFtype c)
37
{
38
    FP_DECL_EX;
39
    FP_DECL_D(A);
40
    FP_DECL_D(B);
41
    FP_DECL_D(C);
42
    FP_DECL_Q(X);
43
    FP_DECL_Q(Y);
44
    FP_DECL_Q(Z);
45
    FP_DECL_Q(U);
46
    FP_DECL_Q(V);
47
    FP_DECL_D(R);
48
    double r;
49
    long double u, x, y, z;
50
  
51
    FP_INIT_ROUNDMODE;
52
    FP_UNPACK_RAW_D (A, a);
53
    FP_UNPACK_RAW_D (B, b);
54
    FP_UNPACK_RAW_D (C, c);
55
56
    /* Extend double to quad.  */
57
#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
58
    FP_EXTEND(Q,D,4,2,X,A);
59
    FP_EXTEND(Q,D,4,2,Y,B);
60
    FP_EXTEND(Q,D,4,2,Z,C);
61
#else
62
    FP_EXTEND(Q,D,2,1,X,A);
63
    FP_EXTEND(Q,D,2,1,Y,B);
64
    FP_EXTEND(Q,D,2,1,Z,C);
65
#endif
66
    FP_PACK_RAW_Q(x,X);
67
    FP_PACK_RAW_Q(y,Y);
68
    FP_PACK_RAW_Q(z,Z);
69
    FP_HANDLE_EXCEPTIONS;
70
71
    /* Multiply.
72
       Rounding is not an issue as we keep the full 106 bit product.  */
73
    FP_UNPACK_Q(X,x);
74
    FP_UNPACK_Q(Y,y);
75
    FP_MUL_Q(U,X,Y);
76
    FP_PACK_Q(u,U);
77
    FP_HANDLE_EXCEPTIONS;
78
79
    /* Add without rounding.  */
80
    FP_UNPACK_SEMIRAW_Q(U,u);
81
    FP_UNPACK_SEMIRAW_Q(Z,z);
82
    FP_ADD_Q(V,U,Z);
83
84
    /* Truncate quad to double and round.  */
85
#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
86
    V_f[3] &= 0x0007ffff;  /* SEMIRAW_TO_SEMIRAW(4) */
87
    FP_TRUNC(D,Q,2,4,R,V);
88
#else
89
    V_f1 &= 0x0007ffffffffffffL;  /* SEMIRAW_TO_SEMIRAW(2) */
90
    FP_TRUNC(D,Q,1,2,R,V);
91
#endif
92
    FP_PACK_SEMIRAW_D(r,R);
93
    FP_HANDLE_EXCEPTIONS;
94
95
    return r;
96
}
97
(-)libc24-cvstip-20060920/soft-fp/fmasf4.c (+96 lines)
Line 0 Link Here
1
/* soft-fp x * y + z as ternary operation.
2
   Copyright (C) 2006 Free Software Foundation, Inc.
3
   This file is part of the GNU C Library.
4
   Contributed by Steven Munroe <sjmunroe@us.ibm.com>, 2006.
5
6
   The GNU C Library is free software; you can redistribute it and/or
7
   modify it under the terms of the GNU Lesser General Public
8
   License as published by the Free Software Foundation; either
9
   version 2.1 of the License, or (at your option) any later version.
10
11
   In addition to the permissions in the GNU Lesser General Public
12
   License, the Free Software Foundation gives you unlimited
13
   permission to link the compiled version of this file into
14
   combinations with other programs, and to distribute those
15
   combinations without any restriction coming from the use of this
16
   file.  (The Lesser General Public License restrictions do apply in
17
   other respects; for example, they cover modification of the file,
18
   and distribution when not linked into a combine executable.)
19
20
   The GNU C Library is distributed in the hope that it will be useful,
21
   but WITHOUT ANY WARRANTY; without even the implied warranty of
22
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23
   Lesser General Public License for more details.
24
25
   You should have received a copy of the GNU Lesser General Public
26
   License along with the GNU C Library; if not, write to the Free
27
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
28
   02111-1307 USA.  */
29
30
#include "soft-fp.h"
31
#include "single.h"
32
#include "double.h"
33
34
/* Compute floating point multiply-add with higher (double) precision.  */
35
SFtype
36
__fmasf4 (SFtype a, SFtype b, SFtype c)
37
{
38
    FP_DECL_EX;
39
    FP_DECL_S(A);
40
    FP_DECL_S(B);
41
    FP_DECL_S(C);
42
    FP_DECL_D(X);
43
    FP_DECL_D(Y);
44
    FP_DECL_D(Z);
45
    FP_DECL_D(U);
46
    FP_DECL_D(V);
47
    FP_DECL_S(R);
48
    float r;
49
    double u, x, y, z;
50
51
    FP_INIT_ROUNDMODE;
52
    FP_UNPACK_RAW_S (A, a);
53
    FP_UNPACK_RAW_S (B, b);
54
    FP_UNPACK_RAW_S (C, c);
55
56
    /* Extend single to double.  */
57
#if _FP_W_TYPE_SIZE < _FP_FRACBITS_D
58
    FP_EXTEND(D,S,2,1,X,A);
59
    FP_EXTEND(D,S,2,1,Y,B);
60
    FP_EXTEND(D,S,2,1,Z,C);
61
#else
62
    FP_EXTEND(D,S,1,1,X,A);
63
    FP_EXTEND(D,S,1,1,Y,B);
64
    FP_EXTEND(D,S,1,1,Z,C);
65
#endif
66
    FP_PACK_RAW_D(x,X);
67
    FP_PACK_RAW_D(y,Y);
68
    FP_PACK_RAW_D(z,Z);
69
    FP_HANDLE_EXCEPTIONS;
70
71
    /* Multiply.
72
       Rounding is not an issue as we keep the full 48 bit product.  */
73
    FP_UNPACK_D(X,x);
74
    FP_UNPACK_D(Y,y);
75
    FP_MUL_D(U,X,Y);
76
    FP_PACK_D(u,U);
77
    FP_HANDLE_EXCEPTIONS;
78
79
    /* Add without rounding.  */
80
    FP_UNPACK_SEMIRAW_D(U,u);
81
    FP_UNPACK_SEMIRAW_D(Z,z);
82
    FP_ADD_D(V,U,Z);
83
84
    /* Truncate double to single and round.  */
85
#if FP_W_TYPE_SIZE < _FP_FRACBITS_D
86
    V_f1 &= 0x007fffffL;  /* SEMIRAW_TO_SEMIRAW(2) */
87
    FP_TRUNC(S,D,1,2,R,V);
88
#else
89
    V_f &= 0x007fffffffffffffL;  /* SEMIRAW_TO_SEMIRAW(1) */
90
    FP_TRUNC(S,D,1,1,R,V);
91
#endif
92
    FP_PACK_SEMIRAW_S(r,R);
93
    FP_HANDLE_EXCEPTIONS;
94
95
    return r;
96
}

Return to bug 3268