From patchwork Wed Jan 10 22:50:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tulio Magno Quites Machado Filho X-Patchwork-Id: 25334 Received: (qmail 108783 invoked by alias); 10 Jan 2018 22:51:01 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 108090 invoked by uid 89); 10 Jan 2018 22:51:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=Hx-languages-length:1309 X-HELO: mx0a-001b2d01.pphosted.com From: "Tulio Magno Quites Machado Filho" To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com Subject: [PATCH] powerpc: Fix llround spurious inexact on 32-bit POWER4 [BZ #22697] Date: Wed, 10 Jan 2018 20:50:40 -0200 X-TM-AS-GCONF: 00 x-cbid: 18011022-2213-0000-0000-000002587A7B X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008356; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000245; SDB=6.00973167; UDB=6.00493073; IPR=6.00753117; BA=6.00005772; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00018970; XFM=3.00000015; UTC=2018-01-10 22:50:55 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18011022-2214-0000-0000-000058B7A38D Message-Id: <20180110225040.23576-1-tuliom@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-01-10_12:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1801100312 This issue is similar to BZ #19235, where spurious exceptions are created from adding 0.5 then converting to an integer. The solution is based on Joseph's fix for BZ #19235. 2018-01-10 Tulio Magno Quites Machado Filho [BZ #22697] * sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S (__llround): Do not add 0.5 to integer or out-of-range arguments. --- sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S b/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S index d0b00ac..5ad89a1 100644 --- a/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S +++ b/sysdeps/powerpc/powerpc32/power4/fpu/s_llround.S @@ -71,6 +71,11 @@ ENTRY (__llround) fcmpu cr1,fp1,fp12 /* x is negative? x < 0.0 */ blt- cr6,.Lretzero /* 0.5 > x < -0.5 so just return 0. */ bge- cr7,.Lnobias /* 2^52 > x < -2^52 just convert with no bias. */ + /* Test whether an integer to avoid spurious "inexact". */ + fadd fp3,fp2,fp9 + fsub fp3,fp3,fp9 + fcmpu cr5,fp2,fp3 + beq cr5,.Lnobias fadd fp3,fp2,fp10 /* |x|+=0.5 bias to prepare to round. */ bge cr1,.Lconvert /* x is positive so don't negate x. */ fnabs fp3,fp3 /* -(|x|+=0.5) */