On Tue, 13 Oct 2015, Hurugalawadi, Naveen wrote:

Please find attached the patch as per your comments.

(hmm, maybe you missed the email I sent with other comments?)

+(simplify
+ (plus (convert? @0) (convert? (xdivamulminusa @0 @1)))
+  (if ((INTEGRAL_TYPE_P (type) || VECTOR_INTEGER_TYPE_P (type))
+       && tree_nop_conversion_p (type, TREE_TYPE (@0)))
+   (trunc_mod (convert @0) (convert @1))))

Is that true when the conversion changes from signed to unsigned? The existing transformation X - (X / Y) * Y appears to be broken as well.

(the version in fold-const is hard to trigger because of canonicalization, but it was slightly more general in that it allowed for VECTOR_CST)

+/* Fold (a * (1 << b)) into (a << b)  */
+(simplify
+ (mult:c @0 (convert? (lshift integer_onep@1 @2)))
+  (if (! FLOAT_TYPE_P (type)
+        && tree_nop_conversion_p (type, TREE_TYPE (@0)))
+   (lshift @0 (convert @2))))

Wrong test, did you mean TREE_TYPE (@1) maybe?

--
Marc Glisse

Reply via email to