arc: Use separate predicated patterns for mpyd(u)
authorClaudiu Zissulescu <claziss@gmail.com>
Tue, 28 Jul 2020 10:15:48 +0000 (13:15 +0300)
committerClaudiu Zissulescu <claziss@synopsys.com>
Fri, 11 Dec 2020 16:13:53 +0000 (18:13 +0200)
commitf7ad4446274831234e5acd3506fd2e01c7594c6a
tree0c119c203adee9865e604e7b763e9bff5380f6a5
parent078c7498908d9b74caff34d12099b5c85470e277
arc: Use separate predicated patterns for mpyd(u)

The compiler can match mpyd.eq r0,r1,r0 as a predicated instruction,
which is incorrect. The mpyd(u) instruction takes as input two 32-bit
registers, returning into a double 64-bit even-odd register pair.  For
the predicated case, the ARC instruction decoder expects the
destination register to be the same as the first input register. In
the big-endian case the result is swaped in the destination register
pair, however, the instruction encoding remains the same.  Refurbish
the mpyd(u) patterns to take into account the above observation.

gcc/
2020-12-11  Claudiu Zissulescu  <claziss@synopsys.com>

* config/arc/arc.md (mpyd<su_optab>_arcv2hs): New template
pattern.
(*pmpyd<su_optab>_arcv2hs): Likewise.
(*pmpyd<su_optab>_imm_arcv2hs): Likewise.
(mpyd_arcv2hs): Moved into above template.
(mpyd_imm_arcv2hs): Moved into above template.
(mpydu_arcv2hs): Likewise.
(mpydu_imm_arcv2hs): Likewise.
(su_optab): New optab prefix for sign/zero-extending operations.

gcc/testsuite/
2020-12-11  Claudiu Zissulescu  <claziss@synopsys.com>

* gcc.target/arc/pmpyd.c: New test.
* gcc.target/arc/tmac-1.c: Update.

Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
gcc/config/arc/arc.md
gcc/testsuite/gcc.target/arc/pmpyd.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arc/tmac-1.c