[PATCH] D92089: [PowerPC] Materialize i64 constants by enumerated patterns.

EsmeYi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 6 19:06:50 PST 2020


Esme marked 3 inline comments as done.
Esme added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:861
+    unsigned LiOpcode = LiImm ? PPC::LIS8 : PPC::LI8;
+    Result = CurDAG->getMachineNode(LiOpcode, dl, MVT::i64, getI32Imm(LiImm));
+    return CurDAG->getMachineNode(PPC::ORI8, dl, MVT::i64, SDValue(Result, 0),
----------------
steven.zhang wrote:
> The logic here is not quite right. If the High 16 bits of the Imm is zero, you still produce the LI which is not needed.
> The logic here is not quite right. If the High 16 bits of the Imm is zero, you still produce the LI which is not needed.

Consider an immediate which is uint<16> but not int<16>, where the High 16 bits is zero but we can't use a single `LI` to handle it. For example 0x8003, we have to use 2 instructions to materialize it, i.e. 

```
	li 3, 0
	ori 3, 3, 32771
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92089/new/

https://reviews.llvm.org/D92089



More information about the llvm-commits mailing list