xref: /llvm-project/llvm/test/CodeGen/X86/loop-strength-reduce8.ll (revision 2f448bf509432c1a19ec46ab8cbc7353c03c6280)
1; RUN: llc < %s -mtriple=i386-apple-darwin | FileCheck %s
2
3; FIXME: The first two instructions, movl and addl, should have been combined to
4; "leal 16(%eax), %edx" by the backend (PR20776).
5; CHECK: movl    %eax, %edx
6; CHECK: addl    $16, %edx
7; CHECK: align
8; CHECK: addl    $4, %edx
9; CHECK: decl    %ecx
10; CHECK: jne     LBB0_2
11
12	%struct.CUMULATIVE_ARGS = type { i32, i32, i32, i32, i32, i32, i32 }
13	%struct.bitmap_element = type { ptr, ptr, i32, [2 x i64] }
14	%struct.bitmap_head_def = type { ptr, ptr, i32 }
15	%struct.branch_path = type { ptr, i32 }
16	%struct.c_lang_decl = type <{ i8, [3 x i8] }>
17	%struct.constant_descriptor = type { ptr, ptr, ptr, { x86_fp80 } }
18	%struct.eh_region = type { ptr, ptr, ptr, i32, ptr, i32, { { ptr, ptr, ptr, ptr } }, ptr, ptr, ptr, ptr }
19	%struct.eh_status = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, ptr, ptr, ptr, i32, i32, ptr, ptr, ptr, ptr, ptr }
20	%struct.emit_status = type { i32, i32, ptr, ptr, ptr, ptr, i32, i32, ptr, i32, ptr, ptr, ptr }
21	%struct.equiv_table = type { ptr, ptr }
22	%struct.expr_status = type { i32, i32, i32, ptr, ptr, ptr, ptr }
23	%struct.function = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, ptr, %struct.CUMULATIVE_ARGS, ptr, ptr, ptr, ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64, ptr, ptr, ptr, ptr, i32, ptr, ptr, i32, i32, i32, ptr, i32, i32, ptr, ptr, ptr, i32, i32, ptr, i32, i32, ptr, ptr, i8, i8, i8 }
24	%struct.goto_fixup = type { ptr, ptr, ptr, ptr, ptr, i32, ptr, ptr }
25	%struct.initial_value_struct = type { i32, i32, ptr }
26	%struct.label_chain = type { ptr, ptr }
27	%struct.lang_decl = type { %struct.c_lang_decl, ptr }
28	%struct.language_function = type { %struct.stmt_tree_s, ptr }
29	%struct.machine_function = type { [59 x [3 x ptr]], i32, i32 }
30	%struct.nesting = type { ptr, ptr, i32, ptr, { { i32, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, ptr, ptr } } }
31	%struct.pool_constant = type { ptr, ptr, ptr, ptr, i32, i32, i32, i64, i32 }
32	%struct.rtunion = type { i64 }
33	%struct.rtx_def = type { i16, i8, i8, [1 x %struct.rtunion] }
34	%struct.sequence_stack = type { ptr, ptr, ptr, ptr }
35	%struct.stmt_status = type { ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, ptr, i32, ptr, i32, ptr }
36	%struct.stmt_tree_s = type { ptr, ptr, ptr, i32 }
37	%struct.temp_slot = type { ptr, ptr, ptr, i32, i64, ptr, ptr, i8, i8, i32, i32, i64, i64 }
38	%struct.tree_common = type { ptr, ptr, i8, i8, i8, i8 }
39	%struct.tree_decl = type { %struct.tree_common, ptr, i32, i32, ptr, i8, i8, i8, i8, i8, i8, %struct.rtunion, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, { ptr }, ptr, ptr, ptr, i64, ptr }
40	%struct.tree_exp = type { %struct.tree_common, i32, [1 x ptr] }
41	%struct.tree_node = type { %struct.tree_decl }
42	%struct.var_refs_queue = type { ptr, i32, i32, ptr }
43	%struct.varasm_status = type { ptr, ptr, ptr, ptr, i64, ptr }
44	%struct.varray_data = type { [1 x i64] }
45	%struct.varray_head_tag = type { i32, i32, i32, ptr, %struct.varray_data }
46@lineno = internal global i32 0		; <ptr> [#uses=1]
47@tree_code_length = internal global [256 x i32] zeroinitializer
48@llvm.used = appending global [1 x ptr] [ ptr @build_stmt ], section "llvm.metadata"		; <ptr> [#uses=0]
49
50define ptr @build_stmt(i32 %code, ...) nounwind {
51entry:
52	%p = alloca ptr		; <ptr> [#uses=3]
53	call void @llvm.va_start(ptr %p)
54	%0 = call fastcc ptr @make_node(i32 %code) nounwind		; <ptr> [#uses=2]
55	%1 = getelementptr [256 x i32], ptr @tree_code_length, i32 0, i32 %code		; <ptr> [#uses=1]
56	%2 = load i32, ptr %1, align 4		; <i32> [#uses=2]
57	%3 = load i32, ptr @lineno, align 4		; <i32> [#uses=1]
58	%4 = getelementptr %struct.tree_exp, ptr %0, i32 0, i32 1		; <ptr> [#uses=1]
59	store i32 %3, ptr %4, align 4
60	%5 = icmp sgt i32 %2, 0		; <i1> [#uses=1]
61	br i1 %5, label %bb, label %bb3
62
63bb:		; preds = %bb, %entry
64	%i.01 = phi i32 [ %indvar.next, %bb ], [ 0, %entry ]		; <i32> [#uses=2]
65	%6 = load ptr, ptr %p, align 4		; <ptr> [#uses=2]
66	%7 = getelementptr i8, ptr %6, i32 4		; <ptr> [#uses=1]
67	store ptr %7, ptr %p, align 4
68	%8 = load ptr, ptr %6, align 4		; <ptr> [#uses=1]
69	%9 = getelementptr %struct.tree_exp, ptr %0, i32 0, i32 2, i32 %i.01		; <ptr> [#uses=1]
70	store ptr %8, ptr %9, align 4
71	%indvar.next = add i32 %i.01, 1		; <i32> [#uses=2]
72	%exitcond = icmp eq i32 %indvar.next, %2		; <i1> [#uses=1]
73	br i1 %exitcond, label %bb3, label %bb
74
75bb3:		; preds = %bb, %entry
76	call void @llvm.va_end(ptr %p)
77	ret ptr %0
78}
79
80declare void @llvm.va_start(ptr) nounwind
81
82declare void @llvm.va_end(ptr) nounwind
83
84declare fastcc ptr @make_node(i32) nounwind
85