1 ; RUN: llc -march=hexagon < %s
4 ; Thie tests checks a compiler assert. So the test just needs to compile for it to pass
5 target triple = "hexagon-unknown--elf"
7 %struct.buffer_t = type { i64, ptr, [4 x i32], [4 x i32], [4 x i32], i32, i8, i8, [6 x i8] }
9 ; Function Attrs: norecurse nounwind
10 define i32 @__testOne(ptr noalias nocapture readonly %inputOne.buffer, ptr noalias nocapture readonly %inputTwo.buffer, ptr noalias nocapture readonly %testOne.buffer) #0 {
12 %buf_host = getelementptr inbounds %struct.buffer_t, ptr %inputOne.buffer, i32 0, i32 1
13 %inputOne.host = load ptr, ptr %buf_host, align 4
14 %buf_min = getelementptr inbounds %struct.buffer_t, ptr %inputOne.buffer, i32 0, i32 4, i32 0
15 %inputOne.min.0 = load i32, ptr %buf_min, align 4
16 %buf_host10 = getelementptr inbounds %struct.buffer_t, ptr %inputTwo.buffer, i32 0, i32 1
17 %inputTwo.host = load ptr, ptr %buf_host10, align 4
18 %buf_min22 = getelementptr inbounds %struct.buffer_t, ptr %inputTwo.buffer, i32 0, i32 4, i32 0
19 %inputTwo.min.0 = load i32, ptr %buf_min22, align 4
20 %buf_host27 = getelementptr inbounds %struct.buffer_t, ptr %testOne.buffer, i32 0, i32 1
21 %testOne.host = load ptr, ptr %buf_host27, align 4
22 %buf_extent31 = getelementptr inbounds %struct.buffer_t, ptr %testOne.buffer, i32 0, i32 2, i32 0
23 %testOne.extent.0 = load i32, ptr %buf_extent31, align 4
24 %buf_min39 = getelementptr inbounds %struct.buffer_t, ptr %testOne.buffer, i32 0, i32 4, i32 0
25 %testOne.min.0 = load i32, ptr %buf_min39, align 4
26 %0 = ashr i32 %testOne.extent.0, 4
27 %1 = icmp sgt i32 %0, 0
28 br i1 %1, label %"for testOne.s0.x.x.preheader", label %"end for testOne.s0.x.x"
30 "for testOne.s0.x.x.preheader": ; preds = %entry
31 %2 = bitcast ptr %inputOne.host to ptr
32 %3 = bitcast ptr %inputTwo.host to ptr
33 %4 = bitcast ptr %testOne.host to ptr
34 br label %"for testOne.s0.x.x"
36 "for testOne.s0.x.x": ; preds = %"for testOne.s0.x.x", %"for testOne.s0.x.x.preheader"
37 %.phi = phi ptr [ %4, %"for testOne.s0.x.x.preheader" ], [ %.inc, %"for testOne.s0.x.x" ]
38 %testOne.s0.x.x = phi i32 [ 0, %"for testOne.s0.x.x.preheader" ], [ %50, %"for testOne.s0.x.x" ]
39 %5 = shl nsw i32 %testOne.s0.x.x, 4
40 %6 = add nsw i32 %5, %testOne.min.0
41 %7 = shl nsw i32 %6, 1
42 %8 = sub nsw i32 %7, %inputOne.min.0
43 %9 = getelementptr inbounds i16, ptr %2, i32 %8
44 %10 = bitcast ptr %9 to ptr
45 %11 = load <16 x i16>, ptr %10, align 2, !tbaa !5
46 %12 = add nsw i32 %8, 15
47 %13 = getelementptr inbounds i16, ptr %2, i32 %12
48 %14 = bitcast ptr %13 to ptr
49 %15 = load <16 x i16>, ptr %14, align 2, !tbaa !5
50 %16 = shufflevector <16 x i16> %11, <16 x i16> %15, <16 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14, i32 17, i32 19, i32 21, i32 23, i32 25, i32 27, i32 29, i32 31>
51 %17 = add nsw i32 %8, 1
52 %18 = getelementptr inbounds i16, ptr %2, i32 %17
53 %19 = bitcast ptr %18 to ptr
54 %20 = load <16 x i16>, ptr %19, align 2, !tbaa !5
55 %21 = add nsw i32 %8, 16
56 %22 = getelementptr inbounds i16, ptr %2, i32 %21
57 %23 = bitcast ptr %22 to ptr
58 %24 = load <16 x i16>, ptr %23, align 2, !tbaa !5
59 %25 = shufflevector <16 x i16> %20, <16 x i16> %24, <16 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14, i32 17, i32 19, i32 21, i32 23, i32 25, i32 27, i32 29, i32 31>
60 %26 = shufflevector <16 x i16> %16, <16 x i16> %25, <32 x i32> <i32 0, i32 16, i32 1, i32 17, i32 2, i32 18, i32 3, i32 19, i32 4, i32 20, i32 5, i32 21, i32 6, i32 22, i32 7, i32 23, i32 8, i32 24, i32 9, i32 25, i32 10, i32 26, i32 11, i32 27, i32 12, i32 28, i32 13, i32 29, i32 14, i32 30, i32 15, i32 31>
61 %27 = sub nsw i32 %7, %inputTwo.min.0
62 %28 = getelementptr inbounds i16, ptr %3, i32 %27
63 %29 = bitcast ptr %28 to ptr
64 %30 = load <16 x i16>, ptr %29, align 2, !tbaa !8
65 %31 = add nsw i32 %27, 15
66 %32 = getelementptr inbounds i16, ptr %3, i32 %31
67 %33 = bitcast ptr %32 to ptr
68 %34 = load <16 x i16>, ptr %33, align 2, !tbaa !8
69 %35 = shufflevector <16 x i16> %30, <16 x i16> %34, <16 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14, i32 17, i32 19, i32 21, i32 23, i32 25, i32 27, i32 29, i32 31>
70 %36 = add nsw i32 %27, 1
71 %37 = getelementptr inbounds i16, ptr %3, i32 %36
72 %38 = bitcast ptr %37 to ptr
73 %39 = load <16 x i16>, ptr %38, align 2, !tbaa !8
74 %40 = add nsw i32 %27, 16
75 %41 = getelementptr inbounds i16, ptr %3, i32 %40
76 %42 = bitcast ptr %41 to ptr
77 %43 = load <16 x i16>, ptr %42, align 2, !tbaa !8
78 %44 = shufflevector <16 x i16> %39, <16 x i16> %43, <16 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14, i32 17, i32 19, i32 21, i32 23, i32 25, i32 27, i32 29, i32 31>
79 %45 = shufflevector <16 x i16> %35, <16 x i16> %44, <32 x i32> <i32 0, i32 16, i32 1, i32 17, i32 2, i32 18, i32 3, i32 19, i32 4, i32 20, i32 5, i32 21, i32 6, i32 22, i32 7, i32 23, i32 8, i32 24, i32 9, i32 25, i32 10, i32 26, i32 11, i32 27, i32 12, i32 28, i32 13, i32 29, i32 14, i32 30, i32 15, i32 31>
80 %46 = bitcast <32 x i16> %26 to <16 x i32>
81 %47 = bitcast <32 x i16> %45 to <16 x i32>
82 %48 = tail call <16 x i32> @llvm.hexagon.V6.vdmpyhvsat(<16 x i32> %46, <16 x i32> %47)
83 %49 = bitcast ptr %.phi to ptr
84 store <16 x i32> %48, ptr %49, align 4, !tbaa !10
85 %50 = add nuw nsw i32 %testOne.s0.x.x, 1
86 %51 = icmp eq i32 %50, %0
87 %.inc = getelementptr i32, ptr %.phi, i32 16
88 br i1 %51, label %"end for testOne.s0.x.x", label %"for testOne.s0.x.x"
90 "end for testOne.s0.x.x": ; preds = %"for testOne.s0.x.x", %entry
91 %52 = add nsw i32 %testOne.extent.0, 15
93 %54 = icmp sgt i32 %53, %0
94 br i1 %54, label %"for testOne.s0.x.x44.preheader", label %destructor_block
96 "for testOne.s0.x.x44.preheader": ; preds = %"end for testOne.s0.x.x"
97 %55 = add nsw i32 %testOne.min.0, %testOne.extent.0
98 %56 = shl nsw i32 %55, 1
99 %57 = sub nsw i32 %56, %inputOne.min.0
100 %58 = add nsw i32 %57, -32
101 %59 = bitcast ptr %inputOne.host to ptr
102 %60 = getelementptr inbounds i16, ptr %59, i32 %58
103 %61 = bitcast ptr %60 to ptr
104 %62 = load <16 x i16>, ptr %61, align 2
105 %63 = add nsw i32 %57, -17
106 %64 = getelementptr inbounds i16, ptr %59, i32 %63
107 %65 = bitcast ptr %64 to ptr
108 %66 = load <16 x i16>, ptr %65, align 2
109 %67 = add nsw i32 %57, -31
110 %68 = getelementptr inbounds i16, ptr %59, i32 %67
111 %69 = bitcast ptr %68 to ptr
112 %70 = load <16 x i16>, ptr %69, align 2
113 %71 = add nsw i32 %57, -16
114 %72 = getelementptr inbounds i16, ptr %59, i32 %71
115 %73 = bitcast ptr %72 to ptr
116 %74 = load <16 x i16>, ptr %73, align 2
117 %75 = shufflevector <16 x i16> %70, <16 x i16> %74, <16 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14, i32 17, i32 19, i32 21, i32 23, i32 25, i32 27, i32 29, i32 31>
118 %76 = sub nsw i32 %56, %inputTwo.min.0
119 %77 = add nsw i32 %76, -32
120 %78 = bitcast ptr %inputTwo.host to ptr
121 %79 = getelementptr inbounds i16, ptr %78, i32 %77
122 %80 = bitcast ptr %79 to ptr
123 %81 = load <16 x i16>, ptr %80, align 2
124 %82 = add nsw i32 %76, -17
125 %83 = getelementptr inbounds i16, ptr %78, i32 %82
126 %84 = bitcast ptr %83 to ptr
127 %85 = load <16 x i16>, ptr %84, align 2
128 %86 = shufflevector <16 x i16> %81, <16 x i16> %85, <16 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14, i32 17, i32 19, i32 21, i32 23, i32 25, i32 27, i32 29, i32 31>
129 %87 = add nsw i32 %76, -31
130 %88 = getelementptr inbounds i16, ptr %78, i32 %87
131 %89 = bitcast ptr %88 to ptr
132 %90 = load <16 x i16>, ptr %89, align 2
133 %91 = add nsw i32 %76, -16
134 %92 = getelementptr inbounds i16, ptr %78, i32 %91
135 %93 = bitcast ptr %92 to ptr
136 %94 = load <16 x i16>, ptr %93, align 2
137 %95 = shufflevector <16 x i16> %90, <16 x i16> %94, <16 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14, i32 17, i32 19, i32 21, i32 23, i32 25, i32 27, i32 29, i32 31>
138 %96 = shufflevector <16 x i16> %86, <16 x i16> %95, <32 x i32> <i32 0, i32 16, i32 1, i32 17, i32 2, i32 18, i32 3, i32 19, i32 4, i32 20, i32 5, i32 21, i32 6, i32 22, i32 7, i32 23, i32 8, i32 24, i32 9, i32 25, i32 10, i32 26, i32 11, i32 27, i32 12, i32 28, i32 13, i32 29, i32 14, i32 30, i32 15, i32 31>
139 %97 = bitcast <32 x i16> %96 to <16 x i32>
140 %98 = add nsw i32 %testOne.extent.0, -16
141 %99 = bitcast ptr %testOne.host to ptr
142 %100 = getelementptr inbounds i32, ptr %99, i32 %98
143 %101 = shufflevector <16 x i16> %62, <16 x i16> %66, <16 x i32> <i32 0, i32 2, i32 4, i32 6, i32 8, i32 10, i32 12, i32 14, i32 17, i32 19, i32 21, i32 23, i32 25, i32 27, i32 29, i32 31>
144 %102 = shufflevector <16 x i16> %101, <16 x i16> %75, <32 x i32> <i32 0, i32 16, i32 1, i32 17, i32 2, i32 18, i32 3, i32 19, i32 4, i32 20, i32 5, i32 21, i32 6, i32 22, i32 7, i32 23, i32 8, i32 24, i32 9, i32 25, i32 10, i32 26, i32 11, i32 27, i32 12, i32 28, i32 13, i32 29, i32 14, i32 30, i32 15, i32 31>
145 %103 = bitcast <32 x i16> %102 to <16 x i32>
146 %104 = tail call <16 x i32> @llvm.hexagon.V6.vdmpyhvsat(<16 x i32> %103, <16 x i32> %97)
147 %105 = bitcast ptr %100 to ptr
148 store <16 x i32> %104, ptr %105, align 4, !tbaa !10
149 br label %destructor_block
151 destructor_block: ; preds = %"for testOne.s0.x.x44.preheader", %"end for testOne.s0.x.x"
155 ; Function Attrs: nounwind readnone
156 declare <16 x i32> @llvm.hexagon.V6.vdmpyhvsat(<16 x i32>, <16 x i32>) #1
158 attributes #0 = { norecurse nounwind "target-cpu"="hexagonv60" "target-features"="+hvxv60,+hvx-length64b" }
159 attributes #1 = { nounwind readnone "target-cpu"="hexagonv60" "target-features"="+hvxv60,+hvx-length64b" }
161 !5 = !{!6, !6, i64 0}
162 !6 = !{!"inputOne", !7}
163 !7 = !{!"Halide buffer"}
164 !8 = !{!9, !9, i64 0}
165 !9 = !{!"inputTwo", !7}
166 !10 = !{!11, !11, i64 0}
167 !11 = !{!"testOne", !7}