[llvm] r298744 - [x86] add 32-bit RUN for better memcmp coverage; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 24 15:09:49 PDT 2017


Author: spatel
Date: Fri Mar 24 17:09:48 2017
New Revision: 298744

URL: http://llvm.org/viewvc/llvm-project?rev=298744&view=rev
Log:
[x86] add 32-bit RUN for better memcmp coverage; NFC

Modified:
    llvm/trunk/test/CodeGen/X86/memcmp.ll

Modified: llvm/trunk/test/CodeGen/X86/memcmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/memcmp.ll?rev=298744&r1=298743&r2=298744&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/memcmp.ll (original)
+++ llvm/trunk/test/CodeGen/X86/memcmp.ll Fri Mar 24 17:09:48 2017
@@ -1,5 +1,6 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
+; RUN: llc < %s -mtriple=i686-unknown-unknown | FileCheck %s --check-prefix=X32
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=X64
 
 ; This tests codegen time inlining/optimization of memcmp
 ; rdar://6480398
@@ -9,179 +10,320 @@
 declare i32 @memcmp(i8*, i8*, i64)
 
 define i1 @length2(i8* %X, i8* %Y, i32* nocapture %P) nounwind {
-; CHECK-LABEL: length2:
-; CHECK:       # BB#0:
-; CHECK-NEXT:    movzwl (%rdi), %eax
-; CHECK-NEXT:    cmpw (%rsi), %ax
-; CHECK-NEXT:    sete %al
-; CHECK-NEXT:    retq
+; X32-LABEL: length2:
+; X32:       # BB#0:
+; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X32-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X32-NEXT:    movzwl (%ecx), %ecx
+; X32-NEXT:    cmpw (%eax), %cx
+; X32-NEXT:    sete %al
+; X32-NEXT:    retl
+;
+; X64-LABEL: length2:
+; X64:       # BB#0:
+; X64-NEXT:    movzwl (%rdi), %eax
+; X64-NEXT:    cmpw (%rsi), %ax
+; X64-NEXT:    sete %al
+; X64-NEXT:    retq
   %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 2) nounwind
   %c = icmp eq i32 %m, 0
   ret i1 %c
 }
 
 define i1 @length2_const(i8* %X, i32* nocapture %P) nounwind {
-; CHECK-LABEL: length2_const:
-; CHECK:       # BB#0:
-; CHECK-NEXT:    movzwl (%rdi), %eax
-; CHECK-NEXT:    cmpl $12849, %eax # imm = 0x3231
-; CHECK-NEXT:    setne %al
-; CHECK-NEXT:    retq
+; X32-LABEL: length2_const:
+; X32:       # BB#0:
+; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X32-NEXT:    movzwl (%eax), %eax
+; X32-NEXT:    cmpl $12849, %eax # imm = 0x3231
+; X32-NEXT:    setne %al
+; X32-NEXT:    retl
+;
+; X64-LABEL: length2_const:
+; X64:       # BB#0:
+; X64-NEXT:    movzwl (%rdi), %eax
+; X64-NEXT:    cmpl $12849, %eax # imm = 0x3231
+; X64-NEXT:    setne %al
+; X64-NEXT:    retq
   %m = tail call i32 @memcmp(i8* %X, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i32 0, i32 1), i64 2) nounwind
   %c = icmp ne i32 %m, 0
   ret i1 %c
 }
 
 define i1 @length2_nobuiltin_attr(i8* %X, i8* %Y, i32* nocapture %P) nounwind {
-; CHECK-LABEL: length2_nobuiltin_attr:
-; CHECK:       # BB#0:
-; CHECK-NEXT:    pushq %rax
-; CHECK-NEXT:    movl $2, %edx
-; CHECK-NEXT:    callq memcmp
-; CHECK-NEXT:    testl %eax, %eax
-; CHECK-NEXT:    sete %al
-; CHECK-NEXT:    popq %rcx
-; CHECK-NEXT:    retq
+; X32-LABEL: length2_nobuiltin_attr:
+; X32:       # BB#0:
+; X32-NEXT:    pushl $0
+; X32-NEXT:    pushl $2
+; X32-NEXT:    pushl {{[0-9]+}}(%esp)
+; X32-NEXT:    pushl {{[0-9]+}}(%esp)
+; X32-NEXT:    calll memcmp
+; X32-NEXT:    addl $16, %esp
+; X32-NEXT:    testl %eax, %eax
+; X32-NEXT:    sete %al
+; X32-NEXT:    retl
+;
+; X64-LABEL: length2_nobuiltin_attr:
+; X64:       # BB#0:
+; X64-NEXT:    pushq %rax
+; X64-NEXT:    movl $2, %edx
+; X64-NEXT:    callq memcmp
+; X64-NEXT:    testl %eax, %eax
+; X64-NEXT:    sete %al
+; X64-NEXT:    popq %rcx
+; X64-NEXT:    retq
   %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 2) nounwind nobuiltin
   %c = icmp eq i32 %m, 0
   ret i1 %c
 }
 
 define i1 @length4(i8* %X, i8* %Y, i32* nocapture %P) nounwind {
-; CHECK-LABEL: length4:
-; CHECK:       # BB#0:
-; CHECK-NEXT:    movl (%rdi), %eax
-; CHECK-NEXT:    cmpl (%rsi), %eax
-; CHECK-NEXT:    setne %al
-; CHECK-NEXT:    retq
+; X32-LABEL: length4:
+; X32:       # BB#0:
+; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X32-NEXT:    movl {{[0-9]+}}(%esp), %ecx
+; X32-NEXT:    movl (%ecx), %ecx
+; X32-NEXT:    cmpl (%eax), %ecx
+; X32-NEXT:    setne %al
+; X32-NEXT:    retl
+;
+; X64-LABEL: length4:
+; X64:       # BB#0:
+; X64-NEXT:    movl (%rdi), %eax
+; X64-NEXT:    cmpl (%rsi), %eax
+; X64-NEXT:    setne %al
+; X64-NEXT:    retq
   %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 4) nounwind
   %c = icmp ne i32 %m, 0
   ret i1 %c
 }
 
 define i1 @length4_const(i8* %X, i32* nocapture %P) nounwind {
-; CHECK-LABEL: length4_const:
-; CHECK:       # BB#0:
-; CHECK-NEXT:    cmpl $875770417, (%rdi) # imm = 0x34333231
-; CHECK-NEXT:    sete %al
-; CHECK-NEXT:    retq
+; X32-LABEL: length4_const:
+; X32:       # BB#0:
+; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax
+; X32-NEXT:    cmpl $875770417, (%eax) # imm = 0x34333231
+; X32-NEXT:    sete %al
+; X32-NEXT:    retl
+;
+; X64-LABEL: length4_const:
+; X64:       # BB#0:
+; X64-NEXT:    cmpl $875770417, (%rdi) # imm = 0x34333231
+; X64-NEXT:    sete %al
+; X64-NEXT:    retq
   %m = tail call i32 @memcmp(i8* %X, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i32 0, i32 1), i64 4) nounwind
   %c = icmp eq i32 %m, 0
   ret i1 %c
 }
 
 define i1 @length8(i8* %X, i8* %Y, i32* nocapture %P) nounwind {
-; CHECK-LABEL: length8:
-; CHECK:       # BB#0:
-; CHECK-NEXT:    movq (%rdi), %rax
-; CHECK-NEXT:    cmpq (%rsi), %rax
-; CHECK-NEXT:    sete %al
-; CHECK-NEXT:    retq
+; X32-LABEL: length8:
+; X32:       # BB#0:
+; X32-NEXT:    pushl $0
+; X32-NEXT:    pushl $8
+; X32-NEXT:    pushl {{[0-9]+}}(%esp)
+; X32-NEXT:    pushl {{[0-9]+}}(%esp)
+; X32-NEXT:    calll memcmp
+; X32-NEXT:    addl $16, %esp
+; X32-NEXT:    testl %eax, %eax
+; X32-NEXT:    sete %al
+; X32-NEXT:    retl
+;
+; X64-LABEL: length8:
+; X64:       # BB#0:
+; X64-NEXT:    movq (%rdi), %rax
+; X64-NEXT:    cmpq (%rsi), %rax
+; X64-NEXT:    sete %al
+; X64-NEXT:    retq
   %m = tail call i32 @memcmp(i8* %X, i8* %Y, i64 8) nounwind
   %c = icmp eq i32 %m, 0
   ret i1 %c
 }
 
 define i1 @length8_const(i8* %X, i32* nocapture %P) nounwind {
-; CHECK-LABEL: length8_const:
-; CHECK:       # BB#0:
-; CHECK-NEXT:    movabsq $3978425819141910832, %rax # imm = 0x3736353433323130
-; CHECK-NEXT:    cmpq %rax, (%rdi)
-; CHECK-NEXT:    setne %al
-; CHECK-NEXT:    retq
+; X32-LABEL: length8_const:
+; X32:       # BB#0:
+; X32-NEXT:    pushl $0
+; X32-NEXT:    pushl $8
+; X32-NEXT:    pushl $.L.str
+; X32-NEXT:    pushl {{[0-9]+}}(%esp)
+; X32-NEXT:    calll memcmp
+; X32-NEXT:    addl $16, %esp
+; X32-NEXT:    testl %eax, %eax
+; X32-NEXT:    setne %al
+; X32-NEXT:    retl
+;
+; X64-LABEL: length8_const:
+; X64:       # BB#0:
+; X64-NEXT:    movabsq $3978425819141910832, %rax # imm = 0x3736353433323130
+; X64-NEXT:    cmpq %rax, (%rdi)
+; X64-NEXT:    setne %al
+; X64-NEXT:    retq
   %m = tail call i32 @memcmp(i8* %X, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i32 0, i32 0), i64 8) nounwind
   %c = icmp ne i32 %m, 0
   ret i1 %c
 }
 
 define i1 @length16(i8* %x, i8* %y) nounwind {
-; CHECK-LABEL: length16:
-; CHECK:       # BB#0:
-; CHECK-NEXT:    pushq %rax
-; CHECK-NEXT:    movl $16, %edx
-; CHECK-NEXT:    callq memcmp
-; CHECK-NEXT:    testl %eax, %eax
-; CHECK-NEXT:    setne %al
-; CHECK-NEXT:    popq %rcx
-; CHECK-NEXT:    retq
+; X32-LABEL: length16:
+; X32:       # BB#0:
+; X32-NEXT:    pushl $0
+; X32-NEXT:    pushl $16
+; X32-NEXT:    pushl {{[0-9]+}}(%esp)
+; X32-NEXT:    pushl {{[0-9]+}}(%esp)
+; X32-NEXT:    calll memcmp
+; X32-NEXT:    addl $16, %esp
+; X32-NEXT:    testl %eax, %eax
+; X32-NEXT:    setne %al
+; X32-NEXT:    retl
+;
+; X64-LABEL: length16:
+; X64:       # BB#0:
+; X64-NEXT:    pushq %rax
+; X64-NEXT:    movl $16, %edx
+; X64-NEXT:    callq memcmp
+; X64-NEXT:    testl %eax, %eax
+; X64-NEXT:    setne %al
+; X64-NEXT:    popq %rcx
+; X64-NEXT:    retq
   %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 16) nounwind
   %cmp = icmp ne i32 %call, 0
   ret i1 %cmp
 }
 
 define i1 @length16_const(i8* %X, i32* nocapture %P) nounwind {
-; CHECK-LABEL: length16_const:
-; CHECK:       # BB#0:
-; CHECK-NEXT:    pushq %rax
-; CHECK-NEXT:    movl $.L.str, %esi
-; CHECK-NEXT:    movl $16, %edx
-; CHECK-NEXT:    callq memcmp
-; CHECK-NEXT:    testl %eax, %eax
-; CHECK-NEXT:    sete %al
-; CHECK-NEXT:    popq %rcx
-; CHECK-NEXT:    retq
+; X32-LABEL: length16_const:
+; X32:       # BB#0:
+; X32-NEXT:    pushl $0
+; X32-NEXT:    pushl $16
+; X32-NEXT:    pushl $.L.str
+; X32-NEXT:    pushl {{[0-9]+}}(%esp)
+; X32-NEXT:    calll memcmp
+; X32-NEXT:    addl $16, %esp
+; X32-NEXT:    testl %eax, %eax
+; X32-NEXT:    sete %al
+; X32-NEXT:    retl
+;
+; X64-LABEL: length16_const:
+; X64:       # BB#0:
+; X64-NEXT:    pushq %rax
+; X64-NEXT:    movl $.L.str, %esi
+; X64-NEXT:    movl $16, %edx
+; X64-NEXT:    callq memcmp
+; X64-NEXT:    testl %eax, %eax
+; X64-NEXT:    sete %al
+; X64-NEXT:    popq %rcx
+; X64-NEXT:    retq
   %m = tail call i32 @memcmp(i8* %X, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i32 0, i32 0), i64 16) nounwind
   %c = icmp eq i32 %m, 0
   ret i1 %c
 }
 
 define i1 @length32(i8* %x, i8* %y) nounwind {
-; CHECK-LABEL: length32:
-; CHECK:       # BB#0:
-; CHECK-NEXT:    pushq %rax
-; CHECK-NEXT:    movl $32, %edx
-; CHECK-NEXT:    callq memcmp
-; CHECK-NEXT:    testl %eax, %eax
-; CHECK-NEXT:    sete %al
-; CHECK-NEXT:    popq %rcx
-; CHECK-NEXT:    retq
+; X32-LABEL: length32:
+; X32:       # BB#0:
+; X32-NEXT:    pushl $0
+; X32-NEXT:    pushl $32
+; X32-NEXT:    pushl {{[0-9]+}}(%esp)
+; X32-NEXT:    pushl {{[0-9]+}}(%esp)
+; X32-NEXT:    calll memcmp
+; X32-NEXT:    addl $16, %esp
+; X32-NEXT:    testl %eax, %eax
+; X32-NEXT:    sete %al
+; X32-NEXT:    retl
+;
+; X64-LABEL: length32:
+; X64:       # BB#0:
+; X64-NEXT:    pushq %rax
+; X64-NEXT:    movl $32, %edx
+; X64-NEXT:    callq memcmp
+; X64-NEXT:    testl %eax, %eax
+; X64-NEXT:    sete %al
+; X64-NEXT:    popq %rcx
+; X64-NEXT:    retq
   %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 32) nounwind
   %cmp = icmp eq i32 %call, 0
   ret i1 %cmp
 }
 
 define i1 @length32_const(i8* %X, i32* nocapture %P) nounwind {
-; CHECK-LABEL: length32_const:
-; CHECK:       # BB#0:
-; CHECK-NEXT:    pushq %rax
-; CHECK-NEXT:    movl $.L.str, %esi
-; CHECK-NEXT:    movl $32, %edx
-; CHECK-NEXT:    callq memcmp
-; CHECK-NEXT:    testl %eax, %eax
-; CHECK-NEXT:    setne %al
-; CHECK-NEXT:    popq %rcx
-; CHECK-NEXT:    retq
+; X32-LABEL: length32_const:
+; X32:       # BB#0:
+; X32-NEXT:    pushl $0
+; X32-NEXT:    pushl $32
+; X32-NEXT:    pushl $.L.str
+; X32-NEXT:    pushl {{[0-9]+}}(%esp)
+; X32-NEXT:    calll memcmp
+; X32-NEXT:    addl $16, %esp
+; X32-NEXT:    testl %eax, %eax
+; X32-NEXT:    setne %al
+; X32-NEXT:    retl
+;
+; X64-LABEL: length32_const:
+; X64:       # BB#0:
+; X64-NEXT:    pushq %rax
+; X64-NEXT:    movl $.L.str, %esi
+; X64-NEXT:    movl $32, %edx
+; X64-NEXT:    callq memcmp
+; X64-NEXT:    testl %eax, %eax
+; X64-NEXT:    setne %al
+; X64-NEXT:    popq %rcx
+; X64-NEXT:    retq
   %m = tail call i32 @memcmp(i8* %X, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i32 0, i32 0), i64 32) nounwind
   %c = icmp ne i32 %m, 0
   ret i1 %c
 }
 
 define i1 @length64(i8* %x, i8* %y) nounwind {
-; CHECK-LABEL: length64:
-; CHECK:       # BB#0:
-; CHECK-NEXT:    pushq %rax
-; CHECK-NEXT:    movl $64, %edx
-; CHECK-NEXT:    callq memcmp
-; CHECK-NEXT:    testl %eax, %eax
-; CHECK-NEXT:    setne %al
-; CHECK-NEXT:    popq %rcx
-; CHECK-NEXT:    retq
+; X32-LABEL: length64:
+; X32:       # BB#0:
+; X32-NEXT:    pushl $0
+; X32-NEXT:    pushl $64
+; X32-NEXT:    pushl {{[0-9]+}}(%esp)
+; X32-NEXT:    pushl {{[0-9]+}}(%esp)
+; X32-NEXT:    calll memcmp
+; X32-NEXT:    addl $16, %esp
+; X32-NEXT:    testl %eax, %eax
+; X32-NEXT:    setne %al
+; X32-NEXT:    retl
+;
+; X64-LABEL: length64:
+; X64:       # BB#0:
+; X64-NEXT:    pushq %rax
+; X64-NEXT:    movl $64, %edx
+; X64-NEXT:    callq memcmp
+; X64-NEXT:    testl %eax, %eax
+; X64-NEXT:    setne %al
+; X64-NEXT:    popq %rcx
+; X64-NEXT:    retq
   %call = tail call i32 @memcmp(i8* %x, i8* %y, i64 64) nounwind
   %cmp = icmp ne i32 %call, 0
   ret i1 %cmp
 }
 
 define i1 @length64_const(i8* %X, i32* nocapture %P) nounwind {
-; CHECK-LABEL: length64_const:
-; CHECK:       # BB#0:
-; CHECK-NEXT:    pushq %rax
-; CHECK-NEXT:    movl $.L.str, %esi
-; CHECK-NEXT:    movl $64, %edx
-; CHECK-NEXT:    callq memcmp
-; CHECK-NEXT:    testl %eax, %eax
-; CHECK-NEXT:    sete %al
-; CHECK-NEXT:    popq %rcx
-; CHECK-NEXT:    retq
+; X32-LABEL: length64_const:
+; X32:       # BB#0:
+; X32-NEXT:    pushl $0
+; X32-NEXT:    pushl $64
+; X32-NEXT:    pushl $.L.str
+; X32-NEXT:    pushl {{[0-9]+}}(%esp)
+; X32-NEXT:    calll memcmp
+; X32-NEXT:    addl $16, %esp
+; X32-NEXT:    testl %eax, %eax
+; X32-NEXT:    sete %al
+; X32-NEXT:    retl
+;
+; X64-LABEL: length64_const:
+; X64:       # BB#0:
+; X64-NEXT:    pushq %rax
+; X64-NEXT:    movl $.L.str, %esi
+; X64-NEXT:    movl $64, %edx
+; X64-NEXT:    callq memcmp
+; X64-NEXT:    testl %eax, %eax
+; X64-NEXT:    sete %al
+; X64-NEXT:    popq %rcx
+; X64-NEXT:    retq
   %m = tail call i32 @memcmp(i8* %X, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i32 0, i32 0), i64 64) nounwind
   %c = icmp eq i32 %m, 0
   ret i1 %c




More information about the llvm-commits mailing list