Strength reduction for operators and conditions.
This is the machine-dependent part of Constprop.
.
.
.
.
Original definition:
Nondetfunction op_strength_reduction
(op: operation) (args: list reg) (vl: list ival) :=
match op, args, vl with
| Oshrximm n, a1::nil, iv1::nil =>
if (int_is_nonnegative iv1)
then ((Oshruimm n), args)
else (op, args)
| Oshrxlimm n, a1::nil, iv1::nil =>
if (long_is_nonnegative iv1)
then ((Oshrluimm n), args)
else (op, args)
| Ocast32unsigned, a1::nil, iv1::nil =>
if int_is_nonnegative iv1
then (Ocast32signed, args)
else (op, args)
| _, _, _ => (op, args)
end.
Original definition:
Nondetfunction addr_strength_reduction
(addr: addressing) (args: list reg) (vl: list ival) :=
match addr, args, vl with
| (Aindexed n), a1::nil, iv1::nil => (addr, args)
| _, _, _ => (addr, args)
end.
Original definition:
Nondetfunction cond_strength_reduction
(cond: condition) (args: list reg) (vl: list ival) :=
match cond, args, vl with
| (Ccomp Cle), a1::a2::nil, iv1::iv2::nil =>
if (int_is_nonnegative iv1) && (int_is_nonnegative iv2)
then ((Ccompu Cle), args)
else (cond, args)
| _ => (cond, args)
end.