Skip to content

Commit

Permalink
Add test for cascading branch-chomping behavior.
Browse files Browse the repository at this point in the history
  • Loading branch information
cfallin committed Jan 23, 2025
1 parent 82b833e commit 3a50e58
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions cranelift/filetests/filetests/isa/x64/branches.clif
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,45 @@ block2:
; popq %rbp
; retq

function %brif_i8_fcmp_same_target(f32, f32) -> i32 {
block0(v0: f32, v1: f32):
v2 = fcmp eq v0, v1
v3 = uextend.i32 v2
brif v3, block1, block1

block1:
v4 = iconst.i32 1
return v4
}

; VCode:
; pushq %rbp
; movq %rsp, %rbp
; block0:
; ucomiss %xmm1, %xmm0
; jp,nz label2; j label1
; block1:
; jmp label3
; block2:
; jmp label3
; block3:
; movl $1, %eax
; movq %rbp, %rsp
; popq %rbp
; ret
;
; Disassembled:
; block0: ; offset 0x0
; pushq %rbp
; movq %rsp, %rbp
; block1: ; offset 0x4
; ucomiss %xmm1, %xmm0
; block2: ; offset 0x7
; movl $1, %eax
; movq %rbp, %rsp
; popq %rbp
; retq

function %br_table_i32(i32) -> i32 {
block0(v0: i32):
br_table v0, block4, [block1, block2, block2, block3]
Expand Down

0 comments on commit 3a50e58

Please # to comment.