|
1 | | -use rand::Rng; |
2 | | -use rustc_apfloat::Float; |
3 | 1 | use rustc_middle::ty; |
4 | 2 | use rustc_middle::ty::FloatTy; |
5 | 3 |
|
@@ -83,62 +81,6 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> { |
83 | 81 | this.write_scalar(val, &dest)?; |
84 | 82 | } |
85 | 83 | } |
86 | | - "fma" | "relaxed_fma" => { |
87 | | - let [a, b, c] = check_intrinsic_arg_count(args)?; |
88 | | - let (a, a_len) = this.project_to_simd(a)?; |
89 | | - let (b, b_len) = this.project_to_simd(b)?; |
90 | | - let (c, c_len) = this.project_to_simd(c)?; |
91 | | - let (dest, dest_len) = this.project_to_simd(dest)?; |
92 | | - |
93 | | - assert_eq!(dest_len, a_len); |
94 | | - assert_eq!(dest_len, b_len); |
95 | | - assert_eq!(dest_len, c_len); |
96 | | - |
97 | | - for i in 0..dest_len { |
98 | | - let a = this.read_scalar(&this.project_index(&a, i)?)?; |
99 | | - let b = this.read_scalar(&this.project_index(&b, i)?)?; |
100 | | - let c = this.read_scalar(&this.project_index(&c, i)?)?; |
101 | | - let dest = this.project_index(&dest, i)?; |
102 | | - |
103 | | - let fuse: bool = intrinsic_name == "fma" |
104 | | - || (this.machine.float_nondet && this.machine.rng.get_mut().random()); |
105 | | - |
106 | | - // Works for f32 and f64. |
107 | | - // FIXME: using host floats to work around https://github.com/rust-lang/miri/issues/2468. |
108 | | - let ty::Float(float_ty) = dest.layout.ty.kind() else { |
109 | | - span_bug!(this.cur_span(), "{} operand is not a float", intrinsic_name) |
110 | | - }; |
111 | | - let val = match float_ty { |
112 | | - FloatTy::F16 => unimplemented!("f16_f128"), |
113 | | - FloatTy::F32 => { |
114 | | - let a = a.to_f32()?; |
115 | | - let b = b.to_f32()?; |
116 | | - let c = c.to_f32()?; |
117 | | - let res = if fuse { |
118 | | - a.mul_add(b, c).value |
119 | | - } else { |
120 | | - ((a * b).value + c).value |
121 | | - }; |
122 | | - let res = this.adjust_nan(res, &[a, b, c]); |
123 | | - Scalar::from(res) |
124 | | - } |
125 | | - FloatTy::F64 => { |
126 | | - let a = a.to_f64()?; |
127 | | - let b = b.to_f64()?; |
128 | | - let c = c.to_f64()?; |
129 | | - let res = if fuse { |
130 | | - a.mul_add(b, c).value |
131 | | - } else { |
132 | | - ((a * b).value + c).value |
133 | | - }; |
134 | | - let res = this.adjust_nan(res, &[a, b, c]); |
135 | | - Scalar::from(res) |
136 | | - } |
137 | | - FloatTy::F128 => unimplemented!("f16_f128"), |
138 | | - }; |
139 | | - this.write_scalar(val, &dest)?; |
140 | | - } |
141 | | - } |
142 | 84 | "expose_provenance" => { |
143 | 85 | let [op] = check_intrinsic_arg_count(args)?; |
144 | 86 | let (op, op_len) = this.project_to_simd(op)?; |
|
0 commit comments