[MIPS] For vectors, select `add %x, C` as `sub %x, -C` if it results in inline immediate
authorRoman Lebedev <lebedev.ri@gmail.com>
Wed, 18 Sep 2019 19:34:41 +0000 (19:34 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Wed, 18 Sep 2019 19:34:41 +0000 (19:34 +0000)
commitec6b91b6655a92d02c88e942d83366004575a234
treef5d76c6f1d139a691081f48a56b48ae353f1bbec
parent260b6949040985b8c315d080b8e197d0ddcc5dec
[MIPS] For vectors, select `add %x, C` as `sub %x, -C` if it results in inline immediate

Summary:
As discussed in https://reviews.llvm.org/D62341#1515637,
for MIPS `add %x, -1` isn't optimal. Unlike X86 there
are no fastpaths to matearialize such `-1`/`1` vector constants,
and `sub %x, 1` results in better codegen,
so undo canonicalization

Reviewers: atanasyan, Petar.Avramovic, RKSimon

Reviewed By: atanasyan

Subscribers: sdardis, arichardson, hiraditya, jrtc27, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D66805

llvm-svn: 372254
llvm/lib/Target/Mips/MipsISelDAGToDAG.cpp
llvm/lib/Target/Mips/MipsISelDAGToDAG.h
llvm/test/CodeGen/Mips/msa/arithmetic.ll