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