This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Materialize the immediate that is Uint32 but not Int32.
AbandonedPublic

Authored by Esme on Sep 30 2020, 1:11 AM.

Details

Reviewers
nemanjai
steven.zhang
jsji
shchenz
lkail
qiucf
Group Reviewers
Restricted Project
Summary

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

Diff Detail

Event Timeline

Esme created this revision.Sep 30 2020, 1:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 30 2020, 1:11 AM
Esme requested review of this revision.Sep 30 2020, 1:11 AM
amyk added a subscriber: amyk.Oct 1 2020, 3:34 PM
amyk added inline comments.
llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
918

s/doen't/doesn't

s/fits/fits in

s/which means/this means

Esme planned changes to this revision.Nov 13 2020, 12:43 AM
Esme abandoned this revision.Nov 25 2020, 6:03 PM

Patch D92089 can cover this.