forked from OSchip/llvm-project
[X86] Add missing isel pattern for BLCFILL producing flags.
This commit is contained in:
parent
058cb1b47f
commit
68400a2308
|
@ -2919,6 +2919,11 @@ let Predicates = [HasTBM] in {
|
|||
(TZMSK64rr GR64:$src)>;
|
||||
|
||||
// Patterns to match flag producing ops.
|
||||
def : Pat<(and_flag_nocf GR32:$src, (add GR32:$src, 1)),
|
||||
(BLCFILL32rr GR32:$src)>;
|
||||
def : Pat<(and_flag_nocf GR64:$src, (add GR64:$src, 1)),
|
||||
(BLCFILL64rr GR64:$src)>;
|
||||
|
||||
def : Pat<(or_flag_nocf GR32:$src, (not (add GR32:$src, 1))),
|
||||
(BLCI32rr GR32:$src)>;
|
||||
def : Pat<(or_flag_nocf GR64:$src, (not (add GR64:$src, 1))),
|
||||
|
|
|
@ -964,4 +964,48 @@ define i64 @tzmsk64_branch(i64 %x) nounwind {
|
|||
ret i64 %tmp3
|
||||
}
|
||||
|
||||
define i32 @blcfill32_branch(i32 %x) nounwind {
|
||||
; CHECK-LABEL: blcfill32_branch:
|
||||
; CHECK: # %bb.0:
|
||||
; CHECK-NEXT: pushq %rbx
|
||||
; CHECK-NEXT: blcfilll %edi, %ebx
|
||||
; CHECK-NEXT: jne .LBB73_2
|
||||
; CHECK-NEXT: # %bb.1:
|
||||
; CHECK-NEXT: callq bar
|
||||
; CHECK-NEXT: .LBB73_2:
|
||||
; CHECK-NEXT: movl %ebx, %eax
|
||||
; CHECK-NEXT: popq %rbx
|
||||
; CHECK-NEXT: retq
|
||||
%tmp2 = add i32 %x, 1
|
||||
%tmp3 = and i32 %tmp2, %x
|
||||
%cmp = icmp eq i32 %tmp3, 0
|
||||
br i1 %cmp, label %1, label %2
|
||||
|
||||
tail call void @bar()
|
||||
br label %2
|
||||
ret i32 %tmp3
|
||||
}
|
||||
|
||||
define i64 @blcfill64_branch(i64 %x) nounwind {
|
||||
; CHECK-LABEL: blcfill64_branch:
|
||||
; CHECK: # %bb.0:
|
||||
; CHECK-NEXT: pushq %rbx
|
||||
; CHECK-NEXT: blcfillq %rdi, %rbx
|
||||
; CHECK-NEXT: jne .LBB74_2
|
||||
; CHECK-NEXT: # %bb.1:
|
||||
; CHECK-NEXT: callq bar
|
||||
; CHECK-NEXT: .LBB74_2:
|
||||
; CHECK-NEXT: movq %rbx, %rax
|
||||
; CHECK-NEXT: popq %rbx
|
||||
; CHECK-NEXT: retq
|
||||
%tmp2 = add i64 %x, 1
|
||||
%tmp3 = and i64 %tmp2, %x
|
||||
%cmp = icmp eq i64 %tmp3, 0
|
||||
br i1 %cmp, label %1, label %2
|
||||
|
||||
tail call void @bar()
|
||||
br label %2
|
||||
ret i64 %tmp3
|
||||
}
|
||||
|
||||
declare void @bar()
|
||||
|
|
Loading…
Reference in New Issue