xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/post-ra-sched.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=i386 -mcpu=pentium4 | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=i386 -mcpu=pentium4m | FileCheck %s
3*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=i386 -mcpu=pentium-m | FileCheck %s
4*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=i386 -mcpu=prescott | FileCheck %s
5*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=i386 -mcpu=nocona | FileCheck %s
6*9880d681SAndroid Build Coastguard Worker;
7*9880d681SAndroid Build Coastguard Worker; Verify that scheduling puts some distance between a load feeding into
8*9880d681SAndroid Build Coastguard Worker; the address of another load, and that second load.  This currently
9*9880d681SAndroid Build Coastguard Worker; happens during the post-RA-scheduler, which should be enabled by
10*9880d681SAndroid Build Coastguard Worker; default with the above specified cpus.
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Worker@ptrs = external global [0 x i32*], align 4
13*9880d681SAndroid Build Coastguard Worker@idxa = common global i32 0, align 4
14*9880d681SAndroid Build Coastguard Worker@idxb = common global i32 0, align 4
15*9880d681SAndroid Build Coastguard Worker@res = common global i32 0, align 4
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Workerdefine void @addindirect() {
18*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: addindirect:
19*9880d681SAndroid Build Coastguard Worker; CHECK:       # BB#0: # %entry
20*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:    movl idxb, %ecx
21*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:    movl idxa, %eax
22*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:    movl ptrs(,%ecx,4), %ecx
23*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:    movl ptrs(,%eax,4), %eax
24*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:    movl (%ecx), %ecx
25*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:    addl (%eax), %ecx
26*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:    movl %ecx, res
27*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT:    retl
28*9880d681SAndroid Build Coastguard Workerentry:
29*9880d681SAndroid Build Coastguard Worker  %0 = load i32, i32* @idxa, align 4
30*9880d681SAndroid Build Coastguard Worker  %arrayidx = getelementptr inbounds [0 x i32*], [0 x i32*]* @ptrs, i32 0, i32 %0
31*9880d681SAndroid Build Coastguard Worker  %1 = load i32*, i32** %arrayidx, align 4
32*9880d681SAndroid Build Coastguard Worker  %2 = load i32, i32* %1, align 4
33*9880d681SAndroid Build Coastguard Worker  %3 = load i32, i32* @idxb, align 4
34*9880d681SAndroid Build Coastguard Worker  %arrayidx1 = getelementptr inbounds [0 x i32*], [0 x i32*]* @ptrs, i32 0, i32 %3
35*9880d681SAndroid Build Coastguard Worker  %4 = load i32*, i32** %arrayidx1, align 4
36*9880d681SAndroid Build Coastguard Worker  %5 = load i32, i32* %4, align 4
37*9880d681SAndroid Build Coastguard Worker  %add = add i32 %5, %2
38*9880d681SAndroid Build Coastguard Worker  store i32 %add, i32* @res, align 4
39*9880d681SAndroid Build Coastguard Worker  ret void
40*9880d681SAndroid Build Coastguard Worker}
41