Does ISLE support or
patterns?
I'd like to replace
;; eq(x, y) && ne(x, y) == ne(x, y) && eq(x, y) == false.
(rule (simplify (band ty (eq ty x y) (ne ty x y))) (subsume (iconst ty (imm64 0))))
(rule (simplify (band ty (ne ty x y) (eq ty x y))) (subsume (iconst ty (imm64 0))))
;; eq(x, y) && ult(x, y) == ult(x, y) && eq(x, y) == false.
(rule (simplify (band ty (eq ty x y) (ult ty x y))) (subsume (iconst ty (imm64 0))))
(rule (simplify (band ty (ult ty x y) (eq ty x y))) (subsume (iconst ty (imm64 0))))
;; eq(x, y) && ugt(x, y) == ugt(x, y) && eq(x, y) == false.
(rule (simplify (band ty (eq ty x y) (ugt ty x y))) (subsume (iconst ty (imm64 0))))
(rule (simplify (band ty (ugt ty x y) (eq ty x y))) (subsume (iconst ty (imm64 0))))
;; eq(x, y) && slt(x, y) == slt(x, y) && eq(x, y) == false.
(rule (simplify (band ty (eq ty x y) (slt ty x y))) (subsume (iconst ty (imm64 0))))
(rule (simplify (band ty (slt ty x y) (eq ty x y))) (subsume (iconst ty (imm64 0))))
with something like
(rule (simplify (band ty (eq ty x y) (icmp_inequality ty x y))) (subsume (iconst ty (imm64 0))))
(rule (simplify (band ty (icmp_inequality ty x y) (eq ty x y))) (subsume (iconst ty (imm64 0))))
Currently, no; @Trevor Elliott has talked about wanting to add them though
Where icmp_inequality
is
(decl icmp_inequality (Type Value Value) Value)
(extractor (icmp_inequality ty x y)
(or
(icmp ty (IntCC.NotEqual) x y)
(icmp ty (IntCC.NotEqual) y x)
(icmp ty (IntCC.UnsignedLessThan) x y)
(icmp ty (IntCC.UnsignedLessThan) y x)
(icmp ty (IntCC.UnsignedGreaterThan) x y)
(icmp ty (IntCC.UnsignedGreaterThan) y x)
(icmp ty (IntCC.SignedLessThan) x y)
(icmp ty (IntCC.SignedLessThan) y x)
(icmp ty (IntCC.SignedGreaterThan) x y)
(icmp ty (IntCC.SignedGreaterThan) y x)))
if you're up for a deep dive into islec, we could talk about how they might be implemented (basically: duplicate the rules in a desugaring pass) though
basically we don't have much developer time to hack on ISLE proper, so stuff has to be built by those who want it :-)
kmeakin has marked this topic as resolved.
Last updated: Nov 22 2024 at 16:03 UTC