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