From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681393542; 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:in-reply-to:in-reply-to: references:references; bh=0ekTp3qScEiHTUqqzuLIGI4farSVqggDgUWQiUNEiPs=; b=ap8+hmXkbQAlDo8MuE1zbpc9hVJbOAvS3HuzzJNBL0NE3r/9wMeZkvBvRpBU/81BXxMQG1 IG2RjUQU6k18oRWQSJ58F5MXQF8nHY57lQr9TLVBhBAPYxoBlh7OJtZZr4f9uaqHkWdU6T S/weGDfQAasMx6HJ/OakKri2M/J14ZQ= 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 From: Jakub Jelinek 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: Reply-To: Jakub Jelinek 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-Type: text/plain; charset=us-ascii 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 List-Id: 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. --- 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)); Jakub