1; RUN: llc  -march=mipsel -mattr=mips16 -relocation-model=pic -O3 < %s | FileCheck %s -check-prefix=16
2
3define i32 @sumc(i8* nocapture %to, i8* nocapture %from, i32) nounwind {
4entry:
5  %sext = shl i32 %0, 16
6  %conv = ashr exact i32 %sext, 16
7  %cmp8 = icmp eq i32 %conv, 0
8  br i1 %cmp8, label %for.end, label %for.body.lr.ph
9
10for.body.lr.ph:                                   ; preds = %entry
11  %.pre = load i8, i8* %to, align 1
12  br label %for.body
13
14for.body:                                         ; preds = %for.body.lr.ph, %for.body
15  %1 = phi i8 [ %.pre, %for.body.lr.ph ], [ %conv4, %for.body ]
16  %i.010 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
17  %from.addr.09 = phi i8* [ %from, %for.body.lr.ph ], [ %incdec.ptr, %for.body ]
18  %incdec.ptr = getelementptr inbounds i8, i8* %from.addr.09, i32 1
19  %2 = load i8, i8* %from.addr.09, align 1
20  %conv27 = zext i8 %2 to i32
21  %conv36 = zext i8 %1 to i32
22  %add = add nsw i32 %conv36, %conv27
23  %conv4 = trunc i32 %add to i8
24  store i8 %conv4, i8* %to, align 1
25  %inc = add nsw i32 %i.010, 1
26  %cmp = icmp eq i32 %inc, %conv
27  br i1 %cmp, label %for.end, label %for.body
28; 16-LABEL: sumc:
29; 16: 	lbu	${{[0-9]+}}, 0(${{[0-9]+}})
30; 16: 	lbu	${{[0-9]+}}, 0(${{[0-9]+}})
31; 16-LABEL: sum:
32; 16: 	lhu	${{[0-9]+}}, 0(${{[0-9]+}})
33; 16: 	lhu	${{[0-9]+}}, 0(${{[0-9]+}})
34
35for.end:                                          ; preds = %for.body, %entry
36  ret i32 undef
37}
38
39define i32 @sum(i16* nocapture %to, i16* nocapture %from, i32) nounwind {
40entry:
41  %sext = shl i32 %0, 16
42  %conv = ashr exact i32 %sext, 16
43  %cmp8 = icmp eq i32 %conv, 0
44  br i1 %cmp8, label %for.end, label %for.body.lr.ph
45
46for.body.lr.ph:                                   ; preds = %entry
47  %.pre = load i16, i16* %to, align 2
48  br label %for.body
49
50for.body:                                         ; preds = %for.body.lr.ph, %for.body
51  %1 = phi i16 [ %.pre, %for.body.lr.ph ], [ %conv4, %for.body ]
52  %i.010 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
53  %from.addr.09 = phi i16* [ %from, %for.body.lr.ph ], [ %incdec.ptr, %for.body ]
54  %incdec.ptr = getelementptr inbounds i16, i16* %from.addr.09, i32 1
55  %2 = load i16, i16* %from.addr.09, align 2
56  %conv27 = zext i16 %2 to i32
57  %conv36 = zext i16 %1 to i32
58  %add = add nsw i32 %conv36, %conv27
59  %conv4 = trunc i32 %add to i16
60  store i16 %conv4, i16* %to, align 2
61  %inc = add nsw i32 %i.010, 1
62  %cmp = icmp eq i32 %inc, %conv
63  br i1 %cmp, label %for.end, label %for.body
64
65for.end:                                          ; preds = %for.body, %entry
66  ret i32 undef
67}
68
69
70