[PATCH] D90905: [RISCV] Add an ANDI to shift amount of FSL/FSR instructions

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 5 23:10:01 PST 2020


craig.topper created this revision.
craig.topper added reviewers: asb, lewis-revill, luismarques, lenary, frasercrmck, PaoloS.
Herald added subscribers: NickHung, evandro, apazos, sameer.abuasal, pzheng, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya.
Herald added a project: LLVM.
craig.topper requested review of this revision.
Herald added a subscriber: MaskRay.

The fshl and fshr intrinsics are defined to modulo their shift amount by the bitwidth of one of their inputs. The FSR/FSL instructions read one extra bit from the shift amount. If that bit is set the inputs are swapped. In order to preserve the semantics of the llvm intrinsics we need to make sure that the extra bit isn't set. DAG combine or instcombine may have removed any mask that was originally present.

We could be smarter here and try to use computeKnownBits to check if the bit is known zero, but wanted to start with correctness.


https://reviews.llvm.org/D90905

Files:
  llvm/lib/Target/RISCV/RISCVInstrInfoB.td
  llvm/test/CodeGen/RISCV/rv32Zbt.ll
  llvm/test/CodeGen/RISCV/rv64Zbt.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90905.303337.patch
Type: text/x-patch
Size: 5375 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201106/a97ab1f2/attachment.bin>


More information about the llvm-commits mailing list