================
@@ -1256,6 +1270,65 @@ 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;
+      S.GetAPFloat().convertToInteger(result, llvm::APFloat::rmTowardZero,
+                                      &isExact);
+      lldb_private::Scalar R(result);
+
+      frame.AssignValue(inst, R, module);
+      if (log) {
+        LLDB_LOGF(log, "Interpreted a %s", inst->getOpcodeName());
+        LLDB_LOGF(log, "  Src : %s", 
frame.SummarizeValue(src_operand).c_str());
+        LLDB_LOGF(log, "  =   : %s", frame.SummarizeValue(inst).c_str());
+      }
+    } break;
+    case Instruction::UIToFP:
+    case Instruction::SIToFP:
+    case Instruction::FPTrunc:
----------------
Michael137 wrote:

`FPTrunc` takes a rounding mode as an argument. Are we intentionally ignoring 
it?

https://github.com/llvm/llvm-project/pull/175292
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to