re PR middle-end/30433 (no longer folding __complex__(0.0, 1.0) == __complex__(1.0, 0.0))
2007-02-15 Andrew Pinski <andrew_pinski@playstation.sony.com> PR middle-end/30433 * fold-const.c (fold_comparison): Add back the folding of constant complex comparisions. 2007-02-15 Andrew Pinski <andrew_pinski@playstation.sony.com> PR middle-end/30433 * gcc.c-torture/compile/pr30433.c: New testcase to check that complex constants comparisions are foldded. From-SVN: r122029
This commit is contained in:
parent
76b9a2a1cd
commit
3c32c87f60
4 changed files with 37 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
2007-02-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
|
||||
|
||||
PR middle-end/30433
|
||||
* fold-const.c (fold_comparison): Add back the
|
||||
folding of constant complex comparisions.
|
||||
|
||||
2007-02-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
|
||||
|
||||
PR middle-end/30729
|
||||
|
|
|
@ -8852,6 +8852,29 @@ fold_comparison (enum tree_code code, tree type, tree op0, tree op1)
|
|||
}
|
||||
}
|
||||
|
||||
/* If this is a comparison of complex values and both sides
|
||||
are COMPLEX_CST, do the comparision by parts to fold the
|
||||
comparision. */
|
||||
if ((code == EQ_EXPR || code == NE_EXPR)
|
||||
&& TREE_CODE (TREE_TYPE (arg0)) == COMPLEX_TYPE
|
||||
&& TREE_CODE (arg0) == COMPLEX_CST
|
||||
&& TREE_CODE (arg1) == COMPLEX_CST)
|
||||
{
|
||||
tree real0, imag0, real1, imag1;
|
||||
enum tree_code outercode;
|
||||
|
||||
real0 = TREE_REALPART (arg0);
|
||||
imag0 = TREE_IMAGPART (arg0);
|
||||
real1 = TREE_REALPART (arg1);
|
||||
imag1 = TREE_IMAGPART (arg1);
|
||||
outercode = code == EQ_EXPR ? TRUTH_ANDIF_EXPR : TRUTH_ORIF_EXPR;
|
||||
|
||||
return fold_build2 (outercode, type,
|
||||
fold_build2 (code, type, real0, real1),
|
||||
fold_build2 (code, type, imag0, imag1));
|
||||
}
|
||||
|
||||
|
||||
/* Fold a comparison of the address of COMPONENT_REFs with the same
|
||||
type and component to a comparison of the address of the base
|
||||
object. In short, &x->a OP &y->a to x OP y and
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2007-02-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
|
||||
|
||||
PR middle-end/30433
|
||||
* gcc.c-torture/compile/pr30433.c: New testcase to check
|
||||
that complex constants comparisions are foldded.
|
||||
|
||||
2007-02-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
|
||||
|
||||
PR C++/30158
|
||||
|
|
2
gcc/testsuite/gcc.c-torture/compile/pr30433.c
Normal file
2
gcc/testsuite/gcc.c-torture/compile/pr30433.c
Normal file
|
@ -0,0 +1,2 @@
|
|||
int f = (_Complex float)(0.5) == 0.5;
|
||||
|
Loading…
Add table
Reference in a new issue