From patchwork Tue Jan 24 13:40:46 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: 1731213 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=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.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=Qjx/Cxsx; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P1Smc0txVz23hB for ; Wed, 25 Jan 2023 00:41:18 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 764353858407 for ; Tue, 24 Jan 2023 13:41:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 764353858407 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674567675; bh=3QGJAXYtK+tW0LNnCY0ebjy0ZLztxcc2Ur43PhtITYI=; h=Date:Subject:To:References:Cc:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=Qjx/CxsxhjN4KecrKSlBLhwIptJG18eVCDHrB4dPdYO8MlTSEoRLwy0x0QuMaFYQX 2CRDnZ43vNEuFvIoYPZcYJKuJutXIEb2pNsKAoOTsCva8PJusYNP42Tzx1Qj6ZZJnG v3B3P/MOBmW9Ik0dMdzO04Vot33W1AA+XhIe3pwY= 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 BDA0F3858D1E for ; Tue, 24 Jan 2023 13:40:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BDA0F3858D1E 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 362474B3; Tue, 24 Jan 2023 05:41:36 -0800 (PST) Received: from [10.57.75.149] (unknown [10.57.75.149]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AC7233F71E; Tue, 24 Jan 2023 05:40:53 -0800 (PST) Message-ID: Date: Tue, 24 Jan 2023 13:40:46 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: [PATCH 1/3] arm: Fix sign of MVE predicate mve_pred16_t [PR 107674] Content-Language: en-US To: "gcc-patches@gcc.gnu.org" References: <13d03aef-f5d1-03fe-5281-31921d24dce0@arm.com> Cc: Kyrylo Tkachov , Richard Earnshaw In-Reply-To: <13d03aef-f5d1-03fe-5281-31921d24dce0@arm.com> X-Spam-Status: No, score=-16.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, SPF_HELO_NONE, SPF_NONE, TXREP 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: "Andre Vieira \(lists\) via Gcc-patches" From: "Andre Vieira (lists)" Reply-To: "Andre Vieira \(lists\)" Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi, The ACLE defines mve_pred16_t as an unsigned short. This patch makes sure GCC treats the predicate as an unsigned type, rather than signed. Bootstrapped on aarch64-none-eabi and regression tested on arm-none-eabi and armeb-none-eabi for armv8.1-m.main+mve.fp. OK for trunk? gcc/ChangeLog: PR target/107674 * config/arm/arm-builtins.cc (arm_simd_builtin_type): Rewrite to use new qualifiers parameter and use unsigned short type for MVE predicate. (arm_init_builtin): Call arm_simd_builtin_type with qualifiers parameter. (arm_init_crypto_builtins): Likewise. gcc/testsuite/ChangeLog: PR target/107674 * gcc.target/arm/mve/mve_vpt.c: New test. diff --git a/gcc/config/arm/arm-builtins.cc b/gcc/config/arm/arm-builtins.cc index 11d7478d9df69139802a9d42c09dd0de7480b60e..6c67cec93ff76a4b42f3a0b305f697142e88fcd9 100644 --- a/gcc/config/arm/arm-builtins.cc +++ b/gcc/config/arm/arm-builtins.cc @@ -1489,12 +1489,14 @@ arm_lookup_simd_builtin_type (machine_mode mode, } static tree -arm_simd_builtin_type (machine_mode mode, bool unsigned_p, bool poly_p) +arm_simd_builtin_type (machine_mode mode, enum arm_type_qualifiers qualifiers) { - if (poly_p) + if ((qualifiers & qualifier_poly) != 0) return arm_lookup_simd_builtin_type (mode, qualifier_poly); - else if (unsigned_p) + else if ((qualifiers & qualifier_unsigned) != 0) return arm_lookup_simd_builtin_type (mode, qualifier_unsigned); + else if ((qualifiers & qualifier_predicate) != 0) + return unsigned_intHI_type_node; else return arm_lookup_simd_builtin_type (mode, qualifier_none); } @@ -1755,9 +1757,7 @@ arm_init_builtin (unsigned int fcode, arm_builtin_datum *d, else { eltype - = arm_simd_builtin_type (op_mode, - (qualifiers & qualifier_unsigned) != 0, - (qualifiers & qualifier_poly) != 0); + = arm_simd_builtin_type (op_mode, qualifiers); gcc_assert (eltype != NULL); /* Add qualifiers. */ @@ -1929,10 +1929,10 @@ static void arm_init_crypto_builtins (void) { tree V16UQI_type_node - = arm_simd_builtin_type (V16QImode, true, false); + = arm_simd_builtin_type (V16QImode, qualifier_unsigned); tree V4USI_type_node - = arm_simd_builtin_type (V4SImode, true, false); + = arm_simd_builtin_type (V4SImode, qualifier_unsigned); tree v16uqi_ftype_v16uqi = build_function_type_list (V16UQI_type_node, V16UQI_type_node, diff --git a/gcc/testsuite/gcc.target/arm/mve/mve_vpt.c b/gcc/testsuite/gcc.target/arm/mve/mve_vpt.c new file mode 100644 index 0000000000000000000000000000000000000000..26a565b79dd1348e361b3aa23a1d6e6d13bffce8 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/mve_vpt.c @@ -0,0 +1,27 @@ +/* { dg-options "-O2" } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-add-options arm_v8_1m_mve } */ +/* { dg-final { check-function-bodies "**" "" } } */ +#include +void test0 (uint8_t *a, uint8_t *b, uint8_t *c) +{ + uint8x16_t va = vldrbq_u8 (a); + uint8x16_t vb = vldrbq_u8 (b); + mve_pred16_t p = vcmpeqq_u8 (va, vb); + uint8x16_t vc = vaddq_x_u8 (va, vb, p); + vstrbq_p_u8 (c, vc, p); +} +/* +** test0: +** vldrb.8 q2, \[r0\] +** vldrb.8 q1, \[r1\] +** vcmp.i8 eq, q2, q1 +** vmrs r3, p0 @ movhi +** uxth r3, r3 +** vmsr p0, r3 @ movhi +** vpst +** vaddt.i8 q3, q2, q1 +** vpst +** vstrbt.8 q3, \[r2\] +** bx lr +*/