This is an archive of the discontinued LLVM Phabricator instance.

[clang] Implement constexpr bit_cast for vectors
Needs ReviewPublic

Authored by DaPorkchop_ on Aug 13 2023, 2:03 PM.

Details

Summary

This makes __builtin_bit_cast support converting to and from vector types in a constexpr context.

Without this patch, attempting to use std::bit_cast with a vector type will fail to compile with a message such as:
constexpr bit_cast involving type '__attribute__((__vector_size__(4 * sizeof(int)))) int const' (vector of 4 'int' values) is not yet supported

Diff Detail

Event Timeline

DaPorkchop_ created this revision.Aug 13 2023, 2:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 13 2023, 2:03 PM
DaPorkchop_ requested review of this revision.Aug 13 2023, 2:03 PM