Commit 64f7ea7c by Kugan Vivekanandarajah Committed by Kugan Vivekanandarajah

gimplefe-30.c: New test.


gcc/testsuite/ChangeLog:

2018-10-28  Kugan Vivekanandarajah  <kuganv@linaro.org>

	* gcc.dg/gimplefe-30.c: New test.
	* gcc.dg/gimplefe-31.c: New test.
	* gcc.dg/gimplefe-32.c: New test.
	* gcc.dg/gimplefe-33.c: New test.


gcc/ChangeLog:

2018-10-28  Kugan Vivekanandarajah  <kuganv@linaro.org>

	* doc/generic.texi (ABSU_EXPR): Document.
        * match.pd (absu(x)*absu(x) -> x*x): Handle.
        (absu(absu(X)) -> absu(X)): Likewise.
        (absu(-X) -> absu(X)): Likewise.
        (absu(X)  where X is nonnegative -> X): Likewise.

From-SVN: r265578
parent 881eaae6
2018-10-28 Kugan Vivekanandarajah <kuganv@linaro.org>
* doc/generic.texi (ABSU_EXPR): Document.
* match.pd (absu(x)*absu(x) -> x*x): Handle.
(absu(absu(X)) -> absu(X)): Likewise.
(absu(-X) -> absu(X)): Likewise.
(absu(X) where X is nonnegative -> X): Likewise.
2018-10-28 Iain Buclaw <ibuclaw@gdcproject.org> 2018-10-28 Iain Buclaw <ibuclaw@gdcproject.org>
* Makefile.in (tm_d_file_list, tm_d_include_list): New variables. * Makefile.in (tm_d_file_list, tm_d_include_list): New variables.
...@@ -1274,6 +1274,7 @@ the byte offset of the field, but should not be used directly; call ...@@ -1274,6 +1274,7 @@ the byte offset of the field, but should not be used directly; call
@subsection Unary and Binary Expressions @subsection Unary and Binary Expressions
@tindex NEGATE_EXPR @tindex NEGATE_EXPR
@tindex ABS_EXPR @tindex ABS_EXPR
@tindex ABSU_EXPR
@tindex BIT_NOT_EXPR @tindex BIT_NOT_EXPR
@tindex TRUTH_NOT_EXPR @tindex TRUTH_NOT_EXPR
@tindex PREDECREMENT_EXPR @tindex PREDECREMENT_EXPR
...@@ -1371,6 +1372,11 @@ or complex abs of a complex value, use the @code{BUILT_IN_CABS}, ...@@ -1371,6 +1372,11 @@ or complex abs of a complex value, use the @code{BUILT_IN_CABS},
to implement the C99 @code{cabs}, @code{cabsf} and @code{cabsl} to implement the C99 @code{cabs}, @code{cabsf} and @code{cabsl}
built-in functions. built-in functions.
@item ABSU_EXPR
These nodes represent the absolute value of the single operand in
equivalent unsigned type such that @code{ABSU_EXPR} of TYPE_MIN is
well defined.
@item BIT_NOT_EXPR @item BIT_NOT_EXPR
These nodes represent bitwise complement, and will always have integral These nodes represent bitwise complement, and will always have integral
type. The only operand is the value to be complemented. type. The only operand is the value to be complemented.
......
...@@ -590,6 +590,11 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) ...@@ -590,6 +590,11 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
(mult (abs@1 @0) @1) (mult (abs@1 @0) @1)
(mult @0 @0)) (mult @0 @0))
/* Convert absu(x)*absu(x) -> x*x. */
(simplify
(mult (absu@1 @0) @1)
(mult (convert@2 @0) @2))
/* cos(copysign(x, y)) -> cos(x). Similarly for cosh. */ /* cos(copysign(x, y)) -> cos(x). Similarly for cosh. */
(for coss (COS COSH) (for coss (COS COSH)
copysigns (COPYSIGN) copysigns (COPYSIGN)
...@@ -1121,16 +1126,35 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) ...@@ -1121,16 +1126,35 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
&& tree_nop_conversion_p (type, TREE_TYPE (@2))) && tree_nop_conversion_p (type, TREE_TYPE (@2)))
(bit_xor (convert @1) (convert @2)))) (bit_xor (convert @1) (convert @2))))
/* Convert abs (abs (X)) into abs (X).
also absu (absu (X)) into absu (X). */
(simplify (simplify
(abs (abs@1 @0)) (abs (abs@1 @0))
@1) @1)
(simplify
(absu (convert@2 (absu@1 @0)))
(if (tree_nop_conversion_p (TREE_TYPE (@2), TREE_TYPE (@1)))
@1))
/* Convert abs[u] (-X) -> abs[u] (X). */
(simplify (simplify
(abs (negate @0)) (abs (negate @0))
(abs @0)) (abs @0))
(simplify
(absu (negate @0))
(absu @0))
/* Convert abs[u] (X) where X is nonnegative -> (X). */
(simplify (simplify
(abs tree_expr_nonnegative_p@0) (abs tree_expr_nonnegative_p@0)
@0) @0)
(simplify
(absu tree_expr_nonnegative_p@0)
(convert @0))
/* A few cases of fold-const.c negate_expr_p predicate. */ /* A few cases of fold-const.c negate_expr_p predicate. */
(match negate_expr_p (match negate_expr_p
INTEGER_CST INTEGER_CST
......
2018-10-28 Kugan Vivekanandarajah <kuganv@linaro.org>
* gcc.dg/gimplefe-30.c: New test.
* gcc.dg/gimplefe-31.c: New test.
* gcc.dg/gimplefe-32.c: New test.
* gcc.dg/gimplefe-33.c: New test.
2018-10-28 Iain Buclaw <ibuclaw@gdcproject.org> 2018-10-28 Iain Buclaw <ibuclaw@gdcproject.org>
* gcc.misc-tests/help.exp: Add D to option descriptions check. * gcc.misc-tests/help.exp: Add D to option descriptions check.
......
/* { dg-do compile } */
/* { dg-options "-O -fgimple -fdump-tree-optimized" } */
unsigned int __GIMPLE() f(int a)
{
unsigned int t0;
unsigned int t1;
unsigned int t2;
t0 = __ABSU a;
t1 = __ABSU a;
t2 = t0 * t1;
return t2;
}
/* { dg-final { scan-tree-dump-times "ABSU" 0 "optimized" } } */
/* { dg-do compile } */
/* { dg-options "-O -fgimple -fdump-tree-optimized" } */
unsigned int __GIMPLE() f(int a)
{
unsigned int t0;
int t1;
unsigned int t2;
t0 = __ABSU a;
t1 = (int) t0;
t2 = __ABSU t1;
return t2;
}
/* { dg-final { scan-tree-dump-times "ABSU" 1 "optimized" } } */
/* { dg-do compile } */
/* { dg-options "-O -fgimple -fdump-tree-optimized" } */
unsigned int __GIMPLE() f(int a)
{
int t0;
unsigned int t1;
t0 = -a;
t1 = __ABSU a;
return t1;
}
/* { dg-final { scan-tree-dump-times "= -" 0 "optimized" } } */
/* { dg-do compile } */
/* { dg-options "-O -fgimple -fdump-tree-optimized" } */
int __GIMPLE() f(int c)
{
int D;
int _1;
unsigned int _2;
_1 = __ABS c;
_2 = __ABSU _1;
D = (int) _2;
return D;
}
/* { dg-final { scan-tree-dump-times "ABSU" 0 "optimized" } } */
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