This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][SVE] Add patterns to generate ADR instruction
ClosedPublic

Authored by mnadeem on Sep 12 2021, 3:21 PM.

Details

Summary

Patterns for:

  • adr z0.s, [z0.s, z0.s, lsl #<shift>]
  • adr z0.d, [z0.d, z0.d, lsl #<shift>]
  • adr z0.d, [z0.d, z0.d, uxtw #<shift>]
  • adr z0.d, [z0.d, z0.d, sxtw #<shift>]

Did not add a pattern for

  • adr z0.s, [z0.s, z0.s]
  • adr z0.d, [z0.d, z0.d]

Diff Detail

Event Timeline

mnadeem created this revision.Sep 12 2021, 3:21 PM
mnadeem requested review of this revision.Sep 12 2021, 3:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 12 2021, 3:21 PM
paulwalker-arm added inline comments.Sep 14 2021, 8:21 AM
llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
1214

Sorry I've fallen a bit behind on code reviews but will take a proper look later. I did want to raise that we now have SVEAllActive that can be used instead of AArch64ptrue 31 with the former catching more cases, looking through reinterprets for example.

Matt added a subscriber: Matt.Sep 16 2021, 1:22 PM
mnadeem updated this revision to Diff 373377.Sep 17 2021, 5:00 PM

Use SVEAllActive

mnadeem marked an inline comment as done.Sep 17 2021, 5:00 PM
paulwalker-arm accepted this revision.Sep 21 2021, 2:37 AM

Just a few missing tests but otherwise looks good.

llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
1222–1224

These patterns are missing tests. I suspect it's not worth the trouble trying to write a getelementptr based test given the i32 based addresses but doing the arithmetic explicitly in IR is good enough.

This revision is now accepted and ready to land.Sep 21 2021, 2:37 AM
This revision was automatically updated to reflect the committed changes.
mnadeem marked an inline comment as done.Sep 21 2021, 3:57 PM
mnadeem added inline comments.
llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
1222–1224

Thanks for pointing that out.
I added the tests in a new file llvm/test/CodeGen/AArch64/sve-adr.ll and also fixed the type for lsl's constant, which should have been i32 for S-form adr z0.s, [z0.s, z0.s, lsl #<shift>]

mnadeem marked an inline comment as done.Sep 21 2021, 3:57 PM