]> git.ipfire.org Git - thirdparty/gcc.git/commit
MIPS: Fix wrong MSA FP vector negation
authorXi Ruoyao <xry111@xry111.site>
Fri, 2 Feb 2024 19:35:07 +0000 (03:35 +0800)
committerXi Ruoyao <xry111@xry111.site>
Mon, 5 Feb 2024 11:41:08 +0000 (19:41 +0800)
commit4d7fe3cf82505b45719356a2e51b1480b5ee21d6
tree3b3526b01b68a23ac7eb058a561a8f0c629494b9
parent42959acb8409c39e1c71c43528832611c3b71e25
MIPS: Fix wrong MSA FP vector negation

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.
(neg<mode>2): Change the mode iterator from MSA to IMSA because
in FP arithmetic we cannot use (0 - x) for -x.
(neg<mode>2): New define_insn to implement FP vector negation,
using a bnegi instruction to negate the sign bit.
gcc/config/mips/mips-msa.md