wasmtime icon indicating copy to clipboard operation
wasmtime copied to clipboard

div to shift for positive power of 2 divs

Open KGrewal1 opened this issue 1 year ago • 3 comments

An attempt at adding isle opts for turning division by powers of two into ushr or sshr bit shifts

KGrewal1 avatar Apr 25 '24 13:04 KGrewal1

Subscribe to Label Action

cc @cfallin, @fitzgen

This issue or pull request has been labeled: "cranelift", "isle"

Thus the following users have been cc'd because of the following labels:

  • cfallin: isle
  • fitzgen: isle

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

github-actions[bot] avatar Apr 25 '24 16:04 github-actions[bot]

I don't think this is viable yet because the e-graph cannot rewrite side effecting instructions in general, see https://github.com/bytecodealliance/wasmtime/issues/5908 for more information.

I suspect that if you attempted to write a filetest exercising this rule, you'd find that it never fires because we never put division instructions into the egraph, and leave them in the "skeleton" outside of the graph.

fitzgen avatar Apr 25 '24 16:04 fitzgen

Ah ok: looking through that issue seems like the current div simplifications in that file also currently do nothing for the same reason...

KGrewal1 avatar Apr 25 '24 18:04 KGrewal1

@KGrewal1 I'm going to close this PR for now, as it's not possible to implement these rules with the constraints of our current e-graph implementation. We can re-open this PR if that changes in the future.

elliottt avatar May 02 '24 20:05 elliottt