2 ; RUN: llc -mtriple=riscv32 -verify-misched -debug-only=machine-scheduler -o - 2>&1 < %s \
3 ; RUN: | FileCheck -check-prefix=NOCLUSTER %s
4 ; RUN: llc -mtriple=riscv64 -verify-misched -debug-only=machine-scheduler -o - 2>&1 < %s \
5 ; RUN: | FileCheck -check-prefix=NOCLUSTER %s
6 ; RUN: llc -mtriple=riscv32 -riscv-misched-load-clustering -verify-misched \
7 ; RUN: -debug-only=machine-scheduler -o - 2>&1 < %s \
8 ; RUN: | FileCheck -check-prefix=LDCLUSTER %s
9 ; RUN: llc -mtriple=riscv64 -riscv-misched-load-clustering -verify-misched \
10 ; RUN: -debug-only=machine-scheduler -o - 2>&1 < %s \
11 ; RUN: | FileCheck -check-prefix=LDCLUSTER %s
14 define i32 @load_clustering_1(ptr nocapture %p) {
15 ; NOCLUSTER: ********** MI Scheduling **********
16 ; NOCLUSTER-LABEL: load_clustering_1:%bb.0
17 ; NOCLUSTER: *** Final schedule for %bb.0 ***
18 ; NOCLUSTER: SU(1): %1:gpr = LW %0:gpr, 12
19 ; NOCLUSTER: SU(2): %2:gpr = LW %0:gpr, 8
20 ; NOCLUSTER: SU(4): %4:gpr = LW %0:gpr, 4
21 ; NOCLUSTER: SU(5): %6:gpr = LW %0:gpr, 16
23 ; LDCLUSTER: ********** MI Scheduling **********
24 ; LDCLUSTER-LABEL: load_clustering_1:%bb.0
25 ; LDCLUSTER: *** Final schedule for %bb.0 ***
26 ; LDCLUSTER: SU(4): %4:gpr = LW %0:gpr, 4
27 ; LDCLUSTER: SU(2): %2:gpr = LW %0:gpr, 8
28 ; LDCLUSTER: SU(1): %1:gpr = LW %0:gpr, 12
29 ; LDCLUSTER: SU(5): %6:gpr = LW %0:gpr, 16
31 %arrayidx0 = getelementptr inbounds i32, ptr %p, i32 3
32 %val0 = load i32, ptr %arrayidx0
33 %arrayidx1 = getelementptr inbounds i32, ptr %p, i32 2
34 %val1 = load i32, ptr %arrayidx1
35 %tmp0 = add i32 %val0, %val1
36 %arrayidx2 = getelementptr inbounds i32, ptr %p, i32 1
37 %val2 = load i32, ptr %arrayidx2
38 %tmp1 = add i32 %tmp0, %val2
39 %arrayidx3 = getelementptr inbounds i32, ptr %p, i32 4
40 %val3 = load i32, ptr %arrayidx3
41 %tmp2 = add i32 %tmp1, %val3