• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s | FileCheck %s
2target datalayout = "e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"
3target triple = "msp430"
4
5define zeroext i16 @add(i16* nocapture %a, i16 zeroext %n) nounwind readonly {
6entry:
7  %cmp8 = icmp eq i16 %n, 0                       ; <i1> [#uses=1]
8  br i1 %cmp8, label %for.end, label %for.body
9
10for.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 @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
22for.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
27define zeroext i16 @sub(i16* nocapture %a, i16 zeroext %n) nounwind readonly {
28entry:
29  %cmp8 = icmp eq i16 %n, 0                       ; <i1> [#uses=1]
30  br i1 %cmp8, label %for.end, label %for.body
31
32for.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 @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
44for.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
49define zeroext i16 @or(i16* nocapture %a, i16 zeroext %n) nounwind readonly {
50entry:
51  %cmp8 = icmp eq i16 %n, 0                       ; <i1> [#uses=1]
52  br i1 %cmp8, label %for.end, label %for.body
53
54for.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 @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
66for.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
71define zeroext i16 @xor(i16* nocapture %a, i16 zeroext %n) nounwind readonly {
72entry:
73  %cmp8 = icmp eq i16 %n, 0                       ; <i1> [#uses=1]
74  br i1 %cmp8, label %for.end, label %for.body
75
76for.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 @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
88for.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
93define zeroext i16 @and(i16* nocapture %a, i16 zeroext %n) nounwind readonly {
94entry:
95  %cmp8 = icmp eq i16 %n, 0                       ; <i1> [#uses=1]
96  br i1 %cmp8, label %for.end, label %for.body
97
98for.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 @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
110for.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