5190f7a965ab845383018838fa9820ba45806102
[oota-llvm.git] / test / CodeGen / X86 / noop-insert-percentage.ll
1 ; RUN: llc < %s -mtriple=x86_64-linux -rng-seed=5 -noop-insertion -noop-insertion-percentage=10 \
2 ; RUN:     | FileCheck %s --check-prefix=PERCENT10
3 ; RUN: llc < %s -mtriple=x86_64-linux -rng-seed=5 -noop-insertion -noop-insertion-percentage=50 \
4 ; RUN:     | FileCheck %s --check-prefix=PERCENT50
5 ; RUN: llc < %s -mtriple=x86_64-linux -rng-seed=5 -noop-insertion -noop-insertion-percentage=100 \
6 ; RUN:     | FileCheck %s --check-prefix=PERCENT100
7
8 ; RUN: llc < %s -march=x86 -rng-seed=5 -noop-insertion -noop-insertion-percentage=100 \
9 ; RUN:     | FileCheck %s --check-prefix=X86-PERCENT100
10
11 ; This test case tests NOOP insertion at varying percentage levels.
12
13 define i32 @test(i32 %x, i32 %y, i32 %z) {
14 entry:
15     %t1 = add i32 %x, %y
16     %t2 = mul i32 %t1, %z
17     %t3 = add i32 %t2, %x
18     %t4 = mul i32 %t3, %z
19     %t5 = add i32 %t4, %x
20     %t6 = mul i32 %t5, %z
21     %t7 = add i32 %t6, %x
22     %t8 = mul i32 %t7, %z
23     %t9 = add i32 %t8, %x
24     %t10 = mul i32 %t9, %z
25     %t11 = add i32 %t10, %x
26     ret i32 %t11
27 }
28
29 ; PERCENT10: movq   %rbp, %rbp
30 ; PERCENT10: retq
31
32 ; PERCENT50: leaq   (%rdi), %rdi
33 ; PERCENT50: nop
34 ; PERCENT50: movq   %rbp, %rbp
35 ; PERCENT50: movq   %rsp, %rsp
36 ; PERCENT50: leaq   (%rsi), %rsi
37 ; PERCENT50: nop
38 ; PERCENT50: retq
39
40 ; PERCENT100: leaq  (%rdi), %rdi
41 ; PERCENT100: leaq  (%rdi), %rdi
42 ; PERCENT100: nop
43 ; PERCENT100: movq  %rbp, %rbp
44 ; PERCENT100: movq  %rsp, %rsp
45 ; PERCENT100: nop
46 ; PERCENT100: nop
47 ; PERCENT100: leaq  (%rsi), %rsi
48 ; PERCENT100: nop
49 ; PERCENT100: leaq  (%rdi), %rdi
50 ; PERCENT100: leaq  (%rdi), %rdi
51 ; PERCENT100: leaq  (%rsi), %rsi
52 ; PERCENT100: retq
53
54
55 ; X86-PERCENT100: leal  (%edi), %edi
56 ; X86-PERCENT100: leal  (%edi), %edi
57 ; X86-PERCENT100: nop
58 ; X86-PERCENT100: movl  %ebp, %ebp
59 ; X86-PERCENT100: movl  %esp, %esp
60 ; X86-PERCENT100: nop
61 ; X86-PERCENT100: nop
62 ; X86-PERCENT100: leal  (%esi), %esi
63 ; X86-PERCENT100: nop
64 ; X86-PERCENT100: leal  (%edi), %edi
65 ; X86-PERCENT100: leal  (%edi), %edi
66 ; X86-PERCENT100: leal  (%esi), %esi