This is an archive of the discontinued LLVM Phabricator instance.

[SveEmitter] Add builtins for svdup and svindex
ClosedPublic

Authored by sdesmalen on May 4 2020, 12:34 PM.

Diff Detail

Event Timeline

sdesmalen created this revision.May 4 2020, 12:34 PM
efriedma added inline comments.May 4 2020, 1:26 PM
clang/include/clang/Basic/arm_sve.td
1071–1075

"Implemented using tbl" isn't really a helpful comment.

I guess you're doing it this way so the lane doesn't have to be a constant? (And then I guess you can optimize it in the backend.)

clang/lib/CodeGen/CGBuiltin.cpp
8093

The select might not be the best approach. I mean, it's semantically correct, but the backend currently doesn't know how to lower a select like that. And even if it did, it's probably better to avoid generating it for now.

Maybe this should use whilelo directly, since that's what the backend would eventually use anyway.

sdesmalen marked 2 inline comments as done.May 5 2020, 1:15 PM
sdesmalen added inline comments.
clang/include/clang/Basic/arm_sve.td
1071–1075

Yes that's right. I can probably clarify the comment a bit more.

clang/lib/CodeGen/CGBuiltin.cpp
8093

but the backend currently doesn't know how to lower a select like that

Yes I noticed, that was the reason for D79356 (added as parent revision)

And even if it did, it's probably better to avoid generating it for now.

Is that because there are common optimisations on the select? I thought it would be safe to use the 'full vector' form of select where the predicate is a scalar (and both operands are splats)

efriedma added inline comments.May 5 2020, 1:39 PM
clang/lib/CodeGen/CGBuiltin.cpp
8093

Yes, the idea would just be to avoid common optimizations. Maybe there aren't that many vector optimizations on a select with a scalar condition, though. If it isn't blowing up, I guess it's fine.

sdesmalen updated this revision to Diff 263258.May 11 2020, 1:07 PM
  • Use llvm.aarch64.sve.dup.x for svdup_n_b
sdesmalen marked 3 inline comments as done.May 11 2020, 1:07 PM
This revision is now accepted and ready to land.May 11 2020, 3:23 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMay 12 2020, 3:43 AM