floats iter 4.3: codegen Float comparison arms (fcmp olt/ole/ogt/oge/UNE) + lower_eq Float

This commit is contained in:
2026-05-10 16:10:13 +02:00
parent 2a290704df
commit 3869641a31
2 changed files with 82 additions and 0 deletions
+9
View File
@@ -281,6 +281,15 @@ pub(crate) fn builtin_binop_typed(
("<=", true, _) => Some(("icmp sle", "i64", "i1")),
(">", true, _) => Some(("icmp sgt", "i64", "i1")),
(">=", true, _) => Some(("icmp sge", "i64", "i1")),
// Float comparison arms (Floats iter 4.3). Note: `!=` Float
// uses `fcmp une` ("unordered or not equal") — NOT `one`
// ("ordered and not equal"), which would return `false` for
// `nan != nan` and violate IEEE / spec A5.
("!=", _, true) => Some(("fcmp une", "double", "i1")),
("<", _, true) => Some(("fcmp olt", "double", "i1")),
("<=", _, true) => Some(("fcmp ole", "double", "i1")),
(">", _, true) => Some(("fcmp ogt", "double", "i1")),
(">=", _, true) => Some(("fcmp oge", "double", "i1")),
_ => None,
}
}