/* ~A + 1 -> -A */
  (simplify
   (plus (bit_not @0) integer_onep@1)
   (if (TREE_CODE (TREE_TYPE (@1)) != COMPLEX_TYPE
        || (TREE_CODE (@1) == COMPLEX_CST
            && integer_onep (TREE_REALPART (@1))
            && integer_onep (TREE_IMAGPART (@1))))
    (negate @0)))

the complex part cannot happen, since integer_onep already checks that the imaginary part is 0. I was thinking of adding a predicate: integer_each_onep (or other name) that would be equivalent to integer_onep except for complex where it would check for 1+i instead of 1. We already have 2 separate predicates for -1 that only differ for complex. And we would probably want a corresponding build_ function to produce such constants.

--
Marc Glisse

Reply via email to