This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
predicates on expressions ?
- From: Prathamesh Kulkarni <bilbotheelffriend at gmail dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>, Diego Novillo <dnovillo at google dot com>, gcc <gcc at gcc dot gnu dot org>, Maxim Kuvyrkov <maxim dot kuvyrkov at linaro dot org>
- Date: Mon, 14 Jul 2014 15:37:55 +0530
- Subject: predicates on expressions ?
- Authentication-results: sourceware.org; auth=none
I was wondering if it was a good idea to implement
predicate on expressions ?
Sth like:
(match_and_simplify
(op (op2:predicate @0))
transform)
instead of:
(match_and_simplify
(op (op2@1 @0))
if (predicate (@1))
transform)
When predicate is simple as just being a macro/function,
we could use this style and when the predicate is more complex
resort to using if-expr (or write the predicate as macro in gimple-match-head.c
and use the macro in pattern instead ...)
Example:
we could rewrite the pattern
(match_and_simplify
(plus:c @0 (negate @1))
if (!TYPE_SATURATING (type))
(minus @0 @1))
to
(match_and_simplify
(plus:c:NOT_TYPE_SATURATING_P @0 (negate @1))
(minus @0 @1))
with NOT_TYPE_SATURATING_P predicate defined
appropriately in gimple-match-head.c
However I am not entirely sure if adding predicates on expressions
would be very useful....
Thanks and Regards,
Prathamesh