rust-lang/rust · error

f128

Error message

f128

What it means

In Miri, the SIMD float unary-op handler (src/tools/miri/src/intrinsics/simd.rs) dispatches on FloatTy for f16/f32/f64 but for FloatTy::F128 it hits unimplemented!("f128") (FIXME(f128)). Any SIMD float intrinsic applied to an f128 lane vector is unsupported and aborts interpretation.

Solutions

  1. Do not run f128 SIMD float intrinsics under Miri; test the scalar path or a smaller float type instead.
  2. Gate f128 SIMD tests behind a cfg that skips Miri (e.g. #[cfg_attr(miri, ignore)]).
  3. Implement the op with host floats on f64 lanes as an approximation while testing.
  4. Track the FIXME(f128) Miri issue and upstream f128 support.

Example fix

// before
let r: Simd<f128, 4> = core::intrinsics::simd::simd_fsqrt(v);
$ cargo miri test   // panics: f128

// after
#[cfg_attr(miri, ignore)]
fn test_f128_simd_sqrt() { /* ... */ }
Defensive patterns

Strategy: validation

Validate before calling

// Skip f128 SIMD intrinsic tests under Miri.
#[cfg_attr(miri, ignore)]
fn test_f128_simd_sqrt() { /* core::intrinsics::simd::simd_fsqrt on f128 */ }

Prevention

When it happens

Trigger: Running Miri on code that calls a SIMD float intrinsic (e.g. simd_fsqrt, simd_fabs, simd_fsin-style ops) on a vector of f128 elements: core::intrinsics::simd::* with a Simd<f128, N> operand.

Common situations: Testing experimental f128 SIMD code under Miri; running the test suite of a crate that uses 128-bit float SIMD intrinsics on a recent nightly.

Related errors


AI-assisted analysis of rust-lang/rust@7088e4b63a (2026-08-10). Data as JSON: /api/errors/1724da6c5aa3d776. Report an issue: GitHub.

Appendix: source

Thrown at src/tools/miri/src/intrinsics/simd.rs:75

                    "flog" => HostUnaryFloatOp::Log,
                    "flog2" => HostUnaryFloatOp::Log2,
                    "flog10" => HostUnaryFloatOp::Log10,
                    _ => bug!(),
                };

                for i in 0..dest_len {
                    let op = this.project_index(&op, i)?;
                    let dest = this.project_index(&dest, i)?;
                    let ty::Float(float_ty) = op.layout.ty.kind() else {
                        span_bug!(this.cur_span(), "{} operand is not a float", intrinsic_name)
                    };
                    // Using host floats except for sqrt (but it's fine, these operations do not
                    // have guaranteed precision).
                    match float_ty {
                        FloatTy::F16 => host_unary_float_op::<HalfS>(this, &op, host_op, &dest)?,
                        FloatTy::F32 => host_unary_float_op::<SingleS>(this, &op, host_op, &dest)?,
                        FloatTy::F64 => host_unary_float_op::<DoubleS>(this, &op, host_op, &dest)?,
                        FloatTy::F128 => unimplemented!("f128"), // FIXME(f128)
                    }
                }
            }
            "expose_provenance" => {
                let [op] = check_intrinsic_arg_count(args)?;
                let (op, op_len) = this.project_to_simd(op)?;
                let (dest, dest_len) = this.project_to_simd(dest)?;

                assert_eq!(dest_len, op_len);

                for i in 0..dest_len {
                    let op = this.read_immediate(&this.project_index(&op, i)?)?;
                    let dest = this.project_index(&dest, i)?;

                    let val = match (op.layout.ty.kind(), dest.layout.ty.kind()) {
                        // Ptr/Int casts
                        (ty::RawPtr(..), ty::Int(_) | ty::Uint(_)) =>
                            this.pointer_expose_provenance_cast(&op, dest.layout)?,

View on GitHub (pinned to 7088e4b63a)