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
212 lines
5.5 KiB
LLVM
212 lines
5.5 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
; RUN: llc -mtriple=arm64-eabi < %s | FileCheck %s
|
|
; rdar://10232252
|
|
|
|
@object = external hidden global i64, section "__DATA, __objc_ivar", align 8
|
|
|
|
; base + offset (imm9)
|
|
define void @t1(i64* %object) {
|
|
; CHECK-LABEL: t1:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: ldr xzr, [x0, #8]
|
|
; CHECK-NEXT: ret
|
|
%incdec.ptr = getelementptr inbounds i64, i64* %object, i64 1
|
|
%tmp = load volatile i64, i64* %incdec.ptr, align 8
|
|
ret void
|
|
}
|
|
|
|
; base + offset (> imm9)
|
|
define void @t2(i64* %object) {
|
|
; CHECK-LABEL: t2:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: sub x8, x0, #264
|
|
; CHECK-NEXT: ldr xzr, [x8]
|
|
; CHECK-NEXT: ret
|
|
%incdec.ptr = getelementptr inbounds i64, i64* %object, i64 -33
|
|
%tmp = load volatile i64, i64* %incdec.ptr, align 8
|
|
ret void
|
|
}
|
|
|
|
; base + unsigned offset (> imm9 and <= imm12 * size of type in bytes)
|
|
define void @t3(i64* %object) {
|
|
; CHECK-LABEL: t3:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: ldr xzr, [x0, #32760]
|
|
; CHECK-NEXT: ret
|
|
%incdec.ptr = getelementptr inbounds i64, i64* %object, i64 4095
|
|
%tmp = load volatile i64, i64* %incdec.ptr, align 8
|
|
ret void
|
|
}
|
|
|
|
; base + unsigned offset (> imm12 * size of type in bytes)
|
|
define void @t4(i64* %object) {
|
|
; CHECK-LABEL: t4:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: mov w8, #32768
|
|
; CHECK-NEXT: ldr xzr, [x0, x8]
|
|
; CHECK-NEXT: ret
|
|
%incdec.ptr = getelementptr inbounds i64, i64* %object, i64 4096
|
|
%tmp = load volatile i64, i64* %incdec.ptr, align 8
|
|
ret void
|
|
}
|
|
|
|
; base + reg
|
|
define void @t5(i64 %a) {
|
|
; CHECK-LABEL: t5:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: adrp x8, object
|
|
; CHECK-NEXT: add x8, x8, :lo12:object
|
|
; CHECK-NEXT: ldr xzr, [x8, x0, lsl #3]
|
|
; CHECK-NEXT: ret
|
|
%incdec.ptr = getelementptr inbounds i64, i64* @object, i64 %a
|
|
%tmp = load volatile i64, i64* %incdec.ptr, align 8
|
|
ret void
|
|
}
|
|
|
|
; base + reg + imm
|
|
define void @t6(i64 %a, i64* %object) {
|
|
; CHECK-LABEL: t6:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: mov w8, #32768
|
|
; CHECK-NEXT: add x9, x1, x0, lsl #3
|
|
; CHECK-NEXT: ldr xzr, [x9, x8]
|
|
; CHECK-NEXT: ret
|
|
%tmp1 = getelementptr inbounds i64, i64* %object, i64 %a
|
|
%incdec.ptr = getelementptr inbounds i64, i64* %tmp1, i64 4096
|
|
%tmp = load volatile i64, i64* %incdec.ptr, align 8
|
|
ret void
|
|
}
|
|
|
|
; Test base + wide immediate
|
|
define void @t7(i64 %a) {
|
|
; CHECK-LABEL: t7:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: mov w8, #65535
|
|
; CHECK-NEXT: ldr xzr, [x0, x8]
|
|
; CHECK-NEXT: ret
|
|
%1 = add i64 %a, 65535 ;0xffff
|
|
%2 = inttoptr i64 %1 to i64*
|
|
%3 = load volatile i64, i64* %2, align 8
|
|
ret void
|
|
}
|
|
|
|
define void @t8(i64 %a) {
|
|
; CHECK-LABEL: t8:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: mov x8, #-4662
|
|
; CHECK-NEXT: ldr xzr, [x0, x8]
|
|
; CHECK-NEXT: ret
|
|
%1 = sub i64 %a, 4662 ;-4662 is 0xffffffffffffedca
|
|
%2 = inttoptr i64 %1 to i64*
|
|
%3 = load volatile i64, i64* %2, align 8
|
|
ret void
|
|
}
|
|
|
|
define void @t9(i64 %a) {
|
|
; CHECK-LABEL: t9:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: mov x8, #-305463297
|
|
; CHECK-NEXT: ldr xzr, [x0, x8]
|
|
; CHECK-NEXT: ret
|
|
%1 = add i64 -305463297, %a ;-305463297 is 0xffffffffedcaffff
|
|
%2 = inttoptr i64 %1 to i64*
|
|
%3 = load volatile i64, i64* %2, align 8
|
|
ret void
|
|
}
|
|
|
|
define void @t10(i64 %a) {
|
|
; CHECK-LABEL: t10:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: mov x8, #81909218222800896
|
|
; CHECK-NEXT: ldr xzr, [x0, x8]
|
|
; CHECK-NEXT: ret
|
|
%1 = add i64 %a, 81909218222800896 ;0x123000000000000
|
|
%2 = inttoptr i64 %1 to i64*
|
|
%3 = load volatile i64, i64* %2, align 8
|
|
ret void
|
|
}
|
|
|
|
define void @t11(i64 %a) {
|
|
; CHECK-LABEL: t11:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: mov w8, #17767
|
|
; CHECK-NEXT: movk w8, #291, lsl #16
|
|
; CHECK-NEXT: ldr xzr, [x0, x8]
|
|
; CHECK-NEXT: ret
|
|
%1 = add i64 %a, 19088743 ;0x1234567
|
|
%2 = inttoptr i64 %1 to i64*
|
|
%3 = load volatile i64, i64* %2, align 8
|
|
ret void
|
|
}
|
|
|
|
; Test some boundaries that should not use movz/movn/orr
|
|
define void @t12(i64 %a) {
|
|
; CHECK-LABEL: t12:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: add x8, x0, #4095
|
|
; CHECK-NEXT: ldr xzr, [x8]
|
|
; CHECK-NEXT: ret
|
|
%1 = add i64 %a, 4095 ;0xfff
|
|
%2 = inttoptr i64 %1 to i64*
|
|
%3 = load volatile i64, i64* %2, align 8
|
|
ret void
|
|
}
|
|
|
|
define void @t13(i64 %a) {
|
|
; CHECK-LABEL: t13:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: sub x8, x0, #4095
|
|
; CHECK-NEXT: ldr xzr, [x8]
|
|
; CHECK-NEXT: ret
|
|
%1 = add i64 %a, -4095 ;-0xfff
|
|
%2 = inttoptr i64 %1 to i64*
|
|
%3 = load volatile i64, i64* %2, align 8
|
|
ret void
|
|
}
|
|
|
|
define void @t14(i64 %a) {
|
|
; CHECK-LABEL: t14:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: add x8, x0, #291, lsl #12 // =1191936
|
|
; CHECK-NEXT: ldr xzr, [x8]
|
|
; CHECK-NEXT: ret
|
|
%1 = add i64 %a, 1191936 ;0x123000
|
|
%2 = inttoptr i64 %1 to i64*
|
|
%3 = load volatile i64, i64* %2, align 8
|
|
ret void
|
|
}
|
|
|
|
define void @t15(i64 %a) {
|
|
; CHECK-LABEL: t15:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: sub x8, x0, #291, lsl #12 // =1191936
|
|
; CHECK-NEXT: ldr xzr, [x8]
|
|
; CHECK-NEXT: ret
|
|
%1 = add i64 %a, -1191936 ;0xFFFFFFFFFFEDD000
|
|
%2 = inttoptr i64 %1 to i64*
|
|
%3 = load volatile i64, i64* %2, align 8
|
|
ret void
|
|
}
|
|
|
|
define void @t16(i64 %a) {
|
|
; CHECK-LABEL: t16:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: ldr xzr, [x0, #28672]
|
|
; CHECK-NEXT: ret
|
|
%1 = add i64 %a, 28672 ;0x7000
|
|
%2 = inttoptr i64 %1 to i64*
|
|
%3 = load volatile i64, i64* %2, align 8
|
|
ret void
|
|
}
|
|
|
|
define void @t17(i64 %a) {
|
|
; CHECK-LABEL: t17:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: ldur xzr, [x0, #-256]
|
|
; CHECK-NEXT: ret
|
|
%1 = add i64 %a, -256 ;-0x100
|
|
%2 = inttoptr i64 %1 to i64*
|
|
%3 = load volatile i64, i64* %2, align 8
|
|
ret void
|
|
}
|