Xi Ruoyao <xry...@xry111.site> 于2024年3月26日周二 18:10写道: > > On Tue, 2024-03-26 at 11:15 +0800, YunQiang Su wrote: > > /* snip */ > > > With -ffinite-math-only -fno-signed-zeros, it does work with > > x >= y ? x : y > > while without `-ffinite-math-only -fno-signed-zeros`, it cannot. > > @Xi Ruoyao Is it expected by IEEE? > > When y is (quiet) NaN and x is not, fmax(x, y) should produce x but x >= > y ? x : y should produce y. Thus -ffinite-math-only is needed. > > When x is +0.0 and y is -0.0, x >= y ? x : y should produce +0.0 but > fmax(x, y) may produce +0.0 or -0.0 (IEEE allows both and I don't see a > more strict requirement in MIPS 6.06 manual either). Thus -fno-signed- > zeros is needed. >
Yes, MIPS 6.06 requires `max.f Y,+0,-0` produce +0. There is a table after the description of max.fmt instruction, aka Table 4.1 Special Cases for FP MAX, MIN, MAXA, MINA. > -- > Xi Ruoyao <xry...@xry111.site> > School of Aerospace Science and Technology, Xidian University