blob: 65c26f818a6a682a228f3acefef7273407c3b6d2 [file] [log] [blame]
Michael Zolotukhin0c380a32014-05-05 14:05:25 +00001; RUN: llc < %s -O3 -march=x86-64 |FileCheck %s
2define i64 @foo(i1 %z, i192* %p, i192* %q)
3{
Michael Zolotukhin4e030e82014-05-05 14:46:53 +00004; 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 Zolotukhin0c380a32014-05-05 14:05:25 +00008entry:
David Blaikiea79ac142015-02-27 21:17:42 +00009 %data1 = load i192, i192* %p, align 8
Michael Zolotukhin0c380a32014-05-05 14:05:25 +000010 %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
16L_val2:
David Blaikiea79ac142015-02-27 21:17:42 +000017 %data2 = load i192, i192* %q, align 8
Michael Zolotukhin0c380a32014-05-05 14:05:25 +000018 %lshr2 = lshr i192 %data2, 128
19 %val2 = trunc i192 %lshr2 to i64
20 br label %End
21
22End:
23 %p1 = phi i64 [%val1,%entry], [%val2,%L_val2]
24 ret i64 %p1
25}