================
@@ -1256,6 +1279,73 @@ bool IRInterpreter::Interpret(llvm::Module &module,
llvm::Function &function,
LLDB_LOGF(log, " = : %s", frame.SummarizeValue(inst).c_str());
}
} break;
+ case Instruction::FPToUI:
+ case Instruction::FPToSI: {
+ Value *src_operand = inst->getOperand(0);
+
+ lldb_private::Scalar S;
+ if (!frame.EvaluateValue(S, src_operand, module)) {
+ LLDB_LOGF(log, "Couldn't evaluate %s",
PrintValue(src_operand).c_str());
+ error = lldb_private::Status::FromErrorString(bad_value_error);
+ return false;
+ }
+
+ assert(inst->getType()->isIntegerTy() && "Unexpected target type");
+ llvm::APSInt result(inst->getType()->getIntegerBitWidth(),
+ /*isUnsigned=*/inst->getOpcode() ==
+ Instruction::FPToUI);
+ assert(S.GetType() == lldb_private::Scalar::e_float &&
+ "Unexpected source type");
+ bool isExact;
+ llvm::APFloatBase::opStatus status = S.GetAPFloat().convertToInteger(
+ result, llvm::APFloat::rmTowardZero, &isExact);
+ // Casting floating point values that are out of bounds of the target
type
+ // is undefined behaviour.
+ if (status & llvm::APFloatBase::opInvalidOp) {
----------------
Michael137 wrote:
`status == llvm::APFloatBase::opOK` instead?
https://github.com/llvm/llvm-project/pull/175292
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits