]> 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:42:22 +0000 (19:42 +0800)
commit410f9bfde56b05aa48fbca2606ca045afb92199b
tree9e012f4fb86bd999bdb9b1fa450860b7416678f2
parent78b8d256e1c89214625fd7a42c0b99719b750aff
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.

(cherry picked from commit 4d7fe3cf82505b45719356a2e51b1480b5ee21d6)
gcc/config/mips/mips-msa.md