[llvm] r295495 - [x86] add tests for sext (not bool); NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 17 13:10:40 PST 2017


Author: spatel
Date: Fri Feb 17 15:10:40 2017
New Revision: 295495

URL: http://llvm.org/viewvc/llvm-project?rev=295495&view=rev
Log:
[x86] add tests for sext (not bool); NFC

Modified:
    llvm/trunk/test/CodeGen/X86/sext-i1.ll

Modified: llvm/trunk/test/CodeGen/X86/sext-i1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/sext-i1.ll?rev=295495&r1=295494&r2=295495&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/sext-i1.ll (original)
+++ llvm/trunk/test/CodeGen/X86/sext-i1.ll Fri Feb 17 15:10:40 2017
@@ -112,3 +112,75 @@ define i64 @t5(i32 %x) nounwind readnone
   ret i64 %t1
 }
 
+; FIXME: sext (xor Bool, -1) --> sub (zext Bool), 1
+
+define i32 @select_0_or_1s(i1 %cond) {
+; X32-LABEL: select_0_or_1s:
+; X32:       # BB#0:
+; X32-NEXT:    movb {{[0-9]+}}(%esp), %al
+; X32-NEXT:    notb %al
+; X32-NEXT:    movzbl %al, %eax
+; X32-NEXT:    andl $1, %eax
+; X32-NEXT:    negl %eax
+; X32-NEXT:    retl
+;
+; X64-LABEL: select_0_or_1s:
+; X64:       # BB#0:
+; X64-NEXT:    notb %dil
+; X64-NEXT:    movzbl %dil, %eax
+; X64-NEXT:    andl $1, %eax
+; X64-NEXT:    negl %eax
+; X64-NEXT:    retq
+  %not = xor i1 %cond, 1
+  %sext = sext i1 %not to i32
+  ret i32 %sext
+}
+
+; FIXME: sext (xor Bool, -1) --> sub (zext Bool), 1
+
+define i32 @select_0_or_1s_zeroext(i1 zeroext %cond) {
+; X32-LABEL: select_0_or_1s_zeroext:
+; X32:       # BB#0:
+; X32-NEXT:    movb {{[0-9]+}}(%esp), %al
+; X32-NEXT:    notb %al
+; X32-NEXT:    movzbl %al, %eax
+; X32-NEXT:    andl $1, %eax
+; X32-NEXT:    negl %eax
+; X32-NEXT:    retl
+;
+; X64-LABEL: select_0_or_1s_zeroext:
+; X64:       # BB#0:
+; X64-NEXT:    notb %dil
+; X64-NEXT:    movzbl %dil, %eax
+; X64-NEXT:    andl $1, %eax
+; X64-NEXT:    negl %eax
+; X64-NEXT:    retq
+  %not = xor i1 %cond, 1
+  %sext = sext i1 %not to i32
+  ret i32 %sext
+}
+
+; FIXME: sext (xor Bool, -1) --> sub (zext Bool), 1
+
+define i32 @select_0_or_1s_signext(i1 signext %cond) {
+; X32-LABEL: select_0_or_1s_signext:
+; X32:       # BB#0:
+; X32-NEXT:    movb {{[0-9]+}}(%esp), %al
+; X32-NEXT:    notb %al
+; X32-NEXT:    movzbl %al, %eax
+; X32-NEXT:    andl $1, %eax
+; X32-NEXT:    negl %eax
+; X32-NEXT:    retl
+;
+; X64-LABEL: select_0_or_1s_signext:
+; X64:       # BB#0:
+; X64-NEXT:    notb %dil
+; X64-NEXT:    movzbl %dil, %eax
+; X64-NEXT:    andl $1, %eax
+; X64-NEXT:    negl %eax
+; X64-NEXT:    retq
+  %not = xor i1 %cond, 1
+  %sext = sext i1 %not to i32
+  ret i32 %sext
+}
+




More information about the llvm-commits mailing list