Skip to content

Conversation

@MaxGraey
Copy link
Contributor

This is final part of #4265

(i32(x) >= 0) & (i32(y) >= 0)   ==>   i32(x | y) >= 0
(i64(x) >= 0) & (i64(y) >= 0)   ==>   i64(x | y) >= 0

(i32(x) == -1) & (i32(y) == -1)   ==>   i32(x & y) == -1
(i64(x) == -1) & (i64(y) == -1)   ==>   i64(x & y) == -1

@MaxGraey
Copy link
Contributor Author

Fuzzed: ITERATION: 11267

@kripken could you take a look please?

(i32.ge_s (local.get $y) (i32.const 0))
))
;; (i64(x) >= 0) & (i64(y) >= 0) ==> i64(x | y) >= 0
(drop (i32.and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be i64? Does binaryen not error on this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, result type of LHS and RHS comparisons are i32. Also all this optimizations only apply for i32 and / or.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, thanks, I forgot that the comparisons return a bool, which is i32...

@kripken kripken merged commit cabe973 into WebAssembly:main Jan 26, 2022
@MaxGraey MaxGraey deleted the combine-and_part_7-8 branch January 26, 2022 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants