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
121 lines
4.7 KiB
LLVM
121 lines
4.7 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
; RUN: llc < %s -mtriple=arm64-- | FileCheck %s
|
|
|
|
; This test provides fmf coverage for DAG combining of selects
|
|
|
|
; select Cond0, (select Cond1, X, Y), Y -> select (and Cond0, Cond1), X, Y
|
|
define float @select_select_fold_select_and(float %w, float %x, float %y, float %z) {
|
|
; CHECK-LABEL: select_select_fold_select_and:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: fminnm s5, s1, s2
|
|
; CHECK-NEXT: fcmp s1, s2
|
|
; CHECK-NEXT: fmaxnm s1, s0, s3
|
|
; CHECK-NEXT: fmov s4, #0.50000000
|
|
; CHECK-NEXT: fccmp s5, s0, #4, lt
|
|
; CHECK-NEXT: fcsel s2, s1, s0, gt
|
|
; CHECK-NEXT: fadd s1, s0, s4
|
|
; CHECK-NEXT: fadd s4, s1, s2
|
|
; CHECK-NEXT: fcmp s4, s1
|
|
; CHECK-NEXT: b.le .LBB0_2
|
|
; CHECK-NEXT: // %bb.1: // %if.then.i157.i.i
|
|
; CHECK-NEXT: fmov s0, #1.00000000
|
|
; CHECK-NEXT: fadd s0, s2, s0
|
|
; CHECK-NEXT: ret
|
|
; CHECK-NEXT: .LBB0_2: // %if.end.i159.i.i
|
|
; CHECK-NEXT: mov w8, #52429
|
|
; CHECK-NEXT: mov w9, #13107
|
|
; CHECK-NEXT: movk w8, #48844, lsl #16
|
|
; CHECK-NEXT: movk w9, #48819, lsl #16
|
|
; CHECK-NEXT: fcmp s1, #0.0
|
|
; CHECK-NEXT: fmov s2, w8
|
|
; CHECK-NEXT: fmov s4, w9
|
|
; CHECK-NEXT: fadd s0, s0, s2
|
|
; CHECK-NEXT: fadd s2, s3, s4
|
|
; CHECK-NEXT: fcsel s0, s0, s2, gt
|
|
; CHECK-NEXT: ret
|
|
%tmp21 = fcmp fast olt float %x, %y
|
|
%tmp22 = select fast i1 %tmp21, float %x, float %y
|
|
%tmp24 = fcmp fast ogt float %tmp22, %w
|
|
%tmp78 = fcmp fast ogt float %w, %z
|
|
%select0 = select fast i1 %tmp78, float %w, float %z
|
|
%select1 = select fast i1 %tmp21, float %select0, float %w
|
|
%select2 = select fast i1 %tmp24, float %select1, float %w
|
|
%tmp82 = fadd fast float %w, 5.000000e-01
|
|
%tmp102 = fadd fast float %tmp82, %select2
|
|
%cmp.i155.i.i = fcmp fast ogt float %tmp102, %tmp82
|
|
br i1 %cmp.i155.i.i, label %if.then.i157.i.i, label %if.end.i159.i.i
|
|
|
|
if.then.i157.i.i: ; preds = %0
|
|
%add.i156.i.i = fadd fast float %select2, 1.000000e+00
|
|
br label %exit
|
|
|
|
if.end.i159.i.i: ; preds = %0
|
|
%sub.i158.i.i = fadd fast float %w, 0xBFD99999A0000000
|
|
%sub15.i.i.i = fadd fast float %z, 0xBFD6666660000000
|
|
%tmp191 = fcmp fast ogt float %tmp82, 0.000000e+00
|
|
%select3 = select fast i1 %tmp191, float %sub.i158.i.i, float %sub15.i.i.i
|
|
br label %exit
|
|
|
|
exit: ; preds = %if.end.i159.i.i, %if.then.i157.i.i
|
|
%phi1 = phi float [ %add.i156.i.i, %if.then.i157.i.i ], [ %select3, %if.end.i159.i.i ]
|
|
ret float %phi1
|
|
}
|
|
|
|
; select Cond0, X, (select Cond1, X, Y) -> select (or Cond0, Cond1), X, Y
|
|
define float @select_select_fold_select_or(float %w, float %x, float %y, float %z) {
|
|
; CHECK-LABEL: select_select_fold_select_or:
|
|
; CHECK: // %bb.0:
|
|
; CHECK-NEXT: fminnm s5, s1, s2
|
|
; CHECK-NEXT: fcmp s1, s2
|
|
; CHECK-NEXT: fmaxnm s1, s0, s3
|
|
; CHECK-NEXT: fmov s4, #0.50000000
|
|
; CHECK-NEXT: fccmp s5, s0, #0, ge
|
|
; CHECK-NEXT: fcsel s2, s0, s1, gt
|
|
; CHECK-NEXT: fadd s1, s0, s4
|
|
; CHECK-NEXT: fadd s4, s1, s2
|
|
; CHECK-NEXT: fcmp s4, s1
|
|
; CHECK-NEXT: b.le .LBB1_2
|
|
; CHECK-NEXT: // %bb.1: // %if.then.i157.i.i
|
|
; CHECK-NEXT: fmov s0, #1.00000000
|
|
; CHECK-NEXT: fadd s0, s2, s0
|
|
; CHECK-NEXT: ret
|
|
; CHECK-NEXT: .LBB1_2: // %if.end.i159.i.i
|
|
; CHECK-NEXT: mov w8, #52429
|
|
; CHECK-NEXT: mov w9, #13107
|
|
; CHECK-NEXT: movk w8, #48844, lsl #16
|
|
; CHECK-NEXT: movk w9, #48819, lsl #16
|
|
; CHECK-NEXT: fcmp s1, #0.0
|
|
; CHECK-NEXT: fmov s2, w8
|
|
; CHECK-NEXT: fmov s4, w9
|
|
; CHECK-NEXT: fadd s0, s0, s2
|
|
; CHECK-NEXT: fadd s2, s3, s4
|
|
; CHECK-NEXT: fcsel s0, s0, s2, gt
|
|
; CHECK-NEXT: ret
|
|
%tmp21 = fcmp fast olt float %x, %y
|
|
%tmp22 = select fast i1 %tmp21, float %x, float %y
|
|
%tmp24 = fcmp fast ogt float %tmp22, %w
|
|
%tmp78 = fcmp fast ogt float %w, %z
|
|
%select0 = select fast i1 %tmp78, float %w, float %z
|
|
%select1 = select fast i1 %tmp21, float %w, float %select0
|
|
%select2 = select fast i1 %tmp24, float %w, float %select1
|
|
%tmp82 = fadd fast float %w, 5.000000e-01
|
|
%tmp102 = fadd fast float %tmp82, %select2
|
|
%cmp.i155.i.i = fcmp fast ogt float %tmp102, %tmp82
|
|
br i1 %cmp.i155.i.i, label %if.then.i157.i.i, label %if.end.i159.i.i
|
|
|
|
if.then.i157.i.i: ; preds = %0
|
|
%add.i156.i.i = fadd fast float %select2, 1.000000e+00
|
|
br label %exit
|
|
|
|
if.end.i159.i.i: ; preds = %0
|
|
%sub.i158.i.i = fadd fast float %w, 0xBFD99999A0000000
|
|
%sub15.i.i.i = fadd fast float %z, 0xBFD6666660000000
|
|
%tmp191 = fcmp fast ogt float %tmp82, 0.000000e+00
|
|
%select3 = select fast i1 %tmp191, float %sub.i158.i.i, float %sub15.i.i.i
|
|
br label %exit
|
|
|
|
exit: ; preds = %if.end.i159.i.i, %if.then.i157.i.i
|
|
%phi1 = phi float [ %add.i156.i.i, %if.then.i157.i.i ], [ %select3, %if.end.i159.i.i ]
|
|
ret float %phi1
|
|
}
|