1 ; RUN: llc -march=hexagon -hexagon-small-data-threshold=0 -disable-hexagon-amodeopt < %s | FileCheck %s --check-prefix=CHECK-NO-AMODE 2 ; RUN: llc -march=hexagon -hexagon-small-data-threshold=0 -disable-hexagon-amodeopt=0 -hexagon-amode-growth-limit=4 < %s | FileCheck %s --check-prefix=CHECK-AMODE 3 4 ; CHECK-NO-AMODE: [[REG0:(r[0-9]+)]] = ##global_2 5 ; CHECK-NO-AMODE: memw([[REG0]] + {{.*}}<<#2) = 6 7 ; CHECK-AMODE: [[REG1:(r[0-9]+)]] = memw(##global_1) 8 ; CHECK-AMODE: memw([[REG1]]<<#2 + ##global_2) = 9 10 @global_1 = external global i32, align 4 11 @global_2 = external global [128 x i32], align 8 12 13 declare i32 @foo(i32, i32) #0 14 15 define i32 @fred(i32 %a0, i32 %a1, i32* %p) #0 { 16 entry: 17 %call24 = tail call i32 @foo(i32 %a0, i32 1) #0 18 %tobool26 = icmp eq i32 %call24, 0 19 br i1 %tobool26, label %while.end, label %while.body.lr.ph 20 21 while.body.lr.ph: ; preds = %entry 22 %cmp3 = icmp sgt i32 %a1, 19 23 %sub = sub nsw i32 19, %a0 24 %xor = xor i32 %a0, 1 25 br i1 %cmp3, label %while.body.us.preheader, label %while.body.preheader 26 27 while.body.preheader: ; preds = %while.body.lr.ph 28 br label %while.body 29 30 while.body.us.preheader: ; preds = %while.body.lr.ph 31 br label %while.body.us 32 33 while.body.us: ; preds = %while.body.us.preheader, %while.cond.backedge.us 34 %call27.us = phi i32 [ %call.us, %while.cond.backedge.us ], [ %call24, %while.body.us.preheader ] 35 %x0 = load i32, i32* %p, align 4, !tbaa !4 36 %cmp.us = icmp sgt i32 %x0, 0 37 br i1 %cmp.us, label %if.then.us, label %if.end.us 38 39 if.then.us: ; preds = %while.body.us 40 %sext.us = shl i32 %call27.us, 24 41 %conv2.us = ashr i32 %sext.us, 24 42 %x10 = tail call i32 @foo(i32 %conv2.us, i32 %sext.us) #0 43 br label %if.end.us 44 45 if.end.us: ; preds = %if.then.us, %while.body.us 46 %x1 = load i32, i32* %p, align 4, !tbaa !4 47 %call8.us = tail call i32 @foo(i32 %sub, i32 %a1) #0 48 %tobool11.us = icmp eq i32 %call8.us, 0 49 br i1 %tobool11.us, label %while.cond.backedge.us, label %if.then12.us 50 51 if.then12.us: ; preds = %if.end.us 52 %x3 = load i32, i32* %p, align 4, !tbaa !4 53 %sub13.us = sub i32 %x3, %x1 54 %x4 = load i32, i32* @global_1, align 4, !tbaa !4 55 %arrayidx.us = getelementptr inbounds [128 x i32], [128 x i32]* @global_2, i32 0, i32 %x4 56 store i32 %sub13.us, i32* %arrayidx.us, align 4, !tbaa !4 57 br label %while.cond.backedge.us 58 59 while.cond.backedge.us: ; preds = %if.then12.us, %if.end.us 60 %call.us = tail call i32 @foo(i32 %a0, i32 2) #0 61 %tobool.us = icmp eq i32 %call.us, 0 62 br i1 %tobool.us, label %while.end.loopexit, label %while.body.us 63 64 while.body: ; preds = %while.body.preheader, %while.cond.backedge 65 %call27 = phi i32 [ %call, %while.cond.backedge ], [ %call24, %while.body.preheader ] 66 %x5 = load i32, i32* %p, align 4, !tbaa !4 67 %cmp = icmp sgt i32 %x5, 0 68 br i1 %cmp, label %if.then, label %if.end 69 70 if.then: ; preds = %while.body 71 %sext = shl i32 %call27, 24 72 %conv2 = ashr i32 %sext, 24 73 %x11 = tail call i32 @foo(i32 %conv2, i32 %sext) #0 74 br label %if.end 75 76 if.end: ; preds = %if.then, %while.body 77 %tobool11 = icmp eq i32 %call27, 0 78 br i1 %tobool11, label %while.cond.backedge, label %if.then12 79 80 if.then12: ; preds = %if.end 81 %x7 = load i32, i32* @global_1, align 4, !tbaa !4 82 %arrayidx = getelementptr inbounds [128 x i32], [128 x i32]* @global_2, i32 0, i32 %x7 83 store i32 0, i32* %arrayidx, align 4, !tbaa !4 84 br label %while.cond.backedge 85 86 while.cond.backedge: ; preds = %if.then12, %if.end 87 %call = tail call i32 @foo(i32 %a0, i32 3) #0 88 %tobool = icmp eq i32 %call, 0 89 br i1 %tobool, label %while.end.loopexit33, label %while.body 90 91 while.end.loopexit: ; preds = %while.cond.backedge.us 92 br label %while.end 93 94 while.end.loopexit33: ; preds = %while.cond.backedge 95 br label %while.end 96 97 while.end: ; preds = %while.end.loopexit33, %while.end.loopexit, %entry 98 ret i32 0 99 } 100 101 attributes #0 = { nounwind } 102 103 !1 = !{!2, !2, i64 0} 104 !2 = !{!"omnipotent char", !3, i64 0} 105 !3 = !{!"Simple C/C++ TBAA"} 106 !4 = !{!5, !5, i64 0} 107 !5 = !{!"int", !2, i64 0} 108