Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #7 from microsoft/weba/fix-tvm-patch
Browse files Browse the repository at this point in the history
adding miss equal check
  • Loading branch information
yangchen-MS authored Sep 28, 2019
2 parents f1c5d2a + 8c1f0d3 commit 9b3a424
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmake/patches/halide_fp_simplify.patch
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ index 7174974..d23e988 100644
+ if (no_overflow(op->type) && (mod_a && mul_b)) {
+ const Mod* mod_b_a = mul_b->a.as<Mod>();
+ const Div* div_b_a_a = mod_b_a ? mod_b_a->a.as<Div>() : nullptr;
+ if (mod_b_a && div_b_a_a && equal(mod_a->b, mul_b->b) && equal(mod_a->b, div_b_a_a->b)) {
+ if (mod_b_a && div_b_a_a && equal(mod_a->b, mul_b->b) && equal(mod_a->b, div_b_a_a->b) && equal(mod_a->a, div_b_a_a->a)) {
+ // x%2 + ((x/2)%4)*2 -> x%(2*4)
+ expr = Mod::make(mod_a->a, mod_a->b * mod_b_a->b);
+ }
+ } else if (no_overflow(op->type) && (mul_a && mod_b)) {
+ const Mod* mod_a_a = mul_a->a.as<Mod>();
+ const Div* div_a_a_a = mod_a_a ? mod_a_a->a.as<Div>() : nullptr;
+ if (mod_a_a && div_a_a_a && equal(mod_b->b, mul_a->b) && equal(mod_b->b, div_a_a_a->b)) {
+ if (mod_a_a && div_a_a_a && equal(mod_b->b, mul_a->b) && equal(mod_b->b, div_a_a_a->b) && equal(mod_b->a, div_a_a_a->a)) {
+ // ((x/2)%4)*2 + x%2 -> x%(2*4)
+ expr = Mod::make(mod_b->a, mod_b->b * mod_a_a->b);
+ }
Expand Down

0 comments on commit 9b3a424

Please sign in to comment.