From patchwork Thu Aug 15 08:53:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 1147496 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-507024-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="Anf7RGXJ"; 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 468Kwq4vJvz9sN6 for ; Thu, 15 Aug 2019 18:53:15 +1000 (AEST) 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=TCuP9Ck4QqVrP3rQ7KCsUGaOsw+smxVek7rYJS4zTsRuTpHv4YtE9 ebec7DDuZYlsETPh2n4w8ivS9QfeLZ+Ct36f9uMTA2ltZ8auMk8sjpY57KyDZMnG dgx/BbzqauxkH4XN9GYuyT+O5C26FJkwqXKXavpoV8SRfKwDJjnUiE= 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=Y4Af2twOqkmhJKTlv7IOwhpEPh0=; b=Anf7RGXJPEElGi5wlMkk nFFanoR/UhFQpq9xNBMgsVCMvP/5RV5okvTRaGIaMhzIprFKafKqlQHNXZGC+NDO zLb1ae7Fjc7TsEZCJdDYZEXNDdVPPcbYgPFCb2RRzKAmMu5UP1BjBZC3hbUN0r5t EesDzxLKOqXVBFrmmiy4Sqk= Received: (qmail 118821 invoked by alias); 15 Aug 2019 08:53:08 -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 118813 invoked by uid 89); 15 Aug 2019 08:53:07 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-8.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=svpattern_token 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; Thu, 15 Aug 2019 08:53:06 +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 8146828 for ; Thu, 15 Aug 2019 01:53:04 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.99.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 285AB3F706 for ; Thu, 15 Aug 2019 01:53:04 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [committed][AArch64] Pass a pattern to aarch64_output_sve_cnt_immediate Date: Thu, 15 Aug 2019 09:53:03 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 X-IsSubscribed: yes This patch makes us always pass an explicit vector pattern to aarch64_output_sve_cnt_immediate, rather than assuming it's ALL. The ACLE patches need to be able to pass in other values. Tested on aarch64-linux-gnu (with and without SVE) and aarch64_be-elf. Applied as r274520. Richard 2019-08-15 Richard Sandiford gcc/ * config/aarch64/aarch64.c (aarch64_output_sve_cnt_immediate): Take the vector pattern as an aarch64_svpattern argument. Update the overloaded caller accordingly. (aarch64_output_sve_scalar_inc_dec): Update call accordingly. (aarch64_output_sve_vector_inc_dec): Likewise. Index: gcc/config/aarch64/aarch64.c =================================================================== --- gcc/config/aarch64/aarch64.c 2019-08-15 09:49:56.159207559 +0100 +++ gcc/config/aarch64/aarch64.c 2019-08-15 09:52:08.670229990 +0100 @@ -2902,16 +2902,17 @@ aarch64_sve_cnt_immediate_p (rtx x) operand (a vector pattern followed by a multiplier in the range [1, 16]). PREFIX is the mnemonic without the size suffix and OPERANDS is the first part of the operands template (the part that comes before the - vector size itself). FACTOR is the number of quadwords. - NELTS_PER_VQ, if nonzero, is the number of elements in each quadword. - If it is zero, we can use any element size. */ + vector size itself). PATTERN is the pattern to use. FACTOR is the + number of quadwords. NELTS_PER_VQ, if nonzero, is the number of elements + in each quadword. If it is zero, we can use any element size. */ static char * aarch64_output_sve_cnt_immediate (const char *prefix, const char *operands, + aarch64_svpattern pattern, unsigned int factor, unsigned int nelts_per_vq) { - static char buffer[sizeof ("sqincd\t%x0, %w0, all, mul #16")]; + static char buffer[sizeof ("sqincd\t%x0, %w0, vl256, mul #16")]; if (nelts_per_vq == 0) /* There is some overlap in the ranges of the four CNT instructions. @@ -2924,12 +2925,16 @@ aarch64_output_sve_cnt_immediate (const factor >>= shift; unsigned int written; - if (factor == 1) + if (pattern == AARCH64_SV_ALL && factor == 1) written = snprintf (buffer, sizeof (buffer), "%s%c\t%s", prefix, suffix, operands); + else if (factor == 1) + written = snprintf (buffer, sizeof (buffer), "%s%c\t%s, %s", + prefix, suffix, operands, svpattern_token (pattern)); else - written = snprintf (buffer, sizeof (buffer), "%s%c\t%s, all, mul #%d", - prefix, suffix, operands, factor); + written = snprintf (buffer, sizeof (buffer), "%s%c\t%s, %s, mul #%d", + prefix, suffix, operands, svpattern_token (pattern), + factor); gcc_assert (written < sizeof (buffer)); return buffer; } @@ -2939,7 +2944,8 @@ aarch64_output_sve_cnt_immediate (const PREFIX is the mnemonic without the size suffix and OPERANDS is the first part of the operands template (the part that comes before the vector size itself). X is the value of the vector size operand, - as a polynomial integer rtx. */ + as a polynomial integer rtx; we need to convert this into an "all" + pattern with a multiplier. */ char * aarch64_output_sve_cnt_immediate (const char *prefix, const char *operands, @@ -2947,7 +2953,7 @@ aarch64_output_sve_cnt_immediate (const { poly_int64 value = rtx_to_poly_int64 (x); gcc_assert (aarch64_sve_cnt_immediate_p (value)); - return aarch64_output_sve_cnt_immediate (prefix, operands, + return aarch64_output_sve_cnt_immediate (prefix, operands, AARCH64_SV_ALL, value.coeffs[1], 0); } @@ -2971,10 +2977,10 @@ aarch64_output_sve_scalar_inc_dec (rtx o poly_int64 offset_value = rtx_to_poly_int64 (offset); gcc_assert (offset_value.coeffs[0] == offset_value.coeffs[1]); if (offset_value.coeffs[1] > 0) - return aarch64_output_sve_cnt_immediate ("inc", "%x0", + return aarch64_output_sve_cnt_immediate ("inc", "%x0", AARCH64_SV_ALL, offset_value.coeffs[1], 0); else - return aarch64_output_sve_cnt_immediate ("dec", "%x0", + return aarch64_output_sve_cnt_immediate ("dec", "%x0", AARCH64_SV_ALL, -offset_value.coeffs[1], 0); } @@ -3079,11 +3085,11 @@ aarch64_output_sve_vector_inc_dec (const if (!aarch64_sve_vector_inc_dec_immediate_p (x, &factor, &nelts_per_vq)) gcc_unreachable (); if (factor < 0) - return aarch64_output_sve_cnt_immediate ("dec", operands, -factor, - nelts_per_vq); + return aarch64_output_sve_cnt_immediate ("dec", operands, AARCH64_SV_ALL, + -factor, nelts_per_vq); else - return aarch64_output_sve_cnt_immediate ("inc", operands, factor, - nelts_per_vq); + return aarch64_output_sve_cnt_immediate ("inc", operands, AARCH64_SV_ALL, + factor, nelts_per_vq); } static int