1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+sse4.2 | FileCheck %s
4 ; widen v8i8 to v16i8 (checks even power of 2 widening with add & and)
6 define void @update(ptr %dst_i, ptr %src_i, i32 %n) nounwind {
8 ; CHECK: # %bb.0: # %entry
9 ; CHECK-NEXT: subl $12, %esp
10 ; CHECK-NEXT: movl $0, (%esp)
11 ; CHECK-NEXT: pcmpeqd %xmm0, %xmm0
12 ; CHECK-NEXT: movdqa {{.*#+}} xmm1 = <4,4,4,4,4,4,4,4,u,u,u,u,u,u,u,u>
13 ; CHECK-NEXT: .p2align 4, 0x90
14 ; CHECK-NEXT: .LBB0_1: # %forcond
15 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
16 ; CHECK-NEXT: movl (%esp), %eax
17 ; CHECK-NEXT: cmpl {{[0-9]+}}(%esp), %eax
18 ; CHECK-NEXT: jge .LBB0_3
19 ; CHECK-NEXT: # %bb.2: # %forbody
20 ; CHECK-NEXT: # in Loop: Header=BB0_1 Depth=1
21 ; CHECK-NEXT: movl (%esp), %eax
22 ; CHECK-NEXT: leal (,%eax,8), %ecx
23 ; CHECK-NEXT: movl {{[0-9]+}}(%esp), %edx
24 ; CHECK-NEXT: addl %ecx, %edx
25 ; CHECK-NEXT: movl %edx, {{[0-9]+}}(%esp)
26 ; CHECK-NEXT: addl {{[0-9]+}}(%esp), %ecx
27 ; CHECK-NEXT: movl %ecx, {{[0-9]+}}(%esp)
28 ; CHECK-NEXT: movq {{.*#+}} xmm2 = mem[0],zero
29 ; CHECK-NEXT: psubb %xmm0, %xmm2
30 ; CHECK-NEXT: pand %xmm1, %xmm2
31 ; CHECK-NEXT: movq %xmm2, (%edx,%eax,8)
32 ; CHECK-NEXT: incl (%esp)
33 ; CHECK-NEXT: jmp .LBB0_1
34 ; CHECK-NEXT: .LBB0_3: # %afterfor
35 ; CHECK-NEXT: addl $12, %esp
38 %dst_i.addr = alloca ptr
39 %src_i.addr = alloca ptr
41 %i = alloca i32, align 4
42 %dst = alloca ptr, align 4
43 %src = alloca ptr, align 4
44 store ptr %dst_i, ptr %dst_i.addr
45 store ptr %src_i, ptr %src_i.addr
46 store i32 %n, ptr %n.addr
51 %tmp = load i32, ptr %i
52 %tmp1 = load i32, ptr %n.addr
53 %cmp = icmp slt i32 %tmp, %tmp1
54 br i1 %cmp, label %forbody, label %afterfor
57 %tmp2 = load i32, ptr %i
58 %tmp3 = load ptr, ptr %dst_i.addr
59 %arrayidx = getelementptr i64, ptr %tmp3, i32 %tmp2
60 store ptr %arrayidx, ptr %dst
61 %tmp4 = load i32, ptr %i
62 %tmp5 = load ptr, ptr %src_i.addr
63 %arrayidx6 = getelementptr i64, ptr %tmp5, i32 %tmp4
64 store ptr %arrayidx6, ptr %src
65 %tmp8 = load i32, ptr %i
66 %tmp9 = load ptr, ptr %dst
67 %arrayidx10 = getelementptr <8 x i8>, ptr %tmp9, i32 %tmp8
68 %tmp11 = load i32, ptr %i
69 %tmp12 = load ptr, ptr %src
70 %arrayidx13 = getelementptr <8 x i8>, ptr %tmp12, i32 %tmp11
71 %tmp14 = load <8 x i8>, ptr %arrayidx13
72 %add = add <8 x i8> %tmp14, < i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1 >
73 %and = and <8 x i8> %add, < i8 4, i8 4, i8 4, i8 4, i8 4, i8 4, i8 4, i8 4 >
74 store <8 x i8> %and, ptr %arrayidx10
78 %tmp15 = load i32, ptr %i
79 %inc = add i32 %tmp15, 1
80 store i32 %inc, ptr %i