bd312dbb4be4072fc3a0340d0d81da48d466bb81
[oota-llvm.git] / test / CodeGen / X86 / noop-insert.ll
1 ; RUN: llc < %s -mtriple=x86_64-linux -noop-insertion | FileCheck %s
2 ; RUN: llc < %s -mtriple=x86_64-linux -noop-insertion -rng-seed=1 | FileCheck %s --check-prefix=SEED1
3 ; RUN: llc < %s -mtriple=x86_64-linux -noop-insertion -rng-seed=20 | FileCheck %s --check-prefix=SEED2
4 ; RUN: llc < %s -mtriple=x86_64-linux -noop-insertion -rng-seed=500 | FileCheck %s --check-prefix=SEED3
5
6 ; RUN: llc < %s -march=x86 -noop-insertion | FileCheck %s --check-prefix=x86_32
7
8 ; This test case checks that NOOPs are inserted, and that the RNG seed
9 ; affects both the placement (position of imull) and choice of these NOOPs.
10
11 ; It just happens that with a default percentage of 25% and seed=0,
12 ; no NOOPs are inserted.
13 ; CHECK: imull
14 ; CHECK-NEXT: leal
15 ; CHECK-NEXT: retq
16 ; CHECK-NOT: nop
17
18 ; SEED1: leaq (%rsi), %rsi
19 ; SEED1-NEXT: imull
20 ; SEED1-NEXT: leal
21 ; SEED1-NEXT: retq
22
23 ; SEED2: imull
24 ; SEED2-NEXT: movq %rsp, %rsp
25 ; SEED2-NEXT: leal
26 ; SEED2-NEXT: retq
27
28 ; SEED3: imull
29 ; SEED3-NEXT: movq %rsp, %rsp
30 ; SEED3-NEXT: leal
31 ; SEED3-NEXT: leaq (%rdi), %rdi
32 ; SEED3-NEXT: retq
33
34 ; The operand of the following is used to distinguish from a movl NOOP
35 ; x86_32: movl 4(%esp),
36 ; x86_32-NEXT: imull
37 ; x86_32-NEXT: addl
38 ; x86_32-NEXT: movl %esp, %esp
39 ; x86_32-NEXT: retl
40
41 define i32 @test1(i32 %x, i32 %y, i32 %z) {
42 entry:
43     %tmp = mul i32 %x, %y
44     %tmp2 = add i32 %tmp, %z
45     ret i32 %tmp2
46 }