1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ;RUN: llc < %s -mtriple=i686-- -mattr=-slow-incdec | FileCheck %s -check-prefixes=CHECK,SLOW
3 ;RUN: llc < %s -mtriple=i686-- -mattr=+slow-incdec | FileCheck %s -check-prefixes=CHECK,FAST
5 define void @foo(i32 inreg %dns) minsize {
7 ; CHECK: # %bb.0: # %entry
8 ; CHECK-NEXT: xorl %ecx, %ecx
9 ; CHECK-NEXT: decl %ecx
10 ; CHECK-NEXT: .LBB0_1: # %for.body
11 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
12 ; CHECK-NEXT: movzwl %cx, %edx
13 ; CHECK-NEXT: decl %ecx
14 ; CHECK-NEXT: cmpl %eax, %edx
15 ; CHECK-NEXT: jl .LBB0_1
16 ; CHECK-NEXT: # %bb.2: # %for.end
22 %i.05 = phi i16 [ %dec, %for.body ], [ 0, %entry ]
23 %dec = add i16 %i.05, -1
24 %conv = zext i16 %dec to i32
25 %cmp = icmp slt i32 %conv, %dns
26 br i1 %cmp, label %for.body, label %for.end
32 define void @bar(i32 inreg %dns) minsize {
34 ; CHECK: # %bb.0: # %entry
35 ; CHECK-NEXT: xorl %ecx, %ecx
36 ; CHECK-NEXT: incl %ecx
37 ; CHECK-NEXT: .LBB1_1: # %for.body
38 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
39 ; CHECK-NEXT: movzwl %cx, %edx
40 ; CHECK-NEXT: incl %ecx
41 ; CHECK-NEXT: cmpl %eax, %edx
42 ; CHECK-NEXT: jl .LBB1_1
43 ; CHECK-NEXT: # %bb.2: # %for.end
49 %i.05 = phi i16 [ %inc, %for.body ], [ 0, %entry ]
50 %inc = add i16 %i.05, 1
51 %conv = zext i16 %inc to i32
52 %cmp = icmp slt i32 %conv, %dns
53 br i1 %cmp, label %for.body, label %for.end
58 define void @foo_optsize(i32 inreg %dns) optsize {
59 ; CHECK-LABEL: foo_optsize:
60 ; CHECK: # %bb.0: # %entry
61 ; CHECK-NEXT: xorl %ecx, %ecx
62 ; CHECK-NEXT: decl %ecx
63 ; CHECK-NEXT: .LBB2_1: # %for.body
64 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
65 ; CHECK-NEXT: movzwl %cx, %edx
66 ; CHECK-NEXT: decl %ecx
67 ; CHECK-NEXT: cmpl %eax, %edx
68 ; CHECK-NEXT: jl .LBB2_1
69 ; CHECK-NEXT: # %bb.2: # %for.end
75 %i.05 = phi i16 [ %dec, %for.body ], [ 0, %entry ]
76 %dec = add i16 %i.05, -1
77 %conv = zext i16 %dec to i32
78 %cmp = icmp slt i32 %conv, %dns
79 br i1 %cmp, label %for.body, label %for.end
85 define void @bar_optsize(i32 inreg %dns) optsize {
86 ; CHECK-LABEL: bar_optsize:
87 ; CHECK: # %bb.0: # %entry
88 ; CHECK-NEXT: xorl %ecx, %ecx
89 ; CHECK-NEXT: incl %ecx
90 ; CHECK-NEXT: .LBB3_1: # %for.body
91 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
92 ; CHECK-NEXT: movzwl %cx, %edx
93 ; CHECK-NEXT: incl %ecx
94 ; CHECK-NEXT: cmpl %eax, %edx
95 ; CHECK-NEXT: jl .LBB3_1
96 ; CHECK-NEXT: # %bb.2: # %for.end
102 %i.05 = phi i16 [ %inc, %for.body ], [ 0, %entry ]
103 %inc = add i16 %i.05, 1
104 %conv = zext i16 %inc to i32
105 %cmp = icmp slt i32 %conv, %dns
106 br i1 %cmp, label %for.body, label %for.end
111 define void @foo_nosize(i32 inreg %dns) {
112 ; SLOW-LABEL: foo_nosize:
113 ; SLOW: # %bb.0: # %entry
114 ; SLOW-NEXT: movw $-1, %cx
115 ; SLOW-NEXT: .p2align 4, 0x90
116 ; SLOW-NEXT: .LBB4_1: # %for.body
117 ; SLOW-NEXT: # =>This Inner Loop Header: Depth=1
118 ; SLOW-NEXT: movzwl %cx, %edx
119 ; SLOW-NEXT: decl %ecx
120 ; SLOW-NEXT: cmpl %eax, %edx
121 ; SLOW-NEXT: jl .LBB4_1
122 ; SLOW-NEXT: # %bb.2: # %for.end
125 ; FAST-LABEL: foo_nosize:
126 ; FAST: # %bb.0: # %entry
127 ; FAST-NEXT: movw $-1, %cx
128 ; FAST-NEXT: .p2align 4, 0x90
129 ; FAST-NEXT: .LBB4_1: # %for.body
130 ; FAST-NEXT: # =>This Inner Loop Header: Depth=1
131 ; FAST-NEXT: movzwl %cx, %edx
132 ; FAST-NEXT: addl $-1, %ecx
133 ; FAST-NEXT: cmpl %eax, %edx
134 ; FAST-NEXT: jl .LBB4_1
135 ; FAST-NEXT: # %bb.2: # %for.end
141 %i.05 = phi i16 [ %dec, %for.body ], [ 0, %entry ]
142 %dec = add i16 %i.05, -1
143 %conv = zext i16 %dec to i32
144 %cmp = icmp slt i32 %conv, %dns
145 br i1 %cmp, label %for.body, label %for.end
151 define void @bar_nosize(i32 inreg %dns) {
152 ; SLOW-LABEL: bar_nosize:
153 ; SLOW: # %bb.0: # %entry
154 ; SLOW-NEXT: movw $1, %cx
155 ; SLOW-NEXT: .p2align 4, 0x90
156 ; SLOW-NEXT: .LBB5_1: # %for.body
157 ; SLOW-NEXT: # =>This Inner Loop Header: Depth=1
158 ; SLOW-NEXT: movzwl %cx, %edx
159 ; SLOW-NEXT: incl %ecx
160 ; SLOW-NEXT: cmpl %eax, %edx
161 ; SLOW-NEXT: jl .LBB5_1
162 ; SLOW-NEXT: # %bb.2: # %for.end
165 ; FAST-LABEL: bar_nosize:
166 ; FAST: # %bb.0: # %entry
167 ; FAST-NEXT: movw $1, %cx
168 ; FAST-NEXT: .p2align 4, 0x90
169 ; FAST-NEXT: .LBB5_1: # %for.body
170 ; FAST-NEXT: # =>This Inner Loop Header: Depth=1
171 ; FAST-NEXT: movzwl %cx, %edx
172 ; FAST-NEXT: addl $1, %ecx
173 ; FAST-NEXT: cmpl %eax, %edx
174 ; FAST-NEXT: jl .LBB5_1
175 ; FAST-NEXT: # %bb.2: # %for.end
181 %i.05 = phi i16 [ %inc, %for.body ], [ 0, %entry ]
182 %inc = add i16 %i.05, 1
183 %conv = zext i16 %inc to i32
184 %cmp = icmp slt i32 %conv, %dns
185 br i1 %cmp, label %for.body, label %for.end