diff options
author | Zack Weinberg <zack@gcc.gnu.org> | 2002-12-16 18:23:00 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2002-12-16 18:23:00 +0000 |
commit | 4977bab6ed59f01c73f9c8b9e92298706df9b6d5 (patch) | |
tree | c259697c448b0c6f548f153c48c46a8d7a75970f /gcc/simplify-rtx.c | |
parent | b51dc045004ee7eb8d2bf4358ddf22a6cc6c1d00 (diff) | |
download | gcc-4977bab6ed59f01c73f9c8b9e92298706df9b6d5.zip gcc-4977bab6ed59f01c73f9c8b9e92298706df9b6d5.tar.gz gcc-4977bab6ed59f01c73f9c8b9e92298706df9b6d5.tar.bz2 |
Merge basic-improvements-branch to trunk
From-SVN: r60174
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r-- | gcc/simplify-rtx.c | 66 |
1 files changed, 11 insertions, 55 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index 212d3b9..04c7b9f 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -22,6 +22,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "config.h" #include "system.h" +#include "coretypes.h" +#include "tm.h" #include "rtl.h" #include "tree.h" #include "tm_p.h" @@ -39,41 +41,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA /* Simplification and canonicalization of RTL. */ -/* Nonzero if X has the form (PLUS frame-pointer integer). We check for - virtual regs here because the simplify_*_operation routines are called - by integrate.c, which is called before virtual register instantiation. - - ?!? NONZERO_BASE_PLUS_P needs to move into - a header file so that their definitions can be shared with the - simplification routines in simplify-rtx.c. Until then, do not - change this macro without also changing the copy in simplify-rtx.c. */ - -/* Allows reference to the stack pointer. - - This used to include FIXED_BASE_PLUS_P, however, we can't assume that - arg_pointer_rtx by itself is nonzero, because on at least one machine, - the i960, the arg pointer is zero when it is unused. */ - -#define NONZERO_BASE_PLUS_P(X) \ - ((X) == frame_pointer_rtx || (X) == hard_frame_pointer_rtx \ - || (X) == virtual_stack_vars_rtx \ - || (X) == virtual_incoming_args_rtx \ - || (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == CONST_INT \ - && (XEXP (X, 0) == frame_pointer_rtx \ - || XEXP (X, 0) == hard_frame_pointer_rtx \ - || ((X) == arg_pointer_rtx \ - && fixed_regs[ARG_POINTER_REGNUM]) \ - || XEXP (X, 0) == virtual_stack_vars_rtx \ - || XEXP (X, 0) == virtual_incoming_args_rtx)) \ - || (X) == stack_pointer_rtx \ - || (X) == virtual_stack_dynamic_rtx \ - || (X) == virtual_outgoing_args_rtx \ - || (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == CONST_INT \ - && (XEXP (X, 0) == stack_pointer_rtx \ - || XEXP (X, 0) == virtual_stack_dynamic_rtx \ - || XEXP (X, 0) == virtual_outgoing_args_rtx)) \ - || GET_CODE (X) == ADDRESSOF) - /* Much code operates on (low, high) pairs; the low value is an unsigned wide int, the high value a signed wide int. We occasionally need to sign extend from low to high as if low were a @@ -606,15 +573,17 @@ simplify_unary_operation (code, mode, op, op_mode) else if (GET_CODE (trueop) == CONST_DOUBLE && GET_MODE_CLASS (mode) == MODE_FLOAT) { - REAL_VALUE_TYPE d; + REAL_VALUE_TYPE d, t; REAL_VALUE_FROM_CONST_DOUBLE (d, trueop); switch (code) { case SQRT: - /* We don't attempt to optimize this. */ - return 0; - + if (HONOR_SNANS (mode) && real_isnan (&d)) + return 0; + real_sqrt (&t, mode, &d); + d = t; + break; case ABS: d = REAL_VALUE_ABS (d); break; @@ -1344,6 +1313,7 @@ simplify_binary_operation (code, mode, op0, op1) case ROTATERT: case ROTATE: + case ASHIFTRT: /* Rotating ~0 always results in ~0. */ if (GET_CODE (trueop0) == CONST_INT && width <= HOST_BITS_PER_WIDE_INT && (unsigned HOST_WIDE_INT) INTVAL (trueop0) == GET_MODE_MASK (mode) @@ -1353,7 +1323,6 @@ simplify_binary_operation (code, mode, op0, op1) /* ... fall through ... */ case ASHIFT: - case ASHIFTRT: case LSHIFTRT: if (trueop1 == const0_rtx) return op0; @@ -2038,25 +2007,12 @@ simplify_relational_operation (code, mode, op0, op1) switch (code) { case EQ: - /* References to the frame plus a constant or labels cannot - be zero, but a SYMBOL_REF can due to #pragma weak. */ - if (((NONZERO_BASE_PLUS_P (op0) && trueop1 == const0_rtx) - || GET_CODE (trueop0) == LABEL_REF) -#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM - /* On some machines, the ap reg can be 0 sometimes. */ - && op0 != arg_pointer_rtx -#endif - ) + if (trueop1 == const0_rtx && nonzero_address_p (op0)) return const0_rtx; break; case NE: - if (((NONZERO_BASE_PLUS_P (op0) && trueop1 == const0_rtx) - || GET_CODE (trueop0) == LABEL_REF) -#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM - && op0 != arg_pointer_rtx -#endif - ) + if (trueop1 == const0_rtx && nonzero_address_p (op0)) return const_true_rtx; break; |