Skip to content

Commit

Permalink
[X86][TBM] Add tests showing failure to fold RFLAGS result into TBM i…
Browse files Browse the repository at this point in the history
…nstructions.

And fails to select TBM instructions at all.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310790 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
RKSimon committed Aug 13, 2017
1 parent b554ed7 commit 2f6bcf0
Show file tree
Hide file tree
Showing 2 changed files with 353 additions and 2 deletions.
28 changes: 28 additions & 0 deletions test/CodeGen/X86/tbm-intrinsics-x86_64.ll
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@ entry:
ret i32 %0
}

define i32 @test_x86_tbm_bextri_u32_z(i32 %a, i32 %b) nounwind readonly {
; CHECK-LABEL: test_x86_tbm_bextri_u32_z:
; CHECK: # BB#0: # %entry
; CHECK-NEXT: bextr $2814, %edi, %eax # imm = 0xAFE
; CHECK-NEXT: testl %eax, %eax
; CHECK-NEXT: cmovel %esi, %eax
; CHECK-NEXT: retq
entry:
%0 = tail call i32 @llvm.x86.tbm.bextri.u32(i32 %a, i32 2814)
%1 = icmp eq i32 %0, 0
%2 = select i1 %1, i32 %b, i32 %0
ret i32 %2
}

define i64 @test_x86_tbm_bextri_u64(i64 %a) nounwind readnone {
; CHECK-LABEL: test_x86_tbm_bextri_u64:
; CHECK: # BB#0: # %entry
Expand All @@ -46,3 +60,17 @@ entry:
%0 = tail call i64 @llvm.x86.tbm.bextri.u64(i64 %tmp1, i64 2814)
ret i64 %0
}

define i64 @test_x86_tbm_bextri_u64_z(i64 %a, i64 %b) nounwind readnone {
; CHECK-LABEL: test_x86_tbm_bextri_u64_z:
; CHECK: # BB#0: # %entry
; CHECK-NEXT: bextr $2814, %rdi, %rax # imm = 0xAFE
; CHECK-NEXT: testq %rax, %rax
; CHECK-NEXT: cmoveq %rsi, %rax
; CHECK-NEXT: retq
entry:
%0 = tail call i64 @llvm.x86.tbm.bextri.u64(i64 %a, i64 2814)
%1 = icmp eq i64 %0, 0
%2 = select i1 %1, i64 %b, i64 %0
ret i64 %2
}
Loading

0 comments on commit 2f6bcf0

Please sign in to comment.