1 ; RUN: llc < %s -mtriple=arm-apple-ios5.0 -mcpu=cortex-a8 | FileCheck %s -check-prefix=A8
2 ; RUN: llc < %s -mtriple=arm-apple-ios5.0 -mcpu=swift | FileCheck %s -check-prefix=SWIFT
3 ; RUN: llc < %s -mtriple=thumbv7-apple-macho -mcpu=cortex-a8 | FileCheck %s -check-prefix=A8
7 define void @foo(i32 %x, i32 %y, ptr nocapture %P) nounwind ssp {
11 ; A8-NOT: bl ___divmodsi4
16 ; SWIFT-NOT: bl __divmodsi4
17 %div = sdiv i32 %x, %y
18 store i32 %div, ptr %P, align 4
19 %rem = srem i32 %x, %y
20 %arrayidx6 = getelementptr inbounds i32, ptr %P, i32 1
21 store i32 %rem, ptr %arrayidx6, align 4
25 define void @bar(i32 %x, i32 %y, ptr nocapture %P) nounwind ssp {
28 ; A8: bl ___udivmodsi4
29 ; A8-NOT: bl ___udivmodsi4
34 ; SWIFT-NOT: bl __udivmodsi4
35 %div = udiv i32 %x, %y
36 store i32 %div, ptr %P, align 4
37 %rem = urem i32 %x, %y
38 %arrayidx6 = getelementptr inbounds i32, ptr %P, i32 1
39 store i32 %rem, ptr %arrayidx6, align 4
44 @flags = external unnamed_addr global i32
45 @tabsize = external unnamed_addr global i32
47 define void @do_indent(i32 %cols) nounwind {
49 ; A8-LABEL: do_indent:
50 ; SWIFT-LABEL: do_indent:
51 %0 = load i32, ptr @flags, align 4
52 %1 = and i32 %0, 67108864
53 %2 = icmp eq i32 %1, 0
54 br i1 %2, label %bb1, label %bb
60 ; SWIFT-NOT: bl __divmodsi4
61 %3 = load i32, ptr @tabsize, align 4
62 %4 = srem i32 %cols, %3
63 %5 = sdiv i32 %cols, %3
64 %6 = tail call i32 @llvm.objectsize.i32.p0(ptr null, i1 false)
65 %7 = tail call ptr @__memset_chk(ptr null, i32 9, i32 %5, i32 %6) nounwind
69 %line_indent_len.0 = phi i32 [ %4, %bb ], [ 0, %entry ]
70 %8 = getelementptr inbounds i8, ptr null, i32 %line_indent_len.0
71 store i8 0, ptr %8, align 1
75 declare i32 @llvm.objectsize.i32.p0(ptr, i1) nounwind readnone
76 declare ptr @__memset_chk(ptr, i32, i32, i32) nounwind
79 define i32 @howmany(i32 %x, i32 %y) nounwind {
82 ; A8: bl ___udivmodsi4
85 ; SWIFT-LABEL: howmany:
88 ; SWIFT-NOT: bl __udivmodsi4
89 %rem = urem i32 %x, %y
90 %div = udiv i32 %x, %y
91 %not.cmp = icmp ne i32 %rem, 0
92 %add = zext i1 %not.cmp to i32
93 %cond = add i32 %add, %div