This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add scheduler classes for the Zba and Zbb extensions.
ClosedPublic

Authored by craig.topper on Mar 21 2021, 10:34 AM.

Details

Summary

I've used IALU for the simplest operations from Zbb:
min, minu, max, maxu, sext.b, sext.h, zext.h, andn, orn, xnor

I've put add.uw in IALU32 and slli.uw in ShiftImm32.

Remaining instructions have received new classes.
All 3 sh*add are grouped together. sh*add.uw are grouped together.
Rotate left and right are together. Everything else got their own
class containing one instruction.

I think what I have here is the minimum granularity we need. I
could be convinced that we need more classes.

Diff Detail

Event Timeline

craig.topper created this revision.Mar 21 2021, 10:34 AM
craig.topper requested review of this revision.Mar 21 2021, 10:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 21 2021, 10:34 AM
Herald added a subscriber: MaskRay. · View Herald Transcript

This seems like a sensible level of granularity and reuse of existing resources.

llvm/lib/Target/RISCV/RISCVSchedRocket.td
177

Perhaps consider placing the resources for the B instructions when they are not supported in a separate file for convenient inclusion in targets which do not support it.

238

Ditto.

llvm/lib/Target/RISCV/RISCVSchedSiFive7.td
165

Ditto.

226

Ditto.

llvm/lib/Target/RISCV/RISCVSchedule.td
111

Perhaps consider putting the resources specific to the B instructions in a separate file.

craig.topper added inline comments.Mar 23 2021, 1:16 PM
llvm/lib/Target/RISCV/RISCVSchedRocket.td
177

I'm worried that starts becoming unmanageable. You would need a file per sub extension which will quickly pollute the directory.

Maybe we need a multiclass to instantiate instead?

jrtc27 added inline comments.Mar 23 2021, 1:54 PM
llvm/lib/Target/RISCV/RISCVInstrInfoB.td
246

Various missing spaces after commas in this file

llvm/lib/Target/RISCV/RISCVSchedRocket.td
177

That seems like a sensible solution to me; I was also thinking about this problem but hadn't yet got round to commenting

Add spaces after commas.
Add multiclass for unsupported subextensions

Separate the sched classes by Zba and Zbb for clarity.

craig.topper added inline comments.Mar 23 2021, 2:53 PM
llvm/lib/Target/RISCV/RISCVSchedSiFive7.td
271

I'll reword the Zfh above to use a multiclass if we like this for Zba/Zbb.

craig.topper added inline comments.Mar 23 2021, 2:59 PM
llvm/lib/Target/RISCV/RISCVSchedSiFive7.td
271

Err that was supposed to say "rework"

Add multiclass for unsupported subextensions

Cool!

Any other comments?

evandro accepted this revision.Mar 26 2021, 2:07 PM
This revision is now accepted and ready to land.Mar 26 2021, 2:07 PM