[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:26 PDT 2026
================
@@ -187,6 +233,24 @@ class InstExecutor : public InstVisitor<InstExecutor, void> {
});
}
+ void visitFPUnOp(Instruction &I,
+ function_ref<AnyValue(const APFloat &)> ScalarFn) {
+ FastMathFlags FMF = cast<FPMathOperator>(I).getFastMathFlags();
+
+ visitUnOp(I, [&](const AnyValue &Operand) -> AnyValue {
+ if (Operand.isPoison())
+ return AnyValue::poison();
+
+ // We don't flush denormals here since the only floating-point unary
+ // operation is fneg. And fneg is specified as a bitwise operation which
+ // only flips the sign bit of the input.
+
+ APFloat Result = ScalarFn(Operand.asFloat()).asFloat();
----------------
dtcxzyw wrote:
`ScalarFn` may return a poison. It would be better to change the return type to APFloat.
https://github.com/llvm/llvm-project/pull/188453
More information about the llvm-commits
mailing list