Chris Lattner | 6f948be | 2010-12-19 20:12:58 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -march=x86 -mattr=+sse42 | FileCheck %s |
Mon P Wang | 362b8f2 | 2009-10-16 22:09:05 +0000 | [diff] [blame] | 2 | ; CHECK: mulps |
| 3 | ; CHECK: addps |
Mon P Wang | 1d04548 | 2008-12-18 20:05:58 +0000 | [diff] [blame] | 4 | |
| 5 | ; widen a v3f32 to vfi32 to do a vector multiple and an add |
Mon P Wang | 1d04548 | 2008-12-18 20:05:58 +0000 | [diff] [blame] | 6 | |
| 7 | define void @update(<3 x float>* %dst, <3 x float>* %src, i32 %n) nounwind { |
| 8 | entry: |
| 9 | %dst.addr = alloca <3 x float>* ; <<3 x float>**> [#uses=2] |
| 10 | %src.addr = alloca <3 x float>* ; <<3 x float>**> [#uses=2] |
| 11 | %n.addr = alloca i32 ; <i32*> [#uses=2] |
| 12 | %v = alloca <3 x float>, align 16 ; <<3 x float>*> [#uses=2] |
| 13 | %i = alloca i32, align 4 ; <i32*> [#uses=6] |
| 14 | store <3 x float>* %dst, <3 x float>** %dst.addr |
| 15 | store <3 x float>* %src, <3 x float>** %src.addr |
| 16 | store i32 %n, i32* %n.addr |
| 17 | store <3 x float> < float 1.000000e+00, float 2.000000e+00, float 3.000000e+00 >, <3 x float>* %v |
| 18 | store i32 0, i32* %i |
| 19 | br label %forcond |
| 20 | |
| 21 | forcond: ; preds = %forinc, %entry |
| 22 | %tmp = load i32* %i ; <i32> [#uses=1] |
| 23 | %tmp1 = load i32* %n.addr ; <i32> [#uses=1] |
| 24 | %cmp = icmp slt i32 %tmp, %tmp1 ; <i1> [#uses=1] |
| 25 | br i1 %cmp, label %forbody, label %afterfor |
| 26 | |
| 27 | forbody: ; preds = %forcond |
| 28 | %tmp2 = load i32* %i ; <i32> [#uses=1] |
| 29 | %tmp3 = load <3 x float>** %dst.addr ; <<3 x float>*> [#uses=1] |
| 30 | %arrayidx = getelementptr <3 x float>* %tmp3, i32 %tmp2 ; <<3 x float>*> [#uses=1] |
| 31 | %tmp4 = load i32* %i ; <i32> [#uses=1] |
| 32 | %tmp5 = load <3 x float>** %src.addr ; <<3 x float>*> [#uses=1] |
| 33 | %arrayidx6 = getelementptr <3 x float>* %tmp5, i32 %tmp4 ; <<3 x float>*> [#uses=1] |
| 34 | %tmp7 = load <3 x float>* %arrayidx6 ; <<3 x float>> [#uses=1] |
| 35 | %tmp8 = load <3 x float>* %v ; <<3 x float>> [#uses=1] |
Dan Gohman | ae3a0be | 2009-06-04 22:49:04 +0000 | [diff] [blame] | 36 | %mul = fmul <3 x float> %tmp7, %tmp8 ; <<3 x float>> [#uses=1] |
| 37 | %add = fadd <3 x float> %mul, < float 0x409EE02900000000, float 0x409EE02900000000, float 0x409EE02900000000 > ; <<3 x float>> [#uses=1] |
Mon P Wang | 1d04548 | 2008-12-18 20:05:58 +0000 | [diff] [blame] | 38 | store <3 x float> %add, <3 x float>* %arrayidx |
| 39 | br label %forinc |
| 40 | |
| 41 | forinc: ; preds = %forbody |
| 42 | %tmp9 = load i32* %i ; <i32> [#uses=1] |
| 43 | %inc = add i32 %tmp9, 1 ; <i32> [#uses=1] |
| 44 | store i32 %inc, i32* %i |
| 45 | br label %forcond |
| 46 | |
| 47 | afterfor: ; preds = %forcond |
| 48 | ret void |
| 49 | } |