[Cranelift] add simplification rules by myunbin · Pull Request #12799 · bytecodealliance/wasmtime

Skip to content

Navigation Menu

Sign in

Appearance settings

Conversation

@myunbin

This PR adds several simplification rules:

arithmetic.isle

  • ((x + y) - (x + z)) --> (y - z)
  • ((x - z) - (y - z)) --> (x - y)
  • ((x - y) - (x - z)) --> (z - y)
  • min(x, y) + max(x, y) --> x + y
  • ((x - y) + (y + z)) --> (x + z)
  • (x - (x + y)) --> -y
  • (x + (y + (z - x))) --> (y + z)
  • (x + y) == (y + x) --> true
  • (x - y) != x --> y != 0

bitops.isle

  • ((x & ~y) - (x & y)) --> ((x ^ y) - y)
  • (x & ~y) | (~x & y) --> (x ^ y)
  • (x & ~y) | (x ^ y) --> (x ^ y)
  • (x & ~y) ^ ~x --> ~(x & y)
  • (~x & y) ^ x --> x | y
  • (x | y) & ~(x ^ y) --> x & y
  • x | ~(x ^ y) --> x | ~y
  • x | ((~x) ^ y) --> x | ~y
  • x & ~(x ^ y) --> x & y
  • x & ((~x) ^ y) --> x & y
  • (x | y) | (x ^ y) --> (x | y)
  • (x ^ y) & (x ^ (y ^ z)) --> (x ^ y) & ~z
  • (~x & y) ^ z --> (x & y) ^ (z ^ y)
  • ~x - ~y --> y - x
  • (~x & y) | ~(x | y) --> ~x
  • (~x | y) & ~(x & y) --> ~x
  • (x & y) | ~(x | y) --> ~(x ^ y)
  • (~x | y) ^ (x ^ y) --> x | ~y

cc @bongjunj

@github-actions

Subscribe to Label Action

cc @cfallin, @fitzgen

Details 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.

@myunbin

I’m trying to identify the reason for the CI failure, but since it’s difficult to check on local environment, I will check various scenarios.

I would appreciate it if you could ignore this PR until it is completed.

Labels

cranelift

Issues related to the Cranelift code generator

isle

Related to the ISLE domain-specific language

1 participant

@myunbin