I’m just wondering, is there any signed i1?
I found two operations, ISD::MULHU and ISD::MULHS - Multiply high - Multiply two integers of type iN, producing an unsigned/signed value of type i[2*N], then return the top part.
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.
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.