[llvm] [llubi] Initial support for floating-point numbers (PR #188453)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 1 12:06:27 PDT 2026


================
@@ -794,6 +996,77 @@ class InstExecutor : public InstVisitor<InstExecutor, void> {
     });
   }
 
+  void visitFPExtInst(FPExtInst &FPExt) { visitFPConvInst(FPExt); }
+
+  void visitFPTruncInst(FPTruncInst &FPTrunc) { visitFPConvInst(FPTrunc); }
+
+  void visitFPConvInst(Instruction &I) {
+    const fltSemantics &DstSem =
+        I.getType()->getScalarType()->getFltSemantics();
+
+    visitUnOp(I, [&](const AnyValue &Operand) -> AnyValue {
+      if (Operand.isPoison())
+        return AnyValue::poison();
+
+      APFloat Res = Operand.asFloat();
+      bool LosesInfo;
+      Res.convert(DstSem, CurrentRoundingMode, &LosesInfo);
+      return AnyValue(Res);
----------------
dtcxzyw wrote:

Missing FMF handling.

https://github.com/llvm/llvm-project/pull/188453


More information about the llvm-commits mailing list