Commit 75326e8c by Richard Kenner

(common_type): For COMPLEX_TYPE, return one of the original types if is the desired common type.

(common_type): For COMPLEX_TYPE, return one of the original types if is the
desired common type.
(build_binary_op): Use SHORT_COMPARE code even if complex.

From-SVN: r6312
parent c470260b
...@@ -193,21 +193,20 @@ common_type (t1, t2) ...@@ -193,21 +193,20 @@ common_type (t1, t2)
code1 = TREE_CODE (t1); code1 = TREE_CODE (t1);
code2 = TREE_CODE (t2); code2 = TREE_CODE (t2);
/* If one type is complex, form the common type /* If one type is complex, form the common type of the non-complex
of the non-complex components, components, then make that complex. Use T1 or T2 if it is the
then make that complex. */ required type. */
if (code1 == COMPLEX_TYPE || code2 == COMPLEX_TYPE) if (code1 == COMPLEX_TYPE || code2 == COMPLEX_TYPE)
{ {
tree subtype1, subtype2, subtype; tree subtype1 = code1 == COMPLEX_TYPE ? TREE_TYPE (t1) : t1;
if (code1 == COMPLEX_TYPE) tree subtype2 = code2 == COMPLEX_TYPE ? TREE_TYPE (t2) : t2;
subtype1 = TREE_TYPE (t1); tree subtype = common_type (subtype1, subtype2);
else
subtype1 = t1; if (code1 == COMPLEX_TYPE && TREE_TYPE (t1) == subtype)
if (code2 == COMPLEX_TYPE) return t1;
subtype2 = TREE_TYPE (t2); else if (code2 == COMPLEX_TYPE && TREE_TYPE (t2) == subtype)
return t2;
else else
subtype2 = t2;
subtype = common_type (subtype1, subtype2);
return build_complex_type (subtype); return build_complex_type (subtype);
} }
...@@ -2358,7 +2357,7 @@ build_binary_op (code, orig_op0, orig_op1, convert_p) ...@@ -2358,7 +2357,7 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
/* Comparison operations are shortened too but differently. /* Comparison operations are shortened too but differently.
They identify themselves by setting short_compare = 1. */ They identify themselves by setting short_compare = 1. */
if (short_compare && none_complex) if (short_compare)
{ {
/* Don't write &op0, etc., because that would prevent op0 /* Don't write &op0, etc., because that would prevent op0
from being kept in a register. from being kept in a register.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment