This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add scalable offset under very large stack size.
ClosedPublic

Authored by HsiangKai on Apr 7 2021, 6:53 AM.

Details

Summary

If the stack size is larger than 12 bits, we have to use a scratch
register to store the stack size. Before we introduce the scalable stack
offset, we could simplify

%0 = ADDI %stack.0, 0

>

%scratch = ... # sequence of instructions to move the offset into %scratch
%0 = ADD %fp, %scratch

However, if the offset contains scalable part, we need to consider it.

%0 = ADDI %stack.0, 0

>

%scratch = ... # sequence of instructions to move the offset into %scratch
%scratch = ADD %fp, %scratch
%scalable_offset = ... # sequence of instructions for vscaled-offset.
%0 = ADD/SUB %scratch, %scalable_offset

Diff Detail

Event Timeline

HsiangKai created this revision.Apr 7 2021, 6:53 AM
HsiangKai requested review of this revision.Apr 7 2021, 6:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 7 2021, 6:53 AM

I think it makes sense to me, but it would be good to pre-commit this test to better see the fix.

HsiangKai updated this revision to Diff 335984.Apr 7 2021, 7:53 PM

I think it makes sense to me, but it would be good to pre-commit this test to better see the fix.

D100084

rogfer01 accepted this revision.Apr 7 2021, 10:57 PM

LGTM. Thanks @HsiangKai.

This revision is now accepted and ready to land.Apr 7 2021, 10:57 PM
StephenFan accepted this revision.Apr 7 2021, 11:15 PM