i386: Fix V2SF horizontal add/subtract insns
authorUros Bizjak <ubizjak@gmail.com>
Wed, 27 May 2020 19:46:49 +0000 (21:46 +0200)
committerUros Bizjak <ubizjak@gmail.com>
Wed, 27 May 2020 19:46:49 +0000 (21:46 +0200)
commit1852a26b925970f64f8d31518ba732fe9c3ade23
treefab03c36683cb5d424488e73cfa1be1d5a3ee39f
parentc949ec9c4e88d2ff6dbd5b179abddf3703129577
i386: Fix V2SF horizontal add/subtract insns

PFPNACC insn is incorrectly modelled to perform addition and subtraction
of two operands, but in reality it performs horizontal addition and
subtraction:

Instruction: PFPNACC dest,src

Description:
dest[31:0] <- dest[31:0] - dest[63:32];
dest[63:32] <- src[31:0] + src[63:32];

Also, it is not possible to directly replace PFACC with HADDPS and PFNACC
with HSUBPS, because operands in the second word do not match.

PFACC does:

dest[31..0] <- dest[31..0] + dest[63..32];
dest[63..32] <- src[31..0] + src [63..32];

while HADDPS does:

dest[31..0] <-  dest[31..0]  +  dest[63..32];
dest[63..32] <- dest[127..96] + dest[95..64];
dest[95..64] <- src [31..0]  +  src [64..32];
dest[127:96] <- src [127..96] + src [95..64];

2020-05-27  Uroš Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog:
* config/i386/mmx.md (*mmx_haddv2sf3): Remove SSE alternatives.
(mmx_hsubv2sf3): Ditto.
(mmx_haddsubv2sf3): New expander.
(*mmx_haddsubv2sf3): Rename from mmx_addsubv2sf3. Correct
RTL template to model horizontal subtraction and addition.
* config/i386/i386-builtin.def (IX86_BUILTIN_PFPNACC):
Update for rename.
gcc/config/i386/i386-builtin.def
gcc/config/i386/mmx.md