[LLVMdev] Signed i1?

Tim Northover t.p.northover at gmail.com
Wed Jun 18 08:21:28 PDT 2014


> What will be the result of MULHS on v32i1? This question may seem weird, but
> I just want to know if there is any LLVM convention on it.

Hypothetically (because I don't think that node would be created in
existing backends), I believe it would always be 0. There are, of
course, multiple ways to get that result:

1. The only valid values for a signed i1 are 0 and -1. Multiplying any
pair of these gives either 0 or 1, and neither of those integers has
bit 1 set, as a signed i2.
2. Sign extend i1 to i2, and the possible values are 0b00, 0b11.
Multiply them and you get 0b00 or 0b01 (from 0b1001 in full). The high
bits of both of those are 0.

I'm sure there are many other ways of thinking about it too.

Cheers.

Tim.



More information about the llvm-dev mailing list