diff options
author | Roger Sayle <roger@nextmovesoftware.com> | 2021-06-11 17:15:38 +0100 |
---|---|---|
committer | Roger Sayle <roger@nextmovesoftware.com> | 2021-06-11 17:17:58 +0100 |
commit | 5b02ed4b87685c0f7c5da9b46cde3ce56fcfd457 (patch) | |
tree | 5383dd4f566eb945a79017ed6c292af4f627257c /libphobos/src | |
parent | b8b80b8aa3d9a7abbcb59b651ea5e84c2ea12d0b (diff) | |
download | gcc-5b02ed4b87685c0f7c5da9b46cde3ce56fcfd457.zip gcc-5b02ed4b87685c0f7c5da9b46cde3ce56fcfd457.tar.gz gcc-5b02ed4b87685c0f7c5da9b46cde3ce56fcfd457.tar.bz2 |
[PATCH] PR tree-optimization/96392 Optimize x+0.0 if x is an integer
The patch implements a missed optimization enhancement. Under usual
IEEE rules, x+0.0 can't be simplified to x when x might potentially
be an IEEE minus zero (-0.0). The current logic in the middle-end
checks whether the type of x should honor signed zeros, but with this
patch we introduce tree_expr_maybe_real_minus_zero_p that allows us
to confirm that the value can't possibly be -0.0, for example, the result
of a conversion from an integer type, or the result of fabs (or has a
type that doesn't honor signed zero).
Whilst modifying match.pd, I also converted some additional folding
transformations from "testing the type" to "testing the value".
2020-06-10 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
PR tree-optimization/96392
* fold-const.c (fold_real_zero_addition_p): Take both arguments
of the addition or subtraction, not just the zero. Use this
other argument in tests for signaling NaNs and signed zeros.
(tree_expr_maybe_real_minus_zero_p): New predicate.
* fold-const.h (fold_real_zero_addition_p): Update prototype.
(tree_expr_maybe_real_minus_zero_p): New function prototype.
* match.pd: Update calls to fold_real_zero_addition_p.
Replace HONOR_NANS with tree_expr_maybe_nan_p.
Replace HONOR_SIGNED_ZEROS with tree_expr_maybe_real_minus_zero_p.
Replace HONOR_SNANS with tree_expr_maybe_signaling_nan_p.
* tree-ssa-reassoc.c (eliminate_using_constants): Update
call to fold_real_zero_addition_p.
gcc/testsuite/ChangeLog
PR tree-optimization/96392
* gcc.dg/pr96392.c: New test.
Diffstat (limited to 'libphobos/src')
0 files changed, 0 insertions, 0 deletions