On Thu, 2024-03-21 at 10:14 +0800, Jie Mei wrote:
> diff --git a/gcc/testsuite/gcc.target/mips/mips-minmax.c 
> b/gcc/testsuite/gcc.target/mips/mips-minmax.c
> new file mode 100644
> index 00000000000..2d234ac4b1d
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/mips/mips-minmax.c
> @@ -0,0 +1,40 @@
> +/* { dg-do compile } */
> +/* { dg-options "-mhard-float -ffinite-math-only -march=mips32r6" } */

You may want to add fmin<mode>3 and fmax<mode>3 in addition to
smin<mode>3 and smax<mode>3 so it will work without -ffinite-math-only.

‘fminM3’, ‘fmaxM3’
     IEEE-conformant minimum and maximum operations.  If one operand is
     a quiet ‘NaN’, then the other operand is returned.  If both
     operands are quiet ‘NaN’, then a quiet ‘NaN’ is returned.  In the
     case when gcc supports signaling ‘NaN’ (-fsignaling-nans) an
     invalid floating point exception is raised and a quiet ‘NaN’ is
     returned.

And the MIPS 6.06 manual says:

Numbers are preferred to NaNs: if one input is a NaN, but not both, the
value of the numeric input is returned. If both are NaNs, the NaN in fs
is returned.

for MAX.fmt and MIN.fmt, so they matches fmin<mode>3 and fmax<mode>3.

> +/* { dg-skip-if "code quality test" { *-*-* } { "-O0" } { "" } } */

-- 
Xi Ruoyao <xry...@xry111.site>
School of Aerospace Science and Technology, Xidian University

Reply via email to