• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
4; rdar://12481395
5
6define void @foo(i32 %x, i32 %y, i32* nocapture %P) nounwind ssp {
7entry:
8; A8-LABEL: foo:
9; A8: bl ___divmodsi4
10; A8-NOT: bl ___divmodsi4
11
12; SWIFT-LABEL: foo:
13; SWIFT: sdiv
14; SWIFT: mls
15; SWIFT-NOT: bl __divmodsi4
16  %div = sdiv i32 %x, %y
17  store i32 %div, i32* %P, align 4
18  %rem = srem i32 %x, %y
19  %arrayidx6 = getelementptr inbounds i32, i32* %P, i32 1
20  store i32 %rem, i32* %arrayidx6, align 4
21  ret void
22}
23
24define void @bar(i32 %x, i32 %y, i32* nocapture %P) nounwind ssp {
25entry:
26; A8-LABEL: bar:
27; A8: bl ___udivmodsi4
28; A8-NOT: bl ___udivmodsi4
29
30; SWIFT-LABEL: bar:
31; SWIFT: udiv
32; SWIFT: mls
33; SWIFT-NOT: bl __udivmodsi4
34  %div = udiv i32 %x, %y
35  store i32 %div, i32* %P, align 4
36  %rem = urem i32 %x, %y
37  %arrayidx6 = getelementptr inbounds i32, i32* %P, i32 1
38  store i32 %rem, i32* %arrayidx6, align 4
39  ret void
40}
41
42; rdar://9280991
43@flags = external unnamed_addr global i32
44@tabsize = external unnamed_addr global i32
45
46define void @do_indent(i32 %cols) nounwind {
47entry:
48; A8-LABEL: do_indent:
49; SWIFT-LABEL: do_indent:
50  %0 = load i32, i32* @flags, align 4
51  %1 = and i32 %0, 67108864
52  %2 = icmp eq i32 %1, 0
53  br i1 %2, label %bb1, label %bb
54
55bb:
56; A8: bl ___divmodsi4
57; SWIFT: sdiv
58; SWIFT: mls
59; SWIFT-NOT: bl __divmodsi4
60  %3 = load i32, i32* @tabsize, align 4
61  %4 = srem i32 %cols, %3
62  %5 = sdiv i32 %cols, %3
63  %6 = tail call i32 @llvm.objectsize.i32.p0i8(i8* null, i1 false)
64  %7 = tail call i8* @__memset_chk(i8* null, i32 9, i32 %5, i32 %6) nounwind
65  br label %bb1
66
67bb1:
68  %line_indent_len.0 = phi i32 [ %4, %bb ], [ 0, %entry ]
69  %8 = getelementptr inbounds i8, i8* null, i32 %line_indent_len.0
70  store i8 0, i8* %8, align 1
71  ret void
72}
73
74declare i32 @llvm.objectsize.i32.p0i8(i8*, i1) nounwind readnone
75declare i8* @__memset_chk(i8*, i32, i32, i32) nounwind
76
77; rdar://11714607
78define i32 @howmany(i32 %x, i32 %y) nounwind {
79entry:
80; A8-LABEL: howmany:
81; A8: bl ___udivmodsi4
82; A8-NOT: ___udivsi3
83
84; SWIFT-LABEL: howmany:
85; SWIFT: udiv
86; SWIFT: mls
87; SWIFT-NOT: bl __udivmodsi4
88  %rem = urem i32 %x, %y
89  %div = udiv i32 %x, %y
90  %not.cmp = icmp ne i32 %rem, 0
91  %add = zext i1 %not.cmp to i32
92  %cond = add i32 %add, %div
93  ret i32 %cond
94}
95