We would like to start pushing -mcpu=generic towards enabling the set of
features that improves performance for some CPUs, without hurting any
others. A blend of the performance options hopefully beneficial to all
CPUs. The largest part of that is enabling in-order scheduling using the
Cortex-A55 schedule model. This is similar to the Arm backend change
from eecb353d0e which made -mcpu=generic perform in-order scheduling
using the cortex-a8 schedule model.
The idea is that in-order cpu's require the most help in instruction
scheduling, whereas out-of-order cpus can for the most part out-of-order
schedule around different codegen. Our benchmarking suggests that
hypothesis holds. When running on an in-order core this improved
performance by 3.8% geomean on a set of DSP workloads, 2% geomean on
some other embedded benchmark and between 1% and 1.8% on a set of
singlecore and multicore workloads, all running on a Cortex-A55 cluster.
On an out-of-order cpu the results are a lot more noisy but show flat
performance or an improvement. On the set of DSP and embedded
benchmarks, run on a Cortex-A78 there was a very noisy 1% speed
improvement. Using the most detailed results I could find, SPEC2006 runs
on a Neoverse N1 show a small increase in instruction count (+0.127%),
but a decrease in cycle counts (-0.155%, on average). The instruction
count is very low noise, the cycle count is more noisy with a 0.15%
decrease not being significant. SPEC2k17 shows a small decrease (-0.2%)
in instruction count leading to a -0.296% decrease in cycle count. These
results are within noise margins but tend to show a small improvement in
general.
When specifying an Apple target, clang will set "-target-cpu apple-a7"
on the command line, so should not be affected by this change when
running from clang. This also doesn't enable more runtime unrolling like
-mcpu=cortex-a55 does, only changing the schedule used.
A lot of existing tests have updated. This is a summary of the important
differences:
- Most changes are the same instructions in a different order.
- Sometimes this leads to very minor inefficiencies, such as requiring
an extra mov to move variables into r0/v0 for the return value of a test
function.
- misched-fusion.ll was no longer fusing the pairs of instructions it
should, as per D110561. I've changed the schedule used in the test
for now.
- neon-mla-mls.ll now uses "mul; sub" as opposed to "neg; mla" due to
the different latencies. This seems fine to me.
- Some SVE tests do not always remove movprfx where they did before due
to different register allocation giving different destructive forms.
- The tests argument-blocks-array-of-struct.ll and arm64-windows-calls.ll
produce two LDR where they previously produced an LDP due to
store-pair-suppress kicking in.
- arm64-ldp.ll and arm64-neon-copy.ll are missing pre/postinc on LPD.
- Some tests such as arm64-neon-mul-div.ll and
ragreedy-local-interval-cost.ll have more, less or just different
spilling.
- In aarch64_generated_funcs.ll.generated.expected one part of the
function is no longer outlined. Interestingly if I switch this to use
any other scheduled even less is outlined.
Some of these are expected to happen, such as differences in outlining
or register spilling. There will be places where these result in worse
codegen, places where they are better, with the SPEC instruction counts
suggesting it is not a decrease overall, on average.
Differential Revision: https://reviews.llvm.org/D110830
143 lines
4.0 KiB
LLVM
143 lines
4.0 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
; RUN: llc < %s -mtriple=arm64-linux-gnu | FileCheck %s
|
|
; RUN: llc < %s -global-isel -mtriple=arm64-linux-gnu | FileCheck %s --check-prefix=GISEL
|
|
|
|
@x1 = external hidden global [2 x i64]
|
|
@x2 = external hidden global [16777216 x i64]
|
|
@x3 = external hidden global { [9 x i8*], [8 x i8*] }
|
|
|
|
define i64 @f1() {
|
|
; CHECK-LABEL: f1:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: adrp x8, x1+16
|
|
; CHECK-NEXT: ldr x0, [x8, :lo12:x1+16]
|
|
; CHECK-NEXT: ret
|
|
;
|
|
; GISEL-LABEL: f1:
|
|
; GISEL: // %bb.0:
|
|
; GISEL-NEXT: adrp x8, x1+16
|
|
; GISEL-NEXT: ldr x0, [x8, :lo12:x1+16]
|
|
; GISEL-NEXT: ret
|
|
%l = load i64, i64* getelementptr ([2 x i64], [2 x i64]* @x1, i64 0, i64 2)
|
|
ret i64 %l
|
|
}
|
|
|
|
define i64 @f2() {
|
|
; CHECK-LABEL: f2:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: adrp x8, x1
|
|
; CHECK-NEXT: add x8, x8, :lo12:x1
|
|
; CHECK-NEXT: ldr x0, [x8, #24]
|
|
; CHECK-NEXT: ret
|
|
;
|
|
; GISEL-LABEL: f2:
|
|
; GISEL: // %bb.0:
|
|
; GISEL-NEXT: adrp x8, x1
|
|
; GISEL-NEXT: add x8, x8, :lo12:x1
|
|
; GISEL-NEXT: ldr x0, [x8, #24]
|
|
; GISEL-NEXT: ret
|
|
|
|
%l = load i64, i64* getelementptr ([2 x i64], [2 x i64]* @x1, i64 0, i64 3)
|
|
ret i64 %l
|
|
}
|
|
|
|
define i64 @f3() {
|
|
; CHECK-LABEL: f3:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: adrp x8, x1+1
|
|
; CHECK-NEXT: add x8, x8, :lo12:x1+1
|
|
; CHECK-NEXT: ldr x0, [x8]
|
|
; CHECK-NEXT: ret
|
|
;
|
|
; GISEL-LABEL: f3:
|
|
; GISEL: // %bb.0:
|
|
; GISEL-NEXT: adrp x8, x1+1
|
|
; GISEL-NEXT: add x8, x8, :lo12:x1+1
|
|
; GISEL-NEXT: ldr x0, [x8]
|
|
; GISEL-NEXT: ret
|
|
%l = load i64, i64* bitcast (i8* getelementptr (i8, i8* bitcast ([2 x i64]* @x1 to i8*), i64 1) to i64*)
|
|
ret i64 %l
|
|
}
|
|
|
|
define [2 x i64] @f4() {
|
|
; FIXME: GlobalISel misses the opportunity to form a LDP here.
|
|
;
|
|
; CHECK-LABEL: f4:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: adrp x8, x2+8
|
|
; CHECK-NEXT: add x8, x8, :lo12:x2+8
|
|
; CHECK-NEXT: ldp x0, x1, [x8]
|
|
; CHECK-NEXT: ret
|
|
;
|
|
; GISEL-LABEL: f4:
|
|
; GISEL: // %bb.0:
|
|
; GISEL-NEXT: adrp x9, x2+8
|
|
; GISEL-NEXT: adrp x8, x2+8
|
|
; GISEL-NEXT: add x9, x9, :lo12:x2+8
|
|
; GISEL-NEXT: ldr x0, [x8, :lo12:x2+8]
|
|
; GISEL-NEXT: ldr x1, [x9, #8]
|
|
; GISEL-NEXT: ret
|
|
%l = load [2 x i64], [2 x i64]* bitcast (i8* getelementptr (i8, i8* bitcast ([16777216 x i64]* @x2 to i8*), i64 8) to [2 x i64]*)
|
|
ret [2 x i64] %l
|
|
}
|
|
|
|
define i64 @f5() {
|
|
; CHECK-LABEL: f5:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: adrp x8, x2+2097144
|
|
; CHECK-NEXT: ldr x0, [x8, :lo12:x2+2097144]
|
|
; CHECK-NEXT: ret
|
|
;
|
|
; GISEL-LABEL: f5:
|
|
; GISEL: // %bb.0:
|
|
; GISEL-NEXT: adrp x8, x2+2097144
|
|
; GISEL-NEXT: ldr x0, [x8, :lo12:x2+2097144]
|
|
; GISEL-NEXT: ret
|
|
%l = load i64, i64* getelementptr ([16777216 x i64], [16777216 x i64]* @x2, i64 0, i64 262143)
|
|
ret i64 %l
|
|
}
|
|
|
|
define i64 @f6() {
|
|
; CHECK-LABEL: f6:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: mov w8, #2097152
|
|
; CHECK-NEXT: adrp x9, x2
|
|
; CHECK-NEXT: add x9, x9, :lo12:x2
|
|
; CHECK-NEXT: ldr x0, [x9, x8]
|
|
; CHECK-NEXT: ret
|
|
;
|
|
; GISEL-LABEL: f6:
|
|
; GISEL: // %bb.0:
|
|
; GISEL-NEXT: mov w8, #2097152
|
|
; GISEL-NEXT: adrp x9, x2
|
|
; GISEL-NEXT: add x9, x9, :lo12:x2
|
|
; GISEL-NEXT: ldr x0, [x9, x8]
|
|
; GISEL-NEXT: ret
|
|
%l = load i64, i64* getelementptr ([16777216 x i64], [16777216 x i64]* @x2, i64 0, i64 262144)
|
|
ret i64 %l
|
|
}
|
|
|
|
define i32 @f7() {
|
|
; FIXME: GlobalISel doesn't handle vectors well.
|
|
;
|
|
; CHECK-LABEL: f7:
|
|
; CHECK: // %bb.0: // %entry
|
|
; CHECK-NEXT: adrp x8, x3+108
|
|
; CHECK-NEXT: ldr w0, [x8, :lo12:x3+108]
|
|
; CHECK-NEXT: ret
|
|
;
|
|
; GISEL-LABEL: f7:
|
|
; GISEL: // %bb.0: // %entry
|
|
; GISEL-NEXT: adrp x8, x3+88
|
|
; GISEL-NEXT: add x8, x8, :lo12:x3+88
|
|
; GISEL-NEXT: mov v0.d[1], x8
|
|
; GISEL-NEXT: mov d0, v0.d[1]
|
|
; GISEL-NEXT: fmov x8, d0
|
|
; GISEL-NEXT: ldr w0, [x8, #20]
|
|
; GISEL-NEXT: ret
|
|
|
|
entry:
|
|
%l = load i32, i32* getelementptr (i32, i32* inttoptr (i64 trunc (i128 lshr (i128 bitcast (<2 x i64> <i64 undef, i64 ptrtoint (i8** getelementptr inbounds ({ [9 x i8*], [8 x i8*] }, { [9 x i8*], [8 x i8*] }* @x3, i64 0, inrange i32 1, i64 2) to i64)> to i128), i128 64) to i64) to i32*), i64 5)
|
|
ret i32 %l
|
|
}
|