Wei Mi | 7e103d9 | 2016-08-12 03:33:22 +0000 | [diff] [blame] | 1 | ; PR28852: Check machine code sinking is not stopped by SUBREG_TO_REG. |
| 2 | ; RUN: llc < %s | FileCheck %s |
| 3 | |
| 4 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 5 | target triple = "x86_64-unknown-linux-gnu" |
| 6 | |
| 7 | ; CHECK: foo |
| 8 | ; CHECK-NOT: imull |
| 9 | ; CHECK: retq |
| 10 | ; CHECK: imull |
| 11 | |
| 12 | define void @foo(i64 %value, i32 %kLengthBits, i32* nocapture %bits, i64* nocapture %bit_buffer_64, i32 %x) local_unnamed_addr { |
| 13 | entry: |
| 14 | %mul = mul i32 %x, %kLengthBits |
| 15 | %add = add i32 %mul, 3 |
| 16 | %conv = zext i32 %add to i64 |
| 17 | %mul2 = mul nuw nsw i64 %conv, 5 |
| 18 | %sub = sub i64 64, %value |
| 19 | %conv4 = trunc i64 %sub to i32 |
| 20 | %tmp0 = load i32, i32* %bits, align 4 |
| 21 | %cmp = icmp ult i32 %tmp0, %conv4 |
| 22 | br i1 %cmp, label %if.then, label %if.end, !prof !0 |
| 23 | |
| 24 | if.then: ; preds = %entry |
| 25 | %add7 = add i64 %mul2, %value |
| 26 | %tmp1 = load i64, i64* %bit_buffer_64, align 8 |
| 27 | %add8 = add i64 %add7, %tmp1 |
| 28 | store i64 %add8, i64* %bit_buffer_64, align 8 |
| 29 | %conv9 = trunc i64 %mul2 to i32 |
| 30 | store i32 %conv9, i32* %bits, align 4 |
| 31 | br label %if.end |
| 32 | |
| 33 | if.end: ; preds = %if.then, %entry |
| 34 | ret void |
| 35 | } |
| 36 | |
| 37 | !0 = !{!"branch_weights", i32 1, i32 2000} |