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: 196791 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp837523dyb; Mon, 5 Feb 2024 04:26:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IEDQ4El1ahjsvEOOqc4oimQ17XWTYlWUJTWmYkDU2lIDFgad9aPozBAG0hJLyMKAmqCh17f X-Received: by 2002:a25:694d:0:b0:dc6:aeba:5aaf with SMTP id e74-20020a25694d000000b00dc6aeba5aafmr8356258ybc.19.1707135972389; Mon, 05 Feb 2024 04:26:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707135972; cv=pass; d=google.com; s=arc-20160816; b=V3GqNd53+wSgOYrZS4RVE83FY4RRDRdN3WQUEH0Vu4z/VPhDiESIIHHVUL9Ni3ymIQ yoadBFvelNNt7DIlsSMSyEWFXbtHwxDchRZEzKyMsY8tdEmVHUBD60n57IJyYSTY9unO lh7nALc0BbuQsXdsbIuUUvs5V6MY6r6ZWcFy6qtnTl/69PIIUfBmoP3/zUjA9552K/l0 mo4okvRtqCk8rvf4i1D1rXhjnNItDhYmne+JrkyuEW+fC+5eNAIQ9+q+lOeDfgU7dyly 7XaodTd+q5M2UF/pHLM96/Yf9N03zqcLq2BIl/TffMbtqsIsf9RonAyAUwRc5SNuPV+6 4VgA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mime-version:user-agent :content-transfer-encoding:autocrypt:references:in-reply-to:date:cc :to:from:subject:message-id:dkim-signature:arc-filter:dmarc-filter :delivered-to; bh=yfeLieenVnWcrCB9CToB+RceI6eKipRaPuqH7sJ2IUE=; fh=apcBYqHFipHxf2HqyPG85FgUsUAN6Sjv/TV0+3WldOY=; b=nMDukbahKl6JukvPY14AgAmBpltEA2UKjym/vEtISpSiiR7X1yOArQelc5E2WEUDne TujFiTNsHwaK+0VnlucpQZpIx0/HLkzHy71iWyAMjErKWJEzVtY/7mohi2drLaIeW1K4 tV24q7E7poerDhDpiRNf9WlHaItVBcZJj+mFz2ytq8X4wbUGZ5t9/p7NUvSDOzD4WSZc 30FofOwIrXpbAz8ZHgEdG3A49sWAA4N1PZFSDqmmHAnROmdZpiakMsKHKX8Zz/3elBMg YKdpE398RfaAfVf5JT/kwPpzuJOuyVjjFehxAuIHi81c1dyvi4spBxhUTavGCu0wi+2e xtNQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=YNg6Wipz; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site X-Forwarded-Encrypted: i=1; AJvYcCWkiSpWZlb93tdiwnLaT4s7Cnp7u61fUFdKX5BenbEoPhHf7M4f9ZdgTj/BCmOY0MvNTZqLWbBkr5B0Y7ytmk29IwlAzw== Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id z8-20020a0cfec8000000b0068c7a23fd9dsi8102385qvs.185.2024.02.05.04.26.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 04:26:12 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=YNg6Wipz; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 17B9A3858413 for ; Mon, 5 Feb 2024 12:26:12 +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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790061809634454725 X-GMAIL-MSGID: 1790061809634454725 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")