Skip to content

Commit 36c078f

Browse files
committed
Add stubs for f16 and f128 to miri
1 parent 8e7a8c7 commit 36c078f

File tree

1 file changed

+10
-0
lines changed
  • src/tools/miri/src/shims/intrinsics

1 file changed

+10
-0
lines changed

src/tools/miri/src/shims/intrinsics/simd.rs

+10
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
8383
let op = op.to_scalar();
8484
// "Bitwise" operation, no NaN adjustments
8585
match float_ty {
86+
FloatTy::F16 => unimplemented!("f16_f128"),
8687
FloatTy::F32 => Scalar::from_f32(op.to_f32()?.abs()),
8788
FloatTy::F64 => Scalar::from_f64(op.to_f64()?.abs()),
89+
FloatTy::F128 => unimplemented!("f16_f128"),
8890
}
8991
}
9092
Op::Sqrt => {
@@ -93,6 +95,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
9395
};
9496
// FIXME using host floats
9597
match float_ty {
98+
FloatTy::F16 => unimplemented!("f16_f128"),
9699
FloatTy::F32 => {
97100
let f = op.to_scalar().to_f32()?;
98101
let res = f.to_host().sqrt().to_soft();
@@ -105,13 +108,15 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
105108
let res = this.adjust_nan(res, &[f]);
106109
Scalar::from(res)
107110
}
111+
FloatTy::F128 => unimplemented!("f16_f128"),
108112
}
109113
}
110114
Op::Round(rounding) => {
111115
let ty::Float(float_ty) = op.layout.ty.kind() else {
112116
span_bug!(this.cur_span(), "{} operand is not a float", intrinsic_name)
113117
};
114118
match float_ty {
119+
FloatTy::F16 => unimplemented!("f16_f128"),
115120
FloatTy::F32 => {
116121
let f = op.to_scalar().to_f32()?;
117122
let res = f.round_to_integral(rounding).value;
@@ -124,6 +129,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
124129
let res = this.adjust_nan(res, &[f]);
125130
Scalar::from_f64(res)
126131
}
132+
FloatTy::F128 => unimplemented!("f16_f128"),
127133
}
128134
}
129135
Op::Numeric(name) => {
@@ -267,6 +273,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
267273
span_bug!(this.cur_span(), "{} operand is not a float", intrinsic_name)
268274
};
269275
let val = match float_ty {
276+
FloatTy::F16 => unimplemented!("f16_f128"),
270277
FloatTy::F32 => {
271278
let a = a.to_f32()?;
272279
let b = b.to_f32()?;
@@ -283,6 +290,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
283290
let res = this.adjust_nan(res, &[a, b, c]);
284291
Scalar::from(res)
285292
}
293+
FloatTy::F128 => unimplemented!("f16_f128"),
286294
};
287295
this.write_scalar(val, &dest)?;
288296
}
@@ -724,6 +732,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
724732
let left = left.to_scalar();
725733
let right = right.to_scalar();
726734
Ok(match float_ty {
735+
FloatTy::F16 => unimplemented!("f16_f128"),
727736
FloatTy::F32 => {
728737
let left = left.to_f32()?;
729738
let right = right.to_f32()?;
@@ -744,6 +753,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
744753
let res = this.adjust_nan(res, &[left, right]);
745754
Scalar::from_f64(res)
746755
}
756+
FloatTy::F128 => unimplemented!("f16_f128"),
747757
})
748758
}
749759
}

0 commit comments

Comments
 (0)