Message ID | ZcdJ1WGHQm73I8eU@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 r10csp1387541dyd; Sat, 10 Feb 2024 02:03:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWgeTZSO/cekgJ35P8TWdfq4xAWqYeU3ZWOHNRRMrkPNiha3l2WiFEqI6cNTeyUCXd25jq75hF1SbFOXtc4UXgJqfUNCg== X-Google-Smtp-Source: AGHT+IG15v1gqJMIAdNvQp+l/GBEq29Ayg126BPZGwA46MZMaaGr5/ESMpyp/XRZFZ5RvWH4BJdY X-Received: by 2002:a05:6830:2b13:b0:6dd:e29d:dbf6 with SMTP id l19-20020a0568302b1300b006dde29ddbf6mr1574275otv.16.1707559422733; Sat, 10 Feb 2024 02:03:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707559422; cv=pass; d=google.com; s=arc-20160816; b=tn/igjtrwIY7BNYPn8koU90aUBsw0GsAgTY8pNdKXw7P/3/bHYud+3Cn6WKnF3hQT9 64iiSHvKVIthL9poQMt+HW3vG0XR7yBIbOaqP5MK8OnBzY77sefHKDeNimkgC1cVvrwV 2zSSBjYh3FxOuj+ElfT5/y1XRGFDXo13jsap58Z/EcXNsUdk/xS0Gdg82+7q3xGGz1gT J7f8i4fa6IDapnXwwhy7jF1xlKSzsIK5QNF00aAifmxY96jr8yS+0RCxluOkMoFxx7wI i0+UmcJAoedpiiDT6Y5gipSCKtMJXufpHxR43b8KvzucOclAI/TFJ9izY/X/buPITP0l cwdw== 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=afAchjYcbcVhAk0VxvyX//QanMOVlMyy4jIUw7DFx1k=; fh=XUO/O8Ev2xqj+pwn+G7LP29MSrMBmTi7pfr1AiRzYJQ=; b=wSbd8jA1uSZ2HexTT6gqH7hbC7FnJSs9+ZZZmBnYOQ0Al2Ht/vzWIkzdaZMFuMHw0W 3+2MOjMFWvPq2wp2o2rKj/p+zBuDwfq9GXaQ5tgSbNgqxp0sgMAzw9WLO68OYTIkxrxw KbAv6Njd8iMGEElAEXvZaEiF8PHRf6EP95FVDAiL11YWEqODxyIJRrkXJlnRl4+feytu kj5+1FkwEF9C6UfiejEVFyBrpP78Fp2XQ1jXl30wZvvO8cLYG82lOQp+arRrjLNoTKg6 xG7csYkJZMX8asOmWY/Ea2+UqDfITGkFmScU1soI4qNL7lnotY8B0A3uPZyt8WhHkxCU DciA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GKrqD150; 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; AJvYcCVeue0si1tPIx6DpUGyzubxAQvJanvfjf5n8Np/tp0Ck9159WF23JsGPEgztwQA+vbAErrCkZaNe+TIldAC8TsGSQvQ9w== Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id b7-20020a05622a020700b0042c459cd209si3906756qtx.600.2024.02.10.02.03.42 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 02:03:42 -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=GKrqD150; 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 6A0293858C29 for <ouuuleilei@gmail.com>; Sat, 10 Feb 2024 10:03:42 +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 C2BE03858D20 for <gcc-patches@gcc.gnu.org>; Sat, 10 Feb 2024 10:03:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C2BE03858D20 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 C2BE03858D20 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=1707559389; cv=none; b=rfdKVwsyHUX1qNjfC9TWBlqK8a4Atcc5Hvjh3W7sh75geKkrkqCAS8rva5sLybj9hc+ziwo4d+7qM8W7qUKuK09jtzw5DZQEYoBn80bWInfsuefrrSu1xa6iu0C6mpzCmwYl1QotM0Mlk98qijlsjKKItp6DE3MFfITKOaS66uo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707559389; c=relaxed/simple; bh=VTkWbI4/ypcEcqU8cSrnv6W7l0gV1cgyMV2+xfyyekg=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=fWiPJWo/3ULFeGWVxrP/omS9a22eCLT4m9tJE0PR5GCS9VXy/pfLuT8BPsF3X3oVtvKuSGIDq4xKH55bBVFVo1vYF22ASg1tQyzicC+2Jt87jAihDjhrwnxkAetsG7sfRu6iiBF+IepYy2wzn43dXWKsTVHIdofaZp0yjxfS3SM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707559387; 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=afAchjYcbcVhAk0VxvyX//QanMOVlMyy4jIUw7DFx1k=; b=GKrqD150Cd+WuBi3H+RzVyg7QjYMcIWveemd77NEq8QmwRL5zk/9YrDjSgHVVVzllOkXar CZJ5zeY76RzQGKVeLg1z6hXqvra0EEvIPi4pLYHTtpepQ0QOyi3pNNbl8hcf6ocYPa0un2 DuxZbXXhI/DrzJon7oLiZd5FCBMx3+w= 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-583-Hpk1fz1NPQ-JxfNg-qIKTQ-1; Sat, 10 Feb 2024 05:03:05 -0500 X-MC-Unique: Hpk1fz1NPQ-JxfNg-qIKTQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (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 91688380610E; Sat, 10 Feb 2024 10:03:05 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5549AA26; Sat, 10 Feb 2024 10:03:05 +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 41AA32Sk4023511 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Sat, 10 Feb 2024 11:03:03 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 41AA31qR4023510; Sat, 10 Feb 2024 11:03:01 +0100 Date: Sat, 10 Feb 2024 11:03:01 +0100 From: Jakub Jelinek <jakub@redhat.com> To: Richard Biener <rguenther@suse.de> Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] lower-bitint: Fix up .{ADD,SUB}_OVERFLOW lowering Message-ID: <ZcdJ1WGHQm73I8eU@tucnak> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 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: 1790505829142482180 X-GMAIL-MSGID: 1790505829142482180 |
Series |
lower-bitint: Fix up .{ADD,SUB}_OVERFLOW lowering
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Jakub Jelinek
Feb. 10, 2024, 10:03 a.m. UTC
Hi! torture/bitint-37.c test FAILed on i686-linux e.g. on signed _BitInt(575) + unsigned _BitInt(575) -> signed _BitInt(575) __builtin_add_overflow. With 64-bit limbs, we use 4 .UADDC calls in the IL, 2 in a loop (which handles the first 8 limbs), then one partial limb (we use 63 bits from that) and finally last_ovf case due to the mixing of signed vs. unsigned. But with 32-bit limbs, we use 5 .UADDC calls in the IL, 2 in a loop (which handles the first 16 limbs), then one full limb above that, one partial (31 bits) and finally last_ovf case, and for the last_ovf case the code computed incorrect idx and so partly did the wrong thing, e.g. overwrote the result from the previous .UADDC. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2024-02-10 Jakub Jelinek <jakub@redhat.com> * gimple-lower-bitint.cc (itint_large_huge::lower_addsub_overflow): Fix computation of idx for i == 4 of bitint_prec_huge. Jakub
Comments
> Am 10.02.2024 um 11:03 schrieb Jakub Jelinek <jakub@redhat.com>: > > Hi! > > torture/bitint-37.c test FAILed on i686-linux e.g. on > signed _BitInt(575) + unsigned _BitInt(575) -> signed _BitInt(575) > __builtin_add_overflow. With 64-bit limbs, we use 4 .UADDC calls in > the IL, 2 in a loop (which handles the first 8 limbs), then one partial > limb (we use 63 bits from that) and finally last_ovf case due to the > mixing of signed vs. unsigned. > But with 32-bit limbs, we use 5 .UADDC calls in the IL, 2 in a loop (which > handles the first 16 limbs), then one full limb above that, one partial > (31 bits) and finally last_ovf case, and for the last_ovf case the code > computed incorrect idx and so partly did the wrong thing, e.g. overwrote > the result from the previous .UADDC. > > Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for > trunk? Ok Richard > 2024-02-10 Jakub Jelinek <jakub@redhat.com> > > * gimple-lower-bitint.cc (itint_large_huge::lower_addsub_overflow): Fix > computation of idx for i == 4 of bitint_prec_huge. > > --- gcc/gimple-lower-bitint.cc.jj 2024-02-09 16:16:55.335552760 +0100 > +++ gcc/gimple-lower-bitint.cc 2024-02-09 20:41:50.397455671 +0100 > @@ -4031,7 +4031,7 @@ bitint_large_huge::lower_addsub_overflow > if (kind != bitint_prec_huge) > idx = size_int (i); > else if (i >= 2) > - idx = size_int (fin + (i > 2)); > + idx = size_int (fin + i - 2); > if (!last_ovf || i < cnt - 1) > { > if (type0 != TREE_TYPE (arg0)) > > Jakub >
--- gcc/gimple-lower-bitint.cc.jj 2024-02-09 16:16:55.335552760 +0100 +++ gcc/gimple-lower-bitint.cc 2024-02-09 20:41:50.397455671 +0100 @@ -4031,7 +4031,7 @@ bitint_large_huge::lower_addsub_overflow if (kind != bitint_prec_huge) idx = size_int (i); else if (i >= 2) - idx = size_int (fin + (i > 2)); + idx = size_int (fin + i - 2); if (!last_ovf || i < cnt - 1) { if (type0 != TREE_TYPE (arg0))