From patchwork Tue Dec 10 11:31:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 1207034 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-515592-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="OUK3Wd7X"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47XHvy2FMcz9sPh for ; Tue, 10 Dec 2019 22:31:58 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=aUE+8UZjtvZHN5EsezpidaggXp/4ydrLt5Rpu2xBxNOJpOyRGpj4N q8XVLQNv0laE6mp1uqi9mz1qJ+H3nSuV3k63kZHVZroN9XcYXMlxPjvw0WiFwQIW h8g9U7nGvwUmmHHLXdKTwSTUSGvexjY4k8/kfKzWWYsv7S4bab7c9s= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=v03t6c33b1FZNpJU1SriUDptoQg=; b=OUK3Wd7Xx/pmJVLVRqIO gc1BIR0i1bHfxkwNHqM0g/xgX2kH0VZYXpBVvE/43z4wO1Yl66NsQAZamJId5RNT i43gW4GMjemF0T0q3jGQHABTNTYLjpST58yDsDL54BKP8FgnnH+Z35YRXqZkVDcV 44eOsBSESeVWePCEHiCfExQ= Received: (qmail 119273 invoked by alias); 10 Dec 2019 11:31:50 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 119265 invoked by uid 89); 10 Dec 2019 11:31:50 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-9.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=filed X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.110.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Dec 2019 11:31:49 +0000 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 19E1B1FB for ; Tue, 10 Dec 2019 03:31:48 -0800 (PST) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.126]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B5FDF3F6CF for ; Tue, 10 Dec 2019 03:31:47 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [committed] Disallow EXTRACT_LAST_REDUCTION for reduction chains Date: Tue, 10 Dec 2019 11:31:46 +0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 X-IsSubscribed: yes gcc.dg/vect/vect-cond-reduc-5.c was ICEing for SVE because we tried to use an extract-last reduction for a chain of COND_EXPRs. Adding support for the chained case would be too invasive for stage 3 so this patch explicitly forbids it instead. I've filed PR92884 for the possible future work. Tested on aarch64-linux-gnu and x86_64-linux-gnu, applied as obvious. Richard 2019-12-10 Richard Sandiford gcc/ * tree-vect-loop.c (vectorizable_reduction): Don't use EXTRACT_LAST_REDUCTION for chained reductions. Index: gcc/tree-vect-loop.c =================================================================== --- gcc/tree-vect-loop.c 2019-12-06 10:31:12.558424757 +0000 +++ gcc/tree-vect-loop.c 2019-12-10 11:30:16.014189041 +0000 @@ -6196,8 +6196,9 @@ vectorizable_reduction (stmt_vec_info st return false; } - if (direct_internal_fn_supported_p (IFN_FOLD_EXTRACT_LAST, - vectype_in, OPTIMIZE_FOR_SPEED)) + if (reduc_chain_length == 1 + && direct_internal_fn_supported_p (IFN_FOLD_EXTRACT_LAST, + vectype_in, OPTIMIZE_FOR_SPEED)) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,