[RISCV] Optimize immediate materialisation with BSETI/BCLRI
commit7e815261267727b1a7138e7135225c482541c677
authorBen Shi <powerman1st@163.com>
Thu, 14 Oct 2021 03:10:33 +0000 (14 03:10 +0000)
committerBen Shi <powerman1st@163.com>
Thu, 14 Oct 2021 04:56:47 +0000 (14 04:56 +0000)
tree93f9b91364c142c4d85dbf35e7e20fd9b2227313
parente567f37dabc242cb02fb8b8b288fd05a0aebfb8f
[RISCV] Optimize immediate materialisation with BSETI/BCLRI

Opitimize immediate materialisation in the following way if profitable:
1. Use BCLRI for upper 32 bits if the lower 32 bits are negative int32.
2. Use BSETI for upper 32 bits if the lower 32 bits are positive int32.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D111508
llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp
llvm/test/CodeGen/RISCV/imm.ll
llvm/test/MC/RISCV/rv64zbs-aliases-valid.s