From: Craig Topper Date: Mon, 1 Oct 2018 18:52:19 +0000 (+0000) Subject: [X86] Add more test shrinking with truncate and sign bit usage tests. NFC X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1346b5b7cf0037291f52213ed3d82b38f2ee13fe;p=platform%2Fupstream%2Fllvm.git [X86] Add more test shrinking with truncate and sign bit usage tests. NFC llvm-svn: 343519 --- diff --git a/llvm/test/CodeGen/X86/test-shrink.ll b/llvm/test/CodeGen/X86/test-shrink.ll index c83e7fa..c226a99 100644 --- a/llvm/test/CodeGen/X86/test-shrink.ll +++ b/llvm/test/CodeGen/X86/test-shrink.ll @@ -717,7 +717,7 @@ no: ret void } -define void @and32_trunc_16_sign(i32 %x) minsize nounwind { +define void @and32_trunc_16_sign(i32 %x) nounwind { ; CHECK-LINUX64-LABEL: and32_trunc_16_sign: ; CHECK-LINUX64: # %bb.0: ; CHECK-LINUX64-NEXT: andl $32768, %edi # imm = 0x8000 @@ -764,8 +764,8 @@ no: ret void } -define void @and64_trunc_32_sign(i64 %x) minsize nounwind { -; CHECK-LINUX64-LABEL: and64_trunc_32_sign: +define void @and32_trunc_16_sign_minsize(i32 %x) minsize nounwind { +; CHECK-LINUX64-LABEL: and32_trunc_16_sign_minsize: ; CHECK-LINUX64: # %bb.0: ; CHECK-LINUX64-NEXT: andl $32768, %edi # imm = 0x8000 ; CHECK-LINUX64-NEXT: testw %di, %di @@ -777,7 +777,7 @@ define void @and64_trunc_32_sign(i64 %x) minsize nounwind { ; CHECK-LINUX64-NEXT: .LBB17_2: # %no ; CHECK-LINUX64-NEXT: retq ; -; CHECK-WIN32-64-LABEL: and64_trunc_32_sign: +; CHECK-WIN32-64-LABEL: and32_trunc_16_sign_minsize: ; CHECK-WIN32-64: # %bb.0: ; CHECK-WIN32-64-NEXT: subq $40, %rsp ; CHECK-WIN32-64-NEXT: andl $32768, %ecx # imm = 0x8000 @@ -789,7 +789,7 @@ define void @and64_trunc_32_sign(i64 %x) minsize nounwind { ; CHECK-WIN32-64-NEXT: addq $40, %rsp ; CHECK-WIN32-64-NEXT: retq ; -; CHECK-X86-LABEL: and64_trunc_32_sign: +; CHECK-X86-LABEL: and32_trunc_16_sign_minsize: ; CHECK-X86: # %bb.0: ; CHECK-X86-NEXT: movl $32768, %eax # imm = 0x8000 ; CHECK-X86-NEXT: andl {{[0-9]+}}(%esp), %eax @@ -799,6 +799,53 @@ define void @and64_trunc_32_sign(i64 %x) minsize nounwind { ; CHECK-X86-NEXT: calll bar ; CHECK-X86-NEXT: .LBB17_2: # %no ; CHECK-X86-NEXT: retl + %t = and i32 %x, 32768 + %r = trunc i32 %t to i16 + %s = icmp sle i16 %r, 0 + br i1 %s, label %yes, label %no + +yes: + call void @bar() + ret void +no: + ret void +} + +define void @and64_trunc_16_sign(i64 %x) nounwind { +; CHECK-LINUX64-LABEL: and64_trunc_16_sign: +; CHECK-LINUX64: # %bb.0: +; CHECK-LINUX64-NEXT: andl $32768, %edi # imm = 0x8000 +; CHECK-LINUX64-NEXT: testw %di, %di +; CHECK-LINUX64-NEXT: jg .LBB18_2 +; CHECK-LINUX64-NEXT: # %bb.1: # %yes +; CHECK-LINUX64-NEXT: pushq %rax +; CHECK-LINUX64-NEXT: callq bar +; CHECK-LINUX64-NEXT: popq %rax +; CHECK-LINUX64-NEXT: .LBB18_2: # %no +; CHECK-LINUX64-NEXT: retq +; +; CHECK-WIN32-64-LABEL: and64_trunc_16_sign: +; CHECK-WIN32-64: # %bb.0: +; CHECK-WIN32-64-NEXT: subq $40, %rsp +; CHECK-WIN32-64-NEXT: andl $32768, %ecx # imm = 0x8000 +; CHECK-WIN32-64-NEXT: testw %cx, %cx +; CHECK-WIN32-64-NEXT: jg .LBB18_2 +; CHECK-WIN32-64-NEXT: # %bb.1: # %yes +; CHECK-WIN32-64-NEXT: callq bar +; CHECK-WIN32-64-NEXT: .LBB18_2: # %no +; CHECK-WIN32-64-NEXT: addq $40, %rsp +; CHECK-WIN32-64-NEXT: retq +; +; CHECK-X86-LABEL: and64_trunc_16_sign: +; CHECK-X86: # %bb.0: +; CHECK-X86-NEXT: movl $32768, %eax # imm = 0x8000 +; CHECK-X86-NEXT: andl {{[0-9]+}}(%esp), %eax +; CHECK-X86-NEXT: testw %ax, %ax +; CHECK-X86-NEXT: jg .LBB18_2 +; CHECK-X86-NEXT: # %bb.1: # %yes +; CHECK-X86-NEXT: calll bar +; CHECK-X86-NEXT: .LBB18_2: # %no +; CHECK-X86-NEXT: retl %t = and i64 %x, 32768 %r = trunc i64 %t to i16 %s = icmp sle i16 %r, 0 @@ -811,4 +858,94 @@ no: ret void } +define void @and64_trunc_16_sign_minsize(i64 %x) minsize nounwind { +; CHECK-LINUX64-LABEL: and64_trunc_16_sign_minsize: +; CHECK-LINUX64: # %bb.0: +; CHECK-LINUX64-NEXT: andl $32768, %edi # imm = 0x8000 +; CHECK-LINUX64-NEXT: testw %di, %di +; CHECK-LINUX64-NEXT: jg .LBB19_2 +; CHECK-LINUX64-NEXT: # %bb.1: # %yes +; CHECK-LINUX64-NEXT: pushq %rax +; CHECK-LINUX64-NEXT: callq bar +; CHECK-LINUX64-NEXT: popq %rax +; CHECK-LINUX64-NEXT: .LBB19_2: # %no +; CHECK-LINUX64-NEXT: retq +; +; CHECK-WIN32-64-LABEL: and64_trunc_16_sign_minsize: +; CHECK-WIN32-64: # %bb.0: +; CHECK-WIN32-64-NEXT: subq $40, %rsp +; CHECK-WIN32-64-NEXT: andl $32768, %ecx # imm = 0x8000 +; CHECK-WIN32-64-NEXT: testw %cx, %cx +; CHECK-WIN32-64-NEXT: jg .LBB19_2 +; CHECK-WIN32-64-NEXT: # %bb.1: # %yes +; CHECK-WIN32-64-NEXT: callq bar +; CHECK-WIN32-64-NEXT: .LBB19_2: # %no +; CHECK-WIN32-64-NEXT: addq $40, %rsp +; CHECK-WIN32-64-NEXT: retq +; +; CHECK-X86-LABEL: and64_trunc_16_sign_minsize: +; CHECK-X86: # %bb.0: +; CHECK-X86-NEXT: movl $32768, %eax # imm = 0x8000 +; CHECK-X86-NEXT: andl {{[0-9]+}}(%esp), %eax +; CHECK-X86-NEXT: testw %ax, %ax +; CHECK-X86-NEXT: jg .LBB19_2 +; CHECK-X86-NEXT: # %bb.1: # %yes +; CHECK-X86-NEXT: calll bar +; CHECK-X86-NEXT: .LBB19_2: # %no +; CHECK-X86-NEXT: retl + %t = and i64 %x, 32768 + %r = trunc i64 %t to i16 + %s = icmp sle i16 %r, 0 + br i1 %s, label %yes, label %no + +yes: + call void @bar() + ret void +no: + ret void +} + +define void @and64_trunc_32_sign(i64 %x) nounwind { +; CHECK-LINUX64-LABEL: and64_trunc_32_sign: +; CHECK-LINUX64: # %bb.0: +; CHECK-LINUX64-NEXT: testl $-2147483648, %edi # imm = 0x80000000 +; CHECK-LINUX64-NEXT: jg .LBB20_2 +; CHECK-LINUX64-NEXT: # %bb.1: # %yes +; CHECK-LINUX64-NEXT: pushq %rax +; CHECK-LINUX64-NEXT: callq bar +; CHECK-LINUX64-NEXT: popq %rax +; CHECK-LINUX64-NEXT: .LBB20_2: # %no +; CHECK-LINUX64-NEXT: retq +; +; CHECK-WIN32-64-LABEL: and64_trunc_32_sign: +; CHECK-WIN32-64: # %bb.0: +; CHECK-WIN32-64-NEXT: subq $40, %rsp +; CHECK-WIN32-64-NEXT: testl $-2147483648, %ecx # imm = 0x80000000 +; CHECK-WIN32-64-NEXT: jg .LBB20_2 +; CHECK-WIN32-64-NEXT: # %bb.1: # %yes +; CHECK-WIN32-64-NEXT: callq bar +; CHECK-WIN32-64-NEXT: .LBB20_2: # %no +; CHECK-WIN32-64-NEXT: addq $40, %rsp +; CHECK-WIN32-64-NEXT: retq +; +; CHECK-X86-LABEL: and64_trunc_32_sign: +; CHECK-X86: # %bb.0: +; CHECK-X86-NEXT: testl $-2147483648, {{[0-9]+}}(%esp) # imm = 0x80000000 +; CHECK-X86-NEXT: jg .LBB20_2 +; CHECK-X86-NEXT: # %bb.1: # %yes +; CHECK-X86-NEXT: calll bar +; CHECK-X86-NEXT: .LBB20_2: # %no +; CHECK-X86-NEXT: retl + %t = and i64 %x, 2147483648 + %r = trunc i64 %t to i32 + %s = icmp sle i32 %r, 0 + br i1 %s, label %yes, label %no + +yes: + call void @bar() + ret void +no: + ret void +} + declare void @bar()