On Fri Nov 3 13:11:37 2023 +0000, Giovanni Mascellani wrote:
I'm quite confused, you mean that `itof` on bools is used to indicate that `true` must be mapped to `-1.0` and something else (maybe `utof`?) is used to indicate that `true` must be mapped to `1.0`? That looks like a very peculiar operation, that I wouldn't overload on `itof`. What's the alternative op expected here? Also, is there anything already that generates `itof` on bools? If not, like it seems to me, than that should be introduced before adding this code, so it is not dead.
It makes an odd kind of sense. LLVM treats bool as a 1-bit int, so a signed bool has only a sign bit, and `true` is `-1`. I could add a new instruction, but `spirv_compiler_emit_alu_instruction()` must handle bool anyway, so I see no issue in treating bool as a 1-bit int and passing it to numeric handlers.
Also, is there anything already that generates `itof` on bools?
`CAST_SITOFP` supports bool and maps to `ITOF`.