Hi all,
  While moving the simple A CMP 0 ? A : -A patterns from
fold_cond_expr_with_comparison to match, I ran into an issue where
using cond directly in the patterns work while "for cnd (cond
vec_cond)" don't work.
It looks like in the first case we are able to correctly handle the
cond first operand being a comparison while with the for loop we are
not.

That is the following additional pattern works:
/* A == 0? A : -A    same as -A */
(simplify
 (cond (eq @0 zerop) @0 (negate@1 @0))
  (if (!HONOR_SIGNED_ZEROS (element_mode (type)))
   @1))
(simplify
 (cond (eq @0 zerop) zerop (negate@1 @0))
  (if (!HONOR_SIGNED_ZEROS (element_mode (type)))
   @1)))

While this one does not work:
(for cnd (cond vec_cond)
/* A == 0? A : -A    same as -A */
(simplify
 (cnd (eq @0 zerop) @0 (negate@1 @0))
  (if (!HONOR_SIGNED_ZEROS (element_mode (type)))
   @1))
(simplify
 (cnd (eq @0 zerop) zerop (negate@1 @0))
  (if (!HONOR_SIGNED_ZEROS (element_mode (type)))
   @1)))

---- CUT ---
I will try to debug genmatch some but I wanted to get this email out
to record what will need to be fixed to continue the movement of
phiopt over to match.

Thanks,
Andrew Pinski

Reply via email to