fix fp2tosi semantics for negative zero
MODIFY
ir/instr.cpp
ir/instr.cpp
@@ -1274,7 +1274,8 @@ StateValue ConversionOp::toSMT(State &s) const {
fn = [](auto &&val, auto &to_type) -> StateValue {
expr bv = val.fp2sint(to_type.bits());
expr fp2 = bv.sint2fp(val);
- return { move(bv), fp2 == val };
+ // -0.0 is converted to 0 and then to 0.0, though -0.0 is ok to convert
+ return { move(bv), val.isFPZero() || fp2 == val };
};
break;
case FPToUInt:

ADD
tests/alive-tv/fp/fptosi-nsz.srctgt.ll
+; ERROR: Target is more poisonous than source
+
+define i8 @src() {
+ %i = fptosi float -0.0 to i8
+ ret i8 %i
+}
+
+define i8 @tgt() {
+ ret i8 poison
+}

fix fp2tosi semantics for negative zero