From patchwork Mon Feb 5 12:25:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Xi Ruoyao X-Patchwork-Id: 1895259 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=xry111.site header.i=@xry111.site header.a=rsa-sha256 header.s=default header.b=YNg6Wipz; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; 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 [8.43.85.97]) (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 4TT5FQ5l4Jz23gT for ; Mon, 5 Feb 2024 23:25:46 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AC2D3385829B for ; Mon, 5 Feb 2024 12:25:43 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from xry111.site (xry111.site [89.208.246.23]) by sourceware.org (Postfix) with ESMTPS id A72EE3858409; Mon, 5 Feb 2024 12:25:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A72EE3858409 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xry111.site ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A72EE3858409 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=89.208.246.23 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707135924; cv=none; b=xr39DQYGdn497aJUHIN6eIc71bK8e2xlwv77BsmzrS7KJ7oe+MsViw98kdAoh+NhFee9ZB6pLR1RSMdNGrIj/NABI0rLy6Kbv0rWJSwyxR3BLJNmhsLkibni/GUpe3mL2X3De99CzpvL5mG/Lhfrs9qGPBFx8gCdnpBAj0dCLgs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707135924; c=relaxed/simple; bh=Oj0A+sAoPwkz/WmdF0e8JTglxo8ZYFyzfhiuZf+ol88=; h=DKIM-Signature:Message-ID:Subject:From:To:Date:MIME-Version; b=M2YKjTRCfIox8rVIuqN8eJvreUGcGgZ3kbrk3hrgwZLlhAbdOqSWaxflpS0FfZa7kVUZVb2XKE5R0DcZqqatdZIk93/G/xrC9uI4w00pvqGOmsZ/a4ISVeoX61X5tCc0ff8qzo2jDAmMr40wn4M9f8aA4j13omI+L2c6p9VVR7k= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1707135921; bh=Oj0A+sAoPwkz/WmdF0e8JTglxo8ZYFyzfhiuZf+ol88=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=YNg6Wipzbs6QpPWM2ENMsvzLqUphqf5C/wMfKzW6eKMRunLvHywpTXOaXIsO28pOD U0ufgmpwyaEdJnRLXgZkv+LOboXmNJAdvaeDZtq7n0tthwO9lQGnLu8SqHsKHba0jN 1VgItCqfCAN1JI6KGXpdcrkCuDmUWIeRhyJnXfZE= Received: from [127.0.0.1] (unknown [IPv6:2001:470:683e::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 2BED166D7C; Mon, 5 Feb 2024 07:25:19 -0500 (EST) Message-ID: <1e966ed29e33be7f0c53513633abd6eba8185cdd.camel@xry111.site> Subject: Pushed: [PATCH] MIPS: Fix wrong MSA FP vector negation From: Xi Ruoyao To: YunQiang Su Cc: gcc-patches@gcc.gnu.org, Jeff Law Date: Mon, 05 Feb 2024 20:25:17 +0800 In-Reply-To: References: <20240204180106.468674-1-xry111@xry111.site> Autocrypt: addr=xry111@xry111.site; prefer-encrypt=mutual; keydata=mDMEYnkdPhYJKwYBBAHaRw8BAQdAsY+HvJs3EVKpwIu2gN89cQT/pnrbQtlvd6Yfq7egugi0HlhpIFJ1b3lhbyA8eHJ5MTExQHhyeTExMS5zaXRlPoiTBBMWCgA7FiEEkdD1djAfkk197dzorKrSDhnnEOMFAmJ5HT4CGwMFCwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQrKrSDhnnEOPHFgD8D9vUToTd1MF5bng9uPJq5y3DfpcxDp+LD3joA3U2TmwA/jZtN9xLH7CGDHeClKZK/ZYELotWfJsqRcthOIGjsdAPuDgEYnkdPhIKKwYBBAGXVQEFAQEHQG+HnNiPZseiBkzYBHwq/nN638o0NPwgYwH70wlKMZhRAwEIB4h4BBgWCgAgFiEEkdD1djAfkk197dzorKrSDhnnEOMFAmJ5HT4CGwwACgkQrKrSDhnnEOPjXgD/euD64cxwqDIqckUaisT3VCst11RcnO5iRHm6meNIwj0BALLmWplyi7beKrOlqKfuZtCLbiAPywGfCNg8LOTt4iMD User-Agent: Evolution 3.50.3 MIME-Version: 1.0 X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, LIKELY_SPAM_FROM, SPF_HELO_PASS, SPF_PASS, 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 On Mon, 2024-02-05 at 09:56 +0800, YunQiang Su wrote: > Xi Ruoyao 于2024年2月5日周一 02:01写道: > > > > We expanded (neg x) to (minus const0 x) for MSA FP vectors, this is > > wrong because -0.0 is not 0 - 0.0.  This causes some Python tests to > > fail when Python is built with MSA enabled. > > > > Use the bnegi.df instructions to simply reverse the sign bit instead. > > > > gcc/ChangeLog: > > > >          * config/mips/mips-msa.md (elmsgnbit): New define_mode_attr. > >          (neg2): Change the mode iterator from MSA to IMSA because > >          in FP arithmetic we cannot use (0 - x) for -x. > >          (neg2): New define_insn to implement FP vector negation, > >          using a bnegi instruction to negate the sign bit. > > --- > > > > Bootstrapped and regtested on mips64el-linux-gnuabi64.  Ok for trunk > > and/or release branches? > > > >   gcc/config/mips/mips-msa.md | 18 +++++++++++++++--- > >   1 file changed, 15 insertions(+), 3 deletions(-) > > > > LGTM, while I guess that we also need a test case. Pushed to trunk and release branches, with a following obvious fix: I'll write a test case for gcc.dg/vect later (now I have to do $SOME_REAL_LIFE_THING...) diff --git a/gcc/config/mips/mips-msa.md b/gcc/config/mips/mips-msa.md index 920161ed1d8..779157f2a0c 100644 --- a/gcc/config/mips/mips-msa.md +++ b/gcc/config/mips/mips-msa.md @@ -613,7 +613,7 @@ (define_expand "neg2" (define_insn "neg2" [(set (match_operand:FMSA 0 "register_operand" "=f") - (neg (match_operand:FMSA 1 "register_operand" "f")))] + (neg:FMSA (match_operand:FMSA 1 "register_operand" "f")))] "ISA_HAS_MSA" "bnegi.\t%w0,%w1," [(set_attr "type" "simd_bit")