[PATCH 4/4][AArch64] Cost CCMP instruction sequences to choose better expand order
James Greenhalgh
james.greenhalgh@arm.com
Wed Feb 3 09:58:00 GMT 2016
On Thu, Jan 28, 2016 at 02:33:20PM +0000, James Greenhalgh wrote:
> On Mon, Jan 25, 2016 at 08:09:39PM +0000, Wilco Dijkstra wrote:
> > Andreas Schwab <schwab@linux-m68k.org> wrote:
> >
> > > FAIL: gcc.target/aarch64/ccmp_1.c scan-assembler-times \tcmp\tw[0-9]+, 0 4
> > > FAIL: gcc.target/aarch64/ccmp_1.c scan-assembler adds\t
> > > FAIL: gcc.target/aarch64/ccmp_1.c scan-assembler-times fccmpe\t.*0\\.0 1
> >
> > Yes I noticed those too, and here is the fix. Richard's recent change added
> > UNSPEC to the CCMP patterns to stop combine optimizing the CCMP CCmode
> > immediate in a rare case. This requires a change to the CCMP cost calculation
> > as the CCMP instruction with unspec is no longer recognized.
> >
> > Fix the ccmp_1.c test to allow both '0' and 'wzr' on cmp - BTW is there a
> > regular expression that correctly implements (0|xzr)? If I use that the test
> > still fails somehow but \[0wzr\]+ works fine... Is the correct syntax
> > documented somewhere?
> >
> > Finally to ensure FCCMPE is emitted on relational compares, add
> > -ffinite-math-only.
> >
> > ChangeLog:
> > 2016-01-25 Wilco Dijkstra <wdijkstr@arm.com>
> >
> > gcc/
> > * config/aarch64/aarch64.c (aarch64_if_then_else_costs):
> > Remove CONST_INT_P check in CCMP cost calculation.
> >
> > gcc/testsuite/
> > * gcc.target/aarch64/ccmp_1.c: Fix test issues.
I'm still seeing:
FAIL: gcc.target/aarch64/ccmp_1.c scan-assembler-times \\tcmp\\tw[0-9]+, (0|wzr) 4
Looking at the assembly generated for me with this testcase I see ccmp
with zero in 5 places:
f3:
cmp w1, 34
ccmp w0, 19, 0, eq
cset w0, eq
ret
f4:
cmp w0, 35
ccmp w1, 20, 0, eq
cset w0, eq
ret
f7:
cmp w0, 0
ccmp w1, 7, 0, eq
cset w0, eq
ret
f8:
cmp w1, 0
ccmp w0, 9, 0, eq
cset w0, eq
ret
f11:
fcmpe d0, #0.0
ccmp w0, 30, 0, mi
cset w0, eq
ret
Are these all expected? If so, can you spin the "obvious" patch to bump
this number to 5.
Thanks,
James
More information about the Gcc-patches
mailing list