Skip to content

Commit

Permalink
Merge #2217
Browse files Browse the repository at this point in the history
2217: Fix bug in i64.rotr X 0 in compiler-llvm, add wasmer wast tests r=MarkMcCaskey a=MarkMcCaskey

Resolves #2215 

I applied all the tests on the `i32` shift instructions to the `i64` ones too. I didn't update all the tests to test the edge cases in the exact same way that the `i32` one is doing, but I did update some of them to be 64-bit specific (for example anywhere a 32bit constant appeared, I changed that to 64 in the tests for 64bit rotates).

# Review

- [ ] Add a short description of the the change to the CHANGELOG.md file


Co-authored-by: Mark McCaskey <[email protected]>
  • Loading branch information
bors[bot] and Mark McCaskey authored Mar 26, 2021
2 parents 2948bc7 + 74a0550 commit 72d4733
Show file tree
Hide file tree
Showing 2 changed files with 225 additions and 61 deletions.
4 changes: 2 additions & 2 deletions lib/compiler-llvm/src/translator/code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3118,8 +3118,8 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
let v2 = self.builder.build_and(v2, mask, "");
let lhs = self.builder.build_right_shift(v1, v2, false, "");
let rhs = {
let int_width = self.intrinsics.i64_ty.const_int(64 as u64, false);
let rhs = self.builder.build_int_sub(int_width, v2, "");
let negv2 = self.builder.build_int_neg(v2, "");
let rhs = self.builder.build_and(negv2, mask, "");
self.builder.build_left_shift(v1, rhs, "")
};
let res = self.builder.build_or(lhs, rhs, "");
Expand Down
Loading

0 comments on commit 72d4733

Please sign in to comment.