+2003-08-26 Roger Sayle <roger@eyesopen.com>
+
+ PR middle-end/12002
+ * tree.h (SCALAR_FLOAT_TYPE_P, COMPLEX_FLOAT_TYPE_P): New macros.
+ (FLOAT_TYPE_P): Define in terms of these two new macros.
+ * fold-const.c (fold <PLUS_EXPR>): Don't convert x+x into x*2.0
+ for complex floating point types.
+
2003-08-26 Ulrich Weigand <uweigand@de.ibm.com>
* config/s390/s390.c (emit_prologue): Don't check literal pool size.
return non_lvalue (convert (type, arg1));
/* Convert x+x into x*2.0. */
- if (operand_equal_p (arg0, arg1, 0))
+ if (operand_equal_p (arg0, arg1, 0)
+ && SCALAR_FLOAT_TYPE_P (type))
return fold (build (MULT_EXPR, type, arg0,
build_real (type, dconst2)));
+2003-08-26 Roger Sayle <roger@eyesopen.com>
+
+ PR middle-end/12002
+ * g77.f-torture/compile/12002.f: New test case.
+
2003-08-26 Roger Sayle <roger@eyesopen.com>
* gcc.dg/20030826-1.c: New test case.
--- /dev/null
+C PR middle-end/12002
+ COMPLEX TE1
+ TE1=-2.
+ TE1=TE1+TE1
+ END
(TREE_CODE (TYPE) == INTEGER_TYPE || TREE_CODE (TYPE) == ENUMERAL_TYPE \
|| TREE_CODE (TYPE) == BOOLEAN_TYPE || TREE_CODE (TYPE) == CHAR_TYPE)
+/* Nonzero if TYPE represents a scalar floating-point type. */
+
+#define SCALAR_FLOAT_TYPE_P(TYPE) (TREE_CODE (TYPE) == REAL_TYPE)
+
+/* Nonzero if TYPE represents a complex floating-point type. */
+
+#define COMPLEX_FLOAT_TYPE_P(TYPE) \
+ (TREE_CODE (TYPE) == COMPLEX_TYPE \
+ && TREE_CODE (TREE_TYPE (TYPE)) == REAL_TYPE)
+
/* Nonzero if TYPE represents a floating-point type, including complex
floating-point types. */
#define FLOAT_TYPE_P(TYPE) \
- (TREE_CODE (TYPE) == REAL_TYPE \
- || (TREE_CODE (TYPE) == COMPLEX_TYPE \
- && TREE_CODE (TREE_TYPE (TYPE)) == REAL_TYPE))
+ (SCALAR_FLOAT_TYPE_P (TYPE) || COMPLEX_FLOAT_TYPE_P (TYPE))
/* Nonzero if TYPE represents an aggregate (multi-component) type. */