Browse Source
x64 bugfix: prevent load-op fusion of cmp because it could be emitted multiple times.pull/2579/head
Chris Fallin
4 years ago
committed by
GitHub
2 changed files with 62 additions and 4 deletions
@ -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 |
|||
} |
Loading…
Reference in new issue