add_ternary() casts the condition to bool _if_ it's scalar, but not otherwise. That's kind of incidental, since the main point there was to match the shape.
Oh, you are right. Sorry, I should have paid more attention. Please ignore my previous argumentation. Going back to your example:
1/7 looks wrong. I haven't checked, but won't it do the wrong thing if we have something like
const int x = 0x80000000; return x ? 1 : 0;
So, integers and bools are represented internally as float in SM1, so a reinterpret has no real effect (doesn't emit any instruction) besides avoiding the "SM1 non-float expression" fixme in d3dbc. I think that emitting this fixme is correct for ABS and NEG operations on bool types, and thus, the reinterpret should be explicit in HLSL IR. -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/744#note_66507