forked from bytecodealliance/wasmtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request bytecodealliance#2576 from cfallin/cmp-load-bug
x64 bugfix: prevent load-op fusion of cmp because it could be emitted multiple times.
- Loading branch information
Showing
2 changed files
with
62 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
test compile | ||
target x86_64 | ||
feature "experimental_x64" | ||
|
||
function %f0(i64, i64) -> i64, i64 { | ||
block0(v0: i64, v1: i64): | ||
v2 = load.i64 v1 | ||
; check: movq 0(%rsi), %rax | ||
|
||
v3 = icmp eq v0, v2 | ||
|
||
v4 = bint.i64 v3 | ||
; nextln: cmpq %rax, %rdi | ||
; nextln: setz %cl | ||
; nextln: movzbq %cl, %rcx | ||
|
||
v5 = select.i64 v3, v0, v1 | ||
; nextln: cmpq %rax, %rdi | ||
; nextln: cmovzq %rdi, %rsi | ||
|
||
return v4, v5 | ||
; nextln: movq %rcx, %rax | ||
; nextln: movq %rsi, %rdx | ||
} | ||
|
||
function %f1(f64, i64) -> i64, f64 { | ||
block0(v0: f64, v1: i64): | ||
v2 = load.f64 v1 | ||
; check: movsd 0(%rdi), %xmm1 | ||
|
||
v3 = fcmp eq v0, v2 | ||
|
||
v4 = bint.i64 v3 | ||
; nextln: ucomisd %xmm1, %xmm0 | ||
; nextln: setnp %dil | ||
; nextln: setz %sil | ||
; nextln: andl %edi, %esi | ||
; nextln: movzbq %sil, %rsi | ||
|
||
v5 = select.f64 v3, v0, v0 | ||
; nextln: ucomisd %xmm1, %xmm0 | ||
; nextln: movaps %xmm0, %xmm1 | ||
; nextln: jnp $$next; movsd %xmm0, %xmm1; $$next: | ||
; nextln: jz $$next; movsd %xmm0, %xmm1; $$next: | ||
|
||
return v4, v5 | ||
; nextln: movq %rsi, %rax | ||
; nextln: movaps %xmm1, %xmm0 | ||
} |