[PATCH] D87974: [Builtin] Add __builtin_zero_non_value_bits.

Zoe Carver via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 7 19:21:18 PST 2020


zoecarver added a comment.

In D87974#2438682 <https://reviews.llvm.org/D87974#2438682>, @BillyONeal wrote:

>> Are they actually the same, with the same handling of corner cases like unions and tail padding?
>> There's more to this than just the name, and if they aren't the same, it seems better to have two names.
>
> They are both implementing the same C++ feature, with the same desired semantics of zeroing out any bits in the object representation that aren't in the value representation. If they differ, one or the other would have a bug.

I agree, they either need to be identical (including corner cases) or there needs to be two of them (i.e., GCC ships both `__builtin_zero_non_value_bits` and `__builtin_clear_padding` and the first is the same as MSVC, Clang, and NVCC).

>> Is there a specification for __builtin_zero_non_value_bits available somewhere?
>
> I don't know if there is a formal spec for it beyond the actual C++ standard.

I think P0528 is the relevant paper but other than that, no, there's not a spec. I think that's going to be the most time sensitive part of implementing this: coming up with the spec and making sure all the tests pass on all the implementations.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87974/new/

https://reviews.llvm.org/D87974



More information about the cfe-commits mailing list