MIPS: Use -mnan value for -mabs if not specified
On most hardware, FCSR.ABS2008 is set the value same with FCSR.NAN2008. Let's use this behaivor by default in GCC, aka gcc -mnan=2008 -c fabs.c will imply `-mabs=2008`. And of course, `gcc -mnan=2008 -mabs=legacy` can continue workable like previous. gcc/ChangeLog * config/mips/mips.cc(mips_option_override): Set mips_abs to 2008, if mips_abs is default and mips_nan is 2008. gcc/testsuite/ * gcc.target/mips/fabs-nan2008.c: New test. * gcc.target/mips/fabsf-nan2008.c: New test.
This commit is contained in:
parent
3a6df3281a
commit
78bfc86bf2
3 changed files with 22 additions and 0 deletions
|
@ -20550,6 +20550,8 @@ mips_option_override (void)
|
|||
/* Set NaN and ABS defaults. */
|
||||
if (mips_nan == MIPS_IEEE_754_DEFAULT && !ISA_HAS_IEEE_754_LEGACY)
|
||||
mips_nan = MIPS_IEEE_754_2008;
|
||||
if (mips_abs == MIPS_IEEE_754_DEFAULT && mips_nan == MIPS_IEEE_754_2008)
|
||||
mips_abs = MIPS_IEEE_754_2008;
|
||||
if (mips_abs == MIPS_IEEE_754_DEFAULT && !ISA_HAS_IEEE_754_LEGACY)
|
||||
mips_abs = MIPS_IEEE_754_2008;
|
||||
|
||||
|
|
10
gcc/testsuite/gcc.target/mips/fabs-nan2008.c
Normal file
10
gcc/testsuite/gcc.target/mips/fabs-nan2008.c
Normal file
|
@ -0,0 +1,10 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-mnan=2008" } */
|
||||
|
||||
NOMIPS16 double
|
||||
fabs_2008 (double d)
|
||||
{
|
||||
return __builtin_fabs (d);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler "\tabs\\.d\t" } } */
|
10
gcc/testsuite/gcc.target/mips/fabsf-nan2008.c
Normal file
10
gcc/testsuite/gcc.target/mips/fabsf-nan2008.c
Normal file
|
@ -0,0 +1,10 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-mnan=2008" } */
|
||||
|
||||
NOMIPS16 float
|
||||
fabsf_2008 (float f)
|
||||
{
|
||||
return __builtin_fabsf (f);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler "\tabs\\.s\t" } } */
|
Loading…
Add table
Reference in a new issue