Michael Zolotukhin | 0c380a3 | 2014-05-05 14:05:25 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -O3 -march=x86-64 |FileCheck %s |
| 2 | define i64 @foo(i1 %z, i192* %p, i192* %q) |
| 3 | { |
Michael Zolotukhin | 4e030e8 | 2014-05-05 14:46:53 +0000 | [diff] [blame] | 4 | ; If const 128 is hoisted to a variable, then in basic block L_val2 we would |
| 5 | ; have %lshr2 = lshr i192 %data2, %const, and the definition of %const would |
| 6 | ; be in another basic block. As a result, a very inefficient code might be |
| 7 | ; produced. Here we check that this doesn't occur. |
Michael Zolotukhin | 0c380a3 | 2014-05-05 14:05:25 +0000 | [diff] [blame] | 8 | entry: |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 9 | %data1 = load i192, i192* %p, align 8 |
Michael Zolotukhin | 0c380a3 | 2014-05-05 14:05:25 +0000 | [diff] [blame] | 10 | %lshr1 = lshr i192 %data1, 128 |
| 11 | %val1 = trunc i192 %lshr1 to i64 |
| 12 | br i1 %z, label %End, label %L_val2 |
| 13 | |
| 14 | ; CHECK: movq 16(%rdx), %rax |
| 15 | ; CHECK-NEXT: retq |
| 16 | L_val2: |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 17 | %data2 = load i192, i192* %q, align 8 |
Michael Zolotukhin | 0c380a3 | 2014-05-05 14:05:25 +0000 | [diff] [blame] | 18 | %lshr2 = lshr i192 %data2, 128 |
| 19 | %val2 = trunc i192 %lshr2 to i64 |
| 20 | br label %End |
| 21 | |
| 22 | End: |
| 23 | %p1 = phi i64 [%val1,%entry], [%val2,%L_val2] |
| 24 | ret i64 %p1 |
| 25 | } |