On Thu, 6 Nov 2014, Richard Biener wrote:
+/* Try simple folding for X op !X, and X op X with the help + of the truth_valued_p and logical_inverted_value predicates. */ +(match truth_valued_p + @0 + (if (INTEGRAL_TYPE_P (type) && TYPE_PRECISION (type) == 1))) +(for op (lt le eq ne ge gt truth_and truth_andif truth_or truth_orif truth_xor) + (match truth_valued_p + (op @0 @1))) +(match truth_valued_p + (truth_not @0)) + +(match (logical_inverted_value @0) + (bit_not truth_valued_p@0)) +(match (logical_inverted_value @0) + (eq @0 integer_zerop) + (if (INTEGRAL_TYPE_P (TREE_TYPE (@0))))) +(match (logical_inverted_value @0) + (ne truth_valued_p@0 integer_onep) + (if (INTEGRAL_TYPE_P (TREE_TYPE (@0))))) +(match (logical_inverted_value @0) + (bit_xor truth_valued_p@0 integer_onep)) + +/* X & !X -> 0. */ +(simplify + (bit_and:c @0 (logical_inverted_value @0)) + { build_zero_cst (type); }) +/* X | !X and X ^ !X -> 1, , if X is truth-valued. */ +(for op (bit_ior bit_xor) + (simplify + (op:c truth_valued_p@0 (logical_inverted_value @0)) + { build_one_cst (type); }))
Shouldn't that be build_true_cst (type) so it is -1 for vectors? It seems that it could match: vec a, b; vec c=a<b; vec d=~c; vec e=c|d; -- Marc Glisse