[AVR] Optimize 32-bit shift: move bytes around
authorAyke van Laethem <aykevanlaethem@gmail.com>
Tue, 6 Dec 2022 12:58:08 +0000 (13:58 +0100)
committerAyke van Laethem <aykevanlaethem@gmail.com>
Sun, 8 Jan 2023 19:05:31 +0000 (20:05 +0100)
commit8f8afabd32092590a81e10e11e0a2c8b24e09b76
tree996381a656ae01afbade29cc6b1f08cf1afa84a1
parent840d10a1d2c939016f387a041b0fbb3a9d592b17
[AVR] Optimize 32-bit shift: move bytes around

This patch optimizes 32-bit constant shifts by renaming registers. This
is very effective as the compiler would otherwise need to do a lot of
single bit shift instructions. Instead, the registers are renamed at the
SSA level which means the register allocator will insert the necessary
mov instructions.

Unfortunately, the register allocator will insert some unnecessary movs
with the current code. This will be fixed in a later patch.

Differential Revision: https://reviews.llvm.org/D140570
llvm/lib/Target/AVR/AVRISelLowering.cpp
llvm/test/CodeGen/AVR/shift32.ll