[InstCombine] Matrix multiplication negation optimisation
authorZain Jaffal <z_jaffal@apple.com>
Tue, 20 Sep 2022 18:45:02 +0000 (19:45 +0100)
committerFlorian Hahn <flo@fhahn.com>
Tue, 20 Sep 2022 18:50:39 +0000 (19:50 +0100)
commit68cc35d52cff2d8345c6dffbed0d1b36b20f824f
treeb6273e9423354cb86bb38935c4e25844e47ff309
parent28e03692aef8842e6c1d8f06647cb9a4b88b69a7
[InstCombine] Matrix multiplication negation optimisation

If one of the operands in a matrix multiplication is negated we can optimise the equation by moving the negation to the smallest element of the operands or the result.

Reviewed By: spatel, fhahn

Differential Revision: https://reviews.llvm.org/D133300
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/test/Transforms/InstCombine/matrix-multiplication-negation.ll