Skip to content

Commit

Permalink
Cherrypick and release-notes update for 0.35.1. (#3909)
Browse files Browse the repository at this point in the history
* Fix uextend on x64 for non-i32-source cases. (#3906)

In #3849, I moved uextend over to ISLE in the x64 backend. Unfortunately, the lowering patterns had a bug in the i32-to-i64 special case (when we know the generating instruction zeroes the upper 32 bits): it wasn't actually special casing for an i32 source! This meant that e.g. zero extends of the results of i8 adds did not work properly.

This PR fixes the bug and updates the runtest for extends significantly to cover the narrow-value cases.

No security impact to Wasm as Wasm does not use narrow integer types.

Thanks @bjorn3 for reporting!

* Updated RELEASES for 0.35.1 patch release.
  • Loading branch information
cfallin authored Mar 9, 2022
1 parent 9137b4a commit 8cde5b7
Show file tree
Hide file tree
Showing 5 changed files with 321 additions and 114 deletions.
11 changes: 11 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

--------------------------------------------------------------------------------

## 0.35.1

Released 2022-03-09.

### Fixed

* Fixed a bug in the x86-64 lowering of the `uextend` opcode for narrow (`i8`,
`i16`) integer sources when the value is produced by one of several
arithmetic instructions.
[#3906](https://github.com/bytecodealliance/wasmtime/pull/3906)

## 0.35.0

Released 2022-03-07.
Expand Down
20 changes: 10 additions & 10 deletions cranelift/codegen/src/isa/x64/lower.isle
Original file line number Diff line number Diff line change
Expand Up @@ -1894,34 +1894,34 @@
;; keep these here than write an external extractor containing bits of
;; the instruction pattern.s)
(rule (lower (has_type $I64
(uextend src @ (iadd _ _))))
(uextend src @ (has_type $I32 (iadd _ _)))))
src)
(rule (lower (has_type $I64
(uextend src @ (iadd_ifcout _ _))))
(uextend src @ (has_type $I32 (iadd_ifcout _ _)))))
src)
(rule (lower (has_type $I64
(uextend src @ (isub _ _))))
(uextend src @ (has_type $I32 (isub _ _)))))
src)
(rule (lower (has_type $I64
(uextend src @ (imul _ _))))
(uextend src @ (has_type $I32 (imul _ _)))))
src)
(rule (lower (has_type $I64
(uextend src @ (band _ _))))
(uextend src @ (has_type $I32 (band _ _)))))
src)
(rule (lower (has_type $I64
(uextend src @ (bor _ _))))
(uextend src @ (has_type $I32 (bor _ _)))))
src)
(rule (lower (has_type $I64
(uextend src @ (bxor _ _))))
(uextend src @ (has_type $I32 (bxor _ _)))))
src)
(rule (lower (has_type $I64
(uextend src @ (ishl _ _))))
(uextend src @ (has_type $I32 (ishl _ _)))))
src)
(rule (lower (has_type $I64
(uextend src @ (ushr _ _))))
(uextend src @ (has_type $I32 (ushr _ _)))))
src)
(rule (lower (has_type $I64
(uextend src @ (uload32 _ _ _))))
(uextend src @ (has_type $I32 (uload32 _ _ _)))))
src)

;; Rules for `sextend` / `bextend` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
src/clif.isle 9ea75a6f790b5c03
src/prelude.isle b2bc986bcbbbb77
src/isa/x64/inst.isle 40f495d3ca5ae547
src/isa/x64/lower.isle faa2a07bba48a813
src/isa/x64/lower.isle c049f7d36db0e0fb
186 changes: 96 additions & 90 deletions cranelift/codegen/src/isa/x64/lower/isle/generated_code.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8cde5b7

Please sign in to comment.