Files
wasmtime/winch/filetests/filetests/x64/i64_add/max.wat
Saúl Cabrera 7c5c7e4b6d winch: Add full support for integer sub and add instructions (#5737)
This patch adds complete support for the `sub` and `add` WebAssembly instructions
for x64, and complete support for the `add` WebAssembly instruction for aarch64.

This patch also refactors how the binary operations get constructed within the
`VisitOperator` trait implementation. The refactor adds methods in the
`CodeGenContext` to abstract all the common steps to emit binary operations,
making this process less repetitive and less brittle (e.g. omitting to push the resulting value
to the stack, or omitting to free registers after used).

This patch also improves test coverage and refactors the filetests directory to make it
easier to add tests for other instructions.
2023-02-08 17:01:44 -08:00

17 lines
441 B
Plaintext

;;! target = "x86_64"
(module
(func (result i64)
(i64.const 1)
(i64.const 0x7fffffffffffffff)
(i64.add)
)
)
;; 0: 55 push rbp
;; 1: 4889e5 mov rbp, rsp
;; 4: 48c7c001000000 mov rax, 1
;; b: 49bbffffffffffffff7f
;; movabs r11, 0x7fffffffffffffff
;; 15: 4c01d8 add rax, r11
;; 18: 5d pop rbp
;; 19: c3 ret