1. [RISCV] Add implementation of targetShrinkDemandedConstant to optimize AND immediates. (details)
Commit 86e604c4d68528478333a8901d7c79c09ca16fa8 by craig.topper
[RISCV] Add implementation of targetShrinkDemandedConstant to optimize AND immediates.

SimplifyDemandedBits can remove set bits from immediates from instructions
like AND/OR/XOR. This can prevent them from being efficiently
codegened on RISCV.

This adds an initial version that tries to keep or form 12 bit
sign extended immediates for AND operations to enable use of ANDI.
If that doesn't work we'll try to create a 32 bit sign extended immediate
to use LUI+ADDIW.

More optimizations are possible for different size immediates or
different operations. But this is a good starting point that already
has test coverage.

Reviewed By: frasercrmck

Differential Revision:
The file was modifiedllvm/test/CodeGen/RISCV/frame-info.ll
The file was modifiedllvm/test/CodeGen/RISCV/half-bitmanip-dagcombines.ll
The file was modifiedllvm/test/CodeGen/RISCV/vararg.ll
The file was modifiedllvm/test/CodeGen/RISCV/srem-lkk.ll
The file was modifiedllvm/test/CodeGen/RISCV/copysign-casts.ll
The file was modifiedllvm/lib/Target/RISCV/RISCVISelLowering.h
The file was modifiedllvm/test/CodeGen/RISCV/rv64Zbp.ll
The file was modifiedllvm/lib/Target/RISCV/RISCVISelLowering.cpp
The file was modifiedllvm/test/CodeGen/RISCV/srem-vector-lkk.ll
The file was modifiedllvm/test/CodeGen/RISCV/stack-realignment-with-variable-sized-objects.ll