[PATCH] D88538: [PowerPC] Materialize the immediate that is Uint32 but not Int32.

EsmeYi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 30 01:11:38 PDT 2020


Esme created this revision.
Esme added reviewers: nemanjai, steven.zhang, jsji, shchenz, lkail, qiucf, PowerPC.
Herald added subscribers: llvm-commits, kbarton, hiraditya.
Herald added a project: LLVM.
Esme requested review of this revision.

If the immediate doen't fit int32 but fits uint32, which means the sign bit is 1. If we use LI/LIS to load the high bits, LIS/LI will sign-extend the value, where an extra clrldi is necessary. However if its low bits fits int16, we can use LI to load the low bits then handle the high bits.
For example, currently we need 3 instructions for `i32 -394967296`

  	lis 3, 232
  	ori 3, 3, 30023
  	sldi 3, 3, 8

After this patch we get,

  	li 3, 18176
  	oris 3, 3, 59509


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88538

Files:
  llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
  llvm/test/CodeGen/PowerPC/aix-cc-abi.ll
  llvm/test/CodeGen/PowerPC/constants-i64.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88538.295195.patch
Type: text/x-patch
Size: 5643 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200930/c74907f8/attachment.bin>


More information about the llvm-commits mailing list