Fix for IA-64 glibc math test failures.
* Makefile.in (gcse.o): Add $(TREE_H) to dependencies. * gcse.c: Include tree.h. (implicit_set_cond_p): New. (find_implicit_sets): Call it. * gcc.c-torture/execute/ieee/mzero5.c: New. Co-Authored-By: Roger Sayle <roger@eyesopen.com> From-SVN: r74769
This commit is contained in:
parent
d4ac5ffabb
commit
b0656d8b25
@ -1,3 +1,11 @@
|
||||
2003-12-17 James E Wilson <wilson@specifixinc.com>
|
||||
Roger Sayle <roger@eyesopen.com>
|
||||
|
||||
* Makefile.in (gcse.o): Add $(TREE_H) to dependencies.
|
||||
* gcse.c: Include tree.h.
|
||||
(implicit_set_cond_p): New.
|
||||
(find_implicit_sets): Call it.
|
||||
|
||||
2003-12-17 Santiago Vila <sanvila@unex.es>
|
||||
|
||||
* config/kfreebsdgnu.h (TARGET_OS_CPP_BUILTINS): Rename from
|
||||
|
@ -1654,7 +1654,8 @@ web.o : web.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \
|
||||
hard-reg-set.h flags.h $(BASIC_BLOCK_H) function.h output.h toplev.h df.h
|
||||
gcse.o : gcse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \
|
||||
hard-reg-set.h flags.h real.h insn-config.h $(GGC_H) $(RECOG_H) $(EXPR_H) \
|
||||
$(BASIC_BLOCK_H) function.h output.h toplev.h $(TM_P_H) $(PARAMS_H) except.h gt-gcse.h
|
||||
$(BASIC_BLOCK_H) function.h output.h toplev.h $(TM_P_H) $(PARAMS_H) \
|
||||
except.h gt-gcse.h $(TREE_H)
|
||||
sibcall.o : sibcall.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \
|
||||
function.h hard-reg-set.h flags.h insn-config.h $(RECOG_H) $(BASIC_BLOCK_H)
|
||||
resource.o : resource.c $(CONFIG_H) $(RTL_H) hard-reg-set.h $(SYSTEM_H) coretypes.h \
|
||||
|
35
gcc/gcse.c
35
gcc/gcse.c
@ -150,6 +150,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
#include "toplev.h"
|
||||
|
||||
#include "rtl.h"
|
||||
#include "tree.h"
|
||||
#include "tm_p.h"
|
||||
#include "regs.h"
|
||||
#include "hard-reg-set.h"
|
||||
@ -4559,6 +4560,38 @@ fis_get_condition (rtx jump)
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/* Check the comparison COND to see if we can safely form an implicit set from
|
||||
it. COND is either an EQ or NE comparison. */
|
||||
|
||||
static bool
|
||||
implicit_set_cond_p (rtx cond)
|
||||
{
|
||||
enum machine_mode mode = GET_MODE (XEXP (cond, 0));
|
||||
rtx cst = XEXP (cond, 1);
|
||||
|
||||
/* We can't perform this optimization if either operand might be or might
|
||||
contain a signed zero. */
|
||||
if (HONOR_SIGNED_ZEROS (mode))
|
||||
{
|
||||
/* It is sufficient to check if CST is or contains a zero. We must
|
||||
handle float, complex, and vector. If any subpart is a zero, then
|
||||
the optimization can't be performed. */
|
||||
/* ??? The complex and vector checks are not implemented yet. We just
|
||||
always return zero for them. */
|
||||
if (GET_CODE (cst) == CONST_DOUBLE)
|
||||
{
|
||||
REAL_VALUE_TYPE d;
|
||||
REAL_VALUE_FROM_CONST_DOUBLE (d, cst);
|
||||
if (REAL_VALUES_EQUAL (d, dconst0))
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
return gcse_constant_p (cst);
|
||||
}
|
||||
|
||||
/* Find the implicit sets of a function. An "implicit set" is a constraint
|
||||
on the value of a variable, implied by a conditional jump. For example,
|
||||
following "if (x == 2)", the then branch may be optimized as though the
|
||||
@ -4584,7 +4617,7 @@ find_implicit_sets (void)
|
||||
&& (GET_CODE (cond) == EQ || GET_CODE (cond) == NE)
|
||||
&& GET_CODE (XEXP (cond, 0)) == REG
|
||||
&& REGNO (XEXP (cond, 0)) >= FIRST_PSEUDO_REGISTER
|
||||
&& gcse_constant_p (XEXP (cond, 1)))
|
||||
&& implicit_set_cond_p (cond))
|
||||
{
|
||||
dest = GET_CODE (cond) == EQ ? BRANCH_EDGE (bb)->dest
|
||||
: FALLTHRU_EDGE (bb)->dest;
|
||||
|
@ -1,3 +1,8 @@
|
||||
2003-12-17 James E Wilson <wilson@specifixinc.com>
|
||||
Roger Sayle <roger@eyesopen.com>
|
||||
|
||||
* gcc.c-torture/execute/ieee/mzero5.c: New.
|
||||
|
||||
2003-12-17 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/10603
|
||||
|
29
gcc/testsuite/gcc.c-torture/execute/ieee/mzero5.c
Normal file
29
gcc/testsuite/gcc.c-torture/execute/ieee/mzero5.c
Normal file
@ -0,0 +1,29 @@
|
||||
/* Test gcse handling of IEEE 0/-0 rules. */
|
||||
static double zero = 0.0;
|
||||
|
||||
int
|
||||
negzero_check (double d)
|
||||
{
|
||||
if (d == 0)
|
||||
return !!memcmp ((void *)&zero, (void *)&d, sizeof (double));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sub (double d, double e)
|
||||
{
|
||||
if (d == 0.0 && e == 0.0
|
||||
&& negzero_check (d) == 0 && negzero_check (e) == 0)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
double minus_zero = -0.0;
|
||||
if (sub (minus_zero, 0))
|
||||
abort ();
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user