; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; 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
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=AVX2 | FileCheck %s --check-prefix=X64 --check-prefix=AVX2
; This tests codegen time inlining/optimization of memcmp
; rdar://6480398
; X32-NEXT: setne %al
; X32-NEXT: retl
;
-; X64-LABEL: length16:
-; X64: # BB#0:
-; X64-NEXT: movdqu (%rsi), %xmm0
-; X64-NEXT: movdqu (%rdi), %xmm1
-; X64-NEXT: pcmpeqb %xmm0, %xmm1
-; X64-NEXT: pmovmskb %xmm1, %eax
-; X64-NEXT: cmpl $65535, %eax # imm = 0xFFFF
-; X64-NEXT: setne %al
-; X64-NEXT: retq
+; AVX2-LABEL: length16:
+; AVX2: # BB#0:
+; AVX2-NEXT: vmovdqu (%rdi), %xmm0
+; AVX2-NEXT: vpcmpeqb (%rsi), %xmm0, %xmm0
+; AVX2-NEXT: vpmovmskb %xmm0, %eax
+; AVX2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
+; AVX2-NEXT: setne %al
+; AVX2-NEXT: retq
%call = tail call i32 @memcmp(i8* %x, i8* %y, i64 16) nounwind
%cmp = icmp ne i32 %call, 0
ret i1 %cmp
; X32-NEXT: sete %al
; X32-NEXT: retl
;
-; X64-LABEL: length16_const:
-; X64: # BB#0:
-; X64-NEXT: movdqu (%rdi), %xmm0
-; X64-NEXT: pcmpeqb {{.*}}(%rip), %xmm0
-; X64-NEXT: pmovmskb %xmm0, %eax
-; X64-NEXT: cmpl $65535, %eax # imm = 0xFFFF
-; X64-NEXT: sete %al
-; X64-NEXT: retq
+; AVX2-LABEL: length16_const:
+; AVX2: # BB#0:
+; AVX2-NEXT: vmovdqu (%rdi), %xmm0
+; AVX2-NEXT: vpcmpeqb {{.*}}(%rip), %xmm0, %xmm0
+; AVX2-NEXT: vpmovmskb %xmm0, %eax
+; AVX2-NEXT: cmpl $65535, %eax # imm = 0xFFFF
+; AVX2-NEXT: sete %al
+; AVX2-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