I was wondering how to write transform that involves conversions
(without using c_expr) ?
for eg:
(T1)(~(T2) X)  -> ~(T1) X
// T1, T2 has same precision and X is an integral type not narrower than T1, T2

this could be written as:
(simplify
  (convert (bit_not (convert@0 integral_op_p@1)))
  if-expr
  transform)

How would the transform be written ?
with c_expr we could probably write as: (is that correct?)
(bit_not { fold_convert (type, @1); })

I was wondering whether we should have an explicit support for
conversions (something equivalent of "casting") ?
sth like:
(bit_not (cast type @0))

in case we want to cast to a type of another capture
we could use:
(foo (cast (type @0) @1)) ?  // cast @1 to @0's type
here type would be an operator that extracts type of the capture.

Another use of having type as an operator I guess would be for
type-matching (not sure if it's useful).
for instance:
(foo (bar @0 @1) @(type @0)@1)
that checks if @0, @1 have same types.

I was wondering on the same lines if we could introduce new
keyword "precision" analogous to type ?
(precision @0) would be short-hand for
TYPE_PRECISION (TREE_TYPE (@0))

So far I found couple patterns in fold_unary_loc with conversions
in transform:
(T1)(X p+ Y) into ((T1)X p+ Y)
(T1)(~(T2) X) -> ~(T1) X
(T1) (X * Y) -> (T1) X * (T1) Y

Thanks,
Prathamesh

Reply via email to