[GISel] Add new GISel combiners for G_MUL
authorAditya Nandakumar <aditya_nandakumar@apple.com>
Tue, 15 Sep 2020 23:06:55 +0000 (16:06 -0700)
committerAditya Nandakumar <aditya_nandakumar@apple.com>
Tue, 15 Sep 2020 23:08:47 +0000 (16:08 -0700)
commit97203cfd6bae0388f9dd22ddca592737324a2c72
treeac8bd4eb0b45d5d516cdffa4fe12db5a2a104f50
parent61fc10d6a520f267e11009ce8fce88d73615796b
[GISel] Add new GISel combiners for G_MUL

https://reviews.llvm.org/D87668

Patch adds two new GICombinerRules, one for G_MUL(X, 1) and another for G_MUL(X, -1).
G_MUL(X, 1) is an identity combine, and G_MUL(X, -1) gets replaced with G_SUB(0, X).
Patch additionally adds new combiner tests for the AArch64 target to test these
new combiner rules, as well as updates AMDGPU GISel tests.

Patch by mkitzan
llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
llvm/include/llvm/Target/GlobalISel/Combine.td
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
llvm/test/CodeGen/AArch64/GlobalISel/combine-mul.mir [new file with mode: 0644]