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(i64* %dst_i, i64* %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]
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: pmovzxbw {{.*#+}} xmm2 = mem[0],zero,mem[1],zero,mem[2],zero,mem[3],zero,mem[4],zero,mem[5],zero,mem[6],zero,mem[7],zero
29 ; CHECK-NEXT: psubw %xmm0, %xmm2
30 ; CHECK-NEXT: pand %xmm1, %xmm2
31 ; CHECK-NEXT: packuswb %xmm0, %xmm2
32 ; CHECK-NEXT: movq %xmm2, (%edx,%eax,8)
33 ; CHECK-NEXT: incl (%esp)
34 ; CHECK-NEXT: jmp .LBB0_1
35 ; CHECK-NEXT: .LBB0_3: # %afterfor
36 ; CHECK-NEXT: addl $12, %esp
39 %dst_i.addr = alloca i64*
40 %src_i.addr = alloca i64*
42 %i = alloca i32, align 4
43 %dst = alloca <8 x i8>*, align 4
44 %src = alloca <8 x i8>*, align 4
45 store i64* %dst_i, i64** %dst_i.addr
46 store i64* %src_i, i64** %src_i.addr
47 store i32 %n, i32* %n.addr
52 %tmp = load i32, i32* %i
53 %tmp1 = load i32, i32* %n.addr
54 %cmp = icmp slt i32 %tmp, %tmp1
55 br i1 %cmp, label %forbody, label %afterfor
58 %tmp2 = load i32, i32* %i
59 %tmp3 = load i64*, i64** %dst_i.addr
60 %arrayidx = getelementptr i64, i64* %tmp3, i32 %tmp2
61 %conv = bitcast i64* %arrayidx to <8 x i8>*
62 store <8 x i8>* %conv, <8 x i8>** %dst
63 %tmp4 = load i32, i32* %i
64 %tmp5 = load i64*, i64** %src_i.addr
65 %arrayidx6 = getelementptr i64, i64* %tmp5, i32 %tmp4
66 %conv7 = bitcast i64* %arrayidx6 to <8 x i8>*
67 store <8 x i8>* %conv7, <8 x i8>** %src
68 %tmp8 = load i32, i32* %i
69 %tmp9 = load <8 x i8>*, <8 x i8>** %dst
70 %arrayidx10 = getelementptr <8 x i8>, <8 x i8>* %tmp9, i32 %tmp8
71 %tmp11 = load i32, i32* %i
72 %tmp12 = load <8 x i8>*, <8 x i8>** %src
73 %arrayidx13 = getelementptr <8 x i8>, <8 x i8>* %tmp12, i32 %tmp11
74 %tmp14 = load <8 x i8>, <8 x i8>* %arrayidx13
75 %add = add <8 x i8> %tmp14, < i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1 >
76 %and = and <8 x i8> %add, < i8 4, i8 4, i8 4, i8 4, i8 4, i8 4, i8 4, i8 4 >
77 store <8 x i8> %and, <8 x i8>* %arrayidx10
81 %tmp15 = load i32, i32* %i
82 %inc = add i32 %tmp15, 1
83 store i32 %inc, i32* %i