1; RUN: llc < %s -mtriple=arm-apple-ios5.0 -mcpu=cortex-a8 | FileCheck %s 2 3define void @foo(i32 %x, i32 %y, i32* nocapture %P) nounwind ssp { 4entry: 5; CHECK: foo: 6; CHECK: bl ___divmodsi4 7; CHECK-NOT: bl ___divmodsi4 8 %div = sdiv i32 %x, %y 9 store i32 %div, i32* %P, align 4 10 %rem = srem i32 %x, %y 11 %arrayidx6 = getelementptr inbounds i32* %P, i32 1 12 store i32 %rem, i32* %arrayidx6, align 4 13 ret void 14} 15 16define void @bar(i32 %x, i32 %y, i32* nocapture %P) nounwind ssp { 17entry: 18; CHECK: bar: 19; CHECK: bl ___udivmodsi4 20; CHECK-NOT: bl ___udivmodsi4 21 %div = udiv i32 %x, %y 22 store i32 %div, i32* %P, align 4 23 %rem = urem i32 %x, %y 24 %arrayidx6 = getelementptr inbounds i32* %P, i32 1 25 store i32 %rem, i32* %arrayidx6, align 4 26 ret void 27} 28 29; rdar://9280991 30@flags = external unnamed_addr global i32 31@tabsize = external unnamed_addr global i32 32 33define void @do_indent(i32 %cols) nounwind { 34entry: 35; CHECK: do_indent: 36 %0 = load i32* @flags, align 4 37 %1 = and i32 %0, 67108864 38 %2 = icmp eq i32 %1, 0 39 br i1 %2, label %bb1, label %bb 40 41bb: 42; CHECK: bl ___divmodsi4 43 %3 = load i32* @tabsize, align 4 44 %4 = srem i32 %cols, %3 45 %5 = sdiv i32 %cols, %3 46 %6 = tail call i32 @llvm.objectsize.i32(i8* null, i1 false) 47 %7 = tail call i8* @__memset_chk(i8* null, i32 9, i32 %5, i32 %6) nounwind 48 br label %bb1 49 50bb1: 51 %line_indent_len.0 = phi i32 [ %4, %bb ], [ 0, %entry ] 52 %8 = getelementptr inbounds i8* null, i32 %line_indent_len.0 53 store i8 0, i8* %8, align 1 54 ret void 55} 56 57declare i32 @llvm.objectsize.i32(i8*, i1) nounwind readnone 58declare i8* @__memset_chk(i8*, i32, i32, i32) nounwind 59 60; rdar://11714607 61define i32 @howmany(i32 %x, i32 %y) nounwind { 62entry: 63; CHECK: howmany: 64; CHECK: bl ___udivmodsi4 65; CHECK-NOT: ___udivsi3 66 %rem = urem i32 %x, %y 67 %div = udiv i32 %x, %y 68 %not.cmp = icmp ne i32 %rem, 0 69 %add = zext i1 %not.cmp to i32 70 %cond = add i32 %add, %div 71 ret i32 %cond 72} 73