]> git.ipfire.org Git - thirdparty/gcc.git/commit
LoongArch: Fix wrong LSX FP vector negation
authorXi Ruoyao <xry111@xry111.site>
Fri, 2 Feb 2024 19:16:14 +0000 (03:16 +0800)
committerXi Ruoyao <xry111@xry111.site>
Sun, 4 Feb 2024 14:57:47 +0000 (22:57 +0800)
commitaa33570033fb642f2e25326cd67f98e70f199533
tree5f0679ab64445a4ed6b832099ec1ebb4b67d9987
parent829b26328aebca167083f4cf81ca69f7d906e704
LoongArch: Fix wrong LSX FP vector negation

We expanded (neg x) to (minus const0 x) for LSX 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 LSX enabled.

Use the vbitrevi.{d/w} instructions to simply reverse the sign bit
instead.  We are already doing this for LASX and now we can unify them
into simd.md.

gcc/ChangeLog:

* config/loongarch/lsx.md (neg<mode:FLSX>2): Remove the
incorrect expand.
* config/loongarch/simd.md (simdfmt_as_i): New define_mode_attr.
(elmsgnbit): Likewise.
(neg<mode:FVEC>2): New define_insn.
* config/loongarch/lasx.md (negv4df2, negv8sf2): Remove as they
are now instantiated in simd.md.
gcc/config/loongarch/lasx.md
gcc/config/loongarch/lsx.md
gcc/config/loongarch/simd.md