This is an archive of the discontinued LLVM Phabricator instance.

[Sema][SVE] Allow casting SVE types to themselves in C
ClosedPublic

Authored by rsandifo-arm on Mar 24 2020, 4:53 AM.

Details

Summary

Casts from an SVE type to itself aren't very useful, but they are
supposed to be valid, and could occur in things like macro expansions.

Such casts already work for C++ and are tested by sizeless-1.cpp.
This patch makes them work for C too.

Diff Detail

Event Timeline

rsandifo-arm created this revision.Mar 24 2020, 4:53 AM
Herald added a project: Restricted Project. · View Herald Transcript

Is it not legal to cast an SVE type to any type other than itself?

Is it not legal to cast an SVE type to any type other than itself?

Not in normal length-agnostic mode. Instead we provide reinterpret intrinsics for type changes that are supposed to be bitcasts and conversion intrinsics for type changes that are supposed to be arithmetic operations. The types are really just opaque blobs that hold the inputs to and outputs from intrinsics.

For length-specific mode, we eventually want to allow casts to and from equivalent "normal" fixed-length vector types. Those conversions would also be implicit, so that fixed-length vectors of the right type and length can be used directly with intrinsics.

efriedma accepted this revision.Mar 24 2020, 8:24 PM

Okay, then LGTM.

This revision is now accepted and ready to land.Mar 24 2020, 8:24 PM
This revision was automatically updated to reflect the committed changes.