On Wed, 4 Nov 2015, Hurugalawadi, Naveen wrote:

I thought we were mostly using the 'convert?'
and tree_nop_conversion_p on integers

Done. Cleared all instances of convert which are not required.
However, I am still confused about the use of "convert" in match
and simplify.

It could be that I am wrong, you'll have to wait for Richard's comments anyway. The one place where a convert could be useful is:
(div (convert? (bit_and @0 INTEGER_CST@1)) INTEGER_CST@2)
but I didn't check if we want it (it would probably at least require (convert @0) instead of plain @0 in the result so the division and the shift are done with the same signedness).

So all patterns looking at arg[01] are handling nop-conversions on their
outermost operands while those looking at op[01] do not.

These patterns are looking at arg[01] rather than op[01] ?

Might be a case where it doesn't really matter which one you look at, and the easiest one in fold-const may not be the same as in match.pd.

+/* Convert (A/B)/C to A/(B*C)  */
+(simplify
+ (rdiv (rdiv @0 @1) @2)
+  (if (flag_reciprocal_math)

I would indent this line the same as the one above.

+   (rdiv @0 (mult @1 @2))))
+
+/* Convert A/(B/C) to (A/B)*C  */
+(simplify
+ (rdiv @0 (rdiv @1 @2))
+  (if (flag_reciprocal_math)
+   (mult (rdiv @0 @1) @2)))

I believe you might want a :s on the inner rdiv (?).
Note that you can factor out the test on flag_reciprocal_math so you write it only once for 2 patterns.

I don't really remember what the tests !TYPE_UNSIGNED (type) and tree_int_cst_sgn are for in the other pattern, but since you are only moving the transformation...

--
Marc Glisse

Reply via email to