This is an archive of the discontinued LLVM Phabricator instance.

[clang][AArch64][SVE] Avoid going through memory for VLAT <-> VLST casts
ClosedPublic

Authored by joechrisellis on Dec 7 2020, 6:37 AM.

Details

Summary

This change makes use of the llvm.vector.extract intrinsic to avoid
going through memory when performing bitcasts between vector-length
agnostic types and vector-length specific types.

Depends on D91362

Diff Detail

Event Timeline

joechrisellis created this revision.Dec 7 2020, 6:37 AM
joechrisellis requested review of this revision.Dec 7 2020, 6:37 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptDec 7 2020, 6:37 AM
joechrisellis added subscribers: aeubanks, c-rhodes.

Adding reviewers @c-rhodes and @aeubanks because git blame tells me they've touched the surrounding code. 🙂

aeubanks resigned from this revision.Dec 11 2020, 8:37 AM

I'm unfamiliar with this code

c-rhodes accepted this revision.Dec 15 2020, 10:36 AM

Left a couple of nits but mostly LGTM, cheers

clang/lib/CodeGen/CGExprScalar.cpp
2025–2057

nit: it might be worth adding a comment stating we need to keep this around for casting between predicates, until we figure out a better way of doing that. The insert/extract intrinsics you've added require the element type to be identical and we represent fixed predicates with i8, whereas scalable predicates are represented as <vscale x 16 x i1>.

llvm/include/llvm/IR/IRBuilder.h
925–941

/// Create a call to the experimental.vector.extract intrinsic.

932

/// Create a call to the experimental.vector.insert intrinsic.

This revision is now accepted and ready to land.Dec 15 2020, 10:36 AM

Address @c-rhodes's comments.

  • Add a comment stating that we intend to eliminate going through memory when the element types of the vectors are not the same (for example, with predicates).
  • Doc comments for the new methods in IRBuilder.h.
This revision was landed with ongoing or failed builds.Dec 16 2020, 4:24 AM
This revision was automatically updated to reflect the committed changes.