[ARM] Fix ReconstructShuffle for bigendian
authorDavid Green <david.green@arm.com>
Wed, 12 Feb 2020 20:51:39 +0000 (20:51 +0000)
committerDavid Green <david.green@arm.com>
Thu, 13 Feb 2020 09:56:46 +0000 (09:56 +0000)
commit9d4c59754110647f8cc8cdd4fef3114843c91d17
tree695c0f28b47a442d87436a9ec707e41502aba47c
parent6505124a0c7c648560aad88bac103b0738a8b5f0
[ARM] Fix ReconstructShuffle for bigendian

Simon pointed out that this function is doing a bitcast, which can be
incorrect for big endian. That makes the lowering of VMOVN in MVE
wrong, but the function is shared between Neon and MVE so both can
be incorrect.

This attempts to fix things by using the newly added VECTOR_REG_CAST
instead of the BITCAST. As it may now be used on Neon, I've added the
relevant patterns for it there too. I've also added a quick dag combine
for it to remove them where possible.

Differential Revision: https://reviews.llvm.org/D74485
llvm/lib/Target/ARM/ARMISelLowering.cpp
llvm/lib/Target/ARM/ARMInstrInfo.td
llvm/lib/Target/ARM/ARMInstrMVE.td
llvm/lib/Target/ARM/ARMInstrNEON.td
llvm/test/CodeGen/ARM/neon-vmovn.ll
llvm/test/CodeGen/Thumb2/mve-vmovn.ll