On Thu, 29 Jun 2023, Richard Biener wrote:

The thing with signed bools is that the two relevant values are -1 (true)
and 0 (false), those are used for vector bool components where we also
need them to be of wider type (32bits in this case).

My main confusion comes from seeing IR doing arithmetic such as

  <signed-boolean:32> _127;
  <signed-boolean:32> _169;
  ...
  _169 = _127 + -1;

or

  <signed-boolean:32> _127;
  <signed-boolean:32> _169;
  ...
  _169 = -_127;

and it was unclear to me what kind of arithmetic is allowed.

I have now verified that all cases seems to be just one operation of this form (where _127 has the value 0 or 1), so it cannot construct values such as 42. But the wide signed Boolean can have the three different values 1, 0, and -1, which I still think is at least one too many. :)

I'll update my tool to complain if the value is outside the range [-1, 1].

  /Krister

Reply via email to