1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

[X86] Update tzcnt fast-isel tests to match clang r343126.

We now generate cttz with the zero_undef flag set to false. This allows -O0 to avoid the zero check.

llvm-svn: 343127
This commit is contained in:
Craig Topper 2018-09-26 17:19:28 +00:00
parent 6149964938
commit 8f7099c560
2 changed files with 22 additions and 74 deletions

View File

@ -67,14 +67,11 @@ define i64 @test__blsr_u64(i64 %a0) {
define i64 @test__tzcnt_u64(i64 %a0) {
; X64-LABEL: test__tzcnt_u64:
; X64: # %bb.0:
; X64-NEXT: tzcntq %rdi, %rcx
; X64-NEXT: movl $64, %eax
; X64-NEXT: cmovaeq %rcx, %rax
; X64-NEXT: tzcntq %rdi, %rax
; X64-NEXT: retq
%cmp = icmp ne i64 %a0, 0
%cttz = call i64 @llvm.cttz.i64(i64 %a0, i1 true)
%res = select i1 %cmp, i64 %cttz, i64 64
ret i64 %res
%cttz = call i64 @llvm.cttz.i64(i64 %a0, i1 false)
ret i64 %cttz
}
;
@ -151,14 +148,11 @@ define i64 @test_blsr_u64(i64 %a0) {
define i64 @test_tzcnt_u64(i64 %a0) {
; X64-LABEL: test_tzcnt_u64:
; X64: # %bb.0:
; X64-NEXT: tzcntq %rdi, %rcx
; X64-NEXT: movl $64, %eax
; X64-NEXT: cmovaeq %rcx, %rax
; X64-NEXT: tzcntq %rdi, %rax
; X64-NEXT: retq
%cmp = icmp ne i64 %a0, 0
%cttz = call i64 @llvm.cttz.i64(i64 %a0, i1 true)
%res = select i1 %cmp, i64 %cttz, i64 64
ret i64 %res
%cttz = call i64 @llvm.cttz.i64(i64 %a0, i1 false)
ret i64 %cttz
}
declare i64 @llvm.cttz.i64(i64, i1)

View File

@ -11,30 +11,17 @@
define i16 @test__tzcnt_u16(i16 %a0) {
; X32-LABEL: test__tzcnt_u16:
; X32: # %bb.0:
; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
; X32-NEXT: movzwl %ax, %ecx
; X32-NEXT: cmpl $0, %ecx
; X32-NEXT: jne .LBB0_1
; X32-NEXT: # %bb.2:
; X32-NEXT: movw $16, %ax
; X32-NEXT: retl
; X32-NEXT: .LBB0_1:
; X32-NEXT: tzcntw %ax, %ax
; X32-NEXT: tzcntw {{[0-9]+}}(%esp), %ax
; X32-NEXT: retl
;
; X64-LABEL: test__tzcnt_u16:
; X64: # %bb.0:
; X64-NEXT: movzwl %di, %eax
; X64-NEXT: tzcntw %ax, %cx
; X64-NEXT: cmpl $0, %eax
; X64-NEXT: movw $16, %ax
; X64-NEXT: cmovnew %cx, %ax
; X64-NEXT: tzcntw %di, %ax
; X64-NEXT: retq
%zext = zext i16 %a0 to i32
%cmp = icmp ne i32 %zext, 0
%cttz = call i16 @llvm.cttz.i16(i16 %a0, i1 true)
%res = select i1 %cmp, i16 %cttz, i16 16
ret i16 %res
%cttz = call i16 @llvm.cttz.i16(i16 %a0, i1 false)
ret i16 %cttz
}
define i32 @test__andn_u32(i32 %a0, i32 %a1) {
@ -134,26 +121,16 @@ define i32 @test__blsr_u32(i32 %a0) {
define i32 @test__tzcnt_u32(i32 %a0) {
; X32-LABEL: test__tzcnt_u32:
; X32: # %bb.0:
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
; X32-NEXT: cmpl $0, %eax
; X32-NEXT: jne .LBB6_1
; X32-NEXT: # %bb.2:
; X32-NEXT: movl $32, %eax
; X32-NEXT: retl
; X32-NEXT: .LBB6_1:
; X32-NEXT: tzcntl %eax, %eax
; X32-NEXT: tzcntl {{[0-9]+}}(%esp), %eax
; X32-NEXT: retl
;
; X64-LABEL: test__tzcnt_u32:
; X64: # %bb.0:
; X64-NEXT: tzcntl %edi, %ecx
; X64-NEXT: movl $32, %eax
; X64-NEXT: cmovael %ecx, %eax
; X64-NEXT: tzcntl %edi, %eax
; X64-NEXT: retq
%cmp = icmp ne i32 %a0, 0
%cttz = call i32 @llvm.cttz.i32(i32 %a0, i1 true)
%res = select i1 %cmp, i32 %cttz, i32 32
ret i32 %res
%cttz = call i32 @llvm.cttz.i32(i32 %a0, i1 false)
ret i32 %cttz
}
;
@ -163,30 +140,17 @@ define i32 @test__tzcnt_u32(i32 %a0) {
define i16 @test_tzcnt_u16(i16 %a0) {
; X32-LABEL: test_tzcnt_u16:
; X32: # %bb.0:
; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
; X32-NEXT: movzwl %ax, %ecx
; X32-NEXT: cmpl $0, %ecx
; X32-NEXT: jne .LBB7_1
; X32-NEXT: # %bb.2:
; X32-NEXT: movw $16, %ax
; X32-NEXT: retl
; X32-NEXT: .LBB7_1:
; X32-NEXT: tzcntw %ax, %ax
; X32-NEXT: tzcntw {{[0-9]+}}(%esp), %ax
; X32-NEXT: retl
;
; X64-LABEL: test_tzcnt_u16:
; X64: # %bb.0:
; X64-NEXT: movzwl %di, %eax
; X64-NEXT: tzcntw %ax, %cx
; X64-NEXT: cmpl $0, %eax
; X64-NEXT: movw $16, %ax
; X64-NEXT: cmovnew %cx, %ax
; X64-NEXT: tzcntw %di, %ax
; X64-NEXT: retq
%zext = zext i16 %a0 to i32
%cmp = icmp ne i32 %zext, 0
%cttz = call i16 @llvm.cttz.i16(i16 %a0, i1 true)
%res = select i1 %cmp, i16 %cttz, i16 16
ret i16 %res
%cttz = call i16 @llvm.cttz.i16(i16 %a0, i1 false)
ret i16 %cttz
}
define i32 @test_andn_u32(i32 %a0, i32 %a1) {
@ -299,26 +263,16 @@ define i32 @test_blsr_u32(i32 %a0) {
define i32 @test_tzcnt_u32(i32 %a0) {
; X32-LABEL: test_tzcnt_u32:
; X32: # %bb.0:
; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
; X32-NEXT: cmpl $0, %eax
; X32-NEXT: jne .LBB13_1
; X32-NEXT: # %bb.2:
; X32-NEXT: movl $32, %eax
; X32-NEXT: retl
; X32-NEXT: .LBB13_1:
; X32-NEXT: tzcntl %eax, %eax
; X32-NEXT: tzcntl {{[0-9]+}}(%esp), %eax
; X32-NEXT: retl
;
; X64-LABEL: test_tzcnt_u32:
; X64: # %bb.0:
; X64-NEXT: tzcntl %edi, %ecx
; X64-NEXT: movl $32, %eax
; X64-NEXT: cmovael %ecx, %eax
; X64-NEXT: tzcntl %edi, %eax
; X64-NEXT: retq
%cmp = icmp ne i32 %a0, 0
%cttz = call i32 @llvm.cttz.i32(i32 %a0, i1 true)
%res = select i1 %cmp, i32 %cttz, i32 32
ret i32 %res
%cttz = call i32 @llvm.cttz.i32(i32 %a0, i1 false)
ret i32 %cttz
}
declare i16 @llvm.cttz.i16(i16, i1)