blob: 1b6def17bd914f2793e4c9f48c40cfd41eaba391 [file] [log] [blame]
Krzysztof Parzyszek4094ab72018-03-20 19:35:09 +00001; RUN: llc -march=hexagon -enable-pipeliner -enable-bsb-sched=0 -join-liveintervals=false < %s | FileCheck %s
2
3; Test that we generate the correct Phi values when there is a Phi that
4; references another Phi. We need to examine the other Phi to get the
5; correct value. We need to do this even if we haven't generated the
6; kernel code for the other Phi yet.
7
8; CHECK: [[REG0:(v[0-9]+)]] = [[REG1:(v[0-9]+)]]
9; CHECK: loop0
10; CHECK: [[REG0]] = [[REG1]]
11; CHECK: endloop0
12
13; Function Attrs: nounwind
14define void @f0() #0 {
15b0:
16 br i1 undef, label %b1, label %b2
17
18b1: ; preds = %b1, %b0
19 %v0 = phi i32 [ %v7, %b1 ], [ 0, %b0 ]
20 %v1 = phi <16 x i32> [ %v4, %b1 ], [ undef, %b0 ]
21 %v2 = phi <16 x i32> [ %v1, %b1 ], [ undef, %b0 ]
22 %v3 = tail call <16 x i32> @llvm.hexagon.V6.valignb(<16 x i32> %v1, <16 x i32> %v2, i32 62)
23 %v4 = tail call <16 x i32> @llvm.hexagon.V6.vaddh(<16 x i32> undef, <16 x i32> undef)
24 %v5 = tail call <16 x i32> @llvm.hexagon.V6.valignb(<16 x i32> %v4, <16 x i32> %v1, i32 2)
25 %v6 = tail call <16 x i32> @llvm.hexagon.V6.vabsdiffh(<16 x i32> %v3, <16 x i32> %v5)
26 store <16 x i32> %v6, <16 x i32>* null, align 64
27 %v7 = add nsw i32 %v0, 1
28 %v8 = icmp slt i32 %v7, undef
29 br i1 %v8, label %b1, label %b2
30
31b2: ; preds = %b1, %b0
32 ret void
33}
34
35; Function Attrs: nounwind readnone
36declare <16 x i32> @llvm.hexagon.V6.vaddh(<16 x i32>, <16 x i32>) #1
37
38; Function Attrs: nounwind readnone
39declare <16 x i32> @llvm.hexagon.V6.valignb(<16 x i32>, <16 x i32>, i32) #1
40
41; Function Attrs: nounwind readnone
42declare <16 x i32> @llvm.hexagon.V6.vabsdiffh(<16 x i32>, <16 x i32>) #1
43
44attributes #0 = { nounwind "target-cpu"="hexagonv60" "target-features"="+hvxv60,+hvx-length64b" }
45attributes #1 = { nounwind readnone }