(I didn't read everything)
+/* Convert (A/B)/C to A/(B*C) */
+(simplify
+ (rdiv (convert? (rdiv @0 @1)) (convert? @2))
+ (if (flag_reciprocal_math
+ && tree_nop_conversion_p (type, TREE_TYPE (@0))
+ && tree_nop_conversion_p (type, TREE_TYPE (@2)))
+ (rdiv (convert @0) (convert (mult @1 @2)))))
I thought we were mostly using the 'convert?' and tree_nop_conversion_p on
integers, but I could be wrong. For floats, it seems limited to cases
where long double has the same size as double? In any case, the 'convert?'
on @2 seems strange, either useless or not sufficient.
+ (rdiv (REAL_CST@0) (mult (convert? @1) REAL_CST@2))
Here again, the 'convert?' seems useless, (mult @1 REAL_CST@2) would match
just as well.
+(simplify
+ (trunc_div (bit_and (convert? @0) @1) INTEGER_CST@2)
That would probably also work for exact_div.
Again, I don't see the point of this 'convert?'.
+ (if (!TYPE_UNSIGNED (type) && integer_pow2p (@2)
+ && tree_int_cst_sgn (@2) > 0
+ && tree_nop_conversion_p (type, TREE_TYPE (@0)))
+ (with
+ { tree sum = fold_binary (PLUS_EXPR, TREE_TYPE (@2), @2, @1); }
Don't you want to require that @1 is INTEGER_CST? And then you could use
const_binop, or even wi::add.
+ (if (sum && integer_zerop (sum))
+ (rshift (convert @0) { build_int_cst (integer_type_node,
+ wi::exact_log2 (@2)); })))))
--
Marc Glisse