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 eecb353d0e25ba 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
252 lines
7.4 KiB
LLVM
252 lines
7.4 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
; RUN: llc -verify-machineinstrs -o - -mtriple=aarch64-none-linux-gnu -code-model=tiny < %s | FileCheck %s
|
|
; RUN: llc -verify-machineinstrs -o - -mtriple=aarch64-none-linux-gnu -code-model=tiny -fast-isel < %s | FileCheck %s
|
|
; RUN: llc -verify-machineinstrs -o - -mtriple=aarch64-none-linux-gnu -code-model=tiny -global-isel < %s | FileCheck %s --check-prefix=CHECK-GLOBISEL
|
|
|
|
; Note fast-isel tests here will fall back to isel
|
|
|
|
@src = external local_unnamed_addr global [65536 x i8], align 1
|
|
@dst = external global [65536 x i8], align 1
|
|
@ptr = external local_unnamed_addr global i8*, align 8
|
|
|
|
define dso_local void @foo1() {
|
|
; CHECK-LABEL: foo1:
|
|
; CHECK: // %bb.0: // %entry
|
|
; CHECK-NEXT: ldr x8, :got:src
|
|
; CHECK-NEXT: ldrb w8, [x8]
|
|
; CHECK-NEXT: ldr x9, :got:dst
|
|
; CHECK-NEXT: strb w8, [x9]
|
|
; CHECK-NEXT: ret
|
|
;
|
|
; CHECK-GLOBISEL-LABEL: foo1:
|
|
; CHECK-GLOBISEL: // %bb.0: // %entry
|
|
; CHECK-GLOBISEL-NEXT: ldr x8, :got:src
|
|
; CHECK-GLOBISEL-NEXT: ldrb w8, [x8]
|
|
; CHECK-GLOBISEL-NEXT: ldr x9, :got:dst
|
|
; CHECK-GLOBISEL-NEXT: strb w8, [x9]
|
|
; CHECK-GLOBISEL-NEXT: ret
|
|
entry:
|
|
%0 = load i8, i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @src, i64 0, i64 0), align 1
|
|
store i8 %0, i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dst, i64 0, i64 0), align 1
|
|
ret void
|
|
}
|
|
|
|
define dso_local void @foo2() {
|
|
; CHECK-LABEL: foo2:
|
|
; CHECK: // %bb.0: // %entry
|
|
; CHECK-NEXT: ldr x8, :got:ptr
|
|
; CHECK-NEXT: ldr x9, :got:dst
|
|
; CHECK-NEXT: str x9, [x8]
|
|
; CHECK-NEXT: ret
|
|
;
|
|
; CHECK-GLOBISEL-LABEL: foo2:
|
|
; CHECK-GLOBISEL: // %bb.0: // %entry
|
|
; CHECK-GLOBISEL-NEXT: ldr x8, :got:ptr
|
|
; CHECK-GLOBISEL-NEXT: ldr x9, :got:dst
|
|
; CHECK-GLOBISEL-NEXT: str x9, [x8]
|
|
; CHECK-GLOBISEL-NEXT: ret
|
|
entry:
|
|
store i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @dst, i64 0, i64 0), i8** @ptr, align 8
|
|
ret void
|
|
}
|
|
|
|
define dso_local void @foo3() {
|
|
; FIXME: Needn't adr ptr
|
|
;
|
|
; CHECK-LABEL: foo3:
|
|
; CHECK: // %bb.0: // %entry
|
|
; CHECK-NEXT: ldr x8, :got:src
|
|
; CHECK-NEXT: ldr x9, :got:ptr
|
|
; CHECK-NEXT: ldrb w8, [x8]
|
|
; CHECK-NEXT: ldr x9, [x9]
|
|
; CHECK-NEXT: strb w8, [x9]
|
|
; CHECK-NEXT: ret
|
|
;
|
|
; CHECK-GLOBISEL-LABEL: foo3:
|
|
; CHECK-GLOBISEL: // %bb.0: // %entry
|
|
; CHECK-GLOBISEL-NEXT: ldr x8, :got:src
|
|
; CHECK-GLOBISEL-NEXT: ldr x9, :got:ptr
|
|
; CHECK-GLOBISEL-NEXT: ldrb w8, [x8]
|
|
; CHECK-GLOBISEL-NEXT: ldr x9, [x9]
|
|
; CHECK-GLOBISEL-NEXT: strb w8, [x9]
|
|
; CHECK-GLOBISEL-NEXT: ret
|
|
entry:
|
|
%0 = load i8, i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @src, i64 0, i64 0), align 1
|
|
%1 = load i8*, i8** @ptr, align 8
|
|
store i8 %0, i8* %1, align 1
|
|
ret void
|
|
}
|
|
|
|
@lsrc = internal global i8 0, align 4
|
|
@ldst = internal global i8 0, align 4
|
|
@lptr = internal global i8* null, align 8
|
|
|
|
define dso_local void @bar1() {
|
|
; CHECK-LABEL: bar1:
|
|
; CHECK: // %bb.0: // %entry
|
|
; CHECK-NEXT: adr x8, lsrc
|
|
; CHECK-NEXT: adr x9, ldst
|
|
; CHECK-NEXT: ldrb w8, [x8]
|
|
; CHECK-NEXT: strb w8, [x9]
|
|
; CHECK-NEXT: ret
|
|
;
|
|
; CHECK-GLOBISEL-LABEL: bar1:
|
|
; CHECK-GLOBISEL: // %bb.0: // %entry
|
|
; CHECK-GLOBISEL-NEXT: adr x8, lsrc
|
|
; CHECK-GLOBISEL-NEXT: adr x9, ldst
|
|
; CHECK-GLOBISEL-NEXT: ldrb w8, [x8]
|
|
; CHECK-GLOBISEL-NEXT: strb w8, [x9]
|
|
; CHECK-GLOBISEL-NEXT: ret
|
|
entry:
|
|
%0 = load i8, i8* @lsrc, align 4
|
|
store i8 %0, i8* @ldst, align 4
|
|
ret void
|
|
}
|
|
|
|
define dso_local void @bar2() {
|
|
; CHECK-LABEL: bar2:
|
|
; CHECK: // %bb.0: // %entry
|
|
; CHECK-NEXT: adr x8, lptr
|
|
; CHECK-NEXT: adr x9, ldst
|
|
; CHECK-NEXT: str x9, [x8]
|
|
; CHECK-NEXT: ret
|
|
;
|
|
; CHECK-GLOBISEL-LABEL: bar2:
|
|
; CHECK-GLOBISEL: // %bb.0: // %entry
|
|
; CHECK-GLOBISEL-NEXT: adr x8, lptr
|
|
; CHECK-GLOBISEL-NEXT: adr x9, ldst
|
|
; CHECK-GLOBISEL-NEXT: str x9, [x8]
|
|
; CHECK-GLOBISEL-NEXT: ret
|
|
entry:
|
|
store i8* @ldst, i8** @lptr, align 8
|
|
ret void
|
|
}
|
|
|
|
define dso_local void @bar3() {
|
|
; FIXME: Needn't adr lptr
|
|
;
|
|
; CHECK-LABEL: bar3:
|
|
; CHECK: // %bb.0: // %entry
|
|
; CHECK-NEXT: adr x8, lsrc
|
|
; CHECK-NEXT: ldr x9, lptr
|
|
; CHECK-NEXT: ldrb w8, [x8]
|
|
; CHECK-NEXT: strb w8, [x9]
|
|
; CHECK-NEXT: ret
|
|
;
|
|
; CHECK-GLOBISEL-LABEL: bar3:
|
|
; CHECK-GLOBISEL: // %bb.0: // %entry
|
|
; CHECK-GLOBISEL-NEXT: adr x8, lsrc
|
|
; CHECK-GLOBISEL-NEXT: adr x9, lptr
|
|
; CHECK-GLOBISEL-NEXT: ldrb w8, [x8]
|
|
; CHECK-GLOBISEL-NEXT: ldr x9, [x9]
|
|
; CHECK-GLOBISEL-NEXT: strb w8, [x9]
|
|
; CHECK-GLOBISEL-NEXT: ret
|
|
entry:
|
|
%0 = load i8, i8* @lsrc, align 4
|
|
%1 = load i8*, i8** @lptr, align 8
|
|
store i8 %0, i8* %1, align 1
|
|
ret void
|
|
}
|
|
|
|
|
|
@lbsrc = internal global [65536 x i8] zeroinitializer, align 4
|
|
@lbdst = internal global [65536 x i8] zeroinitializer, align 4
|
|
|
|
define dso_local void @baz1() {
|
|
; CHECK-LABEL: baz1:
|
|
; CHECK: // %bb.0: // %entry
|
|
; CHECK-NEXT: adr x8, lbsrc
|
|
; CHECK-NEXT: adr x9, lbdst
|
|
; CHECK-NEXT: ldrb w8, [x8]
|
|
; CHECK-NEXT: strb w8, [x9]
|
|
; CHECK-NEXT: ret
|
|
;
|
|
; CHECK-GLOBISEL-LABEL: baz1:
|
|
; CHECK-GLOBISEL: // %bb.0: // %entry
|
|
; CHECK-GLOBISEL-NEXT: adr x8, lbsrc
|
|
; CHECK-GLOBISEL-NEXT: adr x9, lbdst
|
|
; CHECK-GLOBISEL-NEXT: ldrb w8, [x8]
|
|
; CHECK-GLOBISEL-NEXT: strb w8, [x9]
|
|
; CHECK-GLOBISEL-NEXT: ret
|
|
entry:
|
|
%0 = load i8, i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @lbsrc, i64 0, i64 0), align 4
|
|
store i8 %0, i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @lbdst, i64 0, i64 0), align 4
|
|
ret void
|
|
}
|
|
|
|
define dso_local void @baz2() {
|
|
; CHECK-LABEL: baz2:
|
|
; CHECK: // %bb.0: // %entry
|
|
; CHECK-NEXT: adr x8, lptr
|
|
; CHECK-NEXT: adr x9, lbdst
|
|
; CHECK-NEXT: str x9, [x8]
|
|
; CHECK-NEXT: ret
|
|
;
|
|
; CHECK-GLOBISEL-LABEL: baz2:
|
|
; CHECK-GLOBISEL: // %bb.0: // %entry
|
|
; CHECK-GLOBISEL-NEXT: adr x8, lptr
|
|
; CHECK-GLOBISEL-NEXT: adr x9, lbdst
|
|
; CHECK-GLOBISEL-NEXT: str x9, [x8]
|
|
; CHECK-GLOBISEL-NEXT: ret
|
|
entry:
|
|
store i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @lbdst, i64 0, i64 0), i8** @lptr, align 8
|
|
ret void
|
|
}
|
|
|
|
define dso_local void @baz3() {
|
|
; FIXME: Needn't adr lptr
|
|
;
|
|
; CHECK-LABEL: baz3:
|
|
; CHECK: // %bb.0: // %entry
|
|
; CHECK-NEXT: adr x8, lbsrc
|
|
; CHECK-NEXT: ldr x9, lptr
|
|
; CHECK-NEXT: ldrb w8, [x8]
|
|
; CHECK-NEXT: strb w8, [x9]
|
|
; CHECK-NEXT: ret
|
|
;
|
|
; CHECK-GLOBISEL-LABEL: baz3:
|
|
; CHECK-GLOBISEL: // %bb.0: // %entry
|
|
; CHECK-GLOBISEL-NEXT: adr x8, lbsrc
|
|
; CHECK-GLOBISEL-NEXT: adr x9, lptr
|
|
; CHECK-GLOBISEL-NEXT: ldrb w8, [x8]
|
|
; CHECK-GLOBISEL-NEXT: ldr x9, [x9]
|
|
; CHECK-GLOBISEL-NEXT: strb w8, [x9]
|
|
; CHECK-GLOBISEL-NEXT: ret
|
|
entry:
|
|
%0 = load i8, i8* getelementptr inbounds ([65536 x i8], [65536 x i8]* @lbsrc, i64 0, i64 0), align 4
|
|
%1 = load i8*, i8** @lptr, align 8
|
|
store i8 %0, i8* %1, align 1
|
|
ret void
|
|
}
|
|
|
|
|
|
declare void @func(...)
|
|
|
|
define dso_local i8* @externfuncaddr() {
|
|
; CHECK-LABEL: externfuncaddr:
|
|
; CHECK: // %bb.0: // %entry
|
|
; CHECK-NEXT: ldr x0, :got:func
|
|
; CHECK-NEXT: ret
|
|
;
|
|
; CHECK-GLOBISEL-LABEL: externfuncaddr:
|
|
; CHECK-GLOBISEL: // %bb.0: // %entry
|
|
; CHECK-GLOBISEL-NEXT: ldr x0, :got:func
|
|
; CHECK-GLOBISEL-NEXT: ret
|
|
entry:
|
|
ret i8* bitcast (void (...)* @func to i8*)
|
|
}
|
|
|
|
define dso_local i8* @localfuncaddr() {
|
|
; CHECK-LABEL: localfuncaddr:
|
|
; CHECK: // %bb.0: // %entry
|
|
; CHECK-NEXT: adr x0, externfuncaddr
|
|
; CHECK-NEXT: ret
|
|
;
|
|
; CHECK-GLOBISEL-LABEL: localfuncaddr:
|
|
; CHECK-GLOBISEL: // %bb.0: // %entry
|
|
; CHECK-GLOBISEL-NEXT: adr x0, externfuncaddr
|
|
; CHECK-GLOBISEL-NEXT: ret
|
|
entry:
|
|
ret i8* bitcast (i8* ()* @externfuncaddr to i8*)
|
|
}
|