RyuJIT: x*2 -> x+x; x*1 -> x (fp) (#33024)
authorEgor Bogatov <egorbo@gmail.com>
Wed, 6 May 2020 19:00:31 +0000 (22:00 +0300)
committerGitHub <noreply@github.com>
Wed, 6 May 2020 19:00:31 +0000 (12:00 -0700)
commit5abde010ed0a53f196bba11cd18e839e9a0ce5fa
tree0a3d63cb52f4342a6214ea4f0d5d9673a705303a
parent87f7afa0ae356678485e8a9cb51ea0cd07c84c47
RyuJIT:  x*2 -> x+x; x*1 -> x (fp) (#33024)

* Optimize "x * 2" to "x + x" for floats

* Add tests

* Fix typo

* Address feedback

* Move to morph.cpp, also add "x*1" optimization

* clean up

* clean up

* update op2

* Fix incorrect "fgMakeMultiUse" usage

* update op1

* Address feedback

* Add opts.OptimizationEnabled()
src/coreclr/src/jit/morph.cpp
src/coreclr/tests/src/JIT/opt/InstructionCombining/MulToAdd.cs [new file with mode: 0644]
src/coreclr/tests/src/JIT/opt/InstructionCombining/MulToAdd.csproj [new file with mode: 0644]