+2015-05-15 Marc Glisse <marc.glisse@inria.fr>
+
+ PR tree-optimization/64454
+ * match.pd ((X % Y) % Y, (X % Y) < Y): New patterns.
+ (-1 - A -> ~A): Remove unnecessary condition.
+
2015-05-15 Gregor Richards <gregor.richards@uwaterloo.ca>
* config/i386/linux.h (MUSL_DYNAMIC_LINKER): Define.
(simplify
(mod @0 integer_minus_onep@1)
(if (!TYPE_UNSIGNED (type))
- { build_zero_cst (type); })))
+ { build_zero_cst (type); }))
+ /* (X % Y) % Y is just X % Y. */
+ (simplify
+ (mod (mod@2 @0 @1) @1)
+ @2))
/* X % -C is the same as X % C. */
(simplify
&& !sign_bit_p (@1, @1))
(trunc_mod @0 (negate @1))))
+/* X % Y is smaller than Y. */
+(for cmp (lt ge)
+ (simplify
+ (cmp (trunc_mod @0 @1) @1)
+ (if (TYPE_UNSIGNED (TREE_TYPE (@0)))
+ { constant_boolean_node (cmp == LT_EXPR, type); })))
+(for cmp (gt le)
+ (simplify
+ (cmp @1 (trunc_mod @0 @1))
+ (if (TYPE_UNSIGNED (TREE_TYPE (@0)))
+ { constant_boolean_node (cmp == GT_EXPR, type); })))
+
/* x | ~0 -> ~0 */
(simplify
(bit_ior @0 integer_all_onesp@1)
/* -1 - A -> ~A */
(simplify
(minus integer_all_onesp @0)
- (if (TREE_CODE (type) != COMPLEX_TYPE)
- (bit_not @0)))
+ (bit_not @0))
/* (T)(P + A) - (T)P -> (T) A */
(for add (plus pointer_plus)
+2015-05-15 Marc Glisse <marc.glisse@inria.fr>
+
+ PR tree-optimization/64454
+ * gcc.dg/modmod.c: New testcase.
+
2015-05-15 Ilya Enkovich <ilya.enkovich@intel.com>
* gcc.dg/lto/chkp-wrap-asm-name_0.c: New.
--- /dev/null
+/* { dg-options "-O -fdump-tree-optimized-raw" } */
+
+int f(int a, int b){
+ a %= b;
+ return a % b;
+}
+int g(unsigned a, unsigned b){
+ a %= b;
+ return a < b;
+}
+
+/* { dg-final { scan-tree-dump-times "trunc_mod_expr" 1 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */