Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion clang/docs/LanguageExtensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -635,11 +635,12 @@ C and C++. For example:
return v;
}


Boolean vectors are a Clang extension of the ext vector type. Boolean vectors
are intended, though not guaranteed, to map to vector mask registers. The size
parameter of a boolean vector type is the number of bits in the vector. The
boolean vector is dense and each bit in the boolean vector is one vector
element.
element. Query for this feature with ``__has_feature(ext_vector_type_boolean)``.

The semantics of boolean vectors borrows from C bit-fields with the following
differences:
Expand Down
1 change: 1 addition & 0 deletions clang/include/clang/Basic/Features.def
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ FEATURE(attribute_overloadable, true)
FEATURE(attribute_unavailable_with_message, true)
FEATURE(attribute_unused_on_fields, true)
FEATURE(attribute_diagnose_if_objc, true)
FEATURE(ext_vector_type_boolean, true)
FEATURE(blocks, LangOpts.Blocks)
FEATURE(c_thread_safety_attributes, true)
FEATURE(cxx_exceptions, LangOpts.CXXExceptions)
Expand Down
4 changes: 4 additions & 0 deletions clang/test/SemaCXX/vector-bool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,7 @@ void Sizeof() {
static_assert(sizeof(Bool195) == 32);
static_assert(sizeof(Bool257) == 64);
}

#if !__has_feature(ext_vector_type_boolean)
#error "FAIL"
#endif