From patchwork Wed Feb 17 14:17:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Andre Vieira (lists)" X-Patchwork-Id: 1441252 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=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: 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=lx7mA2x8; dkim-atps=neutral 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 (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dgg012C7bz9sBJ for ; Thu, 18 Feb 2021 01:17:20 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5F931389681A; Wed, 17 Feb 2021 14:17:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5F931389681A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1613571436; bh=I3dArB8/MV2LuUQc3aC9l2nI1uYWMQ2X0SxuGxSQLYE=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=lx7mA2x8Wv8PuzkK9Q+4FaXVu+MYTZoOhqVCbriXUcvetKtyQyW1zkpo18OhcHlsT i/I+J5P97enkZgAvFLisWs63VCT5tZAYU+IofNOuAn9hMXi5GOL975DkS0EZXmtSXj 7XtCSXDG2MWJyotVSVFSpaiP6QBWsyLfTaipbAx8= 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 989BE385780C for ; Wed, 17 Feb 2021 14:17:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 989BE385780C 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 0BC8CED1; Wed, 17 Feb 2021 06:17:13 -0800 (PST) Received: from [10.57.9.213] (unknown [10.57.9.213]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7701F3F73B; Wed, 17 Feb 2021 06:17:12 -0800 (PST) To: "gcc-patches@gcc.gnu.org" Subject: [AArch64] PR98657: Fix vec_duplicate creation in SVE's 3 Message-ID: <4202239f-f0aa-98ea-4655-94a08ef3c978@arm.com> Date: Wed, 17 Feb 2021 14:17:10 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 Content-Language: en-US X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, BODY_8BITS, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_NUMSUBJECT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: "Andre Vieira \(lists\) via Gcc-patches" From: "Andre Vieira (lists)" Reply-To: "Andre Vieira \(lists\)" Cc: Richard Sandiford Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" Hi, This patch prevents generating a vec_duplicate with illegal predicate. Regression tested on aarch64-linux-gnu. OK for trunk? gcc/ChangeLog: 2021-02-17  Andre Vieira          PR target/98657         * config/aarch64/aarch64-sve.md: Use 'expand_vector_broadcast' to emit vec_duplicate's         in '3' pattern. gcc/testsuite/ChangeLog: 2021-02-17  Andre Vieira          PR target/98657         * gcc.target/aarch64/sve/pr98657.c: New test. diff --git a/gcc/config/aarch64/aarch64-sve.md b/gcc/config/aarch64/aarch64-sve.md index 608319600318974b414e47285ee1474b041f0e05..7db2938bb84e04d066a7b07574e5cf344a3a8fb6 100644 --- a/gcc/config/aarch64/aarch64-sve.md +++ b/gcc/config/aarch64/aarch64-sve.md @@ -4549,10 +4549,8 @@ (define_expand "3" } else { - amount = gen_reg_rtx (mode); - emit_insn (gen_vec_duplicate (amount, - convert_to_mode (mode, - operands[2], 0))); + amount = convert_to_mode (mode, operands[2], 0); + amount = expand_vector_broadcast (mode, amount); } emit_insn (gen_v3 (operands[0], operands[1], amount)); DONE; diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr98657.c b/gcc/testsuite/gcc.target/aarch64/sve/pr98657.c new file mode 100644 index 0000000000000000000000000000000000000000..592af25d7bbc69bc05823d27358f07cd741dbe20 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/pr98657.c @@ -0,0 +1,9 @@ +/* PR target/98657 */ +/* { dg-do compile } */ +/* { dg-options "-O3 -msve-vector-bits=256" } */ +extern char a[]; +void b(_Bool c[][18]) { + int d; + for (int e = 0; e < 23; e++) + a[e] = 6 >> c[1][d]; +}