Manuel Jacob | a7c48f9 | 2014-03-13 13:36:25 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -march=x86-64 | FileCheck %s |
| 2 | |
| 3 | define void @test(i64* nocapture %arr, i64 %arrsize, i64 %factor) nounwind uwtable { |
| 4 | %1 = icmp sgt i64 %arrsize, 0 |
| 5 | br i1 %1, label %.lr.ph, label %._crit_edge |
| 6 | |
| 7 | .lr.ph: ; preds = %0 |
| 8 | %2 = sext i64 %factor to i128 |
| 9 | br label %3 |
| 10 | |
| 11 | ; <label>:3 ; preds = %3, %.lr.ph |
| 12 | ; CHECK-NOT: mul |
| 13 | ; CHECK: imulq |
| 14 | ; CHECK-NOT: mul |
| 15 | %carry.02 = phi i128 [ 0, %.lr.ph ], [ %10, %3 ] |
| 16 | %i.01 = phi i64 [ 0, %.lr.ph ], [ %11, %3 ] |
| 17 | %4 = getelementptr inbounds i64* %arr, i64 %i.01 |
| 18 | %5 = load i64* %4, align 8 |
| 19 | %6 = sext i64 %5 to i128 |
| 20 | %7 = mul nsw i128 %6, %2 |
| 21 | %8 = add nsw i128 %7, %carry.02 |
| 22 | %.tr = trunc i128 %8 to i64 |
| 23 | %9 = and i64 %.tr, 9223372036854775807 |
| 24 | store i64 %9, i64* %4, align 8 |
| 25 | %10 = ashr i128 %8, 63 |
| 26 | %11 = add nsw i64 %i.01, 1 |
| 27 | %exitcond = icmp eq i64 %11, %arrsize |
| 28 | br i1 %exitcond, label %._crit_edge, label %3 |
| 29 | |
| 30 | ._crit_edge: ; preds = %3, %0 |
| 31 | ret void |
| 32 | } |