summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmaury Sechet <deadalnix@gmail.com>2018-01-29 20:22:46 +0000
committerAmaury Sechet <deadalnix@gmail.com>2018-01-29 20:22:46 +0000
commit4cbca08d71f90222803a6bd4156c5b5f2be141d9 (patch)
tree00948345d88678ea052bb466e74ee99187cc6314
parent1589d6e6a3a2a605a68dbf6e0e21415afe824f7c (diff)
downloadbcm5719-llvm-4cbca08d71f90222803a6bd4156c5b5f2be141d9.tar.gz
bcm5719-llvm-4cbca08d71f90222803a6bd4156c5b5f2be141d9.zip
[X86] Add test case to ensure testw is generated when optimizing for size. NFC
llvm-svn: 323687
-rw-r--r--llvm/test/CodeGen/X86/test-shrink.ll44
1 files changed, 44 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/test-shrink.ll b/llvm/test/CodeGen/X86/test-shrink.ll
index d7050504d54..a054c1f1edb 100644
--- a/llvm/test/CodeGen/X86/test-shrink.ll
+++ b/llvm/test/CodeGen/X86/test-shrink.ll
@@ -530,4 +530,48 @@ no:
ret void
}
+define void @testw(i16 inreg %x) nounwind minsize {
+; CHECK-LINUX64-LABEL: testw:
+; CHECK-LINUX64: # %bb.0:
+; CHECK-LINUX64-NEXT: testw $2049, %di # imm = 0x801
+; CHECK-LINUX64-NEXT: je .LBB12_1
+; CHECK-LINUX64-NEXT: # %bb.2: # %no
+; CHECK-LINUX64-NEXT: retq
+; CHECK-LINUX64-NEXT: .LBB12_1: # %yes
+; CHECK-LINUX64-NEXT: pushq %rax
+; CHECK-LINUX64-NEXT: callq bar
+; CHECK-LINUX64-NEXT: popq %rax
+; CHECK-LINUX64-NEXT: retq
+;
+; CHECK-WIN32-64-LABEL: testw:
+; CHECK-WIN32-64: # %bb.0:
+; CHECK-WIN32-64-NEXT: subq $40, %rsp
+; CHECK-WIN32-64-NEXT: testw $2049, %cx # imm = 0x801
+; CHECK-WIN32-64-NEXT: jne .LBB12_2
+; CHECK-WIN32-64-NEXT: # %bb.1: # %yes
+; CHECK-WIN32-64-NEXT: callq bar
+; CHECK-WIN32-64-NEXT: .LBB12_2: # %no
+; CHECK-WIN32-64-NEXT: addq $40, %rsp
+; CHECK-WIN32-64-NEXT: retq
+;
+; CHECK-X86-LABEL: testw:
+; CHECK-X86: # %bb.0:
+; CHECK-X86-NEXT: testw $2049, %ax # imm = 0x801
+; CHECK-X86-NEXT: je .LBB12_1
+; CHECK-X86-NEXT: # %bb.2: # %no
+; CHECK-X86-NEXT: retl
+; CHECK-X86-NEXT: .LBB12_1: # %yes
+; CHECK-X86-NEXT: calll bar
+; CHECK-X86-NEXT: retl
+ %t = and i16 %x, 2049
+ %s = icmp eq i16 %t, 0
+ br i1 %s, label %yes, label %no
+
+yes:
+ call void @bar()
+ ret void
+no:
+ ret void
+}
+
declare void @bar()
OpenPOWER on IntegriCloud