Message ID | ZcdIFVDl6Bby8QZG@tucnak |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1384795dyd; Sat, 10 Feb 2024 01:56:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IGvhw438Jh4drc5Gtua+AyRyY07YDKvH/zXe3Gu7WcMGAf/+vIDOxUUm21iD6Us0BbYe8IK X-Received: by 2002:a05:620a:568:b0:783:96c4:8c8 with SMTP id p8-20020a05620a056800b0078396c408c8mr1261820qkp.63.1707558982454; Sat, 10 Feb 2024 01:56:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707558982; cv=pass; d=google.com; s=arc-20160816; b=cxuVmqQjTt0wKTVuxKmbPWUWk7VWVp0qM6QSqxYzKwIY9lUgUB/hiQqp8L8lW3JOHJ rY9Fd3F14uIu58TgToXnmzWBMsDU32a28N2WicLor1W+hbx0OosFksbdlLMs4syemG32 OJoldhAl8BTpkf6ok2/npW3WKRR4dzIVBvODQlGxzuzlxrACwwL6SP4kvLzV++AO9bMd iFzxMJDZPx/LvBu8BaCgasAVyn4rSBb+12+/d4uAE6KfoxkAWRFAY7raoopEw33kNUTx ig7xV+wpWGnlB6Ymq8tx1nnVcgzdc+xcQsTKRV/WwkQ8N9xhb37CN2H/OUBzZIgInpHK jI6w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:reply-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=I6g1Pymm/EIUae4Y7ZbeuBK4ZuZ84+GOMj74bbA+kTs=; fh=Koz6kcPpGmSwbI5lb0MP8NuVzwMKPNSmonvwgbVdblM=; b=CXJ8AKn2sX+W58XMBxwGVE49XnRXjT17H5YiPM2tnE7MhE12hbI5RIo9EteLDTcejW tWWaAIgAY76f6FMDlV8ESoaYbQzvCV3W2sUR38gMXA7P8zMfQ6sg47iFqPl+m3n9QABG rrajUwoUqHVYfV8zD2Yxn8SYZWxEavOIkaPITpvLKUKddYGw1ucU3pr+WdBtlX6aIcM1 mFf/BudIx5/ukFUXUkq6s5x7vptk8ya4np22woCv64JQcy4W9VLwt0HEaDjS6uNJWAzd G7sX2hVcfCBIl8mt+DnRGwVWXmW+ie/3N7WLrzbXD+lwUfuzfd4WEPI8s+kNam8e0nyP vXuA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hMoI6EDR; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=2; AJvYcCXlegkm/kH23pxHJ2ocV24tFQKmqaDG8XkMVsQOu0RN9/cXhcCtSA0ZO++64H3Y5cnAccds9rarEGTwO7FxX2IToP6gXw== Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id b8-20020a05620a088800b00783aa61af29si1347670qka.526.2024.02.10.01.56.22 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 01:56:22 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hMoI6EDR; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 213413858C2D for <ouuuleilei@gmail.com>; Sat, 10 Feb 2024 09:56:22 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id E41DF3858D32 for <gcc-patches@gcc.gnu.org>; Sat, 10 Feb 2024 09:55:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E41DF3858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E41DF3858D32 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707558944; cv=none; b=tA2KZ1+wcd32QDmJ02wY5DawkP3CEQKBMmdkKuaY39q+N6e80ZXl4bmt/sxV3khn/P8wY7O1+nLaMJ1UX1Oc4cFvao6pqoXz6U9Gt8ta7AU5SCdJv3SwVpfrZK8SEoyIHKh5QoPxidUTlDGduyH9uXYn5Uw7zbivvkLlDxuQo3k= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707558944; c=relaxed/simple; bh=i6gTaKgYoyrq7/FK+6lRMO4SGQBc8PX2AficJDzYM24=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=m0IRtFyzA8z7Grpw+ptPOlDYTIgcTXZ1JlRUahWVhStwAEAuSbvy0oYhSBm5g0pyb9/7rzbWSzIgqE08f/Zyruq64Z3HAZ1eyNdOU7+IppomSglnSfw3mSUmRAIAJgNupLI0GdhxLIwQ9fYSI6xxpB6++GLuceQwzZsZgU7uiVM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707558942; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=I6g1Pymm/EIUae4Y7ZbeuBK4ZuZ84+GOMj74bbA+kTs=; b=hMoI6EDRbq+UZtIh3FBzqhKedcZSbtNsGCL+i/cyUlbR+eHyxPqqUuBZpLtX2n927+KDsq Q8Y21saDVtVU86b2GdyFhKnBTgCM0UcKnPhXYt52/I2G7+pOP0s+SVtz7YEczfJfPQiLL7 lpSCP3own/lWJldLn5FQqaSQ7MWkPQ4= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-661-ow1bLxnsPd24kqwwLtecVA-1; Sat, 10 Feb 2024 04:55:41 -0500 X-MC-Unique: ow1bLxnsPd24kqwwLtecVA-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B0B903C0F1A9; Sat, 10 Feb 2024 09:55:40 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 61F4C492BC6; Sat, 10 Feb 2024 09:55:40 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 41A9tY5c4023473 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Sat, 10 Feb 2024 10:55:35 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 41A9tXa84023472; Sat, 10 Feb 2024 10:55:33 +0100 Date: Sat, 10 Feb 2024 10:55:33 +0100 From: Jakub Jelinek <jakub@redhat.com> To: Richard Biener <rguenther@suse.de>, "Joseph S. Myers" <josmyers@redhat.com> Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] libgcc: Fix a bug in _BitInt -> dfp conversions Message-ID: <ZcdIFVDl6Bby8QZG@tucnak> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Reply-To: Jakub Jelinek <jakub@redhat.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790505367678674270 X-GMAIL-MSGID: 1790505367678674270 |
Series |
libgcc: Fix a bug in _BitInt -> dfp conversions
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Jakub Jelinek
Feb. 10, 2024, 9:55 a.m. UTC
Hi! The ia32 _BitInt support revealed a bug in floatbitint?d.c. As can be even guessed from how the code is written in the loop, the intention was to set inexact to non-zero whenever the remainder after division wasn't zero, but I've ended up just checking whether the 2 least significant limbs of the remainder were non-zero. Now, in the dfp/bitint-4.c test in one case the remainder happens to have least significant 64 bits zero and then the higher limbs are non-zero; with 32-bit limbs that means 2 least significant limbs are zero and so the code acted as if it was exactly divisible. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux (including the _BitInt enablement there), ok for trunk? 2024-02-10 Jakub Jelinek <jakub@redhat.com> * soft-fp/floatbitintdd.c (__bid_floatbitintdd): Or in all remainder limbs into inexact rather than just first two. * soft-fp/floatbitintsd.c (__bid_floatbitintsd): Likewise. * soft-fp/floatbitinttd.c (__bid_floatbitinttd): Likewise. Jakub
Comments
> Am 10.02.2024 um 10:56 schrieb Jakub Jelinek <jakub@redhat.com>: > > Hi! > > The ia32 _BitInt support revealed a bug in floatbitint?d.c. > As can be even guessed from how the code is written in the loop, > the intention was to set inexact to non-zero whenever the remainder > after division wasn't zero, but I've ended up just checking whether > the 2 least significant limbs of the remainder were non-zero. > Now, in the dfp/bitint-4.c test in one case the remainder happens > to have least significant 64 bits zero and then the higher limbs are > non-zero; with 32-bit limbs that means 2 least significant limbs are zero > and so the code acted as if it was exactly divisible. > > Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux > (including the _BitInt enablement there), ok for trunk? Ok Richard > 2024-02-10 Jakub Jelinek <jakub@redhat.com> > > * soft-fp/floatbitintdd.c (__bid_floatbitintdd): Or in all remainder > limbs into inexact rather than just first two. > * soft-fp/floatbitintsd.c (__bid_floatbitintsd): Likewise. > * soft-fp/floatbitinttd.c (__bid_floatbitinttd): Likewise. > > --- libgcc/soft-fp/floatbitintdd.c.jj 2024-02-09 17:11:47.095675716 +0100 > +++ libgcc/soft-fp/floatbitintdd.c 2024-02-09 18:22:25.786674139 +0100 > @@ -114,7 +114,7 @@ __bid_floatbitintdd (const UBILtype *i, > buf + BITINT_END (q_limbs - 1, 0), q_limbs); > inexact = buf[q_limbs + pow10_limbs]; > for (j = 1; j < pow10_limbs; ++j) > - inexact |= buf[q_limbs + pow10_limbs + 1]; > + inexact |= buf[q_limbs + pow10_limbs + j]; > } > else > { > --- libgcc/soft-fp/floatbitintsd.c.jj 2023-09-06 17:34:04.978510447 +0200 > +++ libgcc/soft-fp/floatbitintsd.c 2024-02-09 18:21:50.949158569 +0100 > @@ -113,7 +113,7 @@ __bid_floatbitintsd (const UBILtype *i, > buf + BITINT_END (q_limbs - 1, 0), q_limbs); > inexact = buf[q_limbs + pow10_limbs]; > for (j = 1; j < pow10_limbs; ++j) > - inexact |= buf[q_limbs + pow10_limbs + 1]; > + inexact |= buf[q_limbs + pow10_limbs + j]; > } > else > { > --- libgcc/soft-fp/floatbitinttd.c.jj 2024-02-09 17:14:17.485578556 +0100 > +++ libgcc/soft-fp/floatbitinttd.c 2024-02-09 18:21:34.409388566 +0100 > @@ -113,7 +113,7 @@ __bid_floatbitinttd (const UBILtype *i, > buf + BITINT_END (q_limbs - 1, 0), q_limbs); > inexact = buf[q_limbs + pow10_limbs]; > for (j = 1; j < pow10_limbs; ++j) > - inexact |= buf[q_limbs + pow10_limbs + 1]; > + inexact |= buf[q_limbs + pow10_limbs + j]; > } > else > { > > Jakub >
--- libgcc/soft-fp/floatbitintdd.c.jj 2024-02-09 17:11:47.095675716 +0100 +++ libgcc/soft-fp/floatbitintdd.c 2024-02-09 18:22:25.786674139 +0100 @@ -114,7 +114,7 @@ __bid_floatbitintdd (const UBILtype *i, buf + BITINT_END (q_limbs - 1, 0), q_limbs); inexact = buf[q_limbs + pow10_limbs]; for (j = 1; j < pow10_limbs; ++j) - inexact |= buf[q_limbs + pow10_limbs + 1]; + inexact |= buf[q_limbs + pow10_limbs + j]; } else { --- libgcc/soft-fp/floatbitintsd.c.jj 2023-09-06 17:34:04.978510447 +0200 +++ libgcc/soft-fp/floatbitintsd.c 2024-02-09 18:21:50.949158569 +0100 @@ -113,7 +113,7 @@ __bid_floatbitintsd (const UBILtype *i, buf + BITINT_END (q_limbs - 1, 0), q_limbs); inexact = buf[q_limbs + pow10_limbs]; for (j = 1; j < pow10_limbs; ++j) - inexact |= buf[q_limbs + pow10_limbs + 1]; + inexact |= buf[q_limbs + pow10_limbs + j]; } else { --- libgcc/soft-fp/floatbitinttd.c.jj 2024-02-09 17:14:17.485578556 +0100 +++ libgcc/soft-fp/floatbitinttd.c 2024-02-09 18:21:34.409388566 +0100 @@ -113,7 +113,7 @@ __bid_floatbitinttd (const UBILtype *i, buf + BITINT_END (q_limbs - 1, 0), q_limbs); inexact = buf[q_limbs + pow10_limbs]; for (j = 1; j < pow10_limbs; ++j) - inexact |= buf[q_limbs + pow10_limbs + 1]; + inexact |= buf[q_limbs + pow10_limbs + j]; } else {