Dan Gohman | a10756e | 2010-01-21 02:09:26 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -march=x86 >%t |
| 2 | |
| 3 | ; TODO: Enhance full lsr mode to get this: |
| 4 | ; RUNX: grep {addl \\\$4,} %t | count 3 |
| 5 | ; RUNX: not grep {,%} %t |
| 6 | |
| 7 | ; For now, it should find this, which is still pretty good: |
| 8 | ; RUN: not grep {addl \\\$4,} %t |
| 9 | ; RUN: grep {,%} %t | count 6 |
Dan Gohman | c17e0cf | 2009-02-20 04:17:46 +0000 | [diff] [blame] | 10 | |
| 11 | define void @foo(float* nocapture %A, float* nocapture %B, float* nocapture %C, i32 %N) nounwind { |
| 12 | entry: |
| 13 | %0 = icmp sgt i32 %N, 0 ; <i1> [#uses=1] |
| 14 | br i1 %0, label %bb, label %return |
| 15 | |
| 16 | bb: ; preds = %bb, %entry |
| 17 | %i.03 = phi i32 [ 0, %entry ], [ %indvar.next, %bb ] ; <i32> [#uses=5] |
| 18 | %1 = getelementptr float* %A, i32 %i.03 ; <float*> [#uses=1] |
| 19 | %2 = load float* %1, align 4 ; <float> [#uses=1] |
| 20 | %3 = getelementptr float* %B, i32 %i.03 ; <float*> [#uses=1] |
| 21 | %4 = load float* %3, align 4 ; <float> [#uses=1] |
Dan Gohman | ae3a0be | 2009-06-04 22:49:04 +0000 | [diff] [blame] | 22 | %5 = fadd float %2, %4 ; <float> [#uses=1] |
Dan Gohman | c17e0cf | 2009-02-20 04:17:46 +0000 | [diff] [blame] | 23 | %6 = getelementptr float* %C, i32 %i.03 ; <float*> [#uses=1] |
| 24 | store float %5, float* %6, align 4 |
| 25 | %7 = add i32 %i.03, 10 ; <i32> [#uses=3] |
| 26 | %8 = getelementptr float* %A, i32 %7 ; <float*> [#uses=1] |
| 27 | %9 = load float* %8, align 4 ; <float> [#uses=1] |
| 28 | %10 = getelementptr float* %B, i32 %7 ; <float*> [#uses=1] |
| 29 | %11 = load float* %10, align 4 ; <float> [#uses=1] |
Dan Gohman | ae3a0be | 2009-06-04 22:49:04 +0000 | [diff] [blame] | 30 | %12 = fadd float %9, %11 ; <float> [#uses=1] |
Dan Gohman | c17e0cf | 2009-02-20 04:17:46 +0000 | [diff] [blame] | 31 | %13 = getelementptr float* %C, i32 %7 ; <float*> [#uses=1] |
| 32 | store float %12, float* %13, align 4 |
| 33 | %indvar.next = add i32 %i.03, 1 ; <i32> [#uses=2] |
| 34 | %exitcond = icmp eq i32 %indvar.next, %N ; <i1> [#uses=1] |
| 35 | br i1 %exitcond, label %return, label %bb |
| 36 | |
| 37 | return: ; preds = %bb, %entry |
| 38 | ret void |
| 39 | } |