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

Collapse All | Expand All

(-)libc24-ppc64-20060830/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-ppc64-20060830/soft-fp/fmadf4.c (+89 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
   You should have received a copy of the GNU Lesser General Public
17
   License along with the GNU C Library; if not, write to the Free
18
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19
   02111-1307 USA.  */
20
21
#include "soft-fp.h"
22
#include "double.h"
23
#include "quad.h"
24
25
/* Compute floating point multiply-add with higher (quad) precision.  */
26
DFtype
27
__fmadf4 (DFtype a, DFtype b, DFtype c)
28
{
29
    FP_DECL_EX;
30
    FP_DECL_D(A);
31
    FP_DECL_D(B);
32
    FP_DECL_D(C);
33
    FP_DECL_Q(X);
34
    FP_DECL_Q(Y);
35
    FP_DECL_Q(Z);
36
    FP_DECL_Q(U);
37
    FP_DECL_Q(V);
38
    FP_DECL_D(R);
39
    double r;
40
    long double u, x, y, z;
41
42
    FP_INIT_ROUNDMODE;
43
    FP_UNPACK_RAW_D (A, a);
44
    FP_UNPACK_RAW_D (B, b);
45
    FP_UNPACK_RAW_D (C, c);
46
47
    /* Extend double to quad.  */
48
#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
49
    FP_EXTEND(Q,D,4,2,X,A);
50
    FP_EXTEND(Q,D,4,2,Y,B);
51
    FP_EXTEND(Q,D,4,2,Z,C);
52
#else
53
    FP_EXTEND(Q,D,2,1,X,A);
54
    FP_EXTEND(Q,D,2,1,Y,B);
55
    FP_EXTEND(Q,D,2,1,Z,C);
56
#endif
57
    FP_PACK_RAW_Q(x,X);
58
    FP_PACK_RAW_Q(y,Y);
59
    FP_PACK_RAW_Q(z,Z);
60
    FP_HANDLE_EXCEPTIONS;
61
62
    /* Multiply.  */
63
    FP_INIT_ROUNDMODE;
64
    FP_UNPACK_Q(X,x);
65
    FP_UNPACK_Q(Y,y);
66
    FP_MUL_Q(U,X,Y);
67
    FP_PACK_Q(u,U);
68
    FP_HANDLE_EXCEPTIONS;
69
70
    /* Subtract.  */
71
    FP_INIT_ROUNDMODE;
72
    FP_UNPACK_SEMIRAW_Q(U,u);
73
    FP_UNPACK_SEMIRAW_Q(Z,z);
74
    FP_ADD_Q(V,U,Z);
75
76
    /* Truncate quad to double.  */
77
#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
78
    V_f[3] &= 0x0007ffff;
79
    FP_TRUNC(D,Q,2,4,R,V);
80
#else
81
    V_f1 &= 0x0007ffffffffffffL;
82
    FP_TRUNC(D,Q,1,2,R,V);
83
#endif
84
    FP_PACK_SEMIRAW_D(r,R);
85
    FP_HANDLE_EXCEPTIONS;
86
87
    return r;
88
}
89
(-)libc24-ppc64-20060830/soft-fp/fmasf4.c (+88 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
   You should have received a copy of the GNU Lesser General Public
17
   License along with the GNU C Library; if not, write to the Free
18
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19
   02111-1307 USA.  */
20
21
#include "soft-fp.h"
22
#include "single.h"
23
#include "double.h"
24
25
/* Compute floating point multiply-add with higher (double) precision.  */
26
SFtype
27
__fmasf4 (SFtype a, SFtype b, SFtype c)
28
{
29
    FP_DECL_EX;
30
    FP_DECL_S(A);
31
    FP_DECL_S(B);
32
    FP_DECL_S(C);
33
    FP_DECL_D(X);
34
    FP_DECL_D(Y);
35
    FP_DECL_D(Z);
36
    FP_DECL_D(U);
37
    FP_DECL_D(V);
38
    FP_DECL_S(R);
39
    float r;
40
    double u, x, y, z;
41
42
    FP_INIT_ROUNDMODE;
43
    FP_UNPACK_RAW_S (A, a);
44
    FP_UNPACK_RAW_S (B, b);
45
    FP_UNPACK_RAW_S (C, c);
46
47
    /* Extend single to double.  */
48
#if _FP_W_TYPE_SIZE < _FP_FRACBITS_D
49
    FP_EXTEND(D,S,2,1,X,A);
50
    FP_EXTEND(D,S,2,1,Y,B);
51
    FP_EXTEND(D,S,2,1,Z,C);
52
#else
53
    FP_EXTEND(D,S,1,1,X,A);
54
    FP_EXTEND(D,S,1,1,Y,B);
55
    FP_EXTEND(D,S,1,1,Z,C);
56
#endif
57
    FP_PACK_RAW_D(x,X);
58
    FP_PACK_RAW_D(y,Y);
59
    FP_PACK_RAW_D(z,Z);
60
    FP_HANDLE_EXCEPTIONS;
61
62
    /* Multiply.  */
63
    FP_INIT_ROUNDMODE;
64
    FP_UNPACK_D(X,x);
65
    FP_UNPACK_D(Y,y);
66
    FP_MUL_D(U,X,Y);
67
    FP_PACK_D(u,U);
68
    FP_HANDLE_EXCEPTIONS;
69
70
    /* Subtract.  */
71
    FP_INIT_ROUNDMODE;
72
    FP_UNPACK_SEMIRAW_D(U,u);
73
    FP_UNPACK_SEMIRAW_D(Z,z);
74
    FP_ADD_D(V,U,Z);
75
76
    /* Truncate double to single.  */
77
#if FP_W_TYPE_SIZE < _FP_FRACBITS_D
78
    V_f1 &= 0x007fffffL;
79
    FP_TRUNC(S,D,1,2,R,V);
80
#else
81
    V_f &= 0x007fffffffffffffL;
82
    FP_TRUNC(S,D,1,1,R,V);
83
#endif
84
    FP_PACK_SEMIRAW_S(r,R);
85
    FP_HANDLE_EXCEPTIONS;
86
87
    return r;
88
}

Return to bug 3268