Skip to content

Commit ad1c556

Browse files
committed
[X86][TBM] Add tests showing failure to fold RFLAGS result into TBM instructions.
And fails to select TBM instructions at all. llvm-svn: 310790
1 parent 799fa2c commit ad1c556

File tree

2 files changed

+353
-2
lines changed

2 files changed

+353
-2
lines changed

llvm/test/CodeGen/X86/tbm-intrinsics-x86_64.ll

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,20 @@ entry:
2424
ret i32 %0
2525
}
2626

27+
define i32 @test_x86_tbm_bextri_u32_z(i32 %a, i32 %b) nounwind readonly {
28+
; CHECK-LABEL: test_x86_tbm_bextri_u32_z:
29+
; CHECK: # BB#0: # %entry
30+
; CHECK-NEXT: bextr $2814, %edi, %eax # imm = 0xAFE
31+
; CHECK-NEXT: testl %eax, %eax
32+
; CHECK-NEXT: cmovel %esi, %eax
33+
; CHECK-NEXT: retq
34+
entry:
35+
%0 = tail call i32 @llvm.x86.tbm.bextri.u32(i32 %a, i32 2814)
36+
%1 = icmp eq i32 %0, 0
37+
%2 = select i1 %1, i32 %b, i32 %0
38+
ret i32 %2
39+
}
40+
2741
define i64 @test_x86_tbm_bextri_u64(i64 %a) nounwind readnone {
2842
; CHECK-LABEL: test_x86_tbm_bextri_u64:
2943
; CHECK: # BB#0: # %entry
@@ -46,3 +60,17 @@ entry:
4660
%0 = tail call i64 @llvm.x86.tbm.bextri.u64(i64 %tmp1, i64 2814)
4761
ret i64 %0
4862
}
63+
64+
define i64 @test_x86_tbm_bextri_u64_z(i64 %a, i64 %b) nounwind readnone {
65+
; CHECK-LABEL: test_x86_tbm_bextri_u64_z:
66+
; CHECK: # BB#0: # %entry
67+
; CHECK-NEXT: bextr $2814, %rdi, %rax # imm = 0xAFE
68+
; CHECK-NEXT: testq %rax, %rax
69+
; CHECK-NEXT: cmoveq %rsi, %rax
70+
; CHECK-NEXT: retq
71+
entry:
72+
%0 = tail call i64 @llvm.x86.tbm.bextri.u64(i64 %a, i64 2814)
73+
%1 = icmp eq i64 %0, 0
74+
%2 = select i1 %1, i64 %b, i64 %0
75+
ret i64 %2
76+
}

0 commit comments

Comments
 (0)