xref: /minix3/external/bsd/llvm/dist/llvm/test/CodeGen/X86/isel-optnone.ll (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc; RUN: llc -O2 -march=x86 < %s | FileCheck %s
2*f4a2713aSLionel Sambuc
3*f4a2713aSLionel Sambucdefine i32* @fooOptnone(i32* %p, i32* %q, i32** %z) #0 {
4*f4a2713aSLionel Sambucentry:
5*f4a2713aSLionel Sambuc  %r = load i32* %p
6*f4a2713aSLionel Sambuc  %s = load i32* %q
7*f4a2713aSLionel Sambuc  %y = load i32** %z
8*f4a2713aSLionel Sambuc
9*f4a2713aSLionel Sambuc  %t0 = add i32 %r, %s
10*f4a2713aSLionel Sambuc  %t1 = add i32 %t0, 1
11*f4a2713aSLionel Sambuc  %t2 = getelementptr i32* %y, i32 1
12*f4a2713aSLionel Sambuc  %t3 = getelementptr i32* %t2, i32 %t1
13*f4a2713aSLionel Sambuc
14*f4a2713aSLionel Sambuc  ret i32* %t3
15*f4a2713aSLionel Sambuc
16*f4a2713aSLionel Sambuc; 'optnone' should use fast-isel which will not produce 'lea'.
17*f4a2713aSLionel Sambuc; CHECK-LABEL: fooOptnone:
18*f4a2713aSLionel Sambuc; CHECK-NOT:   lea
19*f4a2713aSLionel Sambuc; CHECK:       ret
20*f4a2713aSLionel Sambuc}
21*f4a2713aSLionel Sambuc
22*f4a2713aSLionel Sambucdefine i32* @fooNormal(i32* %p, i32* %q, i32** %z) #1 {
23*f4a2713aSLionel Sambucentry:
24*f4a2713aSLionel Sambuc  %r = load i32* %p
25*f4a2713aSLionel Sambuc  %s = load i32* %q
26*f4a2713aSLionel Sambuc  %y = load i32** %z
27*f4a2713aSLionel Sambuc
28*f4a2713aSLionel Sambuc  %t0 = add i32 %r, %s
29*f4a2713aSLionel Sambuc  %t1 = add i32 %t0, 1
30*f4a2713aSLionel Sambuc  %t2 = getelementptr i32* %y, i32 1
31*f4a2713aSLionel Sambuc  %t3 = getelementptr i32* %t2, i32 %t1
32*f4a2713aSLionel Sambuc
33*f4a2713aSLionel Sambuc  ret i32* %t3
34*f4a2713aSLionel Sambuc
35*f4a2713aSLionel Sambuc; Normal ISel will produce 'lea'.
36*f4a2713aSLionel Sambuc; CHECK-LABEL: fooNormal:
37*f4a2713aSLionel Sambuc; CHECK:       lea
38*f4a2713aSLionel Sambuc; CHECK:       ret
39*f4a2713aSLionel Sambuc}
40*f4a2713aSLionel Sambuc
41*f4a2713aSLionel Sambucattributes #0 = { nounwind optnone noinline }
42*f4a2713aSLionel Sambucattributes #1 = { nounwind }
43