For fixed SVE types, predicates are represented using vectors of i8,
where as for scalable types they are represented using vectors of i1. We
can avoid going through memory for casts between these by bitcasting the
i1 scalable vectors to/from a scalable i8 vector of matching size, which
can then use the existing vector insert/extract logic.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/CodeGen/CGExprScalar.cpp | ||
---|---|---|
2110–2128 | Don't we still need this for casting between vectors with different element types, or are these guaranteed to not hit this code path? |
clang/lib/CodeGen/CGExprScalar.cpp | ||
---|---|---|
2110–2128 |
Apologies I was wrong, you're right we'll still need it for casting between vectors with different element types to support lax vector conversions, although it's no longer tested. Might be worth adding a codegen test for ~: svint64_t lax_cast(fixed_int32_t t) { return t; } and the comment could also be updated |
clang/lib/CodeGen/CGExprScalar.cpp | ||
---|---|---|
2102 | I think this may also works for casting between vectors with different element types. |
clang/lib/CodeGen/CGExprScalar.cpp | ||
---|---|---|
2102 | A similar argument applies here as the other related ticket, in principal we could, however it's not clear that there is a good use case for writing code that would make use of this. So for now it's probably best to just deal with predicates which are definitely a problem and other cases as they arise. |
clang/lib/CodeGen/CGExprScalar.cpp | ||
---|---|---|
2102 | Although i believe this generates better code than using memory load/store. Thanks for explaining this. |
should const be dropped now the type might change?