This moves the `(pointer_diff (pointer_plus @0 @2) (pointer_plus @1 @2))` pattern
to right below the `(pointer_diff (pointer_plus @0 @1) (pointer_plus @0 @2))` pattern
to make easier to see both versions are supported.
Bootstrapped and tested on x86_64-linux-gnu.
gcc/ChangeLog:
* match.pd (`(ptr_diff (ptr_plus @0 @2) (ptr_plus @1 @2))`): Move pattern
earlier to the other `(ptr_diff (ptr_plus) (ptr_plus))` pattern.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
(pointer_diff (pointer_plus @0 @1) (pointer_plus @0 @2))
(if (TYPE_OVERFLOW_WRAPS (TREE_TYPE (@1)))
(convert (minus @1 @2))))
+(simplify
+ (pointer_diff (pointer_plus @0 @2) (pointer_plus @1 @2))
+ (pointer_diff @0 @1))
/* X - Z < Y - Z is the same as X < Y when there is no overflow. */
(for op (lt le ge gt)
&& TREE_CODE (@2) == INTEGER_CST
&& tree_int_cst_sign_bit (@2) == 0))
(minus (convert @1) (convert @2)))))
- (simplify
- (pointer_diff (pointer_plus @0 @2) (pointer_plus @1 @2))
- (pointer_diff @0 @1))
(simplify
(pointer_diff (pointer_plus @@0 @1) (pointer_plus @0 @2))
/* The second argument of pointer_plus must be interpreted as signed, and