llvm.org GIT mirror llvm / 2fef457
Reenable use of divmod compiler_rt functions for iOS 5.0 and later. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141368 91177308-0d34-0410-b5e6-96231b3b80d8 Bob Wilson 8 years ago
2 changed file(s) with 65 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
419419 setLibcallName(RTLIB::MEMCPY, "__aeabi_memcpy");
420420 setLibcallName(RTLIB::MEMMOVE, "__aeabi_memmove");
421421 setLibcallName(RTLIB::MEMSET, "__aeabi_memset");
422 }
423
424 // Use divmod compiler-rt calls for iOS 5.0 and later.
425 if (Subtarget->getTargetTriple().getOS() == Triple::IOS &&
426 !Subtarget->getTargetTriple().isOSVersionLT(5, 0)) {
427 setLibcallName(RTLIB::SDIVREM_I32, "__divmodsi4");
428 setLibcallName(RTLIB::UDIVREM_I32, "__udivmodsi4");
422429 }
423430
424431 if (Subtarget->isThumb1Only())
0 ; RUN: llc < %s -mtriple=arm-apple-ios5.0 | FileCheck %s
1
2 define void @foo(i32 %x, i32 %y, i32* nocapture %P) nounwind ssp {
3 entry:
4 ; CHECK: foo:
5 ; CHECK: bl ___divmodsi4
6 ; CHECK-NOT: bl ___divmodsi4
7 %div = sdiv i32 %x, %y
8 store i32 %div, i32* %P, align 4
9 %rem = srem i32 %x, %y
10 %arrayidx6 = getelementptr inbounds i32* %P, i32 1
11 store i32 %rem, i32* %arrayidx6, align 4
12 ret void
13 }
14
15 define void @bar(i32 %x, i32 %y, i32* nocapture %P) nounwind ssp {
16 entry:
17 ; CHECK: bar:
18 ; CHECK: bl ___udivmodsi4
19 ; CHECK-NOT: bl ___udivmodsi4
20 %div = udiv i32 %x, %y
21 store i32 %div, i32* %P, align 4
22 %rem = urem i32 %x, %y
23 %arrayidx6 = getelementptr inbounds i32* %P, i32 1
24 store i32 %rem, i32* %arrayidx6, align 4
25 ret void
26 }
27
28 ; rdar://9280991
29 @flags = external unnamed_addr global i32
30 @tabsize = external unnamed_addr global i32
31
32 define void @do_indent(i32 %cols) nounwind {
33 entry:
34 ; CHECK: do_indent:
35 %0 = load i32* @flags, align 4
36 %1 = and i32 %0, 67108864
37 %2 = icmp eq i32 %1, 0
38 br i1 %2, label %bb1, label %bb
39
40 bb:
41 ; CHECK: bl ___divmodsi4
42 %3 = load i32* @tabsize, align 4
43 %4 = srem i32 %cols, %3
44 %5 = sdiv i32 %cols, %3
45 %6 = tail call i32 @llvm.objectsize.i32(i8* null, i1 false)
46 %7 = tail call i8* @__memset_chk(i8* null, i32 9, i32 %5, i32 %6) nounwind
47 br label %bb1
48
49 bb1:
50 %line_indent_len.0 = phi i32 [ %4, %bb ], [ 0, %entry ]
51 %8 = getelementptr inbounds i8* null, i32 %line_indent_len.0
52 store i8 0, i8* %8, align 1
53 ret void
54 }
55
56 declare i32 @llvm.objectsize.i32(i8*, i1) nounwind readnone
57 declare i8* @__memset_chk(i8*, i32, i32, i32) nounwind