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