1 ; RUN: llc < %s -march=bpfel | FileCheck %s 2 3 define zeroext i16 @add(i16* nocapture %a, i16 zeroext %n) nounwind readonly { 4 entry: 5 %cmp8 = icmp eq i16 %n, 0 ; <i1> [#uses=1] 6 br i1 %cmp8, label %for.end, label %for.body 7 8 for.body: ; preds = %for.body, %entry 9 %i.010 = phi i16 [ 0, %entry ], [ %inc, %for.body ] ; <i16> [#uses=2] 10 %sum.09 = phi i16 [ 0, %entry ], [ %add, %for.body ] ; <i16> [#uses=1] 11 %arrayidx = getelementptr i16, i16* %a, i16 %i.010 ; <i16*> [#uses=1] 12 ; CHECK-LABEL: add: 13 ; CHECK: add r{{[0-9]+}}, r{{[0-9]+}} 14 %tmp4 = load i16, i16* %arrayidx ; <i16> [#uses=1] 15 %add = add i16 %tmp4, %sum.09 ; <i16> [#uses=2] 16 %inc = add i16 %i.010, 1 ; <i16> [#uses=2] 17 %exitcond = icmp eq i16 %inc, %n ; <i1> [#uses=1] 18 br i1 %exitcond, label %for.end, label %for.body 19 20 for.end: ; preds = %for.body, %entry 21 %sum.0.lcssa = phi i16 [ 0, %entry ], [ %add, %for.body ] ; <i16> [#uses=1] 22 ret i16 %sum.0.lcssa 23 } 24 25 define zeroext i16 @sub(i16* nocapture %a, i16 zeroext %n) nounwind readonly { 26 entry: 27 %cmp8 = icmp eq i16 %n, 0 ; <i1> [#uses=1] 28 br i1 %cmp8, label %for.end, label %for.body 29 30 for.body: ; preds = %for.body, %entry 31 %i.010 = phi i16 [ 0, %entry ], [ %inc, %for.body ] ; <i16> [#uses=2] 32 %sum.09 = phi i16 [ 0, %entry ], [ %add, %for.body ] ; <i16> [#uses=1] 33 %arrayidx = getelementptr i16, i16* %a, i16 %i.010 ; <i16*> [#uses=1] 34 ; CHECK-LABEL: sub: 35 ; CHECK: sub r{{[0-9]+}}, r{{[0-9]+}} 36 %tmp4 = load i16, i16* %arrayidx ; <i16> [#uses=1] 37 %add = sub i16 %tmp4, %sum.09 ; <i16> [#uses=2] 38 %inc = add i16 %i.010, 1 ; <i16> [#uses=2] 39 %exitcond = icmp eq i16 %inc, %n ; <i1> [#uses=1] 40 br i1 %exitcond, label %for.end, label %for.body 41 42 for.end: ; preds = %for.body, %entry 43 %sum.0.lcssa = phi i16 [ 0, %entry ], [ %add, %for.body ] ; <i16> [#uses=1] 44 ret i16 %sum.0.lcssa 45 } 46 47 define zeroext i16 @or(i16* nocapture %a, i16 zeroext %n) nounwind readonly { 48 entry: 49 %cmp8 = icmp eq i16 %n, 0 ; <i1> [#uses=1] 50 br i1 %cmp8, label %for.end, label %for.body 51 52 for.body: ; preds = %for.body, %entry 53 %i.010 = phi i16 [ 0, %entry ], [ %inc, %for.body ] ; <i16> [#uses=2] 54 %sum.09 = phi i16 [ 0, %entry ], [ %add, %for.body ] ; <i16> [#uses=1] 55 %arrayidx = getelementptr i16, i16* %a, i16 %i.010 ; <i16*> [#uses=1] 56 ; CHECK-LABEL: or: 57 ; CHECK: or r{{[0-9]+}}, r{{[0-9]+}} 58 %tmp4 = load i16, i16* %arrayidx ; <i16> [#uses=1] 59 %add = or i16 %tmp4, %sum.09 ; <i16> [#uses=2] 60 %inc = add i16 %i.010, 1 ; <i16> [#uses=2] 61 %exitcond = icmp eq i16 %inc, %n ; <i1> [#uses=1] 62 br i1 %exitcond, label %for.end, label %for.body 63 64 for.end: ; preds = %for.body, %entry 65 %sum.0.lcssa = phi i16 [ 0, %entry ], [ %add, %for.body ] ; <i16> [#uses=1] 66 ret i16 %sum.0.lcssa 67 } 68 69 define zeroext i16 @xor(i16* nocapture %a, i16 zeroext %n) nounwind readonly { 70 entry: 71 %cmp8 = icmp eq i16 %n, 0 ; <i1> [#uses=1] 72 br i1 %cmp8, label %for.end, label %for.body 73 74 for.body: ; preds = %for.body, %entry 75 %i.010 = phi i16 [ 0, %entry ], [ %inc, %for.body ] ; <i16> [#uses=2] 76 %sum.09 = phi i16 [ 0, %entry ], [ %add, %for.body ] ; <i16> [#uses=1] 77 %arrayidx = getelementptr i16, i16* %a, i16 %i.010 ; <i16*> [#uses=1] 78 ; CHECK-LABEL: xor: 79 ; CHECK: xor r{{[0-9]+}}, r{{[0-9]+}} 80 %tmp4 = load i16, i16* %arrayidx ; <i16> [#uses=1] 81 %add = xor i16 %tmp4, %sum.09 ; <i16> [#uses=2] 82 %inc = add i16 %i.010, 1 ; <i16> [#uses=2] 83 %exitcond = icmp eq i16 %inc, %n ; <i1> [#uses=1] 84 br i1 %exitcond, label %for.end, label %for.body 85 86 for.end: ; preds = %for.body, %entry 87 %sum.0.lcssa = phi i16 [ 0, %entry ], [ %add, %for.body ] ; <i16> [#uses=1] 88 ret i16 %sum.0.lcssa 89 } 90 91 define zeroext i16 @and(i16* nocapture %a, i16 zeroext %n) nounwind readonly { 92 entry: 93 %cmp8 = icmp eq i16 %n, 0 ; <i1> [#uses=1] 94 br i1 %cmp8, label %for.end, label %for.body 95 96 for.body: ; preds = %for.body, %entry 97 %i.010 = phi i16 [ 0, %entry ], [ %inc, %for.body ] ; <i16> [#uses=2] 98 %sum.09 = phi i16 [ 0, %entry ], [ %add, %for.body ] ; <i16> [#uses=1] 99 %arrayidx = getelementptr i16, i16* %a, i16 %i.010 ; <i16*> [#uses=1] 100 ; CHECK-LABEL: and: 101 ; CHECK: and r{{[0-9]+}}, r{{[0-9]+}} 102 %tmp4 = load i16, i16* %arrayidx ; <i16> [#uses=1] 103 %add = and i16 %tmp4, %sum.09 ; <i16> [#uses=2] 104 %inc = add i16 %i.010, 1 ; <i16> [#uses=2] 105 %exitcond = icmp eq i16 %inc, %n ; <i1> [#uses=1] 106 br i1 %exitcond, label %for.end, label %for.body 107 108 for.end: ; preds = %for.body, %entry 109 %sum.0.lcssa = phi i16 [ 0, %entry ], [ %add, %for.body ] ; <i16> [#uses=1] 110 ret i16 %sum.0.lcssa 111 } 112