[mips] Fix lowering a signed immediate for *.d MSA instructions
authorSimon Atanasyan <simon@atanasyan.com>
Fri, 29 Mar 2019 15:15:22 +0000 (15:15 +0000)
committerSimon Atanasyan <simon@atanasyan.com>
Fri, 29 Mar 2019 15:15:22 +0000 (15:15 +0000)
commitf26f56d6d3d6506fe888f9894bcc270ed7db07c5
tree7754453d4f80633b1f4c6743526925ddcc71f635
parent4d81e877657a08007b95a839a8125cc1d9a8e00c
[mips] Fix lowering a signed immediate for *.d MSA instructions

The `lowerMSASplatImm` function zero-extends `i32` immediates while
building constant. If target type is `i64`, negative immediate loses
the sign. As a result, for example `__builtin_msa_ldi_d(-1)` lowered
to series of instruction loads incorrect value 0xffffffff to the `$w0`
register instead of single `ldi.d $w0, -1` instruction.

The fix zero-extends unsigned immediates and signed-extend signed
immediates.

Differential Revision: http://reviews.llvm.org/D59884

llvm-svn: 357264
llvm/lib/Target/Mips/MipsSEISelLowering.cpp
llvm/test/CodeGen/Mips/msa/i10.ll
llvm/test/CodeGen/Mips/msa/i5-c.ll
llvm/test/CodeGen/Mips/msa/i5-m.ll