Skip to content

Conversation

@abrown
Copy link
Member

@abrown abrown commented May 4, 2020

This adds a legalization for sshr.i64x2 and fixes some issues I found while doing this. It is based on the changes from #1645 since some of the display changes there made these issues easier to troubleshoot.

@github-actions github-actions bot added cranelift Issues related to the Cranelift code generator cranelift:docs cranelift:meta Everything related to the meta-language. cranelift:wasm labels May 4, 2020
@github-actions
Copy link

github-actions bot commented May 4, 2020

Subscribe to Label Action

cc @bnjbvr

Details This issue or pull request has been labeled: "cranelift", "cranelift:docs", "cranelift:meta", "cranelift:wasm"

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

  • bnjbvr: cranelift

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

Learn more.

@abrown abrown force-pushed the add-shift-i64x2 branch from 2303cfd to 3e8c2d4 Compare May 4, 2020 20:45
@abrown abrown requested a review from julian-seward1 May 4, 2020 20:45
v2 = sshr v0, v1
return v2
}
; run: %ishl_i64x2([1 -1], 0) == [1 -1]
Copy link
Contributor

Choose a reason for hiding this comment

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

I am confused by the use of ishl_64x2 at this point. Shouldn't that be ishr_64x2? The actual results shown are consistent with a signed shift right, not a shift left.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also I'd be happier if there were a couple more tests here. Could you add a test that 1000-(63)-000 >>signed 63 produces 111-(64)-111 and that 0111-(63)-111 >>signed 63 produces 000-(64)-000 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, good catch; yeah, that's likely an oversight from copying other tests. I'll fix these and add the additional tests.

Copy link
Contributor

@julian-seward1 julian-seward1 left a comment

Choose a reason for hiding this comment

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

r+ but with the request that the tests are clarified and slightly enhanced, as described.

abrown added 3 commits May 5, 2020 11:24
Previously, the logic was wrong on two counts:
 - It used the bits of the entire vector (e.g. i32x4 -> 128) instead of just the lane bits (e.g. i32x4 -> 32).
 - It used the type of the first operand before it was bitcast to its correct type. Remember that, by default, vectors are handed around as i8x16 and we must bitcast them to their correct type for Cranelift's verifier; see bytecodealliance#1147 for discussion on this. This fix simply uses the type of the instruction itself, which is equivalent and hopefully less fragile to any changes.
@abrown abrown force-pushed the add-shift-i64x2 branch from 3e8c2d4 to 2cbff1d Compare May 5, 2020 18:24
@abrown abrown merged commit cb47611 into bytecodealliance:master May 5, 2020
@abrown abrown deleted the add-shift-i64x2 branch May 5, 2020 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cranelift:meta Everything related to the meta-language. cranelift:wasm cranelift Issues related to the Cranelift code generator

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants