re PR tree-optimization/57066 (std::logb(-inf) returns wrong value)
PR tree-optimization/57066 * builtins.c (fold_builtin_logb): Return +Inf for -Inf. * gcc.dg/torture/builtin-logb-1.c: Adjust testcase. From-SVN: r198308
This commit is contained in:
parent
96659611d2
commit
ea28bb0b9d
@ -1,3 +1,8 @@
|
||||
2013-04-25 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR tree-optimization/57066
|
||||
* builtins.c (fold_builtin_logb): Return +Inf for -Inf.
|
||||
|
||||
2013-04-25 James Greenhalgh <jame.greenhalgh@arm.com>
|
||||
|
||||
* config/aarch64/aarch64-simd.md (neg<mode>2): Use VDQ iterator.
|
||||
|
@ -9698,7 +9698,16 @@ fold_builtin_logb (location_t loc, tree arg, tree rettype)
|
||||
case rvc_inf:
|
||||
/* If arg is Inf or NaN and we're logb, return it. */
|
||||
if (TREE_CODE (rettype) == REAL_TYPE)
|
||||
return fold_convert_loc (loc, rettype, arg);
|
||||
{
|
||||
/* For logb(-Inf) we have to return +Inf. */
|
||||
if (real_isinf (value) && real_isneg (value))
|
||||
{
|
||||
REAL_VALUE_TYPE tem;
|
||||
real_inf (&tem);
|
||||
return build_real (rettype, tem);
|
||||
}
|
||||
return fold_convert_loc (loc, rettype, arg);
|
||||
}
|
||||
/* Fall through... */
|
||||
case rvc_zero:
|
||||
/* Zero may set errno and/or raise an exception for logb, also
|
||||
|
@ -1,3 +1,8 @@
|
||||
2013-04-25 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR tree-optimization/57066
|
||||
* gcc.dg/torture/builtin-logb-1.c: Adjust testcase.
|
||||
|
||||
2013-04-25 James Greenhalgh <james.greenhalgh@arm.com>
|
||||
Tejas Belagod <tejas.belagod@arm.com>
|
||||
|
||||
|
@ -48,25 +48,25 @@ extern void link_error(int);
|
||||
/* Test if FUNCRES(FUNC(NEG FUNCARG(ARGARG))) is false. Check the
|
||||
sign as well. */
|
||||
#ifndef __SPU__
|
||||
#define TESTIT3(FUNC,NEG,FUNCARG,ARGARG,FUNCRES) do { \
|
||||
#define TESTIT3(FUNC,NEG,FUNCARG,ARGARG,FUNCRES,NEG2) do { \
|
||||
if (!__builtin_##FUNCRES##f(__builtin_##FUNC(NEG __builtin_##FUNCARG##f(ARGARG))) \
|
||||
|| CKSGN_F(__builtin_##FUNC##f(NEG __builtin_##FUNCARG##f(ARGARG)), NEG __builtin_##FUNCARG##f(ARGARG))) \
|
||||
|| CKSGN_F(__builtin_##FUNC##f(NEG __builtin_##FUNCARG##f(ARGARG)), NEG2 __builtin_##FUNCARG##f(ARGARG))) \
|
||||
link_error(__LINE__); \
|
||||
if (!__builtin_##FUNCRES(__builtin_##FUNC(NEG __builtin_##FUNCARG(ARGARG))) \
|
||||
|| CKSGN(__builtin_##FUNC(NEG __builtin_##FUNCARG(ARGARG)), NEG __builtin_##FUNCARG(ARGARG))) \
|
||||
|| CKSGN(__builtin_##FUNC(NEG __builtin_##FUNCARG(ARGARG)), NEG2 __builtin_##FUNCARG(ARGARG))) \
|
||||
link_error(__LINE__); \
|
||||
if (!__builtin_##FUNCRES##l(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG))) \
|
||||
|| CKSGN_L(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG)), NEG __builtin_##FUNCARG##l(ARGARG))) \
|
||||
|| CKSGN_L(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG)), NEG2 __builtin_##FUNCARG##l(ARGARG))) \
|
||||
link_error(__LINE__); \
|
||||
} while (0)
|
||||
#else
|
||||
#define TESTIT3(FUNC,NEG,FUNCARG,ARGARG,FUNCRES) do { \
|
||||
#define TESTIT3(FUNC,NEG,FUNCARG,ARGARG,FUNCRES,NEG2) do { \
|
||||
/* SPU single-precision floating point format does not support Inf or Nan. */ \
|
||||
if (!__builtin_##FUNCRES(__builtin_##FUNC(NEG __builtin_##FUNCARG(ARGARG))) \
|
||||
|| CKSGN(__builtin_##FUNC(NEG __builtin_##FUNCARG(ARGARG)), NEG __builtin_##FUNCARG(ARGARG))) \
|
||||
|| CKSGN(__builtin_##FUNC(NEG __builtin_##FUNCARG(ARGARG)), NEG2 __builtin_##FUNCARG(ARGARG))) \
|
||||
link_error(__LINE__); \
|
||||
if (!__builtin_##FUNCRES##l(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG))) \
|
||||
|| CKSGN_L(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG)), NEG __builtin_##FUNCARG##l(ARGARG))) \
|
||||
|| CKSGN_L(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG)), NEG2 __builtin_##FUNCARG##l(ARGARG))) \
|
||||
link_error(__LINE__); \
|
||||
} while (0)
|
||||
#endif
|
||||
@ -173,15 +173,15 @@ foo(void)
|
||||
|
||||
/* Test for f(+-Inf) -> +-Inf and f(+-NaN) -> +-NaN, regardless of
|
||||
the radix. */
|
||||
TESTIT3 (logb, ,inf, , isinf);
|
||||
TESTIT3 (logb, - ,inf, , isinf);
|
||||
TESTIT3 (logb, ,nan, "", isnan);
|
||||
TESTIT3 (logb, - ,nan, "", isnan);
|
||||
TESTIT3 (logb, ,inf, , isinf, );
|
||||
TESTIT3 (logb, - ,inf, , isinf, );
|
||||
TESTIT3 (logb, ,nan, "", isnan, );
|
||||
TESTIT3 (logb, - ,nan, "", isnan, -);
|
||||
|
||||
TESTIT3 (significand, ,inf, , isinf);
|
||||
TESTIT3 (significand, - ,inf, , isinf);
|
||||
TESTIT3 (significand, ,nan, "", isnan);
|
||||
TESTIT3 (significand, - ,nan, "", isnan);
|
||||
TESTIT3 (significand, ,inf, , isinf, );
|
||||
TESTIT3 (significand, - ,inf, , isinf, -);
|
||||
TESTIT3 (significand, ,nan, "", isnan, );
|
||||
TESTIT3 (significand, - ,nan, "", isnan, -);
|
||||
}
|
||||
|
||||
int main()
|
||||
|
Loading…
Reference in New Issue
Block a user