On 05/30/2016 12:59 AM, peer.ad...@c-lab.de wrote: > +uint32_t helper_fmadd(CPUTriCoreState *env, uint32_t r1, > + uint32_t r2, uint32_t r3) > +{ > + uint32_t flags; > + float32 arg1 = make_float32(r1); > + float32 arg2 = make_float32(r2); > + float32 arg3 = make_float32(r3); > + float32 f_result; > + > + flags = f_get_excp_flags(env); > + f_result = float32_muladd(arg1, arg2, arg3, flags, &env->fp_status); The flags argument allows the caller to select negation of the addend, the intermediate product, or the final result. These are not excp_flags. Additionally, you need to collect the excp_flags after doing the muladd. > + > + if (flags) { > + /* If the output is a NaN, but the inputs aren't, > + we return a unique value. */ > + if ((flags & float_flag_invalid) > + && !float32_is_any_nan(arg1) > + && !float32_is_any_nan(arg2)) { You are not doing what the comment says. You have three inputs here but you only check two.
> + float32 arg2 = make_float32(r2); > + float32 arg3 = make_float32(r3); > + float32 f_result; > + > + flags = f_get_excp_flags(env); > + f_result = float32_muladd(-arg1, arg2, arg3, flags, &env->fp_status); Likewise. > + if (flags) { > + /* If the output is a NaN, but the inputs aren't, > + we return a unique value. */ > + if ((flags & float_flag_invalid) > + && !float32_is_any_nan(arg1) > + && !float32_is_any_nan(arg2)) { Likewise. Cheers, Bastian