+2015-06-30 Marek Polacek <polacek@redhat.com>
+
+ * match.pd (X - (X / Y) * Y): Use convert1 and convert2. Convert
+ both operands of the resulting expression.
+
2015-06-30 Richard Biener <rguenther@suse.de>
* fold-const.c (fold_binary_loc): Move ~x & ~y -> ~(x | y) and
/* X - (X / Y) * Y is the same as X % Y. */
(simplify
- (minus (convert? @0) (convert? (mult (trunc_div @0 @1) @1)))
+ (minus (convert1? @0) (convert2? (mult (trunc_div @0 @1) @1)))
(if (INTEGRAL_TYPE_P (type) || VECTOR_INTEGER_TYPE_P (type))
- (convert (trunc_mod @0 @1))))
+ (trunc_mod (convert @0) (convert @1))))
/* Optimize TRUNC_MOD_EXPR by a power of two into a BIT_AND_EXPR,
i.e. "X % C" into "X & (C - 1)", if X and C are positive.
+2015-06-30 Marek Polacek <polacek@redhat.com>
+
+ * gcc.dg/fold-minus-6.c: New test.
+
2015-06-30 Edward Smith-Rowland <3dw4rd@verizon.net>
Implement N4197 - Adding u8 character literals
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-cddce1" } */
+
+int
+fn1 (int x)
+{
+ return 42L - (42 / x) * x;
+}
+
+long
+fn2 (int x)
+{
+ return 42L - (42 / x) * x;
+}
+
+int
+fn3 (long int x)
+{
+ return 42L - (42 / x) * x;
+}
+
+int
+fn4 (int a, int b)
+{
+ return a - (unsigned) ((a / b) * b);
+}
+
+int
+fn5 (int a, unsigned int b)
+{
+ return a - ((a / b) * b);
+}
+
+unsigned int
+fn6 (int a, int b)
+{
+ return a - ((a / b) * b);
+}
+
+/* { dg-final { scan-tree-dump-not " / " "cddce1" } } */
+/* { dg-final { scan-tree-dump-not " - " "cddce1" } } */
+/* { dg-final { scan-tree-dump-not " \\+ " "cddce1" } } */