| Daniel Sanders | 8008de5 | 2015-10-15 14:34:23 +0000 | [diff] [blame] | 1 | ; RUN: llc  -march=mipsel -mattr=mips16 -relocation-model=pic -O3 < %s | FileCheck %s -check-prefix=16 | 
| Reed Kotler | 740981e | 2012-10-29 19:39:04 +0000 | [diff] [blame] | 2 |  | 
|  | 3 | define i32 @sumc(i8* nocapture %to, i8* nocapture %from, i32) nounwind { | 
|  | 4 | entry: | 
|  | 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 |  | 
|  | 10 | for.body.lr.ph:                                   ; preds = %entry | 
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 11 | %.pre = load i8, i8* %to, align 1 | 
| Reed Kotler | 740981e | 2012-10-29 19:39:04 +0000 | [diff] [blame] | 12 | br label %for.body | 
|  | 13 |  | 
|  | 14 | for.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 ] | 
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 18 | %incdec.ptr = getelementptr inbounds i8, i8* %from.addr.09, i32 1 | 
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 19 | %2 = load i8, i8* %from.addr.09, align 1 | 
| Reed Kotler | 740981e | 2012-10-29 19:39:04 +0000 | [diff] [blame] | 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 | 
| Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 28 | ; 16-LABEL: sumc: | 
| Reed Kotler | 740981e | 2012-10-29 19:39:04 +0000 | [diff] [blame] | 29 | ; 16: 	lbu	${{[0-9]+}}, 0(${{[0-9]+}}) | 
|  | 30 | ; 16: 	lbu	${{[0-9]+}}, 0(${{[0-9]+}}) | 
| Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 31 | ; 16-LABEL: sum: | 
| Reed Kotler | 740981e | 2012-10-29 19:39:04 +0000 | [diff] [blame] | 32 | ; 16: 	lhu	${{[0-9]+}}, 0(${{[0-9]+}}) | 
|  | 33 | ; 16: 	lhu	${{[0-9]+}}, 0(${{[0-9]+}}) | 
|  | 34 |  | 
|  | 35 | for.end:                                          ; preds = %for.body, %entry | 
|  | 36 | ret i32 undef | 
|  | 37 | } | 
|  | 38 |  | 
|  | 39 | define i32 @sum(i16* nocapture %to, i16* nocapture %from, i32) nounwind { | 
|  | 40 | entry: | 
|  | 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 |  | 
|  | 46 | for.body.lr.ph:                                   ; preds = %entry | 
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 47 | %.pre = load i16, i16* %to, align 2 | 
| Reed Kotler | 740981e | 2012-10-29 19:39:04 +0000 | [diff] [blame] | 48 | br label %for.body | 
|  | 49 |  | 
|  | 50 | for.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 ] | 
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 54 | %incdec.ptr = getelementptr inbounds i16, i16* %from.addr.09, i32 1 | 
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 55 | %2 = load i16, i16* %from.addr.09, align 2 | 
| Reed Kotler | 740981e | 2012-10-29 19:39:04 +0000 | [diff] [blame] | 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 |  | 
|  | 65 | for.end:                                          ; preds = %for.body, %entry | 
|  | 66 | ret i32 undef | 
|  | 67 | } | 
|  | 68 |  | 
|  | 69 |  |