Article View: comp.sys.ibm.pc.rt
Article #1977Fix for APC floating point problem (part 2/2) IBM/4.3
From: Mark S. Lewis
Date: Fri, 09 Mar 1990 20:08
Date: Fri, 09 Mar 1990 20:08
236 lines
8450 bytes
8450 bytes
Subject: Fix for APC floating point problem (part 2/2) IBM/4.3
Index: /usr/src/usr.lib/libfp/genfp/{f881gen, fpa2gen}.c
Description:
There is an unusual set of circumstances that could cause
certain models of the IBM RT System (6150, 6151) and the IBM
6152 Academic System to give inaccurate floating point arithmetic
results. Although the probability of its occurrence is
extremely remote, we are informing our customers and
providing a fix.
These fixes are designed to detect the circumstances where
a floating point error could potentially occur and to
prevent the floating point error from occurring.
The complete fix is comprised of 3 components: a patch
to vmunix, a patch to the floating point library, and a
new version of the fortran compiler hf77.
V1.27_kit.1 - Patch to kernel
V1.27_kit.2 - Patch to fp library (this file)
hf77_12.1_tar.Z - hf77 with APC fix
(628233 bytes, 20410 checksum)
The fortran compiler can be copied (uucp) from the IBM support
host ibmsupt from the directory /usr/spool/uucppublic/ibm43-fixes.
(See V1.28 for details.)
Fix:
Following is a patch to the floating point library. Apply
this patch to the Dec 88 release of IBM/4.3. Make and install
the new library.
cd /usr/src/usr.lib/libfp/genfp
patch -p1 < V1.27_kit.2
*** f881gen.c Thu Jan 4 17:47:18 1990
--- f881gen.c.fix Thu Jan 4 16:43:32 1990
***************
*** 1,14 ****
/*
! * 5799-WZQ (C) COPYRIGHT IBM CORPORATION 1987,1988
* LICENSED MATERIALS - PROPERTY OF IBM
* REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
*/
! /* $Header:f881gen.c 12.0$ */
! /* $ACIS:f881gen.c 12.0$ */
/* $Source: /ibm/acis/usr/src/usr.lib/libfp/genfp/RCS/f881gen.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:f881gen.c 12.0$";
#endif
#include "fpgen.h"
--- 1,13 ----
/*
! * P_R_P_Q_# (C) COPYRIGHT IBM CORPORATION 1987,1988
* LICENSED MATERIALS - PROPERTY OF IBM
* REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
*/
! /* $Header: f881gen.c,v 12.1 89/05/09 23:21:46 triha Exp $ */
/* $Source: /ibm/acis/usr/src/usr.lib/libfp/genfp/RCS/f881gen.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: f881gen.c,v 12.1 89/05/09 23:21:46
triha Exp $";
#endif
#include "fpgen.h"
***************
*** 406,411 ****
--- 405,411 ----
/* move the value on stack into which_scr */
i += _fp_inst_store(&newcode[i], ra, rr, f881_WRITE_SCR(which_scr));
+ newcode[i++] = RTi_SYNC;
return (i);
} /* end _mv_gr2fpscr */
***************
*** 917,923 ****
f881_PREC_MASK,f881_PREC_SINGLE);
inst.L = f881inst(f881_F2F,fdst,fdst,OP881_MOVE);
icode += _fp_new_inst_store(&newcode[icode],gi,r0,inst);
! }
} else { /* need to move opnd1 <- freg */
if (is_uint(resprec) && check_version(VERSION_UNSIGNED))
icode += _f881_sub_2to31(&newcode[icode],gi,fdst,ra,ri);
--- 917,926 ----
f881_PREC_MASK,f881_PREC_SINGLE);
inst.L = f881inst(f881_F2F,fdst,fdst,OP881_MOVE);
icode += _fp_new_inst_store(&newcode[icode],gi,r0,inst);
! } else if ((gi->data->opcode == FP_MOVE) &&
! ((hi_optype_of(gi,1) == ADDRTYPE) ||
! (hi_optype_of(gi,1) == IMMEDTYPE)))
! newcode[icode++] = RTi_SYNC;
} else { /* need to move opnd1 <- freg */
if (is_uint(resprec) && check_version(VERSION_UNSIGNED))
icode += _f881_sub_2to31(&newcode[icode],gi,fdst,ra,ri);
***************
*** 1049,1055 ****
f881_PREC_MASK,f881_PREC_SINGLE);
inst.L = f881inst(f881_F2F,fdst,fdst,OP881_MOVE);
icode += _fp_new_inst_store(&newcode[icode],gi,r0,inst);
! }
} else { /* need to move opnd1 <- freg */
if (is_uint(resprec) && check_version(VERSION_UNSIGNED))
icode += _f881_sub_2to31(&newcode[icode],gi,fdst,ra,ri);
--- 1052,1060 ----
f881_PREC_MASK,f881_PREC_SINGLE);
inst.L = f881inst(f881_F2F,fdst,fdst,OP881_MOVE);
icode += _fp_new_inst_store(&newcode[icode],gi,r0,inst);
! } else if ((hi_optype_of(gi,1) == ADDRTYPE) ||
! (hi_optype_of(gi,1) == IMMEDTYPE))
! newcode[icode++] = RTi_SYNC;
} else { /* need to move opnd1 <- freg */
if (is_uint(resprec) && check_version(VERSION_UNSIGNED))
icode += _f881_sub_2to31(&newcode[icode],gi,fdst,ra,ri);
***************
*** 1192,1198 ****
f881_PREC_MASK,f881_PREC_SINGLE);
inst.L = f881inst(f881_F2F,fdst,fdst,OP881_MOVE);
icode += _fp_new_inst_store(&newcode[icode],gi,r0,inst);
! }
} else { /* need to move opnd1 <- freg */
if (is_uint(resprec) && check_version(VERSION_UNSIGNED))
icode += _f881_sub_2to31(&newcode[icode],gi,fdst,ra,ri);
--- 1197,1204 ----
f881_PREC_MASK,f881_PREC_SINGLE);
inst.L = f881inst(f881_F2F,fdst,fdst,OP881_MOVE);
icode += _fp_new_inst_store(&newcode[icode],gi,r0,inst);
! } else if ((arg2type == ADDRTYPE) || (arg2type == IMMEDTYPE))
! newcode[icode++] = RTi_SYNC;
} else { /* need to move opnd1 <- freg */
if (is_uint(resprec) && check_version(VERSION_UNSIGNED))
icode += _f881_sub_2to31(&newcode[icode],gi,fdst,ra,ri);
*** fpa2gen.c Thu Jan 4 17:47:09 1990
--- fpa2gen.c.fix Thu Jan 4 16:45:41 1990
***************
*** 1,14 ****
/*
! * 5799-WZQ (C) COPYRIGHT IBM CORPORATION 1987,1988
* LICENSED MATERIALS - PROPERTY OF IBM
* REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
*/
! /* $Header:fpa2gen.c 12.0$ */
! /* $ACIS:fpa2gen.c 12.0$ */
/* $Source: /ibm/acis/usr/src/usr.lib/libfp/genfp/RCS/fpa2gen.c,v $ */
#ifndef lint
! static char *rcsid = "$Header:fpa2gen.c 12.0$";
#endif
#include "fpgen.h"
--- 1,13 ----
/*
! * P_R_P_Q_# (C) COPYRIGHT IBM CORPORATION 1987,1988
* LICENSED MATERIALS - PROPERTY OF IBM
* REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
*/
! /* $Header: fpa2gen.c,v 12.1 89/05/09 23:22:32 triha Exp $ */
/* $Source: /ibm/acis/usr/src/usr.lib/libfp/genfp/RCS/fpa2gen.c,v $ */
#ifndef lint
! static char *rcsid = "$Header: fpa2gen.c,v 12.1 89/05/09 23:22:32
triha Exp $";
#endif
#include "fpgen.h"
***************
*** 226,231 ****
--- 225,231 ----
else
instr = fpa2DMAwrite(freg,len);
i += _fp_new_inst_store(&newcode[i], gi, rx, instr);
+ newcode[i++] = RTi_SYNC;
if (rx != byteval_of(gi, opndnum)) fp_free_genr(gi, rx);
return(i);
***************
*** 333,338 ****
--- 333,339 ----
(freg1*2), (freg1*2),
length_of(opprec));
i += _fp_new_inst_store(&newcode[i], gi, rx, instr);
+ newcode[i++] = RTi_SYNC;
if (rx != byteval_of(gi, arg)) fp_free_genr(gi, rx);
break;
***************
*** 570,575 ****
--- 571,578 ----
(freg1*2), (freg2*2),
length_of(opprec));
i += _fp_new_inst_store(&newcode[i], gi, rx, instr);
+ if ((arg1type == ADDRTYPE) || (arg1type == IMMEDTYPE))
+ newcode[i++] = RTi_SYNC;
if ((arg1type != GREGTYPE) && (rx != arg1byte))
fp_free_genr(gi, rx);
***************
*** 584,589 ****
--- 587,594 ----
(freg1*2), (freg2*2),
length_of(opprec));
i += _fp_new_inst_store(&newcode[i], gi, rx, instr);
+ if ((arg2type == ADDRTYPE) || (arg2type == IMMEDTYPE))
+ newcode[i++] = RTi_SYNC;
if ((arg2type != GREGTYPE) && (rx != arg2byte))
fp_free_genr(gi, rx);
***************
*** 732,737 ****
--- 737,743 ----
}
instr = fpa2DMAread(first_savef,N_WORDS);
icode += _fp_new_inst_store(&newcode[icode], gi, basereg, instr);
+ newcode[icode++] = RTi_SYNC;
fp_free_genr(gi, rx);
***************
*** 793,798 ****
--- 799,805 ----
current_freg >>= 1; /* advance to next freg */
} /* end for */
+ newcode[icode++] = RTi_SYNC;
fp_free_genr(gi, rx);
return(icode);
=====----- Mark S. Lewis, IBM AWD Palo Alto -----======
inet: mlewis%ibmsupt@uunet.uu.net (415) 855-4486
uucp: uunet!ibmsupt!mlewis IBM Tie Line: 465-4486
Technical Details
Message-ID:
<4448@ibmpa.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!ibmpa!dolphin.tcspa.ibm.com!mlewisShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!ibmpa!dolphin.tcspa.ibm.com!mlewis From: mlewis@dolphin.tcspa.ibm.com (Mark S. Lewis) Newsgroups: comp.sys.ibm.pc.rt Subject: Fix for APC floating point problem (part 2/2) IBM/4.3 Keywords: V1.27_kit.2 APC RT IBM/4.3 Message-ID: <4448@ibmpa.UUCP> Date: 9 Mar 90 20:08:07 GMT Sender: news@ibmpa.UUCP Reply-To: mlewis@ibmsupt.UUCP Followup-To: comp.sys.ibm.pc.rt Organization: IBM AWD, Palo Alto Lines: 236