Page MenuHomePhabricator

[Clang] Allow "vector_size" applied to Booleans
Needs ReviewPublic

Authored by simoll on Jun 3 2020, 4:29 AM.

Details

Summary

This patch extends Clang to allow 'bool' as a valid vector element type (attribute vector_size).

This is the natural type for SIMD masks and facilitates clean vector intrinsic declarations.
Vectors of i1 are supported on IR level and below down to many SIMD ISAs, such as AVX512, ARM SVE (fixed vector length) and the VE target (NEC SX-Aurora TSUBASA).

The RFC on cfe-dev: https://lists.llvm.org/pipermail/cfe-dev/2020-May/065434.html

Diff Detail

Event Timeline

simoll created this revision.Jun 3 2020, 4:29 AM
simoll updated this revision to Diff 268140.Jun 3 2020, 4:36 AM

NFC. Undid stray change.

simoll marked 2 inline comments as done.Jun 4 2020, 2:56 AM
simoll added inline comments.
clang/lib/CodeGen/CGExprScalar.cpp
4710

Accidental change. Will undo.

clang/lib/CodeGen/CGRecordLayoutBuilder.cpp
590 ↗(On Diff #268140)

This is an old comment that is no longer helpful. Will remove.

lenary added a subscriber: lenary.Jun 4 2020, 7:04 AM
lenary added inline comments.
clang/docs/LanguageExtensions.rst
473

It would be nice if this aside about non-bool vectors was more prominently displayed - it's something I hadn't realised before.

simoll marked an inline comment as done.Jun 4 2020, 7:08 AM
simoll added inline comments.
clang/docs/LanguageExtensions.rst
473

Yep. that caught me by surprise too. I'll move that sentence to the paragraph about GCC vectors above.

simoll updated this revision to Diff 268488.Jun 4 2020, 8:28 AM
  • Improved documentation for the size argument of vector_size.
  • Rebased
lenary removed a subscriber: lenary.Jun 9 2020, 2:51 AM