re PR other/63387 (Optimize pairs of isnan() calls into a single isunordered())
2015-05-22 Marc Glisse <marc.glisse@inria.fr> PR tree-optimization/63387 gcc/ * match.pd ((X /[ex] A) * A -> X): Remove unnecessary condition. ((x ord x) & (y ord y) -> (x ord y), (x ord x) & (x ord y) -> (x ord y)): New simplifications. * fold-const.c (tree_unary_nonnegative_warnv_p) <ABS_EXPR>: Handle vectors like scalars. gcc/testsuite/ * gcc.dg/pr63387-2.c: New testcase. From-SVN: r223591
This commit is contained in:
parent
b8f75b8cde
commit
257b01ba3e
@ -1,3 +1,12 @@
|
||||
2015-05-22 Marc Glisse <marc.glisse@inria.fr>
|
||||
|
||||
PR tree-optimization/63387
|
||||
* match.pd ((X /[ex] A) * A -> X): Remove unnecessary condition.
|
||||
((x ord x) & (y ord y) -> (x ord y),
|
||||
(x ord x) & (x ord y) -> (x ord y)): New simplifications.
|
||||
* fold-const.c (tree_unary_nonnegative_warnv_p) <ABS_EXPR>: Handle
|
||||
vectors like scalars.
|
||||
|
||||
2015-05-22 Marc Glisse <marc.glisse@inria.fr>
|
||||
|
||||
* convert.c (convert_to_integer, convert_to_vector): Include the
|
||||
|
@ -14688,7 +14688,7 @@ tree_unary_nonnegative_warnv_p (enum tree_code code, tree type, tree op0,
|
||||
case ABS_EXPR:
|
||||
/* We can't return 1 if flag_wrapv is set because
|
||||
ABS_EXPR<INT_MIN> = INT_MIN. */
|
||||
if (!INTEGRAL_TYPE_P (type))
|
||||
if (!ANY_INTEGRAL_TYPE_P (type))
|
||||
return true;
|
||||
if (TYPE_OVERFLOW_UNDEFINED (type))
|
||||
{
|
||||
|
10
gcc/match.pd
10
gcc/match.pd
@ -818,8 +818,7 @@ along with GCC; see the file COPYING3. If not see
|
||||
(simplify
|
||||
(mult (convert? (exact_div @0 @1)) @1)
|
||||
/* Look through a sign-changing conversion. */
|
||||
(if (TYPE_PRECISION (TREE_TYPE (@0)) == TYPE_PRECISION (type))
|
||||
(convert @0)))
|
||||
(convert @0))
|
||||
|
||||
/* Canonicalization of binary operations. */
|
||||
|
||||
@ -970,9 +969,16 @@ along with GCC; see the file COPYING3. If not see
|
||||
(bit_ior (unordered @0 @0) (unordered @1 @1))
|
||||
(if (types_match (@0, @1))
|
||||
(unordered @0 @1)))
|
||||
(simplify
|
||||
(bit_and (ordered @0 @0) (ordered @1 @1))
|
||||
(if (types_match (@0, @1))
|
||||
(ordered @0 @1)))
|
||||
(simplify
|
||||
(bit_ior:c (unordered @0 @0) (unordered:c@2 @0 @1))
|
||||
@2)
|
||||
(simplify
|
||||
(bit_and:c (ordered @0 @0) (ordered:c@2 @0 @1))
|
||||
@2)
|
||||
|
||||
/* Simplification of math builtins. */
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2015-05-22 Marc Glisse <marc.glisse@inria.fr>
|
||||
|
||||
PR tree-optimization/63387
|
||||
* gcc.dg/pr63387-2.c: New testcase.
|
||||
|
||||
2015-05-22 Marc Glisse <marc.glisse@inria.fr>
|
||||
|
||||
* gcc.dg/simd-1.c: Update to the new message.
|
||||
|
26
gcc/testsuite/gcc.dg/pr63387-2.c
Normal file
26
gcc/testsuite/gcc.dg/pr63387-2.c
Normal file
@ -0,0 +1,26 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O -fdump-tree-optimized" } */
|
||||
|
||||
int f(double aaa, double bbb){
|
||||
int xa = !__builtin_isunordered(aaa, aaa);
|
||||
int xb = !__builtin_isunordered(bbb, bbb);
|
||||
return xa & xb;
|
||||
}
|
||||
|
||||
int g(double aaa, double bbb){
|
||||
int xa = !__builtin_isunordered(aaa, bbb);
|
||||
int xb = !__builtin_isunordered(bbb, bbb);
|
||||
return xa & xb;
|
||||
}
|
||||
|
||||
int h(double ccc, float ddd){
|
||||
int xc = !__builtin_isunordered(ccc, ccc);
|
||||
int xd = !__builtin_isunordered(ddd, ddd);
|
||||
return xc & xd;
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump-not "aaa\[^\n\r\]* ord aaa" "optimized" } } */
|
||||
/* { dg-final { scan-tree-dump-not "bbb\[^\n\r\]* ord bbb" "optimized" } } */
|
||||
/* { dg-final { scan-tree-dump-times "aaa\[^\n\r\]* ord bbb" 2 "optimized" } } */
|
||||
/* { dg-final { scan-tree-dump-not "ccc\[^\n\r\]* ord ddd" "optimized" } } */
|
||||
/* { dg-final { cleanup-tree-dump "optimized" } } */
|
Loading…
Reference in New Issue
Block a user