Home | History | Annotate | Download | only in X86
      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
      3 
      4 ; widen v8i8 to v16i8 (checks even power of 2 widening with add & and)
      5 
      6 define void @update(i64* %dst_i, i64* %src_i, i32 %n) nounwind {
      7 ; CHECK-LABEL: update:
      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:    jmp .LBB0_1
     14 ; CHECK-NEXT:    .p2align 4, 0x90
     15 ; CHECK-NEXT:  .LBB0_2: # %forbody
     16 ; CHECK-NEXT:    # in Loop: Header=BB0_1 Depth=1
     17 ; CHECK-NEXT:    movl (%esp), %eax
     18 ; CHECK-NEXT:    leal (,%eax,8), %ecx
     19 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %edx
     20 ; CHECK-NEXT:    addl %ecx, %edx
     21 ; CHECK-NEXT:    movl %edx, {{[0-9]+}}(%esp)
     22 ; CHECK-NEXT:    addl {{[0-9]+}}(%esp), %ecx
     23 ; CHECK-NEXT:    movl %ecx, {{[0-9]+}}(%esp)
     24 ; 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
     25 ; CHECK-NEXT:    psubw %xmm0, %xmm2
     26 ; CHECK-NEXT:    pand %xmm1, %xmm2
     27 ; CHECK-NEXT:    packuswb %xmm0, %xmm2
     28 ; CHECK-NEXT:    movq %xmm2, (%edx,%eax,8)
     29 ; CHECK-NEXT:    incl (%esp)
     30 ; CHECK-NEXT:  .LBB0_1: # %forcond
     31 ; CHECK-NEXT:    # =>This Inner Loop Header: Depth=1
     32 ; CHECK-NEXT:    movl (%esp), %eax
     33 ; CHECK-NEXT:    cmpl {{[0-9]+}}(%esp), %eax
     34 ; CHECK-NEXT:    jl .LBB0_2
     35 ; CHECK-NEXT:  # %bb.3: # %afterfor
     36 ; CHECK-NEXT:    addl $12, %esp
     37 ; CHECK-NEXT:    retl
     38 entry:
     39 	%dst_i.addr = alloca i64*
     40 	%src_i.addr = alloca i64*
     41 	%n.addr = alloca i32
     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
     48 	store i32 0, i32* %i
     49 	br label %forcond
     50 
     51 forcond:
     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
     56 
     57 forbody:
     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
     78 	br label %forinc
     79 
     80 forinc:
     81 	%tmp15 = load i32, i32* %i
     82 	%inc = add i32 %tmp15, 1
     83 	store i32 %inc, i32* %i
     84 	br label %forcond
     85 
     86 afterfor:
     87 	ret void
     88 }
     89 
     90