1; RUN: llc < %s | FileCheck %s 2; CHECK-DAG: memh(r{{[0-9]+}}+#0) = r{{[0-9]+}} 3; CHECK-DAG: memh(r{{[0-9]+}}+#2) = r{{[0-9]+}}.h 4; CHECK-DAG: memh(r{{[0-9]+}}+#4) = r{{[0-9]+}} 5; CHECK-DAG: memh(r{{[0-9]+}}+#6) = r{{[0-9]+}}.h 6 7target datalayout = "e-m:e-p:32:32-i1:32-i64:64-a:0-v32:32-n16:32" 8target triple = "hexagon" 9 10; Function Attrs: nounwind 11define void @foo(i64* nocapture readonly %r64, i16 zeroext %n, i16 zeroext %s, i64* nocapture %p64) #0 { 12entry: 13 %conv = zext i16 %n to i32 14 %cmp = icmp eq i16 %n, 0 15 br i1 %cmp, label %for.end, label %for.body.preheader 16 17for.body.preheader: ; preds = %entry 18 %0 = load i64, i64* %r64, align 8, !tbaa !1 19 %v.sroa.0.0.extract.trunc = trunc i64 %0 to i16 20 %v.sroa.4.0.extract.shift = lshr i64 %0, 16 21 %v.sroa.4.0.extract.trunc = trunc i64 %v.sroa.4.0.extract.shift to i16 22 %v.sroa.5.0.extract.shift = lshr i64 %0, 32 23 %v.sroa.5.0.extract.trunc = trunc i64 %v.sroa.5.0.extract.shift to i16 24 %v.sroa.6.0.extract.shift = lshr i64 %0, 48 25 %v.sroa.6.0.extract.trunc = trunc i64 %v.sroa.6.0.extract.shift to i16 26 %1 = bitcast i64* %p64 to i16* 27 %conv2 = zext i16 %s to i32 28 %add.ptr = getelementptr inbounds i16, i16* %1, i32 %conv2 29 %add.ptr.sum = add nuw nsw i32 %conv2, 1 30 %add.ptr3 = getelementptr inbounds i16, i16* %1, i32 %add.ptr.sum 31 %add.ptr.sum50 = add nuw nsw i32 %conv2, 2 32 %add.ptr4 = getelementptr inbounds i16, i16* %1, i32 %add.ptr.sum50 33 %add.ptr.sum51 = add nuw nsw i32 %conv2, 3 34 %add.ptr5 = getelementptr inbounds i16, i16* %1, i32 %add.ptr.sum51 35 br label %for.body 36 37for.body: ; preds = %for.body.preheader, %for.body 38 %add.ptr11.phi = phi i16* [ %add.ptr11.inc, %for.body ], [ %add.ptr, %for.body.preheader ] 39 %add.ptr16.phi = phi i16* [ %add.ptr16.inc, %for.body ], [ %add.ptr3, %for.body.preheader ] 40 %add.ptr21.phi = phi i16* [ %add.ptr21.inc, %for.body ], [ %add.ptr4, %for.body.preheader ] 41 %add.ptr26.phi = phi i16* [ %add.ptr26.inc, %for.body ], [ %add.ptr5, %for.body.preheader ] 42 %i.058.pmt = phi i32 [ %inc.pmt, %for.body ], [ 0, %for.body.preheader ] 43 %v.sroa.0.157 = phi i16 [ %v.sroa.0.0.extract.trunc34, %for.body ], [ %v.sroa.0.0.extract.trunc, %for.body.preheader ] 44 %v.sroa.4.156 = phi i16 [ %v.sroa.4.0.extract.trunc36, %for.body ], [ %v.sroa.4.0.extract.trunc, %for.body.preheader ] 45 %v.sroa.5.155 = phi i16 [ %v.sroa.5.0.extract.trunc38, %for.body ], [ %v.sroa.5.0.extract.trunc, %for.body.preheader ] 46 %v.sroa.6.154 = phi i16 [ %v.sroa.6.0.extract.trunc40, %for.body ], [ %v.sroa.6.0.extract.trunc, %for.body.preheader ] 47 %q64.153.pn = phi i64* [ %q64.153, %for.body ], [ %r64, %for.body.preheader ] 48 %q64.153 = getelementptr inbounds i64, i64* %q64.153.pn, i32 1 49 store i16 %v.sroa.0.157, i16* %add.ptr11.phi, align 2, !tbaa !5 50 store i16 %v.sroa.4.156, i16* %add.ptr16.phi, align 2, !tbaa !5 51 store i16 %v.sroa.5.155, i16* %add.ptr21.phi, align 2, !tbaa !5 52 store i16 %v.sroa.6.154, i16* %add.ptr26.phi, align 2, !tbaa !5 53 %2 = load i64, i64* %q64.153, align 8, !tbaa !1 54 %v.sroa.0.0.extract.trunc34 = trunc i64 %2 to i16 55 %v.sroa.4.0.extract.shift35 = lshr i64 %2, 16 56 %v.sroa.4.0.extract.trunc36 = trunc i64 %v.sroa.4.0.extract.shift35 to i16 57 %v.sroa.5.0.extract.shift37 = lshr i64 %2, 32 58 %v.sroa.5.0.extract.trunc38 = trunc i64 %v.sroa.5.0.extract.shift37 to i16 59 %v.sroa.6.0.extract.shift39 = lshr i64 %2, 48 60 %v.sroa.6.0.extract.trunc40 = trunc i64 %v.sroa.6.0.extract.shift39 to i16 61 %inc.pmt = add i32 %i.058.pmt, 1 62 %cmp8 = icmp slt i32 %inc.pmt, %conv 63 %add.ptr11.inc = getelementptr i16, i16* %add.ptr11.phi, i32 4 64 %add.ptr16.inc = getelementptr i16, i16* %add.ptr16.phi, i32 4 65 %add.ptr21.inc = getelementptr i16, i16* %add.ptr21.phi, i32 4 66 %add.ptr26.inc = getelementptr i16, i16* %add.ptr26.phi, i32 4 67 br i1 %cmp8, label %for.body, label %for.end 68 69for.end: ; preds = %for.body, %entry 70 ret void 71} 72 73attributes #0 = { nounwind } 74 75!1 = !{!2, !2, i64 0} 76!2 = !{!"long long", !3, i64 0} 77!3 = !{!"omnipotent char", !4, i64 0} 78!4 = !{!"Simple C/C++ TBAA"} 79!5 = !{!6, !6, i64 0} 80!6 = !{!"short", !3, i64 0} 81