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