From patchwork Mon Jul 11 15:00:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 1654958 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=pSJQSKsW; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4LhRs73K32z9s09 for ; Tue, 12 Jul 2022 01:00:42 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ED767385735A for ; Mon, 11 Jul 2022 15:00:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ED767385735A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1657551640; bh=ZGegIEpx3yeqyh3rvzHX1ewlbnA02nzwXj6c6QmTHL8=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=pSJQSKsWefvVFoa0+oKnfbp+yilsFH4rLIHwpplIrL90EaEu4jgAKtfd/X7CmEj9r euEObKKaIJ2xRE1wBBE7L57j99LA60kXgpqysRtt0rF7fhzIf+0zlQQIFVcHT0joYx GgIqOpZtyg8K9Kx/u9K356olMBMhNYmweirBOWQ4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id E29393858D39 for ; Mon, 11 Jul 2022 15:00:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E29393858D39 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D5C051596 for ; Mon, 11 Jul 2022 08:00:15 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.37]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 194363F70D for ; Mon, 11 Jul 2022 08:00:14 -0700 (PDT) To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [committed] vect: Restore optab_vector argument [PR106250] Date: Mon, 11 Jul 2022 16:00:13 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Spam-Status: No, score=-54.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Sandiford via Gcc-patches From: Richard Sandiford Reply-To: Richard Sandiford Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" In g:76c3041b856cb0 I'd removed a "C ? optab_vector : optab_mixed_sign" argument from a call to directly_supported_p, thinking that the argument only existed because of the condition (which I was removing). But the difference between the scalar and vector forms matters for shifts, so we do still need the argument. Tested on aarch64-linux-gnu and pushed as obvious. Richard gcc/ PR tree-optimization/106250 * tree-vect-loop.cc (vectorizable_reduction): Reinstate final argument to directly_supported_p. --- gcc/testsuite/gcc.dg/vect/pr106250.c | 17 +++++++++++++++++ gcc/tree-vect-loop.cc | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/vect/pr106250.c diff --git a/gcc/testsuite/gcc.dg/vect/pr106250.c b/gcc/testsuite/gcc.dg/vect/pr106250.c new file mode 100644 index 00000000000..7f25f551869 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr106250.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ + +int +foo (unsigned long int x, int y, int z) +{ + int ret = 0; + + while (y < 1) + { + x *= 2; + ret = x == z; + z = y; + ++y; + } + + return ret; +} diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 3a70c15b593..2257b29a652 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -7369,7 +7369,7 @@ vectorizable_reduction (loop_vec_info loop_vinfo, dot-products. */ machine_mode vec_mode = TYPE_MODE (vectype_in); if (!lane_reduc_code_p - && !directly_supported_p (op.code, vectype_in)) + && !directly_supported_p (op.code, vectype_in, optab_vector)) { if (dump_enabled_p ()) dump_printf (MSG_NOTE, "op not supported by target.\n");