blob: 4b8016dc7132d5d0d267221122770a69718cc6ad [file] [log] [blame]
Chris Lattner6f948be2010-12-19 20:12:58 +00001; RUN: llc < %s -march=x86 -mattr=+sse42 | FileCheck %s
Mon P Wang1d045482008-12-18 20:05:58 +00002
3; Widen a v3i8 to v16i8 to use a vector add
4
Mon P Wang1d045482008-12-18 20:05:58 +00005define void @update(<3 x i8>* %dst, <3 x i8>* %src, i32 %n) nounwind {
6entry:
Mon P Wang362b8f22009-10-16 22:09:05 +00007; CHECK-NOT: pextrw
8; CHECK: paddb
9; CHECK: pextrb
Mon P Wang1d045482008-12-18 20:05:58 +000010 %dst.addr = alloca <3 x i8>* ; <<3 x i8>**> [#uses=2]
11 %src.addr = alloca <3 x i8>* ; <<3 x i8>**> [#uses=2]
12 %n.addr = alloca i32 ; <i32*> [#uses=2]
13 %i = alloca i32, align 4 ; <i32*> [#uses=6]
14 store <3 x i8>* %dst, <3 x i8>** %dst.addr
15 store <3 x i8>* %src, <3 x i8>** %src.addr
16 store i32 %n, i32* %n.addr
17 store i32 0, i32* %i
18 br label %forcond
19
20forcond: ; preds = %forinc, %entry
21 %tmp = load i32* %i ; <i32> [#uses=1]
22 %tmp1 = load i32* %n.addr ; <i32> [#uses=1]
23 %cmp = icmp slt i32 %tmp, %tmp1 ; <i1> [#uses=1]
24 br i1 %cmp, label %forbody, label %afterfor
25
26forbody: ; preds = %forcond
27 %tmp2 = load i32* %i ; <i32> [#uses=1]
28 %tmp3 = load <3 x i8>** %dst.addr ; <<3 x i8>*> [#uses=1]
29 %arrayidx = getelementptr <3 x i8>* %tmp3, i32 %tmp2 ; <<3 x i8>*> [#uses=1]
30 %tmp4 = load i32* %i ; <i32> [#uses=1]
31 %tmp5 = load <3 x i8>** %src.addr ; <<3 x i8>*> [#uses=1]
32 %arrayidx6 = getelementptr <3 x i8>* %tmp5, i32 %tmp4 ; <<3 x i8>*> [#uses=1]
33 %tmp7 = load <3 x i8>* %arrayidx6 ; <<3 x i8>> [#uses=1]
34 %add = add <3 x i8> %tmp7, < i8 1, i8 1, i8 1 > ; <<3 x i8>> [#uses=1]
35 store <3 x i8> %add, <3 x i8>* %arrayidx
36 br label %forinc
37
38forinc: ; preds = %forbody
39 %tmp8 = load i32* %i ; <i32> [#uses=1]
40 %inc = add i32 %tmp8, 1 ; <i32> [#uses=1]
41 store i32 %inc, i32* %i
42 br label %forcond
43
44afterfor: ; preds = %forcond
45 ret void
46}