This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Optimize immediate materialisation with BSETI/BCLRI
ClosedPublic

Authored by benshi001 on Oct 10 2021, 6:04 AM.

Details

Summary

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.

Diff Detail

Event Timeline

benshi001 created this revision.Oct 10 2021, 6:04 AM
benshi001 requested review of this revision.Oct 10 2021, 6:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 10 2021, 6:04 AM
benshi001 updated this revision to Diff 378668.Oct 11 2021, 8:03 AM
craig.topper added inline comments.Oct 11 2021, 9:40 AM
llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp
208

BCLI -> BCLRI

215

cprresponding -> corresponding

benshi001 marked 2 inline comments as done.
benshi001 updated this revision to Diff 378968.Oct 12 2021, 4:29 AM
craig.topper added inline comments.Oct 12 2021, 9:59 AM
llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp
218

Can we build the bits from low to hi instead of hi to low?

benshi001 updated this revision to Diff 379242.Oct 12 2021, 6:16 PM
This comment was removed by benshi001.
benshi001 edited the summary of this revision. (Show Details)Oct 12 2021, 6:17 PM
benshi001 set the repository for this revision to rG LLVM Github Monorepo.
benshi001 edited the summary of this revision. (Show Details)
benshi001 updated this revision to Diff 379247.Oct 12 2021, 6:45 PM
benshi001 marked an inline comment as done.
craig.topper added inline comments.Oct 13 2021, 10:03 AM
llvm/lib/Target/RISCV/MCTargetDesc/RISCVMatInt.cpp
226

"32-bit" -> "32 bits"

"32-bit is" -> "32 bits are"

32-bit with a hyphen refers to a 32-bit architecture. Your just talking about number of bits here so no hyphen.

227

32-bit -> 32 bits

228

32-bit is -> 32 bits are

benshi001 updated this revision to Diff 379573.Oct 13 2021, 6:09 PM
benshi001 edited the summary of this revision. (Show Details)
benshi001 marked 3 inline comments as done.
benshi001 updated this revision to Diff 379595.Oct 13 2021, 8:13 PM
This revision is now accepted and ready to land.Oct 13 2021, 9:47 PM