[cfe-dev] [RFC] Opt-in vector of bool type

Simon Moll via cfe-dev cfe-dev at lists.llvm.org
Fri May 15 06:16:23 PDT 2020


On 5/14/20 6:23 PM, Richard Sandiford wrote:
> FWIW, this would also be useful for SVE predicates when generating
> fixed-length code.
Yes, i imagine that a lot of SIMD/vector targets would benefit from this.

> It's convenient that both GCC and clang reject boolean element types
> as thing stand, e.g.:
>
>     typedef bool foo __attribute__((vector_size(32)));
>
> I think this means that it should be possible to treat packed boolean
> vectors as a pure extension to what exists today.  Compatibility with
> older compilers shouldn't be a concern, it would just be a new feature.
>
> GCC is a moving target too, and I don't know of any reason in principle
> why GCC would never support this.  A lot of the necessary plumbing
> already exists.
>
> So far the principle has been that vector_size should work the same
> way regardless of the current target, with the compiler deciding
> how best to implement the code.  I think it would be good to follow
> that for any extension too, rather than making the feature opt-in and
> introducing a new target dependency.

I have to say i am pleasantly surprised by the positive feedback for
this proposal :) If there are no principal reservations against going
ahead with this, i'll submit a patch on Phabricator that enables 'bool'
in vector_size by default for all targets, so, basically a revert of:

    commit 8c9795d9fa94a7478d18e3906dff2408f379e8d9
    Author: Aaron Ballman <aaron at aaronballman.com>
    Date:   Fri Sep 13 20:43:08 2013 +0000

        vector_size cannot be applied to Booleans.  Updated the semantic
checking logic, as well as the comment and added a test case.  Fixes PR12649
   
        llvm-svn: 190721

We can flesh out the details during review.

Thanks
- Simon


More information about the cfe-dev mailing list