[LLVMdev] i1 Values

dag at cray.com dag at cray.com
Thu Feb 5 13:28:07 PST 2015


Micah Villmow <micah.villmow at softmachines.com> writes:

> I can see two reasons for it:
>
> 1) An integer way to represent -0 and +0 from the floating point domain.
> 2) unsigned i1 represents 0 and 1(via unsigned values being in the
> range 0 -> (2^N) - 1, but a signed i1 represents [-]0 and -1(via
> signed values being in the range -2^(N-1) -> 2^(N-1) - 1.  This could
> be important when promoting to large integers and determining if sign
> or zero extension is needed.

Right.  As Nick noted, APInt doesn't provide any information to a user
to know whether sign- or zero-extension is appropriate.  This makes
debugging hard as callers can't simply assert that the value is signed
or unsigned.

Not that I want to add state to APInt but it could be helpful in some
cases to carry information about an APInt's intended signedness for
debugging purposes.  As it is now I have to check every user of APInt to
make sure it's doing the right thing.

Probably there's no good solution for this but it's something to ponder.

                            -David



More information about the llvm-dev mailing list