Skip to content

Commit 32e9a12

Browse files
committed
fix test
1 parent 67d56ef commit 32e9a12

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

tests/disas/winch/x64/atomic/rmw/i64_atomic_rmw32_subu.wat

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,33 @@
44
(module
55
(memory 1 1 shared)
66
(func (export "_start") (result i64)
7-
(i64.atomic.rmw8.sub_u (i32.const 0) (i64.const 42))))
7+
(i64.atomic.rmw32.sub_u (i32.const 0) (i64.const 42))))
88
;; wasm[0]::function[0]:
99
;; pushq %rbp
1010
;; movq %rsp, %rbp
1111
;; movq 8(%rdi), %r11
1212
;; movq 0x10(%r11), %r11
1313
;; addq $0x10, %r11
1414
;; cmpq %rsp, %r11
15-
;; ja 0x52
15+
;; ja 0x61
1616
;; 1c: movq %rdi, %r14
1717
;; subq $0x10, %rsp
1818
;; movq %rdi, 8(%rsp)
1919
;; movq %rsi, (%rsp)
2020
;; movq $0x2a, %rax
2121
;; movl $0, %ecx
22+
;; andl $3, %ecx
23+
;; cmpl $0, %ecx
24+
;; jne 0x63
25+
;; 44: movl $0, %ecx
2226
;; movq 0x58(%r14), %r11
2327
;; movq (%r11), %rdx
2428
;; addq %rcx, %rdx
25-
;; negb %al
26-
;; lock xaddb %al, (%rdx)
27-
;; movzbq %al, %rax
29+
;; negl %eax
30+
;; lock xaddl %eax, (%rdx)
31+
;; movl %eax, %eax
2832
;; addq $0x10, %rsp
2933
;; popq %rbp
3034
;; retq
31-
;; 52: ud2
35+
;; 61: ud2
36+
;; 63: ud2

winch/codegen/src/visitor.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2356,7 +2356,12 @@ where
23562356
}
23572357

23582358
fn visit_i64_atomic_rmw32_add_u(&mut self, arg: MemArg) -> Self::Output {
2359-
self.emit_atomic_rmw(&arg, RmwOp::Add, OperandSize::S32, None)
2359+
self.emit_atomic_rmw(
2360+
&arg,
2361+
RmwOp::Add,
2362+
OperandSize::S32,
2363+
Some(ExtendKind::I64Extend32U),
2364+
)
23602365
}
23612366

23622367
fn visit_i64_atomic_rmw_add(&mut self, arg: MemArg) -> Self::Output {
@@ -2408,7 +2413,12 @@ where
24082413
}
24092414

24102415
fn visit_i64_atomic_rmw32_sub_u(&mut self, arg: MemArg) -> Self::Output {
2411-
self.emit_atomic_rmw(&arg, RmwOp::Sub, OperandSize::S32, None)
2416+
self.emit_atomic_rmw(
2417+
&arg,
2418+
RmwOp::Sub,
2419+
OperandSize::S32,
2420+
Some(ExtendKind::I64Extend32U),
2421+
)
24122422
}
24132423

24142424
wasmparser::for_each_visit_operator!(def_unsupported);

0 commit comments

Comments
 (0)