diff options
author | James E Wilson <wilson@specifixinc.com> | 2003-12-18 02:45:18 +0000 |
---|---|---|
committer | Jim Wilson <wilson@gcc.gnu.org> | 2003-12-17 18:45:18 -0800 |
commit | b0656d8b259f9035873700b7fc657f495044b75d (patch) | |
tree | f8a4495008af06d5fe2d1fffdca10a4d0c8a120a | |
parent | d4ac5ffabb92df767dcf8296802ea292f66f072e (diff) | |
download | gcc-b0656d8b259f9035873700b7fc657f495044b75d.zip gcc-b0656d8b259f9035873700b7fc657f495044b75d.tar.gz gcc-b0656d8b259f9035873700b7fc657f495044b75d.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/Makefile.in | 3 | ||||
-rw-r--r-- | gcc/gcse.c | 35 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/ieee/mzero5.c | 29 |
5 files changed, 78 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f92b1b5..6f11c5e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/Makefile.in b/gcc/Makefile.in index b14af5a..24c3849 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -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 \ @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 91c4068..e2aea6c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/mzero5.c b/gcc/testsuite/gcc.c-torture/execute/ieee/mzero5.c new file mode 100644 index 0000000..3804c08 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/ieee/mzero5.c @@ -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; +} |