--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -1896,10 +1896,13 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
 (for cmp (simple_comparison)
      scmp (swapped_simple_comparison)
  (simplify
-  (cmp (bit_not@2 @0) CONSTANT_CLASS_P@1)
+  (cmp (convert?@3 (bit_not@2 @0)) CONSTANT_CLASS_P@1)
   (if (single_use (@2)
-       && (TREE_CODE (@1) == INTEGER_CST || TREE_CODE (@1) == VECTOR_CST))
-   (scmp @0 (bit_not @1)))))
+       && (TREE_CODE (@1) == INTEGER_CST || TREE_CODE (@1) == VECTOR_CST)
+       && (TYPE_PRECISION (TREE_TYPE (@3)) == TYPE_PRECISION (TREE_TYPE (@2)))
+       && tree_nop_conversion_p (type, TREE_TYPE (@0)))
+   (with { tree newtype = TREE_TYPE (@1); }
+    (scmp (view_convert:newtype @0) (bit_not @1))))))

Could you explain in English what you are doing?
'type' is always the outer type, in this case the result of the comparison, could be boolean for instance. Asking for tree_nop_conversion_p between @0 and that type seems strange. Also, you are not allowed to use TYPE_PRECISION on a vector type.

--
Marc Glisse

Reply via email to