1 ; RUN: llc -march=hexagon < %s | FileCheck %s
3 ; Check that we no longer generate 4 inserts.
4 ; CHECK: combine(r{{[0-9]+}}.l,r{{[0-9]+}}.l)
5 ; CHECK: combine(r{{[0-9]+}}.l,r{{[0-9]+}}.l)
8 target datalayout = "e-p:32:32:32-i64:64:64-i32:32:32-i16:16:16-i1:32:32-f64:64:64-f32:32:32-v64:64:64-v32:32:32-a0:0-n16:32"
9 target triple = "hexagon"
11 %struct.a = type { i16 }
13 define i32 @fun(ptr nocapture %pData, i64 %c, ptr nocapture %d, ptr nocapture %e, ptr nocapture %f) #0 {
15 %0 = load i16, ptr %pData, align 2, !tbaa !0
16 %conv185 = sext i16 %0 to i32
17 %shr86 = ashr i32 %conv185, 2
18 %cmp87 = icmp sgt i32 %shr86, 0
19 br i1 %cmp87, label %for.body.lr.ph, label %for.end
21 for.body.lr.ph: ; preds = %entry
22 %h.sroa.0.0.extract.trunc = trunc i64 %c to i32
23 %sext = shl i32 %h.sroa.0.0.extract.trunc, 16
24 %conv8 = ashr exact i32 %sext, 16
25 %l.sroa.2.4.extract.shift = lshr i64 %c, 32
26 %sext76 = ashr i32 %h.sroa.0.0.extract.trunc, 16
27 %m.sroa.2.6.extract.shift = lshr i64 %c, 48
28 %sext7980 = shl nuw nsw i64 %l.sroa.2.4.extract.shift, 16
29 %sext79 = trunc i64 %sext7980 to i32
30 %conv38 = ashr exact i32 %sext79, 16
31 %sext8283 = shl nuw nsw i64 %m.sroa.2.6.extract.shift, 16
32 %sext82 = trunc i64 %sext8283 to i32
33 %conv53 = ashr exact i32 %sext82, 16
36 for.body: ; preds = %for.body.lr.ph, %for.body
37 %arrayidx.phi = phi ptr [ %d, %for.body.lr.ph ], [ %arrayidx.inc, %for.body ]
38 %arrayidx30.phi = phi ptr [ %f, %for.body.lr.ph ], [ %arrayidx30.inc, %for.body ]
39 %arrayidx60.phi = phi ptr [ %e, %for.body.lr.ph ], [ %arrayidx60.inc, %for.body ]
40 %j.088.pmt = phi i32 [ 0, %for.body.lr.ph ], [ %inc.pmt, %for.body ]
41 %1 = load i64, ptr %arrayidx.phi, align 8, !tbaa !1
42 %n_union3.sroa.0.0.extract.trunc = trunc i64 %1 to i32
43 %n_union3.sroa.1.4.extract.shift = lshr i64 %1, 32
44 %2 = tail call i64 @llvm.hexagon.M2.dpmpyss.s0(i32 %n_union3.sroa.0.0.extract.trunc, i32 %conv8)
45 %3 = tail call i64 @llvm.hexagon.S2.asl.r.p(i64 %2, i32 -25)
46 %conv9 = trunc i64 %3 to i32
47 %4 = tail call i32 @llvm.hexagon.A2.sath(i32 %conv9)
48 %n_union13.sroa.1.4.extract.trunc = trunc i64 %n_union3.sroa.1.4.extract.shift to i32
49 %5 = tail call i64 @llvm.hexagon.M2.dpmpyss.s0(i32 %n_union13.sroa.1.4.extract.trunc, i32 %sext76)
50 %6 = tail call i64 @llvm.hexagon.S2.asl.r.p(i64 %5, i32 -25)
51 %conv24 = trunc i64 %6 to i32
52 %7 = tail call i32 @llvm.hexagon.A2.sath(i32 %conv24)
53 %8 = load i64, ptr %arrayidx30.phi, align 8, !tbaa !1
54 %n_union28.sroa.0.0.extract.trunc = trunc i64 %8 to i32
55 %n_union28.sroa.1.4.extract.shift = lshr i64 %8, 32
56 %9 = tail call i64 @llvm.hexagon.M2.dpmpyss.s0(i32 %n_union28.sroa.0.0.extract.trunc, i32 %conv38)
57 %10 = tail call i64 @llvm.hexagon.S2.asl.r.p(i64 %9, i32 -25)
58 %conv39 = trunc i64 %10 to i32
59 %11 = tail call i32 @llvm.hexagon.A2.sath(i32 %conv39)
60 %n_union43.sroa.1.4.extract.trunc = trunc i64 %n_union28.sroa.1.4.extract.shift to i32
61 %12 = tail call i64 @llvm.hexagon.M2.dpmpyss.s0(i32 %n_union43.sroa.1.4.extract.trunc, i32 %conv53)
62 %13 = tail call i64 @llvm.hexagon.S2.asl.r.p(i64 %12, i32 -25)
63 %conv54 = trunc i64 %13 to i32
64 %14 = tail call i32 @llvm.hexagon.A2.sath(i32 %conv54)
65 %n_union.sroa.3.6.insert.ext = zext i32 %14 to i64
66 %n_union.sroa.3.6.insert.shift = shl i64 %n_union.sroa.3.6.insert.ext, 48
67 %conv40.mask = and i32 %11, 65535
68 %n_union.sroa.2.4.insert.ext = zext i32 %conv40.mask to i64
69 %n_union.sroa.2.4.insert.shift = shl nuw nsw i64 %n_union.sroa.2.4.insert.ext, 32
70 %conv25.mask = and i32 %7, 65535
71 %n_union.sroa.1.2.insert.ext = zext i32 %conv25.mask to i64
72 %n_union.sroa.1.2.insert.shift = shl nuw nsw i64 %n_union.sroa.1.2.insert.ext, 16
73 %conv10.mask = and i32 %4, 65535
74 %n_union.sroa.0.0.insert.ext = zext i32 %conv10.mask to i64
75 %n_union.sroa.2.4.insert.insert = or i64 %n_union.sroa.1.2.insert.shift, %n_union.sroa.0.0.insert.ext
76 %n_union.sroa.1.2.insert.insert = or i64 %n_union.sroa.2.4.insert.insert, %n_union.sroa.2.4.insert.shift
77 %n_union.sroa.0.0.insert.insert = or i64 %n_union.sroa.1.2.insert.insert, %n_union.sroa.3.6.insert.shift
78 %15 = load i64, ptr %arrayidx60.phi, align 8, !tbaa !1
79 %16 = tail call i64 @llvm.hexagon.A2.vaddhs(i64 %15, i64 %n_union.sroa.0.0.insert.insert)
80 store i64 %16, ptr %arrayidx60.phi, align 8, !tbaa !1
81 %inc.pmt = add i32 %j.088.pmt, 1
82 %17 = load i16, ptr %pData, align 2, !tbaa !0
83 %conv1 = sext i16 %17 to i32
84 %shr = ashr i32 %conv1, 2
85 %cmp = icmp slt i32 %inc.pmt, %shr
86 %arrayidx.inc = getelementptr i64, ptr %arrayidx.phi, i32 1
87 %arrayidx30.inc = getelementptr i64, ptr %arrayidx30.phi, i32 1
88 %arrayidx60.inc = getelementptr i64, ptr %arrayidx60.phi, i32 1
89 br i1 %cmp, label %for.body, label %for.end.loopexit
91 for.end.loopexit: ; preds = %for.body
94 for.end: ; preds = %for.end.loopexit, %entry
98 declare i32 @llvm.hexagon.A2.sath(i32) #1
100 declare i64 @llvm.hexagon.S2.asl.r.p(i64, i32) #1
102 declare i64 @llvm.hexagon.M2.dpmpyss.s0(i32, i32) #1
104 declare i64 @llvm.hexagon.A2.vaddhs(i64, i64) #1
106 attributes #0 = { nounwind "fp-contract-model"="standard" "frame-pointer"="non-leaf" "realign-stack" "relocation-model"="static" "ssp-buffers-size"="8" }
107 attributes #1 = { nounwind readnone }
110 !1 = !{!"omnipotent char", !2}
111 !2 = !{!"Simple C/C++ TBAA"}