1
Fork 0

Rollup merge of #126429 - tgross35:f16-f128-const-eval, r=RalfJung

Add `f16` and `f128` const eval for binary and unary operationations

Add const evaluation and Miri support for f16 and f128, including unary and binary operations. Casts are not yet included.

Fixes https://github.com/rust-lang/rust/issues/124583

r? ``@RalfJung``
This commit is contained in:
Matthias Krüger 2024-06-15 14:40:50 +02:00 committed by GitHub
commit 3775f2f5d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 89 additions and 112 deletions

View file

@ -69,6 +69,13 @@ impl<Prov: Provenance> fmt::LowerHex for Scalar<Prov> {
}
}
impl<Prov> From<Half> for Scalar<Prov> {
#[inline(always)]
fn from(f: Half) -> Self {
Scalar::from_f16(f)
}
}
impl<Prov> From<Single> for Scalar<Prov> {
#[inline(always)]
fn from(f: Single) -> Self {
@ -83,6 +90,13 @@ impl<Prov> From<Double> for Scalar<Prov> {
}
}
impl<Prov> From<Quad> for Scalar<Prov> {
#[inline(always)]
fn from(f: Quad) -> Self {
Scalar::from_f128(f)
}
}
impl<Prov> From<ScalarInt> for Scalar<Prov> {
#[inline(always)]
fn from(ptr: ScalarInt) -> Self {