Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit b9223fa

Browse files
committed
[Hexagon] - Fix testcase for the HexagonVectorLoopCarriedReuse pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313936 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent fa10300 commit b9223fa

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
; RUN: opt < %s -hexagon-vlcr -adce -S | FileCheck %s
2+
3+
; CHECK: %.hexagon.vlcr = tail call <32 x i32> @llvm.hexagon.V6.vmaxub.128B
4+
; ModuleID = 'hexagon_vector_loop_carried_reuse.c'
5+
source_filename = "hexagon_vector_loop_carried_reuse.c"
6+
target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"
7+
target triple = "hexagon"
8+
9+
@W = external local_unnamed_addr global i32, align 4
10+
11+
; Function Attrs: nounwind
12+
define void @foo(i8* noalias nocapture readonly %src, i8* noalias nocapture %dst, i32 %stride) local_unnamed_addr #0 {
13+
entry:
14+
%add.ptr = getelementptr inbounds i8, i8* %src, i32 %stride
15+
%mul = mul nsw i32 %stride, 2
16+
%add.ptr1 = getelementptr inbounds i8, i8* %src, i32 %mul
17+
%0 = load i32, i32* @W, align 4, !tbaa !1
18+
%cmp55 = icmp sgt i32 %0, 0
19+
br i1 %cmp55, label %for.body.lr.ph, label %for.end
20+
21+
for.body.lr.ph: ; preds = %entry
22+
%1 = bitcast i8* %add.ptr1 to <32 x i32>*
23+
%2 = load <32 x i32>, <32 x i32>* %1, align 128, !tbaa !5
24+
%incdec.ptr4 = getelementptr inbounds i8, i8* %add.ptr1, i32 128
25+
%3 = bitcast i8* %incdec.ptr4 to <32 x i32>*
26+
%4 = bitcast i8* %add.ptr to <32 x i32>*
27+
%5 = load <32 x i32>, <32 x i32>* %4, align 128, !tbaa !5
28+
%incdec.ptr2 = getelementptr inbounds i8, i8* %add.ptr, i32 128
29+
%6 = bitcast i8* %incdec.ptr2 to <32 x i32>*
30+
%7 = bitcast i8* %src to <32 x i32>*
31+
%8 = load <32 x i32>, <32 x i32>* %7, align 128, !tbaa !5
32+
%incdec.ptr = getelementptr inbounds i8, i8* %src, i32 128
33+
%9 = bitcast i8* %incdec.ptr to <32 x i32>*
34+
%10 = bitcast i8* %dst to <32 x i32>*
35+
br label %for.body
36+
37+
for.body: ; preds = %for.body.lr.ph, %for.body
38+
%out.063 = phi <32 x i32>* [ %10, %for.body.lr.ph ], [ %incdec.ptr18, %for.body ]
39+
%p2.062 = phi <32 x i32>* [ %3, %for.body.lr.ph ], [ %incdec.ptr10, %for.body ]
40+
%p1.061 = phi <32 x i32>* [ %6, %for.body.lr.ph ], [ %incdec.ptr8, %for.body ]
41+
%p0.060 = phi <32 x i32>* [ %9, %for.body.lr.ph ], [ %incdec.ptr6, %for.body ]
42+
%i.059 = phi i32 [ 0, %for.body.lr.ph ], [ %add, %for.body ]
43+
%a.sroa.0.058 = phi <32 x i32> [ %8, %for.body.lr.ph ], [ %11, %for.body ]
44+
%b.sroa.0.057 = phi <32 x i32> [ %5, %for.body.lr.ph ], [ %12, %for.body ]
45+
%c.sroa.0.056 = phi <32 x i32> [ %2, %for.body.lr.ph ], [ %13, %for.body ]
46+
%incdec.ptr6 = getelementptr inbounds <32 x i32>, <32 x i32>* %p0.060, i32 1
47+
%11 = load <32 x i32>, <32 x i32>* %p0.060, align 128, !tbaa !5
48+
%incdec.ptr8 = getelementptr inbounds <32 x i32>, <32 x i32>* %p1.061, i32 1
49+
%12 = load <32 x i32>, <32 x i32>* %p1.061, align 128, !tbaa !5
50+
%incdec.ptr10 = getelementptr inbounds <32 x i32>, <32 x i32>* %p2.062, i32 1
51+
%13 = load <32 x i32>, <32 x i32>* %p2.062, align 128, !tbaa !5
52+
%14 = tail call <32 x i32> @llvm.hexagon.V6.vmaxub.128B(<32 x i32> %a.sroa.0.058, <32 x i32> %b.sroa.0.057)
53+
%15 = tail call <32 x i32> @llvm.hexagon.V6.vmaxub.128B(<32 x i32> %14, <32 x i32> %c.sroa.0.056)
54+
%16 = tail call <32 x i32> @llvm.hexagon.V6.vmaxub.128B(<32 x i32> %11, <32 x i32> %12)
55+
%17 = tail call <32 x i32> @llvm.hexagon.V6.vmaxub.128B(<32 x i32> %16, <32 x i32> %13)
56+
%18 = tail call <32 x i32> @llvm.hexagon.V6.valignbi.128B(<32 x i32> %17, <32 x i32> %15, i32 1)
57+
%incdec.ptr18 = getelementptr inbounds <32 x i32>, <32 x i32>* %out.063, i32 1
58+
store <32 x i32> %18, <32 x i32>* %out.063, align 128, !tbaa !5
59+
%add = add nuw nsw i32 %i.059, 128
60+
%cmp = icmp slt i32 %add, %0
61+
br i1 %cmp, label %for.body, label %for.end.loopexit
62+
63+
for.end.loopexit: ; preds = %for.body
64+
br label %for.end
65+
66+
for.end: ; preds = %for.end.loopexit, %entry
67+
ret void
68+
}
69+
70+
; Function Attrs: nounwind readnone
71+
declare <32 x i32> @llvm.hexagon.V6.vmaxub.128B(<32 x i32>, <32 x i32>) #1
72+
73+
; Function Attrs: nounwind readnone
74+
declare <32 x i32> @llvm.hexagon.V6.valignbi.128B(<32 x i32>, <32 x i32>, i32) #1
75+
76+
attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="hexagonv60" "target-features"="+hvx,+hvx-double,-long-calls" "unsafe-fp-math"="false" "use-soft-float"="false" }
77+
attributes #1 = { nounwind readnone }
78+
79+
!llvm.ident = !{!0}
80+
81+
!0 = !{!"QuIC LLVM Hexagon Clang version hexagon-clang-82-2622 (based on LLVM 5.0.0)"}
82+
!1 = !{!2, !2, i64 0}
83+
!2 = !{!"int", !3, i64 0}
84+
!3 = !{!"omnipotent char", !4, i64 0}
85+
!4 = !{!"Simple C/C++ TBAA"}
86+
!5 = !{!3, !3, i64 0}

0 commit comments

Comments
 (0)