From patchwork Fri Nov 3 19:08:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Andre Vieira (lists)" X-Patchwork-Id: 1859104 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SMVdq0gHBz1yQ4 for ; Sat, 4 Nov 2023 06:08:45 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AE27A3858438 for ; Fri, 3 Nov 2023 19:08:42 +0000 (GMT) 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 64FE23858D39 for ; Fri, 3 Nov 2023 19:08:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 64FE23858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 64FE23858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699038512; cv=none; b=c9BBWN2Q4CNmFnsIOn4+iPeB+x/CL/TX4MpxXhUNz1v55xqZOkxlTIf1lxXftxtACX0y45YsZrvfFWjQHgEoidjUfp5xegOtPiQSsKDp+tspEz7gzBiqI46WSrTBk5LVjKBKt2TgKpLljaq+D5rF3lIYvp/ZB+gYLz1tDxcgm6M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699038512; c=relaxed/simple; bh=HY9Z2JKZc+6eDPol3uDcyUxRFHUKujYa2YUqLdXbK7k=; h=Message-ID:Date:MIME-Version:To:From:Subject; b=qV0epb4dONai1vo+BtrhSIJcdIEqXJjpPkf5uTz4/shhlpU59Q9ACCUQkB32Ce58/hN0tq38zHLD9j5+CeCPpDRk9Lidhbg570dp/uuHtNrkRZkvhdUf3W1Agz81faJ1ROaDAq9DNlNGcTdKYpKeL62uz2IXEorQnzJOrRxSmMk= ARC-Authentication-Results: i=1; server2.sourceware.org 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 88EEE2F4; Fri, 3 Nov 2023 12:09:04 -0700 (PDT) Received: from [10.57.72.147] (unknown [10.57.72.147]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 038273F738; Fri, 3 Nov 2023 12:08:20 -0700 (PDT) Message-ID: <91d3f8ee-8b2c-4866-a3ed-beb2953b5438@arm.com> Date: Fri, 3 Nov 2023 19:08:18 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: "gcc-patches@gcc.gnu.org" Cc: Richard Sandiford , Richard Biener , "jakub@redhat.com" From: "Andre Vieira (lists)" Subject: [RFC] vect: disable multiple calls of poly simdclones X-Spam-Status: No, score=-13.5 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Hi, The current codegen code to support VF's that are multiples of a simdclone simdlen rely on BIT_FIELD_REF to create multiple input vectors. This does not work for non-constant simdclones, so we should disable using such clones when the VF is a multiple of the non-constant simdlen until we change the codegen to support those. Enabling SVE simdclone support will cause ICEs if the vectorizer decides to use a SVE simdclone with a VF that is larger than the simdlen. I'll be away for the next two weeks, so cant' really discuss this further. I initially tried to solve the problem, but the way vectorizable_simd_clone_call is structured doesn't make it easy to replace BIT_FIELD_REF with the poly-suitable solution right now of using unpack_{hi,lo}. Unfortunately I only found this now as I was adding further tests for SVE :( gcc/ChangeLog: * tree-vect-stmts.cc (vectorizable_simd_clone_call): Reject simdclones with non-constant simdlen when VF is not exactly the same. diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index 5f262cae2aae784e3ef4fd07455b7aa742797b51..dc3e0716161838aef66cf37342499006673336d6 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -4165,7 +4165,10 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info, if (!constant_multiple_p (vf * group_size, n->simdclone->simdlen, &num_calls) || (!n->simdclone->inbranch && (masked_call_offset > 0)) - || (nargs != simd_nargs)) + || (nargs != simd_nargs) + /* Currently we do not support multiple calls of non-constant + simdlen as poly vectors can not be accessed by BIT_FIELD_REF. */ + || (!n->simdclone->simdlen.is_constant () && num_calls != 1)) continue; if (num_calls != 1) this_badness += exact_log2 (num_calls) * 4096;