From patchwork Thu Apr 13 13:45:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 82991 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1047369vqo; Thu, 13 Apr 2023 06:46:29 -0700 (PDT) X-Google-Smtp-Source: AKy350aC3ONTRhz+3Jl+z7IGADOJ7f5N8coRHNaPWcO9w7YAMeY/X9hdwAxugyAnobFctx8uiuoq X-Received: by 2002:a17:906:780c:b0:94e:c926:ae6b with SMTP id u12-20020a170906780c00b0094ec926ae6bmr383083ejm.16.1681393589346; Thu, 13 Apr 2023 06:46:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681393589; cv=none; d=google.com; s=arc-20160816; b=Lt2vYNMJlu/ww8ba5hc8e1HtbRWZO7l0DwMzGsfAl3gH9S+wNYqx1vjfIamXeQv6oq RHumJsr7SFdOynE1ACYQftPGYy+L1js3EiBAYN+OmWNQWwh1mIAPl5nGw3GWsAxvgORs YqV5MZQUbH2tYyV/Po2COn/hn6WAryW1g3zZLHc0JoAWvqhjovMXmkhXUU1vPlntBApu YtrS1/YC9kWx99YK3uffH6CvC+vbJrbMsYc9SQ3/7+pFyx8k4FVb6LDId3rcHHee+yXz hotqd/AzQEDPgxJUkiUJy+ji6MAx6KXG+5nUiPK9jWFR2aCvNNZjqqU3UbZNu10gI4wO JVSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:in-reply-to:mime-version:references:message-id :subject:cc:to:date:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=0ekTp3qScEiHTUqqzuLIGI4farSVqggDgUWQiUNEiPs=; b=qD1cBVn3PDCJH9D4TAc1+VeS/3M22lLVtrbtYSYmm4dj5dPxRnoclkFPwPxKPBHhMp bT0k7xCJ4y1AXpK0J1kFEoFWvII7LQakaXzCxRR3uPLwb+vkA3bzaEdAIcBVoqv4KPNt 4i2QWD8MOXXKnpgKr7sS5VpRRmN9RqCakGzpRgJeYHB0+bOsHPl9tt9G9xbJnP0NQVfA G0MtvBFL4B81rnJpFTGcXY+XLBaSRkrtIFC35nsEcei1pSVmLihuWBiYlqyV9I554DY3 QrskUiQV7P79rrTE/Jo68bhmN4DOAo3i3b+BerST5R64IGzRGBETXliXhLbJNHT0ELHs BwMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=a4sCWVVQ; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id up18-20020a170907cc9200b00946a18bb2dfsi1719069ejc.986.2023.04.13.06.46.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Apr 2023 06:46:29 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=a4sCWVVQ; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ECB643858C39 for ; Thu, 13 Apr 2023 13:46:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ECB643858C39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681393588; bh=0ekTp3qScEiHTUqqzuLIGI4farSVqggDgUWQiUNEiPs=; h=Date:To:Cc:Subject:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=a4sCWVVQj7js2aV4/oGB9JSxjicSKltrEjeRSAvYqYRykmQqma4cmChfLQDyTWedw nHClgQbG82HQderXaw66jZAv17pHD3EfnzRI3M8Q7H3mdbTb2CSDx3MW1ytzbQcwI/ fYY+/obQHf27nl4Kvo5CRtZ8cAqZOFIlbID2MAYI= 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 470D73858D32 for ; Thu, 13 Apr 2023 13:45:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 470D73858D32 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-541-PI06nY75MXeud1jU_GY6YA-1; Thu, 13 Apr 2023 09:45:39 -0400 X-MC-Unique: PI06nY75MXeud1jU_GY6YA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 07DE788F46B; Thu, 13 Apr 2023 13:45:39 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A4896404DC40; Thu, 13 Apr 2023 13:45:38 +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 33DDjZML3913727 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 13 Apr 2023 15:45:35 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 33DDjSWQ3913724; Thu, 13 Apr 2023 15:45:28 +0200 Date: Thu, 13 Apr 2023 15:45:27 +0200 To: Jeff Law Cc: Segher Boessenkool , Eric Botcazou , gcc-patches@gcc.gnu.org, Richard Biener , Richard Sandiford Subject: [PATCH] loop-iv: Fix up bounds computation Message-ID: References: <3412470.QJadu78ljV@fomalhaut> <8d3c3861-c291-e762-a2a8-0b520f39a7e3@gmail.com> <965831db-ac9e-cc5e-3459-08b6b70fd577@gmail.com> <0760f780-ba7d-3476-1d9a-7b5f3063d63b@gmail.com> <20230413105755.GD19790@gate.crashing.org> <811f7d5a-bb26-b9d1-ed09-7d404b9c7c7f@gmail.com> MIME-Version: 1.0 In-Reply-To: <811f7d5a-bb26-b9d1-ed09-7d404b9c7c7f@gmail.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-3.3 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 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763068964489664364?= X-GMAIL-MSGID: =?utf-8?q?1763068964489664364?= On Thu, Apr 13, 2023 at 06:35:07AM -0600, Jeff Law wrote: > Bootstrap was successful with v3, but there's hundreds of testsuite failures > due to the simplify-rtx hunk. compile/20070520-1.c for example when > compiled with: -O3 -funroll-loops -march=rv64gc -mabi=lp64d > > Thursdays are my hell day. It's unlikely I'd be able to look at this at all > today. So, seems to me this is because loop-iv.cc asks for invalid RTL to be simplified, it calls simplify_gen_binary (AND, SImode, (subreg:SI (plus:DI (reg:DI 289 [ ivtmp_312 ]) (const_int 4294967295 [0xffffffff])) 0), (const_int 4294967295 [0xffffffff])) but 0xffffffff is not valid SImode CONST_INT, and unlike previously we no longer on WORD_REGISTER_OPERATIONS targets which have DImode word_mode optimize that into the op0, so the invalid constant is emitted into the IL and checking fails. The following patch fixes that (and we optimize that & -1 away even earlier with that). Could you please just quickly try to apply this patch, make in the stage3 directory followed by make check-gcc RUNTESTFLAGS="... compile.exp='20070520-1.c ...'" (with all tests that regressed previously), whether this is the only spot or whether we need to fix some other place too? 2023-04-13 Jakub Jelinek * loop-iv.cc (iv_number_of_iterations): Use gen_int_mode instead of GEN_INT. Jakub --- gcc/loop-iv.cc.jj 2023-01-02 09:32:23.000000000 +0100 +++ gcc/loop-iv.cc 2023-04-13 15:34:11.939045804 +0200 @@ -2617,7 +2617,7 @@ iv_number_of_iterations (class loop *loo d *= 2; size--; } - bound = GEN_INT (((uint64_t) 1 << (size - 1 ) << 1) - 1); + bound = gen_int_mode (((uint64_t) 1 << (size - 1) << 1) - 1, mode); tmp1 = lowpart_subreg (mode, iv1.base, comp_mode); tmp = simplify_gen_binary (UMOD, mode, tmp1, gen_int_mode (d, mode));