1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=sse2 | FileCheck %s --check-prefix=SSE2
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=sse4.1 | FileCheck %s --check-prefix=SSE41
4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=avx | FileCheck %s --check-prefix=AVX
5 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=avx2 | FileCheck %s --check-prefix=AVX
6 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=avx512f | FileCheck %s --check-prefix=AVX
7 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=avx512bw | FileCheck %s --check-prefix=AVX
9 declare i64 @llvm.vector.reduce.or.v2i64(<2 x i64>)
11 define i1 @parseHeaders(ptr %ptr) nounwind {
12 ; SSE2-LABEL: parseHeaders:
14 ; SSE2-NEXT: movdqu (%rdi), %xmm0
15 ; SSE2-NEXT: pxor %xmm1, %xmm1
16 ; SSE2-NEXT: pcmpeqd %xmm0, %xmm1
17 ; SSE2-NEXT: movmskps %xmm1, %eax
18 ; SSE2-NEXT: xorl $15, %eax
22 ; SSE41-LABEL: parseHeaders:
24 ; SSE41-NEXT: movdqu (%rdi), %xmm0
25 ; SSE41-NEXT: ptest %xmm0, %xmm0
26 ; SSE41-NEXT: sete %al
29 ; AVX-LABEL: parseHeaders:
31 ; AVX-NEXT: vmovdqu (%rdi), %xmm0
32 ; AVX-NEXT: vptest %xmm0, %xmm0
35 %vload = load <2 x i64>, ptr %ptr, align 8
36 %vreduce = call i64 @llvm.vector.reduce.or.v2i64(<2 x i64> %vload)
37 %vcheck = icmp eq i64 %vreduce, 0
41 define i1 @parseHeaders2_scalar_or(ptr %ptr) nounwind {
42 ; SSE2-LABEL: parseHeaders2_scalar_or:
44 ; SSE2-NEXT: movdqu (%rdi), %xmm0
45 ; SSE2-NEXT: pxor %xmm1, %xmm1
46 ; SSE2-NEXT: pcmpeqd %xmm0, %xmm1
47 ; SSE2-NEXT: movmskps %xmm1, %eax
48 ; SSE2-NEXT: xorl $15, %eax
52 ; SSE41-LABEL: parseHeaders2_scalar_or:
54 ; SSE41-NEXT: movdqu (%rdi), %xmm0
55 ; SSE41-NEXT: ptest %xmm0, %xmm0
56 ; SSE41-NEXT: sete %al
59 ; AVX-LABEL: parseHeaders2_scalar_or:
61 ; AVX-NEXT: vmovdqu (%rdi), %xmm0
62 ; AVX-NEXT: vptest %xmm0, %xmm0
65 %vload = load <2 x i64>, ptr %ptr, align 8
66 %v1 = extractelement <2 x i64> %vload, i32 0
67 %v2 = extractelement <2 x i64> %vload, i32 1
68 %vreduce = or i64 %v1, %v2
69 %vcheck = icmp eq i64 %vreduce, 0
73 define i1 @parseHeaders2_scalar_and(ptr %ptr) nounwind {
74 ; SSE2-LABEL: parseHeaders2_scalar_and:
76 ; SSE2-NEXT: movdqu (%rdi), %xmm0
77 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[2,3,2,3]
78 ; SSE2-NEXT: movq %xmm0, %rax
79 ; SSE2-NEXT: testq %rax, (%rdi)
83 ; SSE41-LABEL: parseHeaders2_scalar_and:
85 ; SSE41-NEXT: movq (%rdi), %rax
86 ; SSE41-NEXT: testq %rax, 8(%rdi)
87 ; SSE41-NEXT: sete %al
90 ; AVX-LABEL: parseHeaders2_scalar_and:
92 ; AVX-NEXT: movq (%rdi), %rax
93 ; AVX-NEXT: testq %rax, 8(%rdi)
96 %vload = load <2 x i64>, ptr %ptr, align 8
97 %v1 = extractelement <2 x i64> %vload, i32 0
98 %v2 = extractelement <2 x i64> %vload, i32 1
99 %vreduce = and i64 %v1, %v2
100 %vcheck = icmp eq i64 %vreduce, 0