Translator: format the float-predicate change

cargo fmt over 267d3163a6's four files (check.rs, fold.rs, interface.rs,
stage.rs): lines past the width limit wrapped. No change in behaviour.

Verified: cargo fmt --all --check is clean after it.
This commit is contained in:
Anees Iqbal committed 2026-11-26 17:00:28 -08:00
1 parent 8006d54fbb
commit 7ccba50e38
4 files changed
+15 -5

No files matched your search

+4 -1
View File
@@ -376,7 +376,10 @@ fn predicate(m: &Module, p: Option<&Predicate>, site: &Site) -> Result<(), Error
&& !g.externally_initialized
&& g.section.is_none()
&& g.init.is_some()
&& matches!(m.types().get(g.value_ty), Some(Type::Int(_) | Type::Half | Type::Float | Type::Double))
&& matches!(
m.types().get(g.value_ty),
Some(Type::Int(_) | Type::Half | Type::Float | Type::Double)
)
});
if ok {
Ok(())
+2 -1
View File
@@ -351,7 +351,8 @@ impl Folder<'_> {
},
},
};
self.mk(ty, Const::Float(if nonzero { one } else { 0 }), m).map(Some)
self.mk(ty, Const::Float(if nonzero { one } else { 0 }), m)
.map(Some)
}
/// `icmp pred a, b` over scalar integers (and null pointers), typed `ty` (`i1`).
@@ -114,7 +114,10 @@ impl Values<'_> {
/// Whether global `g`'s initializer is a floating-point constant.
fn holds_float(&self, g: GlobalId) -> bool {
let init = self.globals.get(g).and_then(|g| g.init);
matches!(init.and_then(|c| self.consts.get(c)).map(|c| &c.value), Some(Const::Float(_)))
matches!(
init.and_then(|c| self.consts.get(c)).map(|c| &c.value),
Some(Const::Float(_))
)
}
/// Whether the floating-point constant global `g` holds is non-zero; an unsupplied one's is
@@ -129,8 +129,11 @@ impl FunctionConstant {
return Some(FunctionConstant::IsDefined);
}
let ty = NumTy::parse(rest.strip_prefix("normalize_function_constant_predicate.")?)?;
(matches!(ty.elem, Elem::I8 | Elem::I16 | Elem::I32 | Elem::F16 | Elem::F32) && !ty.is_vector())
.then_some(FunctionConstant::NormalizePredicate(ty.elem))
(matches!(
ty.elem,
Elem::I8 | Elem::I16 | Elem::I32 | Elem::F16 | Elem::F32
) && !ty.is_vector())
.then_some(FunctionConstant::NormalizePredicate(ty.elem))
}
/// The typed signature.